Community
cancel
Showing results for 
Search instead for 
Did you mean: 
focego
Beginner
54 Views

WebGL context is lost when clearing stencil buffer

I originally posted the issue here - https://community.intel.com/t5/Graphics/WebGL-context-is-lost-when-clearing-stencil-buffer/m-p/12759...

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>

 

 

0 Kudos
0 Replies
Reply