Removed 'f' from floating point constants in GLSL profile. trunk
authorRyan C. Gordon <icculus@icculus.org>
Wed, 16 Apr 2008 18:01:16 -0400
branchtrunk
changeset 131 35a1f5c98d95
parent 130 e2eeb1f1c902
child 132 771666af0fa6
Removed 'f' from floating point constants in GLSL profile. Apparently these ARE allowed, but only in "#version 120" mode...for now, they probably work identically except in GLSL's parser, so just don't emit them.
mojoshader.c
--- a/mojoshader.c	Wed Apr 16 17:58:11 2008 -0400
+++ b/mojoshader.c	Wed Apr 16 18:01:16 2008 -0400
@@ -1677,18 +1677,18 @@
             break;
 
         case SRCMOD_COMPLEMENT:
-            premod_str = "(1.0f - (";
+            premod_str = "(1.0 - (";
             postmod_str = "))";
             break;
 
         case SRCMOD_X2NEGATE:
             premod_str = "-(";
-            postmod_str = " * 2.0f)";
+            postmod_str = " * 2.0)";
             break;
 
         case SRCMOD_X2:
             premod_str = "(";
-            postmod_str = " * 2.0f)";
+            postmod_str = " * 2.0)";
             break;
 
         case SRCMOD_DZ:
@@ -2076,7 +2076,7 @@
 static void emit_GLSL_RCP(Context *ctx)
 {
     const char *src0 = make_GLSL_sourcearg_string(ctx, 0);
-    const char *code = make_GLSL_destarg_assign(ctx, 0, "1.0f / %s", src0);
+    const char *code = make_GLSL_destarg_assign(ctx, 0, "1.0 / %s", src0);
     output_line(ctx, "%s", code);
 } // emit_GLSL_RCP
 
@@ -2164,10 +2164,10 @@
     output_line(ctx, "const 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.0f, 0.0f, 0.0f, 1.0f)");
-    output_line(ctx,   "if (src.x > 0.0f) {"); ctx->indent++;
+    output_line(ctx,   "vec4 retval(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.0f) {"); ctx->indent++;
+    output_line(ctx,     "if (src.y > 0.0) {"); ctx->indent++;
     output_line(ctx,       "retval.z = pow(src.y, power);"); ctx->indent--;
     output_line(ctx,     "}"); ctx->indent--;
     output_line(ctx,   "}");
@@ -2195,7 +2195,7 @@
     push_output(ctx, &ctx->helpers);
     output_line(ctx, "const vec4 DST(const vec4 src0, const vec4 src1)");
     output_line(ctx, "{"); ctx->indent++;
-    output_line(ctx,   "return vec4(1.0f, src0.y * src1.y, src0.z, src1.w);"); ctx->indent--;
+    output_line(ctx,   "return vec4(1.0, src0.y * src1.y, src0.z, src1.w);"); ctx->indent--;
     output_line(ctx, "}");
     output_blank_line(ctx);
     pop_output(ctx);
@@ -2724,7 +2724,7 @@
 
 static void emit_GLSL_CMP(Context *ctx)
 {
-    emit_GLSL_comparison_operations(ctx, ">= 0.0f");
+    emit_GLSL_comparison_operations(ctx, ">= 0.0");
 } // emit_GLSL_CMP
 
 static void emit_GLSL_BEM(Context *ctx)