1
0
mirror of https://github.com/wine-mirror/wine synced 2024-06-29 06:14:34 +00:00

wined3d: Default diffuse to 1.0 in the vertex shader.

This commit is contained in:
Elizabeth Figura 2024-05-04 13:35:04 -05:00 committed by Alexandre Julliard
parent c825c885d3
commit 95999accf6
6 changed files with 15 additions and 27 deletions

View File

@ -26083,10 +26083,9 @@ static void test_color_vertex(void)
ok(SUCCEEDED(hr), "Failed to end scene, hr %#lx.\n", hr);
colour = getPixelColor(device, 320, 240);
todo_wine_if (i == 13 || i == 14 || i == 19)
ok(color_match(colour, tests[i].result, 1),
"Expected colour 0x%08x for test %u, got 0x%08x.\n",
tests[i].result, i, colour);
ok(color_match(colour, tests[i].result, 1),
"Expected colour 0x%08x for test %u, got 0x%08x.\n",
tests[i].result, i, colour);
}
refcount = IDirect3DDevice9_Release(device);
@ -28516,8 +28515,7 @@ static void test_default_diffuse(void)
ok(hr == S_OK, "Got hr %#lx.\n", hr);
colour = getPixelColor(device, 320, 240);
todo_wine_if (j == 2)
ok(colour == vs_tests[j].expect_colour, "Got unexpected colour %08x.\n", colour);
ok(colour == vs_tests[j].expect_colour, "Got unexpected colour %08x.\n", colour);
winetest_pop_context();
}

View File

@ -4938,23 +4938,8 @@ static void wined3d_context_gl_load_numbered_arrays(struct wined3d_context_gl *c
{
if (context->numbered_array_mask & (1u << i))
wined3d_context_gl_unload_numbered_array(context_gl, i);
if (!use_vs(state) && i == WINED3D_FFP_DIFFUSE)
{
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
{
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;
}
}
if (!(context_gl->default_attrib_value_set & (1u << i)))
GL_EXTCALL(glVertexAttrib4f(i, 0.0f, 0.0f, 0.0f, 0.0f));
context_gl->default_attrib_value_set |= 1u << i;
continue;
}

View File

@ -8937,7 +8937,10 @@ static void shader_glsl_ffp_vertex_lighting(struct wined3d_string_buffer *buffer
if (!settings->lighting)
{
shader_addline(buffer, "ffp_varying_diffuse = ffp_attrib_diffuse;\n");
if (settings->diffuse)
shader_addline(buffer, "ffp_varying_diffuse = ffp_attrib_diffuse;\n");
else
shader_addline(buffer, "ffp_varying_diffuse = vec4(1.0);\n");
shader_addline(buffer, "ffp_varying_specular = ffp_attrib_specular;\n");
return;
}

View File

@ -6577,6 +6577,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
settings->transformed = 1;
settings->point_size = state->primitive_type == WINED3D_PT_POINTLIST;
settings->per_vertex_point_size = vdecl->point_size;
settings->diffuse = vdecl->diffuse;
if (!state->render_states[WINED3D_RS_FOGENABLE])
settings->fog_mode = WINED3D_FFP_VS_FOG_OFF;
else if (state->render_states[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE)
@ -6619,6 +6620,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
settings->clipping = state->render_states[WINED3D_RS_CLIPPING]
&& state->render_states[WINED3D_RS_CLIPPLANEENABLE];
settings->diffuse = vdecl->diffuse;
settings->normal = vdecl->normal;
settings->normalize = settings->normal && state->render_states[WINED3D_RS_NORMALIZENORMALS];
settings->lighting = !!state->render_states[WINED3D_RS_LIGHTING];

View File

@ -608,12 +608,11 @@ struct wined3d_context_gl
uint32_t dc_is_private : 1;
uint32_t dc_has_format : 1; /* Only meaningful for private DCs. */
uint32_t fog_enabled : 1;
uint32_t diffuse_attrib_to_1 : 1;
uint32_t rebind_fbo : 1;
uint32_t needs_set : 1;
uint32_t internal_format_set : 1;
uint32_t valid : 1;
uint32_t padding : 24;
uint32_t padding : 25;
uint32_t default_attrib_value_set;

View File

@ -2725,7 +2725,8 @@ struct wined3d_ffp_vs_settings
DWORD ortho_fog : 1;
DWORD flatshading : 1;
DWORD specular_enable : 1;
DWORD padding : 17;
DWORD diffuse : 1;
DWORD padding : 16;
DWORD swizzle_map; /* MAX_ATTRIBS, 32 */