Added a few new ctx->Const. fields for shader-related limits.
authorBrian Paul <brian.paul@tungstengraphics.com>
Wed, 1 Nov 2006 00:12:41 +0000 (00:12 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Wed, 1 Nov 2006 00:12:41 +0000 (00:12 +0000)
src/mesa/main/context.c
src/mesa/main/get.c
src/mesa/main/get_gen.py
src/mesa/main/mtypes.h

index e0630c33d0b0c95439f41688b333df75a6a15743..8aa68283da7ffeba133a64799674fa87241baf56 100644 (file)
@@ -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));
index 61a76d000b96361c205c85707fb8c4aeaf2ae883..9185a03943dd88d9219f2d20cb13c03ee1e748f4 100644 (file)
@@ -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");
index a9e04863a7e3841fa06cac86961b26c61020e207..4555bbb5f9069297bab7b14a6dc5be3839574e84 100644 (file)
@@ -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"] )
 ]
index ffae6ff1784713ada4075b6a6a0d6d60096f6185..4803d0c04707eac0181bfaec2a1c83476aa76710 100644 (file)
@@ -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;
 };