Mesa (master): nir: Make sure to set the texsrc type in nir drawpixels/ bitmap lowering.

Eric Anholt anholt at kemper.freedesktop.org
Fri Nov 4 01:43:18 UTC 2016


Module: Mesa
Branch: master
Commit: 49936364e4c48e318b1ef3f09785b0e669a0c11b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=49936364e4c48e318b1ef3f09785b0e669a0c11b

Author: Eric Anholt <eric at anholt.net>
Date:   Thu Nov  3 16:28:49 2016 -0700

nir: Make sure to set the texsrc type in nir drawpixels/bitmap lowering.

We were leaving an undefined value since the ralloc zeroing changes.
Fixes nir_validate() failures on vc4.

v2: Fix the color-index case of drawpixels as well.

Reviewed-by: Rob Clark <robdclark at gmail.com> (v1)

---

 src/compiler/nir/nir_lower_bitmap.c     | 1 +
 src/compiler/nir/nir_lower_drawpixels.c | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/src/compiler/nir/nir_lower_bitmap.c b/src/compiler/nir/nir_lower_bitmap.c
index fefe53c..f08fb9b 100644
--- a/src/compiler/nir/nir_lower_bitmap.c
+++ b/src/compiler/nir/nir_lower_bitmap.c
@@ -95,6 +95,7 @@ lower_bitmap(nir_shader *shader, nir_builder *b,
    tex->sampler_index = options->sampler;
    tex->texture_index = options->sampler;
    tex->dest_type = nir_type_float;
+   tex->src[0].src_type = nir_tex_src_coord;
    tex->src[0].src = nir_src_for_ssa(texcoord);
 
    nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32, NULL);
diff --git a/src/compiler/nir/nir_lower_drawpixels.c b/src/compiler/nir/nir_lower_drawpixels.c
index 54f3ea0..51c52d0 100644
--- a/src/compiler/nir/nir_lower_drawpixels.c
+++ b/src/compiler/nir/nir_lower_drawpixels.c
@@ -134,6 +134,7 @@ lower_color(lower_drawpixels_state *state, nir_intrinsic_instr *intr)
    tex->sampler_index = state->options->drawpix_sampler;
    tex->texture_index = state->options->drawpix_sampler;
    tex->dest_type = nir_type_float;
+   tex->src[0].src_type = nir_tex_src_coord;
    tex->src[0].src = nir_src_for_ssa(texcoord);
 
    nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32, NULL);
@@ -161,6 +162,7 @@ lower_color(lower_drawpixels_state *state, nir_intrinsic_instr *intr)
       tex->sampler_index = state->options->pixelmap_sampler;
       tex->texture_index = state->options->pixelmap_sampler;
       tex->dest_type = nir_type_float;
+      tex->src[0].src_type = nir_tex_src_coord;
       tex->src[0].src = nir_src_for_ssa(nir_swizzle(b, def, swiz_xy, 2, true));
 
       nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32, NULL);
@@ -174,6 +176,7 @@ lower_color(lower_drawpixels_state *state, nir_intrinsic_instr *intr)
       tex->coord_components = 2;
       tex->sampler_index = state->options->pixelmap_sampler;
       tex->dest_type = nir_type_float;
+      tex->src[0].src_type = nir_tex_src_coord;
       tex->src[0].src = nir_src_for_ssa(nir_swizzle(b, def, swiz_zw, 2, true));
 
       nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32, NULL);




More information about the mesa-commit mailing list