From e3715098dc137f776b551376c294f06a870425b6 Mon Sep 17 00:00:00 2001 From: phil <philjord@ihug.co.nz> Date: Thu, 1 Dec 2016 19:09:53 +1300 Subject: maxVaryingVectors variable loaded into canvas3D This is very important on low power hardware and affects shader design --- src/main/java/org/jogamp/java3d/Canvas3D.java | 6 ++++++ src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java | 6 ++++++ 2 files changed, 12 insertions(+) (limited to 'src/main/java') diff --git a/src/main/java/org/jogamp/java3d/Canvas3D.java b/src/main/java/org/jogamp/java3d/Canvas3D.java index b4d5bcb..fe21197 100644 --- a/src/main/java/org/jogamp/java3d/Canvas3D.java +++ b/src/main/java/org/jogamp/java3d/Canvas3D.java @@ -795,6 +795,8 @@ ArrayList<Integer> textureIdResourceFreeList = new ArrayList<Integer>(); // Max number of vertex attrs (not counting coord, etc.) int maxVertexAttrs = 0; + + int maxVaryingVectors = 0; // End of variables set by createNewContext()/createQueryContext() @@ -3741,8 +3743,12 @@ ArrayList<TextureRetained> textureIDResourceTable = new ArrayList<TextureRetaine keys.add("textureImageUnitsCombinedMax"); values.add(new Integer(maxCombinedTextureImageUnits)); + keys.add("maxVaryingVectors"); + values.add(new Integer(maxVaryingVectors)); + keys.add("vertexAttrsMax"); values.add(new Integer(maxVertexAttrs)); + keys.add("shadingLanguageGLSL"); values.add(new Boolean(shadingLanguageGLSL)); diff --git a/src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java b/src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java index fa556e9..3e2ba74 100644 --- a/src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java +++ b/src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java @@ -7012,6 +7012,11 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline { cv.maxVertexAttrs = 0; } + + //http://stackoverflow.com/questions/26682631/webgl-shaders-maximum-number-of-varying-variables + gl.glGetIntegerv(GL2ES2.GL_MAX_VARYING_VECTORS, tmp, 0); + cv.maxVaryingVectors = tmp[0]; + cv.shadingLanguageGLSL = true; } } @@ -7030,6 +7035,7 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline cv.maxVertexTextureImageUnits = 0; cv.maxCombinedTextureImageUnits = 0; cv.maxVertexAttrs = 0; + cv.maxVaryingVectors = 0; cv.extensionsSupported = 0; cv.textureExtendedFeatures = 0; cv.textureColorTableSize = 0; -- cgit v1.2.3