diff options
author | Dave Airlie <[email protected]> | 2018-02-06 14:17:46 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2018-02-09 09:53:21 +1000 |
commit | 22fc5eff803d14e99e9f86db223ceedcef1b9108 (patch) | |
tree | ffa5a056dae1028c400573ebfdf616c866441c9e /src/gallium | |
parent | cd34deb585669ffe1d520b07c629316f2ac22074 (diff) |
r600/sb: handle scratch mem reads on r600
On r600 we use the scratch mem with read/read_ind, in that case
sb should track the rw_gpr as a dst instead of a src.
This stops the whole shader being optimised out.
Signed-off-by: Dave Airlie <[email protected]>
Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/r600/sb/sb_bc_finalize.cpp | 9 | ||||
-rw-r--r-- | src/gallium/drivers/r600/sb/sb_bc_parser.cpp | 19 |
2 files changed, 23 insertions, 5 deletions
diff --git a/src/gallium/drivers/r600/sb/sb_bc_finalize.cpp b/src/gallium/drivers/r600/sb/sb_bc_finalize.cpp index e737f3d6cd0..5c572938a15 100644 --- a/src/gallium/drivers/r600/sb/sb_bc_finalize.cpp +++ b/src/gallium/drivers/r600/sb/sb_bc_finalize.cpp @@ -778,8 +778,15 @@ void bc_finalizer::finalize_cf(cf_node* c) { int reg = -1; unsigned mask = 0; + for (unsigned chan = 0; chan < 4; ++chan) { - value *v = c->src[chan]; + value *v; + if (ctx.hw_class == HW_CLASS_R600 && c->bc.op == CF_OP_MEM_SCRATCH && + (c->bc.type == 2 || c->bc.type == 3)) + v = c->dst[chan]; + else + v = c->src[chan]; + if (!v || v->is_undef()) continue; diff --git a/src/gallium/drivers/r600/sb/sb_bc_parser.cpp b/src/gallium/drivers/r600/sb/sb_bc_parser.cpp index 2ec842159b1..a7b828268b9 100644 --- a/src/gallium/drivers/r600/sb/sb_bc_parser.cpp +++ b/src/gallium/drivers/r600/sb/sb_bc_parser.cpp @@ -832,12 +832,23 @@ int bc_parser::prepare_ir() { do { - c->src.resize(4); + if (ctx.hw_class == HW_CLASS_R600 && c->bc.op == CF_OP_MEM_SCRATCH && + (c->bc.type == 2 || c->bc.type == 3)) { + c->dst.resize(4); + for(int s = 0; s < 4; ++s) { + if (c->bc.comp_mask & (1 << s)) + c->dst[s] = + sh->get_gpr_value(true, c->bc.rw_gpr, s, false); + } + } else { + c->src.resize(4); - for(int s = 0; s < 4; ++s) { - if (c->bc.comp_mask & (1 << s)) - c->src[s] = + + for(int s = 0; s < 4; ++s) { + if (c->bc.comp_mask & (1 << s)) + c->src[s] = sh->get_gpr_value(true, c->bc.rw_gpr, s, false); + } } if (((flags & CF_RAT) || (!(flags & CF_STRM))) && (c->bc.type & 1)) { // indexed write |