Open sotrh opened 7 months ago
… when I test it out on web SRGB surface textures aren't available …
You need to use the srgb format as a view format:
NOTE: Canvas configuration cannot use srgb formats like "bgra8unorm-srgb". Instead, use the non-srgb equivalent ("bgra8unorm"), specify the srgb format in the viewFormats, and use createView() to create a view with an srgb format.
Is there any reason why the code works as expected on native and WebGL?
I believe we allow sRGB surfaces on any GL device through emulation (https://github.com/gfx-rs/wgpu/blob/v0.19/wgpu-hal/src/gles/shaders/srgb_present.frag). That was probably before that language existed in the spec though, so maybe we should reconsider it for WebGL for consistency.
Description I'm working on updating my tutorial to 0.19 and I got the native code working, but when I test it out on web SRGB surface textures aren't available and certain examples no longer render as expected.
Native:
Web:
Repro steps
cargo r --bin tutorial10-lighting
to see the native demo shown aboveyarn dev
then navigate to localhost:8080Expected vs observed behavior Running the code on web should behave the same as on native, but the web version isn't working.
Extra materials I have some screenshots above
Platform