SlideShare a Scribd company logo
Michael I Gold NVIDIA Corporation OpenGL Interoperability
What is Interoperability? Share memory objects between APIs or contexts within an API Share within a device, or between devices Implicit or explicit synchronization
Who can play? CUDA OpenCL OpenGL Direct3D
CUDA Interoperability Import OpenGL buffer objects as CUDA device pointers Read or write buffer memory directly from a kernel Implicit synchronization within a CPU thread Texture support coming soon
CUDA Interop: Example Application OpenGL driver CUDA driver Quadro or GeForce display Tesla or GeForce Interop fast Multi-card interop fastest with GL on Quadro. Transfer between cards w/o CPU intervention GeForce performs indirect copy, functional but slower Interop faster
CUDA example: Initalization // Create a GL buffer object glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffer); glBufferData(GL_PIXEL_UNPACK_BUFFER, buffer_size, NULL, GL_STREAM_COPY); // Register the buffer object for CUDA interop cuGLRegisterBufferObject(buffer); cuGLSetBufferObjectMapFlags(buffer, CU_GL_MAP_RESOURCE_FLAGS_WRITE_DISCARD);
CUDA example: Per-frame usage // map the buffer, invoke a kernel to populate it,  and release it back to OpenGL cuGLMapBufferObjectAsync(&dptr, &size, buffer, stream); call_kernel(dptr, size); cuGLUnmapBufferObjectAsync(&dptr, &size, buffer, stream); // Use the buffer as a pixel buffer object to  populate a texture glTexSubImage2D( … , NULL);
CUDA resources Drivers, Toolkit and SDK http:// www.nvidia.com/cuda Forums http:// forums.nvidia.com
OpenCL Interoperability Analogous to CUDA Create  cl_mem  from textures and buffers Requires explicit synchronization
OpenCL Shared Objects OpenCL 3D image object OpenGL renderbuffer OpenGL buffer OpenCL buffer object OpenGL texture 2D (or cubemap face) OpenGL texture 3D OpenCL 2D image object OpenCL 2D image object clCreateFromGLBuffer clCreateFromGLTexture2D clCreateFromGLTexture3D clCreateFromGLRenderbuffer OpenGL OpenCL
OpenGL Interoperability Copy between image objects 3D memcpy No format conversions Copy between dimensionalities E.g. A slice of a 3D texture and a face of a cubemap are treated equally Copy between GPUs Complements WGL_NV_gpu_affinity
OpenGL Interop: Example Application OpenGL driver OpenGL driver Quadro display Quadro Interop fast Quadro only Transfer between cards, no host copy Rendering window constrained to affinity GPU GPU affinity Offscreen buffer
OpenGL Interop: Usage wglCopyImageSubDataNV( hSrcRC, srcName, srcTarget, srcLevel,  srcX, srcY, srcZ, hDstRC, dstName, dstTarget, dstLevel,  dstX, dstY, dstZ, width, height, depth);
OpenGL Interop: Resources NV_copy_image extension specification http:// developer.download.nvidia.com /  opengl/specs/GL_NV_copy_image.txt NV_gpu_affinity extension specification http:// developer.download.nvidia.com /  opengl/specs/WGL_NV_gpu_affinity.txt
Direct3D Interoperability Import Direct3D buffer and image resources into OpenGL Vertex and Index buffers -> buffer objects Textures and surfaces -> textures and renderbuffers Currently WinXP / Direct3D 9 only Experimental extension WGL_ NVX _DX_interop
Direct3D Interop: Example Application OpenGL driver DX driver Quadro or GeForce display Interop fast OGL can map DX buffers, not the other way Single GPU only (at this time)

More Related Content

PDF
Artyom Shishkin - Printing interception via modifying Windows GDI
PPT
Intercepting Windows Printing by Modifying GDI Subsystem
PDF
Advanced Scenegraph Rendering Pipeline
PPTX
Databases in Qt
PPTX
Open gl introduction
PDF
Getting Started with OpenGL ES
PDF
CUDA by Example : Graphics Interoperability : Notes
PDF
On Space-Scarce Economy In Blockchain Systems
Artyom Shishkin - Printing interception via modifying Windows GDI
Intercepting Windows Printing by Modifying GDI Subsystem
Advanced Scenegraph Rendering Pipeline
Databases in Qt
Open gl introduction
Getting Started with OpenGL ES
CUDA by Example : Graphics Interoperability : Notes
On Space-Scarce Economy In Blockchain Systems

Similar to GTC 2009 OpenGL Gold (20)

PPT
Advanced Graphics Workshop - GFX2011
PDF
Computer Graphics - Lecture 01 - 3D Programming I
PPTX
13th kandroid OpenGL and EGL
PPT
OpenGL ES based UI Development on TI Platforms
PPT
NVIDIA CUDA
PDF
State of the Art OpenGL and Qt
 
PPT
openGL basics for sample program (1).ppt
PPT
openGL basics for sample program.ppt
PDF
VisionizeBeforeVisulaize_IEVC_Final
PPT
Open gl
PPTX
GFX Part 7 - Introduction to Rendering Targets in OpenGL ES
PPTX
Porting the Source Engine to Linux: Valve's Lessons Learned
PDF
A Follow-up Cg Runtime Tutorial for Readers of The Cg Tutorial
PDF
Gdc 14 bringing unreal engine 4 to open_gl
PDF
Convert Your Legacy OpenGL Code to Modern OpenGL with Qt
 
PDF
Power of WebGL (FSTO 2014)
PPT
Vpu technology &gpgpu computing
PPT
Vpu technology &gpgpu computing
PPT
Vpu technology &gpgpu computing
PPTX
Interactive 3D graphics for web with three.js, Andrey Vedilin, DataArt
Advanced Graphics Workshop - GFX2011
Computer Graphics - Lecture 01 - 3D Programming I
13th kandroid OpenGL and EGL
OpenGL ES based UI Development on TI Platforms
NVIDIA CUDA
State of the Art OpenGL and Qt
 
openGL basics for sample program (1).ppt
openGL basics for sample program.ppt
VisionizeBeforeVisulaize_IEVC_Final
Open gl
GFX Part 7 - Introduction to Rendering Targets in OpenGL ES
Porting the Source Engine to Linux: Valve's Lessons Learned
A Follow-up Cg Runtime Tutorial for Readers of The Cg Tutorial
Gdc 14 bringing unreal engine 4 to open_gl
Convert Your Legacy OpenGL Code to Modern OpenGL with Qt
 
Power of WebGL (FSTO 2014)
Vpu technology &gpgpu computing
Vpu technology &gpgpu computing
Vpu technology &gpgpu computing
Interactive 3D graphics for web with three.js, Andrey Vedilin, DataArt
Ad

More from Mark Kilgard (20)

PDF
D11: a high-performance, protocol-optional, transport-optional, window system...
PPT
Computers, Graphics, Engineering, Math, and Video Games for High School Students
PPT
NVIDIA OpenGL and Vulkan Support for 2017
PPT
NVIDIA OpenGL 4.6 in 2017
PPT
NVIDIA OpenGL in 2016
PPT
Virtual Reality Features of NVIDIA GPUs
PPTX
Migrating from OpenGL to Vulkan
PPT
EXT_window_rectangles
PPT
OpenGL for 2015
PPT
Slides: Accelerating Vector Graphics Rendering using the Graphics Hardware Pi...
PDF
Accelerating Vector Graphics Rendering using the Graphics Hardware Pipeline
PPT
NV_path rendering Functional Improvements
PPTX
OpenGL 4.5 Update for NVIDIA GPUs
PPT
SIGGRAPH Asia 2012: GPU-accelerated Path Rendering
PPT
SIGGRAPH Asia 2012 Exhibitor Talk: OpenGL 4.3 and Beyond
PDF
Programming with NV_path_rendering: An Annex to the SIGGRAPH Asia 2012 paper...
PPT
GPU accelerated path rendering fastforward
PDF
GPU-accelerated Path Rendering
PPT
SIGGRAPH 2012: GPU-Accelerated 2D and Web Rendering
PPT
SIGGRAPH 2012: NVIDIA OpenGL for 2012
D11: a high-performance, protocol-optional, transport-optional, window system...
Computers, Graphics, Engineering, Math, and Video Games for High School Students
NVIDIA OpenGL and Vulkan Support for 2017
NVIDIA OpenGL 4.6 in 2017
NVIDIA OpenGL in 2016
Virtual Reality Features of NVIDIA GPUs
Migrating from OpenGL to Vulkan
EXT_window_rectangles
OpenGL for 2015
Slides: Accelerating Vector Graphics Rendering using the Graphics Hardware Pi...
Accelerating Vector Graphics Rendering using the Graphics Hardware Pipeline
NV_path rendering Functional Improvements
OpenGL 4.5 Update for NVIDIA GPUs
SIGGRAPH Asia 2012: GPU-accelerated Path Rendering
SIGGRAPH Asia 2012 Exhibitor Talk: OpenGL 4.3 and Beyond
Programming with NV_path_rendering: An Annex to the SIGGRAPH Asia 2012 paper...
GPU accelerated path rendering fastforward
GPU-accelerated Path Rendering
SIGGRAPH 2012: GPU-Accelerated 2D and Web Rendering
SIGGRAPH 2012: NVIDIA OpenGL for 2012
Ad

Recently uploaded (20)

