From afa8096df5e3c24cb3b639a7fbc65f7225a17137 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Fri, 31 May 2019 19:14:34 -0300 Subject: 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. --- src/video_core/shader/decode/memory.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src/video_core/shader/decode/memory.cpp') diff --git a/src/video_core/shader/decode/memory.cpp b/src/video_core/shader/decode/memory.cpp index 80fc0ccfc..ab207a33b 100644 --- a/src/video_core/shader/decode/memory.cpp +++ b/src/video_core/shader/decode/memory.cpp @@ -297,18 +297,13 @@ std::tuple ShaderIR::TrackAndGetGlobalMemory(NodeB const auto addr_register{GetRegister(instr.gmem.gpr)}; const auto immediate_offset{static_cast(instr.gmem.offset)}; - const Node base_address{ - TrackCbuf(addr_register, global_code, static_cast(global_code.size()))}; - const auto cbuf = std::get_if(&*base_address); - ASSERT(cbuf != nullptr); - const auto cbuf_offset_imm = std::get_if(&*cbuf->GetOffset()); - ASSERT(cbuf_offset_imm != nullptr); - const auto cbuf_offset = cbuf_offset_imm->GetValue(); - - bb.push_back( - Comment(fmt::format("Base address is c[0x{:x}][0x{:x}]", cbuf->GetIndex(), cbuf_offset))); - - const GlobalMemoryBase descriptor{cbuf->GetIndex(), cbuf_offset}; + const auto [base_address, index, offset] = + TrackCbuf(addr_register, global_code, static_cast(global_code.size())); + ASSERT(base_address != nullptr); + + bb.push_back(Comment(fmt::format("Base address is c[0x{:x}][0x{:x}]", index, offset))); + + const GlobalMemoryBase descriptor{index, offset}; const auto& [entry, is_new] = used_global_memory.try_emplace(descriptor); auto& usage = entry->second; if (is_write) { -- cgit v1.2.3