Unverified Commit 99508c1c by John Kessenich Committed by GitHub

Merge pull request #2157 from neslimsah/master

GL_EXT_ray_query pass-by-reference issues
parents 2df8c712 054b5e35
...@@ -2197,7 +2197,15 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI ...@@ -2197,7 +2197,15 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI
if (node->getOp() == glslang::EOpAtomicCounterIncrement || if (node->getOp() == glslang::EOpAtomicCounterIncrement ||
node->getOp() == glslang::EOpAtomicCounterDecrement || node->getOp() == glslang::EOpAtomicCounterDecrement ||
node->getOp() == glslang::EOpAtomicCounter || node->getOp() == glslang::EOpAtomicCounter ||
node->getOp() == glslang::EOpInterpolateAtCentroid) { node->getOp() == glslang::EOpInterpolateAtCentroid ||
node->getOp() == glslang::EOpRayQueryProceed ||
node->getOp() == glslang::EOpRayQueryGetRayTMin ||
node->getOp() == glslang::EOpRayQueryGetRayFlags ||
node->getOp() == glslang::EOpRayQueryGetWorldRayOrigin ||
node->getOp() == glslang::EOpRayQueryGetWorldRayDirection ||
node->getOp() == glslang::EOpRayQueryGetIntersectionCandidateAABBOpaque ||
node->getOp() == glslang::EOpRayQueryTerminate ||
node->getOp() == glslang::EOpRayQueryConfirmIntersection) {
operand = builder.accessChainGetLValue(); // Special case l-value operands operand = builder.accessChainGetLValue(); // Special case l-value operands
lvalueCoherentFlags = builder.getAccessChain().coherentFlags; lvalueCoherentFlags = builder.getAccessChain().coherentFlags;
lvalueCoherentFlags |= TranslateCoherent(operandNode->getAsTyped()->getType()); lvalueCoherentFlags |= TranslateCoherent(operandNode->getAsTyped()->getType());
...@@ -2296,7 +2304,6 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI ...@@ -2296,7 +2304,6 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI
case glslang::EOpRayQueryConfirmIntersection: case glslang::EOpRayQueryConfirmIntersection:
builder.createNoResultOp(spv::OpRayQueryConfirmIntersectionKHR, operand); builder.createNoResultOp(spv::OpRayQueryConfirmIntersectionKHR, operand);
return false; return false;
#endif #endif
default: default:
......
rayQuery-initialize.rgen rayQuery-initialize.rgen
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80008 // Generated by (magic number): 80008
// Id's are bound by 105 // Id's are bound by 103
Capability RayQueryProvisionalKHR Capability RayQueryProvisionalKHR
Capability RayTracingNV Capability RayTracingNV
...@@ -38,7 +38,6 @@ rayQuery-initialize.rgen ...@@ -38,7 +38,6 @@ rayQuery-initialize.rgen
Name 76 "" Name 76 ""
Name 89 "rayQuery" Name 89 "rayQuery"
Name 90 "param" Name 90 "param"
Name 92 "param"
Decorate 23(gl_LaunchIDNV) BuiltIn LaunchIdKHR Decorate 23(gl_LaunchIDNV) BuiltIn LaunchIdKHR
Decorate 28(gl_LaunchSizeNV) BuiltIn LaunchSizeKHR Decorate 28(gl_LaunchSizeNV) BuiltIn LaunchSizeKHR
Decorate 50(rtas) DescriptorSet 0 Decorate 50(rtas) DescriptorSet 0
...@@ -89,14 +88,13 @@ rayQuery-initialize.rgen ...@@ -89,14 +88,13 @@ rayQuery-initialize.rgen
75: TypePointer Uniform 74(Rays) 75: TypePointer Uniform 74(Rays)
76: 75(ptr) Variable Uniform 76: 75(ptr) Variable Uniform
78: TypePointer Uniform 72(Ray) 78: TypePointer Uniform 72(Ray)
96: 6(int) Constant 32 94: 6(int) Constant 32
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
69(index): 68(ptr) Variable Function 69(index): 68(ptr) Variable Function
71(ray): 15(ptr) Variable Function 71(ray): 15(ptr) Variable Function
89(rayQuery): 11(ptr) Variable Function 89(rayQuery): 11(ptr) Variable Function
90(param): 11(ptr) Variable Function 90(param): 15(ptr) Variable Function
92(param): 15(ptr) Variable Function
70: 6(int) FunctionCall 8(launchIndex() 70: 6(int) FunctionCall 8(launchIndex()
Store 69(index) 70 Store 69(index) 70
77: 6(int) Load 69(index) 77: 6(int) Load 69(index)
...@@ -114,21 +112,19 @@ rayQuery-initialize.rgen ...@@ -114,21 +112,19 @@ rayQuery-initialize.rgen
87: 12(float) CompositeExtract 80 3 87: 12(float) CompositeExtract 80 3
88: 59(ptr) AccessChain 71(ray) 65 88: 59(ptr) AccessChain 71(ray) 65
Store 88 87 Store 88 87
91: 10 Load 89(rayQuery) 91: 14(Ray) Load 71(ray)
Store 90(param) 91 Store 90(param) 91
93: 14(Ray) Load 71(ray) 92: 2 FunctionCall 19(doInitialize(rq1;struct-Ray-vf3-f1-vf3-f11;) 89(rayQuery) 90(param)
Store 92(param) 93 93: 48 Load 50(rtas)
94: 2 FunctionCall 19(doInitialize(rq1;struct-Ray-vf3-f1-vf3-f11;) 90(param) 92(param) 95: 55(ptr) AccessChain 71(ray) 54
95: 48 Load 50(rtas) 96: 13(fvec3) Load 95
97: 55(ptr) AccessChain 71(ray) 54 97: 59(ptr) AccessChain 71(ray) 58
98: 13(fvec3) Load 97 98: 12(float) Load 97
99: 59(ptr) AccessChain 71(ray) 58 99: 55(ptr) AccessChain 71(ray) 62
100: 12(float) Load 99 100: 13(fvec3) Load 99
101: 55(ptr) AccessChain 71(ray) 62 101: 59(ptr) AccessChain 71(ray) 65
102: 13(fvec3) Load 101 102: 12(float) Load 101
103: 59(ptr) AccessChain 71(ray) 65 RayQueryInitializeKHR 89(rayQuery) 93 33 94 96 98 100 102
104: 12(float) Load 103
RayQueryInitializeKHR 89(rayQuery) 95 33 96 98 100 102 104
Return Return
FunctionEnd FunctionEnd
8(launchIndex(): 6(int) Function None 7 8(launchIndex(): 6(int) Function None 7
......
rayQuery-no-cse.rgen rayQuery-no-cse.rgen
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80008 // Generated by (magic number): 80008
// Id's are bound by 111 // Id's are bound by 107
Capability RayQueryProvisionalKHR Capability RayQueryProvisionalKHR
Capability RayTracingNV Capability RayTracingNV
...@@ -38,10 +38,8 @@ rayQuery-no-cse.rgen ...@@ -38,10 +38,8 @@ rayQuery-no-cse.rgen
Name 76 "" Name 76 ""
Name 89 "rayQuery1" Name 89 "rayQuery1"
Name 90 "param" Name 90 "param"
Name 92 "param" Name 103 "rayQuery2"
Name 105 "rayQuery2" Name 104 "param"
Name 106 "param"
Name 108 "param"
Decorate 23(gl_LaunchIDNV) BuiltIn LaunchIdKHR Decorate 23(gl_LaunchIDNV) BuiltIn LaunchIdKHR
Decorate 28(gl_LaunchSizeNV) BuiltIn LaunchSizeKHR Decorate 28(gl_LaunchSizeNV) BuiltIn LaunchSizeKHR
Decorate 50(rtas) DescriptorSet 0 Decorate 50(rtas) DescriptorSet 0
...@@ -92,17 +90,15 @@ rayQuery-no-cse.rgen ...@@ -92,17 +90,15 @@ rayQuery-no-cse.rgen
75: TypePointer Uniform 74(Rays) 75: TypePointer Uniform 74(Rays)
76: 75(ptr) Variable Uniform 76: 75(ptr) Variable Uniform
78: TypePointer Uniform 72(Ray) 78: TypePointer Uniform 72(Ray)
96: 6(int) Constant 32 94: 6(int) Constant 32
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
69(index): 68(ptr) Variable Function 69(index): 68(ptr) Variable Function
71(ray): 15(ptr) Variable Function 71(ray): 15(ptr) Variable Function
89(rayQuery1): 11(ptr) Variable Function 89(rayQuery1): 11(ptr) Variable Function
90(param): 11(ptr) Variable Function 90(param): 15(ptr) Variable Function
92(param): 15(ptr) Variable Function 103(rayQuery2): 11(ptr) Variable Function
105(rayQuery2): 11(ptr) Variable Function 104(param): 15(ptr) Variable Function
106(param): 11(ptr) Variable Function
108(param): 15(ptr) Variable Function
70: 6(int) FunctionCall 8(launchIndex() 70: 6(int) FunctionCall 8(launchIndex()
Store 69(index) 70 Store 69(index) 70
77: 6(int) Load 69(index) 77: 6(int) Load 69(index)
...@@ -120,26 +116,22 @@ rayQuery-no-cse.rgen ...@@ -120,26 +116,22 @@ rayQuery-no-cse.rgen
87: 12(float) CompositeExtract 80 3 87: 12(float) CompositeExtract 80 3
88: 59(ptr) AccessChain 71(ray) 65 88: 59(ptr) AccessChain 71(ray) 65
Store 88 87 Store 88 87
91: 10 Load 89(rayQuery1) 91: 14(Ray) Load 71(ray)
Store 90(param) 91 Store 90(param) 91
93: 14(Ray) Load 71(ray) 92: 2 FunctionCall 19(doInitialize(rq1;struct-Ray-vf3-f1-vf3-f11;) 89(rayQuery1) 90(param)
Store 92(param) 93 93: 48 Load 50(rtas)
94: 2 FunctionCall 19(doInitialize(rq1;struct-Ray-vf3-f1-vf3-f11;) 90(param) 92(param) 95: 55(ptr) AccessChain 71(ray) 54
95: 48 Load 50(rtas) 96: 13(fvec3) Load 95
97: 55(ptr) AccessChain 71(ray) 54 97: 59(ptr) AccessChain 71(ray) 58
98: 13(fvec3) Load 97 98: 12(float) Load 97
99: 59(ptr) AccessChain 71(ray) 58 99: 55(ptr) AccessChain 71(ray) 62
100: 12(float) Load 99 100: 13(fvec3) Load 99
101: 55(ptr) AccessChain 71(ray) 62 101: 59(ptr) AccessChain 71(ray) 65
102: 13(fvec3) Load 101 102: 12(float) Load 101
103: 59(ptr) AccessChain 71(ray) 65 RayQueryInitializeKHR 89(rayQuery1) 93 33 94 96 98 100 102
104: 12(float) Load 103 105: 14(Ray) Load 71(ray)
RayQueryInitializeKHR 89(rayQuery1) 95 33 96 98 100 102 104 Store 104(param) 105
107: 10 Load 105(rayQuery2) 106: 2 FunctionCall 19(doInitialize(rq1;struct-Ray-vf3-f1-vf3-f11;) 103(rayQuery2) 104(param)
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 Return
FunctionEnd FunctionEnd
8(launchIndex(): 6(int) Function None 7 8(launchIndex(): 6(int) Function None 7
......
rayQuery.rgen rayQuery.rgen
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80008 // Generated by (magic number): 80008
// Id's are bound by 46 // Id's are bound by 44
Capability RayQueryProvisionalKHR Capability RayQueryProvisionalKHR
Capability RayTracingNV Capability RayTracingNV
...@@ -51,7 +51,7 @@ rayQuery.rgen ...@@ -51,7 +51,7 @@ rayQuery.rgen
30: 29(int) Constant 1 30: 29(int) Constant 1
31: TypePointer ShaderRecordBufferKHR 25(fvec3) 31: TypePointer ShaderRecordBufferKHR 25(fvec3)
35: 29(int) Constant 0 35: 29(int) Constant 0
40: TypeBool 39: TypeBool
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
8(rayFlags): 7(ptr) Variable Function 8(rayFlags): 7(ptr) Variable Function
...@@ -70,15 +70,13 @@ rayQuery.rgen ...@@ -70,15 +70,13 @@ rayQuery.rgen
37: 25(fvec3) Load 36 37: 25(fvec3) Load 36
38: 10(float) Load 14(tMax) 38: 10(float) Load 14(tMax)
RayQueryInitializeKHR 18(localRayQuery) 22 23 24 33 34 37 38 RayQueryInitializeKHR 18(localRayQuery) 22 23 24 33 34 37 38
39: 16 Load 18(localRayQuery) 40: 39(bool) RayQueryProceedKHR 18(localRayQuery)
41: 40(bool) RayQueryProceedKHR 39 41: 39(bool) LogicalNot 40
42: 40(bool) LogicalNot 41 SelectionMerge 43 None
SelectionMerge 44 None BranchConditional 41 42 43
BranchConditional 42 43 44 42: Label
43: Label RayQueryTerminateKHR 18(localRayQuery)
45: 16 Load 18(localRayQuery) Branch 43
RayQueryTerminateKHR 45 43: Label
Branch 44
44: Label
Return Return
FunctionEnd 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(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);
}
...@@ -1674,7 +1674,7 @@ public: ...@@ -1674,7 +1674,7 @@ public:
} }
virtual bool isOpaque() const { return basicType == EbtSampler virtual bool isOpaque() const { return basicType == EbtSampler
#ifndef GLSLANG_WEB #ifndef GLSLANG_WEB
|| basicType == EbtAtomicUint || basicType == EbtAccStruct || basicType == EbtAtomicUint || basicType == EbtAccStruct || basicType == EbtRayQuery
#endif #endif
; } ; }
virtual bool isBuiltIn() const { return getQualifier().builtIn != EbvNone; } virtual bool isBuiltIn() const { return getQualifier().builtIn != EbvNone; }
......
...@@ -231,7 +231,6 @@ INSTANTIATE_TEST_CASE_P( ...@@ -231,7 +231,6 @@ INSTANTIATE_TEST_CASE_P(
"spv.while-simple.vert", "spv.while-simple.vert",
// vulkan-specific tests // vulkan-specific tests
"rayQuery.rgen", "rayQuery.rgen",
"rayQuery-array-2d-dynamic.rgen",
"rayQuery-decls.rgen", "rayQuery-decls.rgen",
"rayQuery-no-cse.rgen", "rayQuery-no-cse.rgen",
"rayQuery-initialize.rgen", "rayQuery-initialize.rgen",
......
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