diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 6e0a927284c..30fe55177fe 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -2432,6 +2432,12 @@ typedef struct { * then the sampler index is given by sampler_index + sampler_offset. */ unsigned sampler_index; + + /* Back-end specific flags, intended to be used in combination with + * nir_tex_src_backend1/2 to provide additional hw-specific information + * to the back-end compiler. + */ + uint32_t backend_flags; } nir_tex_instr; /** diff --git a/src/compiler/nir/nir_clone.c b/src/compiler/nir/nir_clone.c index 8fadc784055..aca2e99a3d5 100644 --- a/src/compiler/nir/nir_clone.c +++ b/src/compiler/nir/nir_clone.c @@ -415,6 +415,8 @@ clone_tex(clone_state *state, const nir_tex_instr *tex) ntex->texture_non_uniform = tex->texture_non_uniform; ntex->sampler_non_uniform = tex->sampler_non_uniform; + ntex->backend_flags = tex->backend_flags; + return ntex; } diff --git a/src/compiler/nir/nir_instr_set.c b/src/compiler/nir/nir_instr_set.c index 8794e5978e1..040985b3a84 100644 --- a/src/compiler/nir/nir_instr_set.c +++ b/src/compiler/nir/nir_instr_set.c @@ -283,6 +283,7 @@ hash_tex(uint32_t hash, const nir_tex_instr *instr) hash = HASH(hash, instr->sampler_index); hash = HASH(hash, instr->texture_non_uniform); hash = HASH(hash, instr->sampler_non_uniform); + hash = HASH(hash, instr->backend_flags); return hash; } @@ -659,7 +660,8 @@ nir_instrs_equal(const nir_instr *instr1, const nir_instr *instr2) tex1->is_new_style_shadow != tex2->is_new_style_shadow || tex1->component != tex2->component || tex1->texture_index != tex2->texture_index || - tex1->sampler_index != tex2->sampler_index) { + tex1->sampler_index != tex2->sampler_index || + tex1->backend_flags != tex2->backend_flags) { return false; } diff --git a/src/compiler/nir/nir_serialize.c b/src/compiler/nir/nir_serialize.c index 9d5d345c80c..10ca44b9231 100644 --- a/src/compiler/nir/nir_serialize.c +++ b/src/compiler/nir/nir_serialize.c @@ -1506,6 +1506,7 @@ write_tex(write_ctx *ctx, const nir_tex_instr *tex) blob_write_uint32(ctx->blob, tex->texture_index); blob_write_uint32(ctx->blob, tex->sampler_index); + blob_write_uint32(ctx->blob, tex->backend_flags); if (tex->op == nir_texop_tg4) blob_write_bytes(ctx->blob, tex->tg4_offsets, sizeof(tex->tg4_offsets)); @@ -1544,6 +1545,7 @@ read_tex(read_ctx *ctx, union packed_instr header) tex->op = header.tex.op; tex->texture_index = blob_read_uint32(ctx->blob); tex->sampler_index = blob_read_uint32(ctx->blob); + tex->backend_flags = blob_read_uint32(ctx->blob); if (tex->op == nir_texop_tg4) blob_copy_bytes(ctx->blob, tex->tg4_offsets, sizeof(tex->tg4_offsets));