<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, Nov 5, 2018 at 9:36 AM Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com">lionel.g.landwerlin@intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">To play around with debugging, we might want to disable one or the<br>
other component. Having 0s as default values makes this work.<br>
Otherwise we might have NULL components, leading to crashes.<br>
<br>
Signed-off-by: Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a>><br>
---<br>
 src/intel/vulkan/anv_nir_lower_ycbcr_textures.c | 4 +++-<br>
 1 file changed, 3 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_nir_lower_ycbcr_textures.c b/src/intel/vulkan/anv_nir_lower_ycbcr_textures.c<br>
index 71e511f34b7..29e5de481bb 100644<br>
--- a/src/intel/vulkan/anv_nir_lower_ycbcr_textures.c<br>
+++ b/src/intel/vulkan/anv_nir_lower_ycbcr_textures.c<br>
@@ -373,7 +373,9 @@ try_lower_tex_ycbcr(struct anv_pipeline_layout *layout,<br>
    uint8_t y_bpc = y_isl_layout->channels_array[0].bits;<br>
<br>
    /* |ycbcr_comp| holds components in the order : Cr-Y-Cb */<br>
-   nir_ssa_def *ycbcr_comp[5] = { NULL, NULL, NULL,<br>
+   nir_ssa_def *ycbcr_comp[5] = { nir_imm_float(builder, 0.0f),<br>
+                                  nir_imm_float(builder, 0.0f),<br>
+                                  nir_imm_float(builder, 0.0f),<br></blockquote><div><br></div><div>If we wanted to avoid emitting extra instructions, we could do</div><div><br></div><div>nir_ssa_def *zero = nir_imm_float(builder, 0.0f);</div><div>nir_ssa_def *one = nir_imm_float(builder, 1.0f);</div><div>nir_ssa_def *ycbcr_comp[5] = { zero, zero, zero, one, zero };</div><div><br></div><div>It would also save a couple of lines. :)</div><div><br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                                   /* Use extra 2 channels for following swizzle */<br>
                                   nir_imm_float(builder, 1.0f),<br>
                                   nir_imm_float(builder, 0.0f),<br>
-- <br>
2.19.1<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div></div>