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 5841044bf819103d6a91e07443475470361ad3e5..ca9280a7a8386ec8d887865548afcc57fb566ebd 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 2229dc8fab3a21dacc577be9d50f1a6fd39d5501..408939d11056a59f62251a86591bcb34b4656a30 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 a7b828268b9706f2db4f306ede551973e4937a80..eafc1cb8ec471805656bc944a4cf45de3358e29b 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();