From: José Fonseca Date: Thu, 2 Feb 2012 14:01:03 +0000 (+0000) Subject: Merge branch 'master' into d2d X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=e7ea01e6b99d1a8123328047d1bfaeba624832bb;hp=bd17ff6ab2c026a97bf414ff509660b024b8a7da;p=apitrace Merge branch 'master' into d2d --- diff --git a/glretrace.py b/glretrace.py index e862e25..8dfc340 100644 --- a/glretrace.py +++ b/glretrace.py @@ -230,6 +230,11 @@ class GlRetracer(Retracer): if function.name == "glEnd": print ' glretrace::insideGlBeginEnd = false;' + if function.name.startswith('gl') and not function.name.startswith('glX'): + print r' if (!glretrace::context && !glretrace::benchmark && !retrace::profiling) {' + print r' retrace::warning(call) << "no current context\n";' + print r' }' + if function.name == 'memcpy': print ' if (!dest || !src || !n) return;' diff --git a/glsize.hpp b/glsize.hpp index 1d1ce45..d81cdf1 100644 --- a/glsize.hpp +++ b/glsize.hpp @@ -744,18 +744,18 @@ __glClearBuffer_size(GLenum buffer) } /* - * 0 terminated integer/float attribute list. + * attribute list, terminated by the given terminator. */ template static inline size_t -__AttribList_size(const T *pAttribList) +__AttribList_size(const T *pAttribList, const T terminator = static_cast(0)) { size_t size = 0; if (pAttribList) { do { ++size; - } while (*pAttribList++); + } while (*pAttribList++ != terminator); } return size; @@ -767,15 +767,16 @@ __AttribList_size(const T *pAttribList) */ template static inline size_t -__AttribList_size(const T *pAttribList, T terminator) +__AttribPairList_size(const T *pAttribList, const T terminator = static_cast(0)) { size_t size = 0; if (pAttribList) { - while (pAttribList[size] != terminator) + while (pAttribList[size] != terminator) { size += 2; + } // terminator also counts - size++; + ++size; } return size; diff --git a/specs/eglapi.py b/specs/eglapi.py index 0c221a6..fabe5bd 100644 --- a/specs/eglapi.py +++ b/specs/eglapi.py @@ -291,7 +291,7 @@ EGLuint64NV = Alias("EGLuint64NV", UInt64) eglapi = API("EGL") -EGLAttribList = Array(Const(EGLattrib), "__AttribList_size(attrib_list, EGL_NONE)") +EGLAttribList = Array(Const(EGLattrib), "__AttribPairList_size(attrib_list, EGL_NONE)") PROC = Opaque("__eglMustCastToProperFunctionPointerType") diff --git a/specs/glxapi.py b/specs/glxapi.py index 145f46a..e57b82a 100644 --- a/specs/glxapi.py +++ b/specs/glxapi.py @@ -278,20 +278,20 @@ glxapi.addFunctions([ Function(Display, "glXGetCurrentDisplay", [], sideeffects=False), # GLX 1.3 and later - Function(Array(GLXFBConfig, "*nitems"), "glXChooseFBConfig", [(Display, "dpy"), (Int, "screen"), (Array(Const(GLXAttrib), "__AttribList_size(attribList)"), "attribList"), Out(Pointer(Int), "nitems")]), + Function(Array(GLXFBConfig, "*nitems"), "glXChooseFBConfig", [(Display, "dpy"), (Int, "screen"), (Array(Const(GLXAttrib), "__AttribPairList_size(attribList)"), "attribList"), Out(Pointer(Int), "nitems")]), Function(Int, "glXGetFBConfigAttrib", [(Display, "dpy"), (GLXFBConfig, "config"), (GLXAttrib, "attribute"), Out(Pointer(Int), "value")]), Function(Array(GLXFBConfig, "*nelements"), "glXGetFBConfigs", [(Display, "dpy"), (Int, "screen"), Out(Pointer(Int), "nelements")]), Function(Pointer(XVisualInfo), "glXGetVisualFromFBConfig", [(Display, "dpy"), (GLXFBConfig, "config")]), Function(GLXWindow, "glXCreateWindow", [(Display, "dpy"), (GLXFBConfig, "config"), - (Window, "win"), (Array(Const(Int), "__AttribList_size(attribList)"), "attribList")]), + (Window, "win"), (Array(Const(Int), "__AttribPairList_size(attribList)"), "attribList")]), Function(Void, "glXDestroyWindow", [(Display, "dpy"), (GLXWindow, "window")]), Function(GLXPixmap, "glXCreatePixmap", [(Display, "dpy"), (GLXFBConfig, "config"), - (Pixmap, "pixmap"), (Array(Const(Int), "__AttribList_size(attribList)"), "attribList")]), + (Pixmap, "pixmap"), (Array(Const(Int), "__AttribPairList_size(attribList)"), "attribList")]), Function(Void, "glXDestroyPixmap", [(Display, "dpy"), (GLXPixmap, "pixmap")]), Function(GLXPbuffer, "glXCreatePbuffer", [(Display, "dpy"), (GLXFBConfig, "config"), - (Array(Const(GLXEnum), "__AttribList_size(attribList)"), "attribList")]), + (Array(Const(GLXEnum), "__AttribPairList_size(attribList)"), "attribList")]), Function(Void, "glXDestroyPbuffer", [(Display, "dpy"), (GLXPbuffer, "pbuf")]), Function(Void, "glXQueryDrawable", [(Display, "dpy"), (GLXDrawable, "draw"), (GLXEnum, "attribute"), Out(Pointer(UInt), "value")]), @@ -309,7 +309,7 @@ glxapi.addFunctions([ Out(Pointer(ULong), "mask")]), # GLX_ARB_create_context - Function(GLXContext, "glXCreateContextAttribsARB", [(Display, "dpy"), (GLXFBConfig, "config"), (GLXContext, "share_context"), (Bool, "direct"), (Array(Const(GLXAttrib), "__AttribList_size(attrib_list)"), "attrib_list")]), + Function(GLXContext, "glXCreateContextAttribsARB", [(Display, "dpy"), (GLXFBConfig, "config"), (GLXContext, "share_context"), (Bool, "direct"), (Array(Const(GLXAttrib), "__AttribPairList_size(attrib_list)"), "attrib_list")]), # GLX_SGI_swap_control Function(Int, "glXSwapIntervalSGI", [(Int, "interval")]), @@ -335,18 +335,18 @@ glxapi.addFunctions([ # GLX_SGIX_fbconfig Function(Int, "glXGetFBConfigAttribSGIX", [(Display, "dpy"), (GLXFBConfigSGIX, "config"), (Int, "attribute"), Out(Pointer(Int), "value")]), - Function(OpaquePointer(GLXFBConfigSGIX), "glXChooseFBConfigSGIX", [(Display, "dpy"), (Int, "screen"), (Array(Int, "__AttribList_size(attrib_list)"), "attrib_list"), (OpaquePointer(Int), "nelements")]), + Function(OpaquePointer(GLXFBConfigSGIX), "glXChooseFBConfigSGIX", [(Display, "dpy"), (Int, "screen"), (Array(Int, "__AttribPairList_size(attrib_list)"), "attrib_list"), Out(Pointer(Int), "nelements")]), Function(GLXPixmap, "glXCreateGLXPixmapWithConfigSGIX", [(Display, "dpy"), (GLXFBConfigSGIX, "config"), (Pixmap, "pixmap")]), Function(GLXContext, "glXCreateContextWithConfigSGIX", [(Display, "dpy"), (GLXFBConfigSGIX, "config"), (Int, "render_type"), (GLXContext, "share_list"), (Bool, "direct")]), - Function(OpaquePointer(XVisualInfo), "glXGetVisualFromFBConfigSGIX", [(Display, "dpy"), (GLXFBConfigSGIX, "config")]), + Function(Pointer(XVisualInfo), "glXGetVisualFromFBConfigSGIX", [(Display, "dpy"), (GLXFBConfigSGIX, "config")]), Function(GLXFBConfigSGIX, "glXGetFBConfigFromVisualSGIX", [(Display, "dpy"), Out(Pointer(XVisualInfo), "vis")]), # GLX_SGIX_pbuffer - Function(GLXPbufferSGIX, "glXCreateGLXPbufferSGIX", [(Display, "dpy"), (GLXFBConfigSGIX, "config"), (UInt, "width"), (UInt, "height"), (Array(Int, "__AttribList_size(attrib_list)"), "attrib_list")]), + Function(GLXPbufferSGIX, "glXCreateGLXPbufferSGIX", [(Display, "dpy"), (GLXFBConfigSGIX, "config"), (UInt, "width"), (UInt, "height"), (Array(Int, "__AttribPairList_size(attrib_list)"), "attrib_list")]), Function(Void, "glXDestroyGLXPbufferSGIX", [(Display, "dpy"), (GLXPbufferSGIX, "pbuf")]), - Function(Int, "glXQueryGLXPbufferSGIX", [(Display, "dpy"), (GLXPbufferSGIX, "pbuf"), (Int, "attribute"), (OpaquePointer(UInt), "value")]), + Function(Int, "glXQueryGLXPbufferSGIX", [(Display, "dpy"), (GLXPbufferSGIX, "pbuf"), (Int, "attribute"), Out(Pointer(UInt), "value")]), Function(Void, "glXSelectEventSGIX", [(Display, "dpy"), (GLXDrawable, "drawable"), (ULong, "mask")]), - Function(Void, "glXGetSelectedEventSGIX", [(Display, "dpy"), (GLXDrawable, "drawable"), (OpaquePointer(ULong), "mask")]), + Function(Void, "glXGetSelectedEventSGIX", [(Display, "dpy"), (GLXDrawable, "drawable"), Out(Pointer(ULong), "mask")]), # GLX_SGI_cushion Function(Void, "glXCushionSGI", [(Display, "dpy"), (Window, "window"), (Float, "cushion")]), @@ -408,12 +408,12 @@ glxapi.addFunctions([ Function(UInt, "glXGetAGPOffsetMESA", [(OpaquePointer(Const(Void)), "pointer")]), # EXT_texture_from_pixmap - Function(Void, "glXBindTexImageEXT", [(Display, "display"), (GLXDrawable, "drawable"), (Int, "buffer"), (Array(Const(Int), "__AttribList_size(attrib_list)"), "attrib_list")]), + Function(Void, "glXBindTexImageEXT", [(Display, "display"), (GLXDrawable, "drawable"), (Int, "buffer"), (Array(Const(Int), "__AttribPairList_size(attrib_list)"), "attrib_list")]), Function(Void, "glXReleaseTexImageEXT", [(Display, "display"), (GLXDrawable, "drawable"), (Int, "buffer")]), # GLX_NV_present_video #Function(OpaquePointer(UInt), "glXEnumerateVideoDevicesNV", [(Display, "dpy"), (Int, "screen"), (OpaquePointer(Int), "nelements")]), - #Function(Int, "glXBindVideoDeviceNV", [(Display, "dpy"), (UInt, "video_slot"), (UInt, "video_device"), (Array(Const(Int), "__AttribList_size(attrib_list)"), "attrib_list")]), + #Function(Int, "glXBindVideoDeviceNV", [(Display, "dpy"), (UInt, "video_slot"), (UInt, "video_device"), (Array(Const(Int), "__AttribPairList_size(attrib_list)"), "attrib_list")]), # GLX_NV_video_output #Function(Int, "glXGetVideoDeviceNV", [(Display, "dpy"), (Int, "screen"), (Int, "numVideoDevices"), (OpaquePointer(GLXVideoDeviceNV), "pVideoDevice")]), diff --git a/specs/wglapi.py b/specs/wglapi.py index d9e2aac..5e0ee9f 100644 --- a/specs/wglapi.py +++ b/specs/wglapi.py @@ -180,14 +180,14 @@ wglapi.addFunctions([ # WGL_ARB_pixel_format StdFunction(BOOL, "wglGetPixelFormatAttribivARB", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(WGLenum, "nAttributes"), "piAttributes"), Out(Array(Int, "nAttributes"), "piValues")], sideeffects=False), StdFunction(BOOL, "wglGetPixelFormatAttribfvARB", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(WGLenum, "nAttributes"), "piAttributes"), Out(Array(FLOAT, "nAttributes"), "pfValues")], sideeffects=False), - StdFunction(BOOL, "wglChoosePixelFormatARB", [(HDC, "hdc"), (Array(Const(WGLenum), "__AttribList_size(piAttribIList)"), "piAttribIList"), (Array(Const(FLOAT), "__AttribList_size(pfAttribFList)"), "pfAttribFList"), (UINT, "nMaxFormats"), Out(Array(Int, "(*nNumFormats)"), "piFormats"), Out(Pointer(UINT), "nNumFormats")]), + StdFunction(BOOL, "wglChoosePixelFormatARB", [(HDC, "hdc"), (Array(Const(WGLenum), "__AttribPairList_size(piAttribIList)"), "piAttribIList"), (Array(Const(FLOAT), "__AttribPairList_size(pfAttribFList)"), "pfAttribFList"), (UINT, "nMaxFormats"), Out(Array(Int, "(*nNumFormats)"), "piFormats"), Out(Pointer(UINT), "nNumFormats")]), # WGL_ARB_make_current_read StdFunction(BOOL, "wglMakeContextCurrentARB", [(HDC, "hDrawDC"), (HDC, "hReadDC"), (HGLRC, "hglrc")]), StdFunction(HDC, "wglGetCurrentReadDCARB", [], sideeffects=False), # WGL_ARB_pbuffer - StdFunction(HPBUFFERARB, "wglCreatePbufferARB", [(HDC, "hDC"), (Int, "iPixelFormat"), (Int, "iWidth"), (Int, "iHeight"), (Array(Const(WGLenum), "__AttribList_size(piAttribList)"), "piAttribList")]), + StdFunction(HPBUFFERARB, "wglCreatePbufferARB", [(HDC, "hDC"), (Int, "iPixelFormat"), (Int, "iWidth"), (Int, "iHeight"), (Array(Const(WGLenum), "__AttribPairList_size(piAttribList)"), "piAttribList")]), StdFunction(HDC, "wglGetPbufferDCARB", [(HPBUFFERARB, "hPbuffer")]), StdFunction(Int, "wglReleasePbufferDCARB", [(HPBUFFERARB, "hPbuffer"), (HDC, "hDC")]), StdFunction(BOOL, "wglDestroyPbufferARB", [(HPBUFFERARB, "hPbuffer")]), @@ -196,10 +196,10 @@ wglapi.addFunctions([ # WGL_ARB_render_texture StdFunction(BOOL, "wglBindTexImageARB", [(HPBUFFERARB, "hPbuffer"), (Int, "iBuffer")]), StdFunction(BOOL, "wglReleaseTexImageARB", [(HPBUFFERARB, "hPbuffer"), (Int, "iBuffer")]), - StdFunction(BOOL, "wglSetPbufferAttribARB", [(HPBUFFERARB, "hPbuffer"), (Array(Const(WGLenum), "__AttribList_size(piAttribList)"), "piAttribList")]), + StdFunction(BOOL, "wglSetPbufferAttribARB", [(HPBUFFERARB, "hPbuffer"), (Array(Const(WGLenum), "__AttribPairList_size(piAttribList)"), "piAttribList")]), # WGL_ARB_create_context - StdFunction(HGLRC, "wglCreateContextAttribsARB", [(HDC, "hDC"), (HGLRC, "hShareContext"), (Array(Const(WGLenum), "__AttribList_size(attribList)"), "attribList")]), + StdFunction(HGLRC, "wglCreateContextAttribsARB", [(HDC, "hDC"), (HGLRC, "hShareContext"), (Array(Const(WGLenum), "__AttribPairList_size(attribList)"), "attribList")]), # WGL_EXT_extensions_string StdFunction(Const(CString), "wglGetExtensionsStringEXT", [], sideeffects=False), @@ -211,7 +211,7 @@ wglapi.addFunctions([ # WGL_EXT_pixel_format StdFunction(BOOL, "wglGetPixelFormatAttribivEXT", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(WGLenum, "nAttributes"), "piAttributes"), Out(Array(Int, "nAttributes"), "piValues")], sideeffects=False), StdFunction(BOOL, "wglGetPixelFormatAttribfvEXT", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(WGLenum, "nAttributes"), "piAttributes"), Out(Array(FLOAT, "nAttributes"), "pfValues")], sideeffects=False), - StdFunction(BOOL, "wglChoosePixelFormatEXT", [(HDC, "hdc"), (Pointer(Const(WGLenum)), "piAttribIList"), (Pointer(Const(FLOAT)), "pfAttribFList"), (UINT, "nMaxFormats"), Out(Array(Int, "nMaxFormats"), "piFormats"), Out(Pointer(UINT), "nNumFormats")]), + StdFunction(BOOL, "wglChoosePixelFormatEXT", [(HDC, "hdc"), (Array(Const(WGLenum), "__AttribPairList_size(piAttribIList)"), "piAttribIList"), (Array(Const(FLOAT), "__AttribPairList_size(pfAttribFList)"), "pfAttribFList"), (UINT, "nMaxFormats"), Out(Array(Int, "*nNumFormats"), "piFormats"), Out(Pointer(UINT), "nNumFormats")]), # WGL_EXT_swap_control StdFunction(BOOL, "wglSwapIntervalEXT", [(Int, "interval")]),