diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index a3705012065..8e8de673d3c 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -1063,6 +1063,8 @@ agx_emit_image_load(agx_builder *b, agx_index dst, nir_intrinsic_instr *intr) b, tmp, coords, lod, bindless, texture, agx_immediate(0), agx_null(), agx_tex_dim(dim, is_array), lod_mode, 0, false); I->mask = agx_expand_tex_to(b, &intr->def, tmp, true); + + b->shader->out->uses_txf = true; return NULL; } @@ -2098,8 +2100,10 @@ agx_emit_tex(agx_builder *b, nir_tex_instr *instr) !agx_is_null(packed_offset), !agx_is_null(compare), instr->op == nir_texop_lod, agx_gather_for_nir(instr)); - if (instr->op == nir_texop_txf || instr->op == nir_texop_txf_ms) + if (instr->op == nir_texop_txf || instr->op == nir_texop_txf_ms) { I->op = AGX_OPCODE_TEXTURE_LOAD; + b->shader->out->uses_txf = true; + } /* Destination masking doesn't seem to work properly for gathers (because * it's mostly pointless), but it does show up in the lowering of diff --git a/src/asahi/compiler/agx_compile.h b/src/asahi/compiler/agx_compile.h index 1a5ad02a2ce..f6e92e03c87 100644 --- a/src/asahi/compiler/agx_compile.h +++ b/src/asahi/compiler/agx_compile.h @@ -112,6 +112,9 @@ struct agx_shader_info { /* Reads base vertex/instance */ bool uses_base_param; + /* Uses txf and hence needs a txf sampler mapped */ + bool uses_txf; + /* Number of 16-bit registers used by the main shader and preamble * respectively. */ diff --git a/src/asahi/lib/agx_linker.c b/src/asahi/lib/agx_linker.c index fa6ac2cdf4e..3c5b082bcd5 100644 --- a/src/asahi/lib/agx_linker.c +++ b/src/asahi/lib/agx_linker.c @@ -110,6 +110,7 @@ agx_fast_link(void *memctx, struct agx_device *dev, bool fragment, writes_sample_mask |= part->info.writes_sample_mask; disable_tri_merging |= part->info.disable_tri_merging; linked->uses_base_param |= part->info.uses_base_param; + linked->uses_txf |= part->info.uses_txf; tag_write_disable &= part->info.tag_write_disable; } diff --git a/src/asahi/lib/agx_linker.h b/src/asahi/lib/agx_linker.h index 8508a2cc37f..3c737df506d 100644 --- a/src/asahi/lib/agx_linker.h +++ b/src/asahi/lib/agx_linker.h @@ -21,6 +21,11 @@ struct agx_linked_shader { */ bool uses_base_param; + /* Set if the linked shader uses txf. The epilog may even if the main shader + * does not, in the case of spilled render targets. + */ + bool uses_txf; + /* Coefficient register bindings */ struct agx_varyings_fs cf;