[Mesa-dev] [PATCH] gallivm: exit emit_fetch_constat() when no constants

Oded Gabbay oded.gabbay at gmail.com
Mon Nov 2 06:56:24 PST 2015


If we don't have any constants, just exit emit_fetch_constat() and don't
call LLVM functions.

This also prevents a crash that happens when we emit the prologue of the
fragment shader when DEBUG_EXECUTION is set to 1 and we don't have
constants (e.g. arb_blend_func_extended-fbo-extended-blend test in
piglit).

Signed-off-by: Oded Gabbay <oded.gabbay at gmail.com>
---
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index fae604e..189d5da 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -1238,6 +1238,9 @@ emit_fetch_constant(
    consts_ptr = bld->consts[dimension];
    num_consts = bld->consts_sizes[dimension];
 
+   if (!consts_ptr)
+       return NULL;
+
    if (reg->Register.Indirect) {
       LLVMValueRef indirect_index;
       LLVMValueRef swizzle_vec =
-- 
2.4.3



More information about the mesa-dev mailing list