Page MenuHome

MacOS/AMD glLinkProgram warnings (not errors)
Closed, InvalidPublic

Description

Hi. There seems to be a lot of issues with MacOS AMD drivers.

When running Blender 2.8 with apitrace a lot of the same warnings appear when glLinkProgram is done, but no glErrors are generated.

6013 @0 glLinkProgram(program = 55)
WARNING: Output of vertex shader 'uvcoordsvar' not read by fragment shader

I think the problem is closely related to this:

GLSL shader not working on AMD/ATI, but works on NVIDIA

This is probably happening because you are specifying 3 input values for the shader (in_Position, in_Color and in_TextureCoord) but your vertex data does not always contain all 3. When the vertex attributes do not match this format exactly, you're getting into undefined behavior territory and each implementation can do what it wants.

Program #55 is the first one generating this warning.

//
// VERTEX SHADER: common_fullscreen_vert.glsl
//
in vec2 pos;
in vec2 uvs;
out vec4 uvcoordsvar;

void main()
{
	uvcoordsvar = vec4(uvs, 0.0, 0.0);
	gl_Position = vec4(pos, 1.0, 1.0);
}

//
// FRAGMENT SHADER: workbench_ghost_resolve_frag.glsl
//
uniform sampler2D depthBuffer;

void main(void)
{
	float depth = texelFetch(depthBuffer, ivec2(gl_FragCoord.xy), 0).r;

	/* background, discard */
	if (depth >= 1.0) {
		discard;
	}

	gl_FragDepth = depth;
}

Some more in sequence (if not mentioned, no warning):

#55:
	vs: common_fullscreen_vert.glsl
	fs: workbench_ghost_resolve_frag.glsl
#66:
	vs: common_fullscreen_vert.glsl
	fs: workbench_effect_taa_frag.glsl	
#98:
	vs: common_globals_lib.glsl + common_fullscreen_vert.glsl
	fs: common_globals_lib.glsl + object_outline_detect_frag.glsl
#101: 
	vs: common_globals_lib.glsl + common_fullscreen_vert.glsl
	fs: common_globals_lib.glsl + object_outline_detect_frag.glsl
#104:
	vs: common_fullscreen_vert.glsl
	fs: object_outline_expand_frag.glsl
#149:
	vs: common_fullscreen_vert.glsl
	fs: gpencil_zdepth_mix_frag.glsl	
#152:
	vs: common_fullscreen_vert.glsl
	fs: gpencil_simple_mix_frag.glsl

and a lot more...

Program #66 is related to T55987. (AMD Radeon Pro/R9/RX)

My guess would be that (only?) Apple's AMD glCompileShader removes unused variables, while all other implementations keeps them.

I have little knowledge of GLSL, but if someone has any ideas on how to fix this I could try them out.

Details

Type
Bug

Event Timeline

This is not an error only a warning. As long as shader interface (in and out variables) matches the compilation / linking is ok.
We had to make sure the interface matches for eevee in the past so that's why there is many related warning.