From 8af73cfd998335658a09863d997b6a336c33a7ed Mon Sep 17 00:00:00 2001 From: Istvan Kiss Date: Sun, 10 Nov 2024 20:36:24 +0100 Subject: [PATCH] OpenGL interop functions description update --- docs/how-to/hip_runtime_api/opengl_interop.rst | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/how-to/hip_runtime_api/opengl_interop.rst b/docs/how-to/hip_runtime_api/opengl_interop.rst index 00ae889c0e..dd22fcf111 100644 --- a/docs/how-to/hip_runtime_api/opengl_interop.rst +++ b/docs/how-to/hip_runtime_api/opengl_interop.rst @@ -14,10 +14,14 @@ utilize these resources directly, bypassing the need for costly data transfers b the CPU and GPU. This capability is useful in applications that require both intensive GPU computation and real-time visualization. -The OpenGL resource can be mapped to HIP with :cpp:func:`hipGraphicsMapResources` -function and the device pointers are accessed with -:cpp:func:`hipGraphicsResourceGetMappedPointer` or -:cpp:func:`hipGraphicsSubResourceGetMappedArray` functions. +The graphics resources must be registered using functions like +:cpp:func:`hipGraphicsGLRegisterBuffer` or :cpp:func:`hipGraphicsGLRegisterImage` +then they can be mapped to HIP with :cpp:func:`hipGraphicsMapResources` +function. + +After mapping, the :cpp:func:`hipGraphicsResourceGetMappedPointer` or +:cpp:func:`hipGraphicsSubResourceGetMappedArray` functions used to retrieve a +device pointer to the mapped resource, which can then be used in HIP kernels. Unmapping resources with :cpp:func:`hipGraphicsUnmapResources` after computations ensure proper resource management. @@ -35,9 +39,9 @@ framebuffer in a cycle until the window is not closed. .. note:: - The more recent recent OpenGL functions loaded with `OpenGL loader `_, - as these are not loaded by default on all platforms. The use of a custom loader - shown in the following example + The more recent OpenGL functions are loaded with `OpenGL loader `_, + as these are not loaded by default on all platforms. The use of a custom + loader shown in the following example .. literalinclude:: ../../tools/example_codes/opengl_interop.hip :start-after: // [Sphinx opengl functions load start]