From d70e32b7b1e0197859f79d8d949106896c05ea83 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Tue, 3 Jul 2018 19:06:39 -0700 Subject: Moved list of vulkan device features to enable to initialization struct --- Graphics/GraphicsEngine/interface/GraphicsTypes.h | 19 ++++++++++++++++ .../src/RenderDeviceFactoryVk.cpp | 26 +++++++++++----------- 2 files changed, 32 insertions(+), 13 deletions(-) (limited to 'Graphics') diff --git a/Graphics/GraphicsEngine/interface/GraphicsTypes.h b/Graphics/GraphicsEngine/interface/GraphicsTypes.h index f7e994ae..1df91fa0 100644 --- a/Graphics/GraphicsEngine/interface/GraphicsTypes.h +++ b/Graphics/GraphicsEngine/interface/GraphicsTypes.h @@ -1291,6 +1291,25 @@ namespace Diligent /// or when backbuffer is presented. Uint32 NumCommandsToFlushCmdBuffer = 256; + /// List of device features to be enabled + /// see https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VkPhysicalDeviceFeatures + struct DeviceFeatures + { + bool depthBiasClamp = false; + bool fillModeNonSolid = false; + bool depthClamp = false; + bool independentBlend = false; + bool samplerAnisotropy = true; + bool geometryShader = false; + bool tessellationShader = false; + bool dualSrcBlend = false; + bool multiViewport = false; + bool imageCubeArray = false; + bool textureCompressionBC = false; + bool vertexPipelineStoresAndAtomics = false; + bool fragmentStoresAndAtomics = false; + }EnabledFeatures; + /// Descriptor pool size struct DescriptorPoolSize { diff --git a/Graphics/GraphicsEngineVulkan/src/RenderDeviceFactoryVk.cpp b/Graphics/GraphicsEngineVulkan/src/RenderDeviceFactoryVk.cpp index 0edb78ac..b02c4d23 100644 --- a/Graphics/GraphicsEngineVulkan/src/RenderDeviceFactoryVk.cpp +++ b/Graphics/GraphicsEngineVulkan/src/RenderDeviceFactoryVk.cpp @@ -150,19 +150,19 @@ void EngineFactoryVkImpl::CreateDeviceAndContextsVk( const EngineVkAttribs& Crea DeviceCreateInfo.queueCreateInfoCount = 1; DeviceCreateInfo.pQueueCreateInfos = &QueueInfo; VkPhysicalDeviceFeatures DeviceFeatures = {}; - DeviceFeatures.depthBiasClamp = VK_TRUE; - DeviceFeatures.fillModeNonSolid = VK_TRUE; - DeviceFeatures.depthClamp = VK_TRUE; - DeviceFeatures.independentBlend = VK_TRUE; - DeviceFeatures.samplerAnisotropy = VK_TRUE; - DeviceFeatures.geometryShader = VK_TRUE; - DeviceFeatures.tessellationShader = VK_TRUE; - DeviceFeatures.dualSrcBlend = VK_TRUE; - DeviceFeatures.multiViewport = VK_TRUE; - DeviceFeatures.imageCubeArray = VK_TRUE; - DeviceFeatures.textureCompressionBC = VK_TRUE; - DeviceFeatures.vertexPipelineStoresAndAtomics = VK_TRUE; - DeviceFeatures.fragmentStoresAndAtomics = VK_TRUE; + DeviceFeatures.depthBiasClamp = CreationAttribs.EnabledFeatures.depthBiasClamp ? VK_TRUE : VK_FALSE; + DeviceFeatures.fillModeNonSolid = CreationAttribs.EnabledFeatures.fillModeNonSolid ? VK_TRUE : VK_FALSE; + DeviceFeatures.depthClamp = CreationAttribs.EnabledFeatures.depthClamp ? VK_TRUE : VK_FALSE; + DeviceFeatures.independentBlend = CreationAttribs.EnabledFeatures.independentBlend ? VK_TRUE : VK_FALSE; + DeviceFeatures.samplerAnisotropy = CreationAttribs.EnabledFeatures.samplerAnisotropy ? VK_TRUE : VK_FALSE; + DeviceFeatures.geometryShader = CreationAttribs.EnabledFeatures.geometryShader ? VK_TRUE : VK_FALSE; + DeviceFeatures.tessellationShader = CreationAttribs.EnabledFeatures.tessellationShader ? VK_TRUE : VK_FALSE; + DeviceFeatures.dualSrcBlend = CreationAttribs.EnabledFeatures.dualSrcBlend ? VK_TRUE : VK_FALSE; + DeviceFeatures.multiViewport = CreationAttribs.EnabledFeatures.multiViewport ? VK_TRUE : VK_FALSE; + DeviceFeatures.imageCubeArray = CreationAttribs.EnabledFeatures.imageCubeArray ? VK_TRUE : VK_FALSE; + DeviceFeatures.textureCompressionBC = CreationAttribs.EnabledFeatures.textureCompressionBC ? VK_TRUE : VK_FALSE; + DeviceFeatures.vertexPipelineStoresAndAtomics = CreationAttribs.EnabledFeatures.vertexPipelineStoresAndAtomics ? VK_TRUE : VK_FALSE; + DeviceFeatures.fragmentStoresAndAtomics = CreationAttribs.EnabledFeatures.fragmentStoresAndAtomics ? VK_TRUE : VK_FALSE; DeviceCreateInfo.pEnabledFeatures = &DeviceFeatures; // NULL or a pointer to a VkPhysicalDeviceFeatures structure that contains // boolean indicators of all the features to be enabled. -- cgit v1.2.3