summaryrefslogtreecommitdiffstats
path: root/opengl/tools/glgen/stubs/egl
diff options
context:
space:
mode:
Diffstat (limited to 'opengl/tools/glgen/stubs/egl')
-rw-r--r--opengl/tools/glgen/stubs/egl/EGL14Header.java-if2
-rw-r--r--opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp6
-rw-r--r--opengl/tools/glgen/stubs/egl/EGLExtHeader.java-if36
-rw-r--r--opengl/tools/glgen/stubs/egl/EGLExtcHeader.cpp133
-rw-r--r--opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp12
-rw-r--r--opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.java4
6 files changed, 184 insertions, 9 deletions
diff --git a/opengl/tools/glgen/stubs/egl/EGL14Header.java-if b/opengl/tools/glgen/stubs/egl/EGL14Header.java-if
index 0c29d5c..f3bf220 100644
--- a/opengl/tools/glgen/stubs/egl/EGL14Header.java-if
+++ b/opengl/tools/glgen/stubs/egl/EGL14Header.java-if
@@ -1,4 +1,4 @@
-**
+/*
** Copyright 2012, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp b/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp
index 7904ac7..54de1e7 100644
--- a/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp
+++ b/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp
@@ -1,4 +1,4 @@
-**
+/*
** Copyright 2012, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
@@ -27,8 +27,8 @@
#include <EGL/egl.h>
#include <gui/Surface.h>
-#include <gui/SurfaceTexture.h>
-#include <gui/SurfaceTextureClient.h>
+#include <gui/GLConsumer.h>
+#include <gui/Surface.h>
#include <ui/ANativeObjectBase.h>
diff --git a/opengl/tools/glgen/stubs/egl/EGLExtHeader.java-if b/opengl/tools/glgen/stubs/egl/EGLExtHeader.java-if
new file mode 100644
index 0000000..a5a8968
--- /dev/null
+++ b/opengl/tools/glgen/stubs/egl/EGLExtHeader.java-if
@@ -0,0 +1,36 @@
+/*
+** Copyright 2013, 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.
+*/
+
+// This source file is automatically generated
+
+package android.opengl;
+
+/**
+ * EGL Extensions
+ */
+public class EGLExt {
+
+ // EGL_KHR_create_context
+ public static final int EGL_CONTEXT_MAJOR_VERSION_KHR = 0x3098;
+ public static final int EGL_CONTEXT_MINOR_VERSION_KHR = 0x30FB;
+ public static final int EGL_CONTEXT_FLAGS_KHR = 0x30FC;
+ public static final int EGL_OPENGL_ES3_BIT_KHR = 0x0040;
+
+ native private static void _nativeClassInit();
+ static {
+ _nativeClassInit();
+ }
+
diff --git a/opengl/tools/glgen/stubs/egl/EGLExtcHeader.cpp b/opengl/tools/glgen/stubs/egl/EGLExtcHeader.cpp
new file mode 100644
index 0000000..5e1ffa1
--- /dev/null
+++ b/opengl/tools/glgen/stubs/egl/EGLExtcHeader.cpp
@@ -0,0 +1,133 @@
+/*
+** Copyright 2013, 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.
+*/
+
+// This source file is automatically generated
+
+#include "jni.h"
+#include "JNIHelp.h"
+#include <android_runtime/AndroidRuntime.h>
+#include <android_runtime/android_view_Surface.h>
+#include <android_runtime/android_graphics_SurfaceTexture.h>
+#include <utils/misc.h>
+
+#include <assert.h>
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+#include <gui/Surface.h>
+#include <gui/GLConsumer.h>
+#include <gui/Surface.h>
+
+#include <ui/ANativeObjectBase.h>
+
+static int initialized = 0;
+
+static jclass egldisplayClass;
+static jclass eglcontextClass;
+static jclass eglsurfaceClass;
+static jclass eglconfigClass;
+
+static jmethodID egldisplayGetHandleID;
+static jmethodID eglcontextGetHandleID;
+static jmethodID eglsurfaceGetHandleID;
+static jmethodID eglconfigGetHandleID;
+
+static jmethodID egldisplayConstructor;
+static jmethodID eglcontextConstructor;
+static jmethodID eglsurfaceConstructor;
+static jmethodID eglconfigConstructor;
+
+static jobject eglNoContextObject;
+static jobject eglNoDisplayObject;
+static jobject eglNoSurfaceObject;
+
+
+
+/* Cache method IDs each time the class is loaded. */
+
+static void
+nativeClassInit(JNIEnv *_env, jclass glImplClass)
+{
+ jclass egldisplayClassLocal = _env->FindClass("android/opengl/EGLDisplay");
+ egldisplayClass = (jclass) _env->NewGlobalRef(egldisplayClassLocal);
+ jclass eglcontextClassLocal = _env->FindClass("android/opengl/EGLContext");
+ eglcontextClass = (jclass) _env->NewGlobalRef(eglcontextClassLocal);
+ jclass eglsurfaceClassLocal = _env->FindClass("android/opengl/EGLSurface");
+ eglsurfaceClass = (jclass) _env->NewGlobalRef(eglsurfaceClassLocal);
+ jclass eglconfigClassLocal = _env->FindClass("android/opengl/EGLConfig");
+ eglconfigClass = (jclass) _env->NewGlobalRef(eglconfigClassLocal);
+
+ egldisplayGetHandleID = _env->GetMethodID(egldisplayClass, "getHandle", "()I");
+ eglcontextGetHandleID = _env->GetMethodID(eglcontextClass, "getHandle", "()I");
+ eglsurfaceGetHandleID = _env->GetMethodID(eglsurfaceClass, "getHandle", "()I");
+ eglconfigGetHandleID = _env->GetMethodID(eglconfigClass, "getHandle", "()I");
+
+
+ egldisplayConstructor = _env->GetMethodID(egldisplayClass, "<init>", "(I)V");
+ eglcontextConstructor = _env->GetMethodID(eglcontextClass, "<init>", "(I)V");
+ eglsurfaceConstructor = _env->GetMethodID(eglsurfaceClass, "<init>", "(I)V");
+ eglconfigConstructor = _env->GetMethodID(eglconfigClass, "<init>", "(I)V");
+
+ jobject localeglNoContextObject = _env->NewObject(eglcontextClass, eglcontextConstructor, (jint)EGL_NO_CONTEXT);
+ eglNoContextObject = _env->NewGlobalRef(localeglNoContextObject);
+ jobject localeglNoDisplayObject = _env->NewObject(egldisplayClass, egldisplayConstructor, (jint)EGL_NO_DISPLAY);
+ eglNoDisplayObject = _env->NewGlobalRef(localeglNoDisplayObject);
+ jobject localeglNoSurfaceObject = _env->NewObject(eglsurfaceClass, eglsurfaceConstructor, (jint)EGL_NO_SURFACE);
+ eglNoSurfaceObject = _env->NewGlobalRef(localeglNoSurfaceObject);
+
+
+ jclass eglClass = _env->FindClass("android/opengl/EGL14");
+ jfieldID noContextFieldID = _env->GetStaticFieldID(eglClass, "EGL_NO_CONTEXT", "Landroid/opengl/EGLContext;");
+ _env->SetStaticObjectField(eglClass, noContextFieldID, eglNoContextObject);
+
+ jfieldID noDisplayFieldID = _env->GetStaticFieldID(eglClass, "EGL_NO_DISPLAY", "Landroid/opengl/EGLDisplay;");
+ _env->SetStaticObjectField(eglClass, noDisplayFieldID, eglNoDisplayObject);
+
+ jfieldID noSurfaceFieldID = _env->GetStaticFieldID(eglClass, "EGL_NO_SURFACE", "Landroid/opengl/EGLSurface;");
+ _env->SetStaticObjectField(eglClass, noSurfaceFieldID, eglNoSurfaceObject);
+}
+
+static void *
+fromEGLHandle(JNIEnv *_env, jmethodID mid, jobject obj) {
+ if (obj == NULL){
+ jniThrowException(_env, "java/lang/IllegalArgumentException",
+ "Object is set to null.");
+ }
+
+ return (void*) (_env->CallIntMethod(obj, mid));
+}
+
+static jobject
+toEGLHandle(JNIEnv *_env, jclass cls, jmethodID con, void * handle) {
+ if (cls == eglcontextClass &&
+ (EGLContext)handle == EGL_NO_CONTEXT) {
+ return eglNoContextObject;
+ }
+
+ if (cls == egldisplayClass &&
+ (EGLDisplay)handle == EGL_NO_DISPLAY) {
+ return eglNoDisplayObject;
+ }
+
+ if (cls == eglsurfaceClass &&
+ (EGLSurface)handle == EGL_NO_SURFACE) {
+ return eglNoSurfaceObject;
+ }
+
+ return _env->NewObject(cls, con, (jint)handle);
+}
+
+// --------------------------------------------------------------------------
diff --git a/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp b/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp
index 610cde5..906cd80 100644
--- a/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp
+++ b/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp
@@ -34,7 +34,7 @@ not_valid_surface:
goto exit;
}
- window = android::android_Surface_getNativeWindow(_env, win);
+ window = android::android_view_Surface_getNativeWindow(_env, win);
if (window == NULL)
goto not_valid_surface;
@@ -90,7 +90,7 @@ android_eglCreateWindowSurfaceTexture
jint _remaining;
EGLint *attrib_list = (EGLint *) 0;
android::sp<ANativeWindow> window;
- android::sp<android::SurfaceTexture> surfaceTexture;
+ android::sp<android::GLConsumer> glConsumer;
if (!attrib_list_ref) {
_exception = 1;
@@ -111,8 +111,12 @@ not_valid_surface:
_exceptionMessage = "Make sure the SurfaceView or associated SurfaceHolder has a valid Surface";
goto exit;
}
- surfaceTexture = android::SurfaceTexture_getSurfaceTexture(_env, win);
- window = new android::SurfaceTextureClient(surfaceTexture);
+ glConsumer = android::SurfaceTexture_getSurfaceTexture(_env, win);
+
+ if (glConsumer == NULL)
+ goto not_valid_surface;
+
+ window = new android::Surface(glConsumer->getBufferQueue());
if (window == NULL)
goto not_valid_surface;
diff --git a/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.java b/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.java
index e42334e..5d088bd 100644
--- a/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.java
+++ b/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.java
@@ -29,6 +29,8 @@
} else if (win instanceof SurfaceHolder) {
SurfaceHolder holder = (SurfaceHolder)win;
sur = holder.getSurface();
+ } else if (win instanceof Surface) {
+ sur = (Surface) win;
}
EGLSurface surface;
@@ -40,7 +42,7 @@
} else {
throw new java.lang.UnsupportedOperationException(
"eglCreateWindowSurface() can only be called with an instance of " +
- "SurfaceView, SurfaceTexture or SurfaceHolder at the moment, " +
+ "Surface, SurfaceView, SurfaceTexture or SurfaceHolder at the moment, " +
"this will be fixed later.");
}