Commit fca60d69 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

wined3d: Factor out wined3d_get_material_colour_source() function.

parent 83c9e524
......@@ -6381,6 +6381,7 @@ int wined3d_ffp_frag_program_key_compare(const void *key, const struct wine_rb_e
void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
const struct wined3d_state *state, struct wined3d_ffp_vs_settings *settings)
{
enum wined3d_material_color_source diffuse_source, emissive_source, ambient_source, specular_source;
const struct wined3d_stream_info *si = &context->stream_info;
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_d3d_info *d3d_info = context->d3d_info;
......@@ -6442,24 +6443,12 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
settings->point_size = state->gl_primitive_type == GL_POINTS;
settings->per_vertex_point_size = !!(si->use_map & 1u << WINED3D_FFP_PSIZE);
if (state->render_states[WINED3D_RS_COLORVERTEX])
{
settings->diffuse_source = validate_material_colour_source(si->use_map,
state->render_states[WINED3D_RS_DIFFUSEMATERIALSOURCE]);
settings->emissive_source = validate_material_colour_source(si->use_map,
state->render_states[WINED3D_RS_EMISSIVEMATERIALSOURCE]);
settings->ambient_source = validate_material_colour_source(si->use_map,
state->render_states[WINED3D_RS_AMBIENTMATERIALSOURCE]);
settings->specular_source = validate_material_colour_source(si->use_map,
state->render_states[WINED3D_RS_SPECULARMATERIALSOURCE]);
}
else
{
settings->diffuse_source = WINED3D_MCS_MATERIAL;
settings->emissive_source = WINED3D_MCS_MATERIAL;
settings->ambient_source = WINED3D_MCS_MATERIAL;
settings->specular_source = WINED3D_MCS_MATERIAL;
}
wined3d_get_material_colour_source(&diffuse_source, &emissive_source,
&ambient_source, &specular_source, state, si);
settings->diffuse_source = diffuse_source;
settings->emissive_source = emissive_source;
settings->ambient_source = ambient_source;
settings->specular_source = specular_source;
for (i = 0; i < WINED3D_MAX_TEXTURES; ++i)
{
......
......@@ -4851,6 +4851,33 @@ static inline enum wined3d_material_color_source validate_material_colour_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)
{
if (!state->render_states[WINED3D_RS_LIGHTING])
{
*diffuse = WINED3D_MCS_COLOR1;
*specular = WINED3D_MCS_COLOR2;
*emissive = *ambient = WINED3D_MCS_MATERIAL;
return;
}
if (!state->render_states[WINED3D_RS_COLORVERTEX])
{
*diffuse = *emissive = *ambient = *specular = WINED3D_MCS_MATERIAL;
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]);
}
BOOL invert_matrix(struct wined3d_matrix *out, const struct wined3d_matrix *m) DECLSPEC_HIDDEN;
void compute_normal_matrix(float *normal_matrix, BOOL legacy_lighting,
......
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