mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
mesa: split unmap_buffer() in two
This will allow us to implement KHR_no_error support for unmap functions. Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
6c3768692e
commit
0b2e4da80a
1 changed files with 17 additions and 12 deletions
|
|
@ -2002,12 +2002,23 @@ _mesa_ClearNamedBufferSubData(GLuint buffer, GLenum internalformat,
|
||||||
"glClearNamedBufferSubData", true);
|
"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
|
static GLboolean
|
||||||
unmap_buffer(struct gl_context *ctx, struct gl_buffer_object *bufObj,
|
validate_and_unmap_buffer(struct gl_context *ctx,
|
||||||
const char *func)
|
struct gl_buffer_object *bufObj,
|
||||||
|
const char *func)
|
||||||
{
|
{
|
||||||
GLboolean status = GL_TRUE;
|
|
||||||
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
|
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
|
||||||
|
|
||||||
if (!_mesa_bufferobj_mapped(bufObj, MAP_USER)) {
|
if (!_mesa_bufferobj_mapped(bufObj, MAP_USER)) {
|
||||||
|
|
@ -2052,13 +2063,7 @@ unmap_buffer(struct gl_context *ctx, struct gl_buffer_object *bufObj,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
status = ctx->Driver.UnmapBuffer(ctx, bufObj, MAP_USER);
|
return unmap_buffer(ctx, bufObj);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLboolean GLAPIENTRY
|
GLboolean GLAPIENTRY
|
||||||
|
|
@ -2071,7 +2076,7 @@ _mesa_UnmapBuffer(GLenum target)
|
||||||
if (!bufObj)
|
if (!bufObj)
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
|
||||||
return unmap_buffer(ctx, bufObj, "glUnmapBuffer");
|
return validate_and_unmap_buffer(ctx, bufObj, "glUnmapBuffer");
|
||||||
}
|
}
|
||||||
|
|
||||||
GLboolean GLAPIENTRY
|
GLboolean GLAPIENTRY
|
||||||
|
|
@ -2084,7 +2089,7 @@ _mesa_UnmapNamedBuffer(GLuint buffer)
|
||||||
if (!bufObj)
|
if (!bufObj)
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
|
||||||
return unmap_buffer(ctx, bufObj, "glUnmapNamedBuffer");
|
return validate_and_unmap_buffer(ctx, bufObj, "glUnmapNamedBuffer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue