From 3ee68d79eae0e65aa6b1d0dca8c97b81f923658f Mon Sep 17 00:00:00 2001 From: Triang3l Date: Wed, 6 Jul 2022 22:43:40 +0300 Subject: [PATCH] Revert "[GPU] Make Processor optional for GraphicsSystem setup" The Processor is still required in many places, including the GPU command processor worker thread This reverts commit fd03d886e9a512cd3b2a95e28fb25659e12fd5f1. --- src/xenia/emulator.cc | 2 +- src/xenia/gpu/d3d12/d3d12_graphics_system.cc | 4 ++-- src/xenia/gpu/d3d12/d3d12_graphics_system.h | 3 +-- src/xenia/gpu/graphics_system.cc | 5 ++--- src/xenia/gpu/graphics_system.h | 3 +-- src/xenia/gpu/null/null_graphics_system.cc | 4 ++-- src/xenia/gpu/null/null_graphics_system.h | 3 +-- src/xenia/gpu/vulkan/vulkan_graphics_system.cc | 4 ++-- src/xenia/gpu/vulkan/vulkan_graphics_system.h | 3 +-- 9 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/xenia/emulator.cc b/src/xenia/emulator.cc index c4cc8c150..da9fb18d4 100644 --- a/src/xenia/emulator.cc +++ b/src/xenia/emulator.cc @@ -228,7 +228,7 @@ X_STATUS Emulator::Setup( // Setup the core components. result = graphics_system_->Setup( - memory_.get(), processor_.get(), kernel_state_.get(), + processor_.get(), kernel_state_.get(), display_window_ ? &display_window_->app_context() : nullptr, display_window_ != nullptr); if (result) { diff --git a/src/xenia/gpu/d3d12/d3d12_graphics_system.cc b/src/xenia/gpu/d3d12/d3d12_graphics_system.cc index 6f168d4c2..b4e0d025d 100644 --- a/src/xenia/gpu/d3d12/d3d12_graphics_system.cc +++ b/src/xenia/gpu/d3d12/d3d12_graphics_system.cc @@ -39,12 +39,12 @@ std::string D3D12GraphicsSystem::name() const { return "Direct3D 12"; } -X_STATUS D3D12GraphicsSystem::Setup(Memory* memory, cpu::Processor* processor, +X_STATUS D3D12GraphicsSystem::Setup(cpu::Processor* processor, kernel::KernelState* kernel_state, ui::WindowedAppContext* app_context, bool is_surface_required) { provider_ = xe::ui::d3d12::D3D12Provider::Create(); - return GraphicsSystem::Setup(memory, processor, kernel_state, app_context, + return GraphicsSystem::Setup(processor, kernel_state, app_context, is_surface_required); } diff --git a/src/xenia/gpu/d3d12/d3d12_graphics_system.h b/src/xenia/gpu/d3d12/d3d12_graphics_system.h index fc515311e..249cc3ffa 100644 --- a/src/xenia/gpu/d3d12/d3d12_graphics_system.h +++ b/src/xenia/gpu/d3d12/d3d12_graphics_system.h @@ -29,8 +29,7 @@ class D3D12GraphicsSystem : public GraphicsSystem { std::string name() const override; - X_STATUS Setup(Memory* memory, cpu::Processor* processor, - kernel::KernelState* kernel_state, + X_STATUS Setup(cpu::Processor* processor, kernel::KernelState* kernel_state, ui::WindowedAppContext* app_context, bool is_surface_required) override; diff --git a/src/xenia/gpu/graphics_system.cc b/src/xenia/gpu/graphics_system.cc index f57d966d4..b5470fd0a 100644 --- a/src/xenia/gpu/graphics_system.cc +++ b/src/xenia/gpu/graphics_system.cc @@ -52,11 +52,11 @@ GraphicsSystem::GraphicsSystem() : vsync_worker_running_(false) {} GraphicsSystem::~GraphicsSystem() = default; -X_STATUS GraphicsSystem::Setup(Memory* memory, cpu::Processor* processor, +X_STATUS GraphicsSystem::Setup(cpu::Processor* processor, kernel::KernelState* kernel_state, ui::WindowedAppContext* app_context, [[maybe_unused]] bool is_surface_required) { - memory_ = memory; + memory_ = processor->memory(); processor_ = processor; kernel_state_ = kernel_state; app_context_ = app_context; @@ -233,7 +233,6 @@ void GraphicsSystem::EnableReadPointerWriteBack(uint32_t ptr, void GraphicsSystem::SetInterruptCallback(uint32_t callback, uint32_t user_data) { - assert_false(callback && !processor_); interrupt_callback_ = callback; interrupt_callback_data_ = user_data; XELOGGPU("SetInterruptCallback({:08X}, {:08X})", callback, user_data); diff --git a/src/xenia/gpu/graphics_system.h b/src/xenia/gpu/graphics_system.h index 90cd6a4ae..0434a5619 100644 --- a/src/xenia/gpu/graphics_system.h +++ b/src/xenia/gpu/graphics_system.h @@ -43,13 +43,12 @@ class GraphicsSystem { virtual std::string name() const = 0; Memory* memory() const { return memory_; } - // The Processor is optional and may be null (needed only for interrupts). cpu::Processor* processor() const { return processor_; } kernel::KernelState* kernel_state() const { return kernel_state_; } ui::GraphicsProvider* provider() const { return provider_.get(); } ui::Presenter* presenter() const { return presenter_.get(); } - virtual X_STATUS Setup(Memory* memory, cpu::Processor* processor, + virtual X_STATUS Setup(cpu::Processor* processor, kernel::KernelState* kernel_state, ui::WindowedAppContext* app_context, bool is_surface_required); diff --git a/src/xenia/gpu/null/null_graphics_system.cc b/src/xenia/gpu/null/null_graphics_system.cc index 7a92d16d9..57d5e958f 100644 --- a/src/xenia/gpu/null/null_graphics_system.cc +++ b/src/xenia/gpu/null/null_graphics_system.cc @@ -21,14 +21,14 @@ NullGraphicsSystem::NullGraphicsSystem() {} NullGraphicsSystem::~NullGraphicsSystem() {} -X_STATUS NullGraphicsSystem::Setup(Memory* memory, cpu::Processor* processor, +X_STATUS NullGraphicsSystem::Setup(cpu::Processor* processor, kernel::KernelState* kernel_state, ui::WindowedAppContext* app_context, bool is_surface_required) { // This is a null graphics system, but we still setup vulkan because UI needs // it through us :| provider_ = xe::ui::vulkan::VulkanProvider::Create(is_surface_required); - return GraphicsSystem::Setup(memory, processor, kernel_state, app_context, + return GraphicsSystem::Setup(processor, kernel_state, app_context, is_surface_required); } diff --git a/src/xenia/gpu/null/null_graphics_system.h b/src/xenia/gpu/null/null_graphics_system.h index fd866c694..d5b8d32b9 100644 --- a/src/xenia/gpu/null/null_graphics_system.h +++ b/src/xenia/gpu/null/null_graphics_system.h @@ -28,8 +28,7 @@ class NullGraphicsSystem : public GraphicsSystem { std::string name() const override { return "null"; } - X_STATUS Setup(Memory* memory, cpu::Processor* processor, - kernel::KernelState* kernel_state, + X_STATUS Setup(cpu::Processor* processor, kernel::KernelState* kernel_state, ui::WindowedAppContext* app_context, bool is_surface_required) override; diff --git a/src/xenia/gpu/vulkan/vulkan_graphics_system.cc b/src/xenia/gpu/vulkan/vulkan_graphics_system.cc index 89a95bdf7..c42510050 100644 --- a/src/xenia/gpu/vulkan/vulkan_graphics_system.cc +++ b/src/xenia/gpu/vulkan/vulkan_graphics_system.cc @@ -21,12 +21,12 @@ VulkanGraphicsSystem::VulkanGraphicsSystem() {} VulkanGraphicsSystem::~VulkanGraphicsSystem() {} -X_STATUS VulkanGraphicsSystem::Setup(Memory* memory, cpu::Processor* processor, +X_STATUS VulkanGraphicsSystem::Setup(cpu::Processor* processor, kernel::KernelState* kernel_state, ui::WindowedAppContext* app_context, bool is_surface_required) { provider_ = xe::ui::vulkan::VulkanProvider::Create(is_surface_required); - return GraphicsSystem::Setup(memory, processor, kernel_state, app_context, + return GraphicsSystem::Setup(processor, kernel_state, app_context, is_surface_required); } diff --git a/src/xenia/gpu/vulkan/vulkan_graphics_system.h b/src/xenia/gpu/vulkan/vulkan_graphics_system.h index e28cb6381..ae81e144c 100644 --- a/src/xenia/gpu/vulkan/vulkan_graphics_system.h +++ b/src/xenia/gpu/vulkan/vulkan_graphics_system.h @@ -30,8 +30,7 @@ class VulkanGraphicsSystem : public GraphicsSystem { return "Vulkan - HEAVILY INCOMPLETE, early development"; } - X_STATUS Setup(Memory* memory, cpu::Processor* processor, - kernel::KernelState* kernel_state, + X_STATUS Setup(cpu::Processor* processor, kernel::KernelState* kernel_state, ui::WindowedAppContext* app_context, bool is_surface_required) override;