}
}
-void UpdateCmdBufferLastCmd(GLOBAL_CB_NODE *cb_state, const CMD_TYPE cmd) {
- if (cb_state->state == CB_RECORDING) {
- cb_state->last_cmd = cmd;
- }
-}
// For given object struct return a ptr of BASE_NODE type for its wrapping struct
BASE_NODE *GetStateStructPtrFromObject(layer_data *dev_data, VK_OBJECT object_struct) {
BASE_NODE *base_ptr = nullptr;
GLOBAL_CB_NODE *pCB = dev_data->commandBufferMap[cb];
if (pCB) {
pCB->in_use.store(0);
- pCB->last_cmd = CMD_NONE;
// Reset CB state (note that createInfo is not cleared)
pCB->commandBuffer = cb;
memset(&pCB->beginInfo, 0, sizeof(VkCommandBufferBeginInfo));
skip |= insideRenderPass(dev_data, pCB, "vkEndCommandBuffer()", VALIDATION_ERROR_27400078);
}
skip |= ValidateCmd(dev_data, pCB, CMD_END, "vkEndCommandBuffer()");
- UpdateCmdBufferLastCmd(pCB, CMD_END);
for (auto query : pCB->activeQueries) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_2740007a, "DS",
skip |= ValidateCmdQueueFlags(dev_data, cb_state, "vkCmdBindPipeline()", VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT,
VALIDATION_ERROR_18002415);
skip |= ValidateCmd(dev_data, cb_state, CMD_BINDPIPELINE, "vkCmdBindPipeline()");
- UpdateCmdBufferLastCmd(cb_state, CMD_BINDPIPELINE);
if ((VK_PIPELINE_BIND_POINT_COMPUTE == pipelineBindPoint) && (cb_state->activeRenderPass)) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
if (pCB) {
skip |= ValidateCmdQueueFlags(dev_data, pCB, "vkCmdSetViewport()", VK_QUEUE_GRAPHICS_BIT, VALIDATION_ERROR_1e002415);
skip |= ValidateCmd(dev_data, pCB, CMD_SETVIEWPORTSTATE, "vkCmdSetViewport()");
- UpdateCmdBufferLastCmd(pCB, CMD_SETVIEWPORTSTATE);
pCB->viewportMask |= ((1u << viewportCount) - 1u) << firstViewport;
}
lock.unlock();
if (pCB) {
skip |= ValidateCmdQueueFlags(dev_data, pCB, "vkCmdSetScissor()", VK_QUEUE_GRAPHICS_BIT, VALIDATION_ERROR_1d802415);
skip |= ValidateCmd(dev_data, pCB, CMD_SETSCISSORSTATE, "vkCmdSetScissor()");
- UpdateCmdBufferLastCmd(pCB, CMD_SETSCISSORSTATE);
pCB->scissorMask |= ((1u << scissorCount) - 1u) << firstScissor;
}
lock.unlock();
if (pCB) {
skip |= ValidateCmdQueueFlags(dev_data, pCB, "vkCmdSetLineWidth()", VK_QUEUE_GRAPHICS_BIT, VALIDATION_ERROR_1d602415);
skip |= ValidateCmd(dev_data, pCB, CMD_SETLINEWIDTHSTATE, "vkCmdSetLineWidth()");
- UpdateCmdBufferLastCmd(pCB, CMD_SETLINEWIDTHSTATE);
pCB->status |= CBSTATUS_LINE_WIDTH_SET;
PIPELINE_STATE *pPipeTrav = pCB->lastBound[VK_PIPELINE_BIND_POINT_GRAPHICS].pipeline_state;
validation_error_map[VALIDATION_ERROR_1cc0062c]);
}
if (!skip) {
- UpdateCmdBufferLastCmd(pCB, CMD_SETDEPTHBIASSTATE);
pCB->status |= CBSTATUS_DEPTH_BIAS_SET;
}
}
if (pCB) {
skip |= ValidateCmdQueueFlags(dev_data, pCB, "vkCmdSetBlendConstants()", VK_QUEUE_GRAPHICS_BIT, VALIDATION_ERROR_1ca02415);
skip |= ValidateCmd(dev_data, pCB, CMD_SETBLENDSTATE, "vkCmdSetBlendConstants()");
- UpdateCmdBufferLastCmd(pCB, CMD_SETBLENDSTATE);
pCB->status |= CBSTATUS_BLEND_CONSTANTS_SET;
}
lock.unlock();
if (pCB) {
skip |= ValidateCmdQueueFlags(dev_data, pCB, "vkCmdSetDepthBounds()", VK_QUEUE_GRAPHICS_BIT, VALIDATION_ERROR_1ce02415);
skip |= ValidateCmd(dev_data, pCB, CMD_SETDEPTHBOUNDSSTATE, "vkCmdSetDepthBounds()");
- UpdateCmdBufferLastCmd(pCB, CMD_SETDEPTHBOUNDSSTATE);
pCB->status |= CBSTATUS_DEPTH_BOUNDS_SET;
}
lock.unlock();
skip |=
ValidateCmdQueueFlags(dev_data, pCB, "vkCmdSetStencilCompareMask()", VK_QUEUE_GRAPHICS_BIT, VALIDATION_ERROR_1da02415);
skip |= ValidateCmd(dev_data, pCB, CMD_SETSTENCILREADMASKSTATE, "vkCmdSetStencilCompareMask()");
- UpdateCmdBufferLastCmd(pCB, CMD_SETSTENCILREADMASKSTATE);
pCB->status |= CBSTATUS_STENCIL_READ_MASK_SET;
}
lock.unlock();
skip |=
ValidateCmdQueueFlags(dev_data, pCB, "vkCmdSetStencilWriteMask()", VK_QUEUE_GRAPHICS_BIT, VALIDATION_ERROR_1de02415);
skip |= ValidateCmd(dev_data, pCB, CMD_SETSTENCILWRITEMASKSTATE, "vkCmdSetStencilWriteMask()");
- UpdateCmdBufferLastCmd(pCB, CMD_SETSTENCILWRITEMASKSTATE);
pCB->status |= CBSTATUS_STENCIL_WRITE_MASK_SET;
}
lock.unlock();
skip |=
ValidateCmdQueueFlags(dev_data, pCB, "vkCmdSetStencilReference()", VK_QUEUE_GRAPHICS_BIT, VALIDATION_ERROR_1dc02415);
skip |= ValidateCmd(dev_data, pCB, CMD_SETSTENCILREFERENCESTATE, "vkCmdSetStencilReference()");
- UpdateCmdBufferLastCmd(pCB, CMD_SETSTENCILREFERENCESTATE);
pCB->status |= CBSTATUS_STENCIL_REFERENCE_SET;
}
lock.unlock();
"Attempt to bind descriptor set 0x%" PRIxLEAST64 " that doesn't exist!",
HandleToUint64(pDescriptorSets[set_idx]));
}
- UpdateCmdBufferLastCmd(cb_state, CMD_BINDDESCRIPTORSETS);
// For any previously bound sets, need to set them to "invalid" if they were disturbed by this update
if (firstSet > 0) { // Check set #s below the first bound set
for (uint32_t i = 0; i < firstSet; ++i) {
return ValidateBufferMemoryIsValid(dev_data, buffer_state, "vkCmdBindIndexBuffer()");
};
cb_node->validate_functions.push_back(function);
- UpdateCmdBufferLastCmd(cb_node, CMD_BINDINDEXBUFFER);
VkDeviceSize offset_align = 0;
switch (indexType) {
case VK_INDEX_TYPE_UINT16:
pOffsets[i], validation_error_map[VALIDATION_ERROR_182004e4]);
}
}
- UpdateCmdBufferLastCmd(cb_node, CMD_BINDVERTEXBUFFER);
updateResourceTracking(cb_node, firstBinding, bindingCount, pBuffers);
} else {
assert(0);
CMD_TYPE cmd_type) {
UpdateDrawState(dev_data, cb_state, bind_point);
MarkStoreImagesAndBuffersAsWritten(dev_data, cb_state);
- UpdateCmdBufferLastCmd(cb_state, cmd_type);
}
// Generic function to handle state update for all CmdDraw* type functions
ValidateCmdQueueFlags(dev_data, cb_node, "vkCmdUpdateBuffer()",
VK_QUEUE_TRANSFER_BIT | VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT, VALIDATION_ERROR_1e402415);
skip |= ValidateCmd(dev_data, cb_node, CMD_UPDATEBUFFER, "vkCmdUpdateBuffer()");
- UpdateCmdBufferLastCmd(cb_node, CMD_UPDATEBUFFER);
skip |= insideRenderPass(dev_data, cb_node, "vkCmdUpdateBuffer()", VALIDATION_ERROR_1e400017);
} else {
assert(0);
skip |= ValidateCmdQueueFlags(dev_data, pCB, "vkCmdSetEvent()", VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT,
VALIDATION_ERROR_1d402415);
skip |= ValidateCmd(dev_data, pCB, CMD_SETEVENT, "vkCmdSetEvent()");
- UpdateCmdBufferLastCmd(pCB, CMD_SETEVENT);
skip |= insideRenderPass(dev_data, pCB, "vkCmdSetEvent()", VALIDATION_ERROR_1d400017);
skip |= ValidateStageMaskGsTsEnables(dev_data, stageMask, "vkCmdSetEvent()", VALIDATION_ERROR_1d4008fc,
VALIDATION_ERROR_1d4008fe);
skip |= ValidateCmdQueueFlags(dev_data, pCB, "vkCmdResetEvent()", VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT,
VALIDATION_ERROR_1c402415);
skip |= ValidateCmd(dev_data, pCB, CMD_RESETEVENT, "vkCmdResetEvent()");
- UpdateCmdBufferLastCmd(pCB, CMD_RESETEVENT);
skip |= insideRenderPass(dev_data, pCB, "vkCmdResetEvent()", VALIDATION_ERROR_1c400017);
skip |= ValidateStageMaskGsTsEnables(dev_data, stageMask, "vkCmdResetEvent()", VALIDATION_ERROR_1c400904,
VALIDATION_ERROR_1c400906);
skip |= ValidateCmdQueueFlags(dev_data, cb_state, "vkCmdWaitEvents()", VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT,
VALIDATION_ERROR_1e602415);
skip |= ValidateCmd(dev_data, cb_state, CMD_WAITEVENTS, "vkCmdWaitEvents()");
- UpdateCmdBufferLastCmd(cb_state, CMD_WAITEVENTS);
skip |=
ValidateBarriersToImages(dev_data, commandBuffer, imageMemoryBarrierCount, pImageMemoryBarriers, "vkCmdWaitEvents()");
if (!skip) {
static void PreCallRecordCmdPipelineBarrier(layer_data *device_data, GLOBAL_CB_NODE *cb_state, VkCommandBuffer commandBuffer,
uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers) {
- UpdateCmdBufferLastCmd(cb_state, CMD_PIPELINEBARRIER);
TransitionImageLayouts(device_data, commandBuffer, imageMemoryBarrierCount, pImageMemoryBarriers);
}
QueryObject query = {queryPool, slot};
pCB->activeQueries.insert(query);
pCB->startedQueries.insert(query);
- UpdateCmdBufferLastCmd(pCB, CMD_BEGINQUERY);
addCommandBufferBinding(&GetQueryPoolNode(dev_data, queryPool)->cb_bindings,
{HandleToUint64(queryPool), kVulkanObjectTypeQueryPool}, pCB);
}
if (cb_state) {
cb_state->activeQueries.erase(query);
cb_state->queryUpdates.emplace_back([=](VkQueue q){return setQueryState(q, commandBuffer, query, true);});
- UpdateCmdBufferLastCmd(cb_state, CMD_ENDQUERY);
addCommandBufferBinding(&GetQueryPoolNode(dev_data, queryPool)->cb_bindings,
{HandleToUint64(queryPool), kVulkanObjectTypeQueryPool}, cb_state);
}
cb_state->waitedEventsBeforeQueryReset[query] = cb_state->waitedEvents;
cb_state->queryUpdates.emplace_back([=](VkQueue q){return setQueryState(q, commandBuffer, query, false);});
}
- UpdateCmdBufferLastCmd(cb_state, CMD_RESETQUERYPOOL);
addCommandBufferBinding(&GetQueryPoolNode(dev_data, queryPool)->cb_bindings,
{HandleToUint64(queryPool), kVulkanObjectTypeQueryPool}, cb_state);
}
cb_node->queryUpdates.emplace_back([=](VkQueue q) {
return validateQuery(q, cb_node, queryPool, firstQuery, queryCount);
});
- UpdateCmdBufferLastCmd(cb_node, CMD_COPYQUERYPOOLRESULTS);
addCommandBufferBinding(&GetQueryPoolNode(dev_data, queryPool)->cb_bindings,
{HandleToUint64(queryPool), kVulkanObjectTypeQueryPool}, cb_node);
}
skip |= ValidateCmdQueueFlags(dev_data, cb_state, "vkCmdPushConstants()", VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT,
VALIDATION_ERROR_1bc02415);
skip |= ValidateCmd(dev_data, cb_state, CMD_PUSHCONSTANTS, "vkCmdPushConstants()");
- UpdateCmdBufferLastCmd(cb_state, CMD_PUSHCONSTANTS);
}
skip |= validatePushConstantRange(dev_data, offset, size, "vkCmdPushConstants()");
if (0 == stageFlags) {
if (cb_state) {
QueryObject query = {queryPool, slot};
cb_state->queryUpdates.emplace_back([=](VkQueue q) {return setQueryState(q, commandBuffer, query, true);});
- UpdateCmdBufferLastCmd(cb_state, CMD_WRITETIMESTAMP);
}
}
skip |= ValidateCmdQueueFlags(dev_data, cb_node, "vkCmdBeginRenderPass()", VK_QUEUE_GRAPHICS_BIT,
VALIDATION_ERROR_17a02415);
skip |= ValidateCmd(dev_data, cb_node, CMD_BEGINRENDERPASS, "vkCmdBeginRenderPass()");
- UpdateCmdBufferLastCmd(cb_node, CMD_BEGINRENDERPASS);
cb_node->activeRenderPass = render_pass_state;
// This is a shallow copy as that is all that is needed for now
cb_node->activeRenderPassBeginInfo = *pRenderPassBegin;
skip |= validatePrimaryCommandBuffer(dev_data, pCB, "vkCmdNextSubpass()", VALIDATION_ERROR_1b600019);
skip |= ValidateCmdQueueFlags(dev_data, pCB, "vkCmdNextSubpass()", VK_QUEUE_GRAPHICS_BIT, VALIDATION_ERROR_1b602415);
skip |= ValidateCmd(dev_data, pCB, CMD_NEXTSUBPASS, "vkCmdNextSubpass()");
- UpdateCmdBufferLastCmd(pCB, CMD_NEXTSUBPASS);
skip |= outsideRenderPass(dev_data, pCB, "vkCmdNextSubpass()", VALIDATION_ERROR_1b600017);
auto subpassCount = pCB->activeRenderPass->createInfo.subpassCount;
skip |= validatePrimaryCommandBuffer(dev_data, pCB, "vkCmdEndRenderPass()", VALIDATION_ERROR_1b000019);
skip |= ValidateCmdQueueFlags(dev_data, pCB, "vkCmdEndRenderPass()", VK_QUEUE_GRAPHICS_BIT, VALIDATION_ERROR_1b002415);
skip |= ValidateCmd(dev_data, pCB, CMD_ENDRENDERPASS, "vkCmdEndRenderPass()");
- UpdateCmdBufferLastCmd(pCB, CMD_ENDRENDERPASS);
}
lock.unlock();
ValidateCmdQueueFlags(dev_data, pCB, "vkCmdExecuteCommands()",
VK_QUEUE_TRANSFER_BIT | VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT, VALIDATION_ERROR_1b202415);
skip |= ValidateCmd(dev_data, pCB, CMD_EXECUTECOMMANDS, "vkCmdExecuteCommands()");
- UpdateCmdBufferLastCmd(pCB, CMD_EXECUTECOMMANDS);
}
lock.unlock();
if (!skip) dev_data->dispatch_table.CmdExecuteCommands(commandBuffer, commandBuffersCount, pCommandBuffers);