From 83ed9485b75c92e269c000a5d184393fbe4cbd77 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Fri, 18 May 2018 15:20:35 +1000 Subject: [PATCH] mesa: add support for glNamedBuffer*DataEXT() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák Signed-off-by: Marek Olšák --- .../glapi/gen/EXT_direct_state_access.xml | 17 +++++++++- src/mapi/glapi/gen/static_data.py | 2 ++ src/mesa/main/bufferobj.c | 31 +++++++++++++++++++ src/mesa/main/bufferobj.h | 6 ++++ src/mesa/main/tests/dispatch_sanity.cpp | 4 +-- 5 files changed, 57 insertions(+), 3 deletions(-) diff --git a/src/mapi/glapi/gen/EXT_direct_state_access.xml b/src/mapi/glapi/gen/EXT_direct_state_access.xml index 73d8d973a8c..a19677cde10 100644 --- a/src/mapi/glapi/gen/EXT_direct_state_access.xml +++ b/src/mapi/glapi/gen/EXT_direct_state_access.xml @@ -129,6 +129,21 @@ - + + + + + + + + + + + + + + + + diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py index e189eb3ac4e..92a07abd9db 100644 --- a/src/mapi/glapi/gen/static_data.py +++ b/src/mapi/glapi/gen/static_data.py @@ -1474,6 +1474,8 @@ offsets = { "MatrixMultTransposefEXT": 1438, "MatrixMultTransposedEXT": 1439, "BindMultiTextureEXT": 1440, + "NamedBufferDataEXT": 1441, + "NamedBufferSubDataEXT": 1442, } functions = [ diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index e65c577e427..6b8a2111a8f 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -2169,6 +2169,20 @@ _mesa_NamedBufferData(GLuint buffer, GLsizeiptr size, const GLvoid *data, "glNamedBufferData"); } +void GLAPIENTRY +_mesa_NamedBufferDataEXT(GLuint buffer, GLsizeiptr size, const GLvoid *data, + GLenum usage) +{ + GET_CURRENT_CONTEXT(ctx); + + struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, buffer); + if (!_mesa_handle_bind_buffer_gen(ctx, buffer, + &bufObj, "glNamedBufferDataEXT")) + return; + + _mesa_buffer_data(ctx, bufObj, GL_NONE, size, data, usage, + "glNamedBufferDataEXT"); +} static bool validate_buffer_sub_data(struct gl_context *ctx, @@ -2297,6 +2311,23 @@ _mesa_NamedBufferSubData(GLuint buffer, GLintptr offset, "glNamedBufferSubData"); } +void GLAPIENTRY +_mesa_NamedBufferSubDataEXT(GLuint buffer, GLintptr offset, + GLsizeiptr size, const GLvoid *data) +{ + GET_CURRENT_CONTEXT(ctx); + + struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, buffer); + if (!_mesa_handle_bind_buffer_gen(ctx, buffer, + &bufObj, "glNamedBufferSubDataEXT")) + return; + + if (validate_buffer_sub_data(ctx, bufObj, offset, size, + "glNamedBufferSubDataEXT")) { + _mesa_buffer_sub_data(ctx, bufObj, offset, size, data); + } +} + void GLAPIENTRY _mesa_GetBufferSubData(GLenum target, GLintptr offset, diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h index 74538648540..74124649bb6 100644 --- a/src/mesa/main/bufferobj.h +++ b/src/mesa/main/bufferobj.h @@ -222,6 +222,9 @@ _mesa_NamedBufferData_no_error(GLuint buffer, GLsizeiptr size, void GLAPIENTRY _mesa_NamedBufferData(GLuint buffer, GLsizeiptr size, const GLvoid *data, GLenum usage); +void GLAPIENTRY +_mesa_NamedBufferDataEXT(GLuint buffer, GLsizeiptr size, + const GLvoid *data, GLenum usage); void GLAPIENTRY _mesa_BufferSubData_no_error(GLenum target, GLintptr offset, @@ -236,6 +239,9 @@ _mesa_NamedBufferSubData_no_error(GLuint buffer, GLintptr offset, void GLAPIENTRY _mesa_NamedBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr size, const GLvoid *data); +void GLAPIENTRY +_mesa_NamedBufferSubDataEXT(GLuint buffer, GLintptr offset, + GLsizeiptr size, const GLvoid *data); void GLAPIENTRY _mesa_GetBufferSubData(GLenum target, GLintptr offset, diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index eb0f217a1d2..0fba8d19fe3 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -1126,8 +1126,8 @@ const struct function common_desktop_functions_possible[] = { { "glMatrixMultTransposefEXT", 13, -1 }, { "glMatrixMultTransposedEXT", 13, -1 }, /* GL_EXT_direct_state_access - GL 1.5 */ - //{ "glNamedBufferDataEXT", 15, -1 }, - //{ "glNamedBufferSubDataEXT", 15, -1 }, + { "glNamedBufferDataEXT", 15, -1 }, + { "glNamedBufferSubDataEXT", 15, -1 }, //{ "glMapNamedBufferEXT", 15, -1 }, //{ "glUnmapNamedBufferEXT", 15, -1 }, //{ "glGetNamedBufferParameterivEXT", 15, -1 }, -- 2.30.2