PDF
cuic standard and advanced reporting.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Cloud computing and distributed systems.
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPT
Teaching material agriculture food technology
PDF
NewMind AI Monthly Chronicles - July 2025
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
A Presentation on Artificial Intelligence
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
cuic standard and advanced reporting.pdf
Review of recent advances in non-invasive hemoglobin estimation
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Building Integrated photovoltaic BIPV_UPV.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Cloud computing and distributed systems.
Understanding_Digital_Forensics_Presentation.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Teaching material agriculture food technology
NewMind AI Monthly Chronicles - July 2025
“AI and Expert System Decision Support & Business Intelligence Systems”
NewMind AI Weekly Chronicles - August'25 Week I
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
A Presentation on Artificial Intelligence
Per capita expenditure prediction using model stacking based on satellite ima...
Dropbox Q2 2025 Financial Results & Investor Presentation
Unlocking AI with Model Context Protocol (MCP)
How UI/UX Design Impacts User Retention in Mobile Apps.pdf

GTC 2009 OpenGL Gold

  • 1. Michael I Gold NVIDIA Corporation OpenGL Interoperability
  • 2. What is Interoperability? Share memory objects between APIs or contexts within an API Share within a device, or between devices Implicit or explicit synchronization
  • 3. Who can play? CUDA OpenCL OpenGL Direct3D
  • 4. CUDA Interoperability Import OpenGL buffer objects as CUDA device pointers Read or write buffer memory directly from a kernel Implicit synchronization within a CPU thread Texture support coming soon
  • 5. CUDA Interop: Example Application OpenGL driver CUDA driver Quadro or GeForce display Tesla or GeForce Interop fast Multi-card interop fastest with GL on Quadro. Transfer between cards w/o CPU intervention GeForce performs indirect copy, functional but slower Interop faster
  • 6. CUDA example: Initalization // Create a GL buffer object glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffer); glBufferData(GL_PIXEL_UNPACK_BUFFER, buffer_size, NULL, GL_STREAM_COPY); // Register the buffer object for CUDA interop cuGLRegisterBufferObject(buffer); cuGLSetBufferObjectMapFlags(buffer, CU_GL_MAP_RESOURCE_FLAGS_WRITE_DISCARD);
  • 7. CUDA example: Per-frame usage // map the buffer, invoke a kernel to populate it, and release it back to OpenGL cuGLMapBufferObjectAsync(&dptr, &size, buffer, stream); call_kernel(dptr, size); cuGLUnmapBufferObjectAsync(&dptr, &size, buffer, stream); // Use the buffer as a pixel buffer object to populate a texture glTexSubImage2D( … , NULL);
  • 8. CUDA resources Drivers, Toolkit and SDK http:// www.nvidia.com/cuda Forums http:// forums.nvidia.com
  • 9. OpenCL Interoperability Analogous to CUDA Create cl_mem from textures and buffers Requires explicit synchronization
  • 10. OpenCL Shared Objects OpenCL 3D image object OpenGL renderbuffer OpenGL buffer OpenCL buffer object OpenGL texture 2D (or cubemap face) OpenGL texture 3D OpenCL 2D image object OpenCL 2D image object clCreateFromGLBuffer clCreateFromGLTexture2D clCreateFromGLTexture3D clCreateFromGLRenderbuffer OpenGL OpenCL
  • 11. OpenGL Interoperability Copy between image objects 3D memcpy No format conversions Copy between dimensionalities E.g. A slice of a 3D texture and a face of a cubemap are treated equally Copy between GPUs Complements WGL_NV_gpu_affinity
  • 12. OpenGL Interop: Example Application OpenGL driver OpenGL driver Quadro display Quadro Interop fast Quadro only Transfer between cards, no host copy Rendering window constrained to affinity GPU GPU affinity Offscreen buffer
  • 13. OpenGL Interop: Usage wglCopyImageSubDataNV( hSrcRC, srcName, srcTarget, srcLevel, srcX, srcY, srcZ, hDstRC, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, width, height, depth);
  • 14. OpenGL Interop: Resources NV_copy_image extension specification http:// developer.download.nvidia.com / opengl/specs/GL_NV_copy_image.txt NV_gpu_affinity extension specification http:// developer.download.nvidia.com / opengl/specs/WGL_NV_gpu_affinity.txt
  • 15. Direct3D Interoperability Import Direct3D buffer and image resources into OpenGL Vertex and Index buffers -> buffer objects Textures and surfaces -> textures and renderbuffers Currently WinXP / Direct3D 9 only Experimental extension WGL_ NVX _DX_interop
  • 16. Direct3D Interop: Example Application OpenGL driver DX driver Quadro or GeForce display Interop fast OGL can map DX buffers, not the other way Single GPU only (at this time)