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

gles/compat: Handle glDeleteFramebuffers() where the buffer is bound. #1266

Merged
merged 2 commits into from
Oct 26, 2017
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
23 changes: 22 additions & 1 deletion gapis/api/gles/compat.go
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,27 @@ func compat(ctx context.Context, device *device.Instance) (transform.Transformer
return
}

case *GlDeleteFramebuffers:
// If you delete a framebuffer that is currently bound then the
// binding automatically reverts back to the default framebuffer
// (0). As we do compat for glBindFramebuffer(), scan the list of
// framebuffers that are being deleted, and forward them to a fake
// call to glBindFramebuffer(XXX, 0) if we find any.
cmd.extras.Observations().ApplyReads(s.Memory.ApplicationPool())
fbs, err := cmd.Framebuffers.Slice(0, uint64(cmd.Count), s.MemoryLayout).Read(ctx, cmd, s, nil)
if err == nil {
for _, fb := range fbs {
if fb == c.Bound.DrawFramebuffer.ID {
t.Transform(ctx, dID, cb.GlBindFramebuffer(GLenum_GL_DRAW_FRAMEBUFFER, 0), out)
}
if fb == c.Bound.ReadFramebuffer.ID {
t.Transform(ctx, dID, cb.GlBindFramebuffer(GLenum_GL_READ_FRAMEBUFFER, 0), out)
}
}
out.MutateAndWrite(ctx, dID, cmd)
return
}

case *GlBindFramebuffer:
if cmd.Framebuffer != 0 && !c.Objects.GeneratedNames.Framebuffers[cmd.Framebuffer] {
// glGenFramebuffers() was not used to generate the buffer. Legal in GLES.
Expand All @@ -975,7 +996,7 @@ func compat(ctx context.Context, device *device.Instance) (transform.Transformer
// SRGB capable. Thus, when SRGB is enabled in the state, and we're
// binding the default framebuffer, SRGB needs to be disabled, and
// specifically enabled when binding the non-default framebuffer.
// (If it was explicetly disabled in the capture, no change is needed.)
// (If it was explicitly disabled in the capture, no change is needed.)
// TODO: Handle the use of the EGL KHR_gl_colorspace extension.
if cmd.Target == GLenum_GL_FRAMEBUFFER || cmd.Target == GLenum_GL_DRAW_FRAMEBUFFER {
origSrgb := c.Pixel.FramebufferSrgb
Expand Down