Avoid duplicate BuiltIn variables for ray tracing matrices (fix #2921)
Fixes an issue where invalid SPIR-V was generated when gl_ObjectToWorldEXT and gl_ObjectToWorld3x4EXT, or gl_WorldToObjectEXT and gl_WorldToObject3x4EXT, were used in the same shader. The SPIR-V specification requires that there be at most one OpVariable decorated with a given BuiltIn value.
This commit is contained in:
parent
316f12ac1d
commit
6cdae46314
4 changed files with 142 additions and 134 deletions
|
|
@ -1,7 +1,7 @@
|
|||
spv.ext.ClosestHitShader.rchit
|
||||
// Module Version 10400
|
||||
// Generated by (magic number): 8000a
|
||||
// Id's are bound by 104
|
||||
// Id's are bound by 102
|
||||
|
||||
Capability RayTracingKHR
|
||||
Capability RayCullMaskKHR
|
||||
|
|
@ -9,7 +9,7 @@ spv.ext.ClosestHitShader.rchit
|
|||
Extension "SPV_KHR_ray_tracing"
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint ClosestHitKHR 4 "main" 11 14 20 23 26 33 36 39 42 47 50 53 58 64 67 70 76 80 84 88 101 103
|
||||
EntryPoint ClosestHitKHR 4 "main" 11 14 20 23 26 33 36 39 42 47 50 53 58 64 67 70 82 86 99 101
|
||||
Source GLSL 460
|
||||
SourceExtension "GL_EXT_ray_cull_mask"
|
||||
SourceExtension "GL_EXT_ray_tracing"
|
||||
|
|
@ -47,14 +47,12 @@ spv.ext.ClosestHitShader.rchit
|
|||
Name 69 "v15"
|
||||
Name 70 "gl_GeometryIndexEXT"
|
||||
Name 75 "v16"
|
||||
Name 76 "gl_ObjectToWorld3x4EXT"
|
||||
Name 79 "v17"
|
||||
Name 80 "gl_WorldToObject3x4EXT"
|
||||
Name 83 "v18"
|
||||
Name 84 "gl_CullMaskEXT"
|
||||
Name 88 "accEXT"
|
||||
Name 101 "incomingPayload"
|
||||
Name 103 "localPayload"
|
||||
Name 78 "v17"
|
||||
Name 81 "v18"
|
||||
Name 82 "gl_CullMaskEXT"
|
||||
Name 86 "accEXT"
|
||||
Name 99 "incomingPayload"
|
||||
Name 101 "localPayload"
|
||||
Decorate 11(gl_LaunchIDEXT) BuiltIn LaunchIdKHR
|
||||
Decorate 14(gl_LaunchSizeEXT) BuiltIn LaunchSizeKHR
|
||||
Decorate 20(gl_PrimitiveID) BuiltIn PrimitiveId
|
||||
|
|
@ -71,11 +69,9 @@ spv.ext.ClosestHitShader.rchit
|
|||
Decorate 64(gl_ObjectToWorldEXT) BuiltIn ObjectToWorldKHR
|
||||
Decorate 67(gl_WorldToObjectEXT) BuiltIn WorldToObjectKHR
|
||||
Decorate 70(gl_GeometryIndexEXT) BuiltIn RayGeometryIndexKHR
|
||||
Decorate 76(gl_ObjectToWorld3x4EXT) BuiltIn ObjectToWorldKHR
|
||||
Decorate 80(gl_WorldToObject3x4EXT) BuiltIn WorldToObjectKHR
|
||||
Decorate 84(gl_CullMaskEXT) BuiltIn CullMaskKHR
|
||||
Decorate 88(accEXT) DescriptorSet 0
|
||||
Decorate 88(accEXT) Binding 0
|
||||
Decorate 82(gl_CullMaskEXT) BuiltIn CullMaskKHR
|
||||
Decorate 86(accEXT) DescriptorSet 0
|
||||
Decorate 86(accEXT) Binding 0
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeInt 32 0
|
||||
|
|
@ -115,26 +111,24 @@ spv.ext.ClosestHitShader.rchit
|
|||
72: TypeVector 28(float) 4
|
||||
73: TypeMatrix 72(fvec4) 3
|
||||
74: TypePointer Function 73
|
||||
76(gl_ObjectToWorld3x4EXT): 63(ptr) Variable Input
|
||||
80(gl_WorldToObject3x4EXT): 63(ptr) Variable Input
|
||||
84(gl_CullMaskEXT): 57(ptr) Variable Input
|
||||
86: TypeAccelerationStructureKHR
|
||||
87: TypePointer UniformConstant 86
|
||||
88(accEXT): 87(ptr) Variable UniformConstant
|
||||
90: 6(int) Constant 0
|
||||
91: 6(int) Constant 1
|
||||
92: 6(int) Constant 2
|
||||
93: 6(int) Constant 3
|
||||
94: 28(float) Constant 1056964608
|
||||
82(gl_CullMaskEXT): 57(ptr) Variable Input
|
||||
84: TypeAccelerationStructureKHR
|
||||
85: TypePointer UniformConstant 84
|
||||
86(accEXT): 85(ptr) Variable UniformConstant
|
||||
88: 6(int) Constant 0
|
||||
89: 6(int) Constant 1
|
||||
90: 6(int) Constant 2
|
||||
91: 6(int) Constant 3
|
||||
92: 28(float) Constant 1056964608
|
||||
93: 29(fvec3) ConstantComposite 92 92 92
|
||||
94: 28(float) Constant 1065353216
|
||||
95: 29(fvec3) ConstantComposite 94 94 94
|
||||
96: 28(float) Constant 1065353216
|
||||
97: 29(fvec3) ConstantComposite 96 96 96
|
||||
98: 28(float) Constant 1061158912
|
||||
99: 16(int) Constant 1
|
||||
100: TypePointer IncomingRayPayloadKHR 72(fvec4)
|
||||
101(incomingPayload): 100(ptr) Variable IncomingRayPayloadKHR
|
||||
102: TypePointer RayPayloadKHR 72(fvec4)
|
||||
103(localPayload): 102(ptr) Variable RayPayloadKHR
|
||||
96: 28(float) Constant 1061158912
|
||||
97: 16(int) Constant 1
|
||||
98: TypePointer IncomingRayPayloadKHR 72(fvec4)
|
||||
99(incomingPayload): 98(ptr) Variable IncomingRayPayloadKHR
|
||||
100: TypePointer RayPayloadKHR 72(fvec4)
|
||||
101(localPayload): 100(ptr) Variable RayPayloadKHR
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
9(v0): 8(ptr) Variable Function
|
||||
|
|
@ -154,8 +148,8 @@ spv.ext.ClosestHitShader.rchit
|
|||
66(v14): 61(ptr) Variable Function
|
||||
69(v15): 17(ptr) Variable Function
|
||||
75(v16): 74(ptr) Variable Function
|
||||
79(v17): 74(ptr) Variable Function
|
||||
83(v18): 55(ptr) Variable Function
|
||||
78(v17): 74(ptr) Variable Function
|
||||
81(v18): 55(ptr) Variable Function
|
||||
12: 7(ivec3) Load 11(gl_LaunchIDEXT)
|
||||
Store 9(v0) 12
|
||||
15: 7(ivec3) Load 14(gl_LaunchSizeEXT)
|
||||
|
|
@ -188,15 +182,15 @@ spv.ext.ClosestHitShader.rchit
|
|||
Store 66(v14) 68
|
||||
71: 16(int) Load 70(gl_GeometryIndexEXT)
|
||||
Store 69(v15) 71
|
||||
77: 60 Load 76(gl_ObjectToWorld3x4EXT)
|
||||
78: 73 Transpose 77
|
||||
Store 75(v16) 78
|
||||
81: 60 Load 80(gl_WorldToObject3x4EXT)
|
||||
82: 73 Transpose 81
|
||||
Store 79(v17) 82
|
||||
85: 6(int) Load 84(gl_CullMaskEXT)
|
||||
Store 83(v18) 85
|
||||
89: 86 Load 88(accEXT)
|
||||
TraceRayKHR 89 90 91 92 93 90 95 94 97 98 101(incomingPayload)
|
||||
76: 60 Load 64(gl_ObjectToWorldEXT)
|
||||
77: 73 Transpose 76
|
||||
Store 75(v16) 77
|
||||
79: 60 Load 67(gl_WorldToObjectEXT)
|
||||
80: 73 Transpose 79
|
||||
Store 78(v17) 80
|
||||
83: 6(int) Load 82(gl_CullMaskEXT)
|
||||
Store 81(v18) 83
|
||||
87: 84 Load 86(accEXT)
|
||||
TraceRayKHR 87 88 89 90 91 88 93 92 95 96 99(incomingPayload)
|
||||
Return
|
||||
FunctionEnd
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue