From 38ea2bc9bb2574deef0ab542cc20e711882bde0a Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Tue, 1 Aug 2017 19:08:28 +0100 Subject: [PATCH] gapis/gles: Workarounds for EGL_EXT_buffer_age #846. See verbose comments. --- .../api/gles/dependency_graph_behaviour_provider.go | 12 ++++++++++-- gapis/api/gles/undefined_framebuffer.go | 13 +++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/gapis/api/gles/dependency_graph_behaviour_provider.go b/gapis/api/gles/dependency_graph_behaviour_provider.go index 41f2d43385..37474b2f09 100644 --- a/gapis/api/gles/dependency_graph_behaviour_provider.go +++ b/gapis/api/gles/dependency_graph_behaviour_provider.go @@ -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 diff --git a/gapis/api/gles/undefined_framebuffer.go b/gapis/api/gles/undefined_framebuffer.go index 846a056e72..6126480ae7 100644 --- a/gapis/api/gles/undefined_framebuffer.go +++ b/gapis/api/gles/undefined_framebuffer.go @@ -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) }