|
|
@@ -8,24 +8,26 @@ namespace BansheeEngine
|
|
|
VulkanDescriptorPool::VulkanDescriptorPool(VulkanDevice& device)
|
|
|
:mDevice(device)
|
|
|
{
|
|
|
+ const VkPhysicalDeviceLimits& limits = device.getDeviceProperties().limits;
|
|
|
+
|
|
|
VkDescriptorPoolSize poolSizes[4];
|
|
|
poolSizes[0].type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
|
|
|
- poolSizes[0].descriptorCount = sMaxSampledImages;
|
|
|
+ poolSizes[0].descriptorCount = std::min(limits.maxPerStageDescriptorSampledImages, sMaxSampledImages);
|
|
|
|
|
|
poolSizes[1].type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
|
|
|
- poolSizes[1].descriptorCount = sMaxUniformBuffers;
|
|
|
+ poolSizes[1].descriptorCount = std::min(limits.maxPerStageDescriptorUniformBuffers, sMaxUniformBuffers);
|
|
|
|
|
|
poolSizes[2].type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
|
|
|
- poolSizes[2].descriptorCount = sMaxImages;
|
|
|
+ poolSizes[2].descriptorCount = std::min(limits.maxPerStageDescriptorStorageImages, sMaxImages);
|
|
|
|
|
|
poolSizes[3].type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
|
|
|
- poolSizes[3].descriptorCount = sMaxBuffers;
|
|
|
+ poolSizes[3].descriptorCount = std::min(limits.maxPerStageDescriptorStorageBuffers, sMaxBuffers);
|
|
|
|
|
|
VkDescriptorPoolCreateInfo poolCI;
|
|
|
poolCI.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
|
|
|
poolCI.pNext = nullptr;
|
|
|
poolCI.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT;
|
|
|
- poolCI.maxSets = sMaxSets;
|
|
|
+ poolCI.maxSets = std::min(limits.maxBoundDescriptorSets, sMaxSets);
|
|
|
poolCI.poolSizeCount = sizeof(poolSizes)/sizeof(poolSizes[0]);
|
|
|
poolCI.pPoolSizes = poolSizes;
|
|
|
|