summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-06-10 14:56:54 -0700
committerAlyssa Rosenzweig <[email protected]>2019-06-11 08:44:19 -0700
commitb4a3296e779bbe93df80a1b6bd701628b3c20888 (patch)
treec2be337b04ab36edff1ed11f6d381e61e154de25 /src/gallium/drivers
parent4e9e42cc56ea85cc0fcd7c4f4079c24636aa72b0 (diff)
panfrost/midgard: Decode texture offset register swizzle
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/panfrost/midgard/disassemble.c21
-rw-r--r--src/gallium/drivers/panfrost/midgard/midgard.h13
2 files changed, 23 insertions, 11 deletions
diff --git a/src/gallium/drivers/panfrost/midgard/disassemble.c b/src/gallium/drivers/panfrost/midgard/disassemble.c
index 6a4194bc5ca..f1139f40b27 100644
--- a/src/gallium/drivers/panfrost/midgard/disassemble.c
+++ b/src/gallium/drivers/panfrost/midgard/disassemble.c
@@ -36,6 +36,7 @@
#include "disassemble.h"
#include "helpers.h"
#include "util/half_float.h"
+#include "util/u_math.h"
#define DEFINE_CASE(define, str) case define: { printf(str); break; }
@@ -1135,12 +1136,22 @@ print_texture_word(uint32_t *word, unsigned tabs)
printf(" + ");
print_texture_reg_triple(texture->offset_x);
- /* I've never seen them different than this */
- if (texture->offset_y != 2)
- printf(" /* y = %d */", texture->offset_y);
+ /* The less questions you ask, the better. */
- if (texture->offset_z != 1)
- printf(" /* z = %d */", texture->offset_z);
+ 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);
printf(", ");
} else if (texture->offset_x || texture->offset_y || texture->offset_z) {
diff --git a/src/gallium/drivers/panfrost/midgard/midgard.h b/src/gallium/drivers/panfrost/midgard/midgard.h
index fa3e38e0879..532734820e9 100644
--- a/src/gallium/drivers/panfrost/midgard/midgard.h
+++ b/src/gallium/drivers/panfrost/midgard/midgard.h
@@ -558,14 +558,15 @@ __attribute__((__packed__))
unsigned unknownA : 4;
- /* Each offset field is either an immediate (range 0-7) or, in the case of X, a
- * register full / select / upper triplet to select the offset vector
- * register in register mode. In register mode, Y=2 and Z=1 for some
- * reason. The range in register mode is [-8, 7].
+ /* In immediate mode, each offset field is an immediate range [0, 7].
*
- * In immediate mode, for texel fethces the range is the full [-8, 7],
+ * In register mode, offset_x becomes a register full / select / upper
+ * triplet and a vec3 swizzle is splattered across offset_y/offset_z in
+ * a genuinely bizarre way.
+ *
+ * For texel fetches in immediate mode, the range is the full [-8, 7],
* but for normal texturing the top bit must be zero and a register
- * used instead. It's not clear where this limitated is from. */
+ * used instead. It's not clear where this limitation is from. */
signed offset_x : 4;
signed offset_y : 4;