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.
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
Implementation details
The changes basically use the new
glbackend coming towgputo run graphics on the web using WebGL2.The PR uses my own forks of:
winit– implements a newwebplatform with support forweb-sysandstdweb. Coffee uses theweb-sysbackend on web.gfx-backend-gl– fixes some issues I have detected when dealing with WebGL. More specifically, it implements theCopyImageToSurfacecommand and it fixes a big memory leak.wgpu-native– implements new wiring to support the newwinitfeatures.wgpu-rs– adapts to the changes inwgpu-native.wgpu_glyph– fixes an issue withdrawArraysInstancedin WebGL2 on Firefox.instant– fixes anIllegal invocationerror when callingperformance.now(). A fix should be merged soon (calling window for performance now 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
winitWasm supportweberrors rust-windowing/winit#1040gfx-backend-glfixesvertex_attrib_divisorto0when needed on GL backend gfx-rs/gfx#2887R8Unormformat in GL backend gfx-rs/gfx#2891submitin GL when there are no sync capabilities gfx-rs/gfx#2893wgpu-nativeandwgpu-rswiring codewgpu_glyphfixesinstantfix (calling window for performance now sebcrozet/instant#5)gfxbackends to integrate with the newwinit(and maybe contribute!)BGRA*texture formats do not seem to worktwox-hashhas so many collisions on WasmFile::openwith an alternative on Wasmwinitandwgpu#62)wgpubackend to latest API #60winitandwgpu#62