nir/opt_varyings: clear info->clip/cull_distance_array_size if relocated

svga breaks if shader_info declares these, but the shader is missing
the outputs.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32684>
This commit is contained in:
Marek Olšák 2024-12-19 02:45:15 -05:00 committed by Marge Bot
parent 9d129505b5
commit a50d069d1c

View file

@ -5301,6 +5301,14 @@ nir_opt_varyings(nir_shader *producer, nir_shader *consumer, bool spirv,
free_linkage(linkage);
FREE(linkage);
/* Compaction moves CLIP_DIST and CULL_DIST outputs to VARn if the next
* shader is not FS. Clear those fields in shader_info.
*/
if (consumer->info.stage <= MESA_SHADER_GEOMETRY) {
producer->info.clip_distance_array_size = 0;
producer->info.cull_distance_array_size = 0;
}
if (progress & nir_progress_producer)
nir_validate_shader(producer, "nir_opt_varyings");
if (progress & nir_progress_consumer)