Commit 24bfe140 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

Decode alpha coverage

parent 003d2bdf
......@@ -90,16 +90,16 @@ enum mali_alt_func {
/* Flags apply to unknown2_3? */
#define MALI_HAS_MSAA (1 << 16)
#define MALI_CAN_DISCARD (1 << 21)
#define MALI_HAS_BLEND_SHADER (1 << 22)
#define MALI_HAS_MSAA (1 << 0)
#define MALI_CAN_DISCARD (1 << 5)
#define MALI_HAS_BLEND_SHADER (1 << 6)
/* func is mali_func */
#define MALI_DEPTH_FUNC(func) (func << 24)
#define MALI_GET_DEPTH_FUNC(flags) ((flags >> 24) & 0x7)
#define MALI_DEPTH_FUNC(func) (func << 8)
#define MALI_GET_DEPTH_FUNC(flags) ((flags >> 8) & 0x7)
#define MALI_DEPTH_FUNC_MASK MALI_DEPTH_FUNC(0x7)
#define MALI_DEPTH_TEST (1 << 27)
#define MALI_DEPTH_TEST (1 << 11)
/* Next flags to unknown2_4 */
#define MALI_STENCIL_TEST (1 << 16)
......@@ -161,6 +161,13 @@ struct mali_blend_equation {
unsigned zero : 32;
};
/* Alpha coverage is encoded as 4-bits (from a clampf), with inversion
* literally performing a bitwise invert. This function produces slightly wrong
* results and I'm not sure why; some rounding issue I suppose... */
#define MALI_ALPHA_COVERAGE(clampf) ((uint16_t) (int) (clampf * 15.0f))
#define MALI_GET_ALPHA_COVERAGE(nibble) ((float) nibble / 15.0f)
struct mali_shader_meta {
mali_ptr shader;
u32 zero1;
......@@ -188,7 +195,10 @@ struct mali_shader_meta {
float depth_factor;
u32 unknown2_2;
u32 unknown2_3;
u16 alpha_coverage;
u16 unknown2_3;
u32 unknown2_4;
struct mali_stencil_test stencil_front;
......
......@@ -510,6 +510,13 @@ panwrap_replay_vertex_or_tiler_job(const struct mali_job_descriptor_header *h,
panwrap_prop("depth_factor = %f", s->depth_factor);
}
bool invert_alpha_coverage = s->alpha_coverage & 0xFFF0;
uint16_t inverted_coverage = invert_alpha_coverage ? ~s->alpha_coverage : s->alpha_coverage;
panwrap_prop("alpha_coverage = %sMALI_ALPHA_COVERAGE(%f)",
invert_alpha_coverage ? "~" : "",
MALI_GET_ALPHA_COVERAGE(inverted_coverage));
panwrap_log(".unknown2_3 = ");
int unknown2_3 = s->unknown2_3;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment