Fixes for Vulkan descriptor types iterations

This commit is contained in:
Wojtek Figat
2020-12-19 23:24:31 +01:00
parent af39369661
commit 5cab22e20d
4 changed files with 20 additions and 17 deletions

View File

@@ -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<VkDescriptorPoolSize, FixedAllocation<VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT>> types;
Array<VkDescriptorPoolSize, FixedAllocation<VULKAN_DESCRIPTOR_TYPE_END + 1>> types;
#if VULKAN_USE_DESCRIPTOR_POOL_MANAGER
// Max number of descriptor sets layout allocations
@@ -180,10 +180,10 @@ DescriptorPoolVulkan::DescriptorPoolVulkan(GPUDeviceVulkan* device)
// Descriptor sets number required to allocate the max number of descriptor sets layout.
// When we're hashing pools with types usage ID the descriptor pool can be used for different layouts so the initial layout does not make much sense.
// 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
// In the latter case we'll be probably over-allocating 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_SAMPLER; typeIndex < VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT + 1; ++typeIndex)
for (uint32 typeIndex = VULKAN_DESCRIPTOR_TYPE_BEGIN; typeIndex <= VULKAN_DESCRIPTOR_TYPE_END; 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_SAMPLER; typeIndex < VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT + 1; typeIndex++)
for (uint32 typeIndex = VULKAN_DESCRIPTOR_TYPE_BEGIN; typeIndex <= VULKAN_DESCRIPTOR_TYPE_END; 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_SAMPLER; typeIndex < VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT + 1; typeIndex++)
for (uint32 typeIndex = VULKAN_DESCRIPTOR_TYPE_BEGIN; typeIndex <= VULKAN_DESCRIPTOR_TYPE_END; typeIndex++)
{
#if VULKAN_USE_DESCRIPTOR_POOL_MANAGER
ASSERT(Layout.GetTypesUsed((VkDescriptorType)typeIndex) == layout.GetTypesUsed((VkDescriptorType)typeIndex));