From de221a672d9585510b7525610c1dce0c6d069e92 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 28 May 2015 10:06:45 -0700 Subject: [PATCH] meta: Add a default ds_state and use it when no ds state is set --- src/vulkan/meta.c | 15 +++++++++++++++ src/vulkan/private.h | 1 + 2 files changed, 16 insertions(+) diff --git a/src/vulkan/meta.c b/src/vulkan/meta.c index 4ce917124f9..8e9529595a2 100644 --- a/src/vulkan/meta.c +++ b/src/vulkan/meta.c @@ -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); } diff --git a/src/vulkan/private.h b/src/vulkan/private.h index f2835ba660e..96b72596a1f 100644 --- a/src/vulkan/private.h +++ b/src/vulkan/private.h @@ -311,6 +311,7 @@ struct anv_meta_state { struct { VkDynamicRsState rs_state; VkDynamicCbState cb_state; + VkDynamicDsState ds_state; } shared; }; -- 2.30.2