- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I originally posted the issue here - https://community.intel.com/t5/Graphics/WebGL-context-is-lost-when-clearing-stencil-buffer/m-p/1275921
Our webgl games crashes "randomly" on machines with intel graphics. My theory is that there is a leak in the driver when clearing the stencil with a non 0xff bitmask.
Here is what I found so far:
Description:
The WebGL context is lost and not recovered again, when performing certain stencil buffer clears.
Hardware:
The issue has been reported on a number of devices including desktops, NUCs and laptops. With the common factor being Intel graphics.
Software:
Intel Drivers:
27.20.100.8280 - This version works
27.20.100.8336 - This and all versions after fail
Browser:
- Firefox - works
- Chrome, Edge(chromium) - fails
Note 1: the issue only happens when using the default D3D11 rendering and not when using D3D9 (set using the flags)
Note 2: the chrome behavior is the same with both the latest version and a 2 year old version (i.e. 2 year old version works with 8280 and fails with 8336)
How to repro:
1. Clear the stencil at least once per frame, with a non zero, non 0xff mask.
2. Let it run for 1-5 minutes
3. See that the context is lost and not recovered again
Source Code:
https://codepen.io/fredrikolsson/pen/zYNRaLB
<!doctype html>
<html>
<body>
<canvas id="glcanvas" width="1024" height="1024"/>
</body>
<script>
const canvas = document.querySelector('#glcanvas');
const gl = canvas.getContext('webgl', {'stencil': true});
gl.enable(gl.STENCIL_TEST);
let frame = 0;
(function loop() {
gl.clearColor((++frame * 0.01) % 1.0, 0.0, 0.0, 1.0);
gl.clear(gl.COLOR_BUFFER_BIT);
for (let i=0; i<8; i++) {
gl.stencilMask(1 << i);
gl.clear(gl.STENCIL_BUFFER_BIT);
}
requestAnimationFrame(loop);
})();
</script>
</html>
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi focego
I met the same issue that running Chrome on D3D11, Intel UHD Graphics.
My game could crash because of web gl context ,even just place it idle.
After removing stencil masks, the problem gone.
Observations
Firefox, Intel UHD Graphics: good
Chrome, D3D11, Intel UHD Graphics 630: issue
Chrome, D3D11, Intel HD Graphics 530 | Iris(TM) Pro Graphics 6200, GeForce GT430: good
Chrome, D3D9, Intel UHD Graphics 630: good
Seems now up to Chrome version 93 the issue is still not yet fixed. Did you resolve the issue or did you find any workaround ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I ended up making a software implementation of the stencil buffer using an extra rgb buffer.
The games run a bit slower, but we swap implementation based on WEBGL_debug_renderer_info so it only affects customers with Intel GPUs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page