wined3d: Keep track of textures projection state in compiled pixel shaders.

Matteo Bruni matteo.mystral at gmail.com
Tue Sep 28 14:03:03 CDT 2010


This fixes EverQuest 2 bug http://bugs.winehq.org/show_bug.cgi?id=11354
-------------- next part --------------
From ccdf7e08aa27aa0f031658b7a395b8b2fcd5a371 Mon Sep 17 00:00:00 2001
From: Matteo Bruni <matteo.mystral at gmail.com>
Date: Sat, 25 Sep 2010 19:37:47 +0200
Subject: wined3d: Keep track of textures projection state in compiled pixel shaders.

---
 dlls/wined3d/shader.c          |   12 +++++++++++-
 dlls/wined3d/wined3d_private.h |    2 +-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 8d380b7..1995f50 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -2082,7 +2082,17 @@ void find_ps_compile_args(IWineD3DPixelShaderImpl *shader,
         if(rt->resource.format->Flags & WINED3DFMT_FLAG_SRGB_WRITE) args->srgb_correction = 1;
     }
 
-    args->np2_fixup = 0;
+    if (shader->baseShader.reg_maps.shader_version.major == 1
+            && shader->baseShader.reg_maps.shader_version.minor <= 3)
+    {
+        for (i = 0; i < 4; ++i)
+        {
+            /* Projected cube textures don't make a lot of sense, the resulting coordinates stay the same. */
+            if (stateblock->state.texture_states[i][WINED3DTSS_TEXTURETRANSFORMFLAGS] & WINED3DTTFF_PROJECTED
+                    && shader->baseShader.reg_maps.sampler_type[i] != WINED3DSTT_CUBE)
+                args->projected |= 1 << i;
+        }
+    }
 
     for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i)
     {
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 8adcc35..37f4295 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -681,7 +681,7 @@ struct ps_compile_args {
     struct color_fixup_desc     color_fixup[MAX_FRAGMENT_SAMPLERS];
     enum vertexprocessing_mode  vp_mode;
     enum fogmode                fog;
-    /* Projected textures(ps 1.0-1.3) */
+    BYTE                        projected; /* ps 1.0-1.3, 4 textures */
     /* Texture types(2D, Cube, 3D) in ps 1.x */
     BOOL                        srgb_correction;
     WORD                        np2_fixup;
-- 
1.7.2.2


More information about the wine-patches mailing list