diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2018-11-01 15:08:54 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-01 15:08:54 -0700 |
| commit | 453331951b0df2a612f9bc0d68eab2ad786ec5bf (patch) | |
| tree | 5514782a6c8247941d5aa3396930aa479e504db9 /source/slang/compiler.cpp | |
| parent | 82f57ae3561e9f9e8ece8ab6c12c2b318580bc38 (diff) | |
Add support for a "strict" floating-point mode (#709)
This change adds an API function and command line options for controlling the default floating-point behavior for a target, with options for "fast" and "precise" computation.
The "precise" option gets mapped to the "IEEE strictness" mode in `fxc` and `dxc` (there is currently no equivalent option for glslang that I could find).
Diffstat (limited to 'source/slang/compiler.cpp')
| -rw-r--r-- | source/slang/compiler.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/source/slang/compiler.cpp b/source/slang/compiler.cpp index ed222d181..52a31645c 100644 --- a/source/slang/compiler.cpp +++ b/source/slang/compiler.cpp @@ -428,6 +428,18 @@ namespace Slang dxMacros = dxMacrosStorage.Buffer(); } + DWORD flags = 0; + + switch( targetReq->floatingPointMode ) + { + default: + break; + + case FloatingPointMode::Precise: + flags |= D3DCOMPILE_IEEE_STRICTNESS; + break; + } + ID3DBlob* codeBlob; ID3DBlob* diagnosticsBlob; HRESULT hr = D3DCompile_( @@ -438,8 +450,8 @@ namespace Slang nullptr, getText(entryPoint->name).begin(), GetHLSLProfileName(profile).Buffer(), - 0, - 0, + flags, + 0, // unused: effect flags &codeBlob, &diagnosticsBlob); |
