On Fri, 17 May 2019 at 13:22, Paul Gofman <gofmanp(a)gmail.com> wrote:
+static void wined3d_format_get_color(const struct wined3d_format *format, const BYTE *data, + struct wined3d_color *color) +{ Thinking about it a bit more, perhaps the the long term direction we want this to go is something like "wined3d_format_get_vec4()", instead of making this specific to colours. No rush though, it would be fine to wait with that until it's actually needed.
+ case WINED3DFMT_R32_FLOAT: + case WINED3DFMT_R32G32_FLOAT: + case WINED3DFMT_R32G32B32_FLOAT: + case WINED3DFMT_R32G32B32A32_FLOAT: + { + const float *float_data = (const float *)data; + + for (i = 0; i < format->component_count; ++i) + output[i] = float_data[i]; + + break; + } Note that you leave the "implicit" components uninitialised in this case, while you do initialise them for the other formats.
+ if (lighting) + { + if (state->render_states[WINED3D_RS_COLORVERTEX]) + { + diffuse_source = validate_material_colour_source(stream_info->use_map, + state->render_states[WINED3D_RS_DIFFUSEMATERIALSOURCE]); + specular_source = validate_material_colour_source(stream_info->use_map, + state->render_states[WINED3D_RS_SPECULARMATERIALSOURCE]); + } + else + { + diffuse_source = specular_source = WINED3D_MCS_MATERIAL; + } + } + else + { + diffuse_source = WINED3D_MCS_COLOR1; + specular_source = WINED3D_MCS_COLOR2; + } In case it helps, wined3d_ffp_get_vs_settings() already does something very similar, perhaps it makes sense to start from the wined3d_ffp_vs_settings structure, instead of the raw state.