Fix OpenGL function prototype calling conventions
authorPiers Daniell <pdaniell@nvidia.com>
Fri, 1 Dec 2017 21:17:54 +0000 (14:17 -0700)
committerPiers Daniell <pdaniell@nvidia.com>
Fri, 1 Dec 2017 21:17:54 +0000 (14:17 -0700)
OpenGL doesn't use the default function calling convention
on all platforms, which is why gl.h defines the macros
GL_APICALL and GL_APIENTRY for applications to use when
defining their own OpenGL function prototypes. Not using
these may cause a crash if an OpenGL function is called
with the wrong calling convention.

Affects:
KHR-GL46.transform_feedback.*

Components: OpenGL

VK-GL-CTS issue: 882

Change-Id: I8766262b32a04b8eff8e110e1f116c2f915274e9

external/openglcts/modules/gl/gl3cTransformFeedbackTests.hpp

index 0f5776a..31ba85c 100644 (file)
@@ -223,10 +223,10 @@ private:
         */
        bool testInstanced(void);
 
-       typedef void (*BindBufferOffsetEXT_ProcAddress)(glw::GLenum target, glw::GLuint index, glw::GLuint buffer,
-                                                                                                       glw::GLintptr offset);
-       typedef void (*GetIntegerIndexedvEXT_ProcAddress)(glw::GLenum param, glw::GLuint index, glw::GLint* values);
-       typedef void (*GetBooleanIndexedvEXT_ProcAddress)(glw::GLenum param, glw::GLuint index, glw::GLboolean* values);
+       typedef GLW_APICALL void (GLW_APIENTRY *BindBufferOffsetEXT_ProcAddress)(glw::GLenum target, glw::GLuint index, glw::GLuint buffer,
+                                                                                                                                                        glw::GLintptr offset);
+       typedef GLW_APICALL void (GLW_APIENTRY *GetIntegerIndexedvEXT_ProcAddress)(glw::GLenum param, glw::GLuint index, glw::GLint* values);
+       typedef GLW_APICALL void (GLW_APIENTRY *GetBooleanIndexedvEXT_ProcAddress)(glw::GLenum param, glw::GLuint index, glw::GLboolean* values);
 
        BindBufferOffsetEXT_ProcAddress   m_glBindBufferOffsetEXT;
        GetIntegerIndexedvEXT_ProcAddress m_glGetIntegerIndexedvEXT;
@@ -388,8 +388,8 @@ protected:
        glw::GLenum     m_attrib_type;
        glw::GLuint     m_max_vertices_drawn;
 
-       typedef void (*BindBufferOffsetEXT_ProcAddress)(glw::GLenum target, glw::GLuint index, glw::GLuint buffer,
-                                                                                                       glw::GLintptr offset);
+       typedef GLW_APICALL void (GLW_APIENTRY *BindBufferOffsetEXT_ProcAddress)(glw::GLenum target, glw::GLuint index, glw::GLuint buffer,
+                                                                                                                                                        glw::GLintptr offset);
 
        BindBufferOffsetEXT_ProcAddress m_glBindBufferOffsetEXT;
 
@@ -1196,10 +1196,10 @@ private:
        bool check();
        void clean();
 
-       typedef glw::GLuint (*GetUniformBlockIndex_ProcAddress)(glw::GLuint program, const glw::GLchar* uniformBlockName);
-       typedef void        (*UniformBlockBinding_ProcAddress)(glw::GLuint program,
-                                                                                                                  glw::GLuint uniformIndex,
-                                                                                                                  glw::GLuint uniformBlockBinding);
+       typedef GLW_APICALL glw::GLuint (GLW_APIENTRY *GetUniformBlockIndex_ProcAddress)(glw::GLuint program, const glw::GLchar* uniformBlockName);
+       typedef GLW_APICALL void        (GLW_APIENTRY *UniformBlockBinding_ProcAddress)(glw::GLuint program,
+                                                                                                                                                                       glw::GLuint uniformIndex,
+                                                                                                                                                                       glw::GLuint uniformBlockBinding);
 
        GetUniformBlockIndex_ProcAddress m_glGetUniformBlockIndex;
        UniformBlockBinding_ProcAddress  m_glUniformBlockBinding;
@@ -1280,10 +1280,10 @@ private:
        bool check();
        void clean();
 
-       typedef glw::GLuint (*GetUniformBlockIndex_ProcAddress)(glw::GLuint program, const glw::GLchar* uniformBlockName);
-       typedef void        (*UniformBlockBinding_ProcAddress)(glw::GLuint program,
-                                                                                                                  glw::GLuint uniformIndex,
-                                                                                                                  glw::GLuint uniformBlockBinding);
+       typedef GLW_APICALL glw::GLuint (GLW_APIENTRY *GetUniformBlockIndex_ProcAddress)(glw::GLuint program, const glw::GLchar* uniformBlockName);
+       typedef GLW_APICALL void        (GLW_APIENTRY *UniformBlockBinding_ProcAddress)(glw::GLuint program,
+                                                                                                                                                                       glw::GLuint uniformIndex,
+                                                                                                                                                                       glw::GLuint uniformBlockBinding);
 
        GetUniformBlockIndex_ProcAddress m_glGetUniformBlockIndex;
        UniformBlockBinding_ProcAddress  m_glUniformBlockBinding;