[Mesa-dev] [PATCH 14/15] anv: ignore VkSamplerYcbcrConversion on non-yuv formats

Lionel Landwerlin lionel.g.landwerlin at intel.com
Tue Dec 11 14:32:20 UTC 2018


On 27/11/2018 10:53, Tapani Pälli wrote:
> 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.
>
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> ---
>   src/intel/vulkan/genX_state.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/intel/vulkan/genX_state.c b/src/intel/vulkan/genX_state.c
> index 42800a2581e..9b579d3118c 100644
> --- a/src/intel/vulkan/genX_state.c
> +++ b/src/intel/vulkan/genX_state.c
> @@ -337,8 +337,11 @@ VkResult genX(CreateSampler)(


I would just edit the following condition :

if (conversion == NULL || !conversion->format->can_ycbcr)
     break;

If you add the paragraph from the commit message in this code path too, 
that would remind our future selves about this detail :)

Thanks and with that changed :

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>


>            if (conversion == NULL)
>               break;
>   
> -         sampler->n_planes = conversion->format->n_planes;
> -         sampler->conversion = conversion;
> +         /* Setup conversion only if format is YUV format. */
> +         if (conversion && conversion->format->can_ycbcr) {
> +            sampler->n_planes = conversion->format->n_planes;
> +            sampler->conversion = conversion;
> +         }
>            break;
>         }
>   #if GEN_GEN >= 9




More information about the mesa-dev mailing list