Fixed DEF and DEFI output in GLSL profile. trunk
authorRyan C. Gordon <icculus@icculus.org>
Wed, 16 Apr 2008 17:53:41 -0400
branchtrunk
changeset 129 272d51a25a21
parent 128 d87a5548ee21
child 130 e2eeb1f1c902
Fixed DEF and DEFI output in GLSL profile. Apparently you can't do "1.0f" for float constants, just "1.0" ... at least, that's what Apple's GLSL compiler thinks, and you have to do an assignment instead of a direct constructor.
mojoshader.c
--- a/mojoshader.c	Wed Apr 16 17:43:10 2008 -0400
+++ b/mojoshader.c	Wed Apr 16 17:53:41 2008 -0400
@@ -2537,7 +2537,7 @@
     const char *varname = get_GLSL_destarg_varname(ctx, 0);
     const int32 *x = (const int32 *) ctx->dwords;
     push_output(ctx, &ctx->globals);
-    output_line(ctx, "const ivec4 %s(%d, %d, %d, %d);",
+    output_line(ctx, "const ivec4 %s = ivec4(%d, %d, %d, %d);",
                 varname, (int) x[0], (int) x[1], (int) x[2], (int) x[3]);
     pop_output(ctx);
 } // emit_GLSL_DEFI
@@ -2687,7 +2687,7 @@
     floatstr(ctx, val3, sizeof (val3), val[3], 1);
 
     push_output(ctx, &ctx->globals);
-    output_line(ctx, "const vec4 %s(%sf, %sf, %sf, %sf);",
+    output_line(ctx, "const vec4 %s = vec4(%s, %s, %s, %s);",
                 varname, val0, val1, val2, val3);
     pop_output(ctx);
 } // emit_GLSL_DEF