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

Web support #63

Draft
wants to merge 10 commits into
base: master
from

Conversation

@hecrj
Copy link
Owner

commented Jul 2, 2019

Depends on #62 and #60.

This PR allows Coffee to compile to Wasm! πŸŽ‰

Examples

I would greatly appreciate it if you report any issues you find!

Known issues

  • Text does not render on some environments.

Implementation details

The changes basically use the new gl backend coming to wgpu to run graphics on the web using WebGL2.

The PR uses my own forks of:

  • winit – implements a new web platform with support for web-sys and stdweb. Coffee uses the web-sys backend on web.
  • gfx-backend-gl – fixes some issues I have detected when dealing with WebGL. More specifically, it implements the CopyImageToSurface command and it fixes a big memory leak.
  • wgpu-native – implements new wiring to support the new winit features.
  • wgpu-rs – adapts to the changes in wgpu-native.
  • wgpu_glyph – fixes an issue with drawArraysInstanced in WebGL2 on Firefox.
  • instant – fixes an Illegal invocation error when calling performance.now(). A fix should be merged soon (sebcrozet/instant#5).

This PR does not contain any additional breaking changes to the ones found in #62. The API remains unchanged, meaning web support will be mostly free for projects that are already using Coffee.

Pending work

hecrj added some commits Jun 27, 2019

Migrate to the new `winit` event loop.
- The new `game::Loop` trait is introduced to remove code duplication in
  `UserInterface::run`.
- The `empty` feature is introduced, it allows testing without a
  specific backend enabled.
Dirtyfix `gfx-backend-gl` 1-layer texture arrays.
Apparently, `gfx-backend-gl` cannot easily distinguish between
single-layered texture arrays and normal textures.
Use `RGBA` instead of `BGRA` as texture format.
Apparently, `BGRA` does not work properly. We should investigate why.

@hecrj hecrj added the feature label Jul 2, 2019

@hecrj hecrj self-assigned this Jul 2, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.