[Mesa-dev] [PATCH] gallivm: exit emit_fetch_constat() when no constants
Roland Scheidegger
sroland at vmware.com
Mon Nov 2 11:29:16 PST 2015
Am 02.11.2015 um 15:56 schrieb Oded Gabbay:
> 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 =
>
I'm not convinced that's the right solution. Clearly, a shader trying to
fetch a constant but without a const dcl is invalid.
Not sure what's the problem with the debug stuff actually. Some quick
look seems to say this should work, since it will output only up from 0
to file_max, and some other quick look at tgsi_scan_shader says this
should be initialized to -1, thus it should never try to output anything
for the const file. Might be worth trying to figure out why that's not
the case.
Roland
More information about the mesa-dev
mailing list