From 8e31f961e6cfd9680b33647c053b0f708abb8a18 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Wed, 13 Jun 2012 15:47:45 -0700 Subject: 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 Reviewed-by: Kenneth Graunke --- src/glsl/ir.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/glsl/ir.cpp') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index f81bfd1ab8a..1c9eec6e2d1 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -299,6 +299,7 @@ ir_expression::ir_expression(int op, ir_rvalue *op0) break; case ir_unop_i2u: + case ir_unop_f2u: case ir_unop_bitcast_f2u: this->type = glsl_type::get_instance(GLSL_TYPE_UINT, op0->type->vector_elements, 1); @@ -428,6 +429,7 @@ static const char *const operator_strs[] = { "exp2", "log2", "f2i", + "f2u", "i2f", "f2b", "b2f", -- cgit v1.2.3