Skip to content

Commit 5a4a175

Browse files
alelenvdgkoch
authored andcommitted
Split primitive culling ray flags to separate extension
Fixes vulkan issue #2073 glslang #2169
1 parent f5dd468 commit 5a4a175

4 files changed

Lines changed: 127 additions & 21 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,4 @@ which normatively accepts SPIR-V but does not normatively consume a high-level s
6565
- [GL_EXT_debug_printf](https://github.com/KhronosGroup/GLSL/blob/master/extensions/ext/GLSL_EXT_debug_printf.txt)
6666
- [GL_EXT_ray_tracing](https://github.com/KhronosGroup/GLSL/blob/master/extensions/ext/GLSL_EXT_ray_tracing.txt)
6767
- [GL_EXT_ray_query](https://github.com/KhronosGroup/GLSL/blob/master/extensions/ext/GLSL_EXT_ray_query.txt)
68+
- [GL_EXT_ray_flags_primitive_culling](https://github.com/KhronosGroup/GLSL/blob/master/extensions/ext/GLSL_EXT_ray_flags_primitive_culling.txt)
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
Name
2+
3+
EXT_ray_flags_primitive_culling
4+
5+
Name Strings
6+
7+
GL_EXT_ray_flags_primitive_culling
8+
9+
Contact
10+
11+
Daniel Koch (dkoch 'at' nvidia.com), NVIDIA
12+
13+
Contributors
14+
15+
Ashwin Lele, NVIDIA
16+
Tobias Hector, AMD
17+
18+
Status
19+
20+
Draft
21+
22+
Version
23+
24+
Last Modified Date: 2020-04-01
25+
Revision: 1
26+
27+
Dependencies
28+
29+
This extension can be applied to OpenGL GLSL versions 4.60
30+
(#version 460) and higher.
31+
32+
This extension is written against revision 5 of the OpenGL Shading Language
33+
version 4.60, dated September 4, 2017.
34+
35+
This extension interacts with GL_EXT_ray_tracing.
36+
37+
This extension interacts with GL_EXT_ray_query.
38+
39+
Overview
40+
41+
This extension document modifies GLSL to add additional integer constants
42+
which can be used as ray flags under ray tracing or ray query extensions.
43+
44+
45+
This extension document adds support for the following extensions to be used
46+
within GLSL:
47+
48+
- GL_EXT_ray_flags_primitive_culling -
49+
50+
Mapping to SPIR-V
51+
-----------------
52+
53+
For informational purposes (non-normative), the following is an
54+
expected way for an implementation to map GLSL constructs to SPIR-V
55+
constructs:
56+
57+
gl_RayFlagsSkipTrianglesEXT -> SkipTrianglesKHR ray flag
58+
gl_RayFlagsSkipAABBEXT -> SkipAABBsKHR ray flag
59+
60+
Using this extension defines the <RayTraversalPrimitiveCullingProvisionalKHR>
61+
capability.
62+
63+
Modifications to the OpenGL Shading Language Specification, Version 4.60
64+
65+
Including the following line in a shader can be used to control the
66+
language features described in this extension:
67+
68+
#extension GL_EXT_ray_flags_primitive_culling : <behavior>
69+
70+
where <behavior> is as specified in section 3.3.
71+
New preprocessor #defines are added:
72+
73+
#define GL_EXT_ray_flags_primtive_culling 1
74+
75+
76+
Additions to Chapter 7 of the OpenGL Shading Language Specification
77+
(Built-in Variables)
78+
79+
Modify Section 7.3, Built-in Constants
80+
81+
Add a new subsection 7.3.x, "Fixed Constants"
82+
83+
The following constants are provided in all shader stages when this
84+
extension is enabled
85+
86+
const uint gl_RayFlagsSkipTrianglesEXT = 256U;
87+
const uint gl_RayFlagsSkipAABBEXT = 512U;
88+
89+
90+
Interactions with GL_EXT_ray_tracing/GL_EXT_ray_query
91+
92+
Ray flags added by this extension can be used as flags for 'rayflags'
93+
argument for traceRayEXT()/rayQueryInitializeEXT() call or for comparing
94+
values to gl_IncomingRayFlagsEXT or the result of rayQueryGetRayFlagsEXT.
95+
96+
Issues
97+
98+
TBD
99+
100+
Revision History
101+
102+
Rev. Date Author Changes
103+
---- ----------- ------ -------------------------------------------
104+
1 2019-04-01 alele Initial draft

extensions/ext/GLSL_EXT_ray_query.txt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Status
2222

2323
Version
2424

25-
Last Modified Date: 2020-03-06
26-
Revision: 5
25+
Last Modified Date: 2020-04-01
26+
Revision: 6
2727

2828
Dependencies
2929

@@ -38,6 +38,8 @@ Dependencies
3838

3939
This extension interacts with GLSL_EXT_ray_tracing.
4040

41+
This extension interacts with GLSL_EXT_ray_flags_primitive_culling.
42+
4143
Overview
4244

4345
This extension document modifies GLSL to add support for ray tracing
@@ -69,8 +71,6 @@ Overview
6971
gl_RayFlagsCullFrontFacingTrianglesEXT -> CullFrontFacingTrianglesKHR ray flag
7072
gl_RayFlagsCullOpaqueEXT -> CullOpaqueKHR ray flag
7173
gl_RayFlagsCullNoOpaqueEXT -> CullNoOpaqueKHR ray flag
72-
gl_RayFlagsSkipTrianglesEXT -> SkipTrianglesKHR ray flag
73-
gl_RayFlagsSkipAABBEXT -> SkipAABBsKHR ray flag
7474

7575
gl_RayQueryCommittedIntersectionEXT -> RayQueryCommittedIntersectionKHR enum
7676
gl_RayQueryCandidateIntersectionEXT -> RayQueryCandidateIntersectionKHR enum
@@ -111,11 +111,6 @@ Overview
111111
rayQueryGetIntersectionObjectToWorldEXT -> OpRayQueryGetIntersectionObjectToWorldKHR instruction
112112
rayQueryGetIntersectionWorldToObjectEXT -> OpRayQueryGetIntersectionWorldToObjectKHR instruction
113113

114-
In addition, using this extension defines the <RayQueryProvisionalKHR>
115-
capability.
116-
Using the gl_RayFlagsSkipAABBEXT or gl_RayFlagsSkipTrianglesEXT flags
117-
defines the <RayTraversalPrimitiveCullingProvisionalKHR> capability.
118-
119114
Modifications to the OpenGL Shading Language Specification, Version 4.60
120115

121116
Including the following line in a shader can be used to control the
@@ -211,8 +206,6 @@ Additions to Chapter 7 of the OpenGL Shading Language Specification
211206
const uint gl_RayFlagsCullFrontFacingTrianglesEXT = 32U;
212207
const uint gl_RayFlagsCullOpaqueEXT = 64U;
213208
const uint gl_RayFlagsCullNoOpaqueEXT = 128U;
214-
const uint gl_RayFlagsSkipTrianglesEXT = 256U;
215-
const uint gl_RayFlagsSkipAABBEXT = 512U;
216209

217210
These can be used as flags for the 'rayflags' argument for
218211
traceRayEXT()/rayQueryInitializeEXT() call or for comparing values to
@@ -465,6 +458,12 @@ Interactions with GLSL_EXT_ray_tracing
465458
definitions, and can be enabled by either extension, for use with the
466459
instructions added by that extension.
467460

461+
Interactions with GL_EXT_ray_flags_primitive_culling
462+
463+
If GL_EXT_ray_flags_primitive_culling is supported, ray flags added
464+
by this extension can be used as flags for the 'rayflags' argument
465+
for rayQueryInitializeEXT() call, or the result of rayQueryGetRayFlagsEXT.
466+
468467
Issues
469468

470469
TBD
@@ -478,3 +477,4 @@ Revision History
478477
3 2020-02-12 tobias Updates as per vulkan issue 1989 to better represent mapping to SPIR-V
479478
4 2020-02-25 tobias Added missing (and fairly important!) rayQueryGetIntersectionTEXT
480479
5 2020-03-06 alele Rename RayWorld to WorldRay for some builtins (#20), fix typo (!50)
480+
6 2020-04-01 alele Remove primitive culling ray flags (vulkan issue 2073)

extensions/ext/GLSL_EXT_ray_tracing.txt

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ Status
2929

3030
Version
3131

32-
Last Modified Date: 2020-02-22
33-
Revision: 10
32+
Last Modified Date: 2020-04-01
33+
Revision: 11
3434

3535
Dependencies
3636

@@ -61,6 +61,8 @@ Dependencies
6161

6262
This extension interacts with GL_EXT_nonuniform_qualifier.
6363

64+
This extension interacts with GL_EXT_ray_flags_primitive_culling.
65+
6466
Overview
6567

6668
This extension document modifies GLSL to add new shader stages to support ray tracing.
@@ -125,8 +127,6 @@ Overview
125127
gl_RayFlagsCullFrontFacingTrianglesEXT -> CullFrontFacingTrianglesKHR ray flag
126128
gl_RayFlagsCullOpaqueEXT -> CullOpaqueKHR ray flag
127129
gl_RayFlagsCullNoOpaqueEXT -> CullNoOpaqueKHR ray flag
128-
gl_RayFlagsSkipTrianglesEXT -> SkipTrianglesKHR ray flag
129-
gl_RayFlagsSkipAABBEXT -> SkipAABBsKHR ray flag
130130

131131
gl_HitKindFrontFacingTriangleEXT -> HitKindFrontFacingTriangleKHR hit kind
132132
gl_HitKindBackFacingTriangleEXT -> HitKindBackFacingTriangleKHR hit kind
@@ -139,10 +139,6 @@ Overview
139139

140140
shadercallcoherent -> NonPrivate{Pointer,Texel}KHR + Make{Pointer,Texel}{Available,Visible}KHR with scope = ShaderCallKHR
141141

142-
In addition, using this extension defines the <RayTracingProvisionalKHR>
143-
capability.
144-
Using the gl_RayFlagsSkipAABBEXT or gl_RayFlagsSkipTrianglesEXT flags
145-
defines the <RayTraversalPrimitiveCullingProvisionalKHR> capability.
146142

147143
Modifications to the OpenGL Shading Language Specification, Version 4.60
148144

@@ -740,8 +736,6 @@ Additions to Chapter 7 of the OpenGL Shading Language Specification
740736
const uint gl_RayFlagsCullFrontFacingTrianglesEXT = 32U;
741737
const uint gl_RayFlagsCullOpaqueEXT = 64U;
742738
const uint gl_RayFlagsCullNoOpaqueEXT = 128U;
743-
const uint gl_RayFlagsSkipTrianglesEXT = 256U;
744-
const uint gl_RayFlagsSkipAABBEXT = 512U;
745739

746740
These can be used as flags for the 'rayflags' argument for traceRayEXT() call,
747741
or for comparing value to gl_IncomingRayFlagsEXT.
@@ -1041,6 +1035,12 @@ Interactions with GL_EXT_nonuniform_qualifier
10411035
accelerationStructureEXT can be indexed with non-unform integral
10421036
expressions when they are decorated with the nonuniformEXT qualifier.
10431037

1038+
Interactions with GL_EXT_ray_flags_primitive_culling
1039+
1040+
If GL_EXT_ray_flags_primitive_culling is supported, ray flags added
1041+
by this extension can be used as flags for the 'rayflags' argument
1042+
for traceRayEXT() call, or for comparing value to gl_IncomingRayFlagsEXT.
1043+
10441044
Issues
10451045

10461046
1) Do we need to specify the GL_EXT_ray_tracing as enabled for these new
@@ -1123,3 +1123,4 @@ Revision History
11231123
8 2020-02-20 ewerness Miss shaders do not have gl_ObjectRay* parameters (GLSL #18)
11241124
9 2020-02-21 tobias Clarified interactions with GLSL_EXT_ray_query
11251125
10 2020-02-22 tobias gl_HitTEXT now maps to RayTmaxKHR
1126+
11 2020-04-01 alele Remove primitive culling ray flags (vulkan issue 2073)

0 commit comments

Comments
 (0)