mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-08 23:25:40 +12:00
Remove ownership of SDL's vulkan-surface
This surface is managed by SDL itself, so there is no need to keep it in a Unique handle for us to delete. Fixes the bug where vulkan crashes during shutdown.
This commit is contained in:
parent
e3699fe8f8
commit
e87db99a97
2 changed files with 7 additions and 8 deletions
|
@ -10,7 +10,7 @@ class RendererVK final : public Renderer {
|
||||||
vk::UniqueInstance instance = {};
|
vk::UniqueInstance instance = {};
|
||||||
vk::UniqueDebugUtilsMessengerEXT debugMessenger = {};
|
vk::UniqueDebugUtilsMessengerEXT debugMessenger = {};
|
||||||
|
|
||||||
vk::UniqueSurfaceKHR surface = {};
|
vk::SurfaceKHR surface = {};
|
||||||
|
|
||||||
vk::PhysicalDevice physicalDevice = {};
|
vk::PhysicalDevice physicalDevice = {};
|
||||||
|
|
||||||
|
|
|
@ -199,7 +199,7 @@ void RendererVK::display() {
|
||||||
swapchainExtent.width = windowWidth;
|
swapchainExtent.width = windowWidth;
|
||||||
swapchainExtent.height = windowHeight;
|
swapchainExtent.height = windowHeight;
|
||||||
}
|
}
|
||||||
recreateSwapchain(surface.get(), swapchainExtent);
|
recreateSwapchain(surface, swapchainExtent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
|
@ -356,7 +356,7 @@ void RendererVK::display() {
|
||||||
swapchainExtent.width = windowWidth;
|
swapchainExtent.width = windowWidth;
|
||||||
swapchainExtent.height = windowHeight;
|
swapchainExtent.height = windowHeight;
|
||||||
}
|
}
|
||||||
recreateSwapchain(surface.get(), swapchainExtent);
|
recreateSwapchain(surface, swapchainExtent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
|
@ -445,7 +445,7 @@ void RendererVK::initGraphicsContext(SDL_Window* window) {
|
||||||
// Create surface
|
// Create surface
|
||||||
if (window) {
|
if (window) {
|
||||||
if (VkSurfaceKHR newSurface; SDL_Vulkan_CreateSurface(window, instance.get(), &newSurface)) {
|
if (VkSurfaceKHR newSurface; SDL_Vulkan_CreateSurface(window, instance.get(), &newSurface)) {
|
||||||
surface.reset(newSurface);
|
surface = newSurface;
|
||||||
} else {
|
} else {
|
||||||
Helpers::warn("Error creating Vulkan surface");
|
Helpers::warn("Error creating Vulkan surface");
|
||||||
}
|
}
|
||||||
|
@ -461,8 +461,7 @@ void RendererVK::initGraphicsContext(SDL_Window* window) {
|
||||||
const auto surfaceSupport = [this](const vk::PhysicalDevice& physicalDevice) -> bool {
|
const auto surfaceSupport = [this](const vk::PhysicalDevice& physicalDevice) -> bool {
|
||||||
const usize queueCount = physicalDevice.getQueueFamilyProperties().size();
|
const usize queueCount = physicalDevice.getQueueFamilyProperties().size();
|
||||||
for (usize queueIndex = 0; queueIndex < queueCount; ++queueIndex) {
|
for (usize queueIndex = 0; queueIndex < queueCount; ++queueIndex) {
|
||||||
if (auto supportResult = physicalDevice.getSurfaceSupportKHR(queueIndex, surface.get());
|
if (auto supportResult = physicalDevice.getSurfaceSupportKHR(queueIndex, surface); supportResult.result == vk::Result::eSuccess) {
|
||||||
supportResult.result == vk::Result::eSuccess) {
|
|
||||||
return supportResult.value;
|
return supportResult.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -494,7 +493,7 @@ void RendererVK::initGraphicsContext(SDL_Window* window) {
|
||||||
// Get present queue family
|
// Get present queue family
|
||||||
if (surface) {
|
if (surface) {
|
||||||
for (usize queueFamilyIndex = 0; queueFamilyIndex < queueFamilyProperties.size(); ++queueFamilyIndex) {
|
for (usize queueFamilyIndex = 0; queueFamilyIndex < queueFamilyProperties.size(); ++queueFamilyIndex) {
|
||||||
if (auto supportResult = physicalDevice.getSurfaceSupportKHR(queueFamilyIndex, surface.get());
|
if (auto supportResult = physicalDevice.getSurfaceSupportKHR(queueFamilyIndex, surface);
|
||||||
supportResult.result == vk::Result::eSuccess) {
|
supportResult.result == vk::Result::eSuccess) {
|
||||||
if (supportResult.value) {
|
if (supportResult.value) {
|
||||||
presentQueueFamily = queueFamilyIndex;
|
presentQueueFamily = queueFamilyIndex;
|
||||||
|
@ -594,7 +593,7 @@ void RendererVK::initGraphicsContext(SDL_Window* window) {
|
||||||
swapchainExtent.width = windowWidth;
|
swapchainExtent.width = windowWidth;
|
||||||
swapchainExtent.height = windowHeight;
|
swapchainExtent.height = windowHeight;
|
||||||
}
|
}
|
||||||
recreateSwapchain(surface.get(), swapchainExtent);
|
recreateSwapchain(surface, swapchainExtent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create frame-buffering data
|
// Create frame-buffering data
|
||||||
|
|
Loading…
Add table
Reference in a new issue