Commit 8958eb68 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

wined3d: Avoid some redundant glVertexAttrib4f() calls.

parent 33d38219
......@@ -5358,9 +5358,23 @@ static void wined3d_context_gl_load_numbered_arrays(struct wined3d_context_gl *c
if (context->numbered_array_mask & (1u << i))
context_unload_numbered_array(context, i);
if (!use_vs(state) && i == WINED3D_FFP_DIFFUSE)
GL_EXTCALL(glVertexAttrib4f(i, 1.0f, 1.0f, 1.0f, 1.0f));
{
if (!(context_gl->default_attrib_value_set & (1u << i)) || !context_gl->diffuse_attrib_to_1)
{
GL_EXTCALL(glVertexAttrib4f(i, 1.0f, 1.0f, 1.0f, 1.0f));
context_gl->diffuse_attrib_to_1 = 1;
}
}
else
GL_EXTCALL(glVertexAttrib4f(i, 0.0f, 0.0f, 0.0f, 0.0f));
{
if (!(context_gl->default_attrib_value_set & (1u << i)))
{
GL_EXTCALL(glVertexAttrib4f(i, 0.0f, 0.0f, 0.0f, 0.0f));
if (i == WINED3D_FFP_DIFFUSE)
context_gl->diffuse_attrib_to_1 = 0;
}
}
context_gl->default_attrib_value_set |= 1u << i;
continue;
}
......@@ -5380,6 +5394,7 @@ static void wined3d_context_gl_load_numbered_arrays(struct wined3d_context_gl *c
* mode instead. */
if (context->numbered_array_mask & (1u << i))
context_unload_numbered_array(context, i);
context_gl->default_attrib_value_set &= ~(1u << i);
continue;
}
......@@ -5526,6 +5541,7 @@ static void wined3d_context_gl_load_numbered_arrays(struct wined3d_context_gl *c
break;
}
context_gl->default_attrib_value_set &= ~(1u << i);
}
}
checkGLcall("Loading numbered arrays");
......
......@@ -1996,7 +1996,10 @@ struct wined3d_context_gl
struct wined3d_context c;
uint32_t fog_enabled : 1;
uint32_t padding : 31;
uint32_t diffuse_attrib_to_1 : 1;
uint32_t padding : 30;
uint32_t default_attrib_value_set;
GLenum *texture_type;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment