我正在研究一种模块化的方式来指定额外的制服和采样器(例如描述符集)供 Vulkan 着色器(使用泛型等)使用,但我收到多个验证错误,我无法破译它们的含义或 Vulkan 调用/要检查的数据。
我看不到在哪里触发了不匹配或为什么全局描述符需要(无)组件类型。
UNASSIGNED-CoreValidation-Shader-DescriptorTypeMismatch(ERROR / SPEC): msgNum: 0 - Type mismatch on descriptor slot 0.0 (expected `VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT`) but descriptor of type VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
    Objects: 1
        [0] 0, type: 0, name: NULL
UNASSIGNED-CoreValidation-DrawState-DescriptorSetNotUpdated(ERROR / SPEC): msgNum: 0 - Descriptor set 0x52 bound as set #0 encountered the following validation error at vkCmdDrawIndexed() time: Descriptor in binding #0 at global descriptor index 0 requires (none) component type, but bound descriptor format is VK_FORMAT_R8G8B8A8_UNORM.
    Objects: 1
        [0] 0x52, type: 23, name: NULL
...
UNASSIGNED-CoreValidation-DrawState-DescriptorSetNotUpdated(ERROR / SPEC): msgNum: 0 - Descriptor set 0xa4 bound as set #0 encountered the following validation error at vkCmdDrawIndexed() time: Descriptor in binding #0 at global descriptor index 0 requires (none) component type, but bound descriptor format is VK_FORMAT_R8G8B8A8_UNORM.
    Objects: 1
        [0] 0xa4, type: 23, name: NULL
UNASSIGNED-CoreValidation-Shader-DescriptorTypeMismatch(ERROR / SPEC): msgNum: 0 - Type mismatch on descriptor slot 0.0 (expected `VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT`) but descriptor of type VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
您的着色器接口与您当前绑定的描述符中的描述符类型不同,该描述符设置为 set 0,binding 0。
着色器需要某种统一的缓冲区,但您提供的是组合图像采样器。
也许您将顶点着色器与片段着色器混淆了。
UNASSIGNED-CoreValidation-DrawState-DescriptorSetNotUpdated(ERROR / SPEC): msgNum: 0 - Descriptor set 0x52 bound as set #0 encountered the following validation error at vkCmdDrawIndexed() time: Descriptor in binding #0 at global descriptor index 0 requires (none) component type, but bound descriptor format is VK_FORMAT_R8G8B8A8_UNORM.
您要么为需要缓冲区描述符的内容提供具有格式的图像描述符,要么遇到此处描述的已知验证层错误。
在大型代码库中跟踪验证层错误可能有点棘手,因此如果您不确定如何修复它们,我建议您通过RenderDoc运行您的应用程序,检查发生该层错误时的管道状态,或者只是逐步通过验证层本身。使用例如 Visual Studio 的本地监视窗口将帮助您定位触发这些消息的 Vulkan 对象。