Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
glslang
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
glslang
Commits
75de196c
Unverified
Commit
75de196c
authored
Apr 08, 2020
by
alelenv
Committed by
GitHub
Apr 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for EXT_ray_flags_primitive_culling. (#2173)
Fixes issue #2169.
parent
9c3204a1
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
126 additions
and
106 deletions
+126
-106
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+4
-0
rayQuery-allOps.comp.out
Test/baseResults/rayQuery-allOps.comp.out
+60
-58
spv.ext.ClosestHitShader_Errors.rchit.out
Test/baseResults/spv.ext.ClosestHitShader_Errors.rchit.out
+2
-1
spv.ext.RayGenShader.rgen.out
Test/baseResults/spv.ext.RayGenShader.rgen.out
+42
-39
rayQuery-allOps.comp
Test/rayQuery-allOps.comp
+2
-2
spv.ext.ClosestHitShader_Errors.rchit
Test/spv.ext.ClosestHitShader_Errors.rchit
+1
-0
spv.ext.RayGenShader.rgen
Test/spv.ext.RayGenShader.rgen
+2
-1
spv.ext.RayGenShader_Errors.rgen
Test/spv.ext.RayGenShader_Errors.rgen
+1
-0
Initialize.cpp
glslang/MachineIndependent/Initialize.cpp
+4
-0
Versions.cpp
glslang/MachineIndependent/Versions.cpp
+7
-5
Versions.h
glslang/MachineIndependent/Versions.h
+1
-0
No files found.
SPIRV/GlslangToSpv.cpp
View file @
75de196c
...
...
@@ -1448,6 +1448,10 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion,
builder
.
addExecutionMode
(
shaderEntry
,
spv
::
ExecutionModeXfb
);
}
if
(
sourceExtensions
.
find
(
"GL_EXT_ray_flags_primitive_culling"
)
!=
sourceExtensions
.
end
())
{
builder
.
addCapability
(
spv
::
CapabilityRayTraversalPrimitiveCullingProvisionalKHR
);
}
unsigned
int
mode
;
switch
(
glslangIntermediate
->
getStage
())
{
case
EShLangVertex
:
...
...
Test/baseResults/rayQuery-allOps.comp.out
View file @
75de196c
rayQuery-allOps.comp
// Module Version 10000
// Generated by (magic number): 80008
// Id's are bound by 25
7
// Id's are bound by 25
8
Capability Shader
Capability RayQueryProvisionalKHR
Capability RayTraversalPrimitiveCullingProvisionalKHR
Extension "SPV_KHR_ray_query"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main"
ExecutionMode 4 LocalSize 1 1 1
Source GLSL 460
SourceExtension "GL_EXT_ray_flags_primitive_culling"
SourceExtension "GL_EXT_ray_query"
SourceExtension "GL_NV_ray_tracing"
Name 4 "main"
Name 6 "doSomething("
Name 10 "Ray"
...
...
@@ -34,16 +35,16 @@ rayQuery-allOps.comp
Name 83 "_mat3x4"
Name 143 "t"
Name 156 "committedStatus"
Name 24
0
"o"
Name 24
2
"d"
Name 25
2
"Ray"
MemberName 25
2
(Ray) 0 "pos"
MemberName 25
2
(Ray) 1 "tmin"
MemberName 25
2
(Ray) 2 "dir"
MemberName 25
2
(Ray) 3 "tmax"
Name 25
4
"Rays"
MemberName 25
4
(Rays) 0 "rays"
Name 25
6
""
Name 24
1
"o"
Name 24
3
"d"
Name 25
3
"Ray"
MemberName 25
3
(Ray) 0 "pos"
MemberName 25
3
(Ray) 1 "tmin"
MemberName 25
3
(Ray) 2 "dir"
MemberName 25
3
(Ray) 3 "tmax"
Name 25
5
"Rays"
MemberName 25
5
(Rays) 0 "rays"
Name 25
7
""
MemberDecorate 15(Log) 0 Offset 0
MemberDecorate 15(Log) 1 Offset 4
Decorate 15(Log) BufferBlock
...
...
@@ -51,15 +52,15 @@ rayQuery-allOps.comp
Decorate 17 Binding 0
Decorate 50(rtas) DescriptorSet 0
Decorate 50(rtas) Binding 1
MemberDecorate 25
2
(Ray) 0 Offset 0
MemberDecorate 25
2
(Ray) 1 Offset 12
MemberDecorate 25
2
(Ray) 2 Offset 16
MemberDecorate 25
2
(Ray) 3 Offset 28
Decorate 25
3
ArrayStride 32
MemberDecorate 25
4
(Rays) 0 Offset 0
Decorate 25
4
(Rays) BufferBlock
Decorate 25
6
DescriptorSet 0
Decorate 25
6
Binding 2
MemberDecorate 25
3
(Ray) 0 Offset 0
MemberDecorate 25
3
(Ray) 1 Offset 12
MemberDecorate 25
3
(Ray) 2 Offset 16
MemberDecorate 25
3
(Ray) 3 Offset 28
Decorate 25
4
ArrayStride 32
MemberDecorate 25
5
(Rays) 0 Offset 0
Decorate 25
5
(Rays) BufferBlock
Decorate 25
7
DescriptorSet 0
Decorate 25
7
Binding 2
2: TypeVoid
3: TypeFunction 2
8: TypeFloat 32
...
...
@@ -104,11 +105,12 @@ rayQuery-allOps.comp
144: 8(float) Constant 1056964608
175: 14(int) Constant 1
198: 14(int) Constant 2
252(Ray): TypeStruct 9(fvec3) 8(float) 9(fvec3) 8(float)
253: TypeRuntimeArray 252(Ray)
254(Rays): TypeStruct 253
255: TypePointer Uniform 254(Rays)
256: 255(ptr) Variable Uniform
231: 14(int) Constant 256
253(Ray): TypeStruct 9(fvec3) 8(float) 9(fvec3) 8(float)
254: TypeRuntimeArray 253(Ray)
255(Rays): TypeStruct 254
256: TypePointer Uniform 255(Rays)
257: 256(ptr) Variable Uniform
4(main): 2 Function None 3
5: Label
43(ray): 25(ptr) Variable Function
...
...
@@ -118,8 +120,8 @@ rayQuery-allOps.comp
83(_mat3x4): 82(ptr) Variable Function
143(t): 35(ptr) Variable Function
156(committedStatus): 68(ptr) Variable Function
24
0
(o): 29(ptr) Variable Function
24
2
(d): 29(ptr) Variable Function
24
1
(o): 29(ptr) Variable Function
24
3
(d): 29(ptr) Variable Function
44: 10(Ray) FunctionCall 12(makeRayDesc()
Store 43(ray) 44
51: 48 Load 50(rtas)
...
...
@@ -375,36 +377,36 @@ rayQuery-allOps.comp
Branch 228
228: Label
230: 14(int) RayQueryGetRayFlagsKHR 47(rayQuery)
23
1: 66(bool) UGreaterThan 230 20
SelectionMerge 23
3
None
BranchConditional 23
1 232 233
23
2
: Label
23
4
: 2 FunctionCall 6(doSomething()
Branch 23
3
23
3
: Label
23
5
: 8(float) RayQueryGetRayTMinKHR 47(rayQuery)
23
6: 66(bool) FOrdGreaterThan 235
27
SelectionMerge 23
8
None
BranchConditional 23
6 237 238
23
7
: Label
2
39
: 2 FunctionCall 6(doSomething()
Branch 23
8
23
8
: Label
24
1
: 9(fvec3) RayQueryGetWorldRayOriginKHR 47(rayQuery)
Store 24
0(o) 241
24
3
: 9(fvec3) RayQueryGetWorldRayDirectionKHR 47(rayQuery)
Store 24
2(d) 243
24
4: 35(ptr) AccessChain 240
(o) 20
24
5: 8(float) Load 244
24
6: 35(ptr) AccessChain 242
(d) 198
24
7: 8(float) Load 246
24
8: 66(bool) FOrdEqual 245 247
SelectionMerge 25
0
None
BranchConditional 24
8 249 250
2
49
: Label
25
1
: 2 FunctionCall 6(doSomething()
Branch 25
0
25
0
: Label
23
2: 66(bool) UGreaterThan 230 231
SelectionMerge 23
4
None
BranchConditional 23
2 233 234
23
3
: Label
23
5
: 2 FunctionCall 6(doSomething()
Branch 23
4
23
4
: Label
23
6
: 8(float) RayQueryGetRayTMinKHR 47(rayQuery)
23
7: 66(bool) FOrdGreaterThan 236
27
SelectionMerge 23
9
None
BranchConditional 23
7 238 239
23
8
: Label
2
40
: 2 FunctionCall 6(doSomething()
Branch 23
9
23
9
: Label
24
2
: 9(fvec3) RayQueryGetWorldRayOriginKHR 47(rayQuery)
Store 24
1(o) 242
24
4
: 9(fvec3) RayQueryGetWorldRayDirectionKHR 47(rayQuery)
Store 24
3(d) 244
24
5: 35(ptr) AccessChain 241
(o) 20
24
6: 8(float) Load 245
24
7: 35(ptr) AccessChain 243
(d) 198
24
8: 8(float) Load 247
24
9: 66(bool) FOrdEqual 246 248
SelectionMerge 25
1
None
BranchConditional 24
9 250 251
2
50
: Label
25
2
: 2 FunctionCall 6(doSomething()
Branch 25
1
25
1
: Label
Return
FunctionEnd
6(doSomething(): 2 Function None 3
...
...
Test/baseResults/spv.ext.ClosestHitShader_Errors.rchit.out
View file @
75de196c
...
...
@@ -3,7 +3,8 @@ ERROR: 0:8: 'assign' : l-value required "payload" (cannot modify hitAttributeNV
ERROR: 0:9: 'reportIntersectionEXT' : no matching overloaded function found
ERROR: 0:10: 'terminateRayEXT' : no matching overloaded function found
ERROR: 0:11: 'ignoreIntersectionEXT' : no matching overloaded function found
ERROR: 4 compilation errors. No code generated.
ERROR: 0:12: 'gl_RayFlagsSkipAABBEXT' : required extension not requested: GL_EXT_ray_flags_primitive_culling
ERROR: 5 compilation errors. No code generated.
SPIR-V is not generated for failed compile or link
Test/baseResults/spv.ext.RayGenShader.rgen.out
View file @
75de196c
spv.ext.RayGenShader.rgen
// Module Version 10000
// Generated by (magic number): 80008
// Id's are bound by 5
7
// Id's are bound by 5
8
Capability RayTraversalPrimitiveCullingProvisionalKHR
Capability RayTracingProvisionalKHR
Extension "SPV_KHR_ray_tracing"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint RayGenerationKHR 4 "main" 11 21
Source GLSL 460
SourceExtension "GL_EXT_ray_flags_primitive_culling"
SourceExtension "GL_EXT_ray_tracing"
Name 4 "main"
Name 8 "lx"
...
...
@@ -18,25 +20,25 @@ spv.ext.RayGenShader.rgen
Name 21 "gl_LaunchSizeEXT"
Name 24 "sy"
Name 29 "accEXT0"
Name 3
7
"block"
MemberName 3
7
(block) 0 "dir"
MemberName 3
7
(block) 1 "origin"
Name
39
""
Name 5
0
"accEXT1"
Name 5
3
"imageu"
Name 5
6
"payload"
Name 3
8
"block"
MemberName 3
8
(block) 0 "dir"
MemberName 3
8
(block) 1 "origin"
Name
40
""
Name 5
1
"accEXT1"
Name 5
4
"imageu"
Name 5
7
"payload"
Decorate 11(gl_LaunchIDEXT) BuiltIn LaunchIdKHR
Decorate 21(gl_LaunchSizeEXT) BuiltIn LaunchSizeKHR
Decorate 29(accEXT0) DescriptorSet 0
Decorate 29(accEXT0) Binding 0
MemberDecorate 3
7
(block) 0 Offset 0
MemberDecorate 3
7
(block) 1 Offset 16
Decorate 3
7
(block) BufferBlock
Decorate 5
0
(accEXT1) DescriptorSet 0
Decorate 5
0
(accEXT1) Binding 1
Decorate 5
3
(imageu) DescriptorSet 0
Decorate 5
3
(imageu) Binding 2
Decorate 5
6
(payload) Location 0
MemberDecorate 3
8
(block) 0 Offset 0
MemberDecorate 3
8
(block) 1 Offset 16
Decorate 3
8
(block) BufferBlock
Decorate 5
1
(accEXT1) DescriptorSet 0
Decorate 5
1
(accEXT1) Binding 1
Decorate 5
4
(imageu) DescriptorSet 0
Decorate 5
4
(imageu) Binding 2
Decorate 5
7
(payload) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
...
...
@@ -51,24 +53,25 @@ spv.ext.RayGenShader.rgen
27: TypeAccelerationStructureKHR
28: TypePointer UniformConstant 27
29(accEXT0): 28(ptr) Variable UniformConstant
35: TypeFloat 32
36: TypeVector 35(float) 3
37(block): TypeStruct 36(fvec3) 36(fvec3)
38: TypePointer ShaderRecordBufferKHR 37(block)
39: 38(ptr) Variable ShaderRecordBufferKHR
40: TypeInt 32 1
41: 40(int) Constant 1
42: TypePointer ShaderRecordBufferKHR 36(fvec3)
45: 35(float) Constant 1056964608
46: 40(int) Constant 0
49: 35(float) Constant 1061158912
50(accEXT1): 28(ptr) Variable UniformConstant
51: TypeImage 6(int) 2D nonsampled format:R32ui
52: TypePointer UniformConstant 51
53(imageu): 52(ptr) Variable UniformConstant
54: TypeVector 35(float) 4
55: TypePointer RayPayloadKHR 54(fvec4)
56(payload): 55(ptr) Variable RayPayloadKHR
35: 6(int) Constant 768
36: TypeFloat 32
37: TypeVector 36(float) 3
38(block): TypeStruct 37(fvec3) 37(fvec3)
39: TypePointer ShaderRecordBufferKHR 38(block)
40: 39(ptr) Variable ShaderRecordBufferKHR
41: TypeInt 32 1
42: 41(int) Constant 1
43: TypePointer ShaderRecordBufferKHR 37(fvec3)
46: 36(float) Constant 1056964608
47: 41(int) Constant 0
50: 36(float) Constant 1061158912
51(accEXT1): 28(ptr) Variable UniformConstant
52: TypeImage 6(int) 2D nonsampled format:R32ui
53: TypePointer UniformConstant 52
54(imageu): 53(ptr) Variable UniformConstant
55: TypeVector 36(float) 4
56: TypePointer RayPayloadKHR 55(fvec4)
57(payload): 56(ptr) Variable RayPayloadKHR
4(main): 2 Function None 3
5: Label
8(lx): 7(ptr) Variable Function
...
...
@@ -92,10 +95,10 @@ spv.ext.RayGenShader.rgen
32: 6(int) Load 16(ly)
33: 6(int) Load 20(sx)
34: 6(int) Load 24(sy)
4
3: 42(ptr) AccessChain 39 41
4
4: 36(fvec3) Load 43
4
7: 42(ptr) AccessChain 39 46
4
8: 36(fvec3) Load 47
TraceRayKHR 30 31 32 33 34
12 44 45 48 49 41
4
4: 43(ptr) AccessChain 40 42
4
5: 37(fvec3) Load 44
4
8: 43(ptr) AccessChain 40 47
4
9: 37(fvec3) Load 48
TraceRayKHR 30 31 32 33 34
35 45 46 49 50 42
Return
FunctionEnd
Test/rayQuery-allOps.comp
View file @
75de196c
#version 460
#extension GL_NV_ray_tracing : enable
#extension GL_EXT_ray_query : enable
#extension GL_EXT_ray_flags_primitive_culling : enable
struct Ray
{
...
...
@@ -192,7 +192,7 @@ void main()
doSomething();
}
if (rayQueryGetRayFlagsEXT(rayQuery) >
0
)
if (rayQueryGetRayFlagsEXT(rayQuery) >
gl_RayFlagsSkipTrianglesEXT
)
{
doSomething();
}
...
...
Test/spv.ext.ClosestHitShader_Errors.rchit
View file @
75de196c
...
...
@@ -9,4 +9,5 @@ void main()
reportIntersectionEXT(1.0, 1U); // ERROR, unsupported builtin in stage
terminateRayEXT();
ignoreIntersectionEXT();
bool e1 = gl_IncomingRayFlagsEXT == gl_RayFlagsSkipAABBEXT;
}
Test/spv.ext.RayGenShader.rgen
View file @
75de196c
#version 460
#extension GL_EXT_ray_tracing : enable
#extension GL_EXT_ray_flags_primitive_culling : enable
layout(binding = 0, set = 0) uniform accelerationStructureEXT accEXT0;
layout(binding = 1, set = 0) uniform accelerationStructureEXT accEXT1; // Unused
layout(binding = 2, r32ui) shadercallcoherent uniform uimage2D imageu;
...
...
@@ -16,5 +17,5 @@ void main()
uint ly = gl_LaunchIDEXT.y;
uint sx = gl_LaunchSizeEXT.x;
uint sy = gl_LaunchSizeEXT.y;
traceRayEXT(accEXT0, lx, ly, sx, sy,
0u
, origin, 0.5f, dir, 0.75f, 1);
traceRayEXT(accEXT0, lx, ly, sx, sy,
gl_RayFlagsSkipTrianglesEXT | gl_RayFlagsSkipAABBEXT
, origin, 0.5f, dir, 0.75f, 1);
}
Test/spv.ext.RayGenShader_Errors.rgen
View file @
75de196c
...
...
@@ -34,6 +34,7 @@ void main()
mat4x3 e11 = gl_WorldToObjectEXT; // ERROR, unsupported builtin in stage
float e12 = gl_HitTEXT; // ERROR, unsupported builtin in stage
float e13 = gl_HitKindEXT; // ERROR, unsupported builtin in stage
int e14 = gl_RayFlagsSkipAABBEXT; // ERROR, unsupported builtin in stage
reportIntersectionEXT(1.0, 1U); // ERROR, unsupported builtin in stage
ignoreIntersectionEXT(); // ERROR, unsupported builtin in stage
terminateRayEXT(); // ERROR, unsupported builtin in stage
...
...
glslang/MachineIndependent/Initialize.cpp
View file @
75de196c
...
...
@@ -5457,6 +5457,8 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"const uint gl_RayFlagsCullOpaqueEXT = 64U;"
"const uint gl_RayFlagsCullNoOpaqueNV = 128U;"
"const uint gl_RayFlagsCullNoOpaqueEXT = 128U;"
"const uint gl_RayFlagsSkipTrianglesEXT = 256U;"
"const uint gl_RayFlagsSkipAABBEXT = 512U;"
"const uint gl_HitKindFrontFacingTriangleEXT = 254U;"
"const uint gl_HitKindBackFacingTriangleEXT = 255U;"
"
\n
"
;
...
...
@@ -7572,6 +7574,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable
.
setFunctionExtensions
(
"rayQueryGetIntersectionWorldToObjectEXT"
,
1
,
&
E_GL_EXT_ray_query
);
symbolTable
.
setFunctionExtensions
(
"rayQueryGetWorldRayOriginEXT"
,
1
,
&
E_GL_EXT_ray_query
);
symbolTable
.
setFunctionExtensions
(
"rayQueryGetWorldRayDirectionEXT"
,
1
,
&
E_GL_EXT_ray_query
);
symbolTable
.
setVariableExtensions
(
"gl_RayFlagsSkipAABBEXT"
,
1
,
&
E_GL_EXT_ray_flags_primitive_culling
);
symbolTable
.
setVariableExtensions
(
"gl_RayFlagsSkipTrianglesEXT"
,
1
,
&
E_GL_EXT_ray_flags_primitive_culling
);
}
if
((
profile
!=
EEsProfile
&&
version
>=
130
)
||
...
...
glslang/MachineIndependent/Versions.cpp
View file @
75de196c
...
...
@@ -293,11 +293,12 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior
[
E_GL_OES_texture_cube_map_array
]
=
EBhDisable
;
// EXT extensions
extensionBehavior
[
E_GL_EXT_device_group
]
=
EBhDisable
;
extensionBehavior
[
E_GL_EXT_multiview
]
=
EBhDisable
;
extensionBehavior
[
E_GL_EXT_shader_realtime_clock
]
=
EBhDisable
;
extensionBehavior
[
E_GL_EXT_ray_tracing
]
=
EBhDisable
;
extensionBehavior
[
E_GL_EXT_ray_query
]
=
EBhDisable
;
extensionBehavior
[
E_GL_EXT_device_group
]
=
EBhDisable
;
extensionBehavior
[
E_GL_EXT_multiview
]
=
EBhDisable
;
extensionBehavior
[
E_GL_EXT_shader_realtime_clock
]
=
EBhDisable
;
extensionBehavior
[
E_GL_EXT_ray_tracing
]
=
EBhDisable
;
extensionBehavior
[
E_GL_EXT_ray_query
]
=
EBhDisable
;
extensionBehavior
[
E_GL_EXT_ray_flags_primitive_culling
]
=
EBhDisable
;
// OVR extensions
extensionBehavior
[
E_GL_OVR_multiview
]
=
EBhDisable
;
...
...
@@ -438,6 +439,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define E_GL_EXT_shader_realtime_clock 1
\n
"
"#define E_GL_EXT_ray_tracing 1
\n
"
"#define E_GL_EXT_ray_query 1
\n
"
"#define E_GL_EXT_ray_flags_primitive_culling 1
\n
"
"#define GL_AMD_shader_ballot 1
\n
"
"#define GL_AMD_shader_trinary_minmax 1
\n
"
...
...
glslang/MachineIndependent/Versions.h
View file @
75de196c
...
...
@@ -189,6 +189,7 @@ const char* const E_GL_EXT_shader_realtime_clock = "GL_EXT_shader_rea
const
char
*
const
E_GL_EXT_debug_printf
=
"GL_EXT_debug_printf"
;
const
char
*
const
E_GL_EXT_ray_tracing
=
"GL_EXT_ray_tracing"
;
const
char
*
const
E_GL_EXT_ray_query
=
"GL_EXT_ray_query"
;
const
char
*
const
E_GL_EXT_ray_flags_primitive_culling
=
"GL_EXT_ray_flags_primitive_culling"
;
// Arrays of extensions for the above viewportEXTs duplications
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment