aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2018-06-07 15:00:32 -0400
committerRob Clark <[email protected]>2018-06-19 13:02:28 -0400
commit0bb0cac8dcd0d8907282242e548321f318a64536 (patch)
treeaf0a06c45f9da880d438dd53938c9b8b18a959c0
parentd1d2b13518c190cf6db45dfb45b07f1246769767 (diff)
freedreno/ir3: handle image buffer
Similar to txf case, we need to insert a 2nd coordinate (zero). Signed-off-by: Rob Clark <[email protected]>
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
index 2cbb21f3d10..73871f8e0db 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
@@ -1975,7 +1975,8 @@ emit_intrinsic_load_image(struct ir3_context *ctx, nir_intrinsic_instr *intr,
struct ir3_block *b = ctx->block;
const nir_variable *var = intr->variables[0]->var;
struct ir3_instruction *sam;
- struct ir3_instruction * const *coords = get_src(ctx, &intr->src[0]);
+ struct ir3_instruction * const *src0 = get_src(ctx, &intr->src[0]);
+ struct ir3_instruction *coords[4];
unsigned flags, ncoords = get_image_coords(var, &flags);
unsigned tex_idx = get_image_slot(ctx, intr->variables[0]);
type_t type = get_image_type(var);
@@ -1988,6 +1989,12 @@ emit_intrinsic_load_image(struct ir3_context *ctx, nir_intrinsic_instr *intr,
flags |= IR3_INSTR_A;
}
+ for (unsigned i = 0; i < ncoords; i++)
+ coords[i] = src0[i];
+
+ if (ncoords == 1)
+ coords[ncoords++] = create_immed(b, 0);
+
sam = ir3_SAM(b, OPC_ISAM, type, TGSI_WRITEMASK_XYZW, flags,
tex_idx, tex_idx, create_collect(ctx, coords, ncoords), NULL);