[Vulkan] Set the Vk descriptor type correctly for YCbCr samplers
Per the Vulkan spec, YCbCr samplers must have descriptor type
COMBINED_IMAGE_SAMPLER [1]
[1] https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkSamplerYcbcrConversionInfo.html
Change-Id: Ib09a498acca2afe682cadcab1eab5f34e9ae5c93
Bug: 41488897
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/196337
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
diff --git a/src/dawn/native/vulkan/BindGroupLayoutVk.cpp b/src/dawn/native/vulkan/BindGroupLayoutVk.cpp
index a9f5363..16f7341 100644
--- a/src/dawn/native/vulkan/BindGroupLayoutVk.cpp
+++ b/src/dawn/native/vulkan/BindGroupLayoutVk.cpp
@@ -86,7 +86,13 @@
}
},
[](const SamplerBindingInfo&) { return VK_DESCRIPTOR_TYPE_SAMPLER; },
- [](const StaticSamplerBindingInfo&) { return VK_DESCRIPTOR_TYPE_SAMPLER; },
+ [](const StaticSamplerBindingInfo& layout) {
+ // By the Vulkan spec, YCbCr samplers must have descriptor type
+ // COMBINED_IMAGE_SAMPLER:
+ // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkSamplerYcbcrConversionInfo.html
+ return (layout.sampler->IsYCbCr()) ? VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
+ : VK_DESCRIPTOR_TYPE_SAMPLER;
+ },
[](const TextureBindingInfo&) { return VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; },
[](const StorageTextureBindingInfo&) { return VK_DESCRIPTOR_TYPE_STORAGE_IMAGE; },
[](const InputAttachmentBindingInfo&) { return VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT; });