wined3d: Fetch GL functions from the WGL driver table, including glFinish and glFlush.

This commit is contained in:
Alexandre Julliard 2012-07-19 15:37:25 +02:00
parent 72e873873e
commit d7250e97ed
8 changed files with 28 additions and 38 deletions

View File

@ -7399,7 +7399,7 @@ HRESULT arbfp_blit_surface(struct wined3d_device *device, DWORD filter,
if (wined3d_settings.strict_draw_ordering
|| (dst_surface->container.type == WINED3D_CONTAINER_SWAPCHAIN
&& (dst_surface->container.u.swapchain->front_buffer == dst_surface)))
wglFlush(); /* Flush to ensure ordering across contexts. */
glFlush(); /* Flush to ensure ordering across contexts. */
context_release(context);

View File

@ -635,7 +635,7 @@ static void buffer_sync_apple(struct wined3d_buffer *This, DWORD flags, const st
}
/* Since we don't know about old draws a glFinish is needed once */
wglFinish();
glFinish();
return;
}
TRACE("Synchronizing buffer %p\n", This);
@ -663,7 +663,7 @@ drop_query:
This->query = NULL;
}
wglFinish();
glFinish();
ENTER_GL();
GL_EXTCALL(glBufferParameteriAPPLE(This->buffer_type_hint, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_TRUE));
checkGLcall("glBufferParameteriAPPLE(This->buffer_type_hint, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_TRUE)");
@ -1195,7 +1195,7 @@ void CDECL wined3d_buffer_unmap(struct wined3d_buffer *buffer)
GL_EXTCALL(glUnmapBufferARB(buffer->buffer_type_hint));
LEAVE_GL();
if (wined3d_settings.strict_draw_ordering) wglFlush(); /* Flush to ensure ordering across contexts. */
if (wined3d_settings.strict_draw_ordering) glFlush(); /* Flush to ensure ordering across contexts. */
context_release(context);
buffer->resource.allocatedMemory = NULL;

View File

@ -819,7 +819,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
if (wined3d_settings.strict_draw_ordering || (flags & WINED3DCLEAR_TARGET
&& target->container.type == WINED3D_CONTAINER_SWAPCHAIN
&& target->container.u.swapchain->front_buffer == target))
wglFlush(); /* Flush to ensure ordering across contexts. */
glFlush(); /* Flush to ensure ordering across contexts. */
context_release(context);
}
@ -3811,7 +3811,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device)
context = context_acquire(device, NULL);
/* We only have to do this if we need to read the, swapbuffers performs a flush for us */
wglFlush();
glFlush();
/* No checkGLcall here to avoid locking the lock just for checking a call that hardly ever
* fails. */
context_release(context);

View File

@ -556,7 +556,7 @@ static void test_pbo_functionality(struct wined3d_gl_info *gl_info)
GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0));
LEAVE_GL();
wglFinish(); /* just to be sure */
glFinish(); /* just to be sure */
memset(check, 0, sizeof(check));
ENTER_GL();
@ -5408,11 +5408,14 @@ static BOOL InitAdapters(struct wined3d *wined3d)
}
}
/* Dynamically load all GL core functions */
#ifdef USE_WIN32_OPENGL
pwglGetProcAddress = (void*)GetProcAddress(mod_gl, "wglGetProcAddress");
#define USE_GL_FUNC(pfn) pfn = (void*)GetProcAddress(mod_gl, #pfn);
GL_FUNCS_GEN;
#undef USE_GL_FUNC
#else
/* To bypass the opengl32 thunks load wglGetProcAddress from gdi32 instead of opengl32 */
/* To bypass the opengl32 thunks retrieve functions from the WGL driver instead of opengl32 */
{
HDC hdc = GetDC( 0 );
const struct opengl_funcs *wgl_driver = __wine_get_wgl_driver( hdc, WINE_WGL_DRIVER_VERSION );
@ -5422,8 +5425,10 @@ static BOOL InitAdapters(struct wined3d *wined3d)
ReleaseDC( 0, hdc );
if (!pwglGetProcAddress) goto nogl_adapter;
#define USE_GL_FUNC(pfn) pfn = wgl_driver->gl.p_##pfn;
GL_FUNCS_GEN;
#undef USE_GL_FUNC
}
#define USE_GL_FUNC(pfn) pfn = (void*)pwglGetProcAddress(#pfn);
#endif
/* Load WGL core functions from opengl32.dll */
@ -5431,16 +5436,6 @@ static BOOL InitAdapters(struct wined3d *wined3d)
WGL_FUNCS_GEN;
#undef USE_WGL_FUNC
/* Dynamically load all GL core functions */
GL_FUNCS_GEN;
#undef USE_GL_FUNC
/* Load glFinish and glFlush from opengl32.dll even if we're not using WIN32 opengl
* otherwise because we have to use winex11.drv's override
*/
wglFinish = (void*)GetProcAddress(mod_gl, "glFinish");
wglFlush = (void*)GetProcAddress(mod_gl, "glFlush");
glEnableWINE = glEnable;
glDisableWINE = glDisable;

View File

@ -767,7 +767,7 @@ void drawPrimitive(struct wined3d_device *device, UINT index_count, UINT StartId
wined3d_event_query_issue(device->buffer_queries[i], device);
}
if (wined3d_settings.strict_draw_ordering) wglFlush(); /* Flush to ensure ordering across contexts. */
if (wined3d_settings.strict_draw_ordering) glFlush(); /* Flush to ensure ordering across contexts. */
context_release(context);

View File

