aboutsummaryrefslogtreecommitdiff
path: root/layers/draw_state.cpp
diff options
context:
space:
mode:
authorMichael Lentine <mlentine@google.com>2016-02-03 10:55:23 -0600
committerTobin Ehlis <tobine@google.com>2016-02-04 12:20:17 -0700
commit43a11ea407557a359bdb1afb16aa231fe908f2da (patch)
tree642c910169259f1310b47f297843d63b925e6230 /layers/draw_state.cpp
parent6bf4edeedb88a59d3d319f1d8bc2eb93ea3b0bdd (diff)
downloadusermoji-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/draw_state.cpp')
-rw-r--r--layers/draw_state.cpp16
1 files changed, 16 insertions, 0 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);
}