Selecting a mesh with `transparencyMode` set to `ALPHATEST` using the `SelectionOutlineLayer` causes a crash

The following error is logged:

repro: Babylon.js Playground

Thank you for maintaining this great framework!

Thanks for the report! This is an engine bug in SelectionOutlineLayer.

The layer was compiling its selection shader with alpha-test sampling enabled whenever the material reported that alpha testing was needed. For PBRMaterial.PBRMATERIAL_ALPHATEST, that can be true even when there is no alpha-test texture to bind, so the shader expected diffuseSampler but the render path had nothing to bind. That mismatch can crash in both WebGL2 and WebGPU.

The fix makes the layer only enable the alpha-test selection shader path when an actual alpha-test texture exists. A PR is open here: Add selection outline depth occlusion toggle by Popov72 · Pull Request #18498 · BabylonJS/Babylon.js · GitHub

Thank you for the explanation and the quick fix!