2021-05-02 15:29:35 +00:00
|
|
|
.PHONY: all clean validate-spv validate-msl validate-glsl validate-dot validate-wgsl validate-hlsl
|
2020-03-20 02:14:40 +00:00
|
|
|
.SECONDARY: boids.metal quad.metal
|
2021-06-18 22:38:47 +00:00
|
|
|
SNAPSHOTS_BASE_IN=tests/in
|
|
|
|
SNAPSHOTS_BASE_OUT=tests/out
|
2020-03-19 13:35:10 +00:00
|
|
|
|
2020-03-20 02:14:40 +00:00
|
|
|
all:
|
2021-03-07 03:59:10 +00:00
|
|
|
cargo fmt
|
2021-06-13 12:38:40 +00:00
|
|
|
cargo test --all-features --workspace
|
|
|
|
cargo clippy --all-features --workspace -- -D warnings
|
2020-03-19 13:35:10 +00:00
|
|
|
|
|
|
|
clean:
|
2021-02-05 17:22:24 +00:00
|
|
|
rm *.metal *.air *.metallib *.vert *.frag *.comp *.spv
|
2020-03-19 13:35:10 +00:00
|
|
|
|
2021-06-18 22:38:47 +00:00
|
|
|
%.metal: $(SNAPSHOTS_BASE_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 $@
|
2020-08-22 14:50:54 +00:00
|
|
|
|
2021-06-18 22:38:47 +00:00
|
|
|
%.dot: $(SNAPSHOTS_BASE_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 -- $< $@
|
2020-12-08 05:20:31 +00:00
|
|
|
|
2021-03-02 06:28:32 +00:00
|
|
|
%.png: %.dot
|
|
|
|
dot -Tpng $< -o $@
|
2021-02-05 17:22:24 +00:00
|
|
|
|
2021-06-18 22:38:47 +00:00
|
|
|
validate-spv: $(SNAPSHOTS_BASE_OUT)/spv/*.spvasm
|
2021-02-11 03:44:48 +00:00
|
|
|
@set -e && for file in $^ ; do \
|
2021-06-18 22:38:47 +00:00
|
|
|
echo "Validating" $${file#"$(SNAPSHOTS_BASE_OUT)/"}; \
|
2021-04-14 18:20:48 +00:00
|
|
|
cat $${file} | spirv-as --target-env vulkan1.0 -o - | spirv-val; \
|
2021-02-05 17:22:24 +00:00
|
|
|
done
|
|
|
|
|
2021-06-18 22:38:47 +00:00
|
|
|
validate-msl: $(SNAPSHOTS_BASE_OUT)/msl/*.msl
|
2021-02-11 03:44:48 +00:00
|
|
|
@set -e && for file in $^ ; do \
|
2021-06-18 22:38:47 +00:00
|
|
|
echo "Validating" $${file#"$(SNAPSHOTS_BASE_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; \
|
2021-02-05 17:22:24 +00:00
|
|
|
done
|
|
|
|
|
2021-06-18 22:38:47 +00:00
|
|
|
validate-glsl: $(SNAPSHOTS_BASE_OUT)/glsl/*.glsl
|
|
|
|
@set -e && for file in $(SNAPSHOTS_BASE_OUT)/glsl/*.Vertex.glsl ; do \
|
|
|
|
echo "Validating" $${file#"$(SNAPSHOTS_BASE_OUT)/"};\
|
2021-04-14 18:20:48 +00:00
|
|
|
cat $${file} | glslangValidator --stdin -S vert; \
|
2021-02-05 17:22:24 +00:00
|
|
|
done
|
2021-06-18 22:38:47 +00:00
|
|
|
@set -e && for file in $(SNAPSHOTS_BASE_OUT)/glsl/*.Fragment.glsl ; do \
|
|
|
|
echo "Validating" $${file#"$(SNAPSHOTS_BASE_OUT)/"};\
|
2021-04-14 18:20:48 +00:00
|
|
|
cat $${file} | glslangValidator --stdin -S frag; \
|
2021-02-05 17:22:24 +00:00
|
|
|
done
|
2021-06-18 22:38:47 +00:00
|
|
|
@set -e && for file in $(SNAPSHOTS_BASE_OUT)/glsl/*.Compute.glsl ; do \
|
|
|
|
echo "Validating" $${file#"$(SNAPSHOTS_BASE_OUT)/"};\
|
2021-04-14 18:20:48 +00:00
|
|
|
cat $${file} | glslangValidator --stdin -S comp; \
|
2021-02-05 17:22:24 +00:00
|
|
|
done
|
2021-03-02 06:28:32 +00:00
|
|
|
|
2021-06-18 22:38:47 +00:00
|
|
|
validate-dot: $(SNAPSHOTS_BASE_OUT)/dot/*.dot
|
2021-03-02 06:28:32 +00:00
|
|
|
@set -e && for file in $^ ; do \
|
2021-06-18 22:38:47 +00:00
|
|
|
echo "Validating" $${file#"$(SNAPSHOTS_BASE_OUT)/"}; \
|
2021-04-14 18:20:48 +00:00
|
|
|
cat $${file} | dot -o /dev/null; \
|
2021-03-02 06:28:32 +00:00
|
|
|
done
|
2021-04-19 13:19:03 +00:00
|
|
|
|
2021-06-18 22:38:47 +00:00
|
|
|
validate-wgsl: $(SNAPSHOTS_BASE_OUT)/wgsl/*.wgsl
|
2021-04-19 13:19:03 +00:00
|
|
|
@set -e && for file in $^ ; do \
|
2021-06-18 22:38:47 +00:00
|
|
|
echo "Validating" $${file#"$(SNAPSHOTS_BASE_OUT)/"}; \
|
2021-06-14 16:27:16 +00:00
|
|
|
cargo run $${file}; \
|
2021-04-19 13:19:03 +00:00
|
|
|
done
|
2021-05-02 15:29:35 +00:00
|
|
|
|
2021-06-18 22:38:47 +00:00
|
|
|
validate-hlsl: $(SNAPSHOTS_BASE_OUT)/hlsl/*.hlsl
|
2021-06-14 21:29:20 +00:00
|
|
|
@set -e && for file in $^ ; do \
|
2021-06-18 22:38:47 +00:00
|
|
|
echo "Validating" $${file#"$(SNAPSHOTS_BASE_OUT)/"}; \
|
2021-06-14 21:29:20 +00:00
|
|
|
config="$$(dirname $${file})/$$(basename $${file}).config"; \
|
|
|
|
vertex=""\
|
|
|
|
fragment="" \
|
|
|
|
compute="" \
|
|
|
|
. $${config}; \
|
2021-06-16 07:04:03 +00:00
|
|
|
DXC_PARAMS="-Wno-parentheses-equality -Zi -Qembed_debug;" \
|
|
|
|
[ ! -z "$${vertex}" ] && echo "Vertex Stage:" && dxc $${file} -T $${vertex} -E $${vertex_name} $${DXC_PARAMS} > /dev/null; \
|
|
|
|
[ ! -z "$${fragment}" ] && echo "Fragment Stage:" && dxc $${file} -T $${fragment} -E $${fragment_name} $${DXC_PARAMS} > /dev/null; \
|
|
|
|
[ ! -z "$${compute}" ] && echo "Compute Stage:" && dxc $${file} -T $${compute} -E $${compute_name} $${DXC_PARAMS} > /dev/null; \
|
2021-06-14 21:29:20 +00:00
|
|
|
echo "======================"; \
|
2021-05-02 15:29:35 +00:00
|
|
|
done
|