Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
neon60 committed Nov 28, 2024
1 parent 8470f0d commit 52e1b7f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ libc
libstdc
lifecycle
linearizing
literalinclude
LOC
LUID
ltrace
Expand All @@ -114,7 +113,6 @@ Numa
Nsight
ocp
omnitrace
opengl
overindex
overindexing
oversubscription
Expand Down
16 changes: 16 additions & 0 deletions docs/how-to/hip_runtime_api/opengl_interop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,32 @@ the window's framebuffer in a cycle until the window is not closed.
The more recent OpenGL functions are loaded with `OpenGL loader <https://github.com/ROCm/rocm-examples/tree/develop/External/glad>`_,
as these are not loaded by default on all platforms. The use of a custom
loader is shown in the following example

.. <!-- spellcheck-disable -->
.. literalinclude:: ../../tools/example_codes/opengl_interop.hip
:start-after: // [Sphinx opengl functions load start]
:end-before: // [Sphinx opengl functions load end]
:language: cpp

.. <!-- spellcheck-enable -->
The OpenGL buffer is imported to HIP in the following way:

.. <!-- spellcheck-disable -->
.. literalinclude:: ../../tools/example_codes/opengl_interop.hip
:start-after: // [Sphinx buffer register and get start]
:end-before: // [Sphinx buffer register and get end]
:language: cpp

.. <!-- spellcheck-enable -->
The imported pointer is manipulated in the sinewave kernel as shown in the
following example:

.. <!-- spellcheck-disable -->
.. literalinclude:: ../../tools/example_codes/opengl_interop.hip
:start-after: /// [Sphinx sinewave kernel start]
:end-before: /// [Sphinx sinewave kernel end]
Expand All @@ -68,10 +78,16 @@ following example:
:end-before: // [Sphinx buffer use in kernel end]
:language: cpp

.. <!-- spellcheck-enable -->
The HIP graphics resource that is imported from the OpenGL buffer has to be
unmap and unregister in the following way:

.. <!-- spellcheck-disable -->
.. literalinclude:: ../../tools/example_codes/opengl_interop.hip
:start-after: // [Sphinx unregister start]
:end-before: // [Sphinx unregister end]
:language: cpp

.. <!-- spellcheck-enable -->

0 comments on commit 52e1b7f

Please sign in to comment.