wgl: Remove GL scissors/viewport override.

This commit is contained in:
Chris Robinson 2007-09-25 10:21:40 -07:00 committed by Alexandre Julliard
parent a8124f97e6
commit ebfba49e27
4 changed files with 52 additions and 213 deletions

View File

@ -215,11 +215,6 @@ sub GenerateThunk($$$$$)
return "" if $func_ref->[0] eq "glGetString"; return "" if $func_ref->[0] eq "glGetString";
return "" if $func_ref->[0] eq "glGetIntegerv"; return "" if $func_ref->[0] eq "glGetIntegerv";
return "" if $func_ref->[0] eq "glEnable";
return "" if $func_ref->[0] eq "glIsEnabled";
return "" if $func_ref->[0] eq "glDisable";
return "" if $func_ref->[0] eq "glScissor";
return "" if $func_ref->[0] eq "glViewport";
return "" if $func_ref->[0] eq "glFinish"; return "" if $func_ref->[0] eq "glFinish";
return "" if $func_ref->[0] eq "glFlush"; return "" if $func_ref->[0] eq "glFlush";

View File

@ -809,6 +809,16 @@ void WINAPI wine_glDepthRange( GLclampd nearParam, GLclampd farParam ) {
LEAVE_GL(); LEAVE_GL();
} }
/***********************************************************************
* glDisable (OPENGL32.@)
*/
void WINAPI wine_glDisable( GLenum cap ) {
TRACE("(%d)\n", cap );
ENTER_GL();
glDisable( cap );
LEAVE_GL();
}
/*********************************************************************** /***********************************************************************
* glDisableClientState (OPENGL32.@) * glDisableClientState (OPENGL32.@)
*/ */
@ -899,6 +909,16 @@ void WINAPI wine_glEdgeFlagv( GLboolean* flag ) {
LEAVE_GL(); LEAVE_GL();
} }
/***********************************************************************
* glEnable (OPENGL32.@)
*/
void WINAPI wine_glEnable( GLenum cap ) {
TRACE("(%d)\n", cap );
ENTER_GL();
glEnable( cap );
LEAVE_GL();
}
/*********************************************************************** /***********************************************************************
* glEnableClientState (OPENGL32.@) * glEnableClientState (OPENGL32.@)
*/ */
@ -1703,6 +1723,18 @@ void WINAPI wine_glInterleavedArrays( GLenum format, GLsizei stride, GLvoid* poi
LEAVE_GL(); LEAVE_GL();
} }
/***********************************************************************
* glIsEnabled (OPENGL32.@)
*/
GLboolean WINAPI wine_glIsEnabled( GLenum cap ) {
GLboolean ret_value;
TRACE("(%d)\n", cap );
ENTER_GL();
ret_value = glIsEnabled( cap );
LEAVE_GL();
return ret_value;
}
/*********************************************************************** /***********************************************************************
* glIsList (OPENGL32.@) * glIsList (OPENGL32.@)
*/ */
@ -2809,6 +2841,16 @@ void WINAPI wine_glScalef( GLfloat x, GLfloat y, GLfloat z ) {
LEAVE_GL(); LEAVE_GL();
} }
/***********************************************************************
* glScissor (OPENGL32.@)
*/
void WINAPI wine_glScissor( GLint x, GLint y, GLsizei width, GLsizei height ) {
TRACE("(%d, %d, %d, %d)\n", x, y, width, height );
ENTER_GL();
glScissor( x, y, width, height );
LEAVE_GL();
}
/*********************************************************************** /***********************************************************************
* glSelectBuffer (OPENGL32.@) * glSelectBuffer (OPENGL32.@)
*/ */
@ -3668,3 +3710,13 @@ void WINAPI wine_glVertexPointer( GLint size, GLenum type, GLsizei stride, GLvoi
glVertexPointer( size, type, stride, pointer ); glVertexPointer( size, type, stride, pointer );
LEAVE_GL(); LEAVE_GL();
} }
/***********************************************************************
* glViewport (OPENGL32.@)
*/
void WINAPI wine_glViewport( GLint x, GLint y, GLsizei width, GLsizei height ) {
TRACE("(%d, %d, %d, %d)\n", x, y, width, height );
ENTER_GL();
glViewport( x, y, width, height );
LEAVE_GL();
}

