Fixes in examples: support swapchain image count change on resize, fix multiple validation layer errors on resize and quit, multiview now supports resize/fullscreen, computecloth deltaT now based on frame time, multisampling recreates attachments on resize, P key now pauses computeparticles, descriptorsets, and pushdescriptors

This commit is contained in:
Stephen Saunders 2022-06-01 13:02:33 -04:00
parent cb343c329a
commit 121612857c
10 changed files with 148 additions and 65 deletions

View file

@ -48,6 +48,7 @@ public:
VkPipelineLayout pipelineLayout;
VkDescriptorSet descriptorSet;
VkDescriptorSetLayout descriptorSetLayout;
VkExtent2D attachmentSize;
VulkanExample() : VulkanExampleBase(ENABLE_VALIDATION)
{
@ -199,6 +200,8 @@ public:
void setupRenderPass()
{
// Overrides the virtual function of the base class
attachmentSize = { width, height };
std::array<VkAttachmentDescription, 3> attachments = {};
@ -290,6 +293,20 @@ public:
{
// Overrides the virtual function of the base class
// SRS - If the window is resized, the MSAA attachments need to be released and recreated
if (attachmentSize.width != width || attachmentSize.height != height)
{
attachmentSize = { width, height };
// Destroy MSAA target
vkDestroyImage(device, multisampleTarget.color.image, nullptr);
vkDestroyImageView(device, multisampleTarget.color.view, nullptr);
vkFreeMemory(device, multisampleTarget.color.memory, nullptr);
vkDestroyImage(device, multisampleTarget.depth.image, nullptr);
vkDestroyImageView(device, multisampleTarget.depth.view, nullptr);
vkFreeMemory(device, multisampleTarget.depth.memory, nullptr);
}
std::array<VkImageView, 3> attachments;
setupMultisampleTarget();