gallivm: avoid the use of an uninitialized value

When need_derivs is false, lp_build_cube_lookup does not set the value of
derivs_out which means that the stack is not initialized but its pointer
is then used.

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18635>
This commit is contained in:
Corentin Noël
2022-09-16 16:28:47 +02:00
committed by Marge Bot
parent 3ed712f748
commit 5537f778a0
@@ -2559,7 +2559,9 @@ lp_build_sample_common(struct lp_build_sample_context *bld,
!bld->static_sampler_state->min_max_lod_equal &&
!explicit_lod);
lp_build_cube_lookup(bld, coords, derivs, &cube_rho, &cube_derivs, need_derivs);
derivs = &cube_derivs;
if (need_derivs)
derivs = &cube_derivs;
if (target == PIPE_TEXTURE_CUBE_ARRAY && !is_lodq) {
/* calculate cube layer coord now */
LLVMValueRef layer = lp_build_iround(&bld->coord_bld, coords[3]);