wgpu/Makefile

66 lines
2.0 KiB
Makefile
Raw Normal View History

.PHONY: all clean validate-spv validate-msl validate-glsl validate-dot validate-wgsl
.SECONDARY: boids.metal quad.metal
2021-02-07 23:11:35 +00:00
SNAPSHOTS_IN=tests/in
SNAPSHOTS_OUT=tests/out
2020-03-19 13:35:10 +00:00
all:
cargo fmt
cargo test --all-features
cargo clippy --all-features
2020-03-19 13:35:10 +00:00
clean:
rm *.metal *.air *.metallib *.vert *.frag *.comp *.spv
2020-03-19 13:35:10 +00:00
2021-02-07 23:11:35 +00:00
%.metal: $(SNAPSHOTS_IN)/%.wgsl $(wildcard src/*.rs src/**/*.rs examples/*.rs)
2021-03-02 06:28:32 +00:00
cargo run --features wgsl-in,msl-out -- $< $@
2020-03-19 13:35:10 +00:00
%.air: %.metal
xcrun -sdk macosx metal -c $< -mmacosx-version-min=10.11
%.metallib: %.air
xcrun -sdk macosx metallib $< -o $@
2021-04-23 16:32:28 +00:00
%.dot: $(SNAPSHOTS_IN)/%.wgsl $(wildcard src/*.rs src/front/wgsl/*.rs src/back/dot/*.rs bin/naga.rs)
2021-03-02 06:28:32 +00:00
cargo run --features wgsl-in,dot-out -- $< $@
2021-03-02 06:28:32 +00:00
%.png: %.dot
dot -Tpng $< -o $@
2021-04-14 18:20:48 +00:00
validate-spv: $(SNAPSHOTS_OUT)/*.spvasm
2021-02-11 03:44:48 +00:00
@set -e && for file in $^ ; do \
2021-04-15 16:06:21 +00:00
echo "Validating" $${file#"$(SNAPSHOTS_OUT)/"}; \
2021-04-14 18:20:48 +00:00
cat $${file} | spirv-as --target-env vulkan1.0 -o - | spirv-val; \
done
2021-04-14 18:20:48 +00:00
validate-msl: $(SNAPSHOTS_OUT)/*.msl
2021-02-11 03:44:48 +00:00
@set -e && for file in $^ ; do \
2021-04-15 16:06:21 +00:00
echo "Validating" $${file#"$(SNAPSHOTS_OUT)/"}; \
2021-04-14 18:20:48 +00:00
cat $${file} | xcrun -sdk macosx metal -mmacosx-version-min=10.11 -x metal - -o /dev/null; \
done
2021-04-14 18:20:48 +00:00
validate-glsl: $(SNAPSHOTS_OUT)/*.glsl
@set -e && for file in $(SNAPSHOTS_OUT)/*.Vertex.glsl ; do \
2021-04-15 16:06:21 +00:00
echo "Validating" $${file#"$(SNAPSHOTS_OUT)/"};\
2021-04-14 18:20:48 +00:00
cat $${file} | glslangValidator --stdin -S vert; \
done
2021-04-14 18:20:48 +00:00
@set -e && for file in $(SNAPSHOTS_OUT)/*.Fragment.glsl ; do \
2021-04-15 16:06:21 +00:00
echo "Validating" $${file#"$(SNAPSHOTS_OUT)/"};\
2021-04-14 18:20:48 +00:00
cat $${file} | glslangValidator --stdin -S frag; \
done
2021-04-14 18:20:48 +00:00
@set -e && for file in $(SNAPSHOTS_OUT)/*.Compute.glsl ; do \
2021-04-15 16:06:21 +00:00
echo "Validating" $${file#"$(SNAPSHOTS_OUT)/"};\
2021-04-14 18:20:48 +00:00
cat $${file} | glslangValidator --stdin -S comp; \
done
2021-03-02 06:28:32 +00:00
2021-04-14 18:20:48 +00:00
validate-dot: $(SNAPSHOTS_OUT)/*.dot
2021-03-02 06:28:32 +00:00
@set -e && for file in $^ ; do \
2021-04-15 16:06:21 +00:00
echo "Validating" $${file#"$(SNAPSHOTS_OUT)/"}; \
2021-04-14 18:20:48 +00:00
cat $${file} | dot -o /dev/null; \
2021-03-02 06:28:32 +00:00
done
validate-wgsl: $(SNAPSHOTS_OUT)/*.wgsl
@set -e && for file in $^ ; do \
echo "Validating" $${file#"$(SNAPSHOTS_OUT)/"}; \
2021-04-23 16:32:28 +00:00
cargo run --features wgsl-in $${file}; \
done