diff options
| author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-05-31 19:14:34 -0300 |
|---|---|---|
| committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-07-14 22:36:44 -0300 |
| commit | afa8096df5e3c24cb3b639a7fbc65f7225a17137 (patch) | |
| tree | 1787485f5b47e86d2c0b2f277cd1085266e5e9b8 /src/video_core/shader/shader_ir.cpp | |
| parent | 3477b92289244a26e0bfd5a95d60bce53fd1ed61 (diff) | |
shader: Allow tracking of indirect buffers without variable offset
While changing this code, simplify tracking code to allow returning
the base address node, this way callers don't have to manually rebuild
it on each invocation.
Diffstat (limited to 'src/video_core/shader/shader_ir.cpp')
| -rw-r--r-- | src/video_core/shader/shader_ir.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/video_core/shader/shader_ir.cpp b/src/video_core/shader/shader_ir.cpp index 5994bfc4e..972defff3 100644 --- a/src/video_core/shader/shader_ir.cpp +++ b/src/video_core/shader/shader_ir.cpp @@ -61,7 +61,16 @@ Node ShaderIR::GetConstBufferIndirect(u64 index_, u64 offset_, Node node) { const auto [entry, is_new] = used_cbufs.try_emplace(index); entry->second.MarkAsUsedIndirect(); - const Node final_offset = Operation(OperationCode::UAdd, NO_PRECISE, node, Immediate(offset)); + const Node final_offset = [&]() { + // Attempt to inline constant buffer without a variable offset. This is done to allow + // tracking LDC calls. + if (const auto gpr = std::get_if<GprNode>(&*node)) { + if (gpr->GetIndex() == Register::ZeroIndex) { + return Immediate(offset); + } + } + return Operation(OperationCode::UAdd, NO_PRECISE, node, Immediate(offset)); + }(); return MakeNode<CbufNode>(index, final_offset); } |
