Added virtual function to enable extension based on extension list from physical device

This commit is contained in:
Sascha Willems 2022-10-02 15:46:06 +02:00
parent 44c95211aa
commit 727d351b42
2 changed files with 8 additions and 0 deletions

View file

@ -1017,6 +1017,10 @@ bool VulkanExampleBase::initVulkan()
// This is handled by a separate class that gets a logical device representation // This is handled by a separate class that gets a logical device representation
// and encapsulates functions related to a device // and encapsulates functions related to a device
vulkanDevice = new vks::VulkanDevice(physicalDevice); 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); VkResult res = vulkanDevice->createLogicalDevice(enabledFeatures, enabledDeviceExtensions, deviceCreatepNextChain);
if (res != VK_SUCCESS) { if (res != VK_SUCCESS) {
vks::tools::exitFatal("Could not create Vulkan device: \n" + vks::tools::errorString(res), res); 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::getEnabledFeatures() {}
void VulkanExampleBase::getEnabledExtensions() {}
void VulkanExampleBase::windowResize() void VulkanExampleBase::windowResize()
{ {
if (!prepared) if (!prepared)

View file

@ -386,6 +386,8 @@ public:
virtual void setupRenderPass(); 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 */ /** @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(); 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 */ /** @brief Prepares all Vulkan resources and functions required to run the sample */
virtual void prepare(); virtual void prepare();