1 /*
2 ** Copyright 2012, The Android Open Source Project
3 **
4 ** Licensed under the Apache License, Version 2.0 (the "License");
5 ** you may not use this file except in compliance with the License.
6 ** You may obtain a copy of the License at
7 **
8 **     http://www.apache.org/licenses/LICENSE-2.0
9 **
10 ** Unless required by applicable law or agreed to in writing, software
11 ** distributed under the License is distributed on an "AS IS" BASIS,
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ** See the License for the specific language governing permissions and
14 ** limitations under the License.
15 */
16 
17 // This source file is automatically generated
18 
19 package android.opengl;
20 
21 import android.compat.annotation.UnsupportedAppUsage;
22 import android.graphics.SurfaceTexture;
23 import android.os.Build;
24 import android.view.Surface;
25 import android.view.SurfaceHolder;
26 import android.view.SurfaceView;
27 
28 /**
29  * EGL 1.4
30  *
31  */
32 public class EGL14 {
33 
34 public static final int EGL_DEFAULT_DISPLAY            = 0;
35 public static EGLContext EGL_NO_CONTEXT                = null;
36 public static EGLDisplay EGL_NO_DISPLAY                = null;
37 public static EGLSurface EGL_NO_SURFACE                = null;
38 
39 public static final int EGL_FALSE                          = 0;
40 public static final int EGL_TRUE                           = 1;
41 public static final int EGL_SUCCESS                        = 0x3000;
42 public static final int EGL_NOT_INITIALIZED                = 0x3001;
43 public static final int EGL_BAD_ACCESS                     = 0x3002;
44 public static final int EGL_BAD_ALLOC                      = 0x3003;
45 public static final int EGL_BAD_ATTRIBUTE                  = 0x3004;
46 public static final int EGL_BAD_CONFIG                     = 0x3005;
47 public static final int EGL_BAD_CONTEXT                    = 0x3006;
48 public static final int EGL_BAD_CURRENT_SURFACE            = 0x3007;
49 public static final int EGL_BAD_DISPLAY                    = 0x3008;
50 public static final int EGL_BAD_MATCH                      = 0x3009;
51 public static final int EGL_BAD_NATIVE_PIXMAP              = 0x300A;
52 public static final int EGL_BAD_NATIVE_WINDOW              = 0x300B;
53 public static final int EGL_BAD_PARAMETER                  = 0x300C;
54 public static final int EGL_BAD_SURFACE                    = 0x300D;
55 public static final int EGL_CONTEXT_LOST                   = 0x300E;
56 public static final int EGL_BUFFER_SIZE                    = 0x3020;
57 public static final int EGL_ALPHA_SIZE                     = 0x3021;
58 public static final int EGL_BLUE_SIZE                      = 0x3022;
59 public static final int EGL_GREEN_SIZE                     = 0x3023;
60 public static final int EGL_RED_SIZE                       = 0x3024;
61 public static final int EGL_DEPTH_SIZE                     = 0x3025;
62 public static final int EGL_STENCIL_SIZE                   = 0x3026;
63 public static final int EGL_CONFIG_CAVEAT                  = 0x3027;
64 public static final int EGL_CONFIG_ID                      = 0x3028;
65 public static final int EGL_LEVEL                          = 0x3029;
66 public static final int EGL_MAX_PBUFFER_HEIGHT             = 0x302A;
67 public static final int EGL_MAX_PBUFFER_PIXELS             = 0x302B;
68 public static final int EGL_MAX_PBUFFER_WIDTH              = 0x302C;
69 public static final int EGL_NATIVE_RENDERABLE              = 0x302D;
70 public static final int EGL_NATIVE_VISUAL_ID               = 0x302E;
71 public static final int EGL_NATIVE_VISUAL_TYPE             = 0x302F;
72 public static final int EGL_SAMPLES                        = 0x3031;
73 public static final int EGL_SAMPLE_BUFFERS                 = 0x3032;
74 public static final int EGL_SURFACE_TYPE                   = 0x3033;
75 public static final int EGL_TRANSPARENT_TYPE               = 0x3034;
76 public static final int EGL_TRANSPARENT_BLUE_VALUE         = 0x3035;
77 public static final int EGL_TRANSPARENT_GREEN_VALUE        = 0x3036;
78 public static final int EGL_TRANSPARENT_RED_VALUE          = 0x3037;
79 public static final int EGL_NONE                           = 0x3038;
80 public static final int EGL_BIND_TO_TEXTURE_RGB            = 0x3039;
81 public static final int EGL_BIND_TO_TEXTURE_RGBA           = 0x303A;
82 public static final int EGL_MIN_SWAP_INTERVAL              = 0x303B;
83 public static final int EGL_MAX_SWAP_INTERVAL              = 0x303C;
84 public static final int EGL_LUMINANCE_SIZE                 = 0x303D;
85 public static final int EGL_ALPHA_MASK_SIZE                = 0x303E;
86 public static final int EGL_COLOR_BUFFER_TYPE              = 0x303F;
87 public static final int EGL_RENDERABLE_TYPE                = 0x3040;
88 public static final int EGL_MATCH_NATIVE_PIXMAP            = 0x3041;
89 public static final int EGL_CONFORMANT                     = 0x3042;
90 public static final int EGL_SLOW_CONFIG                    = 0x3050;
91 public static final int EGL_NON_CONFORMANT_CONFIG          = 0x3051;
92 public static final int EGL_TRANSPARENT_RGB                = 0x3052;
93 public static final int EGL_RGB_BUFFER                     = 0x308E;
94 public static final int EGL_LUMINANCE_BUFFER               = 0x308F;
95 public static final int EGL_NO_TEXTURE                     = 0x305C;
96 public static final int EGL_TEXTURE_RGB                    = 0x305D;
97 public static final int EGL_TEXTURE_RGBA                   = 0x305E;
98 public static final int EGL_TEXTURE_2D                     = 0x305F;
99 public static final int EGL_PBUFFER_BIT                    = 0x0001;
100 public static final int EGL_PIXMAP_BIT                     = 0x0002;
101 public static final int EGL_WINDOW_BIT                     = 0x0004;
102 public static final int EGL_VG_COLORSPACE_LINEAR_BIT       = 0x0020;
103 public static final int EGL_VG_ALPHA_FORMAT_PRE_BIT        = 0x0040;
104 public static final int EGL_MULTISAMPLE_RESOLVE_BOX_BIT    = 0x0200;
105 public static final int EGL_SWAP_BEHAVIOR_PRESERVED_BIT    = 0x0400;
106 public static final int EGL_OPENGL_ES_BIT                  = 0x0001;
107 public static final int EGL_OPENVG_BIT                     = 0x0002;
108 public static final int EGL_OPENGL_ES2_BIT                 = 0x0004;
109 public static final int EGL_OPENGL_BIT                     = 0x0008;
110 public static final int EGL_VENDOR                         = 0x3053;
111 public static final int EGL_VERSION                        = 0x3054;
112 public static final int EGL_EXTENSIONS                     = 0x3055;
113 public static final int EGL_CLIENT_APIS                    = 0x308D;
114 public static final int EGL_HEIGHT                         = 0x3056;
115 public static final int EGL_WIDTH                          = 0x3057;
116 public static final int EGL_LARGEST_PBUFFER                = 0x3058;
117 public static final int EGL_TEXTURE_FORMAT                 = 0x3080;
118 public static final int EGL_TEXTURE_TARGET                 = 0x3081;
119 public static final int EGL_MIPMAP_TEXTURE                 = 0x3082;
120 public static final int EGL_MIPMAP_LEVEL                   = 0x3083;
121 public static final int EGL_RENDER_BUFFER                  = 0x3086;
122 public static final int EGL_VG_COLORSPACE                  = 0x3087;
123 public static final int EGL_VG_ALPHA_FORMAT                = 0x3088;
124 public static final int EGL_HORIZONTAL_RESOLUTION          = 0x3090;
125 public static final int EGL_VERTICAL_RESOLUTION            = 0x3091;
126 public static final int EGL_PIXEL_ASPECT_RATIO             = 0x3092;
127 public static final int EGL_SWAP_BEHAVIOR                  = 0x3093;
128 public static final int EGL_MULTISAMPLE_RESOLVE            = 0x3099;
129 public static final int EGL_BACK_BUFFER                    = 0x3084;
130 public static final int EGL_SINGLE_BUFFER                  = 0x3085;
131 public static final int EGL_VG_COLORSPACE_sRGB             = 0x3089;
132 public static final int EGL_VG_COLORSPACE_LINEAR           = 0x308A;
133 public static final int EGL_VG_ALPHA_FORMAT_NONPRE         = 0x308B;
134 public static final int EGL_VG_ALPHA_FORMAT_PRE            = 0x308C;
135 public static final int EGL_DISPLAY_SCALING                = 10000;
136 public static final int EGL_BUFFER_PRESERVED               = 0x3094;
137 public static final int EGL_BUFFER_DESTROYED               = 0x3095;
138 public static final int EGL_OPENVG_IMAGE                   = 0x3096;
139 public static final int EGL_CONTEXT_CLIENT_TYPE            = 0x3097;
140 public static final int EGL_CONTEXT_CLIENT_VERSION         = 0x3098;
141 public static final int EGL_MULTISAMPLE_RESOLVE_DEFAULT    = 0x309A;
142 public static final int EGL_MULTISAMPLE_RESOLVE_BOX        = 0x309B;
143 public static final int EGL_OPENGL_ES_API                  = 0x30A0;
144 public static final int EGL_OPENVG_API                     = 0x30A1;
145 public static final int EGL_OPENGL_API                     = 0x30A2;
146 public static final int EGL_DRAW                           = 0x3059;
147 public static final int EGL_READ                           = 0x305A;
148 public static final int EGL_CORE_NATIVE_ENGINE             = 0x305B;
149 
_nativeClassInit()150     native private static void _nativeClassInit();
151     static {
_nativeClassInit()152         _nativeClassInit();
153     }
154     // C function EGLint eglGetError ( void )
155 
eglGetError( )156     public static native int eglGetError(
157     );
158 
159     // C function EGLDisplay eglGetDisplay ( EGLNativeDisplayType display_id )
160 
eglGetDisplay( int display_id )161     public static native EGLDisplay eglGetDisplay(
162         int display_id
163     );
164 
165     /**
166      * {@hide}
167      */
168     @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
eglGetDisplay( long display_id )169     public static native EGLDisplay eglGetDisplay(
170         long display_id
171     );
172 
173     // C function EGLBoolean eglInitialize ( EGLDisplay dpy, EGLint *major, EGLint *minor )
174 
eglInitialize( EGLDisplay dpy, int[] major, int majorOffset, int[] minor, int minorOffset )175     public static native boolean eglInitialize(
176         EGLDisplay dpy,
177         int[] major,
178         int majorOffset,
179         int[] minor,
180         int minorOffset
181     );
182 
183     // C function EGLBoolean eglTerminate ( EGLDisplay dpy )
184 
eglTerminate( EGLDisplay dpy )185     public static native boolean eglTerminate(
186         EGLDisplay dpy
187     );
188 
189     // C function const char * eglQueryString ( EGLDisplay dpy, EGLint name )
190 
eglQueryString( EGLDisplay dpy, int name )191     public static native String eglQueryString(
192         EGLDisplay dpy,
193         int name
194     );
195     // C function EGLBoolean eglGetConfigs ( EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config )
196 
eglGetConfigs( EGLDisplay dpy, EGLConfig[] configs, int configsOffset, int config_size, int[] num_config, int num_configOffset )197     public static native boolean eglGetConfigs(
198         EGLDisplay dpy,
199         EGLConfig[] configs,
200         int configsOffset,
201         int config_size,
202         int[] num_config,
203         int num_configOffset
204     );
205 
206     // C function EGLBoolean eglChooseConfig ( EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config )
207 
eglChooseConfig( EGLDisplay dpy, int[] attrib_list, int attrib_listOffset, EGLConfig[] configs, int configsOffset, int config_size, int[] num_config, int num_configOffset )208     public static native boolean eglChooseConfig(
209         EGLDisplay dpy,
210         int[] attrib_list,
211         int attrib_listOffset,
212         EGLConfig[] configs,
213         int configsOffset,
214         int config_size,
215         int[] num_config,
216         int num_configOffset
217     );
218 
219     // C function EGLBoolean eglGetConfigAttrib ( EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value )
220 
eglGetConfigAttrib( EGLDisplay dpy, EGLConfig config, int attribute, int[] value, int offset )221     public static native boolean eglGetConfigAttrib(
222         EGLDisplay dpy,
223         EGLConfig config,
224         int attribute,
225         int[] value,
226         int offset
227     );
228 
229     // C function EGLSurface eglCreateWindowSurface ( EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list )
230 
_eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config, Object win, int[] attrib_list, int offset )231     private static native EGLSurface _eglCreateWindowSurface(
232         EGLDisplay dpy,
233         EGLConfig config,
234         Object win,
235         int[] attrib_list,
236         int offset
237     );
238 
_eglCreateWindowSurfaceTexture( EGLDisplay dpy, EGLConfig config, Object win, int[] attrib_list, int offset )239     private static native EGLSurface _eglCreateWindowSurfaceTexture(
240         EGLDisplay dpy,
241         EGLConfig config,
242         Object win,
243         int[] attrib_list,
244         int offset
245     );
246 
eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, Object win, int[] attrib_list, int offset )247     public static EGLSurface eglCreateWindowSurface(EGLDisplay dpy,
248         EGLConfig config,
249         Object win,
250         int[] attrib_list,
251         int offset
252     ){
253         Surface sur = null;
254         if (win instanceof SurfaceView) {
255             SurfaceView surfaceView = (SurfaceView)win;
256             sur = surfaceView.getHolder().getSurface();
257         } else if (win instanceof SurfaceHolder) {
258             SurfaceHolder holder = (SurfaceHolder)win;
259             sur = holder.getSurface();
260         } else if (win instanceof Surface) {
261             sur = (Surface) win;
262         }
263 
264         EGLSurface surface;
265         if (sur != null) {
266             surface = _eglCreateWindowSurface(dpy, config, sur, attrib_list, offset);
267         } else if (win instanceof SurfaceTexture) {
268             surface = _eglCreateWindowSurfaceTexture(dpy, config,
269                     win, attrib_list, offset);
270         } else {
271             throw new java.lang.UnsupportedOperationException(
272                 "eglCreateWindowSurface() can only be called with an instance of " +
273                 "Surface, SurfaceView, SurfaceTexture or SurfaceHolder at the moment, " +
274                 "this will be fixed later.");
275         }
276 
277         return surface;
278     }
279     // C function EGLSurface eglCreatePbufferSurface ( EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list )
280 
eglCreatePbufferSurface( EGLDisplay dpy, EGLConfig config, int[] attrib_list, int offset )281     public static native EGLSurface eglCreatePbufferSurface(
282         EGLDisplay dpy,
283         EGLConfig config,
284         int[] attrib_list,
285         int offset
286     );
287 
288     // C function EGLSurface eglCreatePixmapSurface ( EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list )
289 
290     @Deprecated
eglCreatePixmapSurface( EGLDisplay dpy, EGLConfig config, int pixmap, int[] attrib_list, int offset )291     public static native EGLSurface eglCreatePixmapSurface(
292         EGLDisplay dpy,
293         EGLConfig config,
294         int pixmap,
295         int[] attrib_list,
296         int offset
297     );
298 
299     // C function EGLBoolean eglDestroySurface ( EGLDisplay dpy, EGLSurface surface )
300 
eglDestroySurface( EGLDisplay dpy, EGLSurface surface )301     public static native boolean eglDestroySurface(
302         EGLDisplay dpy,
303         EGLSurface surface
304     );
305 
306     // C function EGLBoolean eglQuerySurface ( EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value )
307 
eglQuerySurface( EGLDisplay dpy, EGLSurface surface, int attribute, int[] value, int offset )308     public static native boolean eglQuerySurface(
309         EGLDisplay dpy,
310         EGLSurface surface,
311         int attribute,
312         int[] value,
313         int offset
314     );
315 
316     // C function EGLBoolean eglBindAPI ( EGLenum api )
317 
eglBindAPI( int api )318     public static native boolean eglBindAPI(
319         int api
320     );
321 
322     // C function EGLenum eglQueryAPI ( void )
323 
eglQueryAPI( )324     public static native int eglQueryAPI(
325     );
326 
327     // C function EGLBoolean eglWaitClient ( void )
328 
eglWaitClient( )329     public static native boolean eglWaitClient(
330     );
331 
332     // C function EGLBoolean eglReleaseThread ( void )
333 
eglReleaseThread( )334     public static native boolean eglReleaseThread(
335     );
336 
337     // C function EGLSurface eglCreatePbufferFromClientBuffer ( EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list )
338     // TODO Deprecate the below method
eglCreatePbufferFromClientBuffer( EGLDisplay dpy, int buftype, int buffer, EGLConfig config, int[] attrib_list, int offset )339     public static native EGLSurface eglCreatePbufferFromClientBuffer(
340         EGLDisplay dpy,
341         int buftype,
342         int buffer,
343         EGLConfig config,
344         int[] attrib_list,
345         int offset
346     );
347     // TODO Unhide the below method
348     /**
349      * {@hide}
350      */
eglCreatePbufferFromClientBuffer( EGLDisplay dpy, int buftype, long buffer, EGLConfig config, int[] attrib_list, int offset )351     public static native EGLSurface eglCreatePbufferFromClientBuffer(
352         EGLDisplay dpy,
353         int buftype,
354         long buffer,
355         EGLConfig config,
356         int[] attrib_list,
357         int offset
358     );
359 
360     // C function EGLBoolean eglSurfaceAttrib ( EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value )
361 
eglSurfaceAttrib( EGLDisplay dpy, EGLSurface surface, int attribute, int value )362     public static native boolean eglSurfaceAttrib(
363         EGLDisplay dpy,
364         EGLSurface surface,
365         int attribute,
366         int value
367     );
368 
369     // C function EGLBoolean eglBindTexImage ( EGLDisplay dpy, EGLSurface surface, EGLint buffer )
370 
eglBindTexImage( EGLDisplay dpy, EGLSurface surface, int buffer )371     public static native boolean eglBindTexImage(
372         EGLDisplay dpy,
373         EGLSurface surface,
374         int buffer
375     );
376 
377     // C function EGLBoolean eglReleaseTexImage ( EGLDisplay dpy, EGLSurface surface, EGLint buffer )
378 
eglReleaseTexImage( EGLDisplay dpy, EGLSurface surface, int buffer )379     public static native boolean eglReleaseTexImage(
380         EGLDisplay dpy,
381         EGLSurface surface,
382         int buffer
383     );
384 
385     // C function EGLBoolean eglSwapInterval ( EGLDisplay dpy, EGLint interval )
386 
eglSwapInterval( EGLDisplay dpy, int interval )387     public static native boolean eglSwapInterval(
388         EGLDisplay dpy,
389         int interval
390     );
391 
392     // C function EGLContext eglCreateContext ( EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list )
393 
eglCreateContext( EGLDisplay dpy, EGLConfig config, EGLContext share_context, int[] attrib_list, int offset )394     public static native EGLContext eglCreateContext(
395         EGLDisplay dpy,
396         EGLConfig config,
397         EGLContext share_context,
398         int[] attrib_list,
399         int offset
400     );
401 
402     // C function EGLBoolean eglDestroyContext ( EGLDisplay dpy, EGLContext ctx )
403 
eglDestroyContext( EGLDisplay dpy, EGLContext ctx )404     public static native boolean eglDestroyContext(
405         EGLDisplay dpy,
406         EGLContext ctx
407     );
408 
409     // C function EGLBoolean eglMakeCurrent ( EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx )
410 
eglMakeCurrent( EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx )411     public static native boolean eglMakeCurrent(
412         EGLDisplay dpy,
413         EGLSurface draw,
414         EGLSurface read,
415         EGLContext ctx
416     );
417 
418     // C function EGLContext eglGetCurrentContext ( void )
419 
eglGetCurrentContext( )420     public static native EGLContext eglGetCurrentContext(
421     );
422 
423     // C function EGLSurface eglGetCurrentSurface ( EGLint readdraw )
424 
eglGetCurrentSurface( int readdraw )425     public static native EGLSurface eglGetCurrentSurface(
426         int readdraw
427     );
428 
429     // C function EGLDisplay eglGetCurrentDisplay ( void )
430 
eglGetCurrentDisplay( )431     public static native EGLDisplay eglGetCurrentDisplay(
432     );
433 
434     // C function EGLBoolean eglQueryContext ( EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value )
435 
eglQueryContext( EGLDisplay dpy, EGLContext ctx, int attribute, int[] value, int offset )436     public static native boolean eglQueryContext(
437         EGLDisplay dpy,
438         EGLContext ctx,
439         int attribute,
440         int[] value,
441         int offset
442     );
443 
444     // C function EGLBoolean eglWaitGL ( void )
445 
eglWaitGL( )446     public static native boolean eglWaitGL(
447     );
448 
449     // C function EGLBoolean eglWaitNative ( EGLint engine )
450 
eglWaitNative( int engine )451     public static native boolean eglWaitNative(
452         int engine
453     );
454 
455     // C function EGLBoolean eglSwapBuffers ( EGLDisplay dpy, EGLSurface surface )
456 
eglSwapBuffers( EGLDisplay dpy, EGLSurface surface )457     public static native boolean eglSwapBuffers(
458         EGLDisplay dpy,
459         EGLSurface surface
460     );
461 
462     // C function EGLBoolean eglCopyBuffers ( EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target )
463 
eglCopyBuffers( EGLDisplay dpy, EGLSurface surface, int target )464     public static native boolean eglCopyBuffers(
465         EGLDisplay dpy,
466         EGLSurface surface,
467         int target
468     );
469 
470 }
471