cuda纹理函数分析

发布时间 2023-07-11 04:42:26作者: 吴建明wujianming

cuda纹理函数分析

纹理对象在纹理对象 API 中描述

纹理提取在纹理提取中进行了描述。

1. 纹理对象接口

1.1. tex1Dfetch()

template<class T>
T tex1Dfetch(cudaTextureObject_t texObj, int x);

使用整数纹理x坐标从一维纹理texObj对象指定的线性内存区域获取。tex1Dfetch()仅适用于非规范化坐标,因此仅支持边框和夹具寻址模式。它不执行任何纹理过滤。对于整数类型,它可以选择将整数提升为单精度浮点数。

1.2. tex1D()

template<class T>
T tex1D(cudaTextureObject_t texObj, float x);

使用x纹理坐标从一维纹理texObj对象指定的 CUDA 数组中获取。

1.3. tex1DLod()

template<class T>
T tex1DLod(cudaTextureObject_t texObj, float x, float level);

使用level细节级别的纹理x坐标从一维纹理texObj对象指定的 CUDA 数组中获取。

1.4. tex1DGrad()

template<class T>
T tex1DGrad(cudaTextureObject_t texObj, float x, float dx, float dy);

使用纹理x坐标从一维纹理texObj对象指定的 CUDA 数组中获取。细节层次派生自X 梯度dx和 Y梯度dy。

1.5. tex2D()

template<class T>
T tex2D(cudaTextureObject_t texObj, float x, float y);

使用纹理(x,y)坐标从 CUDA 数组或二维纹理texObj对象指定的线性内存区域获取。

1.6. tex2D() 用于稀疏 CUDA 数组

                template<class T>
T tex2D(cudaTextureObject_t texObj, float x, float y, bool* isResident);

使用纹理(x,y)坐标从二维纹理texObj对象指定的 CUDA 数组中获取。还通过isResident指针返回纹素是否驻留在内存中。否则,获取的值将为零。

1.7. tex2Dgather()

template<class T>
T tex2Dgather(cudaTextureObject_t texObj,
              float x, float y, int comp = 0);

使用纹理坐标x和y纹理收集中所述的comp参数从 2D 纹理texObj对象指定的 CUDA 数组中获取。

1.8. 用于稀疏 CUDA 数组的 tex2Dgather()

                template<class T>
T tex2Dgather(cudaTextureObject_t texObj,
            float x, float y, bool* isResident, int comp = 0);

使用纹理坐标x和y纹理收集中所述的comp参数从 2D 纹理texObj对象指定的 CUDA 数组中获取。还通过isResident指针返回纹素是否驻留在内存中。否则,获取的值将为零。

1.9. tex2DGrad()

template<class T>
T tex2DGrad(cudaTextureObject_t texObj, float x, float y,
            float2 dx, float2 dy);

使用纹理(x,y)坐标从二维纹理texObj对象指定的 CUDA 数组中获取。详细层次派生自 dx和dy 梯度。

1.10. tex2DGrad() 用于稀疏 CUDA 数组

                template<class T>
T tex2DGrad(cudaTextureObject_t texObj, float x, float y,
        float2 dx, float2 dy, bool* isResident);

使用纹理(x,y)坐标从二维纹理texObj对象指定的 CUDA 数组中获取。详细层次派生自dx 和dy 梯度。还通过isResident指针返回纹素是否驻留在内存中。否则,获取的值将为零。

1.11. tex2DLod()

template<class T>
tex2DLod(cudaTextureObject_t texObj, float x, float y, float level);

使用细节level级别的纹理(x,y)坐标从 CUDA 数组或二维纹理texObj对象指定的线性内存区域获取。

1.12. 用于稀疏 CUDA 数组的 tex2DLod()

        template<class T>
tex2DLod(cudaTextureObject_t texObj, float x, float y, float level, bool* isResident);

使用详细level级别的纹理(x,y)坐标从二维纹理texObj对象指定的 CUDA 数组中获取。还通过isResident指针返回纹素是否驻留在内存中。否则,获取的值将为零。

1.13. tex3D()

template<class T>
T tex3D(cudaTextureObject_t texObj, float x, float y, float z);

使用纹理(x,y,z)坐标从三维纹理texObj对象指定的 CUDA 数组中获取。

1.14. tex3D() 用于稀疏 CUDA 数组

                template<class T>
T tex3D(cudaTextureObject_t texObj, float x, float y, float z, bool* isResident);

使用纹理(x,y,z)坐标从三维纹理texObj对象指定的 CUDA 数组中获取。还通过isResident指针返回纹素是否驻留在内存中。否则,获取的值将为零。

1.15. tex3DLod()

template<class T>
T tex3DLod(cudaTextureObject_t texObj, float x, float y, float z, float level);

使用细节级别的纹理坐标从 CUDA 数组或三维纹理对象指定的线性内存区域获取。texObj(x,y,z)level

1.16. 用于稀疏 CUDA 数组的 tex3DLod()

                template<class T>
T tex3DLod(cudaTextureObject_t texObj, float x, float y, float z, float level, bool* isResident);

使用细节level级别的纹理(x,y,z)坐标从 CUDA 数组或三维纹理texObj对象指定的线性内存区域获取。还通过isResident指针返回纹素是否驻留在内存中。否则,获取的值将为零。

1.17. tex3DGrad()

template<class T>
T tex3DGrad(cudaTextureObject_t texObj, float x, float y, float z,
            float4 dx, float4 dy);

使用从 X dx和 Y dy梯度派生的细节级别的纹理(x,y,z)坐标从三维纹理texObj对象指定的 CUDA 数组中获取。

