From 453331951b0df2a612f9bc0d68eab2ad786ec5bf Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Thu, 1 Nov 2018 15:08:54 -0700 Subject: 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). --- slang.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'slang.h') diff --git a/slang.h b/slang.h index 83aece07f..f774ab323 100644 --- a/slang.h +++ b/slang.h @@ -450,6 +450,17 @@ extern "C" SLANG_TARGET_FLAG_PARAMETER_BLOCKS_USE_REGISTER_SPACES = 1 << 4, }; + /*! + @brief Options to control floating-point precision guarantees for a target. + */ + typedef unsigned int SlangFloatingPointMode; + enum + { + SLANG_FLOATING_POINT_MODE_DEFAULT = 0, + SLANG_FLOATING_POINT_MODE_FAST, + SLANG_FLOATING_POINT_MODE_PRECISE, + }; + /*! @brief Options to control emission of `#line` directives */ @@ -877,6 +888,14 @@ extern "C" int targetIndex, SlangTargetFlags flags); + /*! + @brief Set the floating point mode (e.g., precise or fast) to use a target. + */ + SLANG_API void spSetTargetFloatingPointMode( + SlangCompileRequest* request, + int targetIndex, + SlangFloatingPointMode mode); + /* DEPRECATED: use `spSetMatrixLayoutMode` instead. */ SLANG_API void spSetTargetMatrixLayoutMode( SlangCompileRequest* request, -- cgit v1.2.3