Vulkan Ray Tracing · 2020. 12. 15. · Ray tracing setup compute workloads can be intensive....

20
This work is licensed under a Creative Commons Attribution 4.0 International License Vulkan Ray Tracing Developer Rollout December 2020 © Khronos ® Group 2020

Transcript of Vulkan Ray Tracing · 2020. 12. 15. · Ray tracing setup compute workloads can be intensive....

  • © The Khronos® Group Inc. 2020 - Page 1This work is licensed under a Creative Commons Attribution 4.0 International License

    Vulkan Ray Tracing Developer Rollout

    December 2020

    © Khronos® Group 2020

    https://creativecommons.org/licenses/by/4.0/

  • © The Khronos® Group Inc. 2020 - Page 2This work is licensed under a Creative Commons Attribution 4.0 International License

    The industry’s first open, cross-vendor, cross-platform standard for ray tracing acceleration

    Extension specifications released November 2020

    Coherent ray tracing framework with flexible merging of rasterization and ray tracing

    Set of extensions to Vulkan, GLSL and SPIR-Vseamlessly integrates ray tracing into Vulkan 1.X

    Familiar to users of existing proprietary ray tracing APIs but also introduces new implementation flexibility

    Hardware agnostic – can be accelerated on existing GPU compute and dedicated ray tracing cores

    Primary focus on meeting desktop market demand for both real-time and offline rendering today – but designed to

    encourage mobile ray tracing too

    Vulkan Ray Tracing

  • © The Khronos® Group Inc. 2020 - Page 3This work is licensed under a Creative Commons Attribution 4.0 International License

    Vulkan Ray Tracing Now Developer Ready!

    March 2020Provisional Extension

    Specifications

    January 2018Vulkan Ray TracingSubgroup Created

    Review and Integration of IHV and Developer Feedback

    Streamline layering of DXR over Vulkan Ray Tracing

    Multiple Usability Tweaks

    November 2020Final Extension Specifications

    Conformance Test Development

    MultipleImplementations

    Added support for Provisional Spec to DXC

    HLSL compiler

    December 2020Vulkan SDK with

    Ray Tracing Updated Samples

    We are here!Rollout of Vulkan SDK, Development

    Tools, Production Drivers and Education Materials

    Vulkan Ray Tracing is ready for developers to use in their applications!

    The LunarG Vulkan SDK now integrates all the components necessary for developers to easily use the new ray tracing

    extensions, such as new shader tool chains, without needing them to be built from multiple repositories, and supports

    ray tracing validation within the SDK validation layershttps://vulkan.lunarg.com/

    https://vulkan.lunarg.com/

  • © The Khronos® Group Inc. 2020 - Page 4This work is licensed under a Creative Commons Attribution 4.0 International License

    Developer Vulkan Ray Tracing Resources

    Production Vulkan Drivers with Vulkan Ray Tracing are shipping

    AMD Radeon Adrenalin 20.11.3 drivers for Radeon RX 6000 Series

    NVIDIA R460 drivers for All RTX GPUs

    GeForce GTX 1660 with 6GB+ of memory GeForce GTX 1060+ with 6GB+ of memory

    Intel Xe-HPG GPUs, available in 2021

    Vulkan Ray Tracing Samples

    Vulkan Ray Tracing Guide

    How to use the Vulkan Ray Tracing extensions

    Exploring deeper technical details of the Vulkan Ray Tracing specifications

    Best practices for blending Vulkan rasterization and ray tracing techniques

    Khronos Member MaterialsDeep dive Vulkan Ray Tracing Tutorial

    How to use Vulkan Ray Tracing toCreate a complete mini-path tracer

    A Vulkan-based glTF ray tracing viewerwith open source on GitHub

    New textbook, and here, on principles and history of ray tracing by Jon Peddie Khronos welcomes developer feedback

    on Vulkan GitHub issues tracker

    https://gpuopen.com/vulkan-ray-tracing-extensions/https://www.nvidia.com/Download/index.aspxhttps://github.com/KhronosGroup/Vulkan-Samples/tree/master/samples#basic-ray-tracinghttps://github.com/KhronosGroup/Vulkan-Guidehttps://www.khronos.org/blog/ray-tracing-in-vulkanhttps://www.khronos.org/blog/vulkan-ray-tracing-final-specification-releasehttps://www.khronos.org/blog/vulkan-ray-tracing-best-practices-for-hybrid-renderinghttps://github.com/nvpro-samples/vk_raytracing_tutorial_KHRhttps://github.com/nvpro-samples/vk_mini_path_tracerhttps://github.com/nvpro-samples/vk_raytracehttps://www.amazon.com/Ray-Tracing-Tool-Jon-Peddie/dp/3030174891https://www.springer.com/gp/book/9783030174897https://github.com/KhronosGroup/Vulkan-Docs/issues

  • © The Khronos® Group Inc. 2020 - Page 5This work is licensed under a Creative Commons Attribution 4.0 International License

    Quake II RTXQuake II RTX 1.4 uses Vulkan Ray Tracing extensions

    The world’s first cross-vendor ray tracing Vulkan applicationSource code available on GitHub. Get it on Steam.

    https://github.com/NVIDIA/Q2RTXhttps://store.steampowered.com/agecheck/app/1089130/

  • © The Khronos® Group Inc. 2020 - Page 6This work is licensed under a Creative Commons Attribution 4.0 International License

    Holochip Light Field Display Rendering

    Blog: how Vulkan Ray Tracing has enabled Holochip to innovate on efficient rendering techniques for light field displays

    Uses Vulkan Ray Tracing to optimize light field rendering at the same rendering cost as producing a single view for that same display

    Horizontal light field on a Looking Glass display

    https://www.khronos.org/blog/holochip-develops-breakthrough-light-field-rendering-api-using-vulkan-ray-tracing

  • © The Khronos® Group Inc. 2020 - Page 7This work is licensed under a Creative Commons Attribution 4.0 International License

    Vulkan Ray Tracing and DXR

    Vulkan Ray Tracing DX12 / DXR

    Ray Tracing PipelinesAt least one

    must be available

    Yes

    Ray Queries DXR Tier 1.1Inline ray tracing

    Language for Ray Tracing Shaders GLSL or HLSL HLSL

    Pipeline Libraries Yes DXR Tier 1.1AddToStateObject()

    Build Acceleration Structure on Host Optional No

    Deferred Host Operations Optional No

    Capture/Replay Support for Tools (e.g., RenderDoc) Optional No

    Straightforward to port code between Vulkan Ray Tracing and DXRIncluding re-use of ray trac ing shaders written in HLSL

  • © The Khronos® Group Inc. 2020 - Page 8This work is licensed under a Creative Commons Attribution 4.0 International License

    Vulkan Ray Tracing and Shading Languages

    HLSL

    Front-end Parsing and Validation

    ASTAbstract Syntax Tree

    DXILBackend

    SPIR-VBackend

    DXILSPIR-V

    DXIL ToolsSPIR-V Tools

    DXCVulkan Ray Tracing includes GLSL and SPIR-V ExtensionsEnabling compiled GLSL/SPIR-V shaders to operate in a Ray Tracing Pipeline – similar to HLSL features used in

    Direct3D’s DXR

    HLSL and Vulkan with DXCMicrosoft’s DXC HLSL compiler was open sourced in Jan 2017Google and others have added SPIR-V code generation to DXC

    with Microsoft’s knowledge and approvalVulkan developers can now choose between GLSL and HLSL!

    HLSL for Vulkan Ray TracingNVIDIA added code generation to DXC to generate SPIR-V for the

    Vulkan Ray Tracing extension from HLSL

    Developers can port HLSL shaders with minimal changes between

    Vulkan Ray Tracing and DXR

  • © The Khronos® Group Inc. 2020 - Page 9This work is licensed under a Creative Commons Attribution 4.0 International License

    API Layering

    Layers Over Vulkan OpenGL OpenCL

    OpenGL ES DX12 DX9-11

    Vulkan Zink clspvclvkGLOVEAngle

    vkd3d-Protonvkd3d

    DXVKWineD3D

    OpenGL gfx-rsAshes Angle WineD3D

    DX12 gfx-rs Microsoft‘GLOn12’Microsoft‘CLOn12’

    MicrosoftD3D11On12

    DX9-11 gfx-rsAshes Angle

    Metal MoltenVKgfx-rsclspv +

    SPIRV-Cross?MoltenGL

    Angle

    E.g.Vkd3d-Proton used to port DX12 titles to

    Linux with Valve Proton

    Vulkan is an effective porting target for multiple APIs e.g., for bringing DX12 games to Linux

    Vulkan Ray Tracing designed to efficient support layered DirectX 12 DXR

    Wine 6.0 will support Vulkan specification version 1.2.162 which includes Vulkan Ray Tracing

    https://www.winehq.org/announce/6.0-rc1

  • © The Khronos® Group Inc. 2020 - Page 10This work is licensed under a Creative Commons Attribution 4.0 International License

    Technical Background

    December 2020

    https://creativecommons.org/licenses/by/4.0/

  • © The Khronos® Group Inc. 2020 - Page 11This work is licensed under a Creative Commons Attribution 4.0 International License

    Step 1: Create Efficient Scene Geometry

    Ray tracing may use a huge numbers of raysSpecialized data structures for interrogating scene geometry are necessary for efficient acceleration

    Acceleration StructuresContains low-level 3D geometry to be ray traced and

    high-level references into the geometryOpaque internal organization details

    Each vendor can optimize for processing for their hardwareE.g., Bounding Volume Hierarchy (BVH) for rapidly

    determining if there is any geometry in the path of a ray

    Build Acceleration StructureVulkan driver integrates supplied geometry

    into its two-level Acceleration StructureUsing a BVH data structure to enable

    effic ient ray trac ing through a 3D scene

  • © The Khronos® Group Inc. 2020 - Page 12This work is licensed under a Creative Commons Attribution 4.0 International License

    Step 2: Traverse Scene with Rays

    Two ways to launch rays into the scene

    Ray Tracing PipelinesA new type of graphics pipeline

    Implicit management of ray intersections Application compiles a set of shaders into the pipeline to

    provide desired ray and material processing

    Ray Queries Any type of shader can launch a ray at any time

    Shader can process intersection data however it wishesShader controls how traversal proceeds

    Ray Generation

    Acceleration Structure Traversal

    Hit?

    Miss Closest Hit

    Intersection

    Any Hit

    YesNo

    1. Launch 2D/3D gr id of rays into scene contained in an Acceleration Structure

    2. ‘Intersection’ Shader computes ray intersections Ray-triangle intersections are built-in

    3. Invoke ‘Any Hit’ Shader if intersection is found. Multiple intersections possible - arbitrary order

    4. Invoke ‘Closest Hit’ shader on the closest intersection of the ray ORInvoke ‘Miss’ Shader if no hit foundCan trace more rays

    Vulkan Ray Tracing Pipeline

  • © The Khronos® Group Inc. 2020 - Page 13This work is licensed under a Creative Commons Attribution 4.0 International License

    Pipeline Libraries

    Ray Tracing Pipelines can use many shadersPotentially orders of magnitude more shaders (1000s) than traditional applications to handle diverse tracing techniques and material types

    Compilation BottleneckCompiling many shaders into a Ray Tracing Pipeline

    can be computationally intensive and cause application bottlenecks and stuttering

    Vulkan Pipeline Library ExtensionEnables a library of SPIR-V shaders to be

    incrementally compiled into an existing Ray Tracing Pipeline saving significant processing load

    Primary Ray + Ambient Light

    Reflection + Direct Local light / Shadow

    Indirect Bounce

    Indirect Sun Light / Shadow

    Multiple shaders used to build complex lighting in a Quake 2 scene

  • © The Khronos® Group Inc. 2020 - Page 14This work is licensed under a Creative Commons Attribution 4.0 International License

    Host Offload of Setup Operations

    Ray tracing setup compute workloads can be intensiveBuilding Acceleration Structures and compiling Ray Tracing Pipelines

    Two Vulkan mechanisms to offload and control setup workloads on the host CPU(s) for smoother, faster rendering

    Build Acceleration Structure on HostUse the host to build Acceleration Structure in host memory and then

    copy to the GPU - rather than build directly on the GPUFinal size of Application Structure is known before copying to the

    GPU - enabling optimized GPU memory allocation

    Deferred Host OperationsDriver returns deferred work handle to application for later executionApplication controls work execution and can chose to distribute onto

    multiple cores and background threads

    Deferred Host Operations can be used to asynchronously use multiple CPU cores to build

    Acceleration Structures on the host

    Using Deferred Host Operations to build a complex Acceleration Structure using

    multiple CPU cores to offload the work from the GPU for faster, smoother framerates

    HOST

    HOST

    GPU

    GPU

  • © The Khronos® Group Inc. 2020 - Page 15This work is licensed under a Creative Commons Attribution 4.0 International License

    Vulkan Background

    December 2020

    https://creativecommons.org/licenses/by/4.0/

  • © The Khronos® Group Inc. 2020 - Page 16This work is licensed under a Creative Commons Attribution 4.0 International License

    3D graphics, XR, parallel programming, vision acceleration

    and machine learning

    Non-profit, member-drivenstandards-defining industry

    consortium

    Open to any interested company

    All Khronos standards are royalty-free

    Well-defined IP Framework protects participant’s intellectual

    propertyFounded in 2000

    >150 Members ~ 40% US, 30% Europe, 30% Asia

    Khronos Connects Software to SiliconOpen interoperability standards to enable software to effectively

    harness the power of multiprocessors and accelerator silicon

  • © The Khronos® Group Inc. 2020 - Page 17This work is licensed under a Creative Commons Attribution 4.0 International License

    Khronos Active Initiatives

    3D GraphicsDesktop, Mobile, Web

    Embedded and Safety Critical

    3D Assets Authoring

    and Delivery

    Portable XRAugmented and Virtual Reality

    Parallel ComputationVision, Inferencing, Machine

    Learning

    Guidelines for creating APIs to streamline system safety certification

  • © The Khronos® Group Inc. 2020 - Page 18This work is licensed under a Creative Commons Attribution 4.0 International License

    Pervasive VulkanDesktop and Mobile GPUs

    http://vulkan.gpuinfo.org/

    Platforms

    Engines

    Embedded

    Android(Android 7.0+)

    (Vulkan 1.1 required on Android Q)

    Desktop Media Players ConsolesApple(via porting

    layers)

    Note: The vers ion of Vulkan available will depend on platform and vendor

    Cloud Services Game StreamingAR and VR

    http://vulkan.gpuinfo.org/

  • © The Khronos® Group Inc. 2020 - Page 19This work is licensed under a Creative Commons Attribution 4.0 International License

    Vulkan Roadmap

    Roadmap DiscussionsRay Tracing

    Variable Rate ShadingAccelerated Video Encode/Decode

    Machine Learning PrimitivesMesh Shaders

    January 2020

    Vulkan 1.1 ExtensionsMaintenance updates plus additional functionality

    Timeline semaphoresDX/HLSL compatibility

    Bindless resourcesReduced precision arithmetic

    Formal memory modelBuffer references

    SPIR-V 1.5

  • © The Khronos® Group Inc. 2020 - Page 20This work is licensed under a Creative Commons Attribution 4.0 International License© Khronos® Group 2020

    Thank you!Any questions?

    https://creativecommons.org/licenses/by/4.0/