summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/bufferobj.c
diff options
context:
space:
mode:
authorLaura Ekstrand <[email protected]>2015-02-11 14:09:52 -0800
committerLaura Ekstrand <[email protected]>2015-03-17 10:18:34 -0700
commita0cc03929e754692ae593df5072d144460434297 (patch)
tree9c78d2fa83dc022ed00147eee6acfcb135528cfb /src/mesa/main/bufferobj.c
parent4f513bc330393c4615b4bad98e3e634408123960 (diff)
main: Add entry points for MapNamedBuffer[Range].
Reviewed-by: Fredrik Höglund <[email protected]>
Diffstat (limited to 'src/mesa/main/bufferobj.c')
-rw-r--r--src/mesa/main/bufferobj.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index d37e4a52b43..0d1a69053ec 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -2346,6 +2346,28 @@ _mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length,
"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");
+}
+
/**
* Converts GLenum access from MapBuffer and MapNamedBuffer into
* flags for input to _mesa_map_buffer_range.
@@ -2391,6 +2413,26 @@ _mesa_MapBuffer(GLenum target, GLenum access)
"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");
+}
+
/**
* See GL_ARB_map_buffer_range spec