diff --git a/base/vulkanexamplebase.cpp b/base/vulkanexamplebase.cpp index e253581c..8baa27bf 100644 --- a/base/vulkanexamplebase.cpp +++ b/base/vulkanexamplebase.cpp @@ -830,6 +830,14 @@ void VulkanExampleBase::initVulkan() physicalDevice = physicalDevices[selectedDevice]; + // Store properties (including limits), features and memory properties of the phyiscal device (so that examples can check against them) + vkGetPhysicalDeviceProperties(physicalDevice, &deviceProperties); + vkGetPhysicalDeviceFeatures(physicalDevice, &deviceFeatures); + vkGetPhysicalDeviceMemoryProperties(physicalDevice, &deviceMemoryProperties); + + // Derived examples can override this to set actual features (based on above readings) to enable for logical device creation + getEnabledFeatures(); + // Vulkan device creation // This is handled by a separate class that gets a logical device representation // and encapsulates functions related to a device @@ -840,14 +848,6 @@ void VulkanExampleBase::initVulkan() } device = vulkanDevice->logicalDevice; - // todo: remove - // Store properties (including limits) and features of the phyiscal device - // So examples can check against them and see if a feature is actually supported - vkGetPhysicalDeviceProperties(physicalDevice, &deviceProperties); - vkGetPhysicalDeviceFeatures(physicalDevice, &deviceFeatures); - // Gather physical device memory properties - vkGetPhysicalDeviceMemoryProperties(physicalDevice, &deviceMemoryProperties); - // Get a graphics queue from the device vkGetDeviceQueue(device, vulkanDevice->queueFamilyIndices.graphics, 0, &queue); @@ -2011,6 +2011,11 @@ void VulkanExampleBase::setupRenderPass() VK_CHECK_RESULT(vkCreateRenderPass(device, &renderPassInfo, nullptr, &renderPass)); } +void VulkanExampleBase::getEnabledFeatures() +{ + // Can be overriden in derived class +} + void VulkanExampleBase::windowResize() { if (!prepared) diff --git a/base/vulkanexamplebase.h b/base/vulkanexamplebase.h index c11d7bfc..36900844 100644 --- a/base/vulkanexamplebase.h +++ b/base/vulkanexamplebase.h @@ -333,6 +333,9 @@ public: // Can be overriden in derived class to setup a custom render pass (e.g. for MSAA) virtual void setupRenderPass(); + /** @brief (Virtual) called after the physical device features have been read, used to set features to enable on the device */ + virtual void getEnabledFeatures(); + // Connect and prepare the swap chain void initSwapchain(); // Create swap chain images