From 17b610771dd158cd8a6b737b0de5f72162c57312 Mon Sep 17 00:00:00 2001 From: Amber Date: Fri, 27 Jan 2023 10:41:06 +0100 Subject: [PATCH] ir3: support texture and sampler index with offsets "If this texture instruction has a nir_tex_src_texture_offset source, then the texture index is given by texture_index + texture_offset." This fixes the failures for: spec@arb_arrays_of_arrays@execution@sampler@fs-nested-struct-arrays-nonconst-nested-array spec@arb_gl_spirv@execution@uniform@sampler2d-nonconst-nested-array Signed-off-by: Amber Amber Part-of: --- src/freedreno/ci/freedreno-a618-fails.txt | 5 ----- src/freedreno/ci/freedreno-a630-fails.txt | 5 ----- src/freedreno/ir3/ir3_compiler_nir.c | 8 ++++++++ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/freedreno/ci/freedreno-a618-fails.txt b/src/freedreno/ci/freedreno-a618-fails.txt index 628985a..e328fa9 100644 --- a/src/freedreno/ci/freedreno-a618-fails.txt +++ b/src/freedreno/ci/freedreno-a618-fails.txt @@ -105,11 +105,6 @@ spec@!opengl 2.0@gl-2.0-edgeflag-immediate,Crash spec@!opengl 1.0@gl-1.0-edgeflag,Crash spec@!opengl 1.0@gl-1.0-edgeflag-quads,Crash - -spec@arb_arrays_of_arrays@execution@sampler@fs-nested-struct-arrays-nonconst-nested-array,Fail -# Skips prior to exposing gl45, now fails for same reason as above test -spec@arb_gl_spirv@execution@uniform@sampler2d-nonconst-nested-array,Fail - spec@arb_depth_buffer_float@fbo-clear-formats stencil,Fail spec@arb_depth_buffer_float@fbo-clear-formats stencil@GL_DEPTH32F_STENCIL8,Fail spec@arb_depth_buffer_float@fbo-generatemipmap-formats,Fail diff --git a/src/freedreno/ci/freedreno-a630-fails.txt b/src/freedreno/ci/freedreno-a630-fails.txt index 5b226e3..0d42bad 100644 --- a/src/freedreno/ci/freedreno-a630-fails.txt +++ b/src/freedreno/ci/freedreno-a630-fails.txt @@ -98,11 +98,6 @@ spec@!opengl 2.0@gl-2.0-edgeflag-immediate,Crash spec@!opengl 1.0@gl-1.0-edgeflag,Crash spec@!opengl 1.0@gl-1.0-edgeflag-quads,Crash - -spec@arb_arrays_of_arrays@execution@sampler@fs-nested-struct-arrays-nonconst-nested-array,Fail -# Skips prior to exposing gl45, now fails for same reason as above test -spec@arb_gl_spirv@execution@uniform@sampler2d-nonconst-nested-array,Fail - spec@arb_depth_buffer_float@fbo-clear-formats stencil,Fail spec@arb_depth_buffer_float@fbo-clear-formats stencil@GL_DEPTH32F_STENCIL8,Fail spec@arb_depth_buffer_float@fbo-generatemipmap-formats,Fail diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c index 6286144..d56a845 100644 --- a/src/freedreno/ir3/ir3_compiler_nir.c +++ b/src/freedreno/ir3/ir3_compiler_nir.c @@ -2885,6 +2885,10 @@ get_tex_samp_tex_src(struct ir3_context *ctx, nir_tex_instr *tex) if (texture_idx >= 0) { texture = ir3_get_src(ctx, &tex->src[texture_idx].src)[0]; texture = ir3_COV(ctx->block, texture, TYPE_U32, TYPE_U16); + if (tex->texture_index != 0) { + texture = ir3_ADD_U(b, texture, 0, create_immed_typed(b, tex->texture_index, TYPE_U16), 0); + texture->dsts[0]->flags |= IR3_REG_HALF; + } } else { /* TODO what to do for dynamic case? I guess we only need the * max index for astc srgb workaround so maybe not a problem @@ -2900,6 +2904,10 @@ get_tex_samp_tex_src(struct ir3_context *ctx, nir_tex_instr *tex) if (sampler_idx >= 0) { sampler = ir3_get_src(ctx, &tex->src[sampler_idx].src)[0]; sampler = ir3_COV(ctx->block, sampler, TYPE_U32, TYPE_U16); + if (tex->sampler_index != 0) { + sampler = ir3_ADD_U(b, sampler, 0, create_immed_typed(b, tex->sampler_index, TYPE_U16), 0); + sampler->dsts[0]->flags |= IR3_REG_HALF; + } } else { sampler = create_immed_typed(ctx->block, tex->sampler_index, TYPE_U16); info.samp_idx = tex->texture_index; -- 2.7.4