From 87940c31939f45f94c7af02c6c280773f917ff25 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Wed, 17 Aug 2022 15:32:03 +1000 Subject: [PATCH] glsl: dont lower precision for textureGatherOffsets MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit textureGatherOffsets always takes a highp array of constants. As per the discussion in [1] trying to lower the precision results in segfault later on in the compiler as textureGatherOffsets will end up being passed a temp when its expecting a constant as required by the spec. [1] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16547#note_1393704 Fixes: b83f4b9fa23d ("glsl: Add an IR lowering pass to convert mediump operations to 16-bit") Acked-by: Mike Blumenkrantz Reviewed-by: Ian Romanick Reviewed-by: Marek Olšák Part-of: --- src/compiler/glsl/lower_precision.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/compiler/glsl/lower_precision.cpp b/src/compiler/glsl/lower_precision.cpp index 680d5a1..2b01b9a 100644 --- a/src/compiler/glsl/lower_precision.cpp +++ b/src/compiler/glsl/lower_precision.cpp @@ -480,6 +480,15 @@ handle_call(ir_call *ir, const struct set *lowerable_rvalues) if (!strcmp(ir->callee_name(), "textureSize")) return GLSL_PRECISION_HIGH; + /* 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 + * in the compiler as textureGatherOffsets will end up being passed + * a temp when its expecting a constant as required by the spec. + */ + if (!strcmp(ir->callee_name(), "textureGatherOffsets")) + return GLSL_PRECISION_HIGH; + return var->data.precision; } } -- 2.7.4