gfx-rs / gfx

[maintenance mode] A low-overhead Vulkan-like GPU API for Rust.
http://gfx-rs.github.io/
Apache License 2.0
5.35k stars 551 forks source link

Fix WebGL backend for wgpu-rs cube example #3771

Closed Frizi closed 3 years ago

Frizi commented 3 years ago

Fixes "cube" example in wgpu-rs for webgl backend on Windows. Will also fix MacOS once https://github.com/gfx-rs/naga/pull/936 gets included.

delete_shader is delayed after linking the program. Not doing that seems to be randomly triggering linking issues. I'm not exactly sure under what circumstances it tends to happen, but the fix made it reliable.

The most important fix is about texture filtering for intager textures. ANGLE decides to ignore integer textures if their filtering is kept as default. Instead, it silently substitutes an empty 1px placeholder texture into the shader binding. Forcing the integer textures to NEAREST filtering makes that problem go away.

bors[bot] commented 3 years ago

Build succeeded: