st/glsl_to_nir: call nir_remove_dead_variables() after lowing local indirects
authorTimothy Arceri <tarceri@itsqueeze.com>
Wed, 6 Feb 2019 09:37:14 +0000 (20:37 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Fri, 8 Feb 2019 02:54:56 +0000 (02:54 +0000)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/mesa/state_tracker/st_glsl_to_nir.cpp

index 5fc87354624f884319d9408acd847e61c405424d..686c243e508b92e5c7551478aeb371d844d1c243 100644 (file)
@@ -626,6 +626,13 @@ st_nir_link_shaders(nir_shader **producer, nir_shader **consumer, bool scalar)
 
       st_nir_opts(*producer, scalar);
       st_nir_opts(*consumer, scalar);
+
+      /* Lowering indirects can cause varying to become unused.
+       * nir_compact_varyings() depends on all dead varyings being removed so
+       * we need to call nir_remove_dead_variables() again here.
+       */
+      NIR_PASS_V(*producer, nir_remove_dead_variables, nir_var_shader_out);
+      NIR_PASS_V(*consumer, nir_remove_dead_variables, nir_var_shader_in);
    }
 }