Skip to content

Test Shader compilation wtih WEBMIN flag#1638

Open
CedricGuillemet wants to merge 13 commits into
BabylonJS:masterfrom
CedricGuillemet:TestShaderCompilation
Open

Test Shader compilation wtih WEBMIN flag#1638
CedricGuillemet wants to merge 13 commits into
BabylonJS:masterfrom
CedricGuillemet:TestShaderCompilation

Conversation

@CedricGuillemet
Copy link
Copy Markdown
Collaborator

@CedricGuillemet CedricGuillemet commented Mar 19, 2026

Use a generated shader to check no mandatory glsl function missing in spirv-cross when using WEBMIN flag.

BabylonJS/SPIRV-Cross#10

Fix

UniformTypeChangeTraverser and MoveNonSamplerUniformsIntoStruct were also visiting whole layout(std140) uniform blocks (EbtBlock) and uniform Foo foo; struct instances (EbtStruct) and rewriting them to vec4, producing unnamed placeholder uniforms in the spirv-cross output and a Identifier can't be empty. assert in bgfx. Both traversers are now restricted to scalar/vector basic types (Float/Int/Uint/Bool). CollectNonSamplerUniforms also throws early if a uniform name is empty so future regressions surface in the compiler instead of deep in bgfx.

@CedricGuillemet CedricGuillemet changed the title Test Shader compilation Test Shader compilation wtih WEBMIN flag Mar 19, 2026
CedricGuillemet and others added 3 commits April 17, 2026 14:24
…nto TestShaderCompilation

# Conflicts:
#	Apps/UnitTests/CMakeLists.txt
…raversers.

UniformTypeChangeTraverser and MoveNonSamplerUniformsIntoStruct only
excluded samplers and matrices, so they happily visited the symbols
representing whole `layout(std140) uniform` blocks (EbtBlock) and
`uniform Foo foo;` struct instances (EbtStruct), rewriting them to
vec4. Once that happened, spirv-cross emitted unnamed placeholder
uniforms (e.g. `uniform vec4 _1195;`) and the matrix multiplies
collapsed to scalar nonsense, then bgfx asserted on the empty uniform
name (`Identifier can't be empty.`).

Restrict both traversers to scalar/vector basic types (Float/Int/Uint/
Bool) so blocks and structs are left intact. Also throw early in
CollectNonSamplerUniforms if a uniform name is empty, so any future
regression surfaces in the compiler instead of as a deep bgfx assert.

Add a TODO in CMakeLists.txt to point SPIRV-Cross back to the upstream
BabylonJS fork once the corresponding PR there is merged.
@CedricGuillemet CedricGuillemet marked this pull request as ready for review May 12, 2026 14:39
Copilot AI review requested due to automatic review settings May 12, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant