Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions tools/clang/lib/SPIRV/SpirvEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -864,9 +864,10 @@ void SpirvEmitter::HandleTranslationUnit(ASTContext &context) {

// For Vulkan 1.2 and later, add SignedZeroInfNanPreserve when -Gis is
// provided to preserve NaN/Inf and signed zeros.
if (spirvOptions.IEEEStrict &&
featureManager.getSpirvVersion(featureManager.getTargetEnv()) >=
VersionTuple(1, 2)) {
if (spirvOptions.IEEEStrict) {
if (featureManager.getSpirvVersion(featureManager.getTargetEnv()) <
VersionTuple(1, 2))
spvBuilder.requireExtension("SPV_KHR_float_controls", SourceLocation());
spvBuilder.addExecutionMode(entryFunction,
spv::ExecutionMode::SignedZeroInfNanPreserve,
{32}, SourceLocation());
Expand Down
11 changes: 5 additions & 6 deletions tools/clang/test/CodeGenSPIRV/SignedZeroInfNanPreserve.hlsl
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// RUN: %dxc -T cs_6_0 -spirv -Gis %s| FileCheck %s --check-prefixes=CHECK,OLD
// RUN: %dxc -T cs_6_0 -spirv -Gis -fspv-target-env=vulkan1.2 %s| FileCheck %s --check-prefixes=CHECK,NEW
// RUN: %dxc -T cs_6_0 -spirv -Gis %s| FileCheck %s --check-prefixes=CHECK,PRE_1_3
// RUN: %dxc -T cs_6_0 -spirv -Gis -fspv-target-env=vulkan1.2 %s| FileCheck %s

// OLD-NOT: OpCapability SignedZeroInfNanPreserve
// NEW: OpCapability SignedZeroInfNanPreserve
// CHECK: OpCapability SignedZeroInfNanPreserve
// PRE_1_3: OpExtension "SPV_KHR_float_controls"
// CHECK: OpEntryPoint
// OLD-NOT: OpExecutionMode %main SignedZeroInfNanPreserve 32
// NEW: OpExecutionMode %main SignedZeroInfNanPreserve 32
// CHECK: OpExecutionMode %main SignedZeroInfNanPreserve 32

[numthreads(8,1,1)]
void main() {}