Commit b62f4139 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

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

parent e592b541
...@@ -744,9 +744,9 @@ void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_conte ...@@ -744,9 +744,9 @@ void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_conte
const struct wined3d_state *state) const struct wined3d_state *state)
{ {
DWORD flags = buffer->flags & (WINED3D_BUFFER_SYNC | WINED3D_BUFFER_DISCARD); 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; struct wined3d_device *device = buffer->resource.device;
UINT start, end, len, vertices; UINT start, end, len, vertices;
const struct wined3d_gl_info *gl_info;
BOOL decl_changed = FALSE; BOOL decl_changed = FALSE;
unsigned int i, j; unsigned int i, j;
BYTE *data; BYTE *data;
...@@ -783,7 +783,7 @@ void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_conte ...@@ -783,7 +783,7 @@ void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_conte
if (!use_vs(state)) 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; fixup_flags |= WINED3D_BUFFER_FIXUP_D3DCOLOR;
if (!context->d3d_info->xyzrhw) if (!context->d3d_info->xyzrhw)
fixup_flags |= WINED3D_BUFFER_FIXUP_XYZRHW; fixup_flags |= WINED3D_BUFFER_FIXUP_XYZRHW;
...@@ -873,13 +873,11 @@ void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_conte ...@@ -873,13 +873,11 @@ void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_conte
return; return;
} }
buffer_direct_upload(buffer, context->gl_info, flags); buffer_direct_upload(buffer, gl_info, flags);
return; return;
} }
gl_info = context->gl_info;
if(!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER)) if(!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER))
{ {
buffer_get_sysmem(buffer, context); buffer_get_sysmem(buffer, context);
......
...@@ -3214,7 +3214,7 @@ static void context_update_stream_info(struct wined3d_context *context, const st ...@@ -3214,7 +3214,7 @@ static void context_update_stream_info(struct wined3d_context *context, const st
else else
{ {
WORD slow_mask = -!d3d_info->ffp_generic_attributes & (1u << WINED3D_FFP_PSIZE); 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)); & ((1u << WINED3D_FFP_DIFFUSE) | (1u << WINED3D_FFP_SPECULAR) | (1u << WINED3D_FFP_BLENDWEIGHT));
if ((stream_info->position_transformed && !d3d_info->xyzrhw) if ((stream_info->position_transformed && !d3d_info->xyzrhw)
......
...@@ -6598,8 +6598,8 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr ...@@ -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) for (i = 0; i < ARRAY_SIZE(attrib_info); ++i)
{ {
if (attrib_info[i].name[0]) if (attrib_info[i].name[0])
shader_addline(buffer, "%s %s = vs_in%u;\n", shader_addline(buffer, "%s %s = vs_in%u%s;\n", attrib_info[i].type, attrib_info[i].name,
attrib_info[i].type, attrib_info[i].name, i); i, settings->swizzle_map & (1u << i) ? ".zyxw" : "");
} }
for (i = 0; i < MAX_TEXTURES; ++i) for (i = 0; i < MAX_TEXTURES; ++i)
{ {
......
...@@ -5559,6 +5559,8 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context, ...@@ -5559,6 +5559,8 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
else else
settings->flatshading = FALSE; settings->flatshading = FALSE;
settings->swizzle_map = si->swizzle_map;
return; return;
} }
...@@ -5644,6 +5646,8 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context, ...@@ -5644,6 +5646,8 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
else else
settings->flatshading = FALSE; settings->flatshading = FALSE;
settings->swizzle_map = si->swizzle_map;
settings->padding = 0; settings->padding = 0;
} }
......
...@@ -2299,6 +2299,8 @@ struct wined3d_ffp_vs_settings ...@@ -2299,6 +2299,8 @@ struct wined3d_ffp_vs_settings
DWORD padding : 10; DWORD padding : 10;
DWORD texgen[MAX_TEXTURES]; DWORD texgen[MAX_TEXTURES];
WORD swizzle_map; /* MAX_ATTRIBS, 16 */
}; };
struct wined3d_ffp_vs_desc struct wined3d_ffp_vs_desc
......
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