Bug 14406: Add support for front/back stencil reference dynamic state
authorCody Northrop <cody@lunarg.com>
Tue, 18 Aug 2015 21:21:16 +0000 (15:21 -0600)
committerCody Northrop <cody@lunarg.com>
Wed, 26 Aug 2015 15:59:59 +0000 (09:59 -0600)
17 files changed:
demos/cube.c
demos/tri.c
icd/nulldrv/nulldrv.c
icd/nulldrv/nulldrv.h
include/vk_debug_report_lunarg.h
include/vk_layer.h
include/vulkan.h
layers/draw_state.cpp
layers/draw_state.h
layers/layer_common.h
layers/mem_tracker.cpp
layers/param_checker.cpp
loader/gpa_helper.h
loader/table_ops.h
loader/trampoline.c
vk-layer-generate.py
vulkan.py

index 10c6057cf22113d58369529752861994bcaeb4fc..0e68e006c6a504ca0768b126d6219309c7ba54b6 100644 (file)
@@ -368,7 +368,8 @@ struct demo {
     VkDynamicRasterLineState raster_line;
     VkDynamicRasterDepthBiasState raster_depth_bias;
     VkDynamicColorBlendState color_blend;
-    VkDynamicDepthStencilState depth_stencil;
+    VkDynamicDepthState dynamic_depth;
+    VkDynamicStencilState dynamic_stencil;
 
     mat4x4 projection_matrix;
     mat4x4 view_matrix;
@@ -544,7 +545,8 @@ static void demo_draw_build_cmd(struct demo *demo, VkCmdBuffer cmd_buf)
     vkCmdBindDynamicRasterLineState(cmd_buf,  demo->raster_line);
     vkCmdBindDynamicRasterDepthBiasState(cmd_buf,  demo->raster_depth_bias);
     vkCmdBindDynamicColorBlendState(cmd_buf, demo->color_blend);
-    vkCmdBindDynamicDepthStencilState(cmd_buf, demo->depth_stencil);
+    vkCmdBindDynamicDepthState(cmd_buf, demo->dynamic_depth);
+    vkCmdBindDynamicStencilState(cmd_buf, demo->dynamic_stencil);
 
     vkCmdDraw(cmd_buf, 0, 12 * 3, 0, 1);
     vkCmdEndRenderPass(cmd_buf);
@@ -1669,7 +1671,8 @@ static void demo_prepare_dynamic_states(struct demo *demo)
     VkDynamicRasterLineStateCreateInfo raster_line;
     VkDynamicRasterDepthBiasStateCreateInfo raster_depth_bias;
     VkDynamicColorBlendStateCreateInfo color_blend;
-    VkDynamicDepthStencilStateCreateInfo depth_stencil;
+    VkDynamicDepthStateCreateInfo depth;
+    VkDynamicStencilStateCreateInfo stencil;
     VkResult U_ASSERT_ONLY err;
 
     memset(&viewport_create, 0, sizeof(viewport_create));
@@ -1707,14 +1710,16 @@ static void demo_prepare_dynamic_states(struct demo *demo)
     color_blend.blendConst[2] = 1.0f;
     color_blend.blendConst[3] = 1.0f;
 
-    memset(&depth_stencil, 0, sizeof(depth_stencil));
-    depth_stencil.sType = VK_STRUCTURE_TYPE_DYNAMIC_DEPTH_STENCIL_STATE_CREATE_INFO;
-    depth_stencil.minDepthBounds = 0.0f;
-    depth_stencil.maxDepthBounds = 1.0f;
-    depth_stencil.stencilBackRef = 0;
-    depth_stencil.stencilFrontRef = 0;
-    depth_stencil.stencilReadMask = 0xff;
-    depth_stencil.stencilWriteMask = 0xff;
+    memset(&depth, 0, sizeof(depth));
+    depth.sType = VK_STRUCTURE_TYPE_DYNAMIC_DEPTH_STATE_CREATE_INFO;
+    depth.minDepthBounds = 0.0f;
+    depth.maxDepthBounds = 1.0f;
+
+    memset(&stencil, 0, sizeof(stencil));
+    stencil.sType = VK_STRUCTURE_TYPE_DYNAMIC_STENCIL_STATE_CREATE_INFO;
+    stencil.stencilReference = 0;
+    stencil.stencilReadMask = 0xff;
+    stencil.stencilWriteMask = 0xff;
 
     err = vkCreateDynamicViewportState(demo->device, &viewport_create, &demo->viewport);
     assert(!err);
@@ -1729,8 +1734,12 @@ static void demo_prepare_dynamic_states(struct demo *demo)
             &color_blend, &demo->color_blend);
     assert(!err);
 
-    err = vkCreateDynamicDepthStencilState(demo->device,
-            &depth_stencil, &demo->depth_stencil);
+    err = vkCreateDynamicDepthState(demo->device,
+            &depth, &demo->dynamic_depth);
+    assert(!err);
+
+    err = vkCreateDynamicStencilState(demo->device,
+            &stencil, &stencil, &demo->dynamic_stencil);
     assert(!err);
 }
 
@@ -1896,7 +1905,8 @@ static void demo_cleanup(struct demo *demo)
     vkDestroyDynamicRasterLineState(demo->device, demo->raster_line);
     vkDestroyDynamicRasterDepthBiasState(demo->device, demo->raster_depth_bias);
     vkDestroyDynamicColorBlendState(demo->device, demo->color_blend);
-    vkDestroyDynamicDepthStencilState(demo->device, demo->depth_stencil);
+    vkDestroyDynamicDepthState(demo->device, demo->dynamic_depth);
+    vkDestroyDynamicStencilState(demo->device, demo->dynamic_stencil);
 
     vkDestroyPipeline(demo->device, demo->pipeline);
     vkDestroyPipelineCache(demo->device, demo->pipelineCache);
index d0ff470d829c6e6f01745ae21d6ac8b3e93c2b97..615e5241768717db4e0707e7f3e7e154895cc464 100644 (file)
@@ -220,7 +220,8 @@ struct demo {
     VkDynamicRasterLineState raster_line;
     VkDynamicRasterDepthBiasState raster_depth_bias;
     VkDynamicColorBlendState color_blend;
-    VkDynamicDepthStencilState depth_stencil;
+    VkDynamicDepthState dynamic_depth;
+    VkDynamicStencilState dynamic_stencil;
 
     VkShaderModule vert_shader_module;
     VkShaderModule frag_shader_module;
@@ -386,7 +387,8 @@ static void demo_draw_build_cmd(struct demo *demo)
     vkCmdBindDynamicRasterLineState(demo->draw_cmd, demo->raster_line);
     vkCmdBindDynamicRasterDepthBiasState(demo->draw_cmd, demo->raster_depth_bias);
     vkCmdBindDynamicColorBlendState(demo->draw_cmd, demo->color_blend);
-    vkCmdBindDynamicDepthStencilState(demo->draw_cmd, demo->depth_stencil);
+    vkCmdBindDynamicDepthState(demo->draw_cmd, demo->dynamic_depth);
+    vkCmdBindDynamicStencilState(demo->draw_cmd, demo->dynamic_stencil);
 
     VkDeviceSize offsets[1] = {0};
     vkCmdBindVertexBuffers(demo->draw_cmd, VERTEX_BUFFER_BIND_ID, 1, &demo->vertices.buf, offsets);
@@ -1306,7 +1308,8 @@ static void demo_prepare_dynamic_states(struct demo *demo)
     VkDynamicRasterLineStateCreateInfo raster_line;
     VkDynamicRasterDepthBiasStateCreateInfo raster_depth_bias;
     VkDynamicColorBlendStateCreateInfo color_blend;
-    VkDynamicDepthStencilStateCreateInfo depth_stencil;
+    VkDynamicDepthStateCreateInfo depth;
+    VkDynamicStencilStateCreateInfo stencil;
     VkResult U_ASSERT_ONLY err;
 
     memset(&viewport_create, 0, sizeof(viewport_create));
@@ -1344,14 +1347,16 @@ static void demo_prepare_dynamic_states(struct demo *demo)
     color_blend.blendConst[2] = 1.0f;
     color_blend.blendConst[3] = 1.0f;
 
-    memset(&depth_stencil, 0, sizeof(depth_stencil));
-    depth_stencil.sType = VK_STRUCTURE_TYPE_DYNAMIC_DEPTH_STENCIL_STATE_CREATE_INFO;
-    depth_stencil.minDepthBounds = 0.0f;
-    depth_stencil.maxDepthBounds = 1.0f;
-    depth_stencil.stencilBackRef = 0;
-    depth_stencil.stencilFrontRef = 0;
-    depth_stencil.stencilReadMask = 0xff;
-    depth_stencil.stencilWriteMask = 0xff;
+    memset(&depth, 0, sizeof(depth));
+    depth.sType = VK_STRUCTURE_TYPE_DYNAMIC_DEPTH_STATE_CREATE_INFO;
+    depth.minDepthBounds = 0.0f;
+    depth.maxDepthBounds = 1.0f;
+
+    memset(&stencil, 0, sizeof(stencil));
+    stencil.sType = VK_STRUCTURE_TYPE_DYNAMIC_STENCIL_STATE_CREATE_INFO;
+    stencil.stencilReference = 0;
+    stencil.stencilReadMask = 0xff;
+    stencil.stencilWriteMask = 0xff;
 
     err = vkCreateDynamicViewportState(demo->device, &viewport_create, &demo->viewport);
     assert(!err);
@@ -1366,8 +1371,12 @@ static void demo_prepare_dynamic_states(struct demo *demo)
             &color_blend, &demo->color_blend);
     assert(!err);
 
-    err = vkCreateDynamicDepthStencilState(demo->device,
-            &depth_stencil, &demo->depth_stencil);
+    err = vkCreateDynamicDepthState(demo->device,
+            &depth, &demo->dynamic_depth);
+    assert(!err);
+
+    err = vkCreateDynamicStencilState(demo->device,
+            &stencil, &stencil, &demo->dynamic_stencil);
     assert(!err);
 }
 
@@ -2116,7 +2125,8 @@ static void demo_cleanup(struct demo *demo)
     vkDestroyDynamicRasterLineState(demo->device, demo->raster_line);
     vkDestroyDynamicRasterDepthBiasState(demo->device, demo->raster_depth_bias);
     vkDestroyDynamicColorBlendState(demo->device, demo->color_blend);
-    vkDestroyDynamicDepthStencilState(demo->device, demo->depth_stencil);
+    vkDestroyDynamicDepthState(demo->device, demo->dynamic_depth);
+    vkDestroyDynamicStencilState(demo->device, demo->dynamic_stencil);
 
     vkDestroyPipeline(demo->device, demo->pipeline);
     vkDestroyRenderPass(demo->device, demo->render_pass);
index 37a93249e16904b8f5b88b93e430c8c3114b363e..1a5a158a78b1c83b7e2cb4e7b6da197c46f8af4e 100644 (file)
@@ -566,14 +566,14 @@ static VkResult nulldrv_blend_state_create(struct nulldrv_dev *dev,
     return VK_SUCCESS;
 }
 
-static VkResult nulldrv_ds_state_create(struct nulldrv_dev *dev,
-                                 const VkDynamicDepthStencilStateCreateInfo *info,
-                                 struct nulldrv_dynamic_ds **state_ret)
+static VkResult nulldrv_depth_state_create(struct nulldrv_dev *dev,
+                                 const VkDynamicDepthStateCreateInfo *info,
+                                 struct nulldrv_dynamic_depth **state_ret)
 {
-    struct nulldrv_dynamic_ds *state;
+    struct nulldrv_dynamic_depth *state;
 
-    state = (struct nulldrv_dynamic_ds *) nulldrv_base_create(dev,
-            sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_DEPTH_STENCIL_STATE);
+    state = (struct nulldrv_dynamic_depth *) nulldrv_base_create(dev,
+            sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_DEPTH_STATE);
     if (!state)
         return VK_ERROR_OUT_OF_HOST_MEMORY;
 
@@ -582,6 +582,22 @@ static VkResult nulldrv_ds_state_create(struct nulldrv_dev *dev,
     return VK_SUCCESS;
 }
 
+static VkResult nulldrv_stencil_state_create(struct nulldrv_dev *dev,
+                                 const VkDynamicStencilStateCreateInfo *infoFront,
+                                 const VkDynamicStencilStateCreateInfo *infoBack,
+                                 struct nulldrv_dynamic_stencil **state_ret)
+{
+    struct nulldrv_dynamic_stencil *state;
+
+    state = (struct nulldrv_dynamic_stencil *) nulldrv_base_create(dev,
+            sizeof(*state), VK_OBJECT_TYPE_DYNAMIC_STENCIL_STATE);
+    if (!state)
+        return VK_ERROR_OUT_OF_HOST_MEMORY;
+
+    *state_ret = state;
+
+    return VK_SUCCESS;
+}
 
 static VkResult nulldrv_cmd_create(struct nulldrv_dev *dev,
                             const VkCmdBufferCreateInfo *info,
@@ -1215,9 +1231,16 @@ ICD_EXPORT void VKAPI vkCmdBindDynamicColorBlendState(
     NULLDRV_LOG_FUNC;
 }
 
-ICD_EXPORT void VKAPI vkCmdBindDynamicDepthStencilState(
+ICD_EXPORT void VKAPI vkCmdBindDynamicDepthState(
+    VkCmdBuffer                               cmdBuffer,
+    VkDynamicDepthState                       state)
+{
+    NULLDRV_LOG_FUNC;
+}
+
+ICD_EXPORT void VKAPI vkCmdBindDynamicStencilState(
     VkCmdBuffer                               cmdBuffer,
-    VkDynamicDepthStencilState                    state)
+    VkDynamicStencilState                     state)
 {
     NULLDRV_LOG_FUNC;
 }
@@ -2152,21 +2175,42 @@ ICD_EXPORT VkResult VKAPI vkDestroyDynamicColorBlendState(
     return VK_SUCCESS;
 }
 
-ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
+ICD_EXPORT VkResult VKAPI vkCreateDynamicDepthState(
+    VkDevice                                     device,
+    const VkDynamicDepthStateCreateInfo*         pCreateInfo,
+    VkDynamicDepthState*                         pState)
+{
+    NULLDRV_LOG_FUNC;
+    struct nulldrv_dev *dev = nulldrv_dev(device);
+
+    return nulldrv_depth_state_create(dev, pCreateInfo,
+            (struct nulldrv_dynamic_depth **) pState);
+}
+
+ICD_EXPORT VkResult VKAPI vkDestroyDynamicDepthState(
+    VkDevice                                  device,
+    VkDynamicDepthState                       dynamicDepthState)
+{
+    NULLDRV_LOG_FUNC;
+    return VK_SUCCESS;
+}
+
+ICD_EXPORT VkResult VKAPI vkCreateDynamicStencilState(
     VkDevice                                     device,
-    const VkDynamicDepthStencilStateCreateInfo*  pCreateInfo,
-    VkDynamicDepthStencilState*                  pState)
+    const VkDynamicStencilStateCreateInfo*       pCreateInfoFront,
+    const VkDynamicStencilStateCreateInfo*       pCreateInfoBack,
+    VkDynamicStencilState*                       pState)
 {
     NULLDRV_LOG_FUNC;
     struct nulldrv_dev *dev = nulldrv_dev(device);
 
-    return nulldrv_ds_state_create(dev, pCreateInfo,
-            (struct nulldrv_dynamic_ds **) pState);
+    return nulldrv_stencil_state_create(dev, pCreateInfoFront, pCreateInfoBack,
+            (struct nulldrv_dynamic_stencil **) pState);
 }
 
-ICD_EXPORT VkResult VKAPI vkDestroyDynamicDepthStencilState(
+ICD_EXPORT VkResult VKAPI vkDestroyDynamicStencilState(
     VkDevice                                  device,
-    VkDynamicDepthStencilState                dynamicDepthStencilState)
+    VkDynamicStencilState                     dynamicStencilState)
 {
     NULLDRV_LOG_FUNC;
     return VK_SUCCESS;
index 191db68fb752502f855762956e0a8671087e421d..bf0262981e53bbe8055609bc7d3fcb101b48b41f 100644 (file)
@@ -160,7 +160,11 @@ struct nulldrv_dynamic_cb {
     struct nulldrv_obj obj;
 };
 
-struct nulldrv_dynamic_ds {
+struct nulldrv_dynamic_depth {
+    struct nulldrv_obj obj;
+};
+
+struct nulldrv_dynamic_stencil {
     struct nulldrv_obj obj;
 };
 
index bafdc87202d405b49816e5085c8960cab9116ca5..e466e0a946307ce8ab1061f1c81f32f14bb7a882 100644 (file)
@@ -70,16 +70,17 @@ typedef enum {
     VK_OBJECT_TYPE_DYNAMIC_RASTER_LINE_STATE = 21,
     VK_OBJECT_TYPE_DYNAMIC_RASTER_DEPTH_BIAS_STATE = 22,
     VK_OBJECT_TYPE_DYNAMIC_COLOR_BLEND_STATE = 23,
-    VK_OBJECT_TYPE_DYNAMIC_DEPTH_STENCIL_STATE = 24,
-    VK_OBJECT_TYPE_FENCE = 25,
-    VK_OBJECT_TYPE_SEMAPHORE = 26,
-    VK_OBJECT_TYPE_EVENT = 27,
-    VK_OBJECT_TYPE_QUERY_POOL = 28,
-    VK_OBJECT_TYPE_FRAMEBUFFER = 29,
-    VK_OBJECT_TYPE_RENDER_PASS = 30,
-    VK_OBJECT_TYPE_PIPELINE_CACHE = 31,
-    VK_OBJECT_TYPE_SWAP_CHAIN_WSI = 32,
-    VK_OBJECT_TYPE_CMD_POOL = 33,
+    VK_OBJECT_TYPE_DYNAMIC_DEPTH_STATE = 24,
+    VK_OBJECT_TYPE_DYNAMIC_STENCIL_STATE = 25,
+    VK_OBJECT_TYPE_FENCE = 26,
+    VK_OBJECT_TYPE_SEMAPHORE = 27,
+    VK_OBJECT_TYPE_EVENT = 28,
+    VK_OBJECT_TYPE_QUERY_POOL = 29,
+    VK_OBJECT_TYPE_FRAMEBUFFER = 30,
+    VK_OBJECT_TYPE_RENDER_PASS = 31,
+    VK_OBJECT_TYPE_PIPELINE_CACHE = 32,
+    VK_OBJECT_TYPE_SWAP_CHAIN_WSI = 33,
+    VK_OBJECT_TYPE_CMD_POOL = 34,
     VK_OBJECT_TYPE_BEGIN_RANGE = VK_OBJECT_TYPE_INSTANCE,
     VK_OBJECT_TYPE_END_RANGE = VK_OBJECT_TYPE_CMD_POOL,
     VK_OBJECT_TYPE_NUM = (VK_OBJECT_TYPE_CMD_POOL - VK_OBJECT_TYPE_INSTANCE + 1),
@@ -112,8 +113,10 @@ static inline const char* string_VkDbgObjectType(VkDbgObjectType input_value)
             return "VK_OBJECT_TYPE_DEVICE_MEMORY";
         case VK_OBJECT_TYPE_DYNAMIC_COLOR_BLEND_STATE:
             return "VK_OBJECT_TYPE_DYNAMIC_COLOR_BLEND_STATE";
-        case VK_OBJECT_TYPE_DYNAMIC_DEPTH_STENCIL_STATE:
-            return "VK_OBJECT_TYPE_DYNAMIC_DEPTH_STENCIL_STATE";
+        case VK_OBJECT_TYPE_DYNAMIC_DEPTH_STATE:
+            return "VK_OBJECT_TYPE_DYNAMIC_DEPTH_STATE";
+        case VK_OBJECT_TYPE_DYNAMIC_STENCIL_STATE:
+            return "VK_OBJECT_TYPE_DYNAMIC_STENCIL_STATE";
         case VK_OBJECT_TYPE_DYNAMIC_RASTER_LINE_STATE:
             return "VK_OBJECT_TYPE_DYNAMIC_RASTER_LINE_STATE";
         case VK_OBJECT_TYPE_DYNAMIC_RASTER_DEPTH_BIAS_STATE:
index 3c3cbada36ade1676e2a997e11a82d5792bd085d..028da8a36db8eaa7a7476733fbdd7a3d611669e0 100644 (file)
@@ -110,8 +110,10 @@ typedef struct VkLayerDispatchTable_
     PFN_vkDestroyDynamicRasterDepthBiasState DestroyDynamicRasterDepthBiasState;
     PFN_vkCreateDynamicColorBlendState CreateDynamicColorBlendState;
     PFN_vkDestroyDynamicColorBlendState DestroyDynamicColorBlendState;
-    PFN_vkCreateDynamicDepthStencilState CreateDynamicDepthStencilState;
-    PFN_vkDestroyDynamicDepthStencilState DestroyDynamicDepthStencilState;
+    PFN_vkCreateDynamicDepthState CreateDynamicDepthState;
+    PFN_vkDestroyDynamicDepthState DestroyDynamicDepthState;
+    PFN_vkCreateDynamicStencilState CreateDynamicStencilState;
+    PFN_vkDestroyDynamicStencilState DestroyDynamicStencilState;
     PFN_vkCreateFramebuffer CreateFramebuffer;
     PFN_vkDestroyFramebuffer DestroyFramebuffer;
     PFN_vkCreateRenderPass CreateRenderPass;
@@ -130,7 +132,8 @@ typedef struct VkLayerDispatchTable_
     PFN_vkCmdBindDynamicRasterLineState CmdBindDynamicRasterLineState;
     PFN_vkCmdBindDynamicRasterDepthBiasState CmdBindDynamicRasterDepthBiasState;
     PFN_vkCmdBindDynamicColorBlendState CmdBindDynamicColorBlendState;
-    PFN_vkCmdBindDynamicDepthStencilState CmdBindDynamicDepthStencilState;
+    PFN_vkCmdBindDynamicDepthState CmdBindDynamicDepthState;
+    PFN_vkCmdBindDynamicStencilState CmdBindDynamicStencilState;
     PFN_vkCmdBindDescriptorSets CmdBindDescriptorSets;
     PFN_vkCmdBindVertexBuffers CmdBindVertexBuffers;
     PFN_vkCmdBindIndexBuffer CmdBindIndexBuffer;
index 662923735db08d2730b29eb3a755be01be802904..5dbb64e6c8aacd3197a180ead59b15fb174d49bb 100644 (file)
@@ -122,7 +122,8 @@ VK_DEFINE_NONDISP_HANDLE(VkDynamicViewportState)
 VK_DEFINE_NONDISP_HANDLE(VkDynamicRasterLineState)
 VK_DEFINE_NONDISP_HANDLE(VkDynamicRasterDepthBiasState)
 VK_DEFINE_NONDISP_HANDLE(VkDynamicColorBlendState)
-VK_DEFINE_NONDISP_HANDLE(VkDynamicDepthStencilState)
+VK_DEFINE_NONDISP_HANDLE(VkDynamicDepthState)
+VK_DEFINE_NONDISP_HANDLE(VkDynamicStencilState)
 VK_DEFINE_NONDISP_HANDLE(VkFramebuffer)
 VK_DEFINE_NONDISP_HANDLE(VkCmdPool)
 
@@ -203,43 +204,44 @@ typedef enum {
     VK_STRUCTURE_TYPE_DYNAMIC_RASTER_LINE_STATE_CREATE_INFO = 11,
     VK_STRUCTURE_TYPE_DYNAMIC_RASTER_DEPTH_BIAS_STATE_CREATE_INFO = 12,
     VK_STRUCTURE_TYPE_DYNAMIC_COLOR_BLEND_STATE_CREATE_INFO = 13,
-    VK_STRUCTURE_TYPE_DYNAMIC_DEPTH_STENCIL_STATE_CREATE_INFO = 14,
-    VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO = 15,
-    VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 16,
-    VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 17,
-    VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 18,
-    VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 19,
-    VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 20,
-    VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 21,
-    VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 22,
-    VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 23,
-    VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 24,
-    VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 25,
-    VK_STRUCTURE_TYPE_PIPELINE_RASTER_STATE_CREATE_INFO = 26,
-    VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 27,
-    VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 28,
-    VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 29,
-    VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 30,
-    VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 31,
-    VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 32,
-    VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 33,
-    VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO = 34,
-    VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 35,
-    VK_STRUCTURE_TYPE_MEMORY_BARRIER = 36,
-    VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 37,
-    VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 38,
-    VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 39,
-    VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 40,
-    VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 41,
-    VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 42,
-    VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 43,
-    VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 44,
-    VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 45,
-    VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION = 46,
-    VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION = 47,
-    VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY = 48,
-    VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 49,
-    VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO = 50,
+    VK_STRUCTURE_TYPE_DYNAMIC_DEPTH_STATE_CREATE_INFO = 14,
+    VK_STRUCTURE_TYPE_DYNAMIC_STENCIL_STATE_CREATE_INFO = 15,
+    VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO = 16,
+    VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 17,
+    VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 18,
+    VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 19,
+    VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 20,
+    VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 21,
+    VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 22,
+    VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 23,
+    VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 24,
+    VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 25,
+    VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 26,
+    VK_STRUCTURE_TYPE_PIPELINE_RASTER_STATE_CREATE_INFO = 27,
+    VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 28,
+    VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 29,
+    VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 30,
+    VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 31,
+    VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 32,
+    VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 33,
+    VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 34,
+    VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO = 35,
+    VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 36,
+    VK_STRUCTURE_TYPE_MEMORY_BARRIER = 37,
+    VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 38,
+    VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 39,
+    VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 40,
+    VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 41,
+    VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 42,
+    VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 43,
+    VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 44,
+    VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 45,
+    VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 46,
+    VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION = 47,
+    VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION = 48,
+    VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY = 49,
+    VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 50,
+    VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO = 51,
     VK_STRUCTURE_TYPE_BEGIN_RANGE = VK_STRUCTURE_TYPE_APPLICATION_INFO,
     VK_STRUCTURE_TYPE_END_RANGE = VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO,
     VK_STRUCTURE_TYPE_NUM = (VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO - VK_STRUCTURE_TYPE_APPLICATION_INFO + 1),
@@ -1876,11 +1878,15 @@ typedef struct {
     const void*                                 pNext;
     float                                       minDepthBounds;
     float                                       maxDepthBounds;
+} VkDynamicDepthStateCreateInfo;
+
+typedef struct {
+    VkStructureType                             sType;
+    const void*                                 pNext;
     uint32_t                                    stencilReadMask;
     uint32_t                                    stencilWriteMask;
-    uint32_t                                    stencilFrontRef;
-    uint32_t                                    stencilBackRef;
-} VkDynamicDepthStencilStateCreateInfo;
+    uint32_t                                    stencilReference;
+} VkDynamicStencilStateCreateInfo;
 
 typedef struct {
     VkStructureType                             sType;
@@ -2196,8 +2202,10 @@ typedef VkResult (VKAPI *PFN_vkCreateDynamicRasterDepthBiasState)(VkDevice devic
 typedef VkResult (VKAPI *PFN_vkDestroyDynamicRasterDepthBiasState)(VkDevice device, VkDynamicRasterDepthBiasState dynamicRasterDepthBiasState);
 typedef VkResult (VKAPI *PFN_vkCreateDynamicColorBlendState)(VkDevice device, const VkDynamicColorBlendStateCreateInfo* pCreateInfo, VkDynamicColorBlendState* pState);
 typedef VkResult (VKAPI *PFN_vkDestroyDynamicColorBlendState)(VkDevice device, VkDynamicColorBlendState dynamicColorBlendState);
-typedef VkResult (VKAPI *PFN_vkCreateDynamicDepthStencilState)(VkDevice device, const VkDynamicDepthStencilStateCreateInfo* pCreateInfo, VkDynamicDepthStencilState* pState);
-typedef VkResult (VKAPI *PFN_vkDestroyDynamicDepthStencilState)(VkDevice device, VkDynamicDepthStencilState dynamicDepthStencilState);
+typedef VkResult (VKAPI *PFN_vkCreateDynamicDepthState)(VkDevice device, const VkDynamicDepthStateCreateInfo* pCreateInfo, VkDynamicDepthState* pState);
+typedef VkResult (VKAPI *PFN_vkDestroyDynamicDepthState)(VkDevice device, VkDynamicDepthState dynamicDepthState);
+typedef VkResult (VKAPI *PFN_vkCreateDynamicStencilState)(VkDevice device, const VkDynamicStencilStateCreateInfo* pCreateInfoFront, const VkDynamicStencilStateCreateInfo* pCreateInfoBack, VkDynamicStencilState* pState);
+typedef VkResult (VKAPI *PFN_vkDestroyDynamicStencilState)(VkDevice device, VkDynamicStencilState dynamicStencilState);
 typedef VkResult (VKAPI *PFN_vkCreateFramebuffer)(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, VkFramebuffer* pFramebuffer);
 typedef VkResult (VKAPI *PFN_vkDestroyFramebuffer)(VkDevice device, VkFramebuffer framebuffer);
 typedef VkResult (VKAPI *PFN_vkCreateRenderPass)(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, VkRenderPass* pRenderPass);
@@ -2216,7 +2224,8 @@ typedef void (VKAPI *PFN_vkCmdBindDynamicViewportState)(VkCmdBuffer cmdBuffer, V
 typedef void (VKAPI *PFN_vkCmdBindDynamicRasterLineState)(VkCmdBuffer cmdBuffer, VkDynamicRasterLineState dynamicRasterLineState);
 typedef void (VKAPI *PFN_vkCmdBindDynamicRasterDepthBiasState)(VkCmdBuffer cmdBuffer, VkDynamicRasterDepthBiasState dynamicRasterDepthBiasState);
 typedef void (VKAPI *PFN_vkCmdBindDynamicColorBlendState)(VkCmdBuffer cmdBuffer, VkDynamicColorBlendState dynamicColorBlendState);
-typedef void (VKAPI *PFN_vkCmdBindDynamicDepthStencilState)(VkCmdBuffer cmdBuffer, VkDynamicDepthStencilState dynamicDepthStencilState);
+typedef void (VKAPI *PFN_vkCmdBindDynamicDepthState)(VkCmdBuffer cmdBuffer, VkDynamicDepthState dynamicDepthState);
+typedef void (VKAPI *PFN_vkCmdBindDynamicStencilState)(VkCmdBuffer cmdBuffer, VkDynamicStencilState dynamicStencilState);
 typedef void (VKAPI *PFN_vkCmdBindDescriptorSets)(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t setCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets);
 typedef void (VKAPI *PFN_vkCmdBindIndexBuffer)(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType);
 typedef void (VKAPI *PFN_vkCmdBindVertexBuffers)(VkCmdBuffer cmdBuffer, uint32_t startBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets);
@@ -2711,12 +2720,12 @@ VkResult VKAPI vkDestroyDynamicViewportState(
     VkDynamicViewportState                      dynamicViewportState);
 
 VkResult VKAPI vkCreateDynamicRasterLineState(
-     VkDevice                                    device,
+    VkDevice                                    device,
     const VkDynamicRasterLineStateCreateInfo*   pCreateInfo,
     VkDynamicRasterLineState*                   pState);
 
 VkResult VKAPI vkDestroyDynamicRasterLineState(
-     VkDevice                                    device,
+    VkDevice                                    device,
     VkDynamicRasterLineState                    dynamicRasterLineState);
 
 VkResult VKAPI vkCreateDynamicRasterDepthBiasState(
@@ -2737,14 +2746,24 @@ VkResult VKAPI vkDestroyDynamicColorBlendState(
     VkDevice                                    device,
     VkDynamicColorBlendState                    dynamicColorBlendState);
 
-VkResult VKAPI vkCreateDynamicDepthStencilState(
+VkResult VKAPI vkCreateDynamicDepthState(
     VkDevice                                    device,
-    const VkDynamicDepthStencilStateCreateInfo* pCreateInfo,
-    VkDynamicDepthStencilState*                 pState);
+    const VkDynamicDepthStateCreateInfo*        pCreateInfo,
+    VkDynamicDepthState*                        pState);
 
-VkResult VKAPI vkDestroyDynamicDepthStencilState(
+VkResult VKAPI vkDestroyDynamicDepthState(
     VkDevice                                    device,
-    VkDynamicDepthStencilState                  dynamicDepthStencilState);
+    VkDynamicDepthState                         dynamicDepthState);
+
+VkResult VKAPI vkCreateDynamicStencilState(
+    VkDevice                                    device,
+    const VkDynamicStencilStateCreateInfo*      pCreateInfoFront,
+    const VkDynamicStencilStateCreateInfo*      pCreateInfoBack,
+    VkDynamicStencilState*                      pState);
+
+VkResult VKAPI vkDestroyDynamicStencilState(
+    VkDevice                                    device,
+    VkDynamicStencilState                       dynamicStencilState);
 
 VkResult VKAPI vkCreateFramebuffer(
     VkDevice                                    device,
@@ -2824,9 +2843,13 @@ void VKAPI vkCmdBindDynamicColorBlendState(
     VkCmdBuffer                                 cmdBuffer,
     VkDynamicColorBlendState                    dynamicColorBlendState);
 
-void VKAPI vkCmdBindDynamicDepthStencilState(
+void VKAPI vkCmdBindDynamicDepthState(
+    VkCmdBuffer                                 cmdBuffer,
+    VkDynamicDepthState                         dynamicDepthState);
+
+void VKAPI vkCmdBindDynamicStencilState(
     VkCmdBuffer                                 cmdBuffer,
-    VkDynamicDepthStencilState                  dynamicDepthStencilState);
+    VkDynamicStencilState                       dynamicStencilState);
 
 void VKAPI vkCmdBindDescriptorSets(
     VkCmdBuffer                                 cmdBuffer,
index c465768b0f0fea0cbd8d73a5eb4488cd422a1287..a05fc659cb5e781629e3a96e5ff3730592b34e17 100644 (file)
@@ -68,7 +68,8 @@ unordered_map<uint64_t, VkDynamicViewportStateCreateInfo> dynamicVpStateMap;
 unordered_map<uint64_t, VkDynamicRasterLineStateCreateInfo> dynamicRasterLineStateMap;
 unordered_map<uint64_t, VkDynamicRasterDepthBiasStateCreateInfo> dynamicRasterDepthBiasStateMap;
 unordered_map<uint64_t, VkDynamicColorBlendStateCreateInfo> dynamicCbStateMap;
-unordered_map<uint64_t, VkDynamicDepthStencilStateCreateInfo> dynamicDsStateMap;
+unordered_map<uint64_t, VkDynamicDepthStateCreateInfo> dynamicDepthStateMap;
+unordered_map<uint64_t, std::pair<VkDynamicStencilStateCreateInfo, VkDynamicStencilStateCreateInfo>> dynamicStencilStateMap;
 unordered_map<uint64_t, PIPELINE_NODE*> pipelineMap;
 unordered_map<uint64_t, POOL_NODE*> poolMap;
 unordered_map<uint64_t, SET_NODE*> setMap;
@@ -147,8 +148,10 @@ static string cmdTypeToString(CMD_TYPE cmd)
             return "CMD_BINDDYNAMICRASTERDEPTHBIASSTATE";
         case CMD_BINDDYNAMICCOLORBLENDSTATE:
             return "CMD_BINDDYNAMICCOLORBLENDSTATE";
-        case CMD_BINDDYNAMICDEPTHSTENCILSTATE:
-            return "CMD_BINDDYNAMICDEPTHSTENCILSTATE";
+        case CMD_BINDDYNAMICDEPTHSTATE:
+            return "CMD_BINDDYNAMICDEPTHSTATE";
+        case CMD_BINDDYNAMICSTENCILSTATE:
+            return "CMD_BINDDYNAMICSTENCILSTATE";
         case CMD_BINDDESCRIPTORSETS:
             return "CMD_BINDDESCRIPTORSETS";
         case CMD_BINDINDEXBUFFER:
@@ -263,7 +266,8 @@ static void deleteDynamicState()
     dynamicRasterLineStateMap.clear();
     dynamicRasterDepthBiasStateMap.clear();
     dynamicCbStateMap.clear();
-    dynamicDsStateMap.clear();
+    dynamicDepthStateMap.clear();
+    dynamicStencilStateMap.clear();
 }
 // Free all sampler nodes
 static void deleteSamplers()
@@ -368,8 +372,10 @@ static void* getDynamicStateCreateInfo(const uint64_t handle, const DYNAMIC_STAT
             return (void*)&dynamicRasterDepthBiasStateMap[handle];
         case VK_STATE_BIND_POINT_COLOR_BLEND:
             return (void*)&dynamicCbStateMap[handle];
-        case VK_STATE_BIND_POINT_DEPTH_STENCIL:
-            return (void*)&dynamicDsStateMap[handle];
+        case VK_STATE_BIND_POINT_DEPTH:
+            return (void*)&dynamicDepthStateMap[handle];
+        case VK_STATE_BIND_POINT_STENCIL:
+            return (void*)&dynamicStencilStateMap[handle];
         default:
             return NULL;
     }
@@ -418,7 +424,8 @@ static VkBool32 validate_draw_state_flags(GLOBAL_CB_NODE* pCB, VkBool32 indexedD
     result &= validate_status(pCB, CBSTATUS_NONE, CBSTATUS_RASTER_LINE_BOUND,   CBSTATUS_RASTER_LINE_BOUND,   VK_DBG_REPORT_ERROR_BIT, DRAWSTATE_RASTER_LINE_NOT_BOUND,   "Raster line object not bound to this command buffer");
     result &= validate_status(pCB, CBSTATUS_NONE, CBSTATUS_RASTER_DEPTH_BIAS_BOUND,   CBSTATUS_RASTER_DEPTH_BIAS_BOUND,   VK_DBG_REPORT_ERROR_BIT, DRAWSTATE_RASTER_DEPTH_BIAS_NOT_BOUND,   "Raster depth bias object not bound to this command buffer");
     result &= validate_status(pCB, CBSTATUS_COLOR_BLEND_WRITE_ENABLE, CBSTATUS_COLOR_BLEND_BOUND,   CBSTATUS_COLOR_BLEND_BOUND,   VK_DBG_REPORT_ERROR_BIT,  DRAWSTATE_COLOR_BLEND_NOT_BOUND,   "Color-blend object not bound to this command buffer");
-    result &= validate_status(pCB, CBSTATUS_DEPTH_STENCIL_WRITE_ENABLE, CBSTATUS_DEPTH_STENCIL_BOUND, CBSTATUS_DEPTH_STENCIL_BOUND, VK_DBG_REPORT_ERROR_BIT,  DRAWSTATE_DEPTH_STENCIL_NOT_BOUND, "Depth-stencil object not bound to this command buffer");
+    result &= validate_status(pCB, CBSTATUS_DEPTH_WRITE_ENABLE, CBSTATUS_DEPTH_BOUND, CBSTATUS_DEPTH_BOUND, VK_DBG_REPORT_ERROR_BIT,  DRAWSTATE_DEPTH_NOT_BOUND, "Depth object not bound to this command buffer");
+    result &= validate_status(pCB, CBSTATUS_STENCIL_TEST_ENABLE, CBSTATUS_STENCIL_BOUND, CBSTATUS_STENCIL_BOUND, VK_DBG_REPORT_ERROR_BIT,  DRAWSTATE_STENCIL_NOT_BOUND, "Stencil object not bound to this command buffer");
     if (indexedDraw)
         result &= validate_status(pCB, CBSTATUS_NONE, CBSTATUS_INDEX_BUFFER_BOUND, CBSTATUS_INDEX_BUFFER_BOUND, VK_DBG_REPORT_ERROR_BIT, DRAWSTATE_INDEX_BUFFER_NOT_BOUND, "Index buffer object not bound to this command buffer when Index Draw attempted");
     return result;
@@ -1135,7 +1142,11 @@ static void set_cb_pso_status(GLOBAL_CB_NODE* pCB, const PIPELINE_NODE* pPipe)
         }
     }
     if (pPipe->dsStateCI.depthWriteEnable) {
-        pCB->status |= CBSTATUS_DEPTH_STENCIL_WRITE_ENABLE;
+        pCB->status |= CBSTATUS_DEPTH_WRITE_ENABLE;
+    }
+
+    if (pPipe->dsStateCI.stencilTestEnable) {
+        pCB->status |= CBSTATUS_STENCIL_TEST_ENABLE;
     }
 }
 // Set dyn-state related status bits for an object node
@@ -1148,8 +1159,10 @@ static void set_cb_dyn_status(GLOBAL_CB_NODE* pNode, DYNAMIC_STATE_BIND_POINT st
         pNode->status |= CBSTATUS_RASTER_DEPTH_BIAS_BOUND;
     } else if (stateBindPoint == VK_STATE_BIND_POINT_COLOR_BLEND) {
         pNode->status |= CBSTATUS_COLOR_BLEND_BOUND;
-    } else if (stateBindPoint == VK_STATE_BIND_POINT_DEPTH_STENCIL) {
-        pNode->status |= CBSTATUS_DEPTH_STENCIL_BOUND;
+    } else if (stateBindPoint == VK_STATE_BIND_POINT_DEPTH) {
+        pNode->status |= CBSTATUS_DEPTH_BOUND;
+    } else if (stateBindPoint == VK_STATE_BIND_POINT_STENCIL) {
+        pNode->status |= CBSTATUS_STENCIL_BOUND;
     }
 }
 // Print the last bound Gfx Pipeline
@@ -1635,9 +1648,16 @@ VK_LAYER_EXPORT VkResult VKAPI vkDestroyDynamicColorBlendState(VkDevice device,
     return result;
 }
 
-VK_LAYER_EXPORT VkResult VKAPI vkDestroyDynamicDepthStencilState(VkDevice device, VkDynamicDepthStencilState dynamicDepthStencilState)
+VK_LAYER_EXPORT VkResult VKAPI vkDestroyDynamicDepthState(VkDevice device, VkDynamicDepthState dynamicDepthState)
+{
+    VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyDynamicDepthState(device, dynamicDepthState);
+    // TODO : Clean up any internal data structures using this obj.
+    return result;
+}
+
+VK_LAYER_EXPORT VkResult VKAPI vkDestroyDynamicStencilState(VkDevice device, VkDynamicStencilState dynamicStencilState)
 {
-    VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyDynamicDepthStencilState(device, dynamicDepthStencilState);
+    VkResult result = get_dispatch_table(draw_state_device_table_map, device)->DestroyDynamicStencilState(device, dynamicStencilState);
     // TODO : Clean up any internal data structures using this obj.
     return result;
 }
@@ -1997,12 +2017,28 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(VkDevice device, c
     return result;
 }
 
-VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(VkDevice device, const VkDynamicDepthStencilStateCreateInfo* pCreateInfo, VkDynamicDepthStencilState* pState)
+VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicDepthState(VkDevice device, const VkDynamicDepthStateCreateInfo* pCreateInfo, VkDynamicDepthState* pState)
+{
+    VkResult result = get_dispatch_table(draw_state_device_table_map, device)->CreateDynamicDepthState(device, pCreateInfo, pState);
+    //insertDynamicState(*pState, (GENERIC_HEADER*)pCreateInfo, VK_STATE_BIND_POINT_DEPTH);
+    loader_platform_thread_lock_mutex(&globalLock);
+    dynamicDepthStateMap[pState->handle] = *pCreateInfo;
+    loader_platform_thread_unlock_mutex(&globalLock);
+    return result;
+}
+
+VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicStencilState(VkDevice device, const VkDynamicStencilStateCreateInfo* pCreateInfoFront, const VkDynamicStencilStateCreateInfo* pCreateInfoBack, VkDynamicStencilState* pState)
 {
-    VkResult result = get_dispatch_table(draw_state_device_table_map, device)->CreateDynamicDepthStencilState(device, pCreateInfo, pState);
-    //insertDynamicState(*pState, (GENERIC_HEADER*)pCreateInfo, VK_STATE_BIND_POINT_DEPTH_STENCIL);
+    VkResult result = get_dispatch_table(draw_state_device_table_map, device)->CreateDynamicStencilState(device, pCreateInfoFront, pCreateInfoBack, pState);
+    //insertDynamicState(*pState, (GENERIC_HEADER*)pCreateInfo, VK_STATE_BIND_POINT_STENCIL);
     loader_platform_thread_lock_mutex(&globalLock);
-    dynamicDsStateMap[pState->handle] = *pCreateInfo;
+
+    // Bug 14406 - If back is NULL or equal to front, then single sided.
+    // To support NULL case, simply track front twice
+    const VkDynamicStencilStateCreateInfo* pLocalCreateInfoBack = (pCreateInfoBack == NULL) ? pCreateInfoFront : pCreateInfoBack;
+
+    std::pair<VkDynamicStencilStateCreateInfo, VkDynamicStencilStateCreateInfo> infos(*pCreateInfoFront, *pLocalCreateInfoBack);
+    dynamicStencilStateMap[pState->handle] = infos;
     loader_platform_thread_unlock_mutex(&globalLock);
     return result;
 }
@@ -2232,30 +2268,57 @@ VK_LAYER_EXPORT void VKAPI vkCmdBindDynamicColorBlendState(VkCmdBuffer cmdBuffer
         }
     }
 }
-VK_LAYER_EXPORT void VKAPI vkCmdBindDynamicDepthStencilState(VkCmdBuffer cmdBuffer, VkDynamicDepthStencilState dynamicDepthStencilState)
+VK_LAYER_EXPORT void VKAPI vkCmdBindDynamicDepthState(VkCmdBuffer cmdBuffer, VkDynamicDepthState dynamicDepthState)
+{
+    GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer);
+    if (pCB) {
+        if (pCB->state == CB_UPDATE_ACTIVE) {
+            updateCBTracking(cmdBuffer);
+            addCmd(pCB, CMD_BINDDYNAMICDEPTHSTATE);
+            if (!pCB->activeRenderPass) {
+                log_msg(mdd(pCB->cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NO_ACTIVE_RENDERPASS, "DS",
+                        "Incorrect call to vkCmdBindDynamicDepthState() without an active RenderPass.");
+            }
+            loader_platform_thread_lock_mutex(&globalLock);
+            pCB->status |= CBSTATUS_DEPTH_BOUND;
+            if (dynamicDepthStateMap.find(dynamicDepthState.handle) == dynamicDepthStateMap.end()) {
+                log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_DYNAMIC_DEPTH_STATE, dynamicDepthState.handle, 0, DRAWSTATE_INVALID_DYNAMIC_STATE_OBJECT, "DS",
+                        "Unable to find VkDynamicDepthState object %#" PRIxLEAST64 ", was it ever created?", dynamicDepthState.handle);
+            } else {
+                pCB->lastBoundDynamicState[VK_STATE_BIND_POINT_DEPTH] = dynamicDepthState.handle;
+                g_lastBoundDynamicState[VK_STATE_BIND_POINT_DEPTH] = dynamicDepthState.handle;
+            }
+            loader_platform_thread_unlock_mutex(&globalLock);
+            get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdBindDynamicDepthState(cmdBuffer, dynamicDepthState);
+        } else {
+            report_error_no_cb_begin(cmdBuffer, "vkCmdBindDynamicDepthState()");
+        }
+    }
+}
+VK_LAYER_EXPORT void VKAPI vkCmdBindDynamicStencilState(VkCmdBuffer cmdBuffer, VkDynamicStencilState dynamicStencilState)
 {
     GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer);
     if (pCB) {
         if (pCB->state == CB_UPDATE_ACTIVE) {
             updateCBTracking(cmdBuffer);
-            addCmd(pCB, CMD_BINDDYNAMICDEPTHSTENCILSTATE);
+            addCmd(pCB, CMD_BINDDYNAMICSTENCILSTATE);
             if (!pCB->activeRenderPass) {
                 log_msg(mdd(pCB->cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_NO_ACTIVE_RENDERPASS, "DS",
-                        "Incorrect call to vkCmdBindDynamicDepthStencilState() without an active RenderPass.");
+                        "Incorrect call to vkCmdBindDynamicStencilState() without an active RenderPass.");
             }
             loader_platform_thread_lock_mutex(&globalLock);
-            pCB->status |= CBSTATUS_DEPTH_STENCIL_BOUND;
-            if (dynamicDsStateMap.find(dynamicDepthStencilState.handle) == dynamicDsStateMap.end()) {
-                log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_DYNAMIC_DEPTH_STENCIL_STATE, dynamicDepthStencilState.handle, 0, DRAWSTATE_INVALID_DYNAMIC_STATE_OBJECT, "DS",
-                        "Unable to find VkDynamicDepthStencilState object %#" PRIxLEAST64 ", was it ever created?", dynamicDepthStencilState.handle);
+            pCB->status |= CBSTATUS_STENCIL_BOUND;
+            if (dynamicStencilStateMap.find(dynamicStencilState.handle) == dynamicStencilStateMap.end()) {
+                log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_DYNAMIC_STENCIL_STATE, dynamicStencilState.handle, 0, DRAWSTATE_INVALID_DYNAMIC_STATE_OBJECT, "DS",
+                        "Unable to find VkDynamicStencilState object %#" PRIxLEAST64 ", was it ever created?", dynamicStencilState.handle);
             } else {
-                pCB->lastBoundDynamicState[VK_STATE_BIND_POINT_DEPTH_STENCIL] = dynamicDepthStencilState.handle;
-                g_lastBoundDynamicState[VK_STATE_BIND_POINT_DEPTH_STENCIL] = dynamicDepthStencilState.handle;
+                pCB->lastBoundDynamicState[VK_STATE_BIND_POINT_STENCIL] = dynamicStencilState.handle;
+                g_lastBoundDynamicState[VK_STATE_BIND_POINT_STENCIL] = dynamicStencilState.handle;
             }
             loader_platform_thread_unlock_mutex(&globalLock);
-            get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdBindDynamicDepthStencilState(cmdBuffer, dynamicDepthStencilState);
+            get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdBindDynamicStencilState(cmdBuffer, dynamicStencilState);
         } else {
-            report_error_no_cb_begin(cmdBuffer, "vkCmdBindDynamicDepthStencilState()");
+            report_error_no_cb_begin(cmdBuffer, "vkCmdBindDynamicStencilState()");
         }
     }
 }
@@ -3120,8 +3183,10 @@ VK_LAYER_EXPORT PFN_vkVoidFunction VKAPI vkGetDeviceProcAddr(VkDevice dev, const
         return (PFN_vkVoidFunction) vkDestroyDynamicRasterDepthBiasState;
     if (!strcmp(funcName, "vkDestroyDynamicColorBlendState"))
         return (PFN_vkVoidFunction) vkDestroyDynamicColorBlendState;
-    if (!strcmp(funcName, "vkDestroyDynamicDepthStencilState"))
-        return (PFN_vkVoidFunction) vkDestroyDynamicDepthStencilState;
+    if (!strcmp(funcName, "vkDestroyDynamicDepthState"))
+        return (PFN_vkVoidFunction) vkDestroyDynamicDepthState;
+    if (!strcmp(funcName, "vkDestroyDynamicStencilState"))
+        return (PFN_vkVoidFunction) vkDestroyDynamicStencilState;
     if (!strcmp(funcName, "vkDestroyCommandBuffer"))
         return (PFN_vkVoidFunction) vkDestroyCommandBuffer;
     if (!strcmp(funcName, "vkDestroyFramebuffer"))
@@ -3168,8 +3233,10 @@ VK_LAYER_EXPORT PFN_vkVoidFunction VKAPI vkGetDeviceProcAddr(VkDevice dev, const
         return (PFN_vkVoidFunction) vkCreateDynamicRasterDepthBiasState;
     if (!strcmp(funcName, "vkCreateDynamicColorBlendState"))
         return (PFN_vkVoidFunction) vkCreateDynamicColorBlendState;
-    if (!strcmp(funcName, "vkCreateDynamicDepthStencilState"))
-        return (PFN_vkVoidFunction) vkCreateDynamicDepthStencilState;
+    if (!strcmp(funcName, "vkCreateDynamicDepthState"))
+        return (PFN_vkVoidFunction) vkCreateDynamicDepthState;
+    if (!strcmp(funcName, "vkCreateDynamicStencilState"))
+        return (PFN_vkVoidFunction) vkCreateDynamicStencilState;
     if (!strcmp(funcName, "vkCreateCommandBuffer"))
         return (PFN_vkVoidFunction) vkCreateCommandBuffer;
     if (!strcmp(funcName, "vkBeginCommandBuffer"))
@@ -3188,8 +3255,10 @@ VK_LAYER_EXPORT PFN_vkVoidFunction VKAPI vkGetDeviceProcAddr(VkDevice dev, const
         return (PFN_vkVoidFunction) vkCmdBindDynamicRasterDepthBiasState;
     if (!strcmp(funcName, "vkCmdBindDynamicColorBlendState"))
         return (PFN_vkVoidFunction) vkCmdBindDynamicColorBlendState;
-    if (!strcmp(funcName, "vkCmdBindDynamicDepthStencilState"))
-        return (PFN_vkVoidFunction) vkCmdBindDynamicDepthStencilState;
+    if (!strcmp(funcName, "vkCmdBindDynamicDepthState"))
+        return (PFN_vkVoidFunction) vkCmdBindDynamicDepthState;
+    if (!strcmp(funcName, "vkCmdBindDynamicStencilState"))
+        return (PFN_vkVoidFunction) vkCmdBindDynamicStencilState;
     if (!strcmp(funcName, "vkCmdBindDescriptorSets"))
         return (PFN_vkVoidFunction) vkCmdBindDescriptorSets;
     if (!strcmp(funcName, "vkCmdBindVertexBuffers"))
index 4c7c355502e41de995325c5a89064b1af9e2ea1a..fe4b03d794efa51c17d7154a692f850798043861 100644 (file)
@@ -55,7 +55,8 @@ typedef enum _DRAW_STATE_ERROR
     DRAWSTATE_RASTER_LINE_NOT_BOUND,            // Draw submitted with no raster line state object bound
     DRAWSTATE_RASTER_DEPTH_BIAS_NOT_BOUND,      // Draw submitted with no raster depth bias state object bound
     DRAWSTATE_COLOR_BLEND_NOT_BOUND,            // Draw submitted with no color blend state object bound when color write enabled
-    DRAWSTATE_DEPTH_STENCIL_NOT_BOUND,          // Draw submitted with no depth-stencil state object bound when depth write enabled
+    DRAWSTATE_DEPTH_NOT_BOUND,                  // Draw submitted with no depth state object bound when depth enabled
+    DRAWSTATE_STENCIL_NOT_BOUND,                // Draw submitted with no stencil state object bound when stencil enabled
     DRAWSTATE_INDEX_BUFFER_NOT_BOUND,           // Draw submitted with no depth-stencil state object bound when depth write enabled
     DRAWSTATE_PIPELINE_LAYOUT_MISMATCH,         // Draw submitted PSO Pipeline layout that doesn't match layout from BindDescriptorSets
     DRAWSTATE_INVALID_RENDERPASS,               // Use of a NULL or otherwise invalid RenderPass object
@@ -168,7 +169,8 @@ typedef enum _CMD_TYPE
     CMD_BINDDYNAMICRASTERLINESTATE,
     CMD_BINDDYNAMICRASTERDEPTHBIASSTATE,
     CMD_BINDDYNAMICCOLORBLENDSTATE,
-    CMD_BINDDYNAMICDEPTHSTENCILSTATE,
+    CMD_BINDDYNAMICDEPTHSTATE,
+    CMD_BINDDYNAMICSTENCILSTATE,
     CMD_BINDDESCRIPTORSETS,
     CMD_BINDINDEXBUFFER,
     CMD_BINDVERTEXBUFFER,
@@ -231,9 +233,11 @@ typedef enum _CBStatusFlagBits
     CBSTATUS_RASTER_DEPTH_BIAS_BOUND           = 0x00000004, // Raster state object has been bound
     CBSTATUS_COLOR_BLEND_WRITE_ENABLE          = 0x00000008, // PSO w/ CB Enable set has been bound
     CBSTATUS_COLOR_BLEND_BOUND                 = 0x00000010, // CB state object has been bound
-    CBSTATUS_DEPTH_STENCIL_WRITE_ENABLE        = 0x00000020, // PSO w/ DS Enable set has been bound
-    CBSTATUS_DEPTH_STENCIL_BOUND               = 0x00000040, // DS state object has been bound
-    CBSTATUS_INDEX_BUFFER_BOUND                = 0x00000080, // Index buffer has been bound
+    CBSTATUS_DEPTH_WRITE_ENABLE                = 0x00000020, // PSO w/ Depth Enable set has been bound
+    CBSTATUS_STENCIL_TEST_ENABLE               = 0x00000040, // PSO w/ Stencil Enable set has been bound
+    CBSTATUS_DEPTH_BOUND                       = 0x00000080, // Depth state object has been bound
+    CBSTATUS_STENCIL_BOUND                     = 0x00000100, // Stencil state object has been bound
+    CBSTATUS_INDEX_BUFFER_BOUND                = 0x00000200, // Index buffer has been bound
 } CBStatusFlagBits;
 
 // Cmd Buffer Wrapper Struct
index 4cb2ae1246a156b5d77d147ebe05de76e5ef9c79..f45790522b4de12b498323cf92851f56a4c5b98c 100644 (file)
@@ -29,7 +29,8 @@ typedef enum _DYNAMIC_STATE_BIND_POINT
     VK_STATE_BIND_POINT_RASTER_LINE,
     VK_STATE_BIND_POINT_RASTER_DEPTH_BIAS,
     VK_STATE_BIND_POINT_COLOR_BLEND,
-    VK_STATE_BIND_POINT_DEPTH_STENCIL,
+    VK_STATE_BIND_POINT_DEPTH,
+    VK_STATE_BIND_POINT_STENCIL,
     VK_NUM_STATE_BIND_POINT // Used for array sizing
 } DYNAMIC_STATE_BIND_POINT;
 
@@ -45,8 +46,10 @@ static string string_DYNAMIC_STATE_BIND_POINT(DYNAMIC_STATE_BIND_POINT sbp)
             return "RASTER_DEPTH_BIAS";
         case VK_STATE_BIND_POINT_COLOR_BLEND:
             return "COLOR_BLEND";
-        case VK_STATE_BIND_POINT_DEPTH_STENCIL:
-            return "DEPTH_STENCIL";
+        case VK_STATE_BIND_POINT_DEPTH:
+            return "DEPTH";
+        case VK_STATE_BIND_POINT_STENCIL:
+            return "STENCIL";
         default:
             return "UNKNOWN_DYNAMIC_STATE_BIND_POINT";
     }
@@ -64,8 +67,10 @@ static VkDbgObjectType dynamicStateBindPointToObjType(DYNAMIC_STATE_BIND_POINT s
             return VK_OBJECT_TYPE_DYNAMIC_RASTER_DEPTH_BIAS_STATE;
         case VK_STATE_BIND_POINT_COLOR_BLEND:
             return VK_OBJECT_TYPE_DYNAMIC_COLOR_BLEND_STATE;
-        case VK_STATE_BIND_POINT_DEPTH_STENCIL:
-            return VK_OBJECT_TYPE_DYNAMIC_DEPTH_STENCIL_STATE;
+        case VK_STATE_BIND_POINT_DEPTH:
+            return VK_OBJECT_TYPE_DYNAMIC_DEPTH_STATE;
+        case VK_STATE_BIND_POINT_STENCIL:
+            return VK_OBJECT_TYPE_DYNAMIC_STENCIL_STATE;
         default:
             return VK_OBJECT_TYPE_MAX_ENUM;
     }
index 846cc5bc23534d9f7b2bfe8af61fa8000c26448c..f7bc3a5bd468b472a5186a81a8fa27a232d64caf 100644 (file)
@@ -98,7 +98,8 @@ unordered_map<uint64_t, VkDynamicViewportStateCreateInfo>     dynamicViewportSta
 unordered_map<uint64_t, VkDynamicRasterLineStateCreateInfo>   dynamicRasterLineStateMap;
 unordered_map<uint64_t, VkDynamicRasterDepthBiasStateCreateInfo> dynamicRasterDepthBiasStateMap;
 unordered_map<uint64_t, VkDynamicColorBlendStateCreateInfo>   dynamicColorBlendStateMap;
-unordered_map<uint64_t, VkDynamicDepthStencilStateCreateInfo> dynamicDepthStencilStateMap;
+unordered_map<uint64_t, VkDynamicDepthStateCreateInfo> dynamicDepthStateMap;
+unordered_map<uint64_t, VkDynamicStencilStateCreateInfo> dynamicStencilStateMap;
 
 // For a given handle and object type, return a ptr to its CreateInfo struct, or NULL if not found
 static void* get_object_create_info(uint64_t handle, VkDbgObjectType type)
@@ -246,10 +247,17 @@ static void* get_object_create_info(uint64_t handle, VkDbgObjectType type)
                 return (void*)&(*it).second;
             break;
         }
-        case VK_OBJECT_TYPE_DYNAMIC_DEPTH_STENCIL_STATE:
+        case VK_OBJECT_TYPE_DYNAMIC_DEPTH_STATE:
         {
-            auto it = dynamicDepthStencilStateMap.find(handle);
-            if (it != dynamicDepthStencilStateMap.end())
+            auto it = dynamicDepthStateMap.find(handle);
+            if (it != dynamicDepthStateMap.end())
+                return (void*)&(*it).second;
+            break;
+        }
+        case VK_OBJECT_TYPE_DYNAMIC_STENCIL_STATE:
+        {
+            auto it = dynamicStencilStateMap.find(handle);
+            if (it != dynamicStencilStateMap.end())
                 return (void*)&(*it).second;
             break;
         }
@@ -537,10 +545,16 @@ static void add_object_create_info(const uint64_t handle, const VkDbgObjectType
             memcpy(pCI, pCreateInfo, sizeof(VkDynamicColorBlendStateCreateInfo));
             break;
         }
-        case VK_OBJECT_TYPE_DYNAMIC_DEPTH_STENCIL_STATE:
+        case VK_OBJECT_TYPE_DYNAMIC_DEPTH_STATE:
+        {
+            auto pCI = &dynamicDepthStateMap[handle];
+            memcpy(pCI, pCreateInfo, sizeof(VkDynamicDepthStateCreateInfo));
+            break;
+        }
+        case VK_OBJECT_TYPE_DYNAMIC_STENCIL_STATE:
         {
-            auto pCI = &dynamicDepthStencilStateMap[handle];
-            memcpy(pCI, pCreateInfo, sizeof(VkDynamicDepthStencilStateCreateInfo));
+            auto pCI = &dynamicStencilStateMap[handle];
+            memcpy(pCI, pCreateInfo, sizeof(VkDynamicStencilStateCreateInfo));
             break;
         }
         default:
