Virtual function for enabling features for the logical device creation (called after physical device features have been read)

This commit is contained in:
saschawillems 2017-03-08 21:29:38 +01:00
parent ab95c2f29a
commit 83806a43c2
2 changed files with 16 additions and 8 deletions

View file

@ -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)