Skip to content

Commit a400a90

Browse files
Test Shader compilation with WEBMIN flag (#1638)
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.
1 parent 5c4081e commit a400a90

12 files changed

Lines changed: 25117 additions & 22858 deletions

Apps/UnitTests/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,19 @@ set(BABYLONJS_MATERIALS_ASSETS
1212

1313
set(TEST_ASSETS
1414
"JavaScript/dist/tests.javaScript.all.js"
15-
"JavaScript/dist/tests.shaderCache.basicScene.js")
15+
"JavaScript/dist/tests.shaderCache.basicScene.js"
16+
"JavaScript/dist/tests.shaders.cross.js")
17+
18+
file(GLOB TEST_SCRIPTS "JavaScript/src/*.ts")
19+
set_source_files_properties(${TEST_SCRIPTS} PROPERTIES HEADER_FILE_ONLY TRUE)
1620

1721
set(SOURCES
1822
"Source/App.h"
1923
"Source/App.cpp"
2024
"Source/Tests.ExternalTexture.cpp"
2125
"Source/Tests.JavaScript.cpp"
2226
"Source/Tests.ShaderCache.cpp"
27+
"Source/Tests.ShaderCompilation.cpp"
2328
"Source/Tests.UniformPadding.cpp"
2429
"Source/Utils.h"
2530
"Source/Utils.${GRAPHICS_API}.${BABYLON_NATIVE_PLATFORM_IMPL_EXT}")
@@ -46,7 +51,7 @@ elseif(WIN32)
4651
set(SOURCES ${SOURCES} "Source/App.Win32.cpp")
4752
endif()
4853

49-
add_executable(UnitTests ${BABYLONJS_ASSETS} ${BABYLONJS_MATERIALS_ASSETS} ${TEST_ASSETS} ${SOURCES})
54+
add_executable(UnitTests ${BABYLONJS_ASSETS} ${BABYLONJS_MATERIALS_ASSETS} ${TEST_ASSETS} ${TEST_SCRIPTS} ${SOURCES})
5055
target_link_libraries(UnitTests
5156
PRIVATE AppRuntime
5257
PRIVATE Blob
@@ -94,3 +99,4 @@ source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCES})
9499
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/../node_modules/babylonjs PREFIX Assets FILES ${BABYLONJS_ASSETS})
95100
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/../node_modules/babylonjs-materials PREFIX Assets FILES ${BABYLONJS_MATERIALS_ASSETS})
96101
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/JavaScript/dist PREFIX Assets FILES ${TEST_ASSETS})
102+
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/JavaScript/src PREFIX TypeScript FILES ${TEST_SCRIPTS})

0 commit comments

Comments
 (0)