[Mesa-dev] [PATCH 21/47] glsl: Add a lowering pass for 64-bit float sign()

Elie Tournier tournier.elie at gmail.com
Wed Aug 23 11:07:51 UTC 2017


Signed-off-by: Elie Tournier <elie.tournier at collabora.com>
---
 src/compiler/glsl/lower_64bit.cpp          | 5 ++++-
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/compiler/glsl/lower_64bit.cpp b/src/compiler/glsl/lower_64bit.cpp
index 91b972fe82..86ee13cb89 100644
--- a/src/compiler/glsl/lower_64bit.cpp
+++ b/src/compiler/glsl/lower_64bit.cpp
@@ -421,7 +421,10 @@ lower_64bit_visitor::handle_rvalue(ir_rvalue **rvalue)
 
    case ir_unop_sign:
       if (lowering(SIGN64)) {
-         *rvalue = handle_op(ir, "__builtin_sign64", generate_ir::sign64);
+         if (ir->type->base_type == GLSL_TYPE_DOUBLE)
+            *rvalue = handle_op(ir, "__builtin_fsign64", generate_ir::fsign64);
+         else
+            *rvalue = handle_op(ir, "__builtin_sign64", generate_ir::sign64);
       }
       break;
 
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 3b0b19be53..1d5e74ab31 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -7059,7 +7059,8 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
       if (!pscreen->get_param(pscreen, PIPE_CAP_DOUBLES) &&
             ctx->Const.GLSLVersion >= 130) {
          unsigned lower_inst = ABS64 |
-                               NEG64;
+                               NEG64 |
+                               SIGN64;
          lower_64bit_double_instructions(ir, lower_inst);
       }
 
-- 
2.14.1



More information about the mesa-dev mailing list