vkUpdateDescriptorSets never returns


#1

I’ve checked through debugger that vkUpdateDescriptorSets on second times never returns. There’s no validation error given. The application just hang not responding.I think i’ve done everthings right.

Here’s the code


void DeferredSubpassesApplication::OnResize()
{
	CHECK_VK_RESULT_2(vkDeviceWaitIdle(mpDeviceContext->GetVkDevice()));

	mSwapchainContext.ReSize(mSurfaceKHR, VK_PRESENT_MODE_MAILBOX_KHR);

	mDepthTexture.Purge();
	mGBuffer.diffuse.Purge();
	mGBuffer.specular.Purge();
	mGBuffer.position.Purge();
	mGBuffer.normal.Purge();

	mDeferredRenderPass.DestroyFramebuffers(mDeferredFramebuffers);

	float aspectRatio = (float)mSwapchainContext.GetVkExtent2D().width / (float)mSwapchainContext.GetVkExtent2D().height;

	mFlyingCamera.Perspective(45.0F, aspectRatio, 0.1f, 1000.0f);

	CreateRenderTextures();

	VkWriteDescriptorSet writeSets[4];

	VkDescriptorImageInfo descriptorImageInfo[4] = {};
	descriptorImageInfo[0].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
	descriptorImageInfo[0].imageView = mGBuffer.position.GetVkImageView();

	descriptorImageInfo[1].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
	descriptorImageInfo[1].imageView = mGBuffer.normal.GetVkImageView();

	descriptorImageInfo[2].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
	descriptorImageInfo[2].imageView = mGBuffer.diffuse.GetVkImageView();

	descriptorImageInfo[3].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
	descriptorImageInfo[3].imageView = mGBuffer.specular.GetVkImageView();

	writeSets[0].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
	writeSets[0].dstSet = mGBufferSet;
	writeSets[0].dstBinding = 0;
	writeSets[0].descriptorType = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT;
	writeSets[0].pImageInfo = &descriptorImageInfo[0];
	writeSets[0].descriptorCount = 1;

	writeSets[1].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
	writeSets[1].dstSet = mGBufferSet;
	writeSets[1].dstBinding = 1;
	writeSets[1].descriptorType = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT;
	writeSets[1].pImageInfo = &descriptorImageInfo[1];
	writeSets[1].descriptorCount = 1;

	writeSets[2].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
	writeSets[2].dstSet = mGBufferSet;
	writeSets[2].dstBinding = 2;
	writeSets[2].descriptorType = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT;
	writeSets[2].pImageInfo = &descriptorImageInfo[2];
	writeSets[2].descriptorCount = 1;

	writeSets[3].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
	writeSets[3].dstSet = mGBufferSet;
	writeSets[3].dstBinding = 3;
	writeSets[3].descriptorType = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT;
	writeSets[3].pImageInfo = &descriptorImageInfo[3];
	writeSets[3].descriptorCount = 1;

	vkUpdateDescriptorSets(mpDeviceContext->GetVkDevice(), 4, writeSets, 0, nullptr) ; // It stuck here
	
	PopulateCommandBuffers();
}



#2

Sorry for late reply. It turns out I forgot to initialize VkWriteDescriptorSet writeSets[4]