summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_extensions.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2013-05-14 17:58:32 +0200
committerMarek Olšák <[email protected]>2013-05-28 13:05:30 +0200
commit15a4b6db2192b0adc05c3dc07cf043316c556f2e (patch)
tree33681024f6e8dd67bf32a703781ea3fd3f3f854f /src/mesa/state_tracker/st_extensions.c
parentcdad129f9cda038fb29cde94645d2fcab7207c50 (diff)
mesa: declare UniformBufferBindings as an array with a static size
Some Gallium drivers were crashing, because the array was not large enough. v2: clamp the per-shader maximum in st/mesa, then sum them all up NOTE: This is a candidate for the stable branches.
Diffstat (limited to 'src/mesa/state_tracker/st_extensions.c')
-rw-r--r--src/mesa/state_tracker/st_extensions.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 982e652f1b0..46acc876378 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -197,6 +197,7 @@ void st_init_limits(struct st_context *st)
screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_CONST_BUFFERS);
if (pc->MaxUniformBlocks)
pc->MaxUniformBlocks -= 1; /* The first one is for ordinary uniforms. */
+ pc->MaxUniformBlocks = _min(pc->MaxUniformBlocks, MAX_UNIFORM_BUFFERS);
pc->MaxCombinedUniformComponents = (pc->MaxUniformComponents +
c->MaxUniformBlockSize / 4 *
@@ -279,15 +280,11 @@ void st_init_limits(struct st_context *st)
st->ctx->Extensions.ARB_uniform_buffer_object = GL_TRUE;
c->UniformBufferOffsetAlignment =
screen->get_param(screen, PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT);
- /* FIXME: _mesa_init_buffer_objects() already has been, and
- * ctx->UniformBufferBindings allocated, so unfortunately we can't just
- * change MaxUniformBufferBindings a posteriori. */
-#if 0
c->MaxCombinedUniformBlocks = c->MaxUniformBufferBindings =
c->VertexProgram.MaxUniformBlocks +
c->GeometryProgram.MaxUniformBlocks +
c->FragmentProgram.MaxUniformBlocks;
-#endif
+ assert(c->MaxCombinedUniformBlocks <= MAX_COMBINED_UNIFORM_BUFFERS);
}
}