From 1ef297645c9f22d7f44e019b5a9ca09a84030f49 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Thu, 7 Nov 2019 14:25:19 +0100 Subject: [PATCH] mesa: add ARB_sparse_buffer NamedBufferPageCommitmentEXT function MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- 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 @@ - - + + + + + + + + @@ -21,7 +27,7 @@ - + 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 }, -- 2.30.2