From 9d3143231cf64b06515563172105893e4d5c659a Mon Sep 17 00:00:00 2001 From: psucien Date: Sat, 4 Jan 2025 22:44:46 +0100 Subject: [PATCH] macOS build fixed; `indirect_args_addr` moved out from queues context --- src/video_core/amdgpu/liverpool.cpp | 18 +++++++----------- src/video_core/amdgpu/liverpool.h | 3 ++- src/video_core/amdgpu/pm4_cmds.h | 2 +- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/video_core/amdgpu/liverpool.cpp b/src/video_core/amdgpu/liverpool.cpp index a59d4a64..16ed84f7 100644 --- a/src/video_core/amdgpu/liverpool.cpp +++ b/src/video_core/amdgpu/liverpool.cpp @@ -454,7 +454,6 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span dcb, std::span(header); const auto offset = draw_indirect->data_offset; - const auto ib_address = mapped_queues[GfxQueueId].indirect_args_addr; const auto size = sizeof(DrawIndirectArgs); if (DebugState.DumpingCurrentReg()) { DebugState.PushRegsDump(base_addr, reinterpret_cast(header), regs); @@ -462,7 +461,7 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span dcb, std::span(header); rasterizer->ScopeMarkerBegin(fmt::format("dcb:{}:DrawIndirect", cmd_address)); - rasterizer->DrawIndirect(false, ib_address, offset, size, 1, 0); + rasterizer->DrawIndirect(false, indirect_args_addr, offset, size, 1, 0); rasterizer->ScopeMarkerEnd(); } break; @@ -471,7 +470,6 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span dcb, std::span(header); const auto offset = draw_index_indirect->data_offset; - const auto ib_address = mapped_queues[GfxQueueId].indirect_args_addr; const auto size = sizeof(DrawIndexedIndirectArgs); if (DebugState.DumpingCurrentReg()) { DebugState.PushRegsDump(base_addr, reinterpret_cast(header), regs); @@ -480,7 +478,7 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span dcb, std::span(header); rasterizer->ScopeMarkerBegin( fmt::format("dcb:{}:DrawIndexIndirect", cmd_address)); - rasterizer->DrawIndirect(true, ib_address, offset, size, 1, 0); + rasterizer->DrawIndirect(true, indirect_args_addr, offset, size, 1, 0); rasterizer->ScopeMarkerEnd(); } break; @@ -489,7 +487,6 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span dcb, std::span(header); const auto offset = draw_index_indirect->data_offset; - const auto ib_address = mapped_queues[GfxQueueId].indirect_args_addr; if (DebugState.DumpingCurrentReg()) { DebugState.PushRegsDump(base_addr, reinterpret_cast(header), regs); } @@ -497,9 +494,9 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span dcb, std::span(header); rasterizer->ScopeMarkerBegin( fmt::format("dcb:{}:DrawIndexIndirectCountMulti", cmd_address)); - rasterizer->DrawIndirect(true, ib_address, offset, draw_index_indirect->stride, - draw_index_indirect->count, - draw_index_indirect->countAddr); + rasterizer->DrawIndirect( + true, indirect_args_addr, offset, draw_index_indirect->stride, + draw_index_indirect->count, draw_index_indirect->countAddr); rasterizer->ScopeMarkerEnd(); } break; @@ -528,7 +525,6 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span dcb, std::span(header); auto& cs_program = GetCsRegs(); const auto offset = dispatch_indirect->data_offset; - const auto ib_address = mapped_queues[GfxQueueId].indirect_args_addr; const auto size = sizeof(PM4CmdDispatchIndirect::GroupDimensions); if (DebugState.DumpingCurrentReg()) { DebugState.PushRegsDumpCompute(base_addr, reinterpret_cast(header), @@ -538,7 +534,7 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span dcb, std::span(header); rasterizer->ScopeMarkerBegin( fmt::format("dcb:{}:DispatchIndirect", cmd_address)); - rasterizer->DispatchIndirect(ib_address, offset, size); + rasterizer->DispatchIndirect(indirect_args_addr, offset, size); rasterizer->ScopeMarkerEnd(); } break; @@ -562,7 +558,7 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span dcb, std::span(header); ASSERT(set_base->base_index == PM4CmdSetBase::BaseIndex::DrawIndexIndirPatchTable); - mapped_queues[GfxQueueId].indirect_args_addr = set_base->Address(); + indirect_args_addr = set_base->Address(); break; } case PM4ItOpcode::EventWrite: { diff --git a/src/video_core/amdgpu/liverpool.h b/src/video_core/amdgpu/liverpool.h index 85ea4a75..0f178305 100644 --- a/src/video_core/amdgpu/liverpool.h +++ b/src/video_core/amdgpu/liverpool.h @@ -1479,11 +1479,12 @@ private: std::vector ccb_buffer; std::queue submits{}; ComputeProgram cs_state{}; - VAddr indirect_args_addr{}; }; std::array mapped_queues{}; u32 num_mapped_queues{1u}; // GFX is always available + VAddr indirect_args_addr{}; + struct ConstantEngine { void Reset() { ce_count = 0; diff --git a/src/video_core/amdgpu/pm4_cmds.h b/src/video_core/amdgpu/pm4_cmds.h index 13541545..311f4d4d 100644 --- a/src/video_core/amdgpu/pm4_cmds.h +++ b/src/video_core/amdgpu/pm4_cmds.h @@ -804,7 +804,7 @@ struct PM4CmdDispatchIndirectMec { template T Address() const { - return reinterpret_cast(address0 | (u64(address1 & 0xffff) << 32u)); + return std::bit_cast(address0 | (u64(address1 & 0xffff) << 32u)); } };