diff options
author | Paul Berry <[email protected]> | 2012-06-13 15:47:45 -0700 |
---|---|---|
committer | Paul Berry <[email protected]> | 2012-06-15 08:58:55 -0700 |
commit | 8e31f961e6cfd9680b33647c053b0f708abb8a18 (patch) | |
tree | 0b4111a4ddc78710c2bb917267ba6b54f91cee08 /src/glsl/ir_validate.cpp | |
parent | 75f409d75cacf90df2d6f1d718251a5d5cd92f7f (diff) |
glsl: Add unary operation ir_unop_f2u.
Previously, we performed conversions from float->uint by a two step
process: float->int->uint. However, on platforms that use saturating
conversions (e.g. i965), this didn't work, because if the source value
was larger than the maximum representable int (0x7fffffff), then
converting it to an int would clamp it to 0x7fffffff.
This patch just adds the new opcode; further patches will adapt
optimization passes and back-ends to use it, and then finally the
ast_to_hir logic will be modified to emit the new opcode.
Reviewed-by: Brian Paul <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/ir_validate.cpp')
-rw-r--r-- | src/glsl/ir_validate.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 5721717a5ac..191d3983109 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -256,6 +256,10 @@ ir_validate::visit_leave(ir_expression *ir) assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT); assert(ir->type->base_type == GLSL_TYPE_INT); break; + case ir_unop_f2u: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT); + assert(ir->type->base_type == GLSL_TYPE_UINT); + break; case ir_unop_i2f: assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT); assert(ir->type->base_type == GLSL_TYPE_FLOAT); |