OpenGL interoperability#

hipError_t hipGraphicsMapResources(int count, hipGraphicsResource_t *resources, hipStream_t stream)#

Maps a graphics resource for access.

Parameters:
  • count[in] - Number of resources to map.

  • resources[in] - Pointer of resources to map.

  • stream[in] - Stream for synchronization.

Returns:

hipSuccess, hipErrorInvalidValue, hipErrorUnknown, hipErrorInvalidResourceHandle

hipError_t hipGraphicsSubResourceGetMappedArray(hipArray_t *array, hipGraphicsResource_t resource, unsigned int arrayIndex, unsigned int mipLevel)#

Get an array through which to access a subresource of a mapped graphics resource.

Note

In this API, the value of arrayIndex higher than zero is currently not supported.

Parameters:
  • array[out] - Pointer of array through which a subresource of resource may be accessed.

  • resource[in] - Mapped resource to access.

  • arrayIndex[in] - Array index for the subresource to access.

  • mipLevel[in] - Mipmap level for the subresource to access.

Returns:

hipSuccess, hipErrorInvalidValue

hipError_t hipGraphicsResourceGetMappedPointer(void **devPtr, size_t *size, hipGraphicsResource_t resource)#

Gets device accessible address of a graphics resource.

Parameters:
  • devPtr[out] - Pointer of device through which graphic resource may be accessed.

  • size[out] - Size of the buffer accessible from devPtr.

  • resource[in] - Mapped resource to access.

Returns:

hipSuccess, hipErrorInvalidValue

hipError_t hipGraphicsUnmapResources(int count, hipGraphicsResource_t *resources, hipStream_t stream)#

Unmaps graphics resources.

Parameters:
  • count[in] - Number of resources to unmap.

  • resources[in] - Pointer of resources to unmap.

  • stream[in] - Stream for synchronization.

Returns:

hipSuccess, hipErrorInvalidValue, hipErrorUnknown, hipErrorContextIsDestroyed

hipError_t hipGraphicsUnregisterResource(hipGraphicsResource_t resource)#

Unregisters a graphics resource.

Parameters:

resource[in] - Graphics resources to unregister.

Returns:

hipSuccess

hipError_t hipGLGetDevices(unsigned int *pHipDeviceCount, int *pHipDevices, unsigned int hipDeviceCount, hipGLDeviceList deviceList)#

Queries devices associated with the current OpenGL context.

Parameters:
  • pHipDeviceCount[out] - Pointer of number of devices on the current GL context.

  • pHipDevices[out] - Pointer of devices on the current OpenGL context.

  • hipDeviceCount[in] - Size of device.

  • deviceList[in] - The setting of devices. It could be either hipGLDeviceListCurrentFrame for the devices used to render the current frame, or hipGLDeviceListAll for all devices. The default setting is Invalid deviceList value.

Returns:

hipSuccess, hipErrorInvalidValue, hipErrorNotSupported

hipError_t hipGraphicsGLRegisterBuffer(hipGraphicsResource **resource, GLuint buffer, unsigned int flags)#

Registers a GL Buffer for interop and returns corresponding graphics resource.

Parameters:
  • resource[out] - Returns pointer of graphics resource.

  • buffer[in] - Buffer to be registered.

  • flags[in] - Register flags.

Returns:

hipSuccess, hipErrorInvalidValue, hipErrorUnknown, hipErrorInvalidResourceHandle

hipError_t hipGraphicsGLRegisterImage(hipGraphicsResource **resource, GLuint image, GLenum target, unsigned int flags)#

Register a GL Image for interop and returns the corresponding graphic resource.

Parameters:
  • resource[out] - Returns pointer of graphics resource.

  • image[in] - Image to be registered.

  • target[in] - Valid target value Id.

  • flags[in] - Register flags.

Returns:

hipSuccess, hipErrorInvalidValue, hipErrorUnknown, hipErrorInvalidResourceHandle