profiles/mojoshader_profile_glsl.c
changeset 1216 9d725de6c61c
parent 1215 8e9fb483f4d4
child 1221 012dec2787aa
--- a/profiles/mojoshader_profile_glsl.c	Tue Oct 29 16:31:56 2019 -0400
+++ b/profiles/mojoshader_profile_glsl.c	Wed Oct 30 00:29:02 2019 -0400
@@ -955,10 +955,28 @@
                     if (support_glsles(ctx))
                         break; // GLSL ES does not have gl_FogFragCoord
 #endif
-                    if (index == 0)
+#if SUPPORT_PROFILE_GLSLES
+                    const int skipFogFragCoord = support_glsles(ctx) || (index > 0);
+#else
+                    const int skipFogFragCoord = (index > 0);
+#endif
+                    if (!skipFogFragCoord)
                     {
                         usage_str = "gl_FogFragCoord";
                     } // if
+                    else
+                    {
+                        push_output(ctx, &ctx->globals);
+#if SUPPORT_PROFILE_GLSLES
+                        if (support_glsles(ctx))
+                            output_line(ctx, "varying highp float io_%i_%i;", usage, index);
+                        else
+#endif
+                        output_line(ctx, "varying float io_%i_%i;", usage, index);
+                        output_line(ctx, "#define %s io_%i_%i", var, usage, index);
+                        pop_output(ctx);
+                        return;
+                    }
                     break;
                 case MOJOSHADER_USAGE_TEXCOORD:
 #if SUPPORT_PROFILE_GLSLES