mesa: move location of some geometry program limits
authorBrian Paul <brianp@vmware.com>
Fri, 11 Mar 2011 16:25:22 +0000 (09:25 -0700)
committerBrian Paul <brianp@vmware.com>
Fri, 11 Mar 2011 16:25:22 +0000 (09:25 -0700)
The gl_program_constants struct is for limits that are applicable to
any/all shader stages.  Move the geometry shader-only fields into the
gl_constants struct.
Remove redundant MaxGeometryUniformComponents field too.

src/mesa/main/context.c
src/mesa/main/get.c
src/mesa/main/mtypes.h
src/mesa/main/shaderapi.c
src/mesa/program/ir_to_mesa.cpp

index 5d581c84002383334699ae9ea3ffea3b6791c35e..ca74284ca89d91077e753c9606adbea0fa4b7ec9 100644 (file)
@@ -486,7 +486,6 @@ init_program_limits(GLenum type, struct gl_program_constants *prog)
    prog->MaxTemps = MAX_PROGRAM_TEMPS;
    prog->MaxEnvParams = MAX_PROGRAM_ENV_PARAMS;
    prog->MaxLocalParams = MAX_PROGRAM_LOCAL_PARAMS;
-   prog->MaxUniformComponents = 4 * MAX_UNIFORMS;
    prog->MaxAddressOffset = MAX_PROGRAM_LOCAL_PARAMS;
 
    switch (type) {
@@ -494,23 +493,19 @@ init_program_limits(GLenum type, struct gl_program_constants *prog)
       prog->MaxParameters = MAX_VERTEX_PROGRAM_PARAMS;
       prog->MaxAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS;
       prog->MaxAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS;
+      prog->MaxUniformComponents = 4 * MAX_UNIFORMS;
       break;
    case GL_FRAGMENT_PROGRAM_ARB:
       prog->MaxParameters = MAX_NV_FRAGMENT_PROGRAM_PARAMS;
       prog->MaxAttribs = MAX_NV_FRAGMENT_PROGRAM_INPUTS;
       prog->MaxAddressRegs = MAX_FRAGMENT_PROGRAM_ADDRESS_REGS;
+      prog->MaxUniformComponents = 4 * MAX_UNIFORMS;
       break;
    case MESA_GEOMETRY_PROGRAM:
       prog->MaxParameters = MAX_NV_VERTEX_PROGRAM_PARAMS;
       prog->MaxAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS;
       prog->MaxAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS;
-
-      prog->MaxGeometryTextureImageUnits = MAX_GEOMETRY_TEXTURE_IMAGE_UNITS;
-      prog->MaxGeometryVaryingComponents = MAX_GEOMETRY_VARYING_COMPONENTS;
-      prog->MaxVertexVaryingComponents = MAX_VERTEX_VARYING_COMPONENTS;
-      prog->MaxGeometryUniformComponents = MAX_GEOMETRY_UNIFORM_COMPONENTS;
-      prog->MaxGeometryOutputVertices = MAX_GEOMETRY_OUTPUT_VERTICES;
-      prog->MaxGeometryTotalOutputComponents = MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS;
+      prog->MaxUniformComponents = MAX_GEOMETRY_UNIFORM_COMPONENTS;
       break;
    default:
       assert(0 && "Bad program type in init_program_limits()");
@@ -619,6 +614,13 @@ _mesa_init_constants(struct gl_context *ctx)
    ctx->Const.MaxCombinedTextureImageUnits = MAX_COMBINED_TEXTURE_IMAGE_UNITS;
    ctx->Const.MaxVarying = MAX_VARYING;
 #endif
+#if FEATURE_ARB_geometry_shader4
+   ctx->Const.MaxGeometryTextureImageUnits = MAX_GEOMETRY_TEXTURE_IMAGE_UNITS;
+   ctx->Const.MaxVertexVaryingComponents = MAX_VERTEX_VARYING_COMPONENTS;
+   ctx->Const.MaxGeometryVaryingComponents = MAX_GEOMETRY_VARYING_COMPONENTS;
+   ctx->Const.MaxGeometryOutputVertices = MAX_GEOMETRY_OUTPUT_VERTICES;
+   ctx->Const.MaxGeometryTotalOutputComponents = MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS;
+#endif
 
    /* Shading language version */
    if (ctx->API == API_OPENGL) {
index 336304c591d22b7be590b16a6e41fcb7bbee7753..7d1a5cf600208ba44277578f37fcafeb1832a0c3 100644 (file)
@@ -1201,22 +1201,22 @@ static const struct value_desc values[] = {
 
    /* GL_ARB_geometry_shader4 */
    { GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB,
-     CONTEXT_INT(Const.GeometryProgram.MaxGeometryTextureImageUnits),
+     CONTEXT_INT(Const.MaxGeometryTextureImageUnits),
      extra_ARB_geometry_shader4 },
    { GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB,
-     CONTEXT_INT(Const.GeometryProgram.MaxGeometryOutputVertices),
+     CONTEXT_INT(Const.MaxGeometryOutputVertices),
      extra_ARB_geometry_shader4 },
    { GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB,
-     CONTEXT_INT(Const.GeometryProgram.MaxGeometryTotalOutputComponents),
+     CONTEXT_INT(Const.MaxGeometryTotalOutputComponents),
      extra_ARB_geometry_shader4 },
    { GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB,
-     CONTEXT_INT(Const.GeometryProgram.MaxGeometryUniformComponents),
+     CONTEXT_INT(Const.GeometryProgram.MaxUniformComponents),
      extra_ARB_geometry_shader4 },
    { GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB,
-     CONTEXT_INT(Const.GeometryProgram.MaxGeometryVaryingComponents),
+     CONTEXT_INT(Const.MaxGeometryVaryingComponents),
      extra_ARB_geometry_shader4 },
    { GL_MAX_VERTEX_VARYING_COMPONENTS_ARB,
-     CONTEXT_INT(Const.GeometryProgram.MaxVertexVaryingComponents),
+     CONTEXT_INT(Const.MaxVertexVaryingComponents),
      extra_ARB_geometry_shader4 },
 
    /* GL_EXT_gpu_shader4 / GL 3.0 */
index 695d936527d07cd0fed35781711c3294b44adddc..4f83e2e55c266b6d97a8146efd874b0c203e8a56 100644 (file)
@@ -2563,7 +2563,7 @@ struct gl_precision
 
 
 /**
- * Limits for vertex and fragment programs/shaders.
+ * Limits for vertex, geometry and fragment programs/shaders.
  */
 struct gl_program_constants
 {
@@ -2589,14 +2589,7 @@ struct gl_program_constants
    GLuint MaxNativeAddressRegs;
    GLuint MaxNativeParameters;
    /* For shaders */
-   GLuint MaxUniformComponents;
-   /* GL_ARB_geometry_shader4 */
-   GLuint MaxGeometryTextureImageUnits;
-   GLuint MaxGeometryVaryingComponents;
-   GLuint MaxVertexVaryingComponents;
-   GLuint MaxGeometryUniformComponents;
-   GLuint MaxGeometryOutputVertices;
-   GLuint MaxGeometryTotalOutputComponents;
+   GLuint MaxUniformComponents;  /**< Usually == MaxParameters * 4 */
    /* ES 2.0 and GL_ARB_ES2_compatibility */
    struct gl_precision LowFloat, MediumFloat, HighFloat;
    struct gl_precision LowInt, MediumInt, HighInt;
@@ -2619,6 +2612,7 @@ struct gl_constants
    GLuint MaxTextureImageUnits;
    GLuint MaxVertexTextureImageUnits;
    GLuint MaxCombinedTextureImageUnits;
+   GLuint MaxGeometryTextureImageUnits;
    GLuint MaxTextureUnits;           /**< = MIN(CoordUnits, ImageUnits) */
    GLfloat MaxTextureMaxAnisotropy;  /**< GL_EXT_texture_filter_anisotropic */
    GLfloat MaxTextureLodBias;        /**< GL_EXT_texture_lod_bias */
@@ -2658,7 +2652,14 @@ struct gl_constants
    GLuint MaxRenderbufferSize;   /**< GL_EXT_framebuffer_object */
    GLuint MaxSamples;            /**< GL_ARB_framebuffer_object */
 
-   GLuint MaxVarying;  /**< Number of float[4] varying parameters */
+   /** Number of varying vectors between vertex and fragment shaders */
+   GLuint MaxVarying;
+   GLuint MaxVertexVaryingComponents;   /**< Between vert and geom shader */
+   GLuint MaxGeometryVaryingComponents; /**< Between geom and frag shader */
+
+   /** GL_ARB_geometry_shader4 */
+   GLuint MaxGeometryOutputVertices;
+   GLuint MaxGeometryTotalOutputComponents;
 
    GLuint GLSLVersion;  /**< GLSL version supported (ex: 120 = 1.20) */
 
index 6650613d28d76ea3cca3dec505b71568a807aa94..2c5f2a147ce5984719b6984d71b35bb6af12a5b0 100644 (file)
@@ -1732,7 +1732,7 @@ _mesa_ProgramParameteriARB(GLuint program, GLenum pname,
    switch (pname) {
    case GL_GEOMETRY_VERTICES_OUT_ARB:
       if (value < 1 ||
-          (unsigned) value > ctx->Const.GeometryProgram.MaxGeometryOutputVertices) {
+          (unsigned) value > ctx->Const.MaxGeometryOutputVertices) {
          _mesa_error(ctx, GL_INVALID_VALUE,
                      "glProgramParameteri(GL_GEOMETRY_VERTICES_OUT_ARB=%d",
                      value);
index 9c77f387593b36c4004750521a8aeea2e44b803c..c4704fe6b466abb3e7e6cc6cd799a2a17668948d 100644 (file)
@@ -2460,7 +2460,7 @@ check_resources(const struct gl_context *ctx,
       break;
    case MESA_GEOMETRY_PROGRAM:
       if (_mesa_bitcount(prog->SamplersUsed) >
-          ctx->Const.GeometryProgram.MaxGeometryTextureImageUnits) {
+          ctx->Const.MaxGeometryTextureImageUnits) {
          fail_link(shader_program, "Too many geometry shader texture samplers");
       }
       if (prog->Parameters->NumParameters >