wined3d: Swizzle D3DCOLOR attributes in the GLSL FFP replacement when necessary.

Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Matteo Bruni 2016-07-30 19:56:55 +02:00 committed by Alexandre Julliard
parent e592b541a1
commit b62f4139ed
5 changed files with 12 additions and 8 deletions

View File

@ -744,9 +744,9 @@ void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_conte
const struct wined3d_state *state)
{
DWORD flags = buffer->flags & (WINED3D_BUFFER_SYNC | WINED3D_BUFFER_DISCARD);
const struct wined3d_gl_info *gl_info = context->gl_info;
struct wined3d_device *device = buffer->resource.device;
UINT start, end, len, vertices;
const struct wined3d_gl_info *gl_info;
BOOL decl_changed = FALSE;
unsigned int i, j;
BYTE *data;
@ -783,7 +783,7 @@ void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_conte
if (!use_vs(state))
{
if (!context->gl_info->supported[ARB_VERTEX_ARRAY_BGRA])
if (!gl_info->supported[ARB_VERTEX_ARRAY_BGRA] && !context->d3d_info->ffp_generic_attributes)
fixup_flags |= WINED3D_BUFFER_FIXUP_D3DCOLOR;
if (!context->d3d_info->xyzrhw)
fixup_flags |= WINED3D_BUFFER_FIXUP_XYZRHW;
@ -873,13 +873,11 @@ void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_conte
return;
}
buffer_direct_upload(buffer, context->gl_info, flags);
buffer_direct_upload(buffer, gl_info, flags);
return;
}
gl_info = context->gl_info;
if(!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER))
{
buffer_get_sysmem(buffer, context);

View File

@ -3214,7 +3214,7 @@ static void context_update_stream_info(struct wined3d_context *context, const st
else
{
WORD slow_mask = -!d3d_info->ffp_generic_attributes & (1u << WINED3D_FFP_PSIZE);
slow_mask |= -!gl_info->supported[ARB_VERTEX_ARRAY_BGRA]
slow_mask |= -(!gl_info->supported[ARB_VERTEX_ARRAY_BGRA] && !d3d_info->ffp_generic_attributes)
& ((1u << WINED3D_FFP_DIFFUSE) | (1u << WINED3D_FFP_SPECULAR) | (1u << WINED3D_FFP_BLENDWEIGHT));
if ((stream_info->position_transformed && !d3d_info->xyzrhw)

View File

@ -6598,8 +6598,8 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr
for (i = 0; i < ARRAY_SIZE(attrib_info); ++i)
{
if (attrib_info[i].name[0])
shader_addline(buffer, "%s %s = vs_in%u;\n",
attrib_info[i].type, attrib_info[i].name, i);
shader_addline(buffer, "%s %s = vs_in%u%s;\n", attrib_info[i].type, attrib_info[i].name,
i, settings->swizzle_map & (1u << i) ? ".zyxw" : "");
}
for (i = 0; i < MAX_TEXTURES; ++i)
{

View File

@ -5559,6 +5559,8 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
else
settings->flatshading = FALSE;
settings->swizzle_map = si->swizzle_map;
return;
}
@ -5644,6 +5646,8 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
else
settings->flatshading = FALSE;
settings->swizzle_map = si->swizzle_map;
settings->padding = 0;
}

View File

@ -2299,6 +2299,8 @@ struct wined3d_ffp_vs_settings
DWORD padding : 10;
DWORD texgen[MAX_TEXTURES];
WORD swizzle_map; /* MAX_ATTRIBS, 16 */
};
struct wined3d_ffp_vs_desc