diff --git a/Source/Engine/GraphicsDevice/Vulkan/DescriptorSetVulkan.cpp b/Source/Engine/GraphicsDevice/Vulkan/DescriptorSetVulkan.cpp index e204c3750..9857e15bf 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/DescriptorSetVulkan.cpp +++ b/Source/Engine/GraphicsDevice/Vulkan/DescriptorSetVulkan.cpp @@ -115,7 +115,7 @@ void DescriptorSetLayoutVulkan::Compile() // Check for maxDescriptorSetStorageBuffersDynamic if (LayoutTypes[VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC] > limits.maxDescriptorSetUniformBuffersDynamic) - { + { // TODO: Downgrade to non-dynamic? } ASSERT(LayoutTypes[VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC] @@ -172,7 +172,7 @@ DescriptorPoolVulkan::DescriptorPoolVulkan(GPUDeviceVulkan* device) , Layout(layout) #endif { - Array> types; + Array> types; #if VULKAN_USE_DESCRIPTOR_POOL_MANAGER // Max number of descriptor sets layout allocations @@ -183,7 +183,7 @@ DescriptorPoolVulkan::DescriptorPoolVulkan(GPUDeviceVulkan* device) // In the latter case we'll be probably overallocating the descriptor types but given the relatively small number of max allocations this should not have // a serious impact. MaxDescriptorSets = MaxSetsAllocations * (VULKAN_HASH_POOLS_WITH_TYPES_USAGE_ID ? 1 : Layout.GetLayouts().Count()); - for (uint32 typeIndex = VK_DESCRIPTOR_TYPE_BEGIN_RANGE; typeIndex < VK_DESCRIPTOR_TYPE_END_RANGE; ++typeIndex) + for (uint32 typeIndex = VK_DESCRIPTOR_TYPE_SAMPLER; typeIndex < VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT + 1; ++typeIndex) { const VkDescriptorType descriptorType = (VkDescriptorType)typeIndex; const uint32 typesUsed = Layout.GetTypesUsed(descriptorType); @@ -258,7 +258,7 @@ DescriptorPoolVulkan::~DescriptorPoolVulkan() void DescriptorPoolVulkan::TrackAddUsage(const DescriptorSetLayoutVulkan& layout) { // Check and increment our current type usage - for (uint32 typeIndex = VK_DESCRIPTOR_TYPE_BEGIN_RANGE; typeIndex < VK_DESCRIPTOR_TYPE_END_RANGE; typeIndex++) + for (uint32 typeIndex = VK_DESCRIPTOR_TYPE_SAMPLER; typeIndex < VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT + 1; typeIndex++) { #if VULKAN_USE_DESCRIPTOR_POOL_MANAGER ASSERT(Layout.GetTypesUsed((VkDescriptorType)typeIndex) == layout.GetTypesUsed((VkDescriptorType)typeIndex)); @@ -275,7 +275,7 @@ void DescriptorPoolVulkan::TrackAddUsage(const DescriptorSetLayoutVulkan& layout void DescriptorPoolVulkan::TrackRemoveUsage(const DescriptorSetLayoutVulkan& layout) { // Check and increment our current type usage - for (uint32 typeIndex = VK_DESCRIPTOR_TYPE_BEGIN_RANGE; typeIndex < VK_DESCRIPTOR_TYPE_END_RANGE; typeIndex++) + for (uint32 typeIndex = VK_DESCRIPTOR_TYPE_SAMPLER; typeIndex < VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT + 1; typeIndex++) { #if VULKAN_USE_DESCRIPTOR_POOL_MANAGER ASSERT(Layout.GetTypesUsed((VkDescriptorType)typeIndex) == layout.GetTypesUsed((VkDescriptorType)typeIndex)); diff --git a/Source/Engine/GraphicsDevice/Vulkan/DescriptorSetVulkan.h b/Source/Engine/GraphicsDevice/Vulkan/DescriptorSetVulkan.h index cad7d87ee..848c5cc9b 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/DescriptorSetVulkan.h +++ b/Source/Engine/GraphicsDevice/Vulkan/DescriptorSetVulkan.h @@ -110,7 +110,7 @@ public: protected: - uint32 LayoutTypes[VK_DESCRIPTOR_TYPE_RANGE_SIZE]; + uint32 LayoutTypes[VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT]; Array SetLayouts; uint32 _hash = 0; diff --git a/Source/Engine/GraphicsDevice/Vulkan/GPUPipelineStateVulkan.cpp b/Source/Engine/GraphicsDevice/Vulkan/GPUPipelineStateVulkan.cpp index e73778828..fa03e622e 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/GPUPipelineStateVulkan.cpp +++ b/Source/Engine/GraphicsDevice/Vulkan/GPUPipelineStateVulkan.cpp @@ -286,10 +286,11 @@ bool GPUPipelineStateVulkan::Init(const Description& desc) // Dynamic RenderToolsVulkan::ZeroStruct(_descDynamic, VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO); - _descDynamic.pDynamicStates = _dynamicStates; - _dynamicStates[_descDynamic.dynamicStateCount++] = VK_DYNAMIC_STATE_VIEWPORT; - _dynamicStates[_descDynamic.dynamicStateCount++] = VK_DYNAMIC_STATE_SCISSOR; - _dynamicStates[_descDynamic.dynamicStateCount++] = VK_DYNAMIC_STATE_STENCIL_REFERENCE; + _dynamicStates.Push(VK_DYNAMIC_STATE_VIEWPORT); + _dynamicStates.Push(VK_DYNAMIC_STATE_SCISSOR); + _dynamicStates.Push(VK_DYNAMIC_STATE_STENCIL_REFERENCE); + _descDynamic.dynamicStateCount = _dynamicStates.Count(); + _descDynamic.pDynamicStates = _dynamicStates.Get(); _desc.pDynamicState = &_descDynamic; // Multisample diff --git a/Source/Engine/GraphicsDevice/Vulkan/GPUPipelineStateVulkan.h b/Source/Engine/GraphicsDevice/Vulkan/GPUPipelineStateVulkan.h index f1317898f..8e39ac1d8 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/GPUPipelineStateVulkan.h +++ b/Source/Engine/GraphicsDevice/Vulkan/GPUPipelineStateVulkan.h @@ -131,7 +131,7 @@ private: VkPipelineTessellationStateCreateInfo _descTessellation; VkPipelineViewportStateCreateInfo _descViewport; VkPipelineDynamicStateCreateInfo _descDynamic; - VkDynamicState _dynamicStates[VK_DYNAMIC_STATE_RANGE_SIZE]; + Array _dynamicStates; VkPipelineMultisampleStateCreateInfo _descMultisample; VkPipelineDepthStencilStateCreateInfo _descDepthStencil; VkPipelineRasterizationStateCreateInfo _descRasterization; diff --git a/Source/Engine/GraphicsDevice/Vulkan/RenderToolsVulkan.cpp b/Source/Engine/GraphicsDevice/Vulkan/RenderToolsVulkan.cpp index f26cee5c6..8616260eb 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/RenderToolsVulkan.cpp +++ b/Source/Engine/GraphicsDevice/Vulkan/RenderToolsVulkan.cpp @@ -244,7 +244,9 @@ String RenderToolsVulkan::GetVkErrorString(VkResult result) VKERR(VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT); VKERR(VK_ERROR_FRAGMENTATION_EXT); VKERR(VK_ERROR_NOT_PERMITTED_EXT); +#if VK_HEADER_VERSION < 140 VKERR(VK_RESULT_RANGE_SIZE); +#endif default: sb.AppendFormat(TEXT("0x{0:x}"), static_cast(result)); break;