Skip to content

Commit

Permalink
layers: Check invalid descriptor sets
Browse files Browse the repository at this point in the history
Adds VUIDs:
- 06563
- 06564
  • Loading branch information
ncesario-lunarg committed Apr 8, 2022
1 parent e1113e4 commit 77c90a4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
19 changes: 16 additions & 3 deletions layers/core_validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9224,9 +9224,22 @@ bool CoreChecks::PreCallValidateCmdBindDescriptorSets(VkCommandBuffer commandBuf
"vkCmdBindDescriptorSets(): pDescriptorSets[%" PRIu32 "] was allocated from a pool that was created with VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_VALVE.", set_idx);
}
} else {
skip |= LogError(pDescriptorSets[set_idx], "VUID-vkCmdBindDescriptorSets-pDescriptorSets-parameter",
"vkCmdBindDescriptorSets(): Attempt to bind %s that doesn't exist!",
report_data->FormatHandle(pDescriptorSets[set_idx]).c_str());
if (!IsExtEnabled(device_extensions.vk_ext_graphics_pipeline_library)) {
skip |= LogError(pDescriptorSets[set_idx], "VUID-vkCmdBindDescriptorSets-pDescriptorSets-06563",
"vkCmdBindDescriptorSets(): Attempt to bind pDescriptorSets[%" PRIu32
"] (%s) that does not exist, and %s is not enabled.",
set_idx, report_data->FormatHandle(pDescriptorSets[set_idx]).c_str(),
VK_EXT_GRAPHICS_PIPELINE_LIBRARY_EXTENSION_NAME);
} else {
const auto layout_flags = pipeline_layout->CreateFlags();
if ((layout_flags & VK_PIPELINE_LAYOUT_CREATE_INDEPENDENT_SETS_BIT_EXT) == 0) {
skip |= LogError(pDescriptorSets[set_idx], "VUID-vkCmdBindDescriptorSets-layout-06564",
"vkCmdBindDescriptorSets(): Attempt to bind pDescriptorSets[%" PRIu32
"] (%s) that does not exist, and the layout was not created "
"VK_PIPELINE_LAYOUT_CREATE_INDEPENDENT_SETS_BIT_EXT.",
set_idx, report_data->FormatHandle(pDescriptorSets[set_idx]).c_str());
}
}
}
}
// dynamicOffsetCount must equal the total number of dynamic descriptors in the sets being bound
Expand Down
2 changes: 1 addition & 1 deletion tests/vklayertests_graphics_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ TEST_F(VkGraphicsLibraryLayerTest, InvalidDescriptorSetsGPL) {
m_errorMonitor->VerifyNotFound();

// Now bind with a layout that was _not_ created with independent sets, which should trigger 06564
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-vkCmdBindDescriptorSets-pDescriptorSets-06564");
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-vkCmdBindDescriptorSets-layout-06564");
vk::CmdBindDescriptorSets(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout.handle(), 0,
static_cast<uint32_t>(sets.size()), sets.data(), 0, nullptr);
m_errorMonitor->VerifyFound();
Expand Down

0 comments on commit 77c90a4

Please sign in to comment.