Surface object#

hipError_t hipCreateSurfaceObject(hipSurfaceObject_t *pSurfObject, const hipResourceDesc *pResDesc)#

Create a surface object.

Parameters:
  • pSurfObject[out] Pointer of surface object to be created.

  • pResDesc[in] Pointer of suface object descriptor.

Returns:

hipSuccess, hipErrorInvalidValue

hipError_t hipDestroySurfaceObject(hipSurfaceObject_t surfaceObject)#

Destroy a surface object.

Parameters:

surfaceObject[in] Surface object to be destroyed.

Returns:

hipSuccess, hipErrorInvalidValue

static int __hipGetPixelAddr(int x, int format, int order)#
template<typename T, typename std::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static void surf1Dread(T *data, hipSurfaceObject_t surfObj, int x, int boundaryMode = hipBoundaryModeZero)#

Reads the value at coordinate x from the one-dimensional surface.

Template Parameters:

T – The data type of the surface.

Parameters:
  • data – [out] The T type result is stored in this pointer.

  • surfObj – [in] The surface descriptor.

  • x – [in] The coordinate where the value will be read out.

  • boundaryMode – [in] The boundary mode is currently ignored.

template<typename T, typename std::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static void surf1Dwrite(T data, hipSurfaceObject_t surfObj, int x)#

Writes the value data to the one-dimensional surface at coordinate x.

Template Parameters:

T – The data type of the surface.

Parameters:
  • data – [in] The T type value is written to surface.

  • surfObj – [in] The surface descriptor.

  • x – [in] The coordinate where the data will be written.

template<typename T, typename std::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static void surf2Dread(T *data, hipSurfaceObject_t surfObj, int x, int y)#

Reads the value from the two-dimensional surface at coordinate x, y.

Template Parameters:

T – The data type of the surface.

Parameters:
  • data – [out] The T type result is stored in this pointer.

  • surfObj – [in] The surface descriptor.

  • x – [in] The x coordinate where the value will be read out.

  • y – [in] The y coordinate where the value will be read out.

template<typename T, typename std::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static void surf2Dwrite(T data, hipSurfaceObject_t surfObj, int x, int y)#

Writes the value data to the two-dimensional surface at coordinate x, y.

Template Parameters:

T – The data type of the surface.

Parameters:
  • data – [in] The T type value is written to surface.

  • surfObj – [in] The surface descriptor.

  • x – [in] The x coordinate where the data will be written.

  • y – [in] The y coordinate where the data will be written.

template<typename T, typename std::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static void surf3Dread(T *data, hipSurfaceObject_t surfObj, int x, int y, int z)#

Reads the value from the three-dimensional surface at coordinate x, y, z.

Template Parameters:

T – The data type of the surface.

Parameters:
  • data – [out] The T type result is stored in this pointer.

  • surfObj – [in] The surface descriptor.

  • x – [in] The x coordinate where the value will be read out.

  • y – [in] The y coordinate where the value will be read out.

  • z – [in] The z coordinate where the value will be read out.

template<typename T, typename std::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static void surf3Dwrite(T data, hipSurfaceObject_t surfObj, int x, int y, int z)#

Writes the value data to the three-dimensional surface at coordinate x, y, z.

Template Parameters:

T – The data type of the surface.

Parameters:
  • data – [in] The T type value is written to surface.

  • surfObj – [in] The surface descriptor.

  • x – [in] The x coordinate where the data will be written.

  • y – [in] The y coordinate where the data will be written.

  • z – [in] The z coordinate where the data will be written.

template<typename T, typename std::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static void surf1DLayeredread(T *data, hipSurfaceObject_t surfObj, int x, int layer)#

Reads the value from the one-dimensional layered surface at coordinate x and layer index.

Template Parameters:

T – The data type of the surface.

Parameters:
  • data – [out] The T type result is stored in this pointer.

  • surfObj – [in] The surface descriptor.

  • x – [in] The coordinate where the value will be read out.

  • layer – [in] The layer index where the value will be read out.

