From: Timothy Arceri Date: Wed, 5 Sep 2018 05:48:07 +0000 (+1000) Subject: mesa: add support for glMapNamedBufferEXT() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9c53a2ecb7d5c6c51abf12d7488e75ebd27d0c9d;p=mesa.git mesa: add support for glMapNamedBufferEXT() Reviewed-by: Marek Olšák Signed-off-by: Marek Olšák --- diff --git a/src/mapi/glapi/gen/EXT_direct_state_access.xml b/src/mapi/glapi/gen/EXT_direct_state_access.xml index eb5c20dd108..37f443bb9b5 100644 --- a/src/mapi/glapi/gen/EXT_direct_state_access.xml +++ b/src/mapi/glapi/gen/EXT_direct_state_access.xml @@ -174,6 +174,12 @@ + + + + + + diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py index 5829da0b51e..006b5bb8152 100644 --- a/src/mapi/glapi/gen/static_data.py +++ b/src/mapi/glapi/gen/static_data.py @@ -1480,6 +1480,7 @@ offsets = { "MapNamedBufferRangeEXT": 1444, "TextureSubImage2DEXT": 1445, "CompressedTextureSubImage2DEXT": 1446, + "MapNamedBufferEXT": 1447, } functions = [ diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index cd4bd36810a..b15e9f36e14 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -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, diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h index 91df7e9c231..6dca61ea0ab 100644 --- a/src/mesa/main/bufferobj.h +++ b/src/mesa/main/bufferobj.h @@ -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, diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index b29dbdb7652..a524c58caf4 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -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 },