eglFunctionList.py revision b8e80941
1#!/usr/bin/env python 2 3""" 4Contains a list of EGL functions to generate dispatch functions for. 5 6This is used from gen_egl_dispatch.py. 7 8EGL_FUNCTIONS is a sequence of (name, eglData) pairs, where name is the name 9of the function, and eglData is a dictionary containing data about that 10function. 11 12The values in the eglData dictionary are: 13- method (string): 14 How to select a vendor library. See "Method values" below. 15 16- prefix (string): 17 This string is prepended to the name of the dispatch function. If 18 unspecified, the default is "" (an empty string). 19 20- static (boolean) 21 If True, this function should be declared static. 22 23- "public" (boolean) 24 If True, the function should be exported from the library. Vendor libraries 25 generally should not use this. 26 27- extension (string): 28 If specified, this is the name of a macro to check for before defining a 29 function. Used for checking for extension macros and such. 30 31- retval (string): 32 If specified, this is a C expression with the default value to return if we 33 can't find a function to call. By default, it will try to guess from the 34 return type: EGL_NO_whatever for the various handle types, NULL for 35 pointers, and zero for everything else. 36 37method values: 38- "custom" 39 The dispatch stub will be hand-written instead of generated. 40 41- "none" 42 No dispatch function exists at all, but the function should still have an 43 entry in the index array. This is for other functions that a stub may need 44 to call that are implemented in libEGL itself. 45 46- "display" 47 Select a vendor from an EGLDisplay argument. 48 49- "device" 50 Select a vendor from an EGLDeviceEXT argument. 51 52- "current" 53 Select the vendor that owns the current context. 54""" 55 56def _eglFunc(name, method, static=None, public=False, inheader=None, prefix="dispatch_", extension=None, retval=None): 57 """ 58 A convenience function to define an entry in the EGL function list. 59 """ 60 if static is None: 61 static = (not public and method != "custom") 62 if inheader is None: 63 inheader = (not static) 64 values = { 65 "method" : method, 66 "prefix" : prefix, 67 "extension" : extension, 68 "retval" : retval, 69 "static" : static, 70 "public" : public, 71 "inheader" : inheader, 72 } 73 return (name, values) 74 75EGL_FUNCTIONS = ( 76 # EGL_VERSION_1_0 77 _eglFunc("eglChooseConfig", "none"), 78 _eglFunc("eglCopyBuffers", "none"), 79 _eglFunc("eglCreateContext", "none"), 80 _eglFunc("eglCreatePbufferSurface", "none"), 81 _eglFunc("eglCreatePixmapSurface", "none"), 82 _eglFunc("eglCreateWindowSurface", "none"), 83 _eglFunc("eglDestroyContext", "none"), 84 _eglFunc("eglDestroySurface", "none"), 85 _eglFunc("eglGetConfigAttrib", "none"), 86 _eglFunc("eglGetConfigs", "none"), 87 _eglFunc("eglQueryContext", "none"), 88 _eglFunc("eglQuerySurface", "none"), 89 _eglFunc("eglSwapBuffers", "none"), 90 _eglFunc("eglWaitGL", "none"), 91 _eglFunc("eglWaitNative", "none"), 92 _eglFunc("eglTerminate", "none"), 93 _eglFunc("eglInitialize", "none"), 94 95 _eglFunc("eglGetCurrentDisplay", "none"), 96 _eglFunc("eglGetCurrentSurface", "none"), 97 _eglFunc("eglGetDisplay", "none"), 98 _eglFunc("eglGetError", "none"), 99 _eglFunc("eglGetProcAddress", "none"), 100 _eglFunc("eglMakeCurrent", "none"), 101 _eglFunc("eglQueryString", "none"), 102 103 # EGL_VERSION_1_1 104 _eglFunc("eglBindTexImage", "none"), 105 _eglFunc("eglReleaseTexImage", "none"), 106 _eglFunc("eglSurfaceAttrib", "none"), 107 _eglFunc("eglSwapInterval", "none"), 108 109 # EGL_VERSION_1_2 110 _eglFunc("eglCreatePbufferFromClientBuffer", "none"), 111 _eglFunc("eglWaitClient", "none"), 112 _eglFunc("eglBindAPI", "none"), 113 _eglFunc("eglQueryAPI", "none"), 114 _eglFunc("eglReleaseThread", "none"), 115 116 # EGL_VERSION_1_4 117 _eglFunc("eglGetCurrentContext", "none"), 118 119 # EGL_VERSION_1_5 120 _eglFunc("eglCreateSync", "none"), 121 _eglFunc("eglDestroySync", "none"), 122 _eglFunc("eglClientWaitSync", "none"), 123 _eglFunc("eglGetSyncAttrib", "none"), 124 _eglFunc("eglCreateImage", "none"), 125 _eglFunc("eglDestroyImage", "none"), 126 _eglFunc("eglCreatePlatformWindowSurface", "none"), 127 _eglFunc("eglCreatePlatformPixmapSurface", "none"), 128 _eglFunc("eglWaitSync", "none"), 129 _eglFunc("eglGetPlatformDisplay", "none"), 130 131 # EGL_EXT_platform_base 132 _eglFunc("eglCreatePlatformWindowSurfaceEXT", "display"), 133 _eglFunc("eglCreatePlatformPixmapSurfaceEXT", "display"), 134 _eglFunc("eglGetPlatformDisplayEXT", "none"), 135 136 # TODO: Most of these extensions should be provided by the vendor 137 # libraries, not by libEGL. They're here now to make testing everything 138 # else easier. 139 140 # EGL_EXT_swap_buffers_with_damage 141 _eglFunc("eglSwapBuffersWithDamageEXT", "display"), 142 143 # KHR_EXT_swap_buffers_with_damage 144 _eglFunc("eglSwapBuffersWithDamageKHR", "display"), 145 146 # EGL_KHR_cl_event2 147 _eglFunc("eglCreateSync64KHR", "display"), 148 149 # EGL_KHR_fence_sync 150 _eglFunc("eglCreateSyncKHR", "display"), 151 _eglFunc("eglDestroySyncKHR", "display"), 152 _eglFunc("eglClientWaitSyncKHR", "display"), 153 _eglFunc("eglGetSyncAttribKHR", "display"), 154 155 # EGL_KHR_image 156 _eglFunc("eglCreateImageKHR", "display"), 157 _eglFunc("eglDestroyImageKHR", "display"), 158 159 # EGL_KHR_image_base 160 # eglCreateImageKHR already defined in EGL_KHR_image 161 # eglDestroyImageKHR already defined in EGL_KHR_image 162 163 # EGL_KHR_reusable_sync 164 _eglFunc("eglSignalSyncKHR", "display"), 165 # eglCreateSyncKHR already defined in EGL_KHR_fence_sync 166 # eglDestroySyncKHR already defined in EGL_KHR_fence_sync 167 # eglClientWaitSyncKHR already defined in EGL_KHR_fence_sync 168 # eglGetSyncAttribKHR already defined in EGL_KHR_fence_sync 169 170 # EGL_KHR_wait_sync 171 _eglFunc("eglWaitSyncKHR", "display"), 172 173 # EGL_MESA_drm_image 174 _eglFunc("eglCreateDRMImageMESA", "display"), 175 _eglFunc("eglExportDRMImageMESA", "display"), 176 177 # EGL_MESA_image_dma_buf_export 178 _eglFunc("eglExportDMABUFImageQueryMESA", "display"), 179 _eglFunc("eglExportDMABUFImageMESA", "display"), 180 181 # EGL_NOK_swap_region 182 _eglFunc("eglSwapBuffersRegionNOK", "display"), 183 184 # EGL_NV_post_sub_buffer 185 _eglFunc("eglPostSubBufferNV", "display"), 186 187 # EGL_WL_bind_wayland_display 188 _eglFunc("eglCreateWaylandBufferFromImageWL", "display"), 189 _eglFunc("eglUnbindWaylandDisplayWL", "display"), 190 _eglFunc("eglQueryWaylandBufferWL", "display"), 191 _eglFunc("eglBindWaylandDisplayWL", "display"), 192 193 # EGL_CHROMIUM_get_sync_values 194 _eglFunc("eglGetSyncValuesCHROMIUM", "display"), 195 196 # EGL_ANDROID_native_fence_sync 197 _eglFunc("eglDupNativeFenceFDANDROID", "display"), 198 199 # EGL_ANDROID_blob_cache 200 _eglFunc("eglSetBlobCacheFuncsANDROID", "display"), 201 202 # EGL_EXT_image_dma_buf_import_modifiers 203 _eglFunc("eglQueryDmaBufFormatsEXT", "display"), 204 _eglFunc("eglQueryDmaBufModifiersEXT", "display"), 205 206 # EGL_EXT_device_base 207 _eglFunc("eglQueryDeviceAttribEXT", "device"), 208 _eglFunc("eglQueryDeviceStringEXT", "device"), 209 _eglFunc("eglQueryDevicesEXT", "none"), 210 _eglFunc("eglQueryDisplayAttribEXT", "display"), 211 212 # EGL_MESA_query_driver 213 _eglFunc("eglGetDisplayDriverName", "display"), 214 _eglFunc("eglGetDisplayDriverConfig", "display"), 215 216) 217 218