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 */
cull->data.location_frac = clip_array_size % 4;
}
- nir_foreach_function(function, nir) {
- if (function->impl) {
- nir_metadata_preserve(function->impl,
- nir_metadata_block_index |
- nir_metadata_dominance |
- nir_metadata_live_ssa_defs |
- nir_metadata_loop_analysis);
- }
- }
-
return true;
}
if (nir->info.stage > MESA_SHADER_VERTEX)
progress |= combine_clip_cull(nir, &nir->inputs, false);
+ nir_foreach_function(function, nir) {
+ if (!function->impl)
+ continue;
+
+ if (progress) {
+ nir_metadata_preserve(function->impl,
+ nir_metadata_block_index |
+ nir_metadata_dominance |
+ nir_metadata_live_ssa_defs |
+ nir_metadata_loop_analysis);
+ } else {
+ nir_metadata_preserve(function->impl, nir_metadata_all);
+ }
+ }
+
return progress;
}