sampling from a non-existing texture

Hi

I have a shader in which i use the texture() function to lookup from a non-existing sampler. I expected that I should get errors from complingmy shader. But it compiles clean.


static const char render_fs[] =
        "#version 430 core
"
        "
"
        "layout (location = 0) out vec4 color;
"
        "
"
        "uniform sampler2D output_image;
"
        "
"
        "void main(void)
"
        "{
"
        "    color = texture(output_image1, vec2(gl_FragCoord.xy) / vec2(textureSize(output_image, 0)));
"
		" if(color.r  < 0.0) {color=vec4(1.0,0.0,0.0,1.0);} else{color=vec4(0.0,1.0,0.0,0.0);}
"
        "}
";

Note: I am sampling from output_image1 instead of output_image.output_image1 is an intentional typo.

Also, if it compiles and links cleanly, I would have expected it to go to the else part of the test color.r < 0.0 , since color would be undefined. (Really, I should be getting an error since how on earth can you be trying to access .r from an undefined color. Or am i returning some default value if the texture being sampled is undefined/errornous??)

It appears that I get a white color render instead of erroring out or a green screen ( color assigned from the else part).

On Radeon 7870 with Catalyst 13.4

ERROR: 0:9: error(#143) Undeclared identifier: output_image1
ERROR: 0:9: error(#202) No matching overloaded function found: texture
WARNING: 0:9: warning(#402) Implicit truncation of vector from size: 1 to size: 4
ERROR: error(#273) 2 compilation errors.  No code generate