@@ -1153,7 +1167,8 @@ static void print_object_list(
     print_object_map_members(dispObj, dynamicRasterLineStateMap,   VK_OBJECT_TYPE_DYNAMIC_RASTER_LINE_STATE,   "DynamicRasterLineState");
     print_object_map_members(dispObj, dynamicRasterDepthBiasStateMap, VK_OBJECT_TYPE_DYNAMIC_RASTER_DEPTH_BIAS_STATE, "DynamicRasterDepthBiasState");
     print_object_map_members(dispObj, dynamicColorBlendStateMap,   VK_OBJECT_TYPE_DYNAMIC_COLOR_BLEND_STATE,   "DynamicColorBlendState");
-    print_object_map_members(dispObj, dynamicDepthStencilStateMap, VK_OBJECT_TYPE_DYNAMIC_DEPTH_STENCIL_STATE, "DynamicDepthStencilState");
+    print_object_map_members(dispObj, dynamicDepthStateMap,        VK_OBJECT_TYPE_DYNAMIC_DEPTH_STATE,         "DynamicDepthState");
+    print_object_map_members(dispObj, dynamicStencilStateMap,      VK_OBJECT_TYPE_DYNAMIC_STENCIL_STATE,       "DynamicStencilState");
     log_msg(mdd(dispObj), VK_DBG_REPORT_INFO_BIT, VK_OBJECT_TYPE_DEVICE, 0, 0, MEMTRACK_NONE, "MEM", "*** End of Object lists ***");
 }
 
