Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

NVIDIA OpenGL and Vulkan Support for 2017

2,316 views

Published on

Learn how NVIDIA continues improving both Vulkan and OpenGL for cross-platform graphics and compute development. This high-level talk is intended for anyone wanting to understand the state of Vulkan and OpenGL in 2017 on NVIDIA GPUs. For OpenGL, the latest standard update maintains the compatibility and feature-richness you expect. For Vulkan, NVIDIA has enabled the latest NVIDIA GPU hardware features and now provides explicit support for multiple GPUs. And for either API, NVIDIA's SDKs and Nsight tools help you develop and debug your application faster.

NVIDIA booth theater presentation at SIGGRAPH in Los Angeles, August 1, 2017.

http://www.nvidia.com/object/siggraph2017-schedule.html?id=sig1732

Get your SIGGRAPH driver release with OpenGL 4.6 and the latest Vulkan functionality from
https://developer.nvidia.com/opengl-driver

Published in: Technology
  • Be the first to comment

NVIDIA OpenGL and Vulkan Support for 2017

  1. 1. Mark Kilgard, August 1 SIGGRAPH 2017, Los Angeles NVIDIA OpenGL and Vulkan Support in 2017
  2. 2. 2 Mark Kilgard • Principal System Software Engineer OpenGL driver and API evolution Cg (“C for graphics”) shading language GPU-accelerated path rendering & web browser rendering • OpenGL Utility Toolkit (GLUT) implementer • Specified and implemented much of OpenGL • Author of OpenGL for the X Window System • Co-author of Cg Tutorial • Worked on OpenGL for over 25 years My Background
  3. 3. 3 Focus
  4. 4. 4 Focus 1.0 + extensions4.6 + extensions
  5. 5. 5 Khronos announces OpenGL 4.6 with SPIR-V support Monday
  6. 6. 6 NVIDIA posts OpenGL 4.6 the same day
  7. 7. 7 NVIDIA’s OpenGL Leverage Debugging with Nsight Programmable Graphics Android & SHIELD Quadro OptiX GeForce Adobe Creative Cloud Embedded Projects
  8. 8. 8 OpenGL Codebase Leverage Same driver code base supports multiple APIs OpenGL for Embedded, Mobile, and Web Multi-vendor, explicit, low-level graphics from Khronos
  9. 9. 9 NVIDIA’s Shading Compiler Even More Leveraged Various Direct3D versions3D APIs based on NVIDIA OpenGL driver code base NVIDIA Shading Compiler code base Apple’s proprietary graphics API Proprietary console API
  10. 10. 10 For those tracking birthdays... Then celebrating OpenGL 4.3 Now celebrating OpenGL 4.6
  11. 11. 11 Introducing OpenGL 4.6 • Big feature: SPIR-V support required • SPIR-V = standard intermediate language for parallel compute and graphics • Vulkan 1.0 standard requires expressing SPIR-V • Allows content creators to simplify their shader authoring and management pipelines • Previously this was an optional ARB extension, not required for 4.5 • Includes NEW ARB_spirv_extensions to SPIR-V support • Genius of AND: OpenGL 4.6 allows either GLSL or SPIR-V, your choice • Technically, NVIDIA’s Vulkan 1.0 allows use GLSL directly via an extension • Additional new ARB extensions bundled in OpenGL 4.6 for • Improving performance • Improving rendering quality • Resolving outstanding Intellectual Property (IP) issues support built-in
  12. 12. 12 What OpenGL 4.6 Packages Together • OpenGL evolves by bundling extensions as a core version update • OpenGL 4.6 = everything in 4.5 plus these extensions • ARB_indirect_parameters • ARB_pipeline_statistics_query • ARB_polygon_offset_clamp • KHR_no_error • ARB_shader_atomic_counter_ops (just extends OpenGL Shading Language) • ARB_shader_draw_parameters • ARB_shader_group_vote (just extends OpenGL Shading Language) • ARB_gl_spirv • ARB_spirv_extensions • ARB_texture_filter_anisotropic • ARB_transform_feedback_overflow_query • Now you can code for this functionality without ARB or EXT suffixing! Technically the one “brand new” extension; other 4.6 functionality already proven & public
  13. 13. 13 OpenGL extension exposing Khronos intermediate language for parallel compute and graphics Khronos extension for OpenGL + SPIR-V ARB extension announced last year July 22, 2016 Allows compiled SPIR-V code to be passed directly to OpenGL driver Accepts SPIR-V output from open source Glslang Khronos Reference compiler https://github.com/KhronosGroup/glslang Other compilers can target SPIR-V too Khronos standard extension ARB_gl_spirv +
  14. 14. 14 SPIR-V Ecosystem LLVM Third party kernel and shader Languages •SPIR-V •Khronos defined and controlled cross-API intermediate language •Native support for graphics and parallel constructs •32-bit Word Stream •Extensible and easily parsed •Retains data object and control flow information for effective code generation and translation OpenCL C++OpenCL C GLSL Khronos has open sourced these tools and translators IHV Driver Runtimes Other Intermediate Forms SPIR-V Validator SPIR-V (Dis)Assembler LLVM to SPIR-V Bi-directional Translator Khronos plans to open source these tools soon https://github.com/KhronosGroup/SPIR/tree/spirv-1.1 Open source C++ front-end released HLSL Khronos has open sourced these tools and translators Khronos plans to open source these tools soon Khronos has open sourced these tools and translators HLSL Khronos plans to open source these tools soon Khronos has open sourced these tools and translators GLSLHLSL Khronos plans to open source these tools soon Khronos has open sourced these tools and translators OpenCL C GLSLHLSL Khronos plans to open source these tools soon Khronos has open sourced these tools and translators OpenCL C++OpenCL C GLSLHLSL Khronos plans to open source these tools soon Khronos has open sourced these tools and translators LLVM to SPIR-V Bi-directional Translator OpenCL C++OpenCL C GLSLHLSL Khronos plans to open source these tools soon Khronos has open sourced these tools and translators SPIR-V Validator LLVM to SPIR-V Bi-directional Translator OpenCL C++OpenCL C GLSLHLSL Khronos plans to open source these tools soon Khronos has open sourced these tools and translators SPIR-V (Dis)Assembler SPIR-V Validator LLVM to SPIR-V Bi-directional Translator OpenCL C++OpenCL C GLSLHLSL Khronos plans to open source these tools soon Khronos has open sourced these tools and translators OpenGL support NEW with ARB_gl_spirv Standard in OpenGL 4.6
  15. 15. 15 ARB_gl_spirv •This extension announced SIGGRAPH 2016 • But was optional • NVIDIA’s SIGGRAPH driver last year immediately provided support •Much more useful to have core part of OpenGL 4.6 •And NOW it is!
  16. 16. 16 Driver Pre-OpenGL 4.6 GLSL Compilation of Text Based Shaders shader.vert shader.geom shader.frag GPU GLSL Compiler Front-end GPU-specific Compiler Back-end your run-time process hardware your app
  17. 17. 17 Driver your app GLSL Compiler Front-end OpenGL 4.6 Offline Compilation of GLSL to SPIR-V GPU shader.vert shader.geom shader.frag shader.vert.spv shader.geom.pv shader.frag.spv glslangValidator or glslc GPU-specific Compiler Back-end SPIR-V Compiler Front-end your run-time processbuild-time compilation hardware
  18. 18. 18 Use OpenGL 4.6 SPIR-V Support as Your Bridge to Vulkan • Thinking about Vulkan? Realizing it’s a major, involved transition? • Consider making your transition in steps • First transition GLSL text shaders to SPIR-V binary shaders with OpenGL 4.6 • Then move to Vulkan API
  19. 19. 19 Driver your app GLSL Compiler Front-end OpenGL 4.6 Transition to Offline Compilation of GLSL to SPIR-V GPU shader.vert shader.geom shader.frag shader.vert.spv shader.geom.pv shader.frag.spv glslangValidator or glslc GPU-specific Compiler Back-end SPIR-V Compiler Front-end your run-time processbuild-time compilation hardware
  20. 20. 20 Driver Vulkan Offline Compilation of GLSL to SPIR-V your app GPU shader.vert shader.geom shader.frag shader.vert.spv shader.geom.pv shader.frag.spv glslangValidator or glslc GPU-specific Compiler Back-end SPIR-V Compiler Front-end your run-time processbuild-time compilation hardware
  21. 21. 21 API Usage Differences: Compiling GLSL vs. SPIR-V glCreateProgram glShaderSource glCompileShader glAttachShader glCreateShader glLinkProgram glGetUniformLocation glGetAttribLocation Read GLSL text from file glUseProgram glProgramUniform* while more shader domains while more uniforms to introspect while more attributes to introspect pre-4.6
  22. 22. 22 API Usage Differences: Compiling GLSL vs. SPIR-V glCreateProgram glShaderBinary glSpecializeShader glAttachShader glCreateShader glLinkProgram Read SPIR-V binary blob from file glUseProgram glProgramUniform* while more shader domains while more uniforms to initialize app assume locations assigned within the shader, obviating dynamic introspection 4.6 or ARB_gl_spirv
  23. 23. 23 ARB_spirv_extensions • Only extension rolled into OpenGL 4.6 that is truly new • Motivation • Lots of established OpenGL extensions have accompanying GLSL support • Example: extension adds new GLSL functions • 2016 version of SPIR-V just supported GLSL functionality of core OpenGL 4.5 • ARB_spirv_extensions to the rescue! • Provides a list of SPIR-V extensions • Such extensions indicate SPIR-V support available for one (or more) OpenGL extensions requiring GLSL support
  24. 24. 24 NVIDIA Provides Complete SPIR-V Extensions SPIR-V Extension Name Corresponding OpenGL extension or functionality NVIDIA Support SPV_KHR_shader_ballot ARB_shader_ballot SPV_KHR_shader_draw_parameters ARB_shader_draw_parameters SPV_KHR_subgroup_vote ARB_shader_group_vote SPV_NV_stereo_view_rendering NV_stereo_view_rendering SPV_NV_viewport_array2 NV_viewport_array2 or ARB_shader_viewport_layer_array SPV_NV_geometry_shader_passthrough NV_geometry_shader_passthrough SPV_NV_sample_mask_override_coverage NV_sample_mask_override_coverage SPV_KHR_shader_atomic_counter_ops ARB_shader_atomic_counter_ops SPV_KHR_post_depth_coverage ARB_post_depth_coverage SPV_KHR_storage_buffer_storage_class Storage buffer support
  25. 25. 25 OpenGL 4.6 Fully Realizes “AZDO” Vision AZDO = Approaching Zero Driver Overhead Culmination of a multi-year effort to integrate a succession extensions into core OpenGL for minimizing OpenGL driver head is now complete ARB_indirect_parameters & ARB_shader_draw_parameters now core in OpenGL 4.6
  26. 26. 26 OpenGL 4.6 Adds More “Approaching Zero Driver Overhead” (AZDO) Goodness Frustrated GPU due to slow feeding from the CPU Happy confident GPU feeding herself ARB_indirect_parameters & ARB_shader_draw_parameters now core in OpenGL 4.6 Teach your GPU to feed itself with OpenGL 4.6’s multi draw indirect count
  27. 27. 27 OpenGL 4.6 Features for Better Rendering Quality •Anisotropic texture filtering • Improves texture filtering quality • Intellectual Property (IP) issues resolved • Compatible with existing multi-vendor extension •Polygon offset clamp • Better control of depth bias • Improve rendering quality for techniques depending on polygon offset Conventional texture filtering blurry in distance Anisotropic filtering stays sharp in distance silhouette hidden surface removal co-planar geometry improving shadow mapping
  28. 28. 28 Loose Ends Now Resolved in OpenGL 4.6 • ARB_shader_atomic_counter_ops — Atomic shader counter operations now complete • ARB_shader_group_vote — Groups of graphics shaders can collectively vote • Better performance through managing “herd behavior” • KHR_no_error — Contexts can request driver skip error checks for performance • ARB_transform_feedback_overflow_query • GPU can report when streaming vertices overflows a transform feedback buffer • ARB_pipeline_statistics_query — now pipeline statistic queries are standard • GPU can now report crucial # of rendering operations performed
  29. 29. 29 Available Pipeline Query Statistics Query token Queried statistic GL_VERTICES_SUBMITTED # of vertices issued to OpenGL GL_PRIMITIVES_SUBMITTED # of primitives issued to OpenGL GL_VERTEX_SHADER_INVOCATIONS # of times a vertex shader invoked GL_TESS_CONTROL_SHADER_PATCHES # of times a tessellation control shader invoked GL_TESS_EVALUATION_SHADER_INVOCATIONS # of times a tessellation evaluation shader invoked GL_GEOMETRY_SHADER_INVOCATIONS # of times a geometry shader invoked GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED # of primitives that entered primitive clipping GL_FRAGMENT_SHADER_INVOCATIONS # of times a fragment shader invoked GL_COMPUTE_SHADER_INVOCATIONS # of times a compute shader invoked GL_CLIPPING_INPUT_PRIMITIVES # of primitives that entered primitive clipping GL_CLIPPING_OUTPUT_PRIMITIVES # of primitives that output by primitive clipping
  30. 30. 30 Why OpenGL Core Updates are Important (1) • Not just opportunity for new functionality • A new specification reconciles all the bundled extensions into coherent single document • Also lets OpenGL Working Group better structure OpenGL’s specification • Future extensions can then be written against a cleanly resolved 4.6 specification • Ensures new functionality is covered by the Khronos Intellectual Property (IP) Framework • OpenGL implementers, developers, and end-users can confidently depend on the functionality described • Specifically for 4.6, resolves Intellectual Property concerns for both anisotropic texture filtering and polygon offset clamping • Khronos maintains OpenGL, ES, and Vulkan in the same “IP zone”—so ratifying a Khronos standard resolves issues for related standards Coherent Specification Resolving IP Concerns
  31. 31. 31 Why OpenGL Core Updates are Important (2) •Not just opportunity for new functionality •Opportunity to update Conformance Test Suite (CTS) • New tests obviously cover NEW functionality • OpenGL 4.6 covers both NEW functionality + stricter coverage of EXISTING functionality •Developers adopt OpenGL features at different levels of comfort • Many developers are happy to use the latest, greatest features as soon as extensions are shipped in drivers • Other developers, often those with long-term support horizons, look for core updates to signal mature standards now ready to be adopted Conformance Testing QualitySheriff Developer Comfort Levels
  32. 32. 32 Why OpenGL Core Updates are Important (3) • Not just opportunity for new functionality • OpenGL Shading Language (GLSL) gets accompanying revision • So OpenGL 4.6 brings with it an updated GLSL • Like the core API specification, the GLSL specification needs reconciliation of new extensions, typos fixed, clarifications, etc. • As many Vulkan applications express shaders in GLSL and compile them with glslang to generate the SPIR-V that Vulkan expects, updating GLSL helps advance Vulkan • OpenGL core revisions as much about consolidating OpenGL’s associated ecosystem support as adding NEW features to OpenGL Advancing the Ecosystem
  33. 33. 33 OpenGL 4.6’s Resolving of IP Issues & New Open Sourcing of OpenGL Conformance Suite Benefits Open Source OpenGL Implementation • Khronos using Vulkan’s conformance approach for OpenGL now • See https://github.com/KhronosGroup/VK-GL-CTS • Should help Mesa keep closer to latest official standard, better for OpenGL overall "OpenGL 4.6 will be the first OpenGL release where conformant open source implementations based on the Mesa project will be deliverable in a reasonable timeframe after release. The open sourcing of the OpenGL conformance test suite and ongoing work between Khronos and X.org will also allow for non-vendor led open source implementations to achieve conformance in the near future.“ David Airlie, senior principal engineer at Red Hat, and developer on Mesa / X.org projects Source: Khronos OpenGL 4.6 press release
  34. 34. 34 Credit for OpenGL 4.6 • Khronos relies on its member companies to complete new OpenGL core updates • Different companies drove different features, all free to comment and contribute • Reps of these companies primarily drove the constituent features of OpenGL 4.6 See Appendix J of OpenGL 4.6 for comprehensive list of contributor companies and individuals
  35. 35. 35 GLEW Support Available NOW • GLEW = The OpenGL Extension Wrangler Library Open source library Pre-built distribution: http://glew.sourceforge.net/ Source code: https://github.com/nigels-com/glew Your one-stop-shop for API support for all OpenGL extension APIs • Now released GLEW 2.1 (July 31, 2017) provides complete API support for OpenGL 4.6 • Plus supports Multi-vendor EXT interoperability extensions All of NVIDIA’s Maxwell & Pascal extensions All other NVIDIA multi-GPU generation initiatives Examples: NV_path_rendering, NV_command_list, NV_gpu_multicast Thanks to Nigel Stewart, GLEW maintainer, for this
  36. 36. 36 Miscellaneous NEW Extensions for 2017 • NV_blend_minmax_factor, based on AMD_blend_minmax_factor • EXT_protected_textures (Tegra & ES only) • Used with EGL’s EGL_EXT_protected_content • Basis of Android 7.0’s secure texture video playback
  37. 37. 37 NVIDIA OpenGL in 2017 Provides OpenGL’s Maximally Available Superset OpenGL 4.6 Pascal Extensions 2015 ARB extensions OpenGL 4.5 Core Maxwell Extensions Legacy EXT & Other Compatibility Extensions OpenGL Complete Compatibility Path Rendering Multi-GPU. SLI Approaching Zero Driver Overhead NVIDIA Multi-generation GPU Initiatives DirectX inter-op Vulkan inter-op ES Enhancements Full OpenGL ES 3.2 Khronos Standard Expected Compatibility NVIDIA Initiatives GPU Generation Features
  38. 38. 38 Open Source Efforts for Linux Graphics & OpenGL from NVIDIA •NVIDIA contributes to improve graphics support for entire Linux ecosystem •Examples • GL Vendor-Neutral Dispatch (GLVND) • arbitrates vendor-neutral access to OpenGL and EGL/GLX APIs • Wayland support for EGL Streams • Video Decode and Presentation API for Unix (VDPAU) • complete solution for decoding, post-processing, compositing, and displaying compressed or uncompressed video streams •All open source projects
  39. 39. 39 GLVND: GL Vendor-Neutral Dispatch library • libglvnd • Arbitrates OpenGL API calls between multiple vendors • Multiple drivers from different vendors to coexist on the same file system • Determines which vendor to dispatch each API call to at runtime • Both GLX and EGL are supported • Any combination with OpenGL and OpenGL ES (1.1, 2.0, 3.x) • NVIDIA open source contribution • https://github.com/NVIDIA/libglvnd
  40. 40. 40 Before GLVND NVIDIA Proprietary Linux Driver Mesa + Nouveau I control OpenGL best on NVIDIA GPUs But I got here first! Drivers driving you crazy! I just want my Linux window system to start! pre-GLVND user
  41. 41. 41 GLVND Architecture libOpenGL mapi/glapi libGLdispatch libGLX libGL X11 Server GLX_EXT_libglnvd extension GLX_vendor GLX_vendor2 OpenGL or ES Application
  42. 42. 42 NVIDIA’s Support for Wayland • Wayland • Intended as simpler replacement for X Window System • A protocol for a compositor to talk to its clients • Plus the C library implementation of that protocol • Depends on a compositor (e.g. Weston) that is the display server • Supports varying window managers (e.g. Mutter for Gnome) • Wayland is supported on NVIDIA GPUs through EGL Streams • Using NVIDIA’s Proprietary OpenGL driver performance & quality • Both Weston and Mutter (used by gnome-shell) currently have EGL Stream support • Although not by default • See https://github.com/NVIDIA/egl-wayland • NVIDIA open source project
  43. 43. 43 Latest VDPAU Support •Video Decode and Presentation API for Unix (VDPAU) • https://www.freedesktop.org/wiki/Software/VDPAU/ •Now for latest NVIDIA GPUs (GeForce 1080, etc.) • Supports VDPAU Feature Set H • Hardware-accelerated decoding of 8192x8192 (8k) H.265/HEVC video streams • Full support of HEVC Main12 profile VDPAU Data Flow
  44. 44. 44
  45. 45. 45 What is Vulkan? •Modern explicit API for GPU programming • Open standard, cross-platform, multi-vendor • 3D Graphics + Compute for modern era of GPUs • NOT backward compatible with OpenGL •Motivations • Multi-thread / multi-core friendly • Greatly reduce CPU overhead, for both application & driver • Same API for desktop and mobile use • More predictable performance •Announced February 2016 • How are we doing 18 months in?
  46. 46. 46 Vulkan Extensions Supported by NVIDIA • NVIDIA Vulkan driver already supports 50+ extensions, primarily multi-vendor KHR_swapchain KHR_16bit_storage KHR_bind_memory2 KHR_descriptor_update_template KHR_dedicated_allocation KHR_get_memory_requirements2 KHR_image_format_list KHR_maintenance1 KHR_maintenance2 KHR_push_descriptor KHR_relaxed_block_layout KHR_sampler_mirror_clamp_to_edge KHR_sampler_ycbcr_conversion KHR_shader_draw_parameters KHR_storage_buffer_storage_class KHR_external_memory KHR_external_memory_win32 KHR_external_semaphore KHR_external_semaphore_win32 KHR_win32_keyed_mutex KHR_external_fence KHR_external_fence_win32 KHR_variable_pointers KHX_device_group KHX_external_memory KHX_external_memory_win32 KHX_external_semaphore KHX_external_semaphore_win32 KHX_external_fence KHX_external_fence_win32 KHX_multiview KHX_win32_keyed_mutex KHX_subgroup EXT_blend_operation_advanced EXT_discard_rectangles EXT_sampler_filter_minmax EXT_shader_subgroup_ballot EXT_shader_subgroup_vote NV_clip_space_w_scaling NV_dedicated_allocation NV_external_memory NV_external_memory_win32 NV_fill_rectangle NV_fragment_coverage_to_color NV_framebuffer_mixed_samples NV_glsl_shader NV_win32_keyed_mutex NV_sample_locations NV_sample_mask_override_coverag e NV_viewport_array2 NV_viewport_swizzle NV_geometry_shader_passthrough NVX_device_generated_commands NVX_multiview_per_view_attributes
  47. 47. 47 NVIDIA Vulkan in 2017 Provides Vulkan’s Maximally Available Superset Pascal Extensions Maxwell Extensions OpenGL compatibility NVIDIA Multi-generation GPU Initiatives Khronos Standard NVIDIA Initiatives GPU Generation Features Khronos Vulkan Extensions (KHR) Broad VkPhysicalDevice- Features Vulkan 1.0 Device Generated Commands Multi-vendor Multi-vendor (EXT) Efforts advanced blending common shader features Interop Multi-GPU etc.
  48. 48. 48 NVIDIA’s Vulkan Exposes Extensions for Multi-vendor, Maxwell, & Pascal Features in 2017 Multiply Difference Linear Dodge High-quality 2D shape rendering VK_NV_sample_mask_override_coverage & VK_NV_framebuffer_mixed_samples Advanced blend modes via EXT_blend_operation_advanced Two examples
  49. 49. 49 • Different from implicit multi-GPU for OpenGL and Direct3D, multi-GPU in Vulkan is explicit • Idea is application controls multi-GPU operation for most efficient operation • Use VK_KHX_device_group and VK_KHX_device_group_creation • Multiple Physical Devices is referenced by a single Logical Device New Multi GPU Support for Vulkan Logical Resources/Memory Command Queues Pipelines Bindings Physical Device Group
  50. 50. 50 Device-Generated Commands for Vulkan • Think of a step beyond AZDO (Approaching Zero Driver Overhead) • Not only can the GPU build variable geometry batches to feed itself • Also GPU can even generate its own commands to feed with the geometry! • Available today with experimental Vulkan extension NVX_device_generated_commands Draw indirect # primitives # instances Multi Draw Indirect multiple draws at different index/vertex offsets OpenGL’s NV_command_list & Vulkan’s vkCmdDrawIndirect Change shader inputs for each draw call VK_NVX_device_- generated_commands Change pipeline state per draw
  51. 51. 51 GPU API Interoperability Video Decode and Presentation API for Unix VDPAU
  52. 52. 52 GPU “Interop” Usage •Increasingly applications want to share GPU resources and mix APIs • Typically sophisticated applications •APIs involved might be • Graphics (OpenGL, Vulkan, Direct3D) • Compute (OpenCL, CUDA) • Video encode and decode (VDAPU, NVENC, NVDEC, Windows Media) •Multiple motivations for cross-process GPU resource sharing • Performance (don’t read back to CPU), latency control (VR compositing) • Robustness (isolation) • Security, including protecting digital media assets •Interop = jargon for two things • Sharing GPU resources among different APIs • Sharing GPU resources across process boundaries • For example, a display compositor
  53. 53. 53 Past Interop Extensions for OpenGL •Past interoperability extensions would pair OpenGL concepts to those of another one particular GPU API • Often exposed as proprietary extensions • Typically tied to platform concepts (e.g. Win32 HANDLEs) • Simple when API concepts match (e.g. OpenGL textures to Direct3D Surfaces) •Examples • NV_DX_interop mixed OpenGL and Direct3D 9 • NV_DX_interop2 mixes OpenGL and Direct3D 10 & 11 • NV_vdpau_interop mixes OpenGL and Linux VDAPAU video input/output surfaces • Additionally, CUDA & OpenCL have interop to OpenGL •Worked well as designed BUT...
  54. 54. 54 Responding to New Interop Requirements • Addressing criticism of prior interop extensions... • In many cases, single-vendor and proprietary extensions • Can we strive for something multi-vendor? • Overcoming NEW Managed vs. Explicit GPU API philosophy mismatches • Older GPU APIs (e.g. OpenGL, Direct3D 9,10,11) manage GPU resources and their underlying memory as one • Older APIs have textures, buffers, and synchronization objects • New GPU APIs (e.g. Vulkan, Direct3D 12) uses lower-level mechanisms to manage resources • Newer explicit APIs have explicit memory allocations and semaphores • Noticeable lack of common interop infrastructure • Can there be some common framework for interop • Isolate platform-specific methods to “import” objects into platform-specific extension • Windows uses HANDLEs, etc. • POSIX operating systems use file descriptors
  55. 55. 55 Vulkan Interop Extensions •VK_KHR_external_memory •Allows Vulkan to export or import handles of underlying resources •Follows normal memory aliasing rules – with some strict exceptions Device/Instance Memory Allocation Resource (buffer/image) VK_KHR_external_memory External Resource Device/Instance
  56. 56. 56 OpenGL Provides GL_EXT_memory_object & GL_EXT_semaphore • Vulkan introduces explicit memory and synchronization objects • GL_EXT_memory_object imports Vulkan explicit memory objects to OpenGL • GL_EXT_semaphore imports Vulkan semaphore objects to OpenGL • Extra interop mechanisms need to share GPU objects due to this • Platform-specific extensions specify how to import memory objects & semaphores • For POSIX systems (e.g. Linux), use GL_EXT_memory_object_fd & GL_EXT_sempahore_fd • fd = POSIX file descriptor • For Windows, use GL_EXT_memory_object_win32 & GL_EXT_semaphore_win32 • Uses either Win32’s opaque HANDLE type or KMT share handle • KMT = Kernel-Mode Thunk interface for Windows Display Driver Model (WDDM) • Also for interoperability with Direct3D 11 & 12 • Also EXT_win32_keyed_mutex provides access to the keyed synchronization primitive of Direct3D image objects
  57. 57. 57 OpenGL’s GL_EXT_semaphore • Introduces new object matching Vulkan-style semaphores • Basic operations on semaphores • Object management • glGenSemaphoresEXT generates semaphore object names • glDeleteSemaphoresEXT deletes semaphore objects • Parameter setting & querying • glSemaphoreParameterui64vEXT & GetSemaphoreParameterui64vEXT • Semaphore parameters are platform dependent (e.g. GL_D3D12_FENCE_VALUE_EXT) • Semaphore operations • glSignalSemaphoreEXT signals a semaphore • glWaitSemaphoreEXT waits until something signals the semaphore
  58. 58. 58 OpenGL’s GL_EXT_memory_object • Introduces new memory object corresponding to Vulkan concept • Import memory objects with platform-specific API • Then “carve out” managed OpenGL textures and buffers from a memory object • Commands to make textures: glTexStorageMem1DEXT, glTexStorageMem2DEXT, glTexStorageMem3DEXT, glTexStorageMem2DMultisampleEXT, glTexStorageMem3DMultisampleEXT • Also Direct State Access (DSA) versions: glTextureStorageMem2DEXT, etc. • Commands to carve out a buffer: glBufferStorageMemEXT, glNamedBufferStorageMemEXT
  59. 59. 59 Last Words •OpenGL 4.6 now on NVIDIA GPUs • Zero-day driver, available on announce day • SPIR-V now core feature of OpenGL • Best OpenGL yet •NVIDIA supports open source graphics initiatives • GLVND, Wayland EGL stream support, VDPAU •NVIDIA’s Vulkan 1.0 has 50+ extensions • Multi-GPU support • Maxwell & Pascal GPU features now exposed in Vulkan • Device-Generated Commands (DGC) •Interoperability now available for OpenGL and Vulkan
  60. 60. 60 SIGGRAPH Paper Using Vulkan & OpenGL to Check Out • How to make shaders modular without giving up performance • Open source on github • Accompanied by OpenGL and Vulkan demo • Wednesday, 2 August • Los Angeles Convention Center, Room 150/151 • 10:45 am - 12:35 pm

×