Paul Gofman : d3dx9: Add 'atan2' preshader opcode.

Alexandre Julliard julliard at winehq.org
Mon May 22 15:54:04 CDT 2017


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

Author: Paul Gofman <gofmanp at gmail.com>
Date:   Fri May 19 14:56:36 2017 +0300

d3dx9: Add 'atan2' preshader opcode.

Signed-off-by: Paul Gofman <gofmanp at gmail.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3dx9_36/preshader.c    | 3 +++
 dlls/d3dx9_36/tests/effect.c | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/dlls/d3dx9_36/preshader.c b/dlls/d3dx9_36/preshader.c
index 72f6ff5..7940e2f 100644
--- a/dlls/d3dx9_36/preshader.c
+++ b/dlls/d3dx9_36/preshader.c
@@ -46,6 +46,7 @@ enum pres_ops
     PRESHADER_OP_GE,
     PRESHADER_OP_ADD,
     PRESHADER_OP_MUL,
+    PRESHADER_OP_ATAN2,
     PRESHADER_OP_CMP,
     PRESHADER_OP_DOT,
     PRESHADER_OP_DOTSWIZ6,
@@ -131,6 +132,7 @@ static double pres_log(double *args, int n)
 static double pres_asin(double *args, int n) {return to_signed_nan(asin(args[0]));}
 static double pres_acos(double *args, int n) {return to_signed_nan(acos(args[0]));}
 static double pres_atan(double *args, int n) {return atan(args[0]);}
+static double pres_atan2(double *args, int n) {return atan2(args[0], args[1]);}
 
 #define PRES_OPCODE_MASK 0x7ff00000
 #define PRES_OPCODE_SHIFT 20
@@ -173,6 +175,7 @@ static const struct op_info pres_op_info[] =
     {0x203, "ge",  2, 0, pres_ge }, /* PRESHADER_OP_GE  */
     {0x204, "add", 2, 0, pres_add}, /* PRESHADER_OP_ADD */
     {0x205, "mul", 2, 0, pres_mul}, /* PRESHADER_OP_MUL */
+    {0x206, "atan2", 2, 0, pres_atan2}, /* PRESHADER_OP_ATAN2 */
     {0x300, "cmp", 3, 0, pres_cmp}, /* PRESHADER_OP_CMP */
     {0x500, "dot", 2, 1, pres_dot}, /* PRESHADER_OP_DOT */
     {0x70e, "d3ds_dotswiz", 6, 0, pres_dotswiz6}, /* PRESHADER_OP_DOTSWIZ6 */
diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c
index ffdb1dd..0fa8821 100644
--- a/dlls/d3dx9_36/tests/effect.c
+++ b/dlls/d3dx9_36/tests/effect.c
@@ -4562,6 +4562,10 @@ static void test_effect_preshader_ops(IDirect3DDevice9 *device)
                 {-0.3f, 4.0f, -2.2f, 3.402823466e+38f}, {1.0f, 2.0f, -3.0f, 4.0f}},
         {"atan", 0x10c00001, 1, {0xbe9539d4, 0x3fa9b465, 0xbf927420, 0x3fc90fdb},
                 {-0.3f, 4.0f, -2.2f, 3.402823466e+38f}, {1.0f, 2.0f, -3.0f, 4.0f}},
+        {"atan2 test #1", 0x20600004, 2, {0xbfc90fdb, 0x40490fdb, 0x80000000, 0x7fc00000},
+                {-0.3f, 0.0f, -0.0f, NAN}, {0.0f, -0.0f, 0.0f, 1.0f}},
+        {"atan2 test #2", 0x20600004, 2, {0xbfc90fdb, 0, 0xc0490fdb, 0},
+                {-0.3f, 0.0f, -0.0f, -0.0f}, {-0.0f, 0.0f, -0.0f, 1.0f}},
         {"0 * INF", 0x20500004, 2, {0xffc00000, 0xffc00000, 0xc0d33334, 0x7f800000},
                 {0.0f, -0.0f, -2.2f, 3.402823466e+38f}, {INFINITY, INFINITY, 3.0f, 4.0f}},
     };




More information about the wine-cvs mailing list