Commit fd23f27a authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

Decode texture compare func and wrap modes

parent 84a7b176
......@@ -75,6 +75,19 @@ enum mali_func {
MALI_FUNC_ALWAYS = 7
};
/* Same OpenGL, but mixed up. Why? Because forget me, that's why! */
enum mali_alt_func {
MALI_ALT_FUNC_NEVER = 0,
MALI_ALT_FUNC_GREATER = 1,
MALI_ALT_FUNC_EQUAL = 2,
MALI_ALT_FUNC_GEQUAL = 3,
MALI_ALT_FUNC_LESS = 4,
MALI_ALT_FUNC_NOTEQUAL = 5,
MALI_ALT_FUNC_LEQUAL = 6,
MALI_ALT_FUNC_ALWAYS = 7
};
/* Flags apply to unknown2_3? */
#define MALI_HAS_MSAA (1 << 16)
......@@ -327,6 +340,15 @@ enum mali_channel {
MALI_CHANNEL_RESERVED_1 = 7,
};
/* Used with wrapping. Incomplete (there's a fourth mode in ES 3.2; also, this
* is a 4-bit field...) */
enum mali_wrap_mode {
MALI_WRAP_REPEAT = 0x8,
MALI_WRAP_CLAMP_TO_EDGE = 0x9,
MALI_WRAP_MIRRORED_REPEAT = 0xC
};
struct mali_texture_descriptor {
uint16_t width;
uint16_t height;
......@@ -374,11 +396,21 @@ struct mali_texture_descriptor {
struct mali_sampler_descriptor {
uint32_t filter_mode;
/* Apparently the same as one of the fields in texture_descriptor, so
* maybe it's how linkage is specified */
/* Who knows? ("Someone under NDA" "Um, who else?" "You, in the future,
* I hope?") */
uint32_t unknown1;
uint32_t unknown2;
/* All one word in reality, but packed a bit */
enum mali_wrap_mode wrap_s : 4;
enum mali_wrap_mode wrap_t : 4;
enum mali_wrap_mode wrap_r : 4;
enum mali_alt_func compare_func : 3;
/* A single set bit of unknown, ha! */
unsigned unknown2 : 1;
unsigned zero : 16;
} __attribute__((packed));
/* TODO: What are the floats? Apparently always { -inf, -inf, inf, inf },
......
......@@ -143,6 +143,26 @@ static char *panwrap_func_name(enum mali_func mode)
}
#undef DEFINE_CASE
/* Why is this duplicated? Who knows... */
#define DEFINE_CASE(name) case MALI_ALT_FUNC_ ## name: return "MALI_ALT_FUNC_" #name
static char *panwrap_alt_func_name(enum mali_alt_func mode)
{
switch(mode) {
DEFINE_CASE(NEVER);
DEFINE_CASE(LESS);
DEFINE_CASE(EQUAL);
DEFINE_CASE(LEQUAL);
DEFINE_CASE(GREATER);
DEFINE_CASE(NOTEQUAL);
DEFINE_CASE(GEQUAL);
DEFINE_CASE(ALWAYS);
default: return "MALI_FUNC_NEVER /* XXX: Unknown function, check dump */";
}
}
#undef DEFINE_CASE
#define DEFINE_CASE(name) case MALI_STENCIL_ ## name: return "MALI_STENCIL_" #name
static char *panwrap_stencil_op_name(enum mali_stencil_op op)
{
......@@ -178,6 +198,20 @@ static char *panwrap_channel_name(enum mali_stencil_op op)
}
#undef DEFINE_CASE
#define DEFINE_CASE(name) case MALI_WRAP_## name: return "MALI_WRAP_" #name
static char *panwrap_wrap_mode_name(enum mali_wrap_mode op)
{
switch(op) {
DEFINE_CASE(REPEAT);
DEFINE_CASE(CLAMP_TO_EDGE);
DEFINE_CASE(MIRRORED_REPEAT);
default: return "MALI_WRAP_REPEAT /* XXX: Unknown wrap mode, check dump */";
}
}
#undef DEFINE_CASE
static void panwrap_property_u32_list(const char *name, const u32 *lst, size_t c)
{
panwrap_log(".%s = { ", name);
......@@ -749,7 +783,19 @@ panwrap_replay_vertex_or_tiler_job(const struct mali_job_descriptor_header *h,
s->filter_mode & ~3);
panwrap_prop("unknown1 = 0x%" PRIx32, s->unknown1);
panwrap_prop("unknown2 = 0x%" PRIx32, s->unknown2);
panwrap_prop("wrap_s = %s", panwrap_wrap_mode_name(s->wrap_s));
panwrap_prop("wrap_t = %s", panwrap_wrap_mode_name(s->wrap_t));
panwrap_prop("wrap_r = %s", panwrap_wrap_mode_name(s->wrap_r));
panwrap_prop("compare_func = %s", panwrap_alt_func_name(s->compare_func));
if (s->zero) {
panwrap_msg("Zero tripped\n");
panwrap_prop("zero = 0x%X\n", s->zero);
}
panwrap_prop("unknown2 = %d\n", s->unknown2);
panwrap_indent--;
panwrap_log("};\n");
......
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