@@ -1873,15 +1888,27 @@ VK_LAYER_EXPORT VkResult VKAPI vkDestroyDynamicColorBlendState(VkDevice device,
     return result;
 }
 
-VK_LAYER_EXPORT VkResult VKAPI vkDestroyDynamicDepthStencilState(VkDevice device, VkDynamicDepthStencilState dynamicDepthStencilState)
+VK_LAYER_EXPORT VkResult VKAPI vkDestroyDynamicDepthState(VkDevice device, VkDynamicDepthState dynamicDepthState)
+{
+    loader_platform_thread_lock_mutex(&globalLock);
+    auto item = dynamicDepthStateMap.find(dynamicDepthState.handle);
+    if (item != dynamicDepthStateMap.end()) {
+        dynamicDepthStateMap.erase(item);
+    }
+    loader_platform_thread_unlock_mutex(&globalLock);
+    VkResult result = get_dispatch_table(mem_tracker_device_table_map, device)->DestroyDynamicDepthState(device, dynamicDepthState);
+    return result;
+}
+
+VK_LAYER_EXPORT VkResult VKAPI vkDestroyDynamicStencilState(VkDevice device, VkDynamicStencilState dynamicStencilState)
 {
     loader_platform_thread_lock_mutex(&globalLock);
-    auto item = dynamicDepthStencilStateMap.find(dynamicDepthStencilState.handle);
-    if (item != dynamicDepthStencilStateMap.end()) {
-        dynamicDepthStencilStateMap.erase(item);
+    auto item = dynamicStencilStateMap.find(dynamicStencilState.handle);
+    if (item != dynamicStencilStateMap.end()) {
+        dynamicStencilStateMap.erase(item);
     }
     loader_platform_thread_unlock_mutex(&globalLock);
-    VkResult result = get_dispatch_table(mem_tracker_device_table_map, device)->DestroyDynamicDepthStencilState(device, dynamicDepthStencilState);
+    VkResult result = get_dispatch_table(mem_tracker_device_table_map, device)->DestroyDynamicStencilState(device, dynamicStencilState);
     return result;
 }
 
@@ -2353,15 +2380,35 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(
     return result;
 }
 
-VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
+VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicDepthState(
     VkDevice                          device,
-    const VkDynamicDepthStencilStateCreateInfo *pCreateInfo,
-    VkDynamicDepthStencilState       *pState)
+    const VkDynamicDepthStateCreateInfo *pCreateInfo,
+    VkDynamicDepthState       *pState)
 {
-    VkResult result = get_dispatch_table(mem_tracker_device_table_map, device)->CreateDynamicDepthStencilState(device, pCreateInfo, pState);
+    VkResult result = get_dispatch_table(mem_tracker_device_table_map, device)->CreateDynamicDepthState(device, pCreateInfo, pState);
     if (result == VK_SUCCESS) {
         loader_platform_thread_lock_mutex(&globalLock);
-        add_object_create_info(pState->handle, VK_OBJECT_TYPE_DYNAMIC_DEPTH_STENCIL_STATE, pCreateInfo);
+        add_object_create_info(pState->handle, VK_OBJECT_TYPE_DYNAMIC_DEPTH_STATE, pCreateInfo);
+        loader_platform_thread_unlock_mutex(&globalLock);
+    }
+    return result;
+}
+
+VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicStencilState(
+    VkDevice                          device,
+    const VkDynamicStencilStateCreateInfo *pCreateInfoFront,
+    const VkDynamicStencilStateCreateInfo *pCreateInfoBack,
+    VkDynamicStencilState       *pState)
+{
+    VkResult result = get_dispatch_table(mem_tracker_device_table_map, device)->CreateDynamicStencilState(device, pCreateInfoFront, pCreateInfoBack, pState);
+    if (result == VK_SUCCESS && pCreateInfoFront != nullptr) {
+        loader_platform_thread_lock_mutex(&globalLock);
+        add_object_create_info(pState->handle, VK_OBJECT_TYPE_DYNAMIC_STENCIL_STATE, pCreateInfoFront);
+        loader_platform_thread_unlock_mutex(&globalLock);
+    }
+    if (result == VK_SUCCESS && pCreateInfoBack != nullptr && pCreateInfoBack != pCreateInfoFront) {
+        loader_platform_thread_lock_mutex(&globalLock);
+        add_object_create_info(pState->handle, VK_OBJECT_TYPE_DYNAMIC_STENCIL_STATE, pCreateInfoBack);
         loader_platform_thread_unlock_mutex(&globalLock);
     }
     return result;
@@ -2542,11 +2589,33 @@ void VKAPI vkCmdBindDynamicColorBlendState(
     get_dispatch_table(mem_tracker_device_table_map, cmdBuffer)->CmdBindDynamicColorBlendState(cmdBuffer, dynamicColorBlendState);
 }
 
-void VKAPI vkCmdBindDynamicDepthStencilState(
+void VKAPI vkCmdBindDynamicDepthState(
+     VkCmdBuffer                                 cmdBuffer,
+     VkDynamicDepthState                  dynamicDepthState)
+{
+    VkDynamicDepthStateCreateInfo* pCI;
+    loader_platform_thread_lock_mutex(&globalLock);
+    MT_CB_INFO *pCmdBuf = get_cmd_buf_info(cmdBuffer);
+    if (!pCmdBuf) {
+        // TODO : Want cmdBuffer to be srcObj here
+        log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, 0, 0, MEMTRACK_INVALID_CB, "MEM",
+                "Unable to find command buffer object %p, was it ever created?", (void*)cmdBuffer);
+    }
+    pCI = (VkDynamicDepthStateCreateInfo*)get_object_create_info(dynamicDepthState.handle, VK_OBJECT_TYPE_DYNAMIC_DEPTH_STATE);
+    if (!pCI) {
+         log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_DYNAMIC_DEPTH_STATE, dynamicDepthState.handle, 0, MEMTRACK_INVALID_OBJECT, "MEM",
+                "Unable to find dynamic raster state object %#" PRIxLEAST64 ", was it ever created?", dynamicDepthState.handle);
+    }
+    pCmdBuf->pLastBoundDynamicState[VK_STATE_BIND_POINT_DEPTH] = dynamicDepthState.handle;
+    loader_platform_thread_unlock_mutex(&globalLock);
+    get_dispatch_table(mem_tracker_device_table_map, cmdBuffer)->CmdBindDynamicDepthState(cmdBuffer, dynamicDepthState);
+}
+
+void VKAPI vkCmdBindDynamicStencilState(
      VkCmdBuffer                                 cmdBuffer,
-     VkDynamicDepthStencilState                  dynamicDepthStencilState)
+     VkDynamicStencilState                       dynamicStencilState)
 {
-    VkDynamicDepthStencilStateCreateInfo* pCI;
+    VkDynamicStencilStateCreateInfo* pCI;
     loader_platform_thread_lock_mutex(&globalLock);
     MT_CB_INFO *pCmdBuf = get_cmd_buf_info(cmdBuffer);
     if (!pCmdBuf) {
@@ -2554,14 +2623,14 @@ void VKAPI vkCmdBindDynamicDepthStencilState(
         log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, 0, 0, MEMTRACK_INVALID_CB, "MEM",
                 "Unable to find command buffer object %p, was it ever created?", (void*)cmdBuffer);
     }
-    pCI = (VkDynamicDepthStencilStateCreateInfo*)get_object_create_info(dynamicDepthStencilState.handle, VK_OBJECT_TYPE_DYNAMIC_DEPTH_STENCIL_STATE);
+    pCI = (VkDynamicStencilStateCreateInfo*)get_object_create_info(dynamicStencilState.handle, VK_OBJECT_TYPE_DYNAMIC_STENCIL_STATE);
     if (!pCI) {
-         log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_DYNAMIC_DEPTH_STENCIL_STATE, dynamicDepthStencilState.handle, 0, MEMTRACK_INVALID_OBJECT, "MEM",
-                "Unable to find dynamic raster state object %#" PRIxLEAST64 ", was it ever created?", dynamicDepthStencilState.handle);
+         log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_DYNAMIC_STENCIL_STATE, dynamicStencilState.handle, 0, MEMTRACK_INVALID_OBJECT, "MEM",
+                "Unable to find dynamic raster state object %#" PRIxLEAST64 ", was it ever created?", dynamicStencilState.handle);
     }
