Added real SRCMOD_ABS/SRCMOD_ABSNEGATE support in nv2 profile. trunk
authorRyan C. Gordon <icculus@icculus.org>
Wed, 18 Jun 2008 11:04:19 -0400
branchtrunk
changeset 364 8ab0ad5544ea
parent 363 bea8bf9e5536
child 365 58736fc92e57
Added real SRCMOD_ABS/SRCMOD_ABSNEGATE support in nv2 profile.
mojoshader.c
--- a/mojoshader.c	Wed Jun 18 01:24:47 2008 -0400
+++ b/mojoshader.c	Wed Jun 18 11:04:19 2008 -0400
@@ -3424,14 +3424,22 @@
             premod_str = "-";
             // fall through.
         case SRCMOD_ABS:
-            regtype_str = allocate_ARB1_scratch_reg_name(ctx);
-            regnum_str[0] = '\0'; // move value to scratch register.
-            rel_lbracket = "";   // scratch register won't use array.
-            rel_rbracket = "";
-            rel_offset[0] = '\0';
-            rel_swizzle[0] = '\0';
-            rel_regtype_str = "";
-            output_line(ctx, "ABS %s, %s;", regtype_str, buf);
+            if (ctx->support_nv2)  // GL_NV_vertex_program2_option adds this.
+            {
+                premod_str = (arg->src_mod == SRCMOD_ABSNEGATE) ? "-|" : "|";
+                postmod_str = "|";
+            } // if
+            else
+            {
+                regtype_str = allocate_ARB1_scratch_reg_name(ctx);
+                regnum_str[0] = '\0'; // move value to scratch register.
+                rel_lbracket = "";   // scratch register won't use array.
+                rel_rbracket = "";
+                rel_offset[0] = '\0';
+                rel_swizzle[0] = '\0';
+                rel_regtype_str = "";
+                output_line(ctx, "ABS %s, %s;", regtype_str, buf);
+            } // else
             break;
 
         case SRCMOD_NOT: