Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip tracking the data dependency of destroyed framebuffer images #1657

Merged
merged 3 commits into from
Mar 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions gapis/api/vulkan/footprint_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1211,8 +1211,12 @@ type FootprintBuilder struct {
func (vb *FootprintBuilder) getImageData(ctx context.Context,
bh *dependencygraph.Behavior, vkImg VkImage) []dependencygraph.DefUseVariable {
if bh != nil {
read(ctx, bh, vkHandle(vkImg))
read(ctx, bh, vb.images[vkImg].layout)
if !read(ctx, bh, vkHandle(vkImg)) {
return []dependencygraph.DefUseVariable{}
}
if !read(ctx, bh, vb.images[vkImg].layout) {
return []dependencygraph.DefUseVariable{}
}
}
data := vb.images[vkImg].opaqueData.getBoundData(ctx, bh, 0, vkWholeSize)
for _, aspecti := range vb.images[vkImg].sparseData {
Expand Down Expand Up @@ -1643,6 +1647,9 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context,
lastDrawInfo := GetState(s).LastDrawInfos.Get(lastBoundQueue.VulkanHandle)
if lastDrawInfo.Framebuffer != nil {
for _, view := range lastDrawInfo.Framebuffer.ImageAttachments.Range() {
if view == nil || view.Image == nil {
continue
}
img := view.Image
data := vb.getImageData(ctx, nil, img.VulkanHandle)
vb.machine.lastBoundFramebufferImageData[id] = append(
Expand Down
21 changes: 21 additions & 0 deletions gapis/api/vulkan/vulkan.api
Original file line number Diff line number Diff line change
Expand Up @@ -4166,6 +4166,11 @@ cmd void vkDestroyImage(
delete(imageObject.BoundMemory.BoundObjects, as!u64(image))
}
delete(Images, image)
for _, _, v in ImageViews {
if v.Image.VulkanHandle == image {
v.Image = null
}
}
}

}
Expand Down Expand Up @@ -4221,6 +4226,22 @@ cmd void vkDestroyImageView(
// TODO: pAllocator
if !(device in Devices) { vkErrorInvalidDevice(device) }
delete(ImageViews, imageView)
for _, _, drawInfo in LastDrawInfos {
for _, i, v in drawInfo.Framebuffer.ImageAttachments {
if (v != null) && (v.VulkanHandle == imageView) {
drawInfo.Framebuffer.ImageAttachments[i] = null
}
}
}
for _, _, descSet in DescriptorSets {
for _, _, binding in descSet.Bindings {
for _, _, imgBinding in binding.ImageBinding {
if imgBinding.ImageView == imageView {
imgBinding.ImageView = as!VkImageView(0)
}
}
}
}
}

@indirect("VkDevice")
Expand Down