mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-29 16:40:13 +01:00
mesa: be precise about when to set _NEW_CURRENT_ATTRIB and _NEW_MATERIAL
This commit fixes _mesa_update_color_material, which allows cleaning up the unnecessary state flagging. 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/8850>
This commit is contained in:
parent
1e18754200
commit
93c74193fc
5 changed files with 12 additions and 14 deletions
|
|
@ -896,8 +896,7 @@ _mesa_PopAttrib(void)
|
|||
if (mask & GL_CURRENT_BIT) {
|
||||
memcpy(&ctx->Current, &attr->Current,
|
||||
sizeof(struct gl_current_attrib));
|
||||
/* Set _NEW_MATERIAL because current attribs may reference materials. */
|
||||
ctx->NewState |= _NEW_CURRENT_ATTRIB | _NEW_MATERIAL;
|
||||
ctx->NewState |= _NEW_CURRENT_ATTRIB;
|
||||
}
|
||||
|
||||
if (mask & GL_DEPTH_BUFFER_BIT) {
|
||||
|
|
@ -1012,9 +1011,8 @@ _mesa_PopAttrib(void)
|
|||
ColorMaterial);
|
||||
TEST_AND_UPDATE(ctx->Light.ColorMaterialEnabled,
|
||||
attr->Light.ColorMaterialEnabled, GL_COLOR_MATERIAL);
|
||||
/* Materials - they might be used by current attribs. */
|
||||
/* Shininess material is used by the fixed-func vertex program. */
|
||||
ctx->NewState |= _NEW_MATERIAL | _NEW_CURRENT_ATTRIB | _NEW_FF_VERT_PROGRAM;
|
||||
ctx->NewState |= _NEW_MATERIAL | _NEW_FF_VERT_PROGRAM;
|
||||
memcpy(&ctx->Light.Material, &attr->Light.Material,
|
||||
sizeof(struct gl_material));
|
||||
if (ctx->Extensions.ARB_color_buffer_float) {
|
||||
|
|
|
|||
|
|
@ -781,7 +781,10 @@ _mesa_update_color_material( struct gl_context *ctx, const GLfloat color[4] )
|
|||
while (bitmask) {
|
||||
const int i = u_bit_scan(&bitmask);
|
||||
|
||||
COPY_4FV( mat->Attrib[i], color );
|
||||
if (memcmp(mat->Attrib[i], color, sizeof(mat->Attrib[i]))) {
|
||||
COPY_4FV(mat->Attrib[i], color);
|
||||
ctx->NewState |= _NEW_MATERIAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -805,16 +805,14 @@ _mesa_program_state_flags(const gl_state_index16 state[STATE_LENGTH])
|
|||
{
|
||||
switch (state[0]) {
|
||||
case STATE_MATERIAL:
|
||||
/* these can be affected by glColor when colormaterial mode is used */
|
||||
return _NEW_MATERIAL | _NEW_CURRENT_ATTRIB;
|
||||
return _NEW_MATERIAL;
|
||||
|
||||
case STATE_LIGHTPROD:
|
||||
case STATE_LIGHTPROD_ARRAY_FRONT:
|
||||
case STATE_LIGHTPROD_ARRAY_BACK:
|
||||
case STATE_LIGHTPROD_ARRAY_TWOSIDE:
|
||||
case STATE_LIGHTMODEL_SCENECOLOR:
|
||||
/* these can be affected by glColor when colormaterial mode is used */
|
||||
return _NEW_LIGHT_CONSTANTS | _NEW_MATERIAL | _NEW_CURRENT_ATTRIB;
|
||||
return _NEW_LIGHT_CONSTANTS | _NEW_MATERIAL;
|
||||
|
||||
case STATE_LIGHT:
|
||||
case STATE_LIGHT_ARRAY:
|
||||
|
|
|
|||
|
|
@ -218,10 +218,10 @@ vbo_exec_copy_to_current(struct vbo_exec_context *exec)
|
|||
if (i == VBO_ATTRIB_MAT_FRONT_SHININESS ||
|
||||
i == VBO_ATTRIB_MAT_BACK_SHININESS)
|
||||
ctx->NewState |= _NEW_FF_VERT_PROGRAM;
|
||||
} else {
|
||||
ctx->NewState |= _NEW_CURRENT_ATTRIB;
|
||||
ctx->PopAttribState |= GL_CURRENT_BIT;
|
||||
}
|
||||
|
||||
ctx->NewState |= _NEW_CURRENT_ATTRIB;
|
||||
ctx->PopAttribState |= GL_CURRENT_BIT;
|
||||
}
|
||||
|
||||
/* Given that we explicitly state size here, there is no need
|
||||
|
|
|
|||
|
|
@ -110,8 +110,7 @@ playback_copy_to_current(struct gl_context *ctx,
|
|||
_NEW_CURRENT_ATTRIB, GL_CURRENT_BIT, 0, &data, &color0_changed);
|
||||
/* Copy materials */
|
||||
copy_vao(ctx, node->VAO[VP_MODE_FF], VERT_BIT_MAT_ALL,
|
||||
_NEW_CURRENT_ATTRIB | _NEW_MATERIAL,
|
||||
GL_CURRENT_BIT | GL_LIGHTING_BIT,
|
||||
_NEW_MATERIAL, GL_LIGHTING_BIT,
|
||||
VBO_MATERIAL_SHIFT, &data, &color0_changed);
|
||||
|
||||
if (color0_changed && ctx->Light.ColorMaterialEnabled) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue