Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: texture indirections

  1. #1
    Intern Newbie
    Join Date
    Apr 2004
    Location
    France
    Posts
    34

    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 ) ?
    thanks

  2. #2
    Member Regular Contributor
    Join Date
    Apr 2002
    Location
    Austria
    Posts
    328

    Re: texture indirections

    Try this:

    const int tmp = 0;
    vec4 res = tex2D(textureid,TexCoord + tab[tmp]);
    There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.

    There is another theory which states that this has already happened...

  3. #3
    Intern Newbie
    Join Date
    Apr 2004
    Location
    France
    Posts
    34

    Re: texture indirections

    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

  4. #4
    Member Regular Contributor
    Join Date
    Apr 2002
    Location
    Austria
    Posts
    328

    Re: texture indirections

    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).
    There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.

    There is another theory which states that this has already happened...

  5. #5
    Intern Newbie
    Join Date
    Apr 2004
    Location
    France
    Posts
    34

    Re: texture indirections

    ok thanks i will try with statics datas

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •