diff --git a/jme3-core/src/main/java/com/jme3/renderer/Limits.java b/jme3-core/src/main/java/com/jme3/renderer/Limits.java
index 81db88f5e..a7e737092 100644
--- a/jme3-core/src/main/java/com/jme3/renderer/Limits.java
+++ b/jme3-core/src/main/java/com/jme3/renderer/Limits.java
@@ -32,51 +32,34 @@
package com.jme3.renderer;
/**
- * Limits
allows querying the limits of certain features in
+ * Limits
allows querying the limits of certain features in
* {@link Renderer}.
*
* For example, maximum texture sizes or number of samples.
- *
+ *
* @author Kirill Vainer
*/
public enum Limits {
/**
- * Maximum number of vertex texture units, or number of textures
- * that can be used in the vertex shader.
+ * Maximum number of vertex texture units, or number of textures that can be
+ * used in the vertex shader.
*/
VertexTextureUnits,
-
/**
- * Maximum number of fragment texture units, or number of textures
- * that can be used in the fragment shader.
+ * Maximum number of fragment texture units, or number of textures that can
+ * be used in the fragment shader.
*/
FragmentTextureUnits,
-
- FragmentUniforms,
-
+ FragmentUniformVectors,
+ VertexUniformVectors,
VertexAttributes,
-
FrameBufferSamples,
-
FrameBufferAttachments,
-
FrameBufferMrtAttachments,
-
RenderBufferSize,
-
TextureSize,
-
CubemapSize,
-
- VertexCount,
-
- TriangleCount,
-
ColorTextureSamples,
-
DepthTextureSamples,
-
- VertexUniformVectors,
-
TextureAnisotropy,
}
diff --git a/jme3-core/src/main/java/com/jme3/renderer/Renderer.java b/jme3-core/src/main/java/com/jme3/renderer/Renderer.java
index edfd380b4..305a09743 100644
--- a/jme3-core/src/main/java/com/jme3/renderer/Renderer.java
+++ b/jme3-core/src/main/java/com/jme3/renderer/Renderer.java
@@ -43,6 +43,7 @@ import com.jme3.texture.Image;
import com.jme3.texture.Texture;
import com.jme3.util.NativeObject;
import java.nio.ByteBuffer;
+import java.util.EnumMap;
import java.util.EnumSet;
/**
@@ -66,6 +67,13 @@ public interface Renderer {
*/
public EnumSet getCaps();
+ /**
+ * Get the limits of the renderer.
+ *
+ * @return The limits of the renderer.
+ */
+ public EnumMap getLimits();
+
/**
* The statistics allow tracking of how data
* per frame, such as number of objects rendered, number of triangles, etc.
diff --git a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java
index 3b4a4d07a..4f0162cd2 100644
--- a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java
+++ b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java
@@ -252,18 +252,14 @@ public final class GLRenderer implements Renderer {
limits.put(Limits.FragmentTextureUnits, getInteger(GL.GL_MAX_TEXTURE_IMAGE_UNITS));
-// gl.glGetInteger(GL.GL_MAX_VERTEX_UNIFORM_COMPONENTS, intBuf16);
-// vertexUniforms = intBuf16.get(0);
-// logger.log(Level.FINER, "Vertex Uniforms: {0}", vertexUniforms);
-//
-// gl.glGetInteger(GL.GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, intBuf16);
-// fragUniforms = intBuf16.get(0);
-// logger.log(Level.FINER, "Fragment Uniforms: {0}", fragUniforms);
if (caps.contains(Caps.OpenGLES20)) {
+ limits.put(Limits.FragmentUniformVectors, getInteger(GL.GL_MAX_FRAGMENT_UNIFORM_VECTORS));
limits.put(Limits.VertexUniformVectors, getInteger(GL.GL_MAX_VERTEX_UNIFORM_VECTORS));
} else {
+ limits.put(Limits.FragmentUniformVectors, getInteger(GL.GL_MAX_FRAGMENT_UNIFORM_COMPONENTS) / 4);
limits.put(Limits.VertexUniformVectors, getInteger(GL.GL_MAX_VERTEX_UNIFORM_COMPONENTS) / 4);
}
+
limits.put(Limits.VertexAttributes, getInteger(GL.GL_MAX_VERTEX_ATTRIBS));
limits.put(Limits.TextureSize, getInteger(GL.GL_MAX_TEXTURE_SIZE));
limits.put(Limits.CubemapSize, getInteger(GL.GL_MAX_CUBE_MAP_TEXTURE_SIZE));
diff --git a/jme3-core/src/main/java/com/jme3/system/NullRenderer.java b/jme3-core/src/main/java/com/jme3/system/NullRenderer.java
index ae00386ee..29c4dab26 100644
--- a/jme3-core/src/main/java/com/jme3/system/NullRenderer.java
+++ b/jme3-core/src/main/java/com/jme3/system/NullRenderer.java
@@ -39,6 +39,7 @@ import com.jme3.material.RenderState;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Matrix4f;
import com.jme3.renderer.Caps;
+import com.jme3.renderer.Limits;
import com.jme3.renderer.Renderer;
import com.jme3.renderer.Statistics;
import com.jme3.scene.Mesh;
@@ -48,15 +49,25 @@ import com.jme3.shader.Shader.ShaderSource;
import com.jme3.texture.FrameBuffer;
import com.jme3.texture.Image;
import com.jme3.texture.Texture;
+import java.util.EnumMap;
public class NullRenderer implements Renderer {
- private static final EnumSet caps = EnumSet.allOf(Caps.class);
- private static final Statistics stats = new Statistics();
+ private final EnumSet caps = EnumSet.allOf(Caps.class);
+ private final EnumMap limits = new EnumMap<>(Limits.class);
+ private final Statistics stats = new Statistics();
public void initialize() {
+ for (Limits limit : Limits.values()) {
+ limits.put(limit, Integer.MAX_VALUE);
+ }
}
-
+
+ @Override
+ public EnumMap getLimits() {
+ return limits;
+ }
+
public EnumSet getCaps() {
return caps;
}