shader_dir="src/graphics/backend_wgpu/shader/*"
for file in $shader_dir; do
if [[ "$file" =~ \.(frag|vert)$ ]]; then
test_file="$file.test"
existing_file="$file.spv"
res=$(glslangValidator -V110 $file -o $test_file)
if [[ $? != 0 ]]; then
echo "Error: Failed to compile $file"
echo $res
exit 1
fi
cmp=$(cmp $existing_file $test_file)
if [[ "$cmp" != "" ]]; then
echo "Error: The compiled SPIR-V differs from the compiled SPIR-V from the repository."
echo "Error: Compiled SPIR-V in $test_file differs from $existing_file"
exit 1
else
echo "Compiled SPIR-V in $test_file matches $existing_file"
fi
fi
done