Search code examples
google-chromewebglstencil-buffer

Will asking stencil buffer of the drawing buffer add performance cost (WebGL)?


var gl = canvas.getContext('webgl', { stencil: true });

According to WebGL Spec, this line of code will ask the drawing buffer to have a stencil buffer of at least 8 bits.

But will that add any performance cost? Is it suitable to always asking one in an rendering engine?

(Google-Chrome? / Firefox?)


Solution

  • Unlikely.

    Take a look here. >99% of devices have 24 bit of depth and 8 bit of stencil. The stencil test should also be faster than the depth test. Correct usage of stencil testing can lead into performance gains.