-    pCmdBuf->pLastBoundDynamicState[VK_STATE_BIND_POINT_DEPTH_STENCIL] = dynamicDepthStencilState.handle;
+    pCmdBuf->pLastBoundDynamicState[VK_STATE_BIND_POINT_STENCIL] = dynamicStencilState.handle;
     loader_platform_thread_unlock_mutex(&globalLock);
-    get_dispatch_table(mem_tracker_device_table_map, cmdBuffer)->CmdBindDynamicDepthStencilState(cmdBuffer, dynamicDepthStencilState);
+    get_dispatch_table(mem_tracker_device_table_map, cmdBuffer)->CmdBindDynamicStencilState(cmdBuffer, dynamicStencilState);
 }
 
 VK_LAYER_EXPORT void VKAPI vkCmdBindDescriptorSets(
@@ -3137,8 +3206,10 @@ VK_LAYER_EXPORT PFN_vkVoidFunction VKAPI vkGetDeviceProcAddr(
         return (PFN_vkVoidFunction) vkDestroyDynamicRasterDepthBiasState;
     if (!strcmp(funcName, "vkDestroyDynamicColorBlendState"))
         return (PFN_vkVoidFunction) vkDestroyDynamicColorBlendState;
-    if (!strcmp(funcName, "vkDestroyDynamicDepthStencilState"))
-        return (PFN_vkVoidFunction) vkDestroyDynamicDepthStencilState;
+    if (!strcmp(funcName, "vkDestroyDynamicDepthState"))
+        return (PFN_vkVoidFunction) vkDestroyDynamicDepthState;
+    if (!strcmp(funcName, "vkDestroyDynamicStencilState"))
+        return (PFN_vkVoidFunction) vkDestroyDynamicStencilState;
     if (!strcmp(funcName, "vkBindBufferMemory"))
         return (PFN_vkVoidFunction) vkBindBufferMemory;
     if (!strcmp(funcName, "vkBindImageMemory"))
@@ -3195,8 +3266,10 @@ VK_LAYER_EXPORT PFN_vkVoidFunction VKAPI vkGetDeviceProcAddr(
         return (PFN_vkVoidFunction) vkCreateDynamicRasterDepthBiasState;
     if (!strcmp(funcName, "vkCreateDynamicColorBlendState"))
         return (PFN_vkVoidFunction) vkCreateDynamicColorBlendState;
-    if (!strcmp(funcName, "vkCreateDynamicDepthStencilState"))
-        return (PFN_vkVoidFunction) vkCreateDynamicDepthStencilState;
+    if (!strcmp(funcName, "vkCreateDynamicDepthState"))
+        return (PFN_vkVoidFunction) vkCreateDynamicDepthState;
+    if (!strcmp(funcName, "vkCreateDynamicStencilState"))
+        return (PFN_vkVoidFunction) vkCreateDynamicStencilState;
     if (!strcmp(funcName, "vkCreateCommandBuffer"))
         return (PFN_vkVoidFunction) vkCreateCommandBuffer;
     if (!strcmp(funcName, "vkBeginCommandBuffer"))
@@ -3215,8 +3288,10 @@ VK_LAYER_EXPORT PFN_vkVoidFunction VKAPI vkGetDeviceProcAddr(
         return (PFN_vkVoidFunction) vkCmdBindDynamicRasterDepthBiasState;
     if (!strcmp(funcName, "vkCmdBindDynamicColorBlendState"))
         return (PFN_vkVoidFunction) vkCmdBindDynamicColorBlendState;
-    if (!strcmp(funcName, "vkCmdBindDynamicDepthStencilState"))
-        return (PFN_vkVoidFunction) vkCmdBindDynamicDepthStencilState;
+    if (!strcmp(funcName, "vkCmdBindDynamicDepthState"))
+        return (PFN_vkVoidFunction) vkCmdBindDynamicDepthState;
+    if (!strcmp(funcName, "vkCmdBindDynamicStencilState"))
+        return (PFN_vkVoidFunction) vkCmdBindDynamicStencilState;
     if (!strcmp(funcName, "vkCmdBindDescriptorSets"))
         return (PFN_vkVoidFunction) vkCmdBindDescriptorSets;
     if (!strcmp(funcName, "vkCmdBindVertexBuffers"))
index 42e023574b675e761dd15e60e62d103b5fe65bb0..fef0f84fee63e7511615eb8c54bec4452291da39 100644 (file)
@@ -6090,16 +6090,16 @@ VK_LAYER_EXPORT VkResult VKAPI vkDestroyDynamicColorBlendState(
     return result;
 }
 
-bool PreCreateDynamicDepthStencilState(
+bool PreCreateDynamicDepthState(
     VkDevice device,
-    const VkDynamicDepthStencilStateCreateInfo* pCreateInfo)
+    const VkDynamicDepthStateCreateInfo* pCreateInfo)
 {
     if(pCreateInfo != nullptr)
     {
-    if(pCreateInfo->sType != VK_STRUCTURE_TYPE_DYNAMIC_DEPTH_STENCIL_STATE_CREATE_INFO)
+    if(pCreateInfo->sType != VK_STRUCTURE_TYPE_DYNAMIC_DEPTH_STATE_CREATE_INFO)
     {
         log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType)0, 0, 0, 1, "PARAMCHECK",
-        "vkCreateDynamicDepthStencilState parameter, VkStructureType pCreateInfo->sType, is an invalid enumerator");
+        "vkCreateDynamicDepthState parameter, VkStructureType pCreateInfo->sType, is an invalid enumerator");
         return false;
     }
     }
@@ -6107,9 +6107,9 @@ bool PreCreateDynamicDepthStencilState(
     return true;
 }
 
-bool PostCreateDynamicDepthStencilState(
+bool PostCreateDynamicDepthState(
     VkDevice device,
-    VkDynamicDepthStencilState* pState,
+    VkDynamicDepthState* pState,
     VkResult result)
 {
 
@@ -6119,7 +6119,7 @@ bool PostCreateDynamicDepthStencilState(
 
     if(result < VK_SUCCESS)
     {
-        std::string reason = "vkCreateDynamicDepthStencilState parameter, VkResult result, is " + EnumeratorString(result);
+        std::string reason = "vkCreateDynamicDepthState parameter, VkResult result, is " + EnumeratorString(result);
         log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType)0, 0, 0, 1, "PARAMCHECK", reason.c_str());
         return false;
     }
@@ -6127,30 +6127,117 @@ bool PostCreateDynamicDepthStencilState(
     return true;
 }
 
-VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(
+VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicDepthState(
     VkDevice device,
-    const VkDynamicDepthStencilStateCreateInfo* pCreateInfo,
-    VkDynamicDepthStencilState* pState)
+    const VkDynamicDepthStateCreateInfo* pCreateInfo,
+    VkDynamicDepthState* pState)
 {
-    PreCreateDynamicDepthStencilState(device, pCreateInfo);
+    PreCreateDynamicDepthState(device, pCreateInfo);
 
-    VkResult result = get_dispatch_table(pc_device_table_map, device)->CreateDynamicDepthStencilState(device, pCreateInfo, pState);
+    VkResult result = get_dispatch_table(pc_device_table_map, device)->CreateDynamicDepthState(device, pCreateInfo, pState);
 
-    PostCreateDynamicDepthStencilState(device, pState, result);
+    PostCreateDynamicDepthState(device, pState, result);
 
     return result;
 }
 
-bool PostDestroyDynamicDepthStencilState(
+bool PostDestroyDynamicDepthState(
     VkDevice device,
-    VkDynamicDepthStencilState dynamicDepthStencilState,
+    VkDynamicDepthState dynamicDepthState,
     VkResult result)
 {
+    if(result < VK_SUCCESS)
+    {
+        std::string reason = "vkDestroyDynamicDepthState parameter, VkResult result, is " + EnumeratorString(result);
+        log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType)0, 0, 0, 1, "PARAMCHECK", reason.c_str());
+        return false;
+    }
+
+    return true;
+}
+
+VK_LAYER_EXPORT VkResult VKAPI vkDestroyDynamicDepthState(
+    VkDevice device,
+    VkDynamicDepthState dynamicDepthState)
+{
+    VkResult result = get_dispatch_table(pc_device_table_map, device)->DestroyDynamicDepthState(device, dynamicDepthState);
+
+    PostDestroyDynamicDepthState(device, dynamicDepthState, result);
 
+    return result;
+}
 
+bool PreCreateDynamicStencilState(
+    VkDevice device,
+    const VkDynamicStencilStateCreateInfo* pCreateInfoFront,
+    const VkDynamicStencilStateCreateInfo* pCreateInfoBack)
+{
+    if(pCreateInfoFront != nullptr)
+    {
+    if(pCreateInfoFront->sType != VK_STRUCTURE_TYPE_DYNAMIC_STENCIL_STATE_CREATE_INFO)
+    {
+        log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType)0, 0, 0, 1, "PARAMCHECK",
+        "vkCreateDynamicStencilState parameter, VkStructureType pCreateInfoFront->sType, is an invalid enumerator");
+        return false;
+    }
+    }
+
+    if(pCreateInfoBack != nullptr)
+    {
+    if(pCreateInfoBack->sType != VK_STRUCTURE_TYPE_DYNAMIC_STENCIL_STATE_CREATE_INFO)
+    {
+        log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType)0, 0, 0, 1, "PARAMCHECK",
+        "vkCreateDynamicStencilState parameter, VkStructureType pCreateInfoBack->sType, is an invalid enumerator");
+        return false;
+    }
+    }
+
+    return true;
+}
+
+bool PostCreateDynamicStencilState(
+    VkDevice device,
+    VkDynamicStencilState* pState,
+    VkResult result)
+{
+
+    if(pState != nullptr)
+    {
+    }
+
+    if(result < VK_SUCCESS)
+    {
+        std::string reason = "vkCreateDynamicStencilState parameter, VkResult result, is " + EnumeratorString(result);
+        log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType)0, 0, 0, 1, "PARAMCHECK", reason.c_str());
+        return false;
+    }
+
+    return true;
+}
+
+VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicStencilState(
+    VkDevice device,
+    const VkDynamicStencilStateCreateInfo* pCreateInfoFront,
+    const VkDynamicStencilStateCreateInfo* pCreateInfoBack,
+    VkDynamicStencilState* pState)
+{
+    PreCreateDynamicStencilState(device, pCreateInfoFront, pCreateInfoBack);
+
+    VkResult result = get_dispatch_table(pc_device_table_map, device)->CreateDynamicStencilState(device, pCreateInfoFront, pCreateInfoBack, pState);
+
+    PostCreateDynamicStencilState(device, pState, result);
+
+    return result;
+}
+
+bool PostDestroyDynamicStencilState(
+    VkDevice device,
+    VkDynamicStencilState dynamicStencilState,
+    VkResult result)
+{
     if(result < VK_SUCCESS)
     {
-        std::string reason = "vkDestroyDynamicDepthStencilState parameter, VkResult result, is " + EnumeratorString(result);
+        std::string reason = "vkDestroyDynamicStencilState parameter, VkResult result, is " + EnumeratorString(result);
         log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType)0, 0, 0, 1, "PARAMCHECK", reason.c_str());
         return false;
     }
