前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >DAY43:阅读纹理之Texture Object API

DAY43:阅读纹理之Texture Object API

作者头像
GPUS Lady
发布2018-08-01 14:48:57
9400
发布2018-08-01 14:48:57
举报
文章被收录于专栏:GPUS开发者GPUS开发者
我们正带领大家开始阅读英文的《CUDA C Programming Guide》,今天是第43天,我们正在讲解CUDA C语法,希望在接下来的57天里,您可以学习到原汁原味的CUDA,同时能养成英文阅读的习惯。

B.8. Texture Functions

Texture objects are described in Texture Object API

Texture references are described in Texture Reference API

Texture fetching is described in Texture Fetching.

B.8.1. Texture Object API

B.8.1.1. tex1Dfetch()

代码语言:javascript
复制
template<class T>
T tex1Dfetch(cudaTextureObject_t texObj, int x);

fetches from the region of linear memory specified by the one-dimensional texture object texObj using integer texture coordinate x. tex1Dfetch() only works with non-normalized coordinates, so only the border and clamp addressing modes are supported. It does not perform any texture filtering. For integer types, it may optionally promote the integer to single-precision floating point.

B.8.1.2. tex1D()

代码语言:javascript
复制
template<class T>
T tex1D(cudaTextureObject_t texObj, float x);

fetches from the CUDA array specified by the one-dimensional texture object texObj using texture coordinate x.

B.8.1.3. tex1DLod()

代码语言:javascript
复制
template<class T>
T tex1DLod(cudaTextureObject_t texObj, float x, float level);

fetches from the CUDA array specified by the one-dimensional texture object texObj using texture coordinate x at the level-of-detail level.

B.8.1.4. tex1DGrad()

代码语言:javascript
复制
template<class T>
T tex1DGrad(cudaTextureObject_t texObj, float x, float dx, float dy);

fetches from the CUDA array specified by the one-dimensional texture object texObj using texture coordinate x. The level-of-detail is derived from the X-gradient dx and Y-gradient dy.

B.8.1.5. tex2D()

代码语言:javascript
复制
template<class T>
T tex2D(cudaTextureObject_t texObj, float x, float y);

fetches from the CUDA array or the region of linear memory specified by the two-dimensional texture object texObj using texture coordinate (x,y).

B.8.1.6. tex2DLod()

代码语言:javascript
复制
template<class T>
tex2DLod(cudaTextureObject_t texObj, float x, float y, float level);

fetches from the CUDA array or the region of linear memory specified by the two-dimensional texture object texObj using texture coordinate (x,y) at level-of-detail level.

B.8.1.7. tex2DGrad()

代码语言:javascript
复制
template<class T>
T tex2DGrad(cudaTextureObject_t texObj, float x, float y,
            float2 dx, float2 dy);

fetches from the CUDA array specified by the two-dimensional texture object texObj using texture coordinate (x,y). The level-of-detail is derived from the dx and dy gradients.

B.8.1.8. tex3D()

代码语言:javascript
复制
template<class T>
T tex3D(cudaTextureObject_t texObj, float x, float y, float z);

fetches from the CUDA array specified by the three-dimensional texture object texObj using texture coordinate (x,y,z).

B.8.1.9. tex3DLod()

代码语言:javascript
复制
template<class T>
T tex3DLod(cudaTextureObject_t texObj, float x, float y, float z, float level);

fetches from the CUDA array or the region of linear memory specified by the three-dimensional texture object texObj using texture coordinate (x,y,z) at level-of-detail level.

B.8.1.10. tex3DGrad()

代码语言:javascript
复制
template<class T>
T tex3DGrad(cudaTextureObject_t texObj, float x, float y, float z,
            float4 dx, float4 dy);

fetches from the CUDA array specified by the three-dimensional texture object texObj using texture coordinate (x,y,z) at a level-of-detail derived from the X and Y gradients dx and dy.

B.8.1.11. tex1DLayered()

代码语言:javascript
复制
template<class T>
T tex1DLayered(cudaTextureObject_t texObj, float x, int layer);

fetches from the CUDA array specified by the one-dimensional texture object texObj using texture coordinate x and index layer, as described in Layered Textures

B.8.1.12. tex1DLayeredLod()

代码语言:javascript
复制
template<class T>
T tex1DLayeredLod(cudaTextureObject_t texObj, float x, int layer, float level);

fetches from the CUDA array specified by the one-dimensional layered texture at layer layer using texture coordinate x and level-of-detail level.

B.8.1.13. tex1DLayeredGrad()

