ATI_fragment_shader dependant texture read

I just re-read that relevant part of the spec and it seems you could use coords #x to sample texture #y in the first pass as well. Interesting . I’ve always matched textures to texcoords, it’s a lot more flexible than I thought.

Edit: Hmmm, no. I think I’ll just go read it a couple more times .

[This message has been edited by PH (edited 02-13-2003).]

I agree this point is not very clear, but once you read it s-l-o-w-l-y you get it.

I just re-read that relevant part of the spec and it seems you could use coords #x to sample texture #y in the first pass as well.

Yes it is possible using :

glSampleMapATI(GL_REG_y_ATI, GL_TEXTURE_x_ARB, ...)

Are you sure ? I read that part of the spec a few more times and it appears that,

glSampleMapATI(GL_REG_x_ATI, GL_TEXTUREy_ARB, GL_SWIZZLE_STR_ATI);

will sample texture #y using coords #y and store the result in reg #x.

Edit: After giving it some some thought, it all does seem clear and logical now.

[This message has been edited by PH (edited 02-13-2003).]

I read the spec again and I think I’m right.

The entry point:
  void SampleMapATI (uint dst, uint interp, enum swizzle);
specifies that the value present in the texture data bound on the 
unit associated with <dst> will be written to that register.  A 
value for <dst> of REG_x_ATI means that TEXTUREx_ARB will be 
sampled, and the result written to REG_x_ATI.  The <interp> 
parameter specifies which texture coordinate interpolator is used to 
sample the map.  A value of REG_x_ATI for <interp> in the second 
pass of a two-pass shader will do dependent texture read sampling 
using the value in register x.  Otherwise, specifying TEXTUREx_ARB 
will sample the map using the texture coordinates on unit x.

The text “A value for <dst> of REG_x_ATI means that TEXTUREx_ARB will be sampled, and the result written to REG_x_ATI” means that the <dst> register always samples the texture unit which number is defined by the register number.

The text “Otherwise, specifying TEXTUREx_ARB will sample the map using the texture coordinates on unit x” means that the texture coordinates on unit x is used, it does not mean that a texel is sampled from unit x.

Ahhh yes, that appears to be correct. You’re right, it does say sample the map using texcoords from unit x, where the would mean the texture data bound on the unit associated with <dst>. Crystal clear .

Perhaps the ATI driver guys have problems reading the spec too, as your shader should work.

Well, the 8500 is more flexible than I thought. Thanks for the info vincoof and Ysaneya.

[This message has been edited by PH (edited 02-13-2003).]