diff options
author | Pierre-Eric Pelloux-Prayer <[email protected]> | 2019-05-28 10:27:52 +0200 |
---|---|---|
committer | Pierre-Eric Pelloux-Prayer <[email protected]> | 2019-10-18 10:26:26 +0200 |
commit | eaeab0a99845f3fb6a5ff70d4e275b31df506a0e (patch) | |
tree | 9628b203aded2593736f600985657363bad46daf /src/mesa/main/attrib.c | |
parent | 01666ad206fbb4ab5e95667af6b73d405629f05b (diff) |
mesa: add EXT_dsa glClientAttribDefaultEXT / glPushClientAttribDefaultEXT
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/main/attrib.c')
-rw-r--r-- | src/mesa/main/attrib.c | 75 |
1 files changed, 75 insertions, 0 deletions
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. |