Tex1D, Tex2D, Tex1Dfetch

What is the difference between tex1D and tex1Dfetch? why there is no tex2Dfetch? Thank You

They are all used for reading texture. Depending on your src u have two possibility to bind them to texutre. The tex1D is used for cudaArray. tex1Dfetch is for linear memory.

That is why there is no tex2Dfetch function? Cause linear memory can be bound only to 1D texture?


That’s not strictly true, linear memory can be bound to a 2D texture using cudaBindTexture2D() and read using tex2D() (this is so called pitch-linear texturing), although the performance is not always as good as 2D texturing from CUDA arrays. There’s a sample “simplePitchLinearTexture” in the SDK.

The design is somewhat non-orthogonal, but texture fetches using tex1Dfetch() have additional restrictions (no filtering).

i got 10.1 gt/s against 10.5 om GTX275. maximum theoretical texture fillrate is 50.6 gt/s.

  1. why the result is so far from max?

  2. the performance difference is about 4%. is it intended to be so?

so am i right that only tex1Dfetch has next restrictions

1.no normalized coordinates

2.no filtering

3.no wrap mode

  1. only readelementtype mode

and tex2D works the same for arrays and linear memory except performance?