X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=glapi.py;h=c1b48522854b6001cea5498a72843aac46001156;hb=4aed84a7b7dcec68a2ae0fce952cb8a189fc5c77;hp=f4314c1c9964bcc356542d2385eff084bf351b20;hpb=a10af89da84775b99c5d15333ca60690d33da7f5;p=apitrace diff --git a/glapi.py b/glapi.py index f4314c1..c1b4852 100644 --- a/glapi.py +++ b/glapi.py @@ -33,6 +33,8 @@ cases correctly. """ +import platform + from stdapi import * from glenum import * @@ -86,9 +88,15 @@ GLrenderbuffer = Handle("renderbuffer", GLuint) GLfragmentShaderATI = Handle("fragmentShaderATI", GLuint) GLvertexArray = Handle("vertexArrayAPPLE", GLuint) GLregion = Handle("region", GLuint) +GLmap = Handle("map", OpaquePointer(GLvoid)) -# Some functions take GLenum disguised as GLint -GLenum_int = Alias("GLint", GLenum) +# Some functions take GLenum disguised as GLint. Apple noticed and fixed it in +# the gl.h header. Regardless, C++ typechecking rules force the wrappers to +# match the prototype precisely. +if platform.system() == 'Darwin': + GLenum_int = GLenum +else: + GLenum_int = Alias("GLint", GLenum) GLsync_ = Opaque("GLsync") GLsync = Handle("sync", GLsync_) @@ -541,8 +549,8 @@ glapi.add_functions([ # GL_VERSION_1_4 GlFunction(Void, "glBlendFuncSeparate", [(GLenum, "sfactorRGB"), (GLenum, "dfactorRGB"), (GLenum, "sfactorAlpha"), (GLenum, "dfactorAlpha")]), - GlFunction(Void, "glMultiDrawArrays", [(GLenum_mode, "mode"), (OpaquePointer(GLint), "first"), (OpaquePointer(GLsizei), "count"), (GLsizei, "primcount")]), - GlFunction(Void, "glMultiDrawElements", [(GLenum_mode, "mode"), (Const(Array(GLsizei, "primcount")), "count"), (GLenum, "type"), (Array(Const(Const(OpaquePointer(GLvoid))), "primcount"), "indices"), (GLsizei, "primcount")]), + GlFunction(Void, "glMultiDrawArrays", [(GLenum_mode, "mode"), (Const(Array(GLint, "primcount")), "first"), (Const(Array(GLsizei, "primcount")), "count"), (GLsizei, "primcount")]), + GlFunction(Void, "glMultiDrawElements", [(GLenum_mode, "mode"), (Const(Array(GLsizei, "primcount")), "count"), (GLenum, "type"), (Array(Opaque("const GLvoid *"), "primcount"), "indices"), (GLsizei, "primcount")]), GlFunction(Void, "glPointParameterf", [(GLenum, "pname"), (GLfloat, "param")]), GlFunction(Void, "glPointParameterfv", [(GLenum, "pname"), (Const(Array(GLfloat, "__glPointParameterfv_size(pname)")), "params")]), GlFunction(Void, "glPointParameteri", [(GLenum, "pname"), (GLint, "param")]), @@ -604,10 +612,10 @@ glapi.add_functions([ GlFunction(Void, "glBufferData", [(GLenum, "target"), (GLsizeiptr, "size"), (Blob(Const(GLvoid), "size"), "data"), (GLenum, "usage")]), GlFunction(Void, "glBufferSubData", [(GLenum, "target"), (GLintptr, "offset"), (GLsizeiptr, "size"), (Blob(Const(GLvoid), "size"), "data")]), GlFunction(Void, "glGetBufferSubData", [(GLenum, "target"), (GLintptr, "offset"), (GLsizeiptr, "size"), Out(Blob(GLvoid, "size"), "data")], sideeffects=False), - GlFunction(OpaquePointer(GLvoid), "glMapBuffer", [(GLenum, "target"), (GLenum, "access")]), + GlFunction(GLmap, "glMapBuffer", [(GLenum, "target"), (GLenum, "access")]), GlFunction(GLboolean, "glUnmapBuffer", [(GLenum, "target")]), - GlFunction(Void, "glGetBufferParameteriv", [(GLenum, "target"), (GLenum, "pname"), (OpaquePointer(GLint), "params")], sideeffects=False), - GlFunction(Void, "glGetBufferPointerv", [(GLenum, "target"), (GLenum, "pname"), (OpaquePointer(OpaquePointer(GLvoid)), "params")], sideeffects=False), + GlFunction(Void, "glGetBufferParameteriv", [(GLenum, "target"), (GLenum, "pname"), (Pointer(GLint), "params")], sideeffects=False), + GlFunction(Void, "glGetBufferPointerv", [(GLenum, "target"), (GLenum, "pname"), (Pointer(OpaquePointer(GLvoid)), "params")], sideeffects=False), # GL_VERSION_2_0 GlFunction(Void, "glBlendEquationSeparate", [(GLenum, "modeRGB"), (GLenum, "modeAlpha")]), @@ -960,10 +968,10 @@ glapi.add_functions([ GlFunction(Void, "glBufferDataARB", [(GLenum, "target"), (GLsizeiptrARB, "size"), (Const(Blob(GLvoid, "size")), "data"), (GLenum, "usage")]), GlFunction(Void, "glBufferSubDataARB", [(GLenum, "target"), (GLintptrARB, "offset"), (GLsizeiptrARB, "size"), (Const(Blob(GLvoid, "size")), "data")]), GlFunction(Void, "glGetBufferSubDataARB", [(GLenum, "target"), (GLintptrARB, "offset"), (GLsizeiptrARB, "size"), Out(Blob(GLvoid, "size"), "data")], sideeffects=False), - GlFunction(OpaquePointer(GLvoid), "glMapBufferARB", [(GLenum, "target"), (GLenum, "access")]), + GlFunction(GLmap, "glMapBufferARB", [(GLenum, "target"), (GLenum, "access")]), GlFunction(GLboolean, "glUnmapBufferARB", [(GLenum, "target")]), - GlFunction(Void, "glGetBufferParameterivARB", [(GLenum, "target"), (GLenum, "pname"), Out(OpaquePointer(GLint), "params")], sideeffects=False), - GlFunction(Void, "glGetBufferPointervARB", [(GLenum, "target"), (GLenum, "pname"), Out(Array(OpaquePointer(GLvoid), "1"), "params")], sideeffects=False), + GlFunction(Void, "glGetBufferParameterivARB", [(GLenum, "target"), (GLenum, "pname"), Out(Pointer(GLint), "params")], sideeffects=False), + GlFunction(Void, "glGetBufferPointervARB", [(GLenum, "target"), (GLenum, "pname"), Out(Pointer(OpaquePointer(GLvoid)), "params")], sideeffects=False), # GL_ARB_occlusion_query GlFunction(Void, "glGenQueriesARB", [(GLsizei, "n"), Out(Array(GLquery, "n"), "ids")]), @@ -1063,7 +1071,7 @@ glapi.add_functions([ GlFunction(Void, "glVertexAttribDivisorARB", [(GLuint, "index"), (GLuint, "divisor")]), # GL_ARB_map_buffer_range - GlFunction(OpaquePointer(GLvoid), "glMapBufferRange", [(GLenum, "target"), (GLintptr, "offset"), (GLsizeiptr, "length"), (GLbitfield, "access")]), + GlFunction(GLmap, "glMapBufferRange", [(GLenum, "target"), (GLintptr, "offset"), (GLsizeiptr, "length"), (GLbitfield, "access")]), GlFunction(Void, "glFlushMappedBufferRange", [(GLenum, "target"), (GLintptr, "offset"), (GLsizeiptr, "length")]), # GL_ARB_texture_buffer_object @@ -1121,12 +1129,12 @@ glapi.add_functions([ GlFunction(Void, "glMinSampleShadingARB", [(GLclampf, "value")]), # GL_ARB_shading_language_include - #GlFunction(Void, "glNamedStringARB", [(GLenum, "type"), (GLint, "namelen"), (Const(Array(GLchar, "namelen")), "name"), (GLint, "stringlen"), (Const(Array(GLchar, "stringlen")), "string")]), - #GlFunction(Void, "glDeleteNamedStringARB", [(GLint, "namelen"), (Const(Array(GLchar, "namelen")), "name")]), - #GlFunction(Void, "glCompileShaderIncludeARB", [(GLuint, "shader"), (GLsizei, "count"), (Const(Array(GLstring, "count")), "path"), (Const(Array(GLint, "count")), "length")]), - #GlFunction(GLboolean, "glIsNamedStringARB", [(GLint, "namelen"), (Const(Array(GLchar, "namelen")), "name")]), - #GlFunction(Void, "glGetNamedStringARB", [(GLint, "namelen"), (Const(Array(GLchar, "namelen")), "name"), (GLsizei, "bufSize"), Out(Pointer(GLint), "stringlen"), Out(Array(GLchar, "bufSize"), "string")], sideeffects=False), - #GlFunction(Void, "glGetNamedStringivARB", [(GLint, "namelen"), (Const(Array(GLchar, "namelen")), "name"), (GLenum, "pname"), Out(OpaqueArray(GLint, "__glGetNamedStringivARB_size(pname)"), "params")], sideeffects=False), + GlFunction(Void, "glNamedStringARB", [(GLenum, "type"), (GLint, "namelen"), (Const(String('GLchar *', "namelen")), "name"), (GLint, "stringlen"), (Const(String('GLchar *', "stringlen")), "string")]), + GlFunction(Void, "glDeleteNamedStringARB", [(GLint, "namelen"), (Const(String('GLchar *', "namelen")), "name")]), + GlFunction(Void, "glCompileShaderIncludeARB", [(GLuint, "shader"), (GLsizei, "count"), (Array(GLstring, "count"), "path"), (Const(Array(GLint, "count")), "length")]), + GlFunction(GLboolean, "glIsNamedStringARB", [(GLint, "namelen"), (Const(String('GLchar *', "namelen")), "name")]), + GlFunction(Void, "glGetNamedStringARB", [(GLint, "namelen"), (Const(String('GLchar *', "namelen")), "name"), (GLsizei, "bufSize"), Out(Pointer(GLint), "stringlen"), Out(Array(GLchar, "bufSize"), "string")], sideeffects=False), + GlFunction(Void, "glGetNamedStringivARB", [(GLint, "namelen"), (Const(String('GLchar *', "namelen")), "name"), (GLenum, "pname"), Out(OpaqueArray(GLint, "__glGetNamedStringivARB_size(pname)"), "params")], sideeffects=False), # GL_ARB_blend_func_extended GlFunction(Void, "glBindFragDataLocationIndexed", [(GLuint, "program"), (GLuint, "colorNumber"), (GLuint, "index"), (Const(GLstring), "name")]), @@ -1768,6 +1776,9 @@ glapi.add_functions([ GlFunction(Void, "glGenVertexArraysAPPLE", [(GLsizei, "n"), Out(Array(GLvertexArray, "n"), "arrays")]), GlFunction(GLboolean, "glIsVertexArrayAPPLE", [(GLvertexArray, "array")]), + # GL_ATI_draw_buffers + GlFunction(Void, "glDrawBuffersATI", [(GLsizei, "n"), (Const(Array(GLenum, "n")), "bufs")]), + # GL_NV_fragment_program GlFunction(Void, "glProgramNamedParameter4fNV", [(GLprogramNV, "id"), (GLsizei, "len"), (Const(OpaquePointer(GLubyte)), "name"), (GLfloat, "x"), (GLfloat, "y"), (GLfloat, "z"), (GLfloat, "w")]), GlFunction(Void, "glProgramNamedParameter4dNV", [(GLprogramNV, "id"), (GLsizei, "len"), (Const(OpaquePointer(GLubyte)), "name"), (GLdouble, "x"), (GLdouble, "y"), (GLdouble, "z"), (GLdouble, "w")]), @@ -2258,6 +2269,24 @@ glapi.add_functions([ # GL_EXT_provoking_vertex GlFunction(Void, "glProvokingVertexEXT", [(GLenum, "mode")]), + # GL_APPLE_texture_range + GlFunction(Void, "glTextureRangeAPPLE", [(GLenum, "target"), (GLsizei, "length"), (Const(Blob(GLvoid, "length")), "pointer")]), + GlFunction(Void, "glGetTexParameterPointervAPPLE", [(GLenum, "target"), (GLenum, "pname"), Out(Pointer(OpaquePointer(GLvoid)), "params")], sideeffects=False), + + # GL_APPLE_vertex_program_evaluators + GlFunction(Void, "glEnableVertexAttribAPPLE", [(GLuint, "index"), (GLenum, "pname")]), + GlFunction(Void, "glDisableVertexAttribAPPLE", [(GLuint, "index"), (GLenum, "pname")]), + GlFunction(GLboolean, "glIsVertexAttribEnabledAPPLE", [(GLuint, "index"), (GLenum, "pname")]), + GlFunction(Void, "glMapVertexAttrib1dAPPLE", [(GLuint, "index"), (GLuint, "size"), (GLdouble, "u1"), (GLdouble, "u2"), (GLint, "stride"), (GLint, "order"), (Const(OpaqueArray(GLdouble, "__glMapVertexAttrib1dAPPLE_size(size, stride, order)")), "points")]), + GlFunction(Void, "glMapVertexAttrib1fAPPLE", [(GLuint, "index"), (GLuint, "size"), (GLfloat, "u1"), (GLfloat, "u2"), (GLint, "stride"), (GLint, "order"), (Const(OpaqueArray(GLfloat, "__glMapVertexAttrib1fAPPLE_size(size, stride, order)")), "points")]), + GlFunction(Void, "glMapVertexAttrib2dAPPLE", [(GLuint, "index"), (GLuint, "size"), (GLdouble, "u1"), (GLdouble, "u2"), (GLint, "ustride"), (GLint, "uorder"), (GLdouble, "v1"), (GLdouble, "v2"), (GLint, "vstride"), (GLint, "vorder"), (Const(OpaqueArray(GLdouble, "__glMapVertexAttrib2dAPPLE_size(size, ustride, uorder, vstride, vorder)")), "points")]), + GlFunction(Void, "glMapVertexAttrib2fAPPLE", [(GLuint, "index"), (GLuint, "size"), (GLfloat, "u1"), (GLfloat, "u2"), (GLint, "ustride"), (GLint, "uorder"), (GLfloat, "v1"), (GLfloat, "v2"), (GLint, "vstride"), (GLint, "vorder"), (Const(OpaqueArray(GLfloat, "__glMapVertexAttrib2fAPPLE_size(size, ustride, uorder, vstride, vorder)")), "points")]), + + # GL_APPLE_object_purgeable + GlFunction(GLenum, "glObjectPurgeableAPPLE", [(GLenum, "objectType"), (GLuint, "name"), (GLenum, "option")]), + GlFunction(GLenum, "glObjectUnpurgeableAPPLE", [(GLenum, "objectType"), (GLuint, "name"), (GLenum, "option")]), + GlFunction(Void, "glGetObjectParameterivAPPLE", [(GLenum, "objectType"), (GLuint, "name"), (GLenum, "pname"), Out(OpaqueArray(GLint, "__glGetObjectParameterivAPPLE_size(pname)"), "params")], sideeffects=False), + # GL_NV_copy_image GlFunction(Void, "glCopyImageSubDataNV", [(GLuint, "srcName"), (GLenum, "srcTarget"), (GLint, "srcLevel"), (GLint, "srcX"), (GLint, "srcY"), (GLint, "srcZ"), (GLuint, "dstName"), (GLenum, "dstTarget"), (GLint, "dstLevel"), (GLint, "dstX"), (GLint, "dstY"), (GLint, "dstZ"), (GLsizei, "width"), (GLsizei, "height"), (GLsizei, "depth")]), @@ -2274,3 +2303,8 @@ glapi.add_functions([ GlFunction(GLuint, "glBufferRegionEnabled", [], sideeffects=False), ]) + +# memcpy's prototype. We don't really want to trace all memcpy calls -- just +# emit a few fake memcpy calls --, which is why the prototype is not together +# with the rest. +memcpy = Function(Void, "memcpy", [(GLmap, "dest"), (Blob(Const(Void), "n"), "src"), (SizeT, "n")])