aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/javax/media/opengl/sdk/glsl/CompileShaderNVidia.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2008-08-12 08:39:08 +0000
committerSven Gothel <[email protected]>2008-08-12 08:39:08 +0000
commit9517539e3b43d21017465180376329439bc25f12 (patch)
tree8e44e0a090301e67bc4e66b53ebd6d14827d48f2 /src/classes/javax/media/opengl/sdk/glsl/CompileShaderNVidia.java
parent28d62d086afefaf752b38ce5c2c67bc826b5a286 (diff)
Working:
APX 2500 ES 2.0 + FixedFunction GLSL ES 1.0 +++ javax.media.opengl.glsl - Shader and program state management - Loading and merging shader source code - Loading binaries incl. auto selection of the binary file in respect to the supported binary format. I.e. in case of GLES2.GL_NVIDIA_PLATFORM_BINARY_NV: source: com/sun/opengl/impl/glsl/fixed/shader/ashader.fp binary: com/sun/opengl/impl/glsl/fixed/shader/bin/nvidia/ashader.bfp ShaderCode sc = ShaderCode.create( gl, gl.GL_VERTEX_SHADER, 1, FixedFuncPipeline.class, "shader", "shader/bin", "ashader"); (Derivation of com.sun.javafx.graphics.gl2es2.ShaderUtil) javax.media.opengl.sdk.glsl CompileShaderNVidia implements abstract CompileShader Toolkit to convert JOGL shader source to binaries, according to the location rule as described in ShaderCode. Example: Converts all fixed function shader to binaries. jogl/src/classes/com/sun/opengl/impl/glsl/fixed/shader/scripts/nvidia-apx/glslc-ff.bat (Generalization of com.sun.javafx.graphics.gl2es2.PrecompileNVShader) +++ Fixed function now resides in 'jogl.fixed.jar' - contains shader source and binaries - contains the implementation GL2ES2: - removed glShaderBinaryOrSource() - use glCreateLoadShader() for binary and glCreateCompileShader() for source - using addition glGetError() check for shader upload/compilation - Skipping 'glValidateProgram' in case of ES2 and no compiler, since it fails on APX2500 .. - added: (caching the results) "public Set glGetShaderBinaryFormats()" "public boolean glShaderCompilerAvailable()" - shader-name and binary-data buffer: use 'remaining()' instead of 'limit()' BufferUtil: - adding variant: <Type>Buffer new<Type>Buffer(<type>[] values, int offset, int len) +++ Working on all profiles ES1 + ES2 (CVM) with lighting: demo.es1.cube.Cube demo.es1.cube.CubeImmModeSink demo.es1.cubefbo.Main javabullet.demos.genericjoint.GenericJointDemo git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1749 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/javax/media/opengl/sdk/glsl/CompileShaderNVidia.java')
-rwxr-xr-xsrc/classes/javax/media/opengl/sdk/glsl/CompileShaderNVidia.java54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/classes/javax/media/opengl/sdk/glsl/CompileShaderNVidia.java b/src/classes/javax/media/opengl/sdk/glsl/CompileShaderNVidia.java
new file mode 100755
index 000000000..c0c0d1c1e
--- /dev/null
+++ b/src/classes/javax/media/opengl/sdk/glsl/CompileShaderNVidia.java
@@ -0,0 +1,54 @@
+package javax.media.opengl.sdk.glsl;
+
+import javax.media.opengl.glsl.*;
+import javax.media.opengl.*;
+
+import java.io.*;
+
+/** Precompiles a shader into NVidia binary format. Input is the
+ resource name of the shader, such as
+ "com/sun/opengl/impl/glsl/fixed/shader/a.fp".
+ Output is "com/sun/opengl/impl/glsl/fixed/shader/bin/nvidia/a.bfp". */
+
+public class CompileShaderNVidia extends CompileShader {
+ private static final String NVAPSDK;
+
+ static {
+ String nvapSDKProp = System.getProperty("NVAPSDK");
+ if (nvapSDKProp != null) {
+ NVAPSDK = nvapSDKProp;
+ } else {
+ NVAPSDK = "C:\\nvap_sdk_0_3_x";
+ }
+ }
+
+ public int getBinaryFormat() {
+ return GLES2.GL_NVIDIA_PLATFORM_BINARY_NV;
+ }
+
+ public File getSDKCompilerDir() {
+ File compilerDir = new File( NVAPSDK + File.separator + "tools" + File.separator );
+ File compilerFile = new File( compilerDir, getVertexShaderCompiler());
+ if(!compilerFile.exists()) {
+ compilerDir = new File( NVAPSDK );
+ compilerFile = new File( compilerDir, getVertexShaderCompiler());
+ }
+ if(!compilerFile.exists()) {
+ throw new GLException("Can't find compiler: "+getVertexShaderCompiler() + " in : " +
+ NVAPSDK+", "+NVAPSDK + File.separator + "tools");
+ }
+ return compilerDir;
+ }
+
+ public String getVertexShaderCompiler() {
+ return "glslv.bat";
+ }
+
+ public String getFragmentShaderCompiler() {
+ return "glslf.bat";
+ }
+
+ public static void main(String[] args) {
+ new CompileShaderNVidia().run(args);
+ }
+}