Skip to content

Commit

Permalink
On device destroy clean up presentation and submission images.
Browse files Browse the repository at this point in the history
  • Loading branch information
AWoloszyn committed Mar 2, 2018
1 parent 2ecfa7b commit b1e7110
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 4 additions & 1 deletion gapis/api/vulkan/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,17 @@ 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:
fallthrough
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) {
Expand Down
11 changes: 10 additions & 1 deletion gapis/api/vulkan/vulkan.api
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit b1e7110

Please sign in to comment.