Unverified Commit 8e26c5f5 by John Kessenich Committed by GitHub

Merge pull request #2139 from neslimsah/master

GL_EXT_ray_query updates
parents 393c564a cea9384b
/*
** Copyright (c) 2014-2016 The Khronos Group Inc.
** Copyright (c) 2014-2020 The Khronos Group Inc.
** Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
**
** Permission is hereby granted, free of charge, to any person obtaining a copy
** of this software and/or associated documentation files (the "Materials"),
......@@ -46,4 +47,5 @@ static const char* const E_SPV_EXT_fragment_shader_interlock = "SPV_EXT_fragm
static const char* const E_SPV_KHR_shader_clock = "SPV_KHR_shader_clock";
static const char* const E_SPV_KHR_non_semantic_info = "SPV_KHR_non_semantic_info";
static const char* const E_SPV_KHR_ray_tracing = "SPV_KHR_ray_tracing";
static const char* const E_SPV_KHR_ray_query = "SPV_KHR_ray_query";
#endif // #ifndef GLSLextKHR_H
//
// Copyright (C) 2014-2015 LunarG, Inc.
// Copyright (C) 2015-2018 Google, Inc.
// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
//
// All rights reserved.
//
......@@ -616,6 +617,21 @@ Id Builder::makeAccelerationStructureType()
return type->getResultId();
}
Id Builder::makeRayQueryType()
{
Instruction *type;
if (groupedTypes[OpTypeRayQueryProvisionalKHR].size() == 0) {
type = new Instruction(getUniqueId(), NoType, OpTypeRayQueryProvisionalKHR);
groupedTypes[OpTypeRayQueryProvisionalKHR].push_back(type);
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
} else {
type = groupedTypes[OpTypeRayQueryProvisionalKHR].back();
}
return type->getResultId();
}
#endif
Id Builder::getDerefTypeId(Id resultId) const
......
......@@ -2,6 +2,7 @@
// Copyright (C) 2014-2015 LunarG, Inc.
// Copyright (C) 2015-2020 Google, Inc.
// Copyright (C) 2017 ARM Limited.
// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
//
// All rights reserved.
//
......@@ -183,6 +184,8 @@ public:
// accelerationStructureNV type
Id makeAccelerationStructureType();
// rayQueryEXT type
Id makeRayQueryType();
// For querying about types.
Id getTypeId(Id resultId) const { return module.getTypeId(resultId); }
......
......@@ -2111,4 +2111,3 @@ inline RayFlagsMask operator|(RayFlagsMask a, RayFlagsMask b) { return RayFlagsM
} // end namespace spv
#endif // #ifndef spirv_HPP
rayQuery-allOps.Error.rgen
ERROR: 0:47: '==' : wrong operand types: no operation '==' exists that takes a left-hand operand of type ' global bool' and a right operand of type ' const int' (or there is no acceptable conversion)
ERROR: 0:49: '=' : cannot convert from ' global uint' to ' temp highp int'
ERROR: 0:59: '==' : wrong operand types: no operation '==' exists that takes a left-hand operand of type ' global bool' and a right operand of type ' const int' (or there is no acceptable conversion)
ERROR: 0:64: '==' : wrong operand types: no operation '==' exists that takes a left-hand operand of type ' global 2-component vector of float' and a right operand of type ' const int' (or there is no acceptable conversion)
ERROR: 0:69: '' : boolean expression expected
ERROR: 0:74: '' : boolean expression expected
ERROR: 0:79: '>' : wrong operand types: no operation '>' exists that takes a left-hand operand of type ' global 3-component vector of float' and a right operand of type ' const int' (or there is no acceptable conversion)
ERROR: 0:84: '>' : wrong operand types: no operation '>' exists that takes a left-hand operand of type ' global 3-component vector of float' and a right operand of type ' const int' (or there is no acceptable conversion)
ERROR: 0:89: '' : boolean expression expected
ERROR: 0:94: '' : boolean expression expected
ERROR: 0:99: '' : boolean expression expected
ERROR: 0:127: '=' : cannot convert from ' global uint' to ' temp highp int'
ERROR: 0:145: '==' : wrong operand types: no operation '==' exists that takes a left-hand operand of type ' global 2-component vector of float' and a right operand of type ' const int' (or there is no acceptable conversion)
ERROR: 0:158: '' : boolean expression expected
ERROR: 0:163: '' : boolean expression expected
ERROR: 0:168: '>' : wrong operand types: no operation '>' exists that takes a left-hand operand of type ' global 3-component vector of float' and a right operand of type ' const int' (or there is no acceptable conversion)
ERROR: 0:173: '>' : wrong operand types: no operation '>' exists that takes a left-hand operand of type ' global 3-component vector of float' and a right operand of type ' const int' (or there is no acceptable conversion)
ERROR: 0:178: '' : boolean expression expected
ERROR: 0:183: '' : boolean expression expected
ERROR: 0:195: '' : boolean expression expected
ERROR: 0:200: '' : boolean expression expected
ERROR: 21 compilation errors. No code generated.
SPIR-V is not generated for failed compile or link
rayQuery-committed.Error.rgen
ERROR: 0:48: 'committed' : argument must be compile-time constant
ERROR: 0:53: 'committed' : argument must be compile-time constant
ERROR: 0:54: 'committed' : argument must be compile-time constant
ERROR: 0:58: 'committed' : argument must be compile-time constant
ERROR: 0:62: 'committed' : argument must be compile-time constant
ERROR: 0:66: 'committed' : argument must be compile-time constant
ERROR: 0:70: 'committed' : argument must be compile-time constant
ERROR: 0:74: 'committed' : argument must be compile-time constant
ERROR: 0:78: 'committed' : argument must be compile-time constant
ERROR: 0:82: 'committed' : argument must be compile-time constant
ERROR: 0:86: 'committed' : argument must be compile-time constant
ERROR: 0:90: 'committed' : argument must be compile-time constant
ERROR: 0:97: 'committed' : argument must be compile-time constant
ERROR: 0:100: 'committed' : argument must be compile-time constant
ERROR: 14 compilation errors. No code generated.
SPIR-V is not generated for failed compile or link
rayQuery-initialize.rgen
// Module Version 10000
// Generated by (magic number): 80008
// Id's are bound by 105
Capability RayQueryProvisionalKHR
Capability RayTracingNV
Extension "SPV_KHR_ray_query"
Extension "SPV_NV_ray_tracing"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint RayGenerationKHR 4 "main" 23 28
Source GLSL 460
SourceExtension "GL_EXT_ray_query"
SourceExtension "GL_NV_ray_tracing"
Name 4 "main"
Name 8 "launchIndex("
Name 14 "Ray"
MemberName 14(Ray) 0 "pos"
MemberName 14(Ray) 1 "tmin"
MemberName 14(Ray) 2 "dir"
MemberName 14(Ray) 3 "tmax"
Name 19 "doInitialize(rq1;struct-Ray-vf3-f1-vf3-f11;"
Name 17 "rayQuery"
Name 18 "ray"
Name 23 "gl_LaunchIDNV"
Name 28 "gl_LaunchSizeNV"
Name 50 "rtas"
Name 69 "index"
Name 71 "ray"
Name 72 "Ray"
MemberName 72(Ray) 0 "pos"
MemberName 72(Ray) 1 "tmin"
MemberName 72(Ray) 2 "dir"
MemberName 72(Ray) 3 "tmax"
Name 74 "Rays"
MemberName 74(Rays) 0 "rays"
Name 76 ""
Name 89 "rayQuery"
Name 90 "param"
Name 92 "param"
Decorate 23(gl_LaunchIDNV) BuiltIn LaunchIdKHR
Decorate 28(gl_LaunchSizeNV) BuiltIn LaunchSizeKHR
Decorate 50(rtas) DescriptorSet 0
Decorate 50(rtas) Binding 0
MemberDecorate 72(Ray) 0 Offset 0
MemberDecorate 72(Ray) 1 Offset 12
MemberDecorate 72(Ray) 2 Offset 16
MemberDecorate 72(Ray) 3 Offset 28
Decorate 73 ArrayStride 32
MemberDecorate 74(Rays) 0 Offset 0
Decorate 74(Rays) BufferBlock
Decorate 76 DescriptorSet 0
Decorate 76 Binding 2
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
7: TypeFunction 6(int)
10: TypeRayQueryProvisionalKHR
11: TypePointer Function 10
12: TypeFloat 32
13: TypeVector 12(float) 3
14(Ray): TypeStruct 13(fvec3) 12(float) 13(fvec3) 12(float)
15: TypePointer Function 14(Ray)
16: TypeFunction 2 11(ptr) 15(ptr)
21: TypeVector 6(int) 3
22: TypePointer Input 21(ivec3)
23(gl_LaunchIDNV): 22(ptr) Variable Input
24: 6(int) Constant 2
25: TypePointer Input 6(int)
28(gl_LaunchSizeNV): 22(ptr) Variable Input
29: 6(int) Constant 0
33: 6(int) Constant 1
48: TypeAccelerationStructureKHR
49: TypePointer UniformConstant 48
50(rtas): 49(ptr) Variable UniformConstant
52: 6(int) Constant 16
53: TypeInt 32 1
54: 53(int) Constant 0
55: TypePointer Function 13(fvec3)
58: 53(int) Constant 1
59: TypePointer Function 12(float)
62: 53(int) Constant 2
65: 53(int) Constant 3
68: TypePointer Function 6(int)
72(Ray): TypeStruct 13(fvec3) 12(float) 13(fvec3) 12(float)
73: TypeRuntimeArray 72(Ray)
74(Rays): TypeStruct 73
75: TypePointer Uniform 74(Rays)
76: 75(ptr) Variable Uniform
78: TypePointer Uniform 72(Ray)
96: 6(int) Constant 32
4(main): 2 Function None 3
5: Label
69(index): 68(ptr) Variable Function
71(ray): 15(ptr) Variable Function
89(rayQuery): 11(ptr) Variable Function
90(param): 11(ptr) Variable Function
92(param): 15(ptr) Variable Function
70: 6(int) FunctionCall 8(launchIndex()
Store 69(index) 70
77: 6(int) Load 69(index)
79: 78(ptr) AccessChain 76 54 77
80: 72(Ray) Load 79
81: 13(fvec3) CompositeExtract 80 0
82: 55(ptr) AccessChain 71(ray) 54
Store 82 81
83: 12(float) CompositeExtract 80 1
84: 59(ptr) AccessChain 71(ray) 58
Store 84 83
85: 13(fvec3) CompositeExtract 80 2
86: 55(ptr) AccessChain 71(ray) 62
Store 86 85
87: 12(float) CompositeExtract 80 3
88: 59(ptr) AccessChain 71(ray) 65
Store 88 87
91: 10 Load 89(rayQuery)
Store 90(param) 91
93: 14(Ray) Load 71(ray)
Store 92(param) 93
94: 2 FunctionCall 19(doInitialize(rq1;struct-Ray-vf3-f1-vf3-f11;) 90(param) 92(param)
95: 48 Load 50(rtas)
97: 55(ptr) AccessChain 71(ray) 54
98: 13(fvec3) Load 97
99: 59(ptr) AccessChain 71(ray) 58
100: 12(float) Load 99
101: 55(ptr) AccessChain 71(ray) 62
102: 13(fvec3) Load 101
103: 59(ptr) AccessChain 71(ray) 65
104: 12(float) Load 103
RayQueryInitializeKHR 89(rayQuery) 95 33 96 98 100 102 104
Return
FunctionEnd
8(launchIndex(): 6(int) Function None 7
9: Label
26: 25(ptr) AccessChain 23(gl_LaunchIDNV) 24
27: 6(int) Load 26
30: 25(ptr) AccessChain 28(gl_LaunchSizeNV) 29
31: 6(int) Load 30
32: 6(int) IMul 27 31
34: 25(ptr) AccessChain 28(gl_LaunchSizeNV) 33
35: 6(int) Load 34
36: 6(int) IMul 32 35
37: 25(ptr) AccessChain 23(gl_LaunchIDNV) 33
38: 6(int) Load 37
39: 25(ptr) AccessChain 28(gl_LaunchSizeNV) 29
40: 6(int) Load 39
41: 6(int) IMul 38 40
42: 6(int) IAdd 36 41
43: 25(ptr) AccessChain 23(gl_LaunchIDNV) 29
44: 6(int) Load 43
45: 6(int) IAdd 42 44
ReturnValue 45
FunctionEnd
19(doInitialize(rq1;struct-Ray-vf3-f1-vf3-f11;): 2 Function None 16
17(rayQuery): 11(ptr) FunctionParameter
18(ray): 15(ptr) FunctionParameter
20: Label
51: 48 Load 50(rtas)
56: 55(ptr) AccessChain 18(ray) 54
57: 13(fvec3) Load 56
60: 59(ptr) AccessChain 18(ray) 58
61: 12(float) Load 60
63: 55(ptr) AccessChain 18(ray) 62
64: 13(fvec3) Load 63
66: 59(ptr) AccessChain 18(ray) 65
67: 12(float) Load 66
RayQueryInitializeKHR 17(rayQuery) 51 29 52 57 61 64 67
Return
FunctionEnd
rayQuery-no-cse.rgen
// Module Version 10000
// Generated by (magic number): 80008
// Id's are bound by 111
Capability RayQueryProvisionalKHR
Capability RayTracingNV
Extension "SPV_KHR_ray_query"
Extension "SPV_NV_ray_tracing"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint RayGenerationKHR 4 "main" 23 28
Source GLSL 460
SourceExtension "GL_EXT_ray_query"
SourceExtension "GL_NV_ray_tracing"
Name 4 "main"
Name 8 "launchIndex("
Name 14 "Ray"
MemberName 14(Ray) 0 "pos"
MemberName 14(Ray) 1 "tmin"
MemberName 14(Ray) 2 "dir"
MemberName 14(Ray) 3 "tmax"
Name 19 "doInitialize(rq1;struct-Ray-vf3-f1-vf3-f11;"
Name 17 "rayQuery"
Name 18 "ray"
Name 23 "gl_LaunchIDNV"
Name 28 "gl_LaunchSizeNV"
Name 50 "rtas"
Name 69 "index"
Name 71 "ray"
Name 72 "Ray"
MemberName 72(Ray) 0 "pos"
MemberName 72(Ray) 1 "tmin"
MemberName 72(Ray) 2 "dir"
MemberName 72(Ray) 3 "tmax"
Name 74 "Rays"
MemberName 74(Rays) 0 "rays"
Name 76 ""
Name 89 "rayQuery1"
Name 90 "param"
Name 92 "param"
Name 105 "rayQuery2"
Name 106 "param"
Name 108 "param"
Decorate 23(gl_LaunchIDNV) BuiltIn LaunchIdKHR
Decorate 28(gl_LaunchSizeNV) BuiltIn LaunchSizeKHR
Decorate 50(rtas) DescriptorSet 0
Decorate 50(rtas) Binding 0
MemberDecorate 72(Ray) 0 Offset 0
MemberDecorate 72(Ray) 1 Offset 12
MemberDecorate 72(Ray) 2 Offset 16
MemberDecorate 72(Ray) 3 Offset 28
Decorate 73 ArrayStride 32
MemberDecorate 74(Rays) 0 Offset 0
Decorate 74(Rays) BufferBlock
Decorate 76 DescriptorSet 0
Decorate 76 Binding 2
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
7: TypeFunction 6(int)
10: TypeRayQueryProvisionalKHR
11: TypePointer Function 10
12: TypeFloat 32
13: TypeVector 12(float) 3
14(Ray): TypeStruct 13(fvec3) 12(float) 13(fvec3) 12(float)
15: TypePointer Function 14(Ray)
16: TypeFunction 2 11(ptr) 15(ptr)
21: TypeVector 6(int) 3
22: TypePointer Input 21(ivec3)
23(gl_LaunchIDNV): 22(ptr) Variable Input
24: 6(int) Constant 2
25: TypePointer Input 6(int)
28(gl_LaunchSizeNV): 22(ptr) Variable Input
29: 6(int) Constant 0
33: 6(int) Constant 1
48: TypeAccelerationStructureKHR
49: TypePointer UniformConstant 48
50(rtas): 49(ptr) Variable UniformConstant
52: 6(int) Constant 16
53: TypeInt 32 1
54: 53(int) Constant 0
55: TypePointer Function 13(fvec3)
58: 53(int) Constant 1
59: TypePointer Function 12(float)
62: 53(int) Constant 2
65: 53(int) Constant 3
68: TypePointer Function 6(int)
72(Ray): TypeStruct 13(fvec3) 12(float) 13(fvec3) 12(float)
73: TypeRuntimeArray 72(Ray)
74(Rays): TypeStruct 73
75: TypePointer Uniform 74(Rays)
76: 75(ptr) Variable Uniform
78: TypePointer Uniform 72(Ray)
96: 6(int) Constant 32
4(main): 2 Function None 3
5: Label
69(index): 68(ptr) Variable Function
71(ray): 15(ptr) Variable Function
89(rayQuery1): 11(ptr) Variable Function
90(param): 11(ptr) Variable Function
92(param): 15(ptr) Variable Function
105(rayQuery2): 11(ptr) Variable Function
106(param): 11(ptr) Variable Function
108(param): 15(ptr) Variable Function
70: 6(int) FunctionCall 8(launchIndex()
Store 69(index) 70
77: 6(int) Load 69(index)
79: 78(ptr) AccessChain 76 54 77
80: 72(Ray) Load 79
81: 13(fvec3) CompositeExtract 80 0
82: 55(ptr) AccessChain 71(ray) 54
Store 82 81
83: 12(float) CompositeExtract 80 1
84: 59(ptr) AccessChain 71(ray) 58
Store 84 83
85: 13(fvec3) CompositeExtract 80 2
86: 55(ptr) AccessChain 71(ray) 62
Store 86 85
87: 12(float) CompositeExtract 80 3
88: 59(ptr) AccessChain 71(ray) 65
Store 88 87
91: 10 Load 89(rayQuery1)
Store 90(param) 91
93: 14(Ray) Load 71(ray)
Store 92(param) 93
94: 2 FunctionCall 19(doInitialize(rq1;struct-Ray-vf3-f1-vf3-f11;) 90(param) 92(param)
95: 48 Load 50(rtas)
97: 55(ptr) AccessChain 71(ray) 54
98: 13(fvec3) Load 97
99: 59(ptr) AccessChain 71(ray) 58
100: 12(float) Load 99
101: 55(ptr) AccessChain 71(ray) 62
102: 13(fvec3) Load 101
103: 59(ptr) AccessChain 71(ray) 65
104: 12(float) Load 103
RayQueryInitializeKHR 89(rayQuery1) 95 33 96 98 100 102 104
107: 10 Load 105(rayQuery2)
Store 106(param) 107
109: 14(Ray) Load 71(ray)
Store 108(param) 109
110: 2 FunctionCall 19(doInitialize(rq1;struct-Ray-vf3-f1-vf3-f11;) 106(param) 108(param)
Return
FunctionEnd
8(launchIndex(): 6(int) Function None 7
9: Label
26: 25(ptr) AccessChain 23(gl_LaunchIDNV) 24
27: 6(int) Load 26
30: 25(ptr) AccessChain 28(gl_LaunchSizeNV) 29
31: 6(int) Load 30
32: 6(int) IMul 27 31
34: 25(ptr) AccessChain 28(gl_LaunchSizeNV) 33
35: 6(int) Load 34
36: 6(int) IMul 32 35
37: 25(ptr) AccessChain 23(gl_LaunchIDNV) 33
38: 6(int) Load 37
39: 25(ptr) AccessChain 28(gl_LaunchSizeNV) 29
40: 6(int) Load 39
41: 6(int) IMul 38 40
42: 6(int) IAdd 36 41
43: 25(ptr) AccessChain 23(gl_LaunchIDNV) 29
44: 6(int) Load 43
45: 6(int) IAdd 42 44
ReturnValue 45
FunctionEnd
19(doInitialize(rq1;struct-Ray-vf3-f1-vf3-f11;): 2 Function None 16
17(rayQuery): 11(ptr) FunctionParameter
18(ray): 15(ptr) FunctionParameter
20: Label
51: 48 Load 50(rtas)
56: 55(ptr) AccessChain 18(ray) 54
57: 13(fvec3) Load 56
60: 59(ptr) AccessChain 18(ray) 58
61: 12(float) Load 60
63: 55(ptr) AccessChain 18(ray) 62
64: 13(fvec3) Load 63
66: 59(ptr) AccessChain 18(ray) 65
67: 12(float) Load 66
RayQueryInitializeKHR 17(rayQuery) 51 29 52 57 61 64 67
Return
FunctionEnd
rayQuery.rgen
// Module Version 10000
// Generated by (magic number): 80008
// Id's are bound by 46
Capability RayQueryProvisionalKHR
Capability RayTracingNV
Extension "SPV_KHR_ray_query"
Extension "SPV_NV_ray_tracing"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint RayGenerationKHR 4 "main"
Source GLSL 460
SourceExtension "GL_EXT_ray_query"
SourceExtension "GL_NV_ray_tracing"
Name 4 "main"
Name 8 "rayFlags"
Name 12 "tMin"
Name 14 "tMax"
Name 18 "localRayQuery"
Name 21 "accNV0"
Name 26 "block"
MemberName 26(block) 0 "dir"
MemberName 26(block) 1 "origin"
Name 28 ""
Decorate 21(accNV0) DescriptorSet 0
Decorate 21(accNV0) Binding 0
MemberDecorate 26(block) 0 Offset 0
MemberDecorate 26(block) 1 Offset 16
Decorate 26(block) BufferBlock
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
7: TypePointer Function 6(int)
9: 6(int) Constant 9
10: TypeFloat 32
11: TypePointer Function 10(float)
13: 10(float) Constant 0
15: 10(float) Constant 1148846080
16: TypeRayQueryProvisionalKHR
17: TypePointer Function 16
19: TypeAccelerationStructureKHR
20: TypePointer UniformConstant 19
21(accNV0): 20(ptr) Variable UniformConstant
24: 6(int) Constant 255
25: TypeVector 10(float) 3
26(block): TypeStruct 25(fvec3) 25(fvec3)
27: TypePointer ShaderRecordBufferKHR 26(block)
28: 27(ptr) Variable ShaderRecordBufferKHR
29: TypeInt 32 1
30: 29(int) Constant 1
31: TypePointer ShaderRecordBufferKHR 25(fvec3)
35: 29(int) Constant 0
40: TypeBool
4(main): 2 Function None 3
5: Label
8(rayFlags): 7(ptr) Variable Function
12(tMin): 11(ptr) Variable Function
14(tMax): 11(ptr) Variable Function
18(localRayQuery): 17(ptr) Variable Function
Store 8(rayFlags) 9
Store 12(tMin) 13
Store 14(tMax) 15
22: 19 Load 21(accNV0)
23: 6(int) Load 8(rayFlags)
32: 31(ptr) AccessChain 28 30
33: 25(fvec3) Load 32
34: 10(float) Load 12(tMin)
36: 31(ptr) AccessChain 28 35
37: 25(fvec3) Load 36
38: 10(float) Load 14(tMax)
RayQueryInitializeKHR 18(localRayQuery) 22 23 24 33 34 37 38
39: 16 Load 18(localRayQuery)
41: 40(bool) RayQueryProceedKHR 39
42: 40(bool) LogicalNot 41
SelectionMerge 44 None
BranchConditional 42 43 44
43: Label
45: 16 Load 18(localRayQuery)
RayQueryTerminateKHR 45
Branch 44
44: Label
Return
FunctionEnd
#version 460
#extension GL_NV_ray_tracing : enable
#extension GL_EXT_ray_query : enable
struct Ray
{
vec3 pos;
float tmin;
vec3 dir;
float tmax;
};
layout(std430, set = 0, binding = 0) buffer Log
{
uint x;
uint y;
};
layout(binding = 1, set = 0) uniform accelerationStructureNV rtas;
layout(std430, set = 0, binding = 2) buffer Rays { Ray rays[]; };
void doSomething()
{
x = 0;
y = 0;
}
Ray makeRayDesc()
{
Ray ray;
ray.pos= vec3(0,0,0);
ray.dir = vec3(1,0,0);
ray.tmin = 0.0f;
ray.tmax = 9999.0;
return ray;
}
void main()
{
Ray ray = makeRayDesc();
rayQueryEXT rayQuery;
rayQueryInitializeEXT(rayQuery, rtas, gl_RayFlagsNoneEXT, 0xFF, ray.pos, ray.tmin, ray.dir, ray.tmax);
mat4x3 _mat4x3;
mat3x4 _mat3x4;
while (rayQueryProceedEXT(rayQuery) == 1)
{
int candidateType = rayQueryGetIntersectionTypeEXT(rayQuery, false);
switch(candidateType)
{
case gl_RayQueryCandidateIntersectionTriangleEXT:
rayQueryTerminateEXT(rayQuery);
_mat4x3 = rayQueryGetIntersectionObjectToWorldEXT(rayQuery, false);
_mat3x4 = transpose(_mat4x3);
rayQueryConfirmIntersectionEXT(rayQuery);
if (rayQueryGetIntersectionFrontFaceEXT(rayQuery, true) == 1)
{
doSomething();
}
if (rayQueryGetIntersectionBarycentricsEXT(rayQuery, true) == 0)
{
doSomething();
}
if (rayQueryGetIntersectionInstanceCustomIndexEXT(rayQuery, true))
{
doSomething();
}
if (rayQueryGetIntersectionInstanceIdEXT(rayQuery, true))
{
doSomething();
}
if (rayQueryGetIntersectionObjectRayDirectionEXT(rayQuery, true) > 0)
{
doSomething();
}
if (rayQueryGetIntersectionObjectRayOriginEXT(rayQuery, true) > 0)
{
doSomething();
}
if (rayQueryGetIntersectionPrimitiveIndexEXT(rayQuery, true))
{
doSomething();
}
if (rayQueryGetIntersectionTEXT(rayQuery, true))
{
doSomething();
}
if (rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT(rayQuery, true))
{
doSomething();
}
break;
case gl_RayQueryCandidateIntersectionAABBEXT:
{
_mat4x3 = rayQueryGetIntersectionObjectToWorldEXT(rayQuery, false);
_mat3x4 = transpose(_mat4x3);
if (rayQueryGetIntersectionCandidateAABBOpaqueEXT(rayQuery))
{
doSomething();
}
int t = 1;
rayQueryGenerateIntersectionEXT(rayQuery, t);
rayQueryTerminateEXT(rayQuery);
break;
}
}
}
if(_mat3x4[0][0] == _mat4x3[0][0])
{
doSomething();
}
int committedStatus = rayQueryGetIntersectionTypeEXT(rayQuery, true);
switch(committedStatus)
{
case gl_RayQueryCommittedIntersectionNoneEXT :
_mat4x3 = rayQueryGetIntersectionWorldToObjectEXT(rayQuery, false);
_mat3x4 = transpose(_mat4x3);
break;
case gl_RayQueryCommittedIntersectionTriangleEXT :
_mat4x3 = rayQueryGetIntersectionWorldToObjectEXT(rayQuery, true);
_mat3x4 = transpose(_mat4x3);
if (rayQueryGetIntersectionFrontFaceEXT(rayQuery, true))
{
doSomething();
}
if (rayQueryGetIntersectionBarycentricsEXT(rayQuery, true) == 0)
{
doSomething();
}
break;
case gl_RayQueryCommittedIntersectionGeneratedEXT :
if(rayQueryGetIntersectionGeometryIndexEXT(rayQuery, true) > 0)
{
doSomething();
}
if(rayQueryGetIntersectionInstanceIdEXT(rayQuery, true))
{
doSomething();
}
if(rayQueryGetIntersectionInstanceCustomIndexEXT(rayQuery, true))
{
doSomething();
}
if(rayQueryGetIntersectionObjectRayDirectionEXT(rayQuery, true) > 0)
{
doSomething();
}
if(rayQueryGetIntersectionObjectRayOriginEXT(rayQuery, true) > 0)
{
doSomething();
}
if(rayQueryGetIntersectionPrimitiveIndexEXT(rayQuery, true))
{
doSomething();
}
if(rayQueryGetIntersectionTEXT(rayQuery, true))
{
doSomething();
}
break;
}
if (_mat3x4[0][0] == _mat4x3[0][0])
{
doSomething();
}
if (rayQueryGetRayFlagsEXT(rayQuery))
{
doSomething();
}
if (rayQueryGetRayTMinEXT(rayQuery))
{
doSomething();
}
vec3 o = rayQueryGetWorldRayOriginEXT(rayQuery);
vec3 d = rayQueryGetWorldRayDirectionEXT(rayQuery);
if (o.x == d.z)
{
doSomething();
}
}
#version 460
#extension GL_NV_ray_tracing : enable
#extension GL_EXT_ray_query : enable
struct Ray
{
vec3 pos;
float tmin;
vec3 dir;
float tmax;
};
layout(std430, set = 0, binding = 0) buffer Log
{
uint x;
uint y;
};
layout(binding = 1, set = 0) uniform accelerationStructureNV rtas;
layout(std430, set = 0, binding = 2) buffer Rays { Ray rays[]; };
void doSomething()
{
x = 0;
y = 0;
}
Ray makeRayDesc()
{
Ray ray;
ray.pos= vec3(0,0,0);
ray.dir = vec3(1,0,0);
ray.tmin = 0.0f;
ray.tmax = 9999.0;
return ray;
}
void main()
{
Ray ray = makeRayDesc();
rayQueryEXT rayQuery;
rayQueryInitializeEXT(rayQuery, rtas, gl_RayFlagsNoneEXT, 0xFF, ray.pos, ray.tmin, ray.dir, ray.tmax);
mat4x3 _mat4x3;
mat3x4 _mat3x4;
while (rayQueryProceedEXT(rayQuery))
{
uint candidateType = rayQueryGetIntersectionTypeEXT(rayQuery, false);
switch(candidateType)
{
case gl_RayQueryCandidateIntersectionTriangleEXT:
rayQueryTerminateEXT(rayQuery);
_mat4x3 = rayQueryGetIntersectionObjectToWorldEXT(rayQuery, false);
_mat3x4 = transpose(_mat4x3);
rayQueryConfirmIntersectionEXT(rayQuery);
if (rayQueryGetIntersectionFrontFaceEXT(rayQuery, true))
{
doSomething();
}
if (rayQueryGetIntersectionBarycentricsEXT(rayQuery, true).x == 0)
{
doSomething();
}
if (rayQueryGetIntersectionInstanceCustomIndexEXT(rayQuery, true) > 0)
{
doSomething();
}
if (rayQueryGetIntersectionInstanceIdEXT(rayQuery, true) > 0)
{
doSomething();
}
if (rayQueryGetIntersectionObjectRayDirectionEXT(rayQuery, true).x > 0)
{
doSomething();
}
if (rayQueryGetIntersectionObjectRayOriginEXT(rayQuery, true).x > 0)
{
doSomething();
}
if (rayQueryGetIntersectionPrimitiveIndexEXT(rayQuery, true) > 0)
{
doSomething();
}
if (rayQueryGetIntersectionTEXT(rayQuery, true) > 0.f)
{
doSomething();
}
if (rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT(rayQuery, true) > 0)
{
doSomething();
}
break;
case gl_RayQueryCandidateIntersectionAABBEXT:
{
_mat4x3 = rayQueryGetIntersectionObjectToWorldEXT(rayQuery, false);
_mat3x4 = transpose(_mat4x3);
if (rayQueryGetIntersectionCandidateAABBOpaqueEXT(rayQuery))
{
doSomething();
}
float t = 0.5;
rayQueryGenerateIntersectionEXT(rayQuery, t);
rayQueryTerminateEXT(rayQuery);
break;
}
}
}
if(_mat3x4[0][0] == _mat4x3[0][0])
{
doSomething();
}
uint committedStatus = rayQueryGetIntersectionTypeEXT(rayQuery, true);
switch(committedStatus)
{
case gl_RayQueryCommittedIntersectionNoneEXT :
_mat4x3 = rayQueryGetIntersectionWorldToObjectEXT(rayQuery, false);
_mat3x4 = transpose(_mat4x3);
break;
case gl_RayQueryCommittedIntersectionTriangleEXT :
_mat4x3 = rayQueryGetIntersectionWorldToObjectEXT(rayQuery, true);
_mat3x4 = transpose(_mat4x3);
if (rayQueryGetIntersectionFrontFaceEXT(rayQuery, true))
{
doSomething();
}
if (rayQueryGetIntersectionBarycentricsEXT(rayQuery, true).y == 0)
{
doSomething();
}
break;
case gl_RayQueryCommittedIntersectionGeneratedEXT :
if(rayQueryGetIntersectionGeometryIndexEXT(rayQuery, true) > 0)
{
doSomething();
}
if(rayQueryGetIntersectionInstanceIdEXT(rayQuery, true) > 0)
{
doSomething();
}
if(rayQueryGetIntersectionInstanceCustomIndexEXT(rayQuery, true) > 0)
{
doSomething();
}
if(rayQueryGetIntersectionObjectRayDirectionEXT(rayQuery, true).z > 0)
{
doSomething();
}
if(rayQueryGetIntersectionObjectRayOriginEXT(rayQuery, true).x > 0)
{
doSomething();
}
if(rayQueryGetIntersectionPrimitiveIndexEXT(rayQuery, true) > 0)
{
doSomething();
}
if(rayQueryGetIntersectionTEXT(rayQuery, true) > 0.f)
{
doSomething();
}
break;
}
if (_mat3x4[0][0] == _mat4x3[0][0])
{
doSomething();
}
if (rayQueryGetRayFlagsEXT(rayQuery) > 0)
{
doSomething();
}
if (rayQueryGetRayTMinEXT(rayQuery) > 0.0)
{
doSomething();
}
vec3 o = rayQueryGetWorldRayOriginEXT(rayQuery);
vec3 d = rayQueryGetWorldRayDirectionEXT(rayQuery);
if (o.x == d.z)
{
doSomething();
}
}
#version 460
#extension GL_NV_ray_tracing : enable
#extension GL_EXT_ray_query : enable
struct Ray
{
vec3 pos;
float tmin;
vec3 dir;
float tmax;
};
layout(std430, set = 0, binding = 0) buffer Log
{
uint x;
uint y;
};
layout(binding = 1, set = 0) uniform accelerationStructureNV rtas;
layout(std430, set = 0, binding = 2) buffer Rays { Ray rays[]; };
void doSomething()
{
x = 0;
y = 0;
}
Ray makeRayDesc()
{
Ray ray;
ray.pos= vec3(0,0,0);
ray.dir = vec3(1,0,0);
ray.tmin = 0.0f;
ray.tmax = 9999.0;
return ray;
}
void main()
{
Ray ray = makeRayDesc();
rayQueryEXT rayQuery;
rayQueryInitializeEXT(rayQuery, rtas, gl_RayFlagsNoneEXT, 0xFF, ray.pos, ray.tmin, ray.dir, ray.tmax);
mat4x3 _mat4x3;
mat3x4 _mat3x4;
while (rayQueryProceedEXT(rayQuery))
{
uint candidateType = rayQueryGetIntersectionTypeEXT(rayQuery, false);
switch(candidateType)
{
case gl_RayQueryCandidateIntersectionTriangleEXT:
rayQueryTerminateEXT(rayQuery);
_mat4x3 = rayQueryGetIntersectionObjectToWorldEXT(rayQuery, false);
_mat3x4 = transpose(_mat4x3);
rayQueryConfirmIntersectionEXT(rayQuery);
if (rayQueryGetIntersectionFrontFaceEXT(rayQuery, true))
{
doSomething();
}
if (rayQueryGetIntersectionBarycentricsEXT(rayQuery, true).x == 0)
{
doSomething();
}
if (rayQueryGetIntersectionInstanceCustomIndexEXT(rayQuery, true) > 0)
{
doSomething();
}
if (rayQueryGetIntersectionInstanceIdEXT(rayQuery, true) > 0)
{
doSomething();
}
if (rayQueryGetIntersectionObjectRayDirectionEXT(rayQuery, true).x > 0)
{
doSomething();
}
if (rayQueryGetIntersectionObjectRayOriginEXT(rayQuery, true).x > 0)
{
doSomething();
}
if (rayQueryGetIntersectionPrimitiveIndexEXT(rayQuery, true) > 0)
{
doSomething();
}
if (rayQueryGetIntersectionTEXT(rayQuery, true) > 0.f)
{
doSomething();
}
if (rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT(rayQuery, true) > 0)
{
doSomething();
}
break;
case gl_RayQueryCandidateIntersectionAABBEXT:
{
_mat4x3 = rayQueryGetIntersectionObjectToWorldEXT(rayQuery, false);
_mat3x4 = transpose(_mat4x3);
if (rayQueryGetIntersectionCandidateAABBOpaqueEXT(rayQuery))
{
doSomething();
}
float t = 0.5;
rayQueryGenerateIntersectionEXT(rayQuery, t);
rayQueryTerminateEXT(rayQuery);
break;
}
}
}
if(_mat3x4[0][0] == _mat4x3[0][0])
{
doSomething();
}
uint committedStatus = rayQueryGetIntersectionTypeEXT(rayQuery, true);
switch(committedStatus)
{
case gl_RayQueryCommittedIntersectionNoneEXT :
_mat4x3 = rayQueryGetIntersectionWorldToObjectEXT(rayQuery, false);
_mat3x4 = transpose(_mat4x3);
break;
case gl_RayQueryCommittedIntersectionTriangleEXT :
_mat4x3 = rayQueryGetIntersectionWorldToObjectEXT(rayQuery, true);
_mat3x4 = transpose(_mat4x3);
if (rayQueryGetIntersectionFrontFaceEXT(rayQuery, true))
{
doSomething();
}
if (rayQueryGetIntersectionBarycentricsEXT(rayQuery, true).y == 0)
{
doSomething();
}
break;
case gl_RayQueryCommittedIntersectionGeneratedEXT :
if(rayQueryGetIntersectionGeometryIndexEXT(rayQuery, true) > 0)
{
doSomething();
}
if(rayQueryGetIntersectionInstanceIdEXT(rayQuery, true) > 0)
{
doSomething();
}
if(rayQueryGetIntersectionInstanceCustomIndexEXT(rayQuery, true) > 0)
{
doSomething();
}
if(rayQueryGetIntersectionObjectRayDirectionEXT(rayQuery, true).z > 0)
{
doSomething();
}
if(rayQueryGetIntersectionObjectRayOriginEXT(rayQuery, true).x > 0)
{
doSomething();
}
if(rayQueryGetIntersectionPrimitiveIndexEXT(rayQuery, true) > 0)
{
doSomething();
}
if(rayQueryGetIntersectionTEXT(rayQuery, true) > 0.f)
{
doSomething();
}
break;
}
if (_mat3x4[0][0] == _mat4x3[0][0])
{
doSomething();
}
if (rayQueryGetRayFlagsEXT(rayQuery) > 0)
{
doSomething();
}
if (rayQueryGetRayTMinEXT(rayQuery) > 0.0)
{
doSomething();
}
vec3 o = rayQueryGetWorldRayOriginEXT(rayQuery);
vec3 d = rayQueryGetWorldRayDirectionEXT(rayQuery);
if (o.x == d.z)
{
doSomething();
}
}
#version 460
#extension GL_NV_ray_tracing : enable
#extension GL_EXT_ray_query : enable
struct Ray
{
vec3 pos;
float tmin;
vec3 dir;
float tmax;
};
layout(std430, set = 0, binding = 0) buffer Log
{
uint x;
uint y;
};
layout(binding = 1, set = 0) uniform accelerationStructureNV rtas;
layout(std430, set = 0, binding = 2) buffer Rays { Ray rays[]; };
void doSomething()
{
x = 0;
y = 0;
}
Ray makeRayDesc()
{
Ray ray;
ray.pos= vec3(0,0,0);
ray.dir = vec3(1,0,0);
ray.tmin = 0.0f;
ray.tmax = 9999.0;
return ray;
}
void main()
{
Ray ray = makeRayDesc();
rayQueryEXT rayQuery;
rayQueryInitializeEXT(rayQuery, rtas, gl_RayFlagsNoneEXT, 0xFF, ray.pos, ray.tmin, ray.dir, ray.tmax);
mat4x3 _mat4x3;
mat3x4 _mat3x4;
while (rayQueryProceedEXT(rayQuery))
{
uint candidateType = rayQueryGetIntersectionTypeEXT(rayQuery, false);
switch(candidateType)
{
case gl_RayQueryCandidateIntersectionTriangleEXT:
rayQueryTerminateEXT(rayQuery);
_mat4x3 = rayQueryGetIntersectionObjectToWorldEXT(rayQuery, false);
_mat3x4 = transpose(_mat4x3);
rayQueryConfirmIntersectionEXT(rayQuery);
if (rayQueryGetIntersectionFrontFaceEXT(rayQuery, true))
{
doSomething();
}
if (rayQueryGetIntersectionBarycentricsEXT(rayQuery, true).x == 0)
{
doSomething();
}
if (rayQueryGetIntersectionInstanceCustomIndexEXT(rayQuery, true) > 0)
{
doSomething();
}
if (rayQueryGetIntersectionInstanceIdEXT(rayQuery, true) > 0)
{
doSomething();
}
if (rayQueryGetIntersectionObjectRayDirectionEXT(rayQuery, true).x > 0)
{
doSomething();
}
if (rayQueryGetIntersectionObjectRayOriginEXT(rayQuery, true).x > 0)
{
doSomething();
}
if (rayQueryGetIntersectionPrimitiveIndexEXT(rayQuery, true) > 0)
{
doSomething();
}
if (rayQueryGetIntersectionTEXT(rayQuery, true) > 0.f)
{
doSomething();
}
if (rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT(rayQuery, true) > 0)
{
doSomething();
}
break;
case gl_RayQueryCandidateIntersectionAABBEXT:
{
_mat4x3 = rayQueryGetIntersectionObjectToWorldEXT(rayQuery, false);
_mat3x4 = transpose(_mat4x3);
if (rayQueryGetIntersectionCandidateAABBOpaqueEXT(rayQuery))
{
doSomething();
}
float t = 0.5;
rayQueryGenerateIntersectionEXT(rayQuery, t);
rayQueryTerminateEXT(rayQuery);
break;
}
}
}
if(_mat3x4[0][0] == _mat4x3[0][0])
{
doSomething();
}
uint committedStatus = rayQueryGetIntersectionTypeEXT(rayQuery, true);
switch(committedStatus)
{
case gl_RayQueryCommittedIntersectionNoneEXT :
_mat4x3 = rayQueryGetIntersectionWorldToObjectEXT(rayQuery, false);
_mat3x4 = transpose(_mat4x3);
break;
case gl_RayQueryCommittedIntersectionTriangleEXT :
_mat4x3 = rayQueryGetIntersectionWorldToObjectEXT(rayQuery, true);
_mat3x4 = transpose(_mat4x3);
if (rayQueryGetIntersectionFrontFaceEXT(rayQuery, true))
{
doSomething();
}
if (rayQueryGetIntersectionBarycentricsEXT(rayQuery, true).y == 0)
{
doSomething();
}
break;
case gl_RayQueryCommittedIntersectionGeneratedEXT :
if(rayQueryGetIntersectionGeometryIndexEXT(rayQuery, true) > 0)
{
doSomething();
}
if(rayQueryGetIntersectionInstanceIdEXT(rayQuery, true) > 0)
{
doSomething();
}
if(rayQueryGetIntersectionInstanceCustomIndexEXT(rayQuery, true) > 0)
{
doSomething();
}
if(rayQueryGetIntersectionObjectRayDirectionEXT(rayQuery, true).z > 0)
{
doSomething();
}
if(rayQueryGetIntersectionObjectRayOriginEXT(rayQuery, true).x > 0)
{
doSomething();
}
if(rayQueryGetIntersectionPrimitiveIndexEXT(rayQuery, true) > 0)
{
doSomething();
}
if(rayQueryGetIntersectionTEXT(rayQuery, true) > 0.f)
{
doSomething();
}
break;
}
if (_mat3x4[0][0] == _mat4x3[0][0])
{
doSomething();
}
if (rayQueryGetRayFlagsEXT(rayQuery) > 0)
{
doSomething();
}
if (rayQueryGetRayTMinEXT(rayQuery) > 0.0)
{
doSomething();
}
vec3 o = rayQueryGetWorldRayOriginEXT(rayQuery);
vec3 d = rayQueryGetWorldRayDirectionEXT(rayQuery);
if (o.x == d.z)
{
doSomething();
}
}
#version 460
#extension GL_NV_ray_tracing : enable
#extension GL_EXT_ray_query : enable
struct Ray
{
vec3 pos;
float tmin;
vec3 dir;
float tmax;
};
layout(binding = 0, set = 0) uniform accelerationStructureNV rtas;
layout(std430, set = 0, binding = 2) buffer Rays { Ray rays[]; };
uint launchIndex()
{
return gl_LaunchIDNV.z*gl_LaunchSizeNV.x*gl_LaunchSizeNV.y + gl_LaunchIDNV.y*gl_LaunchSizeNV.x + gl_LaunchIDNV.x;
}
void doInitialize(rayQueryEXT rayQuery, Ray ray)
{
rayQueryInitializeEXT(rayQuery, rtas, gl_RayFlagsNoneEXT, gl_RayFlagsCullBackFacingTrianglesEXT, ray.pos, ray.tmin, ray.dir, ray.tmax);
}
int C;
void main()
{
uint index = launchIndex();
Ray ray = rays[index];
rayQueryEXT rayQuery[2];
doInitialize(rayQuery[0], rays[index]);
rayQueryInitializeEXT(rayQuery[1], rtas, gl_RayFlagsOpaqueEXT, gl_RayFlagsCullFrontFacingTrianglesEXT, ray.pos, ray.tmin, ray.dir, ray.tmax);
doInitialize(rayQuery[C], ray);
}
#version 460
#extension GL_NV_ray_tracing : enable
#extension GL_EXT_ray_query : enable
struct Ray
{
vec3 pos;
float tmin;
vec3 dir;
float tmax;
};
layout(std430, set = 0, binding = 0) buffer Log
{
uint x;
uint y;
};
layout(binding = 1, set = 0) uniform accelerationStructureNV rtas;
layout(std430, set = 0, binding = 2) buffer Rays { Ray rays[]; };
void doSomething()
{
x = 0;
y = 0;
}
uint launchIndex()
{
return gl_LaunchIDNV.z*gl_LaunchSizeNV.x*gl_LaunchSizeNV.y + gl_LaunchIDNV.y*gl_LaunchSizeNV.x + gl_LaunchIDNV.x;
}
void main()
{
uint index = launchIndex();
Ray ray = rays[index];
rayQueryEXT rayQuery;
bool committed_true = true;
bool committed_false = false;
rayQueryInitializeEXT(rayQuery, rtas, gl_RayFlagsOpaqueEXT, gl_RayFlagsCullBackFacingTrianglesEXT, ray.pos, ray.tmin, ray.dir, ray.tmax);
while (rayQueryProceedEXT(rayQuery))
{
mat4x3 mat_o2w;
mat4x3 mat_w2o;
uint candidateType = rayQueryGetIntersectionTypeEXT(rayQuery, committed_false);
if (candidateType == gl_RayQueryCandidateIntersectionTriangleEXT)
{
rayQueryTerminateEXT(rayQuery);
mat_o2w = rayQueryGetIntersectionObjectToWorldEXT(rayQuery, committed_false);
mat_w2o = rayQueryGetIntersectionWorldToObjectEXT(rayQuery, committed_false);
rayQueryConfirmIntersectionEXT(rayQuery);
if (rayQueryGetIntersectionFrontFaceEXT(rayQuery, committed_true))
{
doSomething();
}
if (rayQueryGetIntersectionBarycentricsEXT(rayQuery, committed_true).x == 0)
{
doSomething();
}
if (rayQueryGetIntersectionInstanceCustomIndexEXT(rayQuery, committed_true) > 0)
{
doSomething();
}
if (rayQueryGetIntersectionInstanceIdEXT(rayQuery, committed_true) > 0)
{
doSomething();
}
if (rayQueryGetIntersectionObjectRayDirectionEXT(rayQuery, committed_true).x > 0)
{
doSomething();
}
if (rayQueryGetIntersectionObjectRayOriginEXT(rayQuery, committed_true).x > 0)
{
doSomething();
}
if (rayQueryGetIntersectionPrimitiveIndexEXT(rayQuery, committed_true) > 0)
{
doSomething();
}
if (rayQueryGetIntersectionTEXT(rayQuery, committed_true) > 0.f)
{
doSomething();
}
if (rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT(rayQuery, committed_true) > 0)
{
doSomething();
}
}
}
uint committedStatus = rayQueryGetIntersectionTypeEXT(rayQuery, committed_true);
if (committedStatus == gl_RayQueryCommittedIntersectionGeneratedEXT)
{
if (rayQueryGetIntersectionGeometryIndexEXT(rayQuery, committed_true) > 0)
{
doSomething();
}
}
}
#version 460
#extension GL_NV_ray_tracing : enable
#extension GL_EXT_ray_query : enable
struct Ray
{
vec3 pos;
float tmin;
vec3 dir;
float tmax;
};
layout(binding = 0, set = 0) uniform accelerationStructureNV rtas;
layout(std430, set = 0, binding = 2) buffer Rays { Ray rays[]; };
layout(shaderRecordNV) buffer block
{
uint idx;
};
uint launchIndex()
{
return gl_LaunchIDNV.z*gl_LaunchSizeNV.x*gl_LaunchSizeNV.y + gl_LaunchIDNV.y*gl_LaunchSizeNV.x + gl_LaunchIDNV.x;
}
rayQueryEXT g_rayQueryArray[4];
rayQueryEXT g_rayQueryUnused;
void main()
{
uint index = launchIndex();
Ray ray = rays[index];
rayQueryEXT rayQuery0a;
rayQueryEXT rayQuery0b;
g_rayQueryArray[idx] = rayQuery0b; // Stored here, then overwritten with rayQuery0a
g_rayQueryArray[idx] = rayQuery0a;
// No separate allocation, just a handle copy
// optimizations should have eliminated load from global array
rayQueryEXT rayQuery0c = g_rayQueryArray[idx];
// rayQuery0a is the one actually used here
rayQueryInitializeEXT(rayQuery0c, rtas, gl_RayFlagsOpaqueEXT, gl_RayFlagsCullBackFacingTrianglesEXT, ray.pos, ray.tmin, ray.dir, ray.tmax);
// AllocateRayQuery occurs here, rather than next to allocas
// Should not be extray allocate, since above should allocate and copy
rayQueryEXT rayQuery1c;
// update the rayFlags as RAY_FLAG_FORCE_OPAQUE
rayQueryInitializeEXT(rayQuery1c, rtas, gl_RayFlagsOpaqueEXT, gl_RayFlagsCullFrontFacingTrianglesEXT, ray.pos, ray.tmin, ray.dir, ray.tmax);
rayQueryInitializeEXT(rayQuery1c, rtas, gl_RayFlagsOpaqueEXT|gl_RayFlagsNoOpaqueEXT, gl_RayFlagsCullOpaqueEXT, ray.pos, ray.tmin, ray.dir, ray.tmax);
}
#version 460
#extension GL_NV_ray_tracing : enable
#extension GL_EXT_ray_query : enable
struct Ray
{
vec3 pos;
float tmin;
vec3 dir;
float tmax;
};
layout(binding = 0, set = 0) uniform accelerationStructureNV rtas;
layout(std430, set = 0, binding = 2) buffer Rays { Ray rays[]; };
uint launchIndex()
{
return gl_LaunchIDNV.z*gl_LaunchSizeNV.x*gl_LaunchSizeNV.y + gl_LaunchIDNV.y*gl_LaunchSizeNV.x + gl_LaunchIDNV.x;
}
void doInitialize(rayQueryEXT rayQuery, Ray ray)
{
rayQueryInitializeEXT(rayQuery, rtas, gl_RayFlagsNoneEXT, gl_RayFlagsCullBackFacingTrianglesEXT, ray.pos, ray.tmin, ray.dir, ray.tmax);
}
void main()
{
uint index = launchIndex();
Ray ray = rays[index];
rayQueryEXT rayQuery;
doInitialize(rayQuery, ray);
rayQueryInitializeEXT(rayQuery, rtas, gl_RayFlagsOpaqueEXT, gl_RayFlagsCullFrontFacingTrianglesEXT, ray.pos, ray.tmin, ray.dir, ray.tmax);
}
#version 460
#extension GL_NV_ray_tracing : enable
#extension GL_EXT_ray_query : enable
struct Ray
{
vec3 pos;
float tmin;
vec3 dir;
float tmax;
};
layout(binding = 0, set = 0) uniform accelerationStructureNV rtas;
layout(std430, set = 0, binding = 2) buffer Rays { Ray rays[]; };
uint launchIndex()
{
return gl_LaunchIDNV.z*gl_LaunchSizeNV.x*gl_LaunchSizeNV.y + gl_LaunchIDNV.y*gl_LaunchSizeNV.x + gl_LaunchIDNV.x;
}
void doInitialize(rayQueryEXT rayQuery, Ray ray)
{
rayQueryInitializeEXT(rayQuery, rtas, gl_RayFlagsNoneEXT, gl_RayFlagsCullBackFacingTrianglesEXT, ray.pos, ray.tmin, ray.dir, ray.tmax);
}
void main()
{
uint index = launchIndex();
Ray ray = rays[index];
rayQueryEXT rayQuery1;
rayQueryEXT rayQuery2;
doInitialize(rayQuery1, ray);
rayQueryInitializeEXT(rayQuery1, rtas, gl_RayFlagsOpaqueEXT, gl_RayFlagsCullFrontFacingTrianglesEXT, ray.pos, ray.tmin, ray.dir, ray.tmax);
doInitialize(rayQuery2, ray);
}
#version 460
#extension GL_NV_ray_tracing : enable
#extension GL_EXT_ray_query : enable
layout(binding = 0, set = 0) uniform accelerationStructureNV accNV0;
layout(shaderRecordNV) buffer block
{
vec3 dir;
vec3 origin;
};
void main()
{
rayQueryEXT localRayQuery;
uint rayFlags = gl_RayFlagsOpaqueEXT | gl_RayFlagsSkipClosestHitShaderEXT;
float tMin = 0.f;
float tMax = 1000.f;
rayQueryInitializeEXT(localRayQuery, accNV0, rayFlags, 0xFF , origin, tMin, dir, tMax);
if (!rayQueryProceedEXT(localRayQuery))
{
rayQueryTerminateEXT(localRayQuery);
}
}
......@@ -2,6 +2,7 @@
// Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
// Copyright (C) 2012-2013 LunarG, Inc.
// Copyright (C) 2017 ARM Limited.
// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
//
// All rights reserved.
//
......@@ -63,6 +64,7 @@ enum TBasicType {
EbtBlock,
EbtAccStruct,
EbtReference,
EbtRayQuery,
// HLSL types that live only temporarily.
EbtString,
......
......@@ -3,6 +3,7 @@
// Copyright (C) 2012-2016 LunarG, Inc.
// Copyright (C) 2015-2016 Google, Inc.
// Copyright (C) 2017 ARM Limited.
// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
//
// All rights reserved.
//
......@@ -1950,6 +1951,7 @@ public:
case EbtStruct: return "structure";
case EbtBlock: return "block";
case EbtAccStruct: return "accelerationStructureNV";
case EbtRayQuery: return "rayQueryEXT";
case EbtReference: return "reference";
#endif
default: return "unknown type";
......
......@@ -2,6 +2,7 @@
// Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
// Copyright (C) 2012-2016 LunarG, Inc.
// Copyright (C) 2017 ARM Limited.
// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
//
// All rights reserved.
//
......@@ -916,6 +917,35 @@ enum TOperator {
EOpTerminateRay,
EOpExecuteCallable,
EOpWritePackedPrimitiveIndices4x8NV,
//
// GL_EXT_ray_query operations
//
EOpRayQueryInitialize,
EOpRayQueryTerminate,
EOpRayQueryGenerateIntersection,
EOpRayQueryConfirmIntersection,
EOpRayQueryProceed,
EOpRayQueryGetIntersectionType,
EOpRayQueryGetRayTMin,
EOpRayQueryGetRayFlags,
EOpRayQueryGetIntersectionT,
EOpRayQueryGetIntersectionInstanceCustomIndex,
EOpRayQueryGetIntersectionInstanceId,
EOpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffset,
EOpRayQueryGetIntersectionGeometryIndex,
EOpRayQueryGetIntersectionPrimitiveIndex,
EOpRayQueryGetIntersectionBarycentrics,
EOpRayQueryGetIntersectionFrontFace,
EOpRayQueryGetIntersectionCandidateAABBOpaque,
EOpRayQueryGetIntersectionObjectRayDirection,
EOpRayQueryGetIntersectionObjectRayOrigin,
EOpRayQueryGetWorldRayDirection,
EOpRayQueryGetWorldRayOrigin,
EOpRayQueryGetIntersectionObjectToWorld,
EOpRayQueryGetIntersectionWorldToObject,
//
// HLSL operations
//
......
......@@ -3,6 +3,7 @@
// Copyright (C) 2012-2015 LunarG, Inc.
// Copyright (C) 2015-2018 Google, Inc.
// Copyright (C) 2017, 2019 ARM Limited.
// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
//
// All rights reserved.
//
......@@ -2041,6 +2042,23 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
error(loc, "argument must be compile-time constant", "callable data number", "");
break;
case EOpRayQueryGetIntersectionType:
case EOpRayQueryGetIntersectionT:
case EOpRayQueryGetIntersectionInstanceCustomIndex:
case EOpRayQueryGetIntersectionInstanceId:
case EOpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffset:
case EOpRayQueryGetIntersectionGeometryIndex:
case EOpRayQueryGetIntersectionPrimitiveIndex:
case EOpRayQueryGetIntersectionBarycentrics:
case EOpRayQueryGetIntersectionFrontFace:
case EOpRayQueryGetIntersectionObjectRayDirection:
case EOpRayQueryGetIntersectionObjectRayOrigin:
case EOpRayQueryGetIntersectionObjectToWorld:
case EOpRayQueryGetIntersectionWorldToObject:
if (!(*argp)[1]->getAsConstantUnion())
error(loc, "argument must be compile-time constant", "committed", "");
break;
case EOpTextureQuerySamples:
case EOpImageQuerySamples:
// GL_ARB_shader_texture_image_samples
......@@ -3992,7 +4010,7 @@ void TParseContext::checkRuntimeSizable(const TSourceLoc& loc, const TIntermType
}
// check for additional things allowed by GL_EXT_nonuniform_qualifier
if (base.getBasicType() == EbtSampler || base.getBasicType() == EbtAccStruct ||
if (base.getBasicType() == EbtSampler || base.getBasicType() == EbtAccStruct || base.getBasicType() == EbtRayQuery ||
(base.getBasicType() == EbtBlock && base.getType().getQualifier().isUniformOrBuffer()))
requireExtensions(loc, 1, &E_GL_EXT_nonuniform_qualifier, "variable index");
else
......
......@@ -3,6 +3,7 @@
// Copyright (C) 2013 LunarG, Inc.
// Copyright (C) 2017 ARM Limited.
// Copyright (C) 2020 Google, Inc.
// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
//
// All rights reserved.
//
......@@ -715,6 +716,7 @@ void TScanContext::fillInKeywordMap()
(*KeywordMap)["callableDataInEXT"] = CALLDATAINEXT;
(*KeywordMap)["accelerationStructureNV"] = ACCSTRUCTNV;
(*KeywordMap)["accelerationStructureEXT"] = ACCSTRUCTEXT;
(*KeywordMap)["rayQueryEXT"] = RAYQUERYEXT;
(*KeywordMap)["perprimitiveNV"] = PERPRIMITIVENV;
(*KeywordMap)["perviewNV"] = PERVIEWNV;
(*KeywordMap)["taskNV"] = PERTASKNV;
......@@ -1031,6 +1033,12 @@ int TScanContext::tokenizeIdentifier()
parseContext.extensionTurnedOn(E_GL_EXT_ray_tracing))
return keyword;
return identifierOrType();
case RAYQUERYEXT:
if (parseContext.symbolTable.atBuiltInLevel() ||
(!parseContext.isEsProfile() && parseContext.version >= 460
&& parseContext.extensionTurnedOn(E_GL_EXT_ray_query)))
return keyword;
return identifierOrType();
case ATOMIC_UINT:
if ((parseContext.isEsProfile() && parseContext.version >= 310) ||
parseContext.extensionTurnedOn(E_GL_ARB_shader_atomic_counters))
......
......@@ -3,6 +3,7 @@
// Copyright (C) 2012-2013 LunarG, Inc.
// Copyright (C) 2017 ARM Limited.
// Copyright (C) 2015-2018 Google, Inc.
// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
//
// All rights reserved.
//
......@@ -75,6 +76,7 @@ void TType::buildMangledName(TString& mangledName) const
case EbtUint64: mangledName += "u64"; break;
case EbtAtomicUint: mangledName += "au"; break;
case EbtAccStruct: mangledName += "as"; break;
case EbtRayQuery: mangledName += "rq"; break;
#endif
case EbtSampler:
switch (sampler.type) {
......
......@@ -3,6 +3,7 @@
// Copyright (C) 2012-2013 LunarG, Inc.
// Copyright (C) 2017 ARM Limited.
// Copyright (C) 2015-2020 Google, Inc.
// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
//
// All rights reserved.
//
......@@ -296,6 +297,7 @@ void TParseVersions::initializeExtensionBehavior()
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;
// OVR extensions
extensionBehavior[E_GL_OVR_multiview] = EBhDisable;
......@@ -435,6 +437,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define E_GL_EXT_shader_atomic_int64 1\n"
"#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 GL_AMD_shader_ballot 1\n"
"#define GL_AMD_shader_trinary_minmax 1\n"
......
......@@ -3,6 +3,7 @@
// Copyright (C) 2012-2013 LunarG, Inc.
// Copyright (C) 2017 ARM Limited.
// Copyright (C) 2015-2018 Google, Inc.
// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
//
// All rights reserved.
//
......@@ -187,6 +188,7 @@ const char* const E_GL_EXT_demote_to_helper_invocation = "GL_EXT_demote_to_
const char* const E_GL_EXT_shader_realtime_clock = "GL_EXT_shader_realtime_clock";
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";
// Arrays of extensions for the above viewportEXTs duplications
......
......@@ -3,6 +3,7 @@
// Copyright (C) 2012-2013 LunarG, Inc.
// Copyright (C) 2017 ARM Limited.
// Copyright (C) 2015-2019 Google, Inc.
// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
//
// All rights reserved.
//
......@@ -205,6 +206,7 @@ GLSLANG_WEB_EXCLUDE_ON
%token <lex> ATOMIC_UINT
%token <lex> ACCSTRUCTNV
%token <lex> ACCSTRUCTEXT
%token <lex> RAYQUERYEXT
%token <lex> FCOOPMATNV ICOOPMATNV UCOOPMATNV
// combined image/sampler
......@@ -2406,6 +2408,10 @@ GLSLANG_WEB_EXCLUDE_ON
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtAccStruct;
}
| RAYQUERYEXT {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtRayQuery;
}
| ATOMIC_UINT {
parseContext.vulkanRemoved($1.loc, "atomic counter types");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
......
......@@ -3,6 +3,7 @@
// Copyright (C) 2012-2013 LunarG, Inc.
// Copyright (C) 2017 ARM Limited.
// Copyright (C) 2015-2019 Google, Inc.
// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
//
// All rights reserved.
//
......@@ -205,6 +206,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> ATOMIC_UINT
%token <lex> ACCSTRUCTNV
%token <lex> ACCSTRUCTEXT
%token <lex> RAYQUERYEXT
%token <lex> FCOOPMATNV ICOOPMATNV UCOOPMATNV
// combined image/sampler
......@@ -2406,6 +2408,10 @@ type_specifier_nonarray
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtAccStruct;
}
| RAYQUERYEXT {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtRayQuery;
}
| ATOMIC_UINT {
parseContext.vulkanRemoved($1.loc, "atomic counter types");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
......@@ -3879,3 +3885,4 @@ single_attribute
%%
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -2,6 +2,7 @@
// Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
// Copyright (C) 2012-2016 LunarG, Inc.
// Copyright (C) 2017 ARM Limited.
// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
//
// All rights reserved.
//
......@@ -1085,6 +1086,30 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
case EOpExecuteCallable: out.debug << "executeCallableNV"; break;
case EOpWritePackedPrimitiveIndices4x8NV: out.debug << "writePackedPrimitiveIndices4x8NV"; break;
case EOpRayQueryInitialize: out.debug << "rayQueryInitializeEXT"; break;
case EOpRayQueryTerminate: out.debug << "rayQueryTerminateEXT"; break;
case EOpRayQueryGenerateIntersection: out.debug << "rayQueryGenerateIntersectionEXT"; break;
case EOpRayQueryConfirmIntersection: out.debug << "rayQueryConfirmIntersectionEXT"; break;
case EOpRayQueryProceed: out.debug << "rayQueryProceedEXT"; break;
case EOpRayQueryGetIntersectionType: out.debug << "rayQueryGetIntersectionTypeEXT"; break;
case EOpRayQueryGetRayTMin: out.debug << "rayQueryGetRayTMinEXT"; break;
case EOpRayQueryGetRayFlags: out.debug << "rayQueryGetRayFlagsEXT"; break;
case EOpRayQueryGetIntersectionT: out.debug << "rayQueryGetIntersectionTEXT"; break;
case EOpRayQueryGetIntersectionInstanceCustomIndex: out.debug << "rayQueryGetIntersectionInstanceCustomIndexEXT"; break;
case EOpRayQueryGetIntersectionInstanceId: out.debug << "rayQueryGetIntersectionInstanceIdEXT"; break;
case EOpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffset: out.debug << "rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT"; break;
case EOpRayQueryGetIntersectionGeometryIndex: out.debug << "rayQueryGetIntersectionGeometryIndexEXT"; break;
case EOpRayQueryGetIntersectionPrimitiveIndex: out.debug << "rayQueryGetIntersectionPrimitiveIndexEXT"; break;
case EOpRayQueryGetIntersectionBarycentrics: out.debug << "rayQueryGetIntersectionBarycentricsEXT"; break;
case EOpRayQueryGetIntersectionFrontFace: out.debug << "rayQueryGetIntersectionFrontFaceEXT"; break;
case EOpRayQueryGetIntersectionCandidateAABBOpaque: out.debug << "rayQueryGetIntersectionCandidateAABBOpaqueEXT"; break;
case EOpRayQueryGetIntersectionObjectRayDirection: out.debug << "rayQueryGetIntersectionObjectRayDirectionEXT"; break;
case EOpRayQueryGetIntersectionObjectRayOrigin: out.debug << "rayQueryGetIntersectionObjectRayOriginEXT"; break;
case EOpRayQueryGetWorldRayDirection: out.debug << "rayQueryGetWorldRayDirectionEXT"; break;
case EOpRayQueryGetWorldRayOrigin: out.debug << "rayQueryGetWorldRayOriginEXT"; break;
case EOpRayQueryGetIntersectionObjectToWorld: out.debug << "rayQueryGetIntersectionObjectToWorldEXT"; break;
case EOpRayQueryGetIntersectionWorldToObject: out.debug << "rayQueryGetIntersectionWorldToObjectEXT"; break;
case EOpCooperativeMatrixLoad: out.debug << "Load cooperative matrix"; break;
case EOpCooperativeMatrixStore: out.debug << "Store cooperative matrix"; break;
case EOpCooperativeMatrixMulAdd: out.debug << "MulAdd cooperative matrices"; break;
......
......@@ -105,6 +105,7 @@ TEST_P(CompileVulkanToDebugSpirvTest, FromFile)
"/baseResults/", false, true);
}
TEST_P(CompileVulkan1_1ToSpirvTest, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
......@@ -229,6 +230,16 @@ INSTANTIATE_TEST_CASE_P(
"spv.while-continue-break.vert",
"spv.while-simple.vert",
// vulkan-specific tests
"rayQuery.rgen",
"rayQuery-array-2d-dynamic.rgen",
"rayQuery-decls.rgen",
"rayQuery-no-cse.rgen",
"rayQuery-initialize.rgen",
"rayQuery-allOps.rgen",
"rayQuery-allOps.Error.rgen",
"rayQuery-committed.Error.rgen",
"rayQuery-allOps.comp",
"rayQuery-allOps.frag",
"spv.set.vert",
"spv.double.comp",
"spv.100ops.frag",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment