mesa: add ARB_sparse_buffer NamedBufferPageCommitmentEXT function
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Thu, 7 Nov 2019 13:25:19 +0000 (14:25 +0100)
committerPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Tue, 19 Nov 2019 07:49:45 +0000 (08:49 +0100)
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@amd.com>
docs/features.txt
src/mapi/glapi/gen/ARB_sparse_buffer.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 1661e41492d52066074bd7f9a173828b296540d1..14eb2ad48f23fd62431460649592d51675526e98 100644 (file)
@@ -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
index 90bc659fdaf29099b2820a2308d8dfdb436274a9..98da8bdc8caa0d0f8c62bd2a8d11f94f770428c9 100644 (file)
         <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"/>
 
index 335fc87576d359ab2d324a8c6039f84847360d88..176df719a23c118d0b2d6799a3b74475065089a9 100644 (file)
@@ -1631,6 +1631,7 @@ offsets = {
     "VertexArrayVertexAttribLFormatEXT": 1595,
     "VertexArrayVertexAttribBindingEXT": 1596,
     "VertexArrayVertexBindingDivisorEXT": 1597,
+    "NamedBufferPageCommitmentEXT": 1598,
 }
 
 functions = [
index 73b210d105ad1e68658e2cb957fbeb87f34bf0bb..b5d6bb188d93aa3cd6f9a1291d5347957fae1c01 100644 (file)
@@ -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");
+}
index 23c4f20f3e2bfe3716e318613329e1cb0b6aa62d..588a6a7449bfb10021a0d74328789a2ead258b65 100644 (file)
@@ -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
index 66b77d09598caa7c4ac403b79bbe52a4fadb773b..8b892c6fec2748629ee6aa0b07a3b6eeb800b706 100644 (file)
@@ -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 },