Azmisov
Azmisov

Reputation: 7269

CUDA surfaces vs textures

What is the difference between a surface and texture object in CUDA? When should I use one or the other?

As far as I can tell from the developer documentation, they are exactly the same. Both appear to be CUDA arrays that use special texture memory. The only difference seems to be the API methods that access the memory.

Upvotes: 14

Views: 6068

Answers (1)

tera
tera

Reputation: 7265

Textures are read-only, surfaces are writable and readable. The surface API was introduced later to accomodate for this difference.

Use textures for data that your kernels read only, surfaces if they also write to it.

Upvotes: 20

Related Questions