Repository navigation
Conversation
`create_egl_context` passes `Conf::sample_count` straight to `EGL_SAMPLES` and asserts that `eglChooseConfig` found a config, so an app that asks for MSAA panics at launch on any device whose EGL has no config with that many samples. The Android emulator is one: it offers configs with 0 samples and a single one with 1, so `sample_count: 4` fails with `assertion failed: cfg_count > 0`. Retry with half as many samples until a config matches, down to 0. `sample_count: 1`, the default, still asks for 1 sample first, so apps that don't ask for MSAA get the same config as before. Verified on the Android emulator (API 34, `-gpu auto`): 4 and 2 samples match nothing, 1 matches, and the app starts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
create_egl_contextpassesConf::sample_countstraight toEGL_SAMPLESand asserts thateglChooseConfigfound a config. So an app that asks for MSAA panics at launch on any device whose EGL has no config with that many samples:The Android emulator is one of them. It offers configs with 0 samples and a single one with 1, so
sample_count: 4panics as soon as the surface exists. This happens on API 34 and API 36 images, with-gpu auto,hostandswiftshader.Change
Retry
eglChooseConfigwith half as many samples until a config matches, down to 0. If nothing matches at 0 either, the existing assert still fires.sample_count: 1, the default, still asks for 1 sample first, so apps that don't ask for MSAA are unaffected.eglChooseConfigcalls, and only during context creation.The fallback is in the shared EGL path, so it covers every
create_egl_contextcaller: Android and the Linux X11 and Wayland EGL backends.Verification
-gpu auto), 4 and 2 samples match nothing and 1 matches. A macroquad game (CHOMP) that setssample_count: 4now starts and renders instead of panicking.cargo checkpasses with no new warnings foraarch64-linux-androidandx86_64-unknown-linux-gnu.🤖 Generated with Claude Code