render: Don't try to rebuild D3D11, D3D12, Metal shaders without spirv-cross

Signed-off-by: Simon McVittie <smcv@debian.org>
This commit is contained in:
Simon McVittie
2024-09-17 11:43:32 +01:00
committed by Sam Lantinga
parent 13500bbf50
commit 4b3058d58d

View File

@@ -6,12 +6,15 @@ set -e
which fxc &>/dev/null && HAVE_FXC=1 || HAVE_FXC=0 which fxc &>/dev/null && HAVE_FXC=1 || HAVE_FXC=0
which dxc &>/dev/null && HAVE_DXC=1 || HAVE_DXC=0 which dxc &>/dev/null && HAVE_DXC=1 || HAVE_DXC=0
which spirv-cross &>/dev/null && HAVE_SPIRV_CROSS=1 || HAVE_SPIRV_CROSS=0
[ "$HAVE_FXC" != 0 ] || echo "fxc not in PATH; D3D11 shaders will not be rebuilt" [ "$HAVE_FXC" != 0 ] || echo "fxc not in PATH; D3D11 shaders will not be rebuilt"
[ "$HAVE_DXC" != 0 ] || echo "dxc not in PATH; D3D12 shaders will not be rebuilt" [ "$HAVE_DXC" != 0 ] || echo "dxc not in PATH; D3D12 shaders will not be rebuilt"
[ "$HAVE_SPIRV_CROSS" != 0 ] || echo "spirv-cross not in PATH; D3D11, D3D12, Metal shaders will not be rebuilt"
USE_FXC=${USE_FXC:-$HAVE_FXC} USE_FXC=${USE_FXC:-$HAVE_FXC}
USE_DXC=${USE_DXC:-$HAVE_DXC} USE_DXC=${USE_DXC:-$HAVE_DXC}
USE_SPIRV_CROSS=${USE_SPIRV_CROSS:-$HAVE_SPIRV_CROSS}
spirv_bundle="spir-v.h" spirv_bundle="spir-v.h"
dxbc50_bundle="dxbc50.h" dxbc50_bundle="dxbc50.h"
@@ -19,9 +22,9 @@ dxil60_bundle="dxil60.h"
metal_bundle="metal.h" metal_bundle="metal.h"
rm -f "$spirv_bundle" rm -f "$spirv_bundle"
rm -f "$metal_bundle" [ "$USE_SPIRV_CROSS" != 0 ] && rm -f "$metal_bundle"
[ "$USE_FXC" != 0 ] && rm -f "$dxbc50_bundle" [ "$USE_SPIRV_CROSS" != 0 ] && [ "$USE_FXC" != 0 ] && rm -f "$dxbc50_bundle"
[ "$USE_DXC" != 0 ] && rm -f "$dxil60_bundle" [ "$USE_SPIRV_CROSS" != 0 ] && [ "$USE_DXC" != 0 ] && rm -f "$dxil60_bundle"
make-header() { make-header() {
xxd -i "$1" | sed -e 's/^unsigned /const unsigned /g' > "$1.h" xxd -i "$1" | sed -e 's/^unsigned /const unsigned /g' > "$1.h"
@@ -60,6 +63,10 @@ for i in *.vert *.frag; do
make-header "$spv" make-header "$spv"
echo "#include \"$spv.h\"" >> "$spirv_bundle" echo "#include \"$spv.h\"" >> "$spirv_bundle"
if [ "$USE_SPIRV_CROSS" = "0" ]; then
continue
fi
spirv-cross "$spv" --hlsl --shader-model 50 --hlsl-enable-compat --output "$hlsl50" spirv-cross "$spv" --hlsl --shader-model 50 --hlsl-enable-compat --output "$hlsl50"
spirv-cross "$spv" --hlsl --shader-model 60 --hlsl-enable-compat --output "$hlsl60" spirv-cross "$spv" --hlsl --shader-model 60 --hlsl-enable-compat --output "$hlsl60"