template<typename T, typename std::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static void surf1DLayeredwrite(T data, hipSurfaceObject_t surfObj, int x, int layer)#

Writes the value data to the one-dimensional layered surface at coordinate x and layer index.

Template Parameters:

T – The data type of the surface.

Parameters:
  • data – [in] The T type value is written to surface.

  • surfObj – [in] The surface descriptor.

  • x – [in] The x coordinate where the data will be written.

  • layer – [in] The layer index where the data will be written.

template<typename T, typename std::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static void surf2DLayeredread(T *data, hipSurfaceObject_t surfObj, int x, int y, int layer)#

Reads the value from the two-dimensional layered surface at coordinate x, y and layer index.

Template Parameters:

T – The data type of the surface.

Parameters:
  • data – [out] The T type result is stored in this pointer.

  • surfObj – [in] The surface descriptor.

  • x – [in] The x coordinate where the value will be read out.

  • y – [in] The y coordinate where the value will be read out.

  • layer – [in] The layer index where the value will be read out.

template<typename T, typename std::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static void surf2DLayeredwrite(T data, hipSurfaceObject_t surfObj, int x, int y, int layer)#

Writes the value data to the two-dimensional layered surface at coordinate x, y and layer index.

Template Parameters:

T – The data type of the surface.

Parameters:
  • data – [in] The T type value is written to surface.

  • surfObj – [in] The surface descriptor.

  • x – [in] The x coordinate where the data will be written.

  • y – [in] The y coordinate where the data will be written.

  • layer – [in] The layer index where the data will be written.

template<typename T, typename std::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static void surfCubemapread(T *data, hipSurfaceObject_t surfObj, int x, int y, int face)#

Reads the value from the cubemap surface at coordinate x, y and face index.

Template Parameters:

T – The data type of the surface.

Parameters:
  • data – [out] The T type result is stored in this pointer.

  • surfObj – [in] The surface descriptor.

  • x – [in] The x coordinate where the value will be read out.

  • y – [in] The y coordinate where the value will be read out.

  • face – [in] The face index where the value will be read out.

template<typename T, typename std::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static void surfCubemapwrite(T data, hipSurfaceObject_t surfObj, int x, int y, int face)#

Writes the value data to the cubemap surface at coordinate x, y and face index.

Template Parameters:

T – The data type of the surface.

Parameters:
  • data – [in] The T type value is written to surface.

  • surfObj – [in] The surface descriptor.

  • x – [in] The x coordinate where the data will be written.

  • y – [in] The y coordinate where the data will be written.

  • face – [in] The face index where the data will be written.

template<typename T, typename std::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static void surfCubemapLayeredread(T *data, hipSurfaceObject_t surfObj, int x, int y, int face, int layer)#

Reads the value from the layered cubemap surface at coordinate x, y and face, layer index.

Template Parameters:

T – The data type of the surface.

Parameters:
  • data – [out] The T type result is stored in this pointer.

  • surfObj – [in] The surface descriptor.

  • x – [in] The x coordinate where the value will be read out.

  • y – [in] The y coordinate where the value will be read out.

  • face – [in] The face index where the value will be read out.

  • layer – [in] The layer index where the data will be written.

template<typename T, typename std::enable_if<__hip_is_tex_surf_channel_type<T>::value>::type* = nullptr>
static void surfCubemapLayeredwrite(T *data, hipSurfaceObject_t surfObj, int x, int y, int face, int layer)#

Writes the value data to the layered cubemap surface at coordinate x, y and face, layer index.

Template Parameters:

T – The data type of the surface.

Parameters:
  • data – [in] The T type value to write to the surface.

  • surfObj – [in] The surface descriptor.

  • x – [in] The x coordinate where the data will be written.

  • y – [in] The y coordinate where the data will be written.

  • face – [in] The face index where the data will be written.

  • layer – [in] The layer index where the data will be written.