diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-12-20 13:48:24 -0500 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-12-24 23:46:23 +0000 |
commit | 1bce7fdecd86601a300be9a58a346b8c110d9587 (patch) | |
tree | 315f15619e9693211b43fa9bbd1a1a159720a2b5 /src/panfrost/midgard/disassemble.c | |
parent | 4ec1f95d76b476dd602dca41e5a1065a2c0d6135 (diff) |
pan/midgard: Do witchcraft on texture offsets
My latest divination spell has uncovered a pattern in the aether.
Although the swizzle is unaligned, its format is otherwise standard.
Document this, removing the old incorrect understanding of the swizzle
(which coincided on common special swizzles only).
Fixes dEQP-GLES3.functional.shaders.texture_functions.texelfetchoffset.sampler2d_fixed_fragment
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/panfrost/midgard/disassemble.c')
-rw-r--r-- | src/panfrost/midgard/disassemble.c | 40 |
1 files changed, 13 insertions, 27 deletions
diff --git a/src/panfrost/midgard/disassemble.c b/src/panfrost/midgard/disassemble.c index cfce1110318..d4354388959 100644 --- a/src/panfrost/midgard/disassemble.c +++ b/src/panfrost/midgard/disassemble.c @@ -1366,9 +1366,9 @@ print_texture_word(uint32_t *word, unsigned tabs, unsigned in_reg_base, unsigned if (texture->offset_register) { printf(" + "); - bool full = texture->offset_x & 1; - bool select = texture->offset_x & 2; - bool upper = texture->offset_x & 4; + bool full = texture->offset & 1; + bool select = texture->offset & 2; + bool upper = texture->offset & 4; printf("%sr%u", full ? "" : "h", in_reg_base + select); assert(!(texture->out_full && texture->out_upper)); @@ -1377,30 +1377,19 @@ print_texture_word(uint32_t *word, unsigned tabs, unsigned in_reg_base, unsigned if (upper) printf("'"); - /* The less questions you ask, the better. */ - - unsigned swizzle_lo, swizzle_hi; - unsigned orig_y = texture->offset_y; - unsigned orig_z = texture->offset_z; - - memcpy(&swizzle_lo, &orig_y, sizeof(unsigned)); - memcpy(&swizzle_hi, &orig_z, sizeof(unsigned)); - - /* Duplicate hi swizzle over */ - assert(swizzle_hi < 4); - swizzle_hi = (swizzle_hi << 2) | swizzle_hi; - - unsigned swiz = (swizzle_lo << 4) | swizzle_hi; - unsigned reversed = util_bitreverse(swiz) >> 24; - print_swizzle_vec4(reversed, false, false); + print_swizzle_vec4(texture->offset >> 3, false, false); printf(", "); - } else if (texture->offset_x || texture->offset_y || texture->offset_z) { + } else if (texture->offset) { /* Only select ops allow negative immediate offsets, verify */ - bool neg_x = texture->offset_x < 0; - bool neg_y = texture->offset_y < 0; - bool neg_z = texture->offset_z < 0; + signed offset_x = (texture->offset & 0xF); + signed offset_y = ((texture->offset >> 4) & 0xF); + signed offset_z = ((texture->offset >> 8) & 0xF); + + bool neg_x = offset_x < 0; + bool neg_y = offset_y < 0; + bool neg_z = offset_z < 0; bool any_neg = neg_x || neg_y || neg_z; if (any_neg && texture->op != TEXTURE_OP_TEXEL_FETCH) @@ -1408,10 +1397,7 @@ print_texture_word(uint32_t *word, unsigned tabs, unsigned in_reg_base, unsigned /* Regardless, just print the immediate offset */ - printf(" + <%d, %d, %d>, ", - texture->offset_x, - texture->offset_y, - texture->offset_z); + printf(" + <%d, %d, %d>, ", offset_x, offset_y, offset_z); } else { printf(", "); } |