glsl: fix sampler and image type checking in lower_precision

Use the param type, not the referenced variable. The referenced variable
can be a structure, which wouldn't be recognized as a sampler or image.

Fixes: 733bee57eb - glsl: lower samplers with highp coordinates correctly

Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Tested-by: Dieter Nützel Dieter@nuetzel-hh.de on gfx8 (Polaris 20)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34959>
(cherry picked from commit bd5d623674)
This commit is contained in:
Marek Olšák 2025-05-13 12:23:30 -04:00 committed by Eric Engestrom
parent 4a43d723b5
commit 6692869151
2 changed files with 3 additions and 3 deletions

View file

@ -34,7 +34,7 @@
"description": "glsl: fix sampler and image type checking in lower_precision",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "733bee57eb80c92736f3ef1e1267e68ee6cfade6",
"notes": null

View file

@ -423,7 +423,7 @@ handle_call(ir_call *ir, const struct set *lowerable_rvalues)
ir_variable *resource = param->variable_referenced();
assert(ir->callee->return_precision == GLSL_PRECISION_HIGH);
assert(glsl_type_is_image(glsl_without_array(resource->type)));
assert(glsl_type_is_image(param->type));
/* GLSL ES 3.20 requires that images have a precision modifier, but if
* you set one, it doesn't do anything, because all intrinsics are
@ -466,7 +466,7 @@ handle_call(ir_call *ir, const struct set *lowerable_rvalues)
* We should lower the type of the return value if the sampler type
* uses lower precision. The function parameters don't matter.
*/
if (var && glsl_type_is_sampler(glsl_without_array(var->type))) {
if (var && glsl_type_is_sampler(param->type)) {
/* textureGatherOffsets always takes a highp array of constants. As
* per the discussion https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16547#note_1393704
* trying to lower the precision results in segfault later on