Re: X11Drv: move WGL extension code

2006-09-12 Thread Lionel Ulmer
On Fri, Sep 01, 2006 at 01:57:24PM +0200, Roderick Colenbrander wrote:
 The way WGL extensions are loaded is different. The old code correctly
 advertised the names of available WGL extensions but the wglGetProcAddress
 code didn't work correctly. Even if an extension wasn't advertised you could
 get a function pointer to the functions. On Windows wglGetProcAddress would
 return NULL.

Note that (as far as I know), 'wglGetProcAddress' returns NULL on
non-existant extensions for all extensions, whether they are GL or WGL ones.

This means that our implementation of it is broken (at least on DRI / Mesa)
as 'glXGetProcAddress' may return a non-NULL value when querying a
non-supported extension.

So if we really want to be windows-like, we would need to add a 'function
name / extension name' database and check if the extension corresponding to
the function is present before actually calling 'glXGetProcAddress'.

But as I ever only once got a bug report linked to that, I never took the
pain to fix it :-)

  Lionel (catching up his old mails)

PS: I guess that this 'database' may be automatically build by the
'make_opengl' script though so it should not be that hard to do :-)

-- 
 Lionel Ulmer - http://www.bbrox.org/




Re: X11Drv: move WGL extension code

2006-09-11 Thread Alexandre Julliard
Roderick Colenbrander [EMAIL PROTECTED] writes:

 The patch adds new WGL extension loading code based on code written
 by an old opengl32 - x11drv patch written by Tomas Carnacky. The
 code properly advertises WGL extensions and only returns function
 pointers when the extension is really available.

It would be nicer to declare the extensions as constant variables
instead of building everything at run time. Something like:

static const struct wglextension swap_control =
{
  WGL_EXT_swap_control,
  {
{ wglSwapIntervalEXT, X11DRV_wglSwapIntervalEXT },
{ wglGetSwapIntervalEXT, X11DRV_wglGetSwapIntervalEXT },
  }
};

static void load_extensions(void)
{
if (glxRequireExtension(GLX_SGI_swap_control))
register_extension( swap_control );
... etc.
}

Then the extension list can simply store a pointer instead of copying
the whole thing once more, and you avoid a lot of nasty macros.

-- 
Alexandre Julliard
[EMAIL PROTECTED]