nir: convert_ycbcr: preserve alpha channel
authorJonathan Marek <jonathan@marek.ca>
Fri, 10 Apr 2020 12:37:48 +0000 (08:37 -0400)
committerMarge Bot <eric+marge@anholt.net>
Mon, 20 Apr 2020 22:01:43 +0000 (22:01 +0000)
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: D Scott Phillips <d.scott.phillips@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4528>

src/compiler/nir/nir_convert_ycbcr.c

index fdd6cf1597d2335cfd252a2a29ac55a368a5578d..2a111699fdbaf33c54ebd2e6ef2bdad6f3216077 100644 (file)
@@ -122,7 +122,7 @@ nir_convert_ycbcr_to_rgb(nir_builder *b,
                chroma_range(b, nir_channel(b, raw_channels, 0), bpcs[0], range),
                y_range(b, nir_channel(b, raw_channels, 1), bpcs[1], range),
                chroma_range(b, nir_channel(b, raw_channels, 2), bpcs[2], range),
-               nir_imm_float(b, 1.0f));
+               nir_channel(b, raw_channels, 3));
 
    if (model == VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY)
       return expanded_channels;
@@ -138,5 +138,5 @@ nir_convert_ycbcr_to_rgb(nir_builder *b,
 
    return nir_vec4(b,
                    converted_channels[0], converted_channels[1],
-                   converted_channels[2], nir_imm_float(b, 1.0f));
+                   converted_channels[2], nir_channel(b, raw_channels, 3));
 }