23 #ifndef HIP_INCLUDE_HIP_HCC_DETAIL_SURFACE_FUNCTIONS_H
24 #define HIP_INCLUDE_HIP_HCC_DETAIL_SURFACE_FUNCTIONS_H
28 #define __SURFACE_FUNCTIONS_DECL__ static inline __device__
30 __SURFACE_FUNCTIONS_DECL__
void surf2Dread(T* data,
hipSurfaceObject_t surfObj,
int x,
int y,
31 int boundaryMode = hipBoundaryModeZero) {
33 size_t width = arrayPtr->width;
34 size_t height = arrayPtr->height;
35 int32_t xOffset = x /
sizeof(T);
36 T* dataPtr = (T*)arrayPtr->data;
37 if ((xOffset > width) || (xOffset < 0) || (y > height) || (y < 0)) {
38 if (boundaryMode == hipBoundaryModeZero) {
42 *data = *(dataPtr + y * width + xOffset);
47 __SURFACE_FUNCTIONS_DECL__
void surf2Dwrite(T data,
hipSurfaceObject_t surfObj,
int x,
int y,
48 int boundaryMode = hipBoundaryModeZero) {
50 size_t width = arrayPtr->width;
51 size_t height = arrayPtr->height;
52 int32_t xOffset = x /
sizeof(T);
53 T* dataPtr = (T*)arrayPtr->data;
54 if (!((xOffset > width) || (xOffset < 0) || (y > height) || (y < 0))) {
55 *(dataPtr + y * width + xOffset) = data;