Title: [127961] trunk/Source/WebCore
Revision
127961
Author
[email protected]
Date
2012-09-07 23:21:06 -0700 (Fri, 07 Sep 2012)

Log Message

Fix the build of OpenGLShims on Windows
https://bugs.webkit.org/show_bug.cgi?id=96123

Patch by Simon Hausmann <[email protected]> on 2012-09-07
Reviewed by Kenneth Rohde Christiansen.

OpenGL functions on Windows are generally defined as __stdcall, so we need to make sure
that we declare our own "copies" of those functions with the same calling convention.

This is also required for the situation where we build against ANGLE, because then we
initialize the function table entries with a direct assignment (entry = ::glMyFunction())
and the assignment does not compile if the types don't match, i.e. if RHS has a different
calling convention than LHS.

The approach chosen is basically the same as in the Khronos headers,
using a GLAPIENTRY macro.

* platform/graphics/OpenGLShims.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (127960 => 127961)


--- trunk/Source/WebCore/ChangeLog	2012-09-08 06:16:08 UTC (rev 127960)
+++ trunk/Source/WebCore/ChangeLog	2012-09-08 06:21:06 UTC (rev 127961)
@@ -1,3 +1,23 @@
+2012-09-07  Simon Hausmann  <[email protected]>
+
+        Fix the build of OpenGLShims on Windows
+        https://bugs.webkit.org/show_bug.cgi?id=96123
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        OpenGL functions on Windows are generally defined as __stdcall, so we need to make sure
+        that we declare our own "copies" of those functions with the same calling convention.
+
+        This is also required for the situation where we build against ANGLE, because then we
+        initialize the function table entries with a direct assignment (entry = ::glMyFunction())
+        and the assignment does not compile if the types don't match, i.e. if RHS has a different
+        calling convention than LHS.
+
+        The approach chosen is basically the same as in the Khronos headers,
+        using a GLAPIENTRY macro.
+
+        * platform/graphics/OpenGLShims.h:
+
 2012-09-07  Benjamin Poulain  <[email protected]>
 
         Rename the ustring() accessor to string()

Modified: trunk/Source/WebCore/platform/graphics/OpenGLShims.h (127960 => 127961)


--- trunk/Source/WebCore/platform/graphics/OpenGLShims.h	2012-09-08 06:16:08 UTC (rev 127960)
+++ trunk/Source/WebCore/platform/graphics/OpenGLShims.h	2012-09-08 06:21:06 UTC (rev 127961)
@@ -41,99 +41,105 @@
 OpenGLFunctionTable* openGLFunctionTable();
 }
 
