Mesa (master): mesa: add ARB_sparse_buffer NamedBufferPageCommitmentEXT function

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Nov 19 08:24:14 UTC 2019


Module: Mesa
Branch: master
Commit: 1ef297645c9f22d7f44e019b5a9ca09a84030f49
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1ef297645c9f22d7f44e019b5a9ca09a84030f49

Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date:   Thu Nov  7 14:25:19 2019 +0100

mesa: add ARB_sparse_buffer NamedBufferPageCommitmentEXT function

The spec is unclear on how to handle the buffer argument so we reuse
the logic from the EXT_direct_state_access spec.

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 docs/features.txt                        |  2 +-
 src/mapi/glapi/gen/ARB_sparse_buffer.xml | 12 +++++++++---
 src/mapi/glapi/gen/static_data.py        |  1 +
 src/mesa/main/bufferobj.c                | 20 ++++++++++++++++++++
 src/mesa/main/bufferobj.h                |  4 ++++
 src/mesa/main/tests/dispatch_sanity.cpp  |  1 +
 6 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/docs/features.txt b/docs/features.txt
index 1661e41492d..14eb2ad48f2 100644
--- a/docs/features.txt
+++ b/docs/features.txt
@@ -383,7 +383,7 @@ GL_EXT_direct_state_access additions from other extensions (complete list):
   GL_ARB_instanced_arrays                               DONE
   GL_ARB_internalformat_query2                          DONE
   GL_ARB_sparse_texture                                 n/a
-  GL_ARB_sparse_buffer                                  not started
+  GL_ARB_sparse_buffer                                  DONE
   GL_ARB_texture_buffer_range                           DONE
   GL_ARB_texture_storage                                DONE
   GL_ARB_texture_storage_multisample                    DONE
diff --git a/src/mapi/glapi/gen/ARB_sparse_buffer.xml b/src/mapi/glapi/gen/ARB_sparse_buffer.xml
index 90bc659fdaf..98da8bdc8ca 100644
--- a/src/mapi/glapi/gen/ARB_sparse_buffer.xml
+++ b/src/mapi/glapi/gen/ARB_sparse_buffer.xml
@@ -12,8 +12,14 @@
         <param name="commit" type="GLboolean"/>
     </function>
 
-    <!-- Only with GL_EXT_direct_state_access: glNamedBufferPageCommitmentEXT -->
-    
+    <!-- Only with GL_EXT_direct_state_access -->
+    <function name="NamedBufferPageCommitmentEXT">
+        <param name="buffer" type="GLuint"/>
+        <param name="offset" type="GLintptr"/>
+        <param name="size" type="GLsizeiptr"/>
+        <param name="commit" type="GLboolean"/>
+    </function>
+
     <!-- Only with GL_ARB_direct_state_access -->
     <function name="NamedBufferPageCommitmentARB">
         <param name="buffer" type="GLuint"/>
@@ -21,7 +27,7 @@
         <param name="size" type="GLsizeiptr"/>
         <param name="commit" type="GLboolean"/>
     </function>
-    
+
     <enum name="SPARSE_STORAGE_BIT_ARB" value="0x0400"/>
     <enum name="SPARSE_BUFFER_PAGE_SIZE_ARB" value="0x82F8"/>
 
diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py
index 335fc87576d..176df719a23 100644
--- a/src/mapi/glapi/gen/static_data.py
+++ b/src/mapi/glapi/gen/static_data.py
@@ -1631,6 +1631,7 @@ offsets = {
     "VertexArrayVertexAttribLFormatEXT": 1595,
     "VertexArrayVertexAttribBindingEXT": 1596,
     "VertexArrayVertexBindingDivisorEXT": 1597,
+    "NamedBufferPageCommitmentEXT": 1598,
 }
 
 functions = [
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 73b210d105a..b5d6bb188d9 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -4954,3 +4954,23 @@ _mesa_NamedBufferPageCommitmentARB(GLuint buffer, GLintptr offset,
    buffer_page_commitment(ctx, bufferObj, offset, size, commit,
                           "glNamedBufferPageCommitmentARB");
 }
+
+void GLAPIENTRY
+_mesa_NamedBufferPageCommitmentEXT(GLuint buffer, GLintptr offset,
+                                   GLsizeiptr size, GLboolean commit)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_buffer_object *bufferObj;
+
+   /* Use NamedBuffer* functions logic from EXT_direct_state_access */
+   if (buffer != 0) {
+      bufferObj = _mesa_lookup_bufferobj(ctx, buffer);
+      if (!_mesa_handle_bind_buffer_gen(ctx, buffer, &bufferObj,
+                                        "glNamedBufferPageCommitmentEXT"))
+         return;
+   } else {
+      bufferObj = ctx->Shared->NullBufferObj;
+   }
+   buffer_page_commitment(ctx, bufferObj, offset, size, commit,
+                          "glNamedBufferPageCommitmentEXT");
+}
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
index 23c4f20f3e2..588a6a7449b 100644
--- a/src/mesa/main/bufferobj.h
+++ b/src/mesa/main/bufferobj.h
@@ -457,4 +457,8 @@ void GLAPIENTRY
 _mesa_NamedBufferPageCommitmentARB(GLuint buffer, GLintptr offset,
                                    GLsizeiptr size, GLboolean commit);
 
+void GLAPIENTRY
+_mesa_NamedBufferPageCommitmentEXT(GLuint buffer, GLintptr offset,
+                                   GLsizeiptr size, GLboolean commit);
+
 #endif
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index 66b77d09598..8b892c6fec2 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -1299,6 +1299,7 @@ const struct function common_desktop_functions_possible[] = {
    /* GL_ARB_sparse_buffer */
    { "glBufferPageCommitmentARB", 43, -1 },
    { "glNamedBufferPageCommitmentARB", 43, -1 },
+   { "glNamedBufferPageCommitmentEXT", 43, -1 },
 
    /* GL_ARB_bindless_texture */
    { "glGetTextureHandleARB", 40, -1 },




More information about the mesa-commit mailing list