diff options
Diffstat (limited to 'opengl/java')
-rw-r--r-- | opengl/java/android/opengl/EGL14.java | 1 | ||||
-rw-r--r-- | opengl/java/android/opengl/EGLExt.java | 1 | ||||
-rw-r--r-- | opengl/java/android/opengl/GLES30.java | 8 | ||||
-rw-r--r-- | opengl/java/android/opengl/GLSurfaceView.java | 43 | ||||
-rw-r--r-- | opengl/java/javax/microedition/khronos/egl/EGL10.java | 1 |
5 files changed, 39 insertions, 15 deletions
diff --git a/opengl/java/android/opengl/EGL14.java b/opengl/java/android/opengl/EGL14.java index cf09c5865b98..53ec6c8980ef 100644 --- a/opengl/java/android/opengl/EGL14.java +++ b/opengl/java/android/opengl/EGL14.java @@ -284,6 +284,7 @@ public static final int EGL_CORE_NATIVE_ENGINE = 0x305B; // C function EGLSurface eglCreatePixmapSurface ( EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list ) + @Deprecated public static native EGLSurface eglCreatePixmapSurface( EGLDisplay dpy, EGLConfig config, diff --git a/opengl/java/android/opengl/EGLExt.java b/opengl/java/android/opengl/EGLExt.java index b74b5fbeed8a..74b64ead77bb 100644 --- a/opengl/java/android/opengl/EGLExt.java +++ b/opengl/java/android/opengl/EGLExt.java @@ -28,6 +28,7 @@ public class EGLExt { 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; + public static final int EGL_RECORDABLE_ANDROID = 0x3142; native private static void _nativeClassInit(); static { diff --git a/opengl/java/android/opengl/GLES30.java b/opengl/java/android/opengl/GLES30.java index 74181c513753..3b805d20773c 100644 --- a/opengl/java/android/opengl/GLES30.java +++ b/opengl/java/android/opengl/GLES30.java @@ -590,6 +590,10 @@ public class GLES30 extends GLES20 { // C function void glGetBufferPointerv ( GLenum target, GLenum pname, GLvoid** params ) + /** + * The {@link java.nio.Buffer} instance returned by this method is guaranteed + * to be an instance of {@link java.nio.ByteBuffer}. + */ public static native java.nio.Buffer glGetBufferPointerv( int target, int pname @@ -761,6 +765,10 @@ public class GLES30 extends GLES20 { // C function GLvoid * glMapBufferRange ( GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access ) + /** + * The {@link java.nio.Buffer} instance returned by this method is guaranteed + * to be an instance of {@link java.nio.ByteBuffer}. + */ public static native java.nio.Buffer glMapBufferRange( int target, int offset, diff --git a/opengl/java/android/opengl/GLSurfaceView.java b/opengl/java/android/opengl/GLSurfaceView.java index 0f5dd3aa5667..329514c0b7fc 100644 --- a/opengl/java/android/opengl/GLSurfaceView.java +++ b/opengl/java/android/opengl/GLSurfaceView.java @@ -89,7 +89,7 @@ import javax.microedition.khronos.opengles.GL10; * <p> * <h4>Choosing an EGL Configuration</h4> * A given Android device may support multiple EGLConfig rendering configurations. - * The available configurations may differ in how may channels of data are present, as + * The available configurations may differ in how many channels of data are present, as * well as how many bits are allocated to each channel. Therefore, the first thing * GLSurfaceView has to do when starting to render is choose what EGLConfig to use. * <p> @@ -542,16 +542,27 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback } /** - * This method is part of the SurfaceHolder.Callback interface, and is + * This method is part of the SurfaceHolder.Callback2 interface, and is * not normally called or subclassed by clients of GLSurfaceView. */ @Override - public void surfaceRedrawNeeded(SurfaceHolder holder) { + public void surfaceRedrawNeededAsync(SurfaceHolder holder, Runnable finishDrawing) { if (mGLThread != null) { - mGLThread.requestRenderAndWait(); + mGLThread.requestRenderAndNotify(finishDrawing); } } + /** + * This method is part of the SurfaceHolder.Callback2 interface, and is + * not normally called or subclassed by clients of GLSurfaceView. + */ + @Deprecated + @Override + public void surfaceRedrawNeeded(SurfaceHolder holder) { + // Since we are part of the framework we know only surfaceRedrawNeededAsync + // will be called. + } + /** * Pause the rendering thread, optionally tearing down the EGL context @@ -1305,6 +1316,7 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback int w = 0; int h = 0; Runnable event = null; + Runnable finishDrawingRunnable = null; while (true) { synchronized (sGLThreadManager) { @@ -1400,6 +1412,11 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback sGLThreadManager.notifyAll(); } + if (mFinishDrawingRunnable != null) { + finishDrawingRunnable = mFinishDrawingRunnable; + mFinishDrawingRunnable = null; + } + // Ready to draw? if (readyToDraw()) { @@ -1453,7 +1470,6 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback break; } } - // By design, this is the only place in a GLThread thread where we wait(). if (LOG_THREADS) { Log.i("GLThread", "waiting tid=" + getId() @@ -1546,6 +1562,10 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback try { Trace.traceBegin(Trace.TRACE_TAG_VIEW, "onDrawFrame"); view.mRenderer.onDrawFrame(gl); + if (finishDrawingRunnable != null) { + finishDrawingRunnable.run(); + finishDrawingRunnable = null; + } } finally { Trace.traceEnd(Trace.TRACE_TAG_VIEW); } @@ -1625,7 +1645,7 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback } } - public void requestRenderAndWait() { + public void requestRenderAndNotify(Runnable finishDrawing) { synchronized(sGLThreadManager) { // If we are already on the GL thread, this means a client callback // has caused reentrancy, for example via updating the SurfaceView parameters. @@ -1638,17 +1658,9 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback mWantRenderNotification = true; mRequestRender = true; mRenderComplete = false; + mFinishDrawingRunnable = finishDrawing; sGLThreadManager.notifyAll(); - - while (!mExited && !mPaused && !mRenderComplete && ableToDraw()) { - try { - sGLThreadManager.wait(); - } catch (InterruptedException ex) { - Thread.currentThread().interrupt(); - } - } - } } @@ -1821,6 +1833,7 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback private boolean mRenderComplete; private ArrayList<Runnable> mEventQueue = new ArrayList<Runnable>(); private boolean mSizeChanged = true; + private Runnable mFinishDrawingRunnable = null; // End of member variables protected by the sGLThreadManager monitor. diff --git a/opengl/java/javax/microedition/khronos/egl/EGL10.java b/opengl/java/javax/microedition/khronos/egl/EGL10.java index cf58888effae..612d59c53e9f 100644 --- a/opengl/java/javax/microedition/khronos/egl/EGL10.java +++ b/opengl/java/javax/microedition/khronos/egl/EGL10.java @@ -98,6 +98,7 @@ public interface EGL10 extends EGL { boolean eglCopyBuffers(EGLDisplay display, EGLSurface surface, Object native_pixmap); EGLContext eglCreateContext(EGLDisplay display, EGLConfig config, EGLContext share_context, int[] attrib_list); EGLSurface eglCreatePbufferSurface(EGLDisplay display, EGLConfig config, int[] attrib_list); + @Deprecated EGLSurface eglCreatePixmapSurface(EGLDisplay display, EGLConfig config, Object native_pixmap, int[] attrib_list); EGLSurface eglCreateWindowSurface(EGLDisplay display, EGLConfig config, Object native_window, int[] attrib_list); boolean eglDestroyContext(EGLDisplay display, EGLContext context); |