• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Shaders Why does GMS2 leave the shader code exposed in the final export?

If I have an empty project with a simple shader:
Code:
//
// Simple passthrough fragment shader
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;

void main()
{
    float two = 2.;
    gl_FragColor = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord ) * two;
}
And I then compile it to a zip - I get a folder with the game.exe file and a data.win file. Now if I right-click and edit the data.win file in notepad I can find the following completely exposed:
Code:
precision mediump float;
#define LOWPREC lowp
// Uniforms look like they're shared between vertex and fragment shaders in GLSL, so we have to be careful to avoid name clashes

uniform sampler2D gm_BaseTexture;

uniform bool gm_PS_FogEnabled;
uniform vec4 gm_FogColour;
uniform bool gm_AlphaTestEnabled;
uniform float gm_AlphaRefValue;

void DoAlphaTest(vec4 SrcColour)
{
    if (gm_AlphaTestEnabled)
    {
        if (SrcColour.a <= gm_AlphaRefValue)
        {
            discard;
        }
    }
}

void DoFog(inout vec4 SrcColour, float fogval)
{
    if (gm_PS_FogEnabled)
    {
        SrcColour = mix(SrcColour, gm_FogColour, clamp(fogval, 0.0, 1.0));
    }
}

#define _YY_GLSLES_ 1
//
// Simple passthrough fragment shader
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;

void main()
{
    float two = 2.;
    gl_FragColor = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord ) * two;
}
Can someone explain to me YYG's reasons for leaving the shader code so easily accessible like this?
 
Oh, btw, I may have a solution to this problem writing a c++ extension. I simply don't understand the reasoning behind leaving it so easily exposed like this esp. since strings used to generate shader byte code are easily concealed within directx applications.
 
Top