From 347d4d3139a1e743ed85bd375c20fd35bbe68d74 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Tue, 20 Dec 2016 11:33:11 +1300 Subject: [PATCH] layers: Remove cmds vector from GLOBAL_CB_NODE Now that cmd buffer printing has been removed, the only use of this is to distinguish between cmd buffers invalidated before and after a complete recording. This should eventually be folded into the state machine, but removing the vector of cmds is a first step. Signed-off-by: Chris Forbes --- layers/core_validation.cpp | 10 +++------- layers/core_validation_types.h | 9 ++------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 09b4132..12a8337 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -3821,11 +3821,7 @@ static bool addCmd(layer_data *my_data, GLOBAL_CB_NODE *pCB, const CMD_TYPE cmd, skip_call |= report_error_no_cb_begin(my_data, pCB->commandBuffer, caller_name); } else { skip_call |= validateCmdsInCmdBuffer(my_data, pCB, cmd); - CMD_NODE cmdNode = {}; - // init cmd node and append to end of cmd LL - cmdNode.cmdNumber = ++pCB->numCmds; - cmdNode.type = cmd; - pCB->cmds.push_back(cmdNode); + pCB->last_cmd = cmd; // TODO: replace this with better ->state tracking. } return skip_call; } @@ -3916,7 +3912,7 @@ static void resetCB(layer_data *dev_data, const VkCommandBuffer cb) { GLOBAL_CB_NODE *pCB = dev_data->commandBufferMap[cb]; if (pCB) { pCB->in_use.store(0); - pCB->cmds.clear(); + pCB->last_cmd = CMD_NONE; // Reset CB state (note that createInfo is not cleared) pCB->commandBuffer = cb; memset(&pCB->beginInfo, 0, sizeof(VkCommandBufferBeginInfo)); @@ -7444,7 +7440,7 @@ BeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo "vkBeginCommandBuffer(): Cannot call Begin on command buffer (0x%" PRIxLEAST64 ") in the RECORDING state. Must first call vkEndCommandBuffer().", (uint64_t)commandBuffer); - } else if (CB_RECORDED == cb_node->state || (CB_INVALID == cb_node->state && CMD_END == cb_node->cmds.back().type)) { + } else if (CB_RECORDED == cb_node->state || (CB_INVALID == cb_node->state && CMD_END == cb_node->last_cmd)) { VkCommandPool cmdPool = cb_node->createInfo.commandPool; auto pPool = getCommandPoolNode(dev_data, cmdPool); if (!(VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT & pPool->createFlags)) { diff --git a/layers/core_validation_types.h b/layers/core_validation_types.h index 298848a..ec38522 100644 --- a/layers/core_validation_types.h +++ b/layers/core_validation_types.h @@ -337,6 +337,7 @@ struct RENDER_PASS_STATE : public BASE_NODE { // Cmd Buffer Tracking enum CMD_TYPE { + CMD_NONE, CMD_BINDPIPELINE, CMD_BINDPIPELINEDELTA, CMD_SETVIEWPORTSTATE, @@ -389,12 +390,6 @@ enum CMD_TYPE { CMD_END, // Should be last command in any RECORDED cmd buffer }; -// Data structure for holding sequence of cmds in cmd buffer -struct CMD_NODE { - CMD_TYPE type; - uint64_t cmdNumber; -}; - enum CB_STATE { CB_NEW, // Newly created CB w/o any cmds CB_RECORDING, // BeginCB has been called on this CB @@ -581,7 +576,7 @@ 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 - std::vector cmds; // vector of commands bound to this command buffer + CMD_TYPE last_cmd; // Last command written to the CB // 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 -- 2.7.4