nir/opt_varyings: Only propagate constant MS outputs, not other uniforms.

Due to how mesh shaders work, we'll need a workgroup divergence
pass in order to really prove that an output is uniform.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28685>
This commit is contained in:
Timur Kristóf 2024-04-11 13:37:35 +02:00 committed by Marge Bot
parent 5dd1461ca4
commit bf2227d0d0

View file

@ -1321,11 +1321,19 @@ gather_outputs(struct nir_builder *builder, nir_intrinsic_instr *intr, void *cb_
if (is_store) {
nir_def *value = intr->src[0].ssa;
const bool constant = value->parent_instr->type == nir_instr_type_load_const;
/* If the store instruction is executed in a divergent block, the value
* that's stored in the output becomes divergent.
*
* Mesh shaders get special treatment because we can't follow their topology,
* so we only propagate constants.
* TODO: revisit this when workgroup divergence analysis is merged.
*/
bool divergent = value->divergent ||
intr->instr.block->divergent;
const bool divergent = value->divergent ||
intr->instr.block->divergent ||
(!constant && linkage->producer_stage == MESA_SHADER_MESH);
if (!out->producer.value) {
/* This is the first store to this output. */