glsl: Handle 16-bit types in loop analysis
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 6 Jul 2020 21:56:38 +0000 (17:56 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 8 Jul 2020 02:02:06 +0000 (22:02 -0400)
Fixes crash with mediump lowering in:

dEQP-GLES2.functional.shaders.loops.do_while_constant_iterations.basic_mediump_float_fragment

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5746>

src/compiler/glsl/loop_analysis.cpp

index 9429e69c2a7fe4c7176bf60164bcb7e311336425..6f0b3287a5b17599eef2937842b4998516a2e14f 100644 (file)
@@ -161,12 +161,21 @@ calculate_iterations(ir_rvalue *from, ir_rvalue *to, ir_rvalue *increment,
       case GLSL_TYPE_INT:
          iter = new(mem_ctx) ir_constant(iter_value + bias[i]);
          break;
+      case GLSL_TYPE_INT16:
+         iter = new(mem_ctx) ir_constant(uint16_t(iter_value + bias[i]));
+         break;
       case GLSL_TYPE_UINT:
          iter = new(mem_ctx) ir_constant(unsigned(iter_value + bias[i]));
          break;
+      case GLSL_TYPE_UINT16:
+         iter = new(mem_ctx) ir_constant(uint16_t(iter_value + bias[i]));
+         break;
       case GLSL_TYPE_FLOAT:
          iter = new(mem_ctx) ir_constant(float(iter_value + bias[i]));
          break;
+      case GLSL_TYPE_FLOAT16:
+         iter = new(mem_ctx) ir_constant(float16_t(float(iter_value + bias[i])));
+         break;
       case GLSL_TYPE_DOUBLE:
          iter = new(mem_ctx) ir_constant(double(iter_value + bias[i]));
          break;