[Mesa-dev] [PATCH 16/16] freedreno/ir3: convert to deref instructions
Jason Ekstrand
jason at jlekstrand.net
Sat Apr 7 16:42:29 UTC 2018
On April 7, 2018 09:14:20 Rob Clark <robdclark at gmail.com> wrote:
Signed-off-by: Rob Clark <robdclark at gmail.com>
---
.../drivers/freedreno/ir3/ir3_compiler_nir.c | 46 +++++++++++-----------
src/gallium/drivers/freedreno/ir3/ir3_nir.c | 4 +-
.../freedreno/ir3/ir3_nir_lower_tg4_to_tex.c | 4 +-
3 files changed, 26 insertions(+), 28 deletions(-)
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
index 174141b7fec..c99683368e2 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
@@ -1785,7 +1785,7 @@ emit_intrinsic_load_image(struct ir3_context *ctx,
nir_intrinsic_instr *intr,
struct ir3_instruction **dst)
{
struct ir3_block *b = ctx->block;
- const nir_variable *var = intr->variables[0]->var;
+ const nir_variable *var = nir_intrinsic_get_var(intr, 0);
Do you not support arrays if images yet?
struct ir3_instruction *sam;
struct ir3_instruction * const *coords = get_src(ctx, &intr->src[0]);
unsigned ncoords = get_image_coords(var);
@@ -1810,7 +1810,7 @@ static void
emit_intrinsic_store_image(struct ir3_context *ctx, nir_intrinsic_instr *intr)
{
struct ir3_block *b = ctx->block;
- const nir_variable *var = intr->variables[0]->var;
+ 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]);
@@ -1848,7 +1848,7 @@ emit_intrinsic_image_size(struct ir3_context *ctx,
nir_intrinsic_instr *intr,
struct ir3_instruction **dst)
{
struct ir3_block *b = ctx->block;
- const nir_variable *var = intr->variables[0]->var;
+ const nir_variable *var = nir_intrinsic_get_var(intr, 0);
unsigned ncoords = get_image_coords(var);
unsigned tex_idx = get_image_slot(ctx, var);
struct ir3_instruction *sam, *lod;
@@ -1869,7 +1869,7 @@ 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 = intr->variables[0]->var;
+ 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]);
unsigned ncoords = get_image_coords(var);
@@ -1885,28 +1885,28 @@ emit_intrinsic_atomic_image(struct ir3_context
*ctx, nir_intrinsic_instr *intr)
src2 = get_image_offset(ctx, var, coords, false);
switch (intr->intrinsic) {
- case nir_intrinsic_image_var_atomic_add:
+ case nir_intrinsic_image_deref_atomic_add:
atomic = ir3_ATOMIC_ADD_G(b, image, 0, src0, 0, src1, 0, src2, 0);
break;
- case nir_intrinsic_image_var_atomic_min:
+ case nir_intrinsic_image_deref_atomic_min:
atomic = ir3_ATOMIC_MIN_G(b, image, 0, src0, 0, src1, 0, src2, 0);
break;
- case nir_intrinsic_image_var_atomic_max:
+ case nir_intrinsic_image_deref_atomic_max:
atomic = ir3_ATOMIC_MAX_G(b, image, 0, src0, 0, src1, 0, src2, 0);
break;
- case nir_intrinsic_image_var_atomic_and:
+ case nir_intrinsic_image_deref_atomic_and:
atomic = ir3_ATOMIC_AND_G(b, image, 0, src0, 0, src1, 0, src2, 0);
break;
- case nir_intrinsic_image_var_atomic_or:
+ case nir_intrinsic_image_deref_atomic_or:
atomic = ir3_ATOMIC_OR_G(b, image, 0, src0, 0, src1, 0, src2, 0);
break;
- case nir_intrinsic_image_var_atomic_xor:
+ case nir_intrinsic_image_deref_atomic_xor:
atomic = ir3_ATOMIC_XOR_G(b, image, 0, src0, 0, src1, 0, src2, 0);
break;
- case nir_intrinsic_image_var_atomic_exchange:
+ case nir_intrinsic_image_deref_atomic_exchange:
atomic = ir3_ATOMIC_XCHG_G(b, image, 0, src0, 0, src1, 0, src2, 0);
break;
- case nir_intrinsic_image_var_atomic_comp_swap:
+ case nir_intrinsic_image_deref_atomic_comp_swap:
/* for cmpxchg, src0 is [ui]vec2(data, compare): */
src0 = create_collect(ctx, (struct ir3_instruction*[]){
src0,
@@ -2139,23 +2139,23 @@ emit_intrinsic(struct ir3_context *ctx,
nir_intrinsic_instr *intr)
case nir_intrinsic_shared_atomic_comp_swap:
dst[0] = emit_intrinsic_atomic_shared(ctx, intr);
break;
- case nir_intrinsic_image_var_load:
+ case nir_intrinsic_image_deref_load:
emit_intrinsic_load_image(ctx, intr, dst);
break;
- case nir_intrinsic_image_var_store:
+ case nir_intrinsic_image_deref_store:
emit_intrinsic_store_image(ctx, intr);
break;
- case nir_intrinsic_image_var_size:
+ case nir_intrinsic_image_deref_size:
emit_intrinsic_image_size(ctx, intr, dst);
break;
- case nir_intrinsic_image_var_atomic_add:
- case nir_intrinsic_image_var_atomic_min:
- case nir_intrinsic_image_var_atomic_max:
- case nir_intrinsic_image_var_atomic_and:
- case nir_intrinsic_image_var_atomic_or:
- case nir_intrinsic_image_var_atomic_xor:
- case nir_intrinsic_image_var_atomic_exchange:
- case nir_intrinsic_image_var_atomic_comp_swap:
+ case nir_intrinsic_image_deref_atomic_add:
+ case nir_intrinsic_image_deref_atomic_min:
+ case nir_intrinsic_image_deref_atomic_max:
+ case nir_intrinsic_image_deref_atomic_and:
+ case nir_intrinsic_image_deref_atomic_or:
+ case nir_intrinsic_image_deref_atomic_xor:
+ case nir_intrinsic_image_deref_atomic_exchange:
+ case nir_intrinsic_image_deref_atomic_comp_swap:
dst[0] = emit_intrinsic_atomic_image(ctx, intr);
break;
case nir_intrinsic_barrier:
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_nir.c
b/src/gallium/drivers/freedreno/ir3/ir3_nir.c
index cd1f9c526f2..9f0112f56e2 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_nir.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_nir.c
@@ -242,8 +242,8 @@ ir3_nir_scan_driver_consts(nir_shader *shader,
layout->ssbo_size.count;
layout->ssbo_size.count += 1; /* one const per */
break;
- case nir_intrinsic_image_var_store:
- idx = intr->variables[0]->var->data.driver_location;
+ case nir_intrinsic_image_deref_store:
+ idx = nir_intrinsic_get_var(intr, 0)->data.driver_location;
if (layout->image_dims.mask & (1 << idx))
break;
layout->image_dims.mask |= (1 << idx);
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_nir_lower_tg4_to_tex.c
b/src/gallium/drivers/freedreno/ir3/ir3_nir_lower_tg4_to_tex.c
index de304bffbc3..37a3dcb26f8 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_nir_lower_tg4_to_tex.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_nir_lower_tg4_to_tex.c
@@ -40,7 +40,7 @@ lower_tg4(nir_block *block, nir_builder *b, void *mem_ctx)
if (instr->type != nir_instr_type_tex)
continue;
- nir_tex_instr *tg4 = (nir_tex_instr *)instr;
+ nir_tex_instr *tg4 = (nir_tex_instr *)instr;
if (tg4->op != nir_texop_tg4)
continue;
@@ -62,9 +62,7 @@ lower_tg4(nir_block *block, nir_builder *b, void *mem_ctx)
tex->is_shadow = tg4->is_shadow;
tex->is_new_style_shadow = tg4->is_new_style_shadow;
tex->texture_index = tg4->texture_index;
- tex->texture = nir_deref_var_clone(tg4->texture, tex);
tex->sampler_index = tg4->sampler_index;
- tex->sampler = nir_deref_var_clone(tg4->sampler, tex);
tex->dest_type = tg4->dest_type;
for (int j = 0; j < tg4->num_srcs; j++) {
--
2.14.3
More information about the mesa-dev
mailing list