Mercurial > games > semicongine
diff src/vulkan_helpers.nim @ 4:af9183acb173
did: refactor, add resizing, proper cleanup
author | Sam <sam@basx.dev> |
---|---|
date | Tue, 20 Dec 2022 00:28:05 +0700 |
parents | 213fdf8d31dd |
children | 4ed9cb098315 |
line wrap: on
line diff
--- a/src/vulkan_helpers.nim Mon Dec 19 10:56:04 2022 +0700 +++ b/src/vulkan_helpers.nim Tue Dec 20 00:28:05 2022 +0700 @@ -16,8 +16,8 @@ when defined(release): discard call else: + debug(&"CALLING vulkan: {astToStr(call)}") let value = call - debug(&"CALLING vulkan: {astToStr(call)}") if value != VK_SUCCESS: raise newException(Exception, "Vulkan error: " & astToStr(call) & " returned " & $value) @@ -31,6 +31,12 @@ if format.format == VK_FORMAT_B8G8R8A8_SRGB and format.colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR: result.add(format) +proc getSuitableSurfaceFormat*(formats: seq[VkSurfaceFormatKHR]): VkSurfaceFormatKHR = + let usableSurfaceFormats = filterForSurfaceFormat(formats) + if len(usableSurfaceFormats) == 0: + raise newException(Exception, "No suitable surface formats found") + return usableSurfaceFormats[0] + proc cleanString*(str: openArray[char]): string = for i in 0 ..< len(str):