opengl32: Avoid generating a wrapper for internal functions when we can call the internal one directly.
This commit is contained in:
parent
715d0e8409
commit
de154e738a
|
@ -208,7 +208,14 @@ sub GenerateThunk($$$$$)
|
|||
my $ret = "";
|
||||
my $call_arg = "";
|
||||
my $trace_arg = "";
|
||||
my $wine_func_ref_name = "";
|
||||
|
||||
return "" if $func_ref->[0] eq "glGetString";
|
||||
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";
|
||||
|
||||
# If for opengl_norm.c, generate a nice heading otherwise Patrik won't be happy :-)
|
||||
# Patrik says: Well I would be even happier if a (OPENGL32.@) was added as well. Done. :-)
|
||||
|
@ -259,29 +266,7 @@ sub GenerateThunk($$$$$)
|
|||
if ($func_ref->[1] ne "void") {
|
||||
$ret = $ret . "ret_value = ";
|
||||
}
|
||||
$wine_func_ref_name = $func_ref->[0];
|
||||
if ( $func_ref->[0] eq "glGetString" ) {
|
||||
$wine_func_ref_name = "internal_glGetString";
|
||||
}
|
||||
if ( $func_ref->[0] eq "glGetIntegerv" ) {
|
||||
$wine_func_ref_name = "internal_glGetIntegerv";
|
||||
}
|
||||
if ( $func_ref->[0] eq "glEnable" ) {
|
||||
$wine_func_ref_name = "internal_glEnable";
|
||||
}
|
||||
if ( $func_ref->[0] eq "glIsEnabled" ) {
|
||||
$wine_func_ref_name = "internal_glIsEnabled";
|
||||
}
|
||||
if ( $func_ref->[0] eq "glDisable" ) {
|
||||
$wine_func_ref_name = "internal_glDisable";
|
||||
}
|
||||
if ( $func_ref->[0] eq "glScissor" ) {
|
||||
$wine_func_ref_name = "internal_glScissor";
|
||||
}
|
||||
if ( $func_ref->[0] eq "glViewport" ) {
|
||||
$wine_func_ref_name = "internal_glViewport";
|
||||
}
|
||||
$ret = "$ret$prefix$wine_func_ref_name( $call_arg);\n";
|
||||
$ret = "$ret$prefix$func_ref->[0]( $call_arg);\n";
|
||||
if ($thread_safe) {
|
||||
$ret = "$ret LEAVE_GL();\n";
|
||||
}
|
||||
|
@ -614,34 +599,6 @@ close(REGISTRY);
|
|||
#
|
||||
open(SPEC, ">$spec_file");
|
||||
|
||||
print SPEC "@ stdcall wglCreateContext(long)
|
||||
@ stdcall wglCreateLayerContext(long long)
|
||||
@ stdcall wglCopyContext(long long long)
|
||||
@ stdcall wglDeleteContext(long)
|
||||
@ stdcall wglDescribeLayerPlane(long long long long ptr)
|
||||
@ stdcall wglGetCurrentContext()
|
||||
@ stdcall wglGetCurrentDC()
|
||||
@ stdcall wglGetLayerPaletteEntries(long long long long ptr)
|
||||
@ stdcall wglGetProcAddress(str)
|
||||
@ stdcall wglMakeCurrent(long long)
|
||||
@ stdcall wglRealizeLayerPalette(long long long)
|
||||
@ stdcall wglSetLayerPaletteEntries(long long long long ptr)
|
||||
@ stdcall wglShareLists(long long)
|
||||
@ stdcall wglSwapLayerBuffers(long long)
|
||||
@ stdcall wglUseFontBitmapsA(long long long long)
|
||||
@ stdcall wglUseFontOutlinesA(long long long long long long long ptr)
|
||||
@ stub glGetLevelParameterfv
|
||||
@ stub glGetLevelParameteriv
|
||||
@ stdcall wglUseFontBitmapsW(long long long long)
|
||||
@ stub wglUseFontOutlinesW
|
||||
@ stub wglGetDefaultProcAddress
|
||||
@ stdcall wglChoosePixelFormat(long ptr) gdi32.ChoosePixelFormat
|
||||
@ stdcall wglDescribePixelFormat(long long long ptr) gdi32.DescribePixelFormat
|
||||
@ stdcall wglGetPixelFormat(long) gdi32.GetPixelFormat
|
||||
@ stdcall wglSetPixelFormat(long long ptr) gdi32.SetPixelFormat
|
||||
@ stdcall wglSwapBuffers(long) gdi32.SwapBuffers
|
||||
";
|
||||
|
||||
foreach (sort keys %norm_functions) {
|
||||
my $func_name = $norm_functions{$_}->[0];
|
||||
print SPEC "@ stdcall $func_name( ";
|
||||
|
@ -657,6 +614,35 @@ foreach (sort keys %norm_functions) {
|
|||
}
|
||||
print SPEC ") wine_$func_name\n";
|
||||
}
|
||||
|
||||
print SPEC "@ stub glGetLevelParameterfv
|
||||
@ stub glGetLevelParameteriv
|
||||
@ stdcall wglChoosePixelFormat(long ptr) gdi32.ChoosePixelFormat
|
||||
@ stdcall wglCopyContext(long long long)
|
||||
@ stdcall wglCreateContext(long) gdi32.wglCreateContext
|
||||
@ stdcall wglCreateLayerContext(long long)
|
||||
@ stdcall wglDeleteContext(long) gdi32.wglDeleteContext
|
||||
@ stdcall wglDescribeLayerPlane(long long long long ptr)
|
||||
@ stdcall wglDescribePixelFormat(long long long ptr) gdi32.DescribePixelFormat
|
||||
@ stdcall wglGetCurrentContext() gdi32.wglGetCurrentContext
|
||||
@ stdcall wglGetCurrentDC() gdi32.wglGetCurrentDC
|
||||
@ stub wglGetDefaultProcAddress
|
||||
@ stdcall wglGetLayerPaletteEntries(long long long long ptr)
|
||||
@ stdcall wglGetPixelFormat(long) gdi32.GetPixelFormat
|
||||
@ stdcall wglGetProcAddress(str)
|
||||
@ stdcall wglMakeCurrent(long long) gdi32.wglMakeCurrent
|
||||
@ stdcall wglRealizeLayerPalette(long long long)
|
||||
@ stdcall wglSetLayerPaletteEntries(long long long long ptr)
|
||||
@ stdcall wglSetPixelFormat(long long ptr) gdi32.SetPixelFormat
|
||||
@ stdcall wglShareLists(long long) gdi32.wglShareLists
|
||||
@ stdcall wglSwapBuffers(long) gdi32.SwapBuffers
|
||||
@ stdcall wglSwapLayerBuffers(long long)
|
||||
@ stdcall wglUseFontBitmapsA(long long long long) gdi32.wglUseFontBitmapsA
|
||||
@ stdcall wglUseFontBitmapsW(long long long long) gdi32.wglUseFontBitmapsW
|
||||
@ stdcall wglUseFontOutlinesA(long long long long long long long ptr)
|
||||
@ stdcall wglUseFontOutlinesW(long long long long long long long ptr)
|
||||
";
|
||||
|
||||
close(SPEC);
|
||||
|
||||
#
|
||||
|
@ -675,7 +661,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(opengl);
|
|||
foreach (sort keys %norm_functions) {
|
||||
my $string = GenerateThunk($norm_functions{$_}, 1, "", $gen_thread_safe, "");
|
||||
|
||||
print NORM "\n$string";
|
||||
print NORM "\n$string" if $string;
|
||||
}
|
||||
close(NORM);
|
||||
|
||||
|
|
|
@ -62,12 +62,4 @@ extern void *extension_funcs[];
|
|||
extern const OpenGL_extension extension_registry[];
|
||||
extern const int extension_registry_size;
|
||||
|
||||
const GLubyte* internal_glGetString(GLenum name);
|
||||
void internal_glGetIntegerv(GLenum pname, GLint* params);
|
||||
void internal_glDisable(GLenum cap);
|
||||
void internal_glEnable(GLenum cap);
|
||||
GLboolean internal_glIsEnabled(GLenum cap);
|
||||
void internal_glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
void internal_glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
|
||||
#endif /* __DLLS_OPENGL32_OPENGL_EXT_H */
|
||||
|
|
|
@ -809,16 +809,6 @@ void WINAPI wine_glDepthRange( GLclampd nearParam, GLclampd farParam ) {
|
|||
LEAVE_GL();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* glDisable (OPENGL32.@)
|
||||
*/
|
||||
void WINAPI wine_glDisable( GLenum cap ) {
|
||||
TRACE("(%d)\n", cap );
|
||||
ENTER_GL();
|
||||
internal_glDisable( cap );
|
||||
LEAVE_GL();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* glDisableClientState (OPENGL32.@)
|
||||
*/
|
||||
|
@ -909,16 +899,6 @@ void WINAPI wine_glEdgeFlagv( GLboolean* flag ) {
|
|||
LEAVE_GL();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* glEnable (OPENGL32.@)
|
||||
*/
|
||||
void WINAPI wine_glEnable( GLenum cap ) {
|
||||
TRACE("(%d)\n", cap );
|
||||
ENTER_GL();
|
||||
internal_glEnable( cap );
|
||||
LEAVE_GL();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* glEnableClientState (OPENGL32.@)
|
||||
*/
|
||||
|
@ -1323,16 +1303,6 @@ void WINAPI wine_glGetHistogramParameteriv( GLenum target, GLenum pname, GLint*
|
|||
LEAVE_GL();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* glGetIntegerv (OPENGL32.@)
|
||||
*/
|
||||
void WINAPI wine_glGetIntegerv( GLenum pname, GLint* params ) {
|
||||
TRACE("(%d, %p)\n", pname, params );
|
||||
ENTER_GL();
|
||||
internal_glGetIntegerv( pname, params );
|
||||
LEAVE_GL();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* glGetLightfv (OPENGL32.@)
|
||||
*/
|
||||
|
@ -1493,18 +1463,6 @@ void WINAPI wine_glGetSeparableFilter( GLenum target, GLenum format, GLenum type
|
|||
LEAVE_GL();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* glGetString (OPENGL32.@)
|
||||
*/
|
||||
const GLubyte * WINAPI wine_glGetString( GLenum name ) {
|
||||
const GLubyte * ret_value;
|
||||
TRACE("(%d)\n", name );
|
||||
ENTER_GL();
|
||||
ret_value = internal_glGetString( name );
|
||||
LEAVE_GL();
|
||||
return ret_value;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* glGetTexEnvfv (OPENGL32.@)
|
||||
*/
|
||||
|
@ -1765,18 +1723,6 @@ void WINAPI wine_glInterleavedArrays( GLenum format, GLsizei stride, GLvoid* poi
|
|||
LEAVE_GL();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* glIsEnabled (OPENGL32.@)
|
||||
*/
|
||||
GLboolean WINAPI wine_glIsEnabled( GLenum cap ) {
|
||||
GLboolean ret_value;
|
||||
TRACE("(%d)\n", cap );
|
||||
ENTER_GL();
|
||||
ret_value = internal_glIsEnabled( cap );
|
||||
LEAVE_GL();
|
||||
return ret_value;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* glIsList (OPENGL32.@)
|
||||
*/
|
||||
|
@ -2883,16 +2829,6 @@ void WINAPI wine_glScalef( GLfloat x, GLfloat y, GLfloat z ) {
|
|||
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();
|
||||
internal_glScissor( x, y, width, height );
|
||||
LEAVE_GL();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* glSelectBuffer (OPENGL32.@)
|
||||
*/
|
||||
|
@ -3752,13 +3688,3 @@ void WINAPI wine_glVertexPointer( GLint size, GLenum type, GLsizei stride, GLvoi
|
|||
glVertexPointer( size, type, stride, pointer );
|
||||
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();
|
||||
internal_glViewport( x, y, width, height );
|
||||
LEAVE_GL();
|
||||
}
|
||||
|
|
|
@ -108,6 +108,8 @@ void enter_gl(void)
|
|||
return;
|
||||
}
|
||||
|
||||
const GLubyte * WINAPI wine_glGetString( GLenum name );
|
||||
|
||||
/***********************************************************************
|
||||
* wglCreateLayerContext (OPENGL32.@)
|
||||
*/
|
||||
|
@ -168,7 +170,7 @@ static int compar(const void *elt_a, const void *elt_b) {
|
|||
/* Check if a GL extension is supported */
|
||||
static BOOL is_extension_supported(const char* extension)
|
||||
{
|
||||
const char *gl_ext_string = (const char*)internal_glGetString(GL_EXTENSIONS);
|
||||
const char *gl_ext_string = (const char*)wine_glGetString(GL_EXTENSIONS);
|
||||
|
||||
TRACE("Checking for extension '%s'\n", extension);
|
||||
|
||||
|
@ -561,58 +563,97 @@ BOOL WINAPI wglUseFontOutlinesW(HDC hdc,
|
|||
return wglUseFontOutlines_common(hdc, first, count, listBase, deviation, extrusion, format, lpgmf, TRUE);
|
||||
}
|
||||
|
||||
void internal_glEnable(GLenum cap)
|
||||
/***********************************************************************
|
||||
* glEnable (OPENGL32.@)
|
||||
*/
|
||||
void WINAPI wine_glEnable( GLenum cap )
|
||||
{
|
||||
TRACE("(%d)\n", cap );
|
||||
ENTER_GL();
|
||||
wine_wgl.p_wglEnable(cap);
|
||||
LEAVE_GL();
|
||||
}
|
||||
|
||||
GLboolean internal_glIsEnabled(GLenum cap)
|
||||
/***********************************************************************
|
||||
* glIsEnabled (OPENGL32.@)
|
||||
*/
|
||||
GLboolean WINAPI wine_glIsEnabled( GLenum cap )
|
||||
{
|
||||
return wine_wgl.p_wglIsEnabled(cap);
|
||||
GLboolean ret_value;
|
||||
TRACE("(%d)\n", cap );
|
||||
ENTER_GL();
|
||||
ret_value = wine_wgl.p_wglIsEnabled(cap);
|
||||
LEAVE_GL();
|
||||
return ret_value;
|
||||
}
|
||||
|
||||
void internal_glDisable(GLenum cap)
|
||||
/***********************************************************************
|
||||
* glDisable (OPENGL32.@)
|
||||
*/
|
||||
void WINAPI wine_glDisable( GLenum cap )
|
||||
{
|
||||
TRACE("(%d)\n", cap );
|
||||
ENTER_GL();
|
||||
wine_wgl.p_wglDisable(cap);
|
||||
LEAVE_GL();
|
||||
}
|
||||
|
||||
void internal_glScissor( GLint x, GLint y, GLsizei width, GLsizei height )
|
||||
/***********************************************************************
|
||||
* 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();
|
||||
wine_wgl.p_wglScissor(x, y, width, height);
|
||||
LEAVE_GL();
|
||||
}
|
||||
|
||||
void internal_glViewport( GLint x, GLint y, GLsizei width, GLsizei 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 );
|
||||
ENTER_GL();
|
||||
wine_wgl.p_wglViewport(x, y, width, height);
|
||||
LEAVE_GL();
|
||||
}
|
||||
|
||||
const GLubyte * internal_glGetString(GLenum name) {
|
||||
/***********************************************************************
|
||||
* glGetString (OPENGL32.@)
|
||||
*/
|
||||
const GLubyte * WINAPI wine_glGetString( GLenum name )
|
||||
{
|
||||
const GLubyte *ret;
|
||||
const char* GL_Extensions = NULL;
|
||||
|
||||
if (GL_EXTENSIONS != name) {
|
||||
return glGetString(name);
|
||||
ENTER_GL();
|
||||
ret = glGetString(name);
|
||||
LEAVE_GL();
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (NULL == internal_gl_extensions) {
|
||||
ENTER_GL();
|
||||
GL_Extensions = (const char *) glGetString(GL_EXTENSIONS);
|
||||
|
||||
TRACE("GL_EXTENSIONS reported:\n");
|
||||
if (NULL == GL_Extensions) {
|
||||
ERR("GL_EXTENSIONS returns NULL\n");
|
||||
return NULL;
|
||||
} else {
|
||||
if (GL_Extensions)
|
||||
{
|
||||
size_t len = strlen(GL_Extensions);
|
||||
internal_gl_extensions = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len + 2);
|
||||
|
||||
TRACE("GL_EXTENSIONS reported:\n");
|
||||
while (*GL_Extensions != 0x00) {
|
||||
const char* Start = GL_Extensions;
|
||||
char ThisExtn[256];
|
||||
|
||||
memset(ThisExtn, 0x00, sizeof(ThisExtn));
|
||||
while (*GL_Extensions != ' ' && *GL_Extensions != 0x00) {
|
||||
GL_Extensions++;
|
||||
}
|
||||
memcpy(ThisExtn, Start, (GL_Extensions - Start));
|
||||
ThisExtn[GL_Extensions - Start] = 0;
|
||||
TRACE("- %s:", ThisExtn);
|
||||
|
||||
/* test if supported API is disabled by config */
|
||||
|
@ -627,15 +668,21 @@ const GLubyte * internal_glGetString(GLenum name) {
|
|||
if (*GL_Extensions == ' ') GL_Extensions++;
|
||||
}
|
||||
}
|
||||
LEAVE_GL();
|
||||
}
|
||||
return (const GLubyte *) internal_gl_extensions;
|
||||
}
|
||||
|
||||
void internal_glGetIntegerv(GLenum pname, GLint* params) {
|
||||
TRACE("pname: 0x%x, params %p\n", pname, params);
|
||||
/***********************************************************************
|
||||
* glGetIntegerv (OPENGL32.@)
|
||||
*/
|
||||
void WINAPI wine_glGetIntegerv( GLenum pname, GLint* params )
|
||||
{
|
||||
ENTER_GL();
|
||||
glGetIntegerv(pname, params);
|
||||
/* A few parameters like GL_DEPTH_BITS differ between WGL and GLX, the wglGetIntegerv helper function handles those */
|
||||
wine_wgl.p_wglGetIntegerv(pname, params);
|
||||
LEAVE_GL();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue