vk open icd

This commit is contained in:
lizzie
2026-08-28 19:04:24 +00:00
parent 0f15e5f8a7
commit f3cb65df4b
5 changed files with 27 additions and 7 deletions
+1 -1
View File
@@ -298,7 +298,7 @@ private:
std::size_t bytes_written = 0;
bool enabled = true;
};
#endif
#ifdef _WIN32
/// @brief Backend that writes to Visual Studio's output window
struct DebuggerBackend final : public Backend {
@@ -115,9 +115,19 @@ void RemoveUnavailableLayers(const vk::InstanceDispatch& dld, std::vector<const
}
} // Anonymous namespace
#ifdef __OPENORBIS__
extern "C" {
extern PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(VkInstance instance, const char *pName);
}
#endif
vk::Instance CreateInstance(const Common::DynamicLibrary& library, vk::InstanceDispatch& dld,
u32 required_version, Core::Frontend::WindowSystemType window_type,
bool enable_validation) {
// ps4 doesn't have dlopen() or equivalent, Vulkan is directly shipped with the emu
#ifdef __OPENORBIS__
dld.vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)vk_icdGetInstanceProcAddr;
#else
if (!library.IsOpen()) {
LOG_ERROR(Render_Vulkan, "Vulkan library not available");
throw vk::Exception(VK_ERROR_INITIALIZATION_FAILED);
@@ -126,6 +136,7 @@ vk::Instance CreateInstance(const Common::DynamicLibrary& library, vk::InstanceD
LOG_ERROR(Render_Vulkan, "vkGetInstanceProcAddr not present in Vulkan");
throw vk::Exception(VK_ERROR_INITIALIZATION_FAILED);
}
#endif
if (!vk::Load(dld)) {
LOG_ERROR(Render_Vulkan, "Failed to load Vulkan function pointers");
throw vk::Exception(VK_ERROR_INITIALIZATION_FAILED);
@@ -13,9 +13,11 @@
namespace Vulkan {
std::shared_ptr<Common::DynamicLibrary> OpenLibrary(
[[maybe_unused]] Core::Frontend::GraphicsContext* context) {
std::shared_ptr<Common::DynamicLibrary> OpenLibrary([[maybe_unused]] Core::Frontend::GraphicsContext* context) {
LOG_DEBUG(Render_Vulkan, "Looking for a Vulkan library");
#if defined(__OPENORBIS__)
return std::make_shared<Common::DynamicLibrary>();
#else
#if defined(__ANDROID__) && defined(ARCHITECTURE_arm64)
// Android manages its Vulkan driver from the frontend.
return context->GetDriverLibrary();
@@ -46,6 +48,7 @@ std::shared_ptr<Common::DynamicLibrary> OpenLibrary(
#endif
return library;
#endif
#endif
}
} // namespace Vulkan
+6 -4
View File
@@ -26,10 +26,12 @@
EmuWindow_SDL3::EmuWindow_SDL3(InputCommon::InputSubsystem* input_subsystem_, Core::System& system_)
: input_subsystem{input_subsystem_}, system{system_} {
input_subsystem->Initialize();
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD)) {
LOG_CRITICAL(Frontend, "Failed to initialize SDL3: {}, Exiting...", SDL_GetError());
exit(1);
}
if (!SDL_InitSubSystem(SDL_INIT_VIDEO))
LOG_CRITICAL(Frontend, "SDL_INIT_VIDEO: {}", SDL_GetError());
if (!SDL_InitSubSystem(SDL_INIT_JOYSTICK))
LOG_CRITICAL(Frontend, "SDL_INIT_JOYSTICK: {}", SDL_GetError());
if (!SDL_InitSubSystem(SDL_INIT_GAMEPAD))
LOG_CRITICAL(Frontend, "SDL_INIT_GAMEPAD: {}", SDL_GetError());
titlebar_timer = SDL_AddTimer(2000, [](void *userdata, SDL_TimerID, Uint32) -> Uint32 {
auto* this_ = (EmuWindow_SDL3*)userdata;
auto const results = this_->system.GetAndResetPerfStats();
@@ -81,8 +81,12 @@ EmuWindow_SDL3_VK::EmuWindow_SDL3_VK(InputCommon::InputSubsystem* input_subsyste
window_info.type = Core::Frontend::WindowSystemType::Android;
window_info.render_surface = android_window;
} else {
#ifdef __OPENORBIS__
window_info.type = Core::Frontend::WindowSystemType::Headless;
#else
LOG_CRITICAL(Frontend, "Unable to determine native window backend from SDL properties");
std::exit(EXIT_FAILURE);
#endif
}
OnResize();