aboutsummaryrefslogtreecommitdiff
path: root/layers/core_validation.cpp
diff options
context:
space:
mode:
authorTobin Ehlis <tobine@google.com>2016-05-16 11:23:01 -0600
committerTobin Ehlis <tobine@google.com>2016-05-18 09:06:23 -0600
commitfc39c5b846aecadfc7134ebeb8a26d4a16556f26 (patch)
treedf7bda17871bea7f25d894f6a4f5d5533c93fbea /layers/core_validation.cpp
parentbe8751322d1c4e175fa40cb8c1a23a65f3db3c4a (diff)
downloadusermoji-fc39c5b846aecadfc7134ebeb8a26d4a16556f26.tar.xz
layers: GH544 Allow INVALID cmd buffers to be reset
BeginCommandBuffer performs an implicit reset of a command buffer. This allows command buffers in the INVALID state to undergo this implicit reset. In order to make sure that an invalid command buffer in the INVALID state has had EndCommandBuffer called, this commit adds a CMD_END command that's inserted at the end of a command. If a command buffer in the INVALID state has had EndCommandBuffer called and it is now having BeginCommandBuffer called, it's ok to implicitly reset the command buffer. buffer's vector of commands.
Diffstat (limited to 'layers/core_validation.cpp')
-rw-r--r--layers/core_validation.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 51aaf88d..ebaa6b0d 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -3658,6 +3658,7 @@ static bool addCmd(const layer_data *my_data, GLOBAL_CB_NODE *pCB, const CMD_TYP
case CMD_UPDATEBUFFER:
case CMD_PIPELINEBARRIER:
case CMD_EXECUTECOMMANDS:
+ case CMD_END:
break;
default:
break;
@@ -3665,6 +3666,7 @@ static bool addCmd(const layer_data *my_data, GLOBAL_CB_NODE *pCB, const CMD_TYP
}
if (pCB->state != CB_RECORDING) {
skipCall |= report_error_no_cb_begin(my_data, pCB->commandBuffer, caller_name);
+ } else {
skipCall |= validateCmdsInCmdBuffer(my_data, pCB, cmd);
CMD_NODE cmdNode = {};
// init cmd node and append to end of cmd LL
@@ -6197,7 +6199,7 @@ BeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo
"vkBeginCommandBuffer(): Cannot call Begin on CB (0x%" PRIxLEAST64
") in the RECORDING state. Must first call vkEndCommandBuffer().",
(uint64_t)commandBuffer);
- } else if (CB_RECORDED == pCB->state) {
+ } else if (CB_RECORDED == pCB->state || (CB_INVALID == pCB->state && CMD_END == pCB->cmds.back().type)) {
VkCommandPool cmdPool = pCB->createInfo.commandPool;
if (!(VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT & dev_data->commandPoolMap[cmdPool].createFlags)) {
skipCall |=
@@ -6251,9 +6253,7 @@ VKAPI_ATTR VkResult VKAPI_CALL EndCommandBuffer(VkCommandBuffer commandBuffer) {
// https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/pull/516#discussion_r63013756
skipCall |= insideRenderPass(dev_data, pCB, "vkEndCommandBuffer");
}
- if (pCB->state != CB_RECORDING) {
- skipCall |= report_error_no_cb_begin(dev_data, commandBuffer, "vkEndCommandBuffer()");
- }
+ skipCall |= addCmd(dev_data, pCB, CMD_END, "vkEndCommandBuffer()");
for (auto query : pCB->activeQueries) {
skipCall |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
DRAWSTATE_INVALID_QUERY, "DS",