@@ -6158,13 +6245,13 @@ bool PostDestroyDynamicDepthStencilState(
     return true;
 }
 
-VK_LAYER_EXPORT VkResult VKAPI vkDestroyDynamicDepthStencilState(
+VK_LAYER_EXPORT VkResult VKAPI vkDestroyDynamicStencilState(
     VkDevice device,
-    VkDynamicDepthStencilState dynamicDepthStencilState)
+    VkDynamicStencilState dynamicStencilState)
 {
-    VkResult result = get_dispatch_table(pc_device_table_map, device)->DestroyDynamicDepthStencilState(device, dynamicDepthStencilState);
+    VkResult result = get_dispatch_table(pc_device_table_map, device)->DestroyDynamicStencilState(device, dynamicStencilState);
 
-    PostDestroyDynamicDepthStencilState(device, dynamicDepthStencilState, result);
+    PostDestroyDynamicStencilState(device, dynamicStencilState, result);
 
     return result;
 }
@@ -6888,22 +6975,36 @@ VK_LAYER_EXPORT void VKAPI vkCmdBindDynamicColorBlendState(
     PostCmdBindDynamicColorBlendState(cmdBuffer, dynamicColorBlendState);
 }
 
-bool PostCmdBindDynamicDepthStencilState(
+bool PostCmdBindDynamicDepthState(
     VkCmdBuffer cmdBuffer,
-    VkDynamicDepthStencilState dynamicDepthStencilState)
+    VkDynamicDepthState dynamicDepthState)
 {
+    return true;
+}
+
+VK_LAYER_EXPORT void VKAPI vkCmdBindDynamicDepthState(
+    VkCmdBuffer cmdBuffer,
+    VkDynamicDepthState dynamicDepthState)
+{
+    get_dispatch_table(pc_device_table_map, cmdBuffer)->CmdBindDynamicDepthState(cmdBuffer, dynamicDepthState);
 
+    PostCmdBindDynamicDepthState(cmdBuffer, dynamicDepthState);
+}
 
+bool PostCmdBindDynamicStencilState(
+    VkCmdBuffer cmdBuffer,
+    VkDynamicStencilState dynamicStencilState)
+{
     return true;
 }
 
