Fixed NRM in arb1 profile. trunk
authorRyan C. Gordon <icculus@icculus.org>
Sun, 25 May 2008 22:41:41 -0400
branchtrunk
changeset 327 394d89b5acce
parent 326 348ca33afeb0
child 328 6ea15911de70
Fixed NRM in arb1 profile. Compliments of example code in GL_ARB_vertex_program spec, issue 67.
mojoshader.c
--- a/mojoshader.c	Sun May 25 19:59:41 2008 -0400
+++ b/mojoshader.c	Sun May 25 22:41:41 2008 -0400
@@ -3741,12 +3741,10 @@
 {
     const char *dst0 = make_ARB1_destarg_string(ctx);
     const char *src0 = make_ARB1_srcarg_string(ctx, 0);
-    output_line(ctx, "MUL scratch, %s, %s", src0, src0);
-    output_line(ctx, "ADD scratch2.x, scratch.x, scratch.y");
-    output_line(ctx, "ADD scratch2.x, scratch2.x, scratch.z");
-    output_line(ctx, "RSQ%s, scratch2.x", dst0);
+    output_line(ctx, "DP3 scratch.w, %s, %s", src0, src0);
+    output_line(ctx, "RSQ scratch.w, scratch.w");
+    output_line(ctx, "MUL%s, scratch.w, %s", dst0, src0);
     ctx->flags = (ContextFlags) (ctx->flags | CTX_FLAGS_ARB1_USES_SCRATCH1);
-    ctx->flags = (ContextFlags) (ctx->flags | CTX_FLAGS_ARB1_USES_SCRATCH2);
 } // emit_ARB1_NRM
 
 static void emit_ARB1_SINCOS(Context *ctx)