Virtual function for enabling physical device features (instead of function pointer in constructor)

This commit is contained in:
saschawillems 2016-12-14 20:17:15 +01:00
parent d24f8ec8b7
commit 00ed23db98
5 changed files with 29 additions and 21 deletions

View file

@ -54,6 +54,11 @@ VkResult VulkanExampleBase::createInstance(bool enableValidation)
return vkCreateInstance(&instanceCreateInfo, nullptr, &instance);
}
VkPhysicalDeviceFeatures VulkanExampleBase::getEnabledFeatures()
{
return VkPhysicalDeviceFeatures{};
}
std::string VulkanExampleBase::getWindowTitle()
{
std::string device(deviceProperties.deviceName);
@ -676,7 +681,7 @@ void VulkanExampleBase::submitFrame()
VK_CHECK_RESULT(vkQueueWaitIdle(queue));
}
VulkanExampleBase::VulkanExampleBase(bool enableValidation, PFN_GetEnabledFeatures enabledFeaturesFn)
VulkanExampleBase::VulkanExampleBase(bool enableValidation)
{
// Parse command line arguments
for (auto arg : args)
@ -700,11 +705,6 @@ VulkanExampleBase::VulkanExampleBase(bool enableValidation, PFN_GetEnabledFeatur
initxcbConnection();
#endif
if (enabledFeaturesFn != nullptr)
{
this->enabledFeatures = enabledFeaturesFn();
}
#if defined(_WIN32)
// Enable console if validation is active
// Debug message callback will output to it
@ -830,7 +830,7 @@ void VulkanExampleBase::initVulkan()
// This is handled by a separate class that gets a logical device representation
// and encapsulates functions related to a device
vulkanDevice = new vk::VulkanDevice(physicalDevice);
VK_CHECK_RESULT(vulkanDevice->createLogicalDevice(enabledFeatures));
VK_CHECK_RESULT(vulkanDevice->createLogicalDevice(getEnabledFeatures()));
device = vulkanDevice->logicalDevice;
// todo: remove