On Sat, May 31, 2014 at 12:02:10PM -0700, Jose Fonseca wrote:
> 
> 
> ----- Original Message -----
> > 
> > 
> > ----- Original Message -----
> > > On 24/05/14 20:28, Emil Velikov wrote:
> > > > Hi all,
> > > > 
> > > > Another round of interesting bits and bulbs.
> > > > 
> > > Bit of an update:
> > > 
> > > > The email came out a bit longer than expected, although it provides a
> > > > decent
> > > > list of possible solutions. Let me know which one you'll go with.
> > > > 
> > > > Four topics sorted by priority - high to low (based on my humble 
> > > > opinion)
> > > > 
> > > > * ChoosePixelFormat - close yet quite different across platforms.
> > > > 
> > > >   - glXChoosePixelFormat    - depends on display (matches waffle's
> > > >   model).
> > > >   - CGLChoosePixelFormat    - no dependencies.
> > > >   - {wgl,}ChoosePixelFormat - depends on a device_context/existing
> > > >   window.
> > > > 
> > > To make things better, wgl functions depend on a current context as well.
> > > The
> > > recommended way of doing things under windows seems to be the following:
> > > 
> > >    window_handle = CreateWindow(...)
> > >    device_context = GetDC(window_handle);
> > > 
> > >    gl_rendering_context = wglCreateContext(device_context);
> > >    wglMakeCurrent (device_handle, gl_rendering_context);
> > > 
> > >    // any of the following
> > >    wglGetProcAddress(...)
> > >    wglChoosePixelFormat(...)
> > >    ....
> > > 
> > >    wglMakeCurrent (device_handle, NULL);
> > >    wglDeleteContext (gl_rendering_context);
> > > 
> > >    ReleaseDC(device_context);
> > >    DestroyWindow(window_handle);
> > 
> > Yep.
> > 
> > 
> > 
> > > 
> > > AFAICS waffle is unique wrt other projects (apitrace, epoxy, glut) as it
> > > allows the PixelFormat to be called prior to the creation of either window
> > > or
> > > context.


If you could rewrite this problematic portion of Waffle's API, how would
you design it? I'm asking so that, if we do redesign Waffle's API one
day, it can better accommodate Windows and Mac.

One requirement of any API redesign, though, is to preserve the ability
to create a context and render into it without creating a throwaway
surface, as in EGL_KHR_surfaceless_context. (Through-away surfaces are
ok as long as they are internal to Waffle).


> > > >   Options:
> > > >     - Create a window, choose format, destroy window.
> > > >           No guarantee that the function will behave the same for 
> > > > another
> > > >           window/device_context.
> > 
> > In practice, the odds of this happening are very low.
> 
> Just to be clear. This assumption will break when there are multiple GPUs on 
> the system (each CPU connected to a different display). Anyway, getting 
> OpenGL to work across multiple GPU (if you move the window from one display 
> to another bad things will probably happen.)
> 
> The reason that wglGetProcAddress requires window/context is because only 
> then will OPENGL32.DLL know which ICD DLL to load.

Emil, if you decide to create an invisible window internal to Waffle,
maybe the best time to do that is during waffle_display_connect() and
store it in the display. Just a thought, and maybe not a good one.
_______________________________________________
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle

Reply via email to