From 1977e92ee3a9d1a1ba9c5afec1eb3bd908c3f297 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Sat, 23 Jun 2018 11:02:50 -0400 Subject: [PATCH] freedreno/ir3: fix deref conversion fallout Signed-off-by: Rob Clark --- .../drivers/freedreno/ir3/ir3_compiler_nir.c | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c index 327ff85d67f..892fb061442 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c @@ -1985,7 +1985,7 @@ get_image_offset(struct ir3_context *ctx, const nir_variable *var, }, 2); } -/* src[] = { coord, sample_index }. const_index[] = {} */ +/* src[] = { deref, coord, sample_index }. const_index[] = {} */ static void emit_intrinsic_load_image(struct ir3_context *ctx, nir_intrinsic_instr *intr, struct ir3_instruction **dst) @@ -1993,10 +1993,10 @@ emit_intrinsic_load_image(struct ir3_context *ctx, nir_intrinsic_instr *intr, struct ir3_block *b = ctx->block; const nir_variable *var = nir_intrinsic_get_var(intr, 0); struct ir3_instruction *sam; - struct ir3_instruction * const *src0 = get_src(ctx, &intr->src[0]); + struct ir3_instruction * const *src0 = get_src(ctx, &intr->src[1]); struct ir3_instruction *coords[4]; unsigned flags, ncoords = get_image_coords(var, &flags); - unsigned tex_idx = get_image_slot(ctx, var); + unsigned tex_idx = get_image_slot(ctx, nir_src_as_deref(intr->src[0])); type_t type = get_image_type(var); /* hmm, this seems a bit odd, but it is what blob does and (at least @@ -2022,17 +2022,17 @@ emit_intrinsic_load_image(struct ir3_context *ctx, nir_intrinsic_instr *intr, split_dest(b, dst, sam, 0, 4); } -/* src[] = { coord, sample_index, value }. const_index[] = {} */ +/* src[] = { deref, coord, sample_index, value }. const_index[] = {} */ static void emit_intrinsic_store_image(struct ir3_context *ctx, nir_intrinsic_instr *intr) { struct ir3_block *b = ctx->block; const nir_variable *var = nir_intrinsic_get_var(intr, 0); struct ir3_instruction *stib, *offset; - struct ir3_instruction * const *value = get_src(ctx, &intr->src[2]); - struct ir3_instruction * const *coords = get_src(ctx, &intr->src[0]); + struct ir3_instruction * const *value = get_src(ctx, &intr->src[3]); + struct ir3_instruction * const *coords = get_src(ctx, &intr->src[1]); unsigned ncoords = get_image_coords(var, NULL); - unsigned tex_idx = get_image_slot(ctx, var); + unsigned tex_idx = get_image_slot(ctx, nir_src_as_deref(intr->src[0])); /* src0 is value * src1 is coords @@ -2066,7 +2066,7 @@ emit_intrinsic_image_size(struct ir3_context *ctx, nir_intrinsic_instr *intr, { struct ir3_block *b = ctx->block; const nir_variable *var = nir_intrinsic_get_var(intr, 0); - unsigned tex_idx = get_image_slot(ctx, var); + unsigned tex_idx = get_image_slot(ctx, nir_src_as_deref(intr->src[0])); struct ir3_instruction *sam, *lod; unsigned flags, ncoords = get_image_coords(var, &flags); @@ -2100,23 +2100,23 @@ emit_intrinsic_image_size(struct ir3_context *ctx, nir_intrinsic_instr *intr, } } -/* src[] = { coord, sample_index, value, compare }. const_index[] = {} */ +/* src[] = { deref, coord, sample_index, value, compare }. const_index[] = {} */ static struct ir3_instruction * emit_intrinsic_atomic_image(struct ir3_context *ctx, nir_intrinsic_instr *intr) { struct ir3_block *b = ctx->block; const nir_variable *var = nir_intrinsic_get_var(intr, 0); struct ir3_instruction *atomic, *image, *src0, *src1, *src2; - struct ir3_instruction * const *coords = get_src(ctx, &intr->src[0]); + struct ir3_instruction * const *coords = get_src(ctx, &intr->src[1]); unsigned ncoords = get_image_coords(var, NULL); - image = create_immed(b, get_image_slot(ctx, var)); + image = create_immed(b, get_image_slot(ctx, nir_src_as_deref(intr->src[0]))); /* src0 is value (or uvec2(value, compare)) * src1 is coords * src2 is 64b byte offset */ - src0 = get_src(ctx, &intr->src[2])[0]; + src0 = get_src(ctx, &intr->src[3])[0]; src1 = create_collect(ctx, coords, ncoords); src2 = get_image_offset(ctx, var, coords, false); @@ -2146,7 +2146,7 @@ emit_intrinsic_atomic_image(struct ir3_context *ctx, nir_intrinsic_instr *intr) /* for cmpxchg, src0 is [ui]vec2(data, compare): */ src0 = create_collect(ctx, (struct ir3_instruction*[]){ src0, - get_src(ctx, &intr->src[3])[0], + get_src(ctx, &intr->src[4])[0], }, 2); atomic = ir3_ATOMIC_CMPXCHG_G(b, image, 0, src0, 0, src1, 0, src2, 0); break; -- 2.30.2