Advertisement

Descriptorpool creates descriptors though the pool should be empty

Started by September 27, 2017 08:40 AM
3 comments, last by pcmaster 7 years, 3 months ago

As the title says, I am explicitly creating a too small descriptor pool, which should NOT support the resources I am going to allocate from it.

 


	std::array<vk::DescriptorPoolSize, 3> type_count;
	
	// Initialize our pool with these values
	type_count[0].type = vk::DescriptorType::eCombinedImageSampler;
	type_count[0].descriptorCount = 0;

	type_count[1].type = vk::DescriptorType::eSampler;
	type_count[1].descriptorCount = 0;
	
	type_count[2].type = vk::DescriptorType::eUniformBuffer;
	type_count[2].descriptorCount = 0;



	vk::DescriptorPoolCreateInfo createInfo = vk::DescriptorPoolCreateInfo()
		.setPNext(nullptr)
		.setMaxSets(iMaxSets)
		.setPoolSizeCount(type_count.size())
		.setPPoolSizes(type_count.data());
	pool = aDevice.createDescriptorPool(createInfo);

 

I have an allocation function which looks like this, I am allocating a uniform, image-combined sampler and a regular sampler. Though if my pool is empty this should not work?


vk::DescriptorSetAllocateInfo alloc_info[1] = {};
	alloc_info[0].pNext = NULL;
	alloc_info[0].setDescriptorPool(pool);
	alloc_info[0].setDescriptorSetCount(iNumToAllocate);
	alloc_info[0].setPSetLayouts(&iDescriptorLayouts);

	std::vector<vk::DescriptorSet> tDescriptors;
	tDescriptors.resize(iNumToAllocate);

	iDevice.allocateDescriptorSets(alloc_info, tDescriptors.data());

 

Do you have the debug layer enabled? Does everything return VK_SUCCESS? How are you sure it "works"?

Advertisement

The CPP Vulkan API already does exception throwing when there is no successful result, and yes the debug layer is enabled. And I am sure it "works" is because of the fact my whole scene renders as usual, without any visual problems of any kind. 

Also tested it on a friend's pc. Also works perfectly fine, while it should not. I am expecting it to completely break down, but it just allocates descriptor sets. I have done a clean, rebuild on my project as well to make doubly sure I am not missing something.

Did you figure out, what was it?

This topic is closed to new replies.

Advertisement