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

Alexandre Julliard julliard at winehq.org
Tue Jan 24 14:25:28 CST 2012


Module: wine
Branch: master
Commit: f69f2aa3478b860096b846d7a57794d2a7cabe78
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f69f2aa3478b860096b846d7a57794d2a7cabe78

Author: Matteo Bruni <mbruni at codeweavers.com>
Date:   Mon Jan 23 22:34:47 2012 +0100

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

---

 dlls/d3d9/tests/visual.c |   18 +++++++++---------
 dlls/wined3d/shader.c    |   35 ++++++++++++++++++++---------------
 2 files changed, 29 insertions(+), 24 deletions(-)

diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index c3c4ad6..4f0f204 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -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",
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 1ca4351..d047269 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -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;
             }




More information about the wine-cvs mailing list