[GPU] Make Processor optional for GraphicsSystem setup

This commit is contained in:
Triang3l 2022-07-05 21:21:22 +03:00
parent bdfd410b13
commit fd03d886e9
9 changed files with 18 additions and 13 deletions

View File

@ -228,7 +228,7 @@ X_STATUS Emulator::Setup(
// Setup the core components.
result = graphics_system_->Setup(
processor_.get(), kernel_state_.get(),
memory_.get(), processor_.get(), kernel_state_.get(),
display_window_ ? &display_window_->app_context() : nullptr,
display_window_ != nullptr);
if (result) {

View File

@ -39,12 +39,12 @@ std::string D3D12GraphicsSystem::name() const {
return "Direct3D 12";
}
X_STATUS D3D12GraphicsSystem::Setup(cpu::Processor* processor,
X_STATUS D3D12GraphicsSystem::Setup(Memory* memory, cpu::Processor* processor,
kernel::KernelState* kernel_state,
ui::WindowedAppContext* app_context,
bool is_surface_required) {
provider_ = xe::ui::d3d12::D3D12Provider::Create();
return GraphicsSystem::Setup(processor, kernel_state, app_context,
return GraphicsSystem::Setup(memory, processor, kernel_state, app_context,
is_surface_required);
}

View File

@ -29,7 +29,8 @@ class D3D12GraphicsSystem : public GraphicsSystem {
std::string name() const override;
X_STATUS Setup(cpu::Processor* processor, kernel::KernelState* kernel_state,
X_STATUS Setup(Memory* memory, cpu::Processor* processor,
kernel::KernelState* kernel_state,
ui::WindowedAppContext* app_context,
bool is_surface_required) override;

View File

@ -52,11 +52,11 @@ GraphicsSystem::GraphicsSystem() : vsync_worker_running_(false) {}
GraphicsSystem::~GraphicsSystem() = default;
X_STATUS GraphicsSystem::Setup(cpu::Processor* processor,
X_STATUS GraphicsSystem::Setup(Memory* memory, cpu::Processor* processor,
kernel::KernelState* kernel_state,
ui::WindowedAppContext* app_context,
[[maybe_unused]] bool is_surface_required) {
memory_ = processor->memory();
memory_ = memory;
processor_ = processor;
kernel_state_ = kernel_state;
app_context_ = app_context;
@ -233,6 +233,7 @@ 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);

View File

@ -43,12 +43,13 @@ 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(cpu::Processor* processor,
virtual X_STATUS Setup(Memory* memory, cpu::Processor* processor,
kernel::KernelState* kernel_state,
ui::WindowedAppContext* app_context,
bool is_surface_required);

View File

@ -21,14 +21,14 @@ NullGraphicsSystem::NullGraphicsSystem() {}
NullGraphicsSystem::~NullGraphicsSystem() {}
X_STATUS NullGraphicsSystem::Setup(cpu::Processor* processor,
X_STATUS NullGraphicsSystem::Setup(Memory* memory, 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(processor, kernel_state, app_context,
return GraphicsSystem::Setup(memory, processor, kernel_state, app_context,
is_surface_required);
}

View File

@ -28,7 +28,8 @@ class NullGraphicsSystem : public GraphicsSystem {
std::string name() const override { return "null"; }
X_STATUS Setup(cpu::Processor* processor, kernel::KernelState* kernel_state,
X_STATUS Setup(Memory* memory, cpu::Processor* processor,
kernel::KernelState* kernel_state,
ui::WindowedAppContext* app_context,
bool is_surface_required) override;

View File

@ -21,12 +21,12 @@ VulkanGraphicsSystem::VulkanGraphicsSystem() {}
VulkanGraphicsSystem::~VulkanGraphicsSystem() {}
X_STATUS VulkanGraphicsSystem::Setup(cpu::Processor* processor,
X_STATUS VulkanGraphicsSystem::Setup(Memory* memory, 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(processor, kernel_state, app_context,
return GraphicsSystem::Setup(memory, processor, kernel_state, app_context,
is_surface_required);
}

View File

@ -30,7 +30,8 @@ class VulkanGraphicsSystem : public GraphicsSystem {
return "Vulkan - HEAVILY INCOMPLETE, early development";
}
X_STATUS Setup(cpu::Processor* processor, kernel::KernelState* kernel_state,
X_STATUS Setup(Memory* memory, cpu::Processor* processor,
kernel::KernelState* kernel_state,
ui::WindowedAppContext* app_context,
bool is_surface_required) override;