Revert "Improve EGLConfigAttributes Java usage"
This reverts commit c7f6fde1bedab034e4d848bb913c9bfed4107ecf.
Reason for revert: b/239165059
Change-Id: I3dbf985f025c6fb9c981956ac845501c55eecdb2
diff --git a/graphics/graphics-core/api/current.txt b/graphics/graphics-core/api/current.txt
index 0951710..0a37349 100644
--- a/graphics/graphics-core/api/current.txt
+++ b/graphics/graphics-core/api/current.txt
@@ -76,29 +76,26 @@
package androidx.graphics.opengl.egl {
- public final class EGLConfigAttributes {
- method public int[] toArray();
- field public static final androidx.graphics.opengl.egl.EGLConfigAttributes.Companion Companion;
- field public static final int EGL_COLOR_COMPONENT_TYPE_EXT = 13113; // 0x3339
- field public static final int EGL_COLOR_COMPONENT_TYPE_FIXED_EXT = 13114; // 0x333a
- field public static final int EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT = 13115; // 0x333b
- field public static final androidx.graphics.opengl.egl.EGLConfigAttributes RGBA_1010102;
- field public static final androidx.graphics.opengl.egl.EGLConfigAttributes RGBA_8888;
- field public static final androidx.graphics.opengl.egl.EGLConfigAttributes RGBA_F16;
+ public final inline class EGLConfigAttributes {
+ ctor public EGLConfigAttributes();
}
public static final class EGLConfigAttributes.Builder {
- method public androidx.graphics.opengl.egl.EGLConfigAttributes build();
- method public void include(androidx.graphics.opengl.egl.EGLConfigAttributes attributes);
- method public androidx.graphics.opengl.egl.EGLConfigAttributes.Builder setAttribute(int attribute, int value);
- method @kotlin.jvm.JvmSynthetic public infix void to(int, int that);
- }
-
- public static final class EGLConfigAttributes.Companion {
+ method public void include(int[] attributes);
+ method public infix void to(int, int that);
}
public final class EGLConfigAttributesKt {
- method @kotlin.jvm.JvmSynthetic public static inline androidx.graphics.opengl.egl.EGLConfigAttributes! EGLConfigAttributes(kotlin.jvm.functions.Function1<? super androidx.graphics.opengl.egl.EGLConfigAttributes.Builder,? extends kotlin.Unit> block);
+ method public static inline int[] EGLConfigAttributes(kotlin.jvm.functions.Function1<? super androidx.graphics.opengl.egl.EGLConfigAttributes.Builder,kotlin.Unit> block);
+ method public static int[] getEglConfigAttributes1010102();
+ method public static int[] getEglConfigAttributes8888();
+ method public static int[] getEglConfigAttributesF16();
+ property public static final int[] EglConfigAttributes1010102;
+ property public static final int[] EglConfigAttributes8888;
+ property public static final int[] EglConfigAttributesF16;
+ field public static final int EglColorComponentTypeExt = 13113; // 0x3339
+ field public static final int EglColorComponentTypeFixedExt = 13114; // 0x333a
+ field public static final int EglColorComponentTypeFloatExt = 13115; // 0x333b
}
public final class EGLManager {
@@ -113,7 +110,7 @@
method public androidx.graphics.opengl.egl.EGLVersion getEglVersion();
method public void initialize();
method public boolean isExtensionSupported(String extensionName);
- method public android.opengl.EGLConfig? loadConfig(androidx.graphics.opengl.egl.EGLConfigAttributes configAttributes);
+ method public android.opengl.EGLConfig? loadConfig(int[] configAttributes);
method public boolean makeCurrent(android.opengl.EGLSurface drawSurface, optional android.opengl.EGLSurface readSurface);
method public boolean makeCurrent(android.opengl.EGLSurface drawSurface);
method public void release();
@@ -135,9 +132,9 @@
method public int eglClientWaitSyncKHR(androidx.opengl.EGLSyncKHR sync, int flags, long timeoutNanos);
method public android.opengl.EGLContext eglCreateContext(android.opengl.EGLConfig config);
method @RequiresApi(android.os.Build.VERSION_CODES.O) public androidx.opengl.EGLImageKHR? eglCreateImageFromHardwareBuffer(android.hardware.HardwareBuffer hardwareBuffer);
- method public android.opengl.EGLSurface eglCreatePBufferSurface(android.opengl.EGLConfig config, androidx.graphics.opengl.egl.EGLConfigAttributes? configAttributes);
- method public androidx.opengl.EGLSyncKHR? eglCreateSyncKHR(int type, androidx.graphics.opengl.egl.EGLConfigAttributes? attributes);
- method public android.opengl.EGLSurface eglCreateWindowSurface(android.opengl.EGLConfig config, android.view.Surface surface, androidx.graphics.opengl.egl.EGLConfigAttributes? configAttributes);
+ method public android.opengl.EGLSurface eglCreatePBufferSurface(android.opengl.EGLConfig config, int[]? configAttributes);
+ method public androidx.opengl.EGLSyncKHR? eglCreateSyncKHR(int type, int[]? attributes);
+ method public android.opengl.EGLSurface eglCreateWindowSurface(android.opengl.EGLConfig config, android.view.Surface surface, int[]? configAttributes);
method public void eglDestroyContext(android.opengl.EGLContext eglContext);
method public boolean eglDestroyImageKHR(androidx.opengl.EGLImageKHR image);
method public boolean eglDestroySurface(android.opengl.EGLSurface surface);
@@ -154,7 +151,7 @@
method public boolean eglSwapBuffers(android.opengl.EGLSurface surface);
method public default String getErrorMessage();
method public default static String getStatusString(int error);
- method public android.opengl.EGLConfig? loadConfig(androidx.graphics.opengl.egl.EGLConfigAttributes configAttributes);
+ method public android.opengl.EGLConfig? loadConfig(int[] configAttributes);
field public static final androidx.graphics.opengl.egl.EGLSpec.Companion Companion;
field public static final androidx.graphics.opengl.egl.EGLSpec V14;
}
@@ -254,7 +251,7 @@
public final class EGLExt {
method public static int eglClientWaitSyncKHR(android.opengl.EGLDisplay eglDisplay, androidx.opengl.EGLSyncKHR sync, int flags, long timeoutNanos);
method @RequiresApi(android.os.Build.VERSION_CODES.O) public static androidx.opengl.EGLImageKHR? eglCreateImageFromHardwareBuffer(android.opengl.EGLDisplay eglDisplay, android.hardware.HardwareBuffer hardwareBuffer);
- method public static androidx.opengl.EGLSyncKHR? eglCreateSyncKHR(android.opengl.EGLDisplay eglDisplay, int type, androidx.graphics.opengl.egl.EGLConfigAttributes? attributes);
+ method public static androidx.opengl.EGLSyncKHR? eglCreateSyncKHR(android.opengl.EGLDisplay eglDisplay, int type, int[]? attributes);
method public static boolean eglDestroyImageKHR(android.opengl.EGLDisplay eglDisplay, androidx.opengl.EGLImageKHR image);
method public static boolean eglDestroySyncKHR(android.opengl.EGLDisplay eglDisplay, androidx.opengl.EGLSyncKHR eglSync);
method @RequiresApi(android.os.Build.VERSION_CODES.KITKAT) public static androidx.hardware.SyncFenceCompat eglDupNativeFenceFDANDROID(android.opengl.EGLDisplay display, androidx.opengl.EGLSyncKHR sync);
@@ -298,7 +295,7 @@
public static final class EGLExt.Companion {
method public int eglClientWaitSyncKHR(android.opengl.EGLDisplay eglDisplay, androidx.opengl.EGLSyncKHR sync, int flags, long timeoutNanos);
method @RequiresApi(android.os.Build.VERSION_CODES.O) public androidx.opengl.EGLImageKHR? eglCreateImageFromHardwareBuffer(android.opengl.EGLDisplay eglDisplay, android.hardware.HardwareBuffer hardwareBuffer);
- method public androidx.opengl.EGLSyncKHR? eglCreateSyncKHR(android.opengl.EGLDisplay eglDisplay, int type, androidx.graphics.opengl.egl.EGLConfigAttributes? attributes);
+ method public androidx.opengl.EGLSyncKHR? eglCreateSyncKHR(android.opengl.EGLDisplay eglDisplay, int type, int[]? attributes);
method public boolean eglDestroyImageKHR(android.opengl.EGLDisplay eglDisplay, androidx.opengl.EGLImageKHR image);
method public boolean eglDestroySyncKHR(android.opengl.EGLDisplay eglDisplay, androidx.opengl.EGLSyncKHR eglSync);
method @RequiresApi(android.os.Build.VERSION_CODES.KITKAT) public androidx.hardware.SyncFenceCompat eglDupNativeFenceFDANDROID(android.opengl.EGLDisplay display, androidx.opengl.EGLSyncKHR sync);
diff --git a/graphics/graphics-core/api/public_plus_experimental_current.txt b/graphics/graphics-core/api/public_plus_experimental_current.txt
index 0951710..0a37349 100644
--- a/graphics/graphics-core/api/public_plus_experimental_current.txt
+++ b/graphics/graphics-core/api/public_plus_experimental_current.txt
@@ -76,29 +76,26 @@
package androidx.graphics.opengl.egl {
- public final class EGLConfigAttributes {
- method public int[] toArray();
- field public static final androidx.graphics.opengl.egl.EGLConfigAttributes.Companion Companion;
- field public static final int EGL_COLOR_COMPONENT_TYPE_EXT = 13113; // 0x3339
- field public static final int EGL_COLOR_COMPONENT_TYPE_FIXED_EXT = 13114; // 0x333a
- field public static final int EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT = 13115; // 0x333b
- field public static final androidx.graphics.opengl.egl.EGLConfigAttributes RGBA_1010102;
- field public static final androidx.graphics.opengl.egl.EGLConfigAttributes RGBA_8888;
- field public static final androidx.graphics.opengl.egl.EGLConfigAttributes RGBA_F16;
+ public final inline class EGLConfigAttributes {
+ ctor public EGLConfigAttributes();
}
public static final class EGLConfigAttributes.Builder {
- method public androidx.graphics.opengl.egl.EGLConfigAttributes build();
- method public void include(androidx.graphics.opengl.egl.EGLConfigAttributes attributes);
- method public androidx.graphics.opengl.egl.EGLConfigAttributes.Builder setAttribute(int attribute, int value);
- method @kotlin.jvm.JvmSynthetic public infix void to(int, int that);
- }
-
- public static final class EGLConfigAttributes.Companion {
+ method public void include(int[] attributes);
+ method public infix void to(int, int that);
}
public final class EGLConfigAttributesKt {
- method @kotlin.jvm.JvmSynthetic public static inline androidx.graphics.opengl.egl.EGLConfigAttributes! EGLConfigAttributes(kotlin.jvm.functions.Function1<? super androidx.graphics.opengl.egl.EGLConfigAttributes.Builder,? extends kotlin.Unit> block);
+ method public static inline int[] EGLConfigAttributes(kotlin.jvm.functions.Function1<? super androidx.graphics.opengl.egl.EGLConfigAttributes.Builder,kotlin.Unit> block);
+ method public static int[] getEglConfigAttributes1010102();
+ method public static int[] getEglConfigAttributes8888();
+ method public static int[] getEglConfigAttributesF16();
+ property public static final int[] EglConfigAttributes1010102;
+ property public static final int[] EglConfigAttributes8888;
+ property public static final int[] EglConfigAttributesF16;
+ field public static final int EglColorComponentTypeExt = 13113; // 0x3339
+ field public static final int EglColorComponentTypeFixedExt = 13114; // 0x333a
+ field public static final int EglColorComponentTypeFloatExt = 13115; // 0x333b
}
public final class EGLManager {
@@ -113,7 +110,7 @@
method public androidx.graphics.opengl.egl.EGLVersion getEglVersion();
method public void initialize();
method public boolean isExtensionSupported(String extensionName);
- method public android.opengl.EGLConfig? loadConfig(androidx.graphics.opengl.egl.EGLConfigAttributes configAttributes);
+ method public android.opengl.EGLConfig? loadConfig(int[] configAttributes);
method public boolean makeCurrent(android.opengl.EGLSurface drawSurface, optional android.opengl.EGLSurface readSurface);
method public boolean makeCurrent(android.opengl.EGLSurface drawSurface);
method public void release();
@@ -135,9 +132,9 @@
method public int eglClientWaitSyncKHR(androidx.opengl.EGLSyncKHR sync, int flags, long timeoutNanos);
method public android.opengl.EGLContext eglCreateContext(android.opengl.EGLConfig config);
method @RequiresApi(android.os.Build.VERSION_CODES.O) public androidx.opengl.EGLImageKHR? eglCreateImageFromHardwareBuffer(android.hardware.HardwareBuffer hardwareBuffer);
- method public android.opengl.EGLSurface eglCreatePBufferSurface(android.opengl.EGLConfig config, androidx.graphics.opengl.egl.EGLConfigAttributes? configAttributes);
- method public androidx.opengl.EGLSyncKHR? eglCreateSyncKHR(int type, androidx.graphics.opengl.egl.EGLConfigAttributes? attributes);
- method public android.opengl.EGLSurface eglCreateWindowSurface(android.opengl.EGLConfig config, android.view.Surface surface, androidx.graphics.opengl.egl.EGLConfigAttributes? configAttributes);
+ method public android.opengl.EGLSurface eglCreatePBufferSurface(android.opengl.EGLConfig config, int[]? configAttributes);
+ method public androidx.opengl.EGLSyncKHR? eglCreateSyncKHR(int type, int[]? attributes);
+ method public android.opengl.EGLSurface eglCreateWindowSurface(android.opengl.EGLConfig config, android.view.Surface surface, int[]? configAttributes);
method public void eglDestroyContext(android.opengl.EGLContext eglContext);
method public boolean eglDestroyImageKHR(androidx.opengl.EGLImageKHR image);
method public boolean eglDestroySurface(android.opengl.EGLSurface surface);
@@ -154,7 +151,7 @@
method public boolean eglSwapBuffers(android.opengl.EGLSurface surface);
method public default String getErrorMessage();
method public default static String getStatusString(int error);
- method public android.opengl.EGLConfig? loadConfig(androidx.graphics.opengl.egl.EGLConfigAttributes configAttributes);
+ method public android.opengl.EGLConfig? loadConfig(int[] configAttributes);
field public static final androidx.graphics.opengl.egl.EGLSpec.Companion Companion;
field public static final androidx.graphics.opengl.egl.EGLSpec V14;
}
@@ -254,7 +251,7 @@
public final class EGLExt {
method public static int eglClientWaitSyncKHR(android.opengl.EGLDisplay eglDisplay, androidx.opengl.EGLSyncKHR sync, int flags, long timeoutNanos);
method @RequiresApi(android.os.Build.VERSION_CODES.O) public static androidx.opengl.EGLImageKHR? eglCreateImageFromHardwareBuffer(android.opengl.EGLDisplay eglDisplay, android.hardware.HardwareBuffer hardwareBuffer);
- method public static androidx.opengl.EGLSyncKHR? eglCreateSyncKHR(android.opengl.EGLDisplay eglDisplay, int type, androidx.graphics.opengl.egl.EGLConfigAttributes? attributes);
+ method public static androidx.opengl.EGLSyncKHR? eglCreateSyncKHR(android.opengl.EGLDisplay eglDisplay, int type, int[]? attributes);
method public static boolean eglDestroyImageKHR(android.opengl.EGLDisplay eglDisplay, androidx.opengl.EGLImageKHR image);
method public static boolean eglDestroySyncKHR(android.opengl.EGLDisplay eglDisplay, androidx.opengl.EGLSyncKHR eglSync);
method @RequiresApi(android.os.Build.VERSION_CODES.KITKAT) public static androidx.hardware.SyncFenceCompat eglDupNativeFenceFDANDROID(android.opengl.EGLDisplay display, androidx.opengl.EGLSyncKHR sync);
@@ -298,7 +295,7 @@
public static final class EGLExt.Companion {
method public int eglClientWaitSyncKHR(android.opengl.EGLDisplay eglDisplay, androidx.opengl.EGLSyncKHR sync, int flags, long timeoutNanos);
method @RequiresApi(android.os.Build.VERSION_CODES.O) public androidx.opengl.EGLImageKHR? eglCreateImageFromHardwareBuffer(android.opengl.EGLDisplay eglDisplay, android.hardware.HardwareBuffer hardwareBuffer);
- method public androidx.opengl.EGLSyncKHR? eglCreateSyncKHR(android.opengl.EGLDisplay eglDisplay, int type, androidx.graphics.opengl.egl.EGLConfigAttributes? attributes);
+ method public androidx.opengl.EGLSyncKHR? eglCreateSyncKHR(android.opengl.EGLDisplay eglDisplay, int type, int[]? attributes);
method public boolean eglDestroyImageKHR(android.opengl.EGLDisplay eglDisplay, androidx.opengl.EGLImageKHR image);
method public boolean eglDestroySyncKHR(android.opengl.EGLDisplay eglDisplay, androidx.opengl.EGLSyncKHR eglSync);
method @RequiresApi(android.os.Build.VERSION_CODES.KITKAT) public androidx.hardware.SyncFenceCompat eglDupNativeFenceFDANDROID(android.opengl.EGLDisplay display, androidx.opengl.EGLSyncKHR sync);
diff --git a/graphics/graphics-core/api/restricted_current.txt b/graphics/graphics-core/api/restricted_current.txt
index 297890a..e05ad7e 100644
--- a/graphics/graphics-core/api/restricted_current.txt
+++ b/graphics/graphics-core/api/restricted_current.txt
@@ -76,30 +76,28 @@
package androidx.graphics.opengl.egl {
- public final class EGLConfigAttributes {
- method public int[] toArray();
- field public static final androidx.graphics.opengl.egl.EGLConfigAttributes.Companion Companion;
- field public static final int EGL_COLOR_COMPONENT_TYPE_EXT = 13113; // 0x3339
- field public static final int EGL_COLOR_COMPONENT_TYPE_FIXED_EXT = 13114; // 0x333a
- field public static final int EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT = 13115; // 0x333b
- field public static final androidx.graphics.opengl.egl.EGLConfigAttributes RGBA_1010102;
- field public static final androidx.graphics.opengl.egl.EGLConfigAttributes RGBA_8888;
- field public static final androidx.graphics.opengl.egl.EGLConfigAttributes RGBA_F16;
+ public final inline class EGLConfigAttributes {
+ ctor public EGLConfigAttributes();
}
public static final class EGLConfigAttributes.Builder {
ctor @kotlin.PublishedApi internal EGLConfigAttributes.Builder();
- method public androidx.graphics.opengl.egl.EGLConfigAttributes build();
- method public void include(androidx.graphics.opengl.egl.EGLConfigAttributes attributes);
- method public androidx.graphics.opengl.egl.EGLConfigAttributes.Builder setAttribute(int attribute, int value);
- method @kotlin.jvm.JvmSynthetic public infix void to(int, int that);
- }
-
- public static final class EGLConfigAttributes.Companion {
+ method @kotlin.PublishedApi internal int[] build();
+ method public void include(int[] attributes);
+ method public infix void to(int, int that);
}
public final class EGLConfigAttributesKt {
- method @kotlin.jvm.JvmSynthetic public static inline androidx.graphics.opengl.egl.EGLConfigAttributes! EGLConfigAttributes(kotlin.jvm.functions.Function1<? super androidx.graphics.opengl.egl.EGLConfigAttributes.Builder,? extends kotlin.Unit> block);
+ method public static inline int[] EGLConfigAttributes(kotlin.jvm.functions.Function1<? super androidx.graphics.opengl.egl.EGLConfigAttributes.Builder,kotlin.Unit> block);
+ method public static int[] getEglConfigAttributes1010102();
+ method public static int[] getEglConfigAttributes8888();
+ method public static int[] getEglConfigAttributesF16();
+ property public static final int[] EglConfigAttributes1010102;
+ property public static final int[] EglConfigAttributes8888;
+ property public static final int[] EglConfigAttributesF16;
+ field public static final int EglColorComponentTypeExt = 13113; // 0x3339
+ field public static final int EglColorComponentTypeFixedExt = 13114; // 0x333a
+ field public static final int EglColorComponentTypeFloatExt = 13115; // 0x333b
}
public final class EGLManager {
@@ -114,7 +112,7 @@
method public androidx.graphics.opengl.egl.EGLVersion getEglVersion();
method public void initialize();
method public boolean isExtensionSupported(String extensionName);
- method public android.opengl.EGLConfig? loadConfig(androidx.graphics.opengl.egl.EGLConfigAttributes configAttributes);
+ method public android.opengl.EGLConfig? loadConfig(int[] configAttributes);
method public boolean makeCurrent(android.opengl.EGLSurface drawSurface, optional android.opengl.EGLSurface readSurface);
method public boolean makeCurrent(android.opengl.EGLSurface drawSurface);
method public void release();
@@ -136,9 +134,9 @@
method public int eglClientWaitSyncKHR(androidx.opengl.EGLSyncKHR sync, int flags, long timeoutNanos);
method public android.opengl.EGLContext eglCreateContext(android.opengl.EGLConfig config);
method @RequiresApi(android.os.Build.VERSION_CODES.O) public androidx.opengl.EGLImageKHR? eglCreateImageFromHardwareBuffer(android.hardware.HardwareBuffer hardwareBuffer);
- method public android.opengl.EGLSurface eglCreatePBufferSurface(android.opengl.EGLConfig config, androidx.graphics.opengl.egl.EGLConfigAttributes? configAttributes);
- method public androidx.opengl.EGLSyncKHR? eglCreateSyncKHR(int type, androidx.graphics.opengl.egl.EGLConfigAttributes? attributes);
- method public android.opengl.EGLSurface eglCreateWindowSurface(android.opengl.EGLConfig config, android.view.Surface surface, androidx.graphics.opengl.egl.EGLConfigAttributes? configAttributes);
+ method public android.opengl.EGLSurface eglCreatePBufferSurface(android.opengl.EGLConfig config, int[]? configAttributes);
+ method public androidx.opengl.EGLSyncKHR? eglCreateSyncKHR(int type, int[]? attributes);
+ method public android.opengl.EGLSurface eglCreateWindowSurface(android.opengl.EGLConfig config, android.view.Surface surface, int[]? configAttributes);
method public void eglDestroyContext(android.opengl.EGLContext eglContext);
method public boolean eglDestroyImageKHR(androidx.opengl.EGLImageKHR image);
method public boolean eglDestroySurface(android.opengl.EGLSurface surface);
@@ -155,7 +153,7 @@
method public boolean eglSwapBuffers(android.opengl.EGLSurface surface);
method public default String getErrorMessage();
method public default static String getStatusString(int error);
- method public android.opengl.EGLConfig? loadConfig(androidx.graphics.opengl.egl.EGLConfigAttributes configAttributes);
+ method public android.opengl.EGLConfig? loadConfig(int[] configAttributes);
field public static final androidx.graphics.opengl.egl.EGLSpec.Companion Companion;
field public static final androidx.graphics.opengl.egl.EGLSpec V14;
}
@@ -255,7 +253,7 @@
public final class EGLExt {
method public static int eglClientWaitSyncKHR(android.opengl.EGLDisplay eglDisplay, androidx.opengl.EGLSyncKHR sync, int flags, long timeoutNanos);
method @RequiresApi(android.os.Build.VERSION_CODES.O) public static androidx.opengl.EGLImageKHR? eglCreateImageFromHardwareBuffer(android.opengl.EGLDisplay eglDisplay, android.hardware.HardwareBuffer hardwareBuffer);
- method public static androidx.opengl.EGLSyncKHR? eglCreateSyncKHR(android.opengl.EGLDisplay eglDisplay, int type, androidx.graphics.opengl.egl.EGLConfigAttributes? attributes);
+ method public static androidx.opengl.EGLSyncKHR? eglCreateSyncKHR(android.opengl.EGLDisplay eglDisplay, int type, int[]? attributes);
method public static boolean eglDestroyImageKHR(android.opengl.EGLDisplay eglDisplay, androidx.opengl.EGLImageKHR image);
method public static boolean eglDestroySyncKHR(android.opengl.EGLDisplay eglDisplay, androidx.opengl.EGLSyncKHR eglSync);
method @RequiresApi(android.os.Build.VERSION_CODES.KITKAT) public static androidx.hardware.SyncFenceCompat eglDupNativeFenceFDANDROID(android.opengl.EGLDisplay display, androidx.opengl.EGLSyncKHR sync);
@@ -299,7 +297,7 @@
public static final class EGLExt.Companion {
method public int eglClientWaitSyncKHR(android.opengl.EGLDisplay eglDisplay, androidx.opengl.EGLSyncKHR sync, int flags, long timeoutNanos);
method @RequiresApi(android.os.Build.VERSION_CODES.O) public androidx.opengl.EGLImageKHR? eglCreateImageFromHardwareBuffer(android.opengl.EGLDisplay eglDisplay, android.hardware.HardwareBuffer hardwareBuffer);
- method public androidx.opengl.EGLSyncKHR? eglCreateSyncKHR(android.opengl.EGLDisplay eglDisplay, int type, androidx.graphics.opengl.egl.EGLConfigAttributes? attributes);
+ method public androidx.opengl.EGLSyncKHR? eglCreateSyncKHR(android.opengl.EGLDisplay eglDisplay, int type, int[]? attributes);
method public boolean eglDestroyImageKHR(android.opengl.EGLDisplay eglDisplay, androidx.opengl.EGLImageKHR image);
method public boolean eglDestroySyncKHR(android.opengl.EGLDisplay eglDisplay, androidx.opengl.EGLSyncKHR eglSync);
method @RequiresApi(android.os.Build.VERSION_CODES.KITKAT) public androidx.hardware.SyncFenceCompat eglDupNativeFenceFDANDROID(android.opengl.EGLDisplay display, androidx.opengl.EGLSyncKHR sync);
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLConfigAttributesJavaTest.java b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLConfigAttributesJavaTest.java
deleted file mode 100644
index 536204c..0000000
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLConfigAttributesJavaTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.graphics.opengl.egl;
-
-import static org.junit.Assert.assertEquals;
-
-import android.opengl.EGL14;
-
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-import androidx.test.filters.SmallTest;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@SmallTest
-@RunWith(AndroidJUnit4.class)
-public class EGLConfigAttributesJavaTest {
-
- @Test
- public void testEglConfigAttribute() {
- EGLConfigAttributes config = new EGLConfigAttributes.Builder()
- .setAttribute(1, 2)
- .setAttribute(3, 4)
- .setAttribute(5, 6)
- .build();
- int[] attrs = config.toArray();
- assertEquals(7, attrs.length);
- assertEquals(1, attrs[0]);
- assertEquals(2, attrs[1]);
- assertEquals(3, attrs[2]);
- assertEquals(4, attrs[3]);
- assertEquals(5, attrs[4]);
- assertEquals(6, attrs[5]);
- assertEquals(EGL14.EGL_NONE, attrs[6]);
- }
-}
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLConfigAttributesTest.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLConfigAttributesTest.kt
index 2f4a0c3..51cd87a 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLConfigAttributesTest.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLConfigAttributesTest.kt
@@ -17,8 +17,6 @@
package androidx.graphics.opengl.egl
import android.opengl.EGL14
-import androidx.graphics.opengl.egl.EGLConfigAttributes.Companion.EGL_COLOR_COMPONENT_TYPE_EXT
-import androidx.graphics.opengl.egl.EGLConfigAttributes.Companion.EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import org.junit.Assert.assertEquals
@@ -32,7 +30,7 @@
@Test
fun testConfig8888() {
- with(EGLConfigAttributes.RGBA_8888.attrs) {
+ with(EglConfigAttributes8888.attrs) {
assertTrue(find(EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT))
assertTrue(find(EGL14.EGL_RED_SIZE, 8))
assertTrue(find(EGL14.EGL_GREEN_SIZE, 8))
@@ -49,7 +47,7 @@
@Test
fun testConfig1010102() {
- with(EGLConfigAttributes.RGBA_1010102.attrs) {
+ with(EglConfigAttributes1010102.attrs) {
assertTrue(find(EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT))
assertTrue(find(EGL14.EGL_RED_SIZE, 10))
assertTrue(find(EGL14.EGL_GREEN_SIZE, 10))
@@ -65,9 +63,9 @@
@Test
fun testConfigF16() {
- with(EGLConfigAttributes.RGBA_F16.attrs) {
+ with(EglConfigAttributesF16.attrs) {
assertTrue(find(EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT))
- assertTrue(find(EGL_COLOR_COMPONENT_TYPE_EXT, EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT))
+ assertTrue(find(EglColorComponentTypeExt, EglColorComponentTypeFloatExt))
assertTrue(find(EGL14.EGL_RED_SIZE, 16))
assertTrue(find(EGL14.EGL_GREEN_SIZE, 16))
assertTrue(find(EGL14.EGL_BLUE_SIZE, 16))
@@ -85,16 +83,16 @@
// Verify that custom config that uses an include initially and overwrites
// individual values is handled appropriately even if the config is technically invalid
val customConfig = EGLConfigAttributes {
- include(EGLConfigAttributes.RGBA_8888)
+ include(EglConfigAttributes8888)
EGL14.EGL_RED_SIZE to 27
- EGL_COLOR_COMPONENT_TYPE_EXT to EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT
+ EglColorComponentTypeExt to EglColorComponentTypeFloatExt
EGL14.EGL_STENCIL_SIZE to 32
}
with(customConfig.attrs) {
assertTrue(find(EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT))
assertTrue(find(EGL14.EGL_RED_SIZE, 27))
- assertTrue(find(EGL_COLOR_COMPONENT_TYPE_EXT, EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT))
+ assertTrue(find(EglColorComponentTypeExt, EglColorComponentTypeFloatExt))
assertTrue(find(EGL14.EGL_STENCIL_SIZE, 32))
assertEquals(this[size - 1], EGL14.EGL_NONE)
assertEquals(21, size)
diff --git a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLManagerTest.kt b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLManagerTest.kt
index a887653..7beed6c 100644
--- a/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLManagerTest.kt
+++ b/graphics/graphics-core/src/androidTest/java/androidx/graphics/opengl/egl/EGLManagerTest.kt
@@ -64,7 +64,7 @@
fun testInitializeAndRelease() {
testEglManager {
initialize()
- val config = loadConfig(EGLConfigAttributes.RGBA_8888)?.also {
+ val config = loadConfig(EglConfigAttributes8888)?.also {
createContext(it)
}
if (config == null) {
@@ -85,7 +85,7 @@
fun testMultipleInitializeCallsIgnored() {
testEglManager {
initialize()
- loadConfig(EGLConfigAttributes.RGBA_8888)?.also {
+ loadConfig(EglConfigAttributes8888)?.also {
createContext(it)
}
val currentContext = eglContext
@@ -103,7 +103,7 @@
fun testMultipleReleaseCallsIgnored() {
testEglManager {
initialize()
- loadConfig(EGLConfigAttributes.RGBA_8888)?.also {
+ loadConfig(EglConfigAttributes8888)?.also {
createContext(it)
}
// Multiple attempts to release should act as no-ops, i.e. we should not crash
@@ -125,7 +125,7 @@
assertEquals(currentDrawSurface, EGL14.EGL_NO_SURFACE)
assertEquals(currentReadSurface, EGL14.EGL_NO_SURFACE)
- val config = loadConfig(EGLConfigAttributes.RGBA_8888)
+ val config = loadConfig(EglConfigAttributes8888)
if (config == null) {
fail("Config 8888 should be supported")
@@ -191,7 +191,7 @@
assertEquals(currentDrawSurface, EGL14.EGL_NO_SURFACE)
assertEquals(currentReadSurface, EGL14.EGL_NO_SURFACE)
- val config = loadConfig(EGLConfigAttributes.RGBA_8888)
+ val config = loadConfig(EglConfigAttributes8888)
if (config == null) {
fail("Config 8888 should be supported")
@@ -223,7 +223,7 @@
assertEquals(currentDrawSurface, EGL14.EGL_NO_SURFACE)
assertEquals(currentReadSurface, EGL14.EGL_NO_SURFACE)
- val config = loadConfig(EGLConfigAttributes.RGBA_8888)
+ val config = loadConfig(EglConfigAttributes8888)
if (config == null) {
fail("Config 8888 should be supported")
@@ -256,7 +256,7 @@
testEglManager {
initialize()
- val config = loadConfig(EGLConfigAttributes.RGBA_8888)
+ val config = loadConfig(EglConfigAttributes8888)
if (config == null) {
fail("Config 8888 should be supported")
}
@@ -302,7 +302,7 @@
) {
testEglManager {
initialize()
- val config = loadConfig(EGLConfigAttributes.RGBA_8888)
+ val config = loadConfig(EglConfigAttributes8888)
if (config == null) {
fail("Config 8888 should be supported")
}
@@ -356,7 +356,7 @@
var canRender = false
testEglManager {
initialize()
- val config = loadConfig(EGLConfigAttributes.RGBA_8888)
+ val config = loadConfig(EglConfigAttributes8888)
if (config == null) {
fail("Config 8888 should be supported")
}
@@ -671,7 +671,7 @@
// EGLConfig to the ARGB8888 configuration
private fun EGLManager.initializeWithDefaultConfig() {
initialize()
- val config = loadConfig(EGLConfigAttributes.RGBA_8888)
+ val config = loadConfig(EglConfigAttributes8888)
if (config == null) {
fail("Config 8888 should be supported")
}
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/opengl/GLRenderer.kt b/graphics/graphics-core/src/main/java/androidx/graphics/opengl/GLRenderer.kt
index 0029394..c5d8032 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/opengl/GLRenderer.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/opengl/GLRenderer.kt
@@ -25,7 +25,7 @@
import android.view.SurfaceView
import android.view.TextureView
import androidx.annotation.WorkerThread
-import androidx.graphics.opengl.egl.EGLConfigAttributes
+import androidx.graphics.opengl.egl.EglConfigAttributes8888
import androidx.graphics.opengl.egl.EGLManager
import androidx.graphics.opengl.egl.EGLSpec
import java.util.concurrent.CountDownLatch
@@ -48,7 +48,7 @@
eglSpecFactory: () -> EGLSpec = { EGLSpec.V14 },
eglConfigFactory: EGLManager.() -> EGLConfig = {
// 8 bit channels should always be supported
- loadConfig(EGLConfigAttributes.RGBA_8888)
+ loadConfig(EglConfigAttributes8888)
?: throw IllegalStateException("Unable to obtain config for 8 bit EGL " +
"configuration")
}
@@ -310,7 +310,7 @@
*
* The default implementation will create a window surface with EGL_WIDTH and EGL_HEIGHT
* set to [width] and [height] respectively.
- * Implementations can override this method to provide additional [EGLConfigAttributes]
+ * Implementations can override this method to provide additional EglConfigAttributes
* for this surface (ex. [EGL14.EGL_SINGLE_BUFFER].
*
* Implementations can return null to indicate the default surface should be used.
diff --git a/graphics/graphics-core/src/main/java/androidx/graphics/opengl/egl/EGLConfigAttributes.kt b/graphics/graphics-core/src/main/java/androidx/graphics/opengl/egl/EGLConfigAttributes.kt
index 1852fbb..8e61136 100644
--- a/graphics/graphics-core/src/main/java/androidx/graphics/opengl/egl/EGLConfigAttributes.kt
+++ b/graphics/graphics-core/src/main/java/androidx/graphics/opengl/egl/EGLConfigAttributes.kt
@@ -20,6 +20,71 @@
import android.opengl.EGL14
/**
+ * EGL configuration attribute used to expose EGLConfigs that support formats with floating point
+ * RGBA components. This attribute is exposed through the EGL_EXT_pixel_format_float EGL extension
+ *
+ * See: https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_pixel_format_float.txt
+ */
+const val EglColorComponentTypeExt = 0x3339
+
+/**
+ * EGL configuration attribute value that represents fixed point RGBA components
+ */
+const val EglColorComponentTypeFixedExt = 0x333A
+
+/**
+ * EGL configuration attribute value that represents floating point RGBA components
+ */
+const val EglColorComponentTypeFloatExt = 0x333B
+
+/**
+ * EGL Attributes to create an 8 bit EGL config for red, green, blue, and alpha channels as well
+ * as an 8 bit stencil size
+ */
+val EglConfigAttributes8888 = EGLConfigAttributes {
+ EGL14.EGL_RENDERABLE_TYPE to EGL14.EGL_OPENGL_ES2_BIT
+ EGL14.EGL_RED_SIZE to 8
+ EGL14.EGL_GREEN_SIZE to 8
+ EGL14.EGL_BLUE_SIZE to 8
+ EGL14.EGL_ALPHA_SIZE to 8
+ EGL14.EGL_DEPTH_SIZE to 0
+ EGL14.EGL_CONFIG_CAVEAT to EGL14.EGL_NONE
+ EGL14.EGL_STENCIL_SIZE to 0
+ EGL14.EGL_SURFACE_TYPE to EGL14.EGL_WINDOW_BIT
+}
+
+/**
+ * EGL Attributes to create a 10 bit EGL config for red, green, blue, channels and a
+ * 2 bit alpha channels as well as an 8 bit stencil size
+ */
+val EglConfigAttributes1010102 = EGLConfigAttributes {
+ EGL14.EGL_RENDERABLE_TYPE to EGL14.EGL_OPENGL_ES2_BIT
+ EGL14.EGL_RED_SIZE to 10
+ EGL14.EGL_GREEN_SIZE to 10
+ EGL14.EGL_BLUE_SIZE to 10
+ EGL14.EGL_ALPHA_SIZE to 2
+ EGL14.EGL_DEPTH_SIZE to 0
+ EGL14.EGL_STENCIL_SIZE to 0
+ EGL14.EGL_SURFACE_TYPE to EGL14.EGL_WINDOW_BIT
+}
+
+/**
+ * EGL Attributes to create a 16 bit floating point EGL config for red, green and blue channels
+ * along with a
+ */
+val EglConfigAttributesF16 = EGLConfigAttributes {
+ EGL14.EGL_RENDERABLE_TYPE to EGL14.EGL_OPENGL_ES2_BIT
+ EglColorComponentTypeExt to EglColorComponentTypeFloatExt
+ EGL14.EGL_RED_SIZE to 16
+ EGL14.EGL_GREEN_SIZE to 16
+ EGL14.EGL_BLUE_SIZE to 16
+ EGL14.EGL_ALPHA_SIZE to 16
+ EGL14.EGL_DEPTH_SIZE to 0
+ EGL14.EGL_STENCIL_SIZE to 0
+ EGL14.EGL_SURFACE_TYPE to EGL14.EGL_WINDOW_BIT
+}
+
+/**
* Construct an instance of [EGLConfigAttributes] that includes a mapping of EGL attributes
* to their corresponding value. The full set of attributes can be found here:
* https://www.khronos.org/registry/EGL/sdk/docs/man/html/eglChooseConfig.xhtml
@@ -40,30 +105,27 @@
* EGL14.EGL_SURFACE_TYPE to EGL14.EGL_WINDOW_BIT
* }
*
- * @see EGLConfigAttributes.RGBA_8888
+ * @see EglConfigAttributes8888
*/
-@JvmSynthetic
inline fun EGLConfigAttributes(block: EGLConfigAttributes.Builder.() -> Unit): EGLConfigAttributes =
EGLConfigAttributes.Builder().apply { block() }.build()
-@Suppress("AcronymName")
-class EGLConfigAttributes internal constructor(
+// klint does not support value classes yet, see b/197692691
+// @Suppress("INLINE_CLASS_DEPRECATED")
+@Suppress("AcronymName", "INLINE_CLASS_DEPRECATED")
+inline class EGLConfigAttributes internal constructor(
@PublishedApi internal val attrs: IntArray
) {
/**
- * Return a copy of the created integer array used for EGL methods.
- * Most consumers would pass the [EGLConfigAttributes] instance as a parameter instead, however,
- * this method is provided as a convenience for debugging and testing purposes.
- */
- fun toArray(): IntArray = attrs.clone()
-
- /**
* Builder used to create an instance of [EGLConfigAttributes]
* Allows for a mapping of EGL configuration attributes to their corresponding
* values as well as including a previously generated [EGLConfigAttributes]
* instance to be used as a template and conditionally update individual mapped values
*/
+ // Suppressing build method as EGLConfigAttributes is created using Kotlin DSL syntax
+ // via the function constructor defined above
+ @SuppressWarnings("MissingBuildMethod")
class Builder @PublishedApi internal constructor() {
private val attrs = HashMap<Int, Int>()
@@ -71,20 +133,8 @@
* Map a given EGL configuration attribute key to the given EGL configuration value
*/
@SuppressWarnings("BuilderSetStyle")
- @JvmSynthetic
infix fun Int.to(that: Int) {
- setAttribute(this, that)
- }
-
- /**
- * Map a given EGL configuration attribute key to the given EGL configuration value
- * @param attribute EGL attribute name such as [EGL14.EGL_RED_SIZE]
- * @param value Corresponding value for the [attribute]
- */
- @Suppress("MissingGetterMatchingBuilder")
- fun setAttribute(attribute: Int, value: Int): Builder {
- attrs[attribute] = value
- return this
+ attrs[this] = that
}
/**
@@ -92,11 +142,11 @@
* This is useful for creating a new [EGLConfigAttributes] instance with all the same
* attributes as another, allowing for modification of attributes after the fact.
* For example, the following code snippet can be used to create an [EGLConfigAttributes]
- * instance that has all the same configuration as [RGBA_8888] but with a
+ * instance that has all the same configuration as [EglConfigAttributes8888] but with a
* 16 bit stencil buffer size:
*
* EGLConfigAttributes {
- * include(EGLConfigAttributes.RGBA_8888)
+ * include(EglConfigAttributes8888)
* EGL14.EGL_STENCIL_SIZE to 16
* }
*
@@ -112,12 +162,7 @@
}
}
- /**
- * Construct an instance of [EGLConfigAttributes] with the mappings of integer keys
- * to their respective values. This creates a flat integer array with alternating values
- * for the key value pairs and ends with EGL_NONE
- */
- fun build(): EGLConfigAttributes {
+ @PublishedApi internal fun build(): EGLConfigAttributes {
val entries = attrs.entries
val attrArray = IntArray(entries.size * 2 + 1) // Array must end with EGL_NONE
var index = 0
@@ -130,78 +175,4 @@
return EGLConfigAttributes(attrArray)
}
}
-
- companion object {
- /**
- * EGL configuration attribute used to expose EGLConfigs that support formats with floating
- * point RGBA components. This attribute is exposed through the EGL_EXT_pixel_format_float
- * EGL extension
- *
- * See: https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_pixel_format_float.txt
- */
- const val EGL_COLOR_COMPONENT_TYPE_EXT = 0x3339
-
- /**
- * EGL configuration attribute value that represents fixed point RGBA components
- */
- const val EGL_COLOR_COMPONENT_TYPE_FIXED_EXT = 0x333A
-
- /**
- * EGL configuration attribute value that represents floating point RGBA components
- */
- const val EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT = 0x333B
-
- /**
- * EGL Attributes to create an 8 bit EGL config for red, green, blue, and alpha channels as
- * well as an 8 bit stencil size
- */
- @Suppress("AcronymName")
- @JvmField
- val RGBA_8888 = EGLConfigAttributes {
- EGL14.EGL_RENDERABLE_TYPE to EGL14.EGL_OPENGL_ES2_BIT
- EGL14.EGL_RED_SIZE to 8
- EGL14.EGL_GREEN_SIZE to 8
- EGL14.EGL_BLUE_SIZE to 8
- EGL14.EGL_ALPHA_SIZE to 8
- EGL14.EGL_DEPTH_SIZE to 0
- EGL14.EGL_CONFIG_CAVEAT to EGL14.EGL_NONE
- EGL14.EGL_STENCIL_SIZE to 0
- EGL14.EGL_SURFACE_TYPE to EGL14.EGL_WINDOW_BIT
- }
-
- /**
- * EGL Attributes to create a 10 bit EGL config for red, green, blue, channels and a
- * 2 bit alpha channels. This does not include any bits for depth and stencil buffers.
- */
- @Suppress("AcronymName")
- @JvmField
- val RGBA_1010102 = EGLConfigAttributes {
- EGL14.EGL_RENDERABLE_TYPE to EGL14.EGL_OPENGL_ES2_BIT
- EGL14.EGL_RED_SIZE to 10
- EGL14.EGL_GREEN_SIZE to 10
- EGL14.EGL_BLUE_SIZE to 10
- EGL14.EGL_ALPHA_SIZE to 2
- EGL14.EGL_DEPTH_SIZE to 0
- EGL14.EGL_STENCIL_SIZE to 0
- EGL14.EGL_SURFACE_TYPE to EGL14.EGL_WINDOW_BIT
- }
-
- /**
- * EGL Attributes to create a 16 bit floating point EGL config for red, green, blue and
- * alpha channels without a depth or stencil channel.
- */
- @Suppress("AcronymName")
- @JvmField
- val RGBA_F16 = EGLConfigAttributes {
- EGL14.EGL_RENDERABLE_TYPE to EGL14.EGL_OPENGL_ES2_BIT
- EGL_COLOR_COMPONENT_TYPE_EXT to EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT
- EGL14.EGL_RED_SIZE to 16
- EGL14.EGL_GREEN_SIZE to 16
- EGL14.EGL_BLUE_SIZE to 16
- EGL14.EGL_ALPHA_SIZE to 16
- EGL14.EGL_DEPTH_SIZE to 0
- EGL14.EGL_STENCIL_SIZE to 0
- EGL14.EGL_SURFACE_TYPE to EGL14.EGL_WINDOW_BIT
- }
- }
}
\ No newline at end of file