glsl: handle int16 and uint16 types and add instructions for mediump

v2: add more changes to ir_validate.cpp

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5002>
This commit is contained in:
Marek Olšák
2020-05-08 22:16:42 -04:00
committed by Marge Bot
parent 9c14a87839
commit a052a9c277
12 changed files with 445 additions and 73 deletions

View File

@@ -305,6 +305,14 @@ nir_visitor::constant_copy(ir_constant *ir, void *mem_ctx)
break;
case GLSL_TYPE_UINT16:
/* Only float base types can be matrices. */
assert(cols == 1);
for (unsigned r = 0; r < rows; r++)
ret->values[r].u16 = ir->value.u16[r];
break;
case GLSL_TYPE_INT:
/* Only float base types can be matrices. */
assert(cols == 1);
@@ -314,6 +322,14 @@ nir_visitor::constant_copy(ir_constant *ir, void *mem_ctx)
break;
case GLSL_TYPE_INT16:
/* Only float base types can be matrices. */
assert(cols == 1);
for (unsigned r = 0; r < rows; r++)
ret->values[r].i16 = ir->value.i16[r];
break;
case GLSL_TYPE_FLOAT:
case GLSL_TYPE_FLOAT16:
case GLSL_TYPE_DOUBLE:
@@ -1911,6 +1927,8 @@ nir_visitor::visit(ir_expression *ir)
case ir_unop_f2f16:
case ir_unop_f162b:
case ir_unop_b2f16:
case ir_unop_i2i:
case ir_unop_u2u:
case ir_unop_d2i:
case ir_unop_d2u:
case ir_unop_d2b:
@@ -1954,6 +1972,16 @@ nir_visitor::visit(ir_expression *ir)
break;
}
case ir_unop_i2imp: {
result = nir_build_alu(&b, nir_op_i2imp, srcs[0], NULL, NULL, NULL);
break;
}
case ir_unop_u2ump: {
result = nir_build_alu(&b, nir_op_u2ump, srcs[0], NULL, NULL, NULL);
break;
}
case ir_unop_bitcast_i2f:
case ir_unop_bitcast_f2i:
case ir_unop_bitcast_u2f:
@@ -2390,6 +2418,12 @@ nir_visitor::visit(ir_texture *ir)
case GLSL_TYPE_FLOAT16:
instr->dest_type = nir_type_float16;
break;
case GLSL_TYPE_INT16:
instr->dest_type = nir_type_int16;
break;
case GLSL_TYPE_UINT16:
instr->dest_type = nir_type_uint16;
break;
case GLSL_TYPE_INT:
instr->dest_type = nir_type_int;
break;