Is it possible to define default shader values using desktop gl.

Too say in the ogl version is it possible in the shader to define.

float SomeValue = 1.0f;

then later in code overide it via


This seems to work for dx but not on gl.
Or i dont know the keyword to allow it ?

Mojoshader doesn’t deal with it.

Technically GLSL allows it, but it’s link-time and a link error is optional if the initializer values are mismatched (ie. only Intel will raise the link error).

If gpu_shader4 or greater is active on the context then defaults are not possible and all values must come from legacy wrappers of the old uniform API or via uniform buffer objects.

Edit: GL_ARB_gpu_shaderX trumps anything defined by GL_ARB_vertex_program or GL_ARB_fragment_program

Yeah, MG could handle this by just setting the values when loading the effect, but our parser is currently not good enough to handle it and we can’t get initializer values through reflection.