From 9b205ffa49ed26a039285c9af923fc84870a7c88 Mon Sep 17 00:00:00 2001 From: skal Date: Sat, 7 Feb 2026 09:55:27 +0100 Subject: test(gpu): Add post-process helper utilities testing (Phase 2.2) Created test_post_process_helper.cc to validate pipeline and bind group utilities: - Tests create_post_process_pipeline() function - Validates shader module creation - Verifies bind group layout (3 bindings: sampler, texture, uniform) - Confirms render pipeline creation with standard topology - Tests pp_update_bind_group() function - Creates bind groups with correct sampler/texture/uniform bindings - Validates bind group update/replacement (releases old, creates new) - Full integration test - Combines pipeline + bind group setup - Executes complete render pass with post-process effect - Validates no WebGPU validation errors during rendering Test infrastructure additions: - Helper functions for creating post-process textures with TEXTURE_BINDING usage - Helper for creating texture views - Minimal valid post-process shader for smoke testing - Uses gpu_init_color_attachment() for proper depthSlice handling (macOS) Key technical details: - Post-process textures require RENDER_ATTACHMENT + TEXTURE_BINDING + COPY_SRC usage - Bind group layout: binding 0 (sampler), binding 1 (texture), binding 2 (uniform buffer) - Render passes need depthSlice = WGPU_DEPTH_SLICE_UNDEFINED on non-Windows platforms Added CMake target with dependencies: - Links against gpu, 3d, audio, procedural, util libraries - Minimal dependencies (no timeline/music generation needed) Coverage: Validates core post-processing infrastructure used by all post-process effects Zero binary size impact: All test code under #if !defined(STRIP_ALL) Part of GPU Effects Test Infrastructure (Phase 2/3) Phase 2 Complete: Effect classes + helper utilities tested Next: Phase 3 (optional) - Individual effect render validation --- CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index ee6673b..8419a6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -511,6 +511,16 @@ if(DEMO_BUILD_TESTS) ${GENERATED_MUSIC_DATA_CC}) target_link_libraries(test_demo_effects PRIVATE 3d gpu audio procedural util ${DEMO_LIBS}) add_dependencies(test_demo_effects generate_timeline generate_demo_assets generate_tracker_music) + + # GPU Effects Test Infrastructure (Phase 2.2: Post-Process Utilities) + add_demo_executable(test_post_process_helper + src/tests/test_post_process_helper.cc + src/tests/webgpu_test_fixture.cc + src/tests/offscreen_render_target.cc + ${PLATFORM_SOURCES} + ${GEN_DEMO_CC}) + target_link_libraries(test_post_process_helper PRIVATE 3d gpu audio procedural util ${DEMO_LIBS}) + add_dependencies(test_post_process_helper generate_demo_assets) endif() #-- - Extra Tools -- - -- cgit v1.2.3