Merge pull request #2166 from alelenv/rq_lvalue_fix
Error out assignments to objects of rayQueryEXT type.
This commit is contained in:
commit
e7c94f4973
@ -1,200 +0,0 @@
|
|||||||
rayQuery-decls.rgen
|
|
||||||
// Module Version 10000
|
|
||||||
// Generated by (magic number): 80008
|
|
||||||
// Id's are bound by 130
|
|
||||||
|
|
||||||
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" 12 17
|
|
||||||
Source GLSL 460
|
|
||||||
SourceExtension "GL_EXT_ray_query"
|
|
||||||
SourceExtension "GL_NV_ray_tracing"
|
|
||||||
Name 4 "main"
|
|
||||||
Name 8 "launchIndex("
|
|
||||||
Name 12 "gl_LaunchIDNV"
|
|
||||||
Name 17 "gl_LaunchSizeNV"
|
|
||||||
Name 38 "index"
|
|
||||||
Name 42 "Ray"
|
|
||||||
MemberName 42(Ray) 0 "pos"
|
|
||||||
MemberName 42(Ray) 1 "tmin"
|
|
||||||
MemberName 42(Ray) 2 "dir"
|
|
||||||
MemberName 42(Ray) 3 "tmax"
|
|
||||||
Name 44 "ray"
|
|
||||||
Name 45 "Ray"
|
|
||||||
MemberName 45(Ray) 0 "pos"
|
|
||||||
MemberName 45(Ray) 1 "tmin"
|
|
||||||
MemberName 45(Ray) 2 "dir"
|
|
||||||
MemberName 45(Ray) 3 "tmax"
|
|
||||||
Name 47 "Rays"
|
|
||||||
MemberName 47(Rays) 0 "rays"
|
|
||||||
Name 49 ""
|
|
||||||
Name 73 "g_rayQueryArray"
|
|
||||||
Name 74 "block"
|
|
||||||
MemberName 74(block) 0 "idx"
|
|
||||||
Name 76 ""
|
|
||||||
Name 81 "rayQuery0b"
|
|
||||||
Name 86 "rayQuery0a"
|
|
||||||
Name 89 "rayQuery0c"
|
|
||||||
Name 96 "rtas"
|
|
||||||
Name 107 "rayQuery1c"
|
|
||||||
Name 129 "g_rayQueryUnused"
|
|
||||||
Decorate 12(gl_LaunchIDNV) BuiltIn LaunchIdKHR
|
|
||||||
Decorate 17(gl_LaunchSizeNV) BuiltIn LaunchSizeKHR
|
|
||||||
MemberDecorate 45(Ray) 0 Offset 0
|
|
||||||
MemberDecorate 45(Ray) 1 Offset 12
|
|
||||||
MemberDecorate 45(Ray) 2 Offset 16
|
|
||||||
MemberDecorate 45(Ray) 3 Offset 28
|
|
||||||
Decorate 46 ArrayStride 32
|
|
||||||
MemberDecorate 47(Rays) 0 Offset 0
|
|
||||||
Decorate 47(Rays) BufferBlock
|
|
||||||
Decorate 49 DescriptorSet 0
|
|
||||||
Decorate 49 Binding 2
|
|
||||||
MemberDecorate 74(block) 0 Offset 0
|
|
||||||
Decorate 74(block) BufferBlock
|
|
||||||
Decorate 96(rtas) DescriptorSet 0
|
|
||||||
Decorate 96(rtas) Binding 0
|
|
||||||
2: TypeVoid
|
|
||||||
3: TypeFunction 2
|
|
||||||
6: TypeInt 32 0
|
|
||||||
7: TypeFunction 6(int)
|
|
||||||
10: TypeVector 6(int) 3
|
|
||||||
11: TypePointer Input 10(ivec3)
|
|
||||||
12(gl_LaunchIDNV): 11(ptr) Variable Input
|
|
||||||
13: 6(int) Constant 2
|
|
||||||
14: TypePointer Input 6(int)
|
|
||||||
17(gl_LaunchSizeNV): 11(ptr) Variable Input
|
|
||||||
18: 6(int) Constant 0
|
|
||||||
22: 6(int) Constant 1
|
|
||||||
37: TypePointer Function 6(int)
|
|
||||||
40: TypeFloat 32
|
|
||||||
41: TypeVector 40(float) 3
|
|
||||||
42(Ray): TypeStruct 41(fvec3) 40(float) 41(fvec3) 40(float)
|
|
||||||
43: TypePointer Function 42(Ray)
|
|
||||||
45(Ray): TypeStruct 41(fvec3) 40(float) 41(fvec3) 40(float)
|
|
||||||
46: TypeRuntimeArray 45(Ray)
|
|
||||||
47(Rays): TypeStruct 46
|
|
||||||
48: TypePointer Uniform 47(Rays)
|
|
||||||
49: 48(ptr) Variable Uniform
|
|
||||||
50: TypeInt 32 1
|
|
||||||
51: 50(int) Constant 0
|
|
||||||
53: TypePointer Uniform 45(Ray)
|
|
||||||
57: TypePointer Function 41(fvec3)
|
|
||||||
60: 50(int) Constant 1
|
|
||||||
61: TypePointer Function 40(float)
|
|
||||||
64: 50(int) Constant 2
|
|
||||||
67: 50(int) Constant 3
|
|
||||||
69: TypeRayQueryProvisionalKHR
|
|
||||||
70: 6(int) Constant 4
|
|
||||||
71: TypeArray 69 70
|
|
||||||
72: TypePointer Function 71
|
|
||||||
74(block): TypeStruct 6(int)
|
|
||||||
75: TypePointer ShaderRecordBufferKHR 74(block)
|
|
||||||
76: 75(ptr) Variable ShaderRecordBufferKHR
|
|
||||||
77: TypePointer ShaderRecordBufferKHR 6(int)
|
|
||||||
80: TypePointer Function 69
|
|
||||||
94: TypeAccelerationStructureKHR
|
|
||||||
95: TypePointer UniformConstant 94
|
|
||||||
96(rtas): 95(ptr) Variable UniformConstant
|
|
||||||
98: 6(int) Constant 16
|
|
||||||
109: 6(int) Constant 32
|
|
||||||
119: 6(int) Constant 3
|
|
||||||
120: 6(int) Constant 64
|
|
||||||
4(main): 2 Function None 3
|
|
||||||
5: Label
|
|
||||||
38(index): 37(ptr) Variable Function
|
|
||||||
44(ray): 43(ptr) Variable Function
|
|
||||||
73(g_rayQueryArray): 72(ptr) Variable Function
|
|
||||||
81(rayQuery0b): 80(ptr) Variable Function
|
|
||||||
86(rayQuery0a): 80(ptr) Variable Function
|
|
||||||
89(rayQuery0c): 80(ptr) Variable Function
|
|
||||||
107(rayQuery1c): 80(ptr) Variable Function
|
|
||||||
129(g_rayQueryUnused): 80(ptr) Variable Function
|
|
||||||
39: 6(int) FunctionCall 8(launchIndex()
|
|
||||||
Store 38(index) 39
|
|
||||||
52: 6(int) Load 38(index)
|
|
||||||
54: 53(ptr) AccessChain 49 51 52
|
|
||||||
55: 45(Ray) Load 54
|
|
||||||
56: 41(fvec3) CompositeExtract 55 0
|
|
||||||
58: 57(ptr) AccessChain 44(ray) 51
|
|
||||||
Store 58 56
|
|
||||||
59: 40(float) CompositeExtract 55 1
|
|
||||||
62: 61(ptr) AccessChain 44(ray) 60
|
|
||||||
Store 62 59
|
|
||||||
63: 41(fvec3) CompositeExtract 55 2
|
|
||||||
65: 57(ptr) AccessChain 44(ray) 64
|
|
||||||
Store 65 63
|
|
||||||
66: 40(float) CompositeExtract 55 3
|
|
||||||
68: 61(ptr) AccessChain 44(ray) 67
|
|
||||||
Store 68 66
|
|
||||||
78: 77(ptr) AccessChain 76 51
|
|
||||||
79: 6(int) Load 78
|
|
||||||
82: 69 Load 81(rayQuery0b)
|
|
||||||
83: 80(ptr) AccessChain 73(g_rayQueryArray) 79
|
|
||||||
Store 83 82
|
|
||||||
84: 77(ptr) AccessChain 76 51
|
|
||||||
85: 6(int) Load 84
|
|
||||||
87: 69 Load 86(rayQuery0a)
|
|
||||||
88: 80(ptr) AccessChain 73(g_rayQueryArray) 85
|
|
||||||
Store 88 87
|
|
||||||
90: 77(ptr) AccessChain 76 51
|
|
||||||
91: 6(int) Load 90
|
|
||||||
92: 80(ptr) AccessChain 73(g_rayQueryArray) 91
|
|
||||||
93: 69 Load 92
|
|
||||||
Store 89(rayQuery0c) 93
|
|
||||||
97: 94 Load 96(rtas)
|
|
||||||
99: 57(ptr) AccessChain 44(ray) 51
|
|
||||||
100: 41(fvec3) Load 99
|
|
||||||
101: 61(ptr) AccessChain 44(ray) 60
|
|
||||||
102: 40(float) Load 101
|
|
||||||
103: 57(ptr) AccessChain 44(ray) 64
|
|
||||||
104: 41(fvec3) Load 103
|
|
||||||
105: 61(ptr) AccessChain 44(ray) 67
|
|
||||||
106: 40(float) Load 105
|
|
||||||
RayQueryInitializeKHR 89(rayQuery0c) 97 22 98 100 102 104 106
|
|
||||||
108: 94 Load 96(rtas)
|
|
||||||
110: 57(ptr) AccessChain 44(ray) 51
|
|
||||||
111: 41(fvec3) Load 110
|
|
||||||
112: 61(ptr) AccessChain 44(ray) 60
|
|
||||||
113: 40(float) Load 112
|
|
||||||
114: 57(ptr) AccessChain 44(ray) 64
|
|
||||||
115: 41(fvec3) Load 114
|
|
||||||
116: 61(ptr) AccessChain 44(ray) 67
|
|
||||||
117: 40(float) Load 116
|
|
||||||
RayQueryInitializeKHR 107(rayQuery1c) 108 22 109 111 113 115 117
|
|
||||||
118: 94 Load 96(rtas)
|
|
||||||
121: 57(ptr) AccessChain 44(ray) 51
|
|
||||||
122: 41(fvec3) Load 121
|
|
||||||
123: 61(ptr) AccessChain 44(ray) 60
|
|
||||||
124: 40(float) Load 123
|
|
||||||
125: 57(ptr) AccessChain 44(ray) 64
|
|
||||||
126: 41(fvec3) Load 125
|
|
||||||
127: 61(ptr) AccessChain 44(ray) 67
|
|
||||||
128: 40(float) Load 127
|
|
||||||
RayQueryInitializeKHR 107(rayQuery1c) 118 119 120 122 124 126 128
|
|
||||||
Return
|
|
||||||
FunctionEnd
|
|
||||||
8(launchIndex(): 6(int) Function None 7
|
|
||||||
9: Label
|
|
||||||
15: 14(ptr) AccessChain 12(gl_LaunchIDNV) 13
|
|
||||||
16: 6(int) Load 15
|
|
||||||
19: 14(ptr) AccessChain 17(gl_LaunchSizeNV) 18
|
|
||||||
20: 6(int) Load 19
|
|
||||||
21: 6(int) IMul 16 20
|
|
||||||
23: 14(ptr) AccessChain 17(gl_LaunchSizeNV) 22
|
|
||||||
24: 6(int) Load 23
|
|
||||||
25: 6(int) IMul 21 24
|
|
||||||
26: 14(ptr) AccessChain 12(gl_LaunchIDNV) 22
|
|
||||||
27: 6(int) Load 26
|
|
||||||
28: 14(ptr) AccessChain 17(gl_LaunchSizeNV) 18
|
|
||||||
29: 6(int) Load 28
|
|
||||||
30: 6(int) IMul 27 29
|
|
||||||
31: 6(int) IAdd 25 30
|
|
||||||
32: 14(ptr) AccessChain 12(gl_LaunchIDNV) 18
|
|
||||||
33: 6(int) Load 32
|
|
||||||
34: 6(int) IAdd 31 33
|
|
||||||
ReturnValue 34
|
|
||||||
FunctionEnd
|
|
||||||
@ -1,53 +0,0 @@
|
|||||||
#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 accelerationStructureEXT 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);
|
|
||||||
}
|
|
||||||
@ -184,6 +184,9 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op,
|
|||||||
case EbtAccStruct:
|
case EbtAccStruct:
|
||||||
message = "can't modify accelerationStructureNV";
|
message = "can't modify accelerationStructureNV";
|
||||||
break;
|
break;
|
||||||
|
case EbtRayQuery:
|
||||||
|
message = "can't modify rayQueryEXT";
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -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-decls.rgen",
|
|
||||||
"rayQuery-no-cse.rgen",
|
"rayQuery-no-cse.rgen",
|
||||||
"rayQuery-initialize.rgen",
|
"rayQuery-initialize.rgen",
|
||||||
"rayQuery-allOps.rgen",
|
"rayQuery-allOps.rgen",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user