aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/ir_validate.cpp
diff options
context:
space:
mode:
authorNeil Roberts <[email protected]>2019-05-16 17:01:06 +0200
committerMarge Bot <[email protected]>2020-03-09 16:31:08 +0000
commit2b39bb4fc05638c6c250e9b79c5c8dcf7361229c (patch)
tree5291ea3864a71064225ff78cee376489a6dd5d2e /src/compiler/glsl/ir_validate.cpp
parent198d4a535b9f090f05137d335d3676f3cae1fc1f (diff)
glsl/validate: Allow float16 in the expression tree
v2. [Hyunjun Ko ([email protected])] squashed 3 commits into one commit. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3929>
Diffstat (limited to 'src/compiler/glsl/ir_validate.cpp')
-rw-r--r--src/compiler/glsl/ir_validate.cpp45
1 files changed, 18 insertions, 27 deletions
diff --git a/src/compiler/glsl/ir_validate.cpp b/src/compiler/glsl/ir_validate.cpp
index 4c4948c30ca..0024fd764d1 100644
--- a/src/compiler/glsl/ir_validate.cpp
+++ b/src/compiler/glsl/ir_validate.cpp
@@ -260,8 +260,7 @@ ir_validate::visit_leave(ir_expression *ir)
case ir_unop_abs:
case ir_unop_sign:
assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT ||
- ir->operands[0]->type->is_float() ||
- ir->operands[0]->type->is_double() ||
+ ir->operands[0]->type->is_float_16_32_64() ||
ir->operands[0]->type->base_type == GLSL_TYPE_INT64);
assert(ir->type == ir->operands[0]->type);
break;
@@ -269,8 +268,7 @@ ir_validate::visit_leave(ir_expression *ir)
case ir_unop_rcp:
case ir_unop_rsq:
case ir_unop_sqrt:
- assert(ir->type->is_float() ||
- ir->type->is_double());
+ assert(ir->type->is_float_16_32_64());
assert(ir->type == ir->operands[0]->type);
break;
@@ -279,7 +277,7 @@ ir_validate::visit_leave(ir_expression *ir)
case ir_unop_exp2:
case ir_unop_log2:
case ir_unop_saturate:
- assert(ir->operands[0]->type->is_float());
+ assert(ir->operands[0]->type->is_float_16_32());
assert(ir->type == ir->operands[0]->type);
break;
@@ -450,8 +448,7 @@ ir_validate::visit_leave(ir_expression *ir)
case ir_unop_ceil:
case ir_unop_floor:
case ir_unop_fract:
- assert(ir->operands[0]->type->is_float() ||
- ir->operands[0]->type->is_double());
+ assert(ir->operands[0]->type->is_float_16_32_64());
assert(ir->operands[0]->type == ir->type);
break;
case ir_unop_sin:
@@ -462,7 +459,7 @@ ir_validate::visit_leave(ir_expression *ir)
case ir_unop_dFdy:
case ir_unop_dFdy_coarse:
case ir_unop_dFdy_fine:
- assert(ir->operands[0]->type->is_float());
+ assert(ir->operands[0]->type->is_float_16_32());
assert(ir->operands[0]->type == ir->type);
break;
@@ -566,7 +563,7 @@ ir_validate::visit_leave(ir_expression *ir)
case ir_unop_interpolate_at_centroid:
assert(ir->operands[0]->type == ir->type);
- assert(ir->operands[0]->type->is_float());
+ assert(ir->operands[0]->type->is_float_16_32());
break;
case ir_unop_get_buffer_size:
@@ -619,13 +616,11 @@ ir_validate::visit_leave(ir_expression *ir)
break;
case ir_unop_frexp_sig:
- assert(ir->operands[0]->type->is_float() ||
- ir->operands[0]->type->is_double());
+ assert(ir->operands[0]->type->is_float_16_32_64());
assert(ir->type->is_double());
break;
case ir_unop_frexp_exp:
- assert(ir->operands[0]->type->is_float() ||
- ir->operands[0]->type->is_double());
+ assert(ir->operands[0]->type->is_float_16_32_64());
assert(ir->type->base_type == GLSL_TYPE_INT);
break;
case ir_unop_subroutine_to_int:
@@ -634,8 +629,7 @@ ir_validate::visit_leave(ir_expression *ir)
break;
case ir_unop_atan:
- assert(ir->operands[0]->type->is_float() ||
- ir->operands[0]->type->is_double());
+ assert(ir->operands[0]->type->is_float_16_32_64());
assert(ir->type == ir->operands[0]->type);
break;
@@ -768,9 +762,9 @@ ir_validate::visit_leave(ir_expression *ir)
case ir_binop_dot:
assert(ir->type == glsl_type::float_type ||
- ir->type == glsl_type::double_type);
- assert(ir->operands[0]->type->is_float() ||
- ir->operands[0]->type->is_double());
+ ir->type == glsl_type::double_type ||
+ ir->type == glsl_type::float16_t_type);
+ assert(ir->operands[0]->type->is_float_16_32_64());
assert(ir->operands[0]->type->is_vector());
assert(ir->operands[0]->type == ir->operands[1]->type);
break;
@@ -783,8 +777,7 @@ ir_validate::visit_leave(ir_expression *ir)
case ir_binop_ldexp:
assert(ir->operands[0]->type == ir->type);
- assert(ir->operands[0]->type->is_float() ||
- ir->operands[0]->type->is_double());
+ assert(ir->operands[0]->type->is_float_16_32_64());
assert(ir->operands[1]->type->base_type == GLSL_TYPE_INT);
assert(ir->operands[0]->type->components() ==
ir->operands[1]->type->components());
@@ -810,27 +803,25 @@ ir_validate::visit_leave(ir_expression *ir)
break;
case ir_binop_atan2:
- assert(ir->operands[0]->type->is_float() ||
- ir->operands[0]->type->is_double());
+ assert(ir->operands[0]->type->is_float_16_32_64());
assert(ir->operands[1]->type == ir->operands[0]->type);
assert(ir->type == ir->operands[0]->type);
break;
case ir_triop_fma:
- assert(ir->type->is_float() ||
- ir->type->is_double());
+ assert(ir->type->is_float_16_32_64());
assert(ir->type == ir->operands[0]->type);
assert(ir->type == ir->operands[1]->type);
assert(ir->type == ir->operands[2]->type);
break;
case ir_triop_lrp:
- assert(ir->operands[0]->type->is_float() ||
- ir->operands[0]->type->is_double());
+ assert(ir->operands[0]->type->is_float_16_32_64());
assert(ir->operands[0]->type == ir->operands[1]->type);
assert(ir->operands[2]->type == ir->operands[0]->type ||
ir->operands[2]->type == glsl_type::float_type ||
- ir->operands[2]->type == glsl_type::double_type);
+ ir->operands[2]->type == glsl_type::double_type ||
+ ir->operands[2]->type == glsl_type::float16_t_type);
break;
case ir_triop_csel: