coffee 0.4.0

An opinionated 2D game engine focused on simplicity, explicitness, and type-safety
Documentation
#!/bin/bash
# Script to ensure compiled SPIR-V matches its source on CI.

shader_dir="src/graphics/backend_wgpu/shader/*"

for file in $shader_dir; do
    # Look for files with ".frag" or ".vert" extensions
    if [[ "$file" =~ \.(frag|vert)$ ]]; then

        test_file="$file.test"
        existing_file="$file.spv"

        # Compile the file
        res=$(glslangValidator -V110 $file -o $test_file)

        if [[ $? != 0 ]]; then
            echo "Error: Failed to compile $file"
            echo $res
            exit 1
        fi

        # Compare the newly compiled file with the compiled file from the repo.
        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