PDA

View Full Version : GLSL Error: cannot locate suitable resource to bin



charmingzuo
01-13-2010, 07:17 AM
Dear All,

I have encountered a problem with OpenGL/GLSL as the following message,


error C5041: cannot locate suitable resource to bind parameter ...



I have searched this forum, and several hints said it is related to the
too many varables. I don't think this is my problem.
My code is simple, but the fragment shader is a little bit longer, as,


uniform sampler3D texDiffDat;
uniform sampler2DRect texGrad;
uniform sampler2DRect texRandMatrix;
uniform sampler2DRect texCanvas1;
uniform sampler2DRect texCanvas2;
uniform sampler2DRect texCanvas3;

#define numDirect 90
#define imgW 4
#define imgH 4

....

gl_FragData[0] = ...
....
gl_FragData[5] = ... //Totaly draw 6 buffers



I have tested my NVIDIA card for Quadro NVS 140M with the latest driver,
OpenGL 3.2/gLSL 1.5, and it has 8 draw buffers maxime. With OS win XP, Visual
Studio 2008.
Another test is on NVIDIA Quadro FX1700 card (both on WIN32 and Ubuntu9.10,
all with the latest driver), but the same errors appear.

Actually, in order to test the program, I specifically set the image(texture)
very small, 2D (imgW*imgH) and 3D (imgW*imgH*numDirect). So it won't overload
the GPU mem at all.

A real situation is, my shader is a little bit longer, about 600 lines (C-style),
but it doesn't have too much local arrays or vectors, expcept some single float
or int varables. Does it has limit for the indications in the shader ?

Could some friends give me some suggestions?

Thank you,

DarkShadow44
01-13-2010, 02:36 PM
Sorry I also don't know... :(
But maybe you have too much varyings . (http://www.gamedev.net/community/forums/topic.asp?topic_id=447733&forum_id=12&gforum_id=0)
Check it out with

glGet(GL_MAX_VARYING_FLOATS_ARB).
Or sampler3D is too much.
Or your grapic card doesn't support 6 textures with multitexturing.
I would suppose you to reduce your shader an figure that out. ;)

charmingzuo
01-13-2010, 06:31 PM
Sorry I also don't know... :(
But maybe you have too much varyings . (http://www.gamedev.net/community/forums/topic.asp?topic_id=447733&forum_id=12&gforum_id=0)
Check it out with code]glGet(GL_MAX_VARYING_FLOATS_ARB).[/CODE]
Or sampler3D is too much.
Or your grapic card doesn't support 6 textures with multitexturing.
I would suppose you to reduce your shader an figure that out. ;)

DarkShadow44, Thank you for your suggestions.
The GL_MAX_VARYING_FLOATS of my Quadro NVS 140M card is 60, and GL_MAX_DRAW_BUFFERS
is 8, on my notebook. These parameter should be more on my FX1700 card on Desktop PC.
So, I personally don't think it has too much varying-s.

Actually, when I remove the "uniform sampler2DRect texCanvas3" and reduce draw gl_FragData from 6 to 4, it indeed works well!!

This is also a related problem, but seems without final results.
http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=237438

Thanks,

Alfonse Reinheart
01-13-2010, 10:21 PM
Actually, when I remove the "uniform sampler2DRect texCanvas3" and reduce draw gl_FragData from 6 to 4, it indeed works well!!

That suggests that GL_MAX_DRAW_BUFFERS on your desktop is 4. Is there some reason you can't test this directly?