From b1e71109e5850c24fba32e4c8e1a76e2357c6138 Mon Sep 17 00:00:00 2001 From: Andrew Woloszyn Date: Fri, 2 Mar 2018 10:41:00 -0500 Subject: [PATCH] On device destroy clean up presentation and submission images. --- gapis/api/vulkan/state.go | 5 ++++- gapis/api/vulkan/vulkan.api | 11 ++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/gapis/api/vulkan/state.go b/gapis/api/vulkan/state.go index 841f7b2258..b8202a1fa5 100644 --- a/gapis/api/vulkan/state.go +++ b/gapis/api/vulkan/state.go @@ -90,7 +90,9 @@ func (st *State) getPresentAttachmentInfo(attachment api.FramebufferAttachment) return returnError("Swapchain does not contain image %v", attachment) } color_img := st.LastPresentInfo.PresentImages.Get(image_idx) - return color_img.Info.Extent.Width, color_img.Info.Extent.Height, color_img.Info.Format, image_idx, nil + if color_img != nil { + return color_img.Info.Extent.Width, color_img.Info.Extent.Height, color_img.Info.Format, image_idx, nil + } case api.FramebufferAttachment_Depth: fallthrough case api.FramebufferAttachment_Stencil: @@ -98,6 +100,7 @@ func (st *State) getPresentAttachmentInfo(attachment api.FramebufferAttachment) default: return returnError("Swapchain attachment %v does not exist", attachment) } + return returnError("Swapchain attachment %v does not exist", attachment) } func (st *State) getFramebufferAttachmentInfo(attachment api.FramebufferAttachment) (uint32, uint32, VkFormat, uint32, error) { diff --git a/gapis/api/vulkan/vulkan.api b/gapis/api/vulkan/vulkan.api index ffdd056a6c..0b7e079342 100644 --- a/gapis/api/vulkan/vulkan.api +++ b/gapis/api/vulkan/vulkan.api @@ -2992,6 +2992,11 @@ cmd void vkDestroyDevice( if LastBoundQueue == v { LastBoundQueue = null } + for i in (0 .. LastPresentInfo.PresentImageCount) { + if (LastPresentInfo.PresentImages[i].Device == device) { + delete(LastPresentInfo.PresentImages, i) + } + } delete(Queues, v.VulkanHandle) } } @@ -4185,8 +4190,12 @@ cmd void vkDestroyImage( v.Image = null } } + for i in (0 .. LastPresentInfo.PresentImageCount) { + if (LastPresentInfo.PresentImages[i].VulkanHandle == image) { + delete(LastPresentInfo.PresentImages, i) + } + } } - } @indirect("VkDevice")