Getting shader errors in console, but shader runs without problems?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ggez

I applied an outline shader to my object (2D game) and I get some errors in the console. The shader runs without problems though.

Here is a pic of the console:

Here is the shader code:

shader_type canvas_item;
 
uniform float width;
uniform vec4 outline_color : hint_color;
 
void fragment()
{
    vec2 size = (vec2(width) * TEXTURE_PIXEL_SIZE);
   
    vec4 sprite_color = texture(TEXTURE, UV);
   
    float alpha = sprite_color.a;
    alpha += texture(TEXTURE, UV + vec2(0.0, -size.y)).a;
    alpha += texture(TEXTURE, UV + vec2(size.x, -size.y)).a;
    alpha += texture(TEXTURE, UV + vec2(size.x, 0.0)).a;
    alpha += texture(TEXTURE, UV + vec2(size.x, size.y)).a;
    alpha += texture(TEXTURE, UV + vec2(0.0, size.y)).a;
    alpha += texture(TEXTURE, UV + vec2(-size.x, size.y)).a;
    alpha += texture(TEXTURE, UV + vec2(-size.x, 0.0)).a;
    alpha += texture(TEXTURE, UV + vec2(-size.x, -size.y)).a;
   
    vec3 final_color = mix(outline_color.rgb, sprite_color.rgb, sprite_color.a);
    COLOR = vec4(final_color, clamp(alpha, 0.0, 1.0));
}

I use GLES2. Godot 3.2.3
I’m not sure if I should ignore these errors or somehow fix them.

Error message 1:

E 0:00:00.580   get_current_version: Condition "!cc" is true. Returned: __null
  <C++-Quellcode>drivers/gles2/shader_gles2.cpp:221 @ get_current_version()

Error message 2:

E 0:00:00.582   bind: Condition "!version" is true. Returned: false
  <C++-Quellcode>drivers/gles2/shader_gles2.cpp:89 @ bind()

Error message 3-8:

E 0:00:00.596   _get_uniform: Condition "!version" is true. Returned: -1
  <C++-Quellcode>drivers/gles2/shader_gles2.h:267 @ _get_uniform()
:bust_in_silhouette: Reply From: ggez

I think I solved it, I guess? Not exactly sure.
Anyways, I replaced

uniform float width;
uniform vec4 outline_color : hint_color;

with

const float width = 40.0;
const vec4 outline_color = vec4(1.0, 0.0, 0.0, 1.0);

and the errors went away. Now I can’t set the values in the inspector. But atleast it works.
If anyone could identify what caused the problem, that would be good.

I also have this problem, I have no idea how I can fix it.

SynthED | 2022-11-22 18:05