Mesa (master): main: Add entry points for MapNamedBuffer[Range].
Laura Ekstrand
ldeks at kemper.freedesktop.org
Tue Mar 17 17:20:05 UTC 2015
Module: Mesa
Branch: master
Commit: a0cc03929e754692ae593df5072d144460434297
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a0cc03929e754692ae593df5072d144460434297
Author: Laura Ekstrand <laura at jlekstrand.net>
Date: Wed Feb 11 14:09:52 2015 -0800
main: Add entry points for MapNamedBuffer[Range].
Reviewed-by: Fredrik Höglund <fredrik at kde.org>
---
src/mapi/glapi/gen/ARB_direct_state_access.xml | 14 ++++++++
src/mesa/main/bufferobj.c | 42 ++++++++++++++++++++++++
src/mesa/main/bufferobj.h | 14 ++++++--
src/mesa/main/tests/dispatch_sanity.cpp | 2 ++
4 files changed, 69 insertions(+), 3 deletions(-)
diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml
index ce4017b..557316a 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -61,6 +61,20 @@
<param name="data" type="const GLvoid *" />
</function>
+ <function name="MapNamedBuffer" offset="assign">
+ <return type="GLvoid *" />
+ <param name="buffer" type="GLuint" />
+ <param name="access" type="GLenum" />
+ </function>
+
+ <function name="MapNamedBufferRange" offset="assign">
+ <return type="GLvoid *" />
+ <param name="buffer" type="GLuint" />
+ <param name="offset" type="GLintptr" />
+ <param name="length" type="GLsizeiptr" />
+ <param name="access" type="GLbitfield" />
+ </function>
+
<!-- Texture object functions -->
<function name="CreateTextures" offset="assign">
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index d37e4a5..0d1a690 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
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
index 3584a80..6305b5c 100644
--- a/src/mesa/main/bufferobj.h
+++ b/src/mesa/main/bufferobj.h
@@ -245,9 +245,6 @@ _mesa_ClearNamedBufferSubData(GLuint buffer, GLenum internalformat,
GLenum format, GLenum type,
const GLvoid *data);
-void * GLAPIENTRY
-_mesa_MapBuffer(GLenum target, GLenum access);
-
GLboolean GLAPIENTRY
_mesa_UnmapBuffer(GLenum target);
@@ -274,6 +271,17 @@ void * GLAPIENTRY
_mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length,
GLbitfield access);
+void * GLAPIENTRY
+_mesa_MapNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length,
+ GLbitfield access);
+
+void * GLAPIENTRY
+_mesa_MapBuffer(GLenum target, GLenum access);
+
+void * GLAPIENTRY
+_mesa_MapNamedBuffer(GLuint buffer, GLenum access);
+
+
void GLAPIENTRY
_mesa_FlushMappedBufferRange(GLenum target,
GLintptr offset, GLsizeiptr length);
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index aff5cd6..bda761a 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -960,6 +960,8 @@ const struct function gl_core_functions_possible[] = {
{ "glCopyNamedBufferSubData", 45, -1 },
{ "glClearNamedBufferData", 45, -1 },
{ "glClearNamedBufferSubData", 45, -1 },
+ { "glMapNamedBuffer", 45, -1 },
+ { "glMapNamedBufferRange", 45, -1 },
{ "glCreateTextures", 45, -1 },
{ "glTextureStorage1D", 45, -1 },
{ "glTextureStorage2D", 45, -1 },
More information about the mesa-commit
mailing list