mesa: add support for glMapNamedBufferEXT()
authorTimothy Arceri <tarceri@itsqueeze.com>
Wed, 5 Sep 2018 05:48:07 +0000 (15:48 +1000)
committerMarek Olšák <marek.olsak@amd.com>
Fri, 28 Jun 2019 19:41:24 +0000 (15:41 -0400)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
src/mapi/glapi/gen/EXT_direct_state_access.xml
src/mapi/glapi/gen/static_data.py
src/mesa/main/bufferobj.c
src/mesa/main/bufferobj.h
src/mesa/main/tests/dispatch_sanity.cpp

index eb5c20dd108de7308a3b3728bdc6f317b62c350a..37f443bb9b50ebbd1c41e0d17a55e9e64724474d 100644 (file)
       <param name="data" type="const GLvoid *" />
    </function>
 
+   <function name="MapNamedBufferEXT">
+      <return type="GLvoid *" />
+      <param name="buffer" type="GLuint" />
+      <param name="access" type="GLenum" />
+   </function>
+
    <function name="UnmapNamedBufferEXT">
       <return type="GLboolean" />
       <param name="buffer" type="GLuint" />
index 5829da0b51e38a8be44c8883688a4cfe4738ac7f..006b5bb8152636890f1dad3fa34b8729f83c6d22 100644 (file)
@@ -1480,6 +1480,7 @@ offsets = {
     "MapNamedBufferRangeEXT": 1444,
     "TextureSubImage2DEXT": 1445,
     "CompressedTextureSubImage2DEXT": 1446,
+    "MapNamedBufferEXT": 1447,
 }
 
 functions = [
index cd4bd36810a25bff15c9643e5151b6c4b58cdeed..b15e9f36e14c1ff0ac192b95d9f6e98358f67d69 100644 (file)
@@ -3425,6 +3425,29 @@ _mesa_MapNamedBuffer(GLuint buffer, GLenum access)
                            "glMapNamedBuffer");
 }
 
+void * GLAPIENTRY
+_mesa_MapNamedBufferEXT(GLuint buffer, GLenum access)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   GLbitfield accessFlags;
+   if (!get_map_buffer_access_flags(ctx, access, &accessFlags)) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glMapNamedBufferEXT(invalid access)");
+      return NULL;
+   }
+
+   struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+   if (!_mesa_handle_bind_buffer_gen(ctx, buffer,
+                                     &bufObj, "glMapNamedBufferEXT"))
+      return NULL;
+
+   if (!validate_map_buffer_range(ctx, bufObj, 0, bufObj->Size, accessFlags,
+                                  "glMapNamedBufferEXT"))
+      return NULL;
+
+   return map_buffer_range(ctx, bufObj, 0, bufObj->Size, accessFlags,
+                           "glMapNamedBufferEXT");
+}
 
 static void
 flush_mapped_buffer_range(struct gl_context *ctx,
index 91df7e9c231b37a3e846f7d1f3591dbbfdd6e1b4..6dca61ea0ab20203c4a14669f03f4c32333a590a 100644 (file)
@@ -370,6 +370,8 @@ void * GLAPIENTRY
 _mesa_MapNamedBuffer_no_error(GLuint buffer, GLenum access);
 void * GLAPIENTRY
 _mesa_MapNamedBuffer(GLuint buffer, GLenum access);
+void * GLAPIENTRY
+_mesa_MapNamedBufferEXT(GLuint buffer, GLenum access);
 
 void GLAPIENTRY
 _mesa_FlushMappedBufferRange_no_error(GLenum target, GLintptr offset,
index b29dbdb7652d28784792389544436663a7771698..a524c58caf4014a312058a01c4d175e0661d7bbc 100644 (file)
@@ -1127,7 +1127,7 @@ const struct function common_desktop_functions_possible[] = {
    /* GL_EXT_direct_state_access - GL 1.5 */
    { "glNamedBufferDataEXT", 15, -1 },
    { "glNamedBufferSubDataEXT", 15, -1 },
-   //{ "glMapNamedBufferEXT", 15, -1 },
+   { "glMapNamedBufferEXT", 15, -1 },
    { "glUnmapNamedBufferEXT", 15, -1 },
    //{ "glGetNamedBufferParameterivEXT", 15, -1 },
    //{ "glGetNamedBufferPointervEXT", 15, -1 },