[Mesa-dev] [PATCH 31/47] glsl: Add a lowering pass for 64-bit float d2f()
Elie Tournier
tournier.elie at gmail.com
Wed Aug 23 11:08:01 UTC 2017
Signed-off-by: Elie Tournier <elie.tournier at collabora.com>
---
src/compiler/glsl/ir_optimization.h | 1 +
src/compiler/glsl/lower_64bit.cpp | 7 +++++++
src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 3 ++-
3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/compiler/glsl/ir_optimization.h b/src/compiler/glsl/ir_optimization.h
index c59d7f6ee2..2d5a210dca 100644
--- a/src/compiler/glsl/ir_optimization.h
+++ b/src/compiler/glsl/ir_optimization.h
@@ -72,6 +72,7 @@
#define U2D (1U << 11)
#define D2I (1U << 12)
#define I2D (1U << 13)
+#define D2F (1U << 14)
/**
* \see class lower_packing_builtins_visitor
diff --git a/src/compiler/glsl/lower_64bit.cpp b/src/compiler/glsl/lower_64bit.cpp
index 570f997779..48c053b02b 100644
--- a/src/compiler/glsl/lower_64bit.cpp
+++ b/src/compiler/glsl/lower_64bit.cpp
@@ -436,6 +436,13 @@ lower_64bit_visitor::handle_rvalue(ir_rvalue **rvalue)
}
break;
+ case ir_unop_d2f:
+ if (lowering(D2F)) {
+ if (ir->type->base_type == GLSL_TYPE_FLOAT)
+ *rvalue = handle_op(ir, "__builtin_fp64_to_fp32", generate_ir::fp64_to_fp32);
+ }
+ break;
+
case ir_unop_d2i:
if (lowering(D2I)) {
if (ir->type->base_type == GLSL_TYPE_INT)
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 1be223a3cb..53d85360b2 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -7069,7 +7069,8 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
D2U |
U2D |
D2I |
- I2D;
+ I2D |
+ D2F;
lower_64bit_double_instructions(ir, lower_inst);
}
--
2.14.1
More information about the mesa-dev
mailing list