-VK_LAYER_EXPORT void VKAPI vkCmdBindDynamicDepthStencilState(
+VK_LAYER_EXPORT void VKAPI vkCmdBindDynamicStencilState(
     VkCmdBuffer cmdBuffer,
-    VkDynamicDepthStencilState dynamicDepthStencilState)
+    VkDynamicStencilState dynamicStencilState)
 {
-    get_dispatch_table(pc_device_table_map, cmdBuffer)->CmdBindDynamicDepthStencilState(cmdBuffer, dynamicDepthStencilState);
+    get_dispatch_table(pc_device_table_map, cmdBuffer)->CmdBindDynamicStencilState(cmdBuffer, dynamicStencilState);
 
-    PostCmdBindDynamicDepthStencilState(cmdBuffer, dynamicDepthStencilState);
+    PostCmdBindDynamicStencilState(cmdBuffer, dynamicStencilState);
 }
 
 bool PreCmdBindDescriptorSets(
@@ -8375,8 +8476,10 @@ VK_LAYER_EXPORT PFN_vkVoidFunction VKAPI vkGetDeviceProcAddr(VkDevice device, co
         return (PFN_vkVoidFunction) vkCreateDynamicRasterDepthBiasState;
     if (!strcmp(funcName, "vkCreateDynamicColorBlendState"))
         return (PFN_vkVoidFunction) vkCreateDynamicColorBlendState;
-    if (!strcmp(funcName, "vkCreateDynamicDepthStencilState"))
-        return (PFN_vkVoidFunction) vkCreateDynamicDepthStencilState;
+    if (!strcmp(funcName, "vkCreateDynamicDepthState"))
+        return (PFN_vkVoidFunction) vkCreateDynamicDepthState;
+    if (!strcmp(funcName, "vkCreateDynamicStencilState"))
+        return (PFN_vkVoidFunction) vkCreateDynamicStencilState;
     if (!strcmp(funcName, "vkCreateCommandBuffer"))
         return (PFN_vkVoidFunction) vkCreateCommandBuffer;
     if (!strcmp(funcName, "vkBeginCommandBuffer"))
index bb79f03533773c35d2e21efe5f691fe13e931c7b..185a140cc35d9016033497121e26c64778ae3b7d 100644 (file)
@@ -227,10 +227,14 @@ static inline void* globalGetProcAddr(const char *name)
         return (void*) vkCreateDynamicColorBlendState;
     if (!strcmp(name, "DestroyDynamicColorBlendState"))
         return (void*) vkDestroyDynamicColorBlendState;
-    if (!strcmp(name, "CreateDynamicDepthStencilState"))
-        return (void*) vkCreateDynamicDepthStencilState;
-    if (!strcmp(name, "DestroyDynamicDepthStencilState"))
-        return (void*) vkDestroyDynamicDepthStencilState;
+    if (!strcmp(name, "CreateDynamicDepthState"))
+        return (void*) vkCreateDynamicDepthState;
+    if (!strcmp(name, "DestroyDynamicDepthState"))
+        return (void*) vkDestroyDynamicDepthState;
+    if (!strcmp(name, "CreateDynamicStencilState"))
+        return (void*) vkCreateDynamicStencilState;
+    if (!strcmp(name, "DestroyDynamicStencilState"))
+        return (void*) vkDestroyDynamicStencilState;
     if (!strcmp(name, "CreateFramebuffer"))
         return (void*) vkCreateFramebuffer;
     if (!strcmp(name, "DestroyFramebuffer"))
@@ -267,8 +271,10 @@ static inline void* globalGetProcAddr(const char *name)
         return (void*) vkCmdBindDynamicRasterDepthBiasState;
     if (!strcmp(name, "CmdBindDynamicColorBlendState"))
         return (void*) vkCmdBindDynamicColorBlendState;
-    if (!strcmp(name, "CmdBindDynamicDepthStencilState"))
-        return (void*) vkCmdBindDynamicDepthStencilState;
+    if (!strcmp(name, "CmdBindDynamicDepthState"))
+        return (void*) vkCmdBindDynamicDepthState;
+    if (!strcmp(name, "CmdBindDynamicStencilState"))
+        return (void*) vkCmdBindDynamicStencilState;
     if (!strcmp(name, "CmdBindDescriptorSets"))
         return (void*) vkCmdBindDescriptorSets;
     if (!strcmp(name, "CmdBindIndexBuffer"))
index dbb0ee43a56336d0f17d751608985a9520746c86..d1a59d56c5045f56c4b496066706bb2be0e0b913 100644 (file)
@@ -118,8 +118,10 @@ static inline void loader_init_device_dispatch_table(VkLayerDispatchTable *table
     table->DestroyDynamicRasterDepthBiasState = (PFN_vkDestroyDynamicRasterDepthBiasState) gpa(dev, "vkDestroyDynamicRasterDepthBiasState");
     table->CreateDynamicColorBlendState = (PFN_vkCreateDynamicColorBlendState) gpa(dev, "vkCreateDynamicColorBlendState");
     table->DestroyDynamicColorBlendState = (PFN_vkDestroyDynamicColorBlendState) gpa(dev, "vkDestroyDynamicColorBlendState");
-    table->CreateDynamicDepthStencilState = (PFN_vkCreateDynamicDepthStencilState) gpa(dev, "vkCreateDynamicDepthStencilState");
-    table->DestroyDynamicDepthStencilState = (PFN_vkDestroyDynamicDepthStencilState) gpa(dev, "vkDestroyDynamicDepthStencilState");
+    table->CreateDynamicDepthState = (PFN_vkCreateDynamicDepthState) gpa(dev, "vkCreateDynamicDepthState");
+    table->DestroyDynamicDepthState = (PFN_vkDestroyDynamicDepthState) gpa(dev, "vkDestroyDynamicDepthState");
+    table->CreateDynamicStencilState = (PFN_vkCreateDynamicStencilState) gpa(dev, "vkCreateDynamicStencilState");
+    table->DestroyDynamicStencilState = (PFN_vkDestroyDynamicStencilState) gpa(dev, "vkDestroyDynamicStencilState");
     table->CreateFramebuffer = (PFN_vkCreateFramebuffer) gpa(dev, "vkCreateFramebuffer");
     table->DestroyFramebuffer = (PFN_vkDestroyFramebuffer) gpa(dev, "vkDestroyFramebuffer");
     table->CreateRenderPass = (PFN_vkCreateRenderPass) gpa(dev, "vkCreateRenderPass");
@@ -138,7 +140,8 @@ static inline void loader_init_device_dispatch_table(VkLayerDispatchTable *table
     table->CmdBindDynamicRasterLineState = (PFN_vkCmdBindDynamicRasterLineState) gpa(dev, "vkCmdBindDynamicRasterLineState");
     table->CmdBindDynamicRasterDepthBiasState = (PFN_vkCmdBindDynamicRasterDepthBiasState) gpa(dev, "vkCmdBindDynamicRasterDepthBiasState");
     table->CmdBindDynamicColorBlendState = (PFN_vkCmdBindDynamicColorBlendState) gpa(dev, "vkCmdBindDynamicColorBlendState");
-    table->CmdBindDynamicDepthStencilState = (PFN_vkCmdBindDynamicDepthStencilState) gpa(dev, "vkCmdBindDynamicDepthStencilState");
+    table->CmdBindDynamicDepthState = (PFN_vkCmdBindDynamicDepthState) gpa(dev, "vkCmdBindDynamicDepthState");
+    table->CmdBindDynamicStencilState = (PFN_vkCmdBindDynamicStencilState) gpa(dev, "vkCmdBindDynamicStencilState");
     table->CmdBindDescriptorSets = (PFN_vkCmdBindDescriptorSets) gpa(dev, "vkCmdBindDescriptorSets");
     table->CmdBindVertexBuffers = (PFN_vkCmdBindVertexBuffers) gpa(dev, "vkCmdBindVertexBuffers");
     table->CmdBindIndexBuffer = (PFN_vkCmdBindIndexBuffer) gpa(dev, "vkCmdBindIndexBuffer");
@@ -359,10 +362,14 @@ static inline void *loader_lookup_device_dispatch_table(
         return (void *) table->CreateDynamicColorBlendState;
     if (!strcmp(name, "DestroyDynamicColorBlendState"))
         return (void *) table->DestroyDynamicColorBlendState;
-    if (!strcmp(name, "CreateDynamicDepthStencilState"))
-        return (void *) table->CreateDynamicDepthStencilState;
-    if (!strcmp(name, "DestroyDynamicDepthStencilState"))
-        return (void *) table->DestroyDynamicDepthStencilState;
+    if (!strcmp(name, "CreateDynamicDepthState"))
+        return (void *) table->CreateDynamicDepthState;
+    if (!strcmp(name, "DestroyDynamicDepthState"))
+        return (void *) table->DestroyDynamicDepthState;
+    if (!strcmp(name, "CreateDynamicStencilState"))
+        return (void *) table->CreateDynamicStencilState;
+    if (!strcmp(name, "DestroyDynamicStencilState"))
+        return (void *) table->DestroyDynamicStencilState;
     if (!strcmp(name, "CreateFramebuffer"))
         return (void *) table->CreateFramebuffer;
     if (!strcmp(name, "DestroyFramebuffer"))
@@ -399,8 +406,10 @@ static inline void *loader_lookup_device_dispatch_table(
         return (void *) table->CmdBindDynamicRasterDepthBiasState;
     if (!strcmp(name, "CmdBindDynamicColorBlendState"))
         return (void *) table->CmdBindDynamicColorBlendState;
-    if (!strcmp(name, "CmdBindDynamicDepthStencilState"))
-        return (void *) table->CmdBindDynamicDepthStencilState;
+    if (!strcmp(name, "CmdBindDynamicDepthState"))
+        return (void *) table->CmdBindDynamicDepthState;
+    if (!strcmp(name, "CmdBindDynamicStencilState"))
+        return (void *) table->CmdBindDynamicStencilState;
     if (!strcmp(name, "CmdBindDescriptorSets"))
         return (void *) table->CmdBindDescriptorSets;
     if (!strcmp(name, "CmdBindVertexBuffers"))
index 715fcf742e2a0ca8bdbfefec4fe9f8e5b8b3b729..e5fef1147ff837e7f3e7114113661eb968f7bcb4 100644 (file)
@@ -1070,22 +1070,40 @@ LOADER_EXPORT VkResult VKAPI vkDestroyDynamicColorBlendState(VkDevice device, Vk
     return disp->DestroyDynamicColorBlendState(device, dynamicColorBlendState);
 }
 
-LOADER_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(VkDevice device, const VkDynamicDepthStencilStateCreateInfo* pCreateInfo, VkDynamicDepthStencilState* pState)
+LOADER_EXPORT VkResult VKAPI vkCreateDynamicDepthState(VkDevice device, const VkDynamicDepthStateCreateInfo* pCreateInfo, VkDynamicDepthState* pState)
 {
     const VkLayerDispatchTable *disp;
 
     disp = loader_get_dispatch(device);
 
-    return disp->CreateDynamicDepthStencilState(device, pCreateInfo, pState);
+    return disp->CreateDynamicDepthState(device, pCreateInfo, pState);
 }
 
-LOADER_EXPORT VkResult VKAPI vkDestroyDynamicDepthStencilState(VkDevice device, VkDynamicDepthStencilState dynamicDepthStencilState)
+LOADER_EXPORT VkResult VKAPI vkDestroyDynamicDepthState(VkDevice device, VkDynamicDepthState dynamicDepthState)
 {
     const VkLayerDispatchTable *disp;
 
     disp = loader_get_dispatch(device);
 
-    return disp->DestroyDynamicDepthStencilState(device, dynamicDepthStencilState);
+    return disp->DestroyDynamicDepthState(device, dynamicDepthState);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateDynamicStencilState(VkDevice device, const VkDynamicStencilStateCreateInfo* pCreateInfoFront, const VkDynamicStencilStateCreateInfo* pCreateInfoBack, VkDynamicStencilState* pState)
+{
+    const VkLayerDispatchTable *disp;
+
+    disp = loader_get_dispatch(device);
+
+    return disp->CreateDynamicStencilState(device, pCreateInfoFront, pCreateInfoBack, pState);
+}
+
+LOADER_EXPORT VkResult VKAPI vkDestroyDynamicStencilState(VkDevice device, VkDynamicStencilState dynamicStencilState)
+{
+    const VkLayerDispatchTable *disp;
+
+    disp = loader_get_dispatch(device);
+
+    return disp->DestroyDynamicStencilState(device, dynamicStencilState);
 }
 
 LOADER_EXPORT VkResult VKAPI vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, VkFramebuffer* pFramebuffer)
@@ -1256,13 +1274,22 @@ LOADER_EXPORT void VKAPI vkCmdBindDynamicColorBlendState(VkCmdBuffer cmdBuffer,
     disp->CmdBindDynamicColorBlendState(cmdBuffer, state);
 }
 
-LOADER_EXPORT void VKAPI vkCmdBindDynamicDepthStencilState(VkCmdBuffer cmdBuffer, VkDynamicDepthStencilState state)
+LOADER_EXPORT void VKAPI vkCmdBindDynamicDepthState(VkCmdBuffer cmdBuffer, VkDynamicDepthState state)
+{
+    const VkLayerDispatchTable *disp;
+
+    disp = loader_get_dispatch(cmdBuffer);
+
+    disp->CmdBindDynamicDepthState(cmdBuffer, state);
+}
+
+LOADER_EXPORT void VKAPI vkCmdBindDynamicStencilState(VkCmdBuffer cmdBuffer, VkDynamicStencilState state)
 {
     const VkLayerDispatchTable *disp;
 
     disp = loader_get_dispatch(cmdBuffer);
 
-    disp->CmdBindDynamicDepthStencilState(cmdBuffer, state);
+    disp->CmdBindDynamicStencilState(cmdBuffer, state);
 }
 
 LOADER_EXPORT void VKAPI vkCmdBindDescriptorSets(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t setCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets)
index 4af3b3719c14c9524b0587ff275f0f6085b278f3..a3da7423ab5e67dd521b90cc437deccb6f6b260c 100755 (executable)
@@ -1404,7 +1404,7 @@ class ObjectTrackerSubcommand(Subcommand):
     def generate_command_buffer_validates(self):
         cbv_txt = []
         cbv_txt.append('%s' % self.lineinfo.get())
-        for o in ['VkPipeline', 'VkDynamicViewportState', 'VkDynamicRasterLineState', 'VkDynamicRasterDepthBiasState', 'VkDynamicColorBlendState', 'VkDynamicDepthStencilState',
+        for o in ['VkPipeline', 'VkDynamicViewportState', 'VkDynamicRasterLineState', 'VkDynamicRasterDepthBiasState', 'VkDynamicColorBlendState', 'VkDynamicDepthState', 'VkDynamicStencilState',
                   'VkPipelineLayout', 'VkBuffer', 'VkEvent', 'VkQueryPool', 'VkRenderPass', 'VkFramebuffer']:
             cbv_txt.append('static void validate_object(VkCmdBuffer dispatchable_object, %s object)' % (o))
             cbv_txt.append('{')
@@ -1600,7 +1600,8 @@ class ThreadingSubcommand(Subcommand):
         'VkDynamicRasterLineState' : 'VK_OBJECT_TYPE_DYNAMIC_RASTER_LINE_STATE',
         'VkDynamicRasterDepthBiasState' : 'VK_OBJECT_TYPE_DYNAMIC_RASTER_DEPTH_BIAS_STATE',
         'VkDynamicColorBlendState' : 'VK_OBJECT_TYPE_DYNAMIC_COLOR_BLEND_STATE',
-        'VkDynamicDepthStencilState' : 'VK_OBJECT_TYPE_DYNAMIC_DEPTH_STENCIL_STATE',
+        'VkDynamicDepthState' : 'VK_OBJECT_TYPE_DYNAMIC_DEPTH_STATE',
+        'VkDynamicStencilState' : 'VK_OBJECT_TYPE_DYNAMIC_STENCIL_STATE',
         'VkFramebuffer' : 'VK_OBJECT_TYPE_FRAMEBUFFER',
         'VkCmdPool' : 'VK_OBJECT_TYPE_CMD_POOL',
     }
index e7206b4806ab64ba5b50be853c98f53a355c8dcf..086d2771a029eb6d65bc6ee64e52b11916c78811 100755 (executable)
--- a/vulkan.py
+++ b/vulkan.py
@@ -212,7 +212,8 @@ core = Extension(
         "VkDynamicRasterLineState",
         "VkDynamicRasterDepthBiasState",
         "VkDynamicColorBlendState",
-        "VkDynamicDepthStencilState",
+        "VkDynamicDepthState",
+        "VkDynamicStencilState",
         "VkRenderPass",
         "VkFramebuffer",
     ],
@@ -700,14 +701,24 @@ core = Extension(
             [Param("VkDevice", "device"),
              Param("VkDynamicColorBlendState", "dynamicColorBlendState")]),
 
-        Proto("VkResult", "CreateDynamicDepthStencilState",
+        Proto("VkResult", "CreateDynamicDepthState",
             [Param("VkDevice", "device"),
-             Param("const VkDynamicDepthStencilStateCreateInfo*", "pCreateInfo"),
-             Param("VkDynamicDepthStencilState*", "pState")]),
+             Param("const VkDynamicDepthStateCreateInfo*", "pCreateInfo"),
+             Param("VkDynamicDepthState*", "pState")]),
 
-        Proto("VkResult", "DestroyDynamicDepthStencilState",
+        Proto("VkResult", "DestroyDynamicDepthState",
             [Param("VkDevice", "device"),
-             Param("VkDynamicDepthStencilState", "dynamicDepthStencilState")]),
+             Param("VkDynamicDepthState", "dynamicDepthState")]),
+
+        Proto("VkResult", "CreateDynamicStencilState",
+            [Param("VkDevice", "device"),
+             Param("const VkDynamicStencilStateCreateInfo*", "pCreateInfoFront"),
+             Param("const VkDynamicStencilStateCreateInfo*", "pCreateInfoBack"),
+             Param("VkDynamicStencilState*", "pState")]),
+
+        Proto("VkResult", "DestroyDynamicStencilState",
+            [Param("VkDevice", "device"),
+             Param("VkDynamicStencilState", "dynamicStencilState")]),
 
         Proto("VkResult", "CreateCommandPool",
             [Param("VkDevice", "device"),
@@ -764,9 +775,13 @@ core = Extension(
             [Param("VkCmdBuffer", "cmdBuffer"),
              Param("VkDynamicColorBlendState", "dynamicColorBlendState")]),
 
-        Proto("void", "CmdBindDynamicDepthStencilState",
+        Proto("void", "CmdBindDynamicDepthState",
+            [Param("VkCmdBuffer", "cmdBuffer"),
+             Param("VkDynamicDepthState", "dynamicDepthState")]),
+
+        Proto("void", "CmdBindDynamicStencilState",
             [Param("VkCmdBuffer", "cmdBuffer"),
-             Param("VkDynamicDepthStencilState", "dynamicDepthStencilState")]),
+             Param("VkDynamicStencilState", "dynamicStencilState")]),
 
         Proto("void", "CmdBindDescriptorSets",
             [Param("VkCmdBuffer", "cmdBuffer"),
@@ -1157,7 +1172,8 @@ object_non_dispatch_list = [
     "VkDynamicRasterLineState",
     "VkDynamicRasterDepthBiasState",
     "VkDynamicColorBlendState",
-    "VkDynamicDepthStencilState",
+    "VkDynamicDepthState",
+    "VkDynamicStencilState",
     "VkRenderPass",
     "VkFramebuffer",
     "VkSwapChainWSI",