diff options
author | Alyssa Rosenzweig <[email protected]> | 2020-01-06 21:31:46 -0500 |
---|---|---|
committer | Tomeu Vizoso <[email protected]> | 2020-01-07 08:54:47 +0100 |
commit | bc4c853b490b1a230c9018df60670583be121009 (patch) | |
tree | 804abdf907e96c9456ee69a1f9b2ca3a4a17f96f /src/panfrost/midgard | |
parent | 4152d45d38a21f716ddbbebb571ff1e22cfe689d (diff) |
pan/midgard: Account for z/w flip in texelFetch
Required for proper txf of 2D arrays.
Fixes dEQP-GLES3.functional.shaders.texture_functions.texelfetch.*2darray*
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Reviewed-by: Tomeu Vizoso <[email protected]>
Diffstat (limited to 'src/panfrost/midgard')
-rw-r--r-- | src/panfrost/midgard/midgard_compile.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index 39796d3eb9a..568a08da44c 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -1784,6 +1784,11 @@ emit_texop_native(compiler_context *ctx, nir_tex_instr *instr, unsigned coord_mask = mask_of(instr->coord_components); + bool flip_zw = (instr->sampler_dim == GLSL_SAMPLER_DIM_2D) && (coord_mask & (1 << COMPONENT_Z)); + + if (flip_zw) + coord_mask ^= ((1 << COMPONENT_Z) | (1 << COMPONENT_W)); + if (instr->sampler_dim == GLSL_SAMPLER_DIM_CUBE) { /* texelFetch is undefined on samplerCube */ assert(midgard_texop != TEXTURE_OP_TEXEL_FETCH); @@ -1806,6 +1811,10 @@ emit_texop_native(compiler_context *ctx, nir_tex_instr *instr, /* mov coord_temp, coords */ midgard_instruction mov = v_mov(index, coords); mov.mask = coord_mask; + + if (flip_zw) + mov.swizzle[1][COMPONENT_W] = COMPONENT_Z; + emit_mir_instruction(ctx, mov); } else { coords = index; |