mojoshader.c
changeset 1103 8b7c29c019d5
parent 1102 0af2fb8af7fc
child 1104 9147482e1ec7
--- a/mojoshader.c	Mon Apr 23 02:03:02 2012 -0400
+++ b/mojoshader.c	Sat May 19 01:56:29 2012 -0400
@@ -5664,7 +5664,15 @@
     output_line(ctx, "DP3 %s.y, %s, %s;", dst, src2, src3);
     output_line(ctx, "MUL %s, %s, %s;", tmp, dst, dst);    // normal * normal
     output_line(ctx, "MUL %s, %s, %s;", tmp2, dst, src5);  // normal * eyeray
-    output_line(ctx, "DIV %s, %s, %s;", tmp, tmp, tmp2);
+
+    // !!! FIXME: This is goofy. There's got to be a way to do vector-wide
+    // !!! FIXME:  divides or reciprocals...right?
+    output_line(ctx, "RCP %s.x, %s.x;", tmp2, tmp2);
+    output_line(ctx, "RCP %s.y, %s.y;", tmp2, tmp2);
+    output_line(ctx, "RCP %s.z, %s.z;", tmp2, tmp2);
+    output_line(ctx, "RCP %s.w, %s.w;", tmp2, tmp2);
+    output_line(ctx, "MUL %s, %s, %s;", tmp, tmp, tmp2);
+
     output_line(ctx, "MUL %s, %s, { 2.0, 2.0, 2.0, 2.0 };", tmp, tmp);
     output_line(ctx, "MAD %s, %s, %s, -%s;", tmp, tmp, dst, src5);
     output_line(ctx, "TEX %s, %s, texture[%d], 3D;", dst, tmp, stage);
@@ -5711,7 +5719,15 @@
     output_line(ctx, "DP3 %s.y, %s, %s;", dst, src2, src3);
     output_line(ctx, "MUL %s, %s, %s;", tmp, dst, dst);    // normal * normal
     output_line(ctx, "MUL %s, %s, %s;", tmp2, dst, tmp3);  // normal * eyeray
-    output_line(ctx, "DIV %s, %s, %s;", tmp, tmp, tmp2);
+
+    // !!! FIXME: This is goofy. There's got to be a way to do vector-wide
+    // !!! FIXME:  divides or reciprocals...right?
+    output_line(ctx, "RCP %s.x, %s.x;", tmp2, tmp2);
+    output_line(ctx, "RCP %s.y, %s.y;", tmp2, tmp2);
+    output_line(ctx, "RCP %s.z, %s.z;", tmp2, tmp2);
+    output_line(ctx, "RCP %s.w, %s.w;", tmp2, tmp2);
+    output_line(ctx, "MUL %s, %s, %s;", tmp, tmp, tmp2);
+
     output_line(ctx, "MUL %s, %s, { 2.0, 2.0, 2.0, 2.0 };", tmp, tmp);
     output_line(ctx, "MAD %s, %s, %s, -%s;", tmp, tmp, dst, tmp3);
     output_line(ctx, "TEX %s, %s, texture[%d], 3D;", dst, tmp, stage);