summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorAditya Atluri <[email protected]>2014-07-24 15:18:49 -0400
committerMarek Olšák <[email protected]>2014-08-01 15:50:26 +0200
commitf455f34ab9e8d39bb2657b28e608a63c3c2386f8 (patch)
tree268ac37771a60e8f997714282c7997f82aaffbd0 /src/mesa/main
parent150ac07b855b5c5f879bf6ce9ca421ccd1a6c938 (diff)
mesa: Add missing atomic buffer bindings and unbindings
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/bufferobj.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 7b1bba09736..1dfcda30d5e 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -832,6 +832,9 @@ _mesa_init_buffer_objects( struct gl_context *ctx )
_mesa_reference_buffer_object(ctx, &ctx->UniformBuffer,
ctx->Shared->NullBufferObj);
+ _mesa_reference_buffer_object(ctx, &ctx->AtomicBuffer,
+ ctx->Shared->NullBufferObj);
+
_mesa_reference_buffer_object(ctx, &ctx->DrawIndirectBuffer,
ctx->Shared->NullBufferObj);
@@ -842,6 +845,14 @@ _mesa_init_buffer_objects( struct gl_context *ctx )
ctx->UniformBufferBindings[i].Offset = -1;
ctx->UniformBufferBindings[i].Size = -1;
}
+
+ for (i = 0; i < MAX_COMBINED_ATOMIC_BUFFERS; i++) {
+ _mesa_reference_buffer_object(ctx,
+ &ctx->AtomicBufferBindings[i].BufferObject,
+ ctx->Shared->NullBufferObj);
+ ctx->AtomicBufferBindings[i].Offset = -1;
+ ctx->AtomicBufferBindings[i].Size = -1;
+ }
}
@@ -857,6 +868,8 @@ _mesa_free_buffer_objects( struct gl_context *ctx )
_mesa_reference_buffer_object(ctx, &ctx->UniformBuffer, NULL);
+ _mesa_reference_buffer_object(ctx, &ctx->AtomicBuffer, NULL);
+
_mesa_reference_buffer_object(ctx, &ctx->DrawIndirectBuffer, NULL);
for (i = 0; i < MAX_COMBINED_UNIFORM_BUFFERS; i++) {
@@ -864,6 +877,13 @@ _mesa_free_buffer_objects( struct gl_context *ctx )
&ctx->UniformBufferBindings[i].BufferObject,
NULL);
}
+
+ for (i = 0; i < MAX_COMBINED_ATOMIC_BUFFERS; i++) {
+ _mesa_reference_buffer_object(ctx,
+ &ctx->AtomicBufferBindings[i].BufferObject,
+ NULL);
+ }
+
}
bool
@@ -1200,6 +1220,17 @@ _mesa_DeleteBuffers(GLsizei n, const GLuint *ids)
_mesa_BindBuffer( GL_UNIFORM_BUFFER, 0 );
}
+ /* unbind Atomci Buffer binding points */
+ for (j = 0; j < ctx->Const.MaxAtomicBufferBindings; j++) {
+ if (ctx->AtomicBufferBindings[j].BufferObject == bufObj) {
+ _mesa_BindBufferBase( GL_ATOMIC_COUNTER_BUFFER, j, 0 );
+ }
+ }
+
+ if (ctx->UniformBuffer == bufObj) {
+ _mesa_BindBuffer( GL_ATOMIC_COUNTER_BUFFER, 0 );
+ }
+
/* unbind any pixel pack/unpack pointers bound to this buffer */
if (ctx->Pack.BufferObj == bufObj) {
_mesa_BindBuffer( GL_PIXEL_PACK_BUFFER_EXT, 0 );