# Uniform Buffer Validation # Extracted from main CMakeLists.txt # Sub-task 7: Integrate validation tool into CI/build system # Ensure the Python validation script is available add_custom_target(validate_uniforms_script ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tools/validate_uniforms.py) # Find all WGSL files recursively in src/gpu file(GLOB WGSL_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src/gpu/*.wgsl ${CMAKE_CURRENT_SOURCE_DIR}/src/gpu/**/*.wgsl) # List of C++ files containing uniform struct definitions and shader code # Add more C++ files here if new effects with structs are added. set(VALIDATION_CPP_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/gpu/effects/heptagon_effect.cc ${CMAKE_CURRENT_SOURCE_DIR}/src/gpu/effects/post_process_helper.h ${CMAKE_CURRENT_SOURCE_DIR}/src/gpu/effects/fade_effect.cc ${CMAKE_CURRENT_SOURCE_DIR}/src/gpu/effects/theme_modulation_effect.cc ${CMAKE_CURRENT_SOURCE_DIR}/src/gpu/effects/chroma_aberration_effect.cc ${CMAKE_CURRENT_SOURCE_DIR}/src/gpu/effects/vignette_effect.cc ${CMAKE_CURRENT_SOURCE_DIR}/src/gpu/effects/gaussian_blur_effect.cc ${CMAKE_CURRENT_SOURCE_DIR}/src/gpu/effects/distort_effect.cc ${CMAKE_CURRENT_SOURCE_DIR}/src/gpu/demo_effects.h ${CMAKE_CURRENT_SOURCE_DIR}/src/gpu/effects/circle_mask_effect.h ) # Add custom command to run the validator # It depends on the script itself, WGSL files, and the C++ files being validated. # Outputting a flag file to signal completion. set(VALIDATION_FLAG ${CMAKE_CURRENT_BINARY_DIR}/uniform_validation_complete.flag) add_custom_command( OUTPUT ${VALIDATION_FLAG} COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/tools/validate_uniforms.py ${VALIDATION_FLAG} COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/tools/validate_uniforms.py ${CMAKE_CURRENT_SOURCE_DIR}/assets/final/shaders ${VALIDATION_CPP_FILES} DEPENDS validate_uniforms_script ${WGSL_FILES} ${VALIDATION_CPP_FILES} COMMENT "Validating uniform buffer sizes and alignments..." ) # Add custom target that depends on the validation output flag add_custom_target(validate_uniforms ALL DEPENDS ${VALIDATION_FLAG})