fragment program and texture access

Hi,
i have write a fragment program using Cg that use texRECT to access into a texture more than 3 times but it doesn’t work with more 3 access. Is this a limitation of ARB extension or my graphics card(Radeon 9500)?

Thank you.

This is a limitation of ATI’s implementation of the GL_ARB_fragment_program extension. The Radeon 9500 hardware is only capable of a maximum of 4 texture indirections. Reading a texture bound to a texture unit that was previously read counts as an indirection, so you’re pretty limited in the number of times the same texture unit can be read. You could probably get around this limitation to a degree by binding the same texture to multiple texture units. Then you could read from the same data multiple times without an indirection penalty by fetching samples from the same image on different units.

Hi,
in effect i have proved my Cg on a GeForce5900 without problems. But this is a problem now, must i write now different version of my fragment in Cg for ATI and NVIDIA?

Bye

on NV hardware you can use up to 1024 Texture indirections.

You have choise:

  • to support only NV cards;
  • to write 2 diiferent sources lines(R3x0 use 24bit prescion instead of 32 on NV, have 96 native instruction vs 1024 and more)…
  • modify algorithm to use less than 3 indirections(if possible);

Yes

Hi,
i have proved my source code on a ATI 9700 and doesn’t work. But i am very confuse because i have seen some sources code of ATI where they use more than 3 access to textures(they are all write in asm or HLSL). Hence where is the main problem?(Cg, ARB Extension, my angry about ATI)

Bye

The limitation is in the number of accesses to the same texture sampler. If you’re using 16 samplers, you can sample textures 48 times. If you bind the same texture object to all 16 of the samplers, then you can sample the same texture image 48 times, 3 times on each sampler.