With the new deref instructions, we have to keep the modes consistent
between the derefs and the variables they reference.  Since we remove
outputs by changing them to local variables, we need to run the fixup
pass to fix the modes.
---
 src/intel/vulkan/anv_pipeline.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 95a686f7833..7f89c02407b 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -929,6 +929,7 @@ anv_pipeline_compile_fs(struct anv_pipeline *pipeline,
          num_rts++;
       }
 
+      bool deleted_output = false;
       nir_foreach_variable_safe(var, &nir->outputs) {
          if (var->data.location < FRAG_RESULT_DATA0)
             continue;
@@ -936,6 +937,7 @@ anv_pipeline_compile_fs(struct anv_pipeline *pipeline,
          const unsigned rt = var->data.location - FRAG_RESULT_DATA0;
          if (rt >= key.nr_color_regions) {
             /* Out-of-bounds, throw it away */
+            deleted_output = true;
             var->data.mode = nir_var_local;
             exec_node_remove(&var->node);
             exec_list_push_tail(&impl->locals, &var->node);
@@ -947,6 +949,9 @@ anv_pipeline_compile_fs(struct anv_pipeline *pipeline,
          var->data.location = rt_to_bindings[rt] + FRAG_RESULT_DATA0;
       }
 
+      if (deleted_output)
+         nir_fixup_deref_modes(nir);
+
       if (num_rts == 0) {
          /* If we have no render targets, we need a null render target */
          rt_bindings[0] = (struct anv_pipeline_binding) {
-- 
2.17.1

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to