Skip to content

Commit b105d8e

Browse files
layers: Improve 11315 error message
1 parent 1c76007 commit b105d8e

1 file changed

Lines changed: 21 additions & 6 deletions

File tree

layers/core_checks/cc_spirv.cpp

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3363,15 +3363,30 @@ bool CoreChecks::ValidateShaderDescriptorSetAndBindingMappingInfo(const spirv::M
33633363
const char* vuid =
33643364
pipeline ? "VUID-VkPipelineShaderStageCreateInfo-pNext-11315" : "VUID-VkShaderCreateInfoEXT-pNext-11315";
33653365
const bool is_uniform = resource_variable.storage_class == spv::StorageClassUniform;
3366+
const VkDescriptorType potential_descriptor_type = resource_variable.GetPotentialDescriptorType();
3367+
std::ostringstream ss;
3368+
ss << "(" << string_VkDescriptorMappingSourceEXT(mapping.source) << ") is used to map descriptor "
3369+
<< resource_variable.DescribeDescriptor() << " in " << entrypoint.Describe() << " with StorageClass "
3370+
<< string_SpvStorageClass(resource_variable.storage_class);
3371+
// Prevent more confusion with the cases
3372+
if (potential_descriptor_type != VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER && !resource_variable.is_buffer_block) {
3373+
ss << " (likely " << string_VkDescriptorType(potential_descriptor_type) << ")";
3374+
}
3375+
if (is_uniform) {
3376+
if (resource_variable.is_buffer_block) {
3377+
ss << ", but it is decorated with BufferBlock (which is the Vulkan 1.0 way to turn the Uniform "
3378+
"StorageClass into a Storage Buffer)";
3379+
} else {
3380+
ss << ", but it is not decorated with Block";
3381+
}
3382+
} else {
3383+
ss << ", but it must be StorageClass Uniform (Uniform Buffers) when using this mapping source.\nHint: Did "
3384+
"you mean to use VK_DESCRIPTOR_MAPPING_SOURCE_HEAP_WITH_PUSH_INDEX_EXT instead?";
3385+
}
33663386
skip |= LogError(
33673387
vuid, module_state.handle(),
33683388
loc.pNext(Struct::VkShaderDescriptorSetAndBindingMappingInfoEXT, Field::pMappings, i).dot(Field::source),
3369-
"(%s) is used to map descriptor %s in %s with storage class %s, but it %s",
3370-
string_VkDescriptorMappingSourceEXT(mapping.source), resource_variable.DescribeDescriptor().c_str(),
3371-
entrypoint.Describe().c_str(), string_SpvStorageClass(resource_variable.storage_class),
3372-
!is_uniform ? "must be StorageClass Uniform (Uniform Buffers)\nHint: Did you mean to use "
3373-
"VK_DESCRIPTOR_MAPPING_SOURCE_HEAP_WITH_PUSH_INDEX_EXT instead?"
3374-
: "is not decorated with Block");
3389+
"%s", ss.str().c_str());
33753390
} else if (resource_variable.storage_class == spv::StorageClassUniform && resource_variable.IsArray()) {
33763391
// Additional VU because we currently mark array of Block Structs the same in |resource_variable|
33773392
const char* vuid =

0 commit comments

Comments
 (0)