Warn on failed surface creation for vulkan

Vulkan can technically work just fine without presenting to the user, so
consider these failed window procedures as "warnings" during iteration.
This commit is contained in:
Wunkolo 2023-07-18 22:38:08 -07:00
parent 444d50eaf5
commit c7a93c4f52
3 changed files with 9 additions and 4 deletions

View file

@ -8,6 +8,8 @@ class RendererVK final : public Renderer {
vk::PhysicalDevice physicalDevice = {};
vk::UniqueDevice device = {};
vk::UniqueSurfaceKHR surface = {};
vk::UniqueDebugUtilsMessengerEXT debugMessenger;
public:

View file

@ -35,7 +35,7 @@ void RendererVK::initGraphicsContext(SDL_Window* window) {
#if defined(__APPLE__)
VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME,
#endif
VK_EXT_DEBUG_UTILS_EXTENSION_NAME,
VK_EXT_DEBUG_UTILS_EXTENSION_NAME,
});
#if defined(__APPLE__)
@ -131,8 +131,11 @@ void RendererVK::initGraphicsContext(SDL_Window* window) {
// Initialize device-specific function pointers
VULKAN_HPP_DEFAULT_DISPATCHER.init(device.get());
VkSurfaceKHR surface;
SDL_Vulkan_CreateSurface(window, instance.get(), &surface);
if (VkSurfaceKHR newSurface; SDL_Vulkan_CreateSurface(window, instance.get(), &newSurface)) {
surface.reset(newSurface);
} else {
Helpers::warn("Error creating Vulkan surface");
}
}
void RendererVK::clearBuffer(u32 startAddress, u32 endAddress, u32 value, u32 control) {}

View file

@ -57,7 +57,7 @@ Emulator::Emulator()
window = SDL_CreateWindow("Alber", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, SDL_WINDOW_VULKAN);
if (window == nullptr) {
// Helpers::panic("Window creation failed: %s", SDL_GetError());
Helpers::warn("Window creation failed: %s", SDL_GetError());
}
}
#endif