diff options
author | Timothy Arceri <[email protected]> | 2017-05-04 13:26:45 +1000 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-05-07 15:29:33 +1000 |
commit | 0b2e4da80a00a2d40c82f39b5d369664b63ef8b4 (patch) | |
tree | 60e8593e4a1ce04494e88b2258d8ff9989717d9c | |
parent | 6c3768692e4edd7f61080239f34306be0d43bafd (diff) |
mesa: split unmap_buffer() in two
This will allow us to implement KHR_no_error support for unmap
functions.
Reviewed-by: Eric Anholt <[email protected]>
-rw-r--r-- | src/mesa/main/bufferobj.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index f6822c750df..0fdb623b4b1 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -2002,12 +2002,23 @@ _mesa_ClearNamedBufferSubData(GLuint buffer, GLenum internalformat, "glClearNamedBufferSubData", true); } +static GLboolean +unmap_buffer(struct gl_context *ctx, struct gl_buffer_object *bufObj) +{ + GLboolean status = ctx->Driver.UnmapBuffer(ctx, bufObj, MAP_USER); + bufObj->Mappings[MAP_USER].AccessFlags = 0; + assert(bufObj->Mappings[MAP_USER].Pointer == NULL); + assert(bufObj->Mappings[MAP_USER].Offset == 0); + assert(bufObj->Mappings[MAP_USER].Length == 0); + + return status; +} static GLboolean -unmap_buffer(struct gl_context *ctx, struct gl_buffer_object *bufObj, - const char *func) +validate_and_unmap_buffer(struct gl_context *ctx, + struct gl_buffer_object *bufObj, + const char *func) { - GLboolean status = GL_TRUE; ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); if (!_mesa_bufferobj_mapped(bufObj, MAP_USER)) { @@ -2052,13 +2063,7 @@ unmap_buffer(struct gl_context *ctx, struct gl_buffer_object *bufObj, } #endif - status = ctx->Driver.UnmapBuffer(ctx, bufObj, MAP_USER); - bufObj->Mappings[MAP_USER].AccessFlags = 0; - assert(bufObj->Mappings[MAP_USER].Pointer == NULL); - assert(bufObj->Mappings[MAP_USER].Offset == 0); - assert(bufObj->Mappings[MAP_USER].Length == 0); - - return status; + return unmap_buffer(ctx, bufObj); } GLboolean GLAPIENTRY @@ -2071,7 +2076,7 @@ _mesa_UnmapBuffer(GLenum target) if (!bufObj) return GL_FALSE; - return unmap_buffer(ctx, bufObj, "glUnmapBuffer"); + return validate_and_unmap_buffer(ctx, bufObj, "glUnmapBuffer"); } GLboolean GLAPIENTRY @@ -2084,7 +2089,7 @@ _mesa_UnmapNamedBuffer(GLuint buffer) if (!bufObj) return GL_FALSE; - return unmap_buffer(ctx, bufObj, "glUnmapNamedBuffer"); + return validate_and_unmap_buffer(ctx, bufObj, "glUnmapNamedBuffer"); } |