mojoshader.c
branchtrunk
changeset 407 620d48c5d13a
parent 405 e2cffb40e8b8
child 408 796209598bf9
--- a/mojoshader.c	Sun Jun 29 00:15:52 2008 -0400
+++ b/mojoshader.c	Sun Jun 29 00:16:56 2008 -0400
@@ -421,6 +421,7 @@
     int determined_constants_arrays:1;
     int predicated:1;
     int support_nv2:1;
+    int support_glsl120:1;
     int glsl_generated_lit_opcode:1;
 };
 
@@ -2225,6 +2226,23 @@
         return;
     } // if
 
+    ctx->output = &ctx->globals;
+
+    if (strcmp(profilestr, MOJOSHADER_PROFILE_GLSL) == 0)
+        /* no-op. */ ;
+
+    else if (strcmp(profilestr, MOJOSHADER_PROFILE_GLSL120) == 0)
+    {
+        ctx->support_glsl120 = 1;
+        output_line(ctx, "#version 120");
+    } // else if
+
+    else
+    {
+        failf(ctx, "Profile '%s' unsupported or unknown.", profilestr);
+        return;
+    } // else
+
     ctx->output = &ctx->mainline_intro;
     output_line(ctx, "void main()");
     output_line(ctx, "{");
@@ -4928,6 +4946,7 @@
 // This is for profiles that extend other profiles...
 static const struct { const char *from; const char *to; } profileMap[] =
 {
+    { MOJOSHADER_PROFILE_GLSL120, MOJOSHADER_PROFILE_GLSL },
     { MOJOSHADER_PROFILE_NV2, MOJOSHADER_PROFILE_ARB1 },
 };