mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-04 15:11:05 +01:00 
			
		
		
		
	Examples: Vulkan: Fixed Vulkan descriptor pools. (#6642)
Only use required no. of types and sets
This commit is contained in:
		@@ -95,6 +95,7 @@ Other changes:
 | 
			
		||||
- Backends: GLFW: Revert ignoring mouse data on GLFW_CURSOR_DISABLED as it can be used
 | 
			
		||||
  differently. User may set ImGuiConfigFLags_NoMouse if desired. (#5625, #6609) [@scorpion-26]
 | 
			
		||||
- Backends: WebGPU: Update for changes in Dawn. (#6602, #6188) [@williamhCode]
 | 
			
		||||
- Examples: Vulkan: Creating minimal descriptor pools to fit only what is needed by example. (#6642) [@SaschaWillem]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
-----------------------------------------------------------------------
 | 
			
		||||
 
 | 
			
		||||
@@ -215,25 +215,17 @@ static void SetupVulkan(ImVector<const char*> instance_extensions)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Create Descriptor Pool
 | 
			
		||||
    // The example only requires a single combined image sampler descriptor for the font image and only uses one descriptor set (for that)
 | 
			
		||||
    // If you wish to load e.g. additional textures you may need to alter pools sizes.
 | 
			
		||||
    {
 | 
			
		||||
        VkDescriptorPoolSize pool_sizes[] =
 | 
			
		||||
        {
 | 
			
		||||
            { VK_DESCRIPTOR_TYPE_SAMPLER, 1000 },
 | 
			
		||||
            { VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1000 },
 | 
			
		||||
            { VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1000 },
 | 
			
		||||
            { VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1000 },
 | 
			
		||||
            { VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, 1000 },
 | 
			
		||||
            { VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, 1000 },
 | 
			
		||||
            { VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1000 },
 | 
			
		||||
            { VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1000 },
 | 
			
		||||
            { VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, 1000 },
 | 
			
		||||
            { VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, 1000 },
 | 
			
		||||
            { VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, 1000 }
 | 
			
		||||
            { VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1 },
 | 
			
		||||
        };
 | 
			
		||||
        VkDescriptorPoolCreateInfo pool_info = {};
 | 
			
		||||
        pool_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
 | 
			
		||||
        pool_info.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT;
 | 
			
		||||
        pool_info.maxSets = 1000 * IM_ARRAYSIZE(pool_sizes);
 | 
			
		||||
        pool_info.maxSets = 1;
 | 
			
		||||
        pool_info.poolSizeCount = (uint32_t)IM_ARRAYSIZE(pool_sizes);
 | 
			
		||||
        pool_info.pPoolSizes = pool_sizes;
 | 
			
		||||
        err = vkCreateDescriptorPool(g_Device, &pool_info, g_Allocator, &g_DescriptorPool);
 | 
			
		||||
 
 | 
			
		||||
@@ -203,25 +203,17 @@ static void SetupVulkan(ImVector<const char*> instance_extensions)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Create Descriptor Pool
 | 
			
		||||
    // The example only requires a single combined image sampler descriptor for the font image and only uses one descriptor set (for that)
 | 
			
		||||
    // If you wish to load e.g. additional textures you may need to alter pools sizes.
 | 
			
		||||
    {
 | 
			
		||||
        VkDescriptorPoolSize pool_sizes[] =
 | 
			
		||||
        {
 | 
			
		||||
            { VK_DESCRIPTOR_TYPE_SAMPLER, 1000 },
 | 
			
		||||
            { VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1000 },
 | 
			
		||||
            { VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1000 },
 | 
			
		||||
            { VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1000 },
 | 
			
		||||
            { VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, 1000 },
 | 
			
		||||
            { VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, 1000 },
 | 
			
		||||
            { VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1000 },
 | 
			
		||||
            { VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1000 },
 | 
			
		||||
            { VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, 1000 },
 | 
			
		||||
            { VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, 1000 },
 | 
			
		||||
            { VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, 1000 }
 | 
			
		||||
            { VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1 },
 | 
			
		||||
        };
 | 
			
		||||
        VkDescriptorPoolCreateInfo pool_info = {};
 | 
			
		||||
        pool_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
 | 
			
		||||
        pool_info.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT;
 | 
			
		||||
        pool_info.maxSets = 1000 * IM_ARRAYSIZE(pool_sizes);
 | 
			
		||||
        pool_info.maxSets = 1;
 | 
			
		||||
        pool_info.poolSizeCount = (uint32_t)IM_ARRAYSIZE(pool_sizes);
 | 
			
		||||
        pool_info.pPoolSizes = pool_sizes;
 | 
			
		||||
        err = vkCreateDescriptorPool(g_Device, &pool_info, g_Allocator, &g_DescriptorPool);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user