update spirv-headers and fix handling of gl_HitTEXT (#2471)
* update spirv-headers and fix handling of gl_HitTEXT Update spirv-headers known_good to f027d53ded7e230e008d37c8b47ede7cd308e19d and update SPIRV/spirv.hpp to copy from that version as well. In GLSL gl_HitTNV/gl_HitTEXT is defined as an alias of gl_RayTmaxNV/gl_RayTmaxEXT SPV_NV_ray_tracing has a dedicated HitTNV which gl_HitTNV maps to. For SPV_KHR_ray_tracing, gl_HitTEXT gets mapped to a RayTmaxKHR decoraged variable to simplify the SPIRV consumer. This change fixes the mapping for the GL_EXT_ray_tracing extension, and updates the test results to match. * update MissNV shader test to not use ObjectRay builtins They shouldn't existing in the miss stage because there is no object intersected
This commit is contained in:
parent
4d41da3b81
commit
e11a2c8bec
@ -1006,7 +1006,17 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
|
|||||||
case glslang::EbvInstanceCustomIndex:
|
case glslang::EbvInstanceCustomIndex:
|
||||||
return spv::BuiltInInstanceCustomIndexKHR;
|
return spv::BuiltInInstanceCustomIndexKHR;
|
||||||
case glslang::EbvHitT:
|
case glslang::EbvHitT:
|
||||||
return spv::BuiltInHitTKHR;
|
{
|
||||||
|
// this is a GLSL alias of RayTmax
|
||||||
|
// in SPV_NV_ray_tracing it has a dedicated builtin
|
||||||
|
// but in SPV_KHR_ray_tracing it gets mapped to RayTmax
|
||||||
|
auto& extensions = glslangIntermediate->getRequestedExtensions();
|
||||||
|
if (extensions.find("GL_NV_ray_tracing") != extensions.end()) {
|
||||||
|
return spv::BuiltInHitTNV;
|
||||||
|
} else {
|
||||||
|
return spv::BuiltInRayTmaxKHR;
|
||||||
|
}
|
||||||
|
}
|
||||||
case glslang::EbvHitKind:
|
case glslang::EbvHitKind:
|
||||||
return spv::BuiltInHitKindKHR;
|
return spv::BuiltInHitKindKHR;
|
||||||
case glslang::EbvObjectToWorld:
|
case glslang::EbvObjectToWorld:
|
||||||
|
@ -395,7 +395,7 @@ const char* BuiltInString(int builtIn)
|
|||||||
case BuiltInRayGeometryIndexKHR: return "RayGeometryIndexKHR";
|
case BuiltInRayGeometryIndexKHR: return "RayGeometryIndexKHR";
|
||||||
case BuiltInObjectToWorldKHR: return "ObjectToWorldKHR";
|
case BuiltInObjectToWorldKHR: return "ObjectToWorldKHR";
|
||||||
case BuiltInWorldToObjectKHR: return "WorldToObjectKHR";
|
case BuiltInWorldToObjectKHR: return "WorldToObjectKHR";
|
||||||
case BuiltInHitTKHR: return "HitTKHR";
|
case BuiltInHitTNV: return "HitTNV";
|
||||||
case BuiltInHitKindKHR: return "HitKindKHR";
|
case BuiltInHitKindKHR: return "HitKindKHR";
|
||||||
case BuiltInIncomingRayFlagsKHR: return "IncomingRayFlagsKHR";
|
case BuiltInIncomingRayFlagsKHR: return "IncomingRayFlagsKHR";
|
||||||
case BuiltInViewportMaskNV: return "ViewportMaskNV";
|
case BuiltInViewportMaskNV: return "ViewportMaskNV";
|
||||||
|
@ -614,7 +614,6 @@ enum BuiltIn {
|
|||||||
BuiltInObjectToWorldNV = 5330,
|
BuiltInObjectToWorldNV = 5330,
|
||||||
BuiltInWorldToObjectKHR = 5331,
|
BuiltInWorldToObjectKHR = 5331,
|
||||||
BuiltInWorldToObjectNV = 5331,
|
BuiltInWorldToObjectNV = 5331,
|
||||||
BuiltInHitTKHR = 5332,
|
|
||||||
BuiltInHitTNV = 5332,
|
BuiltInHitTNV = 5332,
|
||||||
BuiltInHitKindKHR = 5333,
|
BuiltInHitKindKHR = 5333,
|
||||||
BuiltInHitKindNV = 5333,
|
BuiltInHitKindNV = 5333,
|
||||||
|
@ -53,7 +53,7 @@ spv.AnyHitShader.rahit
|
|||||||
Decorate 42(gl_ObjectRayDirectionNV) BuiltIn ObjectRayDirectionKHR
|
Decorate 42(gl_ObjectRayDirectionNV) BuiltIn ObjectRayDirectionKHR
|
||||||
Decorate 47(gl_RayTminNV) BuiltIn RayTminKHR
|
Decorate 47(gl_RayTminNV) BuiltIn RayTminKHR
|
||||||
Decorate 50(gl_RayTmaxNV) BuiltIn RayTmaxKHR
|
Decorate 50(gl_RayTmaxNV) BuiltIn RayTmaxKHR
|
||||||
Decorate 53(gl_HitTNV) BuiltIn HitTKHR
|
Decorate 53(gl_HitTNV) BuiltIn HitTNV
|
||||||
Decorate 58(gl_HitKindNV) BuiltIn HitKindKHR
|
Decorate 58(gl_HitKindNV) BuiltIn HitKindKHR
|
||||||
Decorate 64(gl_ObjectToWorldNV) BuiltIn ObjectToWorldKHR
|
Decorate 64(gl_ObjectToWorldNV) BuiltIn ObjectToWorldKHR
|
||||||
Decorate 67(gl_WorldToObjectNV) BuiltIn WorldToObjectKHR
|
Decorate 67(gl_WorldToObjectNV) BuiltIn WorldToObjectKHR
|
||||||
|
@ -55,7 +55,7 @@ spv.ClosestHitShader.rchit
|
|||||||
Decorate 42(gl_ObjectRayDirectionNV) BuiltIn ObjectRayDirectionKHR
|
Decorate 42(gl_ObjectRayDirectionNV) BuiltIn ObjectRayDirectionKHR
|
||||||
Decorate 47(gl_RayTminNV) BuiltIn RayTminKHR
|
Decorate 47(gl_RayTminNV) BuiltIn RayTminKHR
|
||||||
Decorate 50(gl_RayTmaxNV) BuiltIn RayTmaxKHR
|
Decorate 50(gl_RayTmaxNV) BuiltIn RayTmaxKHR
|
||||||
Decorate 53(gl_HitTNV) BuiltIn HitTKHR
|
Decorate 53(gl_HitTNV) BuiltIn HitTNV
|
||||||
Decorate 58(gl_HitKindNV) BuiltIn HitKindKHR
|
Decorate 58(gl_HitKindNV) BuiltIn HitKindKHR
|
||||||
Decorate 64(gl_ObjectToWorldNV) BuiltIn ObjectToWorldKHR
|
Decorate 64(gl_ObjectToWorldNV) BuiltIn ObjectToWorldKHR
|
||||||
Decorate 67(gl_WorldToObjectNV) BuiltIn WorldToObjectKHR
|
Decorate 67(gl_WorldToObjectNV) BuiltIn WorldToObjectKHR
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
spv.MissShader.rmiss
|
spv.MissShader.rmiss
|
||||||
// Module Version 10000
|
// Module Version 10000
|
||||||
// Generated by (magic number): 8000a
|
// Generated by (magic number): 8000a
|
||||||
// Id's are bound by 60
|
// Id's are bound by 59
|
||||||
|
|
||||||
Capability RayTracingNV
|
Capability RayTracingNV
|
||||||
Extension "SPV_NV_ray_tracing"
|
Extension "SPV_NV_ray_tracing"
|
||||||
1: ExtInstImport "GLSL.std.450"
|
1: ExtInstImport "GLSL.std.450"
|
||||||
MemoryModel Logical GLSL450
|
MemoryModel Logical GLSL450
|
||||||
EntryPoint MissKHR 4 "main" 11 14 21 24 27 30 35 38
|
EntryPoint MissKHR 4 "main" 11 14 21 24 29 34 37
|
||||||
Source GLSL 460
|
Source GLSL 460
|
||||||
SourceExtension "GL_NV_ray_tracing"
|
SourceExtension "GL_NV_ray_tracing"
|
||||||
Name 4 "main"
|
Name 4 "main"
|
||||||
@ -19,29 +19,26 @@ spv.MissShader.rmiss
|
|||||||
Name 21 "gl_WorldRayOriginNV"
|
Name 21 "gl_WorldRayOriginNV"
|
||||||
Name 23 "v3"
|
Name 23 "v3"
|
||||||
Name 24 "gl_WorldRayDirectionNV"
|
Name 24 "gl_WorldRayDirectionNV"
|
||||||
Name 26 "v4"
|
Name 27 "v4"
|
||||||
Name 27 "gl_ObjectRayOriginNV"
|
Name 29 "gl_IncomingRayFlagsNV"
|
||||||
Name 29 "v5"
|
Name 32 "v6"
|
||||||
Name 30 "gl_ObjectRayDirectionNV"
|
Name 34 "gl_RayTminNV"
|
||||||
Name 33 "v6"
|
Name 36 "v7"
|
||||||
Name 35 "gl_RayTminNV"
|
Name 37 "gl_RayTmaxNV"
|
||||||
Name 37 "v7"
|
Name 41 "accNV"
|
||||||
Name 38 "gl_RayTmaxNV"
|
Name 56 "localPayload"
|
||||||
Name 42 "accNV"
|
Name 58 "incomingPayload"
|
||||||
Name 57 "localPayload"
|
|
||||||
Name 59 "incomingPayload"
|
|
||||||
Decorate 11(gl_LaunchIDNV) BuiltIn LaunchIdKHR
|
Decorate 11(gl_LaunchIDNV) BuiltIn LaunchIdKHR
|
||||||
Decorate 14(gl_LaunchSizeNV) BuiltIn LaunchSizeKHR
|
Decorate 14(gl_LaunchSizeNV) BuiltIn LaunchSizeKHR
|
||||||
Decorate 21(gl_WorldRayOriginNV) BuiltIn WorldRayOriginKHR
|
Decorate 21(gl_WorldRayOriginNV) BuiltIn WorldRayOriginKHR
|
||||||
Decorate 24(gl_WorldRayDirectionNV) BuiltIn WorldRayDirectionKHR
|
Decorate 24(gl_WorldRayDirectionNV) BuiltIn WorldRayDirectionKHR
|
||||||
Decorate 27(gl_ObjectRayOriginNV) BuiltIn ObjectRayOriginKHR
|
Decorate 29(gl_IncomingRayFlagsNV) BuiltIn IncomingRayFlagsKHR
|
||||||
Decorate 30(gl_ObjectRayDirectionNV) BuiltIn ObjectRayDirectionKHR
|
Decorate 34(gl_RayTminNV) BuiltIn RayTminKHR
|
||||||
Decorate 35(gl_RayTminNV) BuiltIn RayTminKHR
|
Decorate 37(gl_RayTmaxNV) BuiltIn RayTmaxKHR
|
||||||
Decorate 38(gl_RayTmaxNV) BuiltIn RayTmaxKHR
|
Decorate 41(accNV) DescriptorSet 0
|
||||||
Decorate 42(accNV) DescriptorSet 0
|
Decorate 41(accNV) Binding 0
|
||||||
Decorate 42(accNV) Binding 0
|
Decorate 56(localPayload) Location 0
|
||||||
Decorate 57(localPayload) Location 0
|
Decorate 58(incomingPayload) Location 1
|
||||||
Decorate 59(incomingPayload) Location 1
|
|
||||||
2: TypeVoid
|
2: TypeVoid
|
||||||
3: TypeFunction 2
|
3: TypeFunction 2
|
||||||
6: TypeInt 32 0
|
6: TypeInt 32 0
|
||||||
@ -56,41 +53,41 @@ spv.MissShader.rmiss
|
|||||||
20: TypePointer Input 17(fvec3)
|
20: TypePointer Input 17(fvec3)
|
||||||
21(gl_WorldRayOriginNV): 20(ptr) Variable Input
|
21(gl_WorldRayOriginNV): 20(ptr) Variable Input
|
||||||
24(gl_WorldRayDirectionNV): 20(ptr) Variable Input
|
24(gl_WorldRayDirectionNV): 20(ptr) Variable Input
|
||||||
27(gl_ObjectRayOriginNV): 20(ptr) Variable Input
|
26: TypePointer Function 6(int)
|
||||||
30(gl_ObjectRayDirectionNV): 20(ptr) Variable Input
|
28: TypePointer Input 6(int)
|
||||||
32: TypePointer Function 16(float)
|
29(gl_IncomingRayFlagsNV): 28(ptr) Variable Input
|
||||||
34: TypePointer Input 16(float)
|
31: TypePointer Function 16(float)
|
||||||
35(gl_RayTminNV): 34(ptr) Variable Input
|
33: TypePointer Input 16(float)
|
||||||
38(gl_RayTmaxNV): 34(ptr) Variable Input
|
34(gl_RayTminNV): 33(ptr) Variable Input
|
||||||
40: TypeAccelerationStructureKHR
|
37(gl_RayTmaxNV): 33(ptr) Variable Input
|
||||||
41: TypePointer UniformConstant 40
|
39: TypeAccelerationStructureKHR
|
||||||
42(accNV): 41(ptr) Variable UniformConstant
|
40: TypePointer UniformConstant 39
|
||||||
44: 6(int) Constant 0
|
41(accNV): 40(ptr) Variable UniformConstant
|
||||||
45: 6(int) Constant 1
|
43: 6(int) Constant 0
|
||||||
46: 6(int) Constant 2
|
44: 6(int) Constant 1
|
||||||
47: 6(int) Constant 3
|
45: 6(int) Constant 2
|
||||||
48: 16(float) Constant 1056964608
|
46: 6(int) Constant 3
|
||||||
49: 17(fvec3) ConstantComposite 48 48 48
|
47: 16(float) Constant 1056964608
|
||||||
50: 16(float) Constant 1065353216
|
48: 17(fvec3) ConstantComposite 47 47 47
|
||||||
51: 17(fvec3) ConstantComposite 50 50 50
|
49: 16(float) Constant 1065353216
|
||||||
52: 16(float) Constant 1061158912
|
50: 17(fvec3) ConstantComposite 49 49 49
|
||||||
53: TypeInt 32 1
|
51: 16(float) Constant 1061158912
|
||||||
54: 53(int) Constant 1
|
52: TypeInt 32 1
|
||||||
55: TypeVector 16(float) 4
|
53: 52(int) Constant 1
|
||||||
56: TypePointer RayPayloadKHR 55(fvec4)
|
54: TypeVector 16(float) 4
|
||||||
57(localPayload): 56(ptr) Variable RayPayloadKHR
|
55: TypePointer RayPayloadKHR 54(fvec4)
|
||||||
58: TypePointer IncomingRayPayloadKHR 55(fvec4)
|
56(localPayload): 55(ptr) Variable RayPayloadKHR
|
||||||
59(incomingPayload): 58(ptr) Variable IncomingRayPayloadKHR
|
57: TypePointer IncomingRayPayloadKHR 54(fvec4)
|
||||||
|
58(incomingPayload): 57(ptr) Variable IncomingRayPayloadKHR
|
||||||
4(main): 2 Function None 3
|
4(main): 2 Function None 3
|
||||||
5: Label
|
5: Label
|
||||||
9(v0): 8(ptr) Variable Function
|
9(v0): 8(ptr) Variable Function
|
||||||
13(v1): 8(ptr) Variable Function
|
13(v1): 8(ptr) Variable Function
|
||||||
19(v2): 18(ptr) Variable Function
|
19(v2): 18(ptr) Variable Function
|
||||||
23(v3): 18(ptr) Variable Function
|
23(v3): 18(ptr) Variable Function
|
||||||
26(v4): 18(ptr) Variable Function
|
27(v4): 26(ptr) Variable Function
|
||||||
29(v5): 18(ptr) Variable Function
|
32(v6): 31(ptr) Variable Function
|
||||||
33(v6): 32(ptr) Variable Function
|
36(v7): 31(ptr) Variable Function
|
||||||
37(v7): 32(ptr) Variable Function
|
|
||||||
12: 7(ivec3) Load 11(gl_LaunchIDNV)
|
12: 7(ivec3) Load 11(gl_LaunchIDNV)
|
||||||
Store 9(v0) 12
|
Store 9(v0) 12
|
||||||
15: 7(ivec3) Load 14(gl_LaunchSizeNV)
|
15: 7(ivec3) Load 14(gl_LaunchSizeNV)
|
||||||
@ -99,15 +96,13 @@ spv.MissShader.rmiss
|
|||||||
Store 19(v2) 22
|
Store 19(v2) 22
|
||||||
25: 17(fvec3) Load 24(gl_WorldRayDirectionNV)
|
25: 17(fvec3) Load 24(gl_WorldRayDirectionNV)
|
||||||
Store 23(v3) 25
|
Store 23(v3) 25
|
||||||
28: 17(fvec3) Load 27(gl_ObjectRayOriginNV)
|
30: 6(int) Load 29(gl_IncomingRayFlagsNV)
|
||||||
Store 26(v4) 28
|
Store 27(v4) 30
|
||||||
31: 17(fvec3) Load 30(gl_ObjectRayDirectionNV)
|
35: 16(float) Load 34(gl_RayTminNV)
|
||||||
Store 29(v5) 31
|
Store 32(v6) 35
|
||||||
36: 16(float) Load 35(gl_RayTminNV)
|
38: 16(float) Load 37(gl_RayTmaxNV)
|
||||||
Store 33(v6) 36
|
Store 36(v7) 38
|
||||||
39: 16(float) Load 38(gl_RayTmaxNV)
|
42: 39 Load 41(accNV)
|
||||||
Store 37(v7) 39
|
TraceNV 42 43 44 45 46 43 48 47 50 51 53
|
||||||
43: 40 Load 42(accNV)
|
|
||||||
TraceNV 43 44 45 46 47 44 49 48 51 52 54
|
|
||||||
Return
|
Return
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
@ -62,7 +62,7 @@ spv.ext.AnyHitShader.rahit
|
|||||||
Decorate 42(gl_ObjectRayDirectionEXT) BuiltIn ObjectRayDirectionKHR
|
Decorate 42(gl_ObjectRayDirectionEXT) BuiltIn ObjectRayDirectionKHR
|
||||||
Decorate 47(gl_RayTminEXT) BuiltIn RayTminKHR
|
Decorate 47(gl_RayTminEXT) BuiltIn RayTminKHR
|
||||||
Decorate 50(gl_RayTmaxEXT) BuiltIn RayTmaxKHR
|
Decorate 50(gl_RayTmaxEXT) BuiltIn RayTmaxKHR
|
||||||
Decorate 53(gl_HitTEXT) BuiltIn HitTKHR
|
Decorate 53(gl_HitTEXT) BuiltIn RayTmaxKHR
|
||||||
Decorate 58(gl_HitKindEXT) BuiltIn HitKindKHR
|
Decorate 58(gl_HitKindEXT) BuiltIn HitKindKHR
|
||||||
Decorate 64(gl_ObjectToWorldEXT) BuiltIn ObjectToWorldKHR
|
Decorate 64(gl_ObjectToWorldEXT) BuiltIn ObjectToWorldKHR
|
||||||
Decorate 67(gl_WorldToObjectEXT) BuiltIn WorldToObjectKHR
|
Decorate 67(gl_WorldToObjectEXT) BuiltIn WorldToObjectKHR
|
||||||
|
@ -61,7 +61,7 @@ spv.ext.ClosestHitShader.rchit
|
|||||||
Decorate 42(gl_ObjectRayDirectionEXT) BuiltIn ObjectRayDirectionKHR
|
Decorate 42(gl_ObjectRayDirectionEXT) BuiltIn ObjectRayDirectionKHR
|
||||||
Decorate 47(gl_RayTminEXT) BuiltIn RayTminKHR
|
Decorate 47(gl_RayTminEXT) BuiltIn RayTminKHR
|
||||||
Decorate 50(gl_RayTmaxEXT) BuiltIn RayTmaxKHR
|
Decorate 50(gl_RayTmaxEXT) BuiltIn RayTmaxKHR
|
||||||
Decorate 53(gl_HitTEXT) BuiltIn HitTKHR
|
Decorate 53(gl_HitTEXT) BuiltIn RayTmaxKHR
|
||||||
Decorate 58(gl_HitKindEXT) BuiltIn HitKindKHR
|
Decorate 58(gl_HitKindEXT) BuiltIn HitKindKHR
|
||||||
Decorate 64(gl_ObjectToWorldEXT) BuiltIn ObjectToWorldKHR
|
Decorate 64(gl_ObjectToWorldEXT) BuiltIn ObjectToWorldKHR
|
||||||
Decorate 67(gl_WorldToObjectEXT) BuiltIn WorldToObjectKHR
|
Decorate 67(gl_WorldToObjectEXT) BuiltIn WorldToObjectKHR
|
||||||
|
@ -9,8 +9,7 @@ void main()
|
|||||||
uvec3 v1 = gl_LaunchSizeNV;
|
uvec3 v1 = gl_LaunchSizeNV;
|
||||||
vec3 v2 = gl_WorldRayOriginNV;
|
vec3 v2 = gl_WorldRayOriginNV;
|
||||||
vec3 v3 = gl_WorldRayDirectionNV;
|
vec3 v3 = gl_WorldRayDirectionNV;
|
||||||
vec3 v4 = gl_ObjectRayOriginNV;
|
uint v4 = gl_IncomingRayFlagsNV;
|
||||||
vec3 v5 = gl_ObjectRayDirectionNV;
|
|
||||||
float v6 = gl_RayTminNV;
|
float v6 = gl_RayTminNV;
|
||||||
float v7 = gl_RayTmaxNV;
|
float v7 = gl_RayTmaxNV;
|
||||||
traceNV(accNV, 0u, 1u, 2u, 3u, 0u, vec3(0.5f), 0.5f, vec3(1.0f), 0.75f, 1);
|
traceNV(accNV, 0u, 1u, 2u, 3u, 0u, vec3(0.5f), 0.5f, vec3(1.0f), 0.75f, 1);
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
"site" : "github",
|
"site" : "github",
|
||||||
"subrepo" : "KhronosGroup/SPIRV-Headers",
|
"subrepo" : "KhronosGroup/SPIRV-Headers",
|
||||||
"subdir" : "External/spirv-tools/external/spirv-headers",
|
"subdir" : "External/spirv-tools/external/spirv-headers",
|
||||||
"commit" : "104ecc356c1bea4476320faca64440cd1df655a3"
|
"commit" : "f027d53ded7e230e008d37c8b47ede7cd308e19d"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user