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

Author: Timothy Arceri <tarc...@itsqueeze.com>
Date:   Wed Nov  1 12:43:45 2017 +1100

nir: skip lowering sampler if there is no dereference

This avoids a crash on the output of nir_lower_bitmap().

Reviewed-by: Nicolai Hähnle <nicolai.haeh...@amd.com>

---

 src/compiler/nir/nir_lower_samplers_as_deref.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_lower_samplers_as_deref.c 
b/src/compiler/nir/nir_lower_samplers_as_deref.c
index bdbd8672f4..3e819f7fa7 100644
--- a/src/compiler/nir/nir_lower_samplers_as_deref.c
+++ b/src/compiler/nir/nir_lower_samplers_as_deref.c
@@ -157,8 +157,10 @@ static bool
 lower_sampler(nir_tex_instr *instr, struct lower_samplers_as_deref_state 
*state,
               nir_builder *b)
 {
+   if (!instr->texture)
+      return false;
+
    /* In GLSL, we only fill out the texture field.  The sampler is inferred */
-   assert(instr->texture != NULL);
    assert(instr->sampler == NULL);
 
    b->cursor = nir_before_instr(&instr->instr);

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to