1// Copyright (c) 2018-2020 NVIDIA Corporation 2// 3// SPDX-License-Identifier: CC-BY-4.0 4 5include::{generated}/meta/{refprefix}VK_NV_ray_tracing.adoc[] 6 7=== Other Extension Metadata 8 9*Last Modified Date*:: 10 2018-11-20 11*Interactions and External Dependencies*:: 12 - This extension requires 13 {spirv}/NV/SPV_NV_ray_tracing.html[`SPV_NV_ray_tracing`] 14 - This extension provides API support for 15 {GLSLregistry}/nv/GLSL_NV_ray_tracing.txt[`GL_NV_ray_tracing`] 16*Contributors*:: 17 - Eric Werness, NVIDIA 18 - Ashwin Lele, NVIDIA 19 - Robert Stepinski, NVIDIA 20 - Nuno Subtil, NVIDIA 21 - Christoph Kubisch, NVIDIA 22 - Martin Stich, NVIDIA 23 - Daniel Koch, NVIDIA 24 - Jeff Bolz, NVIDIA 25 - Joshua Barczak, Intel 26 - Tobias Hector, AMD 27 - Henrik Rydgard, NVIDIA 28 - Pascal Gautron, NVIDIA 29 30=== Description 31 32Rasterization has been the dominant method to produce interactive graphics, 33but increasing performance of graphics hardware has made ray tracing a 34viable option for interactive rendering. 35Being able to integrate ray tracing with traditional rasterization makes it 36easier for applications to incrementally add ray traced effects to existing 37applications or to do hybrid approaches with rasterization for primary 38visibility and ray tracing for secondary queries. 39 40To enable ray tracing, this extension adds a few different categories of new 41functionality: 42 43 * Acceleration structure objects and build commands 44 * A new pipeline type with new shader domains 45 * An indirection table to link shader groups with acceleration structure 46 items 47 48This extension adds support for the following SPIR-V extension in Vulkan: 49 50 * `SPV_NV_ray_tracing` 51 52include::{generated}/interfaces/VK_NV_ray_tracing.adoc[] 53 54=== New or Modified Built-In Variables 55 56 * <<interfaces-builtin-variables-launchid,code:LaunchIdNV>> 57 * <<interfaces-builtin-variables-launchsize,code:LaunchSizeNV>> 58 * <<interfaces-builtin-variables-worldrayorigin,code:WorldRayOriginNV>> 59 * <<interfaces-builtin-variables-worldraydirection,code:WorldRayDirectionNV>> 60 * <<interfaces-builtin-variables-objectrayorigin,code:ObjectRayOriginNV>> 61 * <<interfaces-builtin-variables-objectraydirection,code:ObjectRayDirectionNV>> 62 * <<interfaces-builtin-variables-raytmin,code:RayTminNV>> 63 * <<interfaces-builtin-variables-raytmax,code:RayTmaxNV>> 64 * <<interfaces-builtin-variables-instancecustomindex,code:InstanceCustomIndexNV>> 65 * <<interfaces-builtin-variables-instanceid,code:InstanceId>> 66 * <<interfaces-builtin-variables-objecttoworld,code:ObjectToWorldNV>> 67 * <<interfaces-builtin-variables-worldtoobject,code:WorldToObjectNV>> 68 * <<interfaces-builtin-variables-hitt,code:HitTNV>> 69 * <<interfaces-builtin-variables-hitkind,code:HitKindNV>> 70 * <<interfaces-builtin-variables-incomingrayflags,code:IncomingRayFlagsNV>> 71 * (modified)code:PrimitiveId 72 73=== New SPIR-V Capabilities 74 75 * <<spirvenv-capabilities-table-RayTracingNV, code:RayTracingNV>> 76 77=== Issues 78 791) Are there issues? 80 81*RESOLVED*: Yes. 82 83=== Sample Code 84 85Example ray generation GLSL shader 86 87[source,c] 88---- 89#version 450 core 90#extension GL_NV_ray_tracing : require 91layout(set = 0, binding = 0, rgba8) uniform image2D image; 92layout(set = 0, binding = 1) uniform accelerationStructureNV as; 93layout(location = 0) rayPayloadNV float payload; 94 95void main() 96{ 97 vec4 col = vec4(0, 0, 0, 1); 98 99 vec3 origin = vec3(float(gl_LaunchIDNV.x)/float(gl_LaunchSizeNV.x), float(gl_LaunchIDNV.y)/float(gl_LaunchSizeNV.y), 1.0); 100 vec3 dir = vec3(0.0, 0.0, -1.0); 101 102 traceNV(as, 0, 0xff, 0, 1, 0, origin, 0.0, dir, 1000.0, 0); 103 104 col.y = payload; 105 106 imageStore(image, ivec2(gl_LaunchIDNV.xy), col); 107} 108---- 109 110=== Version History 111 112 * Revision 1, 2018-09-11 (Robert Stepinski, Nuno Subtil, Eric Werness) 113 ** Internal revisions 114 * Revision 2, 2018-10-19 (Eric Werness) 115 ** rename to VK_NV_ray_tracing, add support for callables. 116 ** too many updates to list 117 * Revision 3, 2018-11-20 (Daniel Koch) 118 ** update to use InstanceId instead of InstanceIndex as implemented. 119