st/mesa: disable lowering of dops to dfrac when dround is available
authorIlia Mirkin <imirkin@alum.mit.edu>
Fri, 25 Jul 2014 21:19:57 +0000 (17:19 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Fri, 20 Feb 2015 00:38:26 +0000 (19:38 -0500)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index 4d8ce11eeeaf62d1bc6e73f5e4dba86623af7b49..1723c3fd7c1ed863f797a547b1796120516c9910 100644 (file)
@@ -1587,7 +1587,6 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
       emit(ir, TGSI_OPCODE_ABS, result_dst, op[0]);
       break;
    case ir_unop_sign:
-      assert(ir->operands[0]->type->base_type != GLSL_TYPE_DOUBLE);
       emit(ir, TGSI_OPCODE_SSG, result_dst, op[0]);
       break;
    case ir_unop_rcp:
@@ -2063,19 +2062,15 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
          emit(ir, TGSI_OPCODE_SNE, result_dst, op[0], st_src_reg_for_float(0.0));
       break;
    case ir_unop_trunc:
-      assert(ir->operands[0]->type->base_type != GLSL_TYPE_DOUBLE);
       emit(ir, TGSI_OPCODE_TRUNC, result_dst, op[0]);
       break;
    case ir_unop_ceil:
-      assert(ir->operands[0]->type->base_type != GLSL_TYPE_DOUBLE);
       emit(ir, TGSI_OPCODE_CEIL, result_dst, op[0]);
       break;
    case ir_unop_floor:
-      assert(ir->operands[0]->type->base_type != GLSL_TYPE_DOUBLE);
       emit(ir, TGSI_OPCODE_FLR, result_dst, op[0]);
       break;
    case ir_unop_round_even:
-      assert(ir->operands[0]->type->base_type != GLSL_TYPE_DOUBLE);
       emit(ir, TGSI_OPCODE_ROUND, result_dst, op[0]);
       break;
    case ir_unop_fract:
@@ -5706,8 +5701,12 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
 
       bool progress;
       exec_list *ir = prog->_LinkedShaders[i]->ir;
+      gl_shader_stage stage = _mesa_shader_enum_to_shader_stage(prog->_LinkedShaders[i]->Type);
       const struct gl_shader_compiler_options *options =
-            &ctx->Const.ShaderCompilerOptions[_mesa_shader_enum_to_shader_stage(prog->_LinkedShaders[i]->Type)];
+            &ctx->Const.ShaderCompilerOptions[stage];
+      unsigned ptarget = shader_stage_to_ptarget(stage);
+      bool have_dround = pscreen->get_shader_param(pscreen, ptarget,
+                                                   PIPE_SHADER_CAP_TGSI_DROUND_SUPPORTED);
 
       /* If there are forms of indirect addressing that the driver
        * cannot handle, perform the lowering pass.
@@ -5747,7 +5746,7 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
                          LDEXP_TO_ARITH |
                          CARRY_TO_ARITH |
                          BORROW_TO_ARITH |
-                         DOPS_TO_DFRAC |
+                         (have_dround ? 0 : DOPS_TO_DFRAC) |
                          (options->EmitNoPow ? POW_TO_EXP2 : 0) |
                          (!ctx->Const.NativeIntegers ? INT_DIV_TO_MUL_RCP : 0) |
                          (options->EmitNoSat ? SAT_TO_CLAMP : 0));