diff options
| author | Michael Lentine <mlentine@google.com> | 2016-02-03 10:55:23 -0600 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-02-04 12:20:17 -0700 |
| commit | 43a11ea407557a359bdb1afb16aa231fe908f2da (patch) | |
| tree | 642c910169259f1310b47f297843d63b925e6230 /layers | |
| parent | 6bf4edeedb88a59d3d319f1d8bc2eb93ea3b0bdd (diff) | |
| download | usermoji-43a11ea407557a359bdb1afb16aa231fe908f2da.tar.xz | |
layers: Validate secondary command buffers are most recently bound.
Secondary cmd buffer bound to new primary cmd buffer cannot be submitted
under the first primary cmd buffer.
This is based on spec valid usage restriction in vkQueueSubmit:
Any given element of pCommandBuffers must not contain commands that execute a
secondary command buffer, if that secondary command buffer has been recorded in
another primary command buffer after it was recorded into this VkCommandBuffer
Diffstat (limited to 'layers')
| -rw-r--r-- | layers/draw_state.cpp | 16 | ||||
| -rwxr-xr-x | layers/draw_state.h | 4 |
2 files changed, 19 insertions, 1 deletions
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp index ee343dbd..01879524 100644 --- a/layers/draw_state.cpp +++ b/layers/draw_state.cpp @@ -2805,6 +2805,7 @@ static void resetCB(layer_data* my_data, const VkCommandBuffer cb) pCB->imageLayoutMap.clear(); pCB->drawData.clear(); pCB->currentDrawData.buffers.clear(); + pCB->primaryCommandBuffer = VK_NULL_HANDLE; pCB->secondaryCommandBuffers.clear(); pCB->dynamicOffsets.clear(); } @@ -3455,6 +3456,20 @@ static VkBool32 validateCommandBufferState(layer_data *dev_data, dev_data, dev_data->commandBufferMap[secondaryCmdBuffer]); GLOBAL_CB_NODE* pSubCB = getCBNode(dev_data, secondaryCmdBuffer); skipCall |= validateCommandBufferSimultaneousUse(dev_data, pSubCB); + if (pSubCB->primaryCommandBuffer != pCB->commandBuffer) { + log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, 0, + __LINE__, + DRAWSTATE_COMMAND_BUFFER_SINGLE_SUBMIT_VIOLATION, "DS", + "CB %#" PRIxLEAST64 + " was submitted with secondary buffer %#" PRIxLEAST64 + " but that buffer has subsequently been bound to " + "primary cmd buffer %#" PRIxLEAST64 ".", + reinterpret_cast<uint64_t>(pCB->commandBuffer), + reinterpret_cast<uint64_t>(secondaryCmdBuffer), + reinterpret_cast<uint64_t>( + pSubCB->primaryCommandBuffer)); + } } } if ((pCB->beginInfo.flags & VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT) && @@ -6593,6 +6608,7 @@ VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands(VkCommandBuffer pCB->beginInfo.flags &= ~VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT; } } + pSubCB->primaryCommandBuffer = pCB->commandBuffer; pCB->secondaryCommandBuffers.insert(pSubCB->commandBuffer); dev_data->globalInFlightCmdBuffers.insert(pSubCB->commandBuffer); } diff --git a/layers/draw_state.h b/layers/draw_state.h index 0726e0f6..52b259c8 100755 --- a/layers/draw_state.h +++ b/layers/draw_state.h @@ -608,7 +608,9 @@ typedef struct _GLOBAL_CB_NODE { unordered_map<VkImage, IMAGE_CMD_BUF_NODE> imageLayoutMap; vector<DRAW_DATA> drawData; DRAW_DATA currentDrawData; - // If cmd buffer is primary, track secondary command buffers pending execution + VkCommandBuffer primaryCommandBuffer; + // If cmd buffer is primary, track secondary command buffers pending + // execution std::unordered_set<VkCommandBuffer> secondaryCommandBuffers; vector<uint32_t> dynamicOffsets; // one dynamic offset per dynamic descriptor bound to this CB } GLOBAL_CB_NODE; |
