diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index 5ad77d0b0ff..467c63c2b2e 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -3237,6 +3237,7 @@ nir_tex_instr_result_size(const nir_tex_instr *instr) case nir_texop_hdr_dim_nv: case nir_texop_tex_type_nv: + case nir_texop_sample_pos_nv: return 4; case nir_texop_custom_border_color_agx: @@ -3266,6 +3267,7 @@ nir_tex_instr_is_query(const nir_tex_instr *instr) case nir_texop_has_custom_border_color_agx: case nir_texop_hdr_dim_nv: case nir_texop_tex_type_nv: + case nir_texop_sample_pos_nv: return true; case nir_texop_tex: case nir_texop_txb: diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 4376a1ca812..a746f71ae63 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -2356,6 +2356,8 @@ typedef enum nir_texop { nir_texop_hdr_dim_nv, /** Maps to TXQ.TEXTURE_TYPE */ nir_texop_tex_type_nv, + /** Maps to TXQ.SAMPLER_POS */ + nir_texop_sample_pos_nv, } nir_texop; /** Represents a texture instruction */ diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index b2ac889a1a4..09496bdc89c 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -1865,6 +1865,9 @@ print_tex_instr(nir_tex_instr *instr, print_state *state) case nir_texop_tex_type_nv: fprintf(fp, "tex_type_nv "); break; + case nir_texop_sample_pos_nv: + fprintf(fp, "sample_pos_nv "); + break; default: unreachable("Invalid texture operation"); break; diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 6c956ea5c8c..f86b43a98d3 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -3508,6 +3508,7 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode, break; case nir_texop_hdr_dim_nv: case nir_texop_tex_type_nv: + case nir_texop_sample_pos_nv: vtn_fail("unexpected nir_texop_*_nv"); break; } diff --git a/src/nouveau/compiler/nak/from_nir.rs b/src/nouveau/compiler/nak/from_nir.rs index e5946a3b874..82cba7d4272 100644 --- a/src/nouveau/compiler/nak/from_nir.rs +++ b/src/nouveau/compiler/nak/from_nir.rs @@ -1866,6 +1866,17 @@ impl<'a> ShaderFromNir<'a> { nodep: flags.nodep(), channel_mask, }); + } else if tex.op == nir_texop_sample_pos_nv { + let src = self.get_src(&srcs[0].src); + assert!(fault.is_none()); + b.push_op(OpTxq { + dsts: dsts, + tex: tex_ref, + src: src, + query: TexQuery::SamplerPos, + nodep: flags.nodep(), + channel_mask, + }); } else { let lod_mode = match flags.lod_mode() { NAK_NIR_LOD_MODE_AUTO => TexLodMode::Auto,