-typedef void (*glActiveTextureType) (GLenum);
-typedef void (*glAttachShaderType) (GLuint, GLuint);
-typedef void (*glBindAttribLocationType) (GLuint, GLuint, const char*);
-typedef void (*glBindBufferType) (GLenum, GLuint);
-typedef void (*glBindFramebufferType) (GLenum, GLuint);
-typedef void (*glBindRenderbufferType) (GLenum, GLuint);
-typedef void (*glBlendColorType) (GLclampf, GLclampf, GLclampf, GLclampf);
-typedef void (*glBlendEquationType) (GLenum);
-typedef void (*glBlendEquationSeparateType)(GLenum, GLenum);
-typedef void (*glBlendFuncSeparateType)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-typedef void (*glBlitFramebufferType) (GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum);
-typedef void (*glBufferDataType) (GLenum, GLsizeiptr, const GLvoid*, GLenum);
-typedef void (*glBufferSubDataType) (GLenum, GLintptr, GLsizeiptr, const GLvoid*);
-typedef GLenum (*glCheckFramebufferStatusType) (GLenum);
-typedef void (*glCompileShaderType) (GLuint);
-typedef GLuint (*glCreateProgramType) ();
-typedef GLuint (*glCreateShaderType) (GLenum);
-typedef void (*glDeleteBuffersType) (GLsizei, const GLuint*);
-typedef void (*glDeleteFramebuffersType) (GLsizei n, const GLuint*);
-typedef void (*glDeleteProgramType) (GLuint);
-typedef void (*glDeleteRenderbuffersType) (GLsizei n, const GLuint*);
-typedef void (*glDeleteShaderType) (GLuint);
-typedef void (*glDetachShaderType) (GLuint, GLuint);
-typedef void (*glDisableVertexAttribArrayType) (GLuint);
-typedef void (*glEnableVertexAttribArrayType) (GLuint);
-typedef void (*glFramebufferRenderbufferType) (GLenum, GLenum, GLenum, GLuint);
-typedef void (*glFramebufferTexture2DType) (GLenum, GLenum, GLenum, GLuint, GLint);
-typedef void (*glGenBuffersType) (GLsizei, GLuint*);
-typedef void (*glGenerateMipmapType) (GLenum target);
-typedef void (*glGenFramebuffersType) (GLsizei, GLuint*);
-typedef void (*glGenRenderbuffersType) (GLsizei, GLuint*);
-typedef void (*glGetActiveAttribType) (GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*);
-typedef void (*glGetActiveUniformType) (GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*);
-typedef void (*glGetAttachedShadersType) (GLuint, GLsizei, GLsizei*, GLuint*);
-typedef GLint (*glGetAttribLocationType) (GLuint, const char*);
-typedef void (*glGetBufferParameterivType) (GLenum, GLenum, GLint*);
-typedef void (*glGetFramebufferAttachmentParameterivType) (GLenum, GLenum, GLenum, GLint* params);
-typedef void (*glGetProgramInfoLogType) (GLuint, GLsizei, GLsizei*, char*);
-typedef void (*glGetProgramivType) (GLuint, GLenum, GLint*);
-typedef void (*glGetRenderbufferParameterivType) (GLenum, GLenum, GLint*);
-typedef void (*glGetShaderInfoLogType) (GLuint, GLsizei, GLsizei*, char*);
-typedef void (*glGetShaderivType) (GLuint, GLenum, GLint*);
-typedef void (*glGetShaderSourceType) (GLuint, GLsizei, GLsizei*, char*);
-typedef GLint (*glGetUniformLocationType) (GLuint, const char*);
-typedef void (*glGetUniformfvType) (GLuint, GLint, GLfloat*);
-typedef void (*glGetUniformivType) (GLuint, GLint, GLint*);
-typedef void (*glGetVertexAttribfvType) (GLuint, GLenum, GLfloat*);
-typedef void (*glGetVertexAttribivType) (GLuint, GLenum, GLint*);
-typedef void (*glGetVertexAttribPointervType) (GLuint, GLenum, GLvoid**);
-typedef GLboolean (*glIsBufferType) (GLuint);
-typedef GLboolean (*glIsFramebufferType) (GLuint);
-typedef GLboolean (*glIsProgramType) (GLuint);
-typedef GLboolean (*glIsRenderbufferType) (GLuint);
-typedef GLboolean (*glIsShaderType) (GLuint);
-typedef void (*glLinkProgramType) (GLuint);
-typedef void (*glRenderbufferStorageType) (GLenum, GLenum, GLsizei, GLsizei);
-typedef void (*glRenderbufferStorageMultisampleType) (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
-typedef void (*glSampleCoverageType) (GLclampf, GLboolean);
-typedef void (*glShaderSourceType) (GLuint, GLsizei, const char**, const GLint*);
-typedef void (*glStencilFuncSeparateType) (GLenum, GLenum, GLint, GLuint);
-typedef void (*glStencilMaskSeparateType) (GLenum, GLuint);
-typedef void (*glStencilOpSeparateType) (GLenum, GLenum, GLenum, GLenum);
-typedef void (*glUniform1fType) (GLint, GLfloat);
-typedef void (*glUniform1fvType) (GLint, GLsizei, const GLfloat*);
-typedef void (*glUniform1iType) (GLint, GLint);
-typedef void (*glUniform1ivType) (GLint, GLsizei, const GLint*);
-typedef void (*glUniform2fType) (GLint, GLfloat, GLfloat);
-typedef void (*glUniform2fvType) (GLint, GLsizei, const GLfloat*);
-typedef void (*glUniform2iType) (GLint, GLint, GLint);
-typedef void (*glUniform2ivType) (GLint, GLsizei, const GLint*);
-typedef void (*glUniform3fType) (GLint, GLfloat, GLfloat, GLfloat);
-typedef void (*glUniform3fvType) (GLint, GLsizei, const GLfloat*);
-typedef void (*glUniform3iType) (GLint, GLint, GLint, GLint);
-typedef void (*glUniform3ivType) (GLint, GLsizei, const GLint*);
-typedef void (*glUniform4fType) (GLint, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (*glUniform4fvType) (GLint, GLsizei, const GLfloat*);
-typedef void (*glUniform4iType) (GLint, GLint, GLint, GLint, GLint);
-typedef void (*glUniform4ivType) (GLint, GLsizei, const GLint*);
-typedef void (*glUniformMatrix2fvType) (GLint, GLsizei, GLboolean, const GLfloat*);
-typedef void (*glUniformMatrix3fvType) (GLint, GLsizei, GLboolean, const GLfloat*);
-typedef void (*glUniformMatrix4fvType) (GLint, GLsizei, GLboolean, const GLfloat*);
-typedef void (*glUseProgramType) (GLuint);
-typedef void (*glValidateProgramType) (GLuint);
-typedef void (*glVertexAttrib1fType) (GLuint, const GLfloat);
-typedef void (*glVertexAttrib1fvType) (GLuint, const GLfloat*);
-typedef void (*glVertexAttrib2fType) (GLuint, const GLfloat, const GLfloat);
-typedef void (*glVertexAttrib2fvType) (GLuint, const GLfloat*);
-typedef void (*glVertexAttrib3fType) (GLuint, const GLfloat, const GLfloat, const GLfloat);
-typedef void (*glVertexAttrib3fvType) (GLuint, const GLfloat*);
-typedef void (*glVertexAttrib4fType) (GLuint, const GLfloat, const GLfloat, const GLfloat, const GLfloat);
-typedef void (*glVertexAttrib4fvType) (GLuint, const GLfloat*);
-typedef void (*glVertexAttribPointerType) (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid*);
+#if OS(WINDOWS)
+#define GLAPIENTRY __stdcall
+#else
+#define GLAPIENTRY
+#endif
 
+typedef void (GLAPIENTRY *glActiveTextureType) (GLenum);
+typedef void (GLAPIENTRY *glAttachShaderType) (GLuint, GLuint);
+typedef void (GLAPIENTRY *glBindAttribLocationType) (GLuint, GLuint, const char*);
+typedef void (GLAPIENTRY *glBindBufferType) (GLenum, GLuint);
+typedef void (GLAPIENTRY *glBindFramebufferType) (GLenum, GLuint);
+typedef void (GLAPIENTRY *glBindRenderbufferType) (GLenum, GLuint);
+typedef void (GLAPIENTRY *glBlendColorType) (GLclampf, GLclampf, GLclampf, GLclampf);
+typedef void (GLAPIENTRY *glBlendEquationType) (GLenum);
+typedef void (GLAPIENTRY *glBlendEquationSeparateType)(GLenum, GLenum);
+typedef void (GLAPIENTRY *glBlendFuncSeparateType)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+typedef void (GLAPIENTRY *glBlitFramebufferType) (GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum);
+typedef void (GLAPIENTRY *glBufferDataType) (GLenum, GLsizeiptr, const GLvoid*, GLenum);
+typedef void (GLAPIENTRY *glBufferSubDataType) (GLenum, GLintptr, GLsizeiptr, const GLvoid*);
+typedef GLenum (GLAPIENTRY *glCheckFramebufferStatusType) (GLenum);
+typedef void (GLAPIENTRY *glCompileShaderType) (GLuint);
+typedef GLuint (GLAPIENTRY *glCreateProgramType) ();
+typedef GLuint (GLAPIENTRY *glCreateShaderType) (GLenum);
+typedef void (GLAPIENTRY *glDeleteBuffersType) (GLsizei, const GLuint*);
+typedef void (GLAPIENTRY *glDeleteFramebuffersType) (GLsizei n, const GLuint*);
+typedef void (GLAPIENTRY *glDeleteProgramType) (GLuint);
+typedef void (GLAPIENTRY *glDeleteRenderbuffersType) (GLsizei n, const GLuint*);
+typedef void (GLAPIENTRY *glDeleteShaderType) (GLuint);
+typedef void (GLAPIENTRY *glDetachShaderType) (GLuint, GLuint);
+typedef void (GLAPIENTRY *glDisableVertexAttribArrayType) (GLuint);
+typedef void (GLAPIENTRY *glEnableVertexAttribArrayType) (GLuint);
+typedef void (GLAPIENTRY *glFramebufferRenderbufferType) (GLenum, GLenum, GLenum, GLuint);
+typedef void (GLAPIENTRY *glFramebufferTexture2DType) (GLenum, GLenum, GLenum, GLuint, GLint);
+typedef void (GLAPIENTRY *glGenBuffersType) (GLsizei, GLuint*);
+typedef void (GLAPIENTRY *glGenerateMipmapType) (GLenum target);
+typedef void (GLAPIENTRY *glGenFramebuffersType) (GLsizei, GLuint*);
+typedef void (GLAPIENTRY *glGenRenderbuffersType) (GLsizei, GLuint*);
+typedef void (GLAPIENTRY *glGetActiveAttribType) (GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*);
+typedef void (GLAPIENTRY *glGetActiveUniformType) (GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*);
+typedef void (GLAPIENTRY *glGetAttachedShadersType) (GLuint, GLsizei, GLsizei*, GLuint*);
+typedef GLint (GLAPIENTRY *glGetAttribLocationType) (GLuint, const char*);
+typedef void (GLAPIENTRY *glGetBufferParameterivType) (GLenum, GLenum, GLint*);
+typedef void (GLAPIENTRY *glGetFramebufferAttachmentParameterivType) (GLenum, GLenum, GLenum, GLint* params);
+typedef void (GLAPIENTRY *glGetProgramInfoLogType) (GLuint, GLsizei, GLsizei*, char*);
+typedef void (GLAPIENTRY *glGetProgramivType) (GLuint, GLenum, GLint*);
+typedef void (GLAPIENTRY *glGetRenderbufferParameterivType) (GLenum, GLenum, GLint*);
+typedef void (GLAPIENTRY *glGetShaderInfoLogType) (GLuint, GLsizei, GLsizei*, char*);
+typedef void (GLAPIENTRY *glGetShaderivType) (GLuint, GLenum, GLint*);
+typedef void (GLAPIENTRY *glGetShaderSourceType) (GLuint, GLsizei, GLsizei*, char*);
+typedef GLint (GLAPIENTRY *glGetUniformLocationType) (GLuint, const char*);
+typedef void (GLAPIENTRY *glGetUniformfvType) (GLuint, GLint, GLfloat*);
+typedef void (GLAPIENTRY *glGetUniformivType) (GLuint, GLint, GLint*);
+typedef void (GLAPIENTRY *glGetVertexAttribfvType) (GLuint, GLenum, GLfloat*);
+typedef void (GLAPIENTRY *glGetVertexAttribivType) (GLuint, GLenum, GLint*);
+typedef void (GLAPIENTRY *glGetVertexAttribPointervType) (GLuint, GLenum, GLvoid**);
+typedef GLboolean (GLAPIENTRY *glIsBufferType) (GLuint);
+typedef GLboolean (GLAPIENTRY *glIsFramebufferType) (GLuint);
+typedef GLboolean (GLAPIENTRY *glIsProgramType) (GLuint);
+typedef GLboolean (GLAPIENTRY *glIsRenderbufferType) (GLuint);
+typedef GLboolean (GLAPIENTRY *glIsShaderType) (GLuint);
+typedef void (GLAPIENTRY *glLinkProgramType) (GLuint);
+typedef void (GLAPIENTRY *glRenderbufferStorageType) (GLenum, GLenum, GLsizei, GLsizei);
+typedef void (GLAPIENTRY *glRenderbufferStorageMultisampleType) (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
+typedef void (GLAPIENTRY *glSampleCoverageType) (GLclampf, GLboolean);
+typedef void (GLAPIENTRY *glShaderSourceType) (GLuint, GLsizei, const char**, const GLint*);
+typedef void (GLAPIENTRY *glStencilFuncSeparateType) (GLenum, GLenum, GLint, GLuint);
+typedef void (GLAPIENTRY *glStencilMaskSeparateType) (GLenum, GLuint);
+typedef void (GLAPIENTRY *glStencilOpSeparateType) (GLenum, GLenum, GLenum, GLenum);
+typedef void (GLAPIENTRY *glUniform1fType) (GLint, GLfloat);
+typedef void (GLAPIENTRY *glUniform1fvType) (GLint, GLsizei, const GLfloat*);
+typedef void (GLAPIENTRY *glUniform1iType) (GLint, GLint);
+typedef void (GLAPIENTRY *glUniform1ivType) (GLint, GLsizei, const GLint*);
+typedef void (GLAPIENTRY *glUniform2fType) (GLint, GLfloat, GLfloat);
+typedef void (GLAPIENTRY *glUniform2fvType) (GLint, GLsizei, const GLfloat*);
+typedef void (GLAPIENTRY *glUniform2iType) (GLint, GLint, GLint);
+typedef void (GLAPIENTRY *glUniform2ivType) (GLint, GLsizei, const GLint*);
+typedef void (GLAPIENTRY *glUniform3fType) (GLint, GLfloat, GLfloat, GLfloat);
+typedef void (GLAPIENTRY *glUniform3fvType) (GLint, GLsizei, const GLfloat*);
+typedef void (GLAPIENTRY *glUniform3iType) (GLint, GLint, GLint, GLint);
+typedef void (GLAPIENTRY *glUniform3ivType) (GLint, GLsizei, const GLint*);
+typedef void (GLAPIENTRY *glUniform4fType) (GLint, GLfloat, GLfloat, GLfloat, GLfloat);
+typedef void (GLAPIENTRY *glUniform4fvType) (GLint, GLsizei, const GLfloat*);
+typedef void (GLAPIENTRY *glUniform4iType) (GLint, GLint, GLint, GLint, GLint);
+typedef void (GLAPIENTRY *glUniform4ivType) (GLint, GLsizei, const GLint*);
+typedef void (GLAPIENTRY *glUniformMatrix2fvType) (GLint, GLsizei, GLboolean, const GLfloat*);
+typedef void (GLAPIENTRY *glUniformMatrix3fvType) (GLint, GLsizei, GLboolean, const GLfloat*);
+typedef void (GLAPIENTRY *glUniformMatrix4fvType) (GLint, GLsizei, GLboolean, const GLfloat*);
+typedef void (GLAPIENTRY *glUseProgramType) (GLuint);
+typedef void (GLAPIENTRY *glValidateProgramType) (GLuint);
+typedef void (GLAPIENTRY *glVertexAttrib1fType) (GLuint, const GLfloat);
+typedef void (GLAPIENTRY *glVertexAttrib1fvType) (GLuint, const GLfloat*);
+typedef void (GLAPIENTRY *glVertexAttrib2fType) (GLuint, const GLfloat, const GLfloat);
+typedef void (GLAPIENTRY *glVertexAttrib2fvType) (GLuint, const GLfloat*);
+typedef void (GLAPIENTRY *glVertexAttrib3fType) (GLuint, const GLfloat, const GLfloat, const GLfloat);
+typedef void (GLAPIENTRY *glVertexAttrib3fvType) (GLuint, const GLfloat*);
+typedef void (GLAPIENTRY *glVertexAttrib4fType) (GLuint, const GLfloat, const GLfloat, const GLfloat, const GLfloat);
+typedef void (GLAPIENTRY *glVertexAttrib4fvType) (GLuint, const GLfloat*);
+typedef void (GLAPIENTRY *glVertexAttribPointerType) (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid*);
+
 #define FUNCTION_TABLE_ENTRY(FunctionName) FunctionName##Type FunctionName
 
 typedef struct _OpenGLFunctionTable {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to