[Mesa-dev] [PATCH 19/21] main: Add entry point for GetNamedBufferPointerv.

Laura Ekstrand laura at jlekstrand.net
Wed Jan 21 17:40:32 PST 2015


---
 src/mapi/glapi/gen/ARB_direct_state_access.xml |  6 ++++++
 src/mesa/main/bufferobj.c                      | 27 +++++++++++++++++++++++---
 src/mesa/main/bufferobj.h                      |  4 ++++
 src/mesa/main/tests/dispatch_sanity.cpp        |  1 +
 4 files changed, 35 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 46f4e9a..9cfc8e5 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -98,6 +98,12 @@
       <param name="params" type="GLint64 *" />
    </function>
 
+   <function name="GetNamedBufferPointerv" offset="assign">
+      <param name="buffer" type="GLuint" />
+      <param name="pname" type="GLenum" />
+      <param name="params" type="GLvoid **" />
+   </function>
+
   <!-- Texture object functions -->
 
    <function name="CreateTextures" offset="assign">
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 51b5d59..5495057 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1977,14 +1977,15 @@ void GLAPIENTRY
 _mesa_GetBufferPointerv(GLenum target, GLenum pname, GLvoid **params)
 {
    GET_CURRENT_CONTEXT(ctx);
-   struct gl_buffer_object * bufObj;
+   struct gl_buffer_object *bufObj;
 
    if (pname != GL_BUFFER_MAP_POINTER_ARB) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferPointervARB(pname)");
+      _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferPointerv(pname != "
+                  "GL_BUFFER_MAP_POINTER)");
       return;
    }
 
-   bufObj = get_buffer(ctx, "glGetBufferPointervARB", target,
+   bufObj = get_buffer(ctx, "glGetBufferPointerv", target,
                        GL_INVALID_OPERATION);
    if (!bufObj)
       return;
@@ -1992,6 +1993,26 @@ _mesa_GetBufferPointerv(GLenum target, GLenum pname, GLvoid **params)
    *params = bufObj->Mappings[MAP_USER].Pointer;
 }
 
+void GLAPIENTRY
+_mesa_GetNamedBufferPointerv(GLuint buffer, GLenum pname, GLvoid **params)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_buffer_object *bufObj;
+
+   if (pname != GL_BUFFER_MAP_POINTER_ARB) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glGetNamedBufferPointerv(pname != "
+                  "GL_BUFFER_MAP_POINTER)");
+      return;
+   }
+
+   bufObj = _mesa_lookup_bufferobj_err(ctx, buffer,
+                                       "glGetNamedBufferPointerv");
+   if (!bufObj)
+      return;
+
+   *params = bufObj->Mappings[MAP_USER].Pointer;
+}
+
 
 void
 _mesa_copy_buffer_sub_data(struct gl_context *ctx,
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
index e55de54..60f5607 100644
--- a/src/mesa/main/bufferobj.h
+++ b/src/mesa/main/bufferobj.h
@@ -278,6 +278,10 @@ void GLAPIENTRY
 _mesa_GetBufferPointerv(GLenum target, GLenum pname, GLvoid **params);
 
 void GLAPIENTRY
+_mesa_GetNamedBufferPointerv(GLuint buffer, GLenum pname, GLvoid **params);
+
+
+void GLAPIENTRY
 _mesa_CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
                         GLintptr readOffset, GLintptr writeOffset,
                         GLsizeiptr size);
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index 7d53ba4..4d5cb6a 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -968,6 +968,7 @@ const struct function gl_core_functions_possible[] = {
    { "glFlushMappedNamedBufferRange", 45, -1 },
    { "glGetNamedBufferParameteriv", 45, -1 },
    { "glGetNamedBufferParameteri64v", 45, -1 },
+   { "glGetNamedBufferPointerv", 45, -1 },
    { "glCreateTextures", 45, -1 },
    { "glTextureStorage1D", 45, -1 },
    { "glTextureStorage2D", 45, -1 },
-- 
2.1.0



More information about the mesa-dev mailing list