View File

@ -48,12 +48,7 @@ WINE_DECLARE_DEBUG_CHANNEL(opengl);
typedef struct wine_wgl_s { typedef struct wine_wgl_s {
PROC WINAPI (*p_wglGetProcAddress)(LPCSTR lpszProc); PROC WINAPI (*p_wglGetProcAddress)(LPCSTR lpszProc);
void WINAPI (*p_wglDisable)(GLenum cap);
void WINAPI (*p_wglEnable)(GLenum cap);
void WINAPI (*p_wglGetIntegerv)(GLenum pname, GLint* params); void WINAPI (*p_wglGetIntegerv)(GLenum pname, GLint* params);
GLboolean WINAPI (*p_wglIsEnabled)(GLenum cap);
void WINAPI (*p_wglScissor)(GLint x, GLint y, GLsizei width, GLsizei height);
void WINAPI (*p_wglViewport)(GLint x, GLint y, GLsizei width, GLsizei height);
void WINAPI (*p_wglFinish)(void); void WINAPI (*p_wglFinish)(void);
void WINAPI (*p_wglFlush)(void); void WINAPI (*p_wglFlush)(void);
} wine_wgl_t; } wine_wgl_t;
@ -570,51 +565,6 @@ BOOL WINAPI wglUseFontOutlinesW(HDC hdc,
return wglUseFontOutlines_common(hdc, first, count, listBase, deviation, extrusion, format, lpgmf, TRUE); return wglUseFontOutlines_common(hdc, first, count, listBase, deviation, extrusion, format, lpgmf, TRUE);
} }
/***********************************************************************
* glEnable (OPENGL32.@)
*/
void WINAPI wine_glEnable( GLenum cap )
{
TRACE("(%d)\n", cap );
wine_wgl.p_wglEnable(cap);
}
/***********************************************************************
* glIsEnabled (OPENGL32.@)
*/
GLboolean WINAPI wine_glIsEnabled( GLenum cap )
{
TRACE("(%d)\n", cap );
return wine_wgl.p_wglIsEnabled(cap);
}
/***********************************************************************
* glDisable (OPENGL32.@)
*/
void WINAPI wine_glDisable( GLenum cap )
{
TRACE("(%d)\n", cap );
wine_wgl.p_wglDisable(cap);
}
/***********************************************************************
* glScissor (OPENGL32.@)
*/
void WINAPI wine_glScissor( GLint x, GLint y, GLsizei width, GLsizei height )
{
TRACE("(%d, %d, %d, %d)\n", x, y, width, height );
wine_wgl.p_wglScissor(x, y, width, height);
}
/***********************************************************************
* glViewport (OPENGL32.@)
*/
void WINAPI wine_glViewport( GLint x, GLint y, GLsizei width, GLsizei height )
{
TRACE("(%d, %d, %d, %d)\n", x, y, width, height );
wine_wgl.p_wglViewport(x, y, width, height);
}
/*********************************************************************** /***********************************************************************
* glFinish (OPENGL32.@) * glFinish (OPENGL32.@)
*/ */
@ -719,12 +669,7 @@ static BOOL process_attach(void)
wine_wgl.p_wglGetProcAddress = (void *)GetProcAddress(mod_gdi32, "wglGetProcAddress"); wine_wgl.p_wglGetProcAddress = (void *)GetProcAddress(mod_gdi32, "wglGetProcAddress");
/* Interal WGL function */ /* Interal WGL function */
wine_wgl.p_wglDisable = (void *)wine_wgl.p_wglGetProcAddress("wglDisable");
wine_wgl.p_wglEnable = (void *)wine_wgl.p_wglGetProcAddress("wglEnable");
wine_wgl.p_wglGetIntegerv = (void *)wine_wgl.p_wglGetProcAddress("wglGetIntegerv"); wine_wgl.p_wglGetIntegerv = (void *)wine_wgl.p_wglGetProcAddress("wglGetIntegerv");
wine_wgl.p_wglIsEnabled = (void *)wine_wgl.p_wglGetProcAddress("wglIsEnabled");
wine_wgl.p_wglScissor = (void *)wine_wgl.p_wglGetProcAddress("wglScissor");
wine_wgl.p_wglViewport = (void *)wine_wgl.p_wglGetProcAddress("wglViewport");
wine_wgl.p_wglFinish = (void *)wine_wgl.p_wglGetProcAddress("wglFinish"); wine_wgl.p_wglFinish = (void *)wine_wgl.p_wglGetProcAddress("wglFinish");
wine_wgl.p_wglFlush = (void *)wine_wgl.p_wglGetProcAddress("wglFlush"); wine_wgl.p_wglFlush = (void *)wine_wgl.p_wglGetProcAddress("wglFlush");

