PDA

View Full Version : texture indirections



pantxua
04-30-2004, 08:22 AM
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 :) ) ?
thanks

Corrail
04-30-2004, 09:05 AM
Try this:

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

pantxua
05-02-2004, 10:38 PM
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

Corrail
05-03-2004, 06:32 AM
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).

pantxua
05-03-2004, 06:58 AM
ok thanks i will try with statics datas