From 41ab73b6458cf91f47c564b589f1126e94fdceb2 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Tue, 15 Aug 2017 14:48:50 -0700 Subject: layers: Track static state bits separately 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 | 9 ++++----- layers/core_validation_types.h | 2 ++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 855c132e..c1310754 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -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) { diff --git a/layers/core_validation_types.h b/layers/core_validation_types.h index 2b109ea2..800610b7 100644 --- a/layers/core_validation_types.h +++ b/layers/core_validation_types.h @@ -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 -- cgit v1.2.3