diff options
author | Marek Olšák <[email protected]> | 2013-05-14 17:58:32 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2013-05-28 13:05:30 +0200 |
commit | 15a4b6db2192b0adc05c3dc07cf043316c556f2e (patch) | |
tree | 33681024f6e8dd67bf32a703781ea3fd3f3f854f /src/mesa/main/bufferobj.c | |
parent | cdad129f9cda038fb29cde94645d2fcab7207c50 (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/main/bufferobj.c')
-rw-r--r-- | src/mesa/main/bufferobj.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 1566cb4c509..ffb67b9b3e5 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -619,13 +619,10 @@ _mesa_init_buffer_objects( struct gl_context *ctx ) _mesa_reference_buffer_object(ctx, &ctx->CopyWriteBuffer, ctx->Shared->NullBufferObj); - ctx->UniformBufferBindings = calloc(ctx->Const.MaxUniformBufferBindings, - sizeof(*ctx->UniformBufferBindings)); - _mesa_reference_buffer_object(ctx, &ctx->UniformBuffer, ctx->Shared->NullBufferObj); - for (i = 0; i < ctx->Const.MaxUniformBufferBindings; i++) { + for (i = 0; i < MAX_COMBINED_UNIFORM_BUFFERS; i++) { _mesa_reference_buffer_object(ctx, &ctx->UniformBufferBindings[i].BufferObject, ctx->Shared->NullBufferObj); @@ -647,14 +644,11 @@ _mesa_free_buffer_objects( struct gl_context *ctx ) _mesa_reference_buffer_object(ctx, &ctx->UniformBuffer, NULL); - for (i = 0; i < ctx->Const.MaxUniformBufferBindings; i++) { + for (i = 0; i < MAX_COMBINED_UNIFORM_BUFFERS; i++) { _mesa_reference_buffer_object(ctx, &ctx->UniformBufferBindings[i].BufferObject, NULL); } - - free(ctx->UniformBufferBindings); - ctx->UniformBufferBindings = NULL; } static bool |