summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2006-11-01 00:12:41 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2006-11-01 00:12:41 +0000
commit90fcf6ccc345c287309d7d17b2ff256cc22fb2b7 (patch)
treee7d348a9064424ae8e60023cf778e7993528fc01 /src/mesa/main
parent5050b565deca3cad165cd2f68badc084b9aa5377 (diff)
Added a few new ctx->Const. fields for shader-related limits.
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/context.c7
-rw-r--r--src/mesa/main/get.c24
-rw-r--r--src/mesa/main/get_gen.py10
-rw-r--r--src/mesa/main/mtypes.h5
4 files changed, 30 insertions, 16 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index e0630c33d0..8aa68283da 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1048,6 +1048,7 @@ _mesa_init_constants( GLcontext *ctx )
ctx->Const.VertexProgram.MaxLocalParams = MAX_PROGRAM_LOCAL_PARAMS;
ctx->Const.VertexProgram.MaxEnvParams = MAX_NV_VERTEX_PROGRAM_PARAMS;
ctx->Const.VertexProgram.MaxAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS;
+ ctx->Const.VertexProgram.MaxUniformComponents = MAX_VERTEX_UNIFORM_COMPONENTS;
init_natives(&ctx->Const.VertexProgram);
#endif
#if FEATURE_ARB_fragment_program
@@ -1061,6 +1062,7 @@ _mesa_init_constants( GLcontext *ctx )
ctx->Const.FragmentProgram.MaxLocalParams = MAX_PROGRAM_LOCAL_PARAMS;
ctx->Const.FragmentProgram.MaxEnvParams = MAX_NV_FRAGMENT_PROGRAM_PARAMS;
ctx->Const.FragmentProgram.MaxAddressRegs = MAX_FRAGMENT_PROGRAM_ADDRESS_REGS;
+ ctx->Const.FragmentProgram.MaxUniformComponents = MAX_FRAGMENT_UNIFORM_COMPONENTS;
init_natives(&ctx->Const.FragmentProgram);
#endif
ctx->Const.MaxProgramMatrices = MAX_PROGRAM_MATRICES;
@@ -1087,6 +1089,11 @@ _mesa_init_constants( GLcontext *ctx )
ctx->Const.MaxRenderbufferSize = MAX_WIDTH;
#endif
+#if FEATURE_ARB_vertex_shader
+ ctx->Const.MaxVertexTextureImageUnits = MAX_VERTEX_TEXTURE_IMAGE_UNITS;
+ ctx->Const.MaxVaryingFloats = MAX_VARYING_FLOATS;
+#endif
+
/* sanity checks */
ASSERT(ctx->Const.MaxTextureUnits == MIN2(ctx->Const.MaxTextureImageUnits,
ctx->Const.MaxTextureCoordUnits));
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 61a76d000b..9185a03943 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1863,7 +1863,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
break;
case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB:
CHECK_EXT1(ARB_fragment_shader, "GetBooleanv");
- params[0] = INT_TO_BOOLEAN(MAX_FRAGMENT_UNIFORM_COMPONENTS);
+ params[0] = INT_TO_BOOLEAN(ctx->Const.FragmentProgram.MaxUniformComponents);
break;
case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB:
CHECK_EXT1(ARB_fragment_shader, "GetBooleanv");
@@ -1871,15 +1871,15 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
break;
case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB:
CHECK_EXT1(ARB_vertex_shader, "GetBooleanv");
- params[0] = INT_TO_BOOLEAN(MAX_VERTEX_UNIFORM_COMPONENTS);
+ params[0] = INT_TO_BOOLEAN(ctx->Const.VertexProgram.MaxUniformComponents);
break;
case GL_MAX_VARYING_FLOATS_ARB:
CHECK_EXT1(ARB_vertex_shader, "GetBooleanv");
- params[0] = INT_TO_BOOLEAN(MAX_VARYING_FLOATS);
+ params[0] = INT_TO_BOOLEAN(ctx->Const.MaxVaryingFloats);
break;
case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB:
CHECK_EXT1(ARB_vertex_shader, "GetBooleanv");
- params[0] = INT_TO_BOOLEAN(MAX_VERTEX_TEXTURE_IMAGE_UNITS);
+ params[0] = INT_TO_BOOLEAN(ctx->Const.MaxVertexTextureImageUnits);
break;
case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB:
CHECK_EXT1(ARB_vertex_shader, "GetBooleanv");
@@ -3687,7 +3687,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
break;
case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB:
CHECK_EXT1(ARB_fragment_shader, "GetFloatv");
- params[0] = (GLfloat)(MAX_FRAGMENT_UNIFORM_COMPONENTS);
+ params[0] = (GLfloat)(ctx->Const.FragmentProgram.MaxUniformComponents);
break;
case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB:
CHECK_EXT1(ARB_fragment_shader, "GetFloatv");
@@ -3695,15 +3695,15 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
break;
case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB:
CHECK_EXT1(ARB_vertex_shader, "GetFloatv");
- params[0] = (GLfloat)(MAX_VERTEX_UNIFORM_COMPONENTS);
+ params[0] = (GLfloat)(ctx->Const.VertexProgram.MaxUniformComponents);
break;
case GL_MAX_VARYING_FLOATS_ARB:
CHECK_EXT1(ARB_vertex_shader, "GetFloatv");
- params[0] = (GLfloat)(MAX_VARYING_FLOATS);
+ params[0] = (GLfloat)(ctx->Const.MaxVaryingFloats);
break;
case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB:
CHECK_EXT1(ARB_vertex_shader, "GetFloatv");
- params[0] = (GLfloat)(MAX_VERTEX_TEXTURE_IMAGE_UNITS);
+ params[0] = (GLfloat)(ctx->Const.MaxVertexTextureImageUnits);
break;
case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB:
CHECK_EXT1(ARB_vertex_shader, "GetFloatv");
@@ -5511,7 +5511,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
break;
case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB:
CHECK_EXT1(ARB_fragment_shader, "GetIntegerv");
- params[0] = MAX_FRAGMENT_UNIFORM_COMPONENTS;
+ params[0] = ctx->Const.FragmentProgram.MaxUniformComponents;
break;
case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB:
CHECK_EXT1(ARB_fragment_shader, "GetIntegerv");
@@ -5519,15 +5519,15 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
break;
case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB:
CHECK_EXT1(ARB_vertex_shader, "GetIntegerv");
- params[0] = MAX_VERTEX_UNIFORM_COMPONENTS;
+ params[0] = ctx->Const.VertexProgram.MaxUniformComponents;
break;
case GL_MAX_VARYING_FLOATS_ARB:
CHECK_EXT1(ARB_vertex_shader, "GetIntegerv");
- params[0] = MAX_VARYING_FLOATS;
+ params[0] = ctx->Const.MaxVaryingFloats;
break;
case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB:
CHECK_EXT1(ARB_vertex_shader, "GetIntegerv");
- params[0] = MAX_VERTEX_TEXTURE_IMAGE_UNITS;
+ params[0] = ctx->Const.MaxVertexTextureImageUnits;
break;
case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB:
CHECK_EXT1(ARB_vertex_shader, "GetIntegerv");
diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py
index a9e04863a7..4555bbb5f9 100644
--- a/src/mesa/main/get_gen.py
+++ b/src/mesa/main/get_gen.py
@@ -978,17 +978,19 @@ StateVars = [
# GL_ARB_fragment_shader
( "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB", GLint,
- ["MAX_FRAGMENT_UNIFORM_COMPONENTS"], "", ["ARB_fragment_shader"] ),
+ ["ctx->Const.FragmentProgram.MaxUniformComponents"], "",
+ ["ARB_fragment_shader"] ),
( "GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB", GLenum,
["ctx->Hint.FragmentShaderDerivative"], "", ["ARB_fragment_shader"] ),
# GL_ARB_vertex_shader
( "GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB", GLint,
- ["MAX_VERTEX_UNIFORM_COMPONENTS"], "", ["ARB_vertex_shader"] ),
+ ["ctx->Const.VertexProgram.MaxUniformComponents"], "",
+ ["ARB_vertex_shader"] ),
( "GL_MAX_VARYING_FLOATS_ARB", GLint,
- ["MAX_VARYING_FLOATS"], "", ["ARB_vertex_shader"] ),
+ ["ctx->Const.MaxVaryingFloats"], "", ["ARB_vertex_shader"] ),
( "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", GLint,
- ["MAX_VERTEX_TEXTURE_IMAGE_UNITS"], "", ["ARB_vertex_shader"] ),
+ ["ctx->Const.MaxVertexTextureImageUnits"], "", ["ARB_vertex_shader"] ),
( "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB", GLint,
["MAX_COMBINED_TEXTURE_IMAGE_UNITS"], "", ["ARB_vertex_shader"] )
]
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index ffae6ff178..4803d0c047 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2311,6 +2311,8 @@ struct gl_program_constants
GLuint MaxNativeTemps;
GLuint MaxNativeAddressRegs; /* vertex program only, for now */
GLuint MaxNativeParameters;
+ /* For shaders */
+ GLuint MaxUniformComponents;
};
@@ -2360,6 +2362,9 @@ struct gl_constants
/* GL_EXT_framebuffer_object */
GLuint MaxColorAttachments;
GLuint MaxRenderbufferSize;
+ /* GL_ARB_vertex_shader */
+ GLuint MaxVertexTextureImageUnits;
+ GLuint MaxVaryingFloats;
};