Three.js: Invalid Internal Format gl.DEPTH_STENCIL

Created on 26 Jul 2020  路  14Comments  路  Source: mrdoob/three.js

Safari WebGL2 context only

WebGL: INVALID_ENUM: renderbufferStorage: invalid internalformat

in WebGLTextures.js

_gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.DEPTH_STENCIL, renderTarget.width, renderTarget.height );

Disabling the stencil buffer for shadows removes the symptoms, but I expect that is not the proper fix.

/ping @aardgoose
/ping @gkjohnson

https://threejs.org/examples/webgl_shadowmap.html (EDIT: With #19927, this example is no longer an issue.)

Screen Shot 2020-07-25 at 5 03 18 PM

https://threejs.org/examples/webgl_clipping_stencil.html (EDIT: This is now working with Safari 14.)

Screen Shot 2020-07-25 at 5 38 42 PM

Three.js version
  • [ x ] Dev
  • [ x ] r118
Browser
  • [ x ] Safari - 13.1.2
OS
  • [ x ] macOS
  • [ x ] iOS
Browser Issue

Most helpful comment

I just tested this in Safari 14 and the stencil clip planes example seems to work, now.

All 14 comments

It may be this is NOT a browser issue. Other browsers may be converting the specified internal format to something acceptable.

I can't test with safari at the moment but presumably this happens with any example that uses a render target and doesn't disable the stencil buffer?

I'm less familiar with the difference in browser implementations of webgl but according to the spec DEPTH_STENCIL should be a valid value for WebGL2 which makes it sound like a browser issue unless there's something more to it.

When using a WebGL 2 context, the following values are available __additionally__:
...

Maybe it's worth trying some other depth buffer types new to WebGL2? gl.DEPTH_COMPONENT24, gl.DEPTH_COMPONENT32F, gl.DEPTH24_STENCIL8, or gl.DEPTH32F_STENCIL8.

I've tested https://threejs.org/examples/webgl_shadowmap.html on macOS 10.15.6 with Safari 13.1.2 and it runs as expected. Same for https://threejs.org/examples/webgl_clipping_stencil.html.

Used an iMac from 2014 with AMD GPU.

@WestLangley I guess this is using Safari's WebGL2 experimental setting?

I guess this is using Safari's WebGL2 experimental setting?

Correct.

Safari 13.1.2 and it runs as expected.

With a WebGL2 context?

I don't know if this is a case of WebGL2 in Safari being more strict or being incomplete.
FWIW, Safari 14 has a different WebGL 2 implementation (ANGLE based).

I don't know if this is a case of WebGL2 in Safari being more strict or being incomplete.

well-said. :-)

With a WebGL2 context?

Checked this now and it uses WebGL 1.

@Mugen87 Please enable experimental WebGL2 in the Develop method. This PR is about Safari WebGL2 context only.

Okay, now I can reproduce. I forgot it's necessary to enable a flag^^.

How about revisiting this topic with Safari 14? I mean if the implementation will be a new one, does it makes sense to invest now time in this issue?

I just tested this in Safari 14 and the stencil clip planes example seems to work, now.

@WestLangley Is there any issue left?

I do not think so. Closing.

Was this page helpful?
0 / 5 - 0 ratings