nir: fix clip/cull_distance_array_size in nir_lower_clip_cull_distance_arrays

This fixes a GPU hang on radeonsi.

It only works if optimizations have already been run.

Cc: 19.3 20.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4194>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4194>
This commit is contained in:
Marek Olšák 2020-03-13 17:54:35 -04:00
parent 73812999d9
commit 3c03718fd7
1 changed files with 10 additions and 1 deletions

View File

@ -72,8 +72,17 @@ combine_clip_cull(nir_shader *nir,
cull = var;
}
if (!cull && !clip)
if (!cull && !clip) {
/* If this is run after optimizations and the variables have been
* eliminated, we should update the shader info, because no other
* place does that.
*/
if (store_info) {
nir->info.clip_distance_array_size = 0;
nir->info.cull_distance_array_size = 0;
}
return false;
}
if (!cull && clip) {
/* The GLSL IR lowering pass must have converted these to vectors */