1.18. tex3DGrad() 用于稀疏 CUDA 数组

                template<class T>
T tex3DGrad(cudaTextureObject_t texObj, float x, float y, float z,
        float4 dx, float4 dy, bool* isResident);

使用从 X dx和 Y dy梯度派生的细节级别的纹理(x,y,z)坐标从三维纹理texObj对象指定的 CUDA 数组中获取。还通过isResident指针返回纹素是否驻留在内存中。否则,获取的值将为零。

1.19. tex1DLayered()

template<class T>
T tex1DLayered(cudaTextureObject_t texObj, float x, int layer);

使用纹理x坐标和layer索引从一维纹理texObj对象指定的 CUDA 数组中获取,如分层纹理中所述

1.20. tex1DLayeredLod()

template<class T>
T tex1DLayeredLod(cudaTextureObject_t texObj, float x, int layer, float level);

使用纹理坐标x和细节level级别从layer层的一维分层纹理指定的 CUDA 数组中获取。

1.21. tex1DLayeredGrad()

template<class T>
T tex1DLayeredGrad(cudaTextureObject_t texObj, float x, int layer,
                   float dx, float dy);

使用纹理x坐标和从dx 和 dy梯度派生的细节级别从layer层的一维分层纹理指定的 CUDA 数组中获取。

1.22. tex2DLayered()

template<class T>
T tex2DLayered(cudaTextureObject_t texObj,
               float x, float y, int layer);

使用纹理(x,y)坐标和layer索引从二维纹理texObj对象指定的 CUDA 数组中获取,如分层纹理中所述。

1.23. tex2DLayered() 用于稀疏 CUDA 数组

                template<class T>
T tex2DLayered(cudaTextureObject_t texObj,
            float x, float y, int layer, bool* isResident);

使用纹理(x,y)坐标和layer索引从二维纹理texObj对象指定的 CUDA 数组中获取,如分层纹理中所述。还通过isResident指针返回纹素是否驻留在内存中。否则,获取的值将为零。

1.24. tex2DLayeredLod()

template<class T>
T tex2DLayeredLod(cudaTextureObject_t texObj, float x, float y, int layer,
                  float level);

使用纹理(x,y)坐标从layer二维分层纹理指定的 CUDA 数组中获取。

1.25. tex2DLayeredLod() 用于稀疏 CUDA 数组

                template<class T>
T tex2DLayeredLod(cudaTextureObject_t texObj, float x, float y, int layer,
                float level, bool* isResident);

使用纹理(x,y)坐标从layer二维分层纹理指定的 CUDA 数组中获取。还通过isResident指针返回纹素是否驻留在内存中。否则,获取的值将为零。

1.26. tex2DLayeredGrad()

template<class T>
T tex2DLayeredGrad(cudaTextureObject_t texObj, float x, float y, int layer,
                   float2 dx, float2 dy);

使用纹理(x,y)坐标和从 dx和 dy梯度派生的细节级别从层的layer二维分层纹理指定的 CUDA 数组中获取。

1.27. tex2DLayeredGrad() 用于稀疏 CUDA 数组

                template<class T>
T tex2DLayeredGrad(cudaTextureObject_t texObj, float x, float y, int layer,
                float2 dx, float2 dy, bool* isResident);

使用纹理(x,y)坐标和从 dx和 dy梯度派生的细节级别从layer层的二维分层纹理指定的 CUDA 数组中获取。还通过isResident指针返回纹素是否驻留在内存中。否则,获取的值将为零。

1.28. texCubemap()

template<class T>
T texCubemap(cudaTextureObject_t texObj, float x, float y, float z);

使用纹理(x,y,z)坐标获取立方体贴图纹理texObj对象指定的 CUDA 数组,如立方体贴图纹理中所述。

1.29. texCubemapGrad()

template<class T>
T texCubemapGrad(cudaTextureObject_t texObj, float x, float, y, float z,
                float4 dx, float4 dy);

使用立方体贴图纹理中所述的纹理(x,y,z)坐标从立方体贴图纹理texObj对象指定的 CUDA 数组中获取。使用的细节层次派生自 dx和 dy梯度。

1.30. texCubemapLod()

template<class T>
T texCubemapLod(cudaTextureObject_t texObj, float x, float, y, float z,
                float level);

使用立方体贴图纹理中所述的纹理(x,y,z)坐标从立方体贴图纹理texObj对象指定的 CUDA 数组中获取。使用的详细级别由level 给出。

1.31. texCubemapLayered()

template<class T>
T texCubemapLayered(cudaTextureObject_t texObj,
                    float x, float y, float z, int layer);

使用纹理(x,y,z)坐标和layer索引从立方体贴图分层纹理texObj对象指定的 CUDA 数组中获取,如立方体贴图分层纹理中所述。

1.32. texCubemapLayeredGrad()

template<class T>
T texCubemapLayeredGrad(cudaTextureObject_t texObj, float x, float y, float z,
                       int layer, float4 dx, float4 dy);

使用纹理(x,y,z)坐标和layer索引从立方体贴图分层纹理texObj对象指定的 CUDA 数组中获取,如立方体贴图分层纹理中所述,在从dx 和 dy梯度派生的详细级别。

1.33. texCubemapLayeredLod()

template<class T>
T texCubemapLayeredLod(cudaTextureObject_t texObj, float x, float y, float z,
                       int layer, float level);

使用纹理(x,y,z)坐标和layer索引从立方体贴图分层纹理texObj对象指定的 CUDA 数组中获取,如立方体贴图分层纹理中所述,在level细节级别。