r600/sb: use safe math optimizations when TGSI contains precise operations
authorGert Wollny <gw.fossdev@gmail.com>
Fri, 14 Sep 2018 14:56:48 +0000 (16:56 +0200)
committerGert Wollny <gw.fossdev@gmail.com>
Sat, 15 Sep 2018 18:44:53 +0000 (20:44 +0200)
Fixes:
  dEQP-GLES3.functional.shaders.invariance.highp.common_subexpression_3
  dEQP-GLES3.functional.shaders.invariance.mediump.common_subexpression_3
  dEQP-GLES3.functional.shaders.invariance.lowp.common_subexpression_3

Signed-off-by: Gert Wollny <gw.fossdev@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
src/gallium/drivers/r600/r600_asm.h
src/gallium/drivers/r600/r600_shader.c
src/gallium/drivers/r600/sb/sb_bc_parser.cpp

index 5841044..ca9280a 100644 (file)
@@ -277,6 +277,7 @@ struct r600_bytecode {
        struct r600_bytecode_output pending_outputs[5];
        int n_pending_outputs;
        boolean                 need_wait_ack; /* emit a pending WAIT_ACK prior to control flow */
+       boolean                 precise;
 };
 
 /* eg_asm.c */
index 2229dc8..408939d 100644 (file)
@@ -3879,6 +3879,9 @@ static int r600_shader_from_tgsi(struct r600_context *rctx,
                                ctx.inst_info = &eg_shader_tgsi_instruction[opcode];
                        else
                                ctx.inst_info = &r600_shader_tgsi_instruction[opcode];
+
+                       ctx.bc->precise |= ctx.parse.FullToken.FullInstruction.Instruction.Precise;
+
                        r = ctx.inst_info->process(&ctx);
                        if (r)
                                goto out_err;
index a7b8282..eafc1cb 100644 (file)
@@ -75,7 +75,7 @@ int bc_parser::decode() {
        }
 
        sh = new shader(ctx, t, bc->debug_id);
-       sh->safe_math = sb_context::safe_math || (t == TARGET_COMPUTE);
+       sh->safe_math = sb_context::safe_math || (t == TARGET_COMPUTE || bc->precise);
 
        int r = decode_shader();