mesa: for every state change, remember states we changed for glPopAttrib

The idea is to restore only those states in glPopAttrib that have been
changed. This will reduce glPopAttrib overhead a lot.

This is based on the state tables in the OpenGL 4.6 Compatibility Profile
specification and many extension specifications.

This code might superfluously flag GL_TEXTURE_BIT for texture and
sampler functions that don't have effect on states popped by glPopAttrib,
but I don't wanna test my luck and make a mistake. Thus,
if _NEW_TEXTURE_OBJECT if flagged, GL_TEXTURE_BIT is usually flagged too.

This has no effect on glPopAttrib yet. glPopAttrib will use this in a later
commit. This only adds attrib masks into FLUSH_VERTICES based on specs.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8181>
This commit is contained in:
Marek Olšák
2020-12-19 01:37:40 -05:00
parent a1f16b59b3
commit 674d275f59
64 changed files with 455 additions and 353 deletions

View File

@@ -181,7 +181,7 @@ _mesa_notifySwapBuffers(struct gl_context *ctx)
{
if (MESA_VERBOSE & VERBOSE_SWAPBUFFERS)
_mesa_debug(ctx, "SwapBuffers\n");
FLUSH_VERTICES(ctx, 0);
FLUSH_VERTICES(ctx, 0, 0);
if (ctx->Driver.Flush) {
ctx->Driver.Flush(ctx);
}
@@ -1868,7 +1868,7 @@ _mesa_get_dispatch(struct gl_context *ctx)
void
_mesa_flush(struct gl_context *ctx)
{
FLUSH_VERTICES( ctx, 0 );
FLUSH_VERTICES(ctx, 0, 0);
if (ctx->Driver.Flush) {
ctx->Driver.Flush(ctx);
}
@@ -1888,7 +1888,7 @@ _mesa_Finish(void)
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_VERTICES(ctx, 0);
FLUSH_VERTICES(ctx, 0, 0);
if (ctx->Driver.Finish) {
ctx->Driver.Finish(ctx);