[wined3d] Status update: Converting Wined3d to use WGL instead
Aric.Cyr at gmail.com
Fri Jan 13 01:06:10 CST 2006
Lionel Ulmer <lionel.ulmer <at> free.fr> writes:
> On Thu, Jan 12, 2006 at 02:17:11AM +0000, Aric Cyr wrote:
> > Most of the problems I've come across were GLXContext related... namely due
> > to a
> > problem in wine's wgl which causes an app to think there is a current
> > context,
> > when infact there isn't. (See wglGetCurrentContext in wgl.c, and see what
> > happens when there is no glX context, especially between calls to
> > wglCreateContext and wglMakeCurrent).
> Could you explain in more details what the problem is ?
The problem occurs is wglGetCurrentContext is called between wglCreateContext
and wglMakeCurrent, and there is no real glX context current. In this case
glXGetCurrentContext() will return NULL, and wglGetCurrentContext will then
search for a context matching NULL, which will be the deferred context created
by wglCreateContext. The fix is simply to return NULL from
wglGetCurrentContext() if glXGetCurrentContext is NULL... I believe a similar
issue would happen in wglGetCurrentDC() as well, but I haven't verified it
(other than visually).
> > Another change I made which I'm not sure about and would like feedback for,
> > is
> > to change wgl's process_attach to use wgl functions instead of glX
> > functions.
> > The reason for this is so that the GLXContext that is created will be
> > properly
> > added to the context list so it can be used for other purposes. This should
> > reduce the number of GL contexts by one for all d3d and (behaved) opengl
> > apps.
> This default context was only added to prevent one game from breaking (do
> not remember the name of it though) which did some 'glGet' stuff before
> creating its context.
Yes, I gathered that from the comments, I just didn't know how common this
> And if you put in the context_list, in that case 'wglGetCurrentContext' will
> return this dummy context (instead of NULL as in the current code as it
> won't find this dummy one in the linked list).
The reason I put it in the context list is so that it can be seen by
wglGetCurrentContext. Even though it is a hack for a broken game, there doesn't
seem any reason to me to make it invisible to other applications. It is just a
way of potentially saving the resources for one render context. Personally I'd
love to get rid of that context all-together, but since it fixes a bug, I guess
there is no choice.
More information about the wine-devel