Add a null graphics system (enable with --gpu=null)
Still uses vulkan to drive xenia UI, may look into decoupling later.
This commit is contained in:
parent
92859f5a28
commit
40f782a83b
|
@ -183,6 +183,7 @@ solution("xenia")
|
||||||
include("src/xenia/cpu/backend/x64")
|
include("src/xenia/cpu/backend/x64")
|
||||||
include("src/xenia/debug/ui")
|
include("src/xenia/debug/ui")
|
||||||
include("src/xenia/gpu")
|
include("src/xenia/gpu")
|
||||||
|
include("src/xenia/gpu/null")
|
||||||
include("src/xenia/gpu/gl4")
|
include("src/xenia/gpu/gl4")
|
||||||
include("src/xenia/gpu/vulkan")
|
include("src/xenia/gpu/vulkan")
|
||||||
include("src/xenia/hid")
|
include("src/xenia/hid")
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
// Available graphics systems:
|
// Available graphics systems:
|
||||||
#include "xenia/gpu/gl4/gl4_graphics_system.h"
|
#include "xenia/gpu/gl4/gl4_graphics_system.h"
|
||||||
|
#include "xenia/gpu/null/null_graphics_system.h"
|
||||||
#include "xenia/gpu/vulkan/vulkan_graphics_system.h"
|
#include "xenia/gpu/vulkan/vulkan_graphics_system.h"
|
||||||
|
|
||||||
// Available input drivers:
|
// Available input drivers:
|
||||||
|
@ -37,7 +38,7 @@
|
||||||
#endif // XE_PLATFORM_WIN32
|
#endif // XE_PLATFORM_WIN32
|
||||||
|
|
||||||
DEFINE_string(apu, "any", "Audio system. Use: [any, nop, xaudio2]");
|
DEFINE_string(apu, "any", "Audio system. Use: [any, nop, xaudio2]");
|
||||||
DEFINE_string(gpu, "any", "Graphics system. Use: [any, gl4, vulkan]");
|
DEFINE_string(gpu, "any", "Graphics system. Use: [any, gl4, vulkan, null]");
|
||||||
DEFINE_string(hid, "any", "Input system. Use: [any, nop, winkey, xinput]");
|
DEFINE_string(hid, "any", "Input system. Use: [any, nop, winkey, xinput]");
|
||||||
|
|
||||||
DEFINE_string(target, "", "Specifies the target .xex or .iso to execute.");
|
DEFINE_string(target, "", "Specifies the target .xex or .iso to execute.");
|
||||||
|
@ -75,6 +76,9 @@ std::unique_ptr<gpu::GraphicsSystem> CreateGraphicsSystem() {
|
||||||
} else if (FLAGS_gpu.compare("vulkan") == 0) {
|
} else if (FLAGS_gpu.compare("vulkan") == 0) {
|
||||||
return std::unique_ptr<gpu::GraphicsSystem>(
|
return std::unique_ptr<gpu::GraphicsSystem>(
|
||||||
new xe::gpu::vulkan::VulkanGraphicsSystem());
|
new xe::gpu::vulkan::VulkanGraphicsSystem());
|
||||||
|
} else if (FLAGS_gpu.compare("null") == 0) {
|
||||||
|
return std::unique_ptr<gpu::GraphicsSystem>(
|
||||||
|
new xe::gpu::null::NullGraphicsSystem());
|
||||||
} else {
|
} else {
|
||||||
// Create best available.
|
// Create best available.
|
||||||
std::unique_ptr<gpu::GraphicsSystem> best;
|
std::unique_ptr<gpu::GraphicsSystem> best;
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* Xenia : Xbox 360 Emulator Research Project *
|
||||||
|
******************************************************************************
|
||||||
|
* Copyright 2016 Ben Vanik. All rights reserved. *
|
||||||
|
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "xenia/gpu/null/null_command_processor.h"
|
||||||
|
|
||||||
|
namespace xe {
|
||||||
|
namespace gpu {
|
||||||
|
namespace null {
|
||||||
|
|
||||||
|
NullCommandProcessor::NullCommandProcessor(NullGraphicsSystem* graphics_system,
|
||||||
|
kernel::KernelState* kernel_state)
|
||||||
|
: CommandProcessor(graphics_system, kernel_state) {}
|
||||||
|
NullCommandProcessor::~NullCommandProcessor() = default;
|
||||||
|
|
||||||
|
bool NullCommandProcessor::SetupContext() {
|
||||||
|
return CommandProcessor::SetupContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NullCommandProcessor::ShutdownContext() {
|
||||||
|
return CommandProcessor::ShutdownContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NullCommandProcessor::PerformSwap(uint32_t frontbuffer_ptr,
|
||||||
|
uint32_t frontbuffer_width,
|
||||||
|
uint32_t frontbuffer_height) {}
|
||||||
|
|
||||||
|
Shader* NullCommandProcessor::LoadShader(ShaderType shader_type,
|
||||||
|
uint32_t guest_address,
|
||||||
|
const uint32_t* host_address,
|
||||||
|
uint32_t dword_count) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NullCommandProcessor::IssueDraw(PrimitiveType prim_type,
|
||||||
|
uint32_t index_count,
|
||||||
|
IndexBufferInfo* index_buffer_info) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NullCommandProcessor::IssueCopy() { return true; }
|
||||||
|
|
||||||
|
} // namespace null
|
||||||
|
} // namespace gpu
|
||||||
|
} // namespace xe
|
|
@ -0,0 +1,48 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* Xenia : Xbox 360 Emulator Research Project *
|
||||||
|
******************************************************************************
|
||||||
|
* Copyright 2016 Ben Vanik. All rights reserved. *
|
||||||
|
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef XENIA_GPU_NULL_NULL_COMMAND_PROCESSOR_H_
|
||||||
|
#define XENIA_GPU_NULL_NULL_COMMAND_PROCESSOR_H_
|
||||||
|
|
||||||
|
#include "xenia/gpu/command_processor.h"
|
||||||
|
#include "xenia/gpu/null/null_graphics_system.h"
|
||||||
|
#include "xenia/gpu/xenos.h"
|
||||||
|
#include "xenia/kernel/kernel_state.h"
|
||||||
|
|
||||||
|
namespace xe {
|
||||||
|
namespace gpu {
|
||||||
|
namespace null {
|
||||||
|
|
||||||
|
class NullCommandProcessor : public CommandProcessor {
|
||||||
|
public:
|
||||||
|
NullCommandProcessor(NullGraphicsSystem* graphics_system,
|
||||||
|
kernel::KernelState* kernel_state);
|
||||||
|
~NullCommandProcessor();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool SetupContext() override;
|
||||||
|
void ShutdownContext() override;
|
||||||
|
|
||||||
|
void PerformSwap(uint32_t frontbuffer_ptr, uint32_t frontbuffer_width,
|
||||||
|
uint32_t frontbuffer_height) override;
|
||||||
|
|
||||||
|
Shader* LoadShader(ShaderType shader_type, uint32_t guest_address,
|
||||||
|
const uint32_t* host_address,
|
||||||
|
uint32_t dword_count) override;
|
||||||
|
|
||||||
|
bool IssueDraw(PrimitiveType prim_type, uint32_t index_count,
|
||||||
|
IndexBufferInfo* index_buffer_info) override;
|
||||||
|
bool IssueCopy() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace null
|
||||||
|
} // namespace gpu
|
||||||
|
} // namespace xe
|
||||||
|
|
||||||
|
#endif // XENIA_GPU_NULL_NULL_COMMAND_PROCESSOR_H_
|
|
@ -0,0 +1,53 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* Xenia : Xbox 360 Emulator Research Project *
|
||||||
|
******************************************************************************
|
||||||
|
* Copyright 2016 Ben Vanik. All rights reserved. *
|
||||||
|
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "xenia/gpu/null/null_graphics_system.h"
|
||||||
|
|
||||||
|
#include "xenia/gpu/null//null_command_processor.h"
|
||||||
|
#include "xenia/ui/vulkan/vulkan_provider.h"
|
||||||
|
#include "xenia/xbox.h"
|
||||||
|
|
||||||
|
namespace xe {
|
||||||
|
namespace gpu {
|
||||||
|
namespace null {
|
||||||
|
|
||||||
|
NullGraphicsSystem::NullGraphicsSystem() {}
|
||||||
|
|
||||||
|
NullGraphicsSystem::~NullGraphicsSystem() {}
|
||||||
|
|
||||||
|
X_STATUS NullGraphicsSystem::Setup(cpu::Processor* processor,
|
||||||
|
kernel::KernelState* kernel_state,
|
||||||
|
ui::Window* target_window) {
|
||||||
|
// This is a null graphics system, but we still setup vulkan because UI needs
|
||||||
|
// it through us :|
|
||||||
|
provider_ = xe::ui::vulkan::VulkanProvider::Create(target_window);
|
||||||
|
|
||||||
|
return GraphicsSystem::Setup(processor, kernel_state, target_window);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NullGraphicsSystem::Shutdown() { GraphicsSystem::Shutdown(); }
|
||||||
|
|
||||||
|
std::unique_ptr<CommandProcessor> NullGraphicsSystem::CreateCommandProcessor() {
|
||||||
|
return std::unique_ptr<CommandProcessor>(
|
||||||
|
new NullCommandProcessor(this, kernel_state_));
|
||||||
|
}
|
||||||
|
|
||||||
|
void NullGraphicsSystem::Swap(xe::ui::UIEvent* e) {
|
||||||
|
if (!command_processor_) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto& swap_state = command_processor_->swap_state();
|
||||||
|
std::lock_guard<std::mutex> lock(swap_state.mutex);
|
||||||
|
swap_state.pending = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace null
|
||||||
|
} // namespace gpu
|
||||||
|
} // namespace xe
|
|
@ -0,0 +1,41 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* Xenia : Xbox 360 Emulator Research Project *
|
||||||
|
******************************************************************************
|
||||||
|
* Copyright 2016 Ben Vanik. All rights reserved. *
|
||||||
|
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef XENIA_GPU_NULL_NULL_GRAPHICS_SYSTEM_H_
|
||||||
|
#define XENIA_GPU_NULL_NULL_GRAPHICS_SYSTEM_H_
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include "xenia/gpu/graphics_system.h"
|
||||||
|
#include "xenia/gpu/command_processor.h"
|
||||||
|
|
||||||
|
namespace xe {
|
||||||
|
namespace gpu {
|
||||||
|
namespace null {
|
||||||
|
|
||||||
|
class NullGraphicsSystem : public GraphicsSystem {
|
||||||
|
public:
|
||||||
|
NullGraphicsSystem();
|
||||||
|
~NullGraphicsSystem() override;
|
||||||
|
|
||||||
|
X_STATUS Setup(cpu::Processor* processor, kernel::KernelState* kernel_state,
|
||||||
|
ui::Window* target_window) override;
|
||||||
|
void Shutdown() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unique_ptr<CommandProcessor> CreateCommandProcessor() override;
|
||||||
|
|
||||||
|
void Swap(xe::ui::UIEvent* e) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace null
|
||||||
|
} // namespace gpu
|
||||||
|
} // namespace xe
|
||||||
|
|
||||||
|
#endif // XENIA_GPU_NULL_NULL_GRAPHICS_SYSTEM_H_
|
|
@ -0,0 +1,21 @@
|
||||||
|
project_root = "../../../.."
|
||||||
|
include(project_root.."/tools/build")
|
||||||
|
|
||||||
|
group("src")
|
||||||
|
project("xenia-gpu-null")
|
||||||
|
uuid("42FCA0B3-4C20-4532-95E9-07D297013BE4")
|
||||||
|
kind("StaticLib")
|
||||||
|
language("C++")
|
||||||
|
links({
|
||||||
|
"xenia-base",
|
||||||
|
"xenia-gpu",
|
||||||
|
"xenia-ui",
|
||||||
|
"xenia-ui-vulkan",
|
||||||
|
"xxhash",
|
||||||
|
})
|
||||||
|
defines({
|
||||||
|
})
|
||||||
|
includedirs({
|
||||||
|
project_root.."/third_party/gflags/src",
|
||||||
|
})
|
||||||
|
local_platform_files()
|
Loading…
Reference in New Issue