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

Handle the case where we destroy an ImageView attached to a framebuffer. #2518

Merged
merged 1 commit into from
Jan 4, 2019
Merged
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
19 changes: 13 additions & 6 deletions gapis/api/vulkan/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,26 @@ func (st *State) getSubmitAttachmentInfo(attachment api.FramebufferAttachment) (
attachmentIndex := uint32(attachment - api.FramebufferAttachment_Color0)
if attRef, ok := subpassDesc.ColorAttachments().Lookup(attachmentIndex); ok {
if ca, ok := lastDrawInfo.Framebuffer().ImageAttachments().Lookup(attRef.Attachment()); ok {
return ca.Image().Info().Extent().Width(),
ca.Image().Info().Extent().Height(),
ca.Image().Info().Fmt(),
attRef.Attachment(), true, nil
// This can occur if we destroy the image-view, we remove it from the framebuffer,
// but may not unbind the framebuffer.
if !ca.Image().IsNil() {
return ca.Image().Info().Extent().Width(),
ca.Image().Info().Extent().Height(),
ca.Image().Info().Fmt(),
attRef.Attachment(), true, nil
}
}

}
case api.FramebufferAttachment_Depth:
if !subpassDesc.DepthStencilAttachment().IsNil() && !lastDrawInfo.Framebuffer().IsNil() {
attRef := subpassDesc.DepthStencilAttachment()
if attachment, ok := lastDrawInfo.Framebuffer().ImageAttachments().Lookup(attRef.Attachment()); ok {
depthImg := attachment.Image()
return depthImg.Info().Extent().Width(), depthImg.Info().Extent().Height(), depthImg.Info().Fmt(), attRef.Attachment(), true, nil
// This can occur if we destroy the image-view, we remove it from the framebuffer,
// but may not unbind the framebuffer.
if !depthImg.IsNil() {
return depthImg.Info().Extent().Width(), depthImg.Info().Extent().Height(), depthImg.Info().Fmt(), attRef.Attachment(), true, nil
}
}
}
case api.FramebufferAttachment_Stencil:
Expand Down