diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-06-14 16:30:29 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-06-17 08:36:14 -0700 |
commit | dabfc71d36e7d4c29d3699ee15f9c2748a00f3a2 (patch) | |
tree | 127bf5e4e1295753582858440711b0402e8a0ead /src/gallium | |
parent | 67a34acd00c056341ebb87d5bc0ce0b76a3b2c10 (diff) |
panfrost/midgard: Adjust swizzles for 2D arrays
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/panfrost/midgard/midgard_compile.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gallium/drivers/panfrost/midgard/midgard_compile.c b/src/gallium/drivers/panfrost/midgard/midgard_compile.c index 7d7bda6ee12..6dbfd4ade6e 100644 --- a/src/gallium/drivers/panfrost/midgard/midgard_compile.c +++ b/src/gallium/drivers/panfrost/midgard/midgard_compile.c @@ -86,6 +86,7 @@ midgard_block_add_successor(midgard_block *block, midgard_block *successor) #define SWIZZLE_XYXX SWIZZLE(COMPONENT_X, COMPONENT_Y, COMPONENT_X, COMPONENT_X) #define SWIZZLE_XYZX SWIZZLE(COMPONENT_X, COMPONENT_Y, COMPONENT_Z, COMPONENT_X) #define SWIZZLE_XYZW SWIZZLE(COMPONENT_X, COMPONENT_Y, COMPONENT_Z, COMPONENT_W) +#define SWIZZLE_XYXZ SWIZZLE(COMPONENT_X, COMPONENT_Y, COMPONENT_X, COMPONENT_Z) #define SWIZZLE_WWWW SWIZZLE(COMPONENT_W, COMPONENT_W, COMPONENT_W, COMPONENT_W) static inline unsigned @@ -1405,6 +1406,15 @@ emit_tex(compiler_context *ctx, nir_tex_instr *instr) ins.alu.mask = expand_writemask(mask_of(nr_comp)); emit_mir_instruction(ctx, ins); + /* To the hardware, z is depth, w is array + * layer. To NIR, z is array layer for a 2D + * array */ + + bool has_array = instr->texture_array_size > 0; + bool is_2d = instr->sampler_dim == GLSL_SAMPLER_DIM_2D; + + if (is_2d && has_array) + position_swizzle = SWIZZLE_XYXZ; } break; |