changeset 4972:c06259a9d8b7

Fix to RT-30446: ES2: Minimize round trip GL calls in production code Reviewed-by: Daniel Blaukopf, Kevin Rushiforth, Thor Johannesson
author Chien Yang <chien.yang@orcale.com>
date Wed, 04 Sep 2013 13:42:23 -0700
parents 55411f1b25b3
children 92d277a8419c
files modules/graphics/src/main/java/com/sun/prism/es2/GLContext.java modules/graphics/src/main/native-prism-es2/GLContext.c
diffstat 2 files changed, 6 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/java/com/sun/prism/es2/GLContext.java	Wed Sep 04 13:30:50 2013 -0700
+++ b/modules/graphics/src/main/java/com/sun/prism/es2/GLContext.java	Wed Sep 04 13:42:23 2013 -0700
@@ -150,7 +150,6 @@
     private static native int nGetMaxTextureSize();
     private static native int nGetUniformLocation(long nativeCtxInfo,
             int programID, String name);
-    private static native int nOneValueGetIntegerv(int pname);
     private static native void nPixelStorei(int pname, int param);
     private static native boolean nReadPixelsByte(long nativeCtxInfo, int length,
             Buffer buffer, byte[] pixelArr, int x, int y, int w, int h);
@@ -428,11 +427,6 @@
         }
     }
 
-    int getBoundTextureID() {
-        // return the single value param
-        return nOneValueGetIntegerv(GL_TEXTURE_BINDING_2D);
-    }
-
     long getNativeCtxInfo() {
         return nativeCtxInfo;
     }
--- a/modules/graphics/src/main/native-prism-es2/GLContext.c	Wed Sep 04 13:30:50 2013 -0700
+++ b/modules/graphics/src/main/native-prism-es2/GLContext.c	Wed Sep 04 13:42:23 2013 -0700
@@ -153,6 +153,7 @@
     ctxInfo->state.fillMode = GL_FILL;
     ctxInfo->state.cullEnable = JNI_FALSE;
     ctxInfo->state.cullMode = GL_BACK;
+    ctxInfo->state.fbo = 0;    
 }
 
 void clearBuffers(ContextInfo *ctxInfo,
@@ -855,7 +856,11 @@
 JNIEXPORT jint JNICALL Java_com_sun_prism_es2_GLContext_nGetFBO
 (JNIEnv *env, jclass class) {
     GLint param;
-    /* TODO: Should use state.fbo vs Querying GL */
+    /* The caching logic has been done on Java side if 
+     * platform isn't MAC or IOS. On these platforms Glass
+     * can change the FBO under us. We should be able to simplify the
+     * logic in Java and remove this method once once Glass stop doing it.
+     */
     glGetIntegerv(GL_FRAMEBUFFER_BINDING, &param);
     return (jint) param;
 }
@@ -955,18 +960,6 @@
     return value;
 }
 
-/*
- * Class:     com_sun_prism_es2_GLContext
- * Method:    nOneValueGetIntegerv
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_com_sun_prism_es2_GLContext_nOneValueGetIntegerv
-(JNIEnv *env, jclass class, jint pname) {
-    GLint param;
-    glGetIntegerv((GLenum) translatePrismToGL(pname), &param);
-    return (jint) param;
-}
-
 GLint translatePixelStore(int pname) {
     switch (pname) {
             // Use by glPixelStorei