gallivm/sample: fix sampling indirect from vertex shaders

When doing indirect sampling, we just fetch one value per lane,
but type.length == 1 caused num_quads to be 0 which caused things
to crash.

Fixes dEQP-GLES31.functional.shaders.opaque_type_indexing.sampler.uniform.vertex.sampler2d

Cc: mesa-stable
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Roland Scheidegger <roland.scheidegger@broadcom.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30358>
This commit is contained in:
Dave Airlie
2024-07-25 07:53:53 +10:00
committed by Marge Bot
parent 97aa3464b9
commit 3e01422a16

View File

@@ -3468,7 +3468,7 @@ lp_build_sample_soa_code(struct gallivm_state *gallivm,
const enum pipe_texture_target target = static_texture_state->target;
const unsigned dims = texture_dims(target);
const unsigned num_quads = type.length / 4;
const unsigned num_quads = type.length == 1 ? 1 : type.length / 4;
struct lp_build_sample_context bld;
struct lp_static_sampler_state derived_sampler_state = *static_sampler_state;
LLVMTypeRef i32t = LLVMInt32TypeInContext(gallivm->context);