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@amd.com>
This commit is contained in:
Pierre-Eric Pelloux-Prayer 2019-11-07 14:25:19 +01:00
parent 8b6d19413f
commit 1ef297645c
6 changed files with 36 additions and 4 deletions

View 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

View File

@ -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"/>

View File

@ -1631,6 +1631,7 @@ offsets = {
"VertexArrayVertexAttribLFormatEXT": 1595,
"VertexArrayVertexAttribBindingEXT": 1596,
"VertexArrayVertexBindingDivisorEXT": 1597,
"NamedBufferPageCommitmentEXT": 1598,
}
functions = [

View 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");
}

View 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

View 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 },