Add CUDA-Graphics (OpenGL) interop support to cuda.core#1608
Add CUDA-Graphics (OpenGL) interop support to cuda.core#1608rparolin wants to merge 12 commits intoNVIDIA:mainfrom
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
| HANDLE_RETURN( | ||
| cydriver.cuGraphicsMapResources(1, &raw, cy_stream) | ||
| ) |
There was a problem hiding this comment.
optional: you could make the unmap more reliable (and avoid the duplicated calls to cuGraphicsUnmapResources) by making this into a resource, similar to the handle.
|
Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
- Remove unused GraphicsResourceHandle cimport (cython-lint) - Split long f-string to stay within 120-char line limit (ruff E501) - Rename unused variable buf to _buf (ruff F841) - Add noqa: S110 to intentional try-except-pass in test cleanup - Apply ruff auto-fixes (import sorting, formatting) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
/ok to test |
|
|
@jakirkham as the original requester of #241, would it be possible for you to review and provide us your feedbacks here? 🙂 |
|
/ok to test |
| flags : int, optional | ||
| Registration flags from :class:`GraphicsRegisterFlags`. | ||
| Defaults to :attr:`GraphicsRegisterFlags.NONE`. |
There was a problem hiding this comment.
Drive-by comment: In Python we tend not to use enums. I think in this case accepting a str like register_option="readonly" is already good enough.
Summary
Adds CUDA-Graphics (OpenGL) interoperability support to
cuda.core, enabling zero-copy sharing of GPU memory between CUDA compute kernels and OpenGL graphics renderers.GraphicsResource— Cython extension class for registering and managing OpenGL buffers/images with CUDA. Supportsfrom_gl_buffer()andfrom_gl_image()factory methods,map()/unmap()with context manager support, and automatic resource cleanup viaclose().GraphicsRegisterFlags— IntEnum for controlling registration behavior (NONE,READ_ONLY,WRITE_DISCARD,SURFACE_LOAD_STORE,TEXTURE_GATHER).GraphicsResourceHandle(shared_ptr with custom deleter) integrated into the existing resource handle infrastructure.gl_interop_plasma.py: real-time plasma effect rendered by a CUDA kernel directly into an OpenGL PBO, displayed via pyglet.New Public API
Files Changed
_graphics.pyx/_graphics.pxdGraphicsResourceandGraphicsRegisterFlags_cpp/resource_handles.cpp/.hppGraphicsResourceHandlecreation +cuGraphicsUnregisterResourcefunction pointer_resource_handles.pxd/.pyx__init__.pyGraphicsResourceandGraphicsRegisterFlagstests/test_graphics.pyexamples/gl_interop_plasma.pypixi.toml/pixi.lockpyglettest dependencyScreenshot