diff options
author | Bryan Cain <[email protected]> | 2011-06-14 23:34:11 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2011-06-29 16:07:12 -0700 |
commit | 20ef96c7ff3f17fbf97e0452a37553249b2b005c (patch) | |
tree | 7ee422b49092e7e0fc48ecf3e90c38ccd0a4fe10 /src/glsl/ir_validate.cpp | |
parent | 4f799e614264d2409fd32e3e3992405bb3fd924f (diff) |
glsl: Add ir_unop_i2u and ir_unop_u2i operations.
These are necessary to handle int/uint constructor conversions. For
example, the following code currently results in a type mismatch:
int x = 7;
uint y = uint(x);
In particular, uint(x) still has type int.
This commit simply adds the new operations; it does not generate them,
nor does it add backend support for them.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/glsl/ir_validate.cpp')
-rw-r--r-- | src/glsl/ir_validate.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 7b1c19d65aa..41ffdfdbcc7 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -280,6 +280,14 @@ ir_validate::visit_leave(ir_expression *ir) assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT); assert(ir->type->base_type == GLSL_TYPE_FLOAT); break; + case ir_unop_i2u: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT); + assert(ir->type->base_type == GLSL_TYPE_UINT); + break; + case ir_unop_u2i: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT); + assert(ir->type->base_type == GLSL_TYPE_INT); + break; case ir_unop_any: assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL); |