Compare commits
948 Commits
asset-uuid
...
tmp-gpu-co
Author | SHA1 | Date | |
---|---|---|---|
41406fcacf | |||
510d009f53 | |||
1c4203ae72 | |||
ba6ddf9e9e | |||
848cbe889b | |||
9132fd8825 | |||
f45f8a7a89 | |||
![]() |
820ca419e0 | ||
d3944940f9 | |||
![]() |
4089b07aa0 | ||
8dc2fbd7b6 | |||
27d50d6f67 | |||
168653ed1d | |||
ff1d599172 | |||
b1bfcf9f6b | |||
2d38ff67d3 | |||
d7a28b3d1a | |||
da741013a1 | |||
55401fbb3d | |||
008ccacdfc | |||
2e33c5ca15 | |||
49c1359b55 | |||
27b643d27a | |||
9cac158e96 | |||
19175f4757 | |||
3eff2b44db | |||
4251a87bf6 | |||
742ad5acbc | |||
2bc017ece1 | |||
5893a1562f | |||
24d035b383 | |||
1f48e67002 | |||
422e5e372e | |||
0ab66dd63f | |||
69ec7ab873 | |||
ff0112bcb2 | |||
dc3baf2c78 | |||
929c94ee20 | |||
2181028292 | |||
699cefefd0 | |||
486c7b87fb | |||
5f6fb5bb41 | |||
7e8d493730 | |||
c09f61a915 | |||
5f46a0fbce | |||
81ce8481b2 | |||
8c10e56331 | |||
ebda95953c | |||
3274ce0a8e | |||
f62c7c546a | |||
![]() |
4e6975ffd6 | ||
03acbc7b71 | |||
54a2fcc0f3 | |||
6e5278c3da | |||
83f01db7a9 | |||
66df8fff32 | |||
b9c7c904ed | |||
f0687d4665 | |||
1804a6d040 | |||
2d89cd7dd5 | |||
99d0b3b793 | |||
7becd283cc | |||
ade7603379 | |||
e2e87efea2 | |||
e749643793 | |||
e4ee9de638 | |||
18d2db22ff | |||
45d61bdc03 | |||
56d0a554a8 | |||
f84342d7e1 | |||
959529d4b8 | |||
18caaff149 | |||
84f7de432c | |||
9c807325dd | |||
91150c9ef5 | |||
659db0592d | |||
4cad74e589 | |||
3e82500509 | |||
7a07683060 | |||
a3c6304a27 | |||
1e76441dd6 | |||
dcad6c9db8 | |||
ac6fbf6ba8 | |||
012ed9ca9f | |||
![]() |
0f075c25c4 | ||
![]() |
55c6cc46b5 | ||
7dfc2f5137 | |||
a0bc3596f0 | |||
cd3be9c46d | |||
c3f6227f30 | |||
e5e97d0fe0 | |||
d8919d12f7 | |||
814ca40c63 | |||
fcf91bbf0d | |||
9c1da81a4c | |||
cf243e0980 | |||
5d88f8eba2 | |||
556252f1fe | |||
80539723b9 | |||
67c33caeec | |||
b274d18aec | |||
cbeb2e55ed | |||
dcf7a05077 | |||
8fbed7f7f5 | |||
9ff7820f62 | |||
bc0b75ea37 | |||
5e232d7a0b | |||
6a689b5047 | |||
47b82fc02f | |||
26bc8f4935 | |||
b99358315e | |||
76d489fe23 | |||
9d412a92f5 | |||
2a52c2d001 | |||
82c38a7df0 | |||
75e16c22d7 | |||
f0c4566ce3 | |||
ec80f1d376 | |||
19de9d1a9e | |||
050de1fb8e | |||
3b9e16a4f7 | |||
c8e45c3fe9 | |||
d738e47b0d | |||
34125ce507 | |||
e296c9e24e | |||
8a60e920f4 | |||
290b372aac | |||
da32c17631 | |||
617e67529c | |||
e7dd89b50b | |||
1675969152 | |||
a2a29327d9 | |||
289aac723a | |||
ed19781a2a | |||
6ad75949b9 | |||
ace832bf7c | |||
221604cdd6 | |||
0006526952 | |||
7eebebebc7 | |||
4f3233dd53 | |||
a0b0a47d81 | |||
e8869d9c71 | |||
2584a2a4e7 | |||
e893430a63 | |||
729da8bfac | |||
e54289cdf3 | |||
1ae8855f8e | |||
7fd68db841 | |||
960ce1e394 | |||
2e376cfcc8 | |||
a5b2aa96e4 | |||
9a53d4a882 | |||
bd4b29d63d | |||
c7ee66e517 | |||
6f5d01779a | |||
38e65331a8 | |||
a83bb170b0 | |||
d64e171c4b | |||
4c5e1f1c25 | |||
79312962de | |||
81a0027f13 | |||
f8a0a5a350 | |||
71506698de | |||
565d7f75cc | |||
7beef1fd33 | |||
d7cb67454d | |||
9ce2c5bf50 | |||
b18c376946 | |||
0b04f0e4e6 | |||
bfeb94eccc | |||
418753b6a6 | |||
382b9007f8 | |||
f31fa3eb97 | |||
ea4a00e93b | |||
93e6ed9b45 | |||
d906116eba | |||
041904ceb8 | |||
40a9524637 | |||
87fb12d16e | |||
6d42ffe03c | |||
9b867f2e90 | |||
3bcec7c142 | |||
d62250a3e0 | |||
9e7ee39385 | |||
344be1fcfa | |||
ba9c88ce18 | |||
2c2082cc62 | |||
e76f64a532 | |||
c9cc5ad1c0 | |||
65e1d43f0b | |||
04195b1e74 | |||
2ebf263f5c | |||
9386dd66ff | |||
94afe7671c | |||
54237994d8 | |||
487eaeed7e | |||
025dc31d28 | |||
18cca0e704 | |||
9e23dbd060 | |||
15655aa1dd | |||
cc7d5e1fe6 | |||
c276ef61d4 | |||
b296b68ff2 | |||
9905db5557 | |||
7c3eaffbbd | |||
97b597cd04 | |||
8b7802db85 | |||
56803e2754 | |||
7b4a21077a | |||
d3cecc5007 | |||
13afc81f6d | |||
a77175c9b6 | |||
076d033e10 | |||
f0e370a650 | |||
7ceb6ffe57 | |||
f2907b06f4 | |||
5414ccbd4c | |||
28b1c70895 | |||
850234c1b1 | |||
9482cc6865 | |||
fd7e31b3e5 | |||
6cecdf2ade | |||
13abacaaf3 | |||
14326619a1 | |||
1e999c7bdb | |||
04d46bdb83 | |||
89f4191a53 | |||
0ae2a1d12a | |||
d52e45c89e | |||
a8d058dbf4 | |||
790d3804d0 | |||
4ca8f25fa8 | |||
82db64ed80 | |||
537c57136f | |||
eeaa4379aa | |||
ddd4fec386 | |||
2308668bac | |||
273f50a333 | |||
d7c4e96493 | |||
9a117fcdae | |||
704d581aea | |||
c64b12c0b8 | |||
50ff450202 | |||
74fcb4d4c2 | |||
f495b583be | |||
ec17b45034 | |||
236ca8fbe8 | |||
b53c46d760 | |||
141deeefff | |||
22b8ac80d2 | |||
3886392430 | |||
13fa4b9898 | |||
1a5945e2c3 | |||
2bd2db120e | |||
2a186af2b3 | |||
0e9999a93e | |||
ba99b12287 | |||
698af2e774 | |||
0b50ea51cc | |||
f359672c35 | |||
c049fe7979 | |||
9cbf43801b | |||
5ccb0f46dd | |||
954aa441bf | |||
149bb0c26d | |||
87c0a38a39 | |||
766edbdf1f | |||
67857b5d9f | |||
cf123da640 | |||
4619562e2f | |||
ad586e7eeb | |||
50cb693f1d | |||
ad6cfcef01 | |||
706b690ec6 | |||
6f3c37a3ff | |||
c9975d19b5 | |||
8d35dceb14 | |||
c8b24af1b2 | |||
ee98dc8d0f | |||
37ad90c35f | |||
4ae24c0b57 | |||
be1969d2a4 | |||
b64ae920e4 | |||
65aba4fc7a | |||
634585aa68 | |||
6596891121 | |||
bfeff73252 | |||
60b80ce142 | |||
79440c37ac | |||
fa21ba0179 | |||
d998258fa6 | |||
ef17e7e51b | |||
85157e74b3 | |||
ad602a3f03 | |||
c8653e516d | |||
8a5da947dc | |||
944df0c784 | |||
62e53788aa | |||
67002402bd | |||
8438ef4d8e | |||
19afb0ea67 | |||
797820fc20 | |||
ce4c2b8f0b | |||
4b31f4ace7 | |||
e5cd770e9f | |||
06e84fef88 | |||
a51048a5d3 | |||
4d6ac72264 | |||
e77644982c | |||
e0400d0a1c | |||
0a5ef40c2c | |||
750899fd31 | |||
921c95ab5e | |||
72fc70879c | |||
6f3ba033f8 | |||
0e280b96ca | |||
![]() |
5a1a4f4dd2 | ||
![]() |
62a0e1d54f | ||
![]() |
a4e3943a08 | ||
1fb9b6b1a1 | |||
![]() |
0c0a9dabc7 | ||
4950022e7d | |||
980dd43bd4 | |||
47b6c33258 | |||
![]() |
8f658ec27c | ||
ef52a9f791 | |||
077a2f7bbb | |||
![]() |
5c28955d3a | ||
a197b81090 | |||
b5194520e3 | |||
83cb4f5f8f | |||
7fc9666c89 | |||
59e48d8fe4 | |||
cfa788cf9a | |||
607d745a79 | |||
878d191bae | |||
46b126a2c8 | |||
69afdf6970 | |||
4aa2a5481c | |||
a39da2cbca | |||
7aabd74222 | |||
b453e9e3a4 | |||
f8cc01595d | |||
8369adabc0 | |||
6c7e62ef9b | |||
17ebbdf1c1 | |||
c2b0c64843 | |||
696c23f284 | |||
cd6250c220 | |||
d42530824e | |||
6b6e2e742f | |||
727e569ac3 | |||
3fe5c0e5df | |||
5904953d22 | |||
269c184ac9 | |||
6b6970d43f | |||
bafe22e8ce | |||
6778ef4dcc | |||
1c0fa3aff6 | |||
494a6a0bf2 | |||
629726177a | |||
0bfec04cd5 | |||
ece6d8b25a | |||
b277a75a3b | |||
8c916a3aec | |||
fdc3f56234 | |||
c46663ad66 | |||
b31d3d1202 | |||
2bc1fd7e91 | |||
b88dd3b8e7 | |||
50fe187443 | |||
731d9f0bfa | |||
ed870f87b9 | |||
d40c39fca0 | |||
![]() |
52543be9a6 | ||
a9644c812f | |||
a5ded0720c | |||
bb63ce9839 | |||
62a819202e | |||
![]() |
7d85495ab9 | ||
4432209849 | |||
7484e45297 | |||
ccc2a7996b | |||
ed184050b6 | |||
4f4af0cbe1 | |||
9016a29f19 | |||
230f7d79ce | |||
cbf2278266 | |||
ac5f011e9c | |||
33ad95b677 | |||
579b180053 | |||
8cbbdedaf4 | |||
![]() |
686ab4c940 | ||
6fbfa522e6 | |||
e4daac84b6 | |||
eb5cd628bd | |||
b219ae4498 | |||
615af4e239 | |||
9db4e44961 | |||
![]() |
78e40ad21f | ||
6247ec7827 | |||
3884d78e49 | |||
5063820c9b | |||
8c90910dcc | |||
ccd2af43b3 | |||
52a7c724b5 | |||
71d0f6f896 | |||
b8601b64c7 | |||
c08d847488 | |||
fe49e4139c | |||
9eaa48f520 | |||
fd67b521b9 | |||
63db971a00 | |||
1dd381828f | |||
c48ccb38cb | |||
4e73ba2cab | |||
f24ccedc18 | |||
016253a648 | |||
fd08d6f391 | |||
d99b343b31 | |||
d9228c557b | |||
4c28b1c74e | |||
59975b0adf | |||
8dfc31f61f | |||
264b1e1e15 | |||
5993c53a6d | |||
c14e6cdd56 | |||
1f2edba1fb | |||
d19b3019d9 | |||
a6bd7777c2 | |||
35f1b3e43b | |||
faeaf53255 | |||
e2305690eb | |||
2d9eee15c5 | |||
0ef57d3fc0 | |||
122d0c8f4b | |||
dcf6e12a60 | |||
7e66616b7e | |||
6d160f199c | |||
99b424334d | |||
5b4a862f83 | |||
2840782d84 | |||
02c09773ea | |||
acad0d75b1 | |||
3d536f69f6 | |||
aa8279648e | |||
25582aef61 | |||
69d14c0ddb | |||
8b0df381d9 | |||
d8a6eec1a3 | |||
893eb30730 | |||
0cdc75ccd2 | |||
e3f8768d8a | |||
2679236047 | |||
3ef59121a4 | |||
![]() |
9582797d4b | ||
bf2bb6db26 | |||
0e3d34e48f | |||
0fcd23a388 | |||
c5f61fbf48 | |||
5910dbdbf7 | |||
0a40c671b0 | |||
83e204702d | |||
618f31312c | |||
89a7a1c156 | |||
608d9b5aa1 | |||
b13bbb22e4 | |||
02a3720000 | |||
93f21ebb13 | |||
e7c1a32a78 | |||
a138bf57c9 | |||
![]() |
09a483a3aa | ||
671c6d8afd | |||
07d70a76df | |||
5099cbeec9 | |||
436d38bb54 | |||
3481f6eaf2 | |||
71ac137662 | |||
8084b7e6e2 | |||
ab19abe223 | |||
bc85081156 | |||
56b8adb9e2 | |||
1494ad20b9 | |||
76bf050853 | |||
aa547ce88b | |||
f64710a518 | |||
4249d6f58e | |||
ada173ebfd | |||
72df7c23c4 | |||
c7aa0f9d74 | |||
279cc34343 | |||
83955d6769 | |||
99fda4d31e | |||
9b6088cb9d | |||
9363c4de06 | |||
66b48ad8fb | |||
f3ea6a5b28 | |||
3d8f8085fb | |||
b882f89fe3 | |||
2ddb3dc617 | |||
56aa5b0d8c | |||
065a00ee3e | |||
d4ce777aed | |||
d897228682 | |||
f6f93b5b12 | |||
7e0bf7a0f1 | |||
35bfe1702c | |||
![]() |
4a9d903e2b | ||
![]() |
9715ad5aca | ||
ad4928a171 | |||
75520894c7 | |||
2811de6e5c | |||
5b099a25d7 | |||
123e29c274 | |||
54abab53bf | |||
a3d90337b8 | |||
d11a2dfe71 | |||
75a09ba2ed | |||
974e36d7d0 | |||
058514aa0a | |||
d4d810f817 | |||
37a8c6d809 | |||
47885abbe6 | |||
cd8f3c9ee7 | |||
2c1edcf3ef | |||
24c846b2b4 | |||
987d14a3b2 | |||
8e16873086 | |||
5dcf60e053 | |||
f1104c2828 | |||
eb54624a9a | |||
5057b28a2f | |||
ba100c883c | |||
a082e49671 | |||
cda6da4957 | |||
ae4098e234 | |||
36e836d0e9 | |||
19d17b217a | |||
57ec1f37e9 | |||
e06a346458 | |||
10cacbbb15 | |||
613d314251 | |||
b3c34011c0 | |||
efc6f6e1ae | |||
5a11c8ba24 | |||
87f8949f0e | |||
44bb73e765 | |||
ff2fa59689 | |||
4e8fc14120 | |||
7e2ffbfb25 | |||
50c6448781 | |||
e8b26a0501 | |||
680a81fc49 | |||
eb87b1c8f6 | |||
![]() |
920b138f83 | ||
e062def3b4 | |||
061d76f55c | |||
d493fc43bd | |||
7f67e3200a | |||
7e0289b618 | |||
98b1a716d6 | |||
dbcc74f801 | |||
0b100e21fb | |||
6cc88e330b | |||
2ba1cf4b40 | |||
797027be6b | |||
14eaa9ed63 | |||
8e9dd5492a | |||
c8a62e4f50 | |||
6068f49c33 | |||
2e8a78f4d1 | |||
78148e20fa | |||
fa7ace2215 | |||
e3fd60b182 | |||
140b26909e | |||
1e5ce39156 | |||
01ec76842f | |||
4096330b81 | |||
25fc84bf2e | |||
26793d619c | |||
0fb08b7cc4 | |||
93e14e5935 | |||
5338b36fcc | |||
b818f6b55f | |||
0b24930541 | |||
37fb586a0b | |||
70992ae270 | |||
6e74a8b69f | |||
2b5e21fe00 | |||
1076952209 | |||
eb3f74a0fe | |||
8dd2386a68 | |||
fcc91faf3f | |||
91e67c7bda | |||
3d587efef2 | |||
5c8dd2a703 | |||
3dcc7c73e2 | |||
![]() |
29da019cb3 | ||
16989c4d1d | |||
952279a366 | |||
5ecefc6a07 | |||
2be7a11e43 | |||
b9f565881e | |||
9db0c36af1 | |||
03c8b048a1 | |||
9c9eb03d78 | |||
f019164f1f | |||
8074a18964 | |||
7b558a20a9 | |||
976a0ff691 | |||
f8afbb7657 | |||
0158571b34 | |||
7453ff73ad | |||
725973485a | |||
a19584a471 | |||
644a915b1b | |||
0718c6fae0 | |||
91c763af3e | |||
6dabfacb38 | |||
6a3c91f7ad | |||
7aacf2e119 | |||
192bd2605f | |||
41e6f9bd43 | |||
e2736afdbe | |||
77cd8182f8 | |||
474dcbcf12 | |||
f319eec881 | |||
30ed51d60a | |||
21b20ae5ec | |||
ebf9082e1c | |||
838b1742fb | |||
404486e66c | |||
ee5c2f6ead | |||
c7eada103c | |||
06401157a6 | |||
46b79b3d4a | |||
b920875893 | |||
8fae58ce0b | |||
16d4373158 | |||
415d3ee05b | |||
6e698653df | |||
651db1b26f | |||
020e0f11ff | |||
d2b910fafe | |||
3dc0178390 | |||
6fbacd6048 | |||
48f10319c6 | |||
4e8fc15586 | |||
3e4f49fe71 | |||
d5208c45fa | |||
6eeb32706a | |||
93791381fe | |||
e65c78cd43 | |||
![]() |
ad45b8d6a4 | ||
d8e648c352 | |||
9dbe9a753a | |||
5372924983 | |||
77f823a240 | |||
47e71f4623 | |||
cbfedf2139 | |||
c2304d2f02 | |||
4d1c3c029e | |||
f93e0f1a9e | |||
337e2c9029 | |||
6c1157201a | |||
45287f909c | |||
26d28ade26 | |||
c806db6313 | |||
60133ff98d | |||
295b3aefb0 | |||
7bae599232 | |||
3121015dce | |||
00eb6a56aa | |||
8fd65a2252 | |||
3edd2832b2 | |||
f62204718b | |||
8f6c0f2242 | |||
52636c3059 | |||
39b525e0f0 | |||
77a646279d | |||
9c25731781 | |||
582a0b7e5a | |||
7a9028cad1 | |||
a148c4676b | |||
03f5acd445 | |||
8b660ea0ec | |||
96068324cd | |||
89cb41faa0 | |||
3fdd092649 | |||
b0378440ce | |||
8f24ec2e26 | |||
3dd460aa7f | |||
a0d3b60015 | |||
0b77e2f4c4 | |||
92bc277950 | |||
3623db7784 | |||
03a00bda2b | |||
1e3247c078 | |||
a90b69d065 | |||
6778949e01 | |||
7b1c406b54 | |||
78b629a98f | |||
1fb667da01 | |||
e5ebaa9fd6 | |||
bd84b2cbcc | |||
13b1374497 | |||
78d48343ae | |||
2be0ae7c99 | |||
![]() |
9de09220fc | ||
42c99ec15b | |||
580d50091c | |||
31ad43a3c7 | |||
544c435fdd | |||
8ddf7556a5 | |||
ea5fe7abc1 | |||
0b8221683f | |||
0b3bf69d3c | |||
754c5d6a14 | |||
31bc76ea4e | |||
403384998a | |||
4b85ed819d | |||
f7d5d4ee3b | |||
e4926c167b | |||
f4a39cafa1 | |||
439c238bb4 | |||
05365d1376 | |||
2de5de57c5 | |||
cb3c4218bf | |||
d1f4546a59 | |||
e3e42c00cb | |||
2b9d62b73a | |||
34d175f372 | |||
840941215d | |||
36a547af7b | |||
ff133bbd33 | |||
a8ff8b64dc | |||
ff444da7c4 | |||
6435acd8f6 | |||
643196cc37 | |||
45004d82e0 | |||
50d7c00d9c | |||
01c8aa12a1 | |||
7fcb6bc59c | |||
afcb41a0aa | |||
eb5fb1741d | |||
8713109212 | |||
902ee4d13c | |||
22158162ef | |||
f4633cf46c | |||
67042aa6a1 | |||
adfae89f96 | |||
a8627ea66d | |||
4990e4dd01 | |||
ff97545c50 | |||
1e2ff4f81b | |||
0edf2fc128 | |||
dad3de89dc | |||
d352902758 | |||
1e3c0b4b03 | |||
202e7ccaae | |||
d1dcd2b464 | |||
20558848d3 | |||
630c6226e2 | |||
737bd549b6 | |||
95f0f31279 | |||
a394aac8b4 | |||
98bee41c8a | |||
70b1c09d7a | |||
f2175e06a7 | |||
02cd159539 | |||
cc311e4a52 | |||
5761cb9ee2 | |||
![]() |
80fe5e1b15 | ||
6d9a6f12b3 | |||
955abbeff2 | |||
e233ee1c1f | |||
19d4e265b6 | |||
6e609f0eb0 | |||
62774baded | |||
d212b3dc43 | |||
b28683b8b5 | |||
0c58970da7 | |||
ad0edc626d | |||
e20171e59f | |||
d557f05502 | |||
053e0c0af3 | |||
12817083ec | |||
a856de700b | |||
f6f4043924 | |||
1562c9f031 | |||
aabfd2fb9b | |||
ee3eba902a | |||
bfc644dcfb | |||
0b07f9b717 | |||
99feb10b8b | |||
20446f07f6 | |||
ffaf294c3f | |||
924578ce19 | |||
073c426900 | |||
c632cf9ccd | |||
2c0cab03ca | |||
dbe171fb26 | |||
18b6c49a90 | |||
572c48cf98 | |||
703a73fa84 | |||
80393a0eba | |||
9353477383 | |||
b51b893df8 | |||
705015e0a4 | |||
4f3045999d | |||
0f617cd67e | |||
baf124c753 | |||
247a28f242 | |||
5d79f9f276 | |||
464aaf2701 | |||
169bb4b9ce | |||
8e97694c8a | |||
9168ea8aab | |||
17603816f2 | |||
b0da78084b | |||
cad98923d0 | |||
ea65c6a153 | |||
4bf56b37ca | |||
59ef43147e | |||
57a48bd0ca | |||
d7dbf90a02 | |||
185fe9cd8b | |||
46fcc12e83 | |||
d2db481dc7 | |||
a21cb22f8b | |||
33a74941c5 | |||
367034f210 | |||
651d1aa7c8 | |||
35ce16939c | |||
a201020cd3 | |||
f254f66587 | |||
3aa53b361d | |||
bf532b1106 | |||
2f6fc5a7e8 | |||
b61ecb785c | |||
f43fedd400 | |||
4a48939f04 | |||
cad2d32be6 | |||
4a5389816b | |||
fac2e63bc0 | |||
1bdabd7b4f | |||
1019c9f582 | |||
883f9dd6e5 | |||
9739fc4d1b | |||
14fd91e7e8 | |||
f4fdb8efc5 | |||
f66aafa391 | |||
f891d4e2ad | |||
53d41e1a6f | |||
2a39b34a09 | |||
fd5b093f84 | |||
4283da83cc | |||
de7c9f41e6 | |||
19483125f8 | |||
7d0a0b8a6d | |||
f82e52ebc8 | |||
17ba566018 | |||
3a59c184b9 | |||
a33756d783 | |||
6a58e15548 | |||
88d358902f | |||
405e6c6cc9 | |||
19ff145e66 | |||
ffef562bf7 | |||
c9975088a9 | |||
1e255ce031 | |||
2633683b52 | |||
93da09d717 | |||
9dce2c9d14 | |||
20869065b8 | |||
f3b8792b96 | |||
86e7648f0e | |||
7704e6a678 | |||
395b294b61 | |||
5fbf70b0d0 | |||
d64803f63b | |||
e797c4f28f | |||
dfbb13b593 | |||
6fea8ec183 | |||
aab41401f9 | |||
ae5529c848 | |||
8e0f8bb3e1 | |||
5fa6bd8a8d | |||
6cb796e98e | |||
5dda6cefb6 | |||
a06d95987e | |||
972d1700cd | |||
4ccd96f1a4 | |||
83eeaddce8 | |||
bbeb1b2b52 | |||
468adfa4fd | |||
cdea648117 | |||
2193c37768 | |||
b1d3850333 | |||
868d6ba1a7 | |||
746aec51a7 | |||
0e1ee29f77 | |||
0f4049db5f | |||
edb49d3dc2 | |||
dfdd23bae6 | |||
9ea5469178 | |||
a272a2a6cd | |||
0fdb79fe58 | |||
a68fd2561e | |||
0961ce04cb | |||
5a13f682ee | |||
![]() |
a07922159d | ||
![]() |
1278657cc2 | ||
![]() |
3ea302cf8e | ||
![]() |
f3e4a3473e | ||
ef0ec01461 | |||
33f36b453a | |||
c5ec8d91bd | |||
85980743b0 | |||
95f3397a68 | |||
7099459245 | |||
![]() |
17b89f6dac | ||
35481fde40 | |||
a4fe8ef236 | |||
06de1bddae | |||
fb0f0f4d79 | |||
f58f09c9a9 | |||
![]() |
46ae115b88 | ||
![]() |
ba2c039b05 | ||
945d0269e3 | |||
22197d7f8a | |||
26ffed7466 | |||
afd976a3b4 | |||
8bee200e2f | |||
52b125a790 | |||
b6f35531b6 | |||
e16972389e | |||
792cb8bdc7 | |||
755c5c6e4c | |||
4723644e7f | |||
6358c7754c | |||
bf5a656ff6 | |||
11a1ddfd30 | |||
f228a8948b | |||
927448a1da | |||
e9d1d1f725 | |||
2788b0261c | |||
f4f00661a5 |
45
.clang-tidy
Normal file
45
.clang-tidy
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
Checks: >
|
||||||
|
-*,
|
||||||
|
readability-*,
|
||||||
|
-readability-uppercase-literal-suffix,
|
||||||
|
-readability-magic-numbers,
|
||||||
|
-readability-isolate-declaration,
|
||||||
|
-readability-convert-member-functions-to-static,
|
||||||
|
-readability-implicit-bool-conversion,
|
||||||
|
-readability-avoid-const-params-in-decls,
|
||||||
|
-readability-simplify-boolean-expr,
|
||||||
|
-readability-make-member-function-const,
|
||||||
|
|
||||||
|
-readability-misleading-indentation,
|
||||||
|
|
||||||
|
-readability-else-after-return,
|
||||||
|
-readability-inconsistent-declaration-parameter-name,
|
||||||
|
-readability-redundant-preprocessor,
|
||||||
|
-readability-function-size,
|
||||||
|
-readability-function-size,
|
||||||
|
-readability-redundant-string-init,
|
||||||
|
-readability-redundant-member-init,
|
||||||
|
-readability-const-return-type,
|
||||||
|
-readability-static-accessed-through-instance,
|
||||||
|
-readability-redundant-declaration,
|
||||||
|
-readability-qualified-auto,
|
||||||
|
-readability-use-anyofallof,
|
||||||
|
|
||||||
|
bugprone-*,
|
||||||
|
-bugprone-narrowing-conversions,
|
||||||
|
-bugprone-unhandled-self-assignment,
|
||||||
|
-bugprone-branch-clone,
|
||||||
|
-bugprone-macro-parentheses,
|
||||||
|
-bugprone-reserved-identifier,
|
||||||
|
|
||||||
|
-bugprone-sizeof-expression,
|
||||||
|
-bugprone-integer-division,
|
||||||
|
-bugprone-incorrect-roundings,
|
||||||
|
-bugprone-suspicious-string-compare,
|
||||||
|
-bugprone-not-null-terminated-result,
|
||||||
|
-bugprone-suspicious-missing-comma,
|
||||||
|
-bugprone-parent-virtual-call,
|
||||||
|
-bugprone-infinite-loop,
|
||||||
|
-bugprone-copy-constructor-init,
|
||||||
|
|
||||||
|
WarningsAsErrors: '*'
|
@@ -41,7 +41,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
# Prever LEGACY OpenGL to eb compatible with all the existing releases and
|
# Prever LEGACY OpenGL to eb compatible with all the existing releases and
|
||||||
# platforms which don't hare GLVND yet. Only do it if preference was not set
|
# platforms which don't hare GLVND yet. Only do it if preference was not set
|
||||||
@@ -367,7 +367,7 @@ option(WITH_CYCLES_CUDA_BINARIES "Build Cycles CUDA binaries" OFF)
|
|||||||
option(WITH_CYCLES_CUBIN_COMPILER "Build cubins with nvrtc based compiler instead of nvcc" OFF)
|
option(WITH_CYCLES_CUBIN_COMPILER "Build cubins with nvrtc based compiler instead of nvcc" OFF)
|
||||||
option(WITH_CYCLES_CUDA_BUILD_SERIAL "Build cubins one after another (useful on machines with limited RAM)" OFF)
|
option(WITH_CYCLES_CUDA_BUILD_SERIAL "Build cubins one after another (useful on machines with limited RAM)" OFF)
|
||||||
mark_as_advanced(WITH_CYCLES_CUDA_BUILD_SERIAL)
|
mark_as_advanced(WITH_CYCLES_CUDA_BUILD_SERIAL)
|
||||||
set(CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 sm_70 sm_75 CACHE STRING "CUDA architectures to build binaries for")
|
set(CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 sm_70 sm_75 compute_75 CACHE STRING "CUDA architectures to build binaries for")
|
||||||
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
|
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
|
||||||
unset(PLATFORM_DEFAULT)
|
unset(PLATFORM_DEFAULT)
|
||||||
option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON)
|
option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON)
|
||||||
@@ -415,6 +415,11 @@ mark_as_advanced(WITH_CXX_GUARDEDALLOC)
|
|||||||
option(WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" ON)
|
option(WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" ON)
|
||||||
mark_as_advanced(WITH_ASSERT_ABORT)
|
mark_as_advanced(WITH_ASSERT_ABORT)
|
||||||
|
|
||||||
|
if(UNIX AND NOT APPLE)
|
||||||
|
option(WITH_CLANG_TIDY "Use Clang Tidy to analyze the source code (only enable for development on Linux using Clang)" OFF)
|
||||||
|
mark_as_advanced(WITH_CLANG_TIDY)
|
||||||
|
endif()
|
||||||
|
|
||||||
option(WITH_BOOST "Enable features depending on boost" ON)
|
option(WITH_BOOST "Enable features depending on boost" ON)
|
||||||
option(WITH_TBB "Enable features depending on TBB (OpenVDB, OpenImageDenoise, sculpt multithreading)" ON)
|
option(WITH_TBB "Enable features depending on TBB (OpenVDB, OpenImageDenoise, sculpt multithreading)" ON)
|
||||||
|
|
||||||
@@ -895,7 +900,7 @@ if(MSVC)
|
|||||||
# endianess-detection and auto-setting is counterproductive
|
# endianess-detection and auto-setting is counterproductive
|
||||||
# so we just set endianness according CMAKE_OSX_ARCHITECTURES
|
# so we just set endianness according CMAKE_OSX_ARCHITECTURES
|
||||||
|
|
||||||
elseif(CMAKE_OSX_ARCHITECTURES MATCHES i386 OR CMAKE_OSX_ARCHITECTURES MATCHES x86_64)
|
elseif(CMAKE_OSX_ARCHITECTURES MATCHES i386 OR CMAKE_OSX_ARCHITECTURES MATCHES x86_64 OR CMAKE_OSX_ARCHITECTURES MATCHES arm64)
|
||||||
add_definitions(-D__LITTLE_ENDIAN__)
|
add_definitions(-D__LITTLE_ENDIAN__)
|
||||||
elseif(CMAKE_OSX_ARCHITECTURES MATCHES ppc OR CMAKE_OSX_ARCHITECTURES MATCHES ppc64)
|
elseif(CMAKE_OSX_ARCHITECTURES MATCHES ppc OR CMAKE_OSX_ARCHITECTURES MATCHES ppc64)
|
||||||
add_definitions(-D__BIG_ENDIAN__)
|
add_definitions(-D__BIG_ENDIAN__)
|
||||||
@@ -1623,10 +1628,6 @@ endif()
|
|||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Libraries
|
# Libraries
|
||||||
|
|
||||||
if(WITH_GTESTS)
|
|
||||||
include(GTestTesting)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WITH_BLENDER)
|
if(WITH_BLENDER)
|
||||||
add_subdirectory(intern)
|
add_subdirectory(intern)
|
||||||
add_subdirectory(extern)
|
add_subdirectory(extern)
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
# build_deps 2015 x64 / build_deps 2015 x86
|
# build_deps 2015 x64 / build_deps 2015 x86
|
||||||
#
|
#
|
||||||
# MAC OS X USAGE:
|
# MAC OS X USAGE:
|
||||||
# Install with homebrew: brew install cmake autoconf automake libtool yasm nasm
|
# Install with homebrew: brew install cmake autoconf automake libtool yasm nasm bison
|
||||||
# Run "make deps" from main Blender directory
|
# Run "make deps" from main Blender directory
|
||||||
#
|
#
|
||||||
# LINUX USAGE:
|
# LINUX USAGE:
|
||||||
@@ -76,6 +76,7 @@ include(cmake/llvm.cmake)
|
|||||||
include(cmake/clang.cmake)
|
include(cmake/clang.cmake)
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
include(cmake/openmp.cmake)
|
include(cmake/openmp.cmake)
|
||||||
|
include(cmake/nasm.cmake)
|
||||||
endif()
|
endif()
|
||||||
include(cmake/openimageio.cmake)
|
include(cmake/openimageio.cmake)
|
||||||
include(cmake/tiff.cmake)
|
include(cmake/tiff.cmake)
|
||||||
@@ -93,9 +94,11 @@ if(UNIX)
|
|||||||
else()
|
else()
|
||||||
include(cmake/pugixml.cmake)
|
include(cmake/pugixml.cmake)
|
||||||
endif()
|
endif()
|
||||||
include(cmake/ispc.cmake)
|
if((NOT APPLE) OR ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64"))
|
||||||
include(cmake/openimagedenoise.cmake)
|
include(cmake/ispc.cmake)
|
||||||
include(cmake/embree.cmake)
|
include(cmake/openimagedenoise.cmake)
|
||||||
|
include(cmake/embree.cmake)
|
||||||
|
endif()
|
||||||
if(NOT APPLE)
|
if(NOT APPLE)
|
||||||
include(cmake/xr_openxr.cmake)
|
include(cmake/xr_openxr.cmake)
|
||||||
endif()
|
endif()
|
||||||
|
@@ -44,7 +44,7 @@ if(WIN32)
|
|||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
set(BOOST_CONFIGURE_COMMAND ./bootstrap.sh)
|
set(BOOST_CONFIGURE_COMMAND ./bootstrap.sh)
|
||||||
set(BOOST_BUILD_COMMAND ./b2)
|
set(BOOST_BUILD_COMMAND ./b2)
|
||||||
set(BOOST_BUILD_OPTIONS toolset=darwin cxxflags=${PLATFORM_CXXFLAGS} linkflags=${PLATFORM_LDFLAGS} visibility=global --disable-icu boost.locale.icu=off)
|
set(BOOST_BUILD_OPTIONS toolset=clang-darwin cxxflags=${PLATFORM_CXXFLAGS} linkflags=${PLATFORM_LDFLAGS} visibility=global --disable-icu boost.locale.icu=off)
|
||||||
set(BOOST_HARVEST_CMD echo .)
|
set(BOOST_HARVEST_CMD echo .)
|
||||||
set(BOOST_PATCH_COMMAND echo .)
|
set(BOOST_PATCH_COMMAND echo .)
|
||||||
else()
|
else()
|
||||||
|
@@ -30,6 +30,7 @@ if(UNIX)
|
|||||||
nasm
|
nasm
|
||||||
yasm
|
yasm
|
||||||
tclsh
|
tclsh
|
||||||
|
bison
|
||||||
)
|
)
|
||||||
|
|
||||||
foreach(_software ${_required_software})
|
foreach(_software ${_required_software})
|
||||||
@@ -40,6 +41,12 @@ if(UNIX)
|
|||||||
unset(_software_find CACHE)
|
unset(_software_find CACHE)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
if(NOT EXISTS "/usr/local/opt/bison/bin/bison")
|
||||||
|
set(_software_missing "${_software_missing} bison")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(_software_missing)
|
if(_software_missing)
|
||||||
message(
|
message(
|
||||||
"\n"
|
"\n"
|
||||||
@@ -50,7 +57,7 @@ if(UNIX)
|
|||||||
" apt install autoconf automake libtool yasm nasm tcl\n"
|
" apt install autoconf automake libtool yasm nasm tcl\n"
|
||||||
"\n"
|
"\n"
|
||||||
"On macOS (with homebrew):\n"
|
"On macOS (with homebrew):\n"
|
||||||
" brew install cmake autoconf automake libtool yasm nasm\n"
|
" brew install cmake autoconf automake libtool yasm nasm bison\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Other platforms:\n"
|
"Other platforms:\n"
|
||||||
" Install equivalent packages.\n")
|
" Install equivalent packages.\n")
|
||||||
|
@@ -30,6 +30,11 @@ else()
|
|||||||
set(CLANG_GENERATOR "Unix Makefiles")
|
set(CLANG_GENERATOR "Unix Makefiles")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
set(CLANG_EXTRA_ARGS ${CLANG_EXTRA_ARGS}
|
||||||
|
-DLIBXML2_LIBRARY=${LIBDIR}/xml2/lib/libxml2.a
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
ExternalProject_Add(external_clang
|
ExternalProject_Add(external_clang
|
||||||
URL ${CLANG_URI}
|
URL ${CLANG_URI}
|
||||||
|
@@ -50,7 +50,8 @@ if(APPLE)
|
|||||||
set(FFMPEG_EXTRA_FLAGS
|
set(FFMPEG_EXTRA_FLAGS
|
||||||
${FFMPEG_EXTRA_FLAGS}
|
${FFMPEG_EXTRA_FLAGS}
|
||||||
--target-os=darwin
|
--target-os=darwin
|
||||||
)
|
--x86asmexe=${LIBDIR}/nasm/bin/nasm
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
ExternalProject_Add(external_ffmpeg
|
ExternalProject_Add(external_ffmpeg
|
||||||
@@ -143,6 +144,12 @@ if(WIN32)
|
|||||||
external_zlib_mingw
|
external_zlib_mingw
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
if(APPLE)
|
||||||
|
add_dependencies(
|
||||||
|
external_ffmpeg
|
||||||
|
external_nasm
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(BUILD_MODE STREQUAL Release AND WIN32)
|
if(BUILD_MODE STREQUAL Release AND WIN32)
|
||||||
ExternalProject_Add_Step(external_ffmpeg after_install
|
ExternalProject_Add_Step(external_ffmpeg after_install
|
||||||
|
@@ -24,7 +24,8 @@ set(FREETYPE_EXTRA_ARGS
|
|||||||
-DFT_WITH_HARFBUZZ=OFF
|
-DFT_WITH_HARFBUZZ=OFF
|
||||||
-DFT_WITH_BZIP2=OFF
|
-DFT_WITH_BZIP2=OFF
|
||||||
-DCMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE
|
-DCMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE
|
||||||
-DCMAKE_DISABLE_FIND_PACKAGE_BZip2=TRUE)
|
-DCMAKE_DISABLE_FIND_PACKAGE_BZip2=TRUE
|
||||||
|
-DCMAKE_DISABLE_FIND_PACKAGE_BrotliDec=TRUE)
|
||||||
|
|
||||||
ExternalProject_Add(external_freetype
|
ExternalProject_Add(external_freetype
|
||||||
URL ${FREETYPE_URI}
|
URL ${FREETYPE_URI}
|
||||||
|
@@ -42,7 +42,7 @@ if(BUILD_MODE STREQUAL Release)
|
|||||||
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/glew/include/ ${HARVEST_TARGET}/opengl/include/ &&
|
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/glew/include/ ${HARVEST_TARGET}/opengl/include/ &&
|
||||||
# tiff
|
# tiff
|
||||||
${CMAKE_COMMAND} -E copy ${LIBDIR}/tiff/lib/tiff.lib ${HARVEST_TARGET}/tiff/lib/libtiff.lib &&
|
${CMAKE_COMMAND} -E copy ${LIBDIR}/tiff/lib/tiff.lib ${HARVEST_TARGET}/tiff/lib/libtiff.lib &&
|
||||||
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/tiff/include/ ${HARVEST_TARGET}/tiff/include/ &&
|
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/tiff/include/ ${HARVEST_TARGET}/tiff/include/
|
||||||
DEPENDS
|
DEPENDS
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
@@ -132,8 +132,12 @@ harvest(openimageio/bin openimageio/bin "maketx")
|
|||||||
harvest(openimageio/bin openimageio/bin "oiiotool")
|
harvest(openimageio/bin openimageio/bin "oiiotool")
|
||||||
harvest(openimageio/include openimageio/include "*")
|
harvest(openimageio/include openimageio/include "*")
|
||||||
harvest(openimageio/lib openimageio/lib "*.a")
|
harvest(openimageio/lib openimageio/lib "*.a")
|
||||||
harvest(openimagedenoise/include openimagedenoise/include "*")
|
if((NOT APPLE) OR ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64"))
|
||||||
harvest(openimagedenoise/lib openimagedenoise/lib "*.a")
|
harvest(openimagedenoise/include openimagedenoise/include "*")
|
||||||
|
harvest(openimagedenoise/lib openimagedenoise/lib "*.a")
|
||||||
|
harvest(embree/include embree/include "*.h")
|
||||||
|
harvest(embree/lib embree/lib "*.a")
|
||||||
|
endif()
|
||||||
harvest(openjpeg/include/openjpeg-2.3 openjpeg/include "*.h")
|
harvest(openjpeg/include/openjpeg-2.3 openjpeg/include "*.h")
|
||||||
harvest(openjpeg/lib openjpeg/lib "*.a")
|
harvest(openjpeg/lib openjpeg/lib "*.a")
|
||||||
harvest(opensubdiv/include opensubdiv/include "*.h")
|
harvest(opensubdiv/include opensubdiv/include "*.h")
|
||||||
@@ -168,8 +172,6 @@ harvest(vpx/lib ffmpeg/lib "*.a")
|
|||||||
harvest(webp/lib ffmpeg/lib "*.a")
|
harvest(webp/lib ffmpeg/lib "*.a")
|
||||||
harvest(x264/lib ffmpeg/lib "*.a")
|
harvest(x264/lib ffmpeg/lib "*.a")
|
||||||
harvest(xvidcore/lib ffmpeg/lib "*.a")
|
harvest(xvidcore/lib ffmpeg/lib "*.a")
|
||||||
harvest(embree/include embree/include "*.h")
|
|
||||||
harvest(embree/lib embree/lib "*.a")
|
|
||||||
harvest(usd/include usd/include "*.h")
|
harvest(usd/include usd/include "*.h")
|
||||||
harvest(usd/lib/usd usd/lib/usd "*")
|
harvest(usd/lib/usd usd/lib/usd "*")
|
||||||
harvest(usd/plugin usd/plugin "*")
|
harvest(usd/plugin usd/plugin "*")
|
||||||
|
@@ -22,6 +22,17 @@ if(WIN32)
|
|||||||
-DBISON_EXECUTABLE=${LIBDIR}/flexbison/win_bison.exe
|
-DBISON_EXECUTABLE=${LIBDIR}/flexbison/win_bison.exe
|
||||||
-DM4_EXECUTABLE=${DOWNLOAD_DIR}/mingw/mingw64/msys/1.0/bin/m4.exe
|
-DM4_EXECUTABLE=${DOWNLOAD_DIR}/mingw/mingw64/msys/1.0/bin/m4.exe
|
||||||
)
|
)
|
||||||
|
elseif(APPLE)
|
||||||
|
# Use bison installed via Homebrew.
|
||||||
|
# The one which comes which Xcode toolset is too old.
|
||||||
|
set(ISPC_EXTRA_ARGS_APPLE
|
||||||
|
-DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison
|
||||||
|
)
|
||||||
|
elseif(UNIX)
|
||||||
|
set(ISPC_EXTRA_ARGS_UNIX
|
||||||
|
-DCMAKE_C_COMPILER=${LIBDIR}/clang/bin/clang
|
||||||
|
-DCMAKE_CXX_COMPILER=${LIBDIR}/clang/bin/clang++
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(ISPC_EXTRA_ARGS
|
set(ISPC_EXTRA_ARGS
|
||||||
@@ -36,6 +47,8 @@ set(ISPC_EXTRA_ARGS
|
|||||||
-DCLANG_LIBRARY_DIR=${LIBDIR}/clang/lib
|
-DCLANG_LIBRARY_DIR=${LIBDIR}/clang/lib
|
||||||
-DCLANG_INCLUDE_DIRS=${LIBDIR}/clang/include
|
-DCLANG_INCLUDE_DIRS=${LIBDIR}/clang/include
|
||||||
${ISPC_EXTRA_ARGS_WIN}
|
${ISPC_EXTRA_ARGS_WIN}
|
||||||
|
${ISPC_EXTRA_ARGS_APPLE}
|
||||||
|
${ISPC_EXTRA_ARGS_UNIX}
|
||||||
)
|
)
|
||||||
|
|
||||||
ExternalProject_Add(external_ispc
|
ExternalProject_Add(external_ispc
|
||||||
|
@@ -16,11 +16,17 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
|
if(APPLE AND "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
|
||||||
|
set(LLVM_TARGETS AArch64)
|
||||||
|
else()
|
||||||
|
set(LLVM_TARGETS X86)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(LLVM_EXTRA_ARGS
|
set(LLVM_EXTRA_ARGS
|
||||||
-DLLVM_USE_CRT_RELEASE=MD
|
-DLLVM_USE_CRT_RELEASE=MD
|
||||||
-DLLVM_USE_CRT_DEBUG=MDd
|
-DLLVM_USE_CRT_DEBUG=MDd
|
||||||
-DLLVM_INCLUDE_TESTS=OFF
|
-DLLVM_INCLUDE_TESTS=OFF
|
||||||
-DLLVM_TARGETS_TO_BUILD=X86
|
-DLLVM_TARGETS_TO_BUILD=${LLVM_TARGETS}
|
||||||
-DLLVM_INCLUDE_EXAMPLES=OFF
|
-DLLVM_INCLUDE_EXAMPLES=OFF
|
||||||
-DLLVM_ENABLE_TERMINFO=OFF
|
-DLLVM_ENABLE_TERMINFO=OFF
|
||||||
-DLLVM_BUILD_LLVM_C_DYLIB=OFF
|
-DLLVM_BUILD_LLVM_C_DYLIB=OFF
|
||||||
|
29
build_files/build_environment/cmake/nasm.cmake
Normal file
29
build_files/build_environment/cmake/nasm.cmake
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software Foundation,
|
||||||
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#
|
||||||
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
|
ExternalProject_Add(external_nasm
|
||||||
|
URL ${NASM_URI}
|
||||||
|
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||||
|
URL_HASH SHA256=${NASM_HASH}
|
||||||
|
PREFIX ${BUILD_DIR}/nasm
|
||||||
|
PATCH_COMMAND ${PATCH_CMD} --verbose -p 1 -N -d ${BUILD_DIR}/nasm/src/external_nasm < ${PATCH_DIR}/nasm.diff
|
||||||
|
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/nasm/src/external_nasm/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/nasm
|
||||||
|
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/nasm/src/external_nasm/ && make -j${MAKE_THREADS}
|
||||||
|
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/nasm/src/external_nasm/ && make install
|
||||||
|
INSTALL_DIR ${LIBDIR}/nasm
|
||||||
|
)
|
@@ -38,6 +38,7 @@ ExternalProject_Add(external_numpy
|
|||||||
PREFIX ${BUILD_DIR}/numpy
|
PREFIX ${BUILD_DIR}/numpy
|
||||||
PATCH_COMMAND ${NUMPY_PATCH}
|
PATCH_COMMAND ${NUMPY_PATCH}
|
||||||
CONFIGURE_COMMAND ""
|
CONFIGURE_COMMAND ""
|
||||||
|
PATCH_COMMAND COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/numpy/src/external_numpy < ${PATCH_DIR}/numpy.diff
|
||||||
LOG_BUILD 1
|
LOG_BUILD 1
|
||||||
BUILD_COMMAND ${PYTHON_BINARY} ${BUILD_DIR}/numpy/src/external_numpy/setup.py build ${NUMPY_BUILD_OPTION} install --old-and-unmanageable
|
BUILD_COMMAND ${PYTHON_BINARY} ${BUILD_DIR}/numpy/src/external_numpy/setup.py build ${NUMPY_BUILD_OPTION} install --old-and-unmanageable
|
||||||
INSTALL_COMMAND ""
|
INSTALL_COMMAND ""
|
||||||
|
@@ -21,6 +21,7 @@ ExternalProject_Add(external_ogg
|
|||||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||||
URL_HASH SHA256=${OGG_HASH}
|
URL_HASH SHA256=${OGG_HASH}
|
||||||
PREFIX ${BUILD_DIR}/ogg
|
PREFIX ${BUILD_DIR}/ogg
|
||||||
|
PATCH_COMMAND ${PATCH_CMD} --verbose -p 1 -N -d ${BUILD_DIR}/ogg/src/external_ogg < ${PATCH_DIR}/ogg.diff
|
||||||
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ogg/src/external_ogg/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/ogg --disable-shared --enable-static
|
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ogg/src/external_ogg/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/ogg --disable-shared --enable-static
|
||||||
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ogg/src/external_ogg/ && make -j${MAKE_THREADS}
|
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ogg/src/external_ogg/ && make -j${MAKE_THREADS}
|
||||||
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ogg/src/external_ogg/ && make install
|
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ogg/src/external_ogg/ && make install
|
||||||
|
@@ -30,6 +30,13 @@ set(OPENCOLORIO_EXTRA_ARGS
|
|||||||
-DOCIO_STATIC_JNIGLUE=OFF
|
-DOCIO_STATIC_JNIGLUE=OFF
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(APPLE AND NOT("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64"))
|
||||||
|
set(OPENCOLORIO_EXTRA_ARGS
|
||||||
|
${OPENCOLORIO_EXTRA_ARGS}
|
||||||
|
-DOCIO_USE_SSE=OFF
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(OCIO_PATCH opencolorio_win.diff)
|
set(OCIO_PATCH opencolorio_win.diff)
|
||||||
set(OPENCOLORIO_EXTRA_ARGS
|
set(OPENCOLORIO_EXTRA_ARGS
|
||||||
|
@@ -22,6 +22,7 @@ ExternalProject_Add(external_openmp
|
|||||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||||
URL_HASH MD5=${OPENMP_HASH}
|
URL_HASH MD5=${OPENMP_HASH}
|
||||||
PREFIX ${BUILD_DIR}/openmp
|
PREFIX ${BUILD_DIR}/openmp
|
||||||
|
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openmp/src/external_openmp < ${PATCH_DIR}/openmp.diff
|
||||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openmp ${DEFAULT_CMAKE_FLAGS}
|
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openmp ${DEFAULT_CMAKE_FLAGS}
|
||||||
INSTALL_COMMAND cd ${BUILD_DIR}/openmp/src/external_openmp-build && install_name_tool -id @executable_path/../Resources/lib/libomp.dylib runtime/src/libomp.dylib && make install
|
INSTALL_COMMAND cd ${BUILD_DIR}/openmp/src/external_openmp-build && install_name_tool -id @executable_path/../Resources/lib/libomp.dylib runtime/src/libomp.dylib && make install
|
||||||
INSTALL_DIR ${LIBDIR}/openmp
|
INSTALL_DIR ${LIBDIR}/openmp
|
||||||
|
@@ -113,16 +113,32 @@ else()
|
|||||||
COMMAND xcode-select --print-path
|
COMMAND xcode-select --print-path
|
||||||
OUTPUT_VARIABLE XCODE_DEV_PATH OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_VARIABLE XCODE_DEV_PATH OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
set(OSX_ARCHITECTURES x86_64)
|
execute_process(
|
||||||
set(OSX_DEPLOYMENT_TARGET 10.11)
|
COMMAND xcodebuild -version -sdk macosx SDKVersion
|
||||||
|
OUTPUT_VARIABLE MACOSX_SDK_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
|
if(NOT CMAKE_OSX_ARCHITECTURES)
|
||||||
|
execute_process(COMMAND uname -m OUTPUT_VARIABLE ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
message(STATUS "Detected native architecture ${ARCHITECTURE}.")
|
||||||
|
set(CMAKE_OSX_ARCHITECTURES "${ARCHITECTURE}")
|
||||||
|
endif()
|
||||||
|
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")
|
||||||
|
set(OSX_DEPLOYMENT_TARGET 10.13)
|
||||||
|
else()
|
||||||
|
set(OSX_DEPLOYMENT_TARGET 11.00)
|
||||||
|
endif()
|
||||||
set(OSX_SYSROOT ${XCODE_DEV_PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk)
|
set(OSX_SYSROOT ${XCODE_DEV_PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk)
|
||||||
|
|
||||||
set(PLATFORM_CFLAGS "-isysroot ${OSX_SYSROOT} -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET}")
|
set(PLATFORM_CFLAGS "-isysroot ${OSX_SYSROOT} -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}")
|
||||||
set(PLATFORM_CXXFLAGS "-isysroot ${OSX_SYSROOT} -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET} -std=c++11 -stdlib=libc++")
|
set(PLATFORM_CXXFLAGS "-isysroot ${OSX_SYSROOT} -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET} -std=c++11 -stdlib=libc++ -arch ${CMAKE_OSX_ARCHITECTURES}")
|
||||||
set(PLATFORM_LDFLAGS "-isysroot ${OSX_SYSROOT} -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET}")
|
set(PLATFORM_LDFLAGS "-isysroot ${OSX_SYSROOT} -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}")
|
||||||
set(PLATFORM_BUILD_TARGET --build=x86_64-apple-darwin15.0.0) # OS X 10.11
|
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")
|
||||||
|
set(PLATFORM_BUILD_TARGET --build=x86_64-apple-darwin17.0.0) # OS X 10.13
|
||||||
|
else()
|
||||||
|
set(PLATFORM_BUILD_TARGET --build=aarch64-apple-darwin20.0.0) # macOS 11.00
|
||||||
|
endif()
|
||||||
set(PLATFORM_CMAKE_FLAGS
|
set(PLATFORM_CMAKE_FLAGS
|
||||||
-DCMAKE_OSX_ARCHITECTURES:STRING=${OSX_ARCHITECTURES}
|
-DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}
|
||||||
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${OSX_DEPLOYMENT_TARGET}
|
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${OSX_DEPLOYMENT_TARGET}
|
||||||
-DCMAKE_OSX_SYSROOT:PATH=${OSX_SYSROOT}
|
-DCMAKE_OSX_SYSROOT:PATH=${OSX_SYSROOT}
|
||||||
)
|
)
|
||||||
@@ -155,6 +171,7 @@ else()
|
|||||||
|
|
||||||
set(CONFIGURE_ENV
|
set(CONFIGURE_ENV
|
||||||
export MACOSX_DEPLOYMENT_TARGET=${OSX_DEPLOYMENT_TARGET} &&
|
export MACOSX_DEPLOYMENT_TARGET=${OSX_DEPLOYMENT_TARGET} &&
|
||||||
|
export MACOSX_SDK_VERSION=${OSX_DEPLOYMENT_TARGET} &&
|
||||||
export CFLAGS=${PLATFORM_CFLAGS} &&
|
export CFLAGS=${PLATFORM_CFLAGS} &&
|
||||||
export CXXFLAGS=${PLATFORM_CXXFLAGS} &&
|
export CXXFLAGS=${PLATFORM_CXXFLAGS} &&
|
||||||
export LDFLAGS=${PLATFORM_LDFLAGS}
|
export LDFLAGS=${PLATFORM_LDFLAGS}
|
||||||
|
@@ -22,6 +22,10 @@ set(PNG_EXTRA_ARGS
|
|||||||
-DPNG_STATIC=ON
|
-DPNG_STATIC=ON
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64"))
|
||||||
|
set(PNG_EXTRA_ARGS ${PNG_EXTRA_ARGS} -DPNG_HARDWARE_OPTIMIZATIONS=ON -DPNG_ARM_NEON=on -DCMAKE_SYSTEM_PROCESSOR="aarch64")
|
||||||
|
endif()
|
||||||
|
|
||||||
ExternalProject_Add(external_png
|
ExternalProject_Add(external_png
|
||||||
URL ${PNG_URI}
|
URL ${PNG_URI}
|
||||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||||
|
@@ -48,7 +48,12 @@ if(WIN32)
|
|||||||
|
|
||||||
else()
|
else()
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
# disable functions that can be in 10.13 sdk but aren't available on 10.9 target
|
# Disable functions that can be in 10.13 sdk but aren't available on 10.9 target.
|
||||||
|
#
|
||||||
|
# Disable libintl (gettext library) as it might come from Homebrew, which makes
|
||||||
|
# it so test program compiles, but the Python does not. This is because for Python
|
||||||
|
# we use isysroot, which seems to forbid using libintl.h.
|
||||||
|
# The gettext functionality seems to come from CoreFoundation, so should be all fine.
|
||||||
set(PYTHON_FUNC_CONFIGS
|
set(PYTHON_FUNC_CONFIGS
|
||||||
export ac_cv_func_futimens=no &&
|
export ac_cv_func_futimens=no &&
|
||||||
export ac_cv_func_utimensat=no &&
|
export ac_cv_func_utimensat=no &&
|
||||||
@@ -60,13 +65,21 @@ else()
|
|||||||
export ac_cv_func_getentropy=no &&
|
export ac_cv_func_getentropy=no &&
|
||||||
export ac_cv_func_mkostemp=no &&
|
export ac_cv_func_mkostemp=no &&
|
||||||
export ac_cv_func_mkostemps=no &&
|
export ac_cv_func_mkostemps=no &&
|
||||||
export ac_cv_func_timingsafe_bcmp=no)
|
export ac_cv_func_timingsafe_bcmp=no &&
|
||||||
|
export ac_cv_header_libintl_h=no &&
|
||||||
|
export ac_cv_lib_intl_textdomain=no
|
||||||
|
)
|
||||||
|
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
|
||||||
|
set(PYTHON_FUNC_CONFIGS ${PYTHON_FUNC_CONFIGS} && export PYTHON_DECIMAL_WITH_MACHINE=ansi64)
|
||||||
|
endif()
|
||||||
set(PYTHON_CONFIGURE_ENV ${CONFIGURE_ENV} && ${PYTHON_FUNC_CONFIGS})
|
set(PYTHON_CONFIGURE_ENV ${CONFIGURE_ENV} && ${PYTHON_FUNC_CONFIGS})
|
||||||
set(PYTHON_BINARY ${BUILD_DIR}/python/src/external_python/python.exe)
|
set(PYTHON_BINARY ${BUILD_DIR}/python/src/external_python/python.exe)
|
||||||
|
set(PYTHON_PATCH ${PATCH_CMD} --verbose -p1 -d ${BUILD_DIR}/python/src/external_python < ${PATCH_DIR}/python_macos.diff)
|
||||||
else()
|
else()
|
||||||
set(PYTHON_CONFIGURE_ENV ${CONFIGURE_ENV})
|
set(PYTHON_CONFIGURE_ENV ${CONFIGURE_ENV})
|
||||||
set(PYTHON_BINARY ${BUILD_DIR}/python/src/external_python/python)
|
set(PYTHON_BINARY ${BUILD_DIR}/python/src/external_python/python)
|
||||||
endif()
|
set(PYTHON_PATCH ${PATCH_CMD} --verbose -p1 -d ${BUILD_DIR}/python/src/external_python < ${PATCH_DIR}/python_linux.diff)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(PYTHON_CONFIGURE_EXTRA_ARGS "--with-openssl=${LIBDIR}/ssl")
|
set(PYTHON_CONFIGURE_EXTRA_ARGS "--with-openssl=${LIBDIR}/ssl")
|
||||||
set(PYTHON_CFLAGS "-I${LIBDIR}/sqlite/include -I${LIBDIR}/bzip2/include -I${LIBDIR}/lzma/include -I${LIBDIR}/zlib/include")
|
set(PYTHON_CFLAGS "-I${LIBDIR}/sqlite/include -I${LIBDIR}/bzip2/include -I${LIBDIR}/lzma/include -I${LIBDIR}/zlib/include")
|
||||||
@@ -76,7 +89,6 @@ else()
|
|||||||
export CPPFLAGS=${PYTHON_CFLAGS} &&
|
export CPPFLAGS=${PYTHON_CFLAGS} &&
|
||||||
export LDFLAGS=${PYTHON_LDFLAGS} &&
|
export LDFLAGS=${PYTHON_LDFLAGS} &&
|
||||||
export PKG_CONFIG_PATH=${LIBDIR}/ffi/lib/pkgconfig)
|
export PKG_CONFIG_PATH=${LIBDIR}/ffi/lib/pkgconfig)
|
||||||
set(PYTHON_PATCH ${PATCH_CMD} --verbose -p1 -d ${BUILD_DIR}/python/src/external_python < ${PATCH_DIR}/python_linux.diff)
|
|
||||||
|
|
||||||
ExternalProject_Add(external_python
|
ExternalProject_Add(external_python
|
||||||
URL ${PYTHON_URI}
|
URL ${PYTHON_URI}
|
||||||
|
@@ -51,7 +51,7 @@ ExternalProject_Add(external_sqlite
|
|||||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||||
URL_HASH SHA1=${SQLITE_HASH}
|
URL_HASH SHA1=${SQLITE_HASH}
|
||||||
PREFIX ${BUILD_DIR}/sqlite
|
PREFIX ${BUILD_DIR}/sqlite
|
||||||
PATCH_COMMAND ${SQLITE_PATCH_CMD}
|
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/sqlite/src/external_sqlite < ${PATCH_DIR}/sqlite.diff
|
||||||
CONFIGURE_COMMAND ${SQLITE_CONFIGURE_ENV} && cd ${BUILD_DIR}/sqlite/src/external_sqlite/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/sqlite ${SQLITE_CONFIGURATION_ARGS}
|
CONFIGURE_COMMAND ${SQLITE_CONFIGURE_ENV} && cd ${BUILD_DIR}/sqlite/src/external_sqlite/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/sqlite ${SQLITE_CONFIGURATION_ARGS}
|
||||||
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/sqlite/src/external_sqlite/ && make -j${MAKE_THREADS}
|
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/sqlite/src/external_sqlite/ && make -j${MAKE_THREADS}
|
||||||
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/sqlite/src/external_sqlite/ && make install
|
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/sqlite/src/external_sqlite/ && make install
|
||||||
|
@@ -20,7 +20,7 @@ set(SSL_CONFIGURE_COMMAND ./Configure)
|
|||||||
set(SSL_PATCH_CMD echo .)
|
set(SSL_PATCH_CMD echo .)
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set(SSL_OS_COMPILER "blender-darwin-x86_64")
|
set(SSL_OS_COMPILER "blender-darwin-${CMAKE_OSX_ARCHITECTURES}")
|
||||||
else()
|
else()
|
||||||
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
|
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
|
||||||
set(SSL_EXTRA_ARGS enable-ec_nistp_64_gcc_128)
|
set(SSL_EXTRA_ARGS enable-ec_nistp_64_gcc_128)
|
||||||
|
@@ -12,4 +12,9 @@ my %targets = (
|
|||||||
inherit_from => [ "darwin64-x86_64-cc" ],
|
inherit_from => [ "darwin64-x86_64-cc" ],
|
||||||
cflags => add("-fPIC"),
|
cflags => add("-fPIC"),
|
||||||
},
|
},
|
||||||
|
"blender-darwin-arm64" => {
|
||||||
|
inherit_from => [ "darwin-common" ],
|
||||||
|
cxxflags => add("-fPIC -arch arm64"),
|
||||||
|
cflags => add("-fPIC -arch arm64"),
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
@@ -27,6 +27,7 @@ ExternalProject_Add(external_theora
|
|||||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||||
URL_HASH SHA256=${THEORA_HASH}
|
URL_HASH SHA256=${THEORA_HASH}
|
||||||
PREFIX ${BUILD_DIR}/theora
|
PREFIX ${BUILD_DIR}/theora
|
||||||
|
PATCH_COMMAND ${PATCH_CMD} -p 0 -d ${BUILD_DIR}/theora/src/external_theora < ${PATCH_DIR}/theora.diff
|
||||||
CONFIGURE_COMMAND ${THEORA_CONFIGURE_ENV} && cd ${BUILD_DIR}/theora/src/external_theora/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/theora
|
CONFIGURE_COMMAND ${THEORA_CONFIGURE_ENV} && cd ${BUILD_DIR}/theora/src/external_theora/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/theora
|
||||||
--disable-shared
|
--disable-shared
|
||||||
--enable-static
|
--enable-static
|
||||||
|
@@ -16,6 +16,12 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
|
if(WITH_WEBP)
|
||||||
|
set(WITH_TIFF_WEBP ON)
|
||||||
|
else()
|
||||||
|
set(WITH_TIFF_WEBP OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(TIFF_EXTRA_ARGS
|
set(TIFF_EXTRA_ARGS
|
||||||
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
|
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
|
||||||
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include
|
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include
|
||||||
@@ -23,6 +29,8 @@ set(TIFF_EXTRA_ARGS
|
|||||||
-DBUILD_SHARED_LIBS=OFF
|
-DBUILD_SHARED_LIBS=OFF
|
||||||
-Dlzma=OFF
|
-Dlzma=OFF
|
||||||
-Djbig=OFF
|
-Djbig=OFF
|
||||||
|
-Dzstd=OFF
|
||||||
|
-Dwebp=${WITH_TIFF_WEBP}
|
||||||
)
|
)
|
||||||
|
|
||||||
ExternalProject_Add(external_tiff
|
ExternalProject_Add(external_tiff
|
||||||
|
@@ -305,6 +305,10 @@ set(MESA_VERSION 18.3.1)
|
|||||||
set(MESA_URI ftp://ftp.freedesktop.org/pub/mesa//mesa-${MESA_VERSION}.tar.xz)
|
set(MESA_URI ftp://ftp.freedesktop.org/pub/mesa//mesa-${MESA_VERSION}.tar.xz)
|
||||||
set(MESA_HASH d60828056d77bfdbae0970f9b15fb1be)
|
set(MESA_HASH d60828056d77bfdbae0970f9b15fb1be)
|
||||||
|
|
||||||
|
set(NASM_VERSION 2.15.02)
|
||||||
|
set(NASM_URI https://www.nasm.us/pub/nasm/releasebuilds/${NASM_VERSION}/nasm-${NASM_VERSION}.tar.xz)
|
||||||
|
set(NASM_HASH f4fd1329b1713e1ccd34b2fc121c4bcd278c9f91cc4cb205ae8fcd2e4728dd14)
|
||||||
|
|
||||||
set(XR_OPENXR_SDK_VERSION 1.0.8)
|
set(XR_OPENXR_SDK_VERSION 1.0.8)
|
||||||
set(XR_OPENXR_SDK_URI https://github.com/KhronosGroup/OpenXR-SDK/archive/release-${XR_OPENXR_SDK_VERSION}.tar.gz)
|
set(XR_OPENXR_SDK_URI https://github.com/KhronosGroup/OpenXR-SDK/archive/release-${XR_OPENXR_SDK_VERSION}.tar.gz)
|
||||||
set(XR_OPENXR_SDK_HASH c6de63d2e0f9029aa58dfa97cad8ce07)
|
set(XR_OPENXR_SDK_HASH c6de63d2e0f9029aa58dfa97cad8ce07)
|
||||||
|
@@ -24,7 +24,11 @@ if(WIN32)
|
|||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set(VPX_EXTRA_FLAGS --target=x86_64-darwin13-gcc)
|
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
|
||||||
|
set(VPX_EXTRA_FLAGS --target=generic-gnu)
|
||||||
|
else()
|
||||||
|
set(VPX_EXTRA_FLAGS --target=x86_64-darwin17-gcc)
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
set(VPX_EXTRA_FLAGS --target=generic-gnu)
|
set(VPX_EXTRA_FLAGS --target=generic-gnu)
|
||||||
endif()
|
endif()
|
||||||
|
@@ -21,12 +21,26 @@ if(WIN32)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
|
||||||
|
set(X264_EXTRA_ARGS ${X264_EXTRA_ARGS} "--disable-asm")
|
||||||
|
set(X264_CONFIGURE_ENV echo .)
|
||||||
|
else()
|
||||||
|
set(X264_CONFIGURE_ENV
|
||||||
|
export AS=${LIBDIR}/nasm/bin/nasm
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(X264_CONFIGURE_ENV echo .)
|
||||||
|
endif()
|
||||||
|
|
||||||
ExternalProject_Add(external_x264
|
ExternalProject_Add(external_x264
|
||||||
URL ${X264_URI}
|
URL ${X264_URI}
|
||||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||||
URL_HASH SHA256=${X264_HASH}
|
URL_HASH SHA256=${X264_HASH}
|
||||||
PREFIX ${BUILD_DIR}/x264
|
PREFIX ${BUILD_DIR}/x264
|
||||||
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/x264/src/external_x264/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/x264
|
CONFIGURE_COMMAND ${CONFIGURE_ENV} && ${X264_CONFIGURE_ENV} && cd ${BUILD_DIR}/x264/src/external_x264/ &&
|
||||||
|
${CONFIGURE_COMMAND} --prefix=${LIBDIR}/x264
|
||||||
--enable-static
|
--enable-static
|
||||||
--enable-pic
|
--enable-pic
|
||||||
--disable-lavf
|
--disable-lavf
|
||||||
@@ -39,3 +53,10 @@ ExternalProject_Add(external_x264
|
|||||||
if(MSVC)
|
if(MSVC)
|
||||||
set_target_properties(external_x264 PROPERTIES FOLDER Mingw)
|
set_target_properties(external_x264 PROPERTIES FOLDER Mingw)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
add_dependencies(
|
||||||
|
external_x264
|
||||||
|
external_nasm
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
@@ -91,3 +91,41 @@ diff -Naur external_blosc.orig/blosc/blosc.c external_blosc/blosc/blosc.c
|
|||||||
|
|
||||||
|
|
||||||
/* Some useful units */
|
/* Some useful units */
|
||||||
|
diff --git a/blosc/shuffle.c b/blosc/shuffle.c
|
||||||
|
index 84b5095..23053b4 100644
|
||||||
|
--- a/blosc/shuffle.c
|
||||||
|
+++ b/blosc/shuffle.c
|
||||||
|
@@ -490,12 +490,12 @@ void unshuffle(size_t bytesoftype, size_t blocksize,
|
||||||
|
#else /* no __SSE2__ available */
|
||||||
|
|
||||||
|
void shuffle(size_t bytesoftype, size_t blocksize,
|
||||||
|
- uint8_t* _src, uint8_t* _dest) {
|
||||||
|
+ const uint8_t* _src, uint8_t* _dest) {
|
||||||
|
_shuffle(bytesoftype, blocksize, _src, _dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
void unshuffle(size_t bytesoftype, size_t blocksize,
|
||||||
|
- uint8_t* _src, uint8_t* _dest) {
|
||||||
|
+ const uint8_t* _src, uint8_t* _dest) {
|
||||||
|
_unshuffle(bytesoftype, blocksize, _src, _dest);
|
||||||
|
}
|
||||||
|
--- a/cmake/FindSSE.cmake
|
||||||
|
+++ b/cmake/FindSSE.cmake
|
||||||
|
@@ -49,6 +49,17 @@
|
||||||
|
set(AVX_FOUND false CACHE BOOL "AVX available on host")
|
||||||
|
ENDIF (AVX_TRUE)
|
||||||
|
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||||
|
+ execute_process(COMMAND uname -m OUTPUT_VARIABLE ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
+ message(STATUS "Detected architecture ${ARCHITECTURE}")
|
||||||
|
+ IF("${ARCHITECTURE}" STREQUAL "arm64")
|
||||||
|
+ set(SSE2_FOUND false CACHE BOOL "SSE2 available on host")
|
||||||
|
+ set(SSE3_FOUND false CACHE BOOL "SSE3 available on host")
|
||||||
|
+ set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host")
|
||||||
|
+ set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host")
|
||||||
|
+ set(AVX_FOUND false CACHE BOOL "AVX available on host")
|
||||||
|
+ return()
|
||||||
|
+ ENDIF()
|
||||||
|
+
|
||||||
|
EXEC_PROGRAM("/usr/sbin/sysctl -n machdep.cpu.features" OUTPUT_VARIABLE
|
||||||
|
CPUINFO)
|
||||||
|
|
@@ -9,3 +9,62 @@
|
|||||||
enabled libopenmpt && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++"
|
enabled libopenmpt && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++"
|
||||||
enabled libopus && {
|
enabled libopus && {
|
||||||
enabled libopus_decoder && {
|
enabled libopus_decoder && {
|
||||||
|
--- a/libavcodec/cfhddata.c
|
||||||
|
+++ b/libavcodec/cfhddata.c
|
||||||
|
@@ -276,10 +276,10 @@
|
||||||
|
av_cold int ff_cfhd_init_vlcs(CFHDContext *s)
|
||||||
|
{
|
||||||
|
int i, j, ret = 0;
|
||||||
|
- uint32_t new_cfhd_vlc_bits[NB_VLC_TABLE_18 * 2];
|
||||||
|
- uint8_t new_cfhd_vlc_len[NB_VLC_TABLE_18 * 2];
|
||||||
|
- uint16_t new_cfhd_vlc_run[NB_VLC_TABLE_18 * 2];
|
||||||
|
- int16_t new_cfhd_vlc_level[NB_VLC_TABLE_18 * 2];
|
||||||
|
+ uint32_t *new_cfhd_vlc_bits = av_calloc(sizeof(uint32_t), NB_VLC_TABLE_18 * 2);
|
||||||
|
+ uint8_t *new_cfhd_vlc_len = av_calloc(sizeof(uint8_t), NB_VLC_TABLE_18 * 2);
|
||||||
|
+ uint16_t *new_cfhd_vlc_run = av_calloc(sizeof(uint16_t), NB_VLC_TABLE_18 * 2);
|
||||||
|
+ int16_t *new_cfhd_vlc_level = av_calloc(sizeof(int16_t), NB_VLC_TABLE_18 * 2);
|
||||||
|
|
||||||
|
/** Similar to dv.c, generate signed VLC tables **/
|
||||||
|
|
||||||
|
@@ -305,8 +305,13 @@
|
||||||
|
|
||||||
|
ret = init_vlc(&s->vlc_9, VLC_BITS, j, new_cfhd_vlc_len,
|
||||||
|
1, 1, new_cfhd_vlc_bits, 4, 4, 0);
|
||||||
|
- if (ret < 0)
|
||||||
|
+ if (ret < 0) {
|
||||||
|
+ av_free(new_cfhd_vlc_bits);
|
||||||
|
+ av_free(new_cfhd_vlc_len);
|
||||||
|
+ av_free(new_cfhd_vlc_run);
|
||||||
|
+ av_free(new_cfhd_vlc_level);
|
||||||
|
return ret;
|
||||||
|
+ }
|
||||||
|
for (i = 0; i < s->vlc_9.table_size; i++) {
|
||||||
|
int code = s->vlc_9.table[i][0];
|
||||||
|
int len = s->vlc_9.table[i][1];
|
||||||
|
@@ -346,8 +351,14 @@
|
||||||
|
|
||||||
|
ret = init_vlc(&s->vlc_18, VLC_BITS, j, new_cfhd_vlc_len,
|
||||||
|
1, 1, new_cfhd_vlc_bits, 4, 4, 0);
|
||||||
|
- if (ret < 0)
|
||||||
|
+ if (ret < 0) {
|
||||||
|
+ av_free(new_cfhd_vlc_bits);
|
||||||
|
+ av_free(new_cfhd_vlc_len);
|
||||||
|
+ av_free(new_cfhd_vlc_run);
|
||||||
|
+ av_free(new_cfhd_vlc_level);
|
||||||
|
return ret;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
av_assert0(s->vlc_18.table_size == 4572);
|
||||||
|
|
||||||
|
for (i = 0; i < s->vlc_18.table_size; i++) {
|
||||||
|
@@ -367,5 +378,10 @@
|
||||||
|
s->table_18_rl_vlc[i].run = run;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ av_free(new_cfhd_vlc_bits);
|
||||||
|
+ av_free(new_cfhd_vlc_len);
|
||||||
|
+ av_free(new_cfhd_vlc_run);
|
||||||
|
+ av_free(new_cfhd_vlc_level);
|
||||||
|
+
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
@@ -34,3 +34,52 @@ diff -Naur orig/cmake/GenerateBuiltins.cmake.txt external_ispc/cmake/GenerateBui
|
|||||||
elseif ("${bit}" STREQUAL "64" AND ${arch} STREQUAL "x86")
|
elseif ("${bit}" STREQUAL "64" AND ${arch} STREQUAL "x86")
|
||||||
set(target_arch "x86_64")
|
set(target_arch "x86_64")
|
||||||
elseif ("${bit}" STREQUAL "32" AND ${arch} STREQUAL "arm")
|
elseif ("${bit}" STREQUAL "32" AND ${arch} STREQUAL "arm")
|
||||||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
|
index 46a8db8..f53beef 100644
|
||||||
|
--- a/CMakeLists.txt
|
||||||
|
+++ b/CMakeLists.txt
|
||||||
|
@@ -36,8 +36,12 @@
|
||||||
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
|
||||||
|
if (UNIX)
|
||||||
|
- set(CMAKE_C_COMPILER "clang")
|
||||||
|
- set(CMAKE_CXX_COMPILER "clang++")
|
||||||
|
+ if (NOT CMAKE_C_COMPILER)
|
||||||
|
+ set(CMAKE_C_COMPILER "clang")
|
||||||
|
+ endif()
|
||||||
|
+ if (NOT CMAKE_CXX_COMPILER)
|
||||||
|
+ set(CMAKE_CXX_COMPILER "clang++")
|
||||||
|
+ endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(PROJECT_NAME ispc)
|
||||||
|
@@ -412,6 +416,29 @@ else()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
+# Link against libstdc++.a which must be provided to the linker after
|
||||||
|
+# LLVM and CLang libraries.
|
||||||
|
+# This is needed because some of LLVM/CLang dependencies are using
|
||||||
|
+# std::make_shared, which is defined in one of those:
|
||||||
|
+# - libclang-cpp.so
|
||||||
|
+# - libstdc++.a
|
||||||
|
+# Using the former one is tricky because then generated binary depends
|
||||||
|
+# on a library which is outside of the LD_LIBRARY_PATH.
|
||||||
|
+#
|
||||||
|
+# Hence, using C++ implementation from G++ which seems to work just fine.
|
||||||
|
+# In fact, from investigation seems that libclang-cpp.so itself is pulling
|
||||||
|
+# std::_Sp_make_shared_tag from G++'s libstdc++.a.
|
||||||
|
+if(UNIX AND NOT APPLE)
|
||||||
|
+ execute_process(
|
||||||
|
+ COMMAND g++ --print-file-name libstdc++.a
|
||||||
|
+ OUTPUT_VARIABLE GCC_LIBSTDCXX_A
|
||||||
|
+ OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
+ )
|
||||||
|
+ if(GCC_LIBSTDCXX_A AND EXISTS ${GCC_LIBSTDCXX_A})
|
||||||
|
+ target_link_libraries(${PROJECT_NAME} ${GCC_LIBSTDCXX_A})
|
||||||
|
+ endif()
|
||||||
|
+endif()
|
||||||
|
+
|
||||||
|
# Build target for utility checking host ISA
|
||||||
|
if (ISPC_INCLUDE_UTILS)
|
||||||
|
add_executable(check_isa "")
|
||||||
|
129
build_files/build_environment/patches/nasm.diff
Normal file
129
build_files/build_environment/patches/nasm.diff
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
diff --git a/output/macho.h b/output/macho.h
|
||||||
|
index 538c531e..fd5e8849 100644
|
||||||
|
--- a/output/macho.h
|
||||||
|
+++ b/output/macho.h
|
||||||
|
@@ -60,6 +60,8 @@
|
||||||
|
#define LC_SEGMENT 0x1
|
||||||
|
#define LC_SEGMENT_64 0x19
|
||||||
|
#define LC_SYMTAB 0x2
|
||||||
|
+#define LC_VERSION_MIN_MACOSX 0x24
|
||||||
|
+#define LC_BUILD_VERSION 0x32
|
||||||
|
|
||||||
|
/* Symbol type bits */
|
||||||
|
#define N_STAB 0xe0
|
||||||
|
diff --git a/output/outmacho.c b/output/outmacho.c
|
||||||
|
index 08147883..de6ec902 100644
|
||||||
|
--- a/output/outmacho.c
|
||||||
|
+++ b/output/outmacho.c
|
||||||
|
@@ -38,6 +38,8 @@
|
||||||
|
|
||||||
|
#include "compiler.h"
|
||||||
|
|
||||||
|
+#include <stdlib.h>
|
||||||
|
+
|
||||||
|
#include "nctype.h"
|
||||||
|
|
||||||
|
#include "nasm.h"
|
||||||
|
@@ -64,6 +66,8 @@
|
||||||
|
#define MACHO_SYMCMD_SIZE 24
|
||||||
|
#define MACHO_NLIST_SIZE 12
|
||||||
|
#define MACHO_RELINFO_SIZE 8
|
||||||
|
+#define MACHO_BUILD_VERSION_SIZE 24
|
||||||
|
+#define MACHO_VERSION_MIN_MACOSX_SIZE 16
|
||||||
|
|
||||||
|
#define MACHO_HEADER64_SIZE 32
|
||||||
|
#define MACHO_SEGCMD64_SIZE 72
|
||||||
|
@@ -1224,6 +1228,46 @@ static void macho_layout_symbols (uint32_t *numsyms,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+static bool get_full_version_from_env (const char *variable_name,
|
||||||
|
+ int *r_major,
|
||||||
|
+ int *r_minor,
|
||||||
|
+ int *r_patch) {
|
||||||
|
+ *r_major = 0;
|
||||||
|
+ *r_minor = 0;
|
||||||
|
+ *r_patch = 0;
|
||||||
|
+
|
||||||
|
+ const char *value = getenv(variable_name);
|
||||||
|
+ if (value == NULL || value[0] == '\0') {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ const char *current_value = value;
|
||||||
|
+ const char *end_value = value + strlen(value);
|
||||||
|
+
|
||||||
|
+ char *endptr;
|
||||||
|
+
|
||||||
|
+ *r_major = strtol(current_value, &endptr, 10);
|
||||||
|
+ if (endptr >= end_value) {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+ current_value = endptr + 1;
|
||||||
|
+
|
||||||
|
+ *r_minor = strtol(current_value, &endptr, 10);
|
||||||
|
+ if (endptr >= end_value) {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+ current_value = endptr + 1;
|
||||||
|
+
|
||||||
|
+ *r_patch = strtol(current_value, &endptr, 10);
|
||||||
|
+
|
||||||
|
+ return true;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static bool need_version_min_macosx_command (void) {
|
||||||
|
+ return getenv("MACOSX_DEPLOYMENT_TARGET") &&
|
||||||
|
+ getenv("MACOSX_SDK_VERSION");
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/* Calculate some values we'll need for writing later. */
|
||||||
|
|
||||||
|
static void macho_calculate_sizes (void)
|
||||||
|
@@ -1270,6 +1314,12 @@ static void macho_calculate_sizes (void)
|
||||||
|
head_sizeofcmds += fmt.segcmd_size + seg_nsects * fmt.sectcmd_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ /* LC_VERSION_MIN_MACOSX */
|
||||||
|
+ if (need_version_min_macosx_command()) {
|
||||||
|
+ ++head_ncmds;
|
||||||
|
+ head_sizeofcmds += MACHO_VERSION_MIN_MACOSX_SIZE;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (nsyms > 0) {
|
||||||
|
++head_ncmds;
|
||||||
|
head_sizeofcmds += MACHO_SYMCMD_SIZE;
|
||||||
|
@@ -1653,6 +1703,33 @@ static void macho_write (void)
|
||||||
|
else
|
||||||
|
nasm_warn(WARN_OTHER, "no sections?");
|
||||||
|
|
||||||
|
+#define ENCODE_BUILD_VERSION(major, minor, patch) \
|
||||||
|
+ (((major) << 16) | ((minor) << 8) | (patch))
|
||||||
|
+
|
||||||
|
+ if (0) {
|
||||||
|
+ fwriteint32_t(LC_BUILD_VERSION, ofile); /* cmd == LC_BUILD_VERSION */
|
||||||
|
+ fwriteint32_t(MACHO_BUILD_VERSION_SIZE, ofile); /* size of load command */
|
||||||
|
+ fwriteint32_t(1, ofile); /* platform */
|
||||||
|
+ fwriteint32_t(ENCODE_BUILD_VERSION(10, 13, 0), ofile); /* minos, X.Y.Z is encoded in nibbles xxxx.yy.zz */
|
||||||
|
+ fwriteint32_t(ENCODE_BUILD_VERSION(10, 15, 4), ofile); /* sdk, X.Y.Z is encoded in nibbles xxxx.yy.zz */
|
||||||
|
+ fwriteint32_t(0, ofile); /* number of tool entries following this */
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (need_version_min_macosx_command()) {
|
||||||
|
+ int sdk_major, sdk_minor, sdk_patch;
|
||||||
|
+ get_full_version_from_env("MACOSX_SDK_VERSION", &sdk_major, &sdk_minor, &sdk_patch);
|
||||||
|
+
|
||||||
|
+ int version_major, version_minor, version_patch;
|
||||||
|
+ get_full_version_from_env("MACOSX_DEPLOYMENT_TARGET", &version_major, &version_minor, &version_patch);
|
||||||
|
+
|
||||||
|
+ fwriteint32_t(LC_VERSION_MIN_MACOSX, ofile); /* cmd == LC_VERSION_MIN_MACOSX */
|
||||||
|
+ fwriteint32_t(MACHO_VERSION_MIN_MACOSX_SIZE, ofile); /* size of load command */
|
||||||
|
+ fwriteint32_t(ENCODE_BUILD_VERSION(version_major, version_minor, version_patch), ofile); /* minos, X.Y.Z is encoded in nibbles xxxx.yy.zz */
|
||||||
|
+ fwriteint32_t(ENCODE_BUILD_VERSION(sdk_major, sdk_minor, sdk_patch), ofile); /* sdk, X.Y.Z is encoded in nibbles xxxx.yy.zz */
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+#undef ENCODE_BUILD_VERSION
|
||||||
|
+
|
||||||
|
if (nsyms > 0) {
|
||||||
|
/* write out symbol command */
|
||||||
|
fwriteint32_t(LC_SYMTAB, ofile); /* cmd == LC_SYMTAB */
|
27
build_files/build_environment/patches/numpy.diff
Normal file
27
build_files/build_environment/patches/numpy.diff
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py
|
||||||
|
index ba2b1f4..b10f7df 100644
|
||||||
|
--- a/numpy/distutils/system_info.py
|
||||||
|
+++ b/numpy/distutils/system_info.py
|
||||||
|
@@ -2164,8 +2164,8 @@ class accelerate_info(system_info):
|
||||||
|
'accelerate' in libraries):
|
||||||
|
if intel:
|
||||||
|
args.extend(['-msse3'])
|
||||||
|
- else:
|
||||||
|
- args.extend(['-faltivec'])
|
||||||
|
+# else:
|
||||||
|
+# args.extend(['-faltivec'])
|
||||||
|
args.extend([
|
||||||
|
'-I/System/Library/Frameworks/vecLib.framework/Headers'])
|
||||||
|
link_args.extend(['-Wl,-framework', '-Wl,Accelerate'])
|
||||||
|
@@ -2174,8 +2174,8 @@ class accelerate_info(system_info):
|
||||||
|
'veclib' in libraries):
|
||||||
|
if intel:
|
||||||
|
args.extend(['-msse3'])
|
||||||
|
- else:
|
||||||
|
- args.extend(['-faltivec'])
|
||||||
|
+# else:
|
||||||
|
+# args.extend(['-faltivec'])
|
||||||
|
args.extend([
|
||||||
|
'-I/System/Library/Frameworks/vecLib.framework/Headers'])
|
||||||
|
link_args.extend(['-Wl,-framework', '-Wl,vecLib'])
|
||||||
|
|
12
build_files/build_environment/patches/ogg.diff
Normal file
12
build_files/build_environment/patches/ogg.diff
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
diff --git a/include/ogg/os_types.h b/include/ogg/os_types.h
|
||||||
|
index eb8a322..6f73b72 100644
|
||||||
|
--- a/include/ogg/os_types.h
|
||||||
|
+++ b/include/ogg/os_types.h
|
||||||
|
@@ -71,6 +71,7 @@
|
||||||
|
#elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */
|
||||||
|
|
||||||
|
# include <sys/types.h>
|
||||||
|
+# include <stdint.h>
|
||||||
|
typedef int16_t ogg_int16_t;
|
||||||
|
typedef uint16_t ogg_uint16_t;
|
||||||
|
typedef int32_t ogg_int32_t;
|
@@ -86,3 +86,47 @@ index 1f9a3ee..d151e9a 100644
|
|||||||
return isnan( value );
|
return isnan( value );
|
||||||
#else
|
#else
|
||||||
return std::isnan(value);
|
return std::isnan(value);
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/DAEValidator/library/src/Dae.cpp b/DAEValidator/library/src/Dae.cpp
|
||||||
|
index 9256ee1..241ad67 100644
|
||||||
|
--- a/DAEValidator/library/src/Dae.cpp
|
||||||
|
+++ b/DAEValidator/library/src/Dae.cpp
|
||||||
|
@@ -304,7 +304,7 @@ namespace opencollada
|
||||||
|
if (auto root_node = root())
|
||||||
|
{
|
||||||
|
const auto & nodes = root_node.selectNodes("//*[@id]");
|
||||||
|
- for (const auto & node : nodes)
|
||||||
|
+ for (const auto node : nodes)
|
||||||
|
{
|
||||||
|
string id = node.attribute("id").value();
|
||||||
|
mIdCache.insert(id);
|
||||||
|
@@ -312,4 +312,4 @@ namespace opencollada
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
-}
|
||||||
|
\ No newline at end of file
|
||||||
|
+}
|
||||||
|
diff --git a/DAEValidator/library/src/DaeValidator.cpp b/DAEValidator/library/src/DaeValidator.cpp
|
||||||
|
index 715d903..24423ce 100644
|
||||||
|
--- a/DAEValidator/library/src/DaeValidator.cpp
|
||||||
|
+++ b/DAEValidator/library/src/DaeValidator.cpp
|
||||||
|
@@ -162,7 +162,7 @@ namespace opencollada
|
||||||
|
|
||||||
|
// Find xsi:schemaLocation attributes in dae and try to validate against specified xsd documents
|
||||||
|
const auto & elements = dae.root().selectNodes("//*[@xsi:schemaLocation]");
|
||||||
|
- for (const auto & element : elements)
|
||||||
|
+ for (const auto element : elements)
|
||||||
|
{
|
||||||
|
if (auto schemaLocation = element.attribute("schemaLocation"))
|
||||||
|
{
|
||||||
|
@@ -274,7 +274,7 @@ namespace opencollada
|
||||||
|
int result = 0;
|
||||||
|
map<string, size_t> ids;
|
||||||
|
const auto & nodes = dae.root().selectNodes("//*[@id]");
|
||||||
|
- for (const auto & node : nodes)
|
||||||
|
+ for (const auto node : nodes)
|
||||||
|
{
|
||||||
|
string id = node.attribute("id").value();
|
||||||
|
size_t line = node.line();
|
||||||
|
23
build_files/build_environment/patches/openmp.diff
Normal file
23
build_files/build_environment/patches/openmp.diff
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
diff --git a/runtime/src/z_Linux_asm.S b/runtime/src/z_Linux_asm.S
|
||||||
|
index 0d8885e..42aa5ad 100644
|
||||||
|
--- a/runtime/src/z_Linux_asm.S
|
||||||
|
+++ b/runtime/src/z_Linux_asm.S
|
||||||
|
@@ -1540,10 +1540,12 @@ __kmp_unnamed_critical_addr:
|
||||||
|
.comm .gomp_critical_user_,32,8
|
||||||
|
.data
|
||||||
|
.align 8
|
||||||
|
- .global __kmp_unnamed_critical_addr
|
||||||
|
-__kmp_unnamed_critical_addr:
|
||||||
|
+ .global ___kmp_unnamed_critical_addr
|
||||||
|
+___kmp_unnamed_critical_addr:
|
||||||
|
.8byte .gomp_critical_user_
|
||||||
|
- .size __kmp_unnamed_critical_addr,8
|
||||||
|
+# if !(KMP_OS_DARWIN)
|
||||||
|
+ .size ___kmp_unnamed_critical_addr,8
|
||||||
|
+# endif
|
||||||
|
#endif /* KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 */
|
||||||
|
|
||||||
|
#if KMP_OS_LINUX
|
||||||
|
|
||||||
|
|
||||||
|
|
289
build_files/build_environment/patches/python_macos.diff
Normal file
289
build_files/build_environment/patches/python_macos.diff
Normal file
@@ -0,0 +1,289 @@
|
|||||||
|
diff -ru a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst
|
||||||
|
--- a/Doc/library/ctypes.rst 2020-03-10 07:11:12.000000000 +0100
|
||||||
|
+++ b/Doc/library/ctypes.rst 2020-07-14 08:10:10.000000000 +0200
|
||||||
|
@@ -1551,6 +1551,13 @@
|
||||||
|
value usable as argument (integer, string, ctypes instance). This allows
|
||||||
|
defining adapters that can adapt custom objects as function parameters.
|
||||||
|
|
||||||
|
+ .. attribute:: variadic
|
||||||
|
+
|
||||||
|
+ Assign a boolean to specify that the function takes a variable number of
|
||||||
|
+ arguments. This does not matter on most platforms, but for Apple arm64
|
||||||
|
+ platforms variadic functions have a different calling convention than
|
||||||
|
+ normal functions.
|
||||||
|
+
|
||||||
|
.. attribute:: errcheck
|
||||||
|
|
||||||
|
Assign a Python function or another callable to this attribute. The
|
||||||
|
diff -ru a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
|
||||||
|
--- a/Modules/_ctypes/_ctypes.c 2020-03-10 07:11:12.000000000 +0100
|
||||||
|
+++ b/Modules/_ctypes/_ctypes.c 2020-07-14 08:14:41.000000000 +0200
|
||||||
|
@@ -3175,6 +3175,35 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
+PyCFuncPtr_set_variadic(PyCFuncPtrObject *self, PyObject *ob, void *Py_UNUSED(ignored))
|
||||||
|
+{
|
||||||
|
+ StgDictObject *dict = PyObject_stgdict((PyObject *)self);
|
||||||
|
+ assert(dict);
|
||||||
|
+ int r = PyObject_IsTrue(ob);
|
||||||
|
+ if (r == 1) {
|
||||||
|
+ dict->flags |= FUNCFLAG_VARIADIC;
|
||||||
|
+ return 0;
|
||||||
|
+ } else if (r == 0) {
|
||||||
|
+ dict->flags &= ~FUNCFLAG_VARIADIC;
|
||||||
|
+ return 0;
|
||||||
|
+ } else {
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static PyObject *
|
||||||
|
+PyCFuncPtr_get_variadic(PyCFuncPtrObject *self, void *Py_UNUSED(ignored))
|
||||||
|
+{
|
||||||
|
+ StgDictObject *dict = PyObject_stgdict((PyObject *)self);
|
||||||
|
+ assert(dict); /* Cannot be NULL for PyCFuncPtrObject instances */
|
||||||
|
+ if (dict->flags & FUNCFLAG_VARIADIC)
|
||||||
|
+ Py_RETURN_TRUE;
|
||||||
|
+ else
|
||||||
|
+ Py_RETURN_FALSE;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
PyCFuncPtr_set_argtypes(PyCFuncPtrObject *self, PyObject *ob, void *Py_UNUSED(ignored))
|
||||||
|
{
|
||||||
|
PyObject *converters;
|
||||||
|
@@ -5632,6 +5661,7 @@
|
||||||
|
PyModule_AddObject(m, "FUNCFLAG_USE_ERRNO", PyLong_FromLong(FUNCFLAG_USE_ERRNO));
|
||||||
|
PyModule_AddObject(m, "FUNCFLAG_USE_LASTERROR", PyLong_FromLong(FUNCFLAG_USE_LASTERROR));
|
||||||
|
PyModule_AddObject(m, "FUNCFLAG_PYTHONAPI", PyLong_FromLong(FUNCFLAG_PYTHONAPI));
|
||||||
|
+ PyModule_AddObject(m, "FUNCFLAG_VARIADIC", PyLong_FromLong(FUNCFLAG_VARIADIC));
|
||||||
|
PyModule_AddStringConstant(m, "__version__", "1.1.0");
|
||||||
|
|
||||||
|
PyModule_AddObject(m, "_memmove_addr", PyLong_FromVoidPtr(memmove));
|
||||||
|
diff -ru a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
|
||||||
|
--- a/Modules/_ctypes/callproc.c 2020-03-10 07:11:12.000000000 +0100
|
||||||
|
+++ b/Modules/_ctypes/callproc.c 2020-07-14 08:18:33.000000000 +0200
|
||||||
|
@@ -767,7 +767,8 @@
|
||||||
|
ffi_type **atypes,
|
||||||
|
ffi_type *restype,
|
||||||
|
void *resmem,
|
||||||
|
- int argcount)
|
||||||
|
+ int argcount,
|
||||||
|
+ int argtypecount)
|
||||||
|
{
|
||||||
|
PyThreadState *_save = NULL; /* For Py_BLOCK_THREADS and Py_UNBLOCK_THREADS */
|
||||||
|
PyObject *error_object = NULL;
|
||||||
|
@@ -793,15 +794,38 @@
|
||||||
|
if ((flags & FUNCFLAG_CDECL) == 0)
|
||||||
|
cc = FFI_STDCALL;
|
||||||
|
#endif
|
||||||
|
- if (FFI_OK != ffi_prep_cif(&cif,
|
||||||
|
- cc,
|
||||||
|
- argcount,
|
||||||
|
- restype,
|
||||||
|
- atypes)) {
|
||||||
|
- PyErr_SetString(PyExc_RuntimeError,
|
||||||
|
- "ffi_prep_cif failed");
|
||||||
|
- return -1;
|
||||||
|
- }
|
||||||
|
+#if HAVE_FFI_PREP_CIF_VAR
|
||||||
|
+ /* Everyone SHOULD set f.variadic=True on variadic function pointers, but
|
||||||
|
+ * lots of existing code will not. If there's at least one arg and more
|
||||||
|
+ * args are passed than are defined in the prototype, then it must be a
|
||||||
|
+ * variadic function. */
|
||||||
|
+ if ((flags & FUNCFLAG_VARIADIC) ||
|
||||||
|
+ (argtypecount != 0 && argcount > argtypecount))
|
||||||
|
+ {
|
||||||
|
+ if (FFI_OK != ffi_prep_cif_var(&cif,
|
||||||
|
+ cc,
|
||||||
|
+ argtypecount,
|
||||||
|
+ argcount,
|
||||||
|
+ restype,
|
||||||
|
+ atypes)) {
|
||||||
|
+ PyErr_SetString(PyExc_RuntimeError,
|
||||||
|
+ "ffi_prep_cif_var failed");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+#endif
|
||||||
|
+ if (FFI_OK != ffi_prep_cif(&cif,
|
||||||
|
+ cc,
|
||||||
|
+ argcount,
|
||||||
|
+ restype,
|
||||||
|
+ atypes)) {
|
||||||
|
+ PyErr_SetString(PyExc_RuntimeError,
|
||||||
|
+ "ffi_prep_cif failed");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+#if HAVE_FFI_PREP_CIF_VAR
|
||||||
|
+ }
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
if (flags & (FUNCFLAG_USE_ERRNO | FUNCFLAG_USE_LASTERROR)) {
|
||||||
|
error_object = _ctypes_get_errobj(&space);
|
||||||
|
@@ -1185,9 +1209,8 @@
|
||||||
|
|
||||||
|
if (-1 == _call_function_pointer(flags, pProc, avalues, atypes,
|
||||||
|
rtype, resbuf,
|
||||||
|
- Py_SAFE_DOWNCAST(argcount,
|
||||||
|
- Py_ssize_t,
|
||||||
|
- int)))
|
||||||
|
+ Py_SAFE_DOWNCAST(argcount, Py_ssize_t, int),
|
||||||
|
+ Py_SAFE_DOWNCAST(argtype_count, Py_ssize_t, int)))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
#ifdef WORDS_BIGENDIAN
|
||||||
|
diff -ru a/Modules/_ctypes/ctypes.h b/Modules/_ctypes/ctypes.h
|
||||||
|
--- a/Modules/_ctypes/ctypes.h 2020-03-10 07:11:12.000000000 +0100
|
||||||
|
+++ b/Modules/_ctypes/ctypes.h 2020-07-14 08:30:53.000000000 +0200
|
||||||
|
@@ -285,6 +285,7 @@
|
||||||
|
#define FUNCFLAG_PYTHONAPI 0x4
|
||||||
|
#define FUNCFLAG_USE_ERRNO 0x8
|
||||||
|
#define FUNCFLAG_USE_LASTERROR 0x10
|
||||||
|
+#define FUNCFLAG_VARIADIC 0x20
|
||||||
|
|
||||||
|
#define TYPEFLAG_ISPOINTER 0x100
|
||||||
|
#define TYPEFLAG_HASPOINTER 0x200
|
||||||
|
diff -ru a/configure b/configure
|
||||||
|
--- a/configure 2020-03-10 07:11:12.000000000 +0100
|
||||||
|
+++ b/configure 2020-07-14 08:03:27.000000000 +0200
|
||||||
|
@@ -3374,7 +3374,7 @@
|
||||||
|
# has no effect, don't bother defining them
|
||||||
|
Darwin/[6789].*)
|
||||||
|
define_xopen_source=no;;
|
||||||
|
- Darwin/1[0-9].*)
|
||||||
|
+ Darwin/[12][0-9].*)
|
||||||
|
define_xopen_source=no;;
|
||||||
|
# On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
|
||||||
|
# used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
|
||||||
|
@@ -9251,6 +9251,9 @@
|
||||||
|
ppc)
|
||||||
|
MACOSX_DEFAULT_ARCH="ppc64"
|
||||||
|
;;
|
||||||
|
+ arm64)
|
||||||
|
+ MACOSX_DEFAULT_ARCH="arm64"
|
||||||
|
+ ;;
|
||||||
|
*)
|
||||||
|
as_fn_error $? "Unexpected output of 'arch' on OSX" "$LINENO" 5
|
||||||
|
;;
|
||||||
|
diff -ru a/configure.ac b/configure.ac
|
||||||
|
--- a/configure.ac 2020-03-10 07:11:12.000000000 +0100
|
||||||
|
+++ b/configure.ac 2020-07-14 08:03:27.000000000 +0200
|
||||||
|
@@ -2456,6 +2456,9 @@
|
||||||
|
ppc)
|
||||||
|
MACOSX_DEFAULT_ARCH="ppc64"
|
||||||
|
;;
|
||||||
|
+ arm64)
|
||||||
|
+ MACOSX_DEFAULT_ARCH="arm64"
|
||||||
|
+ ;;
|
||||||
|
*)
|
||||||
|
AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
|
||||||
|
;;
|
||||||
|
diff -ru a/setup.py b/setup.py
|
||||||
|
--- a/setup.py 2020-03-10 07:11:12.000000000 +0100
|
||||||
|
+++ b/setup.py 2020-07-14 08:28:12.000000000 +0200
|
||||||
|
@@ -141,6 +141,13 @@
|
||||||
|
os.unlink(tmpfile)
|
||||||
|
|
||||||
|
return MACOS_SDK_ROOT
|
||||||
|
+
|
||||||
|
+def is_macosx_at_least(vers):
|
||||||
|
+ if host_platform == 'darwin':
|
||||||
|
+ dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
|
||||||
|
+ if dep_target:
|
||||||
|
+ return tuple(map(int, dep_target.split('.'))) >= vers
|
||||||
|
+ return False
|
||||||
|
|
||||||
|
def is_macosx_sdk_path(path):
|
||||||
|
"""
|
||||||
|
@@ -150,6 +157,13 @@
|
||||||
|
or path.startswith('/System/')
|
||||||
|
or path.startswith('/Library/') )
|
||||||
|
|
||||||
|
+def grep_headers_for(function, headers):
|
||||||
|
+ for header in headers:
|
||||||
|
+ with open(header, 'r') as f:
|
||||||
|
+ if function in f.read():
|
||||||
|
+ return True
|
||||||
|
+ return False
|
||||||
|
+
|
||||||
|
def find_file(filename, std_dirs, paths):
|
||||||
|
"""Searches for the directory where a given file is located,
|
||||||
|
and returns a possibly-empty list of additional directories, or None
|
||||||
|
@@ -1972,7 +1986,11 @@
|
||||||
|
return True
|
||||||
|
|
||||||
|
def detect_ctypes(self, inc_dirs, lib_dirs):
|
||||||
|
- self.use_system_libffi = False
|
||||||
|
+ if not sysconfig.get_config_var("LIBFFI_INCLUDEDIR") and is_macosx_at_least((10,15)):
|
||||||
|
+ self.use_system_libffi = True
|
||||||
|
+ else:
|
||||||
|
+ self.use_system_libffi = '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS")
|
||||||
|
+
|
||||||
|
include_dirs = []
|
||||||
|
extra_compile_args = []
|
||||||
|
extra_link_args = []
|
||||||
|
@@ -2016,32 +2034,48 @@
|
||||||
|
ext_test = Extension('_ctypes_test',
|
||||||
|
sources=['_ctypes/_ctypes_test.c'],
|
||||||
|
libraries=['m'])
|
||||||
|
+ ffi_inc = sysconfig.get_config_var("LIBFFI_INCLUDEDIR")
|
||||||
|
+ ffi_lib = None
|
||||||
|
+
|
||||||
|
self.extensions.extend([ext, ext_test])
|
||||||
|
|
||||||
|
if host_platform == 'darwin':
|
||||||
|
- if '--with-system-ffi' not in sysconfig.get_config_var("CONFIG_ARGS"):
|
||||||
|
+ if not self.use_system_libffi:
|
||||||
|
return
|
||||||
|
- # OS X 10.5 comes with libffi.dylib; the include files are
|
||||||
|
- # in /usr/include/ffi
|
||||||
|
- inc_dirs.append('/usr/include/ffi')
|
||||||
|
-
|
||||||
|
- ffi_inc = [sysconfig.get_config_var("LIBFFI_INCLUDEDIR")]
|
||||||
|
- if not ffi_inc or ffi_inc[0] == '':
|
||||||
|
- ffi_inc = find_file('ffi.h', [], inc_dirs)
|
||||||
|
- if ffi_inc is not None:
|
||||||
|
- ffi_h = ffi_inc[0] + '/ffi.h'
|
||||||
|
+ ffi_in_sdk = os.path.join(macosx_sdk_root(), "usr/include/ffi")
|
||||||
|
+ if os.path.exists(ffi_in_sdk):
|
||||||
|
+ ffi_inc = ffi_in_sdk
|
||||||
|
+ ffi_lib = 'ffi'
|
||||||
|
+ else:
|
||||||
|
+ # OS X 10.5 comes with libffi.dylib; the include files are
|
||||||
|
+ # in /usr/include/ffi
|
||||||
|
+ ffi_inc_dirs.append('/usr/include/ffi')
|
||||||
|
+
|
||||||
|
+ if not ffi_inc:
|
||||||
|
+ found = find_file('ffi.h', [], ffi_inc_dirs)
|
||||||
|
+ if found:
|
||||||
|
+ ffi_inc = found[0]
|
||||||
|
+ if ffi_inc:
|
||||||
|
+ ffi_h = ffi_inc + '/ffi.h'
|
||||||
|
if not os.path.exists(ffi_h):
|
||||||
|
ffi_inc = None
|
||||||
|
print('Header file {} does not exist'.format(ffi_h))
|
||||||
|
- ffi_lib = None
|
||||||
|
- if ffi_inc is not None:
|
||||||
|
+ if ffi_lib is None and ffi_inc:
|
||||||
|
for lib_name in ('ffi', 'ffi_pic'):
|
||||||
|
if (self.compiler.find_library_file(lib_dirs, lib_name)):
|
||||||
|
ffi_lib = lib_name
|
||||||
|
break
|
||||||
|
|
||||||
|
if ffi_inc and ffi_lib:
|
||||||
|
- ext.include_dirs.extend(ffi_inc)
|
||||||
|
+ ffi_headers = glob(os.path.join(ffi_inc, '*.h'))
|
||||||
|
+ if grep_headers_for('ffi_closure_alloc', ffi_headers):
|
||||||
|
+ try:
|
||||||
|
+ sources.remove('_ctypes/malloc_closure.c')
|
||||||
|
+ except ValueError:
|
||||||
|
+ pass
|
||||||
|
+ if grep_headers_for('ffi_prep_cif_var', ffi_headers):
|
||||||
|
+ ext.extra_compile_args.append("-DHAVE_FFI_PREP_CIF_VAR=1")
|
||||||
|
+ ext.include_dirs.append(ffi_inc)
|
||||||
|
ext.libraries.append(ffi_lib)
|
||||||
|
self.use_system_libffi = True
|
||||||
|
|
14
build_files/build_environment/patches/sqlite.diff
Normal file
14
build_files/build_environment/patches/sqlite.diff
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
Only in external_sqlite_orig: config.log
|
||||||
|
diff -ru external_sqlite_orig/config.sub external_sqlite/config.sub
|
||||||
|
--- external_sqlite_orig/config.sub 2020-07-10 14:06:42.000000000 +0200
|
||||||
|
+++ external_sqlite/config.sub 2020-07-10 14:10:24.000000000 +0200
|
||||||
|
@@ -314,6 +314,7 @@
|
||||||
|
# Recognize the basic CPU types with company name.
|
||||||
|
580-* \
|
||||||
|
| a29k-* \
|
||||||
|
+ | aarch64-* \
|
||||||
|
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
|
||||||
|
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
|
||||||
|
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
||||||
|
Only in external_sqlite: mksourceid
|
||||||
|
Only in external_sqlite: sqlite3session.h
|
18
build_files/build_environment/patches/theora.diff
Normal file
18
build_files/build_environment/patches/theora.diff
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
--- config.sub
|
||||||
|
+++ config.sub
|
||||||
|
@@ -226,6 +226,7 @@
|
||||||
|
# Some are omitted here because they have special meanings below.
|
||||||
|
1750a | 580 \
|
||||||
|
| a29k \
|
||||||
|
+ | aarch64 \
|
||||||
|
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
||||||
|
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
||||||
|
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
|
||||||
|
@@ -286,6 +287,7 @@
|
||||||
|
# Recognize the basic CPU types with company name.
|
||||||
|
580-* \
|
||||||
|
| a29k-* \
|
||||||
|
+ | aarch64-* \
|
||||||
|
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
|
||||||
|
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
|
||||||
|
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
@@ -97,3 +97,36 @@ diff -Naur external_usd_base/cmake/macros/Public.cmake external_usd/cmake/macros
|
|||||||
endforeach()
|
endforeach()
|
||||||
foreach(lib ${PXR_OBJECT_LIBS})
|
foreach(lib ${PXR_OBJECT_LIBS})
|
||||||
set(objects "${objects};\$<TARGET_OBJECTS:${lib}>")
|
set(objects "${objects};\$<TARGET_OBJECTS:${lib}>")
|
||||||
|
|
||||||
|
diff --git a/pxr/base/arch/align.h b/pxr/base/arch/align.h
|
||||||
|
index f3cabf4..ebc8a69 100644
|
||||||
|
--- a/pxr/base/arch/align.h
|
||||||
|
+++ b/pxr/base/arch/align.h
|
||||||
|
@@ -77,7 +77,11 @@ ArchAlignMemory(void *base)
|
||||||
|
/// The size of a CPU cache line on the current processor architecture in bytes.
|
||||||
|
///
|
||||||
|
/// \hideinitializer
|
||||||
|
+#if defined(ARCH_OS_DARWIN) && defined(ARCH_CPU_ARM)
|
||||||
|
+#define ARCH_CACHE_LINE_SIZE 128
|
||||||
|
+#else
|
||||||
|
#define ARCH_CACHE_LINE_SIZE 64
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
///@}
|
||||||
|
|
||||||
|
diff --git a/pxr/base/arch/math.h b/pxr/base/arch/math.h
|
||||||
|
index 3e66c37..64a052c 100644
|
||||||
|
--- a/pxr/base/arch/math.h
|
||||||
|
+++ b/pxr/base/arch/math.h
|
||||||
|
@@ -42,7 +42,7 @@ PXR_NAMESPACE_OPEN_SCOPE
|
||||||
|
/// \addtogroup group_arch_Math
|
||||||
|
///@{
|
||||||
|
|
||||||
|
-#if defined (ARCH_CPU_INTEL) || defined(doxygen)
|
||||||
|
+#if defined (ARCH_CPU_INTEL) || defined(ARCH_CPU_ARM) || defined(doxygen)
|
||||||
|
|
||||||
|
/// This is the smallest value e such that 1+e^2 == 1, using floats.
|
||||||
|
/// True for all IEEE754 chipsets.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
104
build_files/cmake/Modules/FindClangTidy.cmake
Normal file
104
build_files/cmake/Modules/FindClangTidy.cmake
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
# - Find clang-tidy executable
|
||||||
|
#
|
||||||
|
# Find the native clang-tidy executable
|
||||||
|
#
|
||||||
|
# This module defines
|
||||||
|
# CLANG_TIDY_EXECUTABLE, the ful lpath to clang-tidy executable
|
||||||
|
#
|
||||||
|
# CLANG_TIDY_VERSION, the full version of the clang-tidy in the
|
||||||
|
# major,minor.patch format
|
||||||
|
#
|
||||||
|
# CLANG_TIDY_VERSION_MAJOR,
|
||||||
|
# CLANG_TIDY_VERSION_MINOR,
|
||||||
|
# CLANG_TIDY_VERSION_PATCH, individual components of the clang-tidy version.
|
||||||
|
#
|
||||||
|
# CLANG_TIDY_FOUND, If false, do not try to use Eigen3.
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Copyright 2020 Blender Foundation.
|
||||||
|
#
|
||||||
|
# Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
# see accompanying file Copyright.txt for details.
|
||||||
|
#
|
||||||
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
# See the License for more information.
|
||||||
|
#=============================================================================
|
||||||
|
|
||||||
|
# If CLANG_TIDY_ROOT_DIR was defined in the environment, use it.
|
||||||
|
if(NOT CLANG_TIDY_ROOT_DIR AND NOT $ENV{CLANG_TIDY_ROOT_DIR} STREQUAL "")
|
||||||
|
set(CLANG_TIDY_ROOT_DIR $ENV{CLANG_TIDY_ROOT_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(_clang_tidy_SEARCH_DIRS
|
||||||
|
${CLANG_TIDY_ROOT_DIR}
|
||||||
|
/usr/local/bin
|
||||||
|
)
|
||||||
|
|
||||||
|
# TODO(sergey): Find more reliable way of finding the latest clang-tidy.
|
||||||
|
find_program(CLANG_TIDY_EXECUTABLE
|
||||||
|
NAMES
|
||||||
|
clang-tidy-10
|
||||||
|
clang-tidy-9
|
||||||
|
clang-tidy-8
|
||||||
|
clang-tidy-7
|
||||||
|
clang-tidy
|
||||||
|
HINTS
|
||||||
|
${_clang_tidy_SEARCH_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(CLANG_TIDY_EXECUTABLE)
|
||||||
|
# Mark clang-tidy as found.
|
||||||
|
set(CLANG_TIDY_FOUND TRUE)
|
||||||
|
|
||||||
|
# Setup fallback values.
|
||||||
|
set(CLANG_TIDY_VERSION_MAJOR 0)
|
||||||
|
set(CLANG_TIDY_VERSION_MINOR 0)
|
||||||
|
set(CLANG_TIDY_VERSION_PATCH 0)
|
||||||
|
|
||||||
|
# Get version from the output.
|
||||||
|
#
|
||||||
|
# NOTE: Don't use name of the executable file since that only includes a
|
||||||
|
# major version. Also, even the major version might be missing in the
|
||||||
|
# executable name.
|
||||||
|
execute_process(COMMAND ${CLANG_TIDY_EXECUTABLE} -version
|
||||||
|
OUTPUT_VARIABLE CLANG_TIDY_VERSION_RAW
|
||||||
|
ERROR_QUIET
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
|
# Parse parts.
|
||||||
|
if(CLANG_TIDY_VERSION_RAW MATCHES "LLVM version .*")
|
||||||
|
# Strip the LLVM prefix and get list of individual version components.
|
||||||
|
string(REGEX REPLACE
|
||||||
|
".*LLVM version ([.0-9]+).*" "\\1"
|
||||||
|
CLANG_SEMANTIC_VERSION "${CLANG_TIDY_VERSION_RAW}")
|
||||||
|
string(REPLACE "." ";" CLANG_VERSION_PARTS "${CLANG_SEMANTIC_VERSION}")
|
||||||
|
list(LENGTH CLANG_VERSION_PARTS NUM_CLANG_TIDY_VERSION_PARTS)
|
||||||
|
|
||||||
|
# Extract components into corresponding variables.
|
||||||
|
if(NUM_CLANG_TIDY_VERSION_PARTS GREATER 0)
|
||||||
|
list(GET CLANG_VERSION_PARTS 0 CLANG_TIDY_VERSION_MAJOR)
|
||||||
|
endif()
|
||||||
|
if(NUM_CLANG_TIDY_VERSION_PARTS GREATER 1)
|
||||||
|
list(GET CLANG_VERSION_PARTS 1 CLANG_TIDY_VERSION_MINOR)
|
||||||
|
endif()
|
||||||
|
if(NUM_CLANG_TIDY_VERSION_PARTS GREATER 2)
|
||||||
|
list(GET CLANG_VERSION_PARTS 2 CLANG_TIDY_VERSION_PATCH)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Unset temp variables.
|
||||||
|
unset(NUM_CLANG_TIDY_VERSION_PARTS)
|
||||||
|
unset(CLANG_SEMANTIC_VERSION)
|
||||||
|
unset(CLANG_VERSION_PARTS)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Construct full semantic version.
|
||||||
|
set(CLANG_TIDY_VERSION "${CLANG_TIDY_VERSION_MAJOR}.\
|
||||||
|
${CLANG_TIDY_VERSION_MINOR}.\
|
||||||
|
${CLANG_TIDY_VERSION_PATCH}")
|
||||||
|
unset(CLANG_TIDY_VERSION_RAW)
|
||||||
|
|
||||||
|
message(STATUS "Found clang-tidy ${CLANG_TIDY_EXECUTABLE} (${CLANG_TIDY_VERSION})")
|
||||||
|
else()
|
||||||
|
set(CLANG_TIDY_FOUND FALSE)
|
||||||
|
endif()
|
@@ -82,7 +82,7 @@ FIND_LIBRARY(EMBREE_LIBRARY
|
|||||||
# handle the QUIETLY and REQUIRED arguments and set EMBREE_FOUND to TRUE if
|
# handle the QUIETLY and REQUIRED arguments and set EMBREE_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(EMBREE DEFAULT_MSG
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Embree DEFAULT_MSG
|
||||||
_embree_LIBRARIES EMBREE_INCLUDE_DIR)
|
_embree_LIBRARIES EMBREE_INCLUDE_DIR)
|
||||||
|
|
||||||
IF(EMBREE_FOUND)
|
IF(EMBREE_FOUND)
|
||||||
|
@@ -37,6 +37,11 @@ macro(BLENDER_SRC_GTEST_EX)
|
|||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(MANIFEST "${CMAKE_BINARY_DIR}/tests.exe.manifest")
|
set(MANIFEST "${CMAKE_BINARY_DIR}/tests.exe.manifest")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_definitions(-DBLENDER_GFLAGS_NAMESPACE=${GFLAGS_NAMESPACE})
|
||||||
|
add_definitions(${GFLAGS_DEFINES})
|
||||||
|
add_definitions(${GLOG_DEFINES})
|
||||||
|
|
||||||
add_executable(${TARGET_NAME} ${ARG_SRC} ${MANIFEST})
|
add_executable(${TARGET_NAME} ${ARG_SRC} ${MANIFEST})
|
||||||
target_include_directories(${TARGET_NAME} PUBLIC "${TEST_INC}")
|
target_include_directories(${TARGET_NAME} PUBLIC "${TEST_INC}")
|
||||||
target_include_directories(${TARGET_NAME} SYSTEM PUBLIC "${TEST_INC_SYS}")
|
target_include_directories(${TARGET_NAME} SYSTEM PUBLIC "${TEST_INC_SYS}")
|
||||||
|
@@ -53,7 +53,7 @@ set(WITH_USD ON CACHE BOOL "" FORCE)
|
|||||||
set(WITH_MEM_JEMALLOC ON CACHE BOOL "" FORCE)
|
set(WITH_MEM_JEMALLOC ON CACHE BOOL "" FORCE)
|
||||||
set(WITH_CYCLES_CUDA_BINARIES ON CACHE BOOL "" FORCE)
|
set(WITH_CYCLES_CUDA_BINARIES ON CACHE BOOL "" FORCE)
|
||||||
set(WITH_CYCLES_CUBIN_COMPILER OFF CACHE BOOL "" FORCE)
|
set(WITH_CYCLES_CUBIN_COMPILER OFF CACHE BOOL "" FORCE)
|
||||||
set(CYCLES_CUDA_BINARIES_ARCH sm_30;sm_35;sm_37;sm_50;sm_52;sm_60;sm_61;sm_70;sm_75 CACHE STRING "" FORCE)
|
set(CYCLES_CUDA_BINARIES_ARCH sm_30;sm_35;sm_37;sm_50;sm_52;sm_60;sm_61;sm_70;sm_75;compute_75 CACHE STRING "" FORCE)
|
||||||
set(WITH_CYCLES_DEVICE_OPTIX ON CACHE BOOL "" FORCE)
|
set(WITH_CYCLES_DEVICE_OPTIX ON CACHE BOOL "" FORCE)
|
||||||
|
|
||||||
# platform dependent options
|
# platform dependent options
|
||||||
|
@@ -169,6 +169,26 @@ function(blender_include_dirs_sys
|
|||||||
include_directories(SYSTEM ${_ALL_INCS})
|
include_directories(SYSTEM ${_ALL_INCS})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
# Set include paths for header files included with "*.h" syntax.
|
||||||
|
# This enables auto-complete suggestions for user header files on Xcode.
|
||||||
|
# Build process is not affected since the include paths are the same
|
||||||
|
# as in HEADER_SEARCH_PATHS.
|
||||||
|
function(blender_user_header_search_paths
|
||||||
|
name
|
||||||
|
includes
|
||||||
|
)
|
||||||
|
|
||||||
|
if(XCODE)
|
||||||
|
set(_ALL_INCS "")
|
||||||
|
foreach(_INC ${includes})
|
||||||
|
get_filename_component(_ABS_INC ${_INC} ABSOLUTE)
|
||||||
|
# _ALL_INCS is a space-separated string of file paths in quotes.
|
||||||
|
set(_ALL_INCS "${_ALL_INCS} \"${_ABS_INC}\"")
|
||||||
|
endforeach()
|
||||||
|
set_target_properties(${name} PROPERTIES XCODE_ATTRIBUTE_USER_HEADER_SEARCH_PATHS "${_ALL_INCS}")
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
function(blender_source_group
|
function(blender_source_group
|
||||||
name
|
name
|
||||||
sources
|
sources
|
||||||
@@ -317,6 +337,7 @@ function(blender_add_lib__impl
|
|||||||
# works fine without having the includes
|
# works fine without having the includes
|
||||||
# listed is helpful for IDE's (QtCreator/MSVC)
|
# listed is helpful for IDE's (QtCreator/MSVC)
|
||||||
blender_source_group("${name}" "${sources}")
|
blender_source_group("${name}" "${sources}")
|
||||||
|
blender_user_header_search_paths("${name}" "${includes}")
|
||||||
|
|
||||||
list_assert_duplicates("${sources}")
|
list_assert_duplicates("${sources}")
|
||||||
list_assert_duplicates("${includes}")
|
list_assert_duplicates("${includes}")
|
||||||
@@ -354,6 +375,42 @@ function(blender_add_lib
|
|||||||
set_property(GLOBAL APPEND PROPERTY BLENDER_LINK_LIBS ${name})
|
set_property(GLOBAL APPEND PROPERTY BLENDER_LINK_LIBS ${name})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
# blender_add_test_lib() is used to define a test library. It is intended to be
|
||||||
|
# called in tandem with blender_add_lib(). The test library will be linked into
|
||||||
|
# the bf_gtest_runner_test executable (see tests/gtests/CMakeLists.txt).
|
||||||
|
function(blender_add_test_lib
|
||||||
|
name
|
||||||
|
sources
|
||||||
|
includes
|
||||||
|
includes_sys
|
||||||
|
library_deps
|
||||||
|
)
|
||||||
|
|
||||||
|
add_cc_flags_custom_test(${name} PARENT_SCOPE)
|
||||||
|
|
||||||
|
# Otherwise external projects will produce warnings that we cannot fix.
|
||||||
|
remove_strict_flags()
|
||||||
|
|
||||||
|
# This duplicates logic that's also in GTestTesting.cmake, macro BLENDER_SRC_GTEST_EX.
|
||||||
|
# TODO(Sybren): deduplicate after the general approach in D7649 has been approved.
|
||||||
|
LIST(APPEND includes
|
||||||
|
${CMAKE_SOURCE_DIR}/tests/gtests
|
||||||
|
)
|
||||||
|
LIST(APPEND includes_sys
|
||||||
|
${GLOG_INCLUDE_DIRS}
|
||||||
|
${GFLAGS_INCLUDE_DIRS}
|
||||||
|
${CMAKE_SOURCE_DIR}/extern/gtest/include
|
||||||
|
${CMAKE_SOURCE_DIR}/extern/gmock/include
|
||||||
|
)
|
||||||
|
add_definitions(-DBLENDER_GFLAGS_NAMESPACE=${GFLAGS_NAMESPACE})
|
||||||
|
add_definitions(${GFLAGS_DEFINES})
|
||||||
|
add_definitions(${GLOG_DEFINES})
|
||||||
|
|
||||||
|
blender_add_lib__impl(${name} "${sources}" "${includes}" "${includes_sys}" "${library_deps}")
|
||||||
|
|
||||||
|
set_property(GLOBAL APPEND PROPERTY BLENDER_TEST_LIBS ${name})
|
||||||
|
endfunction()
|
||||||
|
|
||||||
# Ninja only: assign 'heavy pool' to some targets that are especially RAM-consuming to build.
|
# Ninja only: assign 'heavy pool' to some targets that are especially RAM-consuming to build.
|
||||||
function(setup_heavy_lib_pool)
|
function(setup_heavy_lib_pool)
|
||||||
if(WITH_NINJA_POOL_JOBS AND NINJA_MAX_NUM_PARALLEL_COMPILE_HEAVY_JOBS)
|
if(WITH_NINJA_POOL_JOBS AND NINJA_MAX_NUM_PARALLEL_COMPILE_HEAVY_JOBS)
|
||||||
|
@@ -20,7 +20,11 @@
|
|||||||
|
|
||||||
# Libraries configuration for Apple.
|
# Libraries configuration for Apple.
|
||||||
|
|
||||||
set(MACOSX_DEPLOYMENT_TARGET "10.11")
|
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
|
||||||
|
set(MACOSX_DEPLOYMENT_TARGET 11.00)
|
||||||
|
else()
|
||||||
|
set(MACOSX_DEPLOYMENT_TARGET 10.13)
|
||||||
|
endif()
|
||||||
|
|
||||||
macro(find_package_wrapper)
|
macro(find_package_wrapper)
|
||||||
# do nothing, just satisfy the macro
|
# do nothing, just satisfy the macro
|
||||||
@@ -378,6 +382,12 @@ if(WITH_CYCLES_OSL)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
|
||||||
|
set(WITH_CYCLES_EMBREE OFF)
|
||||||
|
set(WITH_OPENIMAGEDENOISE OFF)
|
||||||
|
set(WITH_CPU_SSE OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(WITH_CYCLES_EMBREE)
|
if(WITH_CYCLES_EMBREE)
|
||||||
find_package(Embree 3.8.0 REQUIRED)
|
find_package(Embree 3.8.0 REQUIRED)
|
||||||
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Xlinker -stack_size -Xlinker 0x100000")
|
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Xlinker -stack_size -Xlinker 0x100000")
|
||||||
@@ -439,8 +449,8 @@ if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR CMAKE_OSX_ARCHITECTURES MATCHES "
|
|||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ftree-vectorize -fvariable-expansion-in-unroller")
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ftree-vectorize -fvariable-expansion-in-unroller")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
set(CMAKE_C_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
|
set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic -fno-strict-aliasing")
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
|
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic -fno-strict-aliasing")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${XCODE_VERSION} VERSION_EQUAL 5 OR ${XCODE_VERSION} VERSION_GREATER 5)
|
if(${XCODE_VERSION} VERSION_EQUAL 5 OR ${XCODE_VERSION} VERSION_GREATER 5)
|
||||||
|
@@ -21,8 +21,10 @@
|
|||||||
# Xcode and system configuration for Apple.
|
# Xcode and system configuration for Apple.
|
||||||
|
|
||||||
if(NOT CMAKE_OSX_ARCHITECTURES)
|
if(NOT CMAKE_OSX_ARCHITECTURES)
|
||||||
set(CMAKE_OSX_ARCHITECTURES x86_64 CACHE STRING
|
execute_process(COMMAND uname -m OUTPUT_VARIABLE ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
"Choose the architecture you want to build Blender for: i386, x86_64 or ppc"
|
message(STATUS "Detected native architecture ${ARCHITECTURE}.")
|
||||||
|
set(CMAKE_OSX_ARCHITECTURES ${ARCHITECTURE} CACHE STRING
|
||||||
|
"Choose the architecture you want to build Blender for: arm64 or x86_64"
|
||||||
FORCE)
|
FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -65,13 +67,9 @@ endif()
|
|||||||
|
|
||||||
message(STATUS "Detected OS X ${OSX_SYSTEM} and Xcode ${XCODE_VERSION} at ${XCODE_BUNDLE}")
|
message(STATUS "Detected OS X ${OSX_SYSTEM} and Xcode ${XCODE_VERSION} at ${XCODE_BUNDLE}")
|
||||||
|
|
||||||
# Older Xcode versions had different approach to the directory hiearchy.
|
# Require a relatively recent Xcode version.
|
||||||
# Require newer Xcode which is also have better chances of being able to compile with the
|
if(${XCODE_VERSION} VERSION_LESS 10.0)
|
||||||
# required deployment target.
|
message(FATAL_ERROR "Only Xcode version 10.0 and newer is supported")
|
||||||
#
|
|
||||||
# NOTE: Xcode version 8.2 is the latest one which runs on macOS 10.11.
|
|
||||||
if(${XCODE_VERSION} VERSION_LESS 8.2)
|
|
||||||
message(FATAL_ERROR "Only Xcode version 8.2 and newer is supported")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# note: xcode-select path could be ambiguous,
|
# note: xcode-select path could be ambiguous,
|
||||||
@@ -133,14 +131,21 @@ if(${CMAKE_GENERATOR} MATCHES "Xcode")
|
|||||||
endif()
|
endif()
|
||||||
unset(OSX_SDKROOT)
|
unset(OSX_SDKROOT)
|
||||||
|
|
||||||
# 10.11 is our min. target, if you use higher sdk, weak linking happens
|
|
||||||
|
# 10.13 is our min. target, if you use higher sdk, weak linking happens
|
||||||
|
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
|
||||||
|
set(OSX_MIN_DEPLOYMENT_TARGET 11.00)
|
||||||
|
else()
|
||||||
|
set(OSX_MIN_DEPLOYMENT_TARGET 10.13)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CMAKE_OSX_DEPLOYMENT_TARGET)
|
if(CMAKE_OSX_DEPLOYMENT_TARGET)
|
||||||
if(${CMAKE_OSX_DEPLOYMENT_TARGET} VERSION_LESS 10.11)
|
if(${CMAKE_OSX_DEPLOYMENT_TARGET} VERSION_LESS ${OSX_MIN_DEPLOYMENT_TARGET})
|
||||||
message(STATUS "Setting deployment target to 10.11, lower versions are not supported")
|
message(STATUS "Setting deployment target to ${OSX_MIN_DEPLOYMENT_TARGET}, lower versions are not supported")
|
||||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE STRING "" FORCE)
|
set(CMAKE_OSX_DEPLOYMENT_TARGET "${OSX_MIN_DEPLOYMENT_TARGET}" CACHE STRING "" FORCE)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE STRING "" FORCE)
|
set(CMAKE_OSX_DEPLOYMENT_TARGET "${OSX_MIN_DEPLOYMENT_TARGET}" CACHE STRING "" FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT ${CMAKE_GENERATOR} MATCHES "Xcode")
|
if(NOT ${CMAKE_GENERATOR} MATCHES "Xcode")
|
||||||
|
@@ -36,6 +36,11 @@ if(NOT DEFINED LIBDIR)
|
|||||||
elseif(EXISTS ${LIBDIR_CENTOS7_ABI})
|
elseif(EXISTS ${LIBDIR_CENTOS7_ABI})
|
||||||
set(LIBDIR ${LIBDIR_CENTOS7_ABI})
|
set(LIBDIR ${LIBDIR_CENTOS7_ABI})
|
||||||
set(WITH_CXX11_ABI OFF)
|
set(WITH_CXX11_ABI OFF)
|
||||||
|
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCC AND
|
||||||
|
CMAKE_C_COMPILER_VERSION VERSION_LESS 9.3)
|
||||||
|
message(FATAL_ERROR "GCC version must be at least 9.3 for precompiled libraries, found ${CMAKE_C_COMPILER_VERSION}")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Avoid namespace pollustion.
|
# Avoid namespace pollustion.
|
||||||
|
@@ -40,7 +40,8 @@ if make_utils.command_missing(git_command):
|
|||||||
|
|
||||||
# Test if we are building a specific release version.
|
# Test if we are building a specific release version.
|
||||||
branch = make_utils.git_branch(git_command)
|
branch = make_utils.git_branch(git_command)
|
||||||
release_version = make_utils.git_branch_release_version(branch)
|
tag = make_utils.git_tag(git_command)
|
||||||
|
release_version = make_utils.git_branch_release_version(branch, tag)
|
||||||
lib_tests_dirpath = os.path.join('..', 'lib', "tests")
|
lib_tests_dirpath = os.path.join('..', 'lib', "tests")
|
||||||
|
|
||||||
if not os.path.exists(lib_tests_dirpath):
|
if not os.path.exists(lib_tests_dirpath):
|
||||||
|
@@ -197,7 +197,8 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
# Test if we are building a specific release version.
|
# Test if we are building a specific release version.
|
||||||
branch = make_utils.git_branch(args.git_command)
|
branch = make_utils.git_branch(args.git_command)
|
||||||
release_version = make_utils.git_branch_release_version(branch)
|
tag = make_utils.git_tag(args.git_command)
|
||||||
|
release_version = make_utils.git_branch_release_version(branch, tag)
|
||||||
|
|
||||||
if not args.no_libraries:
|
if not args.no_libraries:
|
||||||
svn_update(args, release_version)
|
svn_update(args, release_version)
|
||||||
|
@@ -36,7 +36,7 @@ def check_output(cmd, exit_on_error=True):
|
|||||||
return output.strip()
|
return output.strip()
|
||||||
|
|
||||||
def git_branch(git_command):
|
def git_branch(git_command):
|
||||||
# Test if we are building a specific release version.
|
# Get current branch name.
|
||||||
try:
|
try:
|
||||||
branch = subprocess.check_output([git_command, "rev-parse", "--abbrev-ref", "HEAD"])
|
branch = subprocess.check_output([git_command, "rev-parse", "--abbrev-ref", "HEAD"])
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
@@ -45,10 +45,23 @@ def git_branch(git_command):
|
|||||||
|
|
||||||
return branch.strip().decode('utf8')
|
return branch.strip().decode('utf8')
|
||||||
|
|
||||||
def git_branch_release_version(branch):
|
def git_tag(git_command):
|
||||||
|
# Get current tag name.
|
||||||
|
try:
|
||||||
|
tag = subprocess.check_output([git_command, "describe", "--exact-match"], stderr=subprocess.STDOUT)
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
return None
|
||||||
|
|
||||||
|
return tag.strip().decode('utf8')
|
||||||
|
|
||||||
|
def git_branch_release_version(branch, tag):
|
||||||
release_version = re.search("^blender-v(.*)-release$", branch)
|
release_version = re.search("^blender-v(.*)-release$", branch)
|
||||||
if release_version:
|
if release_version:
|
||||||
release_version = release_version.group(1)
|
release_version = release_version.group(1)
|
||||||
|
elif tag:
|
||||||
|
release_version = re.search("^v([0-9]*\.[0-9]*).*", tag)
|
||||||
|
if release_version:
|
||||||
|
release_version = release_version.group(1)
|
||||||
return release_version
|
return release_version
|
||||||
|
|
||||||
def svn_libraries_base_url(release_version):
|
def svn_libraries_base_url(release_version):
|
||||||
|
@@ -38,7 +38,7 @@ PROJECT_NAME = Blender
|
|||||||
# could be handy for archiving the generated documentation or if some version
|
# could be handy for archiving the generated documentation or if some version
|
||||||
# control system is used.
|
# control system is used.
|
||||||
|
|
||||||
PROJECT_NUMBER = "V2.90"
|
PROJECT_NUMBER = "V2.91"
|
||||||
|
|
||||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||||
# for a project that appears at the top of each page and should give viewer a
|
# for a project that appears at the top of each page and should give viewer a
|
||||||
|
@@ -248,7 +248,7 @@ using the ``bl_idname`` rather than the classes original name.
|
|||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
There are some exceptions to this for class names which aren't guarantee to be unique.
|
There are some exceptions to this for class names which aren't guarantee to be unique.
|
||||||
In this case use: :func:`bpy.types.Struct.bl_rna_get_subclass`.
|
In this case use: :func:`bpy.types.Struct.bl_rna_get_subclass_py`.
|
||||||
|
|
||||||
|
|
||||||
When loading a class, Blender performs sanity checks making sure all required properties and functions are found,
|
When loading a class, Blender performs sanity checks making sure all required properties and functions are found,
|
||||||
|
@@ -225,6 +225,7 @@ else:
|
|||||||
"aud",
|
"aud",
|
||||||
"bgl",
|
"bgl",
|
||||||
"blf",
|
"blf",
|
||||||
|
"bl_math",
|
||||||
"imbuf",
|
"imbuf",
|
||||||
"bmesh",
|
"bmesh",
|
||||||
"bmesh.ops",
|
"bmesh.ops",
|
||||||
@@ -695,13 +696,11 @@ def py_descr2sphinx(ident, fw, descr, module_name, type_name, identifier):
|
|||||||
doc = undocumented_message(module_name, type_name, identifier)
|
doc = undocumented_message(module_name, type_name, identifier)
|
||||||
|
|
||||||
if type(descr) == GetSetDescriptorType:
|
if type(descr) == GetSetDescriptorType:
|
||||||
fw(ident + ".. attribute:: %s\n" % identifier)
|
fw(ident + ".. attribute:: %s\n\n" % identifier)
|
||||||
fw(ident + " :noindex:\n\n")
|
|
||||||
write_indented_lines(ident + " ", fw, doc, False)
|
write_indented_lines(ident + " ", fw, doc, False)
|
||||||
fw("\n")
|
fw("\n")
|
||||||
elif type(descr) == MemberDescriptorType: # same as above but use 'data'
|
elif type(descr) == MemberDescriptorType: # same as above but use 'data'
|
||||||
fw(ident + ".. data:: %s\n" % identifier)
|
fw(ident + ".. data:: %s\n\n" % identifier)
|
||||||
fw(ident + " :noindex:\n\n")
|
|
||||||
write_indented_lines(ident + " ", fw, doc, False)
|
write_indented_lines(ident + " ", fw, doc, False)
|
||||||
fw("\n")
|
fw("\n")
|
||||||
elif type(descr) in {MethodDescriptorType, ClassMethodDescriptorType}:
|
elif type(descr) in {MethodDescriptorType, ClassMethodDescriptorType}:
|
||||||
@@ -741,14 +740,11 @@ def pyprop2sphinx(ident, fw, identifier, py_prop):
|
|||||||
'''
|
'''
|
||||||
# readonly properties use "data" directive, variables use "attribute" directive
|
# readonly properties use "data" directive, variables use "attribute" directive
|
||||||
if py_prop.fset is None:
|
if py_prop.fset is None:
|
||||||
fw(ident + ".. data:: %s\n" % identifier)
|
fw(ident + ".. data:: %s\n\n" % identifier)
|
||||||
fw(ident + " :noindex:\n\n")
|
|
||||||
else:
|
else:
|
||||||
fw(ident + ".. attribute:: %s\n" % identifier)
|
fw(ident + ".. attribute:: %s\n\n" % identifier)
|
||||||
fw(ident + " :noindex:\n\n")
|
|
||||||
write_indented_lines(ident + " ", fw, py_prop.__doc__)
|
write_indented_lines(ident + " ", fw, py_prop.__doc__)
|
||||||
if py_prop.fset is None:
|
if py_prop.fset is None:
|
||||||
fw("\n")
|
|
||||||
fw(ident + " (readonly)\n\n")
|
fw(ident + " (readonly)\n\n")
|
||||||
else:
|
else:
|
||||||
fw("\n")
|
fw("\n")
|
||||||
@@ -914,8 +910,7 @@ def pymodule2sphinx(basepath, module_name, module, title):
|
|||||||
elif issubclass(value_type, (bool, int, float, str, tuple)):
|
elif issubclass(value_type, (bool, int, float, str, tuple)):
|
||||||
# constant, not much fun we can do here except to list it.
|
# constant, not much fun we can do here except to list it.
|
||||||
# TODO, figure out some way to document these!
|
# TODO, figure out some way to document these!
|
||||||
fw(".. data:: %s\n" % attribute)
|
fw(".. data:: %s\n\n" % attribute)
|
||||||
fw(" :noindex:\n\n")
|
|
||||||
write_indented_lines(" ", fw, "constant value %s" % repr(value), False)
|
write_indented_lines(" ", fw, "constant value %s" % repr(value), False)
|
||||||
fw("\n")
|
fw("\n")
|
||||||
else:
|
else:
|
||||||
@@ -1125,8 +1120,7 @@ def pycontext2sphinx(basepath):
|
|||||||
|
|
||||||
type_descr = prop.get_type_description(
|
type_descr = prop.get_type_description(
|
||||||
class_fmt=":class:`bpy.types.%s`", collection_id=_BPY_PROP_COLLECTION_ID)
|
class_fmt=":class:`bpy.types.%s`", collection_id=_BPY_PROP_COLLECTION_ID)
|
||||||
fw(".. data:: %s\n" % prop.identifier)
|
fw(".. data:: %s\n\n" % prop.identifier)
|
||||||
fw(" :noindex:\n\n")
|
|
||||||
if prop.description:
|
if prop.description:
|
||||||
fw(" %s\n\n" % prop.description)
|
fw(" %s\n\n" % prop.description)
|
||||||
|
|
||||||
@@ -1171,8 +1165,7 @@ def pycontext2sphinx(basepath):
|
|||||||
i = 0
|
i = 0
|
||||||
while char_array[i] is not None:
|
while char_array[i] is not None:
|
||||||
member = ctypes.string_at(char_array[i]).decode(encoding="ascii")
|
member = ctypes.string_at(char_array[i]).decode(encoding="ascii")
|
||||||
fw(".. data:: %s\n" % member)
|
fw(".. data:: %s\n\n" % member)
|
||||||
fw(" :noindex:\n\n")
|
|
||||||
member_type, is_seq = context_type_map[member]
|
member_type, is_seq = context_type_map[member]
|
||||||
fw(" :type: %s :class:`bpy.types.%s`\n\n" % ("sequence of " if is_seq else "", member_type))
|
fw(" :type: %s :class:`bpy.types.%s`\n\n" % ("sequence of " if is_seq else "", member_type))
|
||||||
unique.add(member)
|
unique.add(member)
|
||||||
@@ -1378,11 +1371,9 @@ def pyrna2sphinx(basepath):
|
|||||||
type_descr = prop.get_type_description(class_fmt=":class:`%s`", collection_id=_BPY_PROP_COLLECTION_ID)
|
type_descr = prop.get_type_description(class_fmt=":class:`%s`", collection_id=_BPY_PROP_COLLECTION_ID)
|
||||||
# readonly properties use "data" directive, variables properties use "attribute" directive
|
# readonly properties use "data" directive, variables properties use "attribute" directive
|
||||||
if 'readonly' in type_descr:
|
if 'readonly' in type_descr:
|
||||||
fw(" .. data:: %s\n" % prop.identifier)
|
fw(" .. data:: %s\n\n" % prop.identifier)
|
||||||
fw(" :noindex:\n\n")
|
|
||||||
else:
|
else:
|
||||||
fw(" .. attribute:: %s\n" % prop.identifier)
|
fw(" .. attribute:: %s\n\n" % prop.identifier)
|
||||||
fw(" :noindex:\n\n")
|
|
||||||
if prop.description:
|
if prop.description:
|
||||||
fw(" %s\n\n" % prop.description)
|
fw(" %s\n\n" % prop.description)
|
||||||
|
|
||||||
@@ -1798,8 +1789,18 @@ def write_rst_contents(basepath):
|
|||||||
|
|
||||||
standalone_modules = (
|
standalone_modules = (
|
||||||
# submodules are added in parent page
|
# submodules are added in parent page
|
||||||
"mathutils", "freestyle", "bgl", "blf", "imbuf", "gpu", "gpu_extras",
|
"aud",
|
||||||
"aud", "bpy_extras", "idprop.types", "bmesh",
|
"bgl",
|
||||||
|
"bl_math",
|
||||||
|
"blf",
|
||||||
|
"bmesh",
|
||||||
|
"bpy_extras",
|
||||||
|
"freestyle",
|
||||||
|
"gpu",
|
||||||
|
"gpu_extras",
|
||||||
|
"idprop.types",
|
||||||
|
"imbuf",
|
||||||
|
"mathutils",
|
||||||
)
|
)
|
||||||
|
|
||||||
for mod in standalone_modules:
|
for mod in standalone_modules:
|
||||||
@@ -1951,6 +1952,7 @@ def write_rst_importable_modules(basepath):
|
|||||||
"mathutils.kdtree": "KDTree Utilities",
|
"mathutils.kdtree": "KDTree Utilities",
|
||||||
"mathutils.interpolate": "Interpolation Utilities",
|
"mathutils.interpolate": "Interpolation Utilities",
|
||||||
"mathutils.noise": "Noise Utilities",
|
"mathutils.noise": "Noise Utilities",
|
||||||
|
"bl_math": "Additional Math Functions",
|
||||||
"freestyle": "Freestyle Module",
|
"freestyle": "Freestyle Module",
|
||||||
"freestyle.types": "Freestyle Types",
|
"freestyle.types": "Freestyle Types",
|
||||||
"freestyle.predicates": "Freestyle Predicates",
|
"freestyle.predicates": "Freestyle Predicates",
|
||||||
|
41
extern/bullet2/patches/btPolyhedralConvexShape_Inertia_fix.patch
vendored
Normal file
41
extern/bullet2/patches/btPolyhedralConvexShape_Inertia_fix.patch
vendored
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp b/extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp
|
||||||
|
index 9095c592d87..b831e20c2f9 100644
|
||||||
|
--- a/extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp
|
||||||
|
+++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp
|
||||||
|
@@ -406,17 +406,17 @@ void btPolyhedralConvexShape::calculateLocalInertia(btScalar mass,btVector3& ine
|
||||||
|
#ifndef __SPU__
|
||||||
|
//not yet, return box inertia
|
||||||
|
|
||||||
|
- btScalar margin = getMargin();
|
||||||
|
+ //btScalar margin = getMargin();
|
||||||
|
|
||||||
|
btTransform ident;
|
||||||
|
ident.setIdentity();
|
||||||
|
btVector3 aabbMin,aabbMax;
|
||||||
|
- getAabb(ident,aabbMin,aabbMax);
|
||||||
|
+ getAabb(ident,aabbMin,aabbMax); // This already contains the margin
|
||||||
|
btVector3 halfExtents = (aabbMax-aabbMin)*btScalar(0.5);
|
||||||
|
|
||||||
|
- btScalar lx=btScalar(2.)*(halfExtents.x()+margin);
|
||||||
|
- btScalar ly=btScalar(2.)*(halfExtents.y()+margin);
|
||||||
|
- btScalar lz=btScalar(2.)*(halfExtents.z()+margin);
|
||||||
|
+ btScalar lx=btScalar(2.)*(halfExtents.x());
|
||||||
|
+ btScalar ly=btScalar(2.)*(halfExtents.y());
|
||||||
|
+ btScalar lz=btScalar(2.)*(halfExtents.z());
|
||||||
|
const btScalar x2 = lx*lx;
|
||||||
|
const btScalar y2 = ly*ly;
|
||||||
|
const btScalar z2 = lz*lz;
|
||||||
|
@@ -476,10 +476,10 @@ void btPolyhedralConvexAabbCachingShape::recalcLocalAabb()
|
||||||
|
|
||||||
|
for ( int i = 0; i < 3; ++i )
|
||||||
|
{
|
||||||
|
- m_localAabbMax[i] = _supporting[i][i] + m_collisionMargin;
|
||||||
|
- m_localAabbMin[i] = _supporting[i + 3][i] - m_collisionMargin;
|
||||||
|
+ m_localAabbMax[i] = _supporting[i][i];
|
||||||
|
+ m_localAabbMin[i] = _supporting[i + 3][i];
|
||||||
|
}
|
||||||
|
-
|
||||||
|
+
|
||||||
|
#else
|
||||||
|
|
||||||
|
for (int i=0;i<3;i++)
|
@@ -180,7 +180,7 @@ void btCompoundShape::getAabb(const btTransform& trans,btVector3& aabbMin,btVect
|
|||||||
localHalfExtents += btVector3(getMargin(),getMargin(),getMargin());
|
localHalfExtents += btVector3(getMargin(),getMargin(),getMargin());
|
||||||
|
|
||||||
|
|
||||||
btMatrix3x3 abs_b = trans.getBasis().absolute();
|
btMatrix3x3 abs_b = trans.getBasis().absolute();
|
||||||
|
|
||||||
btVector3 center = trans(localCenter);
|
btVector3 center = trans(localCenter);
|
||||||
|
|
||||||
|
@@ -406,17 +406,17 @@ void btPolyhedralConvexShape::calculateLocalInertia(btScalar mass,btVector3& ine
|
|||||||
#ifndef __SPU__
|
#ifndef __SPU__
|
||||||
//not yet, return box inertia
|
//not yet, return box inertia
|
||||||
|
|
||||||
btScalar margin = getMargin();
|
//btScalar margin = getMargin();
|
||||||
|
|
||||||
btTransform ident;
|
btTransform ident;
|
||||||
ident.setIdentity();
|
ident.setIdentity();
|
||||||
btVector3 aabbMin,aabbMax;
|
btVector3 aabbMin,aabbMax;
|
||||||
getAabb(ident,aabbMin,aabbMax);
|
getAabb(ident,aabbMin,aabbMax); // This already contains the margin
|
||||||
btVector3 halfExtents = (aabbMax-aabbMin)*btScalar(0.5);
|
btVector3 halfExtents = (aabbMax-aabbMin)*btScalar(0.5);
|
||||||
|
|
||||||
btScalar lx=btScalar(2.)*(halfExtents.x()+margin);
|
btScalar lx=btScalar(2.)*(halfExtents.x());
|
||||||
btScalar ly=btScalar(2.)*(halfExtents.y()+margin);
|
btScalar ly=btScalar(2.)*(halfExtents.y());
|
||||||
btScalar lz=btScalar(2.)*(halfExtents.z()+margin);
|
btScalar lz=btScalar(2.)*(halfExtents.z());
|
||||||
const btScalar x2 = lx*lx;
|
const btScalar x2 = lx*lx;
|
||||||
const btScalar y2 = ly*ly;
|
const btScalar y2 = ly*ly;
|
||||||
const btScalar z2 = lz*lz;
|
const btScalar z2 = lz*lz;
|
||||||
@@ -476,10 +476,10 @@ void btPolyhedralConvexAabbCachingShape::recalcLocalAabb()
|
|||||||
|
|
||||||
for ( int i = 0; i < 3; ++i )
|
for ( int i = 0; i < 3; ++i )
|
||||||
{
|
{
|
||||||
m_localAabbMax[i] = _supporting[i][i] + m_collisionMargin;
|
m_localAabbMax[i] = _supporting[i][i];
|
||||||
m_localAabbMin[i] = _supporting[i + 3][i] - m_collisionMargin;
|
m_localAabbMin[i] = _supporting[i + 3][i];
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
for (int i=0;i<3;i++)
|
for (int i=0;i<3;i++)
|
||||||
|
2
extern/cuew/src/cuew.c
vendored
2
extern/cuew/src/cuew.c
vendored
@@ -879,7 +879,7 @@ int cuewCompilerVersion(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* get --version output */
|
/* get --version output */
|
||||||
strncat(command, "\"", 1);
|
strcat(command, "\"");
|
||||||
strncat(command, path, sizeof(command) - 1);
|
strncat(command, path, sizeof(command) - 1);
|
||||||
strncat(command, "\" --version", sizeof(command) - strlen(path) - 1);
|
strncat(command, "\" --version", sizeof(command) - strlen(path) - 1);
|
||||||
pipe = popen(command, "r");
|
pipe = popen(command, "r");
|
||||||
|
64
extern/mantaflow/CMakeLists.txt
vendored
64
extern/mantaflow/CMakeLists.txt
vendored
@@ -31,19 +31,32 @@ if(MSVC_CLANG AND WITH_OPENMP AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0.1
|
|||||||
remove_cc_flag("-fopenmp")
|
remove_cc_flag("-fopenmp")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(MANTAVERSION "0.12")
|
set(MANTAVERSION "0.13")
|
||||||
|
|
||||||
add_definitions(-DWITH_FLUID=1)
|
add_definitions(-DWITH_FLUID=1)
|
||||||
|
|
||||||
set(MANTA_DEP
|
# Compile Mantaflow dependencies too (e.g. cnpy for numpy file IO).
|
||||||
dependencies
|
# Make sure that dependencies exist before enabling this option by updating the source files in extern/
|
||||||
)
|
set(WITH_MANTA_DEPENDENCIES 0)
|
||||||
|
|
||||||
|
# Enable Mantaflow numpy support
|
||||||
|
set(WITH_MANTA_NUMPY 0)
|
||||||
|
|
||||||
|
if(NOT WITH_MANTA_DEPENDENCIES)
|
||||||
|
add_definitions(-DNO_CNPY=1)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(MANTA_HLP
|
set(MANTA_HLP
|
||||||
helper
|
helper
|
||||||
)
|
)
|
||||||
set(MANTA_PP
|
set(MANTA_PP
|
||||||
preprocessed
|
preprocessed
|
||||||
)
|
)
|
||||||
|
if(WITH_MANTA_DEPENDENCIES)
|
||||||
|
set(MANTA_DEP
|
||||||
|
dependencies
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(WITH_TBB)
|
if(WITH_TBB)
|
||||||
add_definitions(-DTBB=1)
|
add_definitions(-DTBB=1)
|
||||||
@@ -62,6 +75,10 @@ if(WIN32)
|
|||||||
add_definitions(-D_USE_MATH_DEFINES)
|
add_definitions(-D_USE_MATH_DEFINES)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(WITH_MANTA_NUMPY AND WITH_PYTHON_INSTALL_NUMPY)
|
||||||
|
add_definitions(-DNUMPY=1)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(INC
|
set(INC
|
||||||
${MANTA_PP}
|
${MANTA_PP}
|
||||||
${MANTA_PP}/fileio
|
${MANTA_PP}/fileio
|
||||||
@@ -69,14 +86,25 @@ set(INC
|
|||||||
${MANTA_PP}/plugin
|
${MANTA_PP}/plugin
|
||||||
${MANTA_HLP}/pwrapper
|
${MANTA_HLP}/pwrapper
|
||||||
${MANTA_HLP}/util
|
${MANTA_HLP}/util
|
||||||
${MANTA_DEP}/cnpy
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(WITH_MANTA_DEPENDENCIES)
|
||||||
|
list(APPEND INC
|
||||||
|
${MANTA_DEP}/cnpy
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(INC_SYS
|
set(INC_SYS
|
||||||
${PYTHON_INCLUDE_DIRS}
|
${PYTHON_INCLUDE_DIRS}
|
||||||
${ZLIB_INCLUDE_DIRS}
|
${ZLIB_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(WITH_MANTA_NUMPY AND WITH_PYTHON_INSTALL_NUMPY)
|
||||||
|
list(APPEND INC_SYS
|
||||||
|
${PYTHON_NUMPY_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(WITH_TBB)
|
if(WITH_TBB)
|
||||||
list(APPEND INC_SYS
|
list(APPEND INC_SYS
|
||||||
${TBB_INCLUDE_DIRS}
|
${TBB_INCLUDE_DIRS}
|
||||||
@@ -96,9 +124,6 @@ if(WITH_OPENVDB)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(SRC
|
set(SRC
|
||||||
${MANTA_DEP}/cnpy/cnpy.cpp
|
|
||||||
${MANTA_DEP}/cnpy/cnpy.h
|
|
||||||
|
|
||||||
${MANTA_PP}/commonkernels.h
|
${MANTA_PP}/commonkernels.h
|
||||||
${MANTA_PP}/commonkernels.h.reg.cpp
|
${MANTA_PP}/commonkernels.h.reg.cpp
|
||||||
${MANTA_PP}/conjugategrad.cpp
|
${MANTA_PP}/conjugategrad.cpp
|
||||||
@@ -161,14 +186,10 @@ set(SRC
|
|||||||
${MANTA_PP}/plugin/initplugins.cpp
|
${MANTA_PP}/plugin/initplugins.cpp
|
||||||
${MANTA_PP}/plugin/kepsilon.cpp
|
${MANTA_PP}/plugin/kepsilon.cpp
|
||||||
${MANTA_PP}/plugin/meshplugins.cpp
|
${MANTA_PP}/plugin/meshplugins.cpp
|
||||||
# TODO (sebbas): add numpy to libraries
|
|
||||||
# ${MANTA_PP}/plugin/numpyconvert.cpp
|
|
||||||
${MANTA_PP}/plugin/pressure.cpp
|
${MANTA_PP}/plugin/pressure.cpp
|
||||||
${MANTA_PP}/plugin/ptsplugins.cpp
|
${MANTA_PP}/plugin/ptsplugins.cpp
|
||||||
${MANTA_PP}/plugin/secondaryparticles.cpp
|
${MANTA_PP}/plugin/secondaryparticles.cpp
|
||||||
${MANTA_PP}/plugin/surfaceturbulence.cpp
|
${MANTA_PP}/plugin/surfaceturbulence.cpp
|
||||||
# TODO (sebbas): add numpy to libraries
|
|
||||||
# ${MANTA_PP}/plugin/tfplugins.cpp
|
|
||||||
${MANTA_PP}/plugin/vortexplugins.cpp
|
${MANTA_PP}/plugin/vortexplugins.cpp
|
||||||
${MANTA_PP}/plugin/waveletturbulence.cpp
|
${MANTA_PP}/plugin/waveletturbulence.cpp
|
||||||
${MANTA_PP}/plugin/waves.cpp
|
${MANTA_PP}/plugin/waves.cpp
|
||||||
@@ -193,9 +214,6 @@ set(SRC
|
|||||||
${MANTA_PP}/vortexsheet.h.reg.cpp
|
${MANTA_PP}/vortexsheet.h.reg.cpp
|
||||||
|
|
||||||
${MANTA_HLP}/pwrapper/manta.h
|
${MANTA_HLP}/pwrapper/manta.h
|
||||||
# TODO (sebbas): add numpy to libraries
|
|
||||||
# ${MANTA_HLP}/pwrapper/numpyWrap.cpp
|
|
||||||
# ${MANTA_HLP}/pwrapper/numpyWrap.h
|
|
||||||
${MANTA_HLP}/pwrapper/pclass.cpp
|
${MANTA_HLP}/pwrapper/pclass.cpp
|
||||||
${MANTA_HLP}/pwrapper/pclass.h
|
${MANTA_HLP}/pwrapper/pclass.h
|
||||||
${MANTA_HLP}/pwrapper/pconvert.cpp
|
${MANTA_HLP}/pwrapper/pconvert.cpp
|
||||||
@@ -221,6 +239,22 @@ set(SRC
|
|||||||
${MANTA_HLP}/util/vectorbase.h
|
${MANTA_HLP}/util/vectorbase.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(WITH_MANTA_DEPENDENCIES)
|
||||||
|
list(APPEND SRC
|
||||||
|
${MANTA_DEP}/cnpy/cnpy.cpp
|
||||||
|
${MANTA_DEP}/cnpy/cnpy.h
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WITH_MANTA_NUMPY AND WITH_PYTHON_INSTALL_NUMPY)
|
||||||
|
list(APPEND SRC
|
||||||
|
${MANTA_PP}/plugin/numpyconvert.cpp
|
||||||
|
${MANTA_PP}/plugin/tfplugins.cpp
|
||||||
|
${MANTA_HLP}/pwrapper/numpyWrap.cpp
|
||||||
|
${MANTA_HLP}/pwrapper/numpyWrap.h
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(LIB
|
set(LIB
|
||||||
${PYTHON_LINKFLAGS}
|
${PYTHON_LINKFLAGS}
|
||||||
${PYTHON_LIBRARIES}
|
${PYTHON_LIBRARIES}
|
||||||
|
23
extern/mantaflow/UPDATE.sh
vendored
23
extern/mantaflow/UPDATE.sh
vendored
@@ -13,6 +13,12 @@ BLENDER_INSTALLATION=/Users/sebbas/Developer/Blender/fluid-mantaflow
|
|||||||
# Try to check out Mantaflow repository before building?
|
# Try to check out Mantaflow repository before building?
|
||||||
CLEAN_REPOSITORY=0
|
CLEAN_REPOSITORY=0
|
||||||
|
|
||||||
|
# Skip copying dependency files?
|
||||||
|
WITH_DEPENDENCIES=0
|
||||||
|
|
||||||
|
# Build with numpy support?
|
||||||
|
USE_NUMPY=0
|
||||||
|
|
||||||
# Choose which multithreading platform to use for Mantaflow preprocessing
|
# Choose which multithreading platform to use for Mantaflow preprocessing
|
||||||
USE_OMP=0
|
USE_OMP=0
|
||||||
USE_TBB=1
|
USE_TBB=1
|
||||||
@@ -50,17 +56,21 @@ fi
|
|||||||
MANTA_BUILD_PATH=$MANTA_INSTALLATION/build_blender/
|
MANTA_BUILD_PATH=$MANTA_INSTALLATION/build_blender/
|
||||||
mkdir -p $MANTA_BUILD_PATH
|
mkdir -p $MANTA_BUILD_PATH
|
||||||
cd $MANTA_BUILD_PATH
|
cd $MANTA_BUILD_PATH
|
||||||
cmake ../mantaflowgit -DGUI=OFF -DOPENMP=$USE_OMP -DTBB=$USE_TBB -DBLENDER=ON -DPREPDEBUG=ON && make -j8
|
cmake ../mantaflowgit -DGUI=0 -DOPENMP=$USE_OMP -DTBB=$USE_TBB -DBLENDER=1 -DPREPDEBUG=1 -DNUMPY=$USE_NUMPY && make -j8
|
||||||
|
|
||||||
# ==================== 3) COPY MANTAFLOW FILES TO BLENDER ROOT ===========================
|
# ==================== 3) COPY MANTAFLOW FILES TO BLENDER ROOT ===========================
|
||||||
|
|
||||||
mkdir -p $BLENDER_INSTALLATION/blender/tmp/dependencies/ && cp -Rf $MANTA_INSTALLATION/mantaflowgit/dependencies/cnpy "$_"
|
if [[ "$WITH_DEPENDENCIES" -eq "1" ]]; then
|
||||||
|
mkdir -p $BLENDER_INSTALLATION/blender/tmp/dependencies/ && cp -Rf $MANTA_INSTALLATION/mantaflowgit/dependencies/cnpy "$_"
|
||||||
|
fi
|
||||||
mkdir -p $BLENDER_INSTALLATION/blender/tmp/helper/ && cp -Rf $MANTA_INSTALLATION/mantaflowgit/source/util "$_"
|
mkdir -p $BLENDER_INSTALLATION/blender/tmp/helper/ && cp -Rf $MANTA_INSTALLATION/mantaflowgit/source/util "$_"
|
||||||
mkdir -p $BLENDER_INSTALLATION/blender/tmp/helper/ && cp -Rf $MANTA_INSTALLATION/mantaflowgit/source/pwrapper "$_"
|
mkdir -p $BLENDER_INSTALLATION/blender/tmp/helper/ && cp -Rf $MANTA_INSTALLATION/mantaflowgit/source/pwrapper "$_"
|
||||||
mkdir -p $BLENDER_INSTALLATION/blender/tmp/preprocessed/ && cp -Rf $MANTA_INSTALLATION/build_blender/pp/source/. "$_"
|
mkdir -p $BLENDER_INSTALLATION/blender/tmp/preprocessed/ && cp -Rf $MANTA_INSTALLATION/build_blender/pp/source/. "$_"
|
||||||
|
|
||||||
# Remove some files that are not need in Blender
|
# Remove some files that are not need in Blender
|
||||||
rm $BLENDER_INSTALLATION/blender/tmp/dependencies/cnpy/example1.cpp
|
if [[ "$WITH_DEPENDENCIES" -eq "1" ]]; then
|
||||||
|
rm $BLENDER_INSTALLATION/blender/tmp/dependencies/cnpy/example1.cpp
|
||||||
|
fi
|
||||||
rm $BLENDER_INSTALLATION/blender/tmp/helper/pwrapper/pymain.cpp
|
rm $BLENDER_INSTALLATION/blender/tmp/helper/pwrapper/pymain.cpp
|
||||||
rm $BLENDER_INSTALLATION/blender/tmp/preprocessed/*.reg
|
rm $BLENDER_INSTALLATION/blender/tmp/preprocessed/*.reg
|
||||||
rm $BLENDER_INSTALLATION/blender/tmp/preprocessed/python/*.reg
|
rm $BLENDER_INSTALLATION/blender/tmp/preprocessed/python/*.reg
|
||||||
@@ -82,8 +92,13 @@ BLENDER_TMP_DEP=$BLENDER_TMP/dependencies
|
|||||||
BLENDER_TMP_HLP=$BLENDER_TMP/helper
|
BLENDER_TMP_HLP=$BLENDER_TMP/helper
|
||||||
BLENDER_TMP_PP=$BLENDER_TMP/preprocessed
|
BLENDER_TMP_PP=$BLENDER_TMP/preprocessed
|
||||||
|
|
||||||
|
# Before moving new files, delete all existing file in the Blender repository
|
||||||
|
rm -Rf $BLENDER_MANTA_EXTERN/dependencies $BLENDER_MANTA_EXTERN/helper $BLENDER_MANTA_EXTERN/preprocessed
|
||||||
|
|
||||||
# Move files from tmp dir to extern/
|
# Move files from tmp dir to extern/
|
||||||
cp -Rf $BLENDER_TMP_DEP $BLENDER_MANTA_EXTERN
|
if [[ "$WITH_DEPENDENCIES" -eq "1" ]]; then
|
||||||
|
cp -Rf $BLENDER_TMP_DEP $BLENDER_MANTA_EXTERN
|
||||||
|
fi
|
||||||
cp -Rf $BLENDER_TMP_HLP $BLENDER_MANTA_EXTERN
|
cp -Rf $BLENDER_TMP_HLP $BLENDER_MANTA_EXTERN
|
||||||
cp -Rf $BLENDER_TMP_PP $BLENDER_MANTA_EXTERN
|
cp -Rf $BLENDER_TMP_PP $BLENDER_MANTA_EXTERN
|
||||||
|
|
||||||
|
21
extern/mantaflow/dependencies/cnpy/LICENSE
vendored
21
extern/mantaflow/dependencies/cnpy/LICENSE
vendored
@@ -1,21 +0,0 @@
|
|||||||
The MIT License
|
|
||||||
|
|
||||||
Copyright (c) Carl Rogers, 2011
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
385
extern/mantaflow/dependencies/cnpy/cnpy.cpp
vendored
385
extern/mantaflow/dependencies/cnpy/cnpy.cpp
vendored
@@ -1,385 +0,0 @@
|
|||||||
// Copyright (C) 2011 Carl Rogers
|
|
||||||
// Released under MIT License
|
|
||||||
// license available in LICENSE file, or at http://www.opensource.org/licenses/mit-license.php
|
|
||||||
|
|
||||||
#include "cnpy.h"
|
|
||||||
#include <complex>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cstring>
|
|
||||||
#include <iomanip>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <regex>
|
|
||||||
|
|
||||||
char cnpy::BigEndianTest()
|
|
||||||
{
|
|
||||||
int x = 1;
|
|
||||||
return (((char *)&x)[0]) ? '<' : '>';
|
|
||||||
}
|
|
||||||
|
|
||||||
char cnpy::map_type(const std::type_info &t)
|
|
||||||
{
|
|
||||||
if (t == typeid(float))
|
|
||||||
return 'f';
|
|
||||||
if (t == typeid(double))
|
|
||||||
return 'f';
|
|
||||||
if (t == typeid(long double))
|
|
||||||
return 'f';
|
|
||||||
|
|
||||||
if (t == typeid(int))
|
|
||||||
return 'i';
|
|
||||||
if (t == typeid(char))
|
|
||||||
return 'i';
|
|
||||||
if (t == typeid(short))
|
|
||||||
return 'i';
|
|
||||||
if (t == typeid(long))
|
|
||||||
return 'i';
|
|
||||||
if (t == typeid(long long))
|
|
||||||
return 'i';
|
|
||||||
|
|
||||||
if (t == typeid(unsigned char))
|
|
||||||
return 'u';
|
|
||||||
if (t == typeid(unsigned short))
|
|
||||||
return 'u';
|
|
||||||
if (t == typeid(unsigned long))
|
|
||||||
return 'u';
|
|
||||||
if (t == typeid(unsigned long long))
|
|
||||||
return 'u';
|
|
||||||
if (t == typeid(unsigned int))
|
|
||||||
return 'u';
|
|
||||||
|
|
||||||
if (t == typeid(bool))
|
|
||||||
return 'b';
|
|
||||||
|
|
||||||
if (t == typeid(std::complex<float>))
|
|
||||||
return 'c';
|
|
||||||
if (t == typeid(std::complex<double>))
|
|
||||||
return 'c';
|
|
||||||
if (t == typeid(std::complex<long double>))
|
|
||||||
return 'c';
|
|
||||||
|
|
||||||
else
|
|
||||||
return '?';
|
|
||||||
}
|
|
||||||
|
|
||||||
template<> std::vector<char> &cnpy::operator+=(std::vector<char> &lhs, const std::string rhs)
|
|
||||||
{
|
|
||||||
lhs.insert(lhs.end(), rhs.begin(), rhs.end());
|
|
||||||
return lhs;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<> std::vector<char> &cnpy::operator+=(std::vector<char> &lhs, const char *rhs)
|
|
||||||
{
|
|
||||||
// write in little endian
|
|
||||||
size_t len = strlen(rhs);
|
|
||||||
lhs.reserve(len);
|
|
||||||
for (size_t byte = 0; byte < len; byte++) {
|
|
||||||
lhs.push_back(rhs[byte]);
|
|
||||||
}
|
|
||||||
return lhs;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cnpy::parse_npy_header(unsigned char *buffer,
|
|
||||||
size_t &word_size,
|
|
||||||
std::vector<size_t> &shape,
|
|
||||||
bool &fortran_order)
|
|
||||||
{
|
|
||||||
// std::string magic_string(buffer,6);
|
|
||||||
uint8_t major_version = *reinterpret_cast<uint8_t *>(buffer + 6);
|
|
||||||
uint8_t minor_version = *reinterpret_cast<uint8_t *>(buffer + 7);
|
|
||||||
uint16_t header_len = *reinterpret_cast<uint16_t *>(buffer + 8);
|
|
||||||
std::string header(reinterpret_cast<char *>(buffer + 9), header_len);
|
|
||||||
|
|
||||||
size_t loc1, loc2;
|
|
||||||
|
|
||||||
// fortran order
|
|
||||||
loc1 = header.find("fortran_order") + 16;
|
|
||||||
fortran_order = (header.substr(loc1, 4) == "True" ? true : false);
|
|
||||||
|
|
||||||
// shape
|
|
||||||
loc1 = header.find("(");
|
|
||||||
loc2 = header.find(")");
|
|
||||||
|
|
||||||
std::regex num_regex("[0-9][0-9]*");
|
|
||||||
std::smatch sm;
|
|
||||||
shape.clear();
|
|
||||||
|
|
||||||
std::string str_shape = header.substr(loc1 + 1, loc2 - loc1 - 1);
|
|
||||||
while (std::regex_search(str_shape, sm, num_regex)) {
|
|
||||||
shape.push_back(std::stoi(sm[0].str()));
|
|
||||||
str_shape = sm.suffix().str();
|
|
||||||
}
|
|
||||||
|
|
||||||
// endian, word size, data type
|
|
||||||
// byte order code | stands for not applicable.
|
|
||||||
// not sure when this applies except for byte array
|
|
||||||
loc1 = header.find("descr") + 9;
|
|
||||||
bool littleEndian = (header[loc1] == '<' || header[loc1] == '|' ? true : false);
|
|
||||||
assert(littleEndian);
|
|
||||||
|
|
||||||
// char type = header[loc1+1];
|
|
||||||
// assert(type == map_type(T));
|
|
||||||
|
|
||||||
std::string str_ws = header.substr(loc1 + 2);
|
|
||||||
loc2 = str_ws.find("'");
|
|
||||||
word_size = atoi(str_ws.substr(0, loc2).c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void cnpy::parse_npy_header(FILE *fp,
|
|
||||||
size_t &word_size,
|
|
||||||
std::vector<size_t> &shape,
|
|
||||||
bool &fortran_order)
|
|
||||||
{
|
|
||||||
char buffer[256];
|
|
||||||
size_t res = fread(buffer, sizeof(char), 11, fp);
|
|
||||||
if (res != 11)
|
|
||||||
throw std::runtime_error("parse_npy_header: failed fread");
|
|
||||||
std::string header = fgets(buffer, 256, fp);
|
|
||||||
assert(header[header.size() - 1] == '\n');
|
|
||||||
|
|
||||||
size_t loc1, loc2;
|
|
||||||
|
|
||||||
// fortran order
|
|
||||||
loc1 = header.find("fortran_order");
|
|
||||||
if (loc1 == std::string::npos)
|
|
||||||
throw std::runtime_error("parse_npy_header: failed to find header keyword: 'fortran_order'");
|
|
||||||
loc1 += 16;
|
|
||||||
fortran_order = (header.substr(loc1, 4) == "True" ? true : false);
|
|
||||||
|
|
||||||
// shape
|
|
||||||
loc1 = header.find("(");
|
|
||||||
loc2 = header.find(")");
|
|
||||||
if (loc1 == std::string::npos || loc2 == std::string::npos)
|
|
||||||
throw std::runtime_error("parse_npy_header: failed to find header keyword: '(' or ')'");
|
|
||||||
|
|
||||||
std::regex num_regex("[0-9][0-9]*");
|
|
||||||
std::smatch sm;
|
|
||||||
shape.clear();
|
|
||||||
|
|
||||||
std::string str_shape = header.substr(loc1 + 1, loc2 - loc1 - 1);
|
|
||||||
while (std::regex_search(str_shape, sm, num_regex)) {
|
|
||||||
shape.push_back(std::stoi(sm[0].str()));
|
|
||||||
str_shape = sm.suffix().str();
|
|
||||||
}
|
|
||||||
|
|
||||||
// endian, word size, data type
|
|
||||||
// byte order code | stands for not applicable.
|
|
||||||
// not sure when this applies except for byte array
|
|
||||||
loc1 = header.find("descr");
|
|
||||||
if (loc1 == std::string::npos)
|
|
||||||
throw std::runtime_error("parse_npy_header: failed to find header keyword: 'descr'");
|
|
||||||
loc1 += 9;
|
|
||||||
bool littleEndian = (header[loc1] == '<' || header[loc1] == '|' ? true : false);
|
|
||||||
assert(littleEndian);
|
|
||||||
|
|
||||||
// char type = header[loc1+1];
|
|
||||||
// assert(type == map_type(T));
|
|
||||||
|
|
||||||
std::string str_ws = header.substr(loc1 + 2);
|
|
||||||
loc2 = str_ws.find("'");
|
|
||||||
word_size = atoi(str_ws.substr(0, loc2).c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void cnpy::parse_zip_footer(FILE *fp,
|
|
||||||
uint16_t &nrecs,
|
|
||||||
size_t &global_header_size,
|
|
||||||
size_t &global_header_offset)
|
|
||||||
{
|
|
||||||
std::vector<char> footer(22);
|
|
||||||
fseek(fp, -22, SEEK_END);
|
|
||||||
size_t res = fread(&footer[0], sizeof(char), 22, fp);
|
|
||||||
if (res != 22)
|
|
||||||
throw std::runtime_error("parse_zip_footer: failed fread");
|
|
||||||
|
|
||||||
uint16_t disk_no, disk_start, nrecs_on_disk, comment_len;
|
|
||||||
disk_no = *(uint16_t *)&footer[4];
|
|
||||||
disk_start = *(uint16_t *)&footer[6];
|
|
||||||
nrecs_on_disk = *(uint16_t *)&footer[8];
|
|
||||||
nrecs = *(uint16_t *)&footer[10];
|
|
||||||
global_header_size = *(uint32_t *)&footer[12];
|
|
||||||
global_header_offset = *(uint32_t *)&footer[16];
|
|
||||||
comment_len = *(uint16_t *)&footer[20];
|
|
||||||
|
|
||||||
assert(disk_no == 0);
|
|
||||||
assert(disk_start == 0);
|
|
||||||
assert(nrecs_on_disk == nrecs);
|
|
||||||
assert(comment_len == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
cnpy::NpyArray load_the_npy_file(FILE *fp)
|
|
||||||
{
|
|
||||||
std::vector<size_t> shape;
|
|
||||||
size_t word_size;
|
|
||||||
bool fortran_order;
|
|
||||||
cnpy::parse_npy_header(fp, word_size, shape, fortran_order);
|
|
||||||
|
|
||||||
cnpy::NpyArray arr(shape, word_size, fortran_order);
|
|
||||||
size_t nread = fread(arr.data<char>(), 1, arr.num_bytes(), fp);
|
|
||||||
if (nread != arr.num_bytes())
|
|
||||||
throw std::runtime_error("load_the_npy_file: failed fread");
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
cnpy::NpyArray load_the_npz_array(FILE *fp, uint32_t compr_bytes, uint32_t uncompr_bytes)
|
|
||||||
{
|
|
||||||
|
|
||||||
std::vector<unsigned char> buffer_compr(compr_bytes);
|
|
||||||
std::vector<unsigned char> buffer_uncompr(uncompr_bytes);
|
|
||||||
size_t nread = fread(&buffer_compr[0], 1, compr_bytes, fp);
|
|
||||||
if (nread != compr_bytes)
|
|
||||||
throw std::runtime_error("load_the_npy_file: failed fread");
|
|
||||||
|
|
||||||
int err;
|
|
||||||
z_stream d_stream;
|
|
||||||
|
|
||||||
d_stream.zalloc = Z_NULL;
|
|
||||||
d_stream.zfree = Z_NULL;
|
|
||||||
d_stream.opaque = Z_NULL;
|
|
||||||
d_stream.avail_in = 0;
|
|
||||||
d_stream.next_in = Z_NULL;
|
|
||||||
err = inflateInit2(&d_stream, -MAX_WBITS);
|
|
||||||
|
|
||||||
d_stream.avail_in = compr_bytes;
|
|
||||||
d_stream.next_in = &buffer_compr[0];
|
|
||||||
d_stream.avail_out = uncompr_bytes;
|
|
||||||
d_stream.next_out = &buffer_uncompr[0];
|
|
||||||
|
|
||||||
err = inflate(&d_stream, Z_FINISH);
|
|
||||||
err = inflateEnd(&d_stream);
|
|
||||||
|
|
||||||
std::vector<size_t> shape;
|
|
||||||
size_t word_size;
|
|
||||||
bool fortran_order;
|
|
||||||
cnpy::parse_npy_header(&buffer_uncompr[0], word_size, shape, fortran_order);
|
|
||||||
|
|
||||||
cnpy::NpyArray array(shape, word_size, fortran_order);
|
|
||||||
|
|
||||||
size_t offset = uncompr_bytes - array.num_bytes();
|
|
||||||
memcpy(array.data<unsigned char>(), &buffer_uncompr[0] + offset, array.num_bytes());
|
|
||||||
|
|
||||||
return array;
|
|
||||||
}
|
|
||||||
|
|
||||||
cnpy::npz_t cnpy::npz_load(std::string fname)
|
|
||||||
{
|
|
||||||
FILE *fp = fopen(fname.c_str(), "rb");
|
|
||||||
|
|
||||||
if (!fp) {
|
|
||||||
throw std::runtime_error("npz_load: Error! Unable to open file " + fname + "!");
|
|
||||||
}
|
|
||||||
|
|
||||||
cnpy::npz_t arrays;
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
std::vector<char> local_header(30);
|
|
||||||
size_t headerres = fread(&local_header[0], sizeof(char), 30, fp);
|
|
||||||
if (headerres != 30)
|
|
||||||
throw std::runtime_error("npz_load: failed fread");
|
|
||||||
|
|
||||||
// if we've reached the global header, stop reading
|
|
||||||
if (local_header[2] != 0x03 || local_header[3] != 0x04)
|
|
||||||
break;
|
|
||||||
|
|
||||||
// read in the variable name
|
|
||||||
uint16_t name_len = *(uint16_t *)&local_header[26];
|
|
||||||
std::string varname(name_len, ' ');
|
|
||||||
size_t vname_res = fread(&varname[0], sizeof(char), name_len, fp);
|
|
||||||
if (vname_res != name_len)
|
|
||||||
throw std::runtime_error("npz_load: failed fread");
|
|
||||||
|
|
||||||
// erase the lagging .npy
|
|
||||||
varname.erase(varname.end() - 4, varname.end());
|
|
||||||
|
|
||||||
// read in the extra field
|
|
||||||
uint16_t extra_field_len = *(uint16_t *)&local_header[28];
|
|
||||||
if (extra_field_len > 0) {
|
|
||||||
std::vector<char> buff(extra_field_len);
|
|
||||||
size_t efield_res = fread(&buff[0], sizeof(char), extra_field_len, fp);
|
|
||||||
if (efield_res != extra_field_len)
|
|
||||||
throw std::runtime_error("npz_load: failed fread");
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t compr_method = *reinterpret_cast<uint16_t *>(&local_header[0] + 8);
|
|
||||||
uint32_t compr_bytes = *reinterpret_cast<uint32_t *>(&local_header[0] + 18);
|
|
||||||
uint32_t uncompr_bytes = *reinterpret_cast<uint32_t *>(&local_header[0] + 22);
|
|
||||||
|
|
||||||
if (compr_method == 0) {
|
|
||||||
arrays[varname] = load_the_npy_file(fp);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
arrays[varname] = load_the_npz_array(fp, compr_bytes, uncompr_bytes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(fp);
|
|
||||||
return arrays;
|
|
||||||
}
|
|
||||||
|
|
||||||
cnpy::NpyArray cnpy::npz_load(std::string fname, std::string varname)
|
|
||||||
{
|
|
||||||
FILE *fp = fopen(fname.c_str(), "rb");
|
|
||||||
|
|
||||||
if (!fp)
|
|
||||||
throw std::runtime_error("npz_load: Unable to open file " + fname);
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
std::vector<char> local_header(30);
|
|
||||||
size_t header_res = fread(&local_header[0], sizeof(char), 30, fp);
|
|
||||||
if (header_res != 30)
|
|
||||||
throw std::runtime_error("npz_load: failed fread");
|
|
||||||
|
|
||||||
// if we've reached the global header, stop reading
|
|
||||||
if (local_header[2] != 0x03 || local_header[3] != 0x04)
|
|
||||||
break;
|
|
||||||
|
|
||||||
// read in the variable name
|
|
||||||
uint16_t name_len = *(uint16_t *)&local_header[26];
|
|
||||||
std::string vname(name_len, ' ');
|
|
||||||
size_t vname_res = fread(&vname[0], sizeof(char), name_len, fp);
|
|
||||||
if (vname_res != name_len)
|
|
||||||
throw std::runtime_error("npz_load: failed fread");
|
|
||||||
vname.erase(vname.end() - 4, vname.end()); // erase the lagging .npy
|
|
||||||
|
|
||||||
// read in the extra field
|
|
||||||
uint16_t extra_field_len = *(uint16_t *)&local_header[28];
|
|
||||||
fseek(fp, extra_field_len, SEEK_CUR); // skip past the extra field
|
|
||||||
|
|
||||||
uint16_t compr_method = *reinterpret_cast<uint16_t *>(&local_header[0] + 8);
|
|
||||||
uint32_t compr_bytes = *reinterpret_cast<uint32_t *>(&local_header[0] + 18);
|
|
||||||
uint32_t uncompr_bytes = *reinterpret_cast<uint32_t *>(&local_header[0] + 22);
|
|
||||||
|
|
||||||
if (vname == varname) {
|
|
||||||
NpyArray array = (compr_method == 0) ? load_the_npy_file(fp) :
|
|
||||||
load_the_npz_array(fp, compr_bytes, uncompr_bytes);
|
|
||||||
fclose(fp);
|
|
||||||
return array;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// skip past the data
|
|
||||||
// uint32_t size = *(uint32_t*) &local_header[22];
|
|
||||||
uint32_t size = *(uint32_t *)&local_header[18]; // using index 18 instead of 22 enables
|
|
||||||
// support for compressed data
|
|
||||||
fseek(fp, size, SEEK_CUR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(fp);
|
|
||||||
|
|
||||||
// if we get here, we haven't found the variable in the file
|
|
||||||
throw std::runtime_error("npz_load: Variable name " + varname + " not found in " + fname);
|
|
||||||
}
|
|
||||||
|
|
||||||
cnpy::NpyArray cnpy::npy_load(std::string fname)
|
|
||||||
{
|
|
||||||
|
|
||||||
FILE *fp = fopen(fname.c_str(), "rb");
|
|
||||||
|
|
||||||
if (!fp)
|
|
||||||
throw std::runtime_error("npy_load: Unable to open file " + fname);
|
|
||||||
|
|
||||||
NpyArray arr = load_the_npy_file(fp);
|
|
||||||
|
|
||||||
fclose(fp);
|
|
||||||
return arr;
|
|
||||||
}
|
|
310
extern/mantaflow/dependencies/cnpy/cnpy.h
vendored
310
extern/mantaflow/dependencies/cnpy/cnpy.h
vendored
@@ -1,310 +0,0 @@
|
|||||||
// Copyright (C) 2011 Carl Rogers
|
|
||||||
// Released under MIT License
|
|
||||||
// license available in LICENSE file, or at http://www.opensource.org/licenses/mit-license.php
|
|
||||||
|
|
||||||
#ifndef LIBCNPY_H_
|
|
||||||
#define LIBCNPY_H_
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <sstream>
|
|
||||||
#include <vector>
|
|
||||||
#include <cstdio>
|
|
||||||
#include <typeinfo>
|
|
||||||
#include <iostream>
|
|
||||||
#include <cassert>
|
|
||||||
#include <zlib.h>
|
|
||||||
#include <map>
|
|
||||||
#include <memory>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <numeric>
|
|
||||||
|
|
||||||
namespace cnpy {
|
|
||||||
|
|
||||||
struct NpyArray {
|
|
||||||
NpyArray(const std::vector<size_t> &_shape, size_t _word_size, bool _fortran_order)
|
|
||||||
: shape(_shape), word_size(_word_size), fortran_order(_fortran_order)
|
|
||||||
{
|
|
||||||
num_vals = 1;
|
|
||||||
for (size_t i = 0; i < shape.size(); i++)
|
|
||||||
num_vals *= shape[i];
|
|
||||||
data_holder = std::shared_ptr<std::vector<char>>(new std::vector<char>(num_vals * word_size));
|
|
||||||
}
|
|
||||||
|
|
||||||
NpyArray() : shape(0), word_size(0), fortran_order(0), num_vals(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T> T *data()
|
|
||||||
{
|
|
||||||
return reinterpret_cast<T *>(&(*data_holder)[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T> const T *data() const
|
|
||||||
{
|
|
||||||
return reinterpret_cast<T *>(&(*data_holder)[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T> std::vector<T> as_vec() const
|
|
||||||
{
|
|
||||||
const T *p = data<T>();
|
|
||||||
return std::vector<T>(p, p + num_vals);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t num_bytes() const
|
|
||||||
{
|
|
||||||
return data_holder->size();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<std::vector<char>> data_holder;
|
|
||||||
std::vector<size_t> shape;
|
|
||||||
size_t word_size;
|
|
||||||
bool fortran_order;
|
|
||||||
size_t num_vals;
|
|
||||||
};
|
|
||||||
|
|
||||||
using npz_t = std::map<std::string, NpyArray>;
|
|
||||||
|
|
||||||
char BigEndianTest();
|
|
||||||
char map_type(const std::type_info &t);
|
|
||||||
template<typename T> std::vector<char> create_npy_header(const std::vector<size_t> &shape);
|
|
||||||
void parse_npy_header(FILE *fp,
|
|
||||||
size_t &word_size,
|
|
||||||
std::vector<size_t> &shape,
|
|
||||||
bool &fortran_order);
|
|
||||||
void parse_npy_header(unsigned char *buffer,
|
|
||||||
size_t &word_size,
|
|
||||||
std::vector<size_t> &shape,
|
|
||||||
bool &fortran_order);
|
|
||||||
void parse_zip_footer(FILE *fp,
|
|
||||||
uint16_t &nrecs,
|
|
||||||
size_t &global_header_size,
|
|
||||||
size_t &global_header_offset);
|
|
||||||
npz_t npz_load(std::string fname);
|
|
||||||
NpyArray npz_load(std::string fname, std::string varname);
|
|
||||||
NpyArray npy_load(std::string fname);
|
|
||||||
|
|
||||||
template<typename T> std::vector<char> &operator+=(std::vector<char> &lhs, const T rhs)
|
|
||||||
{
|
|
||||||
// write in little endian
|
|
||||||
for (size_t byte = 0; byte < sizeof(T); byte++) {
|
|
||||||
char val = *((char *)&rhs + byte);
|
|
||||||
lhs.push_back(val);
|
|
||||||
}
|
|
||||||
return lhs;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<> std::vector<char> &operator+=(std::vector<char> &lhs, const std::string rhs);
|
|
||||||
template<> std::vector<char> &operator+=(std::vector<char> &lhs, const char *rhs);
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
void npy_save(std::string fname,
|
|
||||||
const T *data,
|
|
||||||
const std::vector<size_t> shape,
|
|
||||||
std::string mode = "w")
|
|
||||||
{
|
|
||||||
FILE *fp = NULL;
|
|
||||||
std::vector<size_t> true_data_shape; // if appending, the shape of existing + new data
|
|
||||||
|
|
||||||
if (mode == "a")
|
|
||||||
fp = fopen(fname.c_str(), "r+b");
|
|
||||||
|
|
||||||
if (fp) {
|
|
||||||
// file exists. we need to append to it. read the header, modify the array size
|
|
||||||
size_t word_size;
|
|
||||||
bool fortran_order;
|
|
||||||
parse_npy_header(fp, word_size, true_data_shape, fortran_order);
|
|
||||||
assert(!fortran_order);
|
|
||||||
|
|
||||||
if (word_size != sizeof(T)) {
|
|
||||||
std::cout << "libnpy error: " << fname << " has word size " << word_size
|
|
||||||
<< " but npy_save appending data sized " << sizeof(T) << "\n";
|
|
||||||
assert(word_size == sizeof(T));
|
|
||||||
}
|
|
||||||
if (true_data_shape.size() != shape.size()) {
|
|
||||||
std::cout << "libnpy error: npy_save attempting to append misdimensioned data to " << fname
|
|
||||||
<< "\n";
|
|
||||||
assert(true_data_shape.size() != shape.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t i = 1; i < shape.size(); i++) {
|
|
||||||
if (shape[i] != true_data_shape[i]) {
|
|
||||||
std::cout << "libnpy error: npy_save attempting to append misshaped data to " << fname
|
|
||||||
<< "\n";
|
|
||||||
assert(shape[i] == true_data_shape[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
true_data_shape[0] += shape[0];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fp = fopen(fname.c_str(), "wb");
|
|
||||||
true_data_shape = shape;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<char> header = create_npy_header<T>(true_data_shape);
|
|
||||||
size_t nels = std::accumulate(shape.begin(), shape.end(), 1, std::multiplies<size_t>());
|
|
||||||
|
|
||||||
fseek(fp, 0, SEEK_SET);
|
|
||||||
fwrite(&header[0], sizeof(char), header.size(), fp);
|
|
||||||
fseek(fp, 0, SEEK_END);
|
|
||||||
fwrite(data, sizeof(T), nels, fp);
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
void npz_save(std::string zipname,
|
|
||||||
std::string fname,
|
|
||||||
const T *data,
|
|
||||||
const std::vector<size_t> &shape,
|
|
||||||
std::string mode = "w")
|
|
||||||
{
|
|
||||||
// first, append a .npy to the fname
|
|
||||||
fname += ".npy";
|
|
||||||
|
|
||||||
// now, on with the show
|
|
||||||
FILE *fp = NULL;
|
|
||||||
uint16_t nrecs = 0;
|
|
||||||
size_t global_header_offset = 0;
|
|
||||||
std::vector<char> global_header;
|
|
||||||
|
|
||||||
if (mode == "a")
|
|
||||||
fp = fopen(zipname.c_str(), "r+b");
|
|
||||||
|
|
||||||
if (fp) {
|
|
||||||
// zip file exists. we need to add a new npy file to it.
|
|
||||||
// first read the footer. this gives us the offset and size of the global header
|
|
||||||
// then read and store the global header.
|
|
||||||
// below, we will write the the new data at the start of the global header then append the
|
|
||||||
// global header and footer below it
|
|
||||||
size_t global_header_size;
|
|
||||||
parse_zip_footer(fp, nrecs, global_header_size, global_header_offset);
|
|
||||||
fseek(fp, global_header_offset, SEEK_SET);
|
|
||||||
global_header.resize(global_header_size);
|
|
||||||
size_t res = fread(&global_header[0], sizeof(char), global_header_size, fp);
|
|
||||||
if (res != global_header_size) {
|
|
||||||
throw std::runtime_error("npz_save: header read error while adding to existing zip");
|
|
||||||
}
|
|
||||||
fseek(fp, global_header_offset, SEEK_SET);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fp = fopen(zipname.c_str(), "wb");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<char> npy_header = create_npy_header<T>(shape);
|
|
||||||
|
|
||||||
size_t nels = std::accumulate(shape.begin(), shape.end(), 1, std::multiplies<size_t>());
|
|
||||||
size_t nbytes = nels * sizeof(T) + npy_header.size();
|
|
||||||
|
|
||||||
// get the CRC of the data to be added
|
|
||||||
uint32_t crc = crc32(0L, (uint8_t *)&npy_header[0], npy_header.size());
|
|
||||||
crc = crc32(crc, (uint8_t *)data, nels * sizeof(T));
|
|
||||||
|
|
||||||
// build the local header
|
|
||||||
std::vector<char> local_header;
|
|
||||||
local_header += "PK"; // first part of sig
|
|
||||||
local_header += (uint16_t)0x0403; // second part of sig
|
|
||||||
local_header += (uint16_t)20; // min version to extract
|
|
||||||
local_header += (uint16_t)0; // general purpose bit flag
|
|
||||||
local_header += (uint16_t)0; // compression method
|
|
||||||
local_header += (uint16_t)0; // file last mod time
|
|
||||||
local_header += (uint16_t)0; // file last mod date
|
|
||||||
local_header += (uint32_t)crc; // crc
|
|
||||||
local_header += (uint32_t)nbytes; // compressed size
|
|
||||||
local_header += (uint32_t)nbytes; // uncompressed size
|
|
||||||
local_header += (uint16_t)fname.size(); // fname length
|
|
||||||
local_header += (uint16_t)0; // extra field length
|
|
||||||
local_header += fname;
|
|
||||||
|
|
||||||
// build global header
|
|
||||||
global_header += "PK"; // first part of sig
|
|
||||||
global_header += (uint16_t)0x0201; // second part of sig
|
|
||||||
global_header += (uint16_t)20; // version made by
|
|
||||||
global_header.insert(global_header.end(), local_header.begin() + 4, local_header.begin() + 30);
|
|
||||||
global_header += (uint16_t)0; // file comment length
|
|
||||||
global_header += (uint16_t)0; // disk number where file starts
|
|
||||||
global_header += (uint16_t)0; // internal file attributes
|
|
||||||
global_header += (uint32_t)0; // external file attributes
|
|
||||||
global_header += (uint32_t)
|
|
||||||
global_header_offset; // relative offset of local file header, since it begins where the
|
|
||||||
// global header used to begin
|
|
||||||
global_header += fname;
|
|
||||||
|
|
||||||
// build footer
|
|
||||||
std::vector<char> footer;
|
|
||||||
footer += "PK"; // first part of sig
|
|
||||||
footer += (uint16_t)0x0605; // second part of sig
|
|
||||||
footer += (uint16_t)0; // number of this disk
|
|
||||||
footer += (uint16_t)0; // disk where footer starts
|
|
||||||
footer += (uint16_t)(nrecs + 1); // number of records on this disk
|
|
||||||
footer += (uint16_t)(nrecs + 1); // total number of records
|
|
||||||
footer += (uint32_t)global_header.size(); // nbytes of global headers
|
|
||||||
footer += (uint32_t)(global_header_offset + nbytes +
|
|
||||||
local_header.size()); // offset of start of global headers, since global
|
|
||||||
// header now starts after newly written array
|
|
||||||
footer += (uint16_t)0; // zip file comment length
|
|
||||||
|
|
||||||
// write everything
|
|
||||||
fwrite(&local_header[0], sizeof(char), local_header.size(), fp);
|
|
||||||
fwrite(&npy_header[0], sizeof(char), npy_header.size(), fp);
|
|
||||||
fwrite(data, sizeof(T), nels, fp);
|
|
||||||
fwrite(&global_header[0], sizeof(char), global_header.size(), fp);
|
|
||||||
fwrite(&footer[0], sizeof(char), footer.size(), fp);
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
void npy_save(std::string fname, const std::vector<T> data, std::string mode = "w")
|
|
||||||
{
|
|
||||||
std::vector<size_t> shape;
|
|
||||||
shape.push_back(data.size());
|
|
||||||
npy_save(fname, &data[0], shape, mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
void npz_save(std::string zipname,
|
|
||||||
std::string fname,
|
|
||||||
const std::vector<T> data,
|
|
||||||
std::string mode = "w")
|
|
||||||
{
|
|
||||||
std::vector<size_t> shape;
|
|
||||||
shape.push_back(data.size());
|
|
||||||
npz_save(zipname, fname, &data[0], shape, mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T> std::vector<char> create_npy_header(const std::vector<size_t> &shape)
|
|
||||||
{
|
|
||||||
|
|
||||||
std::vector<char> dict;
|
|
||||||
dict += "{'descr': '";
|
|
||||||
dict += BigEndianTest();
|
|
||||||
dict += map_type(typeid(T));
|
|
||||||
dict += std::to_string(sizeof(T));
|
|
||||||
dict += "', 'fortran_order': False, 'shape': (";
|
|
||||||
dict += std::to_string(shape[0]);
|
|
||||||
for (size_t i = 1; i < shape.size(); i++) {
|
|
||||||
dict += ", ";
|
|
||||||
dict += std::to_string(shape[i]);
|
|
||||||
}
|
|
||||||
if (shape.size() == 1)
|
|
||||||
dict += ",";
|
|
||||||
dict += "), }";
|
|
||||||
// pad with spaces so that preamble+dict is modulo 16 bytes. preamble is 10 bytes. dict needs to
|
|
||||||
// end with \n
|
|
||||||
int remainder = 16 - (10 + dict.size()) % 16;
|
|
||||||
dict.insert(dict.end(), remainder, ' ');
|
|
||||||
dict.back() = '\n';
|
|
||||||
|
|
||||||
std::vector<char> header;
|
|
||||||
header += (char)0x93;
|
|
||||||
header += "NUMPY";
|
|
||||||
header += (char)0x01; // major version of numpy format
|
|
||||||
header += (char)0x00; // minor version of numpy format
|
|
||||||
header += (uint16_t)dict.size();
|
|
||||||
header.insert(header.end(), dict.begin(), dict.end());
|
|
||||||
|
|
||||||
return header;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace cnpy
|
|
||||||
|
|
||||||
#endif
|
|
42
extern/mantaflow/helper/util/vectorbase.h
vendored
42
extern/mantaflow/helper/util/vectorbase.h
vendored
@@ -248,12 +248,14 @@ template<class S> class Vector3D {
|
|||||||
protected:
|
protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
//! helper to check whether float/double value is non-zero
|
//! helper to check whether value is non-zero
|
||||||
inline bool notZero(Real f)
|
template<class S> inline bool notZero(S v)
|
||||||
{
|
{
|
||||||
if (std::abs(f) > VECTOR_EPSILON)
|
return (std::abs(v) > VECTOR_EPSILON);
|
||||||
return true;
|
}
|
||||||
return false;
|
template<class S> inline bool notZero(Vector3D<S> v)
|
||||||
|
{
|
||||||
|
return (std::abs(norm(v)) > VECTOR_EPSILON);
|
||||||
}
|
}
|
||||||
|
|
||||||
//************************************************************************
|
//************************************************************************
|
||||||
@@ -437,6 +439,36 @@ inline Real normSquare(const int v)
|
|||||||
return square(v);
|
return square(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Compute sum of all components, allow use of int, Real too
|
||||||
|
template<class S> inline S sum(const S v)
|
||||||
|
{
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
template<class S> inline S sum(const Vector3D<S> &v)
|
||||||
|
{
|
||||||
|
return v.x + v.y + v.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Get absolute representation of vector, allow use of int, Real too
|
||||||
|
inline Real abs(const Real v)
|
||||||
|
{
|
||||||
|
return std::fabs(v);
|
||||||
|
}
|
||||||
|
inline int abs(const int v)
|
||||||
|
{
|
||||||
|
return std::abs(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class S> inline Vector3D<S> abs(const Vector3D<S> &v)
|
||||||
|
{
|
||||||
|
Vector3D<S> cp(v.x, v.y, v.z);
|
||||||
|
for (int i = 0; i < 3; ++i) {
|
||||||
|
if (cp[i] < 0)
|
||||||
|
cp[i] *= (-1.0);
|
||||||
|
}
|
||||||
|
return cp;
|
||||||
|
}
|
||||||
|
|
||||||
//! Returns a normalized vector
|
//! Returns a normalized vector
|
||||||
template<class S> inline Vector3D<S> getNormalized(const Vector3D<S> &v)
|
template<class S> inline Vector3D<S> getNormalized(const Vector3D<S> &v)
|
||||||
{
|
{
|
||||||
|
43
extern/mantaflow/preprocessed/fileio/iogrids.cpp
vendored
43
extern/mantaflow/preprocessed/fileio/iogrids.cpp
vendored
@@ -27,7 +27,10 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "cnpy.h"
|
#if NO_CNPY != 1
|
||||||
|
# include "cnpy.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "mantaio.h"
|
#include "mantaio.h"
|
||||||
#include "grid.h"
|
#include "grid.h"
|
||||||
#include "vector4d.h"
|
#include "vector4d.h"
|
||||||
@@ -965,12 +968,16 @@ int readGrid4dUni(
|
|||||||
};
|
};
|
||||||
void readGrid4dUniCleanup(void **fileHandle)
|
void readGrid4dUniCleanup(void **fileHandle)
|
||||||
{
|
{
|
||||||
|
#if NO_ZLIB != 1
|
||||||
gzFile gzf = NULL;
|
gzFile gzf = NULL;
|
||||||
if (fileHandle) {
|
if (fileHandle) {
|
||||||
gzf = (gzFile)(*fileHandle);
|
gzf = (gzFile)(*fileHandle);
|
||||||
gzclose(gzf);
|
gzclose(gzf);
|
||||||
*fileHandle = NULL;
|
*fileHandle = NULL;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
debMsg("file format not supported without zlib", 1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> int writeGrid4dRaw(const string &name, Grid4d<T> *grid)
|
template<class T> int writeGrid4dRaw(const string &name, Grid4d<T> *grid)
|
||||||
@@ -1021,15 +1028,13 @@ template<class T> int readGrid4dRaw(const string &name, Grid4d<T> *grid)
|
|||||||
|
|
||||||
template<class T> int writeGridNumpy(const string &name, Grid<T> *grid)
|
template<class T> int writeGridNumpy(const string &name, Grid<T> *grid)
|
||||||
{
|
{
|
||||||
#if NO_ZLIB == 1
|
|
||||||
debMsg("file format not supported without zlib", 1);
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
#if FLOATINGPOINT_PRECISION != 1
|
#if FLOATINGPOINT_PRECISION != 1
|
||||||
errMsg("writeGridNumpy: Double precision not yet supported");
|
errMsg("writeGridNumpy: Double precision not yet supported");
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if NO_CNPY != 1
|
||||||
// find suffix to differentiate between npy <-> npz , TODO: check for actual "npy" string
|
// find suffix to differentiate between npy <-> npz , TODO: check for actual "npy" string
|
||||||
std::string::size_type idx;
|
std::string::size_type idx;
|
||||||
bool bUseNpz = false;
|
bool bUseNpz = false;
|
||||||
@@ -1075,19 +1080,21 @@ template<class T> int writeGridNumpy(const string &name, Grid<T> *grid)
|
|||||||
cnpy::npy_save(name, &grid[0], shape, "w");
|
cnpy::npy_save(name, &grid[0], shape, "w");
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
};
|
#else
|
||||||
|
debMsg("file format not supported without cnpy", 1);
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
template<class T> int readGridNumpy(const string &name, Grid<T> *grid)
|
template<class T> int readGridNumpy(const string &name, Grid<T> *grid)
|
||||||
{
|
{
|
||||||
#if NO_ZLIB == 1
|
|
||||||
debMsg("file format not supported without zlib", 1);
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
#if FLOATINGPOINT_PRECISION != 1
|
#if FLOATINGPOINT_PRECISION != 1
|
||||||
errMsg("readGridNumpy: Double precision not yet supported");
|
errMsg("readGridNumpy: Double precision not yet supported");
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if NO_CNPY != 1
|
||||||
// find suffix to differentiate between npy <-> npz
|
// find suffix to differentiate between npy <-> npz
|
||||||
std::string::size_type idx;
|
std::string::size_type idx;
|
||||||
bool bUseNpz = false;
|
bool bUseNpz = false;
|
||||||
@@ -1144,7 +1151,11 @@ template<class T> int readGridNumpy(const string &name, Grid<T> *grid)
|
|||||||
gridArr.data<T>(),
|
gridArr.data<T>(),
|
||||||
sizeof(T) * grid->getSizeX() * grid->getSizeY() * grid->getSizeZ());
|
sizeof(T) * grid->getSizeX() * grid->getSizeY() * grid->getSizeZ());
|
||||||
return 1;
|
return 1;
|
||||||
};
|
#else
|
||||||
|
debMsg("file format not supported without cnpy", 1);
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
int writeGridsNumpy(const string &name, std::vector<PbClass *> *grids)
|
int writeGridsNumpy(const string &name, std::vector<PbClass *> *grids)
|
||||||
{
|
{
|
||||||
@@ -1163,13 +1174,12 @@ void getNpzFileSize(
|
|||||||
const string &name, int &x, int &y, int &z, int *t = NULL, std::string *info = NULL)
|
const string &name, int &x, int &y, int &z, int *t = NULL, std::string *info = NULL)
|
||||||
{
|
{
|
||||||
x = y = z = 0;
|
x = y = z = 0;
|
||||||
#if NO_ZLIB != 1
|
|
||||||
debMsg("file format not supported without zlib", 1);
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
#if FLOATINGPOINT_PRECISION != 1
|
#if FLOATINGPOINT_PRECISION != 1
|
||||||
errMsg("getNpzFileSize: Double precision not yet supported");
|
errMsg("getNpzFileSize: Double precision not yet supported");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if NO_CNPY != 1
|
||||||
// find suffix to differentiate between npy <-> npz
|
// find suffix to differentiate between npy <-> npz
|
||||||
cnpy::NpyArray gridArr;
|
cnpy::NpyArray gridArr;
|
||||||
cnpy::npz_t fNpz = cnpy::npz_load(name);
|
cnpy::npz_t fNpz = cnpy::npz_load(name);
|
||||||
@@ -1180,6 +1190,9 @@ void getNpzFileSize(
|
|||||||
x = gridArr.shape[2];
|
x = gridArr.shape[2];
|
||||||
if (t)
|
if (t)
|
||||||
(*t) = 0; // unused for now
|
(*t) = 0; // unused for now
|
||||||
|
#else
|
||||||
|
debMsg("file format not supported without cnpy", 1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
Vec3 getNpzFileSize(const string &name)
|
Vec3 getNpzFileSize(const string &name)
|
||||||
{
|
{
|
||||||
|
@@ -315,10 +315,14 @@ int readObjFile(const std::string &name, Mesh *mesh, bool append)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Real dx = mesh->getParent()->getDx();
|
||||||
|
const Vec3 gs = toVec3(mesh->getParent()->getGridSize());
|
||||||
|
|
||||||
if (!append)
|
if (!append)
|
||||||
mesh->clear();
|
mesh->clear();
|
||||||
int nodebase = mesh->numNodes();
|
int nodebase = mesh->numNodes();
|
||||||
int cnt = nodebase;
|
int cntNodes = nodebase, cntNormals = nodebase;
|
||||||
|
|
||||||
while (ifs.good() && !ifs.eof()) {
|
while (ifs.good() && !ifs.eof()) {
|
||||||
string id;
|
string id;
|
||||||
ifs >> id;
|
ifs >> id;
|
||||||
@@ -333,19 +337,23 @@ int readObjFile(const std::string &name, Mesh *mesh, bool append)
|
|||||||
}
|
}
|
||||||
else if (id == "vn") {
|
else if (id == "vn") {
|
||||||
// normals
|
// normals
|
||||||
if (!mesh->numNodes()) {
|
if (mesh->numNodes() != cntNodes) {
|
||||||
errMsg("invalid amount of nodes");
|
errMsg("invalid amount of nodes");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Node n = mesh->nodes(cnt);
|
Node *n = &mesh->nodes(cntNormals);
|
||||||
ifs >> n.normal.x >> n.normal.y >> n.normal.z;
|
ifs >> n->normal.x >> n->normal.y >> n->normal.z;
|
||||||
cnt++;
|
cntNormals++;
|
||||||
}
|
}
|
||||||
else if (id == "v") {
|
else if (id == "v") {
|
||||||
// vertex
|
// vertex
|
||||||
Node n;
|
Node n;
|
||||||
ifs >> n.pos.x >> n.pos.y >> n.pos.z;
|
ifs >> n.pos.x >> n.pos.y >> n.pos.z;
|
||||||
|
// convert to grid space
|
||||||
|
n.pos /= dx;
|
||||||
|
n.pos += gs * 0.5;
|
||||||
mesh->addNode(n);
|
mesh->addNode(n);
|
||||||
|
cntNodes++;
|
||||||
}
|
}
|
||||||
else if (id == "g") {
|
else if (id == "g") {
|
||||||
// group
|
// group
|
||||||
@@ -408,7 +416,6 @@ int writeObjFile(const string &name, Mesh *mesh)
|
|||||||
// write normals
|
// write normals
|
||||||
for (int i = 0; i < numVerts; i++) {
|
for (int i = 0; i < numVerts; i++) {
|
||||||
Vector3D<float> n = toVec3f(mesh->nodes(i).normal);
|
Vector3D<float> n = toVec3f(mesh->nodes(i).normal);
|
||||||
// normalize to unit cube around 0
|
|
||||||
ofs << "vn " << n.value[0] << " " << n.value[1] << " " << n.value[2] << " "
|
ofs << "vn " << n.value[0] << " " << n.value[1] << " " << n.value[2] << " "
|
||||||
<< "\n";
|
<< "\n";
|
||||||
}
|
}
|
||||||
|
@@ -322,6 +322,7 @@ template<class T> int readPdataUni(const std::string &name, ParticleDataImpl<T>
|
|||||||
UniPartHeader head;
|
UniPartHeader head;
|
||||||
assertMsg(gzread(gzf, &head, sizeof(UniPartHeader)) == sizeof(UniPartHeader),
|
assertMsg(gzread(gzf, &head, sizeof(UniPartHeader)) == sizeof(UniPartHeader),
|
||||||
"can't read file, no header present");
|
"can't read file, no header present");
|
||||||
|
pdata->getParticleSys()->resize(head.dim); // ensure that parent particle system has same size
|
||||||
pdata->resize(head.dim);
|
pdata->resize(head.dim);
|
||||||
|
|
||||||
assertMsg(head.dim == pdata->size(), "pdata size doesn't match");
|
assertMsg(head.dim == pdata->size(), "pdata size doesn't match");
|
||||||
|
21
extern/mantaflow/preprocessed/fileio/ioutil.cpp
vendored
21
extern/mantaflow/preprocessed/fileio/ioutil.cpp
vendored
@@ -26,17 +26,18 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
# include <zlib.h>
|
# include <zlib.h>
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
# if defined(WIN32) || defined(_WIN32)
|
#if defined(WIN32) || defined(_WIN32)
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <string>
|
# include <string>
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
namespace Manta {
|
namespace Manta {
|
||||||
|
|
||||||
# if defined(WIN32) || defined(_WIN32)
|
#if defined(WIN32) || defined(_WIN32)
|
||||||
static wstring stringToWstring(const char *str)
|
static wstring stringToWstring(const char *str)
|
||||||
{
|
{
|
||||||
const int length_wc = MultiByteToWideChar(CP_UTF8, 0, str, strlen(str), NULL, 0);
|
const int length_wc = MultiByteToWideChar(CP_UTF8, 0, str, strlen(str), NULL, 0);
|
||||||
@@ -44,10 +45,11 @@ static wstring stringToWstring(const char *str)
|
|||||||
MultiByteToWideChar(CP_UTF8, 0, str, strlen(str), &strWide[0], length_wc);
|
MultiByteToWideChar(CP_UTF8, 0, str, strlen(str), &strWide[0], length_wc);
|
||||||
return strWide;
|
return strWide;
|
||||||
}
|
}
|
||||||
# endif // WIN32==1
|
#endif // WIN32==1
|
||||||
|
|
||||||
void *safeGzopen(const char *filename, const char *mode)
|
void *safeGzopen(const char *filename, const char *mode)
|
||||||
{
|
{
|
||||||
|
#if NO_ZLIB != 1
|
||||||
gzFile gzfile;
|
gzFile gzfile;
|
||||||
|
|
||||||
# if defined(WIN32) || defined(_WIN32)
|
# if defined(WIN32) || defined(_WIN32)
|
||||||
@@ -58,8 +60,11 @@ void *safeGzopen(const char *filename, const char *mode)
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
return gzfile;
|
return gzfile;
|
||||||
}
|
#else
|
||||||
|
debMsg("safeGzopen not supported without zlib", 1);
|
||||||
|
return nullptr;
|
||||||
#endif // NO_ZLIB != 1
|
#endif // NO_ZLIB != 1
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(OPENVDB)
|
#if defined(OPENVDB)
|
||||||
// Convert from OpenVDB value to Manta value.
|
// Convert from OpenVDB value to Manta value.
|
||||||
@@ -109,4 +114,4 @@ template<> void convertTo(openvdb::Vec3s *out, Vec3 &in)
|
|||||||
}
|
}
|
||||||
#endif // OPENVDB==1
|
#endif // OPENVDB==1
|
||||||
|
|
||||||
} // namespace
|
} // namespace Manta
|
||||||
|
2
extern/mantaflow/preprocessed/gitinfo.h
vendored
2
extern/mantaflow/preprocessed/gitinfo.h
vendored
@@ -1,3 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
#define MANTA_GIT_VERSION "commit d80d3c821de74315ab26b5efd153d41477b976c4"
|
#define MANTA_GIT_VERSION "commit 841bfd09c068dfb95637c0ec14fa78305286a433"
|
||||||
|
38
extern/mantaflow/preprocessed/mesh.cpp
vendored
38
extern/mantaflow/preprocessed/mesh.cpp
vendored
@@ -213,34 +213,36 @@ Mesh &Mesh::operator=(const Mesh &o)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mesh::load(string name, bool append)
|
int Mesh::load(string name, bool append)
|
||||||
{
|
{
|
||||||
if (name.find_last_of('.') == string::npos)
|
if (name.find_last_of('.') == string::npos)
|
||||||
errMsg("file '" + name + "' does not have an extension");
|
errMsg("file '" + name + "' does not have an extension");
|
||||||
string ext = name.substr(name.find_last_of('.'));
|
string ext = name.substr(name.find_last_of('.'));
|
||||||
if (ext == ".gz") // assume bobj gz
|
if (ext == ".gz") // assume bobj gz
|
||||||
readBobjFile(name, this, append);
|
return readBobjFile(name, this, append);
|
||||||
else if (ext == ".obj")
|
else if (ext == ".obj")
|
||||||
readObjFile(name, this, append);
|
return readObjFile(name, this, append);
|
||||||
else
|
else
|
||||||
errMsg("file '" + name + "' filetype not supported");
|
errMsg("file '" + name + "' filetype not supported");
|
||||||
|
|
||||||
// dont always rebuild...
|
// dont always rebuild...
|
||||||
// rebuildCorners();
|
// rebuildCorners();
|
||||||
// rebuildLookup();
|
// rebuildLookup();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mesh::save(string name)
|
int Mesh::save(string name)
|
||||||
{
|
{
|
||||||
if (name.find_last_of('.') == string::npos)
|
if (name.find_last_of('.') == string::npos)
|
||||||
errMsg("file '" + name + "' does not have an extension");
|
errMsg("file '" + name + "' does not have an extension");
|
||||||
string ext = name.substr(name.find_last_of('.'));
|
string ext = name.substr(name.find_last_of('.'));
|
||||||
if (ext == ".obj")
|
if (ext == ".obj")
|
||||||
writeObjFile(name, this);
|
return writeObjFile(name, this);
|
||||||
else if (ext == ".gz")
|
else if (ext == ".gz")
|
||||||
writeBobjFile(name, this);
|
return writeBobjFile(name, this);
|
||||||
else
|
else
|
||||||
errMsg("file '" + name + "' filetype not supported");
|
errMsg("file '" + name + "' filetype not supported");
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mesh::fromShape(Shape &shape, bool append)
|
void Mesh::fromShape(Shape &shape, bool append)
|
||||||
@@ -1339,8 +1341,8 @@ template<class T> void MeshDataImpl<T>::setSource(Grid<T> *grid, bool isMAC)
|
|||||||
{
|
{
|
||||||
mpGridSource = grid;
|
mpGridSource = grid;
|
||||||
mGridSourceMAC = isMAC;
|
mGridSourceMAC = isMAC;
|
||||||
if (isMAC)
|
if (grid && isMAC)
|
||||||
assertMsg(dynamic_cast<MACGrid *>(grid) != NULL, "Given grid is not a valid MAC grid");
|
assertMsg(grid->getType() & GridBase::TypeMAC, "Given grid is not a valid MAC grid");
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> void MeshDataImpl<T>::initNewValue(IndexInt idx, Vec3 pos)
|
template<class T> void MeshDataImpl<T>::initNewValue(IndexInt idx, Vec3 pos)
|
||||||
@@ -1371,38 +1373,40 @@ void Mesh::updateDataFields()
|
|||||||
for (size_t i = 0; i < mNodes.size(); ++i) {
|
for (size_t i = 0; i < mNodes.size(); ++i) {
|
||||||
Vec3 pos = mNodes[i].pos;
|
Vec3 pos = mNodes[i].pos;
|
||||||
for (IndexInt md = 0; md < (IndexInt)mMdataReal.size(); ++md)
|
for (IndexInt md = 0; md < (IndexInt)mMdataReal.size(); ++md)
|
||||||
mMdataReal[md]->initNewValue(i, mNodes[i].pos);
|
mMdataReal[md]->initNewValue(i, pos);
|
||||||
for (IndexInt md = 0; md < (IndexInt)mMdataVec3.size(); ++md)
|
for (IndexInt md = 0; md < (IndexInt)mMdataVec3.size(); ++md)
|
||||||
mMdataVec3[md]->initNewValue(i, mNodes[i].pos);
|
mMdataVec3[md]->initNewValue(i, pos);
|
||||||
for (IndexInt md = 0; md < (IndexInt)mMdataInt.size(); ++md)
|
for (IndexInt md = 0; md < (IndexInt)mMdataInt.size(); ++md)
|
||||||
mMdataInt[md]->initNewValue(i, mNodes[i].pos);
|
mMdataInt[md]->initNewValue(i, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> void MeshDataImpl<T>::load(string name)
|
template<typename T> int MeshDataImpl<T>::load(string name)
|
||||||
{
|
{
|
||||||
if (name.find_last_of('.') == string::npos)
|
if (name.find_last_of('.') == string::npos)
|
||||||
errMsg("file '" + name + "' does not have an extension");
|
errMsg("file '" + name + "' does not have an extension");
|
||||||
string ext = name.substr(name.find_last_of('.'));
|
string ext = name.substr(name.find_last_of('.'));
|
||||||
if (ext == ".uni")
|
if (ext == ".uni")
|
||||||
readMdataUni<T>(name, this);
|
return readMdataUni<T>(name, this);
|
||||||
else if (ext == ".raw") // raw = uni for now
|
else if (ext == ".raw") // raw = uni for now
|
||||||
readMdataUni<T>(name, this);
|
return readMdataUni<T>(name, this);
|
||||||
else
|
else
|
||||||
errMsg("mesh data '" + name + "' filetype not supported for loading");
|
errMsg("mesh data '" + name + "' filetype not supported for loading");
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> void MeshDataImpl<T>::save(string name)
|
template<typename T> int MeshDataImpl<T>::save(string name)
|
||||||
{
|
{
|
||||||
if (name.find_last_of('.') == string::npos)
|
if (name.find_last_of('.') == string::npos)
|
||||||
errMsg("file '" + name + "' does not have an extension");
|
errMsg("file '" + name + "' does not have an extension");
|
||||||
string ext = name.substr(name.find_last_of('.'));
|
string ext = name.substr(name.find_last_of('.'));
|
||||||
if (ext == ".uni")
|
if (ext == ".uni")
|
||||||
writeMdataUni<T>(name, this);
|
return writeMdataUni<T>(name, this);
|
||||||
else if (ext == ".raw") // raw = uni for now
|
else if (ext == ".raw") // raw = uni for now
|
||||||
writeMdataUni<T>(name, this);
|
return writeMdataUni<T>(name, this);
|
||||||
else
|
else
|
||||||
errMsg("mesh data '" + name + "' filetype not supported for saving");
|
errMsg("mesh data '" + name + "' filetype not supported for saving");
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// specializations
|
// specializations
|
||||||
|
127
extern/mantaflow/preprocessed/mesh.h
vendored
127
extern/mantaflow/preprocessed/mesh.h
vendored
@@ -240,35 +240,8 @@ class Mesh : public PbClass {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void load(std::string name, bool append = false);
|
|
||||||
static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
PbArgs _args(_linargs, _kwds);
|
|
||||||
Mesh *pbo = dynamic_cast<Mesh *>(Pb::objFromPy(_self));
|
|
||||||
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
|
|
||||||
pbPreparePlugin(pbo->getParent(), "Mesh::load", !noTiming);
|
|
||||||
PyObject *_retval = 0;
|
|
||||||
{
|
|
||||||
ArgLocker _lock;
|
|
||||||
std::string name = _args.get<std::string>("name", 0, &_lock);
|
|
||||||
bool append = _args.getOpt<bool>("append", 1, false, &_lock);
|
|
||||||
pbo->_args.copy(_args);
|
|
||||||
_retval = getPyNone();
|
|
||||||
pbo->load(name, append);
|
|
||||||
pbo->_args.check();
|
|
||||||
}
|
|
||||||
pbFinalizePlugin(pbo->getParent(), "Mesh::load", !noTiming);
|
|
||||||
return _retval;
|
|
||||||
}
|
|
||||||
catch (std::exception &e) {
|
|
||||||
pbSetError("Mesh::load", e.what());
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void fromShape(Shape &shape, bool append = false);
|
void fromShape(Shape &shape, bool append = false);
|
||||||
static PyObject *_W_3(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
PbArgs _args(_linargs, _kwds);
|
PbArgs _args(_linargs, _kwds);
|
||||||
@@ -294,34 +267,8 @@ class Mesh : public PbClass {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void save(std::string name);
|
|
||||||
static PyObject *_W_4(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
PbArgs _args(_linargs, _kwds);
|
|
||||||
Mesh *pbo = dynamic_cast<Mesh *>(Pb::objFromPy(_self));
|
|
||||||
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
|
|
||||||
pbPreparePlugin(pbo->getParent(), "Mesh::save", !noTiming);
|
|
||||||
PyObject *_retval = 0;
|
|
||||||
{
|
|
||||||
ArgLocker _lock;
|
|
||||||
std::string name = _args.get<std::string>("name", 0, &_lock);
|
|
||||||
pbo->_args.copy(_args);
|
|
||||||
_retval = getPyNone();
|
|
||||||
pbo->save(name);
|
|
||||||
pbo->_args.check();
|
|
||||||
}
|
|
||||||
pbFinalizePlugin(pbo->getParent(), "Mesh::save", !noTiming);
|
|
||||||
return _retval;
|
|
||||||
}
|
|
||||||
catch (std::exception &e) {
|
|
||||||
pbSetError("Mesh::save", e.what());
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void advectInGrid(FlagGrid &flags, MACGrid &vel, int integrationMode);
|
void advectInGrid(FlagGrid &flags, MACGrid &vel, int integrationMode);
|
||||||
static PyObject *_W_5(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
static PyObject *_W_3(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
PbArgs _args(_linargs, _kwds);
|
PbArgs _args(_linargs, _kwds);
|
||||||
@@ -349,7 +296,7 @@ class Mesh : public PbClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void scale(Vec3 s);
|
void scale(Vec3 s);
|
||||||
static PyObject *_W_6(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
static PyObject *_W_4(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
PbArgs _args(_linargs, _kwds);
|
PbArgs _args(_linargs, _kwds);
|
||||||
@@ -375,7 +322,7 @@ class Mesh : public PbClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void offset(Vec3 o);
|
void offset(Vec3 o);
|
||||||
static PyObject *_W_7(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
static PyObject *_W_5(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
PbArgs _args(_linargs, _kwds);
|
PbArgs _args(_linargs, _kwds);
|
||||||
@@ -401,7 +348,7 @@ class Mesh : public PbClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void rotate(Vec3 thetas);
|
void rotate(Vec3 thetas);
|
||||||
static PyObject *_W_8(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
static PyObject *_W_6(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
PbArgs _args(_linargs, _kwds);
|
PbArgs _args(_linargs, _kwds);
|
||||||
@@ -427,7 +374,7 @@ class Mesh : public PbClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void computeVelocity(Mesh &oldMesh, MACGrid &vel);
|
void computeVelocity(Mesh &oldMesh, MACGrid &vel);
|
||||||
static PyObject *_W_9(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
static PyObject *_W_7(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
PbArgs _args(_linargs, _kwds);
|
PbArgs _args(_linargs, _kwds);
|
||||||
@@ -453,6 +400,58 @@ class Mesh : public PbClass {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! file io
|
||||||
|
int load(std::string name, bool append = false);
|
||||||
|
static PyObject *_W_8(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
PbArgs _args(_linargs, _kwds);
|
||||||
|
Mesh *pbo = dynamic_cast<Mesh *>(Pb::objFromPy(_self));
|
||||||
|
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
|
||||||
|
pbPreparePlugin(pbo->getParent(), "Mesh::load", !noTiming);
|
||||||
|
PyObject *_retval = 0;
|
||||||
|
{
|
||||||
|
ArgLocker _lock;
|
||||||
|
std::string name = _args.get<std::string>("name", 0, &_lock);
|
||||||
|
bool append = _args.getOpt<bool>("append", 1, false, &_lock);
|
||||||
|
pbo->_args.copy(_args);
|
||||||
|
_retval = toPy(pbo->load(name, append));
|
||||||
|
pbo->_args.check();
|
||||||
|
}
|
||||||
|
pbFinalizePlugin(pbo->getParent(), "Mesh::load", !noTiming);
|
||||||
|
return _retval;
|
||||||
|
}
|
||||||
|
catch (std::exception &e) {
|
||||||
|
pbSetError("Mesh::load", e.what());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int save(std::string name);
|
||||||
|
static PyObject *_W_9(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
PbArgs _args(_linargs, _kwds);
|
||||||
|
Mesh *pbo = dynamic_cast<Mesh *>(Pb::objFromPy(_self));
|
||||||
|
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
|
||||||
|
pbPreparePlugin(pbo->getParent(), "Mesh::save", !noTiming);
|
||||||
|
PyObject *_retval = 0;
|
||||||
|
{
|
||||||
|
ArgLocker _lock;
|
||||||
|
std::string name = _args.get<std::string>("name", 0, &_lock);
|
||||||
|
pbo->_args.copy(_args);
|
||||||
|
_retval = toPy(pbo->save(name));
|
||||||
|
pbo->_args.check();
|
||||||
|
}
|
||||||
|
pbFinalizePlugin(pbo->getParent(), "Mesh::save", !noTiming);
|
||||||
|
return _retval;
|
||||||
|
}
|
||||||
|
catch (std::exception &e) {
|
||||||
|
pbSetError("Mesh::save", e.what());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void computeLevelset(LevelsetGrid &levelset, Real sigma, Real cutoff = -1.);
|
void computeLevelset(LevelsetGrid &levelset, Real sigma, Real cutoff = -1.);
|
||||||
static PyObject *_W_10(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
static PyObject *_W_10(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||||
{
|
{
|
||||||
@@ -1564,7 +1563,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! file io
|
//! file io
|
||||||
void save(const std::string name);
|
int save(const std::string name);
|
||||||
static PyObject *_W_41(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
static PyObject *_W_41(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -1577,8 +1576,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
|
|||||||
ArgLocker _lock;
|
ArgLocker _lock;
|
||||||
const std::string name = _args.get<std::string>("name", 0, &_lock);
|
const std::string name = _args.get<std::string>("name", 0, &_lock);
|
||||||
pbo->_args.copy(_args);
|
pbo->_args.copy(_args);
|
||||||
_retval = getPyNone();
|
_retval = toPy(pbo->save(name));
|
||||||
pbo->save(name);
|
|
||||||
pbo->_args.check();
|
pbo->_args.check();
|
||||||
}
|
}
|
||||||
pbFinalizePlugin(pbo->getParent(), "MeshDataImpl::save", !noTiming);
|
pbFinalizePlugin(pbo->getParent(), "MeshDataImpl::save", !noTiming);
|
||||||
@@ -1590,7 +1588,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void load(const std::string name);
|
int load(const std::string name);
|
||||||
static PyObject *_W_42(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
static PyObject *_W_42(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -1603,8 +1601,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
|
|||||||
ArgLocker _lock;
|
ArgLocker _lock;
|
||||||
const std::string name = _args.get<std::string>("name", 0, &_lock);
|
const std::string name = _args.get<std::string>("name", 0, &_lock);
|
||||||
pbo->_args.copy(_args);
|
pbo->_args.copy(_args);
|
||||||
_retval = getPyNone();
|
_retval = toPy(pbo->load(name));
|
||||||
pbo->load(name);
|
|
||||||
pbo->_args.check();
|
pbo->_args.check();
|
||||||
}
|
}
|
||||||
pbFinalizePlugin(pbo->getParent(), "MeshDataImpl::load", !noTiming);
|
pbFinalizePlugin(pbo->getParent(), "MeshDataImpl::load", !noTiming);
|
||||||
|
16
extern/mantaflow/preprocessed/mesh.h.reg.cpp
vendored
16
extern/mantaflow/preprocessed/mesh.h.reg.cpp
vendored
@@ -10,14 +10,14 @@ static const Pb::Register _R_12("Mesh", "Mesh", "PbClass");
|
|||||||
template<> const char *Namify<Mesh>::S = "Mesh";
|
template<> const char *Namify<Mesh>::S = "Mesh";
|
||||||
static const Pb::Register _R_13("Mesh", "Mesh", Mesh::_W_0);
|
static const Pb::Register _R_13("Mesh", "Mesh", Mesh::_W_0);
|
||||||
static const Pb::Register _R_14("Mesh", "clear", Mesh::_W_1);
|
static const Pb::Register _R_14("Mesh", "clear", Mesh::_W_1);
|
||||||
static const Pb::Register _R_15("Mesh", "load", Mesh::_W_2);
|
static const Pb::Register _R_15("Mesh", "fromShape", Mesh::_W_2);
|
||||||
static const Pb::Register _R_16("Mesh", "fromShape", Mesh::_W_3);
|
static const Pb::Register _R_16("Mesh", "advectInGrid", Mesh::_W_3);
|
||||||
static const Pb::Register _R_17("Mesh", "save", Mesh::_W_4);
|
static const Pb::Register _R_17("Mesh", "scale", Mesh::_W_4);
|
||||||
static const Pb::Register _R_18("Mesh", "advectInGrid", Mesh::_W_5);
|
static const Pb::Register _R_18("Mesh", "offset", Mesh::_W_5);
|
||||||
static const Pb::Register _R_19("Mesh", "scale", Mesh::_W_6);
|
static const Pb::Register _R_19("Mesh", "rotate", Mesh::_W_6);
|
||||||
static const Pb::Register _R_20("Mesh", "offset", Mesh::_W_7);
|
static const Pb::Register _R_20("Mesh", "computeVelocity", Mesh::_W_7);
|
||||||
static const Pb::Register _R_21("Mesh", "rotate", Mesh::_W_8);
|
static const Pb::Register _R_21("Mesh", "load", Mesh::_W_8);
|
||||||
static const Pb::Register _R_22("Mesh", "computeVelocity", Mesh::_W_9);
|
static const Pb::Register _R_22("Mesh", "save", Mesh::_W_9);
|
||||||
static const Pb::Register _R_23("Mesh", "computeLevelset", Mesh::_W_10);
|
static const Pb::Register _R_23("Mesh", "computeLevelset", Mesh::_W_10);
|
||||||
static const Pb::Register _R_24("Mesh", "getLevelset", Mesh::_W_11);
|
static const Pb::Register _R_24("Mesh", "getLevelset", Mesh::_W_11);
|
||||||
static const Pb::Register _R_25("Mesh", "applyMeshToGrid", Mesh::_W_12);
|
static const Pb::Register _R_25("Mesh", "applyMeshToGrid", Mesh::_W_12);
|
||||||
|
6
extern/mantaflow/preprocessed/particle.cpp
vendored
6
extern/mantaflow/preprocessed/particle.cpp
vendored
@@ -29,7 +29,7 @@ using namespace std;
|
|||||||
namespace Manta {
|
namespace Manta {
|
||||||
|
|
||||||
ParticleBase::ParticleBase(FluidSolver *parent)
|
ParticleBase::ParticleBase(FluidSolver *parent)
|
||||||
: PbClass(parent), mAllowCompress(true), mFreePdata(false)
|
: PbClass(parent), mMaxParticles(0), mAllowCompress(true), mFreePdata(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,8 +359,8 @@ template<class T> void ParticleDataImpl<T>::setSource(Grid<T> *grid, bool isMAC)
|
|||||||
{
|
{
|
||||||
mpGridSource = grid;
|
mpGridSource = grid;
|
||||||
mGridSourceMAC = isMAC;
|
mGridSourceMAC = isMAC;
|
||||||
if (isMAC)
|
if (grid && isMAC)
|
||||||
assertMsg(dynamic_cast<MACGrid *>(grid) != NULL, "Given grid is not a valid MAC grid");
|
assertMsg(grid->getType() & GridBase::TypeMAC, "Given grid is not a valid MAC grid");
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> void ParticleDataImpl<T>::initNewValue(IndexInt idx, Vec3 pos)
|
template<class T> void ParticleDataImpl<T>::initNewValue(IndexInt idx, Vec3 pos)
|
||||||
|
106
extern/mantaflow/preprocessed/particle.h
vendored
106
extern/mantaflow/preprocessed/particle.h
vendored
@@ -100,6 +100,17 @@ class ParticleBase : public PbClass {
|
|||||||
//! threads)
|
//! threads)
|
||||||
inline void addBuffered(const Vec3 &pos, int flag = 0);
|
inline void addBuffered(const Vec3 &pos, int flag = 0);
|
||||||
|
|
||||||
|
virtual void resize(IndexInt size)
|
||||||
|
{
|
||||||
|
assertMsg(false, "Dont use, override...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
virtual void resizeAll(IndexInt size)
|
||||||
|
{
|
||||||
|
assertMsg(false, "Dont use, override...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//! particle data functions
|
//! particle data functions
|
||||||
|
|
||||||
//! create a particle data object
|
//! create a particle data object
|
||||||
@@ -152,6 +163,20 @@ class ParticleBase : public PbClass {
|
|||||||
return mPartData[i];
|
return mPartData[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! expose maximum number of particles to python
|
||||||
|
int mMaxParticles;
|
||||||
|
static PyObject *_GET_mMaxParticles(PyObject *self, void *cl)
|
||||||
|
{
|
||||||
|
ParticleBase *pbo = dynamic_cast<ParticleBase *>(Pb::objFromPy(self));
|
||||||
|
return toPy(pbo->mMaxParticles);
|
||||||
|
}
|
||||||
|
static int _SET_mMaxParticles(PyObject *self, PyObject *val, void *cl)
|
||||||
|
{
|
||||||
|
ParticleBase *pbo = dynamic_cast<ParticleBase *>(Pb::objFromPy(self));
|
||||||
|
pbo->mMaxParticles = fromPy<int>(val);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! new particle candidates
|
//! new particle candidates
|
||||||
std::vector<Vec3> mNewBufferPos;
|
std::vector<Vec3> mNewBufferPos;
|
||||||
@@ -431,8 +456,14 @@ template<class S> class ParticleSystem : public ParticleBase {
|
|||||||
}
|
}
|
||||||
//! insert buffered positions as new particles, update additional particle data
|
//! insert buffered positions as new particles, update additional particle data
|
||||||
void insertBufferedParticles();
|
void insertBufferedParticles();
|
||||||
|
//! resize only the data vector, only use if you know what you're doing, otherwise use
|
||||||
|
//! resizeAll()
|
||||||
|
virtual void resize(IndexInt size)
|
||||||
|
{
|
||||||
|
mData.resize(size);
|
||||||
|
}
|
||||||
//! resize data vector, and all pdata fields
|
//! resize data vector, and all pdata fields
|
||||||
void resizeAll(IndexInt newsize);
|
virtual void resizeAll(IndexInt size);
|
||||||
|
|
||||||
//! adding and deleting
|
//! adding and deleting
|
||||||
inline void kill(IndexInt idx);
|
inline void kill(IndexInt idx);
|
||||||
@@ -877,11 +908,6 @@ class ParticleIndexSystem : public ParticleSystem<ParticleIndexData> {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
//! we only need a resize function...
|
|
||||||
void resize(IndexInt size)
|
|
||||||
{
|
|
||||||
mData.resize(size);
|
|
||||||
}
|
|
||||||
public:
|
public:
|
||||||
PbArgs _args;
|
PbArgs _args;
|
||||||
}
|
}
|
||||||
@@ -2479,28 +2505,66 @@ template<class S> void ParticleSystem<S>::insertBufferedParticles()
|
|||||||
for (IndexInt i = 0; i < (IndexInt)mData.size(); ++i)
|
for (IndexInt i = 0; i < (IndexInt)mData.size(); ++i)
|
||||||
mData[i].flag &= ~PNEW;
|
mData[i].flag &= ~PNEW;
|
||||||
|
|
||||||
if (mNewBufferPos.size() == 0)
|
if (mNewBufferPos.empty())
|
||||||
return;
|
return;
|
||||||
IndexInt newCnt = mData.size();
|
IndexInt bufferSize = mNewBufferPos.size();
|
||||||
resizeAll(newCnt + mNewBufferPos.size());
|
IndexInt partsSize = mData.size();
|
||||||
|
|
||||||
|
if (mMaxParticles > 0)
|
||||||
|
assertMsg(mMaxParticles >= partsSize,
|
||||||
|
"Particle system cannot contain more particles that the maximum allowed number");
|
||||||
|
|
||||||
|
// max number of new particles that can be inserted, adjusted buffer size when using maxParticles
|
||||||
|
// field
|
||||||
|
IndexInt numNewParts = (mMaxParticles > 0) ? mMaxParticles - mData.size() : bufferSize;
|
||||||
|
if (numNewParts > bufferSize)
|
||||||
|
numNewParts = bufferSize; // upper clamp
|
||||||
|
|
||||||
|
assertMsg(numNewParts >= 0, "Must not have negative number of new particles");
|
||||||
|
|
||||||
|
// new size of particle system
|
||||||
|
IndexInt newSize = mData.size() + numNewParts;
|
||||||
|
if (mMaxParticles > 0)
|
||||||
|
assertMsg(newSize <= mMaxParticles,
|
||||||
|
"Particle system cannot contain more particles that the maximum allowed number");
|
||||||
|
resizeAll(newSize);
|
||||||
|
|
||||||
|
int insertFlag;
|
||||||
|
Vec3 insertPos;
|
||||||
|
static RandomStream mRand(9832);
|
||||||
|
for (IndexInt i = 0; i < numNewParts; ++i) {
|
||||||
|
|
||||||
|
// get random index in newBuffer vector
|
||||||
|
// we are inserting particles randomly so that they are sampled uniformly in the fluid region
|
||||||
|
// otherwise, regions of fluid can remain completely empty once mData.size() == maxParticles is
|
||||||
|
// reached.
|
||||||
|
int randIndex = floor(mRand.getReal() * mNewBufferPos.size());
|
||||||
|
|
||||||
|
// get elements from new buffers with random index
|
||||||
|
std::swap(mNewBufferPos[randIndex], mNewBufferPos.back());
|
||||||
|
insertPos = mNewBufferPos.back();
|
||||||
|
mNewBufferPos.pop_back();
|
||||||
|
|
||||||
|
insertFlag = 0;
|
||||||
|
if (!mNewBufferFlag.empty()) {
|
||||||
|
std::swap(mNewBufferFlag[randIndex], mNewBufferFlag.back());
|
||||||
|
insertFlag = mNewBufferFlag.back();
|
||||||
|
mNewBufferFlag.pop_back();
|
||||||
|
}
|
||||||
|
|
||||||
|
mData[partsSize].pos = insertPos;
|
||||||
|
mData[partsSize].flag = PNEW | insertFlag;
|
||||||
|
|
||||||
for (IndexInt i = 0; i < (IndexInt)mNewBufferPos.size(); ++i) {
|
|
||||||
int flag = (mNewBufferFlag.size() > 0) ? mNewBufferFlag[i] : 0;
|
|
||||||
// note, other fields are not initialized here...
|
|
||||||
mData[newCnt].pos = mNewBufferPos[i];
|
|
||||||
mData[newCnt].flag = PNEW | flag;
|
|
||||||
// now init pdata fields from associated grids...
|
// now init pdata fields from associated grids...
|
||||||
for (IndexInt pd = 0; pd < (IndexInt)mPdataReal.size(); ++pd)
|
for (IndexInt pd = 0; pd < (IndexInt)mPdataReal.size(); ++pd)
|
||||||
mPdataReal[pd]->initNewValue(newCnt, mNewBufferPos[i]);
|
mPdataReal[pd]->initNewValue(partsSize, insertPos);
|
||||||
for (IndexInt pd = 0; pd < (IndexInt)mPdataVec3.size(); ++pd)
|
for (IndexInt pd = 0; pd < (IndexInt)mPdataVec3.size(); ++pd)
|
||||||
mPdataVec3[pd]->initNewValue(newCnt, mNewBufferPos[i]);
|
mPdataVec3[pd]->initNewValue(partsSize, insertPos);
|
||||||
for (IndexInt pd = 0; pd < (IndexInt)mPdataInt.size(); ++pd)
|
for (IndexInt pd = 0; pd < (IndexInt)mPdataInt.size(); ++pd)
|
||||||
mPdataInt[pd]->initNewValue(newCnt, mNewBufferPos[i]);
|
mPdataInt[pd]->initNewValue(partsSize, insertPos);
|
||||||
newCnt++;
|
partsSize++;
|
||||||
}
|
}
|
||||||
if (mNewBufferPos.size() > 0)
|
debMsg("Added & initialized " << numNewParts << " particles", 2); // debug info
|
||||||
debMsg("Added & initialized " << (IndexInt)mNewBufferPos.size() << " particles",
|
|
||||||
2); // debug info
|
|
||||||
mNewBufferPos.clear();
|
mNewBufferPos.clear();
|
||||||
mNewBufferFlag.clear();
|
mNewBufferFlag.clear();
|
||||||
}
|
}
|
||||||
|
227
extern/mantaflow/preprocessed/particle.h.reg.cpp
vendored
227
extern/mantaflow/preprocessed/particle.h.reg.cpp
vendored
@@ -29,279 +29,283 @@ static const Pb::Register _R_21("ParticleBase", "ParticleBase", "PbClass");
|
|||||||
template<> const char *Namify<ParticleBase>::S = "ParticleBase";
|
template<> const char *Namify<ParticleBase>::S = "ParticleBase";
|
||||||
static const Pb::Register _R_22("ParticleBase", "ParticleBase", ParticleBase::_W_0);
|
static const Pb::Register _R_22("ParticleBase", "ParticleBase", ParticleBase::_W_0);
|
||||||
static const Pb::Register _R_23("ParticleBase", "create", ParticleBase::_W_1);
|
static const Pb::Register _R_23("ParticleBase", "create", ParticleBase::_W_1);
|
||||||
|
static const Pb::Register _R_24("ParticleBase",
|
||||||
|
"maxParticles",
|
||||||
|
ParticleBase::_GET_mMaxParticles,
|
||||||
|
ParticleBase::_SET_mMaxParticles);
|
||||||
#endif
|
#endif
|
||||||
#ifdef _C_ParticleDataBase
|
#ifdef _C_ParticleDataBase
|
||||||
static const Pb::Register _R_24("ParticleDataBase", "ParticleDataBase", "PbClass");
|
static const Pb::Register _R_25("ParticleDataBase", "ParticleDataBase", "PbClass");
|
||||||
template<> const char *Namify<ParticleDataBase>::S = "ParticleDataBase";
|
template<> const char *Namify<ParticleDataBase>::S = "ParticleDataBase";
|
||||||
static const Pb::Register _R_25("ParticleDataBase", "ParticleDataBase", ParticleDataBase::_W_21);
|
static const Pb::Register _R_26("ParticleDataBase", "ParticleDataBase", ParticleDataBase::_W_21);
|
||||||
#endif
|
#endif
|
||||||
#ifdef _C_ParticleDataImpl
|
#ifdef _C_ParticleDataImpl
|
||||||
static const Pb::Register _R_26("ParticleDataImpl<int>",
|
static const Pb::Register _R_27("ParticleDataImpl<int>",
|
||||||
"ParticleDataImpl<int>",
|
"ParticleDataImpl<int>",
|
||||||
"ParticleDataBase");
|
"ParticleDataBase");
|
||||||
template<> const char *Namify<ParticleDataImpl<int>>::S = "ParticleDataImpl<int>";
|
template<> const char *Namify<ParticleDataImpl<int>>::S = "ParticleDataImpl<int>";
|
||||||
static const Pb::Register _R_27("ParticleDataImpl<int>",
|
static const Pb::Register _R_28("ParticleDataImpl<int>",
|
||||||
"ParticleDataImpl",
|
"ParticleDataImpl",
|
||||||
ParticleDataImpl<int>::_W_22);
|
ParticleDataImpl<int>::_W_22);
|
||||||
static const Pb::Register _R_28("ParticleDataImpl<int>", "clear", ParticleDataImpl<int>::_W_23);
|
static const Pb::Register _R_29("ParticleDataImpl<int>", "clear", ParticleDataImpl<int>::_W_23);
|
||||||
static const Pb::Register _R_29("ParticleDataImpl<int>",
|
static const Pb::Register _R_30("ParticleDataImpl<int>",
|
||||||
"setSource",
|
"setSource",
|
||||||
ParticleDataImpl<int>::_W_24);
|
ParticleDataImpl<int>::_W_24);
|
||||||
static const Pb::Register _R_30("ParticleDataImpl<int>", "copyFrom", ParticleDataImpl<int>::_W_25);
|
static const Pb::Register _R_31("ParticleDataImpl<int>", "copyFrom", ParticleDataImpl<int>::_W_25);
|
||||||
static const Pb::Register _R_31("ParticleDataImpl<int>", "setConst", ParticleDataImpl<int>::_W_26);
|
static const Pb::Register _R_32("ParticleDataImpl<int>", "setConst", ParticleDataImpl<int>::_W_26);
|
||||||
static const Pb::Register _R_32("ParticleDataImpl<int>",
|
static const Pb::Register _R_33("ParticleDataImpl<int>",
|
||||||
"setConstRange",
|
"setConstRange",
|
||||||
ParticleDataImpl<int>::_W_27);
|
ParticleDataImpl<int>::_W_27);
|
||||||
static const Pb::Register _R_33("ParticleDataImpl<int>", "add", ParticleDataImpl<int>::_W_28);
|
static const Pb::Register _R_34("ParticleDataImpl<int>", "add", ParticleDataImpl<int>::_W_28);
|
||||||
static const Pb::Register _R_34("ParticleDataImpl<int>", "sub", ParticleDataImpl<int>::_W_29);
|
static const Pb::Register _R_35("ParticleDataImpl<int>", "sub", ParticleDataImpl<int>::_W_29);
|
||||||
static const Pb::Register _R_35("ParticleDataImpl<int>", "addConst", ParticleDataImpl<int>::_W_30);
|
static const Pb::Register _R_36("ParticleDataImpl<int>", "addConst", ParticleDataImpl<int>::_W_30);
|
||||||
static const Pb::Register _R_36("ParticleDataImpl<int>",
|
static const Pb::Register _R_37("ParticleDataImpl<int>",
|
||||||
"addScaled",
|
"addScaled",
|
||||||
ParticleDataImpl<int>::_W_31);
|
ParticleDataImpl<int>::_W_31);
|
||||||
static const Pb::Register _R_37("ParticleDataImpl<int>", "mult", ParticleDataImpl<int>::_W_32);
|
static const Pb::Register _R_38("ParticleDataImpl<int>", "mult", ParticleDataImpl<int>::_W_32);
|
||||||
static const Pb::Register _R_38("ParticleDataImpl<int>",
|
static const Pb::Register _R_39("ParticleDataImpl<int>",
|
||||||
"multConst",
|
"multConst",
|
||||||
ParticleDataImpl<int>::_W_33);
|
ParticleDataImpl<int>::_W_33);
|
||||||
static const Pb::Register _R_39("ParticleDataImpl<int>", "safeDiv", ParticleDataImpl<int>::_W_34);
|
static const Pb::Register _R_40("ParticleDataImpl<int>", "safeDiv", ParticleDataImpl<int>::_W_34);
|
||||||
static const Pb::Register _R_40("ParticleDataImpl<int>", "clamp", ParticleDataImpl<int>::_W_35);
|
static const Pb::Register _R_41("ParticleDataImpl<int>", "clamp", ParticleDataImpl<int>::_W_35);
|
||||||
static const Pb::Register _R_41("ParticleDataImpl<int>", "clampMin", ParticleDataImpl<int>::_W_36);
|
static const Pb::Register _R_42("ParticleDataImpl<int>", "clampMin", ParticleDataImpl<int>::_W_36);
|
||||||
static const Pb::Register _R_42("ParticleDataImpl<int>", "clampMax", ParticleDataImpl<int>::_W_37);
|
static const Pb::Register _R_43("ParticleDataImpl<int>", "clampMax", ParticleDataImpl<int>::_W_37);
|
||||||
static const Pb::Register _R_43("ParticleDataImpl<int>",
|
static const Pb::Register _R_44("ParticleDataImpl<int>",
|
||||||
"getMaxAbs",
|
"getMaxAbs",
|
||||||
ParticleDataImpl<int>::_W_38);
|
ParticleDataImpl<int>::_W_38);
|
||||||
static const Pb::Register _R_44("ParticleDataImpl<int>", "getMax", ParticleDataImpl<int>::_W_39);
|
static const Pb::Register _R_45("ParticleDataImpl<int>", "getMax", ParticleDataImpl<int>::_W_39);
|
||||||
static const Pb::Register _R_45("ParticleDataImpl<int>", "getMin", ParticleDataImpl<int>::_W_40);
|
static const Pb::Register _R_46("ParticleDataImpl<int>", "getMin", ParticleDataImpl<int>::_W_40);
|
||||||
static const Pb::Register _R_46("ParticleDataImpl<int>", "sum", ParticleDataImpl<int>::_W_41);
|
static const Pb::Register _R_47("ParticleDataImpl<int>", "sum", ParticleDataImpl<int>::_W_41);
|
||||||
static const Pb::Register _R_47("ParticleDataImpl<int>",
|
static const Pb::Register _R_48("ParticleDataImpl<int>",
|
||||||
"sumSquare",
|
"sumSquare",
|
||||||
ParticleDataImpl<int>::_W_42);
|
ParticleDataImpl<int>::_W_42);
|
||||||
static const Pb::Register _R_48("ParticleDataImpl<int>",
|
static const Pb::Register _R_49("ParticleDataImpl<int>",
|
||||||
"sumMagnitude",
|
"sumMagnitude",
|
||||||
ParticleDataImpl<int>::_W_43);
|
ParticleDataImpl<int>::_W_43);
|
||||||
static const Pb::Register _R_49("ParticleDataImpl<int>",
|
static const Pb::Register _R_50("ParticleDataImpl<int>",
|
||||||
"setConstIntFlag",
|
"setConstIntFlag",
|
||||||
ParticleDataImpl<int>::_W_44);
|
ParticleDataImpl<int>::_W_44);
|
||||||
static const Pb::Register _R_50("ParticleDataImpl<int>",
|
static const Pb::Register _R_51("ParticleDataImpl<int>",
|
||||||
"printPdata",
|
"printPdata",
|
||||||
ParticleDataImpl<int>::_W_45);
|
ParticleDataImpl<int>::_W_45);
|
||||||
static const Pb::Register _R_51("ParticleDataImpl<int>", "save", ParticleDataImpl<int>::_W_46);
|
static const Pb::Register _R_52("ParticleDataImpl<int>", "save", ParticleDataImpl<int>::_W_46);
|
||||||
static const Pb::Register _R_52("ParticleDataImpl<int>", "load", ParticleDataImpl<int>::_W_47);
|
static const Pb::Register _R_53("ParticleDataImpl<int>", "load", ParticleDataImpl<int>::_W_47);
|
||||||
static const Pb::Register _R_53("ParticleDataImpl<int>",
|
static const Pb::Register _R_54("ParticleDataImpl<int>",
|
||||||
"getDataPointer",
|
"getDataPointer",
|
||||||
ParticleDataImpl<int>::_W_48);
|
ParticleDataImpl<int>::_W_48);
|
||||||
static const Pb::Register _R_54("ParticleDataImpl<Real>",
|
static const Pb::Register _R_55("ParticleDataImpl<Real>",
|
||||||
"ParticleDataImpl<Real>",
|
"ParticleDataImpl<Real>",
|
||||||
"ParticleDataBase");
|
"ParticleDataBase");
|
||||||
template<> const char *Namify<ParticleDataImpl<Real>>::S = "ParticleDataImpl<Real>";
|
template<> const char *Namify<ParticleDataImpl<Real>>::S = "ParticleDataImpl<Real>";
|
||||||
static const Pb::Register _R_55("ParticleDataImpl<Real>",
|
static const Pb::Register _R_56("ParticleDataImpl<Real>",
|
||||||
"ParticleDataImpl",
|
"ParticleDataImpl",
|
||||||
ParticleDataImpl<Real>::_W_22);
|
ParticleDataImpl<Real>::_W_22);
|
||||||
static const Pb::Register _R_56("ParticleDataImpl<Real>", "clear", ParticleDataImpl<Real>::_W_23);
|
static const Pb::Register _R_57("ParticleDataImpl<Real>", "clear", ParticleDataImpl<Real>::_W_23);
|
||||||
static const Pb::Register _R_57("ParticleDataImpl<Real>",
|
static const Pb::Register _R_58("ParticleDataImpl<Real>",
|
||||||
"setSource",
|
"setSource",
|
||||||
ParticleDataImpl<Real>::_W_24);
|
ParticleDataImpl<Real>::_W_24);
|
||||||
static const Pb::Register _R_58("ParticleDataImpl<Real>",
|
static const Pb::Register _R_59("ParticleDataImpl<Real>",
|
||||||
"copyFrom",
|
"copyFrom",
|
||||||
ParticleDataImpl<Real>::_W_25);
|
ParticleDataImpl<Real>::_W_25);
|
||||||
static const Pb::Register _R_59("ParticleDataImpl<Real>",
|
static const Pb::Register _R_60("ParticleDataImpl<Real>",
|
||||||
"setConst",
|
"setConst",
|
||||||
ParticleDataImpl<Real>::_W_26);
|
ParticleDataImpl<Real>::_W_26);
|
||||||
static const Pb::Register _R_60("ParticleDataImpl<Real>",
|
static const Pb::Register _R_61("ParticleDataImpl<Real>",
|
||||||
"setConstRange",
|
"setConstRange",
|
||||||
ParticleDataImpl<Real>::_W_27);
|
ParticleDataImpl<Real>::_W_27);
|
||||||
static const Pb::Register _R_61("ParticleDataImpl<Real>", "add", ParticleDataImpl<Real>::_W_28);
|
static const Pb::Register _R_62("ParticleDataImpl<Real>", "add", ParticleDataImpl<Real>::_W_28);
|
||||||
static const Pb::Register _R_62("ParticleDataImpl<Real>", "sub", ParticleDataImpl<Real>::_W_29);
|
static const Pb::Register _R_63("ParticleDataImpl<Real>", "sub", ParticleDataImpl<Real>::_W_29);
|
||||||
static const Pb::Register _R_63("ParticleDataImpl<Real>",
|
static const Pb::Register _R_64("ParticleDataImpl<Real>",
|
||||||
"addConst",
|
"addConst",
|
||||||
ParticleDataImpl<Real>::_W_30);
|
ParticleDataImpl<Real>::_W_30);
|
||||||
static const Pb::Register _R_64("ParticleDataImpl<Real>",
|
static const Pb::Register _R_65("ParticleDataImpl<Real>",
|
||||||
"addScaled",
|
"addScaled",
|
||||||
ParticleDataImpl<Real>::_W_31);
|
ParticleDataImpl<Real>::_W_31);
|
||||||
static const Pb::Register _R_65("ParticleDataImpl<Real>", "mult", ParticleDataImpl<Real>::_W_32);
|
static const Pb::Register _R_66("ParticleDataImpl<Real>", "mult", ParticleDataImpl<Real>::_W_32);
|
||||||
static const Pb::Register _R_66("ParticleDataImpl<Real>",
|
static const Pb::Register _R_67("ParticleDataImpl<Real>",
|
||||||
"multConst",
|
"multConst",
|
||||||
ParticleDataImpl<Real>::_W_33);
|
ParticleDataImpl<Real>::_W_33);
|
||||||
static const Pb::Register _R_67("ParticleDataImpl<Real>",
|
static const Pb::Register _R_68("ParticleDataImpl<Real>",
|
||||||
"safeDiv",
|
"safeDiv",
|
||||||
ParticleDataImpl<Real>::_W_34);
|
ParticleDataImpl<Real>::_W_34);
|
||||||
static const Pb::Register _R_68("ParticleDataImpl<Real>", "clamp", ParticleDataImpl<Real>::_W_35);
|
static const Pb::Register _R_69("ParticleDataImpl<Real>", "clamp", ParticleDataImpl<Real>::_W_35);
|
||||||
static const Pb::Register _R_69("ParticleDataImpl<Real>",
|
static const Pb::Register _R_70("ParticleDataImpl<Real>",
|
||||||
"clampMin",
|
"clampMin",
|
||||||
ParticleDataImpl<Real>::_W_36);
|
ParticleDataImpl<Real>::_W_36);
|
||||||
static const Pb::Register _R_70("ParticleDataImpl<Real>",
|
static const Pb::Register _R_71("ParticleDataImpl<Real>",
|
||||||
"clampMax",
|
"clampMax",
|
||||||
ParticleDataImpl<Real>::_W_37);
|
ParticleDataImpl<Real>::_W_37);
|
||||||
static const Pb::Register _R_71("ParticleDataImpl<Real>",
|
static const Pb::Register _R_72("ParticleDataImpl<Real>",
|
||||||
"getMaxAbs",
|
"getMaxAbs",
|
||||||
ParticleDataImpl<Real>::_W_38);
|
ParticleDataImpl<Real>::_W_38);
|
||||||
static const Pb::Register _R_72("ParticleDataImpl<Real>", "getMax", ParticleDataImpl<Real>::_W_39);
|
static const Pb::Register _R_73("ParticleDataImpl<Real>", "getMax", ParticleDataImpl<Real>::_W_39);
|
||||||
static const Pb::Register _R_73("ParticleDataImpl<Real>", "getMin", ParticleDataImpl<Real>::_W_40);
|
static const Pb::Register _R_74("ParticleDataImpl<Real>", "getMin", ParticleDataImpl<Real>::_W_40);
|
||||||
static const Pb::Register _R_74("ParticleDataImpl<Real>", "sum", ParticleDataImpl<Real>::_W_41);
|
static const Pb::Register _R_75("ParticleDataImpl<Real>", "sum", ParticleDataImpl<Real>::_W_41);
|
||||||
static const Pb::Register _R_75("ParticleDataImpl<Real>",
|
static const Pb::Register _R_76("ParticleDataImpl<Real>",
|
||||||
"sumSquare",
|
"sumSquare",
|
||||||
ParticleDataImpl<Real>::_W_42);
|
ParticleDataImpl<Real>::_W_42);
|
||||||
static const Pb::Register _R_76("ParticleDataImpl<Real>",
|
static const Pb::Register _R_77("ParticleDataImpl<Real>",
|
||||||
"sumMagnitude",
|
"sumMagnitude",
|
||||||
ParticleDataImpl<Real>::_W_43);
|
ParticleDataImpl<Real>::_W_43);
|
||||||
static const Pb::Register _R_77("ParticleDataImpl<Real>",
|
static const Pb::Register _R_78("ParticleDataImpl<Real>",
|
||||||
"setConstIntFlag",
|
"setConstIntFlag",
|
||||||
ParticleDataImpl<Real>::_W_44);
|
ParticleDataImpl<Real>::_W_44);
|
||||||
static const Pb::Register _R_78("ParticleDataImpl<Real>",
|
static const Pb::Register _R_79("ParticleDataImpl<Real>",
|
||||||
"printPdata",
|
"printPdata",
|
||||||
ParticleDataImpl<Real>::_W_45);
|
ParticleDataImpl<Real>::_W_45);
|
||||||
static const Pb::Register _R_79("ParticleDataImpl<Real>", "save", ParticleDataImpl<Real>::_W_46);
|
static const Pb::Register _R_80("ParticleDataImpl<Real>", "save", ParticleDataImpl<Real>::_W_46);
|
||||||
static const Pb::Register _R_80("ParticleDataImpl<Real>", "load", ParticleDataImpl<Real>::_W_47);
|
static const Pb::Register _R_81("ParticleDataImpl<Real>", "load", ParticleDataImpl<Real>::_W_47);
|
||||||
static const Pb::Register _R_81("ParticleDataImpl<Real>",
|
static const Pb::Register _R_82("ParticleDataImpl<Real>",
|
||||||
"getDataPointer",
|
"getDataPointer",
|
||||||
ParticleDataImpl<Real>::_W_48);
|
ParticleDataImpl<Real>::_W_48);
|
||||||
static const Pb::Register _R_82("ParticleDataImpl<Vec3>",
|
static const Pb::Register _R_83("ParticleDataImpl<Vec3>",
|
||||||
"ParticleDataImpl<Vec3>",
|
"ParticleDataImpl<Vec3>",
|
||||||
"ParticleDataBase");
|
"ParticleDataBase");
|
||||||
template<> const char *Namify<ParticleDataImpl<Vec3>>::S = "ParticleDataImpl<Vec3>";
|
template<> const char *Namify<ParticleDataImpl<Vec3>>::S = "ParticleDataImpl<Vec3>";
|
||||||
static const Pb::Register _R_83("ParticleDataImpl<Vec3>",
|
static const Pb::Register _R_84("ParticleDataImpl<Vec3>",
|
||||||
"ParticleDataImpl",
|
"ParticleDataImpl",
|
||||||
ParticleDataImpl<Vec3>::_W_22);
|
ParticleDataImpl<Vec3>::_W_22);
|
||||||
static const Pb::Register _R_84("ParticleDataImpl<Vec3>", "clear", ParticleDataImpl<Vec3>::_W_23);
|
static const Pb::Register _R_85("ParticleDataImpl<Vec3>", "clear", ParticleDataImpl<Vec3>::_W_23);
|
||||||
static const Pb::Register _R_85("ParticleDataImpl<Vec3>",
|
static const Pb::Register _R_86("ParticleDataImpl<Vec3>",
|
||||||
"setSource",
|
"setSource",
|
||||||
ParticleDataImpl<Vec3>::_W_24);
|
ParticleDataImpl<Vec3>::_W_24);
|
||||||
static const Pb::Register _R_86("ParticleDataImpl<Vec3>",
|
static const Pb::Register _R_87("ParticleDataImpl<Vec3>",
|
||||||
"copyFrom",
|
"copyFrom",
|
||||||
ParticleDataImpl<Vec3>::_W_25);
|
ParticleDataImpl<Vec3>::_W_25);
|
||||||
static const Pb::Register _R_87("ParticleDataImpl<Vec3>",
|
static const Pb::Register _R_88("ParticleDataImpl<Vec3>",
|
||||||
"setConst",
|
"setConst",
|
||||||
ParticleDataImpl<Vec3>::_W_26);
|
ParticleDataImpl<Vec3>::_W_26);
|
||||||
static const Pb::Register _R_88("ParticleDataImpl<Vec3>",
|
static const Pb::Register _R_89("ParticleDataImpl<Vec3>",
|
||||||
"setConstRange",
|
"setConstRange",
|
||||||
ParticleDataImpl<Vec3>::_W_27);
|
ParticleDataImpl<Vec3>::_W_27);
|
||||||
static const Pb::Register _R_89("ParticleDataImpl<Vec3>", "add", ParticleDataImpl<Vec3>::_W_28);
|
static const Pb::Register _R_90("ParticleDataImpl<Vec3>", "add", ParticleDataImpl<Vec3>::_W_28);
|
||||||
static const Pb::Register _R_90("ParticleDataImpl<Vec3>", "sub", ParticleDataImpl<Vec3>::_W_29);
|
static const Pb::Register _R_91("ParticleDataImpl<Vec3>", "sub", ParticleDataImpl<Vec3>::_W_29);
|
||||||
static const Pb::Register _R_91("ParticleDataImpl<Vec3>",
|
static const Pb::Register _R_92("ParticleDataImpl<Vec3>",
|
||||||
"addConst",
|
"addConst",
|
||||||
ParticleDataImpl<Vec3>::_W_30);
|
ParticleDataImpl<Vec3>::_W_30);
|
||||||
static const Pb::Register _R_92("ParticleDataImpl<Vec3>",
|
static const Pb::Register _R_93("ParticleDataImpl<Vec3>",
|
||||||
"addScaled",
|
"addScaled",
|
||||||
ParticleDataImpl<Vec3>::_W_31);
|
ParticleDataImpl<Vec3>::_W_31);
|
||||||
static const Pb::Register _R_93("ParticleDataImpl<Vec3>", "mult", ParticleDataImpl<Vec3>::_W_32);
|
static const Pb::Register _R_94("ParticleDataImpl<Vec3>", "mult", ParticleDataImpl<Vec3>::_W_32);
|
||||||
static const Pb::Register _R_94("ParticleDataImpl<Vec3>",
|
static const Pb::Register _R_95("ParticleDataImpl<Vec3>",
|
||||||
"multConst",
|
"multConst",
|
||||||
ParticleDataImpl<Vec3>::_W_33);
|
ParticleDataImpl<Vec3>::_W_33);
|
||||||
static const Pb::Register _R_95("ParticleDataImpl<Vec3>",
|
static const Pb::Register _R_96("ParticleDataImpl<Vec3>",
|
||||||
"safeDiv",
|
"safeDiv",
|
||||||
ParticleDataImpl<Vec3>::_W_34);
|
ParticleDataImpl<Vec3>::_W_34);
|
||||||
static const Pb::Register _R_96("ParticleDataImpl<Vec3>", "clamp", ParticleDataImpl<Vec3>::_W_35);
|
static const Pb::Register _R_97("ParticleDataImpl<Vec3>", "clamp", ParticleDataImpl<Vec3>::_W_35);
|
||||||
static const Pb::Register _R_97("ParticleDataImpl<Vec3>",
|
static const Pb::Register _R_98("ParticleDataImpl<Vec3>",
|
||||||
"clampMin",
|
"clampMin",
|
||||||
ParticleDataImpl<Vec3>::_W_36);
|
ParticleDataImpl<Vec3>::_W_36);
|
||||||
static const Pb::Register _R_98("ParticleDataImpl<Vec3>",
|
static const Pb::Register _R_99("ParticleDataImpl<Vec3>",
|
||||||
"clampMax",
|
"clampMax",
|
||||||
ParticleDataImpl<Vec3>::_W_37);
|
ParticleDataImpl<Vec3>::_W_37);
|
||||||
static const Pb::Register _R_99("ParticleDataImpl<Vec3>",
|
|
||||||
"getMaxAbs",
|
|
||||||
ParticleDataImpl<Vec3>::_W_38);
|
|
||||||
static const Pb::Register _R_100("ParticleDataImpl<Vec3>",
|
static const Pb::Register _R_100("ParticleDataImpl<Vec3>",
|
||||||
|
"getMaxAbs",
|
||||||
|
ParticleDataImpl<Vec3>::_W_38);
|
||||||
|
static const Pb::Register _R_101("ParticleDataImpl<Vec3>",
|
||||||
"getMax",
|
"getMax",
|
||||||
ParticleDataImpl<Vec3>::_W_39);
|
ParticleDataImpl<Vec3>::_W_39);
|
||||||
static const Pb::Register _R_101("ParticleDataImpl<Vec3>",
|
static const Pb::Register _R_102("ParticleDataImpl<Vec3>",
|
||||||
"getMin",
|
"getMin",
|
||||||
ParticleDataImpl<Vec3>::_W_40);
|
ParticleDataImpl<Vec3>::_W_40);
|
||||||
static const Pb::Register _R_102("ParticleDataImpl<Vec3>", "sum", ParticleDataImpl<Vec3>::_W_41);
|
static const Pb::Register _R_103("ParticleDataImpl<Vec3>", "sum", ParticleDataImpl<Vec3>::_W_41);
|
||||||
static const Pb::Register _R_103("ParticleDataImpl<Vec3>",
|
static const Pb::Register _R_104("ParticleDataImpl<Vec3>",
|
||||||
"sumSquare",
|
"sumSquare",
|
||||||
ParticleDataImpl<Vec3>::_W_42);
|
ParticleDataImpl<Vec3>::_W_42);
|
||||||
static const Pb::Register _R_104("ParticleDataImpl<Vec3>",
|
static const Pb::Register _R_105("ParticleDataImpl<Vec3>",
|
||||||
"sumMagnitude",
|
"sumMagnitude",
|
||||||
ParticleDataImpl<Vec3>::_W_43);
|
ParticleDataImpl<Vec3>::_W_43);
|
||||||
static const Pb::Register _R_105("ParticleDataImpl<Vec3>",
|
static const Pb::Register _R_106("ParticleDataImpl<Vec3>",
|
||||||
"setConstIntFlag",
|
"setConstIntFlag",
|
||||||
ParticleDataImpl<Vec3>::_W_44);
|
ParticleDataImpl<Vec3>::_W_44);
|
||||||
static const Pb::Register _R_106("ParticleDataImpl<Vec3>",
|
static const Pb::Register _R_107("ParticleDataImpl<Vec3>",
|
||||||
"printPdata",
|
"printPdata",
|
||||||
ParticleDataImpl<Vec3>::_W_45);
|
ParticleDataImpl<Vec3>::_W_45);
|
||||||
static const Pb::Register _R_107("ParticleDataImpl<Vec3>", "save", ParticleDataImpl<Vec3>::_W_46);
|
static const Pb::Register _R_108("ParticleDataImpl<Vec3>", "save", ParticleDataImpl<Vec3>::_W_46);
|
||||||
static const Pb::Register _R_108("ParticleDataImpl<Vec3>", "load", ParticleDataImpl<Vec3>::_W_47);
|
static const Pb::Register _R_109("ParticleDataImpl<Vec3>", "load", ParticleDataImpl<Vec3>::_W_47);
|
||||||
static const Pb::Register _R_109("ParticleDataImpl<Vec3>",
|
static const Pb::Register _R_110("ParticleDataImpl<Vec3>",
|
||||||
"getDataPointer",
|
"getDataPointer",
|
||||||
ParticleDataImpl<Vec3>::_W_48);
|
ParticleDataImpl<Vec3>::_W_48);
|
||||||
#endif
|
#endif
|
||||||
#ifdef _C_ParticleIndexSystem
|
#ifdef _C_ParticleIndexSystem
|
||||||
static const Pb::Register _R_110("ParticleIndexSystem",
|
static const Pb::Register _R_111("ParticleIndexSystem",
|
||||||
"ParticleIndexSystem",
|
"ParticleIndexSystem",
|
||||||
"ParticleSystem<ParticleIndexData>");
|
"ParticleSystem<ParticleIndexData>");
|
||||||
template<> const char *Namify<ParticleIndexSystem>::S = "ParticleIndexSystem";
|
template<> const char *Namify<ParticleIndexSystem>::S = "ParticleIndexSystem";
|
||||||
static const Pb::Register _R_111("ParticleIndexSystem",
|
static const Pb::Register _R_112("ParticleIndexSystem",
|
||||||
"ParticleIndexSystem",
|
"ParticleIndexSystem",
|
||||||
ParticleIndexSystem::_W_19);
|
ParticleIndexSystem::_W_19);
|
||||||
#endif
|
#endif
|
||||||
#ifdef _C_ParticleSystem
|
#ifdef _C_ParticleSystem
|
||||||
static const Pb::Register _R_112("ParticleSystem<BasicParticleData>",
|
static const Pb::Register _R_113("ParticleSystem<BasicParticleData>",
|
||||||
"ParticleSystem<BasicParticleData>",
|
"ParticleSystem<BasicParticleData>",
|
||||||
"ParticleBase");
|
"ParticleBase");
|
||||||
template<>
|
template<>
|
||||||
const char *Namify<ParticleSystem<BasicParticleData>>::S = "ParticleSystem<BasicParticleData>";
|
const char *Namify<ParticleSystem<BasicParticleData>>::S = "ParticleSystem<BasicParticleData>";
|
||||||
static const Pb::Register _R_113("ParticleSystem<BasicParticleData>",
|
static const Pb::Register _R_114("ParticleSystem<BasicParticleData>",
|
||||||
"ParticleSystem",
|
"ParticleSystem",
|
||||||
ParticleSystem<BasicParticleData>::_W_2);
|
ParticleSystem<BasicParticleData>::_W_2);
|
||||||
static const Pb::Register _R_114("ParticleSystem<BasicParticleData>",
|
static const Pb::Register _R_115("ParticleSystem<BasicParticleData>",
|
||||||
"pySize",
|
"pySize",
|
||||||
ParticleSystem<BasicParticleData>::_W_3);
|
ParticleSystem<BasicParticleData>::_W_3);
|
||||||
static const Pb::Register _R_115("ParticleSystem<BasicParticleData>",
|
static const Pb::Register _R_116("ParticleSystem<BasicParticleData>",
|
||||||
"setPos",
|
"setPos",
|
||||||
ParticleSystem<BasicParticleData>::_W_4);
|
ParticleSystem<BasicParticleData>::_W_4);
|
||||||
static const Pb::Register _R_116("ParticleSystem<BasicParticleData>",
|
static const Pb::Register _R_117("ParticleSystem<BasicParticleData>",
|
||||||
"getPos",
|
"getPos",
|
||||||
ParticleSystem<BasicParticleData>::_W_5);
|
ParticleSystem<BasicParticleData>::_W_5);
|
||||||
static const Pb::Register _R_117("ParticleSystem<BasicParticleData>",
|
static const Pb::Register _R_118("ParticleSystem<BasicParticleData>",
|
||||||
"getPosPdata",
|
"getPosPdata",
|
||||||
ParticleSystem<BasicParticleData>::_W_6);
|
ParticleSystem<BasicParticleData>::_W_6);
|
||||||
static const Pb::Register _R_118("ParticleSystem<BasicParticleData>",
|
static const Pb::Register _R_119("ParticleSystem<BasicParticleData>",
|
||||||
"setPosPdata",
|
"setPosPdata",
|
||||||
ParticleSystem<BasicParticleData>::_W_7);
|
ParticleSystem<BasicParticleData>::_W_7);
|
||||||
static const Pb::Register _R_119("ParticleSystem<BasicParticleData>",
|
static const Pb::Register _R_120("ParticleSystem<BasicParticleData>",
|
||||||
"clear",
|
"clear",
|
||||||
ParticleSystem<BasicParticleData>::_W_8);
|
ParticleSystem<BasicParticleData>::_W_8);
|
||||||
static const Pb::Register _R_120("ParticleSystem<BasicParticleData>",
|
static const Pb::Register _R_121("ParticleSystem<BasicParticleData>",
|
||||||
"advectInGrid",
|
"advectInGrid",
|
||||||
ParticleSystem<BasicParticleData>::_W_9);
|
ParticleSystem<BasicParticleData>::_W_9);
|
||||||
static const Pb::Register _R_121("ParticleSystem<BasicParticleData>",
|
static const Pb::Register _R_122("ParticleSystem<BasicParticleData>",
|
||||||
"projectOutside",
|
"projectOutside",
|
||||||
ParticleSystem<BasicParticleData>::_W_10);
|
ParticleSystem<BasicParticleData>::_W_10);
|
||||||
static const Pb::Register _R_122("ParticleSystem<BasicParticleData>",
|
static const Pb::Register _R_123("ParticleSystem<BasicParticleData>",
|
||||||
"projectOutOfBnd",
|
"projectOutOfBnd",
|
||||||
ParticleSystem<BasicParticleData>::_W_11);
|
ParticleSystem<BasicParticleData>::_W_11);
|
||||||
static const Pb::Register _R_123("ParticleSystem<ParticleIndexData>",
|
static const Pb::Register _R_124("ParticleSystem<ParticleIndexData>",
|
||||||
"ParticleSystem<ParticleIndexData>",
|
"ParticleSystem<ParticleIndexData>",
|
||||||
"ParticleBase");
|
"ParticleBase");
|
||||||
template<>
|
template<>
|
||||||
const char *Namify<ParticleSystem<ParticleIndexData>>::S = "ParticleSystem<ParticleIndexData>";
|
const char *Namify<ParticleSystem<ParticleIndexData>>::S = "ParticleSystem<ParticleIndexData>";
|
||||||
static const Pb::Register _R_124("ParticleSystem<ParticleIndexData>",
|
static const Pb::Register _R_125("ParticleSystem<ParticleIndexData>",
|
||||||
"ParticleSystem",
|
"ParticleSystem",
|
||||||
ParticleSystem<ParticleIndexData>::_W_2);
|
ParticleSystem<ParticleIndexData>::_W_2);
|
||||||
static const Pb::Register _R_125("ParticleSystem<ParticleIndexData>",
|
static const Pb::Register _R_126("ParticleSystem<ParticleIndexData>",
|
||||||
"pySize",
|
"pySize",
|
||||||
ParticleSystem<ParticleIndexData>::_W_3);
|
ParticleSystem<ParticleIndexData>::_W_3);
|
||||||
static const Pb::Register _R_126("ParticleSystem<ParticleIndexData>",
|
static const Pb::Register _R_127("ParticleSystem<ParticleIndexData>",
|
||||||
"setPos",
|
"setPos",
|
||||||
ParticleSystem<ParticleIndexData>::_W_4);
|
ParticleSystem<ParticleIndexData>::_W_4);
|
||||||
static const Pb::Register _R_127("ParticleSystem<ParticleIndexData>",
|
static const Pb::Register _R_128("ParticleSystem<ParticleIndexData>",
|
||||||
"getPos",
|
"getPos",
|
||||||
ParticleSystem<ParticleIndexData>::_W_5);
|
ParticleSystem<ParticleIndexData>::_W_5);
|
||||||
static const Pb::Register _R_128("ParticleSystem<ParticleIndexData>",
|
static const Pb::Register _R_129("ParticleSystem<ParticleIndexData>",
|
||||||
"getPosPdata",
|
"getPosPdata",
|
||||||
ParticleSystem<ParticleIndexData>::_W_6);
|
ParticleSystem<ParticleIndexData>::_W_6);
|
||||||
static const Pb::Register _R_129("ParticleSystem<ParticleIndexData>",
|
static const Pb::Register _R_130("ParticleSystem<ParticleIndexData>",
|
||||||
"setPosPdata",
|
"setPosPdata",
|
||||||
ParticleSystem<ParticleIndexData>::_W_7);
|
ParticleSystem<ParticleIndexData>::_W_7);
|
||||||
static const Pb::Register _R_130("ParticleSystem<ParticleIndexData>",
|
static const Pb::Register _R_131("ParticleSystem<ParticleIndexData>",
|
||||||
"clear",
|
"clear",
|
||||||
ParticleSystem<ParticleIndexData>::_W_8);
|
ParticleSystem<ParticleIndexData>::_W_8);
|
||||||
static const Pb::Register _R_131("ParticleSystem<ParticleIndexData>",
|
static const Pb::Register _R_132("ParticleSystem<ParticleIndexData>",
|
||||||
"advectInGrid",
|
"advectInGrid",
|
||||||
ParticleSystem<ParticleIndexData>::_W_9);
|
ParticleSystem<ParticleIndexData>::_W_9);
|
||||||
static const Pb::Register _R_132("ParticleSystem<ParticleIndexData>",
|
static const Pb::Register _R_133("ParticleSystem<ParticleIndexData>",
|
||||||
"projectOutside",
|
"projectOutside",
|
||||||
ParticleSystem<ParticleIndexData>::_W_10);
|
ParticleSystem<ParticleIndexData>::_W_10);
|
||||||
static const Pb::Register _R_133("ParticleSystem<ParticleIndexData>",
|
static const Pb::Register _R_134("ParticleSystem<ParticleIndexData>",
|
||||||
"projectOutOfBnd",
|
"projectOutOfBnd",
|
||||||
ParticleSystem<ParticleIndexData>::_W_11);
|
ParticleSystem<ParticleIndexData>::_W_11);
|
||||||
#endif
|
#endif
|
||||||
@@ -432,6 +436,7 @@ void PbRegister_file_10()
|
|||||||
KEEP_UNUSED(_R_131);
|
KEEP_UNUSED(_R_131);
|
||||||
KEEP_UNUSED(_R_132);
|
KEEP_UNUSED(_R_132);
|
||||||
KEEP_UNUSED(_R_133);
|
KEEP_UNUSED(_R_133);
|
||||||
|
KEEP_UNUSED(_R_134);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace Manta
|
} // namespace Manta
|
144
extern/mantaflow/preprocessed/plugin/initplugins.cpp
vendored
144
extern/mantaflow/preprocessed/plugin/initplugins.cpp
vendored
@@ -1479,48 +1479,24 @@ void PbRegister_addTestParts()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! calculate the difference between two pdata fields (note - slow!, not parallelized)
|
//! calculate the difference between two pdata fields (note - slow!, not parallelized)
|
||||||
|
template<class T> Real getPdataMaxDiff(const ParticleDataImpl<T> *a, const ParticleDataImpl<T> *b)
|
||||||
Real pdataMaxDiff(const ParticleDataBase *a, const ParticleDataBase *b)
|
|
||||||
{
|
{
|
||||||
double maxVal = 0.;
|
|
||||||
// debMsg(" PD "<< a->getType()<<" as"<<a->getSizeSlow()<<" bs"<<b->getSizeSlow() , 1);
|
|
||||||
assertMsg(a->getType() == b->getType(), "pdataMaxDiff problem - different pdata types!");
|
assertMsg(a->getType() == b->getType(), "pdataMaxDiff problem - different pdata types!");
|
||||||
assertMsg(a->getSizeSlow() == b->getSizeSlow(), "pdataMaxDiff problem - different pdata sizes!");
|
assertMsg(a->getSizeSlow() == b->getSizeSlow(), "pdataMaxDiff problem - different pdata sizes!");
|
||||||
|
|
||||||
if (a->getType() & ParticleDataBase::TypeReal) {
|
Real maxVal = 0.;
|
||||||
const ParticleDataImpl<Real> &av = *dynamic_cast<const ParticleDataImpl<Real> *>(a);
|
FOR_PARTS(*a)
|
||||||
const ParticleDataImpl<Real> &bv = *dynamic_cast<const ParticleDataImpl<Real> *>(b);
|
{
|
||||||
FOR_PARTS(av)
|
T diff = a->get(idx) - b->get(idx);
|
||||||
{
|
Real s = (Real)sum(abs(diff));
|
||||||
maxVal = std::max(maxVal, (double)fabs(av[idx] - bv[idx]));
|
maxVal = std::max(maxVal, s);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (a->getType() & ParticleDataBase::TypeInt) {
|
|
||||||
const ParticleDataImpl<int> &av = *dynamic_cast<const ParticleDataImpl<int> *>(a);
|
|
||||||
const ParticleDataImpl<int> &bv = *dynamic_cast<const ParticleDataImpl<int> *>(b);
|
|
||||||
FOR_PARTS(av)
|
|
||||||
{
|
|
||||||
maxVal = std::max(maxVal, (double)fabs((double)av[idx] - bv[idx]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (a->getType() & ParticleDataBase::TypeVec3) {
|
|
||||||
const ParticleDataImpl<Vec3> &av = *dynamic_cast<const ParticleDataImpl<Vec3> *>(a);
|
|
||||||
const ParticleDataImpl<Vec3> &bv = *dynamic_cast<const ParticleDataImpl<Vec3> *>(b);
|
|
||||||
FOR_PARTS(av)
|
|
||||||
{
|
|
||||||
double d = 0.;
|
|
||||||
for (int c = 0; c < 3; ++c) {
|
|
||||||
d += fabs((double)av[idx][c] - (double)bv[idx][c]);
|
|
||||||
}
|
|
||||||
maxVal = std::max(maxVal, d);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
errMsg("pdataMaxDiff: Grid Type is not supported (only Real, Vec3, int)");
|
|
||||||
}
|
|
||||||
|
|
||||||
return maxVal;
|
return maxVal;
|
||||||
}
|
}
|
||||||
|
Real pdataMaxDiff(const ParticleDataImpl<Real> *a, const ParticleDataImpl<Real> *b)
|
||||||
|
{
|
||||||
|
return getPdataMaxDiff(a, b);
|
||||||
|
}
|
||||||
static PyObject *_W_15(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
static PyObject *_W_15(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -1531,8 +1507,8 @@ static PyObject *_W_15(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
|||||||
PyObject *_retval = 0;
|
PyObject *_retval = 0;
|
||||||
{
|
{
|
||||||
ArgLocker _lock;
|
ArgLocker _lock;
|
||||||
const ParticleDataBase *a = _args.getPtr<ParticleDataBase>("a", 0, &_lock);
|
const ParticleDataImpl<Real> *a = _args.getPtr<ParticleDataImpl<Real>>("a", 0, &_lock);
|
||||||
const ParticleDataBase *b = _args.getPtr<ParticleDataBase>("b", 1, &_lock);
|
const ParticleDataImpl<Real> *b = _args.getPtr<ParticleDataImpl<Real>>("b", 1, &_lock);
|
||||||
_retval = toPy(pdataMaxDiff(a, b));
|
_retval = toPy(pdataMaxDiff(a, b));
|
||||||
_args.check();
|
_args.check();
|
||||||
}
|
}
|
||||||
@@ -1552,6 +1528,76 @@ void PbRegister_pdataMaxDiff()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Real pdataMaxDiffInt(const ParticleDataImpl<int> *a, const ParticleDataImpl<int> *b)
|
||||||
|
{
|
||||||
|
return getPdataMaxDiff(a, b);
|
||||||
|
}
|
||||||
|
static PyObject *_W_16(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
PbArgs _args(_linargs, _kwds);
|
||||||
|
FluidSolver *parent = _args.obtainParent();
|
||||||
|
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
|
||||||
|
pbPreparePlugin(parent, "pdataMaxDiffInt", !noTiming);
|
||||||
|
PyObject *_retval = 0;
|
||||||
|
{
|
||||||
|
ArgLocker _lock;
|
||||||
|
const ParticleDataImpl<int> *a = _args.getPtr<ParticleDataImpl<int>>("a", 0, &_lock);
|
||||||
|
const ParticleDataImpl<int> *b = _args.getPtr<ParticleDataImpl<int>>("b", 1, &_lock);
|
||||||
|
_retval = toPy(pdataMaxDiffInt(a, b));
|
||||||
|
_args.check();
|
||||||
|
}
|
||||||
|
pbFinalizePlugin(parent, "pdataMaxDiffInt", !noTiming);
|
||||||
|
return _retval;
|
||||||
|
}
|
||||||
|
catch (std::exception &e) {
|
||||||
|
pbSetError("pdataMaxDiffInt", e.what());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static const Pb::Register _RP_pdataMaxDiffInt("", "pdataMaxDiffInt", _W_16);
|
||||||
|
extern "C" {
|
||||||
|
void PbRegister_pdataMaxDiffInt()
|
||||||
|
{
|
||||||
|
KEEP_UNUSED(_RP_pdataMaxDiffInt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Real pdataMaxDiffVec3(const ParticleDataImpl<Vec3> *a, const ParticleDataImpl<Vec3> *b)
|
||||||
|
{
|
||||||
|
return getPdataMaxDiff(a, b);
|
||||||
|
}
|
||||||
|
static PyObject *_W_17(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
PbArgs _args(_linargs, _kwds);
|
||||||
|
FluidSolver *parent = _args.obtainParent();
|
||||||
|
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
|
||||||
|
pbPreparePlugin(parent, "pdataMaxDiffVec3", !noTiming);
|
||||||
|
PyObject *_retval = 0;
|
||||||
|
{
|
||||||
|
ArgLocker _lock;
|
||||||
|
const ParticleDataImpl<Vec3> *a = _args.getPtr<ParticleDataImpl<Vec3>>("a", 0, &_lock);
|
||||||
|
const ParticleDataImpl<Vec3> *b = _args.getPtr<ParticleDataImpl<Vec3>>("b", 1, &_lock);
|
||||||
|
_retval = toPy(pdataMaxDiffVec3(a, b));
|
||||||
|
_args.check();
|
||||||
|
}
|
||||||
|
pbFinalizePlugin(parent, "pdataMaxDiffVec3", !noTiming);
|
||||||
|
return _retval;
|
||||||
|
}
|
||||||
|
catch (std::exception &e) {
|
||||||
|
pbSetError("pdataMaxDiffVec3", e.what());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static const Pb::Register _RP_pdataMaxDiffVec3("", "pdataMaxDiffVec3", _W_17);
|
||||||
|
extern "C" {
|
||||||
|
void PbRegister_pdataMaxDiffVec3()
|
||||||
|
{
|
||||||
|
KEEP_UNUSED(_RP_pdataMaxDiffVec3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//! calculate center of mass given density grid, for re-centering
|
//! calculate center of mass given density grid, for re-centering
|
||||||
|
|
||||||
Vec3 calcCenterOfMass(const Grid<Real> &density)
|
Vec3 calcCenterOfMass(const Grid<Real> &density)
|
||||||
@@ -1567,7 +1613,7 @@ Vec3 calcCenterOfMass(const Grid<Real> &density)
|
|||||||
p /= w;
|
p /= w;
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
static PyObject *_W_16(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
static PyObject *_W_18(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
PbArgs _args(_linargs, _kwds);
|
PbArgs _args(_linargs, _kwds);
|
||||||
@@ -1589,7 +1635,7 @@ static PyObject *_W_16(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static const Pb::Register _RP_calcCenterOfMass("", "calcCenterOfMass", _W_16);
|
static const Pb::Register _RP_calcCenterOfMass("", "calcCenterOfMass", _W_18);
|
||||||
extern "C" {
|
extern "C" {
|
||||||
void PbRegister_calcCenterOfMass()
|
void PbRegister_calcCenterOfMass()
|
||||||
{
|
{
|
||||||
@@ -1789,7 +1835,7 @@ void updateFractions(const FlagGrid &flags,
|
|||||||
fractions.setConst(Vec3(0.));
|
fractions.setConst(Vec3(0.));
|
||||||
KnUpdateFractions(flags, phiObs, fractions, boundaryWidth, fracThreshold);
|
KnUpdateFractions(flags, phiObs, fractions, boundaryWidth, fracThreshold);
|
||||||
}
|
}
|
||||||
static PyObject *_W_17(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
static PyObject *_W_19(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
PbArgs _args(_linargs, _kwds);
|
PbArgs _args(_linargs, _kwds);
|
||||||
@@ -1816,7 +1862,7 @@ static PyObject *_W_17(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static const Pb::Register _RP_updateFractions("", "updateFractions", _W_17);
|
static const Pb::Register _RP_updateFractions("", "updateFractions", _W_19);
|
||||||
extern "C" {
|
extern "C" {
|
||||||
void PbRegister_updateFractions()
|
void PbRegister_updateFractions()
|
||||||
{
|
{
|
||||||
@@ -1968,7 +2014,7 @@ void setObstacleFlags(FlagGrid &flags,
|
|||||||
{
|
{
|
||||||
KnUpdateFlagsObs(flags, fractions, phiObs, phiOut, phiIn, boundaryWidth);
|
KnUpdateFlagsObs(flags, fractions, phiObs, phiOut, phiIn, boundaryWidth);
|
||||||
}
|
}
|
||||||
static PyObject *_W_18(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
static PyObject *_W_20(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
PbArgs _args(_linargs, _kwds);
|
PbArgs _args(_linargs, _kwds);
|
||||||
@@ -1996,7 +2042,7 @@ static PyObject *_W_18(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static const Pb::Register _RP_setObstacleFlags("", "setObstacleFlags", _W_18);
|
static const Pb::Register _RP_setObstacleFlags("", "setObstacleFlags", _W_20);
|
||||||
extern "C" {
|
extern "C" {
|
||||||
void PbRegister_setObstacleFlags()
|
void PbRegister_setObstacleFlags()
|
||||||
{
|
{
|
||||||
@@ -2113,7 +2159,7 @@ void initVortexVelocity(const Grid<Real> &phiObs,
|
|||||||
{
|
{
|
||||||
kninitVortexVelocity(phiObs, vel, center, radius);
|
kninitVortexVelocity(phiObs, vel, center, radius);
|
||||||
}
|
}
|
||||||
static PyObject *_W_19(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
static PyObject *_W_21(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
PbArgs _args(_linargs, _kwds);
|
PbArgs _args(_linargs, _kwds);
|
||||||
@@ -2139,7 +2185,7 @@ static PyObject *_W_19(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static const Pb::Register _RP_initVortexVelocity("", "initVortexVelocity", _W_19);
|
static const Pb::Register _RP_initVortexVelocity("", "initVortexVelocity", _W_21);
|
||||||
extern "C" {
|
extern "C" {
|
||||||
void PbRegister_initVortexVelocity()
|
void PbRegister_initVortexVelocity()
|
||||||
{
|
{
|
||||||
@@ -2465,7 +2511,7 @@ int blurMacGrid(MACGrid &oG, MACGrid &tG, float si)
|
|||||||
}
|
}
|
||||||
return tmGK.mDim;
|
return tmGK.mDim;
|
||||||
}
|
}
|
||||||
static PyObject *_W_20(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
static PyObject *_W_22(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
PbArgs _args(_linargs, _kwds);
|
PbArgs _args(_linargs, _kwds);
|
||||||
@@ -2489,7 +2535,7 @@ static PyObject *_W_20(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static const Pb::Register _RP_blurMacGrid("", "blurMacGrid", _W_20);
|
static const Pb::Register _RP_blurMacGrid("", "blurMacGrid", _W_22);
|
||||||
extern "C" {
|
extern "C" {
|
||||||
void PbRegister_blurMacGrid()
|
void PbRegister_blurMacGrid()
|
||||||
{
|
{
|
||||||
@@ -2501,7 +2547,7 @@ int blurRealGrid(Grid<Real> &oG, Grid<Real> &tG, float si)
|
|||||||
{
|
{
|
||||||
return blurGrid<Real>(oG, tG, si);
|
return blurGrid<Real>(oG, tG, si);
|
||||||
}
|
}
|
||||||
static PyObject *_W_21(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
static PyObject *_W_23(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
PbArgs _args(_linargs, _kwds);
|
PbArgs _args(_linargs, _kwds);
|
||||||
@@ -2525,7 +2571,7 @@ static PyObject *_W_21(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static const Pb::Register _RP_blurRealGrid("", "blurRealGrid", _W_21);
|
static const Pb::Register _RP_blurRealGrid("", "blurRealGrid", _W_23);
|
||||||
extern "C" {
|
extern "C" {
|
||||||
void PbRegister_blurRealGrid()
|
void PbRegister_blurRealGrid()
|
||||||
{
|
{
|
||||||
|
@@ -111,6 +111,8 @@ extern void PbRegister_checkSymmetryVec3();
|
|||||||
extern void PbRegister_projectPpmFull();
|
extern void PbRegister_projectPpmFull();
|
||||||
extern void PbRegister_addTestParts();
|
extern void PbRegister_addTestParts();
|
||||||
extern void PbRegister_pdataMaxDiff();
|
extern void PbRegister_pdataMaxDiff();
|
||||||
|
extern void PbRegister_pdataMaxDiffInt();
|
||||||
|
extern void PbRegister_pdataMaxDiffVec3();
|
||||||
extern void PbRegister_calcCenterOfMass();
|
extern void PbRegister_calcCenterOfMass();
|
||||||
extern void PbRegister_updateFractions();
|
extern void PbRegister_updateFractions();
|
||||||
extern void PbRegister_setObstacleFlags();
|
extern void PbRegister_setObstacleFlags();
|
||||||
@@ -306,6 +308,8 @@ void MantaEnsureRegistration()
|
|||||||
PbRegister_projectPpmFull();
|
PbRegister_projectPpmFull();
|
||||||
PbRegister_addTestParts();
|
PbRegister_addTestParts();
|
||||||
PbRegister_pdataMaxDiff();
|
PbRegister_pdataMaxDiff();
|
||||||
|
PbRegister_pdataMaxDiffInt();
|
||||||
|
PbRegister_pdataMaxDiffVec3();
|
||||||
PbRegister_calcCenterOfMass();
|
PbRegister_calcCenterOfMass();
|
||||||
PbRegister_updateFractions();
|
PbRegister_updateFractions();
|
||||||
PbRegister_setObstacleFlags();
|
PbRegister_setObstacleFlags();
|
||||||
|
@@ -30,6 +30,7 @@ add_subdirectory(opensubdiv)
|
|||||||
add_subdirectory(mikktspace)
|
add_subdirectory(mikktspace)
|
||||||
add_subdirectory(glew-mx)
|
add_subdirectory(glew-mx)
|
||||||
add_subdirectory(eigen)
|
add_subdirectory(eigen)
|
||||||
|
add_subdirectory(sky)
|
||||||
|
|
||||||
if(WITH_AUDASPACE)
|
if(WITH_AUDASPACE)
|
||||||
add_subdirectory(audaspace)
|
add_subdirectory(audaspace)
|
||||||
|
@@ -153,7 +153,6 @@ static void clg_str_reserve(CLogStringBuf *cstr, const uint len)
|
|||||||
cstr->data = data;
|
cstr->data = data;
|
||||||
cstr->is_alloc = true;
|
cstr->is_alloc = true;
|
||||||
}
|
}
|
||||||
cstr->len_alloc = len;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,26 +178,34 @@ static void clg_str_vappendf(CLogStringBuf *cstr, const char *fmt, va_list args)
|
|||||||
{
|
{
|
||||||
/* Use limit because windows may use '-1' for a formatting error. */
|
/* Use limit because windows may use '-1' for a formatting error. */
|
||||||
const uint len_max = 65535;
|
const uint len_max = 65535;
|
||||||
uint len_avail = (cstr->len_alloc - cstr->len);
|
|
||||||
if (len_avail == 0) {
|
|
||||||
len_avail = CLOG_BUF_LEN_INIT;
|
|
||||||
clg_str_reserve(cstr, len_avail);
|
|
||||||
}
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
uint len_avail = cstr->len_alloc - cstr->len;
|
||||||
|
|
||||||
va_list args_cpy;
|
va_list args_cpy;
|
||||||
va_copy(args_cpy, args);
|
va_copy(args_cpy, args);
|
||||||
int retval = vsnprintf(cstr->data + cstr->len, len_avail, fmt, args_cpy);
|
int retval = vsnprintf(cstr->data + cstr->len, len_avail, fmt, args_cpy);
|
||||||
va_end(args_cpy);
|
va_end(args_cpy);
|
||||||
if (retval != -1) {
|
|
||||||
cstr->len += retval;
|
if (retval < 0) {
|
||||||
|
/* Some encoding error happened, not much we can do here, besides skipping/cancelling this
|
||||||
|
* message. */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if ((uint)retval <= len_avail) {
|
||||||
|
/* Copy was successful. */
|
||||||
|
cstr->len += (uint)retval;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
len_avail *= 2;
|
/* vsnprintf was not successful, due to lack of allocated space, retval contains expected
|
||||||
if (len_avail >= len_max) {
|
* length of the formated string, use it to allocate required amount of memory. */
|
||||||
|
uint len_alloc = cstr->len + (uint)retval;
|
||||||
|
if (len_alloc >= len_max) {
|
||||||
|
/* Safe upper-limit, just in case... */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
clg_str_reserve(cstr, len_avail);
|
clg_str_reserve(cstr, len_alloc);
|
||||||
|
len_avail = cstr->len_alloc - cstr->len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -35,7 +35,7 @@ if(WITH_CYCLES_OSL)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT CYCLES_STANDALONE_REPOSITORY)
|
if(NOT CYCLES_STANDALONE_REPOSITORY)
|
||||||
list(APPEND LIBRARIES bf_intern_glew_mx bf_intern_guardedalloc bf_intern_numaapi)
|
list(APPEND LIBRARIES bf_intern_glew_mx bf_intern_guardedalloc bf_intern_numaapi bf_intern_sky)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_CYCLES_LOGGING)
|
if(WITH_CYCLES_LOGGING)
|
||||||
|
@@ -224,7 +224,7 @@ def system_info():
|
|||||||
import _cycles
|
import _cycles
|
||||||
return _cycles.system_info()
|
return _cycles.system_info()
|
||||||
|
|
||||||
def list_render_passes(srl):
|
def list_render_passes(scene, srl):
|
||||||
# Builtin Blender passes.
|
# Builtin Blender passes.
|
||||||
yield ("Combined", "RGBA", 'COLOR')
|
yield ("Combined", "RGBA", 'COLOR')
|
||||||
|
|
||||||
@@ -279,14 +279,17 @@ def list_render_passes(srl):
|
|||||||
yield ("Denoising Normal", "XYZ", 'VECTOR')
|
yield ("Denoising Normal", "XYZ", 'VECTOR')
|
||||||
yield ("Denoising Albedo", "RGB", 'COLOR')
|
yield ("Denoising Albedo", "RGB", 'COLOR')
|
||||||
yield ("Denoising Depth", "Z", 'VALUE')
|
yield ("Denoising Depth", "Z", 'VALUE')
|
||||||
yield ("Denoising Shadowing", "X", 'VALUE')
|
|
||||||
yield ("Denoising Variance", "RGB", 'COLOR')
|
if scene.cycles.denoiser == 'NLM':
|
||||||
yield ("Denoising Intensity", "X", 'VALUE')
|
yield ("Denoising Shadowing", "X", 'VALUE')
|
||||||
clean_options = ("denoising_diffuse_direct", "denoising_diffuse_indirect",
|
yield ("Denoising Variance", "RGB", 'COLOR')
|
||||||
"denoising_glossy_direct", "denoising_glossy_indirect",
|
yield ("Denoising Intensity", "X", 'VALUE')
|
||||||
"denoising_transmission_direct", "denoising_transmission_indirect")
|
|
||||||
if any(getattr(crl, option) for option in clean_options):
|
clean_options = ("denoising_diffuse_direct", "denoising_diffuse_indirect",
|
||||||
yield ("Denoising Clean", "RGB", 'COLOR')
|
"denoising_glossy_direct", "denoising_glossy_indirect",
|
||||||
|
"denoising_transmission_direct", "denoising_transmission_indirect")
|
||||||
|
if any(getattr(crl, option) for option in clean_options):
|
||||||
|
yield ("Denoising Clean", "RGB", 'COLOR')
|
||||||
|
|
||||||
# Custom AOV passes.
|
# Custom AOV passes.
|
||||||
for aov in crl.aovs:
|
for aov in crl.aovs:
|
||||||
@@ -298,15 +301,15 @@ def list_render_passes(srl):
|
|||||||
def register_passes(engine, scene, view_layer):
|
def register_passes(engine, scene, view_layer):
|
||||||
# Detect duplicate render pass names, first one wins.
|
# Detect duplicate render pass names, first one wins.
|
||||||
listed = set()
|
listed = set()
|
||||||
for name, channelids, channeltype in list_render_passes(view_layer):
|
for name, channelids, channeltype in list_render_passes(scene, view_layer):
|
||||||
if name not in listed:
|
if name not in listed:
|
||||||
engine.register_pass(scene, view_layer, name, len(channelids), channelids, channeltype)
|
engine.register_pass(scene, view_layer, name, len(channelids), channelids, channeltype)
|
||||||
listed.add(name)
|
listed.add(name)
|
||||||
|
|
||||||
def detect_conflicting_passes(view_layer):
|
def detect_conflicting_passes(scene, view_layer):
|
||||||
# Detect conflicting render pass names for UI.
|
# Detect conflicting render pass names for UI.
|
||||||
counter = {}
|
counter = {}
|
||||||
for name, _, _ in list_render_passes(view_layer):
|
for name, _, _ in list_render_passes(scene, view_layer):
|
||||||
counter[name] = counter.get(name, 0) + 1
|
counter[name] = counter.get(name, 0) + 1
|
||||||
|
|
||||||
for aov in view_layer.cycles.aovs:
|
for aov in view_layer.cycles.aovs:
|
||||||
|
@@ -182,6 +182,7 @@ enum_aov_types = (
|
|||||||
('COLOR', "Color", "Write a Color pass", 1),
|
('COLOR', "Color", "Write a Color pass", 1),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def enum_openimagedenoise_denoiser(self, context):
|
def enum_openimagedenoise_denoiser(self, context):
|
||||||
if _cycles.with_openimagedenoise:
|
if _cycles.with_openimagedenoise:
|
||||||
return [('OPENIMAGEDENOISE', "OpenImageDenoise", "Use Intel OpenImageDenoise AI denoiser running on the CPU", 4)]
|
return [('OPENIMAGEDENOISE', "OpenImageDenoise", "Use Intel OpenImageDenoise AI denoiser running on the CPU", 4)]
|
||||||
@@ -196,14 +197,11 @@ def enum_preview_denoiser(self, context):
|
|||||||
optix_items = enum_optix_denoiser(self, context)
|
optix_items = enum_optix_denoiser(self, context)
|
||||||
oidn_items = enum_openimagedenoise_denoiser(self, context)
|
oidn_items = enum_openimagedenoise_denoiser(self, context)
|
||||||
|
|
||||||
if len(optix_items):
|
if len(optix_items) or len(oidn_items):
|
||||||
auto_label = "Fastest (Optix)"
|
items = [('AUTO', "Automatic", "Use the fastest available denoiser for viewport rendering (OptiX if available, OpenImageDenoise otherwise)", 0)]
|
||||||
elif len(oidn_items):
|
|
||||||
auto_label = "Fastest (OpenImageDenoise)"
|
|
||||||
else:
|
else:
|
||||||
auto_label = "None"
|
items = [('AUTO', "None", "Blender was compiled without a viewport denoiser", 0)]
|
||||||
|
|
||||||
items = [('AUTO', auto_label, "Use the fastest available denoiser for viewport rendering", 0)]
|
|
||||||
items += optix_items
|
items += optix_items
|
||||||
items += oidn_items
|
items += oidn_items
|
||||||
return items
|
return items
|
||||||
@@ -211,14 +209,23 @@ def enum_preview_denoiser(self, context):
|
|||||||
def enum_denoiser(self, context):
|
def enum_denoiser(self, context):
|
||||||
items = [('NLM', "NLM", "Cycles native non-local means denoiser, running on any compute device", 1)]
|
items = [('NLM', "NLM", "Cycles native non-local means denoiser, running on any compute device", 1)]
|
||||||
items += enum_optix_denoiser(self, context)
|
items += enum_optix_denoiser(self, context)
|
||||||
|
items += enum_openimagedenoise_denoiser(self, context)
|
||||||
return items
|
return items
|
||||||
|
|
||||||
enum_denoising_optix_input_passes = (
|
enum_denoising_input_passes = (
|
||||||
('RGB', "Color", "Use only color as input", 1),
|
('RGB', "Color", "Use only color as input", 1),
|
||||||
('RGB_ALBEDO', "Color + Albedo", "Use color and albedo data as input", 2),
|
('RGB_ALBEDO', "Color + Albedo", "Use color and albedo data as input", 2),
|
||||||
('RGB_ALBEDO_NORMAL', "Color + Albedo + Normal", "Use color, albedo and normal data as input", 3),
|
('RGB_ALBEDO_NORMAL', "Color + Albedo + Normal", "Use color, albedo and normal data as input", 3),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def update_render_passes(self, context):
|
||||||
|
scene = context.scene
|
||||||
|
view_layer = context.view_layer
|
||||||
|
view_layer.update_render_passes()
|
||||||
|
engine.detect_conflicting_passes(scene, view_layer)
|
||||||
|
|
||||||
|
|
||||||
class CyclesRenderSettings(bpy.types.PropertyGroup):
|
class CyclesRenderSettings(bpy.types.PropertyGroup):
|
||||||
|
|
||||||
device: EnumProperty(
|
device: EnumProperty(
|
||||||
@@ -264,9 +271,12 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
|||||||
|
|
||||||
denoiser: EnumProperty(
|
denoiser: EnumProperty(
|
||||||
name="Denoiser",
|
name="Denoiser",
|
||||||
description="Denoise the image with the selected denoiser",
|
description="Denoise the image with the selected denoiser. "
|
||||||
|
"For denoising the image after rendering, denoising data render passes "
|
||||||
|
"also adapt to the selected denoiser",
|
||||||
items=enum_denoiser,
|
items=enum_denoiser,
|
||||||
default=1,
|
default=1,
|
||||||
|
update=update_render_passes,
|
||||||
)
|
)
|
||||||
preview_denoiser: EnumProperty(
|
preview_denoiser: EnumProperty(
|
||||||
name="Viewport Denoiser",
|
name="Viewport Denoiser",
|
||||||
@@ -821,6 +831,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
|||||||
debug_use_cuda_split_kernel: BoolProperty(name="Split Kernel", default=False)
|
debug_use_cuda_split_kernel: BoolProperty(name="Split Kernel", default=False)
|
||||||
|
|
||||||
debug_optix_cuda_streams: IntProperty(name="CUDA Streams", default=1, min=1)
|
debug_optix_cuda_streams: IntProperty(name="CUDA Streams", default=1, min=1)
|
||||||
|
debug_optix_curves_api: BoolProperty(name="Native OptiX Curve Primitive", default=False)
|
||||||
|
|
||||||
debug_opencl_kernel_type: EnumProperty(
|
debug_opencl_kernel_type: EnumProperty(
|
||||||
name="OpenCL Kernel Type",
|
name="OpenCL Kernel Type",
|
||||||
@@ -1294,12 +1305,6 @@ class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
|
|||||||
del bpy.types.Scene.cycles_curves
|
del bpy.types.Scene.cycles_curves
|
||||||
|
|
||||||
|
|
||||||
def update_render_passes(self, context):
|
|
||||||
view_layer = context.view_layer
|
|
||||||
view_layer.update_render_passes()
|
|
||||||
engine.detect_conflicting_passes(view_layer)
|
|
||||||
|
|
||||||
|
|
||||||
class CyclesAOVPass(bpy.types.PropertyGroup):
|
class CyclesAOVPass(bpy.types.PropertyGroup):
|
||||||
name: StringProperty(
|
name: StringProperty(
|
||||||
name="Name",
|
name="Name",
|
||||||
@@ -1433,7 +1438,7 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
|
|||||||
)
|
)
|
||||||
denoising_store_passes: BoolProperty(
|
denoising_store_passes: BoolProperty(
|
||||||
name="Store Denoising Passes",
|
name="Store Denoising Passes",
|
||||||
description="Store the denoising feature passes and the noisy image",
|
description="Store the denoising feature passes and the noisy image. The passes adapt to the denoiser selected for rendering",
|
||||||
default=False,
|
default=False,
|
||||||
update=update_render_passes,
|
update=update_render_passes,
|
||||||
)
|
)
|
||||||
@@ -1446,11 +1451,18 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
|
|||||||
|
|
||||||
denoising_optix_input_passes: EnumProperty(
|
denoising_optix_input_passes: EnumProperty(
|
||||||
name="Input Passes",
|
name="Input Passes",
|
||||||
description="Passes handed over to the OptiX denoiser (this can have different effects on the denoised image)",
|
description="Passes used by the denoiser to distinguish noise from shader and geometry detail",
|
||||||
items=enum_denoising_optix_input_passes,
|
items=enum_denoising_input_passes,
|
||||||
default='RGB_ALBEDO',
|
default='RGB_ALBEDO',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
denoising_openimagedenoise_input_passes: EnumProperty(
|
||||||
|
name="Input Passes",
|
||||||
|
description="Passes used by the denoiser to distinguish noise from shader and geometry detail",
|
||||||
|
items=enum_denoising_input_passes,
|
||||||
|
default='RGB_ALBEDO_NORMAL',
|
||||||
|
)
|
||||||
|
|
||||||
use_pass_crypto_object: BoolProperty(
|
use_pass_crypto_object: BoolProperty(
|
||||||
name="Cryptomatte Object",
|
name="Cryptomatte Object",
|
||||||
description="Render cryptomatte object pass, for isolating objects in compositing",
|
description="Render cryptomatte object pass, for isolating objects in compositing",
|
||||||
|
@@ -265,7 +265,12 @@ class CYCLES_RENDER_PT_sampling_denoising(CyclesButtonsPanel, Panel):
|
|||||||
row = heading.row(align=True)
|
row = heading.row(align=True)
|
||||||
row.prop(cscene, "use_denoising", text="")
|
row.prop(cscene, "use_denoising", text="")
|
||||||
sub = row.row()
|
sub = row.row()
|
||||||
|
|
||||||
sub.active = cscene.use_denoising
|
sub.active = cscene.use_denoising
|
||||||
|
for view_layer in scene.view_layers:
|
||||||
|
if view_layer.cycles.denoising_store_passes:
|
||||||
|
sub.active = True
|
||||||
|
|
||||||
sub.prop(cscene, "denoiser", text="")
|
sub.prop(cscene, "denoiser", text="")
|
||||||
|
|
||||||
heading = layout.column(align=False, heading="Viewport")
|
heading = layout.column(align=False, heading="Viewport")
|
||||||
@@ -777,10 +782,6 @@ class CYCLES_RENDER_PT_filter(CyclesButtonsPanel, Panel):
|
|||||||
col.prop(view_layer, "use_solid", text="Surfaces")
|
col.prop(view_layer, "use_solid", text="Surfaces")
|
||||||
col.prop(view_layer, "use_strand", text="Hair")
|
col.prop(view_layer, "use_strand", text="Hair")
|
||||||
col.prop(view_layer, "use_volumes", text="Volumes")
|
col.prop(view_layer, "use_volumes", text="Volumes")
|
||||||
if with_freestyle:
|
|
||||||
sub = col.row(align=True)
|
|
||||||
sub.prop(view_layer, "use_freestyle", text="Freestyle")
|
|
||||||
sub.active = rd.use_freestyle
|
|
||||||
|
|
||||||
|
|
||||||
class CYCLES_RENDER_PT_override(CyclesButtonsPanel, Panel):
|
class CYCLES_RENDER_PT_override(CyclesButtonsPanel, Panel):
|
||||||
@@ -1007,6 +1008,7 @@ class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel):
|
|||||||
col.prop(cycles_view_layer, "denoising_optix_input_passes")
|
col.prop(cycles_view_layer, "denoising_optix_input_passes")
|
||||||
return
|
return
|
||||||
elif denoiser == 'OPENIMAGEDENOISE':
|
elif denoiser == 'OPENIMAGEDENOISE':
|
||||||
|
col.prop(cycles_view_layer, "denoising_openimagedenoise_input_passes")
|
||||||
return
|
return
|
||||||
|
|
||||||
col.prop(cycles_view_layer, "denoising_radius", text="Radius")
|
col.prop(cycles_view_layer, "denoising_radius", text="Radius")
|
||||||
@@ -1222,6 +1224,7 @@ def has_geometry_visibility(ob):
|
|||||||
return ob and ((ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META', 'LIGHT'}) or
|
return ob and ((ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META', 'LIGHT'}) or
|
||||||
(ob.instance_type == 'COLLECTION' and ob.instance_collection))
|
(ob.instance_type == 'COLLECTION' and ob.instance_collection))
|
||||||
|
|
||||||
|
|
||||||
class CYCLES_OBJECT_PT_shading(CyclesButtonsPanel, Panel):
|
class CYCLES_OBJECT_PT_shading(CyclesButtonsPanel, Panel):
|
||||||
bl_label = "Shading"
|
bl_label = "Shading"
|
||||||
bl_context = "object"
|
bl_context = "object"
|
||||||
@@ -1244,6 +1247,7 @@ class CYCLES_OBJECT_PT_shading(CyclesButtonsPanel, Panel):
|
|||||||
col = flow.column()
|
col = flow.column()
|
||||||
col.prop(cob, "shadow_terminator_offset")
|
col.prop(cob, "shadow_terminator_offset")
|
||||||
|
|
||||||
|
|
||||||
class CYCLES_OBJECT_PT_visibility(CyclesButtonsPanel, Panel):
|
class CYCLES_OBJECT_PT_visibility(CyclesButtonsPanel, Panel):
|
||||||
bl_label = "Visibility"
|
bl_label = "Visibility"
|
||||||
bl_context = "object"
|
bl_context = "object"
|
||||||
@@ -2024,6 +2028,7 @@ class CYCLES_RENDER_PT_debug(CyclesButtonsPanel, Panel):
|
|||||||
col = layout.column()
|
col = layout.column()
|
||||||
col.label(text="OptiX Flags:")
|
col.label(text="OptiX Flags:")
|
||||||
col.prop(cscene, "debug_optix_cuda_streams")
|
col.prop(cscene, "debug_optix_cuda_streams")
|
||||||
|
col.prop(cscene, "debug_optix_curves_api")
|
||||||
|
|
||||||
col.separator()
|
col.separator()
|
||||||
|
|
||||||
|
@@ -76,6 +76,9 @@ struct BlenderCamera {
|
|||||||
int full_width;
|
int full_width;
|
||||||
int full_height;
|
int full_height;
|
||||||
|
|
||||||
|
int render_width;
|
||||||
|
int render_height;
|
||||||
|
|
||||||
BoundBox2D border;
|
BoundBox2D border;
|
||||||
BoundBox2D pano_viewplane;
|
BoundBox2D pano_viewplane;
|
||||||
BoundBox2D viewport_camera_border;
|
BoundBox2D viewport_camera_border;
|
||||||
@@ -126,8 +129,10 @@ static void blender_camera_init(BlenderCamera *bcam, BL::RenderSettings &b_rende
|
|||||||
bcam->matrix = transform_identity();
|
bcam->matrix = transform_identity();
|
||||||
|
|
||||||
/* render resolution */
|
/* render resolution */
|
||||||
bcam->full_width = render_resolution_x(b_render);
|
bcam->render_width = render_resolution_x(b_render);
|
||||||
bcam->full_height = render_resolution_y(b_render);
|
bcam->render_height = render_resolution_y(b_render);
|
||||||
|
bcam->full_width = bcam->render_width;
|
||||||
|
bcam->full_height = bcam->render_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static float blender_camera_focal_distance(BL::RenderEngine &b_engine,
|
static float blender_camera_focal_distance(BL::RenderEngine &b_engine,
|
||||||
@@ -398,8 +403,8 @@ static void blender_camera_sync(Camera *cam,
|
|||||||
|
|
||||||
/* panorama sensor */
|
/* panorama sensor */
|
||||||
if (bcam->type == CAMERA_PANORAMA && bcam->panorama_type == PANORAMA_FISHEYE_EQUISOLID) {
|
if (bcam->type == CAMERA_PANORAMA && bcam->panorama_type == PANORAMA_FISHEYE_EQUISOLID) {
|
||||||
float fit_xratio = (float)bcam->full_width * bcam->pixelaspect.x;
|
float fit_xratio = (float)bcam->render_width * bcam->pixelaspect.x;
|
||||||
float fit_yratio = (float)bcam->full_height * bcam->pixelaspect.y;
|
float fit_yratio = (float)bcam->render_height * bcam->pixelaspect.y;
|
||||||
bool horizontal_fit;
|
bool horizontal_fit;
|
||||||
float sensor_size;
|
float sensor_size;
|
||||||
|
|
||||||
@@ -709,6 +714,10 @@ static void blender_camera_from_view(BlenderCamera *bcam,
|
|||||||
|
|
||||||
/* 3d view transform */
|
/* 3d view transform */
|
||||||
bcam->matrix = transform_inverse(get_transform(b_rv3d.view_matrix()));
|
bcam->matrix = transform_inverse(get_transform(b_rv3d.view_matrix()));
|
||||||
|
|
||||||
|
/* dimensions */
|
||||||
|
bcam->full_width = width;
|
||||||
|
bcam->full_height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void blender_camera_view_subset(BL::RenderEngine &b_engine,
|
static void blender_camera_view_subset(BL::RenderEngine &b_engine,
|
||||||
|
@@ -200,7 +200,7 @@ template<typename K, typename T> class id_map {
|
|||||||
* To uniquely identify instances, we use the parent, object and persistent instance ID.
|
* To uniquely identify instances, we use the parent, object and persistent instance ID.
|
||||||
* We also export separate object for a mesh and its particle hair. */
|
* We also export separate object for a mesh and its particle hair. */
|
||||||
|
|
||||||
enum { OBJECT_PERSISTENT_ID_SIZE = 16 };
|
enum { OBJECT_PERSISTENT_ID_SIZE = 8 /* MAX_DUPLI_RECUR in Blender. */ };
|
||||||
|
|
||||||
struct ObjectKey {
|
struct ObjectKey {
|
||||||
void *parent;
|
void *parent;
|
||||||
|
@@ -59,7 +59,7 @@ bool BlenderSync::BKE_object_is_modified(BL::Object &b_ob)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BlenderSync::object_is_mesh(BL::Object &b_ob)
|
bool BlenderSync::object_is_geometry(BL::Object &b_ob)
|
||||||
{
|
{
|
||||||
BL::ID b_ob_data = b_ob.data();
|
BL::ID b_ob_data = b_ob.data();
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* only interested in object that we can create meshes from */
|
/* only interested in object that we can create meshes from */
|
||||||
if (!object_is_mesh(b_ob)) {
|
if (!object_is_geometry(b_ob)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -92,6 +92,7 @@ bool debug_flags_sync_from_scene(BL::Scene b_scene)
|
|||||||
flags.cuda.split_kernel = get_boolean(cscene, "debug_use_cuda_split_kernel");
|
flags.cuda.split_kernel = get_boolean(cscene, "debug_use_cuda_split_kernel");
|
||||||
/* Synchronize OptiX flags. */
|
/* Synchronize OptiX flags. */
|
||||||
flags.optix.cuda_streams = get_int(cscene, "debug_optix_cuda_streams");
|
flags.optix.cuda_streams = get_int(cscene, "debug_optix_cuda_streams");
|
||||||
|
flags.optix.curves_api = get_boolean(cscene, "debug_optix_curves_api");
|
||||||
/* Synchronize OpenCL device type. */
|
/* Synchronize OpenCL device type. */
|
||||||
switch (get_enum(cscene, "debug_opencl_device_type")) {
|
switch (get_enum(cscene, "debug_opencl_device_type")) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@@ -492,27 +492,15 @@ void BlenderSession::render(BL::Depsgraph &b_depsgraph_)
|
|||||||
/* Update denoising parameters. */
|
/* Update denoising parameters. */
|
||||||
session->set_denoising(session_params.denoising);
|
session->set_denoising(session_params.denoising);
|
||||||
|
|
||||||
bool use_denoising = session_params.denoising.use;
|
/* Compute render passes and film settings. */
|
||||||
bool store_denoising_passes = session_params.denoising.store_passes;
|
|
||||||
|
|
||||||
buffer_params.denoising_data_pass = use_denoising || store_denoising_passes;
|
|
||||||
buffer_params.denoising_clean_pass = (scene->film->denoising_flags & DENOISING_CLEAN_ALL_PASSES);
|
|
||||||
buffer_params.denoising_prefiltered_pass = store_denoising_passes &&
|
|
||||||
session_params.denoising.type == DENOISER_NLM;
|
|
||||||
|
|
||||||
scene->film->denoising_data_pass = buffer_params.denoising_data_pass;
|
|
||||||
scene->film->denoising_clean_pass = buffer_params.denoising_clean_pass;
|
|
||||||
scene->film->denoising_prefiltered_pass = buffer_params.denoising_prefiltered_pass;
|
|
||||||
|
|
||||||
/* Add passes */
|
|
||||||
vector<Pass> passes = sync->sync_render_passes(
|
vector<Pass> passes = sync->sync_render_passes(
|
||||||
b_rlay, b_view_layer, session_params.adaptive_sampling, session_params.denoising);
|
b_rlay, b_view_layer, session_params.adaptive_sampling, session_params.denoising);
|
||||||
buffer_params.passes = passes;
|
|
||||||
|
|
||||||
scene->film->pass_alpha_threshold = b_view_layer.pass_alpha_threshold();
|
/* Set buffer params, using film settings from sync_render_passes. */
|
||||||
scene->film->tag_passes_update(scene, passes);
|
buffer_params.passes = passes;
|
||||||
scene->film->tag_update(scene);
|
buffer_params.denoising_data_pass = scene->film->denoising_data_pass;
|
||||||
scene->integrator->tag_update(scene);
|
buffer_params.denoising_clean_pass = scene->film->denoising_clean_pass;
|
||||||
|
buffer_params.denoising_prefiltered_pass = scene->film->denoising_prefiltered_pass;
|
||||||
|
|
||||||
BL::RenderResult::views_iterator b_view_iter;
|
BL::RenderResult::views_iterator b_view_iter;
|
||||||
|
|
||||||
|
@@ -815,9 +815,10 @@ static ShaderNode *add_node(Scene *scene,
|
|||||||
sky->ground_albedo = b_sky_node.ground_albedo();
|
sky->ground_albedo = b_sky_node.ground_albedo();
|
||||||
sky->sun_disc = b_sky_node.sun_disc();
|
sky->sun_disc = b_sky_node.sun_disc();
|
||||||
sky->sun_size = b_sky_node.sun_size();
|
sky->sun_size = b_sky_node.sun_size();
|
||||||
|
sky->sun_intensity = b_sky_node.sun_intensity();
|
||||||
sky->sun_elevation = b_sky_node.sun_elevation();
|
sky->sun_elevation = b_sky_node.sun_elevation();
|
||||||
sky->sun_rotation = b_sky_node.sun_rotation();
|
sky->sun_rotation = b_sky_node.sun_rotation();
|
||||||
sky->altitude = b_sky_node.altitude();
|
sky->altitude = 1000.0f * b_sky_node.altitude();
|
||||||
sky->air_density = b_sky_node.air_density();
|
sky->air_density = b_sky_node.air_density();
|
||||||
sky->dust_density = b_sky_node.dust_density();
|
sky->dust_density = b_sky_node.dust_density();
|
||||||
sky->ozone_density = b_sky_node.ozone_density();
|
sky->ozone_density = b_sky_node.ozone_density();
|
||||||
|
@@ -147,30 +147,43 @@ void BlenderSync::sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d
|
|||||||
/* Object */
|
/* Object */
|
||||||
else if (b_id.is_a(&RNA_Object)) {
|
else if (b_id.is_a(&RNA_Object)) {
|
||||||
BL::Object b_ob(b_id);
|
BL::Object b_ob(b_id);
|
||||||
const bool updated_geometry = b_update->is_updated_geometry();
|
const bool is_geometry = object_is_geometry(b_ob);
|
||||||
|
const bool is_light = !is_geometry && object_is_light(b_ob);
|
||||||
|
|
||||||
if (b_update->is_updated_transform() || b_update->is_updated_shading()) {
|
if (is_geometry || is_light) {
|
||||||
object_map.set_recalc(b_ob);
|
const bool updated_geometry = b_update->is_updated_geometry();
|
||||||
light_map.set_recalc(b_ob);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (object_is_mesh(b_ob)) {
|
/* Geometry (mesh, hair, volume). */
|
||||||
if (updated_geometry ||
|
if (is_geometry) {
|
||||||
(object_subdivision_type(b_ob, preview, experimental) != Mesh::SUBDIVISION_NONE)) {
|
if (b_update->is_updated_transform() || b_update->is_updated_shading()) {
|
||||||
BL::ID key = BKE_object_is_modified(b_ob) ? b_ob : b_ob.data();
|
object_map.set_recalc(b_ob);
|
||||||
geometry_map.set_recalc(key);
|
}
|
||||||
|
|
||||||
|
if (updated_geometry ||
|
||||||
|
(object_subdivision_type(b_ob, preview, experimental) != Mesh::SUBDIVISION_NONE)) {
|
||||||
|
BL::ID key = BKE_object_is_modified(b_ob) ? b_ob : b_ob.data();
|
||||||
|
geometry_map.set_recalc(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (updated_geometry) {
|
||||||
|
BL::Object::particle_systems_iterator b_psys;
|
||||||
|
for (b_ob.particle_systems.begin(b_psys); b_psys != b_ob.particle_systems.end();
|
||||||
|
++b_psys) {
|
||||||
|
particle_system_map.set_recalc(b_ob);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
/* Light */
|
||||||
else if (object_is_light(b_ob)) {
|
else if (is_light) {
|
||||||
if (updated_geometry) {
|
if (b_update->is_updated_transform() || b_update->is_updated_shading()) {
|
||||||
light_map.set_recalc(b_ob);
|
object_map.set_recalc(b_ob);
|
||||||
}
|
light_map.set_recalc(b_ob);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updated_geometry) {
|
if (updated_geometry) {
|
||||||
BL::Object::particle_systems_iterator b_psys;
|
light_map.set_recalc(b_ob);
|
||||||
for (b_ob.particle_systems.begin(b_psys); b_psys != b_ob.particle_systems.end(); ++b_psys)
|
}
|
||||||
particle_system_map.set_recalc(b_ob);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Mesh */
|
/* Mesh */
|
||||||
@@ -684,6 +697,16 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
|
|||||||
}
|
}
|
||||||
RNA_END;
|
RNA_END;
|
||||||
|
|
||||||
|
scene->film->denoising_data_pass = denoising.use || denoising.store_passes;
|
||||||
|
scene->film->denoising_clean_pass = (scene->film->denoising_flags & DENOISING_CLEAN_ALL_PASSES);
|
||||||
|
scene->film->denoising_prefiltered_pass = denoising.store_passes &&
|
||||||
|
denoising.type == DENOISER_NLM;
|
||||||
|
|
||||||
|
scene->film->pass_alpha_threshold = b_view_layer.pass_alpha_threshold();
|
||||||
|
scene->film->tag_passes_update(scene, passes);
|
||||||
|
scene->film->tag_update(scene);
|
||||||
|
scene->integrator->tag_update(scene);
|
||||||
|
|
||||||
return passes;
|
return passes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -941,7 +964,13 @@ DenoiseParams BlenderSync::get_denoise_params(BL::Scene &b_scene,
|
|||||||
denoising.strength = get_float(clayer, "denoising_strength");
|
denoising.strength = get_float(clayer, "denoising_strength");
|
||||||
denoising.feature_strength = get_float(clayer, "denoising_feature_strength");
|
denoising.feature_strength = get_float(clayer, "denoising_feature_strength");
|
||||||
denoising.relative_pca = get_boolean(clayer, "denoising_relative_pca");
|
denoising.relative_pca = get_boolean(clayer, "denoising_relative_pca");
|
||||||
denoising.optix_input_passes = get_enum(clayer, "denoising_optix_input_passes");
|
|
||||||
|
denoising.input_passes = (DenoiserInput)get_enum(
|
||||||
|
clayer,
|
||||||
|
(denoising.type == DENOISER_OPTIX) ? "denoising_optix_input_passes" :
|
||||||
|
"denoising_openimagedenoise_input_passes",
|
||||||
|
DENOISER_INPUT_NUM,
|
||||||
|
DENOISER_INPUT_RGB_ALBEDO_NORMAL);
|
||||||
|
|
||||||
denoising.store_passes = get_boolean(clayer, "denoising_store_passes");
|
denoising.store_passes = get_boolean(clayer, "denoising_store_passes");
|
||||||
}
|
}
|
||||||
|
@@ -208,7 +208,7 @@ class BlenderSync {
|
|||||||
/* util */
|
/* util */
|
||||||
void find_shader(BL::ID &id, vector<Shader *> &used_shaders, Shader *default_shader);
|
void find_shader(BL::ID &id, vector<Shader *> &used_shaders, Shader *default_shader);
|
||||||
bool BKE_object_is_modified(BL::Object &b_ob);
|
bool BKE_object_is_modified(BL::Object &b_ob);
|
||||||
bool object_is_mesh(BL::Object &b_ob);
|
bool object_is_geometry(BL::Object &b_ob);
|
||||||
bool object_is_light(BL::Object &b_ob);
|
bool object_is_light(BL::Object &b_ob);
|
||||||
|
|
||||||
/* variables */
|
/* variables */
|
||||||
|
@@ -133,9 +133,9 @@ if(CYCLES_STANDALONE_REPOSITORY)
|
|||||||
set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
|
set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
|
||||||
|
|
||||||
####
|
####
|
||||||
# embree
|
# Embree
|
||||||
if(WITH_CYCLES_EMBREE)
|
if(WITH_CYCLES_EMBREE)
|
||||||
find_package(embree 3.8.0 REQUIRED)
|
find_package(Embree 3.8.0 REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
####
|
####
|
||||||
|
@@ -383,11 +383,24 @@ string CUDADevice::compile_kernel(const DeviceRequestedFeatures &requested_featu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const string ptx = path_get(string_printf("lib/%s_compute_%d%d.ptx", name, major, minor));
|
/* The driver can JIT-compile PTX generated for older generations, so find the closest one. */
|
||||||
VLOG(1) << "Testing for pre-compiled kernel " << ptx << ".";
|
int ptx_major = major, ptx_minor = minor;
|
||||||
if (path_exists(ptx)) {
|
while (ptx_major >= 3) {
|
||||||
VLOG(1) << "Using precompiled kernel.";
|
const string ptx = path_get(
|
||||||
return ptx;
|
string_printf("lib/%s_compute_%d%d.ptx", name, ptx_major, ptx_minor));
|
||||||
|
VLOG(1) << "Testing for pre-compiled kernel " << ptx << ".";
|
||||||
|
if (path_exists(ptx)) {
|
||||||
|
VLOG(1) << "Using precompiled kernel.";
|
||||||
|
return ptx;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ptx_minor > 0) {
|
||||||
|
ptx_minor--;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ptx_major--;
|
||||||
|
ptx_minor = 9;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1760,7 +1773,7 @@ void CUDADevice::denoise(RenderTile &rtile, DenoisingTask &denoising)
|
|||||||
denoising.render_buffer.samples = rtile.sample;
|
denoising.render_buffer.samples = rtile.sample;
|
||||||
denoising.buffer.gpu_temporary_mem = true;
|
denoising.buffer.gpu_temporary_mem = true;
|
||||||
|
|
||||||
denoising.run_denoising(&rtile);
|
denoising.run_denoising(rtile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CUDADevice::adaptive_sampling_filter(uint filter_sample,
|
void CUDADevice::adaptive_sampling_filter(uint filter_sample,
|
||||||
|
@@ -209,13 +209,13 @@ bool Device::bind_fallback_display_space_shader(const float width, const float h
|
|||||||
glUseProgram(fallback_shader_program);
|
glUseProgram(fallback_shader_program);
|
||||||
image_texture_location = glGetUniformLocation(fallback_shader_program, "image_texture");
|
image_texture_location = glGetUniformLocation(fallback_shader_program, "image_texture");
|
||||||
if (image_texture_location < 0) {
|
if (image_texture_location < 0) {
|
||||||
LOG(ERROR) << "Shader doesn't containt the 'image_texture' uniform.";
|
LOG(ERROR) << "Shader doesn't contain the 'image_texture' uniform.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
fullscreen_location = glGetUniformLocation(fallback_shader_program, "fullscreen");
|
fullscreen_location = glGetUniformLocation(fallback_shader_program, "fullscreen");
|
||||||
if (fullscreen_location < 0) {
|
if (fullscreen_location < 0) {
|
||||||
LOG(ERROR) << "Shader doesn't containt the 'fullscreen' uniform.";
|
LOG(ERROR) << "Shader doesn't contain the 'fullscreen' uniform.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -439,10 +439,10 @@ class Device {
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
virtual void map_neighbor_tiles(Device * /*sub_device*/, RenderTile * /*tiles*/)
|
virtual void map_neighbor_tiles(Device * /*sub_device*/, RenderTileNeighbors & /*neighbors*/)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual void unmap_neighbor_tiles(Device * /*sub_device*/, RenderTile * /*tiles*/)
|
virtual void unmap_neighbor_tiles(Device * /*sub_device*/, RenderTileNeighbors & /*neighbors*/)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -182,6 +182,7 @@ class CPUDevice : public Device {
|
|||||||
oidn::DeviceRef oidn_device;
|
oidn::DeviceRef oidn_device;
|
||||||
oidn::FilterRef oidn_filter;
|
oidn::FilterRef oidn_filter;
|
||||||
#endif
|
#endif
|
||||||
|
thread_spin_lock oidn_task_lock;
|
||||||
|
|
||||||
bool use_split_kernel;
|
bool use_split_kernel;
|
||||||
|
|
||||||
@@ -948,12 +949,25 @@ class CPUDevice : public Device {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void denoise_openimagedenoise(DeviceTask &task, RenderTile &rtile)
|
void denoise_openimagedenoise_buffer(DeviceTask &task,
|
||||||
|
float *buffer,
|
||||||
|
const size_t offset,
|
||||||
|
const size_t stride,
|
||||||
|
const size_t x,
|
||||||
|
const size_t y,
|
||||||
|
const size_t w,
|
||||||
|
const size_t h,
|
||||||
|
const float scale)
|
||||||
{
|
{
|
||||||
#ifdef WITH_OPENIMAGEDENOISE
|
#ifdef WITH_OPENIMAGEDENOISE
|
||||||
assert(openimagedenoise_supported());
|
assert(openimagedenoise_supported());
|
||||||
|
|
||||||
/* Only one at a time, since OpenImageDenoise itself is multithreaded. */
|
/* Only one at a time, since OpenImageDenoise itself is multithreaded for full
|
||||||
|
* buffers, and for tiled rendering because creating multiple devices and filters
|
||||||
|
* is slow and memory hungry as well.
|
||||||
|
*
|
||||||
|
* TODO: optimize tiled rendering case, by batching together denoising of many
|
||||||
|
* tiles somehow? */
|
||||||
static thread_mutex mutex;
|
static thread_mutex mutex;
|
||||||
thread_scoped_lock lock(mutex);
|
thread_scoped_lock lock(mutex);
|
||||||
|
|
||||||
@@ -964,54 +978,192 @@ class CPUDevice : public Device {
|
|||||||
}
|
}
|
||||||
if (!oidn_filter) {
|
if (!oidn_filter) {
|
||||||
oidn_filter = oidn_device.newFilter("RT");
|
oidn_filter = oidn_device.newFilter("RT");
|
||||||
|
oidn_filter.set("hdr", true);
|
||||||
|
oidn_filter.set("srgb", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy pixels from compute device to CPU (no-op for CPU device). */
|
|
||||||
rtile.buffers->buffer.copy_from_device();
|
|
||||||
|
|
||||||
/* Set images with appropriate stride for our interleaved pass storage. */
|
/* Set images with appropriate stride for our interleaved pass storage. */
|
||||||
const struct {
|
struct {
|
||||||
const char *name;
|
const char *name;
|
||||||
int offset;
|
const int offset;
|
||||||
} passes[] = {{"color", task.pass_denoising_data + DENOISING_PASS_COLOR},
|
const bool scale;
|
||||||
{"normal", task.pass_denoising_data + DENOISING_PASS_NORMAL},
|
const bool use;
|
||||||
{"albedo", task.pass_denoising_data + DENOISING_PASS_ALBEDO},
|
array<float> scaled_buffer;
|
||||||
{"output", 0},
|
} passes[] = {{"color", task.pass_denoising_data + DENOISING_PASS_COLOR, false, true},
|
||||||
|
{"albedo",
|
||||||
|
task.pass_denoising_data + DENOISING_PASS_ALBEDO,
|
||||||
|
true,
|
||||||
|
task.denoising.input_passes >= DENOISER_INPUT_RGB_ALBEDO},
|
||||||
|
{"normal",
|
||||||
|
task.pass_denoising_data + DENOISING_PASS_NORMAL,
|
||||||
|
true,
|
||||||
|
task.denoising.input_passes >= DENOISER_INPUT_RGB_ALBEDO_NORMAL},
|
||||||
|
{"output", 0, false, true},
|
||||||
{ NULL,
|
{ NULL,
|
||||||
0 }};
|
0 }};
|
||||||
|
|
||||||
for (int i = 0; passes[i].name; i++) {
|
for (int i = 0; passes[i].name; i++) {
|
||||||
const int64_t offset = rtile.offset + rtile.x + rtile.y * rtile.stride;
|
if (!passes[i].use) {
|
||||||
const int64_t buffer_offset = (offset * task.pass_stride + passes[i].offset) * sizeof(float);
|
continue;
|
||||||
const int64_t pixel_stride = task.pass_stride * sizeof(float);
|
}
|
||||||
const int64_t row_stride = rtile.stride * pixel_stride;
|
|
||||||
|
|
||||||
oidn_filter.setImage(passes[i].name,
|
const int64_t pixel_offset = offset + x + y * stride;
|
||||||
(char *)rtile.buffer + buffer_offset,
|
const int64_t buffer_offset = (pixel_offset * task.pass_stride + passes[i].offset);
|
||||||
oidn::Format::Float3,
|
const int64_t pixel_stride = task.pass_stride;
|
||||||
rtile.w,
|
const int64_t row_stride = stride * pixel_stride;
|
||||||
rtile.h,
|
|
||||||
0,
|
if (passes[i].scale && scale != 1.0f) {
|
||||||
pixel_stride,
|
/* Normalize albedo and normal passes as they are scaled by the number of samples.
|
||||||
row_stride);
|
* For the color passes OIDN will perform auto-exposure making it unnecessary. */
|
||||||
|
array<float> &scaled_buffer = passes[i].scaled_buffer;
|
||||||
|
scaled_buffer.resize(w * h * 3);
|
||||||
|
|
||||||
|
for (int y = 0; y < h; y++) {
|
||||||
|
const float *pass_row = buffer + buffer_offset + y * row_stride;
|
||||||
|
float *scaled_row = scaled_buffer.data() + y * w * 3;
|
||||||
|
|
||||||
|
for (int x = 0; x < w; x++) {
|
||||||
|
scaled_row[x * 3 + 0] = pass_row[x * pixel_stride + 0] * scale;
|
||||||
|
scaled_row[x * 3 + 1] = pass_row[x * pixel_stride + 1] * scale;
|
||||||
|
scaled_row[x * 3 + 2] = pass_row[x * pixel_stride + 2] * scale;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
oidn_filter.setImage(
|
||||||
|
passes[i].name, scaled_buffer.data(), oidn::Format::Float3, w, h, 0, 0, 0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
oidn_filter.setImage(passes[i].name,
|
||||||
|
buffer + buffer_offset,
|
||||||
|
oidn::Format::Float3,
|
||||||
|
w,
|
||||||
|
h,
|
||||||
|
0,
|
||||||
|
pixel_stride * sizeof(float),
|
||||||
|
row_stride * sizeof(float));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Execute filter. */
|
/* Execute filter. */
|
||||||
oidn_filter.set("hdr", true);
|
|
||||||
oidn_filter.set("srgb", false);
|
|
||||||
oidn_filter.commit();
|
oidn_filter.commit();
|
||||||
oidn_filter.execute();
|
oidn_filter.execute();
|
||||||
|
|
||||||
/* todo: it may be possible to avoid this copy, but we have to ensure that
|
|
||||||
* when other code copies data from the device it doesn't overwrite the
|
|
||||||
* denoiser buffers. */
|
|
||||||
rtile.buffers->buffer.copy_to_device();
|
|
||||||
#else
|
#else
|
||||||
(void)task;
|
(void)task;
|
||||||
(void)rtile;
|
(void)buffer;
|
||||||
|
(void)offset;
|
||||||
|
(void)stride;
|
||||||
|
(void)x;
|
||||||
|
(void)y;
|
||||||
|
(void)w;
|
||||||
|
(void)h;
|
||||||
|
(void)scale;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void denoise_openimagedenoise(DeviceTask &task, RenderTile &rtile)
|
||||||
|
{
|
||||||
|
if (task.type == DeviceTask::DENOISE_BUFFER) {
|
||||||
|
/* Copy pixels from compute device to CPU (no-op for CPU device). */
|
||||||
|
rtile.buffers->buffer.copy_from_device();
|
||||||
|
|
||||||
|
denoise_openimagedenoise_buffer(task,
|
||||||
|
(float *)rtile.buffer,
|
||||||
|
rtile.offset,
|
||||||
|
rtile.stride,
|
||||||
|
rtile.x,
|
||||||
|
rtile.y,
|
||||||
|
rtile.w,
|
||||||
|
rtile.h,
|
||||||
|
1.0f / rtile.sample);
|
||||||
|
|
||||||
|
/* todo: it may be possible to avoid this copy, but we have to ensure that
|
||||||
|
* when other code copies data from the device it doesn't overwrite the
|
||||||
|
* denoiser buffers. */
|
||||||
|
rtile.buffers->buffer.copy_to_device();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* Per-tile denoising. */
|
||||||
|
rtile.sample = rtile.start_sample + rtile.num_samples;
|
||||||
|
const float scale = 1.0f / rtile.sample;
|
||||||
|
const float invscale = rtile.sample;
|
||||||
|
const size_t pass_stride = task.pass_stride;
|
||||||
|
|
||||||
|
/* Map neighboring tiles into one buffer for denoising. */
|
||||||
|
RenderTileNeighbors neighbors(rtile);
|
||||||
|
task.map_neighbor_tiles(neighbors, this);
|
||||||
|
RenderTile ¢er_tile = neighbors.tiles[RenderTileNeighbors::CENTER];
|
||||||
|
rtile = center_tile;
|
||||||
|
|
||||||
|
/* Calculate size of the tile to denoise (including overlap). The overlap
|
||||||
|
* size was chosen empirically. OpenImageDenoise specifies an overlap size
|
||||||
|
* of 128 but this is significantly bigger than typical tile size. */
|
||||||
|
const int4 rect = rect_clip(rect_expand(center_tile.bounds(), 64), neighbors.bounds());
|
||||||
|
const int2 rect_size = make_int2(rect.z - rect.x, rect.w - rect.y);
|
||||||
|
|
||||||
|
/* Adjacent tiles are in separate memory regions, copy into single buffer. */
|
||||||
|
array<float> merged(rect_size.x * rect_size.y * task.pass_stride);
|
||||||
|
|
||||||
|
for (int i = 0; i < RenderTileNeighbors::SIZE; i++) {
|
||||||
|
RenderTile &ntile = neighbors.tiles[i];
|
||||||
|
if (!ntile.buffer) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int xmin = max(ntile.x, rect.x);
|
||||||
|
const int ymin = max(ntile.y, rect.y);
|
||||||
|
const int xmax = min(ntile.x + ntile.w, rect.z);
|
||||||
|
const int ymax = min(ntile.y + ntile.h, rect.w);
|
||||||
|
|
||||||
|
const size_t tile_offset = ntile.offset + xmin + ymin * ntile.stride;
|
||||||
|
const float *tile_buffer = (float *)ntile.buffer + tile_offset * pass_stride;
|
||||||
|
|
||||||
|
const size_t merged_stride = rect_size.x;
|
||||||
|
const size_t merged_offset = (xmin - rect.x) + (ymin - rect.y) * merged_stride;
|
||||||
|
float *merged_buffer = merged.data() + merged_offset * pass_stride;
|
||||||
|
|
||||||
|
for (int y = ymin; y < ymax; y++) {
|
||||||
|
for (int x = 0; x < pass_stride * (xmax - xmin); x++) {
|
||||||
|
merged_buffer[x] = tile_buffer[x] * scale;
|
||||||
|
}
|
||||||
|
tile_buffer += ntile.stride * pass_stride;
|
||||||
|
merged_buffer += merged_stride * pass_stride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Denoise */
|
||||||
|
denoise_openimagedenoise_buffer(
|
||||||
|
task, merged.data(), 0, rect_size.x, 0, 0, rect_size.x, rect_size.y, 1.0f);
|
||||||
|
|
||||||
|
/* Copy back result from merged buffer. */
|
||||||
|
RenderTile &ntile = neighbors.target;
|
||||||
|
if (ntile.buffer) {
|
||||||
|
const int xmin = max(ntile.x, rect.x);
|
||||||
|
const int ymin = max(ntile.y, rect.y);
|
||||||
|
const int xmax = min(ntile.x + ntile.w, rect.z);
|
||||||
|
const int ymax = min(ntile.y + ntile.h, rect.w);
|
||||||
|
|
||||||
|
const size_t tile_offset = ntile.offset + xmin + ymin * ntile.stride;
|
||||||
|
float *tile_buffer = (float *)ntile.buffer + tile_offset * pass_stride;
|
||||||
|
|
||||||
|
const size_t merged_stride = rect_size.x;
|
||||||
|
const size_t merged_offset = (xmin - rect.x) + (ymin - rect.y) * merged_stride;
|
||||||
|
const float *merged_buffer = merged.data() + merged_offset * pass_stride;
|
||||||
|
|
||||||
|
for (int y = ymin; y < ymax; y++) {
|
||||||
|
for (int x = 0; x < pass_stride * (xmax - xmin); x += pass_stride) {
|
||||||
|
tile_buffer[x + 0] = merged_buffer[x + 0] * invscale;
|
||||||
|
tile_buffer[x + 1] = merged_buffer[x + 1] * invscale;
|
||||||
|
tile_buffer[x + 2] = merged_buffer[x + 2] * invscale;
|
||||||
|
}
|
||||||
|
tile_buffer += ntile.stride * pass_stride;
|
||||||
|
merged_buffer += merged_stride * pass_stride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task.unmap_neighbor_tiles(neighbors, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void denoise_nlm(DenoisingTask &denoising, RenderTile &tile)
|
void denoise_nlm(DenoisingTask &denoising, RenderTile &tile)
|
||||||
{
|
{
|
||||||
ProfilingHelper profiling(denoising.profiler, PROFILING_DENOISING);
|
ProfilingHelper profiling(denoising.profiler, PROFILING_DENOISING);
|
||||||
@@ -1040,7 +1192,7 @@ class CPUDevice : public Device {
|
|||||||
denoising.render_buffer.samples = tile.sample;
|
denoising.render_buffer.samples = tile.sample;
|
||||||
denoising.buffer.gpu_temporary_mem = false;
|
denoising.buffer.gpu_temporary_mem = false;
|
||||||
|
|
||||||
denoising.run_denoising(&tile);
|
denoising.run_denoising(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void thread_render(DeviceTask &task)
|
void thread_render(DeviceTask &task)
|
||||||
@@ -1070,10 +1222,23 @@ class CPUDevice : public Device {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* NLM denoiser. */
|
||||||
DenoisingTask *denoising = NULL;
|
DenoisingTask *denoising = NULL;
|
||||||
|
|
||||||
|
/* OpenImageDenoise: we can only denoise with one thread at a time, so to
|
||||||
|
* avoid waiting with mutex locks in the denoiser, we let only a single
|
||||||
|
* thread acquire denoising tiles. */
|
||||||
|
uint tile_types = task.tile_types;
|
||||||
|
bool hold_denoise_lock = false;
|
||||||
|
if ((tile_types & RenderTile::DENOISE) && task.denoising.type == DENOISER_OPENIMAGEDENOISE) {
|
||||||
|
if (!oidn_task_lock.try_lock()) {
|
||||||
|
tile_types &= ~RenderTile::DENOISE;
|
||||||
|
hold_denoise_lock = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RenderTile tile;
|
RenderTile tile;
|
||||||
while (task.acquire_tile(this, tile, task.tile_types)) {
|
while (task.acquire_tile(this, tile, tile_types)) {
|
||||||
if (tile.task == RenderTile::PATH_TRACE) {
|
if (tile.task == RenderTile::PATH_TRACE) {
|
||||||
if (use_split_kernel) {
|
if (use_split_kernel) {
|
||||||
device_only_memory<uchar> void_buffer(this, "void_buffer");
|
device_only_memory<uchar> void_buffer(this, "void_buffer");
|
||||||
@@ -1108,6 +1273,10 @@ class CPUDevice : public Device {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hold_denoise_lock) {
|
||||||
|
oidn_task_lock.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
profiler.remove_state(&kg->profiler);
|
profiler.remove_state(&kg->profiler);
|
||||||
|
|
||||||
thread_kernel_globals_free((KernelGlobals *)kgbuffer.device_pointer);
|
thread_kernel_globals_free((KernelGlobals *)kgbuffer.device_pointer);
|
||||||
|
@@ -71,29 +71,30 @@ DenoisingTask::~DenoisingTask()
|
|||||||
tile_info_mem.free();
|
tile_info_mem.free();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DenoisingTask::set_render_buffer(RenderTile *rtiles)
|
void DenoisingTask::set_render_buffer(RenderTileNeighbors &neighbors)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 9; i++) {
|
for (int i = 0; i < RenderTileNeighbors::SIZE; i++) {
|
||||||
tile_info->offsets[i] = rtiles[i].offset;
|
RenderTile &rtile = neighbors.tiles[i];
|
||||||
tile_info->strides[i] = rtiles[i].stride;
|
tile_info->offsets[i] = rtile.offset;
|
||||||
tile_info->buffers[i] = rtiles[i].buffer;
|
tile_info->strides[i] = rtile.stride;
|
||||||
|
tile_info->buffers[i] = rtile.buffer;
|
||||||
}
|
}
|
||||||
tile_info->x[0] = rtiles[3].x;
|
tile_info->x[0] = neighbors.tiles[3].x;
|
||||||
tile_info->x[1] = rtiles[4].x;
|
tile_info->x[1] = neighbors.tiles[4].x;
|
||||||
tile_info->x[2] = rtiles[5].x;
|
tile_info->x[2] = neighbors.tiles[5].x;
|
||||||
tile_info->x[3] = rtiles[5].x + rtiles[5].w;
|
tile_info->x[3] = neighbors.tiles[5].x + neighbors.tiles[5].w;
|
||||||
tile_info->y[0] = rtiles[1].y;
|
tile_info->y[0] = neighbors.tiles[1].y;
|
||||||
tile_info->y[1] = rtiles[4].y;
|
tile_info->y[1] = neighbors.tiles[4].y;
|
||||||
tile_info->y[2] = rtiles[7].y;
|
tile_info->y[2] = neighbors.tiles[7].y;
|
||||||
tile_info->y[3] = rtiles[7].y + rtiles[7].h;
|
tile_info->y[3] = neighbors.tiles[7].y + neighbors.tiles[7].h;
|
||||||
|
|
||||||
target_buffer.offset = rtiles[9].offset;
|
target_buffer.offset = neighbors.target.offset;
|
||||||
target_buffer.stride = rtiles[9].stride;
|
target_buffer.stride = neighbors.target.stride;
|
||||||
target_buffer.ptr = rtiles[9].buffer;
|
target_buffer.ptr = neighbors.target.buffer;
|
||||||
|
|
||||||
if (do_prefilter && rtiles[9].buffers) {
|
if (do_prefilter && neighbors.target.buffers) {
|
||||||
target_buffer.denoising_output_offset =
|
target_buffer.denoising_output_offset =
|
||||||
rtiles[9].buffers->params.get_denoising_prefiltered_offset();
|
neighbors.target.buffers->params.get_denoising_prefiltered_offset();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
target_buffer.denoising_output_offset = 0;
|
target_buffer.denoising_output_offset = 0;
|
||||||
@@ -320,12 +321,11 @@ void DenoisingTask::reconstruct()
|
|||||||
functions.solve(target_buffer.ptr);
|
functions.solve(target_buffer.ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DenoisingTask::run_denoising(RenderTile *tile)
|
void DenoisingTask::run_denoising(RenderTile &tile)
|
||||||
{
|
{
|
||||||
RenderTile rtiles[10];
|
RenderTileNeighbors neighbors(tile);
|
||||||
rtiles[4] = *tile;
|
functions.map_neighbor_tiles(neighbors);
|
||||||
functions.map_neighbor_tiles(rtiles);
|
set_render_buffer(neighbors);
|
||||||
set_render_buffer(rtiles);
|
|
||||||
|
|
||||||
setup_denoising_buffer();
|
setup_denoising_buffer();
|
||||||
|
|
||||||
@@ -347,7 +347,7 @@ void DenoisingTask::run_denoising(RenderTile *tile)
|
|||||||
write_buffer();
|
write_buffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
functions.unmap_neighbor_tiles(rtiles);
|
functions.unmap_neighbor_tiles(neighbors);
|
||||||
}
|
}
|
||||||
|
|
||||||
CCL_NAMESPACE_END
|
CCL_NAMESPACE_END
|
||||||
|
@@ -102,8 +102,8 @@ class DenoisingTask {
|
|||||||
device_ptr output_ptr)>
|
device_ptr output_ptr)>
|
||||||
detect_outliers;
|
detect_outliers;
|
||||||
function<bool(int out_offset, device_ptr frop_ptr, device_ptr buffer_ptr)> write_feature;
|
function<bool(int out_offset, device_ptr frop_ptr, device_ptr buffer_ptr)> write_feature;
|
||||||
function<void(RenderTile *rtiles)> map_neighbor_tiles;
|
function<void(RenderTileNeighbors &neighbors)> map_neighbor_tiles;
|
||||||
function<void(RenderTile *rtiles)> unmap_neighbor_tiles;
|
function<void(RenderTileNeighbors &neighbors)> unmap_neighbor_tiles;
|
||||||
} functions;
|
} functions;
|
||||||
|
|
||||||
/* Stores state of the current Reconstruction operation,
|
/* Stores state of the current Reconstruction operation,
|
||||||
@@ -154,7 +154,7 @@ class DenoisingTask {
|
|||||||
DenoisingTask(Device *device, const DeviceTask &task);
|
DenoisingTask(Device *device, const DeviceTask &task);
|
||||||
~DenoisingTask();
|
~DenoisingTask();
|
||||||
|
|
||||||
void run_denoising(RenderTile *tile);
|
void run_denoising(RenderTile &tile);
|
||||||
|
|
||||||
struct DenoiseBuffers {
|
struct DenoiseBuffers {
|
||||||
int pass_stride;
|
int pass_stride;
|
||||||
@@ -179,7 +179,7 @@ class DenoisingTask {
|
|||||||
protected:
|
protected:
|
||||||
Device *device;
|
Device *device;
|
||||||
|
|
||||||
void set_render_buffer(RenderTile *rtiles);
|
void set_render_buffer(RenderTileNeighbors &neighbors);
|
||||||
void setup_denoising_buffer();
|
void setup_denoising_buffer();
|
||||||
void prefilter_shadowing();
|
void prefilter_shadowing();
|
||||||
void prefilter_features();
|
void prefilter_features();
|
||||||
|
@@ -177,8 +177,11 @@ class MultiDevice : public Device {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (requested_features.use_denoising) {
|
if (requested_features.use_denoising) {
|
||||||
|
/* Only need denoising feature, everything else is unused. */
|
||||||
|
DeviceRequestedFeatures denoising_features;
|
||||||
|
denoising_features.use_denoising = true;
|
||||||
foreach (SubDevice &sub, denoising_devices)
|
foreach (SubDevice &sub, denoising_devices)
|
||||||
if (!sub.device->load_kernels(requested_features))
|
if (!sub.device->load_kernels(denoising_features))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -581,20 +584,22 @@ class MultiDevice : public Device {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_neighbor_tiles(Device *sub_device, RenderTile *tiles)
|
void map_neighbor_tiles(Device *sub_device, RenderTileNeighbors &neighbors)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 9; i++) {
|
for (int i = 0; i < RenderTileNeighbors::SIZE; i++) {
|
||||||
if (!tiles[i].buffers) {
|
RenderTile &tile = neighbors.tiles[i];
|
||||||
|
|
||||||
|
if (!tile.buffers) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
device_vector<float> &mem = tiles[i].buffers->buffer;
|
device_vector<float> &mem = tile.buffers->buffer;
|
||||||
tiles[i].buffer = mem.device_pointer;
|
tile.buffer = mem.device_pointer;
|
||||||
|
|
||||||
if (mem.device == this && matching_rendering_and_denoising_devices) {
|
if (mem.device == this && matching_rendering_and_denoising_devices) {
|
||||||
/* Skip unnecessary copies in viewport mode (buffer covers the
|
/* Skip unnecessary copies in viewport mode (buffer covers the
|
||||||
* whole image), but still need to fix up the tile device pointer. */
|
* whole image), but still need to fix up the tile device pointer. */
|
||||||
map_tile(sub_device, tiles[i]);
|
map_tile(sub_device, tile);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -607,15 +612,15 @@ class MultiDevice : public Device {
|
|||||||
* also required for the case where a CPU thread is denoising
|
* also required for the case where a CPU thread is denoising
|
||||||
* a tile rendered on the GPU. In that case we have to avoid
|
* a tile rendered on the GPU. In that case we have to avoid
|
||||||
* overwriting the buffer being de-noised by the CPU thread. */
|
* overwriting the buffer being de-noised by the CPU thread. */
|
||||||
if (!tiles[i].buffers->map_neighbor_copied) {
|
if (!tile.buffers->map_neighbor_copied) {
|
||||||
tiles[i].buffers->map_neighbor_copied = true;
|
tile.buffers->map_neighbor_copied = true;
|
||||||
mem.copy_from_device();
|
mem.copy_from_device();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mem.device == this) {
|
if (mem.device == this) {
|
||||||
/* Can re-use memory if tile is already allocated on the sub device. */
|
/* Can re-use memory if tile is already allocated on the sub device. */
|
||||||
map_tile(sub_device, tiles[i]);
|
map_tile(sub_device, tile);
|
||||||
mem.swap_device(sub_device, mem.device_size, tiles[i].buffer);
|
mem.swap_device(sub_device, mem.device_size, tile.buffer);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mem.swap_device(sub_device, 0, 0);
|
mem.swap_device(sub_device, 0, 0);
|
||||||
@@ -623,40 +628,42 @@ class MultiDevice : public Device {
|
|||||||
|
|
||||||
mem.copy_to_device();
|
mem.copy_to_device();
|
||||||
|
|
||||||
tiles[i].buffer = mem.device_pointer;
|
tile.buffer = mem.device_pointer;
|
||||||
tiles[i].device_size = mem.device_size;
|
tile.device_size = mem.device_size;
|
||||||
|
|
||||||
mem.restore_device();
|
mem.restore_device();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void unmap_neighbor_tiles(Device *sub_device, RenderTile *tiles)
|
void unmap_neighbor_tiles(Device *sub_device, RenderTileNeighbors &neighbors)
|
||||||
{
|
{
|
||||||
device_vector<float> &mem = tiles[9].buffers->buffer;
|
RenderTile &target_tile = neighbors.target;
|
||||||
|
device_vector<float> &mem = target_tile.buffers->buffer;
|
||||||
|
|
||||||
if (mem.device == this && matching_rendering_and_denoising_devices) {
|
if (mem.device == this && matching_rendering_and_denoising_devices) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy denoised result back to the host. */
|
/* Copy denoised result back to the host. */
|
||||||
mem.swap_device(sub_device, tiles[9].device_size, tiles[9].buffer);
|
mem.swap_device(sub_device, target_tile.device_size, target_tile.buffer);
|
||||||
mem.copy_from_device();
|
mem.copy_from_device();
|
||||||
mem.restore_device();
|
mem.restore_device();
|
||||||
|
|
||||||
/* Copy denoised result to the original device. */
|
/* Copy denoised result to the original device. */
|
||||||
mem.copy_to_device();
|
mem.copy_to_device();
|
||||||
|
|
||||||
for (int i = 0; i < 9; i++) {
|
for (int i = 0; i < RenderTileNeighbors::SIZE; i++) {
|
||||||
if (!tiles[i].buffers) {
|
RenderTile &tile = neighbors.tiles[i];
|
||||||
|
if (!tile.buffers) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
device_vector<float> &mem = tiles[i].buffers->buffer;
|
device_vector<float> &mem = tile.buffers->buffer;
|
||||||
|
|
||||||
if (mem.device != sub_device && mem.device != this) {
|
if (mem.device != sub_device && mem.device != this) {
|
||||||
/* Free up memory again if it was allocated for the copy above. */
|
/* Free up memory again if it was allocated for the copy above. */
|
||||||
mem.swap_device(sub_device, tiles[i].device_size, tiles[i].buffer);
|
mem.swap_device(sub_device, tile.device_size, tile.buffer);
|
||||||
sub_device->mem_free(mem);
|
sub_device->mem_free(mem);
|
||||||
mem.restore_device();
|
mem.restore_device();
|
||||||
}
|
}
|
||||||
|
@@ -131,8 +131,12 @@ class OptiXDevice : public CUDADevice {
|
|||||||
PG_RGEN,
|
PG_RGEN,
|
||||||
PG_MISS,
|
PG_MISS,
|
||||||
PG_HITD, // Default hit group
|
PG_HITD, // Default hit group
|
||||||
PG_HITL, // __BVH_LOCAL__ hit group
|
|
||||||
PG_HITS, // __SHADOW_RECORD_ALL__ hit group
|
PG_HITS, // __SHADOW_RECORD_ALL__ hit group
|
||||||
|
PG_HITL, // __BVH_LOCAL__ hit group (only used for triangles)
|
||||||
|
# if OPTIX_ABI_VERSION >= 36
|
||||||
|
PG_HITD_MOTION,
|
||||||
|
PG_HITS_MOTION,
|
||||||
|
# endif
|
||||||
# ifdef WITH_CYCLES_DEBUG
|
# ifdef WITH_CYCLES_DEBUG
|
||||||
PG_EXCP,
|
PG_EXCP,
|
||||||
# endif
|
# endif
|
||||||
@@ -177,6 +181,7 @@ class OptiXDevice : public CUDADevice {
|
|||||||
OptixDeviceContext context = NULL;
|
OptixDeviceContext context = NULL;
|
||||||
|
|
||||||
OptixModule optix_module = NULL; // All necessary OptiX kernels are in one module
|
OptixModule optix_module = NULL; // All necessary OptiX kernels are in one module
|
||||||
|
OptixModule builtin_modules[2] = {};
|
||||||
OptixPipeline pipelines[NUM_PIPELINES] = {};
|
OptixPipeline pipelines[NUM_PIPELINES] = {};
|
||||||
|
|
||||||
bool motion_blur = false;
|
bool motion_blur = false;
|
||||||
@@ -264,6 +269,9 @@ class OptiXDevice : public CUDADevice {
|
|||||||
// Unload modules
|
// Unload modules
|
||||||
if (optix_module != NULL)
|
if (optix_module != NULL)
|
||||||
optixModuleDestroy(optix_module);
|
optixModuleDestroy(optix_module);
|
||||||
|
for (unsigned int i = 0; i < 2; ++i)
|
||||||
|
if (builtin_modules[i] != NULL)
|
||||||
|
optixModuleDestroy(builtin_modules[i]);
|
||||||
for (unsigned int i = 0; i < NUM_PIPELINES; ++i)
|
for (unsigned int i = 0; i < NUM_PIPELINES; ++i)
|
||||||
if (pipelines[i] != NULL)
|
if (pipelines[i] != NULL)
|
||||||
optixPipelineDestroy(pipelines[i]);
|
optixPipelineDestroy(pipelines[i]);
|
||||||
@@ -338,6 +346,12 @@ class OptiXDevice : public CUDADevice {
|
|||||||
optixModuleDestroy(optix_module);
|
optixModuleDestroy(optix_module);
|
||||||
optix_module = NULL;
|
optix_module = NULL;
|
||||||
}
|
}
|
||||||
|
for (unsigned int i = 0; i < 2; ++i) {
|
||||||
|
if (builtin_modules[i] != NULL) {
|
||||||
|
optixModuleDestroy(builtin_modules[i]);
|
||||||
|
builtin_modules[i] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
for (unsigned int i = 0; i < NUM_PIPELINES; ++i) {
|
for (unsigned int i = 0; i < NUM_PIPELINES; ++i) {
|
||||||
if (pipelines[i] != NULL) {
|
if (pipelines[i] != NULL) {
|
||||||
optixPipelineDestroy(pipelines[i]);
|
optixPipelineDestroy(pipelines[i]);
|
||||||
@@ -369,6 +383,18 @@ class OptiXDevice : public CUDADevice {
|
|||||||
# endif
|
# endif
|
||||||
pipeline_options.pipelineLaunchParamsVariableName = "__params"; // See kernel_globals.h
|
pipeline_options.pipelineLaunchParamsVariableName = "__params"; // See kernel_globals.h
|
||||||
|
|
||||||
|
# if OPTIX_ABI_VERSION >= 36
|
||||||
|
pipeline_options.usesPrimitiveTypeFlags = OPTIX_PRIMITIVE_TYPE_FLAGS_TRIANGLE;
|
||||||
|
if (requested_features.use_hair) {
|
||||||
|
if (DebugFlags().optix.curves_api && requested_features.use_hair_thick) {
|
||||||
|
pipeline_options.usesPrimitiveTypeFlags |= OPTIX_PRIMITIVE_TYPE_FLAGS_ROUND_CUBIC_BSPLINE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
pipeline_options.usesPrimitiveTypeFlags |= OPTIX_PRIMITIVE_TYPE_FLAGS_CUSTOM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
// Keep track of whether motion blur is enabled, so to enable/disable motion in BVH builds
|
// Keep track of whether motion blur is enabled, so to enable/disable motion in BVH builds
|
||||||
// This is necessary since objects may be reported to have motion if the Vector pass is
|
// This is necessary since objects may be reported to have motion if the Vector pass is
|
||||||
// active, but may still need to be rendered without motion blur if that isn't active as well
|
// active, but may still need to be rendered without motion blur if that isn't active as well
|
||||||
@@ -442,6 +468,34 @@ class OptiXDevice : public CUDADevice {
|
|||||||
group_descs[PG_HITD].hitgroup.entryFunctionNameIS = "__intersection__curve_ribbon";
|
group_descs[PG_HITD].hitgroup.entryFunctionNameIS = "__intersection__curve_ribbon";
|
||||||
group_descs[PG_HITS].hitgroup.entryFunctionNameIS = "__intersection__curve_ribbon";
|
group_descs[PG_HITS].hitgroup.entryFunctionNameIS = "__intersection__curve_ribbon";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# if OPTIX_ABI_VERSION >= 36
|
||||||
|
if (DebugFlags().optix.curves_api && requested_features.use_hair_thick) {
|
||||||
|
OptixBuiltinISOptions builtin_options;
|
||||||
|
builtin_options.builtinISModuleType = OPTIX_PRIMITIVE_TYPE_ROUND_CUBIC_BSPLINE;
|
||||||
|
builtin_options.usesMotionBlur = false;
|
||||||
|
|
||||||
|
check_result_optix_ret(optixBuiltinISModuleGet(
|
||||||
|
context, &module_options, &pipeline_options, &builtin_options, &builtin_modules[0]));
|
||||||
|
|
||||||
|
group_descs[PG_HITD].hitgroup.moduleIS = builtin_modules[0];
|
||||||
|
group_descs[PG_HITD].hitgroup.entryFunctionNameIS = nullptr;
|
||||||
|
group_descs[PG_HITS].hitgroup.moduleIS = builtin_modules[0];
|
||||||
|
group_descs[PG_HITS].hitgroup.entryFunctionNameIS = nullptr;
|
||||||
|
|
||||||
|
if (motion_blur) {
|
||||||
|
builtin_options.usesMotionBlur = true;
|
||||||
|
|
||||||
|
check_result_optix_ret(optixBuiltinISModuleGet(
|
||||||
|
context, &module_options, &pipeline_options, &builtin_options, &builtin_modules[1]));
|
||||||
|
|
||||||
|
group_descs[PG_HITD_MOTION] = group_descs[PG_HITD];
|
||||||
|
group_descs[PG_HITD_MOTION].hitgroup.moduleIS = builtin_modules[1];
|
||||||
|
group_descs[PG_HITS_MOTION] = group_descs[PG_HITS];
|
||||||
|
group_descs[PG_HITS_MOTION].hitgroup.moduleIS = builtin_modules[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requested_features.use_subsurface || requested_features.use_shader_raytrace) {
|
if (requested_features.use_subsurface || requested_features.use_shader_raytrace) {
|
||||||
@@ -493,8 +547,14 @@ class OptiXDevice : public CUDADevice {
|
|||||||
unsigned int trace_css = stack_size[PG_HITD].cssCH;
|
unsigned int trace_css = stack_size[PG_HITD].cssCH;
|
||||||
// This is based on the maximum of closest-hit and any-hit/intersection programs
|
// This is based on the maximum of closest-hit and any-hit/intersection programs
|
||||||
trace_css = std::max(trace_css, stack_size[PG_HITD].cssIS + stack_size[PG_HITD].cssAH);
|
trace_css = std::max(trace_css, stack_size[PG_HITD].cssIS + stack_size[PG_HITD].cssAH);
|
||||||
trace_css = std::max(trace_css, stack_size[PG_HITL].cssIS + stack_size[PG_HITL].cssAH);
|
|
||||||
trace_css = std::max(trace_css, stack_size[PG_HITS].cssIS + stack_size[PG_HITS].cssAH);
|
trace_css = std::max(trace_css, stack_size[PG_HITS].cssIS + stack_size[PG_HITS].cssAH);
|
||||||
|
trace_css = std::max(trace_css, stack_size[PG_HITL].cssIS + stack_size[PG_HITL].cssAH);
|
||||||
|
# if OPTIX_ABI_VERSION >= 36
|
||||||
|
trace_css = std::max(trace_css,
|
||||||
|
stack_size[PG_HITD_MOTION].cssIS + stack_size[PG_HITD_MOTION].cssAH);
|
||||||
|
trace_css = std::max(trace_css,
|
||||||
|
stack_size[PG_HITS_MOTION].cssIS + stack_size[PG_HITS_MOTION].cssAH);
|
||||||
|
# endif
|
||||||
|
|
||||||
OptixPipelineLinkOptions link_options;
|
OptixPipelineLinkOptions link_options;
|
||||||
link_options.maxTraceDepth = 1;
|
link_options.maxTraceDepth = 1;
|
||||||
@@ -503,17 +563,23 @@ class OptiXDevice : public CUDADevice {
|
|||||||
# else
|
# else
|
||||||
link_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_LINEINFO;
|
link_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_LINEINFO;
|
||||||
# endif
|
# endif
|
||||||
link_options.overrideUsesMotionBlur = pipeline_options.usesMotionBlur;
|
# if OPTIX_ABI_VERSION < 24
|
||||||
|
link_options.overrideUsesMotionBlur = motion_blur;
|
||||||
|
# endif
|
||||||
|
|
||||||
{ // Create path tracing pipeline
|
{ // Create path tracing pipeline
|
||||||
OptixProgramGroup pipeline_groups[] = {
|
OptixProgramGroup pipeline_groups[] = {
|
||||||
groups[PG_RGEN],
|
groups[PG_RGEN],
|
||||||
groups[PG_MISS],
|
groups[PG_MISS],
|
||||||
groups[PG_HITD],
|
groups[PG_HITD],
|
||||||
groups[PG_HITS],
|
groups[PG_HITS],
|
||||||
groups[PG_HITL],
|
groups[PG_HITL],
|
||||||
|
# if OPTIX_ABI_VERSION >= 36
|
||||||
|
groups[PG_HITD_MOTION],
|
||||||
|
groups[PG_HITS_MOTION],
|
||||||
|
# endif
|
||||||
# ifdef WITH_CYCLES_DEBUG
|
# ifdef WITH_CYCLES_DEBUG
|
||||||
groups[PG_EXCP],
|
groups[PG_EXCP],
|
||||||
# endif
|
# endif
|
||||||
};
|
};
|
||||||
check_result_optix_ret(
|
check_result_optix_ret(
|
||||||
@@ -530,8 +596,8 @@ class OptiXDevice : public CUDADevice {
|
|||||||
const unsigned int css = stack_size[PG_RGEN].cssRG + link_options.maxTraceDepth * trace_css;
|
const unsigned int css = stack_size[PG_RGEN].cssRG + link_options.maxTraceDepth * trace_css;
|
||||||
|
|
||||||
// Set stack size depending on pipeline options
|
// Set stack size depending on pipeline options
|
||||||
check_result_optix_ret(optixPipelineSetStackSize(
|
check_result_optix_ret(
|
||||||
pipelines[PIP_PATH_TRACE], 0, 0, css, (pipeline_options.usesMotionBlur ? 3 : 2)));
|
optixPipelineSetStackSize(pipelines[PIP_PATH_TRACE], 0, 0, css, (motion_blur ? 3 : 2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only need to create shader evaluation pipeline if one of these features is used:
|
// Only need to create shader evaluation pipeline if one of these features is used:
|
||||||
@@ -541,15 +607,19 @@ class OptiXDevice : public CUDADevice {
|
|||||||
|
|
||||||
if (use_shader_eval_pipeline) { // Create shader evaluation pipeline
|
if (use_shader_eval_pipeline) { // Create shader evaluation pipeline
|
||||||
OptixProgramGroup pipeline_groups[] = {
|
OptixProgramGroup pipeline_groups[] = {
|
||||||
groups[PG_BAKE],
|
groups[PG_BAKE],
|
||||||
groups[PG_DISP],
|
groups[PG_DISP],
|
||||||
groups[PG_BACK],
|
groups[PG_BACK],
|
||||||
groups[PG_MISS],
|
groups[PG_MISS],
|
||||||
groups[PG_HITD],
|
groups[PG_HITD],
|
||||||
groups[PG_HITS],
|
groups[PG_HITS],
|
||||||
groups[PG_HITL],
|
groups[PG_HITL],
|
||||||
|
# if OPTIX_ABI_VERSION >= 36
|
||||||
|
groups[PG_HITD_MOTION],
|
||||||
|
groups[PG_HITS_MOTION],
|
||||||
|
# endif
|
||||||
# ifdef WITH_CYCLES_DEBUG
|
# ifdef WITH_CYCLES_DEBUG
|
||||||
groups[PG_EXCP],
|
groups[PG_EXCP],
|
||||||
# endif
|
# endif
|
||||||
};
|
};
|
||||||
check_result_optix_ret(
|
check_result_optix_ret(
|
||||||
@@ -672,7 +742,11 @@ class OptiXDevice : public CUDADevice {
|
|||||||
sbt_params.missRecordCount = 1;
|
sbt_params.missRecordCount = 1;
|
||||||
sbt_params.hitgroupRecordBase = sbt_data.device_pointer + PG_HITD * sizeof(SbtRecord);
|
sbt_params.hitgroupRecordBase = sbt_data.device_pointer + PG_HITD * sizeof(SbtRecord);
|
||||||
sbt_params.hitgroupRecordStrideInBytes = sizeof(SbtRecord);
|
sbt_params.hitgroupRecordStrideInBytes = sizeof(SbtRecord);
|
||||||
sbt_params.hitgroupRecordCount = 3; // PG_HITD, PG_HITL, PG_HITS
|
# if OPTIX_ABI_VERSION >= 36
|
||||||
|
sbt_params.hitgroupRecordCount = 5; // PG_HITD(_MOTION), PG_HITS(_MOTION), PG_HITL
|
||||||
|
# else
|
||||||
|
sbt_params.hitgroupRecordCount = 3; // PG_HITD, PG_HITS, PG_HITL
|
||||||
|
# endif
|
||||||
|
|
||||||
// Launch the ray generation program
|
// Launch the ray generation program
|
||||||
check_result_optix(optixLaunch(pipelines[PIP_PATH_TRACE],
|
check_result_optix(optixLaunch(pipelines[PIP_PATH_TRACE],
|
||||||
@@ -727,19 +801,18 @@ class OptiXDevice : public CUDADevice {
|
|||||||
// 0 1 2
|
// 0 1 2
|
||||||
// 3 4 5
|
// 3 4 5
|
||||||
// 6 7 8 9
|
// 6 7 8 9
|
||||||
RenderTile rtiles[10];
|
RenderTileNeighbors neighbors(rtile);
|
||||||
rtiles[4] = rtile;
|
task.map_neighbor_tiles(neighbors, this);
|
||||||
task.map_neighbor_tiles(rtiles, this);
|
RenderTile ¢er_tile = neighbors.tiles[RenderTileNeighbors::CENTER];
|
||||||
rtile = rtiles[4]; // Tile may have been modified by mapping code
|
RenderTile &target_tile = neighbors.target;
|
||||||
|
rtile = center_tile; // Tile may have been modified by mapping code
|
||||||
|
|
||||||
// Calculate size of the tile to denoise (including overlap)
|
// Calculate size of the tile to denoise (including overlap)
|
||||||
int4 rect = make_int4(
|
int4 rect = center_tile.bounds();
|
||||||
rtiles[4].x, rtiles[4].y, rtiles[4].x + rtiles[4].w, rtiles[4].y + rtiles[4].h);
|
|
||||||
// Overlap between tiles has to be at least 64 pixels
|
// Overlap between tiles has to be at least 64 pixels
|
||||||
// TODO(pmours): Query this value from OptiX
|
// TODO(pmours): Query this value from OptiX
|
||||||
rect = rect_expand(rect, 64);
|
rect = rect_expand(rect, 64);
|
||||||
int4 clip_rect = make_int4(
|
int4 clip_rect = neighbors.bounds();
|
||||||
rtiles[3].x, rtiles[1].y, rtiles[5].x + rtiles[5].w, rtiles[7].y + rtiles[7].h);
|
|
||||||
rect = rect_clip(rect, clip_rect);
|
rect = rect_clip(rect, clip_rect);
|
||||||
int2 rect_size = make_int2(rect.z - rect.x, rect.w - rect.y);
|
int2 rect_size = make_int2(rect.z - rect.x, rect.w - rect.y);
|
||||||
int2 overlap_offset = make_int2(rtile.x - rect.x, rtile.y - rect.y);
|
int2 overlap_offset = make_int2(rtile.x - rect.x, rtile.y - rect.y);
|
||||||
@@ -760,14 +833,14 @@ class OptiXDevice : public CUDADevice {
|
|||||||
device_only_memory<float> input(this, "denoiser input");
|
device_only_memory<float> input(this, "denoiser input");
|
||||||
device_vector<TileInfo> tile_info_mem(this, "denoiser tile info", MEM_READ_WRITE);
|
device_vector<TileInfo> tile_info_mem(this, "denoiser tile info", MEM_READ_WRITE);
|
||||||
|
|
||||||
if ((!rtiles[0].buffer || rtiles[0].buffer == rtile.buffer) &&
|
bool contiguous_memory = true;
|
||||||
(!rtiles[1].buffer || rtiles[1].buffer == rtile.buffer) &&
|
for (int i = 0; i < RenderTileNeighbors::SIZE; i++) {
|
||||||
(!rtiles[2].buffer || rtiles[2].buffer == rtile.buffer) &&
|
if (neighbors.tiles[i].buffer && neighbors.tiles[i].buffer != rtile.buffer) {
|
||||||
(!rtiles[3].buffer || rtiles[3].buffer == rtile.buffer) &&
|
contiguous_memory = false;
|
||||||
(!rtiles[5].buffer || rtiles[5].buffer == rtile.buffer) &&
|
}
|
||||||
(!rtiles[6].buffer || rtiles[6].buffer == rtile.buffer) &&
|
}
|
||||||
(!rtiles[7].buffer || rtiles[7].buffer == rtile.buffer) &&
|
|
||||||
(!rtiles[8].buffer || rtiles[8].buffer == rtile.buffer)) {
|
if (contiguous_memory) {
|
||||||
// Tiles are in continous memory, so can just subtract overlap offset
|
// Tiles are in continous memory, so can just subtract overlap offset
|
||||||
input_ptr -= (overlap_offset.x + overlap_offset.y * rtile.stride) * pixel_stride;
|
input_ptr -= (overlap_offset.x + overlap_offset.y * rtile.stride) * pixel_stride;
|
||||||
// Stride covers the whole width of the image and not just a single tile
|
// Stride covers the whole width of the image and not just a single tile
|
||||||
@@ -782,19 +855,19 @@ class OptiXDevice : public CUDADevice {
|
|||||||
input_stride *= rect_size.x;
|
input_stride *= rect_size.x;
|
||||||
|
|
||||||
TileInfo *tile_info = tile_info_mem.alloc(1);
|
TileInfo *tile_info = tile_info_mem.alloc(1);
|
||||||
for (int i = 0; i < 9; i++) {
|
for (int i = 0; i < RenderTileNeighbors::SIZE; i++) {
|
||||||
tile_info->offsets[i] = rtiles[i].offset;
|
tile_info->offsets[i] = neighbors.tiles[i].offset;
|
||||||
tile_info->strides[i] = rtiles[i].stride;
|
tile_info->strides[i] = neighbors.tiles[i].stride;
|
||||||
tile_info->buffers[i] = rtiles[i].buffer;
|
tile_info->buffers[i] = neighbors.tiles[i].buffer;
|
||||||
}
|
}
|
||||||
tile_info->x[0] = rtiles[3].x;
|
tile_info->x[0] = neighbors.tiles[3].x;
|
||||||
tile_info->x[1] = rtiles[4].x;
|
tile_info->x[1] = neighbors.tiles[4].x;
|
||||||
tile_info->x[2] = rtiles[5].x;
|
tile_info->x[2] = neighbors.tiles[5].x;
|
||||||
tile_info->x[3] = rtiles[5].x + rtiles[5].w;
|
tile_info->x[3] = neighbors.tiles[5].x + neighbors.tiles[5].w;
|
||||||
tile_info->y[0] = rtiles[1].y;
|
tile_info->y[0] = neighbors.tiles[1].y;
|
||||||
tile_info->y[1] = rtiles[4].y;
|
tile_info->y[1] = neighbors.tiles[4].y;
|
||||||
tile_info->y[2] = rtiles[7].y;
|
tile_info->y[2] = neighbors.tiles[7].y;
|
||||||
tile_info->y[3] = rtiles[7].y + rtiles[7].h;
|
tile_info->y[3] = neighbors.tiles[7].y + neighbors.tiles[7].h;
|
||||||
tile_info_mem.copy_to_device();
|
tile_info_mem.copy_to_device();
|
||||||
|
|
||||||
void *args[] = {
|
void *args[] = {
|
||||||
@@ -804,7 +877,7 @@ class OptiXDevice : public CUDADevice {
|
|||||||
|
|
||||||
# if OPTIX_DENOISER_NO_PIXEL_STRIDE
|
# if OPTIX_DENOISER_NO_PIXEL_STRIDE
|
||||||
device_only_memory<float> input_rgb(this, "denoiser input rgb");
|
device_only_memory<float> input_rgb(this, "denoiser input rgb");
|
||||||
input_rgb.alloc_to_device(rect_size.x * rect_size.y * 3 * task.denoising.optix_input_passes);
|
input_rgb.alloc_to_device(rect_size.x * rect_size.y * 3 * task.denoising.input_passes);
|
||||||
|
|
||||||
void *input_args[] = {&input_rgb.device_pointer,
|
void *input_args[] = {&input_rgb.device_pointer,
|
||||||
&input_ptr,
|
&input_ptr,
|
||||||
@@ -813,7 +886,7 @@ class OptiXDevice : public CUDADevice {
|
|||||||
&input_stride,
|
&input_stride,
|
||||||
&task.pass_stride,
|
&task.pass_stride,
|
||||||
const_cast<int *>(pass_offset),
|
const_cast<int *>(pass_offset),
|
||||||
&task.denoising.optix_input_passes,
|
&task.denoising.input_passes,
|
||||||
&rtile.sample};
|
&rtile.sample};
|
||||||
launch_filter_kernel(
|
launch_filter_kernel(
|
||||||
"kernel_cuda_filter_convert_to_rgb", rect_size.x, rect_size.y, input_args);
|
"kernel_cuda_filter_convert_to_rgb", rect_size.x, rect_size.y, input_args);
|
||||||
@@ -824,7 +897,7 @@ class OptiXDevice : public CUDADevice {
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
const bool recreate_denoiser = (denoiser == NULL) ||
|
const bool recreate_denoiser = (denoiser == NULL) ||
|
||||||
(task.denoising.optix_input_passes != denoiser_input_passes);
|
(task.denoising.input_passes != denoiser_input_passes);
|
||||||
if (recreate_denoiser) {
|
if (recreate_denoiser) {
|
||||||
// Destroy existing handle before creating new one
|
// Destroy existing handle before creating new one
|
||||||
if (denoiser != NULL) {
|
if (denoiser != NULL) {
|
||||||
@@ -833,23 +906,29 @@ class OptiXDevice : public CUDADevice {
|
|||||||
|
|
||||||
// Create OptiX denoiser handle on demand when it is first used
|
// Create OptiX denoiser handle on demand when it is first used
|
||||||
OptixDenoiserOptions denoiser_options;
|
OptixDenoiserOptions denoiser_options;
|
||||||
assert(task.denoising.optix_input_passes >= 1 && task.denoising.optix_input_passes <= 3);
|
assert(task.denoising.input_passes >= 1 && task.denoising.input_passes <= 3);
|
||||||
denoiser_options.inputKind = static_cast<OptixDenoiserInputKind>(
|
denoiser_options.inputKind = static_cast<OptixDenoiserInputKind>(
|
||||||
OPTIX_DENOISER_INPUT_RGB + (task.denoising.optix_input_passes - 1));
|
OPTIX_DENOISER_INPUT_RGB + (task.denoising.input_passes - 1));
|
||||||
|
# if OPTIX_ABI_VERSION < 28
|
||||||
denoiser_options.pixelFormat = OPTIX_PIXEL_FORMAT_FLOAT3;
|
denoiser_options.pixelFormat = OPTIX_PIXEL_FORMAT_FLOAT3;
|
||||||
|
# endif
|
||||||
check_result_optix_ret(optixDenoiserCreate(context, &denoiser_options, &denoiser));
|
check_result_optix_ret(optixDenoiserCreate(context, &denoiser_options, &denoiser));
|
||||||
check_result_optix_ret(
|
check_result_optix_ret(
|
||||||
optixDenoiserSetModel(denoiser, OPTIX_DENOISER_MODEL_KIND_HDR, NULL, 0));
|
optixDenoiserSetModel(denoiser, OPTIX_DENOISER_MODEL_KIND_HDR, NULL, 0));
|
||||||
|
|
||||||
// OptiX denoiser handle was created with the requested number of input passes
|
// OptiX denoiser handle was created with the requested number of input passes
|
||||||
denoiser_input_passes = task.denoising.optix_input_passes;
|
denoiser_input_passes = task.denoising.input_passes;
|
||||||
}
|
}
|
||||||
|
|
||||||
OptixDenoiserSizes sizes = {};
|
OptixDenoiserSizes sizes = {};
|
||||||
check_result_optix_ret(
|
check_result_optix_ret(
|
||||||
optixDenoiserComputeMemoryResources(denoiser, rect_size.x, rect_size.y, &sizes));
|
optixDenoiserComputeMemoryResources(denoiser, rect_size.x, rect_size.y, &sizes));
|
||||||
|
|
||||||
|
# if OPTIX_ABI_VERSION < 28
|
||||||
const size_t scratch_size = sizes.recommendedScratchSizeInBytes;
|
const size_t scratch_size = sizes.recommendedScratchSizeInBytes;
|
||||||
|
# else
|
||||||
|
const size_t scratch_size = sizes.withOverlapScratchSizeInBytes;
|
||||||
|
# endif
|
||||||
const size_t scratch_offset = sizes.stateSizeInBytes;
|
const size_t scratch_offset = sizes.stateSizeInBytes;
|
||||||
|
|
||||||
// Allocate denoiser state if tile size has changed since last setup
|
// Allocate denoiser state if tile size has changed since last setup
|
||||||
@@ -897,10 +976,10 @@ class OptiXDevice : public CUDADevice {
|
|||||||
int2 output_offset = overlap_offset;
|
int2 output_offset = overlap_offset;
|
||||||
overlap_offset = make_int2(0, 0); // Not supported by denoiser API, so apply manually
|
overlap_offset = make_int2(0, 0); // Not supported by denoiser API, so apply manually
|
||||||
# else
|
# else
|
||||||
output_layers[0].data = rtiles[9].buffer + pixel_offset;
|
output_layers[0].data = target_tile.buffer + pixel_offset;
|
||||||
output_layers[0].width = rtiles[9].w;
|
output_layers[0].width = target_tile.w;
|
||||||
output_layers[0].height = rtiles[9].h;
|
output_layers[0].height = target_tile.h;
|
||||||
output_layers[0].rowStrideInBytes = rtiles[9].stride * pixel_stride;
|
output_layers[0].rowStrideInBytes = target_tile.stride * pixel_stride;
|
||||||
output_layers[0].pixelStrideInBytes = pixel_stride;
|
output_layers[0].pixelStrideInBytes = pixel_stride;
|
||||||
# endif
|
# endif
|
||||||
output_layers[0].format = OPTIX_PIXEL_FORMAT_FLOAT3;
|
output_layers[0].format = OPTIX_PIXEL_FORMAT_FLOAT3;
|
||||||
@@ -913,7 +992,7 @@ class OptiXDevice : public CUDADevice {
|
|||||||
denoiser_state.device_pointer,
|
denoiser_state.device_pointer,
|
||||||
scratch_offset,
|
scratch_offset,
|
||||||
input_layers,
|
input_layers,
|
||||||
task.denoising.optix_input_passes,
|
task.denoising.input_passes,
|
||||||
overlap_offset.x,
|
overlap_offset.x,
|
||||||
overlap_offset.y,
|
overlap_offset.y,
|
||||||
output_layers,
|
output_layers,
|
||||||
@@ -922,26 +1001,26 @@ class OptiXDevice : public CUDADevice {
|
|||||||
|
|
||||||
# if OPTIX_DENOISER_NO_PIXEL_STRIDE
|
# if OPTIX_DENOISER_NO_PIXEL_STRIDE
|
||||||
void *output_args[] = {&input_ptr,
|
void *output_args[] = {&input_ptr,
|
||||||
&rtiles[9].buffer,
|
&target_tile.buffer,
|
||||||
&output_offset.x,
|
&output_offset.x,
|
||||||
&output_offset.y,
|
&output_offset.y,
|
||||||
&rect_size.x,
|
&rect_size.x,
|
||||||
&rect_size.y,
|
&rect_size.y,
|
||||||
&rtiles[9].x,
|
&target_tile.x,
|
||||||
&rtiles[9].y,
|
&target_tile.y,
|
||||||
&rtiles[9].w,
|
&target_tile.w,
|
||||||
&rtiles[9].h,
|
&target_tile.h,
|
||||||
&rtiles[9].offset,
|
&target_tile.offset,
|
||||||
&rtiles[9].stride,
|
&target_tile.stride,
|
||||||
&task.pass_stride,
|
&task.pass_stride,
|
||||||
&rtile.sample};
|
&rtile.sample};
|
||||||
launch_filter_kernel(
|
launch_filter_kernel(
|
||||||
"kernel_cuda_filter_convert_from_rgb", rtiles[9].w, rtiles[9].h, output_args);
|
"kernel_cuda_filter_convert_from_rgb", target_tile.w, target_tile.h, output_args);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
check_result_cuda_ret(cuStreamSynchronize(0));
|
check_result_cuda_ret(cuStreamSynchronize(0));
|
||||||
|
|
||||||
task.unmap_neighbor_tiles(rtiles, this);
|
task.unmap_neighbor_tiles(neighbors, this);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Run CUDA denoising kernels
|
// Run CUDA denoising kernels
|
||||||
@@ -993,7 +1072,11 @@ class OptiXDevice : public CUDADevice {
|
|||||||
sbt_params.missRecordCount = 1;
|
sbt_params.missRecordCount = 1;
|
||||||
sbt_params.hitgroupRecordBase = sbt_data.device_pointer + PG_HITD * sizeof(SbtRecord);
|
sbt_params.hitgroupRecordBase = sbt_data.device_pointer + PG_HITD * sizeof(SbtRecord);
|
||||||
sbt_params.hitgroupRecordStrideInBytes = sizeof(SbtRecord);
|
sbt_params.hitgroupRecordStrideInBytes = sizeof(SbtRecord);
|
||||||
sbt_params.hitgroupRecordCount = 3; // PG_HITD, PG_HITL, PG_HITS
|
# if OPTIX_ABI_VERSION >= 36
|
||||||
|
sbt_params.hitgroupRecordCount = 5; // PG_HITD(_MOTION), PG_HITS(_MOTION), PG_HITL
|
||||||
|
# else
|
||||||
|
sbt_params.hitgroupRecordCount = 3; // PG_HITD, PG_HITS, PG_HITL
|
||||||
|
# endif
|
||||||
|
|
||||||
check_result_optix(optixLaunch(pipelines[PIP_SHADER_EVAL],
|
check_result_optix(optixLaunch(pipelines[PIP_SHADER_EVAL],
|
||||||
cuda_stream[thread_index],
|
cuda_stream[thread_index],
|
||||||
@@ -1070,7 +1153,7 @@ class OptiXDevice : public CUDADevice {
|
|||||||
&build_input,
|
&build_input,
|
||||||
1,
|
1,
|
||||||
temp_mem.device_pointer,
|
temp_mem.device_pointer,
|
||||||
temp_mem.device_size,
|
sizes.tempSizeInBytes,
|
||||||
out_data,
|
out_data,
|
||||||
sizes.outputSizeInBytes,
|
sizes.outputSizeInBytes,
|
||||||
&out_handle,
|
&out_handle,
|
||||||
@@ -1142,7 +1225,6 @@ class OptiXDevice : public CUDADevice {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t num_curves = hair->num_curves();
|
|
||||||
const size_t num_segments = hair->num_segments();
|
const size_t num_segments = hair->num_segments();
|
||||||
|
|
||||||
size_t num_motion_steps = 1;
|
size_t num_motion_steps = 1;
|
||||||
@@ -1152,7 +1234,18 @@ class OptiXDevice : public CUDADevice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
device_vector<OptixAabb> aabb_data(this, "temp_aabb_data", MEM_READ_ONLY);
|
device_vector<OptixAabb> aabb_data(this, "temp_aabb_data", MEM_READ_ONLY);
|
||||||
aabb_data.alloc(num_segments * num_motion_steps);
|
# if OPTIX_ABI_VERSION >= 36
|
||||||
|
device_vector<int> index_data(this, "temp_index_data", MEM_READ_ONLY);
|
||||||
|
device_vector<float4> vertex_data(this, "temp_vertex_data", MEM_READ_ONLY);
|
||||||
|
// Four control points for each curve segment
|
||||||
|
const size_t num_vertices = num_segments * 4;
|
||||||
|
if (DebugFlags().optix.curves_api && hair->curve_shape == CURVE_THICK) {
|
||||||
|
index_data.alloc(num_segments);
|
||||||
|
vertex_data.alloc(num_vertices * num_motion_steps);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
# endif
|
||||||
|
aabb_data.alloc(num_segments * num_motion_steps);
|
||||||
|
|
||||||
// Get AABBs for each motion step
|
// Get AABBs for each motion step
|
||||||
for (size_t step = 0; step < num_motion_steps; ++step) {
|
for (size_t step = 0; step < num_motion_steps; ++step) {
|
||||||
@@ -1165,44 +1258,127 @@ class OptiXDevice : public CUDADevice {
|
|||||||
keys = motion_keys->data_float3() + attr_offset * hair->curve_keys.size();
|
keys = motion_keys->data_float3() + attr_offset * hair->curve_keys.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t i = step * num_segments;
|
for (size_t j = 0, i = 0; j < hair->num_curves(); ++j) {
|
||||||
for (size_t j = 0; j < num_curves; ++j) {
|
const Hair::Curve curve = hair->get_curve(j);
|
||||||
const Hair::Curve c = hair->get_curve(j);
|
|
||||||
|
|
||||||
for (size_t k = 0; k < c.num_segments(); ++i, ++k) {
|
for (int segment = 0; segment < curve.num_segments(); ++segment, ++i) {
|
||||||
BoundBox bounds = BoundBox::empty;
|
# if OPTIX_ABI_VERSION >= 36
|
||||||
c.bounds_grow(k, keys, hair->curve_radius.data(), bounds);
|
if (DebugFlags().optix.curves_api && hair->curve_shape == CURVE_THICK) {
|
||||||
|
int k0 = curve.first_key + segment;
|
||||||
|
int k1 = k0 + 1;
|
||||||
|
int ka = max(k0 - 1, curve.first_key);
|
||||||
|
int kb = min(k1 + 1, curve.first_key + curve.num_keys - 1);
|
||||||
|
|
||||||
aabb_data[i].minX = bounds.min.x;
|
const float4 px = make_float4(keys[ka].x, keys[k0].x, keys[k1].x, keys[kb].x);
|
||||||
aabb_data[i].minY = bounds.min.y;
|
const float4 py = make_float4(keys[ka].y, keys[k0].y, keys[k1].y, keys[kb].y);
|
||||||
aabb_data[i].minZ = bounds.min.z;
|
const float4 pz = make_float4(keys[ka].z, keys[k0].z, keys[k1].z, keys[kb].z);
|
||||||
aabb_data[i].maxX = bounds.max.x;
|
const float4 pw = make_float4(hair->curve_radius[ka],
|
||||||
aabb_data[i].maxY = bounds.max.y;
|
hair->curve_radius[k0],
|
||||||
aabb_data[i].maxZ = bounds.max.z;
|
hair->curve_radius[k1],
|
||||||
|
hair->curve_radius[kb]);
|
||||||
|
|
||||||
|
// Convert Catmull-Rom data to Bezier spline
|
||||||
|
static const float4 cr2bsp0 = make_float4(+7, -4, +5, -2) / 6.f;
|
||||||
|
static const float4 cr2bsp1 = make_float4(-2, 11, -4, +1) / 6.f;
|
||||||
|
static const float4 cr2bsp2 = make_float4(+1, -4, 11, -2) / 6.f;
|
||||||
|
static const float4 cr2bsp3 = make_float4(-2, +5, -4, +7) / 6.f;
|
||||||
|
|
||||||
|
index_data[i] = i * 4;
|
||||||
|
float4 *const v = vertex_data.data() + step * num_vertices + index_data[i];
|
||||||
|
v[0] = make_float4(
|
||||||
|
dot(cr2bsp0, px), dot(cr2bsp0, py), dot(cr2bsp0, pz), dot(cr2bsp0, pw));
|
||||||
|
v[1] = make_float4(
|
||||||
|
dot(cr2bsp1, px), dot(cr2bsp1, py), dot(cr2bsp1, pz), dot(cr2bsp1, pw));
|
||||||
|
v[2] = make_float4(
|
||||||
|
dot(cr2bsp2, px), dot(cr2bsp2, py), dot(cr2bsp2, pz), dot(cr2bsp2, pw));
|
||||||
|
v[3] = make_float4(
|
||||||
|
dot(cr2bsp3, px), dot(cr2bsp3, py), dot(cr2bsp3, pz), dot(cr2bsp3, pw));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
# endif
|
||||||
|
{
|
||||||
|
BoundBox bounds = BoundBox::empty;
|
||||||
|
curve.bounds_grow(segment, keys, hair->curve_radius.data(), bounds);
|
||||||
|
|
||||||
|
const size_t index = step * num_segments + i;
|
||||||
|
aabb_data[index].minX = bounds.min.x;
|
||||||
|
aabb_data[index].minY = bounds.min.y;
|
||||||
|
aabb_data[index].minZ = bounds.min.z;
|
||||||
|
aabb_data[index].maxX = bounds.max.x;
|
||||||
|
aabb_data[index].maxY = bounds.max.y;
|
||||||
|
aabb_data[index].maxZ = bounds.max.z;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Upload AABB data to GPU
|
// Upload AABB data to GPU
|
||||||
aabb_data.copy_to_device();
|
aabb_data.copy_to_device();
|
||||||
|
# if OPTIX_ABI_VERSION >= 36
|
||||||
|
index_data.copy_to_device();
|
||||||
|
vertex_data.copy_to_device();
|
||||||
|
# endif
|
||||||
|
|
||||||
vector<device_ptr> aabb_ptrs;
|
vector<device_ptr> aabb_ptrs;
|
||||||
aabb_ptrs.reserve(num_motion_steps);
|
aabb_ptrs.reserve(num_motion_steps);
|
||||||
|
# if OPTIX_ABI_VERSION >= 36
|
||||||
|
vector<device_ptr> width_ptrs;
|
||||||
|
vector<device_ptr> vertex_ptrs;
|
||||||
|
width_ptrs.reserve(num_motion_steps);
|
||||||
|
vertex_ptrs.reserve(num_motion_steps);
|
||||||
|
# endif
|
||||||
for (size_t step = 0; step < num_motion_steps; ++step) {
|
for (size_t step = 0; step < num_motion_steps; ++step) {
|
||||||
aabb_ptrs.push_back(aabb_data.device_pointer + step * num_segments * sizeof(OptixAabb));
|
aabb_ptrs.push_back(aabb_data.device_pointer + step * num_segments * sizeof(OptixAabb));
|
||||||
|
# if OPTIX_ABI_VERSION >= 36
|
||||||
|
const device_ptr base_ptr = vertex_data.device_pointer +
|
||||||
|
step * num_vertices * sizeof(float4);
|
||||||
|
width_ptrs.push_back(base_ptr + 3 * sizeof(float)); // Offset by vertex size
|
||||||
|
vertex_ptrs.push_back(base_ptr);
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable visibility test anyhit program, since it is already checked during intersection
|
// Force a single any-hit call, so shadow record-all behavior works correctly
|
||||||
// Those trace calls that require anyhit can force it with OPTIX_RAY_FLAG_ENFORCE_ANYHIT
|
unsigned int build_flags = OPTIX_GEOMETRY_FLAG_REQUIRE_SINGLE_ANYHIT_CALL;
|
||||||
unsigned int build_flags = OPTIX_GEOMETRY_FLAG_DISABLE_ANYHIT;
|
|
||||||
OptixBuildInput build_input = {};
|
OptixBuildInput build_input = {};
|
||||||
build_input.type = OPTIX_BUILD_INPUT_TYPE_CUSTOM_PRIMITIVES;
|
# if OPTIX_ABI_VERSION >= 36
|
||||||
build_input.aabbArray.aabbBuffers = (CUdeviceptr *)aabb_ptrs.data();
|
if (DebugFlags().optix.curves_api && hair->curve_shape == CURVE_THICK) {
|
||||||
build_input.aabbArray.numPrimitives = num_segments;
|
build_input.type = OPTIX_BUILD_INPUT_TYPE_CURVES;
|
||||||
build_input.aabbArray.strideInBytes = sizeof(OptixAabb);
|
build_input.curveArray.curveType = OPTIX_PRIMITIVE_TYPE_ROUND_CUBIC_BSPLINE;
|
||||||
build_input.aabbArray.flags = &build_flags;
|
build_input.curveArray.numPrimitives = num_segments;
|
||||||
build_input.aabbArray.numSbtRecords = 1;
|
build_input.curveArray.vertexBuffers = (CUdeviceptr *)vertex_ptrs.data();
|
||||||
build_input.aabbArray.primitiveIndexOffset = hair->optix_prim_offset;
|
build_input.curveArray.numVertices = num_vertices;
|
||||||
|
build_input.curveArray.vertexStrideInBytes = sizeof(float4);
|
||||||
|
build_input.curveArray.widthBuffers = (CUdeviceptr *)width_ptrs.data();
|
||||||
|
build_input.curveArray.widthStrideInBytes = sizeof(float4);
|
||||||
|
build_input.curveArray.indexBuffer = (CUdeviceptr)index_data.device_pointer;
|
||||||
|
build_input.curveArray.indexStrideInBytes = sizeof(int);
|
||||||
|
build_input.curveArray.flag = build_flags;
|
||||||
|
build_input.curveArray.primitiveIndexOffset = hair->optix_prim_offset;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
# endif
|
||||||
|
{
|
||||||
|
// Disable visibility test any-hit program, since it is already checked during
|
||||||
|
// intersection. Those trace calls that require anyhit can force it with a ray flag.
|
||||||
|
build_flags |= OPTIX_GEOMETRY_FLAG_DISABLE_ANYHIT;
|
||||||
|
|
||||||
|
build_input.type = OPTIX_BUILD_INPUT_TYPE_CUSTOM_PRIMITIVES;
|
||||||
|
# if OPTIX_ABI_VERSION < 23
|
||||||
|
build_input.aabbArray.aabbBuffers = (CUdeviceptr *)aabb_ptrs.data();
|
||||||
|
build_input.aabbArray.numPrimitives = num_segments;
|
||||||
|
build_input.aabbArray.strideInBytes = sizeof(OptixAabb);
|
||||||
|
build_input.aabbArray.flags = &build_flags;
|
||||||
|
build_input.aabbArray.numSbtRecords = 1;
|
||||||
|
build_input.aabbArray.primitiveIndexOffset = hair->optix_prim_offset;
|
||||||
|
# else
|
||||||
|
build_input.customPrimitiveArray.aabbBuffers = (CUdeviceptr *)aabb_ptrs.data();
|
||||||
|
build_input.customPrimitiveArray.numPrimitives = num_segments;
|
||||||
|
build_input.customPrimitiveArray.strideInBytes = sizeof(OptixAabb);
|
||||||
|
build_input.customPrimitiveArray.flags = &build_flags;
|
||||||
|
build_input.customPrimitiveArray.numSbtRecords = 1;
|
||||||
|
build_input.customPrimitiveArray.primitiveIndexOffset = hair->optix_prim_offset;
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
// Allocate memory for new BLAS and build it
|
// Allocate memory for new BLAS and build it
|
||||||
OptixTraversableHandle handle;
|
OptixTraversableHandle handle;
|
||||||
@@ -1257,8 +1433,8 @@ class OptiXDevice : public CUDADevice {
|
|||||||
vertex_ptrs.push_back(vertex_data.device_pointer + num_verts * step * sizeof(float3));
|
vertex_ptrs.push_back(vertex_data.device_pointer + num_verts * step * sizeof(float3));
|
||||||
}
|
}
|
||||||
|
|
||||||
// No special build flags for triangle primitives
|
// Force a single any-hit call, so shadow record-all behavior works correctly
|
||||||
unsigned int build_flags = OPTIX_GEOMETRY_FLAG_NONE;
|
unsigned int build_flags = OPTIX_GEOMETRY_FLAG_REQUIRE_SINGLE_ANYHIT_CALL;
|
||||||
OptixBuildInput build_input = {};
|
OptixBuildInput build_input = {};
|
||||||
build_input.type = OPTIX_BUILD_INPUT_TYPE_TRIANGLES;
|
build_input.type = OPTIX_BUILD_INPUT_TYPE_TRIANGLES;
|
||||||
build_input.triangleArray.vertexBuffers = (CUdeviceptr *)vertex_ptrs.data();
|
build_input.triangleArray.vertexBuffers = (CUdeviceptr *)vertex_ptrs.data();
|
||||||
@@ -1324,9 +1500,26 @@ class OptiXDevice : public CUDADevice {
|
|||||||
// Set user instance ID to object index
|
// Set user instance ID to object index
|
||||||
instance.instanceId = ob->get_device_index();
|
instance.instanceId = ob->get_device_index();
|
||||||
|
|
||||||
// Volumes have a special bit set in the visibility mask so a trace can mask only volumes
|
// Have to have at least one bit in the mask, or else instance would always be culled
|
||||||
// See 'scene_intersect_volume' in bvh.h
|
instance.visibilityMask = 1;
|
||||||
instance.visibilityMask = (ob->geometry->has_volume ? 3 : 1);
|
|
||||||
|
if (ob->geometry->has_volume) {
|
||||||
|
// Volumes have a special bit set in the visibility mask so a trace can mask only volumes
|
||||||
|
instance.visibilityMask |= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ob->geometry->type == Geometry::HAIR) {
|
||||||
|
// Same applies to curves (so they can be skipped in local trace calls)
|
||||||
|
instance.visibilityMask |= 4;
|
||||||
|
|
||||||
|
# if OPTIX_ABI_VERSION >= 36
|
||||||
|
if (motion_blur && ob->geometry->has_motion_blur() && DebugFlags().optix.curves_api &&
|
||||||
|
static_cast<const Hair *>(ob->geometry)->curve_shape == CURVE_THICK) {
|
||||||
|
// Select between motion blur and non-motion blur built-in intersection module
|
||||||
|
instance.sbtOffset = PG_HITD_MOTION - PG_HITD;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
// Insert motion traversable if object has motion
|
// Insert motion traversable if object has motion
|
||||||
if (motion_blur && ob->use_motion()) {
|
if (motion_blur && ob->use_motion()) {
|
||||||
|
@@ -29,6 +29,7 @@ CCL_NAMESPACE_BEGIN
|
|||||||
class Device;
|
class Device;
|
||||||
class RenderBuffers;
|
class RenderBuffers;
|
||||||
class RenderTile;
|
class RenderTile;
|
||||||
|
class RenderTileNeighbors;
|
||||||
class Tile;
|
class Tile;
|
||||||
|
|
||||||
enum DenoiserType {
|
enum DenoiserType {
|
||||||
@@ -41,6 +42,14 @@ enum DenoiserType {
|
|||||||
DENOISER_ALL = ~0,
|
DENOISER_ALL = ~0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum DenoiserInput {
|
||||||
|
DENOISER_INPUT_RGB = 1,
|
||||||
|
DENOISER_INPUT_RGB_ALBEDO = 2,
|
||||||
|
DENOISER_INPUT_RGB_ALBEDO_NORMAL = 3,
|
||||||
|
|
||||||
|
DENOISER_INPUT_NUM,
|
||||||
|
};
|
||||||
|
|
||||||
typedef int DenoiserTypeMask;
|
typedef int DenoiserTypeMask;
|
||||||
|
|
||||||
class DenoiseParams {
|
class DenoiseParams {
|
||||||
@@ -72,10 +81,10 @@ class DenoiseParams {
|
|||||||
/* Clamp the input to the range of +-1e8. Should be enough for any legitimate data. */
|
/* Clamp the input to the range of +-1e8. Should be enough for any legitimate data. */
|
||||||
bool clamp_input;
|
bool clamp_input;
|
||||||
|
|
||||||
/** Optix Denoiser **/
|
/** OIDN/Optix Denoiser **/
|
||||||
|
|
||||||
/* Passes handed over to the OptiX denoiser (default to color + albedo). */
|
/* Passes handed over to the OIDN/OptiX denoiser (default to color + albedo). */
|
||||||
int optix_input_passes;
|
DenoiserInput input_passes;
|
||||||
|
|
||||||
DenoiseParams()
|
DenoiseParams()
|
||||||
{
|
{
|
||||||
@@ -91,7 +100,7 @@ class DenoiseParams {
|
|||||||
neighbor_frames = 2;
|
neighbor_frames = 2;
|
||||||
clamp_input = true;
|
clamp_input = true;
|
||||||
|
|
||||||
optix_input_passes = 2;
|
input_passes = DENOISER_INPUT_RGB_ALBEDO_NORMAL;
|
||||||
|
|
||||||
start_sample = 0;
|
start_sample = 0;
|
||||||
}
|
}
|
||||||
@@ -150,8 +159,8 @@ class DeviceTask {
|
|||||||
function<void(RenderTile &)> update_tile_sample;
|
function<void(RenderTile &)> update_tile_sample;
|
||||||
function<void(RenderTile &)> release_tile;
|
function<void(RenderTile &)> release_tile;
|
||||||
function<bool()> get_cancel;
|
function<bool()> get_cancel;
|
||||||
function<void(RenderTile *, Device *)> map_neighbor_tiles;
|
function<void(RenderTileNeighbors &, Device *)> map_neighbor_tiles;
|
||||||
function<void(RenderTile *, Device *)> unmap_neighbor_tiles;
|
function<void(RenderTileNeighbors &, Device *)> unmap_neighbor_tiles;
|
||||||
|
|
||||||
uint tile_types;
|
uint tile_types;
|
||||||
DenoiseParams denoising;
|
DenoiseParams denoising;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user