2016-03-12 14:57 GMT+01:00 Miklós Máté mtmkls@gmail.com:
Theoretically wglBindTexImageARB is supposed to be a fast render-to-texture method, and creating a new context is anything but fast.
This fixes horrible performance in Star Wars Knights of the Old Republic when post-process effects are enabled.
v2: fix context caching, fix destructor, fix comments v3: better handling of context delete
Signed-off-by: Miklós Máté mtmkls@gmail.com
Thank you for following up after the review comments. Unfortunately I think there is one more (and hopefully last) bit which still needs addressing:
@@ -2301,6 +2314,7 @@ static struct wgl_pbuffer *X11DRV_wglCreatePbufferARB( HDC hdc, int iPixelFormat SetLastError(ERROR_NO_SYSTEM_RESOURCES); goto create_failed; /* unexpected error */ }
- list_add_head( &pbuffer_list, &object->entry ); TRACE("->(%p)\n", object); return object;
This needs to be done inside the critical section, so please put EnterCriticalSection() + LeaveCriticalSection() around it. FTR the wglCreateContext and wglCreateContextAttribsARB implementation functions indirectly acquire and release the critical section via get_gl_drawable() / release_gl_drawable().
It looks good to me otherwise.