Kenneth Waters | 1545e11 | 2010-01-14 13:20:44 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
| 2 | * Use of this source code is governed by a BSD-style license that can be |
| 3 | * found in the LICENSE file. */ |
| 4 | |
| 5 | #include <EGL/egl.h> |
| 6 | |
| 7 | static const char* kClientApis = "OpenGL_ES"; |
| 8 | static const char* kExtensions = ""; |
| 9 | static const char* kVendor = "Chromium OS"; |
| 10 | static const char* kVersion = "1.4"; |
| 11 | |
| 12 | EGLint eglGetError() { |
| 13 | /* This EGL stub cannot be initialized. As such we don't need to track |
| 14 | * error state, we can always return EGL_NOT_INITIALIZED. */ |
| 15 | return EGL_NOT_INITIALIZED; |
| 16 | } |
| 17 | |
| 18 | EGLDisplay eglGetDisplay(EGLNativeDisplayType display_id) { |
| 19 | return EGL_NO_DISPLAY; |
| 20 | } |
| 21 | |
| 22 | EGLBoolean eglInitialize(EGLDisplay dpy, EGLint* major, EGLint* minor) { |
| 23 | /* "EGL_FALSE is reutrned on failure and major and minor are not updated" |
| 24 | * -- EGL 1.4 Section 3.2 */ |
| 25 | return EGL_FALSE; |
| 26 | } |
| 27 | |
| 28 | EGLBoolean eglTerminate(EGLDisplay dpy) { |
| 29 | return EGL_FALSE; |
| 30 | } |
| 31 | |
| 32 | const char* eglQueryString(EGLDisplay dpy, EGLint name) { |
| 33 | switch (name) { |
| 34 | case EGL_CLIENT_APIS: |
| 35 | return kClientApis; |
| 36 | case EGL_EXTENSIONS: |
| 37 | return kExtensions; |
| 38 | case EGL_VENDOR: |
| 39 | return kVendor; |
| 40 | case EGL_VERSION: |
| 41 | return kVersion; |
| 42 | default: |
| 43 | return NULL; |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | EGLBoolean eglGetConfigs(EGLDisplay dpy, EGLConfig* configs, |
| 48 | EGLint config_size, EGLint* num_config) { |
| 49 | /* EGL_NOT_INITIALIZED */ |
| 50 | return EGL_FALSE; |
| 51 | } |
| 52 | |
| 53 | EGLBoolean eglChooseConfig(EGLDisplay dpy, const EGLint* attrib_list, |
| 54 | EGLConfig* configs, EGLint config_size, |
| 55 | EGLint* num_config) { |
| 56 | /* EGL_NOT_INITIALIZED */ |
| 57 | return EGL_FALSE; |
| 58 | } |
| 59 | |
| 60 | EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, |
| 61 | EGLint attribute, EGLint* value) { |
| 62 | /* EGL_NOT_INITIALIZED */ |
| 63 | return EGL_FALSE; |
| 64 | } |
| 65 | |
| 66 | EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, |
| 67 | EGLNativeWindowType win, |
| 68 | const EGLint* attrib_list) { |
| 69 | /* EGL_NOT_INITIALIZED */ |
| 70 | return EGL_NO_SURFACE; |
| 71 | } |
| 72 | |
| 73 | EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, |
| 74 | const EGLint* attrib_list) { |
| 75 | /* EGL_NOT_INITIALIZED */ |
| 76 | return EGL_NO_SURFACE; |
| 77 | } |
| 78 | |
| 79 | EGLSurface eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, |
| 80 | EGLNativePixmapType pixmap, |
| 81 | const EGLint* attrib_list) { |
| 82 | /* EGL_NOT_INITIALIZED */ |
| 83 | return EGL_NO_SURFACE; |
| 84 | } |
| 85 | |
| 86 | EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface) { |
| 87 | return EGL_FALSE; |
| 88 | } |
| 89 | |
| 90 | EGLBoolean eglQuerySurface(EGLDisplay dpy, EGLSurface surface, |
| 91 | EGLint attribute, EGLint* value) { |
| 92 | /* "eglQuerySurface returns EGL_FALSE on failure and value is not updated." |
| 93 | * -- EGL 1.4 Section 3.5.6 */ |
| 94 | return EGL_FALSE; |
| 95 | } |
| 96 | |
| 97 | EGLBoolean eglBindAPI(EGLenum api) { |
| 98 | /* "api must specify one of the supported client APIs , either |
| 99 | * EGL_OPENGL_API, EGL_OPENGL_ES_API, or EGL_OPENVG_API." -- EGL 1.4 Section |
| 100 | * 3.7 |
| 101 | * We only support EGL_OPENGL_ES_API from the kClientApis string above. */ |
| 102 | if (api == EGL_OPENGL_ES_API) |
| 103 | return EGL_TRUE; |
| 104 | return EGL_FALSE; |
| 105 | } |
| 106 | |
| 107 | EGLenum eglQueryAPI() { |
| 108 | /* "The initial value of the current rendering API is EGL_OPENGL_ES_API, |
| 109 | * unless OpenGL ES is not supported by an implementation, in which case the |
| 110 | * initial value is EGL_NONE." -- EGL 1.4 Section 3.7 |
| 111 | * We only support EGL_OPENGL_ES_API so this cannot be changed from the |
| 112 | * initial value. */ |
| 113 | return EGL_OPENGL_ES_API; |
| 114 | } |
| 115 | |
| 116 | EGLBoolean eglWaitClient() { |
| 117 | /* "If there is no current context for the current rendering API, the |
| 118 | * function has no effect but still returns EGL_TRUE." -- EGL 1.4 Section 3.8 |
| 119 | */ |
| 120 | return EGL_TRUE; |
| 121 | } |
| 122 | |
| 123 | EGLBoolean eglReleaseThread() { |
| 124 | /* "There are no defined conditions under which failure will occur." -- EGL |
| 125 | * 1.4 Section 3.11 */ |
| 126 | return EGL_TRUE; |
| 127 | } |
| 128 | |
| 129 | EGLSurface eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, |
| 130 | EGLClientBuffer buffer, |
| 131 | EGLConfig config, |
| 132 | const EGLint* attrib_list) { |
| 133 | /* EGL_NOT_INITIALIZED */ |
| 134 | return EGL_NO_SURFACE; |
| 135 | } |
| 136 | |
| 137 | EGLBoolean eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, |
| 138 | EGLint attribute, EGLint value) { |
| 139 | /* EGL_NOT_INITIALIZED */ |
| 140 | return EGL_FALSE; |
| 141 | } |
| 142 | |
| 143 | EGLBoolean eglBindTexImage(EGLDisplay dpy, EGLSurface surface, |
| 144 | EGLint buffer) { |
| 145 | return EGL_FALSE; |
| 146 | } |
| 147 | |
| 148 | EGLBoolean eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, |
| 149 | EGLint buffer) { |
| 150 | return EGL_FALSE; |
| 151 | } |
| 152 | |
| 153 | EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval) { |
| 154 | return EGL_FALSE; |
| 155 | } |
| 156 | |
| 157 | EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config, |
| 158 | EGLContext share_context, |
| 159 | const EGLint *attrib_list) { |
| 160 | /* EGL_NOT_INITIALIZED */ |
| 161 | return EGL_NO_CONTEXT; |
| 162 | } |
| 163 | |
| 164 | EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx) { |
| 165 | return EGL_FALSE; |
| 166 | } |
| 167 | |
| 168 | EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, |
| 169 | EGLContext ctx) { |
| 170 | /* EGL_NOT_INITIALIZED */ |
| 171 | return EGL_FALSE; |
| 172 | } |
| 173 | |
| 174 | EGLContext eglGetCurrentContext() { |
| 175 | return EGL_NO_CONTEXT; |
| 176 | } |
| 177 | |
| 178 | EGLSurface eglGetCurrentSurface(EGLint readdraw) { |
| 179 | return EGL_NO_SURFACE; |
| 180 | } |
| 181 | |
| 182 | EGLDisplay eglGetCurrentDisplay() { |
| 183 | return EGL_NO_DISPLAY; |
| 184 | } |
| 185 | |
| 186 | EGLBoolean eglWaitGL() { |
| 187 | /* Functionally equivalent to calling WaitClient() with the GL API current. |
| 188 | */ |
| 189 | return eglWaitClient(); |
| 190 | } |
| 191 | |
| 192 | EGLBoolean eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, |
| 193 | EGLint *value) { |
| 194 | /* "eglQueryContext returns EGL_FALSE on failure and value is not updated." |
| 195 | * -- EGL 1.4 Section 3.7.4 */ |
| 196 | return EGL_FALSE; |
| 197 | } |
| 198 | |
| 199 | EGLBoolean eglWaitNative(EGLint engine) { |
| 200 | /* "If there is no current context, the function has no effect but still |
| 201 | * returns EGL_TRUE." "If engine does not denote a recognized marking engine, |
| 202 | * EGL_FALSE is returned and an EGL_BAD_PARAMETER error is generated." -- EGL |
| 203 | * 1.4 Section 3.8 */ |
| 204 | if (engine == EGL_CORE_NATIVE_ENGINE) |
| 205 | return EGL_TRUE; |
| 206 | return EGL_FALSE; |
| 207 | } |
| 208 | |
| 209 | EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) { |
| 210 | return EGL_FALSE; |
| 211 | } |
| 212 | |
| 213 | EGLBoolean eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, |
| 214 | EGLNativePixmapType target) { |
| 215 | return EGL_FALSE; |
| 216 | } |
| 217 | |
| 218 | __eglMustCastToProperFunctionPointerType eglGetProcAddress( |
| 219 | const char* procname) { |
| 220 | /* "eglGetProcAddress may not be queried for core (non-extension) functions |
| 221 | * in EGL or client APIs." -- EGL 1.4 Section 3.10. */ |
| 222 | return NULL; |
| 223 | } |
| 224 | |