# EGLExt

Artifact: [androidx.graphics:graphics-core](https://developer.android.com/jetpack/androidx/releases/graphics) [View Source](https://cs.android.com/search?q=file:androidx/opengl/EGLExt.kt+class:androidx.opengl.EGLExt) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

*** ** * ** ***


```
public final class EGLExt
```

<br />

*** ** * ** ***

Utility class that provides some helper methods for interacting EGL Extension APIs

## Summary

| ### Constants |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_ANDROID_CLIENT_BUFFER()` Extension that allows creating an EGLClientBuffer from an Android `https://developer.android.com/reference/android/hardware/HardwareBuffer.html` object which can later be used to create an `https://developer.android.com/reference/androidx/opengl/EGLImageKHR` instance. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_ANDROID_IMAGE_NATIVE_BUFFER()` Enables using an Android window buffer (struct ANativeWindowBuffer) as an EGLImage source |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_ANDROID_NATIVE_FENCE_SYNC()` Determines whether creation of platform specific sync objects are supported. |
| `static final int` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_CONDITION_SATISFIED_KHR() = 12534` Return value used in `https://developer.android.com/reference/androidx/opengl/EGLExt#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` to indicate that the sync object had signalled before the timeout expired. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_EXT_BUFFER_AGE()` Determines if applications can query the age of the back buffer contents for an EGL surface as the number of frames elapsed since the contents were recently defined |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_EXT_GL_COLORSPACE_BT2020_PQ()` Determines whether the platform framebuffers support rendering in a larger color gamut specified in the BT.2020 color space |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_EXT_GL_COLORSPACE_DISPLAY_P3_PASSTHROUGH()` Determines whether the underlying platform can support rendering framebuffers in the non-linear Display-P3 color space |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_EXT_GL_COLORSPACE_SCRGB()` Determines whether extended sRGB color spaces are supported options for EGL Surfaces |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_EXT_PIXEL_FORMAT_FLOAT()` Determines whether floating point RGBA components are supported |
| `static final int` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_FALSE() = 0` Constant indicating false within EGL. |
| `static final long` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_FOREVER_KHR()` Value that can be sent as the timeoutNanos parameter of `https://developer.android.com/reference/androidx/opengl/EGLExt#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` indicating that waiting on the sync object to signal will never time out. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_IMG_CONTEXT_PRIORITY()` Determines whether an EGLContext can be created with a priority hint. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_KHR_FENCE_SYNC()` Determines whether sync objects are supported. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_KHR_GL_COLORSPACE()` Determines whether to use sRGB format default framebuffers to render sRGB content to display devices. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_KHR_IMAGE()` Extension that defines a new EGL resource type that is suitable for sharing 2D arrays of image data between client APIs, the EGLImage, and allows creating EGLImages from EGL native pixmaps. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_KHR_IMAGE_BASE()` Extension for supporting a new EGL resource type that is suitable for sharing 2D arrays of image data between client APIs, the EGLImage. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_KHR_NO_CONFIG_CONTEXT()` Determines whether creation of GL and ES contexts without an EGLConfig is allowed |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_KHR_PARTIAL_UPDATE()` Allows for efficient partial updates to an area of a **buffer** that has changed since the last time the buffer was used |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_KHR_SURFACELESS_CONTEXT()` Determines whether creation of an EGL Context without a surface is supported. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_KHR_SWAP_BUFFERS_WITH_DAMAGE()` Allows for efficient partial updates to an area of a **surface** that changes between frames for the surface. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_KHR_WAIT_SYNC()` Determines whether waiting for signaling of sync objects is supported. |
| `static final int` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_SIGNALED_KHR() = 12530` Return value when `https://developer.android.com/reference/androidx/opengl/EGLExt#eglGetSyncAttribKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.IntArray,kotlin.Int)` is called with `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_SYNC_STATUS_KHR()` indicating that the sync object has already been signalled. |
| `static final int` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_SYNC_CONDITION_KHR() = 12536` Attribute that can be queried in `https://developer.android.com/reference/androidx/opengl/EGLExt#eglGetSyncAttribKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.IntArray,kotlin.Int)`. |
| `static final int` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_SYNC_FENCE_KHR() = 12537` Create an EGL fence sync object for signalling one time events. |
| `static final int` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_SYNC_FLUSH_COMMANDS_BIT_KHR() = 1` Accepted in the flags parameter of `https://developer.android.com/reference/androidx/opengl/EGLExt#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)`. |
| `static final int` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_SYNC_NATIVE_FENCE_ANDROID() = 12612` This extension enables the creation of EGL fence sync objects that are associated with a native synchronization fence object that is referenced using a file descriptor. |
| `static final int` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR() = 12528` Return value when `https://developer.android.com/reference/androidx/opengl/EGLExt#eglGetSyncAttribKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.IntArray,kotlin.Int)` is called with `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_SYNC_CONDITION_KHR()`. |
| `static final int` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_SYNC_STATUS_KHR() = 12529` Attribute that can be queried in `https://developer.android.com/reference/androidx/opengl/EGLExt#eglGetSyncAttribKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.IntArray,kotlin.Int)`. |
| `static final int` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_SYNC_TYPE_KHR() = 12535` Attribute that can be queried in `https://developer.android.com/reference/androidx/opengl/EGLExt#eglGetSyncAttribKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.IntArray,kotlin.Int)`. |
| `static final int` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_TIMEOUT_EXPIRED_KHR() = 12533` Return value used in `https://developer.android.com/reference/androidx/opengl/EGLExt#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` to indicate that the specified timeout period had expired before a sync object was signalled. |
| `static final int` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_TRUE() = 1` Constant indicating true within EGL. |
| `static final int` | `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_UNSIGNALED_KHR() = 12531` Return value when `https://developer.android.com/reference/androidx/opengl/EGLExt#eglGetSyncAttribKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.IntArray,kotlin.Int)` is called with `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_SYNC_STATUS_KHR()` indicating that the sync object has not yet been signalled. |

| ### Public methods |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/opengl/EGLExt#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/opengl/EGLDisplay.html eglDisplay, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/opengl/EGLSyncKHR sync, int flags, long timeoutNanos )` Blocks the calling thread until the specified sync object is signalled or until `https://developer.android.com/reference/androidx/opengl/EGLExt.Companion#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` nanoseconds have passed. |
| `static final https://developer.android.com/reference/androidx/opengl/EGLImageKHR` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/opengl/EGLExt#eglCreateImageFromHardwareBuffer(android.opengl.EGLDisplay,android.hardware.HardwareBuffer)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/opengl/EGLDisplay.html eglDisplay, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/hardware/HardwareBuffer.html hardwareBuffer )` Creates an EGLImage from the provided `https://developer.android.com/reference/android/hardware/HardwareBuffer.html`. |
| `static final https://developer.android.com/reference/androidx/opengl/EGLSyncKHR` | `https://developer.android.com/reference/androidx/opengl/EGLExt#eglCreateSyncKHR(android.opengl.EGLDisplay,kotlin.Int,androidx.graphics.opengl.egl.EGLConfigAttributes)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/opengl/EGLDisplay.html eglDisplay, int type, https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLConfigAttributes attributes )` Creates a sync object of the specified type associated with the specified display, and returns a handle to the new object. |
| `static final boolean` | `https://developer.android.com/reference/androidx/opengl/EGLExt#eglDestroyImageKHR(android.opengl.EGLDisplay,androidx.opengl.EGLImageKHR)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/opengl/EGLDisplay.html eglDisplay, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/opengl/EGLImageKHR image )` Destroy the given `https://developer.android.com/reference/androidx/opengl/EGLImageKHR` instance. |
| `static final boolean` | `https://developer.android.com/reference/androidx/opengl/EGLExt#eglDestroySyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/opengl/EGLDisplay.html eglDisplay, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/opengl/EGLSyncKHR eglSync )` Destroys the given sync object associated with the specified display |
| `static final boolean` | `https://developer.android.com/reference/androidx/opengl/EGLExt#eglGetSyncAttribKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.IntArray,kotlin.Int)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/opengl/EGLDisplay.html eglDisplay, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/opengl/EGLSyncKHR sync, int attribute, @https://developer.android.com/reference/androidx/annotation/NonNull int[] value, int offset )` Query attributes of the provided sync object. |
| `static final void` | `https://developer.android.com/reference/androidx/opengl/EGLExt#glEGLImageTargetTexture2DOES(kotlin.Int,androidx.opengl.EGLImageKHR)(int target, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/opengl/EGLImageKHR image)` Upload a given EGLImage to the currently bound GLTexture |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html>` | `https://developer.android.com/reference/androidx/opengl/EGLExt#parseExtensions(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html queryString)` Returns a set of supported supported extensions from a space separated string that represents the set of OpenGL extensions supported |

## Constants

### EGL_ANDROID_CLIENT_BUFFER

```
public static final @NonNull String EGL_ANDROID_CLIENT_BUFFER
```

Extension that allows creating an EGLClientBuffer from an Android `https://developer.android.com/reference/android/hardware/HardwareBuffer.html` object which can later be used to create an `https://developer.android.com/reference/androidx/opengl/EGLImageKHR` instance. See: https://registry.khronos.org/EGL/extensions/ANDROID/EGL_ANDROID_get_native_client_buffer.txt

### EGL_ANDROID_IMAGE_NATIVE_BUFFER

```
public static final @NonNull String EGL_ANDROID_IMAGE_NATIVE_BUFFER
```

Enables using an Android window buffer (struct ANativeWindowBuffer) as an EGLImage source

See: https://www.khronos.org/registry/EGL/extensions/ANDROID/EGL_ANDROID_image_native_buffer.txt

### EGL_ANDROID_NATIVE_FENCE_SYNC

```
public static final @NonNull String EGL_ANDROID_NATIVE_FENCE_SYNC
```

Determines whether creation of platform specific sync objects are supported. These objects that are associated with a native synchronization fence object using a file descriptor.

See: https://www.khronos.org/registry/EGL/extensions/ANDROID/EGL_ANDROID_native_fence_sync.txt

### EGL_CONDITION_SATISFIED_KHR

```
public static final int EGL_CONDITION_SATISFIED_KHR = 12534
```

Return value used in `https://developer.android.com/reference/androidx/opengl/EGLExt#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` to indicate that the sync object had signalled before the timeout expired. This includes the case where the sync object had already signalled before `https://developer.android.com/reference/androidx/opengl/EGLExt#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` was called.

### EGL_EXT_BUFFER_AGE

```
public static final @NonNull String EGL_EXT_BUFFER_AGE
```

Determines if applications can query the age of the back buffer contents for an EGL surface as the number of frames elapsed since the contents were recently defined

See: https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_buffer_age.txt

### EGL_EXT_GL_COLORSPACE_BT2020_PQ

```
public static final @NonNull String EGL_EXT_GL_COLORSPACE_BT2020_PQ
```

Determines whether the platform framebuffers support rendering in a larger color gamut specified in the BT.2020 color space

See: https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_gl_colorspace_bt2020_linear.txt

### EGL_EXT_GL_COLORSPACE_DISPLAY_P3_PASSTHROUGH

```
public static final @NonNull String EGL_EXT_GL_COLORSPACE_DISPLAY_P3_PASSTHROUGH
```

Determines whether the underlying platform can support rendering framebuffers in the non-linear Display-P3 color space

See: https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_gl_colorspace_display_p3_passthrough.txt

### EGL_EXT_GL_COLORSPACE_SCRGB

```
public static final @NonNull String EGL_EXT_GL_COLORSPACE_SCRGB
```

Determines whether extended sRGB color spaces are supported options for EGL Surfaces

See: https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_gl_colorspace_scrgb.txt

### EGL_EXT_PIXEL_FORMAT_FLOAT

```
public static final @NonNull String EGL_EXT_PIXEL_FORMAT_FLOAT
```

Determines whether floating point RGBA components are supported

See: https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_pixel_format_float.txt

### EGL_FALSE

```
public static final int EGL_FALSE = 0
```

Constant indicating false within EGL. This is often returned in failure cases.

### EGL_FOREVER_KHR

```
public static final long EGL_FOREVER_KHR
```

Value that can be sent as the timeoutNanos parameter of `https://developer.android.com/reference/androidx/opengl/EGLExt#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` indicating that waiting on the sync object to signal will never time out.

### EGL_IMG_CONTEXT_PRIORITY

```
public static final @NonNull String EGL_IMG_CONTEXT_PRIORITY
```

Determines whether an EGLContext can be created with a priority hint. Not all implementations are guaranteed to honor the hint.

See: https://www.khronos.org/registry/EGL/extensions/IMG/EGL_IMG_context_priority.txt

### EGL_KHR_FENCE_SYNC

```
public static final @NonNull String EGL_KHR_FENCE_SYNC
```

Determines whether sync objects are supported. Sync objects are synchronization primitives that represent events whose completion can be tested or waited upon.

See: https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_fence_sync.txt

### EGL_KHR_GL_COLORSPACE

```
public static final @NonNull String EGL_KHR_GL_COLORSPACE
```

Determines whether to use sRGB format default framebuffers to render sRGB content to display devices. Supports creation of EGLSurfaces which will be rendered to in sRGB by OpenGL contexts supporting that capability.

See: https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_gl_colorspace.txt

### EGL_KHR_IMAGE

```
public static final @NonNull String EGL_KHR_IMAGE
```

Extension that defines a new EGL resource type that is suitable for sharing 2D arrays of image data between client APIs, the EGLImage, and allows creating EGLImages from EGL native pixmaps.

See: https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_image.txt

### EGL_KHR_IMAGE_BASE

```
public static final @NonNull String EGL_KHR_IMAGE_BASE
```

Extension for supporting a new EGL resource type that is suitable for sharing 2D arrays of image data between client APIs, the EGLImage. Although the intended purpose is sharing 2D image data, the underlying interface makes no assumptions about the format or purpose of the resource being shared, leaving those decisions to the application and associated client APIs.

See: https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_image_base.txt

### EGL_KHR_NO_CONFIG_CONTEXT

```
public static final @NonNull String EGL_KHR_NO_CONFIG_CONTEXT
```

Determines whether creation of GL and ES contexts without an EGLConfig is allowed

See: https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_no_config_context.txt

### EGL_KHR_PARTIAL_UPDATE

```
public static final @NonNull String EGL_KHR_PARTIAL_UPDATE
```

Allows for efficient partial updates to an area of a **buffer** that has changed since the last time the buffer was used

See: https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_partial_update.txt

### EGL_KHR_SURFACELESS_CONTEXT

```
public static final @NonNull String EGL_KHR_SURFACELESS_CONTEXT
```

Determines whether creation of an EGL Context without a surface is supported. This is useful for applications that only want to render to client API targets (such as OpenGL framebuffer objects) and avoid the need to a throw-away EGL surface just to get a current context.

See: https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_surfaceless_context.txt

### EGL_KHR_SWAP_BUFFERS_WITH_DAMAGE

```
public static final @NonNull String EGL_KHR_SWAP_BUFFERS_WITH_DAMAGE
```

Allows for efficient partial updates to an area of a **surface** that changes between frames for the surface. This relates to the differences between two buffers, the current back buffer and the current front buffer.

See: https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_swap_buffers_with_damage.txt

### EGL_KHR_WAIT_SYNC

```
public static final @NonNull String EGL_KHR_WAIT_SYNC
```

Determines whether waiting for signaling of sync objects is supported. This form of wait does not necessarily block the application thread which issued the wait. Therefore applications may continue to issue commands to the client API or perform other work in parallel leading to increased performance.

See: https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_wait_sync.txt

### EGL_SIGNALED_KHR

```
public static final int EGL_SIGNALED_KHR = 12530
```

Return value when `https://developer.android.com/reference/androidx/opengl/EGLExt#eglGetSyncAttribKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.IntArray,kotlin.Int)` is called with `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_SYNC_STATUS_KHR()` indicating that the sync object has already been signalled.

See: https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_fence_sync.txt

### EGL_SYNC_CONDITION_KHR

```
public static final int EGL_SYNC_CONDITION_KHR = 12536
```

Attribute that can be queried in `https://developer.android.com/reference/androidx/opengl/EGLExt#eglGetSyncAttribKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.IntArray,kotlin.Int)`. This attribute can only be queried on sync objects of the type `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_SYNC_FENCE_KHR()`.

See: https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_fence_sync.txt

### EGL_SYNC_FENCE_KHR

```
public static final int EGL_SYNC_FENCE_KHR = 12537
```

Create an EGL fence sync object for signalling one time events. The fence object created is not associated with the Android Sync fence object and is not recommended for waiting for events in a portable manner across Android/EGL boundaries but rather other EGL primitives.

See: https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_fence_sync.txt

### EGL_SYNC_FLUSH_COMMANDS_BIT_KHR

```
public static final int EGL_SYNC_FLUSH_COMMANDS_BIT_KHR = 1
```

Accepted in the flags parameter of `https://developer.android.com/reference/androidx/opengl/EGLExt#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)`. This will implicitly ensure pending commands are flushed to prevent `https://developer.android.com/reference/androidx/opengl/EGLExt#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` from potentially blocking forever. See `https://developer.android.com/reference/androidx/opengl/EGLExt#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` for details.

### EGL_SYNC_NATIVE_FENCE_ANDROID

```
public static final int EGL_SYNC_NATIVE_FENCE_ANDROID = 12612
```

This extension enables the creation of EGL fence sync objects that are associated with a native synchronization fence object that is referenced using a file descriptor. These EGL fence sync objects have nearly identical semantics to those defined by the KHR_fence_sync extension, except that they have an additional attribute storing the file descriptor referring to the native fence object. This differs from EGL_SYNC_FENCE_KHR as the fence sync object is associated with an Android Sync HAL fence object.

This extension assumes the existence of a native fence synchronization object that behaves similarly to an EGL fence sync object. These native objects must have a signal status like that of an EGLSyncKHR object that indicates whether the fence has ever been signaled. Once signaled the native object's signal status may not change again.

See: https://www.khronos.org/registry/EGL/extensions/ANDROID/EGL_ANDROID_native_fence_sync.txt

### EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR

```
public static final int EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR = 12528
```

Return value when `https://developer.android.com/reference/androidx/opengl/EGLExt#eglGetSyncAttribKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.IntArray,kotlin.Int)` is called with `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_SYNC_CONDITION_KHR()`. This indicates that the sync object will signal on the condition of the completion of the fence command on the corresponding sync object and all preceding commands in th EGL client API's command stream.

### EGL_SYNC_STATUS_KHR

```
public static final int EGL_SYNC_STATUS_KHR = 12529
```

Attribute that can be queried in `https://developer.android.com/reference/androidx/opengl/EGLExt#eglGetSyncAttribKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.IntArray,kotlin.Int)`. The results can be either `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_SIGNALED_KHR()` or `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_UNSIGNALED_KHR()` representing whether or not the sync object has been signalled or not. This can be queried on all sync object types.

See: https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_fence_sync.txt

### EGL_SYNC_TYPE_KHR

```
public static final int EGL_SYNC_TYPE_KHR = 12535
```

Attribute that can be queried in `https://developer.android.com/reference/androidx/opengl/EGLExt#eglGetSyncAttribKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.IntArray,kotlin.Int)`. The results can be either `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_SYNC_FENCE_KHR()` or `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_SYNC_NATIVE_FENCE_ANDROID()`.

See: https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_fence_sync.txt

### EGL_TIMEOUT_EXPIRED_KHR

```
public static final int EGL_TIMEOUT_EXPIRED_KHR = 12533
```

Return value used in `https://developer.android.com/reference/androidx/opengl/EGLExt#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` to indicate that the specified timeout period had expired before a sync object was signalled.

### EGL_TRUE

```
public static final int EGL_TRUE = 1
```

Constant indicating true within EGL. This is often returned in success cases.

### EGL_UNSIGNALED_KHR

```
public static final int EGL_UNSIGNALED_KHR = 12531
```

Return value when `https://developer.android.com/reference/androidx/opengl/EGLExt#eglGetSyncAttribKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.IntArray,kotlin.Int)` is called with `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_SYNC_STATUS_KHR()` indicating that the sync object has not yet been signalled.

See: https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_fence_sync.txt

## Public methods

### eglClientWaitSyncKHR

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

```
public static final int eglClientWaitSyncKHR(
    @NonNull EGLDisplay eglDisplay,
    @NonNull EGLSyncKHR sync,
    int flags,
    long timeoutNanos
)
```

Blocks the calling thread until the specified sync object is signalled or until `https://developer.android.com/reference/androidx/opengl/EGLExt.Companion#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` nanoseconds have passed. More than one `https://developer.android.com/reference/androidx/opengl/EGLExt#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` may be outstanding on the same `https://developer.android.com/reference/androidx/opengl/EGLExt.Companion#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` at any given time. When there are multiple threads blocked on the same `https://developer.android.com/reference/androidx/opengl/EGLExt.Companion#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` and the `https://developer.android.com/reference/androidx/opengl/EGLExt.Companion#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` object has signalled, all such threads are released, but the order in which they are released is not defined.

If the value of `https://developer.android.com/reference/androidx/opengl/EGLExt.Companion#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` is zero, then `https://developer.android.com/reference/androidx/opengl/EGLExt#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` simply tests the current status of sync. If the value of `https://developer.android.com/reference/androidx/opengl/EGLExt.Companion#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` is the special value `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_FOREVER_KHR()`, then `https://developer.android.com/reference/androidx/opengl/EGLExt#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` does not time out. For all other values, `https://developer.android.com/reference/androidx/opengl/EGLExt.Companion#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` is adjusted to the closest value allowed by the implementation-dependent timeout accuracy, which may be substantially longer than one nanosecond.

`https://developer.android.com/reference/androidx/opengl/EGLExt#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` returns one of three status values describing the reason for returning. A return value of `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_TIMEOUT_EXPIRED_KHR()` indicates that the specified timeout period expired before `https://developer.android.com/reference/androidx/opengl/EGLExt.Companion#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` was signalled, or if `https://developer.android.com/reference/androidx/opengl/EGLExt.Companion#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` is zero, indicates that `https://developer.android.com/reference/androidx/opengl/EGLExt.Companion#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` is not signaled. A return value of `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_CONDITION_SATISFIED_KHR()` indicates that `https://developer.android.com/reference/androidx/opengl/EGLExt.Companion#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` was signaled before the timeout expired, which includes the case when `https://developer.android.com/reference/androidx/opengl/EGLExt.Companion#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` was already signaled when `https://developer.android.com/reference/androidx/opengl/EGLExt#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` was called. If an error occurs then an error is generated and `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_FALSE()` is returned.

If the sync object being blocked upon will not be signaled in finite time (for example by an associated fence command issued previously, but not yet flushed to the graphics pipeline), then `https://developer.android.com/reference/androidx/opengl/EGLExt#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` may wait forever. To help prevent this behavior, if the `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_SYNC_FLUSH_COMMANDS_BIT_KHR()` is set on the flags parameter and the `https://developer.android.com/reference/androidx/opengl/EGLExt.Companion#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` is unsignaled when `https://developer.android.com/reference/androidx/opengl/EGLExt#eglClientWaitSyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.Long)` is called, then the equivalent flush will be performed for the current EGL context before blocking on sync. If no context is current bound for the API, the `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_SYNC_FLUSH_COMMANDS_BIT_KHR()` bit is ignored.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/opengl/EGLDisplay.html eglDisplay` | EGLDisplay to associate the sync object with |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/opengl/EGLSyncKHR sync` | EGLSyncKHR object to wait on |
| `int flags` | Optional flags to provide to handle flushing of pending commands |
| `long timeoutNanos` | Optional timeout value to wait before this method returns, measured in nanoseconds. This value is always consumed as an unsigned long value so even negative values will be converted to their unsigned equivalent. |

| Returns |
|---|---|
| `int` | Result code indicating the status of the wait request. Either `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_CONDITION_SATISFIED_KHR()`, if the sync did signal within the specified timeout, `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_TIMEOUT_EXPIRED_KHR()` if the sync did not signal within the specified timeout, or `https://developer.android.com/reference/androidx/opengl/EGLExt#EGL_FALSE()` if an error occurs. |

### eglCreateImageFromHardwareBuffer

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

```
@RequiresApi(value = 26)
public static final EGLImageKHR eglCreateImageFromHardwareBuffer(
    @NonNull EGLDisplay eglDisplay,
    @NonNull HardwareBuffer hardwareBuffer
)
```

Creates an EGLImage from the provided `https://developer.android.com/reference/android/hardware/HardwareBuffer.html`. This handles internally creating an EGLClientBuffer and an `https://developer.android.com/reference/androidx/opengl/EGLImageKHR` from the client buffer.

When this `https://developer.android.com/reference/androidx/opengl/EGLImageKHR` instance is no longer necessary, consumers should be sure to call the corresponding method `https://developer.android.com/reference/androidx/opengl/EGLExt#eglDestroyImageKHR(android.opengl.EGLDisplay,androidx.opengl.EGLImageKHR)` to deallocate the resource.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/opengl/EGLDisplay.html eglDisplay` | EGLDisplay connection associated with the EGLImage to create |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/hardware/HardwareBuffer.html hardwareBuffer` | Backing `https://developer.android.com/reference/android/hardware/HardwareBuffer.html` for the generated EGLImage instance |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/opengl/EGLImageKHR` | an `https://developer.android.com/reference/androidx/opengl/EGLImageKHR` instance representing the `https://developer.android.com/reference/androidx/opengl/EGLImageKHR` created from the HardwareBuffer. Because this is created internally through EGL's eglCreateImageKR method, this has the KHR suffix. This can return null if the EGL_ANDROID_image_native_buffer and EGL_KHR_image_base extensions are not supported or if allocation of the buffer fails. See www.khronos.org/registry/EGL/extensions/ANDROID/EGL_ANDROID_get_native_client_buffer.txt |

### eglCreateSyncKHR

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

```
public static final EGLSyncKHR eglCreateSyncKHR(
    @NonNull EGLDisplay eglDisplay,
    int type,
    EGLConfigAttributes attributes
)
```

Creates a sync object of the specified type associated with the specified display, and returns a handle to the new object. The configuration of the returned `https://developer.android.com/reference/androidx/opengl/EGLSyncKHR` object is specified by the provided attributes.

Consumers should ensure that the EGL_KHR_fence_sync EGL extension is supported before invoking this method otherwise a null EGLSyncFenceKHR object is returned.

Additionally when the `https://developer.android.com/reference/androidx/opengl/EGLSyncKHR` instance is no longer necessary, consumers are encouraged to call `https://developer.android.com/reference/androidx/opengl/EGLExt#eglDestroySyncKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR)` to deallocate this resource.

See: https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_fence_sync.txt

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/opengl/EGLDisplay.html eglDisplay` | EGLDisplay to associate the sync object with |
| `int type` | Indicates the type of sync object that is returned Value is one of the following: - `12537` - `12612` <br /> |
| `https://developer.android.com/reference/androidx/graphics/opengl/egl/EGLConfigAttributes attributes` | Specifies the configuration of the sync object returned |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/opengl/EGLSyncKHR` | the EGLSyncKHR object to be used as a fence or null if this extension is not supported |

### eglDestroyImageKHR

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

```
public static final boolean eglDestroyImageKHR(
    @NonNull EGLDisplay eglDisplay,
    @NonNull EGLImageKHR image
)
```

Destroy the given `https://developer.android.com/reference/androidx/opengl/EGLImageKHR` instance. Once destroyed, the image may not be used to create any additional `https://developer.android.com/reference/androidx/opengl/EGLImageKHR` target resources within any client API contexts, although existing `https://developer.android.com/reference/androidx/opengl/EGLImageKHR` siblings may continue to be used. `True` is returned if DestroyImageKHR succeeds, `false` indicates failure. This can return `false` if the `https://developer.android.com/reference/androidx/opengl/EGLImageKHR` is not associated with the default display.

See: https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_image_base.txt

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/opengl/EGLDisplay.html eglDisplay` | EGLDisplay that this EGLImage is connected to |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/opengl/EGLImageKHR image` | EGLImageKHR to be destroyed |

| Returns |
|---|---|
| `boolean` | True if the destruction of the EGLImageKHR object was successful, false otherwise |

### eglDestroySyncKHR

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

```
public static final boolean eglDestroySyncKHR(
    @NonNull EGLDisplay eglDisplay,
    @NonNull EGLSyncKHR eglSync
)
```

Destroys the given sync object associated with the specified display

Consumers should ensure that the EGL_KHR_fence_sync EGL extension is supported before invoking this method otherwise a null EGLSyncFenceKHR object is returned. See: https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_fence_sync.txt

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/opengl/EGLDisplay.html eglDisplay` | EGLDisplay instance associated with the fence |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/opengl/EGLSyncKHR eglSync` | Fence object to be destroyed |

| Returns |
|---|---|
| `boolean` | true if the EGLSyncKHR object was destroyed successfully false otherwise. This can return false if the sync object is not a valid sync object for the provided display or if the display provided in this method does not match the display used to create this sync in eglCreateSyncKHR. |

### eglGetSyncAttribKHR

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

```
public static final boolean eglGetSyncAttribKHR(
    @NonNull EGLDisplay eglDisplay,
    @NonNull EGLSyncKHR sync,
    int attribute,
    @NonNull int[] value,
    int offset
)
```

Query attributes of the provided sync object. Accepted attributes to query depend on the type of sync object. If no errors are generated, this returns true and the value of the queried attribute is stored in the value array at the offset position. If this method returns false, the provided value array is unmodified.

See: https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_fence_sync.txt

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/opengl/EGLDisplay.html eglDisplay` | EGLDisplay to associate the sync object with |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/opengl/EGLSyncKHR sync` | EGLSyncKHR object to query attributes |
| `int attribute` | Corresponding EGLSyncKHR attribute to query on `https://developer.android.com/reference/androidx/opengl/EGLExt.Companion#eglGetSyncAttribKHR(android.opengl.EGLDisplay,androidx.opengl.EGLSyncKHR,kotlin.Int,kotlin.IntArray,kotlin.Int)` Value is one of the following: - `12535` - `12529` - `12536` <br /> |
| `@https://developer.android.com/reference/androidx/annotation/NonNull int[] value` | Integer array used to store the result of the query |
| `int offset` | Index within the value array to store the result of the attribute query |

| Returns |
|---|---|
| `boolean` | True if the attribute was queried successfully, false otherwise. Failure cases include attempting to call this method on an invalid sync object, or the display provided not matching the display that was used to create this sync object. Additionally if the queried attribute is not supported for the sync object, false is returned. |

### glEGLImageTargetTexture2DOES

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

```
public static final void glEGLImageTargetTexture2DOES(int target, @NonNull EGLImageKHR image)
```

Upload a given EGLImage to the currently bound GLTexture

This method requires either of the following EGL extensions to be supported: EGL_KHR_image_base or EGL_KHR_image

See: https://www.khronos.org/registry/OpenGL/extensions/OES/OES_EGL_image_external.txt

### parseExtensions

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

```
public static final @NonNull Set<@NonNull String> parseExtensions(@NonNull String queryString)
```

Returns a set of supported supported extensions from a space separated string that represents the set of OpenGL extensions supported