Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix map not rendering on emulators when MSAA is enabled #1077

Merged
merged 3 commits into from
Jan 26, 2022

Conversation

kiryldz
Copy link
Contributor

@kiryldz kiryldz commented Jan 25, 2022

Summary of changes

At least Google simulators seem not to support MSAA option when configuring EGL. This will result in map not being rendered at all. Now logic is introduced to try double down EGL_SAMPLE value in a loop until either supported MSAA config will be found (fixing an issue of map not being rendered even on physical device when setting huge MSAA value) or EGL will be configured without MSAA (fixing an issue with emulators).

User impact (optional)

Pull request checklist:

  • Briefly describe the changes in this PR.
  • Include before/after visuals or gifs if this PR includes visual changes.
  • Write tests for all new functionality. If tests were not written, please explain why.
  • Optimize code for java consumption (@JvmOverloads, @file:JvmName, etc).
  • Add example if relevant.
  • Document any changes to public APIs.
  • Apply changelog label ('breaking change', 'bug 🪲', 'build', 'docs', 'feature 🍏', 'performance ⚡', 'testing 💯') or use the label 'skip changelog'
  • Add an entry inside this element for inclusion in the mapbox-maps-android changelog: <changelog>Fix map not rendering on emulators when MSAA is enabled.</changelog>.
  • If this PR is a v10.[version] release branch fix / enhancement, merge it to main firstly and then port to v10.[version] release branch.

Fixes: #1076

PRs must be submitted under the terms of our Contributor License Agreement CLA.

@kiryldz kiryldz added the bug 🪲 Something isn't working label Jan 25, 2022
@kiryldz kiryldz requested a review from a team January 25, 2022 16:09
@kiryldz kiryldz self-assigned this Jan 25, 2022
@kiryldz kiryldz requested a review from pengdev January 25, 2022 16:55
@pengdev
Copy link
Member

pengdev commented Jan 26, 2022

@kiryldz could we add some tests to this function? unit test would be useful to cover logic for getNumberOfConfigurations and preferably also some instrumentation tests?

@kiryldz kiryldz requested a review from yunikkk January 26, 2022 10:25
eglChooserSuccess = false
if (antialiasingSampleCount > 1) {
Logger.w(TAG, "Reducing sample count in 2 times for MSAA as EGL_SAMPLES=$antialiasingSampleCount is not supported")
antialiasingSampleCount /= 2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if the device's supported sample count is like 4, 8 etc, while the user defined 5? would this algorithm end up picking 0 in the end?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pengdev 5 / 2 = 2, 2 / 2 = 1 => config with MSAA disabled will be chosen. Dividing any number (> 1) by 2 will end up with 1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if user defined 5, while device supports 4 or 8 - it depends on the driver, from what I've seen it EGL will select sample count rounded up so in this case it will select 8.
We will write a warning in this case though, this logic is not changed in this PR

@kiryldz kiryldz merged commit a9e3df9 into main Jan 26, 2022
@kiryldz kiryldz deleted the kdz-fix-msaa-emulators branch January 26, 2022 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Black screen if using emulator with MSAA enabled
4 participants