diff options
author | Marek Olšák <[email protected]> | 2020-06-26 07:19:46 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2020-07-07 22:02:06 -0400 |
commit | 69f7a3dac69bc91464e5cba3ebf859777fa5f742 (patch) | |
tree | dfc6c8b2ac5af0921006fa7b9489d05bbc6bebe1 | |
parent | 977b84652a1f5785d08e65723d676a94020f6ff6 (diff) |
glsl: don't lower precision of textureSize
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5746>
-rw-r--r-- | src/compiler/glsl/lower_precision.cpp | 4 | ||||
-rw-r--r-- | src/compiler/glsl/tests/lower_precision_test.py | 15 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/compiler/glsl/lower_precision.cpp b/src/compiler/glsl/lower_precision.cpp index b2d8330a44d..2529a35b4dd 100644 --- a/src/compiler/glsl/lower_precision.cpp +++ b/src/compiler/glsl/lower_precision.cpp @@ -457,6 +457,10 @@ is_lowerable_builtin(ir_call *ir, * uses lower precision. The function parameters don't matter. */ if (var && var->type->without_array()->is_sampler()) { + /* textureSize always returns highp. */ + if (!strcmp(ir->callee_name(), "textureSize")) + return false; + return var->data.precision == GLSL_PRECISION_MEDIUM || var->data.precision == GLSL_PRECISION_LOW; } diff --git a/src/compiler/glsl/tests/lower_precision_test.py b/src/compiler/glsl/tests/lower_precision_test.py index 65f3e25b0d7..9651a066ed6 100644 --- a/src/compiler/glsl/tests/lower_precision_test.py +++ b/src/compiler/glsl/tests/lower_precision_test.py @@ -1161,6 +1161,21 @@ TESTS = [ } """, r'\(expression +f16vec4 +dFdy +\(expression +f16vec4'), + Test("textureSize", + """ + #version 310 es + precision mediump float; + precision mediump int; + + uniform mediump sampler2D tex; + out ivec2 color; + + void main() + { + color = textureSize(tex, 0) * ivec2(2); + } + """, + r'expression ivec2 \* \(txs ivec2 \(var_ref tex'), ] |