bug-14365: add dynamic state to PSO

This commit covers phase 2 of the removal of dynamic
state objects. Now, an application can include an array
of VK_DYNAMIC_STATE_* values that tell the driver
which PSO dynamic state elements to use.
I.e. if VK_DYNAMIC_STATE_LINE_WIDTH was specified in the
pDynamicState array then the ICD should use the lineWidth
defined at PSO create time and ignore any set using
vkCmdSetLineWidth.
To accomplish that the driver will make a copy of the
dynamic state specified in the PSO as well as a bitmask
of the affected state. When vkCmdSet* is called, the
driver will check if a PSO override is current and ignore
the call if so.
At PSO bind time the command buffer's dynamic state
will be updated and the PSO override bitmask set so that
any future vkCmdSet*'s will be appropriately ignored.
TODO: Validation layer should probably indicate a warning
if app tries to do vkCmdSet on state defined by the PSO.
diff --git a/include/vulkan.h b/include/vulkan.h
index 2a1e06d..8be2b4f 100644
--- a/include/vulkan.h
+++ b/include/vulkan.h
@@ -41,7 +41,7 @@
     ((major << 22) | (minor << 12) | patch)
 
 // Vulkan API version supported by this file
-#define VK_API_VERSION VK_MAKE_VERSION(0, 170, 1)
+#define VK_API_VERSION VK_MAKE_VERSION(0, 170, 2)
 
 
 #if defined(__cplusplus) && (_MSC_VER >= 1800 || __cplusplus >= 201103L)
@@ -206,9 +206,10 @@
     VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 43,
     VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO = 44,
     VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = 45,
+    VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = 46,
     VK_STRUCTURE_TYPE_BEGIN_RANGE = VK_STRUCTURE_TYPE_APPLICATION_INFO,
-    VK_STRUCTURE_TYPE_END_RANGE = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
-    VK_STRUCTURE_TYPE_NUM = (VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO - VK_STRUCTURE_TYPE_APPLICATION_INFO + 1),
+    VK_STRUCTURE_TYPE_END_RANGE = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO,
+    VK_STRUCTURE_TYPE_NUM = (VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO - VK_STRUCTURE_TYPE_APPLICATION_INFO + 1),
     VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF
 } VkStructureType;
 
@@ -670,6 +671,22 @@
 } VkBlendOp;
 
 typedef enum {
+    VK_DYNAMIC_STATE_VIEWPORT = 0,
+    VK_DYNAMIC_STATE_SCISSOR = 1,
+    VK_DYNAMIC_STATE_LINE_WIDTH = 2,
+    VK_DYNAMIC_STATE_DEPTH_BIAS = 3,
+    VK_DYNAMIC_STATE_BLEND_CONSTANTS = 4,
+    VK_DYNAMIC_STATE_DEPTH_BOUNDS = 5,
+    VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 6,
+    VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 7,
+    VK_DYNAMIC_STATE_STENCIL_REFERENCE = 8,
+    VK_DYNAMIC_STATE_BEGIN_RANGE = VK_DYNAMIC_STATE_VIEWPORT,
+    VK_DYNAMIC_STATE_END_RANGE = VK_DYNAMIC_STATE_STENCIL_REFERENCE,
+    VK_DYNAMIC_STATE_NUM = (VK_DYNAMIC_STATE_STENCIL_REFERENCE - VK_DYNAMIC_STATE_VIEWPORT + 1),
+    VK_DYNAMIC_STATE_MAX_ENUM = 0x7FFFFFFF
+} VkDynamicState;
+
+typedef enum {
     VK_TEX_FILTER_NEAREST = 0,
     VK_TEX_FILTER_LINEAR = 1,
     VK_TEX_FILTER_BEGIN_RANGE = VK_TEX_FILTER_NEAREST,
@@ -1640,6 +1657,9 @@
     VkStructureType                             sType;
     const void*                                 pNext;
     uint32_t                                    viewportCount;
+    const VkViewport*                           pViewports;
+    uint32_t                                    scissorCount;
+    const VkRect2D*                             pScissors;
 } VkPipelineViewportStateCreateInfo;
 
 typedef struct {
@@ -1651,6 +1671,10 @@
     VkCullMode                                  cullMode;
     VkFrontFace                                 frontFace;
     VkBool32                                    depthBiasEnable;
+    float                                       depthBias;
+    float                                       depthBiasClamp;
+    float                                       slopeScaledDepthBias;
+    float                                       lineWidth;
 } VkPipelineRasterStateCreateInfo;
 
 typedef struct {
@@ -1667,6 +1691,9 @@
     VkStencilOp                                 stencilPassOp;
     VkStencilOp                                 stencilDepthFailOp;
     VkCompareOp                                 stencilCompareOp;
+    uint32_t                                    stencilCompareMask;
+    uint32_t                                    stencilWriteMask;
+    uint32_t                                    stencilReference;
 } VkStencilOpState;
 
 typedef struct {
@@ -1679,6 +1706,8 @@
     VkBool32                                    stencilTestEnable;
     VkStencilOpState                            front;
     VkStencilOpState                            back;
+    float                                       minDepthBounds;
+    float                                       maxDepthBounds;
 } VkPipelineDepthStencilStateCreateInfo;
 
 typedef struct {
@@ -1701,11 +1730,19 @@
     VkLogicOp                                   logicOp;
     uint32_t                                    attachmentCount;
     const VkPipelineColorBlendAttachmentState*  pAttachments;
+    float                                       blendConst[4];
 } VkPipelineColorBlendStateCreateInfo;
 
 typedef struct {
     VkStructureType                             sType;
     const void*                                 pNext;
+    uint32_t                                    dynamicStateCount;
+    const VkDynamicState*                       pDynamicStates;
+} VkPipelineDynamicStateCreateInfo;
+
+typedef struct {
+    VkStructureType                             sType;
+    const void*                                 pNext;
     uint32_t                                    stageCount;
     const VkPipelineShaderStageCreateInfo*      pStages;
     const VkPipelineVertexInputStateCreateInfo* pVertexInputState;
@@ -1716,6 +1753,7 @@
     const VkPipelineMultisampleStateCreateInfo* pMultisampleState;
     const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState;
     const VkPipelineColorBlendStateCreateInfo*  pColorBlendState;
+    const VkPipelineDynamicStateCreateInfo*     pDynamicState;
     VkPipelineCreateFlags                       flags;
     VkPipelineLayout                            layout;
     VkRenderPass                                renderPass;