[Vulkan] Have YCbCrVkDescriptor::vkChromaFilter be FilterMode
Skia will need to query the value of Dawn's
YCbCrVkDescriptor::vkChromaFilter to determine whether linear
filtering is supported. Currently this field is a uint32_t that is set
to the raw Vulkan values of the VkFilter enum, meaning that Skia would
need to query against that enum :\. This CL changes vkChromaFilter to
be a wgpu::FilterMode instead.
Change-Id: I63bbb67d2dbc95da5f3410373fe27440372f6234
Bug: dawn:2476
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/188760
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
diff --git a/docs/dawn/features/y_cb_cr_vulkan_samplers.md b/docs/dawn/features/y_cb_cr_vulkan_samplers.md
index 6234d5c..cb7e6e2 100644
--- a/docs/dawn/features/y_cb_cr_vulkan_samplers.md
+++ b/docs/dawn/features/y_cb_cr_vulkan_samplers.md
@@ -9,9 +9,9 @@
corresponding buffer format properties on the underlying AHardwareBuffer. The
two exceptions are as follows:
-* `vkChromaFilter`: Will be set to VK_FILTER_LINEAR iff
+* `vkChromaFilter`: Will be set to FilterMode::Linear iff
`VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT` is
- present in the AHB format features and VK_FILTER_NEAREST otherwise
+ present in the AHB format features and FilterMode::Nearest otherwise
* `forceExplicitReconstruction`: will be set to true iff
`VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT`
is present in the AHB format features
diff --git a/src/dawn/dawn.json b/src/dawn/dawn.json
index 4833529..6c5b3f9 100644
--- a/src/dawn/dawn.json
+++ b/src/dawn/dawn.json
@@ -4161,7 +4161,7 @@
{"name": "vk component swizzle alpha", "type": "uint32_t", "default": "0"},
{"name": "vk x chroma offset", "type": "uint32_t", "default": "0"},
{"name": "vk y chroma offset", "type": "uint32_t", "default": "0"},
- {"name": "vk chroma filter", "type": "uint32_t", "default": "0"},
+ {"name": "vk chroma filter", "type": "filter mode", "default": "nearest"},
{"name": "force explicit reconstruction", "type": "bool", "default": "false"},
{"name": "external format", "type": "uint64_t", "default": "0"}
]
diff --git a/src/dawn/native/vulkan/SharedTextureMemoryVk.cpp b/src/dawn/native/vulkan/SharedTextureMemoryVk.cpp
index 5a592c0..66b8ef8 100644
--- a/src/dawn/native/vulkan/SharedTextureMemoryVk.cpp
+++ b/src/dawn/native/vulkan/SharedTextureMemoryVk.cpp
@@ -549,8 +549,8 @@
uint32_t formatFeatures = bufferFormatProperties.formatFeatures;
yCbCrAHBInfo.vkChromaFilter =
(formatFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT)
- ? VK_FILTER_LINEAR
- : VK_FILTER_NEAREST;
+ ? wgpu::FilterMode::Linear
+ : wgpu::FilterMode::Nearest;
yCbCrAHBInfo.forceExplicitReconstruction =
formatFeatures &
VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT;
diff --git a/src/dawn/tests/white_box/SharedTextureMemoryTests_android.cpp b/src/dawn/tests/white_box/SharedTextureMemoryTests_android.cpp
index 3a122e0..72f4d11 100644
--- a/src/dawn/tests/white_box/SharedTextureMemoryTests_android.cpp
+++ b/src/dawn/tests/white_box/SharedTextureMemoryTests_android.cpp
@@ -408,10 +408,10 @@
EXPECT_EQ(bufferFormatProperties.suggestedXChromaOffset, yCbCrInfo.vkXChromaOffset);
EXPECT_EQ(bufferFormatProperties.suggestedYChromaOffset, yCbCrInfo.vkYChromaOffset);
- uint32_t expectedFilter =
+ wgpu::FilterMode expectedFilter =
(formatFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT)
- ? VK_FILTER_LINEAR
- : VK_FILTER_NEAREST;
+ ? wgpu::FilterMode::Linear
+ : wgpu::FilterMode::Nearest;
EXPECT_EQ(expectedFilter, yCbCrInfo.vkChromaFilter);
EXPECT_EQ(
formatFeatures &