summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/genX_state.c
diff options
context:
space:
mode:
authorTapani Pälli <[email protected]>2018-09-27 11:02:59 +0300
committerTapani Pälli <[email protected]>2018-12-19 09:38:41 +0200
commit3dc424a4f4a7d3dd91cd925359ead9efa9fd28ba (patch)
treee0beefc227802a96f1c3a062e24bc361c2a56932 /src/intel/vulkan/genX_state.c
parenta7b7772cfba5856784357e2207fc5b9bedc26714 (diff)
anv: ignore VkSamplerYcbcrConversion on non-yuv formats
This fulfills a requirement for clients that want to utilize same code path for images with external formats (VK_FORMAT_UNDEFINED) and "regular" RGBA images where format is known. This is similar to how OES_EGL_image_external works. To support this, we allow color conversion samplers for non-YUV formats but skip setting up conversion when format does not have can_ycbcr flag set. v2: add comment and bundle can_ycbcr to the existing break condition (Lionel) Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel/vulkan/genX_state.c')
-rw-r--r--src/intel/vulkan/genX_state.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/intel/vulkan/genX_state.c b/src/intel/vulkan/genX_state.c
index 0f6b77492fb..cffd1e47247 100644
--- a/src/intel/vulkan/genX_state.c
+++ b/src/intel/vulkan/genX_state.c
@@ -332,7 +332,12 @@ VkResult genX(CreateSampler)(
ANV_FROM_HANDLE(anv_ycbcr_conversion, conversion,
pSamplerConversion->conversion);
- if (conversion == NULL)
+ /* Ignore conversion for non-YUV formats. This fulfills a requirement
+ * for clients that want to utilize same code path for images with
+ * external formats (VK_FORMAT_UNDEFINED) and "regular" RGBA images
+ * where format is known.
+ */
+ if (conversion == NULL || !conversion->format->can_ycbcr)
break;
sampler->n_planes = conversion->format->n_planes;