forked from gfx-rs/naga
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (42 loc) · 1.81 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
.PHONY: all clean validate-spv validate-msl
.SECONDARY: boids.metal quad.metal
SNAPSHOTS_IN=tests/in
SNAPSHOTS_OUT=tests/out
all:
clean:
rm *.metal *.air *.metallib *.vert *.frag *.comp *.spv
%.metal: $(SNAPSHOTS_IN)/%.wgsl $(wildcard src/*.rs src/**/*.rs examples/*.rs)
cargo run --example convert --features wgsl-in,msl-out -- $< $@
%.air: %.metal
xcrun -sdk macosx metal -c $< -mmacosx-version-min=10.11
%.metallib: %.air
xcrun -sdk macosx metallib $< -o $@
%.spv: test-data/%.wgsl $(wildcard src/*.rs src/**/*.rs examples/*.rs)
cargo run --example convert --features wgsl-in,spv-out -- $< $@
spirv-val $@
%.vert %.frag %.comp: test-data/%.wgsl $(wildcard src/*.rs src/**/*.rs examples/*.rs)
cargo run --example convert --features wgsl-in,glsl-out -- $< $@
glslangValidator $@
validate-spv: $(SNAPSHOTS_OUT)/*.spvasm.snap
@for file in $^ ; do \
echo "Validating" $${file#"$(SNAPSHOTS_OUT)/snapshots__"}; \
tail -n +5 $${file} | spirv-as --target-env vulkan1.0 -o - | spirv-val; \
done
validate-msl: $(SNAPSHOTS_OUT)/*.msl.snap
@for file in $^ ; do \
echo "Validating" $${file#"$(SNAPSHOTS_OUT)/snapshots__"}; \
tail -n +5 $${file} | xcrun -sdk macosx metal -mmacosx-version-min=10.11 -x metal - -o /dev/null; \
done
validate-glsl: $(SNAPSHOTS_OUT)/*.glsl.snap
@for file in $(SNAPSHOTS_OUT)/*-Vertex.glsl.snap ; do \
echo "Validating" $${file#"$(SNAPSHOTS_OUT)/snapshots__"};\
tail -n +5 $${file} | glslangValidator --stdin -S vert; \
done
@for file in $(SNAPSHOTS_OUT)/*-Fragment.glsl.snap ; do \
echo "Validating" $${file#"$(SNAPSHOTS_OUT)/snapshots__"};\
tail -n +5 $${file} | glslangValidator --stdin -S frag; \
done
@for file in $(SNAPSHOTS_OUT)/*-Compute.glsl.snap ; do \
echo "Validating" $${file#"$(SNAPSHOTS_OUT)/snapshots__"};\
tail -n +5 $${file} | glslangValidator --stdin -S comp; \
done