anv/lower_ycbcr: make sure to set 0s on all components
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Fri, 26 Oct 2018 14:02:06 +0000 (15:02 +0100)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Tue, 13 Nov 2018 18:56:21 +0000 (18:56 +0000)
To play around with debugging, we might want to disable one or the
other component. Having 0s as default values makes this work.
Otherwise we might have NULL components, leading to crashes.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/vulkan/anv_nir_lower_ycbcr_textures.c

index 3962356708b56f93a157148e74d345b59dd7b6d0..97cfe9454299dba61c738759d9cc601e0e05fa13 100644 (file)
@@ -373,11 +373,11 @@ try_lower_tex_ycbcr(struct anv_pipeline_layout *layout,
    uint8_t y_bpc = y_isl_layout->channels_array[0].bits;
 
    /* |ycbcr_comp| holds components in the order : Cr-Y-Cb */
-   nir_ssa_def *ycbcr_comp[5] = { NULL, NULL, NULL,
-                                  /* Use extra 2 channels for following swizzle */
-                                  nir_imm_float(builder, 1.0f),
-                                  nir_imm_float(builder, 0.0f),
-   };
+   nir_ssa_def *zero = nir_imm_float(builder, 0.0f);
+   nir_ssa_def *one = nir_imm_float(builder, 1.0f);
+   /* Use extra 2 channels for following swizzle */
+   nir_ssa_def *ycbcr_comp[5] = { zero, zero, zero, one, zero };
+
    uint8_t ycbcr_bpcs[5];
    memset(ycbcr_bpcs, y_bpc, sizeof(ycbcr_bpcs));