diff options
author | Timothy Arceri <[email protected]> | 2017-05-22 15:46:58 +1000 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-05-30 08:03:32 +1000 |
commit | 21d9376e710912810f0f5d87da12e439d340ec33 (patch) | |
tree | ff33e868a389e8f9eef258727f5a0e9a41a78699 | |
parent | 135e5659bd882dc2a65f6cf58515c3c71d0515ed (diff) |
mesa: split bind_atomic_buffer() in two
This will help us add KHR_no_error support.
Reviewed-by: Iago Toral Quiroga <[email protected]>
Tested-by: Dieter Nützel <[email protected]>
-rw-r--r-- | src/mesa/main/bufferobj.c | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 132391b4d81..aa253ef9819 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -3273,6 +3273,27 @@ set_atomic_buffer_binding(struct gl_context *ctx, } } +static void +bind_atomic_buffer(struct gl_context *ctx, unsigned index, + struct gl_buffer_object *bufObj, GLintptr offset, + GLsizeiptr size) +{ + _mesa_reference_buffer_object(ctx, &ctx->AtomicBuffer, bufObj); + + struct gl_atomic_buffer_binding *binding = + &ctx->AtomicBufferBindings[index]; + if (binding->BufferObject == bufObj && + binding->Offset == offset && + binding->Size == size) { + return; + } + + FLUSH_VERTICES(ctx, 0); + ctx->NewDriverState |= ctx->DriverFlags.NewAtomicBuffer; + + set_atomic_buffer_binding(ctx, binding, bufObj, offset, size); +} + /** * Binds a buffer object to an atomic buffer binding point. * @@ -3282,15 +3303,10 @@ set_atomic_buffer_binding(struct gl_context *ctx, * updating it. */ static void -bind_atomic_buffer(struct gl_context *ctx, - unsigned index, - struct gl_buffer_object *bufObj, - GLintptr offset, - GLsizeiptr size, - const char *name) +bind_atomic_buffer_err(struct gl_context *ctx, unsigned index, + struct gl_buffer_object *bufObj, GLintptr offset, + GLsizeiptr size, const char *name) { - struct gl_atomic_buffer_binding *binding; - if (index >= ctx->Const.MaxAtomicBufferBindings) { _mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%d)", name, index); return; @@ -3303,19 +3319,7 @@ bind_atomic_buffer(struct gl_context *ctx, return; } - _mesa_reference_buffer_object(ctx, &ctx->AtomicBuffer, bufObj); - - binding = &ctx->AtomicBufferBindings[index]; - if (binding->BufferObject == bufObj && - binding->Offset == offset && - binding->Size == size) { - return; - } - - FLUSH_VERTICES(ctx, 0); - ctx->NewDriverState |= ctx->DriverFlags.NewAtomicBuffer; - - set_atomic_buffer_binding(ctx, binding, bufObj, offset, size); + bind_atomic_buffer(ctx, index, bufObj, offset, size); } static inline bool @@ -4038,8 +4042,8 @@ _mesa_BindBufferRange(GLenum target, GLuint index, size); return; case GL_ATOMIC_COUNTER_BUFFER: - bind_atomic_buffer(ctx, index, bufObj, offset, size, - "glBindBufferRange"); + bind_atomic_buffer_err(ctx, index, bufObj, offset, size, + "glBindBufferRange"); return; default: _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferRange(target)"); @@ -4112,8 +4116,8 @@ _mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer) bind_buffer_base_shader_storage_buffer(ctx, index, bufObj); return; case GL_ATOMIC_COUNTER_BUFFER: - bind_atomic_buffer(ctx, index, bufObj, 0, 0, - "glBindBufferBase"); + bind_atomic_buffer_err(ctx, index, bufObj, 0, 0, + "glBindBufferBase"); return; default: _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferBase(target)"); |