Skip to content

Commit f0e073c

Browse files
layers: Handle commands not in recording command buffer
1 parent ace304f commit f0e073c

15 files changed

+462
-155
lines changed

layers/core_checks/cc_cmd_buffer.cpp

Lines changed: 43 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,6 +1498,41 @@ bool CoreChecks::PreCallValidateCmdDebugMarkerEndEXT(VkCommandBuffer commandBuff
14981498
return ValidateCmd(*cb_state, error_obj.location);
14991499
}
15001500

1501+
bool CoreChecks::PreCallValidateCmdDebugMarkerInsertEXT(VkCommandBuffer commandBuffer,
1502+
const VkDebugMarkerMarkerInfoEXT *pMarkerInfo,
1503+
const ErrorObject &error_obj) const {
1504+
auto cb_state = GetRead<vvl::CommandBuffer>(commandBuffer);
1505+
return ValidateCmd(*cb_state, error_obj.location);
1506+
}
1507+
1508+
bool CoreChecks::PreCallValidateCmdBeginDebugUtilsLabelEXT(VkCommandBuffer commandBuffer, const VkDebugUtilsLabelEXT *pLabelInfo,
1509+
const ErrorObject &error_obj) const {
1510+
auto cb_state = GetRead<vvl::CommandBuffer>(commandBuffer);
1511+
return ValidateCmd(*cb_state, error_obj.location);
1512+
}
1513+
1514+
bool CoreChecks::PreCallValidateCmdInsertDebugUtilsLabelEXT(VkCommandBuffer commandBuffer, const VkDebugUtilsLabelEXT *pLabelInfo,
1515+
const ErrorObject &error_obj) const {
1516+
auto cb_state = GetRead<vvl::CommandBuffer>(commandBuffer);
1517+
return ValidateCmd(*cb_state, error_obj.location);
1518+
}
1519+
1520+
bool CoreChecks::PreCallValidateCmdEndDebugUtilsLabelEXT(VkCommandBuffer commandBuffer, const ErrorObject &error_obj) const {
1521+
bool skip = false;
1522+
auto cb_state = GetRead<vvl::CommandBuffer>(commandBuffer);
1523+
skip |= ValidateCmd(*cb_state, error_obj.location);
1524+
1525+
if (cb_state->IsPrimary() || enabled_features.nestedCommandBuffer) {
1526+
return skip;
1527+
}
1528+
1529+
if (cb_state->GetLabelStackDepth() < 1) {
1530+
skip |= LogError("VUID-vkCmdEndDebugUtilsLabelEXT-commandBuffer-01913", commandBuffer, error_obj.location,
1531+
"called without a corresponding vkCmdBeginDebugUtilsLabelEXT first");
1532+
}
1533+
return skip;
1534+
}
1535+
15011536
bool CoreChecks::ValidateCmdDrawStrideWithStruct(const vvl::CommandBuffer &cb_state, const std::string &vuid, const uint32_t stride,
15021537
Struct struct_name, const uint32_t struct_size, const Location &loc) const {
15031538
bool skip = false;
@@ -1590,7 +1625,6 @@ bool CoreChecks::PreCallValidateCmdBeginTransformFeedbackEXT(VkCommandBuffer com
15901625
bool skip = false;
15911626
auto cb_state = GetRead<vvl::CommandBuffer>(commandBuffer);
15921627
skip |= ValidateCmd(*cb_state, error_obj.location);
1593-
if (skip) return skip; // basic validation failed, might have null pointers
15941628

15951629
const auto *pipe = cb_state->lastBound[VK_PIPELINE_BIND_POINT_GRAPHICS].pipeline_state;
15961630
if (!pipe && !enabled_features.shaderObject) {
@@ -1678,6 +1712,7 @@ bool CoreChecks::PreCallValidateCmdEndTransformFeedbackEXT(VkCommandBuffer comma
16781712
const ErrorObject &error_obj) const {
16791713
bool skip = false;
16801714
auto cb_state = GetRead<vvl::CommandBuffer>(commandBuffer);
1715+
skip |= ValidateCmd(*cb_state, error_obj.location);
16811716
if (!cb_state->transform_feedback_active) {
16821717
skip |= LogError("VUID-vkCmdEndTransformFeedbackEXT-None-02375", commandBuffer, error_obj.location,
16831718
"transform feedback is not active.");
@@ -1770,7 +1805,9 @@ bool CoreChecks::PreCallValidateCmdBeginConditionalRenderingEXT(
17701805
bool skip = false;
17711806

17721807
auto cb_state = GetRead<vvl::CommandBuffer>(commandBuffer);
1773-
if (cb_state && cb_state->conditional_rendering_active) {
1808+
skip |= ValidateCmd(*cb_state, error_obj.location);
1809+
1810+
if (cb_state->conditional_rendering_active) {
17741811
skip |= LogError("VUID-vkCmdBeginConditionalRenderingEXT-None-01980", commandBuffer, error_obj.location,
17751812
"Conditional rendering is already active.");
17761813
}
@@ -1806,9 +1843,7 @@ bool CoreChecks::PreCallValidateCmdEndConditionalRenderingEXT(VkCommandBuffer co
18061843
bool skip = false;
18071844

18081845
auto cb_state = GetRead<vvl::CommandBuffer>(commandBuffer);
1809-
if (!cb_state) {
1810-
return skip;
1811-
}
1846+
skip |= ValidateCmd(*cb_state, error_obj.location);
18121847

18131848
if (!cb_state->conditional_rendering_active) {
18141849
skip |= LogError("VUID-vkCmdEndConditionalRenderingEXT-None-01985", commandBuffer, error_obj.location,
@@ -1832,9 +1867,8 @@ bool CoreChecks::PreCallValidateCmdEndConditionalRenderingEXT(VkCommandBuffer co
18321867

18331868
bool CoreChecks::PreCallValidateCmdBindShadingRateImageNV(VkCommandBuffer commandBuffer, VkImageView imageView,
18341869
VkImageLayout imageLayout, const ErrorObject &error_obj) const {
1835-
auto cb_state = GetRead<vvl::CommandBuffer>(commandBuffer);
18361870
bool skip = false;
1837-
1871+
auto cb_state = GetRead<vvl::CommandBuffer>(commandBuffer);
18381872
skip |= ValidateCmd(*cb_state, error_obj.location);
18391873

18401874
if (!enabled_features.shadingRateImage) {
@@ -1899,21 +1933,6 @@ bool CoreChecks::PreCallValidateCmdBindShadingRateImageNV(VkCommandBuffer comman
18991933
return skip;
19001934
}
19011935

1902-
bool CoreChecks::PreCallValidateCmdEndDebugUtilsLabelEXT(VkCommandBuffer commandBuffer, const ErrorObject &error_obj) const {
1903-
auto cb_state = GetRead<vvl::CommandBuffer>(commandBuffer);
1904-
bool skip = false;
1905-
1906-
if (cb_state->IsPrimary() || enabled_features.nestedCommandBuffer) {
1907-
return skip;
1908-
}
1909-
1910-
if (cb_state->GetLabelStackDepth() < 1) {
1911-
skip |= LogError("VUID-vkCmdEndDebugUtilsLabelEXT-commandBuffer-01913", commandBuffer, error_obj.location,
1912-
"called without a corresponding vkCmdBeginDebugUtilsLabelEXT first");
1913-
}
1914-
return skip;
1915-
}
1916-
19171936
bool CoreChecks::ValidateVkConvertCooperativeVectorMatrixInfoNV(const LogObjectList &objlist,
19181937
const VkConvertCooperativeVectorMatrixInfoNV &info,
19191938
const Location &info_loc) const {
@@ -1961,6 +1980,8 @@ bool CoreChecks::PreCallValidateCmdConvertCooperativeVectorMatrixNV(VkCommandBuf
19611980
const VkConvertCooperativeVectorMatrixInfoNV *pInfos,
19621981
const ErrorObject &error_obj) const {
19631982
bool skip = false;
1983+
auto cb_state = GetRead<vvl::CommandBuffer>(commandBuffer);
1984+
skip |= ValidateCmd(*cb_state, error_obj.location);
19641985

19651986
for (uint32_t i = 0; i < infoCount; ++i) {
19661987
auto const &info = pInfos[i];

layers/core_checks/cc_cmd_buffer_dynamic.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,6 +1958,8 @@ bool CoreChecks::ValidateDepthBiasRepresentationInfo(const Location& loc, const
19581958
bool CoreChecks::PreCallValidateCmdSetDepthBias2EXT(VkCommandBuffer commandBuffer, const VkDepthBiasInfoEXT* pDepthBiasInfo,
19591959
const ErrorObject& error_obj) const {
19601960
bool skip = false;
1961+
auto cb_state = GetRead<vvl::CommandBuffer>(commandBuffer);
1962+
skip |= ValidateCmd(*cb_state, error_obj.location);
19611963

19621964
if ((pDepthBiasInfo->depthBiasClamp != 0.0) && !enabled_features.depthBiasClamp) {
19631965
skip |= LogError("VUID-VkDepthBiasInfoEXT-depthBiasClamp-08950", commandBuffer,
@@ -2051,6 +2053,19 @@ bool CoreChecks::PreCallValidateCmdSetDiscardRectangleEXT(VkCommandBuffer comman
20512053
return skip;
20522054
}
20532055

2056+
bool CoreChecks::PreCallValidateCmdSetDiscardRectangleEnableEXT(VkCommandBuffer commandBuffer, VkBool32 discardRectangleEnable,
2057+
const ErrorObject& error_obj) const {
2058+
auto cb_state = GetRead<vvl::CommandBuffer>(commandBuffer);
2059+
return ValidateCmd(*cb_state, error_obj.location);
2060+
}
2061+
2062+
bool CoreChecks::PreCallValidateCmdSetDiscardRectangleModeEXT(VkCommandBuffer commandBuffer,
2063+
VkDiscardRectangleModeEXT discardRectangleMode,
2064+
const ErrorObject& error_obj) const {
2065+
auto cb_state = GetRead<vvl::CommandBuffer>(commandBuffer);
2066+
return ValidateCmd(*cb_state, error_obj.location);
2067+
}
2068+
20542069
bool CoreChecks::PreCallValidateCmdSetSampleLocationsEXT(VkCommandBuffer commandBuffer,
20552070
const VkSampleLocationsInfoEXT* pSampleLocationsInfo,
20562071
const ErrorObject& error_obj) const {

layers/core_checks/cc_descriptor.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2232,6 +2232,8 @@ bool CoreChecks::ValidateCmdSetDescriptorBufferOffsets(const vvl::CommandBuffer
22322232
uint32_t firstSet, uint32_t setCount, const uint32_t *pBufferIndices,
22332233
const VkDeviceSize *pOffsets, const Location &loc) const {
22342234
bool skip = false;
2235+
skip |= ValidateCmd(cb_state, loc);
2236+
22352237
auto pipeline_layout = Get<vvl::PipelineLayout>(layout);
22362238
if (!pipeline_layout) return skip; // dynamicPipelineLayout
22372239

@@ -2416,6 +2418,7 @@ bool CoreChecks::PreCallValidateCmdSetDescriptorBufferOffsets2EXT(
24162418
bool CoreChecks::ValidateCmdBindDescriptorBufferEmbeddedSamplers(const vvl::CommandBuffer &cb_state, VkPipelineLayout layout,
24172419
uint32_t set, const Location &loc) const {
24182420
bool skip = false;
2421+
skip |= ValidateCmd(cb_state, loc);
24192422
const bool is_2 = loc.function != Func::vkCmdBindDescriptorBufferEmbeddedSamplersEXT;
24202423

24212424
if (!enabled_features.descriptorBuffer) {
@@ -2486,9 +2489,9 @@ bool CoreChecks::PreCallValidateCmdBindDescriptorBufferEmbeddedSamplers2EXT(
24862489
bool CoreChecks::PreCallValidateCmdBindDescriptorBuffersEXT(VkCommandBuffer commandBuffer, uint32_t bufferCount,
24872490
const VkDescriptorBufferBindingInfoEXT *pBindingInfos,
24882491
const ErrorObject &error_obj) const {
2489-
auto cb_state = GetRead<vvl::CommandBuffer>(commandBuffer);
2490-
24912492
bool skip = false;
2493+
auto cb_state = GetRead<vvl::CommandBuffer>(commandBuffer);
2494+
skip |= ValidateCmd(*cb_state, error_obj.location);
24922495

24932496
// A "descriptor buffer" binding is seperate from a "VkBuffer" so you can have the same address to the same VkBuffer and it will
24942497
// count as 2, not 1, towards the limit. (more info at https://gitlab.khronos.org/vulkan/vulkan/-/issues/4086)
@@ -4668,9 +4671,6 @@ bool CoreChecks::ValidateCmdPushConstants(VkCommandBuffer commandBuffer, VkPipel
46684671

46694672
// Check if pipeline_layout VkPushConstantRange(s) overlapping offset, size have stageFlags set for each stage in the command
46704673
// stageFlags argument, *and* that the command stageFlags argument has bits set for the stageFlags in each overlapping range.
4671-
if (skip) {
4672-
return skip;
4673-
}
46744674
auto layout_state = Get<vvl::PipelineLayout>(layout);
46754675
if (!layout_state) return skip; // dynamicPipelineLayout feature
46764676

0 commit comments

Comments
 (0)