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

wined3d: SM1 texture projection always divides by w when there is a vertex shader set.

parent 41c910d5
......@@ -4237,25 +4237,25 @@ static void texture_transform_flags_test(IDirect3DDevice9 *device)
struct projected_textures_test_run projected_tests_3[4] =
{
{
"D3DTTFF_PROJECTED (like COUNT4 | PROJECTED) - bottom left",
"D3DTTFF_COUNT3 | D3DTTFF_PROJECTED (like COUNT4 | PROJECTED) - bottom left",
D3DTTFF_PROJECTED,
decl3,
TRUE, TRUE,
TRUE, FALSE,
{120, 300, 240, 390},
},
{
"D3DTTFF_PROJECTED (like COUNT4 | PROJECTED, the w component has the default value 1.0) - bottom right",
D3DTTFF_PROJECTED,
decl,
"D3DTTFF_COUNT3 | D3DTTFF_PROJECTED (like COUNT4 | PROJECTED) - bottom right",
D3DTTFF_COUNT3 | D3DTTFF_PROJECTED,
decl3,
TRUE, TRUE,
{340, 450, 360, 465},
{440, 300, 560, 390},
},
{
"0xffffffff (like COUNT4 | PROJECTED, the w component has the default value 1.0) - top left",
"0xffffffff (like COUNT4 | PROJECTED) - top left",
0xffffffff,
decl,
decl3,
TRUE, TRUE,
{20, 210, 40, 225},
{120, 60, 240, 150},
},
{
"D3DTTFF_PROJECTED (like COUNT4 | PROJECTED) - top right",
......
......@@ -1919,14 +1919,15 @@ void find_ps_compile_args(const struct wined3d_state *state,
if (flags & WINED3D_TTFF_PROJECTED)
{
enum wined3d_sampler_texture_type sampler_type = shader->reg_maps.sampler_type[i];
DWORD tex_transform = flags & ~WINED3D_TTFF_PROJECTED;
DWORD max_valid = WINED3D_TTFF_COUNT4;
if (!state->vertex_shader)
{
unsigned int j;
unsigned int index = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX];
DWORD max_valid = WINED3D_TTFF_COUNT4;
enum wined3d_sampler_texture_type sampler_type = shader->reg_maps.sampler_type[i];
for (j = 0; j < state->vertex_declaration->element_count; ++j)
{
struct wined3d_vertex_declaration_element *element =
......@@ -1939,21 +1940,25 @@ void find_ps_compile_args(const struct wined3d_state *state,
break;
}
}
if (!tex_transform || tex_transform > max_valid)
{
WARN("Fixing up projected texture transform flags from %#x to %#x.\n",
tex_transform, max_valid);
tex_transform = max_valid;
}
if ((sampler_type == WINED3DSTT_1D && tex_transform > WINED3D_TTFF_COUNT1)
|| (sampler_type == WINED3DSTT_2D && tex_transform > WINED3D_TTFF_COUNT2)
|| (sampler_type == WINED3DSTT_VOLUME && tex_transform > WINED3D_TTFF_COUNT3))
tex_transform |= WINED3D_PSARGS_PROJECTED;
else
{
WARN("Application requested projected texture with unsuitable texture coordinates.\n");
WARN("(texture unit %u, transform flags %#x, sampler type %u).\n",
i, tex_transform, sampler_type);
}
}
if (!tex_transform || tex_transform > max_valid)
{
WARN("Fixing up projected texture transform flags from %#x to %#x.\n",
tex_transform, max_valid);
tex_transform = max_valid;
}
if ((sampler_type == WINED3DSTT_1D && tex_transform > WINED3D_TTFF_COUNT1)
|| (sampler_type == WINED3DSTT_2D && tex_transform > WINED3D_TTFF_COUNT2)
|| (sampler_type == WINED3DSTT_VOLUME && tex_transform > WINED3D_TTFF_COUNT3))
tex_transform |= WINED3D_PSARGS_PROJECTED;
else
WARN("Application requested projected texture with unsuitable texture coordinates.\n");
tex_transform = WINED3D_TTFF_COUNT4 | WINED3D_PSARGS_PROJECTED;
args->tex_transform |= tex_transform << i * WINED3D_PSARGS_TEXTRANSFORM_SHIFT;
}
......
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