diff options
Diffstat (limited to 'make')
-rw-r--r-- | make/build.xml | 37 | ||||
-rwxr-xr-x | make/gl-es2.cfg | 2 | ||||
-rwxr-xr-x | make/gl-if-gl2_es2.cfg | 18 | ||||
-rw-r--r-- | make/gl-impl-CustomJavaCode-gl2.java | 12 | ||||
-rw-r--r-- | make/gl-impl-CustomJavaCode-gl2_es2.java | 137 | ||||
-rw-r--r-- | make/gl-impl-CustomJavaCode-gl2es12.java | 12 | ||||
-rwxr-xr-x | make/gl-impl-CustomJavaCode-gles2.java | 12 | ||||
-rw-r--r-- | make/lstjars.sh | 4 |
8 files changed, 153 insertions, 81 deletions
diff --git a/make/build.xml b/make/build.xml index 0a6022cd7..27b1485c9 100644 --- a/make/build.xml +++ b/make/build.xml @@ -159,7 +159,13 @@ value="com/sun/opengl/impl/glu/gl2/**, com/sun/opengl/impl/glu/nurbs/**, com/sun/opengl/impl/glu/registry/**, javax/media/opengl/glu/gl2/**"/> <property name="java.part.glsl" - value="javax/media/opengl/**/glsl/**, com/sun/opengl/**/glsl/**"/> + value="javax/media/opengl/glsl/**, com/sun/opengl/impl/glsl/**"/> + + <property name="java.part.sdk" + value="javax/media/opengl/sdk/**"/> + + <property name="java.part.glsl.fixed" + value="com/sun/opengl/impl/glsl/fixed/**"/> <property name="java.part.gl2es12.x11" value="com/sun/opengl/impl/gl2es12/**, com/sun/opengl/impl/x11/glx/*, com/sun/opengl/impl/x11/*"/> @@ -445,12 +451,14 @@ <property name="jogl.gl2.win.jar" value="${build}/jogl.gl2.win.jar" /> <property name="jogl.gl2.osx.jar" value="${build}/jogl.gl2.osx.jar" /> <property name="jogl.gl2.dbg.jar" value="${build}/jogl.gl2.dbg.jar" /> + <property name="jogl.fixed.jar" value="${build}/jogl.fixed.jar" /> <property name="jogl.awt.jar" value="${build}/jogl.awt.jar" /> <property name="newt.jar" value="${build}/newt.jar" /> <property name="newt.awt.jar" value="${build}/newt.awt.jar" /> <property name="jogl.util.jar" value="${build}/jogl.util.jar" /> <property name="jogl.util.gl2.jar" value="${build}/jogl.util.gl2.jar" /> <property name="jogl.util.awt.jar" value="${build}/jogl.util.awt.jar" /> + <property name="jogl.sdk.jar" value="${build}/jogl.sdk.jar" /> <property name="jogl.all.jar" value="${build}/jogl.all.jar" /> <!-- The javadoc dirs. --> @@ -1557,13 +1565,13 @@ <copy todir="${classes}"> <fileset dir="${src.java}" - includes="com/sun/opengl/impl/glsl/source/**, com/sun/opengl/impl/glsl/binary_nvidia/**" /> + includes="com/sun/opengl/impl/glsl/fixed/shader/**" /> </copy> <jar manifest="tempversion" destfile="${jogl.core.jar}"> <fileset dir="${classes}" includes="javax/media/opengl/**, com/sun/gluegen/runtime/**, com/sun/opengl/**" - excludes="${java.excludes.fixme} ${java.part.egl}, ${java.part.glsl}, ${java.part.gl2es12.x11}, ${java.part.gl2es12.win}, ${java.part.gl2es12.osx}, ${java.part.gl2es12.dbg}, ${java.part.gl2.x11}, ${java.part.gl2.win}, ${java.part.gl2.osx}, ${java.part.gl2.dbg}, ${java.part.es1}, ${java.part.es1.dbg}, ${java.part.es2}, ${java.part.es2.dbg}, ${java.part.awt}, ${java.part.glutess}, ${java.part.glumipmap}, ${java.part.glugl2}, ${java.part.util} ${java.part.util.awt} ${java.part.util.gl2}, ${java.part.newt}, ${java.part.newt.awt}"/> + excludes="${java.excludes.fixme} ${java.part.egl}, ${java.part.sdk}, ${java.part.glsl}, ${java.part.glsl.fixed}, ${java.part.gl2es12.x11}, ${java.part.gl2es12.win}, ${java.part.gl2es12.osx}, ${java.part.gl2es12.dbg}, ${java.part.gl2.x11}, ${java.part.gl2.win}, ${java.part.gl2.osx}, ${java.part.gl2.dbg}, ${java.part.es1}, ${java.part.es1.dbg}, ${java.part.es2}, ${java.part.es2.dbg}, ${java.part.awt}, ${java.part.glutess}, ${java.part.glumipmap}, ${java.part.glugl2}, ${java.part.util} ${java.part.util.awt} ${java.part.util.gl2}, ${java.part.newt}, ${java.part.newt.awt}"/> </jar> <jar manifest="tempversion" destfile="${jogl.gles1.jar}"> <fileset dir="${classes}" @@ -1577,7 +1585,7 @@ <jar manifest="tempversion" destfile="${jogl.gles2.jar}"> <fileset dir="${classes}" includes="${java.part.es2}, ${java.part.glsl}" - excludes="${java.part.es2.dbg}"/> + excludes="${java.part.es2.dbg}, ${java.part.glsl.fixed}"/> </jar> <jar manifest="tempversion" destfile="${jogl.gles2.dbg.jar}"> <fileset dir="${classes}" @@ -1591,17 +1599,17 @@ <jar manifest="tempversion" destfile="${jogl.gl2es12.x11.jar}"> <fileset dir="${classes}" includes="${java.part.gl2es12.x11}, ${java.part.glsl}" - excludes="${java.part.gl2es12.dbg}, ${java.part.glugl2}"/> + excludes="${java.part.gl2es12.dbg}, ${java.part.glugl2}, ${java.part.glsl.fixed}"/> </jar> <jar manifest="tempversion" destfile="${jogl.gl2es12.win.jar}"> <fileset dir="${classes}" includes="${java.part.gl2es12.win}, ${java.part.glsl}" - excludes="${java.part.gl2es12.dbg}, ${java.part.glugl2}"/> + excludes="${java.part.gl2es12.dbg}, ${java.part.glugl2}, ${java.part.glsl.fixed}"/> </jar> <jar manifest="tempversion" destfile="${jogl.gl2es12.osx.jar}"> <fileset dir="${classes}" includes="${java.part.gl2es12.osx}, ${java.part.glsl}" - excludes="${java.part.gl2es12.dbg}, ${java.part.glugl2}"/> + excludes="${java.part.gl2es12.dbg}, ${java.part.glugl2}, ${java.part.glsl.fixed}"/> </jar> <jar manifest="tempversion" destfile="${jogl.gl2es12.dbg.jar}"> <fileset dir="${classes}" @@ -1610,22 +1618,31 @@ <jar manifest="tempversion" destfile="${jogl.gl2.x11.jar}"> <fileset dir="${classes}" includes="${java.part.gl2.x11}, ${java.part.glsl}" - excludes="${java.part.gl2.dbg}, ${java.part.glugl2}"/> + excludes="${java.part.gl2.dbg}, ${java.part.glugl2}, ${java.part.glsl.fixed}"/> </jar> <jar manifest="tempversion" destfile="${jogl.gl2.win.jar}"> <fileset dir="${classes}" includes="${java.part.gl2.win}, ${java.part.glsl}" - excludes="${java.part.gl2.dbg}, ${java.part.glugl2}"/> + excludes="${java.part.gl2.dbg}, ${java.part.glugl2}, ${java.part.glsl.fixed}"/> </jar> <jar manifest="tempversion" destfile="${jogl.gl2.osx.jar}"> <fileset dir="${classes}" includes="${java.part.gl2.osx}, ${java.part.glsl}" - excludes="${java.part.gl2.dbg}, ${java.part.glugl2}"/> + excludes="${java.part.gl2.dbg}, ${java.part.glugl2}, ${java.part.glsl.fixed}"/> </jar> <jar manifest="tempversion" destfile="${jogl.gl2.dbg.jar}"> <fileset dir="${classes}" includes="${java.part.gl2.dbg}"/> </jar> + <jar manifest="tempversion" destfile="${jogl.fixed.jar}"> + <fileset dir="${classes}" + includes="${java.part.glsl.fixed}" + excludes="com/sun/opengl/impl/glsl/fixed/shader/scripts/**"/> + </jar> + <jar manifest="tempversion" destfile="${jogl.sdk.jar}"> + <fileset dir="${classes}" + includes="${java.part.sdk}"/> + </jar> <jar manifest="tempversion" destfile="${jogl.glutess.jar}"> <fileset dir="${classes}" includes="${java.part.glutess}"/> diff --git a/make/gl-es2.cfg b/make/gl-es2.cfg index 426710416..7e6ea7674 100755 --- a/make/gl-es2.cfg +++ b/make/gl-es2.cfg @@ -71,6 +71,6 @@ Import javax.media.opengl.GLArrayData Import javax.media.opengl.GLUniformData Import javax.media.opengl.util.BufferUtil Import javax.media.opengl.util.PMVMatrix -Import com.sun.opengl.impl.glsl.FixedFuncPipeline +Import com.sun.opengl.impl.glsl.fixed.FixedFuncPipeline Import java.io.PrintStream diff --git a/make/gl-if-gl2_es2.cfg b/make/gl-if-gl2_es2.cfg index 91312330e..1ad1ac8de 100755 --- a/make/gl-if-gl2_es2.cfg +++ b/make/gl-if-gl2_es2.cfg @@ -45,25 +45,17 @@ CustomJavaCode GL2ES2 public boolean glIsShaderStatusValid(IntBuffer shaders, i CustomJavaCode GL2ES2 public boolean glIsProgramStatusValid(int programObj, int name); CustomJavaCode GL2ES2 public boolean glIsProgramValid(int programObj); CustomJavaCode GL2ES2 public boolean glIsProgramValid(int programObj, PrintStream verboseOut); +CustomJavaCode GL2ES2 public boolean glShaderCompilerAvailable(); CustomJavaCode GL2ES2 public void glShaderSource(int shader, java.lang.String[] source); CustomJavaCode GL2ES2 public void glShaderSource(IntBuffer shaders, java.lang.String[][] sources); +CustomJavaCode GL2ES2 public Set glGetShaderBinaryFormats(); CustomJavaCode GL2ES2 public void glShaderBinary(IntBuffer shaders, int binFormat, java.nio.Buffer bin); -CustomJavaCode GL2ES2 /** -CustomJavaCode GL2ES2 * Wrapper for glShaderBinary and glShaderSource. -CustomJavaCode GL2ES2 * Tries binary first, if not null, then the source code, if not null. -CustomJavaCode GL2ES2 * The binary trial will fail in case no binary interface exist (GL2 profile), -CustomJavaCode GL2ES2 * hence the fallback to the source code. -CustomJavaCode GL2ES2 */ -CustomJavaCode GL2ES2 public void glShaderBinaryOrSource(IntBuffer shaders, -CustomJavaCode GL2ES2 int binFormat, java.nio.Buffer bin, -CustomJavaCode GL2ES2 java.lang.String[][] sources); CustomJavaCode GL2ES2 public void glCreateShader(int type, IntBuffer shaders); CustomJavaCode GL2ES2 public void glCompileShader(IntBuffer shaders); +CustomJavaCode GL2ES2 public boolean glCreateLoadShader(IntBuffer shader, int shaderType, +CustomJavaCode GL2ES2 int binFormat, java.nio.Buffer bin, +CustomJavaCode GL2ES2 PrintStream verboseOut); CustomJavaCode GL2ES2 public boolean glCreateCompileShader(IntBuffer shader, int shaderType, -CustomJavaCode GL2ES2 int binFormat, java.nio.Buffer bin, -CustomJavaCode GL2ES2 java.lang.String[][] sources); -CustomJavaCode GL2ES2 public boolean glCreateCompileShader(IntBuffer shader, int shaderType, -CustomJavaCode GL2ES2 int binFormat, java.nio.Buffer bin, CustomJavaCode GL2ES2 java.lang.String[][] sources, CustomJavaCode GL2ES2 PrintStream verboseOut); CustomJavaCode GL2ES2 public void glAttachShader(int program, IntBuffer shaders); diff --git a/make/gl-impl-CustomJavaCode-gl2.java b/make/gl-impl-CustomJavaCode-gl2.java index a13ea7dff..71e3236b7 100644 --- a/make/gl-impl-CustomJavaCode-gl2.java +++ b/make/gl-impl-CustomJavaCode-gl2.java @@ -399,7 +399,17 @@ native private long dispatch_glMapBuffer(int target, int access, long glProcAddr StringBuffer buf = new StringBuffer(); buf.append("GL: "); buf.append(getClass().getName()); - buf.append(" (GLContext: "); + buf.append(" (GLSL compiler: "); + buf.append(glShaderCompilerAvailable()); + Set bfs = glGetShaderBinaryFormats(); + buf.append(", binary formats "); + buf.append(bfs.size()); + buf.append(":"); + for(Iterator iter=bfs.iterator(); iter.hasNext(); ) { + buf.append(" "); + buf.append(((Integer)(iter.next())).intValue()); + } + buf.append(") (GLContext: "); GLContext context = getContext(); buf.append(context.getClass().getName()); buf.append(", GLDrawable: "); diff --git a/make/gl-impl-CustomJavaCode-gl2_es2.java b/make/gl-impl-CustomJavaCode-gl2_es2.java index 0a525c4e7..aef836468 100644 --- a/make/gl-impl-CustomJavaCode-gl2_es2.java +++ b/make/gl-impl-CustomJavaCode-gl2_es2.java @@ -76,18 +76,15 @@ } return false; } - if(!glIsProgramStatusValid(programObj, GL_VALIDATE_STATUS)) { - if(null!=verboseOut) { - verboseOut.println("Program status invalid: "+programObj+"\n\t"+ glGetProgramInfoLog(programObj)); - } - return false; - } - glValidateProgram(programObj); - if(!glIsProgramStatusValid(programObj, GL_VALIDATE_STATUS)) { - if(null!=verboseOut) { - verboseOut.println("Program validation failed: "+programObj+"\n\t"+ glGetProgramInfoLog(programObj)); + if ( !isGLES2() || glShaderCompilerAvailable() ) { + // failed on APX2500 (ES2.0, no compiler) for valid programs + glValidateProgram(programObj); + if(!glIsProgramStatusValid(programObj, GL_VALIDATE_STATUS)) { + if(null!=verboseOut) { + verboseOut.println("Program validation failed: "+programObj+"\n\t"+ glGetProgramInfoLog(programObj)); + } + return false; } - return false; } return true; } @@ -100,9 +97,60 @@ shaders.rewind(); } + private Boolean shaderCompilerAvailable = null; + private Set shaderBinaryFormats = null; + + public Set glGetShaderBinaryFormats() + { + if(null==shaderBinaryFormats) { + HashSet formatSet = new HashSet(); + + int[] param = new int[1]; + + glGetIntegerv(GL2ES2.GL_NUM_SHADER_BINARY_FORMATS, param, 0); + int numFormats = param[0]; + if(numFormats>0) { + int[] formats = new int[numFormats]; + glGetIntegerv(GL2ES2.GL_SHADER_BINARY_FORMATS, formats, 0); + shaderBinaryFormats = new HashSet(numFormats); + for(int i=0; i<numFormats; i++) { + shaderBinaryFormats.add(new Integer(formats[i])); + } + } else { + shaderBinaryFormats = new HashSet(0); + } + } + return shaderBinaryFormats; + } + + + public boolean glShaderCompilerAvailable() { + if(null==shaderCompilerAvailable) { + Set bfs = glGetShaderBinaryFormats(); + if(isGLES2()) { + byte[] param = new byte[1]; + glGetBooleanv(GL2ES2.GL_SHADER_COMPILER, param, 0); + boolean v = param[0]!=(byte)0x00; + if(!v && bfs.size()==0) { + // no supported binary formats, hence a compiler must be available! + v = true; + } + shaderCompilerAvailable = new Boolean(v); + } else if( isGL2() || isGL2ES2() ) { + shaderCompilerAvailable = new Boolean(true); + } else { + throw new GLException("invalid profile"); + } + } + return shaderCompilerAvailable.booleanValue(); + } public void glShaderSource(int shader, java.lang.String[] source) { + if(!glShaderCompilerAvailable()) { + throw new GLException("no compiler is available"); + } + int count = (null!=source)?source.length:0; if(count<=0) { throw new GLException("Method \"glShaderSource\" called with invalid length of source: "+count); @@ -118,7 +166,7 @@ public void glShaderSource(IntBuffer shaders, java.lang.String[][] sources) { int sourceNum = (null!=sources)?sources.length:0; - int shaderNum = (null!=shaders)?shaders.limit():0; + int shaderNum = (null!=shaders)?shaders.remaining():0; if(shaderNum<=0 || sourceNum<=0 || shaderNum!=sourceNum) { throw new GLException("Method \"glShaderSource\" called with invalid number of shaders and/or sources: shaders="+ shaderNum+", sources="+sourceNum); @@ -130,47 +178,22 @@ public void glShaderBinary(IntBuffer shaders, int binFormat, java.nio.Buffer bin) { - int shaderNum = shaders.limit(); + if(glGetShaderBinaryFormats().size()<=0) { + throw new GLException("no binary formats are supported"); + } + + int shaderNum = shaders.remaining(); if(shaderNum<=0) { throw new GLException("Method \"glShaderBinary\" called with shaders number <= 0"); } if(null==bin) { throw new GLException("Method \"glShaderBinary\" without binary (null)"); } - int binLength = bin.limit(); + int binLength = bin.remaining(); if(0>=binLength) { - throw new GLException("Method \"glShaderBinary\" without binary (limit == 0)"); - } - try { - glShaderBinary(shaderNum, shaders, binFormat, bin, binLength); - } catch (Exception e) { } - } - - /** - * Wrapper for glShaderBinary and glShaderSource. - * Tries binary first, if not null, then the source code, if not null. - * The binary trial will fail in case no binary interface exist (GL2 profile), - * hence the fallback to the source code. - */ - public void glShaderBinaryOrSource(IntBuffer shaders, - int binFormat, java.nio.Buffer bin, - java.lang.String[][] sources) - { - int shaderNum = shaders.limit(); - if(shaderNum<=0) { - throw new GLException("Method \"glShaderBinaryOrSource\" called with shaders number <= 0"); - } - if(null!=bin) { - try { - glShaderBinary(shaders, binFormat, bin); - return; // done - } catch (Exception e) { } + throw new GLException("Method \"glShaderBinary\" without binary (remaining == 0)"); } - if(null!=sources) { - glShaderSource(shaders, sources); - return; // done - } - throw new GLException("Method \"glShaderBinaryOrSource\" without binary nor source"); + glShaderBinary(shaderNum, shaders, binFormat, bin, binLength); } public void glCompileShader(IntBuffer shaders) @@ -182,27 +205,33 @@ shaders.rewind(); } - public boolean glCreateCompileShader(IntBuffer shader, int shaderType, - int binFormat, java.nio.Buffer bin, - java.lang.String[][] sources) + public boolean glCreateLoadShader(IntBuffer shader, int shaderType, + int binFormat, java.nio.Buffer bin, + PrintStream verboseOut) { - return glCreateCompileShader(shader, shaderType, - binFormat, bin, - sources, null); + glGetError(); // flush previous errors .. + + glCreateShader(shaderType, shader); + + glShaderBinary(shader, binFormat, bin); + + return glGetError() == GL.GL_NO_ERROR; } public boolean glCreateCompileShader(IntBuffer shader, int shaderType, - int binFormat, java.nio.Buffer bin, java.lang.String[][] sources, PrintStream verboseOut) { + glGetError(); // flush previous errors .. + glCreateShader(shaderType, shader); - glShaderBinaryOrSource(shader, binFormat, bin, sources); + glShaderSource(shader, sources); glCompileShader(shader); - return glIsShaderStatusValid(shader, GL_COMPILE_STATUS, verboseOut); + return glIsShaderStatusValid(shader, GL_COMPILE_STATUS, verboseOut) && + glGetError() == GL.GL_NO_ERROR; } public void glAttachShader(int program, IntBuffer shaders) diff --git a/make/gl-impl-CustomJavaCode-gl2es12.java b/make/gl-impl-CustomJavaCode-gl2es12.java index 5248aa8fe..eaea3afd6 100644 --- a/make/gl-impl-CustomJavaCode-gl2es12.java +++ b/make/gl-impl-CustomJavaCode-gl2es12.java @@ -371,7 +371,17 @@ native private long dispatch_glMapBuffer(int target, int access, long glProcAddr StringBuffer buf = new StringBuffer(); buf.append("GL: "); buf.append(getClass().getName()); - buf.append(" (GLContext: "); + buf.append(" (GLSL compiler: "); + buf.append(glShaderCompilerAvailable()); + Set bfs = glGetShaderBinaryFormats(); + buf.append(", binary formats "); + buf.append(bfs.size()); + buf.append(":"); + for(Iterator iter=bfs.iterator(); iter.hasNext(); ) { + buf.append(" "); + buf.append(((Integer)(iter.next())).intValue()); + } + buf.append(") (GLContext: "); GLContext context = getContext(); buf.append(context.getClass().getName()); buf.append(", GLDrawable: "); diff --git a/make/gl-impl-CustomJavaCode-gles2.java b/make/gl-impl-CustomJavaCode-gles2.java index 358949568..a3c274f9a 100755 --- a/make/gl-impl-CustomJavaCode-gles2.java +++ b/make/gl-impl-CustomJavaCode-gles2.java @@ -537,7 +537,17 @@ public final String toString() { StringBuffer buf = new StringBuffer(); buf.append("GL: "); buf.append(getClass().getName()); - buf.append(" (GLContext: "); + buf.append(" (GLSL compiler: "); + buf.append(glShaderCompilerAvailable()); + Set bfs = glGetShaderBinaryFormats(); + buf.append(", binary formats "); + buf.append(bfs.size()); + buf.append(":"); + for(Iterator iter=bfs.iterator(); iter.hasNext(); ) { + buf.append(" "); + buf.append(((Integer)(iter.next())).intValue()); + } + buf.append(") (GLContext: "); GLContext context = getContext(); buf.append(context.getClass().getName()); buf.append(", GLDrawable: "); diff --git a/make/lstjars.sh b/make/lstjars.sh index 6f01b0842..4d9a33f59 100644 --- a/make/lstjars.sh +++ b/make/lstjars.sh @@ -59,6 +59,10 @@ echo JOGL ES2 NEWT CORE report jogl.core.jar jogl.egl.jar jogl.gles2.jar newt.jar obj/tmp/libjogl_es2.so.gz obj/tmp/libnewt.so.gz echo +echo JOGL ES2 NEWT CORE FIXED +report jogl.core.jar jogl.egl.jar jogl.gles2.jar jogl.fixed.jar newt.jar obj/tmp/libjogl_es2.so.gz obj/tmp/libnewt.so.gz +echo + echo JOGL GL2ES12 NEWT report jogl.core.jar jogl.gl2es12.$OSS.jar newt.jar obj/tmp/libjogl_gl2es12.so.gz obj/tmp/libnewt.so.gz echo |