diff options
author | Eric Anholt <[email protected]> | 2012-07-26 16:56:49 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2012-08-07 13:54:51 -0700 |
commit | 1eb3c06ae82cc962c5d867238acd089f833c2337 (patch) | |
tree | e5025e22697e198edcd843a2134154223fe89164 /src/mesa/main/context.c | |
parent | 803262a5f55ca5b94a09dfe8f35e64a579778209 (diff) |
mesa: Default to GL 3.1's limits on uniform blocks.
The ARB spec lets you get away with the default block counting against the
blocks for combined size limits. The core spec says you need to be able to
support the maximum size of default block *and* the maximum size of each
uniform block. I see no reason that any driver would have a problem with
that.
Fixes gl 3.1/minmax (with an associated fix to the test)
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/main/context.c')
-rw-r--r-- | src/mesa/main/context.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 7616eb78b93..b78bceeb9e4 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -476,7 +476,8 @@ _mesa_init_current(struct gl_context *ctx) * Important: drivers should override these with actual limits. */ static void -init_program_limits(GLenum type, struct gl_program_constants *prog) +init_program_limits(struct gl_context *ctx, GLenum type, + struct gl_program_constants *prog) { prog->MaxInstructions = MAX_PROGRAM_INSTRUCTIONS; prog->MaxAluInstructions = MAX_PROGRAM_INSTRUCTIONS; @@ -542,7 +543,9 @@ init_program_limits(GLenum type, struct gl_program_constants *prog) prog->LowInt = prog->HighInt = prog->MediumInt; prog->MaxUniformBlocks = 12; - prog->MaxCombinedUniformComponents = prog->MaxUniformComponents; + prog->MaxCombinedUniformComponents = (prog->MaxUniformComponents + + ctx->Const.MaxUniformBlockSize / 4 * + prog->MaxUniformBlocks); } @@ -589,14 +592,21 @@ _mesa_init_constants(struct gl_context *ctx) ctx->Const.MaxSpotExponent = 128.0; ctx->Const.MaxViewportWidth = MAX_VIEWPORT_WIDTH; ctx->Const.MaxViewportHeight = MAX_VIEWPORT_HEIGHT; + + /** GL_ARB_uniform_buffer_object */ + ctx->Const.MaxCombinedUniformBlocks = 36; + ctx->Const.MaxUniformBufferBindings = 36; + ctx->Const.MaxUniformBlockSize = 16384; + ctx->Const.UniformBufferOffsetAlignment = 1; + #if FEATURE_ARB_vertex_program - init_program_limits(GL_VERTEX_PROGRAM_ARB, &ctx->Const.VertexProgram); + init_program_limits(ctx, GL_VERTEX_PROGRAM_ARB, &ctx->Const.VertexProgram); #endif #if FEATURE_ARB_fragment_program - init_program_limits(GL_FRAGMENT_PROGRAM_ARB, &ctx->Const.FragmentProgram); + init_program_limits(ctx, GL_FRAGMENT_PROGRAM_ARB, &ctx->Const.FragmentProgram); #endif #if FEATURE_ARB_geometry_shader4 - init_program_limits(MESA_GEOMETRY_PROGRAM, &ctx->Const.GeometryProgram); + init_program_limits(ctx, MESA_GEOMETRY_PROGRAM, &ctx->Const.GeometryProgram); #endif ctx->Const.MaxProgramMatrices = MAX_PROGRAM_MATRICES; ctx->Const.MaxProgramMatrixStackDepth = MAX_PROGRAM_MATRIX_STACK_DEPTH; @@ -655,12 +665,6 @@ _mesa_init_constants(struct gl_context *ctx) ctx->Const.MaxTransformFeedbackInterleavedComponents = 4 * MAX_FEEDBACK_ATTRIBS; ctx->Const.MaxVertexStreams = 1; - /** GL_ARB_uniform_buffer_object */ - ctx->Const.MaxCombinedUniformBlocks = 36; - ctx->Const.MaxUniformBufferBindings = 36; - ctx->Const.MaxUniformBlockSize = 16384; - ctx->Const.UniformBufferOffsetAlignment = 1; - /* GL 3.2: hard-coded for now: */ ctx->Const.ProfileMask = GL_CONTEXT_COMPATIBILITY_PROFILE_BIT; |