From 97a704214374b171bd9e8657694f56c57a0655dc Mon Sep 17 00:00:00 2001 From: niki Date: Sat, 12 Nov 2022 03:24:07 +0100 Subject: [PATCH] vulkan: remove instanceVersion class member This is not actually needed. The api version specified when creating the vulkan instance should be the highest api version that might be used by the application, which can be higher than the supported instance version. VMA can make use of vulkan 1.3 features so this can be hardcoded to VK_API_VERSION_1_3. --- src/modules/graphics/vulkan/Graphics.cpp | 35 ++---------------------- src/modules/graphics/vulkan/Graphics.h | 1 - 2 files changed, 3 insertions(+), 33 deletions(-) diff --git a/src/modules/graphics/vulkan/Graphics.cpp b/src/modules/graphics/vulkan/Graphics.cpp index f1d77c9ad..8e3e85005 100644 --- a/src/modules/graphics/vulkan/Graphics.cpp +++ b/src/modules/graphics/vulkan/Graphics.cpp @@ -81,8 +81,6 @@ Graphics::Graphics() throw love::Exception("could not find vulkan"); volkInitializeCustom((PFN_vkGetInstanceProcAddr)SDL_Vulkan_GetVkGetInstanceProcAddr()); - - instanceVersion = volkGetInstanceVersion(); } Graphics::~Graphics() @@ -599,7 +597,7 @@ void Graphics::unSetMode() renderPassUsages.clear(); framebufferUsages.clear(); pipelineUsages.clear(); - + created = false; vkDeviceWaitIdle(device); Volatile::unloadAll(); @@ -673,34 +671,7 @@ Graphics::RendererInfo Graphics::getRendererInfo() const Graphics::RendererInfo info; - if (isDebugEnabled()) - { - std::stringstream ss; - ss << "Vulkan( "; - ss << renderPasses.size() << " "; - ss << framebuffers.size() << " "; - ss << graphicsPipelines.size() << " "; - if (optionalDeviceFeatures.extendedDynamicState) - ss << "eds "; - if (optionalDeviceFeatures.memoryRequirements2) - ss << "mr2 "; - if (optionalDeviceFeatures.dedicatedAllocation) - ss << "da "; - if (optionalDeviceFeatures.bufferDeviceAddress) - ss << "bda "; - if (optionalDeviceFeatures.memoryBudget) - ss << "mb "; - if (optionalDeviceFeatures.shaderFloatControls) - ss << "sfc "; - if (optionalDeviceFeatures.spirv14) - ss << "spv14 "; - ss << ")"; - - info.name = ss.str(); - } - else - info.name = "Vulkan"; - + info.name = "Vulkan"; info.device = deviceProperties.deviceName; info.vendor = Vulkan::getVendorName(deviceProperties.vendorID); info.version = Vulkan::getVulkanApiVersion(deviceProperties.apiVersion); @@ -1295,7 +1266,7 @@ void Graphics::createVulkanInstance() appInfo.applicationVersion = VK_MAKE_API_VERSION(0, 1, 0, 0); // get this version from somewhere else? appInfo.pEngineName = "LOVE Game Framework"; appInfo.engineVersion = VK_MAKE_API_VERSION(0, VERSION_MAJOR, VERSION_MINOR, VERSION_REV); - appInfo.apiVersion = instanceVersion; + appInfo.apiVersion = VK_API_VERSION_1_3; VkInstanceCreateInfo createInfo{}; createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; diff --git a/src/modules/graphics/vulkan/Graphics.h b/src/modules/graphics/vulkan/Graphics.h index 34f276fd6..c601d7893 100644 --- a/src/modules/graphics/vulkan/Graphics.h +++ b/src/modules/graphics/vulkan/Graphics.h @@ -365,7 +365,6 @@ private: VkSampler createSampler(const SamplerState &sampler); void cleanupUnusedObjects(); - uint32_t instanceVersion = VK_API_VERSION_1_0; VkInstance instance = VK_NULL_HANDLE; VkPhysicalDevice physicalDevice = VK_NULL_HANDLE; uint32_t deviceApiVersion = VK_API_VERSION_1_0;