mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-08-31 18:46:08 +00:00
vk open icd
This commit is contained in:
@@ -298,7 +298,7 @@ private:
|
|||||||
std::size_t bytes_written = 0;
|
std::size_t bytes_written = 0;
|
||||||
bool enabled = true;
|
bool enabled = true;
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
/// @brief Backend that writes to Visual Studio's output window
|
/// @brief Backend that writes to Visual Studio's output window
|
||||||
struct DebuggerBackend final : public Backend {
|
struct DebuggerBackend final : public Backend {
|
||||||
|
|||||||
@@ -115,9 +115,19 @@ void RemoveUnavailableLayers(const vk::InstanceDispatch& dld, std::vector<const
|
|||||||
}
|
}
|
||||||
} // Anonymous namespace
|
} // 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,
|
vk::Instance CreateInstance(const Common::DynamicLibrary& library, vk::InstanceDispatch& dld,
|
||||||
u32 required_version, Core::Frontend::WindowSystemType window_type,
|
u32 required_version, Core::Frontend::WindowSystemType window_type,
|
||||||
bool enable_validation) {
|
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()) {
|
if (!library.IsOpen()) {
|
||||||
LOG_ERROR(Render_Vulkan, "Vulkan library not available");
|
LOG_ERROR(Render_Vulkan, "Vulkan library not available");
|
||||||
throw vk::Exception(VK_ERROR_INITIALIZATION_FAILED);
|
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");
|
LOG_ERROR(Render_Vulkan, "vkGetInstanceProcAddr not present in Vulkan");
|
||||||
throw vk::Exception(VK_ERROR_INITIALIZATION_FAILED);
|
throw vk::Exception(VK_ERROR_INITIALIZATION_FAILED);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (!vk::Load(dld)) {
|
if (!vk::Load(dld)) {
|
||||||
LOG_ERROR(Render_Vulkan, "Failed to load Vulkan function pointers");
|
LOG_ERROR(Render_Vulkan, "Failed to load Vulkan function pointers");
|
||||||
throw vk::Exception(VK_ERROR_INITIALIZATION_FAILED);
|
throw vk::Exception(VK_ERROR_INITIALIZATION_FAILED);
|
||||||
|
|||||||
@@ -13,9 +13,11 @@
|
|||||||
|
|
||||||
namespace Vulkan {
|
namespace Vulkan {
|
||||||
|
|
||||||
std::shared_ptr<Common::DynamicLibrary> OpenLibrary(
|
std::shared_ptr<Common::DynamicLibrary> OpenLibrary([[maybe_unused]] Core::Frontend::GraphicsContext* context) {
|
||||||
[[maybe_unused]] Core::Frontend::GraphicsContext* context) {
|
|
||||||
LOG_DEBUG(Render_Vulkan, "Looking for a Vulkan library");
|
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)
|
#if defined(__ANDROID__) && defined(ARCHITECTURE_arm64)
|
||||||
// Android manages its Vulkan driver from the frontend.
|
// Android manages its Vulkan driver from the frontend.
|
||||||
return context->GetDriverLibrary();
|
return context->GetDriverLibrary();
|
||||||
@@ -46,6 +48,7 @@ std::shared_ptr<Common::DynamicLibrary> OpenLibrary(
|
|||||||
#endif
|
#endif
|
||||||
return library;
|
return library;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Vulkan
|
} // namespace Vulkan
|
||||||
|
|||||||
@@ -26,10 +26,12 @@
|
|||||||
EmuWindow_SDL3::EmuWindow_SDL3(InputCommon::InputSubsystem* input_subsystem_, Core::System& system_)
|
EmuWindow_SDL3::EmuWindow_SDL3(InputCommon::InputSubsystem* input_subsystem_, Core::System& system_)
|
||||||
: input_subsystem{input_subsystem_}, system{system_} {
|
: input_subsystem{input_subsystem_}, system{system_} {
|
||||||
input_subsystem->Initialize();
|
input_subsystem->Initialize();
|
||||||
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD)) {
|
if (!SDL_InitSubSystem(SDL_INIT_VIDEO))
|
||||||
LOG_CRITICAL(Frontend, "Failed to initialize SDL3: {}, Exiting...", SDL_GetError());
|
LOG_CRITICAL(Frontend, "SDL_INIT_VIDEO: {}", SDL_GetError());
|
||||||
exit(1);
|
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 {
|
titlebar_timer = SDL_AddTimer(2000, [](void *userdata, SDL_TimerID, Uint32) -> Uint32 {
|
||||||
auto* this_ = (EmuWindow_SDL3*)userdata;
|
auto* this_ = (EmuWindow_SDL3*)userdata;
|
||||||
auto const results = this_->system.GetAndResetPerfStats();
|
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.type = Core::Frontend::WindowSystemType::Android;
|
||||||
window_info.render_surface = android_window;
|
window_info.render_surface = android_window;
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef __OPENORBIS__
|
||||||
|
window_info.type = Core::Frontend::WindowSystemType::Headless;
|
||||||
|
#else
|
||||||
LOG_CRITICAL(Frontend, "Unable to determine native window backend from SDL properties");
|
LOG_CRITICAL(Frontend, "Unable to determine native window backend from SDL properties");
|
||||||
std::exit(EXIT_FAILURE);
|
std::exit(EXIT_FAILURE);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
OnResize();
|
OnResize();
|
||||||
|
|||||||
Reference in New Issue
Block a user