[Mesa-dev] [PATCH 6/9] glsl/lower_64bit: add flag to denote we want to lower int/uint->double
Dave Airlie
airlied at gmail.com
Thu Feb 1 03:33:55 UTC 2018
From: Dave Airlie <airlied at redhat.com>
Some hardware has no conversion for these (cayman), so we want
to lower them early using the common code. This adds a flag to allow
the lowering pass to take these conversions into consideration.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
src/compiler/glsl/ir_optimization.h | 2 ++
src/compiler/glsl/lower_64bit.cpp | 12 +++++++++++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/compiler/glsl/ir_optimization.h b/src/compiler/glsl/ir_optimization.h
index 5b21319261..0e76951bda 100644
--- a/src/compiler/glsl/ir_optimization.h
+++ b/src/compiler/glsl/ir_optimization.h
@@ -60,6 +60,8 @@
#define SIGN64 (1U << 1)
#define DIV64 (1U << 2)
#define MOD64 (1U << 3)
+/* lower u->d and i->d */
+#define UI2D (1U << 4)
/**
* \see class lower_packing_builtins_visitor
diff --git a/src/compiler/glsl/lower_64bit.cpp b/src/compiler/glsl/lower_64bit.cpp
index b72b5cf799..a9b2b98f83 100644
--- a/src/compiler/glsl/lower_64bit.cpp
+++ b/src/compiler/glsl/lower_64bit.cpp
@@ -419,7 +419,17 @@ lower_64bit_visitor::handle_rvalue(ir_rvalue **rvalue)
*rvalue = handle_op(ir, "__builtin_umul64", generate_ir::umul64);
}
break;
-
+ case ir_unop_i2d:
+ if (lowering(UI2D)) {
+ assert(ir->type->base_type == GLSL_TYPE_DOUBLE);
+ *rvalue = handle_op(ir, "__builtin_int_to_fp64", generate_ir::int_to_fp64, true);
+ }
+ break;
+ case ir_unop_u2d:
+ if (lowering(UI2D)) {
+ assert(ir->type->base_type == GLSL_TYPE_DOUBLE);
+ *rvalue = handle_op(ir, "__builtin_uint_to_fp64", generate_ir::uint_to_fp64, true);
+ }
default:
break;
}
--
2.14.3
More information about the mesa-dev
mailing list