-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile
201 lines (164 loc) · 7.45 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
CTS_DIR=../VK-GL-CTS
CHERRY_DIR=../cherry
BINDING=target/vulkan.rs
LIB_FILE_NAME=
LIB_VULKAN_NAME=
NATIVE_DIR=target/native
NATIVE_TARGET=$(NATIVE_DIR)/test
NATIVE_OBJECTS=$(NATIVE_DIR)/test.o $(NATIVE_DIR)/window.o
TEST_LIST=$(CURDIR)/conformance/deqp.txt
TEST_LIST_SOURCE=$(CTS_DIR)/external/vulkancts/mustpass/1.0.2/vk-default.txt
DEQP_DIR=$(CTS_DIR)/build/external/vulkancts/modules/vulkan/
DEQP=cd $(DEQP_DIR) && RUST_LOG=debug LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH) ./deqp-vk
CLINK_ARGS=
GIT_TAG_FULL=$(shell git describe --tags)
OS_NAME=
ZIP_COMMAND=
DOTA_DIR=../dota2/bin/osx64
DOTA_EXE=$(DOTA_DIR)/dota2.app/Contents/MacOS/dota2
#possible command lines are : -vulkan_disable_occlusion_queries -vulkan_scene_system_job_cost 2 +vulkan_batch_submits 1 +vulkan_batch_size 500
DOTA_PARAMS:=-vulkan -vulkan_disable_occlusion_queries -vulkan_descriptor_sets_per_pool 256
DOTA_DEMO_PHORONIX= "$(CURDIR)/../dota2/demos/dota2-pts-1971360796.dem"
DOTA_BENCHMARK=+timedemoquit +timedemo $(DOTA_DEMO_PHORONIX) +timedemo_start 40000 +timedemo_end 50000 +fps_max 0 -novconsole -high -autoconfig_level 3
DOTA_BENCH_RESULTS=../dota2/dota/Source2Bench.csv
RUST_BACKTRACE:=1
BACKEND:=gl
DEBUGGER=rust-gdb --args
GFX_METAL_RECORDING:=immediate
CC=g++
CFLAGS=-std=c++11 -ggdb -O0 -Iheaders
DEPS=
LDFLAGS=
ifeq ($(CARGO_BUILD_TARGET),)
JSON_SUFFIX=$(OS_NAME)-*
else
JSON_SUFFIX=$(CARGO_BUILD_TARGET)
endif
ifeq ($(OS),Windows_NT)
LDFLAGS=
BACKEND=dx12
LIB_FILE_NAME=portability.dll
LIB_VULKAN_NAME=vulkan.dll
OS_NAME=windows
ZIP_COMMAND=7z a -tzip
else
UNAME_S:=$(shell uname -s)
ZIP_COMMAND=zip
ifeq ($(UNAME_S),Linux)
LDFLAGS=-lpthread -ldl -lm -lX11 -lxcb
BACKEND=vulkan
LIB_FILE_NAME=libportability.so
LIB_VULKAN_NAME=libvulkan.so
OS_NAME=linux
endif
ifeq ($(UNAME_S),Darwin)
LDFLAGS=-lpthread -ldl -lm
BACKEND=metal
DEBUGGER=rust-lldb --
LIB_FILE_NAME=libportability.dylib
LIB_VULKAN_NAME=libvulkan.dylib
#TODO: find a more idiomatic way to pass this arguments!
CLINK_ARGS=-- -Clink-arg="-current_version 1.0.0" -Clink-arg="-compatibility_version 1.0.0"
OS_NAME=macos
endif
endif
FULL_LIBRARY_PATH=$(CURDIR)/target/debug
LIBRARY=target/debug/$(LIB_FILE_NAME)
LIBRARY_FAST=target/release/$(LIB_FILE_NAME)
.PHONY: all dummy check-target rebuild debug release version-debug version-release binding run-native cts clean cherry dota-debug dota-release dota-orig dota-bench-gfx dota-bench-orig dota-bench-gl memcpy-report
all: $(NATIVE_TARGET)
dummy:
rebuild:
cargo build --manifest-path libportability/Cargo.toml --features $(BACKEND)
debug:
cargo build --manifest-path libportability/Cargo.toml --features $(BACKEND),debug
release: $(LIBRARY_FAST)
version-debug:
cargo rustc --manifest-path libportability/Cargo.toml --features $(BACKEND),portability-gfx/env_logger $(CLINK_ARGS)
version-release:
cargo rustc --release --manifest-path libportability/Cargo.toml --features $(BACKEND) $(CLINK_ARGS)
check-target:
cargo check --manifest-path libportability/Cargo.toml --target $(TARGET) --features $(BACKEND)
cargo check --manifest-path libportability-icd/Cargo.toml --target $(TARGET) --features $(BACKEND),portability-gfx/env_logger
dota-debug: version-debug $(DOTA_EXE)
DYLD_LIBRARY_PATH=$(CURDIR)/target/debug:$(CURDIR)/$(DOTA_DIR) $(DOTA_EXE) $(DOTA_PARAMS)
dota-debugger: version-debug $(DOTA_EXE)
echo "env DYLD_LIBRARY_PATH=$(CURDIR)/target/debug:$(CURDIR)/$(DOTA_DIR)" >.lldbinit
DYLD_LIBRARY_PATH=$(CURDIR)/target/debug:$(CURDIR)/$(DOTA_DIR) $(DEBUGGER) $(DOTA_EXE) $(DOTA_PARAMS)
dota-release: version-release $(DOTA_EXE)
DYLD_LIBRARY_PATH=$(CURDIR)/target/release:$(CURDIR)/$(DOTA_DIR) $(DOTA_EXE) $(DOTA_PARAMS)
dota-molten: $(DOTA_EXE)
DYLD_LIBRARY_PATH=$(CURDIR)/../MoltenVK/Package/Release/MoltenVK/macOS:$(CURDIR)/$(DOTA_DIR) $(DOTA_EXE) $(DOTA_PARAMS)
dota-orig: $(DOTA_EXE)
DYLD_LIBRARY_PATH=$(CURDIR)/$(DOTA_DIR) $(DOTA_EXE) $(DOTA_PARAMS)
dota-orig-gl: $(DOTA_EXE)
DYLD_LIBRARY_PATH=$(CURDIR)/$(DOTA_DIR) $(DOTA_EXE) -gl
dota-bench-gfx: version-release $(DOTA_EXE)
DYLD_LIBRARY_PATH=$(CURDIR)/target/release:$(CURDIR)/$(DOTA_DIR) $(DOTA_EXE) $(DOTA_BENCHMARK) $(DOTA_PARAMS)
dota-bench-orig: $(DOTA_EXE)
DYLD_LIBRARY_PATH=$(CURDIR)/$(DOTA_DIR) $(DOTA_EXE) $(DOTA_BENCHMARK) $(DOTA_PARAMS)
dota-bench-gl: $(DOTA_EXE)
DYLD_LIBRARY_PATH=$(CURDIR)/target/release:$(CURDIR)/$(DOTA_DIR) $(DOTA_EXE) $(DOTA_BENCHMARK) -gl
ifeq ($(UNAME_S),Darwin)
target/debug/libMoltenVK.dylib: version-debug
cd target/debug && ln -sf libportability.dylib libMoltenVK.dylib
target/release/libMoltenVK.dylib: version-release
cd target/release && ln -sf libportability.dylib libMoltenVK.dylib
molten-links: target/debug/libMoltenVK.dylib target/release/libMoltenVK.dylib
endif
binding: $(BINDING)
$(BINDING): headers/vulkan/*.h
bindgen --no-layout-tests --rustfmt-bindings headers/vulkan/vulkan.h -o $(BINDING)
$(LIBRARY): dummy
cargo build --manifest-path libportability/Cargo.toml --features $(BACKEND),debug
cargo build --manifest-path libportability-icd/Cargo.toml --features $(BACKEND),debug
$(LIBRARY_FAST): dummy
cargo build --release --manifest-path libportability/Cargo.toml --features $(BACKEND)
cargo build --release --manifest-path libportability-icd/Cargo.toml --features $(BACKEND)
$(NATIVE_DIR)/%.o: native/%.cpp $(DEPS) Makefile
-mkdir $(NATIVE_DIR)
$(CC) -c -o $@ $< $(CFLAGS)
$(NATIVE_TARGET): $(LIBRARY) $(NATIVE_OBJECTS) Makefile
$(CC) -o $(NATIVE_TARGET) $(NATIVE_OBJECTS) $(LIBRARY) $(LDFLAGS)
run-native: $(NATIVE_TARGET)
$(NATIVE_TARGET)
$(TEST_LIST): $(TEST_LIST_SOURCE)
cat $(TEST_LIST_SOURCE) | grep -v -e ".event" -e "query" >$(TEST_LIST)
ifdef pick
cts:
cargo build --manifest-path libportability/Cargo.toml --features $(BACKEND),portability-gfx/env_logger
($(DEQP) -n $(pick))
else
ifdef debug
cts: $(LIBRARY)
echo "env LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH)" >.lldbinit
#(cd $(DEQP_DIR) && LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH) $(DEBUGGER) ./deqp-vk -n $(debug))
LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH) $(DEBUGGER) $(DEQP_DIR)/deqp-vk -n $(debug)
else
cts: $(LIBRARY) $(TEST_LIST)
($(DEQP) --deqp-caselist-file=$(TEST_LIST))
python $(CTS_DIR)/scripts/log/log_to_xml.py TestResults.qpa conformance/last.xml
mv TestResults.qpa conformance/last.qpa
firefox conformance/last.xml
endif #debug
endif #pick
clean:
rm -f $(NATIVE_OBJECTS) $(NATIVE_TARGET) $(BINDING)
cargo clean
gfx-portability.zip: version-debug version-release
cargo build --manifest-path libportability-icd/Cargo.toml --features $(BACKEND)
cargo build --manifest-path libportability-icd/Cargo.toml --features $(BACKEND) --release
echo "$(GIT_TAG_FULL)" > commit-sha
$(ZIP_COMMAND) gfx-portability.zip target/$(CARGO_BUILD_TARGET)/*/$(LIB_FILE_NAME) libportability-icd/portability-$(JSON_SUFFIX).json commit-sha
gfx-portability-custom.zip:
cargo build -Z build-std --manifest-path libportability/Cargo.toml --features $(BACKEND)
cargo build -Z build-std=std,panic_abort --manifest-path libportability/Cargo.toml --features $(BACKEND) --release
echo "$(GIT_TAG_FULL)" > commit-sha
$(ZIP_COMMAND) gfx-portability-custom.zip target/$(CARGO_BUILD_TARGET)/*/$(LIB_FILE_NAME) commit-sha
target/debug/$(LIB_VULKAN_NAME):
cd target/debug && ln -sf $(LIB_FILE_NAME) $(LIB_VULKAN_NAME)
cherry: $(LIBRARY) $(LIB_VULKAN_NAME)
cd $(CHERRY_DIR) && rm -f Cherry.db && RUST_LOG=warn LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH) go run server.go
memcpy-report:
RUSTFLAGS='-g --emit=llvm-ir' cd libportability && cargo build --release --features $(BACKEND)
../memcpy-find/memcpy-find target/release/deps/portability.ll | rustfilt >etc/portability-memcpy.txt