layers: Track static state bits separately
authorChris Forbes <chrisforbes@google.com>
Tue, 15 Aug 2017 21:48:50 +0000 (14:48 -0700)
committerChris Forbes <chrisf@ijw.co.nz>
Wed, 16 Aug 2017 17:39:46 +0000 (10:39 -0700)
This gives us two advantages:
- We no longer need to recalculate the state bits to remove for the old
pipeline when binding a new pipeline.
- We now have the set of bits to test against when trying to bind
dynamic state for #614

layers/core_validation.cpp
layers/core_validation_types.h

index 855c132..c131075 100644 (file)
@@ -1712,6 +1712,7 @@ static void resetCB(layer_data *dev_data, const VkCommandBuffer cb) {
         pCB->state = CB_NEW;
         pCB->submitCount = 0;
         pCB->status = 0;
+        pCB->static_status = 0;
         pCB->viewportMask = 0;
         pCB->scissorMask = 0;
 
@@ -5132,12 +5133,10 @@ VKAPI_ATTR void VKAPI_CALL CmdBindPipeline(VkCommandBuffer commandBuffer, VkPipe
 
         auto pipe_state = getPipelineState(dev_data, pipeline);
         if (VK_PIPELINE_BIND_POINT_GRAPHICS == pipelineBindPoint) {
-            auto old_pipe_state = cb_state->lastBound[pipelineBindPoint].pipeline_state;
-            if (old_pipe_state) {
-                cb_state->status &= ~MakeStaticStateMask(old_pipe_state->graphicsPipelineCI.ptr()->pDynamicState);
-            }
+            cb_state->status &= ~cb_state->static_status;
             if (pipe_state) {
-                cb_state->status |= MakeStaticStateMask(pipe_state->graphicsPipelineCI.ptr()->pDynamicState);
+                cb_state->static_status = MakeStaticStateMask(pipe_state->graphicsPipelineCI.ptr()->pDynamicState);
+                cb_state->status |= cb_state->static_status;
             }
         }
         if (pipe_state) {
index 2b109ea..800610b 100644 (file)
@@ -641,6 +641,8 @@ struct GLOBAL_CB_NODE : public BASE_NODE {
     CB_STATE state;                      // Track cmd buffer update state
     uint64_t submitCount;                // Number of times CB has been submitted
     CBStatusFlags status;                // Track status of various bindings on cmd buffer
+    CBStatusFlags static_status;         // All state bits provided by current graphics pipeline
+                                         // rather than dynamic state
     // Currently storing "lastBound" objects on per-CB basis
     //  long-term may want to create caches of "lastBound" states and could have
     //  each individual CMD_NODE referencing its own "lastBound" state