From 7c0362cdbe4dfae3c6ce0432d2fee16498288f2d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 19 Oct 2012 14:27:48 +0100 Subject: [PATCH] Handle GL_ARB_vertex_array_bgra better. Size can be a symbolic constant GL_BGRA, instead of a numeric value. --- helpers/glsize.hpp | 8 ++++++++ specs/glapi.py | 20 ++++++++++---------- specs/gltypes.py | 4 ++++ 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/helpers/glsize.hpp b/helpers/glsize.hpp index 6ffba68..24c0ac9 100644 --- a/helpers/glsize.hpp +++ b/helpers/glsize.hpp @@ -301,6 +301,14 @@ _glArrayPointer_size(GLint size, GLenum type, GLsizei stride, GLsizei count) return 0; } + if (size == GL_BGRA) { + size = 4; + } + + if (size > 4) { + os::log("apitrace: warning: %s: unexpected size 0x%04X\n", __FUNCTION__, size); + } + size_t elementSize = size*_gl_type_size(type); if (!stride) { stride = (GLsizei)elementSize; diff --git a/specs/glapi.py b/specs/glapi.py index e82287d..c2b13e2 100644 --- a/specs/glapi.py +++ b/specs/glapi.py @@ -376,7 +376,7 @@ glapi.addFunctions([ # GL_VERSION_1_1_DEPRECATED GlFunction(Void, "glArrayElement", [(GLint, "i")]), - GlFunction(Void, "glColorPointer", [(GLint, "size"), (GLenum, "type"), (GLsizei, "stride"), (GLpointerConst, "pointer")]), + GlFunction(Void, "glColorPointer", [(size_bgra, "size"), (GLenum, "type"), (GLsizei, "stride"), (GLpointerConst, "pointer")]), GlFunction(Void, "glDisableClientState", [(GLenum, "array")]), GlFunction(Void, "glEdgeFlagPointer", [(GLsizei, "stride"), (GLpointerConst, "pointer")]), GlFunction(Void, "glEnableClientState", [(GLenum, "array")]), @@ -515,7 +515,7 @@ glapi.addFunctions([ GlFunction(Void, "glSecondaryColor3uiv", [(Array(Const(GLuint), 3), "v")]), GlFunction(Void, "glSecondaryColor3us", [(GLushort, "red"), (GLushort, "green"), (GLushort, "blue")]), GlFunction(Void, "glSecondaryColor3usv", [(Array(Const(GLushort), 3), "v")]), - GlFunction(Void, "glSecondaryColorPointer", [(GLint, "size"), (GLenum, "type"), (GLsizei, "stride"), (GLpointerConst, "pointer")]), + GlFunction(Void, "glSecondaryColorPointer", [(size_bgra, "size"), (GLenum, "type"), (GLsizei, "stride"), (GLpointerConst, "pointer")]), GlFunction(Void, "glWindowPos2d", [(GLdouble, "x"), (GLdouble, "y")]), GlFunction(Void, "glWindowPos2dv", [(Array(Const(GLdouble), 2), "v")]), GlFunction(Void, "glWindowPos2f", [(GLfloat, "x"), (GLfloat, "y")]), @@ -647,7 +647,7 @@ glapi.addFunctions([ GlFunction(Void, "glVertexAttrib4ubv", [(GLuint, "index"), (Array(Const(GLubyte), 4), "v")]), GlFunction(Void, "glVertexAttrib4uiv", [(GLuint, "index"), (Array(Const(GLuint), 4), "v")]), GlFunction(Void, "glVertexAttrib4usv", [(GLuint, "index"), (Array(Const(GLushort), 4), "v")]), - GlFunction(Void, "glVertexAttribPointer", [(GLuint, "index"), (GLint, "size"), (GLenum, "type"), (GLboolean, "normalized"), (GLsizei, "stride"), (GLpointerConst, "pointer")]), + GlFunction(Void, "glVertexAttribPointer", [(GLuint, "index"), (size_bgra, "size"), (GLenum, "type"), (GLboolean, "normalized"), (GLsizei, "stride"), (GLpointerConst, "pointer")]), # GL_VERSION_2_1 GlFunction(Void, "glUniformMatrix2x3fv", [(GLlocation, "location"), (GLsizei, "count"), (GLboolean, "transpose"), (Array(Const(GLfloat), "count*2*3"), "value")]), @@ -870,7 +870,7 @@ glapi.addFunctions([ GlFunction(Void, "glVertexAttrib4ubvARB", [(GLuint, "index"), (Array(Const(GLubyte), 4), "v")]), GlFunction(Void, "glVertexAttrib4uivARB", [(GLuint, "index"), (Array(Const(GLuint), 4), "v")]), GlFunction(Void, "glVertexAttrib4usvARB", [(GLuint, "index"), (Array(Const(GLushort), 4), "v")]), - GlFunction(Void, "glVertexAttribPointerARB", [(GLuint, "index"), (GLint, "size"), (GLenum, "type"), (GLboolean, "normalized"), (GLsizei, "stride"), (GLpointerConst, "pointer")]), + GlFunction(Void, "glVertexAttribPointerARB", [(GLuint, "index"), (size_bgra, "size"), (GLenum, "type"), (GLboolean, "normalized"), (GLsizei, "stride"), (GLpointerConst, "pointer")]), GlFunction(Void, "glEnableVertexAttribArrayARB", [(GLuint, "index")]), GlFunction(Void, "glDisableVertexAttribArrayARB", [(GLuint, "index")]), GlFunction(Void, "glProgramStringARB", [(GLenum, "target"), (GLenum, "format"), (GLsizei, "len"), (String(Const(Void), "len"), "string")]), @@ -1526,7 +1526,7 @@ glapi.addFunctions([ # GL_EXT_vertex_array GlFunction(Void, "glArrayElementEXT", [(GLint, "i")]), - GlFunction(Void, "glColorPointerEXT", [(GLint, "size"), (GLenum, "type"), (GLsizei, "stride"), (GLsizei, "count"), (GLpointerConst, "pointer")]), + GlFunction(Void, "glColorPointerEXT", [(size_bgra, "size"), (GLenum, "type"), (GLsizei, "stride"), (GLsizei, "count"), (GLpointerConst, "pointer")]), GlFunction(Void, "glDrawArraysEXT", [(GLenum_mode, "mode"), (GLint, "first"), (GLsizei, "count")]), GlFunction(Void, "glEdgeFlagPointerEXT", [(GLsizei, "stride"), (GLsizei, "count"), (OpaquePointer(Const(GLboolean)), "pointer")]), GlFunction(Void, "glGetPointervEXT", [(GLenum, "pname"), Out(Pointer(GLpointer), "params")], sideeffects=False), @@ -1664,7 +1664,7 @@ glapi.addFunctions([ # GL_INTEL_parallel_arrays GlFunction(Void, "glVertexPointervINTEL", [(GLint, "size"), (GLenum, "type"), (OpaqueArray(GLpointerConst, "size"), "pointer")]), GlFunction(Void, "glNormalPointervINTEL", [(GLenum, "type"), (OpaqueArray(GLpointerConst, "size"), "pointer")]), - GlFunction(Void, "glColorPointervINTEL", [(GLint, "size"), (GLenum, "type"), (OpaqueArray(GLpointerConst, "size"), "pointer")]), + GlFunction(Void, "glColorPointervINTEL", [(size_bgra, "size"), (GLenum, "type"), (OpaqueArray(GLpointerConst, "size"), "pointer")]), GlFunction(Void, "glTexCoordPointervINTEL", [(GLint, "size"), (GLenum, "type"), (OpaqueArray(GLpointerConst, "size"), "pointer")]), # GL_EXT_pixel_transform @@ -1690,7 +1690,7 @@ glapi.addFunctions([ GlFunction(Void, "glSecondaryColor3uivEXT", [(Array(Const(GLuint), 3), "v")]), GlFunction(Void, "glSecondaryColor3usEXT", [(GLushort, "red"), (GLushort, "green"), (GLushort, "blue")]), GlFunction(Void, "glSecondaryColor3usvEXT", [(Array(Const(GLushort), 3), "v")]), - GlFunction(Void, "glSecondaryColorPointerEXT", [(GLint, "size"), (GLenum, "type"), (GLsizei, "stride"), (GLpointerConst, "pointer")]), + GlFunction(Void, "glSecondaryColorPointerEXT", [(size_bgra, "size"), (GLenum, "type"), (GLsizei, "stride"), (GLpointerConst, "pointer")]), # GL_EXT_texture_perturb_normal GlFunction(Void, "glTextureNormalEXT", [(GLenum, "mode")]), @@ -1858,8 +1858,8 @@ glapi.addFunctions([ GlFunction(Void, "glMultiModeDrawElementsIBM", [(Array(Const(GLenum), "primcount"), "mode"), (Array(Const(GLsizei), "primcount"), "count"), (GLenum, "type"), (Array(Const(GLpointerConst), "primcount"), "indices"), (GLsizei, "primcount"), (GLint, "modestride")]), # GL_IBM_vertex_array_lists - GlFunction(Void, "glColorPointerListIBM", [(GLint, "size"), (GLenum, "type"), (GLint, "stride"), (OpaquePointer(GLpointerConst), "pointer"), (GLint, "ptrstride")]), - GlFunction(Void, "glSecondaryColorPointerListIBM", [(GLint, "size"), (GLenum, "type"), (GLint, "stride"), (OpaquePointer(GLpointerConst), "pointer"), (GLint, "ptrstride")]), + GlFunction(Void, "glColorPointerListIBM", [(size_bgra, "size"), (GLenum, "type"), (GLint, "stride"), (OpaquePointer(GLpointerConst), "pointer"), (GLint, "ptrstride")]), + GlFunction(Void, "glSecondaryColorPointerListIBM", [(size_bgra, "size"), (GLenum, "type"), (GLint, "stride"), (OpaquePointer(GLpointerConst), "pointer"), (GLint, "ptrstride")]), GlFunction(Void, "glEdgeFlagPointerListIBM", [(GLint, "stride"), (OpaquePointer(Opaque("const GLboolean *")), "pointer"), (GLint, "ptrstride")]), GlFunction(Void, "glFogCoordPointerListIBM", [(GLenum, "type"), (GLint, "stride"), (OpaquePointer(GLpointerConst), "pointer"), (GLint, "ptrstride")]), GlFunction(Void, "glIndexPointerListIBM", [(GLenum, "type"), (GLint, "stride"), (OpaquePointer(GLpointerConst), "pointer"), (GLint, "ptrstride")]), @@ -1929,7 +1929,7 @@ glapi.addFunctions([ GlFunction(Void, "glProgramParameters4fvNV", [(GLenum, "target"), (GLuint, "index"), (GLsizei, "count"), (Array(Const(GLfloat), "count*4"), "v")]), GlFunction(Void, "glRequestResidentProgramsNV", [(GLsizei, "n"), (Array(Const(GLprogramARB), "n"), "programs")]), GlFunction(Void, "glTrackMatrixNV", [(GLenum, "target"), (GLuint, "address"), (GLenum, "matrix"), (GLenum, "transform")]), - GlFunction(Void, "glVertexAttribPointerNV", [(GLuint, "index"), (GLint, "size"), (GLenum, "type"), (GLsizei, "stride"), (GLpointerConst, "pointer")]), + GlFunction(Void, "glVertexAttribPointerNV", [(GLuint, "index"), (size_bgra, "size"), (GLenum, "type"), (GLsizei, "stride"), (GLpointerConst, "pointer")]), GlFunction(Void, "glVertexAttrib1dNV", [(GLuint, "index"), (GLdouble, "x")]), GlFunction(Void, "glVertexAttrib1dvNV", [(GLuint, "index"), (Pointer(Const(GLdouble)), "v")]), GlFunction(Void, "glVertexAttrib1fNV", [(GLuint, "index"), (GLfloat, "x")]), diff --git a/specs/gltypes.py b/specs/gltypes.py index 2f565cd..5256e59 100644 --- a/specs/gltypes.py +++ b/specs/gltypes.py @@ -230,3 +230,7 @@ GLbitfield_barrier = Flags(GLbitfield, [ "GL_ATOMIC_COUNTER_BARRIER_BIT", # 0x00001000 ]) +# GL_ARB_vertex_array_bgra +size_bgra = FakeEnum(GLint, [ + "GL_BGRA", +]) -- 2.43.0