Matteo Bruni : wined3d: Remove rcp special handling of 0 from the ARB shader backend.

Alexandre Julliard julliard at winehq.org
Thu Apr 28 12:18:55 CDT 2011


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

Author: Matteo Bruni <mbruni at codeweavers.com>
Date:   Thu Apr 21 18:51:31 2011 +0200

wined3d: Remove rcp special handling of 0 from the ARB shader backend.

---

 dlls/wined3d/arb_program_shader.c |   21 +--------------------
 dlls/wined3d/shader.c             |    1 -
 dlls/wined3d/wined3d_private.h    |    3 +--
 3 files changed, 2 insertions(+), 23 deletions(-)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 2b5b4a0..7d1a3f7 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -340,7 +340,6 @@ static BOOL need_helper_const(const struct arb_vshader_private *shader_data,
     if (gl_info->quirks & WINED3D_QUIRK_SET_TEXCOORD_W) return TRUE; /* Have to init texcoords. */
     if (!use_nv_clip(gl_info)) return TRUE; /* Init the clip texcoord */
     if (reg_maps->usesnrm) return TRUE; /* 0.0 */
-    if (reg_maps->usesrcp) return TRUE; /* EPS */
     return FALSE;
 }
 
@@ -2424,8 +2423,6 @@ static void shader_hw_mnxn(const struct wined3d_shader_instruction *ins)
 static void shader_hw_rcp(const struct wined3d_shader_instruction *ins)
 {
     struct wined3d_shader_buffer *buffer = ins->ctx->buffer;
-    struct shader_arb_ctx_priv *priv = ins->ctx->backend_data;
-    const char *flt_eps = arb_get_helper_value(ins->ctx->reg_maps->shader_version.type, ARB_EPS);
 
     char dst[50];
     char src[50];
@@ -2440,23 +2437,7 @@ static void shader_hw_rcp(const struct wined3d_shader_instruction *ins)
         strcat(src, ".w");
     }
 
-    /* TODO: If the destination is readable, and not the same as the source, the destination
-     * can be used instead of TA
-     */
-    if (priv->target_version >= NV2)
-    {
-        shader_addline(buffer, "MOVC TA.x, %s;\n", src);
-        shader_addline(buffer, "MOV TA.x (EQ.x), %s;\n", flt_eps);
-        shader_addline(buffer, "RCP%s %s, TA.x;\n", shader_arb_get_modifier(ins), dst);
-    }
-    else
-    {
-        const char *zero = arb_get_helper_value(ins->ctx->reg_maps->shader_version.type, ARB_ZERO);
-        shader_addline(buffer, "ABS TA.x, %s;\n", src);
-        shader_addline(buffer, "SGE TA.y, -TA.x, %s;\n", zero);
-        shader_addline(buffer, "MAD TA.x, TA.y, %s, %s;\n", flt_eps, src);
-        shader_addline(buffer, "RCP%s %s, TA.x;\n", shader_arb_get_modifier(ins), dst);
-    }
+    shader_addline(buffer, "RCP%s %s, %s;\n", shader_arb_get_modifier(ins), dst, src);
 }
 
 static void shader_hw_scalar_op(const struct wined3d_shader_instruction *ins)
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index e2c2dce..464fa9a 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -788,7 +788,6 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
             else if (ins.handler_idx == WINED3DSIH_MOVA) reg_maps->usesmova = 1;
             else if (ins.handler_idx == WINED3DSIH_IFC) reg_maps->usesifc = 1;
             else if (ins.handler_idx == WINED3DSIH_CALL) reg_maps->usescall = 1;
-            else if (ins.handler_idx == WINED3DSIH_RCP) reg_maps->usesrcp = 1;
 
             limit = ins.src_count + (ins.predicate ? 1 : 0);
             for (i = 0; i < limit; ++i)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index c4509f0..288c2db 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -559,8 +559,7 @@ struct wined3d_shader_reg_maps
     WORD usestexldl     : 1;
     WORD usesifc        : 1;
     WORD usescall       : 1;
-    WORD usesrcp        : 1;
-    WORD padding        : 3;
+    WORD padding        : 4;
 
     /* Whether or not loops are used in this shader, and nesting depth */
     unsigned loop_depth;




More information about the wine-cvs mailing list