This commit is contained in:
2026-07-11 10:49:24 +01:00
parent c8680f06c2
commit 943f00345c
+9 -10
View File
@@ -313,9 +313,7 @@ VkPhysicalDeviceType _toVkPhysicalDeviceType(PrRhiPhysicalDeviceType type) {
// ============================================================================ // ============================================================================
PrRhiInstance *prRhiCreateInstanceVk(PrRhiInstanceDesc desc, WpAllocator *allocator) { PrRhiInstance *prRhiCreateInstanceVk(PrRhiInstanceDesc desc, WpAllocator *allocator) {
(void)desc; _checkVk(volkInitialize(), "volkInitialize");
volkInitialize();
VkBool32 supported = VK_FALSE; VkBool32 supported = VK_FALSE;
_checkVk(vpGetInstanceProfileSupport(NULL, &_profile, &supported), "vpGetInstanceProfileSupport"); _checkVk(vpGetInstanceProfileSupport(NULL, &_profile, &supported), "vpGetInstanceProfileSupport");
@@ -323,14 +321,15 @@ PrRhiInstance *prRhiCreateInstanceVk(PrRhiInstanceDesc desc, WpAllocator *alloca
u32 sdl_ext_count = 0; u32 sdl_ext_count = 0;
const char *const *sdl_exts = SDL_Vulkan_GetInstanceExtensions(&sdl_ext_count); const char *const *sdl_exts = SDL_Vulkan_GetInstanceExtensions(&sdl_ext_count);
if (!sdl_exts || sdl_ext_count == 0) if (!sdl_exts || sdl_ext_count == 0) {
_abort("SDL_Vulkan_GetInstanceExtensions failed"); _abort("SDL_Vulkan_GetInstanceExtensions failed");
}
VkApplicationInfo app_info = {}; VkApplicationInfo app_info = {};
app_info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; app_info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
app_info.pApplicationName = desc.app_name ? desc.app_name : "Prism"; app_info.pApplicationName = desc.app_name ? desc.app_name : "Prism";
app_info.applicationVersion = desc.app_version; app_info.applicationVersion = desc.app_version;
app_info.apiVersion = VP_PRISM_DESKTOP_2026_MIN_API_VERSION; app_info.apiVersion = VP_PRISM_DESKTOP_2026_MIN_API_VERSION;
VkInstanceCreateInfo instance_info = {}; VkInstanceCreateInfo instance_info = {};
instance_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; instance_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
@@ -349,7 +348,7 @@ PrRhiInstance *prRhiCreateInstanceVk(PrRhiInstanceDesc desc, WpAllocator *alloca
volkLoadInstance(vk_instance); volkLoadInstance(vk_instance);
PrRhiInstance *inst = wpMemAllocatorAlloc(allocator, sizeof(PrRhiInstance)); PrRhiInstance *inst = wpMemAllocatorAlloc(allocator, sizeof(PrRhiInstance));
if (!inst) _abort("alloc failed for PrRhiInstance"); if (!inst) { _abort("alloc failed for PrRhiInstance"); }
inst->handle = vk_instance; inst->handle = vk_instance;
inst->debug_messenger = NULL; inst->debug_messenger = NULL;
@@ -357,7 +356,7 @@ PrRhiInstance *prRhiCreateInstanceVk(PrRhiInstanceDesc desc, WpAllocator *alloca
} }
void prRhiDestroyInstanceVk(PrRhiInstance *inst, WpAllocator *allocator) { void prRhiDestroyInstanceVk(PrRhiInstance *inst, WpAllocator *allocator) {
if (!inst) return; if (!inst) { return; }
vkDestroyInstance((VkInstance)inst->handle, NULL); vkDestroyInstance((VkInstance)inst->handle, NULL);
wpMemAllocatorFree(allocator, (void**)&inst, sizeof(PrRhiInstance)); wpMemAllocatorFree(allocator, (void**)&inst, sizeof(PrRhiInstance));
} }