]> git.cworth.org Git - apitrace/blobdiff - wglapi.py
Advertise GREMEDY extensions through glStringi too.
[apitrace] / wglapi.py
index 099c89886230da45b74790fbdbe5889bf1220754..33bcea00144efa09bfaf0ebb6e78b01e44ae38fc 100644 (file)
--- a/wglapi.py
+++ b/wglapi.py
 ##########################################################################/
 
 
+"""WGL API description"""
+
+
 from glapi import *
-from windows import *
+from winapi import *
+from wglenum import *
 
 
 wglapi = API("WGL")
-wglapi.add_functions(glapi.functions)
 
 
 HGLRC = Alias("HGLRC", HANDLE)
@@ -50,6 +53,7 @@ PFD = Flags(DWORD, [
     "PFD_SWAP_LAYER_BUFFERS",
     "PFD_GENERIC_ACCELERATED",
     "PFD_SUPPORT_DIRECTDRAW",
+    "PFD_SUPPORT_COMPOSITION",
     "PFD_DEPTH_DONTCARE",
     "PFD_DOUBLEBUFFER_DONTCARE",
     "PFD_STEREO_DONTCARE",
@@ -130,148 +134,93 @@ LAYERPLANEDESCRIPTOR = Struct("LAYERPLANEDESCRIPTOR", [
 LPLAYERPLANEDESCRIPTOR = Pointer(LAYERPLANEDESCRIPTOR)
 
 WGLSWAP = Struct("WGLSWAP", [
-   (HDC, "hdc"),
+    (HDC, "hdc"),
     (UINT, "uiFlags"),
 ])
 
-attribute = FakeEnum(Int, [
-    "WGL_NUMBER_PIXEL_FORMATS_EXT",
-    "WGL_DRAW_TO_WINDOW_EXT",
-    "WGL_DRAW_TO_BITMAP_EXT",
-    "WGL_ACCELERATION_EXT",
-    "WGL_NEED_PALETTE_EXT",
-    "WGL_NEED_SYSTEM_PALETTE_EXT",
-    "WGL_SWAP_LAYER_BUFFERS_EXT",
-    "WGL_SWAP_METHOD_EXT",
-    "WGL_NUMBER_OVERLAYS_EXT",
-    "WGL_NUMBER_UNDERLAYS_EXT",
-    "WGL_TRANSPARENT_EXT",
-    "WGL_TRANSPARENT_VALUE_EXT",
-    "WGL_SHARE_DEPTH_EXT",
-    "WGL_SHARE_STENCIL_EXT",
-    "WGL_SHARE_ACCUM_EXT",
-    "WGL_SUPPORT_GDI_EXT",
-    "WGL_SUPPORT_OPENGL_EXT",
-    "WGL_DOUBLE_BUFFER_EXT",
-    "WGL_STEREO_EXT",
-    "WGL_PIXEL_TYPE_EXT",
-    "WGL_COLOR_BITS_EXT",
-    "WGL_RED_BITS_EXT",
-    "WGL_RED_SHIFT_EXT",
-    "WGL_GREEN_BITS_EXT",
-    "WGL_GREEN_SHIFT_EXT",
-    "WGL_BLUE_BITS_EXT",
-    "WGL_BLUE_SHIFT_EXT",
-    "WGL_ALPHA_BITS_EXT",
-    "WGL_ALPHA_SHIFT_EXT",
-    "WGL_ACCUM_BITS_EXT",
-    "WGL_ACCUM_RED_BITS_EXT",
-    "WGL_ACCUM_GREEN_BITS_EXT",
-    "WGL_ACCUM_BLUE_BITS_EXT",
-    "WGL_ACCUM_ALPHA_BITS_EXT",
-    "WGL_DEPTH_BITS_EXT",
-    "WGL_STENCIL_BITS_EXT",
-    "WGL_AUX_BUFFERS_EXT",
-    "WGL_NO_ACCELERATION_EXT",
-    "WGL_GENERIC_ACCELERATION_EXT",
-    "WGL_FULL_ACCELERATION_EXT",
-    "WGL_SWAP_EXCHANGE_EXT",
-    "WGL_SWAP_COPY_EXT",
-    "WGL_SWAP_UNDEFINED_EXT",
-    "WGL_TYPE_RGBA_EXT",
-    "WGL_TYPE_COLORINDEX_EXT",
-])
-
 HPBUFFERARB = Alias("HPBUFFERARB", HANDLE)
 
 
 wglapi.add_functions([
-    StdFunction(BOOL, "wglCopyContext", [(HGLRC, "hglrcSrc"), (HGLRC, "hglrcDst"), (UINT, "mask")]),
+    # WGL
     StdFunction(HGLRC, "wglCreateContext", [(HDC, "hdc")]),
-    StdFunction(HGLRC, "wglCreateLayerContext", [(HDC, "hdc"), (Int, "iLayerPlane")]),
     StdFunction(BOOL, "wglDeleteContext", [(HGLRC, "hglrc")]),
     StdFunction(HGLRC, "wglGetCurrentContext", [], sideeffects=False),
-    StdFunction(HDC, "wglGetCurrentDC", [], sideeffects=False),
-    StdFunction(PROC, "wglGetDefaultProcAddress", [(LPCSTR, "lpszProc")], sideeffects=False),
+    StdFunction(BOOL, "wglMakeCurrent", [(HDC, "hdc"), (HGLRC, "hglrc")]),
+    StdFunction(BOOL, "wglCopyContext", [(HGLRC, "hglrcSrc"), (HGLRC, "hglrcDst"), (UINT, "mask")]),
     StdFunction(Int, "wglChoosePixelFormat", [(HDC, "hdc"), (Pointer(Const(PIXELFORMATDESCRIPTOR)), "ppfd")]), 
     StdFunction(Int, "wglDescribePixelFormat", [(HDC, "hdc"), (Int, "iPixelFormat"), (UINT, "nBytes"), Out(Pointer(PIXELFORMATDESCRIPTOR), "ppfd")]),
+    StdFunction(HDC, "wglGetCurrentDC", [], sideeffects=False),
+    StdFunction(PROC, "wglGetDefaultProcAddress", [(LPCSTR, "lpszProc")], sideeffects=False),
     StdFunction(Int, "wglGetPixelFormat", [(HDC, "hdc")], sideeffects=False),
     StdFunction(BOOL, "wglSetPixelFormat", [(HDC, "hdc"), (Int, "iPixelFormat"), (Pointer(Const(PIXELFORMATDESCRIPTOR)), "ppfd")]),
-    StdFunction(BOOL, "wglMakeCurrent", [(HDC, "hdc"), (HGLRC, "hglrc")]),
+    StdFunction(BOOL, "wglSwapBuffers", [(HDC, "hdc")]),
     StdFunction(BOOL, "wglShareLists", [(HGLRC, "hglrc1"), (HGLRC, "hglrc2")]),
+    StdFunction(HGLRC, "wglCreateLayerContext", [(HDC, "hdc"), (Int, "iLayerPlane")]),
+    StdFunction(BOOL, "wglDescribeLayerPlane", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nBytes"), Out(Pointer(LAYERPLANEDESCRIPTOR), "plpd")]),
+    StdFunction(Int, "wglSetLayerPaletteEntries", [(HDC, "hdc"), (Int, "iLayerPlane"), (Int, "iStart"), (Int, "cEntries"), (Array(Const(COLORREF), "cEntries"), "pcr")]),
+    StdFunction(Int, "wglGetLayerPaletteEntries", [(HDC, "hdc"), (Int, "iLayerPlane"), (Int, "iStart"), (Int, "cEntries"), Out(Array(COLORREF, "cEntries"), "pcr")], sideeffects=False),
+    StdFunction(BOOL, "wglRealizeLayerPalette", [(HDC, "hdc"), (Int, "iLayerPlane"), (BOOL, "bRealize")]),
+    StdFunction(BOOL, "wglSwapLayerBuffers", [(HDC, "hdc"), (UINT, "fuPlanes")]),
     StdFunction(BOOL, "wglUseFontBitmapsA", [(HDC, "hdc"), (DWORD, "first"), (DWORD, "count"), (DWORD, "listBase")]),
     StdFunction(BOOL, "wglUseFontBitmapsW", [(HDC, "hdc"), (DWORD, "first"), (DWORD, "count"), (DWORD, "listBase")]),
-    StdFunction(BOOL, "wglSwapBuffers", [(HDC, "hdc")]),
+    StdFunction(DWORD, "wglSwapMultipleBuffers", [(UINT, "n"), (Array(Const(WGLSWAP), "n"), "ps")]),
     StdFunction(BOOL, "wglUseFontOutlinesA", [(HDC, "hdc"), (DWORD, "first"), (DWORD, "count"), (DWORD, "listBase"), (FLOAT, "deviation"), (FLOAT, "extrusion"), (Int, "format"), (LPGLYPHMETRICSFLOAT, "lpgmf")]),
     StdFunction(BOOL, "wglUseFontOutlinesW", [(HDC, "hdc"), (DWORD, "first"), (DWORD, "count"), (DWORD, "listBase"), (FLOAT, "deviation"), (FLOAT, "extrusion"), (Int, "format"), (LPGLYPHMETRICSFLOAT, "lpgmf")]),
-    StdFunction(BOOL , "wglDescribeLayerPlane", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nBytes"), Out(Pointer(LAYERPLANEDESCRIPTOR), "plpd")]),
-    StdFunction(Int  , "wglSetLayerPaletteEntries", [(HDC, "hdc"), (Int, "iLayerPlane"), (Int, "iStart"), (Int, "cEntries"), (Array(Const(COLORREF), "cEntries"), "pcr")]),
-    StdFunction(Int  , "wglGetLayerPaletteEntries", [(HDC, "hdc"), (Int, "iLayerPlane"), (Int, "iStart"), (Int, "cEntries"), Out(Array(COLORREF, "cEntries"), "pcr")], sideeffects=False),
-    StdFunction(BOOL , "wglRealizeLayerPalette", [(HDC, "hdc"), (Int, "iLayerPlane"), (BOOL, "bRealize")]),
-    StdFunction(BOOL , "wglSwapLayerBuffers", [(HDC, "hdc"), (UINT, "fuPlanes")]),
-    StdFunction(DWORD, "wglSwapMultipleBuffers", [(UINT, "n"), (Array(Const(WGLSWAP), "n"), "ps")]),
-    
+
+    # WGL_ARB_buffer_region
+    StdFunction(HANDLE, "wglCreateBufferRegionARB", [(HDC, "hDC"), (Int, "iLayerPlane"), (UINT, "uType")]),
+    StdFunction(VOID, "wglDeleteBufferRegionARB", [(HANDLE, "hRegion")]),
+    StdFunction(BOOL, "wglSaveBufferRegionARB", [(HANDLE, "hRegion"), (Int, "x"), (Int, "y"), (Int, "width"), (Int, "height")]),
+    StdFunction(BOOL, "wglRestoreBufferRegionARB", [(HANDLE, "hRegion"), (Int, "x"), (Int, "y"), (Int, "width"), (Int, "height"), (Int, "xSrc"), (Int, "ySrc")]),
+
     # WGL_ARB_extensions_string
     StdFunction(Const(CString), "wglGetExtensionsStringARB", [(HDC, "hdc")], sideeffects=False),
-    
+
+    # 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"), (Const(Array(WGLenum, "__AttribList_size(piAttribIList)")), "piAttribIList"), (Const(Array(FLOAT, "__AttribList_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"), (Pointer(Const(Int)), "piAttribList")]), 
-    StdFunction(HDC, "wglGetPbufferDCARB", [(HPBUFFERARB, "hPbuffer")], sideeffects=False),
+    StdFunction(HPBUFFERARB, "wglCreatePbufferARB", [(HDC, "hDC"), (Int, "iPixelFormat"), (Int, "iWidth"), (Int, "iHeight"), (Const(Array(WGLenum, "__AttribList_size(piAttribList)")), "piAttribList")]),
+    StdFunction(HDC, "wglGetPbufferDCARB", [(HPBUFFERARB, "hPbuffer")]),
     StdFunction(Int, "wglReleasePbufferDCARB", [(HPBUFFERARB, "hPbuffer"), (HDC, "hDC")]),
-    StdFunction(BOOL, "wglDestroyPbufferARB", [(HPBUFFERARB, "hPbuffer")]), 
-    StdFunction(BOOL, "wglQueryPbufferARB", [(HPBUFFERARB, "hPbuffer"), (Int, "iAttribute"), Out(Pointer(Int), "piValue")]),
-    
-    # WGL_ARB_pixel_format
-    StdFunction(BOOL, "wglGetPixelFormatAttribivARB", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(attribute, "nAttributes"), "piAttributes"), Out(Array(Int, "nAttributes"), "piValues")], sideeffects=False),
-    StdFunction(BOOL, "wglGetPixelFormatAttribfvARB", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(attribute, "nAttributes"), "piAttributes"), Out(Array(FLOAT, "nAttributes"), "pfValues")], sideeffects=False),
-    StdFunction(BOOL, "wglChoosePixelFormatARB", [(HDC, "hdc"), (Pointer(Const(Int)), "piAttribIList"), (Pointer(Const(FLOAT)), "pfAttribFList"), (UINT, "nMaxFormats"), Out(Array(Int, "nMaxFormats"), "piFormats"), Out(Pointer(UINT), "nNumFormats")]),
-    
+    StdFunction(BOOL, "wglDestroyPbufferARB", [(HPBUFFERARB, "hPbuffer")]),
+    StdFunction(BOOL, "wglQueryPbufferARB", [(HPBUFFERARB, "hPbuffer"), (WGLenum, "iAttribute"), Out(Pointer(Int), "piValue")], sideeffects=False),
+
+    # WGL_ARB_render_texture
+    StdFunction(BOOL, "wglBindTexImageARB", [(HPBUFFERARB, "hPbuffer"), (Int, "iBuffer")]),
+    StdFunction(BOOL, "wglReleaseTexImageARB", [(HPBUFFERARB, "hPbuffer"), (Int, "iBuffer")]),
+    StdFunction(BOOL, "wglSetPbufferAttribARB", [(HPBUFFERARB, "hPbuffer"), (Const(Array(WGLenum, "__AttribList_size(piAttribList)")), "piAttribList")]),
+
+    # WGL_ARB_create_context
+    StdFunction(HGLRC, "wglCreateContextAttribsARB", [(HDC, "hDC"), (HGLRC, "hShareContext"), (Const(Array(WGLenum, "__AttribList_size(attribList)")), "attribList")]),
+
     # WGL_EXT_extensions_string
     StdFunction(Const(CString), "wglGetExtensionsStringEXT", [], sideeffects=False),
 
+    # WGL_EXT_make_current_read
+    StdFunction(BOOL, "wglMakeContextCurrentEXT", [(HDC, "hDrawDC"), (HDC, "hReadDC"), (HGLRC, "hglrc")]),
+    StdFunction(HDC, "wglGetCurrentReadDCEXT", [], sideeffects=False),
+
     # WGL_EXT_pixel_format
-    StdFunction(BOOL, "wglGetPixelFormatAttribivEXT", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(attribute, "nAttributes"), "piAttributes"), Out(Array(Int, "nAttributes"), "piValues")], sideeffects=False),
-    StdFunction(BOOL, "wglGetPixelFormatAttribfvEXT", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(attribute, "nAttributes"), "piAttributes"), Out(Array(FLOAT, "nAttributes"), "pfValues")], sideeffects=False),
-    StdFunction(BOOL, "wglChoosePixelFormatEXT", [(HDC, "hdc"), (Pointer(Const(Int)), "piAttribIList"), (Pointer(Const(FLOAT)), "pfAttribFList"), (UINT, "nMaxFormats"), Out(Array(Int, "nMaxFormats"), "piFormats"), Out(Pointer(UINT), "nNumFormats")]),
+    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")]),
+
+    # WGL_EXT_swap_control
+    StdFunction(BOOL, "wglSwapIntervalEXT", [(Int, "interval")]),
+    StdFunction(Int, "wglGetSwapIntervalEXT", [], sideeffects=False),
+
+    # WGL_NV_vertex_array_range
+    StdFunction(OpaquePointer(Void), "wglAllocateMemoryNV", [(GLsizei, "size"), (GLfloat, "readfreq"), (GLfloat, "writefreq"), (GLfloat, "priority")]),
+    StdFunction(Void, "wglFreeMemoryNV", [(OpaquePointer(Void), "pointer")]),
 
     # must be last
     StdFunction(PROC, "wglGetProcAddress", [(LPCSTR, "lpszProc")]),
 ])
-
-if __name__ == '__main__':
-    print
-    print '#define _GDI32_'
-    print
-    print '#include <windows.h>'
-    print '#include <tchar.h>'
-    print '#include <GL/gl.h>'
-    print '#include "glext.h"'
-    print '#include "wglext.h"'
-    print
-    print '#include "glhelpers.hpp"'
-    print '#include "log.hpp"'
-    print
-    print '#ifndef PFD_SUPPORT_DIRECTDRAW'
-    print '#define PFD_SUPPORT_DIRECTDRAW 0x00002000'
-    print '#endif'
-    print '#ifndef PFD_SUPPORT_COMPOSITION'
-    print '#define PFD_SUPPORT_COMPOSITION 0x00008000'
-    print '#endif'
-    print
-    print '#ifdef __MINGW32__'
-    print ''
-    print 'typedef struct _WGLSWAP'
-    print '{'
-    print '    HDC hdc;'
-    print '    UINT uiFlags;'
-    print '} WGLSWAP, *PWGLSWAP, FAR *LPWGLSWAP;'
-    print ''
-    print '#define WGL_SWAPMULTIPLE_MAX 16'
-    print ''
-    print '#endif'
-    print
-    print 'extern "C" {'
-    print
-    wrap()
-    print
-    print '}'