Stefan Dösinger : wined3d: Pass the instr to pshader_gen_output_modifier_line.

Alexandre Julliard julliard at winehq.org
Fri May 8 08:06:26 CDT 2009


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Thu May  7 17:53:54 2009 +0200

wined3d: Pass the instr to pshader_gen_output_modifier_line.

---

 dlls/wined3d/arb_program_shader.c |   44 +++++++++++++++++++++---------------
 1 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index fd9af76..5e45fe2 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -798,9 +798,26 @@ static void pshader_gen_input_modifier_line(IWineD3DBaseShader *iface, SHADER_BU
         sprintf(outregstr, "T%c%s", 'A' + tmpreg, swzstr);
 }
 
-static inline void pshader_gen_output_modifier_line(SHADER_BUFFER *buffer, int saturate, const char *write_mask,
-        int shift, const char *regstr)
+static inline void pshader_gen_output_modifier_line(const struct wined3d_shader_instruction *ins)
 {
+    BOOL saturate;
+    DWORD shift;
+    char write_mask[20], regstr[50];
+    SHADER_BUFFER *buffer = ins->ctx->buffer;
+    BOOL is_color = FALSE;
+    const struct wined3d_shader_dst_param *dst;
+
+    if (!ins->dst_count) return;
+
+    dst = &ins->dst[0];
+    shift = dst->shift;
+    if(shift == 0) return; /* Saturate alone is handled by the instructions */
+    saturate = dst->modifiers & WINED3DSPDM_SATURATE;
+
+    shader_arb_get_write_mask(ins, dst, write_mask);
+    shader_arb_get_register_name(ins->ctx->shader, dst->reg.type,
+                                 dst->reg.idx, !!dst->reg.rel_addr, regstr, &is_color);
+
     /* Generate a line that does the output modifier computation */
     shader_addline(buffer, "MUL%s %s%s, %s, %s;\n", saturate ? "_SAT" : "",
         regstr, write_mask, regstr, shift_tab[shift]);
@@ -857,7 +874,6 @@ static void pshader_hw_cnd(const struct wined3d_shader_instruction *ins)
     char dst_name[50];
     char src_name[3][50];
     BOOL sat = dst->modifiers & WINED3DSPDM_SATURATE;
-    DWORD shift = dst->shift;
     BOOL is_color;
     DWORD shader_version = WINED3D_SHADER_VERSION(ins->ctx->reg_maps->shader_version.major,
             ins->ctx->reg_maps->shader_version.minor);
@@ -883,8 +899,8 @@ static void pshader_hw_cnd(const struct wined3d_shader_instruction *ins)
         shader_addline(buffer, "CMP%s %s%s, TMP, %s, %s;\n",
                                 sat ? "_SAT" : "", dst_name, dst_wmask, src_name[1], src_name[2]);
     }
-    if (shift != 0)
-        pshader_gen_output_modifier_line(buffer, FALSE, dst_wmask, shift, dst_name);
+
+    pshader_gen_output_modifier_line(ins);
 }
 
 static void pshader_hw_cmp(const struct wined3d_shader_instruction *ins)
@@ -894,7 +910,6 @@ static void pshader_hw_cmp(const struct wined3d_shader_instruction *ins)
     char dst_wmask[20];
     char dst_name[50];
     char src_name[3][50];
-    DWORD shift = dst->shift;
     BOOL sat = dst->modifiers & WINED3DSPDM_SATURATE;
     BOOL is_color;
 
@@ -913,8 +928,7 @@ static void pshader_hw_cmp(const struct wined3d_shader_instruction *ins)
     shader_addline(buffer, "CMP%s %s%s, %s, %s, %s;\n", sat ? "_SAT" : "", dst_name, dst_wmask,
                    src_name[0], src_name[2], src_name[1]);
 
-    if (shift != 0)
-        pshader_gen_output_modifier_line(buffer, FALSE, dst_wmask, shift, dst_name);
+    pshader_gen_output_modifier_line(ins);
 }
 
 /** Process the WINED3DSIO_DP2ADD instruction in ARB.
@@ -926,7 +940,6 @@ static void pshader_hw_dp2add(const struct wined3d_shader_instruction *ins)
     char dst_wmask[20];
     char dst_name[50];
     char src_name[3][50];
-    DWORD shift = dst->shift;
     BOOL sat = dst->modifiers & WINED3DSPDM_SATURATE;
     BOOL is_color;
 
@@ -944,8 +957,7 @@ static void pshader_hw_dp2add(const struct wined3d_shader_instruction *ins)
     shader_addline(buffer, "DP3 TMP2, TMP, %s;\n", src_name[1]);
     shader_addline(buffer, "ADD%s %s%s, TMP2, %s;\n", sat ? "_SAT" : "", dst_name, dst_wmask, src_name[2]);
 
-    if (shift != 0)
-        pshader_gen_output_modifier_line(buffer, FALSE, dst_wmask, shift, dst_name);
+    pshader_gen_output_modifier_line(ins);
 }
 
 /* Map the opcode 1-to-1 to the GL code */
@@ -1048,7 +1060,7 @@ static void shader_hw_map2gl(const struct wined3d_shader_instruction *ins)
         shader_addline(buffer, "%s%s %s;\n", instruction, modifier, arguments);
 
         /* A shift requires another line. */
-        if (shift) pshader_gen_output_modifier_line(buffer, saturate, output_wmask, shift, output_rname);
+        pshader_gen_output_modifier_line(ins);
     } else {
         /* Note that shader_arb_add_*_param() adds spaces. */
 
@@ -1687,7 +1699,6 @@ static void shader_hw_nrm(const struct wined3d_shader_instruction *ins)
     char dst_name[50];
     char src_name[50];
     char dst_wmask[20];
-    DWORD shift = dst->shift;
     BOOL sat = dst->modifiers & WINED3DSPDM_SATURATE;
     BOOL is_color;
 
@@ -1702,8 +1713,7 @@ static void shader_hw_nrm(const struct wined3d_shader_instruction *ins)
     shader_addline(buffer, "MUL%s %s%s, %s, TMP;\n", sat ? "_SAT" : "", dst_name, dst_wmask,
                    src_name);
 
-    if (shift != 0)
-        pshader_gen_output_modifier_line(buffer, FALSE, dst_wmask, shift, dst_name);
+    pshader_gen_output_modifier_line(ins);
 }
 
 static void shader_hw_sincos(const struct wined3d_shader_instruction *ins)
@@ -1717,7 +1727,6 @@ static void shader_hw_sincos(const struct wined3d_shader_instruction *ins)
     char dst_name[50];
     char src_name[50];
     char dst_wmask[20];
-    DWORD shift = dst->shift;
     BOOL sat = dst->modifiers & WINED3DSPDM_SATURATE;
     BOOL is_color;
 
@@ -1729,8 +1738,7 @@ static void shader_hw_sincos(const struct wined3d_shader_instruction *ins)
     shader_addline(buffer, "SCS%s %s%s, %s;\n", sat ? "_SAT" : "", dst_name, dst_wmask,
                    src_name);
 
-    if (shift != 0)
-        pshader_gen_output_modifier_line(buffer, FALSE, dst_wmask, shift, dst_name);
+    pshader_gen_output_modifier_line(ins);
 
 }
 




More information about the wine-cvs mailing list