[Vulkan] Refactoring and fixes for VulkanProvider and related areas

Enable portability subset physical device enumeration.

Don't use Vulkan 1.1+ logical devices on Vulkan 1.0 instances due to the
VkApplicationInfo::apiVersion specification.

Make sure all extension dependencies are enabled when creating a device.

Prefer exposing feature support over extension support via the device
interface to avoid causing confusion with regard to promoted extensions
(especially those that required some features as extensions, but had those
features made optional when they were promoted).

Allow creating presentation-only devices, not demanding any optional
features beyond the basic Vulkan 1.0, for use cases such as internal tools
or CPU rendering.

Require the independentBlend feature for GPU emulation as working around is
complicated, while support is almost ubiquitous.

Move the graphics system initialization fatal error message to xenia_main
after attempting to initialize all implementations, for automatic fallback
to other implementations in the future.

Log Vulkan driver info.

Improve Vulkan debug message logging, enabled by default.

Refactor code, with simplified logic for enabling extensions and layers.
This commit is contained in:
Triang3l
2025-08-12 23:21:59 +03:00
parent a06be03f1b
commit b5432ab83f
70 changed files with 3238 additions and 2757 deletions

View File

@@ -336,13 +336,42 @@ std::unique_ptr<gpu::GraphicsSystem> EmulatorApp::CreateGraphicsSystem() {
// For maintainability, as much implementation code as possible should be
// placed in `xe::gpu` and shared between the backends rather than duplicated
// between them.
const std::string gpu_implementation_name = cvars::gpu;
if (gpu_implementation_name == "null") {
return std::make_unique<gpu::null::NullGraphicsSystem>();
}
Factory<gpu::GraphicsSystem> factory;
#if XE_PLATFORM_WIN32
factory.Add<gpu::d3d12::D3D12GraphicsSystem>("d3d12");
#endif // XE_PLATFORM_WIN32
factory.Add<gpu::vulkan::VulkanGraphicsSystem>("vulkan");
factory.Add<gpu::null::NullGraphicsSystem>("null");
return factory.Create(cvars::gpu);
std::unique_ptr<gpu::GraphicsSystem> gpu_implementation =
factory.Create(gpu_implementation_name);
if (!gpu_implementation) {
xe::FatalError(
"Unable to initialize the graphics subsystem.\n"
"\n"
#if XE_PLATFORM_ANDROID
"The GPU must support at least Vulkan 1.0 with the 'independentBlend' "
"feature.\n"
"\n"
#else
#if XE_PLATFORM_WIN32
"For Direct3D 12, at least Windows 10 is required, and the GPU must be "
"compatible with Direct3D 12 feature level 11_0.\n"
"\n"
#endif // XE_PLATFORM_WIN32
"For Vulkan, the Vulkan runtime must be installed, and the GPU must "
"support at least Vulkan 1.0. The Vulkan runtime can be downloaded at "
"https://vulkan.lunarg.com/sdk/home.\n"
"\n"
"Also, ensure that you have the latest driver installed for your GPU.\n"
"\n"
#endif // XE_PLATFORM_ANDROID
"See https://xenia.jp/faq/ for more information and the system "
"requirements.");
}
return gpu_implementation;
}
std::vector<std::unique_ptr<hid::InputDriver>> EmulatorApp::CreateInputDrivers(