代码语言:javascript
复制
template<class T>
T tex1DLayeredGrad(cudaTextureObject_t texObj, float x, int layer,                   float dx, float dy);

fetches from the CUDA array specified by the one-dimensional layered texture at layer layer using texture coordinate x and a level-of-detail derived from the dx and dy gradients.

B.8.1.14. tex2DLayered()

代码语言:javascript
复制
template<class T>
T tex2DLayered(cudaTextureObject_t texObj,               
        float x, float y, int layer);

fetches from the CUDA array specified by the two-dimensional texture object texObj using texture coordinate (x,y) and index layer, as described in Layered Textures.

B.8.1.15. tex2DLayeredLod()

代码语言:javascript
复制
template<class T>
T tex2DLayeredLod(cudaTextureObject_t texObj, float x, float y, int layer,                  float level);

fetches from the CUDA array specified by the two-dimensional layered texture at layer layer using texture coordinate (x,y).

B.8.1.16. tex2DLayeredGrad()

代码语言:javascript
复制
template<class T>
T tex2DLayeredGrad(cudaTextureObject_t texObj, float x, float y, int layer,
                   float2 dx, float2 dy);

fetches from the CUDA array specified by the two-dimensional layered texture at layer layer using texture coordinate (x,y) and a level-of-detail derived from the dx and dy X and Y gradients.

B.8.1.17. texCubemap()

代码语言:javascript
复制
template<class T>
T texCubemap(cudaTextureObject_t texObj, float x, float y, float z);

fetches the CUDA array specified by the three-dimensional texture object texObj using texture coordinate (x,y,z), as described in Cubemap Textures.

B.8.1.18. texCubemapLod()

代码语言:javascript
复制
template<class T>
T texCubemapLod(cudaTextureObject_t texObj, float x, float, y, float z,                float level);

fetches from the CUDA array specified by the three-dimensional texture object texObj using texture coordinate (x,y,z) as described in Cubemap Textures. The level-of-detail used is given by level.

B.8.1.19. texCubemapLayered()

代码语言:javascript
复制
template<class T>
T texCubemapLayered(cudaTextureObject_t texObj,                    
                      float x, float y, float z, int layer);

fetches from the CUDA array specified by the cubemap layered texture object texObj using texture coordinates (x,y,z), and index layer, as described in Cubemap Layered Textures.

B.8.1.20. texCubemapLayeredLod()

代码语言:javascript
复制
template<class T>
T texCubemapLayeredLod(cudaTextureObject_t texObj, float x, float y, float z,                       int layer, float level);

fetches from the CUDA array specified by the cubemap layered texture object texObj using texture coordinate (x,y,z) and index layer, as described in Cubemap Layered Textures, at level-of-detail level level.

B.8.1.21. tex2Dgather()

代码语言:javascript
复制
template<class T>
T tex2Dgather(cudaTextureObject_t texObj,              
               float x, float y, int comp = 0);

fetches from the CUDA array specified by the 2D texture object texObj using texture coordinates x and y and the comp parameter as described in Texture Gather.

本文备注/经验分享:

今天这章节比较简单, 主要是在device端(也就是kernel代码里)所能使用的纹理读取(识取)函数.还记得纹理么. 之前的章节介绍过好多.

我先把Texture Object API部分放出来,等明天把Texture Reference API部分放出来,我再一起讲。

有不明白的地方,请在本文后留言

或者在我们的技术论坛bbs.gpuworld.cn上发帖

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2018-07-06,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 GPUS开发者 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • B.8. Texture Functions
  • B.8.1. Texture Object API
  • B.8.1.1. tex1Dfetch()
  • B.8.1.2. tex1D()
  • B.8.1.3. tex1DLod()
  • B.8.1.4. tex1DGrad()
  • B.8.1.5. tex2D()
  • B.8.1.6. tex2DLod()
  • B.8.1.7. tex2DGrad()
  • B.8.1.8. tex3D()
  • B.8.1.9. tex3DLod()
  • B.8.1.10. tex3DGrad()
  • B.8.1.11. tex1DLayered()
  • B.8.1.12. tex1DLayeredLod()
  • B.8.1.13. tex1DLayeredGrad()
  • B.8.1.14. tex2DLayered()
  • B.8.1.15. tex2DLayeredLod()
  • B.8.1.16. tex2DLayeredGrad()
  • B.8.1.17. texCubemap()
  • B.8.1.18. texCubemapLod()
  • B.8.1.19. texCubemapLayered()
  • B.8.1.20. texCubemapLayeredLod()
  • B.8.1.21. tex2Dgather()
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档