表面功能:
在下面的部分中,boundaryMode指定边界模式,即处理超出范围的表面坐标的方式; 它等于cudaBoundaryModeClamp(在这种情况下,超出范围的坐标被钳位到有效范围)或cudaBoundaryModeZero(在这种情况下超出范围的读取返回零并且超出范围的写入被忽略)或cudaBoundaryModeTrap, 在这种情况下,超出范围的访问会导致内核执行失败。
表面对象API:
surf1Dread():
template<class T>
T surf1Dread(cudaSurfaceObject_t surfObj, int x,
boundaryMode = cudaBoundaryModeTrap);
使用坐标x读取由一维表面对象surfObj指定的CUDA数组。
surf1Dwrite():
template<class T>
void surf1Dwrite(T data,
cudaSurfaceObject_t surfObj,
int x,
boundaryMode = cudaBoundaryModeTrap);
将值数据写入由坐标x处的一维表面对象surfObj指定的CUDA数组。
surf2Dread():
template<class T>
T surf2Dread(cudaSurfaceObject_t surfObj,
int x, int y,
boundaryMode = cudaBoundaryModeTrap);
template<class T>
void surf2Dread(T* data,
cudaSurfaceObject_t surfObj,
int x, int y,
boundaryMode = cudaBoundaryModeTrap);
使用坐标x和y读取由二维表面对象surfObj指定的CUDA数组
surf2Dwrite():
template<class T>
void surf2Dwrite(T data,
cudaSurfaceObject_t surfObj,
int x, int y,
boundaryMode = cudaBoundaryModeTrap);
将值数据写入由坐标x和y处的二维表面对象surfObj指定的CUDA数组。
surf3Dread():
template<class T>
T surf3Dread(cudaSurfaceObject_t surfObj,
int x, int y, int z,
boundaryMode = cudaBoundaryModeTrap);
template<class T>
void surf3Dread(T* data,
cudaSurfaceObject_t surfObj,
int x, int y, int z,
boundaryMode = cudaBoundaryModeTrap);
使用坐标x,y和z读取由三维表面对象surfObj指定的CUDA数组。
surf3Dwrite():
template<class T>
void surf3Dwrite(T data,
cudaSurfaceObject_t surfObj,
int x, int y, int z,
boundaryMode = cudaBoundaryModeTrap);
将值数据写入由三维对象surfObj在坐标x,y和z指定的CUDA数组。
surf1DLayeredread():
template<class T>
T surf1DLayeredread(
cudaSurfaceObject_t surfObj,
int x, int layer,
boundaryMode = cudaBoundaryModeTrap);
template<class T>
void surf1DLayeredread(T data,
cudaSurfaceObject_t surfObj,
int x, int layer,
boundaryMode = cudaBoundaryModeTrap);
使用坐标x和索引层读取由一维分层表面对象surfObj指定的CUDA数组。
surf1DLayeredwrite():
template<class Type>
void surf1DLayeredwrite(T data,
cudaSurfaceObject_t surfObj,
int x, int layer,
boundaryMode = cudaBoundaryModeTrap);
将值数据写入由位于坐标x和索引层的二维分层表面对象surfObj指定的CUDA数组。
surf2DLayeredread():
template<class T>
T surf2DLayeredread(
cudaSurfaceObject_t surfObj,
int x, int y, int layer,
boundaryMode = cudaBoundaryModeTrap);
template<class T>
void surf2DLayeredread(T data,
cudaSurfaceObject_t surfObj,
int x, int y, int layer,
boundaryMode = cudaBoundaryModeTrap);
使用坐标x和y以及索引层读取由二维分层表面对象surfObj指定的CUDA数组。
surf2DLayeredwrite():
template<class T>
void surf2DLayeredwrite(T data,
cudaSurfaceObject_t surfObj,
int x, int y, int layer,
boundaryMode = cudaBoundaryModeTrap);
将值数据写入由坐标x和y处的一维分层表面对象surfObj和索引层指定的CUDA数组。
surfCubemapread():
template<class T>
T surfCubemapread(
cudaSurfaceObject_t surfObj,
int x, int y, int face,
boundaryMode = cudaBoundaryModeTrap);
template<class T>
void surfCubemapread(T data,
cudaSurfaceObject_t surfObj,
int x, int y, int face,
boundaryMode = cudaBoundaryModeTrap);
使用坐标x和y读取由立方体贴图表面对象surfObj指定的CUDA数组,并使用面对索引面。
surfCubemapwrite():
template<class T>
void surfCubemapwrite(T data,
cudaSurfaceObject_t surfObj,
int x, int y, int face,
boundaryMode = cudaBoundaryModeTrap);
将值数据写入由坐标x和y处的立方图对象surfObj指定的CUDA数组,以及面索引面。
surfCubemapLayeredread():
template<class T>
T surfCubemapLayeredread(
cudaSurfaceObject_t surfObj,
int x, int y, int layerFace,
boundaryMode = cudaBoundaryModeTrap);
template<class T>
void surfCubemapLayeredread(T data,
cudaSurfaceObject_t surfObj,
int x, int y, int layerFace,
boundaryMode = cudaBoundaryModeTrap);
使用坐标x和y读取cubemap分层表面对象surfObj指定的CUDA数组,以及索引layerFace。
surfCubemapLayeredwrite():
template<class T>
void surfCubemapLayeredwrite(T data,
cudaSurfaceObject_t surfObj,
int x, int y, int layerFace,
boundaryMode = cudaBoundaryModeTrap);
将值数据写入由坐标x和y处的立方体贴图分层对象surfObj指定的CUDA数组,以及索引层面部。