diff options
author | Alok Hota <[email protected]> | 2018-08-28 12:23:31 -0500 |
---|---|---|
committer | Alok Hota <[email protected]> | 2019-02-15 14:54:09 -0600 |
commit | 0b4db4370544459fcd47499d9f8663e421fcae34 (patch) | |
tree | 44310f8570a122e99f29ad945d4a30d034cb8a19 /src/gallium/drivers/swr/rasterizer/common | |
parent | dc7b3c95a45078fcbf32e68bf6b2c972c6df41c9 (diff) |
swr/rast: FP consistency between POSH/RENDER pipes
- Ensure all threads have optimal floating-point control state
- Disable auto-generation of fused FP ops for VERTEX shader stage
- Disable "fast" FP ops for VERTEX shader stage
Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr/rasterizer/common')
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/common/os.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/common/os.h b/src/gallium/drivers/swr/rasterizer/common/os.h index 314d8184374..b00beeb36dd 100644 --- a/src/gallium/drivers/swr/rasterizer/common/os.h +++ b/src/gallium/drivers/swr/rasterizer/common/os.h @@ -294,4 +294,25 @@ int SWR_API std::string* pOptStdErr = nullptr, ///< (Optional Out) Standard Error text const std::string* pOptStdIn = nullptr); ///< (Optional In) Standard Input text + +/// Helper for setting up FP state +/// @returns old csr state +static INLINE uint32_t SetOptimalVectorCSR() +{ + uint32_t oldCSR = _mm_getcsr(); + + uint32_t newCSR = (oldCSR & ~(_MM_ROUND_MASK | _MM_DENORMALS_ZERO_MASK | _MM_FLUSH_ZERO_MASK)); + newCSR |= (_MM_ROUND_NEAREST | _MM_FLUSH_ZERO_ON | _MM_DENORMALS_ZERO_ON); + _mm_setcsr(newCSR); + + return oldCSR; +} + +/// Set Vector CSR state. +/// @param csrState - should be value returned from SetOptimalVectorCSR() +static INLINE void RestoreVectorCSR(uint32_t csrState) +{ + _mm_setcsr(csrState); +} + #endif //__SWR_OS_H__ |