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

Enable webgl1 fallback #2656

Merged
merged 8 commits into from
Jun 12, 2023
Merged

Conversation

birkskyum
Copy link
Member

@birkskyum birkskyum commented Jun 10, 2023

This is a fix to the regression caused by the complete sunset of webgl1. Closes #2653 , Closes #2644

This reverts shaders to GL ES 1.0, and adds conditional logic and union typings to allow webgl1 as a fallback while keeping the majority of users on webgl2.

  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!

@codecov-commenter
Copy link

codecov-commenter commented Jun 10, 2023

Codecov Report

Attention: Patch coverage is 78.43137% with 11 lines in your changes missing coverage. Please review.

Project coverage is 73.77%. Comparing base (3ab0fcd) to head (dda0428).
Report is 1694 commits behind head on main.

Files with missing lines Patch % Lines
src/gl/context.ts 65.38% 9 Missing ⚠️
src/gl/value.ts 80.00% 1 Missing ⚠️
src/util/webp_supported.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2656      +/-   ##
==========================================
- Coverage   73.83%   73.77%   -0.07%     
==========================================
  Files         237      238       +1     
  Lines       18893    18925      +32     
  Branches     4223     4244      +21     
==========================================
+ Hits        13949    13961      +12     
- Misses       4944     4964      +20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/gl/context.ts Outdated Show resolved Hide resolved
src/render/draw_heatmap.ts Outdated Show resolved Hide resolved
@HarelM
Copy link
Collaborator

HarelM commented Jun 11, 2023

Is there a way to keep the new shaders code and use the rollup to translate it to "old" code?
So that if and when we move to the new shaders we would only need to remove this part?
This is a rough thought, I don't know how possible it is.

@birkskyum birkskyum force-pushed the enable-webgl1-fallback branch from 4c07869 to c5b032e Compare June 11, 2023 09:21
@birkskyum
Copy link
Member Author

birkskyum commented Jun 11, 2023

Is there a way to keep the new shaders code and use the rollup to translate it to "old" code? So that if and when we move to the new shaders we would only need to remove this part? This is a rough thought, I don't know how possible it is.

I've made a webgl1 compatibility solution to the generate-shaders that downgrades the shaders. More advanced features of webgl2, and refactor of associated logic, won't be possible to approach with this webgl1 limitation in place, but at least the changes we have done already can be kept.

@HarelM
Copy link
Collaborator

HarelM commented Jun 11, 2023

LGTM! Thanks! Yea, this is what I meant.

@handymenny
Copy link
Contributor

the downgrade is done at build time, right? what about downgrading at runtime? Indeed that would be a (small?) penality for webgl1 users, but it clearly states that webgl2 is the path that maplibre is optimizing for.

@birkskyum
Copy link
Member Author

@handymenny , yes, this is done a build time. It's an interesting idea to consider runtime transpiring - i'll bring that suggestion to the tsc meeting discussion as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

webgl1 support and future Failed to create WebGL context: WebGL creation failed
4 participants