Commit 84a7b176 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

Identify texture channel swizzle

parent a5667d9c
......@@ -315,19 +315,38 @@ struct mali_payload_vertex_tiler {
#define MALI_NEGATIVE(dim) (dim + 1)
/* Used with channel swizzling */
enum mali_channel {
MALI_CHANNEL_RED = 0,
MALI_CHANNEL_GREEN = 1,
MALI_CHANNEL_BLUE = 2,
MALI_CHANNEL_ALPHA = 3,
MALI_CHANNEL_ZERO = 4,
MALI_CHANNEL_ONE = 5,
MALI_CHANNEL_RESERVED_0 = 6,
MALI_CHANNEL_RESERVED_1 = 7,
};
struct mali_texture_descriptor {
uint16_t width;
uint16_t height;
uint32_t unknown1;
/* No idea on format1 and format2 */
uint32_t format1;
uint32_t unknown3;
uint32_t format2;
/* Swizzling is a single 32-bit word, broken up here for convenience.
* Here, swizzling refers to the ES 3.0 texture parameters for channel
* level swizzling, not the internal pixel-level swizzling which is
* below OpenGL's reach */
enum mali_channel swizzle_r : 3;
enum mali_channel swizzle_g : 3;
enum mali_channel swizzle_b : 3;
enum mali_channel swizzle_a : 3;
unsigned swizzle_zero : 20;
uint32_t unknown5;
uint32_t unknown6;
......@@ -362,8 +381,8 @@ struct mali_sampler_descriptor {
uint32_t unknown2;
} __attribute__((packed));
/* TODO: What are the floats? Apparently always { -inf, -inf, inf, inf, 0.0,
* 1.0 }
/* TODO: What are the floats? Apparently always { -inf, -inf, inf, inf },
* unless the scissor test is enabled.
*
* viewport0/viewport1 form the arguments to glViewport. viewport1 is modified
* by MALI_POSITIVE; viewport0 is as-is.
......
......@@ -161,6 +161,23 @@ static char *panwrap_stencil_op_name(enum mali_stencil_op op)
#undef DEFINE_CASE
#define DEFINE_CASE(name) case MALI_CHANNEL_## name: return "MALI_CHANNEL_" #name
static char *panwrap_channel_name(enum mali_stencil_op op)
{
switch(op) {
DEFINE_CASE(RED);
DEFINE_CASE(GREEN);
DEFINE_CASE(BLUE);
DEFINE_CASE(ALPHA);
DEFINE_CASE(ZERO);
DEFINE_CASE(ONE);
DEFINE_CASE(RESERVED_0);
DEFINE_CASE(RESERVED_1);
default: return "MALI_CHANNEL_ZERO /* XXX: Unknown channel, check dump */";
}
}
#undef DEFINE_CASE
static void panwrap_property_u32_list(const char *name, const u32 *lst, size_t c)
{
panwrap_log(".%s = { ", name);
......@@ -685,9 +702,19 @@ panwrap_replay_vertex_or_tiler_job(const struct mali_job_descriptor_header *h,
panwrap_prop("unknown1 = 0x%" PRIx32, t->unknown1);
/* TODO: I don't understand how these work at all yet */
/* TODO: I don't understand how this works at all yet */
panwrap_prop("format1 = 0x%" PRIx32, t->format1);
panwrap_prop("format2 = 0x%" PRIx32, t->format2);
panwrap_prop("swizzle_r = %s", panwrap_channel_name(t->swizzle_r));
panwrap_prop("swizzle_g = %s", panwrap_channel_name(t->swizzle_g));
panwrap_prop("swizzle_b = %s", panwrap_channel_name(t->swizzle_b));
panwrap_prop("swizzle_a = %s", panwrap_channel_name(t->swizzle_a));
if (t->swizzle_zero) {
/* Shouldn't happen */
panwrap_msg("Swizzle zero tripped but replay will be fine anyway");
panwrap_prop("swizzle_zero = %d", t->swizzle_zero);
}
panwrap_prop("unknown3 = 0x%" PRIx32, t->unknown3);
......
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