@ -1136,7 +1136,7 @@ static void wined3d_surface_depth_blt_fbo(const struct wined3d_device *device, s
LEAVE_GL();
if (wined3d_settings.strict_draw_ordering)
wglFlush(); /* Flush to ensure ordering across contexts. */
glFlush(); /* Flush to ensure ordering across contexts. */
context_release(context);
}
@ -1259,7 +1259,7 @@ static void surface_blt_fbo(const struct wined3d_device *device, enum wined3d_te
if (wined3d_settings.strict_draw_ordering
|| (dst_location == SFLAG_INDRAWABLE
&& dst_surface->container.u.swapchain->front_buffer == dst_surface))
wglFlush();
glFlush();
context_release(context);
}
@ -2378,7 +2378,7 @@ static void surface_upload_data(struct wined3d_surface *surface, const struct wi
LEAVE_GL();
if (wined3d_settings.strict_draw_ordering)
wglFlush();
glFlush();
if (gl_info->quirks & WINED3D_QUIRK_FBO_TEX_UPDATE)
{
@ -4575,7 +4575,7 @@ static void flush_to_framebuffer_drawpixels(struct wined3d_surface *surface,
if (wined3d_settings.strict_draw_ordering
|| (surface->container.type == WINED3D_CONTAINER_SWAPCHAIN
&& surface->container.u.swapchain->front_buffer == surface))
wglFlush();
glFlush();
context_release(context);
}
@ -5260,7 +5260,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st
LEAVE_GL();
if (wined3d_settings.strict_draw_ordering) wglFlush(); /* Flush to ensure ordering across contexts. */
if (wined3d_settings.strict_draw_ordering) glFlush(); /* Flush to ensure ordering across contexts. */
context_release(context);
@ -5363,7 +5363,7 @@ static void surface_blt_to_drawable(const struct wined3d_device *device,
if (wined3d_settings.strict_draw_ordering
|| (dst_surface->container.type == WINED3D_CONTAINER_SWAPCHAIN
&& (dst_surface->container.u.swapchain->front_buffer == dst_surface)))
wglFlush(); /* Flush to ensure ordering across contexts. */
glFlush(); /* Flush to ensure ordering across contexts. */
context_release(context);
}
@ -5794,7 +5794,7 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
LEAVE_GL();
if (wined3d_settings.strict_draw_ordering) wglFlush(); /* Flush to ensure ordering across contexts. */
if (wined3d_settings.strict_draw_ordering) glFlush(); /* Flush to ensure ordering across contexts. */
}
else if (location == SFLAG_INDRAWABLE)
{
@ -5812,7 +5812,7 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
LEAVE_GL();
if (wined3d_settings.strict_draw_ordering) wglFlush(); /* Flush to ensure ordering across contexts. */
if (wined3d_settings.strict_draw_ordering) glFlush(); /* Flush to ensure ordering across contexts. */
}
else
{

View File

@ -564,7 +564,7 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT
}
if (swapchain->num_contexts > 1)
wglFinish();
glFinish();
SwapBuffers(context->hdc); /* TODO: cycle through the swapchain buffers */
TRACE("SwapBuffers called, Starting new frame\n");

View File

@ -1095,6 +1095,8 @@ void (WINE_GLAPI *glEvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint
void (WINE_GLAPI *glEvalPoint1)(GLint i) DECLSPEC_HIDDEN;
void (WINE_GLAPI *glEvalPoint2)(GLint i, GLint j) DECLSPEC_HIDDEN;
void (WINE_GLAPI *glFeedbackBuffer)(GLsizei size, GLenum type, GLfloat *buffer) DECLSPEC_HIDDEN;
void (WINE_GLAPI *glFinish)(void) DECLSPEC_HIDDEN;
void (WINE_GLAPI *glFlush)(void) DECLSPEC_HIDDEN;
void (WINE_GLAPI *glFogf)(GLenum pname, GLfloat param) DECLSPEC_HIDDEN;
void (WINE_GLAPI *glFogfv)(GLenum pname, const GLfloat *params) DECLSPEC_HIDDEN;
void (WINE_GLAPI *glFogi)(GLenum pname, GLint param) DECLSPEC_HIDDEN;
@ -1353,15 +1355,6 @@ void (WINE_GLAPI *glVertex4sv)(const GLshort *v) DECLSPEC_HIDDEN;
void (WINE_GLAPI *glVertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) DECLSPEC_HIDDEN;
void (WINE_GLAPI *glViewport)(GLint x, GLint y, GLsizei width, GLsizei height) DECLSPEC_HIDDEN;
/* glFinish and glFlush are always loaded from opengl32.dll, thus they always have
* __stdcall calling convention.
*
* They are wgl functions and must not be called inside the gl lock, give them a
* name that makes this clear
*/
void (__stdcall *wglFinish)(void) DECLSPEC_HIDDEN;
void (__stdcall *wglFlush)(void) DECLSPEC_HIDDEN;
/* WGL functions */
HGLRC (WINAPI *pwglCreateContext)(HDC) DECLSPEC_HIDDEN;
BOOL (WINAPI *pwglDeleteContext)(HGLRC) DECLSPEC_HIDDEN;
@ -1461,6 +1454,8 @@ BOOL (WINAPI *pwglShareLists)(HGLRC, HGLRC) DECLSPEC_HIDDEN;
USE_GL_FUNC(glEvalPoint1) \
USE_GL_FUNC(glEvalPoint2) \
USE_GL_FUNC(glFeedbackBuffer) \
USE_GL_FUNC(glFinish) \
USE_GL_FUNC(glFlush) \
USE_GL_FUNC(glFogf) \
USE_GL_FUNC(glFogfv) \
USE_GL_FUNC(glFogi) \