diff options
author | Timothy Arceri <[email protected]> | 2017-05-22 15:46:57 +1000 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-05-30 08:03:32 +1000 |
commit | 135e5659bd882dc2a65f6cf58515c3c71d0515ed (patch) | |
tree | edc38ac2706816441cf8bdfc9a62d18b3b50e8c2 /src/mesa | |
parent | cea384fa75de5772f29a477e9d573ed78eccfba5 (diff) |
mesa: split bind_buffer_range_shader_storage_buffer() in two
This will help us implement KHR_no_error support.
Reviewed-by: Iago Toral Quiroga <[email protected]>
Tested-by: Dieter Nützel <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/bufferobj.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 2c5d56b3c01..132391b4d81 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -3160,6 +3160,22 @@ bind_buffer_range_uniform_buffer_err(struct gl_context *ctx, GLuint index, bind_buffer_range_uniform_buffer(ctx, index, bufObj, offset, size); } +static void +bind_buffer_range_shader_storage_buffer(struct gl_context *ctx, + GLuint index, + struct gl_buffer_object *bufObj, + GLintptr offset, + GLsizeiptr size) +{ + if (bufObj == ctx->Shared->NullBufferObj) { + offset = -1; + size = -1; + } + + _mesa_reference_buffer_object(ctx, &ctx->ShaderStorageBuffer, bufObj); + bind_shader_storage_buffer(ctx, index, bufObj, offset, size, GL_FALSE); +} + /** * Bind a region of a buffer object to a shader storage block binding point. * \param index the shader storage buffer binding point index @@ -3168,11 +3184,10 @@ bind_buffer_range_uniform_buffer_err(struct gl_context *ctx, GLuint index, * \param size size of the buffer object region */ static void -bind_buffer_range_shader_storage_buffer(struct gl_context *ctx, - GLuint index, - struct gl_buffer_object *bufObj, - GLintptr offset, - GLsizeiptr size) +bind_buffer_range_shader_storage_buffer_err(struct gl_context *ctx, + GLuint index, + struct gl_buffer_object *bufObj, + GLintptr offset, GLsizeiptr size) { if (index >= ctx->Const.MaxShaderStorageBufferBindings) { _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(index=%d)", index); @@ -3186,13 +3201,7 @@ bind_buffer_range_shader_storage_buffer(struct gl_context *ctx, return; } - if (bufObj == ctx->Shared->NullBufferObj) { - offset = -1; - size = -1; - } - - _mesa_reference_buffer_object(ctx, &ctx->ShaderStorageBuffer, bufObj); - bind_shader_storage_buffer(ctx, index, bufObj, offset, size, GL_FALSE); + bind_buffer_range_shader_storage_buffer(ctx, index, bufObj, offset, size); } /** @@ -4025,7 +4034,8 @@ _mesa_BindBufferRange(GLenum target, GLuint index, bind_buffer_range_uniform_buffer_err(ctx, index, bufObj, offset, size); return; case GL_SHADER_STORAGE_BUFFER: - bind_buffer_range_shader_storage_buffer(ctx, index, bufObj, offset, size); + bind_buffer_range_shader_storage_buffer_err(ctx, index, bufObj, offset, + size); return; case GL_ATOMIC_COUNTER_BUFFER: bind_atomic_buffer(ctx, index, bufObj, offset, size, |