View File

@ -111,9 +111,6 @@ typedef struct wine_glcontext {
BOOL do_escape; BOOL do_escape;
X11DRV_PDEVICE *physDev; X11DRV_PDEVICE *physDev;
X11DRV_PDEVICE *pReadDev; X11DRV_PDEVICE *pReadDev;
RECT viewport;
RECT scissor;
BOOL scissor_enabled;
struct wine_glcontext *next; struct wine_glcontext *next;
struct wine_glcontext *prev; struct wine_glcontext *prev;
} Wine_GLContext; } Wine_GLContext;
@ -263,20 +260,15 @@ MAKE_FUNCPTR(glBitmap)
MAKE_FUNCPTR(glCopyTexSubImage1D) MAKE_FUNCPTR(glCopyTexSubImage1D)
MAKE_FUNCPTR(glCopyTexImage2D) MAKE_FUNCPTR(glCopyTexImage2D)
MAKE_FUNCPTR(glCopyTexSubImage2D) MAKE_FUNCPTR(glCopyTexSubImage2D)
MAKE_FUNCPTR(glDisable)
MAKE_FUNCPTR(glDrawBuffer) MAKE_FUNCPTR(glDrawBuffer)
MAKE_FUNCPTR(glEnable)
MAKE_FUNCPTR(glEndList) MAKE_FUNCPTR(glEndList)
MAKE_FUNCPTR(glGetError) MAKE_FUNCPTR(glGetError)
MAKE_FUNCPTR(glGetIntegerv) MAKE_FUNCPTR(glGetIntegerv)
MAKE_FUNCPTR(glGetString) MAKE_FUNCPTR(glGetString)
MAKE_FUNCPTR(glIsEnabled)
MAKE_FUNCPTR(glNewList) MAKE_FUNCPTR(glNewList)
MAKE_FUNCPTR(glPixelStorei) MAKE_FUNCPTR(glPixelStorei)
MAKE_FUNCPTR(glReadPixels) MAKE_FUNCPTR(glReadPixels)
MAKE_FUNCPTR(glScissor)
MAKE_FUNCPTR(glTexImage2D) MAKE_FUNCPTR(glTexImage2D)
MAKE_FUNCPTR(glViewport)
MAKE_FUNCPTR(glFinish) MAKE_FUNCPTR(glFinish)
MAKE_FUNCPTR(glFlush) MAKE_FUNCPTR(glFlush)
#undef MAKE_FUNCPTR #undef MAKE_FUNCPTR
@ -416,20 +408,15 @@ LOAD_FUNCPTR(glBitmap)
LOAD_FUNCPTR(glCopyTexSubImage1D) LOAD_FUNCPTR(glCopyTexSubImage1D)
LOAD_FUNCPTR(glCopyTexImage2D) LOAD_FUNCPTR(glCopyTexImage2D)
LOAD_FUNCPTR(glCopyTexSubImage2D) LOAD_FUNCPTR(glCopyTexSubImage2D)
LOAD_FUNCPTR(glDisable)
LOAD_FUNCPTR(glDrawBuffer) LOAD_FUNCPTR(glDrawBuffer)
LOAD_FUNCPTR(glEnable)
LOAD_FUNCPTR(glEndList) LOAD_FUNCPTR(glEndList)
LOAD_FUNCPTR(glGetError) LOAD_FUNCPTR(glGetError)
LOAD_FUNCPTR(glGetIntegerv) LOAD_FUNCPTR(glGetIntegerv)
LOAD_FUNCPTR(glGetString) LOAD_FUNCPTR(glGetString)
LOAD_FUNCPTR(glIsEnabled)
LOAD_FUNCPTR(glNewList) LOAD_FUNCPTR(glNewList)
LOAD_FUNCPTR(glPixelStorei) LOAD_FUNCPTR(glPixelStorei)
LOAD_FUNCPTR(glReadPixels) LOAD_FUNCPTR(glReadPixels)
LOAD_FUNCPTR(glScissor)
LOAD_FUNCPTR(glTexImage2D) LOAD_FUNCPTR(glTexImage2D)
LOAD_FUNCPTR(glViewport)
LOAD_FUNCPTR(glFinish) LOAD_FUNCPTR(glFinish)
LOAD_FUNCPTR(glFlush) LOAD_FUNCPTR(glFlush)
#undef LOAD_FUNCPTR #undef LOAD_FUNCPTR
@ -1568,53 +1555,6 @@ PROC X11DRV_wglGetProcAddress(LPCSTR lpszProc)
return NULL; return NULL;
} }
/***********************************************************************
* sync_current_drawable
*
* Adjust the current viewport and scissor in order to position
* and size the current drawable correctly on the parent window.
*/
static void sync_current_drawable(BOOL updatedc)
{
int dy;
int width;
int height;
RECT rc;
Wine_GLContext *ctx = (Wine_GLContext *) NtCurrentTeb()->glContext;
TRACE("\n");
if (ctx && ctx->physDev)
{
if (updatedc)
GetClipBox(ctx->physDev->hdc, &rc); /* Make sure physDev is up to date */
dy = ctx->physDev->drawable_rect.bottom - ctx->physDev->drawable_rect.top -
ctx->physDev->dc_rect.bottom;
width = ctx->physDev->dc_rect.right - ctx->physDev->dc_rect.left;
height = ctx->physDev->dc_rect.bottom - ctx->physDev->dc_rect.top;
wine_tsx11_lock();
pglViewport(ctx->physDev->dc_rect.left + ctx->viewport.left,
dy + ctx->viewport.top,
ctx->viewport.right ? (ctx->viewport.right - ctx->viewport.left) : width,
ctx->viewport.bottom ? (ctx->viewport.bottom - ctx->viewport.top) : height);
pglEnable(GL_SCISSOR_TEST);
if (ctx->scissor_enabled)
pglScissor(ctx->physDev->dc_rect.left + min(width, max(0, ctx->scissor.left)),
dy + min(height, max(0, ctx->scissor.top)),
min(width, max(0, ctx->scissor.right - ctx->scissor.left)),
min(height, max(0, ctx->scissor.bottom - ctx->scissor.top)));
else
pglScissor(ctx->physDev->dc_rect.left, dy, width, height);
wine_tsx11_unlock();
}
}
/** /**
* X11DRV_wglMakeCurrent * X11DRV_wglMakeCurrent
* *
@ -1671,10 +1611,6 @@ BOOL X11DRV_wglMakeCurrent(X11DRV_PDEVICE *physDev, HGLRC hglrc) {
ctx->do_escape = TRUE; ctx->do_escape = TRUE;
pglDrawBuffer(GL_FRONT_LEFT); pglDrawBuffer(GL_FRONT_LEFT);
} }
else
{
sync_current_drawable(FALSE);
}
} }
} }
wine_tsx11_unlock(); wine_tsx11_unlock();
@ -1941,40 +1877,6 @@ BOOL X11DRV_wglUseFontBitmapsW(X11DRV_PDEVICE *physDev, DWORD first, DWORD count
return TRUE; return TRUE;
} }
static void WINAPI X11DRV_wglDisable(GLenum cap)
{
if (cap == GL_SCISSOR_TEST)
{
Wine_GLContext *ctx = (Wine_GLContext *) NtCurrentTeb()->glContext;
if (ctx)
ctx->scissor_enabled = FALSE;
}
else
{
wine_tsx11_lock();
pglDisable(cap);
wine_tsx11_unlock();
}
}
static void WINAPI X11DRV_wglEnable(GLenum cap)
{
if (cap == GL_SCISSOR_TEST)
{
Wine_GLContext *ctx = (Wine_GLContext *) NtCurrentTeb()->glContext;
if (ctx)
ctx->scissor_enabled = TRUE;
}
else
{
wine_tsx11_lock();
pglEnable(cap);
wine_tsx11_unlock();
}
}
/* WGL helper function which handles differences in glGetIntegerv from WGL and GLX */ /* WGL helper function which handles differences in glGetIntegerv from WGL and GLX */
static void WINAPI X11DRV_wglGetIntegerv(GLenum pname, GLint* params) static void WINAPI X11DRV_wglGetIntegerv(GLenum pname, GLint* params)
{ {
@ -2012,56 +1914,6 @@ static void WINAPI X11DRV_wglGetIntegerv(GLenum pname, GLint* params)
wine_tsx11_unlock(); wine_tsx11_unlock();
} }
static GLboolean WINAPI X11DRV_wglIsEnabled(GLenum cap)
{
GLboolean enabled = False;
if (cap == GL_SCISSOR_TEST)
{
Wine_GLContext *ctx = (Wine_GLContext *) NtCurrentTeb()->glContext;
if (ctx)
enabled = ctx->scissor_enabled;
}
else
{
wine_tsx11_lock();
enabled = pglIsEnabled(cap);
wine_tsx11_unlock();
}
return enabled;
}
static void WINAPI X11DRV_wglScissor(GLint x, GLint y, GLsizei width, GLsizei height)
{
Wine_GLContext *ctx = (Wine_GLContext *) NtCurrentTeb()->glContext;
if (ctx)
{
ctx->scissor.left = x;
ctx->scissor.top = y;
ctx->scissor.right = x + width;
ctx->scissor.bottom = y + height;
sync_current_drawable(TRUE);
}
}
static void WINAPI X11DRV_wglViewport(GLint x, GLint y, GLsizei width, GLsizei height)
{
Wine_GLContext *ctx = (Wine_GLContext *) NtCurrentTeb()->glContext;
if (ctx)
{
ctx->viewport.left = x;
ctx->viewport.top = y;
ctx->viewport.right = x + width;
ctx->viewport.bottom = y + height;
sync_current_drawable(TRUE);
}
}
static void WINAPI X11DRV_wglFinish(void) static void WINAPI X11DRV_wglFinish(void)
{ {
wine_tsx11_lock(); wine_tsx11_lock();
@ -3109,12 +2961,7 @@ static const WineGLExtension WGL_internal_functions =
{ {
"", "",
{ {
{ "wglDisable", X11DRV_wglDisable },
{ "wglEnable", X11DRV_wglEnable },
{ "wglGetIntegerv", X11DRV_wglGetIntegerv }, { "wglGetIntegerv", X11DRV_wglGetIntegerv },
{ "wglIsEnabled", X11DRV_wglIsEnabled },
{ "wglScissor", X11DRV_wglScissor },
{ "wglViewport", X11DRV_wglViewport },
{ "wglFinish", X11DRV_wglFinish }, { "wglFinish", X11DRV_wglFinish },
{ "wglFlush", X11DRV_wglFlush }, { "wglFlush", X11DRV_wglFlush },
} }