Fixed the GLSL LIT opcode.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 13 Apr 2012 02:13:47 -0400
changeset 1079 a9a27872b73c
parent 1078 cbfa46c1fda6
child 1080 b92bdbf78621
Fixed the GLSL LIT opcode. Clearly we never pushed this through a GLSL compiler before. :)
mojoshader.c
--- a/mojoshader.c	Fri Apr 13 00:26:21 2012 -0400
+++ b/mojoshader.c	Fri Apr 13 02:13:47 2012 -0400
@@ -2756,7 +2756,7 @@
 
 static void emit_GLSL_LIT_helper(Context *ctx)
 {
-    const char *maxp = "127.9961f"; // value from the dx9 reference.
+    const char *maxp = "127.9961"; // value from the dx9 reference.
 
     if (ctx->glsl_generated_lit_opcode)
         return;
@@ -2764,10 +2764,10 @@
     ctx->glsl_generated_lit_opcode = 1;
 
     push_output(ctx, &ctx->helpers);
-    output_line(ctx, "const vec4 LIT(const vec4 src)");
+    output_line(ctx, "vec4 LIT(const vec4 src)");
     output_line(ctx, "{"); ctx->indent++;
-    output_line(ctx,   "const float power = clamp(src.w, -%s, %s);",maxp,maxp);
-    output_line(ctx,   "vec4 retval(1.0, 0.0, 0.0, 1.0)");
+    output_line(ctx,   "float power = clamp(src.w, -%s, %s);",maxp,maxp);
+    output_line(ctx,   "vec4 retval = vec4(1.0, 0.0, 0.0, 1.0);");
     output_line(ctx,   "if (src.x > 0.0) {"); ctx->indent++;
     output_line(ctx,     "retval.y = src.x;");
     output_line(ctx,     "if (src.y > 0.0) {"); ctx->indent++;