PDA

View Full Version : What is wrong with this shader?



henniman
05-14-2011, 01:17 AM
Hi all,

when i try to load this shader, i get "invalid operation"

const GLchar* source =
"
uniform samplerRect TSAMP0;
uniform sampler2D TSAMP1;
void main(void)
{
vec4 c0 = textureRect(TSAMP0,gl_FragCoord.xy);
vec4 c1 = texture2D(TSAMP1,gl_TexCoord[0].xy);
gl_FragColor = c0 * c1;
}
";


the error is not related to any application state / condition, when i load simpler shaders ( without texture uniforms ) everything runs fine. The same code runs fine on windows. I get my problems with Mac OS 10.6.7

Anyone knows what is wrong with this shader?
Is it allowed to mix sampler2D / samplerRect on Mac OS X?

randall
05-14-2011, 05:03 AM
There is no such thing as samplerRect. There is only sampler2DRect. On windows NVIDIA incorrectly accepts samplerRect.

Alfonse Reinheart
05-14-2011, 05:14 AM
when i try to load this shader, i get "invalid operation"

BTW, when you load shaders, the compiler/linker will tell you when you have done something wrong. They have a message log. You don't have to wait until render time to know that a shader is broken.

henniman
05-14-2011, 09:49 AM
There is no such thing as samplerRect. There is only sampler2DRect. On windows NVIDIA incorrectly accepts samplerRect.

perfect! thank you! and i had to use texture2DRect, too.
It is always dangerous to develop under windows and then switch to macos ..

henniman
05-14-2011, 09:51 AM
BTW, when you load shaders, the compiler/linker will tell you when you have done something wrong. They have a message log.

yes, and i am always checking link success - and the shader compiled fine but did not load. ( really strange... )