wgpu
wgpu copied to clipboard
wasm/webgl2: buggy ClearColor behavior on various platforms
Description
Clear color is darker than expected, but occasionally flickers with the correct color.
Repro steps
With an M1 Mac, open Chrome (stable) and visit https://wgpu.rs/examples-gl/?example=cube or https://wgpu.rs/examples-gl/?example=mipmap
Alternately, with Win10 in Firefox follow instructions in the linked bevy issue.
Expected vs observed behavior
Expected a light blue background color, but I see a dark blue color that occasionally flickers light blue.
Extra materials
https://user-images.githubusercontent.com/200550/180576975-4b3c732b-9740-4ddd-8f85-41cc0299e237.mp4
See also: https://github.com/bevyengine/bevy/issues/5426
With bevy in the loop, we're also seeing strange Clear color behavior on Windows in Firefox but I'm so far unsuccessful in reproducing this in a wgpu example.
Platform
This seems to occur only in Stable Chrome for me, so I suppose the issue will eventually fix itself?
Here's the results of testing on various browsers that I have access to on this machine.
Browser | AdapterInfo | |
---|---|---|
Bug | Chrome 103.0.5060.114 | AdapterInfo { name: "ANGLE (Apple, Apple M1 Max, OpenGL 4.1)", vendor: 0, device: 0, device_type: IntegratedGpu, backend: Gl } |
Bug | Chrome 103.0.5060.134 | AdapterInfo { name: "ANGLE (Apple, Apple M1 Max, OpenGL 4.1)", vendor: 0, device: 0, device_type: IntegratedGpu, backend: Gl } |
Ok | Chrome Canary 105.0.5195.0 | AdapterInfo { name: "ANGLE (Apple, ANGLE Metal Renderer: Apple M1 Max, Version 12.2.1 (Build 21D62))", vendor: 0, device: 0, device_type: IntegratedGpu, backend: Gl } |
Ok | Chrome Canary 105.0.5195.2 | AdapterInfo { name: "ANGLE (Apple, ANGLE Metal Renderer: Apple M1 Max, Version 12.2.1 (Build 21D62))", vendor: 0, device: 0, device_type: IntegratedGpu, backend: Gl } |
Ok | Safari 15.3 (17612.4.9.1.8) | AdapterInfo { name: "Apple GPU", vendor: 0, device: 0, device_type: Other, backend: Gl } |
Ok | Firefox 102.0.1 | AdapterInfo { name: "Apple M1", vendor: 0, device: 0, device_type: IntegratedGpu, backend: Gl } |
Ok | Firefox Nightly 104.0a1 | AdapterInfo { name: "Apple M1", vendor: 0, device: 0, device_type: IntegratedGpu, backend: Gl } |
I also get this issue on my apple m1 when rendering, would be interesting to see what the issue is
Worked on this a bit a while back with cwfitzgerald in the bevy discord. Reposting the information here for visibility.
Patching this file to unconditionally set the MESA_I915_SRGB_SHADER_CLEAR
resolves the issue for me on MacOS.
The issue on Windows that requires the slightly more involved repro in the linked Bevy issue may be a completely separate issue, because the patch above does not seem to help there.