Do not output location decoration for certain variables in ray tracing storage

classes.
This commit is contained in:
Ashwin Lele 2021-12-06 13:09:03 -08:00
parent ec5ea2d6cb
commit e306f02927
18 changed files with 12 additions and 22 deletions

View File

@ -8716,8 +8716,18 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol
builder.addDecoration(id, spv::DecorationOffset, symbol->getQualifier().layoutOffset);
}
if (symbol->getQualifier().hasLocation())
builder.addDecoration(id, spv::DecorationLocation, symbol->getQualifier().layoutLocation);
if (symbol->getQualifier().hasLocation()) {
if (!(glslangIntermediate->isRayTracingStage() && glslangIntermediate->IsRequestedExtension(glslang::E_GL_EXT_ray_tracing)
&& (builder.getStorageClass(id) == spv::StorageClassRayPayloadKHR ||
builder.getStorageClass(id) == spv::StorageClassIncomingRayPayloadKHR ||
builder.getStorageClass(id) == spv::StorageClassCallableDataKHR ||
builder.getStorageClass(id) == spv::StorageClassIncomingCallableDataKHR))) {
// Location values are used to link TraceRayKHR and ExecuteCallableKHR to corresponding variables
// but are not valid in SPIRV since they are supported only for Input/Output Storage classes.
builder.addDecoration(id, spv::DecorationLocation, symbol->getQualifier().layoutLocation);
}
}
builder.addDecoration(id, TranslateInvariantDecoration(symbol->getType().getQualifier()));
if (symbol->getQualifier().hasStream() && glslangIntermediate->isMultiStream()) {
builder.addCapability(spv::CapabilityGeometryStreams);

View File

@ -21,7 +21,6 @@ spv.ClosestHitShaderMotion.rchit
Decorate 10(gl_CurrentRayTimeNV) BuiltIn CurrentRayTimeNV
Decorate 16(accEXT) DescriptorSet 0
Decorate 16(accEXT) Binding 0
Decorate 32(incomingPayloadEXT) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32

View File

@ -21,7 +21,6 @@ spv.MissShaderMotion.rmiss
Decorate 10(gl_CurrentRayTimeNV) BuiltIn CurrentRayTimeNV
Decorate 16(accEXT) DescriptorSet 0
Decorate 16(accEXT) Binding 0
Decorate 32(localPayloadEXT) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32

View File

@ -26,7 +26,6 @@ spv.RayGenShaderMotion.rgen
Decorate 21(gl_LaunchSizeEXT) BuiltIn LaunchSizeKHR
Decorate 29(accEXT) DescriptorSet 0
Decorate 29(accEXT) Binding 0
Decorate 46(payloadEXT) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0

View File

@ -69,7 +69,6 @@ spv.ext.AnyHitShader.rahit
Decorate 70(gl_GeometryIndexEXT) BuiltIn RayGeometryIndexKHR
Decorate 76(gl_ObjectToWorld3x4EXT) BuiltIn ObjectToWorldKHR
Decorate 80(gl_WorldToObject3x4EXT) BuiltIn WorldToObjectKHR
Decorate 84(incomingPayload) Location 1
Decorate 98(gl_SubgroupSize) RelaxedPrecision
Decorate 98(gl_SubgroupSize) BuiltIn SubgroupSize
Decorate 99 RelaxedPrecision

View File

@ -70,8 +70,6 @@ spv.ext.ClosestHitShader.rchit
Decorate 80(gl_WorldToObject3x4EXT) BuiltIn WorldToObjectKHR
Decorate 85(accEXT) DescriptorSet 0
Decorate 85(accEXT) Binding 0
Decorate 98(incomingPayload) Location 1
Decorate 100(localPayload) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0

View File

@ -34,7 +34,6 @@ spv.ext.ClosestHitShader_Subgroup.rchit
Name 61 "gl_SMIDNV"
Decorate 8(accEXT) DescriptorSet 0
Decorate 8(accEXT) Binding 0
Decorate 26(incomingPayload) Location 1
Decorate 28(gl_SubgroupInvocationID) RelaxedPrecision
Decorate 28(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId
Decorate 29 RelaxedPrecision

View File

@ -53,7 +53,6 @@ spv.ext.MissShader.rmiss
Decorate 32(gl_RayTmaxEXT) BuiltIn RayTmaxKHR
Decorate 36(accEXT) DescriptorSet 0
Decorate 36(accEXT) Binding 0
Decorate 51(incomingPayload) Location 1
Decorate 53(gl_SubGroupSizeARB) BuiltIn SubgroupSize
Decorate 53(gl_SubGroupSizeARB) Volatile
Decorate 53(gl_SubGroupSizeARB) Coherent
@ -67,7 +66,6 @@ spv.ext.MissShader.rmiss
Decorate 74(s2D) Binding 1
Decorate 78(c2) Location 2
Decorate 85(lodClamp) Location 3
Decorate 89(localPayload) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0

View File

@ -22,8 +22,6 @@ spv.ext.RayCallable.rcall
Decorate 11(gl_LaunchIDEXT) BuiltIn LaunchIdKHR
Decorate 14(gl_LaunchSizeEXT) BuiltIn LaunchSizeKHR
Decorate 16(dataBlock) Block
Decorate 18 Location 1
Decorate 29(data0) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0

View File

@ -15,7 +15,6 @@ spv.ext.RayConstants.rgen
Name 26 "payload"
Decorate 8(accEXT) DescriptorSet 0
Decorate 8(accEXT) Binding 0
Decorate 26(payload) Location 1
2: TypeVoid
3: TypeFunction 2
6: TypeAccelerationStructureKHR

View File

@ -49,7 +49,6 @@ spv.ext.RayGenSBTlayout.rgen
MemberDecorate 36(block) 9 Offset 120
MemberDecorate 36(block) 10 Offset 128
Decorate 36(block) Block
Decorate 60(payload) Location 1
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0

View File

@ -49,7 +49,6 @@ spv.ext.RayGenSBTlayout140.rgen
MemberDecorate 36(block) 9 Offset 136
MemberDecorate 36(block) 10 Offset 144
Decorate 36(block) Block
Decorate 60(payload) Location 1
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0

View File

@ -49,7 +49,6 @@ spv.ext.RayGenSBTlayout430.rgen
MemberDecorate 36(block) 9 Offset 120
MemberDecorate 36(block) 10 Offset 128
Decorate 36(block) Block
Decorate 60(payload) Location 1
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0

View File

@ -50,7 +50,6 @@ spv.ext.RayGenSBTlayoutscalar.rgen
MemberDecorate 36(block) 9 Offset 96
MemberDecorate 36(block) 10 Offset 104
Decorate 36(block) Block
Decorate 60(payload) Location 1
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0

View File

@ -34,7 +34,6 @@ spv.ext.RayGenShader.rgen
MemberDecorate 38(block) 0 Offset 0
MemberDecorate 38(block) 1 Offset 16
Decorate 38(block) Block
Decorate 53(payload) Location 1
Decorate 54(accEXT1) DescriptorSet 0
Decorate 54(accEXT1) Binding 1
Decorate 57(imageu) DescriptorSet 0

View File

@ -30,7 +30,6 @@ spv.ext.RayGenShader11.rgen
MemberDecorate 37(block) 0 Offset 0
MemberDecorate 37(block) 1 Offset 16
Decorate 37(block) Block
Decorate 52(payload) Location 1
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0

View File

@ -43,7 +43,6 @@ spv.ext.RayGenShaderArray.rgen
MemberDecorate 36(block) 3 Offset 32
MemberDecorate 36(block) 4 Offset 40
Decorate 36(block) Block
Decorate 61(payload) Location 1
Decorate 65(accEXT1) DescriptorSet 0
Decorate 65(accEXT1) Binding 1
Decorate 80 DecorationNonUniformEXT

View File

@ -28,7 +28,6 @@ spv.ext.World3x4.rahit
Decorate 60(gl_WorldToObject3x4EXT) BuiltIn WorldToObjectKHR
Decorate 78(result) DescriptorSet 0
Decorate 78(result) Binding 0
Decorate 89(hitValue) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32