🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Dealing with Vulkan DescriptorSet limitation to 4096?

Started by
10 comments, last by DexterZ101 2 years, 2 months ago

Just starting creating a mini engine using Vulkan and came across the limitation of DecriptorSet to 4096, My inquiries are what techniques others are using when dealing with this limitation when drawing object more than 4096. I read others are doing a reusable DescriptorSet, instancing etc… but how can I reuse the DescriptorSet+UniformBuffer while the object is currently in flight in the command buffer?

Greatly appreciated any help ^_^Y
Dex

Advertisement

Which limit specifically are you referring to? I'm not familiar with such a 4k limit.

Hello Sir @MJP ,

In Vulkan you can only create a maximum of 4096 DescriptorSet, ATM I'm using DescriptorSet on each object, the DescriptorSet is needed in Vulkan in order to draw an object, I 'm just wondering how others are handling this, without using Dynamic buffering, Instancing or any magic technique as I'm just staring to learn VK.

Many thanks ^_^y
Dex

DexterZ101 said:
Just starting creating a mini engine using Vulkan and came across the limitation of DecriptorSet to 4096, My inquiries are what techniques others are using when dealing with this limitation when drawing object more than 4096.

Check result vkAllocateDescriptorSets, if you have VK_ERROR_OUT_OF_POOL_MEMORY, you should create

a new VkDescriptorPool, using vkCreateDescriptorPool.

DexterZ101 said:
I read others are doing a reusable DescriptorSet, instancing etc… but how can I reuse the DescriptorSet+UniformBuffer while the object is currently in flight in the command buffer?

Each VkDescriptorSet will be stored inside corresponding vkCreateDescriptorPool, so you can use more than 4096 DescriptorSet

3DGraphics,Direct3D12,Vulkan,OpenCL,Algorithms

Check result vkAllocateDescriptorSets, if you have VK_ERROR_OUT_OF_POOL_MEMORY, you should create a new VkDescriptorPool, using vkCreateDescriptorPool.

Thanks @andreyvk_d3d

Initially that is also what I thought, I already have my DescriptorPoolManager with 256 allocated on each DescriptorPool and will automatically created a new DescriptorPool for every 256 DescriptorSet allocated, in my example apparently that is not the case T_T

I tried to create 5000 objects and it will only create a 16 DescriptorPool ( see image ) from my manager, I think even how many DescriptorPool you created the total maximum of DescriptorSet in Vulkan will still be 4096.


Many thanks sir,
Dex



DexterZ101 said:
, I think even how many DescriptorPool you created the total maximum of DescriptorSet in Vulkan will still be 4096.

VkPhysicalDeviceLimits::maxMemoryAllocationCount I is not related to VkDescriptorSet's Allocation. I think you try to allocate memory for VkBuffer/VkImage for each drawing Object, so you cannot call VkAllocMemory function more than kPhysicalDeviceLimits::maxMemoryAllocationCount(4096 for you GPU). Use Vulkan Memory Allocation library(VMA), Or try to create memory manager using single big allocations using vkBindImageMemory/vkBindBufferMemory and memoryOffset's parameter.

3DGraphics,Direct3D12,Vulkan,OpenCL,Algorithms

Sir @AndreyVK_D3D , I'll look into it,
Super thanks for the hints to where to look at,
Dex ^_^y

Sir @andreyvk_d3d ,

Upon checking, I only created VkBuffer/VkImage for texture only once which reference to the Pipeline,

The 5000 VkBuffer which exceeds the 4096 limit is the "Uniform Buffer" I created on each object,
because each object has different Word matrix.

I cannot reuse the Uniform Buffer which is already in command buffer on the flight, I tried and it works
with no errors, but all of them are using the same world space : )

Dex,


DexterZ101 said:
I tried and it works with no errors, but all of them are using the same world space : )

Use Big Dynamic(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC) ConstantBuffer (VkPhysicalDeviceLimits::maxUniformBufferRange) with and descriptor offsets(pDynamicOffsets parametes for vkCmdBindDescriptorSets) for each objects.

Example: https://vkguide.dev/docs/chapter-4/descriptors_code_more

https://github.com/SaschaWillems/Vulkan/tree/master/examples/dynamicuniformbuffer​

3DGraphics,Direct3D12,Vulkan,OpenCL,Algorithms

Hi bro @AndreyVK_D3D ,

Thank you on all of your responses, but based on my previous I'm looking for a solution to render many objects without using Dynamic uniform buffering or Instancing. I have the complete projects of Sascha Willems with all of his example which is also my basis in learning Vulkan.

Many thanks,
Dex


This topic is closed to new replies.

Advertisement