You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: -fno-finite-math-only after -ffast-math for #369 - #407
The order matters, -fno-finite-math-only must come after -ffast-math (last flag wins), which re-enables inf/NaN semantics while keeping the rest of fast-math for the DSP.
The reason, as best I've been able to establish, is that a recent cairo bump (cairo >= 1.18) causes it to silently drop entire paths when calling cairo_line_to if any coordinate is non-finite.
That matters because the analyzer uses INFINITY as a flag for "skip this pixel" when drawing. So with -ffinite-math-only enabled, the compiler assumes infinities can't exist and folds the line-graph widget's guard data[i] < INFINITY to constant-true. Technically -ffast-math was always incompatible, it just never showed up here before.
Bars/boxes/spectralizer views survive because they pass coordinates through (int)y casts before cairo, so no non-finite value ever reaches the path.
I've got the patched version working on my box currently, using a nix substituteInPlace expr. to trial it.
Hi, I also ran into not seeing Analyser's spectrum and can independently confirm:
Calf 0.90.9 calflv2gui.so built with GCC 15.2.0 (Ubuntu) and the flags from src/CMakeLists.txt, in Ardour 9.8 (built against Ardour's bundled GTK2 fork, but the mechanism below doesn't depend on GTK). The phase correlation display updates, but the Analyzer spectrum line stays empty. Adding -fno-finite-math-only after -ffast-math, as this PR does, fixes it.
Root cause: analyzer::draw() (src/analyzer.cpp) marks points that should not be drawn with data[i] = INFINITY, and calf_line_graph_draw_graph() (src/ctl_linegraph.cpp) skips them with data[i] < INFINITY. -ffast-math implies -ffinite-math-only, so GCC folds that comparison to true. Every marker is then drawn: in line mode as cairo_line_to(ctx, x, y) with y = -inf. In a standalone reproduction of that drawing code with cairo 1.18.4, the folded line path paints 0 pixels and cairo reports no error, while the bar path, which casts (int)y before cairo_rectangle(), still paints. That is consistent with Bars working and Lines not (#369). Curves that never contain INFINITY, like the Filter response, are unaffected.
Thanks for submitting this PR, it seems to solve the problem.
Before we merge this, I wonder whether this change might have on other parts of the code, as it will have an effect on all source files. Could this rather be solved locally, i.e. find a very high value that serves as a sentinel, but is not INFINITY? Would that be safer?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(Copied from response in issue #369)
So I was able to actually resolve this with some trial and error, turns out the problem is in the compile options and their ordering.
Specifically here:
That needs to be changed to:
The order matters,
-fno-finite-math-onlymust come after-ffast-math(last flag wins), which re-enables inf/NaN semantics while keeping the rest of fast-math for the DSP.The reason, as best I've been able to establish, is that a recent cairo bump (cairo >= 1.18) causes it to silently drop entire paths when calling
cairo_line_toif any coordinate is non-finite.That matters because the analyzer uses
INFINITYas a flag for "skip this pixel" when drawing. So with-ffinite-math-onlyenabled, the compiler assumes infinities can't exist and folds the line-graph widget's guarddata[i] < INFINITYto constant-true. Technically-ffast-mathwas always incompatible, it just never showed up here before.Bars/boxes/spectralizer views survive because they pass coordinates through
(int)ycasts before cairo, so no non-finite value ever reaches the path.I've got the patched version working on my box currently, using a nix
substituteInPlaceexpr. to trial it.