fix: water shader under LÖVE 12 — make effect()'s parameter precision a define - #82
Open
luisgonzaleznf wants to merge 1 commit into
Open
Conversation
… define The float params were pinned to mediump to match LOVE 11's forward declaration of effect(), because a definition whose precisions differ from the prototype's reads as a second function to some compilers. LOVE 12 declares it under a different precision, so the pin became the mismatch there and the shader stopped compiling -- lakes drew flat on any LOVE 12 + Metal build, iOS included. The qualifier is a define now, and Water.shader compiles the pinned form first and the bare one only if that is refused, so whichever prototype a runtime brought, one of the two agrees with it. The warning fires only when both are refused.
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.
Fixes #76.
effect()'s float parameters are pinned tomediumpto match LÖVE 11's forward declaration — the signature's own comment explains why, and the Xclipse case it names is real. LÖVE 12 forward-declareseffect()under a different precision, so on 12 the pin is the mismatch, from the other side:Arguments 1, 3 and 4 are exactly the three qualified floats; argument 2 is
Image texand carries no qualifier, which is why it is not flagged. The trailingmissing #endifin the log is a cascade — the directives balance, and the compiler reportscompilation terminatedbefore reaching the closing one.The shader then falls back to flat water, silently apart from the warning. On iOS that is the current state, since the iOS shell runs LÖVE 12.
Rather than swap one hardcoded precision for another and break the case the original comment was defending, the qualifier becomes a define the Lua side fills in, and
Water.shadercompiles the pinned form first and the bare form only if that is refused. Whichever prototype a runtime brought, one of the two agrees with it — Xclipse still gets its pinnedmediumpon the first attempt, LÖVE 12 falls through to the bare one. The warning now fires only when both shapes are refused, which is a driver that was never going to draw this water anyway.No version or platform checks.
Verified on LÖVE 12.0 nightly + Metal on macOS, the configuration that was failing:
with shoreline and dock reflections visible in-game and no shader warning. Both variants compile, so the wireframe path is covered too. LÖVE 11.5 / OpenGL is unchanged — it takes the pinned form on the first attempt, exactly as before, and the second
pcallnever runs.Independent of #75 (shadow map under LÖVE 12); they touch different files and can land in either order.