diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/bufferobj.c | 10 | ||||
-rw-r--r-- | src/mesa/main/config.h | 3 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 3 |
3 files changed, 7 insertions, 9 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 diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index ea87b754a40..4a4fdc98c1d 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -168,6 +168,9 @@ /*@{*/ #define MAX_PROGRAM_LOCAL_PARAMS 4096 #define MAX_UNIFORMS 4096 +#define MAX_UNIFORM_BUFFERS 15 /* + 1 default uniform buffer */ +/* 6 is for vertex, hull, domain, geometry, fragment, and compute shader. */ +#define MAX_COMBINED_UNIFORM_BUFFERS (MAX_UNIFORM_BUFFERS * 6) /*@}*/ /** diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 244bee2e670..40ffb929617 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3544,7 +3544,8 @@ struct gl_context * associated with uniform blocks by glUniformBlockBinding()'s state in the * shader program. */ - struct gl_uniform_buffer_binding *UniformBufferBindings; + struct gl_uniform_buffer_binding + UniformBufferBindings[MAX_COMBINED_UNIFORM_BUFFERS]; /*@}*/ |