mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
egl-winsys: Bind the framebuffer before swapping
For some reason the EGL spec says that the surface passed to eglSwapBuffers must be bound as the current surface for the swap to work. Mesa validates that this is the case and returns an error from the swap buffers call if not. https://bugzilla.gnome.org/show_bug.cgi?id=665604 Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
parent
d16131a09f
commit
dba42715d4
@ -1538,6 +1538,14 @@ _cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen,
|
||||
rect[1] = framebuffer_height - rect[1] - rect[3];
|
||||
}
|
||||
|
||||
/* At least for eglSwapBuffers the EGL spec says that the surface to
|
||||
swap must be bound to the current context. It looks like Mesa
|
||||
also validates that this is the case for eglSwapBuffersRegion so
|
||||
we must bind here too */
|
||||
_cogl_framebuffer_flush_state (COGL_FRAMEBUFFER (onscreen),
|
||||
COGL_FRAMEBUFFER (onscreen),
|
||||
COGL_FRAMEBUFFER_STATE_BIND);
|
||||
|
||||
if (egl_renderer->pf_eglSwapBuffersRegion (egl_renderer->edpy,
|
||||
egl_onscreen->egl_surface,
|
||||
n_rectangles,
|
||||
@ -1578,6 +1586,15 @@ _cogl_winsys_onscreen_swap_buffers (CoglOnscreen *onscreen)
|
||||
&egl_onscreen->kms_onscreen);
|
||||
return;
|
||||
#else
|
||||
/* The specification for EGL (at least in 1.4) says that the surface
|
||||
needs to be bound to the current context for the swap to work
|
||||
although it may change in future. Mesa explicitly checks for this
|
||||
and just returns an error if this is not the case so we can't
|
||||
just pretend this isn't in the spec. */
|
||||
_cogl_framebuffer_flush_state (COGL_FRAMEBUFFER (onscreen),
|
||||
COGL_FRAMEBUFFER (onscreen),
|
||||
COGL_FRAMEBUFFER_STATE_BIND);
|
||||
|
||||
eglSwapBuffers (egl_renderer->edpy, egl_onscreen->egl_surface);
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user