Chia-I Wu | c1d4c4d | 2011-11-03 12:23:21 +0800 | [diff] [blame] | 1 | ########################################################################## |
| 2 | # |
| 3 | # Copyright 2011 LunarG, Inc. |
| 4 | # All Rights Reserved. |
| 5 | # |
| 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | # of this software and associated documentation files (the "Software"), to deal |
| 8 | # in the Software without restriction, including without limitation the rights |
| 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 | # copies of the Software, and to permit persons to whom the Software is |
| 11 | # furnished to do so, subject to the following conditions: |
| 12 | # |
| 13 | # The above copyright notice and this permission notice shall be included in |
| 14 | # all copies or substantial portions of the Software. |
| 15 | # |
| 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 22 | # THE SOFTWARE. |
| 23 | # |
| 24 | ##########################################################################/ |
| 25 | |
| 26 | """EGL API description.""" |
| 27 | |
| 28 | |
| 29 | from stdapi import * |
| 30 | |
| 31 | EGLNativeDisplayType = Opaque("EGLNativeDisplayType") |
| 32 | EGLNativeWindowType = Opaque("EGLNativeWindowType") |
| 33 | EGLNativePixmapType = Opaque("EGLNativePixmapType") |
| 34 | |
| 35 | EGLDisplay = Opaque("EGLDisplay") |
| 36 | EGLConfig = Opaque("EGLConfig") |
| 37 | EGLContext = Opaque("EGLContext") |
| 38 | EGLSurface = Opaque("EGLSurface") |
| 39 | |
| 40 | EGLClientBuffer = Opaque("EGLClientBuffer") |
| 41 | |
| 42 | _EGLBoolean = Alias("EGLBoolean", UInt) |
| 43 | EGLBoolean = FakeEnum(_EGLBoolean, [ |
| 44 | "EGL_FALSE", |
| 45 | "EGL_TRUE", |
| 46 | ]) |
| 47 | |
| 48 | EGLint = Alias("EGLint", Int32) |
| 49 | EGLenum = Alias("EGLenum", UInt) |
| 50 | |
| 51 | EGLError = FakeEnum(EGLint, [ |
| 52 | "EGL_SUCCESS", # 0x3000 |
| 53 | "EGL_NOT_INITIALIZED", # 0x3001 |
| 54 | "EGL_BAD_ACCESS", # 0x3002 |
| 55 | "EGL_BAD_ALLOC", # 0x3003 |
| 56 | "EGL_BAD_ATTRIBUTE", # 0x3004 |
| 57 | "EGL_BAD_CONFIG", # 0x3005 |
| 58 | "EGL_BAD_CONTEXT", # 0x3006 |
| 59 | "EGL_BAD_CURRENT_SURFACE", # 0x3007 |
| 60 | "EGL_BAD_DISPLAY", # 0x3008 |
| 61 | "EGL_BAD_MATCH", # 0x3009 |
| 62 | "EGL_BAD_NATIVE_PIXMAP", # 0x300A |
| 63 | "EGL_BAD_NATIVE_WINDOW", # 0x300B |
| 64 | "EGL_BAD_PARAMETER", # 0x300C |
| 65 | "EGL_BAD_SURFACE", # 0x300D |
| 66 | "EGL_CONTEXT_LOST", # 0x300E /* EGL 1.1 - IMG_power_management */ |
| 67 | ]) |
| 68 | |
| 69 | EGLConfigAttrib = FakeEnum(EGLint, [ |
| 70 | "EGL_BUFFER_SIZE", # 0x3020 |
| 71 | "EGL_ALPHA_SIZE", # 0x3021 |
| 72 | "EGL_BLUE_SIZE", # 0x3022 |
| 73 | "EGL_GREEN_SIZE", # 0x3023 |
| 74 | "EGL_RED_SIZE", # 0x3024 |
| 75 | "EGL_DEPTH_SIZE", # 0x3025 |
| 76 | "EGL_STENCIL_SIZE", # 0x3026 |
| 77 | "EGL_CONFIG_CAVEAT", # 0x3027 |
| 78 | "EGL_CONFIG_ID", # 0x3028 |
| 79 | "EGL_LEVEL", # 0x3029 |
| 80 | "EGL_MAX_PBUFFER_HEIGHT", # 0x302A |
| 81 | "EGL_MAX_PBUFFER_PIXELS", # 0x302B |
| 82 | "EGL_MAX_PBUFFER_WIDTH", # 0x302C |
| 83 | "EGL_NATIVE_RENDERABLE", # 0x302D |
| 84 | "EGL_NATIVE_VISUAL_ID", # 0x302E |
| 85 | "EGL_NATIVE_VISUAL_TYPE", # 0x302F |
| 86 | "EGL_SAMPLES", # 0x3031 |
| 87 | "EGL_SAMPLE_BUFFERS", # 0x3032 |
| 88 | "EGL_SURFACE_TYPE", # 0x3033 |
| 89 | "EGL_TRANSPARENT_TYPE", # 0x3034 |
| 90 | "EGL_TRANSPARENT_BLUE_VALUE", # 0x3035 |
| 91 | "EGL_TRANSPARENT_GREEN_VALUE", # 0x3036 |
| 92 | "EGL_TRANSPARENT_RED_VALUE", # 0x3037 |
| 93 | "EGL_NONE", # 0x3038 /* Attrib list terminator */ |
| 94 | "EGL_BIND_TO_TEXTURE_RGB", # 0x3039 |
| 95 | "EGL_BIND_TO_TEXTURE_RGBA", # 0x303A |
| 96 | "EGL_MIN_SWAP_INTERVAL", # 0x303B |
| 97 | "EGL_MAX_SWAP_INTERVAL", # 0x303C |
| 98 | "EGL_LUMINANCE_SIZE", # 0x303D |
| 99 | "EGL_ALPHA_MASK_SIZE", # 0x303E |
| 100 | "EGL_COLOR_BUFFER_TYPE", # 0x303F |
| 101 | "EGL_RENDERABLE_TYPE", # 0x3040 |
| 102 | "EGL_MATCH_NATIVE_PIXMAP", # 0x3041 /* Pseudo-attribute (not queryable) */ |
| 103 | "EGL_CONFORMANT", # 0x3042 |
| 104 | ]) |
| 105 | |
| 106 | EGLName = FakeEnum(EGLint, [ |
| 107 | "EGL_VENDOR", # 0x3053 |
| 108 | "EGL_VERSION", # 0x3054 |
| 109 | "EGL_EXTENSIONS", # 0x3055 |
| 110 | "EGL_CLIENT_APIS", # 0x308D |
| 111 | ]) |
| 112 | |
| 113 | EGLSurfaceAttrib = FakeEnum(EGLint, [ |
| 114 | "EGL_HEIGHT", # 0x3056 |
| 115 | "EGL_WIDTH", # 0x3057 |
| 116 | "EGL_LARGEST_PBUFFER", # 0x3058 |
| 117 | "EGL_TEXTURE_FORMAT", # 0x3080 |
| 118 | "EGL_TEXTURE_TARGET", # 0x3081 |
| 119 | "EGL_MIPMAP_TEXTURE", # 0x3082 |
| 120 | "EGL_MIPMAP_LEVEL", # 0x3083 |
| 121 | "EGL_RENDER_BUFFER", # 0x3086 |
| 122 | "EGL_VG_COLORSPACE", # 0x3087 |
| 123 | "EGL_VG_ALPHA_FORMAT", # 0x3088 |
| 124 | "EGL_HORIZONTAL_RESOLUTION", # 0x3090 |
| 125 | "EGL_VERTICAL_RESOLUTION", # 0x3091 |
| 126 | "EGL_PIXEL_ASPECT_RATIO", # 0x3092 |
| 127 | "EGL_SWAP_BEHAVIOR", # 0x3093 |
| 128 | "EGL_MULTISAMPLE_RESOLVE", # 0x3099 |
| 129 | "EGL_NONE", |
| 130 | ]) |
| 131 | |
| 132 | EGLContextAttrib = FakeEnum(EGLint, [ |
| 133 | "EGL_CONTEXT_CLIENT_TYPE", # 0x3097 |
| 134 | "EGL_CONTEXT_CLIENT_VERSION", # 0x3098 |
| 135 | "EGL_NONE", |
| 136 | ]) |
| 137 | |
| 138 | EGLAPI = FakeEnum(EGLenum, [ |
| 139 | "EGL_OPENGL_ES_API", # 0x30A0 |
| 140 | "EGL_OPENVG_API", # 0x30A1 |
| 141 | "EGL_OPENGL_API", # 0x30A2 |
| 142 | ]) |
| 143 | |
| 144 | EGLClientBufferType = FakeEnum(EGLenum, [ |
| 145 | "EGL_OPENVG_IMAGE", # 0x3096 |
| 146 | ]) |
| 147 | |
| 148 | EGLBufferType = FakeEnum(EGLint, [ |
| 149 | "EGL_BACK_BUFFER", # 0x3084 |
| 150 | "EGL_SINGLE_BUFFER", # 0x3085 |
| 151 | ]) |
| 152 | |
| 153 | EGLEngine = FakeEnum(EGLint, [ |
| 154 | "EGL_CORE_NATIVE_ENGINE", # 0x305B |
| 155 | ]) |
| 156 | |
| 157 | eglapi = API("EGL") |
| 158 | |
| 159 | PROC = Opaque("__eglMustCastToProperFunctionPointerType") |
| 160 | |
| 161 | eglapi.add_functions([ |
| 162 | # EGL 1.4 |
| 163 | Function(EGLError, "eglGetError", [], sideeffects=False), |
| 164 | |
| 165 | Function(EGLDisplay, "eglGetDisplay", [(EGLNativeDisplayType, "display_id")]), |
| 166 | Function(EGLBoolean, "eglInitialize", [(EGLDisplay, "dpy"), Out(Pointer(EGLint), "major"), Out(Pointer(EGLint), "minor")]), |
| 167 | Function(EGLBoolean, "eglTerminate", [(EGLDisplay, "dpy")]), |
| 168 | |
| 169 | Function(Const(String("char *")), "eglQueryString", [(EGLDisplay, "dpy"), (EGLName, "name")], sideeffects=False), |
| 170 | |
| 171 | Function(EGLBoolean, "eglGetConfigs", [(EGLDisplay, "dpy"), (Array(EGLConfig, "config_size"), "configs"), (EGLint, "config_size"), Out(Pointer(EGLint), "num_config")]), |
| 172 | Function(EGLBoolean, "eglChooseConfig", [(EGLDisplay, "dpy"), (Array(Const(EGLConfigAttrib), "__AttribList_size(attrib_list, EGL_NONE)"), "attrib_list"), (Array(EGLConfig, "config_size"), "configs"), (EGLint, "config_size"), Out(Pointer(EGLint), "num_config")]), |
| 173 | Function(EGLBoolean, "eglGetConfigAttrib", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (EGLConfigAttrib, "attribute"), Out(Pointer(EGLint), "value")], sideeffects=False), |
| 174 | |
| 175 | Function(EGLSurface, "eglCreateWindowSurface", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (EGLNativeWindowType, "win"), (Array(Const(EGLSurfaceAttrib), "__AttribList_size(attrib_list, EGL_NONE)"), "attrib_list")]), |
| 176 | Function(EGLSurface, "eglCreatePbufferSurface", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (Array(Const(EGLSurfaceAttrib), "__AttribList_size(attrib_list, EGL_NONE)"), "attrib_list")]), |
| 177 | Function(EGLSurface, "eglCreatePixmapSurface", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (EGLNativePixmapType, "pixmap"), (Array(Const(EGLSurfaceAttrib), "__AttribList_size(attrib_list, EGL_NONE)"), "attrib_list")]), |
| 178 | Function(EGLBoolean, "eglDestroySurface", [(EGLDisplay, "dpy"), (EGLSurface, "surface")]), |
| 179 | Function(EGLBoolean, "eglQuerySurface", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLSurfaceAttrib, "attribute"), Out(Pointer(EGLint), "value")], sideeffects=False), |
| 180 | |
| 181 | Function(EGLBoolean, "eglBindAPI", [(EGLAPI, "api")]), |
| 182 | Function(EGLAPI, "eglQueryAPI", [], sideeffects=False), |
| 183 | |
| 184 | Function(EGLBoolean, "eglWaitClient", []), |
| 185 | |
| 186 | Function(EGLBoolean, "eglReleaseThread", []), |
| 187 | |
| 188 | Function(EGLSurface, "eglCreatePbufferFromClientBuffer", [(EGLDisplay, "dpy"), (EGLClientBufferType, "buftype"), (EGLClientBuffer, "buffer"), (EGLConfig, "config"), (Array(Const(EGLSurfaceAttrib), "__AttribList_size(attrib_list, EGL_NONE)"), "attrib_list")]), |
| 189 | |
| 190 | Function(EGLBoolean, "eglSurfaceAttrib", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLSurfaceAttrib, "attribute"), (EGLint, "value")]), |
| 191 | Function(EGLBoolean, "eglBindTexImage", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLBufferType, "buffer")]), |
| 192 | Function(EGLBoolean, "eglReleaseTexImage", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLBufferType, "buffer")]), |
| 193 | |
| 194 | Function(EGLBoolean, "eglSwapInterval", [(EGLDisplay, "dpy"), (EGLint, "interval")]), |
| 195 | |
| 196 | Function(EGLContext, "eglCreateContext", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (EGLContext, "share_context"), (Array(Const(EGLContextAttrib), "__AttribList_size(attrib_list, EGL_NONE)"), "attrib_list")]), |
| 197 | Function(EGLBoolean, "eglDestroyContext", [(EGLDisplay, "dpy"), (EGLContext, "ctx")]), |
| 198 | Function(EGLBoolean, "eglMakeCurrent", [(EGLDisplay, "dpy"), (EGLSurface, "draw"), (EGLSurface, "read"), (EGLContext, "ctx")]), |
| 199 | |
| 200 | Function(EGLContext, "eglGetCurrentContext", [], sideeffects=False), |
| 201 | Function(EGLSurface, "eglGetCurrentSurface", [(EGLBufferType, "readdraw")], sideeffects=False), |
| 202 | Function(EGLDisplay, "eglGetCurrentDisplay", [], sideeffects=False), |
| 203 | |
| 204 | Function(EGLBoolean, "eglQueryContext", [(EGLDisplay, "dpy"), (EGLContext, "ctx"), (EGLContextAttrib, "attribute"), Out(Pointer(EGLint), "value")], sideeffects=False), |
| 205 | |
| 206 | Function(EGLBoolean, "eglWaitGL", []), |
| 207 | Function(EGLBoolean, "eglWaitNative", [(EGLEngine, "engine")]), |
| 208 | Function(EGLBoolean, "eglSwapBuffers", [(EGLDisplay, "dpy"), (EGLSurface, "surface")]), |
| 209 | Function(EGLBoolean, "eglCopyBuffers", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLNativePixmapType, "target")]), |
| 210 | |
| 211 | Function(PROC, "eglGetProcAddress", [(Const(CString), "procname")]), |
| 212 | ]) |