From 2bdf809e66d16ff571eafa90f7607793ba65266b Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Mon, 9 Sep 2019 16:22:29 +0200 Subject: [PATCH] mesa: add EXT_dsa + EXT_texture_buffer_object functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák --- .../glapi/gen/EXT_direct_state_access.xml | 14 +++++ src/mapi/glapi/gen/static_data.py | 2 + src/mesa/main/tests/dispatch_sanity.cpp | 4 +- src/mesa/main/teximage.c | 59 +++++++++++++++++++ src/mesa/main/teximage.h | 8 +++ 5 files changed, 85 insertions(+), 2 deletions(-) diff --git a/src/mapi/glapi/gen/EXT_direct_state_access.xml b/src/mapi/glapi/gen/EXT_direct_state_access.xml index c35eacadeed..6a26a43dba2 100644 --- a/src/mapi/glapi/gen/EXT_direct_state_access.xml +++ b/src/mapi/glapi/gen/EXT_direct_state_access.xml @@ -1085,5 +1085,19 @@ + + + + + + + + + + + + + + diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py index 2116a1b38a5..ae041817bb3 100644 --- a/src/mapi/glapi/gen/static_data.py +++ b/src/mapi/glapi/gen/static_data.py @@ -1582,6 +1582,8 @@ offsets = { "NamedProgramLocalParameter4dvEXT": 1546, "GetNamedProgramLocalParameterdvEXT": 1547, "GetNamedProgramivEXT": 1548, + "TextureBufferEXT": 1549, + "MultiTexBufferEXT": 1550, } functions = [ diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index 8e06a7179dd..e0451b36df3 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -1137,8 +1137,8 @@ const struct function common_desktop_functions_possible[] = { /* GL_EXT_direct_state_access - GL 2.1 */ /* Added glProgramUniformMAtrix*EXT functions are aliases */ /* GL_EXT_direct_state_access - EXT_texture_buffer_object */ - //{ "glTextureBufferEXT", 10, -1 }, - //{ "glMultiTexBufferEXT", 10, -1 }, + { "glTextureBufferEXT", 10, -1 }, + { "glMultiTexBufferEXT", 10, -1 }, /* GL_EXT_direct_state_access - EXT_texture_integer */ //{ "glTextureParameterIivEXT", 10, -1 }, //{ "glTextureParameterIuivEXT", 10, -1 }, diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index b80d5a9b675..67500830853 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -6428,6 +6428,65 @@ _mesa_TextureBuffer(GLuint texture, GLenum internalFormat, GLuint buffer) bufObj, 0, buffer ? -1 : 0, "glTextureBuffer"); } +void GLAPIENTRY +_mesa_TextureBufferEXT(GLuint texture, GLenum target, + GLenum internalFormat, GLuint buffer) +{ + struct gl_texture_object *texObj; + struct gl_buffer_object *bufObj; + + GET_CURRENT_CONTEXT(ctx); + + if (buffer) { + bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glTextureBuffer"); + if (!bufObj) + return; + } else + bufObj = NULL; + + /* Get the texture object by Name. */ + texObj = _mesa_lookup_or_create_texture(ctx, target, texture, + false, true, + "glTextureBufferEXT"); + + if (!texObj || + !check_texture_buffer_target(ctx, texObj->Target, "glTextureBufferEXT")) + return; + + texture_buffer_range(ctx, texObj, internalFormat, + bufObj, 0, buffer ? -1 : 0, "glTextureBufferEXT"); +} + +void GLAPIENTRY +_mesa_MultiTexBufferEXT(GLenum texunit, GLenum target, + GLenum internalFormat, GLuint buffer) +{ + struct gl_texture_object *texObj; + struct gl_buffer_object *bufObj; + + GET_CURRENT_CONTEXT(ctx); + + if (buffer) { + bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glMultiTexBufferEXT"); + if (!bufObj) + return; + } else + bufObj = NULL; + + /* Get the texture object */ + texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target, + texunit - GL_TEXTURE0, + true, + "glMultiTexBufferEXT"); + + if (!texObj || + !check_texture_buffer_target(ctx, texObj->Target, "glMultiTexBufferEXT")) + return; + + texture_buffer_range(ctx, texObj, internalFormat, + bufObj, 0, buffer ? -1 : 0, "glMultiTexBufferEXT"); +} + void GLAPIENTRY _mesa_TextureBufferRange(GLuint texture, GLenum internalFormat, GLuint buffer, GLintptr offset, GLsizeiptr size) diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h index 51d555584c9..b14acdf7597 100644 --- a/src/mesa/main/teximage.h +++ b/src/mesa/main/teximage.h @@ -787,6 +787,14 @@ _mesa_TexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer, extern void GLAPIENTRY _mesa_TextureBuffer(GLuint texture, GLenum internalFormat, GLuint buffer); +extern void GLAPIENTRY +_mesa_TextureBufferEXT(GLuint texture, GLenum target, GLenum internalFormat, + GLuint buffer); + +extern void GLAPIENTRY +_mesa_MultiTexBufferEXT(GLenum texunit, GLenum target, GLenum internalFormat, + GLuint buffer); + extern void GLAPIENTRY _mesa_TextureBufferRange(GLuint texture, GLenum internalFormat, GLuint buffer, GLintptr offset, GLsizeiptr size); -- 2.30.2