Mesa (master): glsl: tolerate int16 loop counters

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Apr 10 09:21:08 UTC 2021


Module: Mesa
Branch: master
Commit: a161cccd9b918899812fad12263de072a3d993f0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a161cccd9b918899812fad12263de072a3d993f0

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Fri Apr  9 07:25:03 2021 +0200

glsl: tolerate int16 loop counters

When lowering precision on integers from GLSL ES, we can end up with
16 bit integer loop counters. So let's tolerate this as well.

This was probably not caught earlier because most NIR drivers disable
GLSL-level loop-unrolling, and no non-NIR driver sets LowerPrecisionInt16
to true. This was discovered while trying to wire up int16 support for
Zink, which doesn't currently disable GLSL loop-unrolling.

Reviewed-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10125>

---

 src/compiler/glsl/loop_analysis.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/glsl/loop_analysis.cpp b/src/compiler/glsl/loop_analysis.cpp
index 3273f2ba704..37cc2ae4e1a 100644
--- a/src/compiler/glsl/loop_analysis.cpp
+++ b/src/compiler/glsl/loop_analysis.cpp
@@ -107,7 +107,7 @@ calculate_iterations(ir_rvalue *from, ir_rvalue *to, ir_rvalue *increment,
       return -1;
    }
 
-   if (!iter->type->is_integer_32() && !iter->type->is_integer_64()) {
+   if (!iter->type->is_integer()) {
       const ir_expression_operation op = iter->type->is_double()
          ? ir_unop_d2i : ir_unop_f2i;
       ir_rvalue *cast =



More information about the mesa-commit mailing list