diff options
author | Marek Olšák <marek.olsak@amd.com> | 2020-12-19 01:37:40 -0500 |
---|---|---|
committer | Marek Olšák <marek.olsak@amd.com> | 2021-01-30 16:25:29 -0500 |
commit | 674d275f590d05f1f14dbe40a6c77b6203206ac5 (patch) | |
tree | 000743c9213b9aca92ed65a4d0403868bac81eed | |
parent | a1f16b59b3ce7e1498e08d57947bbc9cf78624ed (diff) |
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>
64 files changed, 455 insertions, 353 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index ca6e966f919..e27b31eab09 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -347,7 +347,7 @@ _mesa_meta_setup_vertex_objects(struct gl_context *ctx, GL_DYNAMIC_DRAW, __func__); /* setup vertex arrays */ - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (use_generic_attributes) { assert(color_size == 0); @@ -1077,7 +1077,7 @@ _mesa_meta_end(struct gl_context *ctx) /* restore texture objects for unit[0] only */ for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) { if (ctx->Texture.Unit[0].CurrentTex[tgt] != save->CurrentTexture[tgt]) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE); + FLUSH_VERTICES(ctx, _NEW_TEXTURE, GL_TEXTURE_BIT); _mesa_reference_texobj(&ctx->Texture.Unit[0].CurrentTex[tgt], save->CurrentTexture[tgt]); } @@ -1087,12 +1087,12 @@ _mesa_meta_end(struct gl_context *ctx) /* Restore fixed function texture enables, texgen */ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { if (ctx->Texture.FixedFuncUnit[u].Enabled != save->TexEnabled[u]) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE); + FLUSH_VERTICES(ctx, _NEW_TEXTURE, GL_TEXTURE_BIT); ctx->Texture.FixedFuncUnit[u].Enabled = save->TexEnabled[u]; } if (ctx->Texture.FixedFuncUnit[u].TexGenEnabled != save->TexGenEnabled[u]) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE); + FLUSH_VERTICES(ctx, _NEW_TEXTURE, GL_TEXTURE_BIT); ctx->Texture.FixedFuncUnit[u].TexGenEnabled = save->TexGenEnabled[u]; } } @@ -3324,7 +3324,7 @@ _mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, GL_DYNAMIC_DRAW, __func__); /* setup vertex arrays */ - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); _mesa_update_array_format(ctx, array_obj, VERT_ATTRIB_POS, 3, GL_FLOAT, GL_RGBA, GL_FALSE, GL_FALSE, GL_FALSE, @@ -3336,7 +3336,7 @@ _mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); _mesa_update_array_format(ctx, array_obj, VERT_ATTRIB_TEX(i), 2, GL_FLOAT, GL_RGBA, GL_FALSE, GL_FALSE, GL_FALSE, diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 97acef16364..5c1bf86b8c9 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -161,7 +161,7 @@ intel_dri2_flush_with_flags(__DRIcontext *cPriv, _mesa_glthread_finish(ctx); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (flags & __DRI2_FLUSH_DRAWABLE) intel_resolve_for_dri2_flush(brw, dPriv); diff --git a/src/mesa/main/accum.c b/src/mesa/main/accum.c index ff1168afc45..c8db08aa42c 100644 --- a/src/mesa/main/accum.c +++ b/src/mesa/main/accum.c @@ -49,6 +49,7 @@ _mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) if (TEST_EQ_4V(tmp, ctx->Accum.ClearColor)) return; + ctx->PopAttribState |= GL_ACCUM_BUFFER_BIT; COPY_4FV( ctx->Accum.ClearColor, tmp ); } @@ -453,7 +454,7 @@ void GLAPIENTRY _mesa_Accum( GLenum op, GLfloat value ) { GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); switch (op) { case GL_ADD: diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c index 46c04926548..359718256ef 100644 --- a/src/mesa/main/arbprogram.c +++ b/src/mesa/main/arbprogram.c @@ -55,7 +55,7 @@ flush_vertices_for_program_constants(struct gl_context *ctx, GLenum target) ctx->DriverFlags.NewShaderConstants[MESA_SHADER_VERTEX]; } - FLUSH_VERTICES(ctx, new_driver_state ? 0 : _NEW_PROGRAM_CONSTANTS); + FLUSH_VERTICES(ctx, new_driver_state ? 0 : _NEW_PROGRAM_CONSTANTS, 0); ctx->NewDriverState |= new_driver_state; } @@ -136,7 +136,7 @@ _mesa_BindProgramARB(GLenum target, GLuint id) } /* signal new program (and its new constants) */ - FLUSH_VERTICES(ctx, _NEW_PROGRAM); + FLUSH_VERTICES(ctx, _NEW_PROGRAM, 0); flush_vertices_for_program_constants(ctx, target); /* bind newProg */ @@ -166,7 +166,7 @@ _mesa_DeleteProgramsARB(GLsizei n, const GLuint *ids) GLint i; GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (n < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glDeleteProgramsNV" ); @@ -359,7 +359,7 @@ set_program_string(struct gl_program *prog, GLenum target, GLenum format, GLsize bool failed; GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, _NEW_PROGRAM); + FLUSH_VERTICES(ctx, _NEW_PROGRAM, 0); if (!ctx->Extensions.ARB_vertex_program && !ctx->Extensions.ARB_fragment_program) { diff --git a/src/mesa/main/atifragshader.c b/src/mesa/main/atifragshader.c index dba67f08d8e..a08a1b613a1 100644 --- a/src/mesa/main/atifragshader.c +++ b/src/mesa/main/atifragshader.c @@ -226,7 +226,7 @@ _mesa_BindFragmentShaderATI(GLuint id) return; } - FLUSH_VERTICES(ctx, _NEW_PROGRAM); + FLUSH_VERTICES(ctx, _NEW_PROGRAM, 0); if (curProg->Id == id) { return; @@ -288,7 +288,7 @@ _mesa_DeleteFragmentShaderATI(GLuint id) else if (prog) { if (ctx->ATIFragmentShader.Current && ctx->ATIFragmentShader.Current->Id == id) { - FLUSH_VERTICES(ctx, _NEW_PROGRAM); + FLUSH_VERTICES(ctx, _NEW_PROGRAM, 0); _mesa_BindFragmentShaderATI(0); } } @@ -316,7 +316,7 @@ _mesa_BeginFragmentShaderATI(void) return; } - FLUSH_VERTICES(ctx, _NEW_PROGRAM); + FLUSH_VERTICES(ctx, _NEW_PROGRAM, 0); /* if the shader was already defined free instructions and get new ones (or, could use the same mem but would need to reinitialize) */ @@ -815,7 +815,7 @@ _mesa_SetFragmentShaderConstantATI(GLuint dst, const GLfloat * value) curProg->LocalConstDef |= 1 << dstindex; } else { - FLUSH_VERTICES(ctx, _NEW_PROGRAM); + FLUSH_VERTICES(ctx, _NEW_PROGRAM, 0); COPY_4V(ctx->ATIFragmentShader.GlobalConstants[dstindex], value); } } diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index bd8a44b5788..ff11ae245bd 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -654,7 +654,7 @@ _mesa_PopAttrib(void) { struct gl_attrib_node *attr; GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (ctx->AttribStackDepth == 0) { _mesa_error(ctx, GL_STACK_UNDERFLOW, "glPopAttrib"); @@ -1381,7 +1381,7 @@ _mesa_PopClientAttrib(void) struct gl_client_attrib_node *head; GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (ctx->ClientAttribStackDepth == 0) { _mesa_error(ctx, GL_STACK_UNDERFLOW, "glPopClientAttrib"); diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index 1b84c9077f0..ebc4ae0966c 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -229,7 +229,8 @@ blend_func_separate(struct gl_context *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA) { - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewBlend ? 0 : _NEW_COLOR); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewBlend ? 0 : _NEW_COLOR, + GL_COLOR_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewBlend; const unsigned numBuffers = num_buffers(ctx); @@ -389,7 +390,8 @@ blend_func_separatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB, return; } - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewBlend ? 0 : _NEW_COLOR); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewBlend ? 0 : _NEW_COLOR, + GL_COLOR_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewBlend; ctx->Color.Blend[buf].SrcRGB = sfactorRGB; @@ -791,7 +793,8 @@ _mesa_BlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) if (TEST_EQ_4V(tmp, ctx->Color.BlendColorUnclamped)) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewBlendColor ? 0 : _NEW_COLOR); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewBlendColor ? 0 : _NEW_COLOR, + GL_COLOR_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewBlendColor; COPY_4FV( ctx->Color.BlendColorUnclamped, tmp ); @@ -836,7 +839,8 @@ _mesa_AlphaFunc( GLenum func, GLclampf ref ) case GL_NOTEQUAL: case GL_GEQUAL: case GL_ALWAYS: - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewAlphaTest ? 0 : _NEW_COLOR); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewAlphaTest ? 0 : _NEW_COLOR, + GL_COLOR_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewAlphaTest; ctx->Color.AlphaFunc = func; ctx->Color.AlphaRefUnclamped = ref; @@ -902,7 +906,8 @@ logic_op(struct gl_context *ctx, GLenum opcode, bool no_error) } } - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLogicOp ? 0 : _NEW_COLOR); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLogicOp ? 0 : _NEW_COLOR, + GL_COLOR_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewLogicOp; ctx->Color.LogicOp = opcode; ctx->Color._LogicOp = color_logicop_mapping[opcode & 0x0f]; @@ -951,7 +956,8 @@ _mesa_IndexMask( GLuint mask ) if (ctx->Color.IndexMask == mask) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewColorMask ? 0 : _NEW_COLOR); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewColorMask ? 0 : _NEW_COLOR, + GL_COLOR_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewColorMask; ctx->Color.IndexMask = mask; } @@ -990,7 +996,8 @@ _mesa_ColorMask( GLboolean red, GLboolean green, if (ctx->Color.ColorMask == mask) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewColorMask ? 0 : _NEW_COLOR); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewColorMask ? 0 : _NEW_COLOR, + GL_COLOR_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewColorMask; ctx->Color.ColorMask = mask; _mesa_update_allow_draw_out_of_order(ctx); @@ -1026,7 +1033,8 @@ _mesa_ColorMaski(GLuint buf, GLboolean red, GLboolean green, if (GET_COLORMASK(ctx->Color.ColorMask, buf) == mask) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewColorMask ? 0 : _NEW_COLOR); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewColorMask ? 0 : _NEW_COLOR, + GL_COLOR_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewColorMask; ctx->Color.ColorMask &= ~(0xf << (4 * buf)); ctx->Color.ColorMask |= mask << (4 * buf); @@ -1056,7 +1064,7 @@ _mesa_ClampColor(GLenum target, GLenum clamp) case GL_CLAMP_VERTEX_COLOR_ARB: if (ctx->API == API_OPENGL_CORE) goto invalid_enum; - FLUSH_VERTICES(ctx, _NEW_LIGHT); + FLUSH_VERTICES(ctx, _NEW_LIGHT, GL_LIGHTING_BIT | GL_ENABLE_BIT); ctx->Light.ClampVertexColor = clamp; _mesa_update_clamp_vertex_color(ctx, ctx->DrawBuffer); break; @@ -1064,12 +1072,14 @@ _mesa_ClampColor(GLenum target, GLenum clamp) if (ctx->API == API_OPENGL_CORE) goto invalid_enum; if (ctx->Color.ClampFragmentColor != clamp) { + FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT); ctx->Color.ClampFragmentColor = clamp; _mesa_update_clamp_fragment_color(ctx, ctx->DrawBuffer); } break; case GL_CLAMP_READ_COLOR_ARB: ctx->Color.ClampReadColor = clamp; + ctx->PopAttribState |= GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT; break; default: goto invalid_enum; diff --git a/src/mesa/main/blend.h b/src/mesa/main/blend.h index 6e56f2fd1ea..8830ca50ea3 100644 --- a/src/mesa/main/blend.h +++ b/src/mesa/main/blend.h @@ -175,9 +175,9 @@ static inline void _mesa_flush_vertices_for_blend_state(struct gl_context *ctx) { if (!ctx->DriverFlags.NewBlend) { - FLUSH_VERTICES(ctx, _NEW_COLOR); + FLUSH_VERTICES(ctx, _NEW_COLOR, GL_COLOR_BUFFER_BIT); } else { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewBlend; } } @@ -191,7 +191,7 @@ _mesa_flush_vertices_for_blend_adv(struct gl_context *ctx, if (_mesa_has_KHR_blend_equation_advanced(ctx) && _mesa_advanded_blend_sh_constant_changed(ctx, new_blend_enabled, new_mode)) { - FLUSH_VERTICES(ctx, _NEW_COLOR); + FLUSH_VERTICES(ctx, _NEW_COLOR, GL_COLOR_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewBlend; return; } diff --git a/src/mesa/main/blit.c b/src/mesa/main/blit.c index 8bb3ba328a3..116c012b212 100644 --- a/src/mesa/main/blit.c +++ b/src/mesa/main/blit.c @@ -347,7 +347,7 @@ blit_framebuffer(struct gl_context *ctx, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter, bool no_error, const char *func) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (!readFb || !drawFb) { /* This will normally never happen but someday we may want to diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index f667ece819b..738af3bd93b 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -1315,7 +1315,7 @@ bind_buffer(struct gl_context *ctx, return; } - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); ctx->NewDriverState |= driver_state; set_buffer_binding(ctx, binding, bufObj, offset, size, autoSize, usage); @@ -1456,7 +1456,7 @@ bind_buffer_base_atomic_buffer(struct gl_context *ctx, static void delete_buffers(struct gl_context *ctx, GLsizei n, const GLuint *ids) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); _mesa_HashLockMaybeLocked(ctx->Shared->BufferObjects, ctx->BufferObjectsLocked); @@ -1813,7 +1813,7 @@ buffer_storage(struct gl_context *ctx, struct gl_buffer_object *bufObj, /* Unmap the existing buffer. We'll replace it now. Not an error. */ _mesa_buffer_unmap_all_mappings(ctx, bufObj); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); bufObj->Written = GL_TRUE; bufObj->Immutable = GL_TRUE; @@ -2061,7 +2061,7 @@ buffer_data(struct gl_context *ctx, struct gl_buffer_object *bufObj, /* Unmap the existing buffer. We'll replace it now. Not an error. */ _mesa_buffer_unmap_all_mappings(ctx, bufObj); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); bufObj->Written = GL_TRUE; bufObj->MinMaxCacheDirty = true; @@ -4032,7 +4032,7 @@ bind_uniform_buffers(struct gl_context *ctx, GLuint first, GLsizei count, return; /* Assume that at least one binding will be changed */ - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); ctx->NewDriverState |= ctx->DriverFlags.NewUniformBuffer; if (!buffers) { @@ -4135,7 +4135,7 @@ bind_shader_storage_buffers(struct gl_context *ctx, GLuint first, return; /* Assume that at least one binding will be changed */ - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); ctx->NewDriverState |= ctx->DriverFlags.NewShaderStorageBuffer; if (!buffers) { @@ -4303,7 +4303,7 @@ bind_xfb_buffers(struct gl_context *ctx, return; /* Assume that at least one binding will be changed */ - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); ctx->NewDriverState |= ctx->DriverFlags.NewTransformFeedback; if (!buffers) { @@ -4464,7 +4464,7 @@ bind_atomic_buffers(struct gl_context *ctx, return; /* Assume that at least one binding will be changed */ - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); ctx->NewDriverState |= ctx->DriverFlags.NewAtomicBuffer; if (!buffers) { diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 5dc00116ead..9be0a6f1180 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -288,7 +288,7 @@ draw_buffer(struct gl_context *ctx, struct gl_framebuffer *fb, { GLbitfield destMask; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT); if (MESA_VERBOSE & VERBOSE_API) { _mesa_debug(ctx, "%s %s\n", caller, _mesa_enum_to_string(buffer)); @@ -435,7 +435,7 @@ draw_buffers(struct gl_context *ctx, struct gl_framebuffer *fb, GLsizei n, GLbitfield usedBufferMask, supportedMask; GLbitfield destMask[MAX_DRAW_BUFFERS]; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT); if (!no_error) { /* Turns out n==0 is a valid input that should not produce an error. @@ -733,7 +733,7 @@ _mesa_NamedFramebufferDrawBuffers(GLuint framebuffer, GLsizei n, static void updated_drawbuffers(struct gl_context *ctx, struct gl_framebuffer *fb) { - FLUSH_VERTICES(ctx, _NEW_BUFFERS); + FLUSH_VERTICES(ctx, _NEW_BUFFERS, GL_COLOR_BUFFER_BIT); if (ctx->API == API_OPENGL_COMPAT && !ctx->Extensions.ARB_ES2_compatibility) { /* Flag the FBO as requiring validation. */ @@ -900,7 +900,7 @@ read_buffer(struct gl_context *ctx, struct gl_framebuffer *fb, { gl_buffer_index srcBuffer; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_PIXEL_MODE_BIT); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "%s %s\n", caller, _mesa_enum_to_string(buffer)); diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c index ba978a06ad6..2e22c83e030 100644 --- a/src/mesa/main/clear.c +++ b/src/mesa/main/clear.c @@ -48,6 +48,7 @@ _mesa_ClearIndex( GLfloat c ) { GET_CURRENT_CONTEXT(ctx); + ctx->PopAttribState |= GL_COLOR_BUFFER_BIT; ctx->Color.ClearIndex = (GLuint) c; } @@ -67,6 +68,7 @@ _mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) { GET_CURRENT_CONTEXT(ctx); + ctx->PopAttribState |= GL_COLOR_BUFFER_BIT; ctx->Color.ClearColor.f[0] = red; ctx->Color.ClearColor.f[1] = green; ctx->Color.ClearColor.f[2] = blue; @@ -82,6 +84,7 @@ _mesa_ClearColorIiEXT(GLint r, GLint g, GLint b, GLint a) { GET_CURRENT_CONTEXT(ctx); + ctx->PopAttribState |= GL_COLOR_BUFFER_BIT; ctx->Color.ClearColor.i[0] = r; ctx->Color.ClearColor.i[1] = g; ctx->Color.ClearColor.i[2] = b; @@ -97,6 +100,7 @@ _mesa_ClearColorIuiEXT(GLuint r, GLuint g, GLuint b, GLuint a) { GET_CURRENT_CONTEXT(ctx); + ctx->PopAttribState |= GL_COLOR_BUFFER_BIT; ctx->Color.ClearColor.ui[0] = r; ctx->Color.ClearColor.ui[1] = g; ctx->Color.ClearColor.ui[2] = b; @@ -144,7 +148,7 @@ color_buffer_writes_enabled(const struct gl_context *ctx, unsigned idx) static ALWAYS_INLINE void clear(struct gl_context *ctx, GLbitfield mask, bool no_error) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (!no_error) { if (mask & ~(GL_COLOR_BUFFER_BIT | @@ -343,7 +347,7 @@ static ALWAYS_INLINE void clear_bufferiv(struct gl_context *ctx, GLenum buffer, GLint drawbuffer, const GLint *value, bool no_error) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (ctx->NewState) { _mesa_update_state( ctx ); @@ -462,7 +466,7 @@ static ALWAYS_INLINE void clear_bufferuiv(struct gl_context *ctx, GLenum buffer, GLint drawbuffer, const GLuint *value, bool no_error) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (ctx->NewState) { _mesa_update_state( ctx ); @@ -556,7 +560,7 @@ static ALWAYS_INLINE void clear_bufferfv(struct gl_context *ctx, GLenum buffer, GLint drawbuffer, const GLfloat *value, bool no_error) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (ctx->NewState) { _mesa_update_state( ctx ); @@ -692,7 +696,7 @@ clear_bufferfi(struct gl_context *ctx, GLenum buffer, GLint drawbuffer, { GLbitfield mask = 0; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (!no_error) { if (buffer != GL_DEPTH_STENCIL) { diff --git a/src/mesa/main/clip.c b/src/mesa/main/clip.c index 0950283ff3c..72308604e78 100644 --- a/src/mesa/main/clip.c +++ b/src/mesa/main/clip.c @@ -84,7 +84,7 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq ) return; /* EyeUserPlane is used by program state constants. */ - FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + FLUSH_VERTICES(ctx, _NEW_TRANSFORM, GL_TRANSFORM_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewClipPlane; COPY_4FV(ctx->Transform.EyeUserPlane[p], equation); diff --git a/src/mesa/main/compute.c b/src/mesa/main/compute.c index 8e446afa9ee..ef189b34827 100644 --- a/src/mesa/main/compute.c +++ b/src/mesa/main/compute.c @@ -285,7 +285,7 @@ dispatch_compute(GLuint num_groups_x, GLuint num_groups_y, GET_CURRENT_CONTEXT(ctx); const GLuint num_groups[3] = { num_groups_x, num_groups_y, num_groups_z }; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glDispatchCompute(%d, %d, %d)\n", @@ -320,7 +320,7 @@ dispatch_compute_indirect(GLintptr indirect, bool no_error) { GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glDispatchComputeIndirect(%ld)\n", (long) indirect); @@ -353,7 +353,7 @@ dispatch_compute_group_size(GLuint num_groups_x, GLuint num_groups_y, const GLuint num_groups[3] = { num_groups_x, num_groups_y, num_groups_z }; const GLuint group_size[3] = { group_size_x, group_size_y, group_size_z }; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, diff --git a/src/mesa/main/condrender.c b/src/mesa/main/condrender.c index 1676890e244..4c5a59df490 100644 --- a/src/mesa/main/condrender.c +++ b/src/mesa/main/condrender.c @@ -136,7 +136,7 @@ _mesa_BeginConditionalRender(GLuint queryId, GLenum mode) static void end_conditional_render(struct gl_context *ctx) { - FLUSH_VERTICES(ctx, 0x0); + FLUSH_VERTICES(ctx, 0, 0); if (ctx->Driver.EndConditionalRender) ctx->Driver.EndConditionalRender(ctx, ctx->Query.CondRenderQuery); diff --git a/src/mesa/main/conservativeraster.c b/src/mesa/main/conservativeraster.c index d27c21c1f36..b912b5517fd 100644 --- a/src/mesa/main/conservativeraster.c +++ b/src/mesa/main/conservativeraster.c @@ -60,7 +60,7 @@ conservative_raster_parameter(GLenum pname, GLfloat param, return; } - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); ctx->NewDriverState |= ctx->DriverFlags.NewNvConservativeRasterizationParams; @@ -80,7 +80,7 @@ conservative_raster_parameter(GLenum pname, GLfloat param, return; } - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); ctx->NewDriverState |= ctx->DriverFlags.NewNvConservativeRasterizationParams; diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 98e189af08a..31ddef85708 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -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); diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index 9ffd75fbae3..984011dc4d6 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -207,13 +207,14 @@ _mesa_inside_dlist_begin_end(const struct gl_context *ctx) * and calls dd_function_table::FlushVertices if so. Marks * __struct gl_contextRec::NewState with \p newstate. */ -#define FLUSH_VERTICES(ctx, newstate) \ +#define FLUSH_VERTICES(ctx, newstate, pop_attrib_mask) \ do { \ if (MESA_VERBOSE & VERBOSE_STATE) \ _mesa_debug(ctx, "FLUSH_VERTICES in %s\n", __func__); \ if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \ vbo_exec_FlushVertices(ctx, FLUSH_STORED_VERTICES); \ ctx->NewState |= newstate; \ + ctx->PopAttribState |= pop_attrib_mask; \ } while (0) /** diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c index ab98de745e4..3e366a71d1e 100644 --- a/src/mesa/main/depth.c +++ b/src/mesa/main/depth.c @@ -47,6 +47,7 @@ _mesa_ClearDepth( GLclampd depth ) if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glClearDepth(%f)\n", depth); + ctx->PopAttribState |= GL_DEPTH_BUFFER_BIT; ctx->Depth.Clear = CLAMP( depth, 0.0, 1.0 ); } @@ -81,7 +82,8 @@ depth_func(struct gl_context *ctx, GLenum func, bool no_error) } } - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH, + GL_DEPTH_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewDepth; ctx->Depth.Func = func; _mesa_update_allow_draw_out_of_order(ctx); @@ -127,7 +129,8 @@ _mesa_DepthMask( GLboolean flag ) if (ctx->Depth.Mask == flag) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH, + GL_DEPTH_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewDepth; ctx->Depth.Mask = flag; _mesa_update_allow_draw_out_of_order(ctx); @@ -160,7 +163,8 @@ _mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax ) if (ctx->Depth.BoundsMin == zmin && ctx->Depth.BoundsMax == zmax) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH, + GL_DEPTH_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewDepth; ctx->Depth.BoundsMin = (GLfloat) zmin; ctx->Depth.BoundsMax = (GLfloat) zmax; diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 0f634af853b..aa63abba454 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -13495,7 +13495,7 @@ GLboolean GLAPIENTRY _mesa_IsList(GLuint list) { GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); /* must be called before assert */ + FLUSH_VERTICES(ctx, 0, 0); /* must be called before assert */ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); return _mesa_get_list(ctx, list, NULL); } @@ -13509,7 +13509,7 @@ _mesa_DeleteLists(GLuint list, GLsizei range) { GET_CURRENT_CONTEXT(ctx); GLuint i; - FLUSH_VERTICES(ctx, 0); /* must be called before assert */ + FLUSH_VERTICES(ctx, 0, 0); /* must be called before assert */ ASSERT_OUTSIDE_BEGIN_END(ctx); if (range < 0) { @@ -13543,7 +13543,7 @@ _mesa_GenLists(GLsizei range) { GET_CURRENT_CONTEXT(ctx); GLuint base; - FLUSH_VERTICES(ctx, 0); /* must be called before assert */ + FLUSH_VERTICES(ctx, 0, 0); /* must be called before assert */ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); if (range < 0) { @@ -13653,7 +13653,7 @@ _mesa_EndList(void) { GET_CURRENT_CONTEXT(ctx); SAVE_FLUSH_VERTICES(ctx); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glEndList\n"); @@ -13936,7 +13936,7 @@ void GLAPIENTRY _mesa_ListBase(GLuint base) { GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); /* must be called before assert */ + FLUSH_VERTICES(ctx, 0, GL_LIST_BIT); /* must be called before assert */ ASSERT_OUTSIDE_BEGIN_END(ctx); ctx->List.ListBase = base; } diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index ae50dd918f9..a231c717387 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -49,7 +49,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, GLenum err; GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glDrawPixels(%d, %d, %s, %s, %p) // to %s at %ld, %ld\n", @@ -193,7 +193,7 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, { GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, @@ -310,7 +310,7 @@ _mesa_Bitmap( GLsizei width, GLsizei height, { GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (width < 0 || height < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glBitmap(width or height < 0)" ); @@ -373,6 +373,7 @@ _mesa_Bitmap( GLsizei width, GLsizei height, /* update raster position */ ctx->Current.RasterPos[0] += xmove; ctx->Current.RasterPos[1] += ymove; + ctx->PopAttribState |= GL_CURRENT_BIT; if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) { _mesa_flush(ctx); diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 0c5579b0dd0..67a112d490c 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -124,7 +124,7 @@ client_state(struct gl_context *ctx, struct gl_vertex_array_object* vao, case GL_POINT_SIZE_ARRAY_OES: if (ctx->VertexProgram.PointSizeEnabled != state) { - FLUSH_VERTICES(ctx, _NEW_PROGRAM); + FLUSH_VERTICES(ctx, _NEW_PROGRAM, 0); ctx->VertexProgram.PointSizeEnabled = state; } vao_state(ctx, vao, VERT_ATTRIB_POINT_SIZE, state); @@ -333,7 +333,7 @@ enable_texture(struct gl_context *ctx, GLboolean state, GLbitfield texBit) if (texUnit->Enabled == newenabled) return GL_FALSE; - FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE, GL_TEXTURE_BIT | GL_ENABLE_BIT); texUnit->Enabled = newenabled; return GL_TRUE; } @@ -354,9 +354,9 @@ _mesa_set_multisample(struct gl_context *ctx, GLboolean state) */ if (ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES || !ctx->DriverFlags.NewMultisampleEnable) { - FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); + FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE, GL_MULTISAMPLE_BIT | GL_ENABLE_BIT); } else { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_MULTISAMPLE_BIT | GL_ENABLE_BIT); } ctx->NewDriverState |= ctx->DriverFlags.NewMultisampleEnable; @@ -378,7 +378,8 @@ _mesa_set_framebuffer_srgb(struct gl_context *ctx, GLboolean state) return; /* TODO: Switch i965 to the new flag and remove the conditional */ - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewFramebufferSRGB ? 0 : _NEW_BUFFERS); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewFramebufferSRGB ? 0 : _NEW_BUFFERS, + GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewFramebufferSRGB; ctx->Color.sRGBEnabled = state; @@ -415,7 +416,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) if (ctx->Color.AlphaEnabled == state) return; /* AlphaEnabled is used by the fixed-func fragment program */ - FLUSH_VERTICES(ctx, _NEW_COLOR); + FLUSH_VERTICES(ctx, _NEW_COLOR, GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewAlphaTest; ctx->Color.AlphaEnabled = state; break; @@ -424,7 +425,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.AutoNormal == state) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_EVAL_BIT | GL_ENABLE_BIT); vbo_exec_update_eval_maps(ctx); ctx->Eval.AutoNormal = state; break; @@ -435,6 +436,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) if (newEnabled != ctx->Color.BlendEnabled) { _mesa_flush_vertices_for_blend_adv(ctx, newEnabled, ctx->Color._AdvancedBlendMode); + ctx->PopAttribState |= GL_ENABLE_BIT; ctx->Color.BlendEnabled = newEnabled; _mesa_update_allow_draw_out_of_order(ctx); } @@ -463,9 +465,10 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) */ if (ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES || !ctx->DriverFlags.NewClipPlaneEnable) { - FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + FLUSH_VERTICES(ctx, _NEW_TRANSFORM, + GL_TRANSFORM_BIT | GL_ENABLE_BIT); } else { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_TRANSFORM_BIT | GL_ENABLE_BIT); } ctx->NewDriverState |= ctx->DriverFlags.NewClipPlaneEnable; @@ -489,7 +492,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Light.ColorMaterialEnabled == state) return; - FLUSH_VERTICES(ctx, _NEW_LIGHT); + FLUSH_VERTICES(ctx, _NEW_LIGHT, GL_LIGHTING_BIT | GL_ENABLE_BIT); FLUSH_CURRENT(ctx, 0); ctx->Light.ColorMaterialEnabled = state; if (state) { @@ -501,14 +504,16 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) if (ctx->Polygon.CullFlag == state) return; FLUSH_VERTICES(ctx, - ctx->DriverFlags.NewPolygonState ? 0 : _NEW_POLYGON); + ctx->DriverFlags.NewPolygonState ? 0 : _NEW_POLYGON, + GL_POLYGON_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewPolygonState; ctx->Polygon.CullFlag = state; break; case GL_DEPTH_TEST: if (ctx->Depth.Test == state) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH, + GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewDepth; ctx->Depth.Test = state; _mesa_update_allow_draw_out_of_order(ctx); @@ -520,7 +525,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) case GL_DITHER: if (ctx->Color.DitherFlag == state) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewBlend ? 0 : _NEW_COLOR); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewBlend ? 0 : _NEW_COLOR, + GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewBlend; ctx->Color.DitherFlag = state; break; @@ -529,7 +535,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Fog.Enabled == state) return; - FLUSH_VERTICES(ctx, _NEW_FOG); + FLUSH_VERTICES(ctx, _NEW_FOG, GL_FOG_BIT | GL_ENABLE_BIT); ctx->Fog.Enabled = state; ctx->Fog._PackedEnabledMode = state ? ctx->Fog._PackedMode : FOG_NONE; break; @@ -545,7 +551,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Light.Light[cap-GL_LIGHT0].Enabled == state) return; - FLUSH_VERTICES(ctx, _NEW_LIGHT); + FLUSH_VERTICES(ctx, _NEW_LIGHT, GL_LIGHTING_BIT | GL_ENABLE_BIT); ctx->Light.Light[cap-GL_LIGHT0].Enabled = state; if (state) { ctx->Light._EnabledLights |= 1u << (cap - GL_LIGHT0); @@ -559,7 +565,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Light.Enabled == state) return; - FLUSH_VERTICES(ctx, _NEW_LIGHT); + FLUSH_VERTICES(ctx, _NEW_LIGHT, GL_LIGHTING_BIT | GL_ENABLE_BIT); ctx->Light.Enabled = state; break; case GL_LINE_SMOOTH: @@ -567,7 +573,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Line.SmoothFlag == state) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLineState ? 0 : _NEW_LINE); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLineState ? 0 : _NEW_LINE, + GL_LINE_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewLineState; ctx->Line.SmoothFlag = state; break; @@ -576,7 +583,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Line.StippleFlag == state) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLineState ? 0 : _NEW_LINE); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLineState ? 0 : _NEW_LINE, + GL_LINE_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewLineState; ctx->Line.StippleFlag = state; break; @@ -585,7 +593,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Color.IndexLogicOpEnabled == state) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLogicOp ? 0 : _NEW_COLOR); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLogicOp ? 0 : _NEW_COLOR, + GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewLogicOp; ctx->Color.IndexLogicOpEnabled = state; break; @@ -594,7 +603,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->IntelConservativeRasterization == state) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); ctx->NewDriverState |= ctx->DriverFlags.NewIntelConservativeRasterization; ctx->IntelConservativeRasterization = state; @@ -604,7 +613,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->ConservativeRasterization == state) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewNvConservativeRasterization; ctx->ConservativeRasterization = state; @@ -614,7 +623,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Color.ColorLogicOpEnabled == state) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLogicOp ? 0 : _NEW_COLOR); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLogicOp ? 0 : _NEW_COLOR, + GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewLogicOp; ctx->Color.ColorLogicOpEnabled = state; _mesa_update_allow_draw_out_of_order(ctx); @@ -624,7 +634,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map1Color4 == state) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_EVAL_BIT | GL_ENABLE_BIT); vbo_exec_update_eval_maps(ctx); ctx->Eval.Map1Color4 = state; break; @@ -633,7 +643,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map1Index == state) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_EVAL_BIT | GL_ENABLE_BIT); vbo_exec_update_eval_maps(ctx); ctx->Eval.Map1Index = state; break; @@ -642,7 +652,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map1Normal == state) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_EVAL_BIT | GL_ENABLE_BIT); vbo_exec_update_eval_maps(ctx); ctx->Eval.Map1Normal = state; break; @@ -651,7 +661,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map1TextureCoord1 == state) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_EVAL_BIT | GL_ENABLE_BIT); vbo_exec_update_eval_maps(ctx); ctx->Eval.Map1TextureCoord1 = state; break; @@ -660,7 +670,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map1TextureCoord2 == state) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_EVAL_BIT | GL_ENABLE_BIT); vbo_exec_update_eval_maps(ctx); ctx->Eval.Map1TextureCoord2 = state; break; @@ -669,7 +679,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map1TextureCoord3 == state) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_EVAL_BIT | GL_ENABLE_BIT); vbo_exec_update_eval_maps(ctx); ctx->Eval.Map1TextureCoord3 = state; break; @@ -678,7 +688,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map1TextureCoord4 == state) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_EVAL_BIT | GL_ENABLE_BIT); vbo_exec_update_eval_maps(ctx); ctx->Eval.Map1TextureCoord4 = state; break; @@ -687,7 +697,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map1Vertex3 == state) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_EVAL_BIT | GL_ENABLE_BIT); vbo_exec_update_eval_maps(ctx); ctx->Eval.Map1Vertex3 = state; break; @@ -696,7 +706,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map1Vertex4 == state) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_EVAL_BIT | GL_ENABLE_BIT); vbo_exec_update_eval_maps(ctx); ctx->Eval.Map1Vertex4 = state; break; @@ -705,7 +715,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map2Color4 == state) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_EVAL_BIT | GL_ENABLE_BIT); vbo_exec_update_eval_maps(ctx); ctx->Eval.Map2Color4 = state; break; @@ -714,7 +724,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map2Index == state) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_EVAL_BIT | GL_ENABLE_BIT); vbo_exec_update_eval_maps(ctx); ctx->Eval.Map2Index = state; break; @@ -723,7 +733,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map2Normal == state) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_EVAL_BIT | GL_ENABLE_BIT); vbo_exec_update_eval_maps(ctx); ctx->Eval.Map2Normal = state; break; @@ -732,7 +742,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map2TextureCoord1 == state) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_EVAL_BIT | GL_ENABLE_BIT); vbo_exec_update_eval_maps(ctx); ctx->Eval.Map2TextureCoord1 = state; break; @@ -741,7 +751,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map2TextureCoord2 == state) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_EVAL_BIT | GL_ENABLE_BIT); vbo_exec_update_eval_maps(ctx); ctx->Eval.Map2TextureCoord2 = state; break; @@ -750,7 +760,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map2TextureCoord3 == state) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_EVAL_BIT | GL_ENABLE_BIT); vbo_exec_update_eval_maps(ctx); ctx->Eval.Map2TextureCoord3 = state; break; @@ -759,7 +769,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map2TextureCoord4 == state) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_EVAL_BIT | GL_ENABLE_BIT); vbo_exec_update_eval_maps(ctx); ctx->Eval.Map2TextureCoord4 = state; break; @@ -768,7 +778,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map2Vertex3 == state) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_EVAL_BIT | GL_ENABLE_BIT); vbo_exec_update_eval_maps(ctx); ctx->Eval.Map2Vertex3 = state; break; @@ -777,7 +787,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Eval.Map2Vertex4 == state) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_EVAL_BIT | GL_ENABLE_BIT); vbo_exec_update_eval_maps(ctx); ctx->Eval.Map2Vertex4 = state; break; @@ -786,7 +796,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Transform.Normalize == state) return; - FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + FLUSH_VERTICES(ctx, _NEW_TRANSFORM, GL_TRANSFORM_BIT | GL_ENABLE_BIT); ctx->Transform.Normalize = state; break; case GL_POINT_SMOOTH: @@ -794,7 +804,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Point.SmoothFlag == state) return; - FLUSH_VERTICES(ctx, _NEW_POINT); + FLUSH_VERTICES(ctx, _NEW_POINT, GL_POINT_BIT | GL_ENABLE_BIT); ctx->Point.SmoothFlag = state; break; case GL_POLYGON_SMOOTH: @@ -803,7 +813,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) if (ctx->Polygon.SmoothFlag == state) return; FLUSH_VERTICES(ctx, - ctx->DriverFlags.NewPolygonState ? 0 : _NEW_POLYGON); + ctx->DriverFlags.NewPolygonState ? 0 : _NEW_POLYGON, + GL_POLYGON_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewPolygonState; ctx->Polygon.SmoothFlag = state; break; @@ -813,7 +824,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) if (ctx->Polygon.StippleFlag == state) return; FLUSH_VERTICES(ctx, - ctx->DriverFlags.NewPolygonState ? 0 : _NEW_POLYGON); + ctx->DriverFlags.NewPolygonState ? 0 : _NEW_POLYGON, + GL_POLYGON_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewPolygonState; ctx->Polygon.StippleFlag = state; break; @@ -823,7 +835,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) if (ctx->Polygon.OffsetPoint == state) return; FLUSH_VERTICES(ctx, - ctx->DriverFlags.NewPolygonState ? 0 : _NEW_POLYGON); + ctx->DriverFlags.NewPolygonState ? 0 : _NEW_POLYGON, + GL_POLYGON_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewPolygonState; ctx->Polygon.OffsetPoint = state; break; @@ -833,7 +846,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) if (ctx->Polygon.OffsetLine == state) return; FLUSH_VERTICES(ctx, - ctx->DriverFlags.NewPolygonState ? 0 : _NEW_POLYGON); + ctx->DriverFlags.NewPolygonState ? 0 : _NEW_POLYGON, + GL_POLYGON_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewPolygonState; ctx->Polygon.OffsetLine = state; break; @@ -841,7 +855,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) if (ctx->Polygon.OffsetFill == state) return; FLUSH_VERTICES(ctx, - ctx->DriverFlags.NewPolygonState ? 0 : _NEW_POLYGON); + ctx->DriverFlags.NewPolygonState ? 0 : _NEW_POLYGON, + GL_POLYGON_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewPolygonState; ctx->Polygon.OffsetFill = state; break; @@ -850,7 +865,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Transform.RescaleNormals == state) return; - FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + FLUSH_VERTICES(ctx, _NEW_TRANSFORM, GL_TRANSFORM_BIT | GL_ENABLE_BIT); ctx->Transform.RescaleNormals = state; break; case GL_SCISSOR_TEST: @@ -860,7 +875,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) state * ((1 << ctx->Const.MaxViewports) - 1); if (newEnabled != ctx->Scissor.EnableFlags) { FLUSH_VERTICES(ctx, ctx->DriverFlags.NewScissorTest ? 0 : - _NEW_SCISSOR); + _NEW_SCISSOR, + GL_SCISSOR_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewScissorTest; ctx->Scissor.EnableFlags = newEnabled; } @@ -869,7 +885,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) case GL_STENCIL_TEST: if (ctx->Stencil.Enabled == state) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, + GL_STENCIL_BUFFER_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewStencil; ctx->Stencil.Enabled = state; _mesa_update_allow_draw_out_of_order(ctx); @@ -912,7 +929,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) newenabled |= coordBit; if (texUnit->TexGenEnabled == newenabled) return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE, + GL_TEXTURE_BIT | GL_ENABLE_BIT); texUnit->TexGenEnabled = newenabled; } } @@ -933,7 +951,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) newenabled |= STR_BITS; if (texUnit->TexGenEnabled == newenabled) return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE, 0); texUnit->TexGenEnabled = newenabled; } } @@ -978,7 +996,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Fog.ColorSumEnabled == state) return; - FLUSH_VERTICES(ctx, _NEW_FOG); + FLUSH_VERTICES(ctx, _NEW_FOG, GL_FOG_BIT | GL_ENABLE_BIT); ctx->Fog.ColorSumEnabled = state; break; @@ -992,7 +1010,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) if (ctx->Multisample.SampleAlphaToCoverage == state) return; FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleAlphaToXEnable ? 0 : - _NEW_MULTISAMPLE); + _NEW_MULTISAMPLE, + GL_MULTISAMPLE_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewSampleAlphaToXEnable; ctx->Multisample.SampleAlphaToCoverage = state; break; @@ -1002,7 +1021,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) if (ctx->Multisample.SampleAlphaToOne == state) return; FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleAlphaToXEnable ? 0 : - _NEW_MULTISAMPLE); + _NEW_MULTISAMPLE, + GL_MULTISAMPLE_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewSampleAlphaToXEnable; ctx->Multisample.SampleAlphaToOne = state; break; @@ -1010,7 +1030,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) if (ctx->Multisample.SampleCoverage == state) return; FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleMask ? 0 : - _NEW_MULTISAMPLE); + _NEW_MULTISAMPLE, + GL_MULTISAMPLE_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewSampleMask; ctx->Multisample.SampleCoverage = state; break; @@ -1020,7 +1041,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) if (ctx->Multisample.SampleCoverageInvert == state) return; FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleMask ? 0 : - _NEW_MULTISAMPLE); + _NEW_MULTISAMPLE, + GL_MULTISAMPLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewSampleMask; ctx->Multisample.SampleCoverageInvert = state; break; @@ -1032,7 +1054,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) if (ctx->Multisample.SampleShading == state) return; FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleShading ? 0 : - _NEW_MULTISAMPLE); + _NEW_MULTISAMPLE, + GL_MULTISAMPLE_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewSampleShading; ctx->Multisample.SampleShading = state; break; @@ -1043,7 +1066,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Transform.RasterPositionUnclipped == state) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_TRANSFORM_BIT | GL_ENABLE_BIT); ctx->Transform.RasterPositionUnclipped = state; break; @@ -1055,7 +1078,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Point.PointSprite == state) return; - FLUSH_VERTICES(ctx, _NEW_POINT); + FLUSH_VERTICES(ctx, _NEW_POINT, GL_POINT_BIT | GL_ENABLE_BIT); ctx->Point.PointSprite = state; break; @@ -1064,7 +1087,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->VertexProgram.Enabled == state) return; - FLUSH_VERTICES(ctx, _NEW_PROGRAM); + FLUSH_VERTICES(ctx, _NEW_PROGRAM, GL_ENABLE_BIT); ctx->VertexProgram.Enabled = state; _mesa_update_vertex_processing_mode(ctx); break; @@ -1077,7 +1100,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->VertexProgram.PointSizeEnabled == state) return; - FLUSH_VERTICES(ctx, _NEW_PROGRAM); + FLUSH_VERTICES(ctx, _NEW_PROGRAM, GL_ENABLE_BIT); ctx->VertexProgram.PointSizeEnabled = state; break; case GL_VERTEX_PROGRAM_TWO_SIDE_ARB: @@ -1085,7 +1108,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->VertexProgram.TwoSideEnabled == state) return; - FLUSH_VERTICES(ctx, _NEW_PROGRAM); + FLUSH_VERTICES(ctx, _NEW_PROGRAM, GL_ENABLE_BIT); ctx->VertexProgram.TwoSideEnabled = state; break; @@ -1104,7 +1127,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Stencil.TestTwoSide == state) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, + GL_STENCIL_BUFFER_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewStencil; ctx->Stencil.TestTwoSide = state; if (state) { @@ -1119,7 +1143,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->FragmentProgram.Enabled == state) return; - FLUSH_VERTICES(ctx, _NEW_PROGRAM); + FLUSH_VERTICES(ctx, _NEW_PROGRAM, GL_ENABLE_BIT); ctx->FragmentProgram.Enabled = state; break; @@ -1129,7 +1153,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Depth.BoundsTest == state) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH, + GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewDepth; ctx->Depth.BoundsTest = state; break; @@ -1142,7 +1167,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) ctx->Transform.DepthClampFar == state) return; FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepthClamp ? 0 : - _NEW_TRANSFORM); + _NEW_TRANSFORM, + GL_TRANSFORM_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewDepthClamp; ctx->Transform.DepthClampNear = state; ctx->Transform.DepthClampFar = state; @@ -1154,7 +1180,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) if (ctx->Transform.DepthClampNear == state) return; FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepthClamp ? 0 : - _NEW_TRANSFORM); + _NEW_TRANSFORM, + GL_TRANSFORM_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewDepthClamp; ctx->Transform.DepthClampNear = state; break; @@ -1165,7 +1192,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) if (ctx->Transform.DepthClampFar == state) return; FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepthClamp ? 0 : - _NEW_TRANSFORM); + _NEW_TRANSFORM, + GL_TRANSFORM_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewDepthClamp; ctx->Transform.DepthClampFar = state; break; @@ -1175,7 +1203,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->ATIFragmentShader.Enabled == state) return; - FLUSH_VERTICES(ctx, _NEW_PROGRAM); + FLUSH_VERTICES(ctx, _NEW_PROGRAM, GL_ENABLE_BIT); ctx->ATIFragmentShader.Enabled = state; break; @@ -1183,7 +1211,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) if (!_mesa_has_ARB_seamless_cube_map(ctx)) goto invalid_enum_error; if (ctx->Texture.CubeMapSeamless != state) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT, 0); ctx->Texture.CubeMapSeamless = state; } break; @@ -1192,7 +1220,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) if (!(_mesa_has_EXT_transform_feedback(ctx) || _mesa_is_gles3(ctx))) goto invalid_enum_error; if (ctx->RasterDiscard != state) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); ctx->NewDriverState |= ctx->DriverFlags.NewRasterizerDiscard; ctx->RasterDiscard = state; } @@ -1202,7 +1230,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) if (!_mesa_has_MESA_tile_raster_order(ctx)) goto invalid_enum_error; if (ctx->TileRasterOrderFixed != state) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewTileRasterOrder; ctx->TileRasterOrderFixed = state; } @@ -1212,7 +1240,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) if (!_mesa_has_MESA_tile_raster_order(ctx)) goto invalid_enum_error; if (ctx->TileRasterOrderIncreasingX != state) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewTileRasterOrder; ctx->TileRasterOrderIncreasingX = state; } @@ -1222,7 +1250,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) if (!_mesa_has_MESA_tile_raster_order(ctx)) goto invalid_enum_error; if (ctx->TileRasterOrderIncreasingY != state) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewTileRasterOrder; ctx->TileRasterOrderIncreasingY = state; } @@ -1274,7 +1302,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) if (ctx->Multisample.SampleMask == state) return; FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleMask ? 0 : - _NEW_MULTISAMPLE); + _NEW_MULTISAMPLE, 0); ctx->NewDriverState |= ctx->DriverFlags.NewSampleMask; ctx->Multisample.SampleMask = state; break; @@ -1284,7 +1312,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Color.BlendCoherent == state) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewBlend ? 0 : _NEW_COLOR); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewBlend ? 0 : _NEW_COLOR, + GL_COLOR_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewBlend; ctx->Color.BlendCoherent = state; break; @@ -1294,7 +1323,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->IntelBlackholeRender == state) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); ctx->IntelBlackholeRender = state; break; @@ -1369,6 +1398,7 @@ _mesa_set_enablei(struct gl_context *ctx, GLenum cap, _mesa_flush_vertices_for_blend_adv(ctx, enabled, ctx->Color._AdvancedBlendMode); + ctx->PopAttribState |= GL_ENABLE_BIT; ctx->Color.BlendEnabled = enabled; _mesa_update_allow_draw_out_of_order(ctx); } @@ -1381,7 +1411,8 @@ _mesa_set_enablei(struct gl_context *ctx, GLenum cap, } if (((ctx->Scissor.EnableFlags >> index) & 1) != state) { FLUSH_VERTICES(ctx, - ctx->DriverFlags.NewScissorTest ? 0 : _NEW_SCISSOR); + ctx->DriverFlags.NewScissorTest ? 0 : _NEW_SCISSOR, + GL_SCISSOR_BIT | GL_ENABLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewScissorTest; if (state) ctx->Scissor.EnableFlags |= (1 << index); diff --git a/src/mesa/main/eval.c b/src/mesa/main/eval.c index 874f5255e9c..9db9934eaef 100644 --- a/src/mesa/main/eval.c +++ b/src/mesa/main/eval.c @@ -353,7 +353,7 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, pnts = _mesa_copy_map_points1d(target, ustride, uorder, (GLdouble*) points); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_EVAL_BIT); vbo_exec_update_eval_maps(ctx); map->Order = uorder; map->u1 = u1; @@ -449,7 +449,7 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, vstride, vorder, (GLdouble*) points); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_EVAL_BIT); vbo_exec_update_eval_maps(ctx); map->Uorder = uorder; map->u1 = u1; @@ -770,7 +770,7 @@ _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid1f" ); return; } - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_EVAL_BIT); vbo_exec_update_eval_maps(ctx); ctx->Eval.MapGrid1un = un; ctx->Eval.MapGrid1u1 = u1; @@ -801,7 +801,7 @@ _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, return; } - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_EVAL_BIT); vbo_exec_update_eval_maps(ctx); ctx->Eval.MapGrid2un = un; ctx->Eval.MapGrid2u1 = u1; diff --git a/src/mesa/main/externalobjects.c b/src/mesa/main/externalobjects.c index 6a766485915..01c859f8301 100644 --- a/src/mesa/main/externalobjects.c +++ b/src/mesa/main/externalobjects.c @@ -729,7 +729,7 @@ _mesa_WaitSemaphoreEXT(GLuint semaphore, if (!semObj) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); bufObjs = malloc(sizeof(struct gl_buffer_object *) * numBufferBarriers); if (!bufObjs) { @@ -789,7 +789,7 @@ _mesa_SignalSemaphoreEXT(GLuint semaphore, if (!semObj) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); bufObjs = malloc(sizeof(struct gl_buffer_object *) * numBufferBarriers); if (!bufObjs) { diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 267e2f1319a..a1a084d1f77 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1093,7 +1093,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, assert(_mesa_is_user_fbo(fb)); /* we're changing framebuffer fields here */ - FLUSH_VERTICES(ctx, _NEW_BUFFERS); + FLUSH_VERTICES(ctx, _NEW_BUFFERS, 0); numImages = 0; fb->Width = 0; @@ -1985,7 +1985,7 @@ _mesa_DeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers) return; } - FLUSH_VERTICES(ctx, _NEW_BUFFERS); + FLUSH_VERTICES(ctx, _NEW_BUFFERS, 0); for (i = 0; i < n; i++) { if (renderbuffers[i] > 0) { @@ -2493,7 +2493,7 @@ _mesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, storageSamples) == GL_NO_ERROR); } - FLUSH_VERTICES(ctx, _NEW_BUFFERS); + FLUSH_VERTICES(ctx, _NEW_BUFFERS, 0); if (rb->InternalFormat == internalFormat && rb->Width == (GLuint) width && @@ -2707,7 +2707,7 @@ _mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image) return; } - FLUSH_VERTICES(ctx, _NEW_BUFFERS); + FLUSH_VERTICES(ctx, _NEW_BUFFERS, 0); ctx->Driver.EGLImageTargetRenderbufferStorage(ctx, rb, image); } @@ -3119,13 +3119,13 @@ _mesa_bind_framebuffers(struct gl_context *ctx, * that a render-to-texture case. */ if (bindReadBuf) { - FLUSH_VERTICES(ctx, _NEW_BUFFERS); + FLUSH_VERTICES(ctx, _NEW_BUFFERS, 0); _mesa_reference_framebuffer(&ctx->ReadBuffer, newReadFb); } if (bindDrawBuf) { - FLUSH_VERTICES(ctx, _NEW_BUFFERS); + FLUSH_VERTICES(ctx, _NEW_BUFFERS, 0); ctx->NewDriverState |= ctx->DriverFlags.NewSampleLocations; /* check if old framebuffer had any texture attachments */ @@ -3177,7 +3177,7 @@ _mesa_DeleteFramebuffers(GLsizei n, const GLuint *framebuffers) return; } - FLUSH_VERTICES(ctx, _NEW_BUFFERS); + FLUSH_VERTICES(ctx, _NEW_BUFFERS, 0); for (i = 0; i < n; i++) { if (framebuffers[i] > 0) { @@ -3764,7 +3764,7 @@ _mesa_framebuffer_texture(struct gl_context *ctx, struct gl_framebuffer *fb, GLint level, GLsizei samples, GLuint layer, GLboolean layered) { - FLUSH_VERTICES(ctx, _NEW_BUFFERS); + FLUSH_VERTICES(ctx, _NEW_BUFFERS, 0); simple_mtx_lock(&fb->Mutex); if (texObj) { @@ -4172,7 +4172,7 @@ _mesa_framebuffer_renderbuffer(struct gl_context *ctx, { assert(!_mesa_is_winsys_fbo(fb)); - FLUSH_VERTICES(ctx, _NEW_BUFFERS); + FLUSH_VERTICES(ctx, _NEW_BUFFERS, 0); assert(ctx->Driver.FramebufferRenderbuffer); ctx->Driver.FramebufferRenderbuffer(ctx, fb, attachment, rb); diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c index 8b3410f39c5..fbac508b32e 100644 --- a/src/mesa/main/feedback.c +++ b/src/mesa/main/feedback.c @@ -84,7 +84,7 @@ _mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ) return; } - FLUSH_VERTICES(ctx, _NEW_RENDERMODE); /* Always flush */ + FLUSH_VERTICES(ctx, _NEW_RENDERMODE, 0); /* Always flush */ ctx->Feedback.Type = type; ctx->Feedback.BufferSize = size; ctx->Feedback.Buffer = buffer; @@ -98,7 +98,7 @@ _mesa_PassThrough( GLfloat token ) GET_CURRENT_CONTEXT(ctx); if (ctx->RenderMode==GL_FEEDBACK) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); _mesa_feedback_token( ctx, (GLfloat) (GLint) GL_PASS_THROUGH_TOKEN ); _mesa_feedback_token( ctx, token ); } @@ -169,7 +169,7 @@ _mesa_SelectBuffer( GLsizei size, GLuint *buffer ) return; /* KW: added return */ } - FLUSH_VERTICES(ctx, _NEW_RENDERMODE); + FLUSH_VERTICES(ctx, _NEW_RENDERMODE, 0); ctx->Select.Buffer = buffer; ctx->Select.BufferSize = size; ctx->Select.BufferCount = 0; @@ -269,7 +269,7 @@ void GLAPIENTRY _mesa_InitNames( void ) { GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); /* Record the hit before the HitFlag is wiped out again. */ if (ctx->RenderMode == GL_SELECT) { @@ -309,7 +309,7 @@ _mesa_LoadName( GLuint name ) return; } - FLUSH_VERTICES(ctx, _NEW_RENDERMODE); + FLUSH_VERTICES(ctx, _NEW_RENDERMODE, 0); if (ctx->Select.HitFlag) { write_hit_record( ctx ); @@ -343,7 +343,7 @@ _mesa_PushName( GLuint name ) return; } - FLUSH_VERTICES(ctx, _NEW_RENDERMODE); + FLUSH_VERTICES(ctx, _NEW_RENDERMODE, 0); if (ctx->Select.HitFlag) { write_hit_record( ctx ); } @@ -373,7 +373,7 @@ _mesa_PopName( void ) return; } - FLUSH_VERTICES(ctx, _NEW_RENDERMODE); + FLUSH_VERTICES(ctx, _NEW_RENDERMODE, 0); if (ctx->Select.HitFlag) { write_hit_record( ctx ); } @@ -416,7 +416,7 @@ _mesa_RenderMode( GLenum mode ) if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glRenderMode %s\n", _mesa_enum_to_string(mode)); - FLUSH_VERTICES(ctx, _NEW_RENDERMODE); + FLUSH_VERTICES(ctx, _NEW_RENDERMODE, 0); switch (ctx->RenderMode) { case GL_RENDER: diff --git a/src/mesa/main/fog.c b/src/mesa/main/fog.c index 0decf762a99..a9a354bd689 100644 --- a/src/mesa/main/fog.c +++ b/src/mesa/main/fog.c @@ -104,7 +104,7 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params ) } if (ctx->Fog.Mode == m) return; - FLUSH_VERTICES(ctx, _NEW_FOG); + FLUSH_VERTICES(ctx, _NEW_FOG, GL_FOG_BIT); ctx->Fog.Mode = m; ctx->Fog._PackedEnabledMode = ctx->Fog.Enabled ? ctx->Fog._PackedMode : FOG_NONE; @@ -116,19 +116,19 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params ) } if (ctx->Fog.Density == *params) return; - FLUSH_VERTICES(ctx, _NEW_FOG); + FLUSH_VERTICES(ctx, _NEW_FOG, GL_FOG_BIT); ctx->Fog.Density = *params; break; case GL_FOG_START: if (ctx->Fog.Start == *params) return; - FLUSH_VERTICES(ctx, _NEW_FOG); + FLUSH_VERTICES(ctx, _NEW_FOG, GL_FOG_BIT); ctx->Fog.Start = *params; break; case GL_FOG_END: if (ctx->Fog.End == *params) return; - FLUSH_VERTICES(ctx, _NEW_FOG); + FLUSH_VERTICES(ctx, _NEW_FOG, GL_FOG_BIT); ctx->Fog.End = *params; break; case GL_FOG_INDEX: @@ -136,13 +136,13 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params ) goto invalid_pname; if (ctx->Fog.Index == *params) return; - FLUSH_VERTICES(ctx, _NEW_FOG); + FLUSH_VERTICES(ctx, _NEW_FOG, GL_FOG_BIT); ctx->Fog.Index = *params; break; case GL_FOG_COLOR: if (TEST_EQ_4V(ctx->Fog.Color, params)) return; - FLUSH_VERTICES(ctx, _NEW_FOG); + FLUSH_VERTICES(ctx, _NEW_FOG, GL_FOG_BIT); ctx->Fog.ColorUnclamped[0] = params[0]; ctx->Fog.ColorUnclamped[1] = params[1]; ctx->Fog.ColorUnclamped[2] = params[2]; @@ -161,7 +161,7 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params ) } if (ctx->Fog.FogCoordinateSource == p) return; - FLUSH_VERTICES(ctx, _NEW_FOG); + FLUSH_VERTICES(ctx, _NEW_FOG, GL_FOG_BIT); ctx->Fog.FogCoordinateSource = p; break; } @@ -174,7 +174,7 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params ) } if (ctx->Fog.FogDistanceMode == p) return; - FLUSH_VERTICES(ctx, _NEW_FOG); + FLUSH_VERTICES(ctx, _NEW_FOG, GL_FOG_BIT); ctx->Fog.FogDistanceMode = p; break; } diff --git a/src/mesa/main/genmipmap.c b/src/mesa/main/genmipmap.c index 16e2b037635..36727bb7060 100644 --- a/src/mesa/main/genmipmap.c +++ b/src/mesa/main/genmipmap.c @@ -115,7 +115,7 @@ generate_texture_mipmap(struct gl_context *ctx, { struct gl_texture_image *srcImage; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (texObj->Attrib.BaseLevel >= texObj->Attrib.MaxLevel) { /* nothing to do */ diff --git a/src/mesa/main/hint.c b/src/mesa/main/hint.c index 890be7b39c8..193a3621cbf 100644 --- a/src/mesa/main/hint.c +++ b/src/mesa/main/hint.c @@ -54,7 +54,7 @@ _mesa_Hint( GLenum target, GLenum mode ) goto invalid_target; if (ctx->Hint.Fog == mode) return; - FLUSH_VERTICES(ctx, _NEW_HINT); + FLUSH_VERTICES(ctx, _NEW_HINT, GL_HINT_BIT); ctx->Hint.Fog = mode; break; case GL_LINE_SMOOTH_HINT: @@ -62,7 +62,7 @@ _mesa_Hint( GLenum target, GLenum mode ) goto invalid_target; if (ctx->Hint.LineSmooth == mode) return; - FLUSH_VERTICES(ctx, _NEW_HINT); + FLUSH_VERTICES(ctx, _NEW_HINT, GL_HINT_BIT); ctx->Hint.LineSmooth = mode; break; case GL_PERSPECTIVE_CORRECTION_HINT: @@ -70,7 +70,7 @@ _mesa_Hint( GLenum target, GLenum mode ) goto invalid_target; if (ctx->Hint.PerspectiveCorrection == mode) return; - FLUSH_VERTICES(ctx, _NEW_HINT); + FLUSH_VERTICES(ctx, _NEW_HINT, GL_HINT_BIT); ctx->Hint.PerspectiveCorrection = mode; break; case GL_POINT_SMOOTH_HINT: @@ -78,7 +78,7 @@ _mesa_Hint( GLenum target, GLenum mode ) goto invalid_target; if (ctx->Hint.PointSmooth == mode) return; - FLUSH_VERTICES(ctx, _NEW_HINT); + FLUSH_VERTICES(ctx, _NEW_HINT, GL_HINT_BIT); ctx->Hint.PointSmooth = mode; break; case GL_POLYGON_SMOOTH_HINT: @@ -86,7 +86,7 @@ _mesa_Hint( GLenum target, GLenum mode ) goto invalid_target; if (ctx->Hint.PolygonSmooth == mode) return; - FLUSH_VERTICES(ctx, _NEW_HINT); + FLUSH_VERTICES(ctx, _NEW_HINT, GL_HINT_BIT); ctx->Hint.PolygonSmooth = mode; break; @@ -96,7 +96,7 @@ _mesa_Hint( GLenum target, GLenum mode ) goto invalid_target; if (ctx->Hint.TextureCompression == mode) return; - FLUSH_VERTICES(ctx, _NEW_HINT); + FLUSH_VERTICES(ctx, _NEW_HINT, GL_HINT_BIT); ctx->Hint.TextureCompression = mode; break; @@ -106,7 +106,7 @@ _mesa_Hint( GLenum target, GLenum mode ) goto invalid_target; if (ctx->Hint.GenerateMipmap == mode) return; - FLUSH_VERTICES(ctx, _NEW_HINT); + FLUSH_VERTICES(ctx, _NEW_HINT, GL_HINT_BIT); ctx->Hint.GenerateMipmap = mode; break; @@ -116,7 +116,7 @@ _mesa_Hint( GLenum target, GLenum mode ) goto invalid_target; if (ctx->Hint.FragmentShaderDerivative == mode) return; - FLUSH_VERTICES(ctx, _NEW_HINT); + FLUSH_VERTICES(ctx, _NEW_HINT, GL_HINT_BIT); ctx->Hint.FragmentShaderDerivative = mode; break; diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index 8c7f131066e..497bbd3efc4 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -51,7 +51,7 @@ _mesa_ShadeModel( GLenum mode ) return; } - FLUSH_VERTICES(ctx, _NEW_LIGHT); + FLUSH_VERTICES(ctx, _NEW_LIGHT, GL_LIGHTING_BIT); ctx->Light.ShadeModel = mode; if (ctx->Driver.ShadeModel) @@ -84,7 +84,7 @@ _mesa_ProvokingVertex(GLenum mode) return; } - FLUSH_VERTICES(ctx, _NEW_LIGHT); + FLUSH_VERTICES(ctx, _NEW_LIGHT, GL_LIGHTING_BIT); ctx->Light.ProvokingVertex = mode; } @@ -110,26 +110,26 @@ _mesa_light(struct gl_context *ctx, GLuint lnum, GLenum pname, const GLfloat *pa case GL_AMBIENT: if (TEST_EQ_4V(lu->Ambient, params)) return; - FLUSH_VERTICES(ctx, _NEW_LIGHT); + FLUSH_VERTICES(ctx, _NEW_LIGHT, GL_LIGHTING_BIT); COPY_4V( lu->Ambient, params ); break; case GL_DIFFUSE: if (TEST_EQ_4V(lu->Diffuse, params)) return; - FLUSH_VERTICES(ctx, _NEW_LIGHT); + FLUSH_VERTICES(ctx, _NEW_LIGHT, GL_LIGHTING_BIT); COPY_4V( lu->Diffuse, params ); break; case GL_SPECULAR: if (TEST_EQ_4V(lu->Specular, params)) return; - FLUSH_VERTICES(ctx, _NEW_LIGHT); + FLUSH_VERTICES(ctx, _NEW_LIGHT, GL_LIGHTING_BIT); COPY_4V( lu->Specular, params ); break; case GL_POSITION: { /* NOTE: position has already been transformed by ModelView! */ if (TEST_EQ_4V(lu->EyePosition, params)) return; - FLUSH_VERTICES(ctx, _NEW_LIGHT); + FLUSH_VERTICES(ctx, _NEW_LIGHT, GL_LIGHTING_BIT); COPY_4V(lu->EyePosition, params); if (lu->EyePosition[3] != 0.0F) light->_Flags |= LIGHT_POSITIONAL; @@ -154,7 +154,7 @@ _mesa_light(struct gl_context *ctx, GLuint lnum, GLenum pname, const GLfloat *pa /* NOTE: Direction already transformed by inverse ModelView! */ if (TEST_EQ_3V(lu->SpotDirection, params)) return; - FLUSH_VERTICES(ctx, _NEW_LIGHT); + FLUSH_VERTICES(ctx, _NEW_LIGHT, GL_LIGHTING_BIT); COPY_3V(lu->SpotDirection, params); break; case GL_SPOT_EXPONENT: @@ -162,14 +162,14 @@ _mesa_light(struct gl_context *ctx, GLuint lnum, GLenum pname, const GLfloat *pa assert(params[0] <= ctx->Const.MaxSpotExponent); if (lu->SpotExponent == params[0]) return; - FLUSH_VERTICES(ctx, _NEW_LIGHT); + FLUSH_VERTICES(ctx, _NEW_LIGHT, GL_LIGHTING_BIT); lu->SpotExponent = params[0]; break; case GL_SPOT_CUTOFF: assert(params[0] == 180.0F || (params[0] >= 0.0F && params[0] <= 90.0F)); if (lu->SpotCutoff == params[0]) return; - FLUSH_VERTICES(ctx, _NEW_LIGHT); + FLUSH_VERTICES(ctx, _NEW_LIGHT, GL_LIGHTING_BIT); lu->SpotCutoff = params[0]; lu->_CosCutoff = (cosf(lu->SpotCutoff * M_PI / 180.0)); if (lu->_CosCutoff < 0) @@ -183,21 +183,21 @@ _mesa_light(struct gl_context *ctx, GLuint lnum, GLenum pname, const GLfloat *pa assert(params[0] >= 0.0F); if (lu->ConstantAttenuation == params[0]) return; - FLUSH_VERTICES(ctx, _NEW_LIGHT); + FLUSH_VERTICES(ctx, _NEW_LIGHT, GL_LIGHTING_BIT); lu->ConstantAttenuation = params[0]; break; case GL_LINEAR_ATTENUATION: assert(params[0] >= 0.0F); if (lu->LinearAttenuation == params[0]) return; - FLUSH_VERTICES(ctx, _NEW_LIGHT); + FLUSH_VERTICES(ctx, _NEW_LIGHT, GL_LIGHTING_BIT); lu->LinearAttenuation = params[0]; break; case GL_QUADRATIC_ATTENUATION: assert(params[0] >= 0.0F); if (lu->QuadraticAttenuation == params[0]) return; - FLUSH_VERTICES(ctx, _NEW_LIGHT); + FLUSH_VERTICES(ctx, _NEW_LIGHT, GL_LIGHTING_BIT); lu->QuadraticAttenuation = params[0]; break; default: @@ -461,7 +461,7 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params ) case GL_LIGHT_MODEL_AMBIENT: if (TEST_EQ_4V( ctx->Light.Model.Ambient, params )) return; - FLUSH_VERTICES(ctx, _NEW_LIGHT); + FLUSH_VERTICES(ctx, _NEW_LIGHT, GL_LIGHTING_BIT); COPY_4V( ctx->Light.Model.Ambient, params ); break; case GL_LIGHT_MODEL_LOCAL_VIEWER: @@ -470,14 +470,14 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params ) newbool = (params[0] != 0.0F); if (ctx->Light.Model.LocalViewer == newbool) return; - FLUSH_VERTICES(ctx, _NEW_LIGHT); + FLUSH_VERTICES(ctx, _NEW_LIGHT, GL_LIGHTING_BIT); ctx->Light.Model.LocalViewer = newbool; break; case GL_LIGHT_MODEL_TWO_SIDE: newbool = (params[0] != 0.0F); if (ctx->Light.Model.TwoSide == newbool) return; - FLUSH_VERTICES(ctx, _NEW_LIGHT); + FLUSH_VERTICES(ctx, _NEW_LIGHT, GL_LIGHTING_BIT); ctx->Light.Model.TwoSide = newbool; break; case GL_LIGHT_MODEL_COLOR_CONTROL: @@ -494,7 +494,7 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params ) } if (ctx->Light.Model.ColorControl == newenum) return; - FLUSH_VERTICES(ctx, _NEW_LIGHT); + FLUSH_VERTICES(ctx, _NEW_LIGHT, GL_LIGHTING_BIT); ctx->Light.Model.ColorControl = newenum; break; default: @@ -763,7 +763,7 @@ _mesa_ColorMaterial( GLenum face, GLenum mode ) ctx->Light.ColorMaterialMode == mode) return; - FLUSH_VERTICES(ctx, _NEW_LIGHT); + FLUSH_VERTICES(ctx, _NEW_LIGHT, GL_LIGHTING_BIT); ctx->Light._ColorMaterialBitmask = bitmask; ctx->Light.ColorMaterialFace = face; ctx->Light.ColorMaterialMode = mode; @@ -784,8 +784,8 @@ _mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params ) GET_CURRENT_CONTEXT(ctx); GLuint f; GLfloat (*mat)[4] = ctx->Light.Material.Attrib; - FLUSH_VERTICES(ctx, 0); /* update materials */ + FLUSH_VERTICES(ctx, 0, 0); /* update materials */ FLUSH_CURRENT(ctx, 0); /* update ctx->Light.Material from vertex buffer */ if (face==GL_FRONT) { @@ -839,7 +839,7 @@ _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params ) assert(ctx->API == API_OPENGL_COMPAT); - FLUSH_VERTICES(ctx, 0); /* update materials */ + FLUSH_VERTICES(ctx, 0, 0); /* update materials */ FLUSH_CURRENT(ctx, 0); /* update ctx->Light.Material from vertex buffer */ if (face==GL_FRONT) { diff --git a/src/mesa/main/lines.c b/src/mesa/main/lines.c index 78d3a7729b9..275e9a229b3 100644 --- a/src/mesa/main/lines.c +++ b/src/mesa/main/lines.c @@ -67,7 +67,7 @@ line_width(struct gl_context *ctx, GLfloat width, bool no_error) return; } - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLineState ? 0 : _NEW_LINE); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLineState ? 0 : _NEW_LINE, GL_LINE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewLineState; ctx->Line.Width = width; @@ -122,7 +122,7 @@ _mesa_LineStipple( GLint factor, GLushort pattern ) ctx->Line.StipplePattern == pattern) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLineState ? 0 : _NEW_LINE); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLineState ? 0 : _NEW_LINE, GL_LINE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewLineState; ctx->Line.StippleFactor = factor; ctx->Line.StipplePattern = pattern; diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index e6f301ad78b..f9ae68f67d4 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -115,7 +115,7 @@ static void matrix_frustum(struct gl_matrix_stack* stack, return; } - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); _math_matrix_frustum(stack->Top, (GLfloat) left, (GLfloat) right, @@ -196,7 +196,7 @@ matrix_ortho(struct gl_matrix_stack* stack, return; } - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); _math_matrix_ortho( stack->Top, (GLfloat) left, (GLfloat) right, @@ -285,6 +285,7 @@ _mesa_MatrixMode( GLenum mode ) if (stack) { ctx->CurrentStack = stack; ctx->Transform.MatrixMode = mode; + ctx->PopAttribState |= GL_TRANSFORM_BIT; } } @@ -377,7 +378,7 @@ pop_matrix( struct gl_context *ctx, struct gl_matrix_stack *stack ) */ if (memcmp(stack->Top, &stack->Stack[stack->Depth], sizeof(GLmatrix))) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); ctx->NewState |= stack->DirtyFlag; } @@ -445,7 +446,7 @@ _mesa_MatrixPopEXT( GLenum matrixMode ) void _mesa_load_identity_matrix(struct gl_context *ctx, struct gl_matrix_stack *stack) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); _math_matrix_set_identity(stack->Top); ctx->NewState |= stack->DirtyFlag; @@ -491,7 +492,7 @@ _mesa_load_matrix(struct gl_context *ctx, struct gl_matrix_stack *stack, const GLfloat *m) { if (memcmp(m, stack->Top->m, 16 * sizeof(GLfloat)) != 0) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); _math_matrix_loadf(stack->Top, m); ctx->NewState |= stack->DirtyFlag; } @@ -575,7 +576,7 @@ matrix_mult(struct gl_matrix_stack *stack, const GLfloat *m, const char* caller) m[2], m[6], m[10], m[14], m[3], m[7], m[11], m[15]); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); _math_matrix_mul_floats(stack->Top, m); ctx->NewState |= stack->DirtyFlag; } @@ -619,7 +620,7 @@ matrix_rotate(struct gl_matrix_stack *stack, GLfloat angle, { GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (angle != 0.0F) { _math_matrix_rotate(stack->Top, angle, x, y, z); ctx->NewState |=stack->DirtyFlag; @@ -680,7 +681,7 @@ _mesa_Scalef( GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); _math_matrix_scale( ctx->CurrentStack->Top, x, y, z); ctx->NewState |= ctx->CurrentStack->DirtyFlag; } @@ -696,7 +697,7 @@ _mesa_MatrixScalefEXT( GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z ) if (!stack) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); _math_matrix_scale(stack->Top, x, y, z); ctx->NewState |= stack->DirtyFlag; } @@ -720,7 +721,7 @@ _mesa_Translatef( GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); _math_matrix_translate( ctx->CurrentStack->Top, x, y, z); ctx->NewState |= ctx->CurrentStack->DirtyFlag; } @@ -735,7 +736,7 @@ _mesa_MatrixTranslatefEXT( GLenum matrixMode, GLfloat x, GLfloat y, GLfloat z ) if (!stack) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); _math_matrix_translate(stack->Top, x, y, z); ctx->NewState |= stack->DirtyFlag; } diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 3836f8b4c65..8f08396fe15 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1892,6 +1892,7 @@ prepare_mipmap_level(struct gl_context *ctx, _mesa_update_fbo_texture(ctx, texObj, face, level); ctx->NewState |= _NEW_TEXTURE_OBJECT; + ctx->PopAttribState |= GL_TEXTURE_BIT; } } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 69c72955ec9..edd466f4ca8 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -5390,6 +5390,7 @@ struct gl_context GLenum16 RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */ GLbitfield NewState; /**< bitwise-or of _NEW_* flags */ + GLbitfield PopAttribState; /**< Updated state since glPushAttrib */ uint64_t NewDriverState; /**< bitwise-or of flags from DriverFlags */ struct gl_driver_flags DriverFlags; diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c index c1d0e3be94f..2d243eaac48 100644 --- a/src/mesa/main/multisample.c +++ b/src/mesa/main/multisample.c @@ -47,7 +47,8 @@ _mesa_SampleCoverage(GLclampf value, GLboolean invert) ctx->Multisample.SampleCoverageValue == value) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleMask ? 0 : _NEW_MULTISAMPLE); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleMask ? 0 : _NEW_MULTISAMPLE, + GL_MULTISAMPLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewSampleMask; ctx->Multisample.SampleCoverageValue = value; ctx->Multisample.SampleCoverageInvert = invert; @@ -132,7 +133,7 @@ sample_maski(struct gl_context *ctx, GLuint index, GLbitfield mask) if (ctx->Multisample.SampleMaskValue == mask) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleMask ? 0 : _NEW_MULTISAMPLE); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleMask ? 0 : _NEW_MULTISAMPLE, 0); ctx->NewDriverState |= ctx->DriverFlags.NewSampleMask; ctx->Multisample.SampleMaskValue = mask; } @@ -171,7 +172,8 @@ min_sample_shading(struct gl_context *ctx, GLclampf value) return; FLUSH_VERTICES(ctx, - ctx->DriverFlags.NewSampleShading ? 0 : _NEW_MULTISAMPLE); + ctx->DriverFlags.NewSampleShading ? 0 : _NEW_MULTISAMPLE, + GL_MULTISAMPLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewSampleShading; ctx->Multisample.MinSampleShadingValue = value; } @@ -359,7 +361,8 @@ _mesa_AlphaToCoverageDitherControlNV_no_error(GLenum mode) GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleAlphaToXEnable ? 0 : - _NEW_MULTISAMPLE); + _NEW_MULTISAMPLE, + GL_MULTISAMPLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewSampleAlphaToXEnable; ctx->Multisample.SampleAlphaToCoverageDitherControl = mode; } @@ -370,7 +373,8 @@ _mesa_AlphaToCoverageDitherControlNV(GLenum mode) GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleAlphaToXEnable ? 0 : - _NEW_MULTISAMPLE); + _NEW_MULTISAMPLE, + GL_MULTISAMPLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewSampleAlphaToXEnable; switch (mode) { case GL_ALPHA_TO_COVERAGE_DITHER_DEFAULT_NV: diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c index 41af16afa2c..0ff3e5c7d18 100644 --- a/src/mesa/main/pipelineobj.c +++ b/src/mesa/main/pipelineobj.c @@ -514,7 +514,7 @@ _mesa_bind_pipeline(struct gl_context *ctx, * considered current." */ if (&ctx->Shader != ctx->_Shader) { - FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); + FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS, 0); if (pipe != NULL) { /* Bound the pipeline to the current program and diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index a5cb6d85ef5..ffa362f297d 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -51,7 +51,7 @@ _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor ) ctx->Pixel.ZoomY == yfactor) return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); + FLUSH_VERTICES(ctx, _NEW_PIXEL, GL_PIXEL_MODE_BIT); ctx->Pixel.ZoomX = xfactor; ctx->Pixel.ZoomY = yfactor; } @@ -191,7 +191,7 @@ _mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values ) } } - FLUSH_VERTICES(ctx, _NEW_PIXEL); + FLUSH_VERTICES(ctx, _NEW_PIXEL, 0); if (!validate_pbo_access(ctx, &ctx->Unpack, mapsize, GL_INTENSITY, GL_FLOAT, INT_MAX, values)) { @@ -232,7 +232,7 @@ _mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values ) } } - FLUSH_VERTICES(ctx, _NEW_PIXEL); + FLUSH_VERTICES(ctx, _NEW_PIXEL, 0); if (!validate_pbo_access(ctx, &ctx->Unpack, mapsize, GL_INTENSITY, GL_UNSIGNED_INT, INT_MAX, values)) { @@ -287,7 +287,7 @@ _mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values ) } } - FLUSH_VERTICES(ctx, _NEW_PIXEL); + FLUSH_VERTICES(ctx, _NEW_PIXEL, 0); if (!validate_pbo_access(ctx, &ctx->Unpack, mapsize, GL_INTENSITY, GL_UNSIGNED_SHORT, INT_MAX, values)) { @@ -497,85 +497,85 @@ _mesa_PixelTransferf( GLenum pname, GLfloat param ) case GL_MAP_COLOR: if (ctx->Pixel.MapColorFlag == (param ? GL_TRUE : GL_FALSE)) return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); + FLUSH_VERTICES(ctx, _NEW_PIXEL, GL_PIXEL_MODE_BIT); ctx->Pixel.MapColorFlag = param ? GL_TRUE : GL_FALSE; break; case GL_MAP_STENCIL: if (ctx->Pixel.MapStencilFlag == (param ? GL_TRUE : GL_FALSE)) return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); + FLUSH_VERTICES(ctx, _NEW_PIXEL, GL_PIXEL_MODE_BIT); ctx->Pixel.MapStencilFlag = param ? GL_TRUE : GL_FALSE; break; case GL_INDEX_SHIFT: if (ctx->Pixel.IndexShift == (GLint) param) return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); + FLUSH_VERTICES(ctx, _NEW_PIXEL, GL_PIXEL_MODE_BIT); ctx->Pixel.IndexShift = (GLint) param; break; case GL_INDEX_OFFSET: if (ctx->Pixel.IndexOffset == (GLint) param) return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); + FLUSH_VERTICES(ctx, _NEW_PIXEL, GL_PIXEL_MODE_BIT); ctx->Pixel.IndexOffset = (GLint) param; break; case GL_RED_SCALE: if (ctx->Pixel.RedScale == param) return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); + FLUSH_VERTICES(ctx, _NEW_PIXEL, GL_PIXEL_MODE_BIT); ctx->Pixel.RedScale = param; break; case GL_RED_BIAS: if (ctx->Pixel.RedBias == param) return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); + FLUSH_VERTICES(ctx, _NEW_PIXEL, GL_PIXEL_MODE_BIT); ctx->Pixel.RedBias = param; break; case GL_GREEN_SCALE: if (ctx->Pixel.GreenScale == param) return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); + FLUSH_VERTICES(ctx, _NEW_PIXEL, GL_PIXEL_MODE_BIT); ctx->Pixel.GreenScale = param; break; case GL_GREEN_BIAS: if (ctx->Pixel.GreenBias == param) return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); + FLUSH_VERTICES(ctx, _NEW_PIXEL, GL_PIXEL_MODE_BIT); ctx->Pixel.GreenBias = param; break; case GL_BLUE_SCALE: if (ctx->Pixel.BlueScale == param) return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); + FLUSH_VERTICES(ctx, _NEW_PIXEL, GL_PIXEL_MODE_BIT); ctx->Pixel.BlueScale = param; break; case GL_BLUE_BIAS: if (ctx->Pixel.BlueBias == param) return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); + FLUSH_VERTICES(ctx, _NEW_PIXEL, GL_PIXEL_MODE_BIT); ctx->Pixel.BlueBias = param; break; case GL_ALPHA_SCALE: if (ctx->Pixel.AlphaScale == param) return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); + FLUSH_VERTICES(ctx, _NEW_PIXEL, GL_PIXEL_MODE_BIT); ctx->Pixel.AlphaScale = param; break; case GL_ALPHA_BIAS: if (ctx->Pixel.AlphaBias == param) return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); + FLUSH_VERTICES(ctx, _NEW_PIXEL, GL_PIXEL_MODE_BIT); ctx->Pixel.AlphaBias = param; break; case GL_DEPTH_SCALE: if (ctx->Pixel.DepthScale == param) return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); + FLUSH_VERTICES(ctx, _NEW_PIXEL, GL_PIXEL_MODE_BIT); ctx->Pixel.DepthScale = param; break; case GL_DEPTH_BIAS: if (ctx->Pixel.DepthBias == param) return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); + FLUSH_VERTICES(ctx, _NEW_PIXEL, GL_PIXEL_MODE_BIT); ctx->Pixel.DepthBias = param; break; default: diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c index 10b2ab16514..124f3ca07ec 100644 --- a/src/mesa/main/points.c +++ b/src/mesa/main/points.c @@ -51,7 +51,7 @@ point_size(struct gl_context *ctx, GLfloat size, bool no_error) return; } - FLUSH_VERTICES(ctx, _NEW_POINT); + FLUSH_VERTICES(ctx, _NEW_POINT, GL_POINT_BIT); ctx->Point.Size = size; if (ctx->Driver.PointSize) @@ -130,7 +130,7 @@ _mesa_PointParameterfv( GLenum pname, const GLfloat *params) case GL_DISTANCE_ATTENUATION_EXT: if (TEST_EQ_3V(ctx->Point.Params, params)) return; - FLUSH_VERTICES(ctx, _NEW_POINT); + FLUSH_VERTICES(ctx, _NEW_POINT, GL_POINT_BIT); COPY_3V(ctx->Point.Params, params); ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0F || ctx->Point.Params[1] != 0.0F || @@ -144,7 +144,7 @@ _mesa_PointParameterfv( GLenum pname, const GLfloat *params) } if (ctx->Point.MinSize == params[0]) return; - FLUSH_VERTICES(ctx, _NEW_POINT); + FLUSH_VERTICES(ctx, _NEW_POINT, GL_POINT_BIT); ctx->Point.MinSize = params[0]; break; case GL_POINT_SIZE_MAX_EXT: @@ -155,7 +155,7 @@ _mesa_PointParameterfv( GLenum pname, const GLfloat *params) } if (ctx->Point.MaxSize == params[0]) return; - FLUSH_VERTICES(ctx, _NEW_POINT); + FLUSH_VERTICES(ctx, _NEW_POINT, GL_POINT_BIT); ctx->Point.MaxSize = params[0]; break; case GL_POINT_FADE_THRESHOLD_SIZE_EXT: @@ -166,7 +166,7 @@ _mesa_PointParameterfv( GLenum pname, const GLfloat *params) } if (ctx->Point.Threshold == params[0]) return; - FLUSH_VERTICES(ctx, _NEW_POINT); + FLUSH_VERTICES(ctx, _NEW_POINT, GL_POINT_BIT); ctx->Point.Threshold = params[0]; break; case GL_POINT_SPRITE_COORD_ORIGIN: @@ -183,7 +183,7 @@ _mesa_PointParameterfv( GLenum pname, const GLfloat *params) } if (ctx->Point.SpriteOrigin == value) return; - FLUSH_VERTICES(ctx, _NEW_POINT); + FLUSH_VERTICES(ctx, _NEW_POINT, GL_POINT_BIT); ctx->Point.SpriteOrigin = value; } else { diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c index 54674521cbc..dac56e4a894 100644 --- a/src/mesa/main/polygon.c +++ b/src/mesa/main/polygon.c @@ -62,7 +62,8 @@ cull_face(struct gl_context *ctx, GLenum mode, bool no_error) return; } - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewPolygonState ? 0 : _NEW_POLYGON); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewPolygonState ? 0 : _NEW_POLYGON, + GL_POLYGON_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewPolygonState; ctx->Polygon.CullFaceMode = mode; @@ -113,7 +114,8 @@ front_face(struct gl_context *ctx, GLenum mode, bool no_error) return; } - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewPolygonState ? 0 : _NEW_POLYGON); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewPolygonState ? 0 : _NEW_POLYGON, + GL_POLYGON_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewPolygonState; ctx->Polygon.FrontFace = mode; @@ -186,14 +188,16 @@ polygon_mode(struct gl_context *ctx, GLenum face, GLenum mode, bool no_error) } if (ctx->Polygon.FrontMode == mode) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewPolygonState ? 0 : _NEW_POLYGON); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewPolygonState ? 0 : _NEW_POLYGON, + GL_POLYGON_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewPolygonState; ctx->Polygon.FrontMode = mode; break; case GL_FRONT_AND_BACK: if (ctx->Polygon.FrontMode == mode && ctx->Polygon.BackMode == mode) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewPolygonState ? 0 : _NEW_POLYGON); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewPolygonState ? 0 : _NEW_POLYGON, + GL_POLYGON_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewPolygonState; ctx->Polygon.FrontMode = mode; ctx->Polygon.BackMode = mode; @@ -205,7 +209,8 @@ polygon_mode(struct gl_context *ctx, GLenum face, GLenum mode, bool no_error) } if (ctx->Polygon.BackMode == mode) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewPolygonState ? 0 : _NEW_POLYGON); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewPolygonState ? 0 : _NEW_POLYGON, + GL_POLYGON_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewPolygonState; ctx->Polygon.BackMode = mode; break; @@ -248,7 +253,8 @@ _mesa_PolygonStipple(const GLubyte *pattern) _mesa_debug(ctx, "glPolygonStipple\n"); FLUSH_VERTICES(ctx, ctx->DriverFlags.NewPolygonStipple ? 0 : - _NEW_POLYGONSTIPPLE); + _NEW_POLYGONSTIPPLE, + GL_POLYGON_STIPPLE_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewPolygonStipple; pattern = _mesa_map_validate_pbo_source(ctx, 2, @@ -307,7 +313,8 @@ _mesa_polygon_offset_clamp(struct gl_context *ctx, ctx->Polygon.OffsetClamp == clamp) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewPolygonState ? 0 : _NEW_POLYGON); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewPolygonState ? 0 : _NEW_POLYGON, + GL_POLYGON_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewPolygonState; ctx->Polygon.OffsetFactor = factor; ctx->Polygon.OffsetUnits = units; diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c index d346cc2e2ba..d391bf0d3cb 100644 --- a/src/mesa/main/queryobj.c +++ b/src/mesa/main/queryobj.c @@ -327,7 +327,7 @@ _mesa_DeleteQueries(GLsizei n, const GLuint *ids) { GLint i; GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glDeleteQueries(%d)\n", n); @@ -415,7 +415,7 @@ _mesa_BeginQueryIndexed(GLenum target, GLuint index, GLuint id) if (!query_error_check_index(ctx, target, index)) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); bindpt = get_query_binding_point(ctx, target, index); if (!bindpt) { @@ -521,7 +521,7 @@ _mesa_EndQueryIndexed(GLenum target, GLuint index) if (!query_error_check_index(ctx, target, index)) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); bindpt = get_query_binding_point(ctx, target, index); if (!bindpt) { diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c index 0f20912c68b..9ecfe5d4c92 100644 --- a/src/mesa/main/rastpos.c +++ b/src/mesa/main/rastpos.c @@ -392,6 +392,8 @@ compute_texgen(struct gl_context *ctx, const GLfloat vObj[4], const GLfloat vEye void _mesa_RasterPos(struct gl_context *ctx, const GLfloat vObj[4]) { + ctx->PopAttribState |= GL_CURRENT_BIT; + if (_mesa_arb_vertex_program_enabled(ctx)) { /* XXX implement this */ _mesa_problem(ctx, "Vertex programs not implemented for glRasterPos"); @@ -533,7 +535,7 @@ rasterpos(GLfloat x, GLfloat y, GLfloat z, GLfloat w) p[2] = z; p[3] = w; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); FLUSH_CURRENT(ctx, 0); if (ctx->NewState) @@ -705,7 +707,7 @@ window_pos3f(GLfloat x, GLfloat y, GLfloat z) GET_CURRENT_CONTEXT(ctx); GLfloat z2; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_CURRENT_BIT); FLUSH_CURRENT(ctx, 0); z2 = CLAMP(z, 0.0F, 1.0F) diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c index 5f9b4b9d159..1800450015a 100644 --- a/src/mesa/main/readpix.c +++ b/src/mesa/main/readpix.c @@ -1033,7 +1033,7 @@ read_pixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glReadPixels(%d, %d, %s, %s, %p)\n", diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c index 3568b975dd4..7ac0700824e 100644 --- a/src/mesa/main/samplerobj.c +++ b/src/mesa/main/samplerobj.c @@ -232,7 +232,7 @@ _mesa_CreateSamplers(GLsizei count, GLuint *samplers) static void delete_samplers(struct gl_context *ctx, GLsizei count, const GLuint *samplers) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); _mesa_HashLockMutex(ctx->Shared->SamplerObjects); @@ -246,7 +246,7 @@ delete_samplers(struct gl_context *ctx, GLsizei count, const GLuint *samplers) /* If the sampler is currently bound, unbind it. */ for (j = 0; j < ctx->Const.MaxCombinedTextureImageUnits; j++) { if (ctx->Texture.Unit[j].Sampler == sampObj) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT, GL_TEXTURE_BIT); _mesa_reference_sampler_object(ctx, &ctx->Texture.Unit[j].Sampler, NULL); } } @@ -300,7 +300,7 @@ _mesa_bind_sampler(struct gl_context *ctx, GLuint unit, struct gl_sampler_object *sampObj) { if (ctx->Texture.Unit[unit].Sampler != sampObj) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT, GL_TEXTURE_BIT); } _mesa_reference_sampler_object(ctx, &ctx->Texture.Unit[unit].Sampler, @@ -357,7 +357,7 @@ bind_samplers(struct gl_context *ctx, GLuint first, GLsizei count, { GLsizei i; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (samplers) { /* Note that the error semantics for multi-bind commands differ from @@ -416,6 +416,7 @@ bind_samplers(struct gl_context *ctx, GLuint first, GLsizei count, &ctx->Texture.Unit[unit].Sampler, sampObj); ctx->NewState |= _NEW_TEXTURE_OBJECT; + ctx->PopAttribState |= GL_TEXTURE_BIT; } } @@ -430,6 +431,7 @@ bind_samplers(struct gl_context *ctx, GLuint first, GLsizei count, &ctx->Texture.Unit[unit].Sampler, NULL); ctx->NewState |= _NEW_TEXTURE_OBJECT; + ctx->PopAttribState |= GL_TEXTURE_BIT; } } } @@ -510,7 +512,7 @@ validate_texture_wrap_mode(struct gl_context *ctx, GLenum wrap) static inline void flush(struct gl_context *ctx) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT, GL_TEXTURE_BIT); } void diff --git a/src/mesa/main/scissor.c b/src/mesa/main/scissor.c index b38db06bc86..df7b3363d20 100644 --- a/src/mesa/main/scissor.c +++ b/src/mesa/main/scissor.c @@ -48,7 +48,8 @@ set_scissor_no_notify(struct gl_context *ctx, unsigned idx, height == ctx->Scissor.ScissorArray[idx].Height) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewScissorRect ? 0 : _NEW_SCISSOR); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewScissorRect ? 0 : _NEW_SCISSOR, + GL_SCISSOR_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewScissorRect; ctx->Scissor.ScissorArray[idx].X = x; @@ -301,7 +302,7 @@ _mesa_WindowRectanglesEXT(GLenum mode, GLsizei count, const GLint *box) box += 4; } - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_SCISSOR_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewWindowRectangles; memcpy(ctx->Scissor.WindowRects, newval, diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 62c49f388dd..941d8fb2b75 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -1307,7 +1307,7 @@ link_program(struct gl_context *ctx, struct gl_shader_program *shProg, ensure_builtin_types(ctx); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); _mesa_glsl_link_shader(ctx, shProg); /* From section 7.3 (Program Objects) of the OpenGL 4.5 spec: @@ -1680,7 +1680,7 @@ _mesa_DeleteObjectARB(GLhandleARB obj) if (obj) { GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (is_program(ctx, obj)) { delete_shader_program(ctx, obj); } @@ -1699,7 +1699,7 @@ _mesa_DeleteProgram(GLuint name) { if (name) { GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); delete_shader_program(ctx, name); } } @@ -1710,7 +1710,7 @@ _mesa_DeleteShader(GLuint name) { if (name) { GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); delete_shader(ctx, name); } } @@ -2573,7 +2573,7 @@ _mesa_use_program(struct gl_context *ctx, gl_shader_stage stage, if (*target != prog) { /* Program is current, flush it */ if (shTarget == ctx->_Shader) { - FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); + FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS, 0); } _mesa_reference_shader_program(ctx, @@ -2695,7 +2695,7 @@ void GLAPIENTRY _mesa_PatchParameteri_no_error(GLenum pname, GLint value) { GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_CURRENT_BIT); ctx->TessCtrlProgram.patch_vertices = value; } @@ -2720,7 +2720,7 @@ _mesa_PatchParameteri(GLenum pname, GLint value) return; } - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_CURRENT_BIT); ctx->TessCtrlProgram.patch_vertices = value; } @@ -2737,13 +2737,13 @@ _mesa_PatchParameterfv(GLenum pname, const GLfloat *values) switch(pname) { case GL_PATCH_DEFAULT_OUTER_LEVEL: - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); memcpy(ctx->TessCtrlProgram.patch_default_outer_level, values, 4 * sizeof(GLfloat)); ctx->NewDriverState |= ctx->DriverFlags.NewDefaultTessLevels; return; case GL_PATCH_DEFAULT_INNER_LEVEL: - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); memcpy(ctx->TessCtrlProgram.patch_default_inner_level, values, 2 * sizeof(GLfloat)); ctx->NewDriverState |= ctx->DriverFlags.NewDefaultTessLevels; diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c index 7a47585ce05..cfa229acdb5 100644 --- a/src/mesa/main/shaderimage.c +++ b/src/mesa/main/shaderimage.c @@ -588,7 +588,7 @@ bind_image_texture(struct gl_context *ctx, struct gl_texture_object *texObj, u = &ctx->ImageUnits[unit]; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); ctx->NewDriverState |= ctx->DriverFlags.NewImageUnits; set_image_binding(u, texObj, level, layered, layer, access, format); @@ -687,7 +687,7 @@ bind_image_textures(struct gl_context *ctx, GLuint first, GLuint count, int i; /* Assume that at least one binding will be changed */ - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); ctx->NewDriverState |= ctx->DriverFlags.NewImageUnits; /* Note that the error semantics for multi-bind commands differ from diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 1083ded50d3..76ebef0b473 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -143,7 +143,7 @@ _mesa_update_allow_draw_out_of_order(struct gl_context *ctx) * vertices. */ if (previous_state && !ctx->_AllowDrawOutOfOrder) - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); } diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c index 604167ae2d7..0d60234607e 100644 --- a/src/mesa/main/stencil.c +++ b/src/mesa/main/stencil.c @@ -112,6 +112,7 @@ _mesa_ClearStencil( GLint s ) if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glClearStencil(%d)\n", s); + ctx->PopAttribState |= GL_STENCIL_BUFFER_BIT; ctx->Stencil.Clear = (GLuint) s; } @@ -157,7 +158,8 @@ _mesa_StencilFuncSeparateATI( GLenum frontfunc, GLenum backfunc, GLint ref, GLui ctx->Stencil.Ref[0] == ref && ctx->Stencil.Ref[1] == ref) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, + GL_STENCIL_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewStencil; ctx->Stencil.Function[0] = frontfunc; ctx->Stencil.Function[1] = backfunc; @@ -195,7 +197,8 @@ stencil_func(struct gl_context *ctx, GLenum func, GLint ref, GLuint mask) ctx->Stencil.ValueMask[face] == mask && ctx->Stencil.Ref[face] == ref) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, + GL_STENCIL_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewStencil; ctx->Stencil.Function[face] = func; ctx->Stencil.Ref[face] = ref; @@ -217,7 +220,8 @@ stencil_func(struct gl_context *ctx, GLenum func, GLint ref, GLuint mask) ctx->Stencil.Ref[0] == ref && ctx->Stencil.Ref[1] == ref) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, + GL_STENCIL_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewStencil; ctx->Stencil.Function[0] = ctx->Stencil.Function[1] = func; ctx->Stencil.Ref[0] = ctx->Stencil.Ref[1] = ref; @@ -282,7 +286,8 @@ _mesa_StencilMask( GLuint mask ) */ if (ctx->Stencil.WriteMask[face] == mask) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, + GL_STENCIL_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewStencil; ctx->Stencil.WriteMask[face] = mask; @@ -298,7 +303,8 @@ _mesa_StencilMask( GLuint mask ) if (ctx->Stencil.WriteMask[0] == mask && ctx->Stencil.WriteMask[1] == mask) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, + GL_STENCIL_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewStencil; ctx->Stencil.WriteMask[0] = ctx->Stencil.WriteMask[1] = mask; if (ctx->Driver.StencilMaskSeparate) { @@ -336,7 +342,8 @@ stencil_op(struct gl_context *ctx, GLenum fail, GLenum zfail, GLenum zpass) ctx->Stencil.ZPassFunc[face] == zpass && ctx->Stencil.FailFunc[face] == fail) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, + GL_STENCIL_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewStencil; ctx->Stencil.ZFailFunc[face] = zfail; ctx->Stencil.ZPassFunc[face] = zpass; @@ -358,7 +365,8 @@ stencil_op(struct gl_context *ctx, GLenum fail, GLenum zfail, GLenum zpass) ctx->Stencil.FailFunc[0] == fail && ctx->Stencil.FailFunc[1] == fail) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, + GL_STENCIL_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewStencil; ctx->Stencil.ZFailFunc[0] = ctx->Stencil.ZFailFunc[1] = zfail; ctx->Stencil.ZPassFunc[0] = ctx->Stencil.ZPassFunc[1] = zpass; @@ -442,7 +450,8 @@ stencil_op_separate(struct gl_context *ctx, GLenum face, GLenum sfail, if (ctx->Stencil.ZFailFunc[0] != zfail || ctx->Stencil.ZPassFunc[0] != zpass || ctx->Stencil.FailFunc[0] != sfail){ - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, + GL_STENCIL_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewStencil; ctx->Stencil.ZFailFunc[0] = zfail; ctx->Stencil.ZPassFunc[0] = zpass; @@ -456,7 +465,8 @@ stencil_op_separate(struct gl_context *ctx, GLenum face, GLenum sfail, if (ctx->Stencil.ZFailFunc[1] != zfail || ctx->Stencil.ZPassFunc[1] != zpass || ctx->Stencil.FailFunc[1] != sfail) { - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, + GL_STENCIL_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewStencil; ctx->Stencil.ZFailFunc[1] = zfail; ctx->Stencil.ZPassFunc[1] = zpass; @@ -516,7 +526,8 @@ static void stencil_func_separate(struct gl_context *ctx, GLenum face, GLenum func, GLint ref, GLuint mask) { - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, + GL_STENCIL_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewStencil; if (face != GL_BACK) { @@ -574,7 +585,8 @@ _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) static void stencil_mask_separate(struct gl_context *ctx, GLenum face, GLuint mask) { - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, + GL_STENCIL_BUFFER_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewStencil; if (face != GL_BACK) { diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c index 5f6a4abe2b9..24e47b099e4 100644 --- a/src/mesa/main/texenv.c +++ b/src/mesa/main/texenv.c @@ -77,7 +77,7 @@ set_env_mode(struct gl_context *ctx, } if (legal) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE, GL_TEXTURE_BIT); texUnit->EnvMode = mode; } else { @@ -93,7 +93,7 @@ set_env_color(struct gl_context *ctx, { if (TEST_EQ_4V(color, texUnit->EnvColorUnclamped)) return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE, GL_TEXTURE_BIT); COPY_4FV(texUnit->EnvColorUnclamped, color); texUnit->EnvColor[0] = CLAMP(color[0], 0.0F, 1.0F); texUnit->EnvColor[1] = CLAMP(color[1], 0.0F, 1.0F); @@ -151,14 +151,14 @@ set_combiner_mode(struct gl_context *ctx, case GL_COMBINE_RGB: if (texUnit->Combine.ModeRGB == mode) return true; - FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE, GL_TEXTURE_BIT); texUnit->Combine.ModeRGB = mode; break; case GL_COMBINE_ALPHA: if (texUnit->Combine.ModeA == mode) return true; - FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE, GL_TEXTURE_BIT); texUnit->Combine.ModeA = mode; break; default: @@ -252,7 +252,7 @@ set_combiner_source(struct gl_context *ctx, return false; } - FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE, GL_TEXTURE_BIT); if (alpha) texUnit->Combine.SourceA[term] = param; @@ -336,7 +336,7 @@ set_combiner_operand(struct gl_context *ctx, return false; } - FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE, GL_TEXTURE_BIT); if (alpha) texUnit->Combine.OperandA[term] = param; @@ -373,13 +373,13 @@ set_combiner_scale(struct gl_context *ctx, case GL_RGB_SCALE: if (texUnit->Combine.ScaleShiftRGB == shift) return true; - FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE, GL_TEXTURE_BIT); texUnit->Combine.ScaleShiftRGB = shift; break; case GL_ALPHA_SCALE: if (texUnit->Combine.ScaleShiftA == shift) return true; - FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE, GL_TEXTURE_BIT); texUnit->Combine.ScaleShiftA = shift; break; default: @@ -469,7 +469,7 @@ _mesa_texenvfv_indexed( struct gl_context* ctx, GLuint texunit, GLenum target, if (pname == GL_TEXTURE_LOD_BIAS_EXT) { if (texUnit->LodBias == param[0]) return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT, GL_TEXTURE_BIT); texUnit->LodBias = param[0]; } else { @@ -490,12 +490,12 @@ _mesa_texenvfv_indexed( struct gl_context* ctx, GLuint texunit, GLenum target, if (iparam0 == GL_TRUE) { if (ctx->Point.CoordReplace & (1u << texunit)) return; - FLUSH_VERTICES(ctx, _NEW_POINT); + FLUSH_VERTICES(ctx, _NEW_POINT, GL_POINT_BIT); ctx->Point.CoordReplace |= (1u << texunit); } else if (iparam0 == GL_FALSE) { if (~(ctx->Point.CoordReplace) & (1u << texunit)) return; - FLUSH_VERTICES(ctx, _NEW_POINT); + FLUSH_VERTICES(ctx, _NEW_POINT, GL_POINT_BIT); ctx->Point.CoordReplace &= ~(1u << texunit); } else { _mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(param=0x%x)", iparam0); diff --git a/src/mesa/main/texgen.c b/src/mesa/main/texgen.c index 327b9c83c01..d87452187e6 100644 --- a/src/mesa/main/texgen.c +++ b/src/mesa/main/texgen.c @@ -129,7 +129,7 @@ texgenfv( GLuint texunitIndex, GLenum coord, GLenum pname, return; } - FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE, GL_TEXTURE_BIT); texgen->Mode = mode; texgen->_ModeBit = bit; } @@ -143,7 +143,7 @@ texgenfv( GLuint texunitIndex, GLenum coord, GLenum pname, } if (TEST_EQ_4V(unit->ObjectPlane[index], params)) return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE, GL_TEXTURE_BIT); COPY_4FV(unit->ObjectPlane[index], params); } break; @@ -165,7 +165,7 @@ texgenfv( GLuint texunitIndex, GLenum coord, GLenum pname, ctx->ModelviewMatrixStack.Top->inv); if (TEST_EQ_4V(unit->EyePlane[index], tmp)) return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE, GL_TEXTURE_BIT); COPY_4FV(unit->EyePlane[index], tmp); } break; diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 65775c4f961..0b8a031fbf0 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -1394,7 +1394,7 @@ get_texture_image(struct gl_context *ctx, unsigned firstFace, numFaces, i; GLint imageStride; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); texImage = select_tex_image(texObj, target, level, zoffset); assert(texImage); /* should have been error checked already */ @@ -1768,7 +1768,7 @@ get_compressed_texture_image(struct gl_context *ctx, struct gl_texture_image *texImage; unsigned firstFace, numFaces, i, imageStride; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); texImage = select_tex_image(texObj, target, level, zoffset); assert(texImage); /* should have been error checked already */ diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 5b7c96ab561..f431136aef4 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -2968,7 +2968,7 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims, mesa_format texFormat; bool dimensionsOK = true, sizeOK = true; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) { if (compressed) @@ -3397,7 +3397,7 @@ egl_image_target_texture(struct gl_context *ctx, { struct gl_texture_image *texImage; bool valid_target; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); switch (target) { case GL_TEXTURE_2D: @@ -3562,7 +3562,7 @@ texture_sub_image(struct gl_context *ctx, GLuint dims, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (ctx->NewState & _NEW_PIXEL) _mesa_update_state(ctx); @@ -4241,7 +4241,7 @@ copy_texture_sub_image_err(struct gl_context *ctx, GLuint dims, GLint x, GLint y, GLsizei width, GLsizei height, const char *caller) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "%s %s %d %d %d %d %d %d %d %d\n", caller, @@ -4269,7 +4269,7 @@ copy_texture_sub_image_no_error(struct gl_context *ctx, GLuint dims, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (ctx->NewState & NEW_COPY_TEX_STATE) _mesa_update_state(ctx); @@ -4291,7 +4291,7 @@ copyteximage(struct gl_context *ctx, GLuint dims, struct gl_texture_object *texO struct gl_texture_image *texImage; mesa_format texFormat; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "glCopyTexImage%uD %s %d %s %d %d %d %d %d\n", @@ -5659,7 +5659,7 @@ compressed_texture_sub_image(struct gl_context *ctx, GLuint dims, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); _mesa_lock_texture(ctx, texObj); { @@ -6331,7 +6331,7 @@ texture_buffer_range(struct gl_context *ctx, return; } - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_TEXTURE_BIT); _mesa_lock_texture(ctx, texObj); { diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 0b0252a0c6a..3fc232bf214 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -892,6 +892,7 @@ _mesa_dirty_texobj(struct gl_context *ctx, struct gl_texture_object *texObj) texObj->_BaseComplete = GL_FALSE; texObj->_MipmapComplete = GL_FALSE; ctx->NewState |= _NEW_TEXTURE_OBJECT; + ctx->PopAttribState |= GL_TEXTURE_BIT; } @@ -1395,6 +1396,7 @@ unbind_textures_from_unit(struct gl_context *ctx, GLuint unit) texUnit->_BoundTextures &= ~(1 << index); ctx->NewState |= _NEW_TEXTURE_OBJECT; + ctx->PopAttribState |= GL_TEXTURE_BIT; } } @@ -1416,7 +1418,7 @@ unbind_textures_from_unit(struct gl_context *ctx, GLuint unit) static void delete_textures(struct gl_context *ctx, GLsizei n, const GLuint *textures) { - FLUSH_VERTICES(ctx, 0); /* too complex */ + FLUSH_VERTICES(ctx, 0, 0); /* too complex */ if (!textures) return; @@ -1454,6 +1456,7 @@ delete_textures(struct gl_context *ctx, GLsizei n, const GLuint *textures) _mesa_unlock_texture(ctx, delObj); ctx->NewState |= _NEW_TEXTURE_OBJECT; + ctx->PopAttribState |= GL_TEXTURE_BIT; /* The texture _name_ is now free for re-use. * Remove it from the hash table now. @@ -1483,7 +1486,7 @@ _mesa_delete_nameless_texture(struct gl_context *ctx, if (!texObj) return; - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT, GL_TEXTURE_BIT); _mesa_lock_texture(ctx, texObj); { @@ -1506,8 +1509,6 @@ _mesa_delete_nameless_texture(struct gl_context *ctx, } _mesa_unlock_texture(ctx, texObj); - ctx->NewState |= _NEW_TEXTURE_OBJECT; - /* Unreference the texobj. If refcount hits zero, the texture * will be deleted. */ @@ -1632,8 +1633,14 @@ bind_texture_object(struct gl_context *ctx, unsigned unit, } } - /* flush before changing binding */ - FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT); + /* Flush before changing binding. + * + * Note: Multisample textures don't need to flag GL_TEXTURE_BIT because + * they are not restored by glPopAttrib according to the GL 4.6 + * Compatibility Profile specification. We set GL_TEXTURE_BIT anyway + * to simplify the code. This has no effect on behavior. + */ + FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT, GL_TEXTURE_BIT); /* If the refcount on the previously bound texture is decremented to * zero, it'll be deleted here. @@ -2025,7 +2032,6 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName, if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "glPrioritizeTextures %d\n", n); - FLUSH_VERTICES(ctx, 0); if (n < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glPrioritizeTextures" ); @@ -2035,6 +2041,8 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName, if (!priorities) return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT, GL_TEXTURE_BIT); + for (i = 0; i < n; i++) { if (texName[i] > 0) { struct gl_texture_object *t = _mesa_lookup_texture(ctx, texName[i]); @@ -2043,8 +2051,6 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName, } } } - - ctx->NewState |= _NEW_TEXTURE_OBJECT; } @@ -2150,6 +2156,7 @@ _mesa_lock_context_textures( struct gl_context *ctx ) if (ctx->Shared->TextureStateStamp != ctx->TextureStateTimestamp) { ctx->NewState |= _NEW_TEXTURE_OBJECT; + ctx->PopAttribState |= GL_TEXTURE_BIT; ctx->TextureStateTimestamp = ctx->Shared->TextureStateStamp; } } diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index dffc509bece..2f0004458eb 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -206,7 +206,7 @@ set_swizzle_component(GLushort *swizzle, GLuint comp, GLuint swz) static inline void flush(struct gl_context *ctx) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT, GL_TEXTURE_BIT); } @@ -220,7 +220,7 @@ flush(struct gl_context *ctx) static inline void incomplete(struct gl_context *ctx, struct gl_texture_object *texObj) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT, GL_TEXTURE_BIT); _mesa_dirty_texobj(ctx, texObj); } @@ -507,7 +507,7 @@ set_tex_parameteri(struct gl_context *ctx, return GL_FALSE; /* This should not be restored by glPopAttrib. */ - FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT, 0); texObj->StencilSampling = stencil; return GL_TRUE; } @@ -1028,7 +1028,7 @@ _mesa_texture_parameterIiv(struct gl_context *ctx, _mesa_error(ctx, dsa ? GL_INVALID_OPERATION : GL_INVALID_ENUM, "glTextureParameterIiv(texture)"); return; } - FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT, GL_TEXTURE_BIT); /* set the integer-valued border color */ COPY_4V(texObj->Sampler.Attrib.BorderColor.i, params); break; @@ -1056,7 +1056,7 @@ _mesa_texture_parameterIuiv(struct gl_context *ctx, _mesa_error(ctx, dsa ? GL_INVALID_OPERATION : GL_INVALID_ENUM, "glTextureParameterIuiv(texture)"); return; } - FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT, GL_TEXTURE_BIT); /* set the unsigned integer-valued border color */ COPY_4V(texObj->Sampler.Attrib.BorderColor.ui, params); break; diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index ec7abe7e24d..b5803a05b4a 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -327,7 +327,7 @@ active_texture(GLenum texture, bool no_error) * * https://bugs.freedesktop.org/show_bug.cgi?id=105436 */ - FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE, GL_TEXTURE_BIT); ctx->Texture.CurrentUnit = texUnit; if (ctx->Transform.MatrixMode == GL_TEXTURE) { diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c index 47494177cf4..04ba74e1b1d 100644 --- a/src/mesa/main/transformfeedback.c +++ b/src/mesa/main/transformfeedback.c @@ -455,7 +455,7 @@ begin_transform_feedback(struct gl_context *ctx, GLenum mode, bool no_error) } } - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); ctx->NewDriverState |= ctx->DriverFlags.NewTransformFeedback; obj->Active = GL_TRUE; @@ -506,7 +506,7 @@ static void end_transform_feedback(struct gl_context *ctx, struct gl_transform_feedback_object *obj) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); ctx->NewDriverState |= ctx->DriverFlags.NewTransformFeedback; assert(ctx->Driver.EndTransformFeedback); @@ -1249,7 +1249,7 @@ static void pause_transform_feedback(struct gl_context *ctx, struct gl_transform_feedback_object *obj) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); ctx->NewDriverState |= ctx->DriverFlags.NewTransformFeedback; assert(ctx->Driver.PauseTransformFeedback); @@ -1293,7 +1293,7 @@ static void resume_transform_feedback(struct gl_context *ctx, struct gl_transform_feedback_object *obj) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); ctx->NewDriverState |= ctx->DriverFlags.NewTransformFeedback; obj->Paused = GL_FALSE; diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp index 54c1b306050..82ebe7dad02 100644 --- a/src/mesa/main/uniform_query.cpp +++ b/src/mesa/main/uniform_query.cpp @@ -1041,7 +1041,7 @@ _mesa_flush_vertices_for_uniforms(struct gl_context *ctx, if (!uni->is_bindless && uni->type->contains_opaque()) { /* Samplers flush on demand and ignore redundant updates. */ if (!uni->type->is_sampler()) - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); return; } @@ -1055,7 +1055,7 @@ _mesa_flush_vertices_for_uniforms(struct gl_context *ctx, new_driver_state |= ctx->DriverFlags.NewShaderConstants[index]; } - FLUSH_VERTICES(ctx, new_driver_state ? 0 : _NEW_PROGRAM_CONSTANTS); + FLUSH_VERTICES(ctx, new_driver_state ? 0 : _NEW_PROGRAM_CONSTANTS, 0); ctx->NewDriverState |= new_driver_state; } @@ -1278,7 +1278,7 @@ _mesa_uniform(GLint location, GLsizei count, const GLvoid *values, */ if (sampler->unit != value || !sampler->bound) { if (!flushed) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT | _NEW_PROGRAM); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT | _NEW_PROGRAM, 0); flushed = true; } sampler->unit = value; @@ -1289,7 +1289,7 @@ _mesa_uniform(GLint location, GLsizei count, const GLvoid *values, } else { if (sh->Program->SamplerUnits[unit] != value) { if (!flushed) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT | _NEW_PROGRAM); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT | _NEW_PROGRAM, 0); flushed = true; } sh->Program->SamplerUnits[unit] = value; diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c index 277e914b1d6..7172cbd0ae4 100644 --- a/src/mesa/main/uniforms.c +++ b/src/mesa/main/uniforms.c @@ -1100,7 +1100,7 @@ uniform_block_binding(struct gl_context *ctx, struct gl_shader_program *shProg, if (shProg->data->UniformBlocks[uniformBlockIndex].Binding != uniformBlockBinding) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); ctx->NewDriverState |= ctx->DriverFlags.NewUniformBuffer; shProg->data->UniformBlocks[uniformBlockIndex].Binding = @@ -1162,7 +1162,7 @@ shader_storage_block_binding(struct gl_context *ctx, if (shProg->data->ShaderStorageBlocks[shaderStorageBlockIndex].Binding != shaderStorageBlockBinding) { - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, 0); ctx->NewDriverState |= ctx->DriverFlags.NewShaderStorageBuffer; shProg->data->ShaderStorageBlocks[shaderStorageBlockIndex].Binding = diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c index d8b80aa469f..de9687eb071 100644 --- a/src/mesa/main/viewport.c +++ b/src/mesa/main/viewport.c @@ -71,7 +71,8 @@ set_viewport_no_notify(struct gl_context *ctx, unsigned idx, ctx->ViewportArray[idx].Height == height) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewViewport ? 0 : _NEW_VIEWPORT); + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewViewport ? 0 : _NEW_VIEWPORT, + GL_VIEWPORT_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewViewport; ctx->ViewportArray[idx].X = x; @@ -292,7 +293,7 @@ set_depth_range_no_notify(struct gl_context *ctx, unsigned idx, return; /* The depth range is needed by program state constants. */ - FLUSH_VERTICES(ctx, _NEW_VIEWPORT); + FLUSH_VERTICES(ctx, _NEW_VIEWPORT, GL_VIEWPORT_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewViewport; ctx->ViewportArray[idx].Near = SATURATE(nearval); @@ -520,7 +521,7 @@ clip_control(struct gl_context *ctx, GLenum origin, GLenum depth, bool no_error) /* Affects transform state and the viewport transform */ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewClipControl ? 0 : - _NEW_TRANSFORM | _NEW_VIEWPORT); + _NEW_TRANSFORM | _NEW_VIEWPORT, GL_TRANSFORM_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewClipControl; if (ctx->Transform.ClipOrigin != origin) { @@ -614,7 +615,7 @@ subpixel_precision_bias(struct gl_context *ctx, GLuint xbits, GLuint ybits) if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glSubpixelPrecisionBiasNV(%u, %u)\n", xbits, ybits); - FLUSH_VERTICES(ctx, 0); + FLUSH_VERTICES(ctx, 0, GL_VIEWPORT_BIT); ctx->SubpixelPrecisionBias[0] = xbits; ctx->SubpixelPrecisionBias[1] = ybits; @@ -675,7 +676,7 @@ set_viewport_swizzle(struct gl_context *ctx, GLuint index, viewport->SwizzleW == swizzlew) return; - FLUSH_VERTICES(ctx, _NEW_VIEWPORT); + FLUSH_VERTICES(ctx, _NEW_VIEWPORT, GL_VIEWPORT_BIT); ctx->NewDriverState |= ctx->DriverFlags.NewViewport; viewport->SwizzleX = swizzlex; diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 92d3aef1c82..acd4073d789 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -770,6 +770,7 @@ st_DrawAtlasBitmaps(struct gl_context *ctx, /* Update the raster position */ ctx->Current.RasterPos[0] += xmove; ctx->Current.RasterPos[1] += ymove; + ctx->PopAttribState |= GL_CURRENT_BIT; } u_upload_unmap(pipe->stream_uploader); diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c index d7a0a648090..b88a95e0e1d 100644 --- a/src/mesa/state_tracker/st_cb_rasterpos.c +++ b/src/mesa/state_tracker/st_cb_rasterpos.c @@ -145,6 +145,8 @@ rastpos_point(struct draw_stage *stage, struct prim_header *prim) const GLfloat *pos; GLuint i; + ctx->PopAttribState |= GL_CURRENT_BIT; + /* if we get here, we didn't get clipped */ ctx->Current.RasterPosValid = GL_TRUE; @@ -250,6 +252,7 @@ st_RasterPos(struct gl_context *ctx, const GLfloat v[4]) st_validate_state(st, ST_PIPELINE_RENDER); /* This will get set only if rastpos_point(), above, gets called */ + ctx->PopAttribState |= GL_CURRENT_BIT; ctx->Current.RasterPosValid = GL_FALSE; /* All vertex attribs but position were previously initialized above. diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index 42c3947b7af..030c4edaaa7 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -666,7 +666,7 @@ st_context_flush(struct st_context_iface *stctxi, unsigned flags, * it means that glBitmap was called first and then glBegin. */ st_flush_bitmap_cache(st); - FLUSH_VERTICES(st->ctx, 0); + FLUSH_VERTICES(st->ctx, 0, 0); /* Notify the caller that we're ready to flush */ if (before_flush_cb) diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index c9a36b07fb4..acb698d7134 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -224,10 +224,13 @@ vbo_exec_copy_to_current(struct vbo_exec_context *exec) * that doesn't get used (eg light positions). */ if (i >= VBO_ATTRIB_MAT_FRONT_AMBIENT && - i <= VBO_ATTRIB_MAT_BACK_INDEXES) + i <= VBO_ATTRIB_MAT_BACK_INDEXES) { ctx->NewState |= _NEW_LIGHT; + ctx->PopAttribState |= GL_LIGHTING_BIT; + } ctx->NewState |= _NEW_CURRENT_ATTRIB; + ctx->PopAttribState |= GL_CURRENT_BIT; } } diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index c867bff947b..15ace15c673 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -44,7 +44,8 @@ static void copy_vao(struct gl_context *ctx, const struct gl_vertex_array_object *vao, - GLbitfield mask, GLbitfield state, int shift, fi_type **data) + GLbitfield mask, GLbitfield state, GLbitfield pop_state, + int shift, fi_type **data) { struct vbo_context *vbo = vbo_context(ctx); @@ -74,6 +75,7 @@ copy_vao(struct gl_context *ctx, const struct gl_vertex_array_object *vao, vbo_set_vertex_format(&currval->Format, size, type); ctx->NewState |= state; + ctx->PopAttribState |= pop_state; } *data += size; @@ -94,10 +96,12 @@ playback_copy_to_current(struct gl_context *ctx, fi_type *data = node->current_data; /* Copy conventional attribs and generics except pos */ copy_vao(ctx, node->VAO[VP_MODE_SHADER], ~VERT_BIT_POS & VERT_BIT_ALL, - _NEW_CURRENT_ATTRIB, 0, &data); + _NEW_CURRENT_ATTRIB, GL_CURRENT_BIT, 0, &data); /* Copy materials */ copy_vao(ctx, node->VAO[VP_MODE_FF], VERT_BIT_MAT_ALL, - _NEW_CURRENT_ATTRIB | _NEW_LIGHT, VBO_MATERIAL_SHIFT, &data); + _NEW_CURRENT_ATTRIB | _NEW_LIGHT, + GL_CURRENT_BIT | GL_LIGHTING_BIT, + VBO_MATERIAL_SHIFT, &data); /* Colormaterial -- this kindof sucks. */ |