Allocate a null state whenever there is depth/stencil
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 22 Oct 2016 01:11:42 +0000 (18:11 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 16 Nov 2016 18:32:20 +0000 (10:32 -0800)
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/intel/vulkan/genX_cmd_buffer.c

index e076e18f7e67c36519ceb24e6a28edcfc9344001..3ee8c7586996e4893e4035ac44e31f9351516878 100644 (file)
@@ -180,18 +180,19 @@ genX(cmd_buffer_setup_attachments)(struct anv_cmd_buffer *cmd_buffer,
    }
 
    bool need_null_state = false;
-   for (uint32_t s = 0; s < pass->subpass_count; ++s) {
-      if (pass->subpasses[s].color_count == 0) {
-         need_null_state = true;
-         break;
-      }
-   }
-
-   unsigned num_states = need_null_state;
+   unsigned num_states = 0;
    for (uint32_t i = 0; i < pass->attachment_count; ++i) {
-      if (vk_format_is_color(pass->attachments[i].format))
+      if (vk_format_is_color(pass->attachments[i].format)) {
          num_states++;
+      } else {
+         /* We need a null state for any depth-stencil-only subpasses.
+          * Importantly, this includes depth/stencil clears so we create one
+          * whenever we have depth or stencil
+          */
+         need_null_state = true;
+      }
    }
+   num_states += need_null_state;
 
    const uint32_t ss_stride = align_u32(isl_dev->ss.size, isl_dev->ss.align);
    state->render_pass_states =