From 3108677a4db1656fb2058e12f96fd5633714f52a Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Mon, 14 May 2018 15:01:43 -0500 Subject: [PATCH] [GPU] Public swap callback function --- src/xenia/gpu/command_processor.h | 2 +- src/xenia/gpu/graphics_system.cc | 6 ++++-- src/xenia/gpu/graphics_system.h | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/xenia/gpu/command_processor.h b/src/xenia/gpu/command_processor.h index 8385ac1bb..bd1d56b91 100644 --- a/src/xenia/gpu/command_processor.h +++ b/src/xenia/gpu/command_processor.h @@ -126,7 +126,7 @@ class CommandProcessor { void IssueSwap(uint32_t frontbuffer_ptr, uint32_t frontbuffer_width, uint32_t frontbuffer_height); - void set_swap_request_handler(std::function fn) { + void SetSwapCallback(std::function fn) { swap_request_handler_ = fn; } diff --git a/src/xenia/gpu/graphics_system.cc b/src/xenia/gpu/graphics_system.cc index 894cb4252..08d3107a9 100644 --- a/src/xenia/gpu/graphics_system.cc +++ b/src/xenia/gpu/graphics_system.cc @@ -54,8 +54,6 @@ X_STATUS GraphicsSystem::Setup( return X_STATUS_UNSUCCESSFUL; } - command_processor_->set_swap_request_handler([]() {}); - // Let the processor know we want register access callbacks. memory_->AddVirtualMappedRange( 0x7FC80000, 0xFFFF0000, 0x0000FFFF, this, @@ -113,6 +111,10 @@ void GraphicsSystem::Reset() { xe::FatalError("Graphics device lost (probably due to an internal error)"); } +void GraphicsSystem::SetSwapCallback(std::function fn) { + command_processor_->SetSwapCallback(fn); +} + uint32_t GraphicsSystem::ReadRegisterThunk(void* ppc_context, GraphicsSystem* gs, uint32_t addr) { return gs->ReadRegister(addr); diff --git a/src/xenia/gpu/graphics_system.h b/src/xenia/gpu/graphics_system.h index f441e2f10..8e76adbcb 100644 --- a/src/xenia/gpu/graphics_system.h +++ b/src/xenia/gpu/graphics_system.h @@ -62,6 +62,8 @@ class GraphicsSystem { virtual void ClearCaches(); + void SetSwapCallback(std::function fn); + void RequestFrameTrace(); void BeginTracing(); void EndTracing();