More than 3 texture3D lookups hangs application

I’ve got a small problem. I use a 3D noise texture now, but for some reason the application hangs when I do more than 3 lookups in the texture. I’m trying to do a cloudy sky and would like to use 4-5 octaves of this pregenerated noise. At first I thought that maybe there’s a limitation on number of lookups per texture unit, so I bound the texture object to texture units 0-3, but with the same result.

Has anyone encountered any such limitation?

Markus

Radeon 9800 Pro, Catalyst 4.4

What do you get when you call glGetInfoLog?

I have the same problem with doing a convolution (with a ATI 9800 pro):
when i try to lookup more than three times in my texture, my program crashs. I have the same problem with using a for loop.

uniform sampler2D BaseImage;

void main (void)
vec4 sum = texture2D(BaseImage, gl_TexCoord[0].st + vec2(0, 1));
sum += texture2D(BaseImage, gl_TexCoord[0].st + vec2(-1, 0));
sum += texture2D(BaseImage, gl_TexCoord[0].st + vec2(1, 0));
sum += texture2D(BaseImage, gl_TexCoord[0].st + vec2(0, -1));

gl_FragColor = sum * vec4(0.25);
}

But I have no solution

I got a similar problem. When sampeling more than 3 textures glGetInfoLog returns me a warning, that the shader will run in software because of exceeding texture indirections…

I have no warning, my infolog is : “Link successful. The GLSL vertex shader will run in hardware. the GLSL fragment Shader will run in hardware.”, but i still have the problem :slight_smile:

I get the same message as you Corrail.

where do you you put your infolog in your code ?

ok, i have the same message in the infolog which is “number of texture indirections exceeded”

That’s a known flaw in ATI’s current glsl-implementation. I’ve noticed that (with 2D-texture lookups) some months ago, but ATI still haven’t fixed this.

This was btw. also the case with ARB_FP, where a similiar problem existed and took ATI some time to
fix.

It seems that ATI’s glsl-implementation takes normal lookups for dependant lookups, which isn’t correct. Hopefully they’ll fix that within one of their next drivers (instead of including such useless crap as those “smartshaders”).

ok, i will wait for next ATI driver but is there another way to make a convolution without using more than 3 textures lookups ?

Originally posted by pantxua:
[b]I have the same problem with doing a convolution (with a ATI 9800 pro):
when i try to lookup more than three times in my texture, my program crashs. I have the same problem with using a for loop.

uniform sampler2D BaseImage;

void main (void)
vec4 sum = texture2D(BaseImage, gl_TexCoord[0].st + vec2(0, 1));
sum += texture2D(BaseImage, gl_TexCoord[0].st + vec2(-1, 0));
sum += texture2D(BaseImage, gl_TexCoord[0].st + vec2(1, 0));
sum += texture2D(BaseImage, gl_TexCoord[0].st + vec2(0, -1));

gl_FragColor = sum * vec4(0.25);
}

But I have no solution[/b]

since you are storing the result of all texture lookups in the same temporary variable, it is technically a texture indirection.

one way to workaround would be to store the four lookups in four variables, and to add them to get your final sum.

A better compiler could do this for you.

Pierre B.

thx but storing the four lookups in four variables has the same result than storing the result of four lookups in the same temporary variable. The hote that the next ATI driver will have a better compiler which will work with more than 3 texture lookups.

I tested my shader with an FX5900 card and Forceware 60.72. Works like a charm!!

AFAIK there is a limit of 4 dependent texture reads on the Radeon cards. When you compute gl_TexCoord[0].st + vec2(0, 1), you’re computing a texture coordinate in the shader, thus it counts as a dependent read.

However, it looks like you’re using exactly 4 reads, so it should just work.

Alternatively, you can try computing the texture coordinates in a vertex shader and using them directly in the fragment shader. This will avoid the extra computations in the fragment program and turn dependent texture reads into independent ones.

ok, i’ve done it with 5 texture lookups :

uniform sampler2D BaseImage;
varying vec2 TexCoord;
void main (void)
{
vec2 textcoord = TexCoord;
float tmp = 1.0/512.0;
float div = 1.0/5.0;
vec2 coord1 = textcoord + vec2(0, 0);
vec2 coord2 = textcoord + vec2(0, tmp);
vec2 coord3 = textcoord + vec2(-tmp, 0);
vec2 coord4 = textcoord + vec2(0, -tmp);
vec2 coord5 = textcoord + vec2(0, 0);
vec4 sum = texture2D(BaseImage, coord1);
sum+= texture2D(BaseImage, coord2);
sum+= texture2D(BaseImage, coord3);
sum+= texture2D(BaseImage, coord4);
sum+= texture2D(BaseImage, coord5);
gl_FragColor = (sum)* vec4(div);
}

with one lookup more my application crash. So I will try to do my convolution with cg while waiting for ati’s driver :slight_smile:
thx a lot

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.