[Mesa-dev] [PATCH v2 5/5] st/glsl_to_tgsi: use DDIV instead of DRCP + DMUL
Nicolai Hähnle
nhaehnle at gmail.com
Thu Jan 19 13:59:40 UTC 2017
From: Nicolai Hähnle <nicolai.haehnle at amd.com>
Fixes GL45-CTS.gpu_shader_fp64.built_in_functions.
v2: use DDIV unconditionally
Reviewed-by: Roland Scheidegger <sroland at vmware.com> (v1)
Reviewed-by: Marek Olšák <marek.olsak at amd.com> (v1)
---
src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index a99e991..d0183d2 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -948,21 +948,21 @@ glsl_to_tgsi_visitor::get_opcode(unsigned op,
op = TGSI_OPCODE_##f; \
else \
op = TGSI_OPCODE_##c; \
break;
switch(op) {
case3fid(ADD, UADD, DADD);
case3fid(MUL, UMUL, DMUL);
case3fid(MAD, UMAD, DMAD);
case3fid(FMA, UMAD, DFMA);
- case3(DIV, IDIV, UDIV);
+ case4d(DIV, IDIV, UDIV, DDIV);
case4d(MAX, IMAX, UMAX, DMAX);
case4d(MIN, IMIN, UMIN, DMIN);
case2iu(MOD, UMOD);
casecomp(SEQ, FSEQ, USEQ, USEQ, DSEQ);
casecomp(SNE, FSNE, USNE, USNE, DSNE);
casecomp(SGE, FSGE, ISGE, USGE, DSGE);
casecomp(SLT, FSLT, ISLT, USLT, DSLT);
case2iu(ISHR, USHR);
@@ -1703,24 +1703,21 @@ glsl_to_tgsi_visitor::visit_expression(ir_expression* ir, st_src_reg *op)
break;
case ir_binop_sub:
op[1].negate = ~op[1].negate;
emit_asm(ir, TGSI_OPCODE_ADD, result_dst, op[0], op[1]);
break;
case ir_binop_mul:
emit_asm(ir, TGSI_OPCODE_MUL, result_dst, op[0], op[1]);
break;
case ir_binop_div:
- if (result_dst.type == GLSL_TYPE_FLOAT || result_dst.type == GLSL_TYPE_DOUBLE)
- assert(!"not reached: should be handled by ir_div_to_mul_rcp");
- else
- emit_asm(ir, TGSI_OPCODE_DIV, result_dst, op[0], op[1]);
+ emit_asm(ir, TGSI_OPCODE_DIV, result_dst, op[0], op[1]);
break;
case ir_binop_mod:
if (result_dst.type == GLSL_TYPE_FLOAT)
assert(!"ir_binop_mod should have been converted to b * fract(a/b)");
else
emit_asm(ir, TGSI_OPCODE_MOD, result_dst, op[0], op[1]);
break;
case ir_binop_less:
emit_asm(ir, TGSI_OPCODE_SLT, result_dst, op[0], op[1]);
@@ -6911,21 +6908,21 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
if (!pscreen->get_param(pscreen, PIPE_CAP_TEXTURE_GATHER_OFFSETS))
lower_offset_arrays(ir);
do_mat_op_to_vec(ir);
if (stage == MESA_SHADER_FRAGMENT)
lower_blend_equation_advanced(shader);
lower_instructions(ir,
MOD_TO_FLOOR |
- DIV_TO_MUL_RCP |
+ FDIV_TO_MUL_RCP |
EXP_TO_EXP2 |
LOG_TO_LOG2 |
LDEXP_TO_ARITH |
(have_dfrexp ? 0 : DFREXP_DLDEXP_TO_ARITH) |
CARRY_TO_ARITH |
BORROW_TO_ARITH |
(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) |
--
2.7.4
More information about the mesa-dev
mailing list