diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-01-21 21:41:09 +0100 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-01-29 21:53:11 +0100 |
commit | c29584a0906e4d9a624b58467a74ff9d04c8d5de (patch) | |
tree | 3a763858b1fca87ba99d6001a3dfbd7a6852500f | |
parent | yuzu: Implement Vulkan frontend (diff) | |
download | yuzu-c29584a0906e4d9a624b58467a74ff9d04c8d5de.tar yuzu-c29584a0906e4d9a624b58467a74ff9d04c8d5de.tar.gz yuzu-c29584a0906e4d9a624b58467a74ff9d04c8d5de.tar.bz2 yuzu-c29584a0906e4d9a624b58467a74ff9d04c8d5de.tar.lz yuzu-c29584a0906e4d9a624b58467a74ff9d04c8d5de.tar.xz yuzu-c29584a0906e4d9a624b58467a74ff9d04c8d5de.tar.zst yuzu-c29584a0906e4d9a624b58467a74ff9d04c8d5de.zip |
-rw-r--r-- | src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp | 15 | ||||
-rw-r--r-- | src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h | 4 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp index 89e736ef6..a203f0da9 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp @@ -82,19 +82,19 @@ EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(bool fullscreen) : EmuWindow_SDL2(fullscree const auto vkCreateInstance = reinterpret_cast<PFN_vkCreateInstance>(vkGetInstanceProcAddr(nullptr, "vkCreateInstance")); if (vkCreateInstance == nullptr || - vkCreateInstance(&instance_ci, nullptr, &instance) != VK_SUCCESS) { + vkCreateInstance(&instance_ci, nullptr, &vk_instance) != VK_SUCCESS) { LOG_CRITICAL(Frontend, "Failed to create Vulkan instance!"); exit(EXIT_FAILURE); } vkDestroyInstance = reinterpret_cast<PFN_vkDestroyInstance>( - vkGetInstanceProcAddr(instance, "vkDestroyInstance")); + vkGetInstanceProcAddr(vk_instance, "vkDestroyInstance")); if (vkDestroyInstance == nullptr) { LOG_CRITICAL(Frontend, "Failed to retrieve Vulkan function pointer!"); exit(EXIT_FAILURE); } - if (!SDL_Vulkan_CreateSurface(render_window, instance, &surface)) { + if (!SDL_Vulkan_CreateSurface(render_window, vk_instance, &vk_surface)) { LOG_CRITICAL(Frontend, "Failed to create Vulkan surface! {}", SDL_GetError()); exit(EXIT_FAILURE); } @@ -107,7 +107,7 @@ EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(bool fullscreen) : EmuWindow_SDL2(fullscree } EmuWindow_SDL2_VK::~EmuWindow_SDL2_VK() { - vkDestroyInstance(instance, nullptr); + vkDestroyInstance(vk_instance, nullptr); } void EmuWindow_SDL2_VK::SwapBuffers() {} @@ -122,9 +122,10 @@ void EmuWindow_SDL2_VK::DoneCurrent() { void EmuWindow_SDL2_VK::RetrieveVulkanHandlers(void* get_instance_proc_addr, void* instance, void* surface) const { - std::memcpy(get_instance_proc_addr, vkGetInstanceProcAddr, sizeof(vkGetInstanceProcAddr)); - std::memcpy(instance, &this->instance, sizeof(this->instance)); - std::memcpy(surface, &this->surface, sizeof(this->surface)); + const auto instance_proc_addr = vkGetInstanceProcAddr; + std::memcpy(get_instance_proc_addr, &instance_proc_addr, sizeof(instance_proc_addr)); + std::memcpy(instance, &vk_instance, sizeof(vk_instance)); + std::memcpy(surface, &vk_surface, sizeof(vk_surface)); } std::unique_ptr<Core::Frontend::GraphicsContext> EmuWindow_SDL2_VK::CreateSharedContext() const { diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h index f7234841b..2a7c06a24 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h @@ -31,8 +31,8 @@ public: private: bool UseStandardLayers(PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr) const; - VkInstance instance{}; - VkSurfaceKHR surface{}; + VkInstance vk_instance{}; + VkSurfaceKHR vk_surface{}; PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr{}; PFN_vkDestroyInstance vkDestroyInstance{}; |