yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

yuzu_cmd: Fix memcpy on Vulkan handlers

This commit is contained in:
ReinUsesLisp 2020-01-21 17:41:09 -03:00
parent f92cbc5501
commit c29584a090
2 changed files with 10 additions and 9 deletions

View File

@ -82,19 +82,19 @@ EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(bool fullscreen) : EmuWindow_SDL2(fullscree
const auto vkCreateInstance = const auto vkCreateInstance =
reinterpret_cast<PFN_vkCreateInstance>(vkGetInstanceProcAddr(nullptr, "vkCreateInstance")); reinterpret_cast<PFN_vkCreateInstance>(vkGetInstanceProcAddr(nullptr, "vkCreateInstance"));
if (vkCreateInstance == nullptr || 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!"); LOG_CRITICAL(Frontend, "Failed to create Vulkan instance!");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
vkDestroyInstance = reinterpret_cast<PFN_vkDestroyInstance>( vkDestroyInstance = reinterpret_cast<PFN_vkDestroyInstance>(
vkGetInstanceProcAddr(instance, "vkDestroyInstance")); vkGetInstanceProcAddr(vk_instance, "vkDestroyInstance"));
if (vkDestroyInstance == nullptr) { if (vkDestroyInstance == nullptr) {
LOG_CRITICAL(Frontend, "Failed to retrieve Vulkan function pointer!"); LOG_CRITICAL(Frontend, "Failed to retrieve Vulkan function pointer!");
exit(EXIT_FAILURE); 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()); LOG_CRITICAL(Frontend, "Failed to create Vulkan surface! {}", SDL_GetError());
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -107,7 +107,7 @@ EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(bool fullscreen) : EmuWindow_SDL2(fullscree
} }
EmuWindow_SDL2_VK::~EmuWindow_SDL2_VK() { EmuWindow_SDL2_VK::~EmuWindow_SDL2_VK() {
vkDestroyInstance(instance, nullptr); vkDestroyInstance(vk_instance, nullptr);
} }
void EmuWindow_SDL2_VK::SwapBuffers() {} 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 EmuWindow_SDL2_VK::RetrieveVulkanHandlers(void* get_instance_proc_addr, void* instance,
void* surface) const { void* surface) const {
std::memcpy(get_instance_proc_addr, vkGetInstanceProcAddr, sizeof(vkGetInstanceProcAddr)); const auto instance_proc_addr = vkGetInstanceProcAddr;
std::memcpy(instance, &this->instance, sizeof(this->instance)); std::memcpy(get_instance_proc_addr, &instance_proc_addr, sizeof(instance_proc_addr));
std::memcpy(surface, &this->surface, sizeof(this->surface)); 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 { std::unique_ptr<Core::Frontend::GraphicsContext> EmuWindow_SDL2_VK::CreateSharedContext() const {

View File

@ -31,8 +31,8 @@ public:
private: private:
bool UseStandardLayers(PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr) const; bool UseStandardLayers(PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr) const;
VkInstance instance{}; VkInstance vk_instance{};
VkSurfaceKHR surface{}; VkSurfaceKHR vk_surface{};
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr{}; PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr{};
PFN_vkDestroyInstance vkDestroyInstance{}; PFN_vkDestroyInstance vkDestroyInstance{};