Repository navigation
Skip equation code that doesn't compile instead of failing the preset - #1069
Open
Coastrnaut wants to merge 1 commit into
Open
Coastrnaut wants to merge 1 commit into
Coastrnaut wants to merge 1 commit into
Conversation
If a code block of a preset doesn't compile, Milkdrop shows a warning, leaves that block disabled and still uses the preset (RecompileExpressions() in state.cpp). If the init code fails, it resets the q variables (or the t variables of a custom wave or shape) that would have been set by it. projectM threw an exception instead, so the whole preset failed to load. Some presets in the common packs contain broken code that Milkdrop also rejects, e.g. "0.99l", ".-.4" or a stray "per_frame_1=" pasted into a line, often in a block that has little or no visible effect. Log a warning and skip the block instead, and reset the variables like Milkdrop does.
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
If a code block of a preset doesn't compile, Milkdrop shows a warning, leaves that block disabled and still uses the preset (
RecompileExpressions()in state.cpp). If the init code fails, it resets the q variables (or the t variables of a custom wave or shape) that the init code would have set.projectM throws a
MilkdropCompileExceptioninstead, so the whole preset fails to load. With the line joining fix in #1068, 17 presets in the four packs below still fail this way, all with code that Milkdrop rejects as well, for example:This logs a warning and skips the block instead of throwing, and resets the variables like Milkdrop does. It intentionally changes how projectM treats broken presets, so I kept it separate from the other fixes: apps that relied on these presets being skipped will now show them, like Milkdrop does.
Results
EquationCompileErrorTest. The per-frame context can be tested without a GL context;PresetStateneeds one, so the init code path is covered by the preset run. All unit tests pass.How I tested it
I loaded all 14,536 presets from cream-of-the-crop, en-d, milkdrop-original and projectm-classic one after another (Windows, RTX A6000), with the preset folders as texture search path, rendered 30 frames each with fixed audio and frame times, and recorded shader compile/link results, failed loads, logged warnings and frame hashes. For the pixel comparison both builds had their random seeds fixed (a local patch only, identical on both sides). The presets this PR fixes are excluded from the pixel comparison, since loading them changes shared state (e.g. the expression evaluator's random generator) for every preset after them.
Retested on current master (2026-11-12)
sonar cow, has a composite shader that doesn't compile without the other shader PRs, so it uses the default one here. Frames before the first of them are identical to master except for$$$ Royal - Mashup (257), which also renders differently between two runs of master.