wined3d: Ignore invalid texture transform flags.

This commit is contained in:
Matteo Bruni 2011-12-12 20:25:17 +01:00 committed by Alexandre Julliard
parent fdd4df446f
commit 68e0cd430f

View file

@ -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;
}
}