wined3d: SM1 texture projection always divides by w when there is a vertex shader set.
This commit is contained in:
parent
41c910d5f0
commit
f69f2aa347
|
@ -4237,25 +4237,25 @@ static void texture_transform_flags_test(IDirect3DDevice9 *device)
|
||||||
struct projected_textures_test_run projected_tests_3[4] =
|
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,
|
D3DTTFF_PROJECTED,
|
||||||
decl3,
|
decl3,
|
||||||
TRUE, TRUE,
|
TRUE, FALSE,
|
||||||
{120, 300, 240, 390},
|
{120, 300, 240, 390},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"D3DTTFF_PROJECTED (like COUNT4 | PROJECTED, the w component has the default value 1.0) - bottom right",
|
"D3DTTFF_COUNT3 | D3DTTFF_PROJECTED (like COUNT4 | PROJECTED) - bottom right",
|
||||||
D3DTTFF_PROJECTED,
|
D3DTTFF_COUNT3 | D3DTTFF_PROJECTED,
|
||||||
decl,
|
decl3,
|
||||||
TRUE, TRUE,
|
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,
|
0xffffffff,
|
||||||
decl,
|
decl3,
|
||||||
TRUE, TRUE,
|
TRUE, TRUE,
|
||||||
{20, 210, 40, 225},
|
{120, 60, 240, 150},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"D3DTTFF_PROJECTED (like COUNT4 | PROJECTED) - top right",
|
"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)
|
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 tex_transform = flags & ~WINED3D_TTFF_PROJECTED;
|
||||||
DWORD max_valid = WINED3D_TTFF_COUNT4;
|
|
||||||
|
|
||||||
if (!state->vertex_shader)
|
if (!state->vertex_shader)
|
||||||
{
|
{
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
unsigned int index = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX];
|
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)
|
for (j = 0; j < state->vertex_declaration->element_count; ++j)
|
||||||
{
|
{
|
||||||
struct wined3d_vertex_declaration_element *element =
|
struct wined3d_vertex_declaration_element *element =
|
||||||
|
@ -1939,21 +1940,25 @@ void find_ps_compile_args(const struct wined3d_state *state,
|
||||||
break;
|
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
|
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;
|
args->tex_transform |= tex_transform << i * WINED3D_PSARGS_TEXTRANSFORM_SHIFT;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue