PDA

View Full Version : Texture Images usage in glsl



Ffelagund
05-15-2004, 12:40 PM
Hello, I'm having some problems with the texture units/images in glsl. Acording with the specification, a shader is able to use up to GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB between the vertex shader and the fragment shader. With a gffx card this value is 16, so I go from tex0 to tex15 binding all textures,
for"i=0;i<15;i++"{glActiveTextureARB"GL_TEXTURE0_ARB + i"; glBindTexture"target[i],id[i]";}
With this configuration in the host application
If I try to assign a value greather than 7 to the sampler2D, the result is a black object in the window... so only works the first eight texture images
P.S: replace quotes for parenthesis

Corrail
05-16-2004, 12:02 AM
Shouldn't it rather be GL_MAX_TEXTURE_IMAGE_UNITS for fragment shader texturing?

Ffelagund
05-16-2004, 12:54 AM
These are the driver limitations for the fx5200

GL_MAX_TEXTURE_UNITS: 4

GL_MAX_VERTEX_ATTRIBS_ARB: 16

GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: 256

GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB: 4

GL_MAX_VARYING_FLOATS_ARB: 32

GL_MAX_TEXTURE_IMAGE_UNITS_ARB: 16

GL_MAX_TEXTURE_COORDS_ARB: 8

GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: 16

GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: 128

As you can see, both parameters has the same value, 16. Another strange thing is GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, is should be 0, but is 4... and as far i know texture fetches in vertex shaders isn't allowed yet...
Could be this two issues driver bugs?
To compare, these are my driver capabilities (WildCat VP 560)

Vendor: 3Dlabs
Version: 1.3.2
Renderer: Wildcat VP560 - GL2

GL_MAX_TEXTURE_UNITS: 8

GL_MAX_VERTEX_ATTRIBS_ARB: 15

GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: 468

GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB: 0

GL_MAX_VARYING_FLOATS_ARB: 32

GL_MAX_TEXTURE_IMAGE_UNITS_ARB: 8

GL_MAX_TEXTURE_COORDS_ARB: 8

GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: 8

GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: 32

Corrail
05-16-2004, 02:03 AM
hm...
Sounds like a bug. Which driver do you use?

Ffelagund
05-16-2004, 02:32 AM
I'm using the latest nv developer drivers, but...
I'd tested with an ATI 9600xt, and i have the same result: the object becomes black when i try to use the TI#8 or highter

Vendor: ATI Technologies Inc.
Version: 1.5.4273 Win2000 Release
Renderer: RADEON 9600 x86/MMX/3DNow!/SSE

GL_MAX_TEXTURE_UNITS: 8

GL_MAX_VERTEX_ATTRIBS_ARB: 32

GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: 4096

GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB: 0

GL_MAX_VARYING_FLOATS_ARB: 44

GL_MAX_TEXTURE_IMAGE_UNITS_ARB: 16

GL_MAX_TEXTURE_COORDS_ARB: 8

GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: 16

GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: 4096

simongreen
05-17-2004, 02:29 PM
You should be able to bind 16 separate texture images in GLSL on GeForce FX hardware. Since you are seeing this problem on ATI and NVIDIA hardware my first thought is it may be a problem with your application.

If you can send me a simple test case I'll can take a look at it.

Thanks,

Simon Green
NVIDIA Developer Relations

Ffelagund
05-18-2004, 03:51 AM
Well, after build a test application to test the textures issue, I can see that the problem will be in my main application. The test application works fine accesing to all 16 textures :confused: . Well, at least I know where are the error, it's an advance :)
Other strange thing: Why GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB have 4 in gffx card? this means that 4 is the number of the textures accesibles into a vertex shader, this is an error?

Thanks for your patience.