Blend2D
2D Vector Graphics Engine
Blend2D runtime scope [C++ API].
Runtime scope is a totally optional feature that can be used by Blend2D to setup the current thread's control word in a way to make the behavior of some floating point computations consistent between platforms. Blend2D doesn't rely on any specific behavior, however, for testing purposes and possibly consistency of rendering across different architectures some setup may be necessary.
The runtime scope current only changes FPU control word in 32-bit x86 case to 64-bit precision. This means that if the FPU control word was set to 80-bits the precision of floating computations would be basically lowered, but this is necessary to make sure that intermediate computations match other platforms that don't have extended precision. Blend2D doesn't rely on extended precision in any way and this all is needed only if 100% consistency is required across different platforms.
At the moment BLRuntimeScope is only used by tests to ensure that we can compare reference implementation written in C++ with SIMD optimized implementation written either in C++ or generated at runtime (JIT).
As the name of the class suggests, BLRuntimeScope
establishes a scope, so the FPU control word would only be changed temporarily within the life-time of the scope.
Example:
Establishes a new runtime scope by possibly changing the state of FPU control word.
Restores the scope to the previous state.