From d14be3b7878281469b28eac293c4e03e5c81459a Mon Sep 17 00:00:00 2001 From: SRSaunders <82544213+SRSaunders@users.noreply.github.com> Date: Sun, 9 Mar 2025 07:48:00 -0400 Subject: [PATCH] Fix a few compiler warnings and startup/validation issues at runtime (#1193) * Add error recovery to trianglevulkan13 and fix missing "override" compiler warnings * Look for vkGetPhysicalDeviceFormatProperties2KHR in hostimagecopy example * Enable fragmentStoresAndAtomics feature to avoid VVL warning in subpasses example --- examples/hostimagecopy/hostimagecopy.cpp | 2 +- examples/subpasses/subpasses.cpp | 2 ++ examples/trianglevulkan13/trianglevulkan13.cpp | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/examples/hostimagecopy/hostimagecopy.cpp b/examples/hostimagecopy/hostimagecopy.cpp index a2dfffda..cad565c5 100644 --- a/examples/hostimagecopy/hostimagecopy.cpp +++ b/examples/hostimagecopy/hostimagecopy.cpp @@ -419,7 +419,7 @@ public: // Get the function pointers required host image copies vkCopyMemoryToImageEXT = reinterpret_cast(vkGetDeviceProcAddr(device, "vkCopyMemoryToImageEXT")); vkTransitionImageLayoutEXT = reinterpret_cast(vkGetDeviceProcAddr(device, "vkTransitionImageLayoutEXT")); - vkGetPhysicalDeviceFormatProperties2 = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceFormatProperties2")); + vkGetPhysicalDeviceFormatProperties2 = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceFormatProperties2KHR")); loadAssets(); loadTexture(); diff --git a/examples/subpasses/subpasses.cpp b/examples/subpasses/subpasses.cpp index 72ab1109..e28d32d9 100644 --- a/examples/subpasses/subpasses.cpp +++ b/examples/subpasses/subpasses.cpp @@ -99,6 +99,8 @@ public: camera.setRotation(glm::vec3(0.5f, 210.05f, 0.0f)); camera.setPerspective(60.0f, (float)width / (float)height, 0.1f, 256.0f); ui.subpass = 2; + + enabledFeatures.fragmentStoresAndAtomics = VK_TRUE; } ~VulkanExample() diff --git a/examples/trianglevulkan13/trianglevulkan13.cpp b/examples/trianglevulkan13/trianglevulkan13.cpp index 462462de..6fa0a5bc 100644 --- a/examples/trianglevulkan13/trianglevulkan13.cpp +++ b/examples/trianglevulkan13/trianglevulkan13.cpp @@ -140,6 +140,14 @@ public: } } + virtual void getEnabledFeatures() override + { + // Vulkan 1.3 device support is required for this example + if (deviceProperties.apiVersion < VK_API_VERSION_1_3) { + vks::tools::exitFatal("Selected GPU does not support support Vulkan 1.3", VK_ERROR_INCOMPATIBLE_DRIVER); + } + } + // This function is used to request a device memory type that supports all the property flags we request (e.g. device local, host visible) // Upon success it will return the index of the memory type that fits our requested memory properties // This is necessary as implementations can offer an arbitrary number of memory types with different memory properties