mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 15:04:44 +00:00
wined3d: Just check the vertex declaration for colour usage.
Do not check the stream info. In practice, this amounts to a difference if the usage is included in the vertex declaration but the corresponding stream is not bound; however, tests show that in this case we should supply a default colour of zero.
This commit is contained in:
parent
db63c8be29
commit
4929e51932
|
@ -26083,7 +26083,7 @@ 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 == 16 || i == 18 || i == 19)
|
||||
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);
|
||||
|
|
|
@ -3383,7 +3383,7 @@ static HRESULT process_vertices_strided(const struct wined3d_device *device, DWO
|
|||
lighting = state->render_states[WINED3D_RS_LIGHTING]
|
||||
&& (dst_fvf & (WINED3DFVF_DIFFUSE | WINED3DFVF_SPECULAR));
|
||||
wined3d_get_material_colour_source(&diffuse_source, &emissive_source,
|
||||
&ambient_source, &specular_source, state, stream_info);
|
||||
&ambient_source, &specular_source, state);
|
||||
output_colour_format = wined3d_get_format(device->adapter, WINED3DFMT_B8G8R8A8_UNORM, 0);
|
||||
material_specular_state_colour = state->render_states[WINED3D_RS_SPECULARENABLE]
|
||||
? &state->material.specular : &black;
|
||||
|
|
|
@ -11759,13 +11759,13 @@ static void glsl_vertex_pipe_vdecl(struct wined3d_context *context,
|
|||
const struct wined3d_vertex_declaration *vdecl = state->vertex_declaration;
|
||||
struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
|
||||
const struct wined3d_gl_info *gl_info = context_gl->gl_info;
|
||||
BOOL specular = !!(context->stream_info.use_map & (1u << WINED3D_FFP_SPECULAR));
|
||||
BOOL diffuse = !!(context->stream_info.use_map & (1u << WINED3D_FFP_DIFFUSE));
|
||||
BOOL normal = !!(context->stream_info.use_map & (1u << WINED3D_FFP_NORMAL));
|
||||
const BOOL legacy_clip_planes = needs_legacy_glsl_syntax(gl_info);
|
||||
BOOL transformed = context->stream_info.position_transformed;
|
||||
BOOL wasrhw = context->last_was_rhw;
|
||||
bool point_size = vdecl->point_size;
|
||||
bool specular = vdecl->specular;
|
||||
bool diffuse = vdecl->diffuse;
|
||||
unsigned int i;
|
||||
|
||||
context->last_was_rhw = transformed;
|
||||
|
|
|
@ -6629,7 +6629,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
|
|||
settings->per_vertex_point_size = vdecl->point_size;
|
||||
|
||||
wined3d_get_material_colour_source(&diffuse_source, &emissive_source,
|
||||
&ambient_source, &specular_source, state, si);
|
||||
&ambient_source, &specular_source, state);
|
||||
settings->diffuse_source = diffuse_source;
|
||||
settings->emissive_source = emissive_source;
|
||||
settings->ambient_source = ambient_source;
|
||||
|
|
|
@ -222,6 +222,10 @@ static HRESULT vertexdeclaration_init(struct wined3d_vertex_declaration *declara
|
|||
declaration->position_transformed = true;
|
||||
else if (e->usage == WINED3D_DECL_USAGE_PSIZE)
|
||||
declaration->point_size = true;
|
||||
else if (e->usage == WINED3D_DECL_USAGE_COLOR && !e->usage_idx)
|
||||
declaration->diffuse = true;
|
||||
else if (e->usage == WINED3D_DECL_USAGE_COLOR && e->usage_idx == 1)
|
||||
declaration->specular = true;
|
||||
|
||||
/* Find the streams used in the declaration. The vertex buffers have
|
||||
* to be loaded when drawing, but filter tessellation pseudo streams. */
|
||||
|
|
|
@ -3493,6 +3493,8 @@ struct wined3d_vertex_declaration
|
|||
|
||||
bool position_transformed;
|
||||
bool point_size;
|
||||
bool diffuse;
|
||||
bool specular;
|
||||
};
|
||||
|
||||
bool wined3d_light_state_enable_light(struct wined3d_light_state *state, const struct wined3d_d3d_info *d3d_info,
|
||||
|
@ -4625,21 +4627,22 @@ static inline void wined3d_not_from_cs(const struct wined3d_cs *cs)
|
|||
assert(cs->thread_id != GetCurrentThreadId());
|
||||
}
|
||||
|
||||
static inline enum wined3d_material_color_source validate_material_colour_source(WORD use_map,
|
||||
enum wined3d_material_color_source source)
|
||||
static inline enum wined3d_material_color_source validate_material_colour_source(
|
||||
const struct wined3d_vertex_declaration *vdecl, enum wined3d_material_color_source source)
|
||||
{
|
||||
if (source == WINED3D_MCS_COLOR1 && use_map & (1u << WINED3D_FFP_DIFFUSE))
|
||||
if (source == WINED3D_MCS_COLOR1 && vdecl->diffuse)
|
||||
return source;
|
||||
if (source == WINED3D_MCS_COLOR2 && use_map & (1u << WINED3D_FFP_SPECULAR))
|
||||
if (source == WINED3D_MCS_COLOR2 && vdecl->specular)
|
||||
return source;
|
||||
return WINED3D_MCS_MATERIAL;
|
||||
}
|
||||
|
||||
static inline void wined3d_get_material_colour_source(enum wined3d_material_color_source *diffuse,
|
||||
enum wined3d_material_color_source *emissive, enum wined3d_material_color_source *ambient,
|
||||
enum wined3d_material_color_source *specular, const struct wined3d_state *state,
|
||||
const struct wined3d_stream_info *si)
|
||||
enum wined3d_material_color_source *specular, const struct wined3d_state *state)
|
||||
{
|
||||
const struct wined3d_vertex_declaration *vdecl = state->vertex_declaration;
|
||||
|
||||
if (!state->render_states[WINED3D_RS_LIGHTING])
|
||||
{
|
||||
*diffuse = WINED3D_MCS_COLOR1;
|
||||
|
@ -4656,10 +4659,10 @@ static inline void wined3d_get_material_colour_source(enum wined3d_material_colo
|
|||
return;
|
||||
}
|
||||
|
||||
*diffuse = validate_material_colour_source(si->use_map, state->render_states[WINED3D_RS_DIFFUSEMATERIALSOURCE]);
|
||||
*emissive = validate_material_colour_source(si->use_map, state->render_states[WINED3D_RS_EMISSIVEMATERIALSOURCE]);
|
||||
*ambient = validate_material_colour_source(si->use_map, state->render_states[WINED3D_RS_AMBIENTMATERIALSOURCE]);
|
||||
*specular = validate_material_colour_source(si->use_map, state->render_states[WINED3D_RS_SPECULARMATERIALSOURCE]);
|
||||
*diffuse = validate_material_colour_source(vdecl, state->render_states[WINED3D_RS_DIFFUSEMATERIALSOURCE]);
|
||||
*emissive = validate_material_colour_source(vdecl, state->render_states[WINED3D_RS_EMISSIVEMATERIALSOURCE]);
|
||||
*ambient = validate_material_colour_source(vdecl, state->render_states[WINED3D_RS_AMBIENTMATERIALSOURCE]);
|
||||
*specular = validate_material_colour_source(vdecl, state->render_states[WINED3D_RS_SPECULARMATERIALSOURCE]);
|
||||
}
|
||||
|
||||
static inline void wined3d_vec4_transform(struct wined3d_vec4 *dst,
|
||||
|
|
Loading…
Reference in a new issue