HybridRenderer/HybridRenderer/RayTracingRenderer.cpp
/*
	If the window has been resized, we need to recreate the storage image and it's descriptor
*/
If the window has been resized, we need to recreate the storage image and it's descriptor
If the window has been resized we need to recreate the storage image and it ' s descriptor
void RayTracingRenderer::Reinitialise()
{
	storageImage.Destroy();
	createStorageImage();
	VkDescriptorImageInfo storageImageDescriptor{};
	storageImageDescriptor.imageView = storageImage.imageView;
	storageImageDescriptor.imageLayout = VK_IMAGE_LAYOUT_GENERAL;
	DescriptorSetRequest request(2);
	request.AddDescriptorBinding(0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, VK_SHADER_STAGE_RAYGEN_BIT_KHR);
	request.AddDescriptorBinding(1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_SHADER_STAGE_RAYGEN_BIT_KHR);
	request.AddDescriptorImageData(0, &storageImageDescriptor);
	request.AddDescriptorImageData(1, &ubo.descriptorInfo);
	rtDescriptor.requestData = request;
	deviceContext->GetDescriptors(rtDescriptor);
	commandBuffersReady = false;
}
void RayTracingRenderer :: Reinitialise ( ) { storageImage . Destroy ( ) ; createStorageImage ( ) ; VkDescriptorImageInfo storageImageDescriptor { } ; storageImageDescriptor . imageView = storageImage . imageView ; storageImageDescriptor . imageLayout = VK_IMAGE_LAYOUT_GENERAL ; DescriptorSetRequest request ( 2 ) ; request . AddDescriptorBinding ( 0 , VK_DESCRIPTOR_TYPE_STORAGE_IMAGE , VK_SHADER_STAGE_RAYGEN_BIT_KHR ) ; request . AddDescriptorBinding ( 1 , VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER , VK_SHADER_STAGE_RAYGEN_BIT_KHR ) ; request . AddDescriptorImageData ( 0 , & storageImageDescriptor ) ; request . AddDescriptorImageData ( 1 , & ubo . descriptorInfo ) ; rtDescriptor . requestData = request ; deviceContext -> GetDescriptors ( rtDescriptor ) ; commandBuffersReady = false ; }
If the window has been resized, we need to recreate the storage image and it's descriptor
If the window has been resized we need to recreate the storage image and it ' s descriptor
// Delete allocated resources // Recreate image //request.ids.push_back({ 0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, VK_SHADER_STAGE_RAYGEN_BIT_KHR }); //request.ids.push_back({ 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_SHADER_STAGE_RAYGEN_BIT_KHR }); //request.data.reserve(request.ids.size() * deviceContext->imageCount); //for (size_t i = 0; i < deviceContext->imageCount; i++) //{ //	request.data.push_back(&storageImageDescriptor); //	request.data.push_back(&ubo.descriptorInfo); //}