Repository navigation
metal: set the simulator cfg in build.rs to keep the 1.70 MSRV - #711
Open
nivaldomcj wants to merge 1 commit into
Open
nivaldomcj wants to merge 1 commit into
nivaldomcj wants to merge 1 commit into
Conversation
cfg(target_abi) is only stable since Rust 1.78, so the uniform buffer alignment check from not-fl3#636 broke Apple builds on the declared MSRV. build.rs now sets miniquad_apple_sim for the -sim targets instead, which also reads the same on compilers that renamed it to target_env = "sim". check-cfg is only declared from Rust 1.80 on, where cargo accepts it. The MSRV job now runs on macOS as well, since metal.rs and the macOS backend never compile on the Linux runner. Fixes not-fl3#709 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Thanks for picking this up! I tested it on macOS 27.2.1 with Xcode 27.2, on an M2 Max:
One optional suggestion: like master, LGTM 👍 |
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 #709.
metal.rspicks the uniform buffer alignment withcfg(target_abi = "sim"), which needs Rust 1.78, so Apple targets stopped building on the declared MSRV. This is option 2 from the issue:build.rssetsminiquad_apple_simwhenTARGETends in-sim(aarch64-apple-ios-sim, aarch64-apple-tvos-sim), andmetal.rsuses that instead. The x86_64 simulators were already matched bytarget_arch = "x86_64".Cargo before 1.80 warns about
rustc-check-cfg, sobuild.rsonly prints it whenrustc --versionis 1.80 or newer, the same way serde's build script does.The MSRV job now also runs on
macos-latest, so Apple-only code gets built with 1.70.To check that the alignment didn't change, I built each Apple target on Rust 1.100.0 with a temporary compile-time assert comparing
UNIFORM_BUFFER_ALIGNagainst master'starget_abicfgs:miniquad_apple_simcargo +1.70.0 build --all-targetspasses for aarch64-apple-darwin and x86_64-apple-darwin, where master fails with E0658. On 1.98.0 and 1.100.0, the macOS builds andcargo check --all-targetsfor the five iOS/tvOS targets pass with no warnings.I also ran
examples/quadwith Metal API validation on the iOS 26.5 and tvOS 26.5 simulators (Xcode 27.2). This branch and master both draw with no validation errors. As a control, a build forced to the 16-byte alignment on the simulator fails on the first frame with "must be a multiple of 256 but was set to 16". Getting the example running there needed local workarounds for a few unrelated issues, which I'll open separately.Tested on macOS 27.2.1 (26B131), Apple M3 Max (arm64), Rust 1.70.0, 1.98.0 and 1.100.0. cc @benface