diff --git a/src/compiler/nir/nir_range_analysis.c b/src/compiler/nir/nir_range_analysis.c index f45f6db2fd7..a50e43651bb 100644 --- a/src/compiler/nir/nir_range_analysis.c +++ b/src/compiler/nir/nir_range_analysis.c @@ -1292,7 +1292,15 @@ nir_unsigned_upper_bound(nir_shader *shader, struct hash_table *range_ht, nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(scalar.def->parent_instr); switch (intrin->intrinsic) { case nir_intrinsic_load_local_invocation_index: - if (shader->info.workgroup_size_variable) { + /* The local invocation index is used under the hood by RADV for + * some non-compute-like shaders (eg. LS and NGG). These technically + * run in workgroups on the HW, even though this fact is not exposed + * by the API. + * They can safely use the same code path here as variable sized + * compute-like shader stages. + */ + if (!gl_shader_stage_uses_workgroup(shader->info.stage) || + shader->info.workgroup_size_variable) { res = config->max_workgroup_invocations - 1; } else { res = (shader->info.workgroup_size[0] *