PDA

View Full Version : AMD: Misleading error message



Groovounet
02-21-2011, 10:22 AM
Hi,

On the following scenario, the compiler return the error:
Cannot convert from 'const float' to 'out highp 4-component vector of float' which isn't at all what's happening.



layout(location = FRAG_COLOR, index = 0) out vec4 FragColor;

vec4 test(in sampler2D Sampler, in vec2 Texcoord, in int Lod);

float Lod = textureQueryLod(Diffuse, Vert.Texcoord).x;
FragColor = test(Diffuse, Vert.Texcoord, Lod);

The following code fix this error:



layout(location = FRAG_COLOR, index = 0) out vec4 FragColor;

vec4 test(in sampler2D Sampler, in vec2 Texcoord, in int Lod);

int Lod = int(textureQueryLod(Diffuse, Vert.Texcoord).x);
FragColor = test(Diffuse, Vert.Texcoord, Lod);

frank li
02-21-2011, 07:35 PM
I think you miss another error message like
[parser] error(#202) No matching overloaded function found test.
It means the compiler can't find the prototype of the function "test".

For undefined function call, the default return value may be float, so the driver reports that "convert from float to vec4". We could improve the message for better understanding. Thanks for your reminder.

Groovounet
02-22-2011, 03:25 AM
Hi Frank,

In my actual case "test" has a body I just didn't bother to include it.

I really think that compiler errors is a really important topic that should not be underestimated as the duty of figuring out build error isn't one of the programmer but the compiler and still it takes too much time to figure out what's going on, especially compare to C++ error messages and despite that GLSL is so much simpler than C++.