Stefan Doesinger : wined3d: Add modifier support to tex and friends.

Alexandre Julliard julliard at winehq.org
Wed Jun 17 10:43:27 CDT 2009


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

Author: Stefan Doesinger <stefan at codeweavers.com>
Date:   Thu May 28 19:31:08 2009 +0200

wined3d: Add modifier support to tex and friends.

---

 dlls/wined3d/arb_program_shader.c |   68 ++++++++++++++++++++-----------------
 1 files changed, 37 insertions(+), 31 deletions(-)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index e081774..b39732d 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -910,6 +910,35 @@ static void gen_color_correction(SHADER_BUFFER *buffer, const char *reg, DWORD d
     }
 }
 
+static const char *shader_arb_get_modifier(const struct wined3d_shader_instruction *ins)
+{
+    DWORD mod;
+    const char *ret = "";
+    if (!ins->dst_count) return "";
+
+    mod = ins->dst[0].modifiers;
+    if(mod & WINED3DSPDM_SATURATE)
+    {
+        ret = "_SAT";
+        mod &= ~WINED3DSPDM_SATURATE;
+    }
+    if(mod & WINED3DSPDM_PARTIALPRECISION)
+    {
+        FIXME("Unhandled modifier WINED3DSPDM_PARTIALPRECISION\n");
+        mod &= ~WINED3DSPDM_PARTIALPRECISION;
+    }
+    if(mod & WINED3DSPDM_MSAMPCENTROID)
+    {
+        FIXME("Unhandled modifier WINED3DSPDM_MSAMPCENTROID\n");
+        mod &= ~WINED3DSPDM_MSAMPCENTROID;
+    }
+    if(mod)
+    {
+        FIXME("Unknown modifiers 0x%08x\n", mod);
+    }
+    return ret;
+}
+
 #define TEX_PROJ        0x1
 #define TEX_BIAS        0x2
 #define TEX_LOD         0x4
@@ -924,6 +953,7 @@ static void shader_hw_sample(const struct wined3d_shader_instruction *ins, DWORD
     IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl *)ins->ctx->shader;
     IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) This->baseShader.device;
     struct shader_arb_ctx_priv *priv = ins->ctx->backend_data;
+    const char *mod = shader_arb_get_modifier(ins);
 
     switch(sampler_type) {
         case WINED3DSTT_1D:
@@ -963,29 +993,30 @@ static void shader_hw_sample(const struct wined3d_shader_instruction *ins, DWORD
     {
         if(flags & TEX_PROJ) FIXME("Projected texture sampling with custom derivates\n");
         if(flags & TEX_BIAS) FIXME("Biased texture sampling with custom derivates\n");
-        shader_addline(buffer, "TXD %s, %s, %s, %s, texture[%u], %s;\n", dst_str, coord_reg, dsx, dsy,
-                       sampler_idx, tex_type);
+        shader_addline(buffer, "TXD%s %s, %s, %s, %s, texture[%u], %s;\n", mod, dst_str, coord_reg,
+                       dsx, dsy,sampler_idx, tex_type);
     }
     else if(flags & TEX_LOD)
     {
         if(flags & TEX_PROJ) FIXME("Projected texture sampling with explicit lod\n");
         if(flags & TEX_BIAS) FIXME("Biased texture sampling with explicit lod\n");
-        shader_addline(buffer, "TXL %s, %s, texture[%u], %s;\n", dst_str, coord_reg, sampler_idx, tex_type);
+        shader_addline(buffer, "TXL%s %s, %s, texture[%u], %s;\n", mod, dst_str, coord_reg,
+                       sampler_idx, tex_type);
     }
     else if (flags & TEX_BIAS)
     {
         /* Shouldn't be possible, but let's check for it */
         if(flags & TEX_PROJ) FIXME("Biased and Projected texture sampling\n");
         /* TXB takes the 4th component of the source vector automatically, as d3d. Nothing more to do */
-        shader_addline(buffer, "TXB %s, %s, texture[%u], %s;\n", dst_str, coord_reg, sampler_idx, tex_type);
+        shader_addline(buffer, "TXB%s %s, %s, texture[%u], %s;\n", mod, dst_str, coord_reg, sampler_idx, tex_type);
     }
     else if (flags & TEX_PROJ)
     {
-        shader_addline(buffer, "TXP %s, %s, texture[%u], %s;\n", dst_str, coord_reg, sampler_idx, tex_type);
+        shader_addline(buffer, "TXP%s %s, %s, texture[%u], %s;\n", mod, dst_str, coord_reg, sampler_idx, tex_type);
     }
     else
     {
-        shader_addline(buffer, "TEX %s, %s, texture[%u], %s;\n", dst_str, coord_reg, sampler_idx, tex_type);
+        shader_addline(buffer, "TEX%s %s, %s, texture[%u], %s;\n", mod, dst_str, coord_reg, sampler_idx, tex_type);
     }
 
     if (shader_is_pshader_version(ins->ctx->reg_maps->shader_version.type))
@@ -1079,31 +1110,6 @@ static void shader_arb_get_src_param(const struct wined3d_shader_instruction *in
         sprintf(outregstr, "T%c%s", 'A' + tmpreg, swzstr);
 }
 
-static const char *shader_arb_get_modifier(const struct wined3d_shader_instruction *ins)
-{
-    DWORD mod;
-    const char *ret = "";
-    if (!ins->dst_count) return "";
-
-    mod = ins->dst[0].modifiers;
-    if(mod & WINED3DSPDM_SATURATE) {
-        ret = "_SAT";
-        mod &= ~WINED3DSPDM_SATURATE;
-    }
-    if(mod & WINED3DSPDM_PARTIALPRECISION) {
-        FIXME("Unhandled modifier WINED3DSPDM_PARTIALPRECISION\n");
-        mod &= ~WINED3DSPDM_PARTIALPRECISION;
-    }
-    if(mod & WINED3DSPDM_MSAMPCENTROID) {
-        FIXME("Unhandled modifier WINED3DSPDM_MSAMPCENTROID\n");
-        mod &= ~WINED3DSPDM_MSAMPCENTROID;
-    }
-    if(mod) {
-        FIXME("Unknown modifiers 0x%08x\n", mod);
-    }
-    return ret;
-}
-
 static void pshader_hw_bem(const struct wined3d_shader_instruction *ins)
 {
     const struct wined3d_shader_dst_param *dst = &ins->dst[0];




More information about the wine-cvs mailing list