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