meta: Add a default ds_state and use it when no ds state is set
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 28 May 2015 17:06:45 +0000 (10:06 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 28 May 2015 17:06:45 +0000 (10:06 -0700)
src/vulkan/meta.c
src/vulkan/private.h

index 4ce917124f9b9431dd70d1c9c01791be5bf7fc9f..8e9529595a24772b70958ea8fdb82bb307a955ce 100644 (file)
@@ -290,6 +290,11 @@ anv_cmd_buffer_clear(struct anv_cmd_buffer *cmd_buffer,
                                     VK_STATE_BIND_POINT_VIEWPORT,
                                     cmd_buffer->framebuffer->vp_state);
 
+   if (cmd_buffer->ds_state == NULL)
+      anv_CmdBindDynamicStateObject((VkCmdBuffer) cmd_buffer,
+                                    VK_STATE_BIND_POINT_DEPTH_STENCIL,
+                                    device->meta_state.shared.ds_state);
+
    anv_CmdDraw((VkCmdBuffer) cmd_buffer, 0, 3, 0, pass->num_clear_layers);
 
    /* Restore API state */
@@ -484,6 +489,10 @@ meta_prepare_blit(struct anv_cmd_buffer *cmd_buffer,
       anv_CmdBindDynamicStateObject((VkCmdBuffer) cmd_buffer,
                                     VK_STATE_BIND_POINT_RASTER,
                                     device->meta_state.shared.rs_state);
+   if (cmd_buffer->ds_state == NULL)
+      anv_CmdBindDynamicStateObject((VkCmdBuffer) cmd_buffer,
+                                    VK_STATE_BIND_POINT_DEPTH_STENCIL,
+                                    device->meta_state.shared.ds_state);
 
    saved_state->cb_state = (VkDynamicCbState) cmd_buffer->cb_state;
    anv_CmdBindDynamicStateObject((VkCmdBuffer) cmd_buffer,
@@ -1226,4 +1235,10 @@ anv_device_init_meta(struct anv_device *device)
          .sType = VK_STRUCTURE_TYPE_DYNAMIC_CB_STATE_CREATE_INFO
       },
       &device->meta_state.shared.cb_state);
+
+   anv_CreateDynamicDepthStencilState((VkDevice) device,
+      &(VkDynamicDsStateCreateInfo) {
+         .sType = VK_STRUCTURE_TYPE_DYNAMIC_DS_STATE_CREATE_INFO
+      },
+      &device->meta_state.shared.ds_state);
 }
index f2835ba660e93a145ba47ac390e517214d941b77..96b72596a1f32adc1c0e95e09a1ddebbec697f09 100644 (file)
@@ -311,6 +311,7 @@ struct anv_meta_state {
    struct {
       VkDynamicRsState                          rs_state;
       VkDynamicCbState                          cb_state;
+      VkDynamicDsState                          ds_state;
    } shared;
 };