From 77384388c5583148a2826c60219beac560ff343b Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Wed, 30 Oct 2019 00:29:02 -0400 Subject: [PATCH] USAGE_FOG is a float, not a vec4 --- profiles/mojoshader_profile_glsl.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/profiles/mojoshader_profile_glsl.c b/profiles/mojoshader_profile_glsl.c index 9142f0e3..d9336a8d 100644 --- a/profiles/mojoshader_profile_glsl.c +++ b/profiles/mojoshader_profile_glsl.c @@ -955,10 +955,28 @@ void emit_GLSL_attribute(Context *ctx, RegisterType regtype, int regnum, 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