summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-07-02 17:10:42 -0600
committerBrian Paul <[email protected]>2008-07-02 17:10:42 -0600
commit39b9b05313c8b8fce9b80e96819aded479e382c9 (patch)
treea0514cae3b1e2ded0d66f3c44bfe18288eeac375 /src
parentdff477a5e27c39aa61aac8e1555c345211e832b8 (diff)
mesa: additional GLSL built-in constants
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/mfeatures.h1
-rw-r--r--src/mesa/shader/slang/slang_simplify.c32
2 files changed, 20 insertions, 13 deletions
diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h
index c3c337ea904..b08c017ec8d 100644
--- a/src/mesa/main/mfeatures.h
+++ b/src/mesa/main/mfeatures.h
@@ -44,6 +44,7 @@
#define FEATURE_dlist _HAVE_FULL_GL
#define FEATURE_draw_read_buffer _HAVE_FULL_GL
#define FEATURE_drawpix _HAVE_FULL_GL
+#define FEATURE_es2_glsl 0
#define FEATURE_evaluators _HAVE_FULL_GL
#define FEATURE_feedback _HAVE_FULL_GL
#define FEATURE_fixedpt 0
diff --git a/src/mesa/shader/slang/slang_simplify.c b/src/mesa/shader/slang/slang_simplify.c
index 21d004db889..158d6bc8cfd 100644
--- a/src/mesa/shader/slang/slang_simplify.c
+++ b/src/mesa/shader/slang/slang_simplify.c
@@ -49,20 +49,26 @@ _slang_lookup_constant(const char *name)
struct constant_info {
const char *Name;
const GLenum Token;
+ GLint Divisor;
};
static const struct constant_info info[] = {
- { "gl_MaxClipPlanes", GL_MAX_CLIP_PLANES },
- { "gl_MaxCombinedTextureImageUnits", GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS },
- { "gl_MaxDrawBuffers", GL_MAX_DRAW_BUFFERS },
- { "gl_MaxFragmentUniformComponents", GL_MAX_FRAGMENT_UNIFORM_COMPONENTS },
- { "gl_MaxLights", GL_MAX_LIGHTS },
- { "gl_MaxTextureUnits", GL_MAX_TEXTURE_UNITS },
- { "gl_MaxTextureCoords", GL_MAX_TEXTURE_COORDS },
- { "gl_MaxVertexAttribs", GL_MAX_VERTEX_ATTRIBS },
- { "gl_MaxVertexUniformComponents", GL_MAX_VERTEX_UNIFORM_COMPONENTS },
- { "gl_MaxVaryingFloats", GL_MAX_VARYING_FLOATS },
- { "gl_MaxVertexTextureImageUnits", GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS },
- { "gl_MaxTextureImageUnits", GL_MAX_TEXTURE_IMAGE_UNITS },
+ { "gl_MaxClipPlanes", GL_MAX_CLIP_PLANES, 1 },
+ { "gl_MaxCombinedTextureImageUnits", GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, 1 },
+ { "gl_MaxDrawBuffers", GL_MAX_DRAW_BUFFERS, 1 },
+ { "gl_MaxFragmentUniformComponents", GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, 1 },
+ { "gl_MaxLights", GL_MAX_LIGHTS, 1 },
+ { "gl_MaxTextureUnits", GL_MAX_TEXTURE_UNITS, 1 },
+ { "gl_MaxTextureCoords", GL_MAX_TEXTURE_COORDS, 1 },
+ { "gl_MaxVertexAttribs", GL_MAX_VERTEX_ATTRIBS, 1 },
+ { "gl_MaxVertexUniformComponents", GL_MAX_VERTEX_UNIFORM_COMPONENTS, 1 },
+ { "gl_MaxVaryingFloats", GL_MAX_VARYING_FLOATS, 1 },
+ { "gl_MaxVertexTextureImageUnits", GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, 1 },
+ { "gl_MaxTextureImageUnits", GL_MAX_TEXTURE_IMAGE_UNITS, 1 },
+#if FEATURE_es2_glsl
+ { "gl_MaxVertexUniformVectors", GL_MAX_VERTEX_UNIFORM_COMPONENTS, 4 },
+ { "gl_MaxVaryingVectors", GL_MAX_VARYING_FLOATS, 4 },
+ { "gl_MaxFragmentUniformVectors", GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, 4 },
+#endif
{ NULL, 0 }
};
GLuint i;
@@ -73,7 +79,7 @@ _slang_lookup_constant(const char *name)
GLint value = -1.0;
_mesa_GetIntegerv(info[i].Token, &value);
ASSERT(value >= 0); /* sanity check that glGetFloatv worked */
- return value;
+ return value / info[i].Divisor;
}
}
return -1;