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>
(cherry picked from commit 3e01422a16)
This commit is contained in:
Dave Airlie 2024-07-25 07:53:53 +10:00 committed by Eric Engestrom
parent d4c3867cc2
commit 664041f204
2 changed files with 2 additions and 2 deletions

View file

@ -1234,7 +1234,7 @@
"description": "gallivm/sample: fix sampling indirect from vertex shaders",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -3379,7 +3379,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);