This looks good to me:<div><br></div><div>Reviewed-by: Robert Bragg <<a href="mailto:robert@linux.intel.com">robert@linux.intel.com</a>></div><div><br></div><div>thanks,</div><div>- Robert</div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Tue, Nov 13, 2012 at 12:10 PM, Neil Roberts <span dir="ltr"><<a href="mailto:neil@linux.intel.com" target="_blank">neil@linux.intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The ‘length’ for the swap chain is initially -1 which is supposed to<br>
mean ‘no preference’. However, both of the SDL winsys's were<br>
explicitly setting the SDL_GL_DOUBLEBUFFER attribute to zero in that<br>
case which would try to disable double buffering.<br>
<br>
On OS X, the equivalent to eglSwapBuffers (ie, [NSOpenGLContext<br>
flushBuffer]) does nothing for a single buffer context. The<br>
cogl-sdl-hello example does not specify the swap chain length so<br>
presumably it would end up with a single buffer config. When<br>
cogl_onscreen_swap_buffers is called it therefore does nothing and<br>
nothing is painted.<br>
<br>
I guess to make single-buffered contexts actually useful we should<br>
expose some public equivalent to glFlush so that you can ensure the<br>
rendering commands will actually hit the buffer. Alteneratively we<br>
could document that cogl_onscreen_swap_buffers performs this task on<br>
single-buffered configs and then we could make the SDL winsys<br>
explicitly call glFlush in that case.<br>
---<br>
 cogl/winsys/cogl-winsys-sdl.c  | 5 +++--<br>
 cogl/winsys/cogl-winsys-sdl2.c | 5 +++--<br>
 2 files changed, 6 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/cogl/winsys/cogl-winsys-sdl.c b/cogl/winsys/cogl-winsys-sdl.c<br>
index ccb0764..63abbd0 100644<br>
--- a/cogl/winsys/cogl-winsys-sdl.c<br>
+++ b/cogl/winsys/cogl-winsys-sdl.c<br>
@@ -135,8 +135,9 @@ set_gl_attribs_from_framebuffer_config (CoglFramebufferConfig *config)<br>
   SDL_GL_SetAttribute (SDL_GL_STENCIL_SIZE,<br>
                        config->need_stencil ? 1 : 0);<br>
<br>
-  SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER,<br>
-                       config->swap_chain->length > 1 ? 1 : 0);<br>
+  if (config->swap_chain->length >= 0)<br>
+    SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER,<br>
+                         config->swap_chain->length > 1 ? 1 : 0);<br>
<br>
   SDL_GL_SetAttribute (SDL_GL_ALPHA_SIZE,<br>
                        config->swap_chain->has_alpha ? 1 : 0);<br>
diff --git a/cogl/winsys/cogl-winsys-sdl2.c b/cogl/winsys/cogl-winsys-sdl2.c<br>
index 4c0583b..0df2607 100644<br>
--- a/cogl/winsys/cogl-winsys-sdl2.c<br>
+++ b/cogl/winsys/cogl-winsys-sdl2.c<br>
@@ -131,8 +131,9 @@ set_gl_attribs_from_framebuffer_config (CoglFramebufferConfig *config)<br>
   SDL_GL_SetAttribute (SDL_GL_STENCIL_SIZE,<br>
                        config->need_stencil ? 1 : 0);<br>
<br>
-  SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER,<br>
-                       config->swap_chain->length > 1 ? 1 : 0);<br>
+  if (config->swap_chain->length >= 0)<br>
+    SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER,<br>
+                         config->swap_chain->length > 1 ? 1 : 0);<br>
<br>
   SDL_GL_SetAttribute (SDL_GL_ALPHA_SIZE,<br>
                        config->swap_chain->has_alpha ? 1 : 0);<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.11.3.g3c3efa5<br>
<br>
_______________________________________________<br>
Cogl mailing list<br>
<a href="mailto:Cogl@lists.freedesktop.org">Cogl@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/cogl" target="_blank">http://lists.freedesktop.org/mailman/listinfo/cogl</a><br>
</font></span></blockquote></div><br></div>