For example we have a shader:
varying mediump vec2 var_texcoord0;
uniform lowp sampler2D DIFFUSE_TEXTURE;
uniform lowp vec4 tint;
uniform lowp vec4 colorization;
void main()
{
lowp vec4 color1 = texture2D(DIFFUSE_TEXTURE, var_texcoord0.xy);
lowp vec4 color2 = (colorization.xyz*color1.w, color1.w);
lowp vec4 color3 = mix(color1, color2, colorization.w);
// Pre-multiply alpha since all runtime textures already are
lowp vec4 tint_pm = vec4(tint.xyz * tint.w, tint.w);
lowp vec4 color_result = color3 * tint_pm;
gl_FragColor = color_result;
}
On windows game with this shader starts and shader didn’t work.
But on mac it show an error:
WARNING:GRAPHICS: ERROR: 0:10: Incompatible types in initialization (and no available implicit conversion)
The right version of shader is:
varying mediump vec2 var_texcoord0;
uniform lowp sampler2D DIFFUSE_TEXTURE;
uniform lowp vec4 tint;
uniform lowp vec4 colorization;
void main()
{
lowp vec4 color1 = texture2D(DIFFUSE_TEXTURE, var_texcoord0.xy);
lowp vec4 color2 = vec4(colorization.xyz*color1.w, color1.w);
lowp vec4 color3 = mix(color1, color2, colorization.w);
// Pre-multiply alpha since all runtime textures already are
lowp vec4 tint_pm = vec4(tint.xyz * tint.w, tint.w);
lowp vec4 color_result = color3 * tint_pm;
gl_FragColor = color_result;
}
Would be great if windows version of Defold Editor 2 shows the same error like mac version. It will make a shader writing on Windows much easier.
(I am not sure is it editor2 specific issue or not? Should I create an issue for editor2 on github?
maybe this or this ?
)