|
|
Donner SVG 0.8.0-pre
SVG editor and embeddable C++20 engine.
|
The round-half-away-from-zero recipe, as a function any IR program can declare. More...
Namespaces | |
| namespace | donner |
| Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css. | |
Functions | |
| ShaderStatus | donner::gpu::shader::programs::AddRoundHalfAwayFromZero (ModuleBuilder &builder) |
Declares round_half_away_from_zero(x: f32) -> f32 on builder, ready to be called by name. | |
The round-half-away-from-zero recipe, as a function any IR program can declare.
WGSL's round is round-half-to-even, so it disagrees with the CPU filter path's std::round on exact half values. Comparing the fractional magnitude with 0.5 avoids rounding the preceding representable value upward while computing the rounding decision.
| ShaderStatus donner::gpu::shader::programs::AddRoundHalfAwayFromZero | ( | ModuleBuilder & | builder | ) |
Declares round_half_away_from_zero(x: f32) -> f32 on builder, ready to be called by name.
Declare it before the function that calls it: a module emits its functions in declaration order, and a call to a function declared later would not compile.
| builder | Module to declare the function on. |