Matteo Bruni : wined3d: Ignore invalid texture transform flags.
Alexandre Julliard
julliard at winehq.org
Tue Dec 13 13:01:24 CST 2011
Module: wine
Branch: master
Commit: 68e0cd430f2e57e55278acd2422127330628eb6d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=68e0cd430f2e57e55278acd2422127330628eb6d
Author: Matteo Bruni <mbruni at codeweavers.com>
Date: Mon Dec 12 20:25:17 2011 +0100
wined3d: Ignore invalid texture transform flags.
---
dlls/wined3d/shader.c | 23 +++++++++++++++++++++--
1 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 11be333..4823750 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -1911,9 +1911,28 @@ void find_ps_compile_args(const struct wined3d_state *state,
for (i = 0; i < 4; ++i)
{
DWORD flags = state->texture_states[i][WINED3DTSS_TEXTURETRANSFORMFLAGS];
- DWORD tex_transform = flags & ~WINED3DTTFF_PROJECTED;
+ DWORD count, tex_transform;
+
+ /* Filter some invalid flags */
+ count = flags & ~WINED3DTTFF_PROJECTED;
+ if (count > WINED3DTTFF_COUNT4)
+ {
+ WARN("The application set an invalid TEXTURETRANSFORMFLAGS value.\n");
+ flags = count = 0;
+ }
+
+ tex_transform = count;
if (flags & WINED3DTTFF_PROJECTED)
- tex_transform |= WINED3D_PSARGS_PROJECTED;
+ {
+ enum wined3d_sampler_texture_type sampler_type = shader->reg_maps.sampler_type[i];
+
+ if ((sampler_type == WINED3DSTT_1D && tex_transform > WINED3DTTFF_COUNT1)
+ || (sampler_type == WINED3DSTT_2D && tex_transform > WINED3DTTFF_COUNT2)
+ || (sampler_type == WINED3DSTT_VOLUME && tex_transform > WINED3DTTFF_COUNT3))
+ tex_transform |= WINED3D_PSARGS_PROJECTED;
+ else
+ WARN("Application requested projected texture with unsuitable texture coordinates.\n");
+ }
args->tex_transform |= tex_transform << i * WINED3D_PSARGS_TEXTRANSFORM_SHIFT;
}
}
More information about the wine-cvs
mailing list