Crash on some devices with transparent materials and present render target

Here’s a minimal example on which my phone (Samsung Galaxy A36) crashes with Chrome. Thing is, this (quite common) device and browser doesn’t support extension OES_draw_buffers_indexed according to what I see on webglreport.com .

Since this commit

in packages/dev/core/src/States/alphaCullingState.ts there were changes to use WebGL2RenderingContext.enableIndexed and WebGL2RenderingContext.disableIndexed for when number of targets is larger than 1 (which happens when this._currentRenderTarget.textures in ThinEngine is present and larger than 1, which happens with SSR pipeline enabled).

This automatically presumes that device supports corresponding extension, and crashes as a result.

@Evgeni_Popov Is it possible to fix it? Could something like changing condition from just numTargets === 1 to actually look if gl2.enableIndexed and gl2.disableIndexed actually present fix this problem to at least fall back to old behaviour if such thing happens?

To back up my claims:

This PR should address it: Rendering Engine: Fix blending when blending parameters per target are not supported by Popov72 · Pull Request #17053 · BabylonJS/Babylon.js · GitHub

Huh, indeed. What a timing :sweat_smile: Looked at the topic but somehow missed that the same issue was addressed in comments, probably because I looked at the topic yesterday at evening and wrote report today.

Nevertheless, thanks!