aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-06-18 08:29:53 +0200
committermarha <marha@users.sourceforge.net>2012-06-18 08:29:53 +0200
commita3691edaff553b5130c97ff912ecaa96f08a6643 (patch)
tree8a1fb2257d45cc0ebd3d0a69fdf8a7a8a0cc9d1e /mesalib/src/glsl
parenta33de30073bfa0ee1abba186dba9fa52cf0aa23a (diff)
downloadvcxsrv-a3691edaff553b5130c97ff912ecaa96f08a6643.tar.gz
vcxsrv-a3691edaff553b5130c97ff912ecaa96f08a6643.tar.bz2
vcxsrv-a3691edaff553b5130c97ff912ecaa96f08a6643.zip
fontconfig mesa pixman git update 18 Jun 2012
Diffstat (limited to 'mesalib/src/glsl')
-rw-r--r--mesalib/src/glsl/ast_function.cpp3
-rw-r--r--mesalib/src/glsl/ir.cpp2
-rw-r--r--mesalib/src/glsl/ir.h1
-rw-r--r--mesalib/src/glsl/ir_constant_expression.cpp6
-rw-r--r--mesalib/src/glsl/ir_validate.cpp4
5 files changed, 14 insertions, 2 deletions
diff --git a/mesalib/src/glsl/ast_function.cpp b/mesalib/src/glsl/ast_function.cpp
index 9e7c5995f..ea3282c5f 100644
--- a/mesalib/src/glsl/ast_function.cpp
+++ b/mesalib/src/glsl/ast_function.cpp
@@ -452,8 +452,7 @@ convert_component(ir_rvalue *src, const glsl_type *desired_type)
result = new(ctx) ir_expression(ir_unop_i2u, src);
break;
case GLSL_TYPE_FLOAT:
- result = new(ctx) ir_expression(ir_unop_i2u,
- new(ctx) ir_expression(ir_unop_f2i, src));
+ result = new(ctx) ir_expression(ir_unop_f2u, src);
break;
case GLSL_TYPE_BOOL:
result = new(ctx) ir_expression(ir_unop_i2u,
diff --git a/mesalib/src/glsl/ir.cpp b/mesalib/src/glsl/ir.cpp
index f81bfd1ab..1c9eec6e2 100644
--- a/mesalib/src/glsl/ir.cpp
+++ b/mesalib/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",
diff --git a/mesalib/src/glsl/ir.h b/mesalib/src/glsl/ir.h
index 55535b2f5..014f3630d 100644
--- a/mesalib/src/glsl/ir.h
+++ b/mesalib/src/glsl/ir.h
@@ -896,6 +896,7 @@ enum ir_expression_operation {
ir_unop_exp2,
ir_unop_log2,
ir_unop_f2i, /**< Float-to-integer conversion. */
+ ir_unop_f2u, /**< Float-to-unsigned conversion. */
ir_unop_i2f, /**< Integer-to-float conversion. */
ir_unop_f2b, /**< Float-to-boolean conversion */
ir_unop_b2f, /**< Boolean-to-float conversion */
diff --git a/mesalib/src/glsl/ir_constant_expression.cpp b/mesalib/src/glsl/ir_constant_expression.cpp
index 38a1ed96c..17b54b923 100644
--- a/mesalib/src/glsl/ir_constant_expression.cpp
+++ b/mesalib/src/glsl/ir_constant_expression.cpp
@@ -182,6 +182,12 @@ ir_expression::constant_expression_value(struct hash_table *variable_context)
data.i[c] = (int) op[0]->value.f[c];
}
break;
+ case ir_unop_f2u:
+ assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
+ for (unsigned c = 0; c < op[0]->type->components(); c++) {
+ data.i[c] = (unsigned) op[0]->value.f[c];
+ }
+ break;
case ir_unop_i2f:
assert(op[0]->type->base_type == GLSL_TYPE_INT);
for (unsigned c = 0; c < op[0]->type->components(); c++) {
diff --git a/mesalib/src/glsl/ir_validate.cpp b/mesalib/src/glsl/ir_validate.cpp
index 5721717a5..191d39831 100644
--- a/mesalib/src/glsl/ir_validate.cpp
+++ b/mesalib/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);