summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-06-14 16:03:39 -0700
committerAlyssa Rosenzweig <[email protected]>2019-06-17 08:28:13 -0700
commit8429beef5edebf5ed911195a0514ed3bba037d28 (patch)
treeebf54a9ec9cddebe5ba5b399cda076a00590c1ea /src/gallium
parent56f9b47efd64c57abdd56a0398660078ed3f753f (diff)
panfrost/midgard: Fix 3D texture masks/swizzles
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/panfrost/midgard/midgard_compile.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/gallium/drivers/panfrost/midgard/midgard_compile.c b/src/gallium/drivers/panfrost/midgard/midgard_compile.c
index d121fdee506..7d7bda6ee12 100644
--- a/src/gallium/drivers/panfrost/midgard/midgard_compile.c
+++ b/src/gallium/drivers/panfrost/midgard/midgard_compile.c
@@ -1370,9 +1370,12 @@ emit_tex(compiler_context *ctx, nir_tex_instr *instr)
int texture_index = instr->texture_index;
int sampler_index = texture_index;
+ unsigned position_swizzle = 0;
+
for (unsigned i = 0; i < instr->num_srcs; ++i) {
int reg = SSA_FIXED_REGISTER(REGISTER_TEXTURE_BASE + in_reg);
int index = nir_src_index(ctx, &instr->src[i].src);
+ int nr_comp = nir_src_num_components(instr->src[i].src);
midgard_vector_alu_src alu_src = blank_alu_src;
switch (instr->src[i].src_type) {
@@ -1394,12 +1397,14 @@ emit_tex(compiler_context *ctx, nir_tex_instr *instr)
st.load_store.swizzle = alu_src.swizzle;
emit_mir_instruction(ctx, st);
+ position_swizzle = swizzle_of(2);
} else {
- alu_src.swizzle = SWIZZLE(COMPONENT_X, COMPONENT_Y, COMPONENT_X, COMPONENT_X);
+ position_swizzle = alu_src.swizzle = swizzle_of(nr_comp);
midgard_instruction ins = v_fmov(index, alu_src, reg);
- ins.alu.mask = expand_writemask(0x3); /* xy */
+ ins.alu.mask = expand_writemask(mask_of(nr_comp));
emit_mir_instruction(ctx, ins);
+
}
break;
@@ -1438,7 +1443,7 @@ emit_tex(compiler_context *ctx, nir_tex_instr *instr)
/* TODO: half */
.in_reg_full = 1,
- .in_reg_swizzle = SWIZZLE_XYXX,
+ .in_reg_swizzle = position_swizzle,
.out_full = 1,
/* Always 1 */