From 060fc2c76a1ad6f2fbf0e2aef6cbd88fad9ebbda Mon Sep 17 00:00:00 2001 From: SlowRiot Date: Thu, 9 Jan 2025 01:18:15 +0000 Subject: [PATCH] only validate shaders if they're being recompiled --- build.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/build.sh b/build.sh index 8cf24b7..c801c18 100755 --- a/build.sh +++ b/build.sh @@ -33,12 +33,6 @@ if [ ! -d "$build_dir" ]; then mkdir "$build_dir" fi -# validate shaders -if ! [ -z "$(which naga)" ]; then - echo "Validating shaders with naga-cli" - naga --bulk-validate render/shaders/*.wgsl || exit 1 -fi - # compile resources compiled_resources_total=0 compiled_resources_up_to_date=0 @@ -49,7 +43,16 @@ for file in "${compiled_resources[@]}"; do ((++compiled_resources_up_to_date)) fi done -echo "Compiled resources: $((compiled_resources_total - compiled_resources_up_to_date)) updated, $compiled_resources_up_to_date up to date ($compiled_resources_total total)" +compiled_resources_updated=$((compiled_resources_total - compiled_resources_up_to_date)) +echo "Compiled resources: $compiled_resources_updated updated, $compiled_resources_up_to_date up to date ($compiled_resources_total total)" + +if [ "$compiled_resources_updated" != 0 ]; then + # validate shaders + if ! [ -z "$(which naga)" ]; then + echo "Validating shaders with naga-cli" + naga --bulk-validate render/shaders/*.wgsl || exit 1 + fi +fi cd "$build_dir"