Skip to content

Commit

Permalink
only validate shaders if they're being recompiled
Browse files Browse the repository at this point in the history
  • Loading branch information
slowriot committed Jan 9, 2025
1 parent e815c4d commit 060fc2c
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

Expand Down

0 comments on commit 060fc2c

Please sign in to comment.