From eaeab0a99845f3fb6a5ff70d4e275b31df506a0e Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Tue, 28 May 2019 10:27:52 +0200 Subject: [PATCH] mesa: add EXT_dsa glClientAttribDefaultEXT / glPushClientAttribDefaultEXT 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 | 8 ++ src/mapi/glapi/gen/static_data.py | 2 + src/mesa/main/attrib.c | 75 +++++++++++++++++++ src/mesa/main/attrib.h | 6 ++ src/mesa/main/tests/dispatch_sanity.cpp | 4 +- 5 files changed, 93 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 d01521b75d1..28cc9b91b0f 100644 --- a/src/mapi/glapi/gen/EXT_direct_state_access.xml +++ b/src/mapi/glapi/gen/EXT_direct_state_access.xml @@ -102,6 +102,14 @@ + + + + + + + + diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py index bd37a34f6f6..141eb8ff7ff 100644 --- a/src/mapi/glapi/gen/static_data.py +++ b/src/mapi/glapi/gen/static_data.py @@ -1571,6 +1571,8 @@ offsets = { "GetFramebufferParameterivMESA": 1535, "NamedRenderbufferStorageEXT": 1536, "GetNamedRenderbufferParameterivEXT": 1537, + "ClientAttribDefaultEXT": 1538, + "PushClientAttribDefaultEXT": 1539, } functions = [ diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index fe6c5a00460..b2756354f1f 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -43,6 +43,7 @@ #include "macros.h" #include "matrix.h" #include "multisample.h" +#include "pixelstore.h" #include "points.h" #include "polygon.h" #include "shared.h" @@ -1852,6 +1853,80 @@ _mesa_PopClientAttrib(void) } } +void GLAPIENTRY +_mesa_ClientAttribDefaultEXT( GLbitfield mask ) +{ + if (mask & GL_CLIENT_PIXEL_STORE_BIT) { + _mesa_PixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE); + _mesa_PixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE); + _mesa_PixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0); + _mesa_PixelStorei(GL_UNPACK_SKIP_IMAGES, 0); + _mesa_PixelStorei(GL_UNPACK_ROW_LENGTH, 0); + _mesa_PixelStorei(GL_UNPACK_SKIP_ROWS, 0); + _mesa_PixelStorei(GL_UNPACK_SKIP_PIXELS, 0); + _mesa_PixelStorei(GL_UNPACK_ALIGNMENT, 4); + _mesa_PixelStorei(GL_PACK_SWAP_BYTES, GL_FALSE); + _mesa_PixelStorei(GL_PACK_LSB_FIRST, GL_FALSE); + _mesa_PixelStorei(GL_PACK_IMAGE_HEIGHT, 0); + _mesa_PixelStorei(GL_PACK_SKIP_IMAGES, 0); + _mesa_PixelStorei(GL_PACK_ROW_LENGTH, 0); + _mesa_PixelStorei(GL_PACK_SKIP_ROWS, 0); + _mesa_PixelStorei(GL_PACK_SKIP_PIXELS, 0); + _mesa_PixelStorei(GL_PACK_ALIGNMENT, 4); + + _mesa_BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); + _mesa_BindBuffer(GL_PIXEL_PACK_BUFFER, 0); + } + if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) { + GET_CURRENT_CONTEXT(ctx); + int i; + + _mesa_BindBuffer(GL_ARRAY_BUFFER, 0); + _mesa_BindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + + _mesa_DisableClientState(GL_EDGE_FLAG_ARRAY); + _mesa_EdgeFlagPointer(0, 0); + + _mesa_DisableClientState(GL_INDEX_ARRAY); + _mesa_IndexPointer(GL_FLOAT, 0, 0); + + _mesa_DisableClientState(GL_SECONDARY_COLOR_ARRAY); + _mesa_SecondaryColorPointer(4, GL_FLOAT, 0, 0); + + _mesa_DisableClientState(GL_FOG_COORD_ARRAY); + _mesa_FogCoordPointer(GL_FLOAT, 0, 0); + + for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { + _mesa_ClientActiveTexture(GL_TEXTURE0 + i); + _mesa_DisableClientState(GL_TEXTURE_COORD_ARRAY); + _mesa_TexCoordPointer(4, GL_FLOAT, 0, 0); + } + + _mesa_DisableClientState(GL_COLOR_ARRAY); + _mesa_ColorPointer(4, GL_FLOAT, 0, 0); + + _mesa_DisableClientState(GL_NORMAL_ARRAY); + _mesa_NormalPointer(GL_FLOAT, 0, 0); + + _mesa_DisableClientState(GL_VERTEX_ARRAY); + _mesa_VertexPointer(4, GL_FLOAT, 0, 0); + + for (i = 0; i < ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs; i++) { + _mesa_DisableVertexAttribArray(i); + _mesa_VertexAttribPointer(i, 4, GL_FLOAT, GL_FALSE, 0, 0); + } + + _mesa_ClientActiveTexture(GL_TEXTURE0); + } +} + +void GLAPIENTRY +_mesa_PushClientAttribDefaultEXT( GLbitfield mask ) +{ + _mesa_PushClientAttrib(mask); + _mesa_ClientAttribDefaultEXT(mask); +} + /** * Free any attribute state data that might be attached to the context. diff --git a/src/mesa/main/attrib.h b/src/mesa/main/attrib.h index f4fd4929f73..90951306fd5 100644 --- a/src/mesa/main/attrib.h +++ b/src/mesa/main/attrib.h @@ -43,6 +43,12 @@ _mesa_PushClientAttrib( GLbitfield mask ); extern void GLAPIENTRY _mesa_PopClientAttrib( void ); +extern void GLAPIENTRY +_mesa_ClientAttribDefaultEXT( GLbitfield mask ); + +extern void GLAPIENTRY +_mesa_PushClientAttribDefaultEXT( GLbitfield mask ); + extern void _mesa_init_attrib( struct gl_context *ctx ); diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index cbd65d7ba63..be322aa792e 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -1031,8 +1031,8 @@ const struct function common_desktop_functions_possible[] = { { "glMatrixPushEXT", 10, -1 }, { "glMatrixPopEXT", 10, -1 }, /* GL_EXT_direct_state_access - GL 1.1 */ - //{ "glClientAttribDefaultEXT", 11, -1 }, - //{ "glPushClientAttribDefaultEXT", 11, -1 }, + { "glClientAttribDefaultEXT", 11, -1 }, + { "glPushClientAttribDefaultEXT", 11, -1 }, { "glTextureParameteriEXT", 11, -1 }, { "glTextureParameterivEXT", 11, -1 }, { "glTextureParameterfEXT", 11, -1 }, -- 2.30.2