[Mesa-dev] [PATCH 01/18] mesa: make map_buffer_range() static
Timothy Arceri
tarceri at itsqueeze.com
Thu May 4 07:41:26 UTC 2017
---
src/mesa/main/bufferobj.c | 27 +++++++++++++--------------
src/mesa/main/bufferobj.h | 6 ------
2 files changed, 13 insertions(+), 20 deletions(-)
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 961871c..76e035f 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -2372,25 +2372,24 @@ _mesa_CopyNamedBufferSubData(GLuint readBuffer, GLuint writeBuffer,
dst = _mesa_lookup_bufferobj_err(ctx, writeBuffer,
"glCopyNamedBufferSubData");
if (!dst)
return;
_mesa_copy_buffer_sub_data(ctx, src, dst, readOffset, writeOffset, size,
"glCopyNamedBufferSubData");
}
-void *
-_mesa_map_buffer_range(struct gl_context *ctx,
- struct gl_buffer_object *bufObj,
- GLintptr offset, GLsizeiptr length,
- GLbitfield access, const char *func)
+static void *
+map_buffer_range(struct gl_context *ctx, struct gl_buffer_object *bufObj,
+ GLintptr offset, GLsizeiptr length, GLbitfield access,
+ const char *func)
{
void *map;
GLbitfield allowed_access;
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL);
if (offset < 0) {
_mesa_error(ctx, GL_INVALID_VALUE,
"%s(offset %ld < 0)", func, (long) offset);
return NULL;
@@ -2579,49 +2578,49 @@ _mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length,
if (!ctx->Extensions.ARB_map_buffer_range) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glMapBufferRange(ARB_map_buffer_range not supported)");
return NULL;
}
bufObj = get_buffer(ctx, "glMapBufferRange", target, GL_INVALID_OPERATION);
if (!bufObj)
return NULL;
- return _mesa_map_buffer_range(ctx, bufObj, offset, length, access,
- "glMapBufferRange");
+ return map_buffer_range(ctx, bufObj, offset, length, access,
+ "glMapBufferRange");
}
void * GLAPIENTRY
_mesa_MapNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length,
GLbitfield access)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj;
if (!ctx->Extensions.ARB_map_buffer_range) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glMapNamedBufferRange("
"ARB_map_buffer_range not supported)");
return NULL;
}
bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glMapNamedBufferRange");
if (!bufObj)
return NULL;
- return _mesa_map_buffer_range(ctx, bufObj, offset, length, access,
- "glMapNamedBufferRange");
+ return map_buffer_range(ctx, bufObj, offset, length, access,
+ "glMapNamedBufferRange");
}
/**
* Converts GLenum access from MapBuffer and MapNamedBuffer into
- * flags for input to _mesa_map_buffer_range.
+ * flags for input to map_buffer_range.
*
* \return true if the type of requested access is permissible.
*/
static bool
get_map_buffer_access_flags(struct gl_context *ctx, GLenum access,
GLbitfield *flags)
{
switch (access) {
case GL_READ_ONLY_ARB:
*flags = GL_MAP_READ_BIT;
@@ -2646,42 +2645,42 @@ _mesa_MapBuffer(GLenum target, GLenum access)
if (!get_map_buffer_access_flags(ctx, access, &accessFlags)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glMapBuffer(invalid access)");
return NULL;
}
bufObj = get_buffer(ctx, "glMapBuffer", target, GL_INVALID_OPERATION);
if (!bufObj)
return NULL;
- return _mesa_map_buffer_range(ctx, bufObj, 0, bufObj->Size, accessFlags,
- "glMapBuffer");
+ return map_buffer_range(ctx, bufObj, 0, bufObj->Size, accessFlags,
+ "glMapBuffer");
}
void * GLAPIENTRY
_mesa_MapNamedBuffer(GLuint buffer, GLenum access)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj;
GLbitfield accessFlags;
if (!get_map_buffer_access_flags(ctx, access, &accessFlags)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glMapNamedBuffer(invalid access)");
return NULL;
}
bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glMapNamedBuffer");
if (!bufObj)
return NULL;
- return _mesa_map_buffer_range(ctx, bufObj, 0, bufObj->Size, accessFlags,
- "glMapNamedBuffer");
+ return map_buffer_range(ctx, bufObj, 0, bufObj->Size, accessFlags,
+ "glMapNamedBuffer");
}
void
_mesa_flush_mapped_buffer_range(struct gl_context *ctx,
struct gl_buffer_object *bufObj,
GLintptr offset, GLsizeiptr length,
const char *func)
{
if (!ctx->Extensions.ARB_map_buffer_range) {
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
index 259de94..f9d8874 100644
--- a/src/mesa/main/bufferobj.h
+++ b/src/mesa/main/bufferobj.h
@@ -151,26 +151,20 @@ extern void
_mesa_buffer_unmap_all_mappings(struct gl_context *ctx,
struct gl_buffer_object *bufObj);
extern void
_mesa_copy_buffer_sub_data(struct gl_context *ctx,
struct gl_buffer_object *src,
struct gl_buffer_object *dst,
GLintptr readOffset, GLintptr writeOffset,
GLsizeiptr size, const char *func);
-extern void *
-_mesa_map_buffer_range(struct gl_context *ctx,
- struct gl_buffer_object *bufObj,
- GLintptr offset, GLsizeiptr length,
- GLbitfield access, const char *func);
-
extern void
_mesa_flush_mapped_buffer_range(struct gl_context *ctx,
struct gl_buffer_object *bufObj,
GLintptr offset, GLsizeiptr length,
const char *func);
extern void
_mesa_ClearBufferSubData_sw(struct gl_context *ctx,
GLintptr offset, GLsizeiptr size,
const GLvoid *clearValue,
--
2.9.3
More information about the mesa-dev
mailing list