glsl: Handle 16-bit types in loop analysis

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>
This commit is contained in:
Alyssa Rosenzweig 2020-07-06 17:56:38 -04:00 committed by Marek Olšák
parent 63ab8d41d1
commit 7f00d4dac8
1 changed files with 9 additions and 0 deletions

View 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;