I want to use highp precision for float in shader in web. But if I set the following code:
#ifdef GL_ES
precision highp float;
#endif
varying mediump vec2 var_texcoord0;
varying lowp vec4 var_color;
Then the following error appears:
/materials/gui_gradient.fp _generated_b7060373.fpc:\Users\user\AppData\Local\Temp_generated_b7060373.fpc650248135771408284.glsl ERROR: C:\Users\user\AppData\Local\Temp_generated_b7 060373.fpc650248135771408284.glsl:23: ‘_DMENGINE_GENERATED_gl_FragColor_0’ : undeclared identifier ERROR: C:\Users\user\AppData\Local\Temp_generated_b7060373.fpc650248135771408284.glsl:23: ‘’ : compilation terminated
ERROR: 2 compilation errors. No code generated.
SPIR-V is not generated for failed compile or link
I have to release the code below:
varying mediump vec2 var_texcoord0;
varying lowp vec4 var_color;
#ifdef GL_ES
precision highp float;
#endif
And then the project compiles. But when I run it, I get the following error:
Error: ERROR: 0:3: '' : No precision specified for (float)
I couldn’t overcome this error. What am I doing wrong?
full shader code:
varying mediump vec2 var_texcoord0;
varying lowp vec4 var_color;
#ifdef GL_ES
precision highp float;
#endif
uniform lowp vec4 color_1;
uniform lowp vec4 color_2;
uniform lowp sampler2D texture_sampler;
void main()
{
vec4 color = mix(color_2, color_1, smoothstep(0.0, 1.0, var_texcoord0.y));
gl_FragColor = color * var_color;
}