#!/bin/bash # Compiles the BCn decoder variants into app/src/main/cpp/vkbridge/bc_spv.h (committed, so a build # needs no shader compiler). Needs glslangValidator; regenerates bc_tables.glsl first. set -eu cd "$(dirname "$0")" python3 gen_bc_tables.py out=../../../app/src/main/cpp/vkbridge/bc_spv.h tmp=$(mktemp -d) { echo "/* Generated by tools/vkbridge/shaders/build.sh from bc_decode.comp - do not edit. */" echo "#pragma once" echo "#include " } > "$out" for f in BC1 BC2 BC3 BC4 BC5 BC6H BC7; do name=spv_$(echo $f | tr A-Z a-z) glslangValidator -V --target-env vulkan1.1 -DFMT_$f --vn "$name" -o "$tmp/$name.h" bc_decode.comp >/dev/null grep -v '^ *//\|#pragma once' "$tmp/$name.h" | sed 's/^const uint32_t/static const uint32_t/' >> "$out" done rm -rf "$tmp" echo "wrote $out"