Compiler will emit an uniform value corresponding to the requested
parameter (bpp, y-stride or z-stride) for the dereferenced image.
---
 src/freedreno/ir3/ir3_compiler_nir.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/freedreno/ir3/ir3_compiler_nir.c 
b/src/freedreno/ir3/ir3_compiler_nir.c
index fd641735620..df948995000 100644
--- a/src/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/freedreno/ir3/ir3_compiler_nir.c
@@ -1719,6 +1719,24 @@ emit_intrinsic(struct ir3_context *ctx, 
nir_intrinsic_instr *intr)
        case nir_intrinsic_image_deref_atomic_comp_swap:
                dst[0] = emit_intrinsic_atomic_image(ctx, intr);
                break;
+       case nir_intrinsic_image_deref_load_param_ir3: {
+               const nir_variable *var = nir_intrinsic_get_var(intr, 0);
+               compile_assert(ctx, var);
+               idx = var->data.driver_location;
+
+               /* this is the index into image_dims offsets, which can take
+                * values 0, 1 or 2 (bpp, y-stride, z-stride respectively).
+                */
+               uint8_t off = intr->const_index[0];
+               compile_assert(ctx, off <= 2);
+
+               unsigned cb = regid(ctx->so->constbase.image_dims, 0) +
+                       ctx->so->const_layout.image_dims.off[idx];
+               compile_assert(ctx, ctx->so->const_layout.image_dims.mask & (1 
<< idx));
+
+               dst[0] = create_uniform(b, cb + off);
+               break;
+       }
        case nir_intrinsic_barrier:
        case nir_intrinsic_memory_barrier:
        case nir_intrinsic_group_memory_barrier:
-- 
2.20.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to