Sign in to follow this  
Kazade

GLSL Sampler Problem

Recommended Posts

Hey, I'm just learning about vertex and fragment shaders using glsl, and i've come across an error when compiling a shader and I cant figure out what it means. This is what my log is printing... Link successful. The GLSL vertex shader will run in hardware. The GLSL fragment shader will run in hardware. Validation failed - samplers of different types are bound to the same texture image unit. Yet i am setting different texture units like this...

	GLuint loc = gBufferFill->GetUniformLocation("diffuseTex");
	gBufferFill->SendUniform(loc, 0);

	loc = gBufferFill->GetUniformLocation("normalMap");
	gBufferFill->SendUniform(loc, 1);

	loc = gBufferFill->GetUniformLocation("normalisationCubeMap");
	gBufferFill->SendUniform(loc, 2);
This is probably a really simple question, but i cant find any information on the error im getting. Cheers. Luke.

Share this post


Link to post
Share on other sites
no idea, though try it without the normalisation cubemap.
youll get better quality on all cards + on quite a few cards itll be faster (and the % of cards itll be faster on will only go up )

Share this post


Link to post
Share on other sites
Quote:
Original post by Kazade
Hey,

I'm just learning about vertex and fragment shaders using glsl, and i've come across an error when compiling a shader and I cant figure out what it means. This is what my log is printing...

Link successful. The GLSL vertex shader will run in hardware. The GLSL fragment shader will run in hardware. Validation failed - samplers of different types are bound to the same texture image unit.

Yet i am setting different texture units like this...



GLuint loc = gBufferFill->GetUniformLocation("diffuseTex");
gBufferFill->SendUniform(loc, 0);

loc = gBufferFill->GetUniformLocation("normalMap");
gBufferFill->SendUniform(loc, 1);

loc = gBufferFill->GetUniformLocation("normalisationCubeMap");
gBufferFill->SendUniform(loc, 2);


This is probably a really simple question, but i cant find any information on the error im getting.


When do you validate the shader program, before or after that code?

The validate message depends on the current over all state of the shader program and the OpenGL pipeline.

When you link a shader all uniform data defaults to zero, this includes samplers, as such when you validate the driver looks at your shader and see all the uniforms pointing at the same shader unit BUT being different types, thus it throws that error back at you.

If you setup the uniforms and THEN validate it should validate just fine.

Share this post


Link to post
Share on other sites
OK I removed the normalisation cube map from the shader and it compiled and validated fine. Isnt it slower to normalise the vectors everytime? On a slightly related question i'm now having trouble using texture rectangles in my shader. My Radeon 9550 says it supports GL_EXT_texture_rectangle, yet when I use samplerRect in my shader it says its a syntax error.

I cant find any information anywhere on any of this stuff, the only information I have is from "More OpenGL Game Programming" but that doesnt help as most of the examples are for nVidia.

Luke.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this