Skip to content

Commit

Permalink
gapis/gles: Workarounds for EGL_EXT_buffer_age #846.
Browse files Browse the repository at this point in the history
See verbose comments.
  • Loading branch information
ben-clayton committed Aug 1, 2017
1 parent 2774352 commit 38ea2bc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
12 changes: 10 additions & 2 deletions gapis/api/gles/dependency_graph_behaviour_provider.go
Expand Up @@ -117,8 +117,16 @@ func (*GlesDependencyGraphBehaviourProvider) GetBehaviourForAtom(
c := GetContext(s, cmd.Thread())
if c != nil && c.Info.Initialized {
_, isEglSwapBuffers := cmd.(*EglSwapBuffers)
_, isEglSwapBuffersWithDamageKHR := cmd.(*EglSwapBuffersWithDamageKHR)
if isEglSwapBuffers || isEglSwapBuffersWithDamageKHR {
// TODO: We should also be considering eglSwapBuffersWithDamageKHR here
// too, but this is nearly exculsively used by the Android framework,
// which also loves to do partial framebuffer updates. Unfortunately
// we do not currently know whether the framebuffer is invalidated
// between calls to eglSwapBuffersWithDamageKHR as the OS now uses
// the EGL_EXT_buffer_age extension, which we do not track. For now,
// assume that eglSwapBuffersWithDamageKHR calls are coming from the
// framework, and that the framebuffer is reused between calls.
// BUG: https://github.com/google/gapid/issues/846.
if isEglSwapBuffers {
// Get default renderbuffers
fb := c.Objects.Framebuffers[0]
color := fb.ColorAttachments[0].Renderbuffer
Expand Down
13 changes: 13 additions & 0 deletions gapis/api/gles/undefined_framebuffer.go
Expand Up @@ -40,6 +40,19 @@ func undefinedFramebuffer(ctx context.Context, device *device.Instance) transfor
seenSurfaces[eglMakeCurrent.Draw] = true
}
if cmd.CmdFlags().IsStartOfFrame() {
if _, ok := cmd.(*EglSwapBuffersWithDamageKHR); ok {
// TODO: This is a hack. eglSwapBuffersWithDamageKHR is nearly
// exculsively used by the Android framework, which also loves
// to do partial framebuffer updates. Unfortunately we do not
// currently know whether the framebuffer is invalidated between
// calls to eglSwapBuffersWithDamageKHR as the OS now uses the
// EGL_EXT_buffer_age extension, which we do not track. For now,
// assume that eglSwapBuffersWithDamageKHR calls are coming from
// the framework, and that the framebuffer is reused between
// calls.
// BUG: https://github.com/google/gapid/issues/846.
return
}
if c != nil && !c.Info.PreserveBuffersOnSwap {
drawUndefinedFramebuffer(ctx, id, cmd, device, s, c, out)
}
Expand Down

0 comments on commit 38ea2bc

Please sign in to comment.