tu,ir3: inform ir3 of dynamically remapped FS slots

The clear FS shaders will statically use slot numbers from 0 up to the
number of supported render targets. However, the driver will remap those
slots to the actual render targets being cleared.

This means that ir3 should not make any assumptions about the static
slot number in those cases. This is especially important when
implementing alias.rt, which statically encodes the render target.

Add an new ir3_shader_option (fragdata_dynamic_remap) which allows the
driver to indicate to ir3 that it will perform such dynamic remapping.

Signed-off-by: Job Noorman <jnoorman@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31222>
This commit is contained in:
Job Noorman 2025-01-22 15:33:48 +01:00 committed by Marge Bot
parent 2a0a317244
commit b8b3fe20b2
2 changed files with 8 additions and 0 deletions

View file

@ -606,6 +606,12 @@ struct ir3_shader_options {
struct ir3_const_allocations const_allocs;
struct ir3_shader_nir_options nir_options;
/* Whether FRAG_RESULT_DATAi slots may be dynamically remapped by the driver.
* If true, ir3 will assume it cannot statically use the value of such slots
* anywhere (e.g., as the target of alias.rt).
*/
bool fragdata_dynamic_remap;
};
/**

View file

@ -807,6 +807,8 @@ compile_shader(struct tu_device *dev, struct nir_shader *nir,
.api_wavesize = IR3_SINGLE_OR_DOUBLE,
.real_wavesize = IR3_SINGLE_OR_DOUBLE,
.const_allocs = const_allocs,
.fragdata_dynamic_remap =
idx >= GLOBAL_SH_VS_CLEAR && idx <= GLOBAL_SH_FS_CLEAR_MAX,
};
ir3_finalize_nir(dev->compiler, &options.nir_options, nir);