From 727d351b42316e0aa8c6cd5ed552b88ab75d052a Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sun, 2 Oct 2022 15:46:06 +0200 Subject: [PATCH] Added virtual function to enable extension based on extension list from physical device --- base/vulkanexamplebase.cpp | 6 ++++++ base/vulkanexamplebase.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/base/vulkanexamplebase.cpp b/base/vulkanexamplebase.cpp index 6d6b7d1b..ea7f0203 100644 --- a/base/vulkanexamplebase.cpp +++ b/base/vulkanexamplebase.cpp @@ -1017,6 +1017,10 @@ bool VulkanExampleBase::initVulkan() // This is handled by a separate class that gets a logical device representation // and encapsulates functions related to a device vulkanDevice = new vks::VulkanDevice(physicalDevice); + + // Derived examples can enable extensions based on the list of supported extensions read from the physical device + getEnabledExtensions(); + VkResult res = vulkanDevice->createLogicalDevice(enabledFeatures, enabledDeviceExtensions, deviceCreatepNextChain); if (res != VK_SUCCESS) { vks::tools::exitFatal("Could not create Vulkan device: \n" + vks::tools::errorString(res), res); @@ -2798,6 +2802,8 @@ void VulkanExampleBase::setupRenderPass() void VulkanExampleBase::getEnabledFeatures() {} +void VulkanExampleBase::getEnabledExtensions() {} + void VulkanExampleBase::windowResize() { if (!prepared) diff --git a/base/vulkanexamplebase.h b/base/vulkanexamplebase.h index 9f814cf9..c03f9e6a 100644 --- a/base/vulkanexamplebase.h +++ b/base/vulkanexamplebase.h @@ -386,6 +386,8 @@ public: virtual void setupRenderPass(); /** @brief (Virtual) Called after the physical device features have been read, can be used to set features to enable on the device */ virtual void getEnabledFeatures(); + /** @brief (Virtual) Called after the physical device extensions have been read, can be used to enable extensions based on the supported extension listing*/ + virtual void getEnabledExtensions(); /** @brief Prepares all Vulkan resources and functions required to run the sample */ virtual void prepare();