Texture indirections

hi,
I use this code with a radeon 9800 PRO:

uniform vec2 tab;
uniform sampler2d texureid;

int tmp = 0;
vec4 res = tex2D(textureid,TexCoord + tab[tmp]);

I have the error : “…texture indirections exceded…” and shader is used in software

but if i use this code :
uniform vec2 tab;
uniform sampler2d texureid;

vec4 res = tex2D(textureid,TexCoord + tab[0]);

then my shader is used in hardware
so what could be the explanation of this ?
and how can I use the first code in hardware (if I can :slight_smile: ) ?
thanks

Try this:

const int tmp = 0;
vec4 res = tex2D(textureid,TexCoord + tab[tmp]);

this could be a solution but not for my case : (for example)
uniform vec2 tab;
uniform sampler2d texureid;
uniform int value;

int tmp = value * 2;
vec4 res = tex2D(textureid,TexCoord + tab[tmp]);

in fact “tmp” is a non constant value

This won’t work on 9800Pro because the shader as you wrote it has to detect at runtime which tab[] to take. Radoen 9xxx graphic cards aren’t able to do that in hardware (Shader Model 3.0 is required for this).

ok thanks i will try with statics datas

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