Compare commits

..

227 Commits

Author SHA1 Message Date
4469102925 progress 2021-09-10 11:02:06 +02:00
0eb570cbbb progress 2021-09-09 18:55:38 +02:00
e3594c8e65 Merge branch 'master' into parallel-multi-function 2021-09-09 17:47:04 +02:00
bcae5507b8 Merge branch 'temp-geometry-nodes-fields' into parallel-multi-function 2021-09-09 17:45:46 +02:00
29704854df hide new nodes behind feature flag 2021-09-09 11:40:09 +02:00
2920a569b5 progress 2021-09-09 11:19:09 +02:00
015bde6145 Add description for domain property 2021-09-08 09:58:09 -05:00
8d19ceaee7 Rename "dst_hints" to "dst_varrays", update comments 2021-09-08 09:58:01 -05:00
d62cf98164 A few picky changes to comments 2021-09-08 09:51:00 -05:00
655223e4c6 Merge branch 'master' into temp-geometry-nodes-fields 2021-09-08 09:13:22 -05:00
068f012221 initial commit 2021-09-08 15:47:45 +02:00
54cc128a31 Remove changes to the Point Translate node 2021-09-07 13:14:31 -05:00
fa5a9b0f6a Merge branch 'master' into temp-geometry-nodes-fields 2021-09-07 13:05:06 -05:00
cffd4a7ccf Cleanup: Add comment about reusing span for input and output 2021-09-06 20:43:21 -05:00
2012469acc fix exposed string property 2021-09-06 20:54:56 +02:00
713da0fcc4 remove unused function 2021-09-06 20:54:56 +02:00
8ba889a4be Merge branch 'master' into temp-geometry-nodes-fields 2021-09-06 19:42:52 +02:00
5cd7e557ae Cleanup: Comment formatting 2021-09-06 12:39:53 -05:00
584af77101 Add assertion in FieldEvaluator for evaluation state 2021-09-06 12:30:40 -05:00
d53e400454 Merge branch 'temp-geometry-nodes-fields' of git.blender.org:blender into temp-geometry-nodes-fields 2021-09-06 12:24:21 -05:00
64d1fe3450 Update field tests for the newer API 2021-09-06 12:24:17 -05:00
4b091f2eb6 add comments for anonymous attributes 2021-09-06 17:41:15 +02:00
e70f9b0d0e Cleanup: Rename functions
- "try" is not necessary / doesn't really make it clearer
- Fix incorrect name
2021-09-06 10:39:05 -05:00
d2d10e63c9 Merge branch 'master' into temp-geometry-nodes-fields 2021-09-06 17:25:40 +02:00
b51f68d780 Various small cleanups and comment changes 2021-09-06 10:22:21 -05:00
c3adfd6d5d Cleanup: Rename node identifier's and file to include "Input" 2021-09-06 09:50:08 -05:00
edac56b414 more comments 2021-09-06 13:35:06 +02:00
8c76ca6a53 cleanup 2021-09-06 13:24:38 +02:00
0bd2b314e8 Merge branch 'master' into temp-geometry-nodes-fields 2021-09-06 12:55:48 +02:00
2963be588d cleanup 2021-09-06 12:53:03 +02:00
507f2628fd rename Freeze to Capture 2021-09-06 12:05:41 +02:00
c227b4da17 cleanup 2021-09-06 11:45:50 +02:00
605f145aba cleanup FieldNode 2021-09-06 10:58:56 +02:00
deb7cd5783 Merge branch 'master' into temp-geometry-nodes-fields 2021-09-06 10:31:26 +02:00
cb0a78cb8f Merge branch 'master' into temp-geometry-nodes-fields 2021-09-05 23:15:06 -05:00
70e3b6d11f Rename position node file 2021-09-03 15:16:35 -05:00
e041389c68 Fix crash in normal node 2021-09-03 15:15:06 -05:00
38574e37cc Various small cleanups 2021-09-03 13:42:45 -05:00
8186dddec1 Merge branch 'master' into temp-geometry-nodes-fields 2021-09-03 13:21:26 -05:00
47fa00ffef Support fields in the point translate node, add selection input
Because we don't have a "Extract Named Attribute" node currently,
I had to keep the old string input. Otherwise we wouldn't be able to
add versioning.
2021-09-03 13:12:50 -05:00
62f8bb87b7 Add utility methods for field destinations and selection fields 2021-09-03 13:06:54 -05:00
5617cb5500 add some comments 2021-09-03 17:09:43 +02:00
a4d4188c8d rename field related classes 2021-09-03 16:12:47 +02:00
f487dbae97 use GFieldRef where appropriate 2021-09-03 13:29:22 +02:00
94b98d3f88 fix bug when the same field is evaluated twice 2021-09-03 12:54:28 +02:00
32f101c603 add initial Attribute Freeze node 2021-09-03 11:55:22 +02:00
2feed5ce33 support deduplication of normal node 2021-09-03 11:06:50 +02:00
f7b9114eec fix typo 2021-09-03 10:53:06 +02:00
7f017a51bb Merge branch 'master' into temp-geometry-nodes-fields 2021-09-03 10:48:12 +02:00
efbe1ea8c7 Cleanup and improve comment 2021-09-02 23:05:54 -05:00
2b38770ebd Add initial normal node
In contrast with the read-only "normal" attribute on the face domain,
this node gives normalized values for every mesh domain, including
edges and corners. This is preferrable since it's much more predictable
to work with.

The implementation is a little more complicated than I would like,
but could be improved with const access to lazy calculation of normals
on meshes, which is something I've been planning to work on anyway.
2021-09-02 23:00:00 -05:00
5a96096c5e Fix function and define names 2021-09-02 22:55:09 -05:00
ce1519d804 Cleanup: Internally rename "position" to "input_position"
Maybe we'll decide not to do this, for now maybe it's better to be consistent though
2021-09-02 16:24:08 -05:00
bd1375f9cb Cleanup: Rename index node define 2021-09-02 16:20:00 -05:00
af641d0912 Add "Index" node 2021-09-02 16:13:44 -05:00
6c0ae5e890 Allow Set Position node to act on more component types, cleanup 2021-09-02 16:11:30 -05:00
fac0723e92 Add a special case for a selection span
This will probably end up being a utility used elsewhere,
so it's worth adding this case.
2021-09-02 15:57:35 -05:00
68a8a89c49 Reorder input sockets
Since the position is the more important input compared to the
selection, it should be on top
2021-09-02 15:48:36 -05:00
8c9432be6a Cleanup: Remove unnecessary include 2021-09-02 15:47:50 -05:00
6e08de6028 Merge branch 'master' into temp-geometry-nodes-fields 2021-09-02 14:58:26 -05:00
00ed599fe4 fix test 2021-09-02 13:42:54 +02:00
769c7521b5 fix attribute field source deduplication 2021-09-02 13:00:59 +02:00
e23ccfe913 Merge branch 'master' into temp-geometry-nodes-fields 2021-09-02 12:50:26 +02:00
7398076be2 cleanup 2021-09-02 12:48:02 +02:00
ea98f53dcd add initial Position and Set Position node 2021-09-02 12:42:38 +02:00
70cbbd614f get more efficient virtual array from MFParams 2021-09-02 12:41:51 +02:00
95288eba59 improve field evaluator and add geometry context 2021-09-02 12:41:19 +02:00
01037308d5 Cleanup: Change wording of comments 2021-09-01 23:46:25 -05:00
1765e1b20a Merge branch 'master' into temp-geometry-nodes-fields 2021-09-01 23:03:23 -05:00
7cb4665bee new FieldEvaluator utility class 2021-09-01 18:01:48 +02:00
d6bddbef2d add more flexible field evaluation method 2021-09-01 17:00:26 +02:00
fcfec33cf7 Merge branch 'temp-geometry-nodes-fields--fields-jacques' into temp-geometry-nodes-fields 2021-09-01 11:52:37 +02:00
e338ebb720 Merge branch 'temp-geometry-nodes-fields--anonymous-attributes' into temp-geometry-nodes-fields 2021-09-01 11:52:14 +02:00
741deadff4 Merge branch 'master' into temp-geometry-nodes-fields 2021-09-01 11:51:56 +02:00
c1cab4aa68 add common base class for field input/operation 2021-09-01 11:39:18 +02:00
bf6b04bf89 destruct all variables that are not outputs 2021-08-31 13:40:45 +02:00
a275572e0b fix string socket 2021-08-31 13:22:05 +02:00
9ec7e23c44 support modifier inputs again 2021-08-31 12:41:13 +02:00
3c5681c212 support field conversion 2021-08-31 12:40:53 +02:00
28f1e71e2e fix default values 2021-08-31 12:05:11 +02:00
149fd7b65f initial support for function nodes in evaluator 2021-08-31 11:41:53 +02:00
a55c230b8a initial support in evaluator 2021-08-31 11:03:38 +02:00
1f1dc4ade3 field cpp type 2021-08-31 10:22:43 +02:00
d445ee4c73 rename to GField 2021-08-31 09:58:12 +02:00
73e52ab55f Fix index field name for debugging 2021-08-30 17:57:01 -05:00
3fec225931 Cleanup: Rename function, add comments 2021-08-30 17:54:43 -05:00
f0443b8859 Cleanup: Remove incorrect comment 2021-08-30 17:50:47 -05:00
b73f692919 Add a slightly more complicated test 2021-08-30 17:49:38 -05:00
4aeb9dc996 Fix incorrect descruction of output variables 2021-08-30 17:49:20 -05:00
3b12594054 Fix broken test because of stupid mistake 2021-08-30 16:41:34 -05:00
0597e93e5e Add TODO comment 2021-08-30 16:41:17 -05:00
5f003515a1 Add a new (failing) test and some comments 2021-08-30 15:25:04 -05:00
26f8647fea Add name to variable outputs from functions 2021-08-30 15:24:30 -05:00
12f296d800 Add TODO comment 2021-08-30 15:24:15 -05:00
75ec632b61 Fix infinite loop 2021-08-30 14:28:03 -05:00
d6519d4305 Fixes for network traversal, add comments 2021-08-30 14:01:54 -05:00
54cf7eaf92 Cleanup: Make construction of function fields easier to read 2021-08-30 14:01:26 -05:00
d0b1e739b1 Merge branch 'temp-geometry-nodes-fields' into temp-geometry-nodes-fields--fields 2021-08-30 10:59:03 -05:00
b04e2e8877 Merge branch 'master' into temp-geometry-nodes-fields 2021-08-30 10:58:33 -05:00
fb0d5124f2 support anonymous attributes in foreach_attribute 2021-08-30 16:02:58 +02:00
6146a679c9 support creating anonymous attributes 2021-08-30 14:24:18 +02:00
84660c44f0 Refactor procedure building to add proper destructs, to use stacks
This still doesn't really work, but it solves a fundamental problem
with the order I was adding destruct calls for intermediate values.
The current problem is that the variables that a function depends
on (its inputs) are not added first, so basically a problem with the
traversal of the field network.
2021-08-29 12:28:40 -05:00
c398cad059 show procedure parameters in dot graph 2021-08-29 12:46:39 +02:00
35bf6b9790 move dot graph generation into utility class 2021-08-29 12:27:39 +02:00
e5a59e876e slightly improve readability of dot export 2021-08-29 12:09:56 +02:00
d464816c37 Cleanup: Rename variables 2021-08-28 21:20:50 -05:00
007651129a Add comment 2021-08-28 21:18:38 -05:00
1968c9b702 Add another test, add TODO comments 2021-08-28 21:17:21 -05:00
eb54741226 Don't destruct reused inputs after a function call 2021-08-28 18:10:38 -05:00
ce86a518b9 Fix problem building variables for function inuts 2021-08-28 13:29:22 -05:00
09a5ea059f Add a slightly more complicated test
This one doesn't pass, I'll need to debug it
2021-08-28 00:40:58 -05:00
b3cc26bf35 Add another very simple passing test 2021-08-28 00:21:01 -05:00
5f29552be7 Complete handling of field network inputs 2021-08-28 00:05:14 -05:00
6afa55b7e4 Add short comment 2021-08-28 00:02:49 -05:00
37d717fe14 Add FieldInput for input virtual arrays 2021-08-27 15:53:03 -05:00
f193cf66d4 Merge branch 'temp-geometry-nodes-fields' into temp-geometry-nodes-fields--fields 2021-08-27 15:02:33 -05:00
68efa935da Merge branch 'master' into temp-geometry-nodes-fields 2021-08-27 15:01:30 -05:00
1a0fed5d8e Use EXPECT_EQ instead of ASSERT_EQ 2021-08-27 10:55:14 -05:00
c3206bd2a0 Rename Function to FieldFunction 2021-08-27 09:49:36 -05:00
26e7fef920 Merge branch 'temp-geometry-nodes-fields' into temp-geometry-nodes-fields--fields 2021-08-27 09:13:19 -05:00
92e1c8744b Merge branch 'master' into temp-geometry-nodes-fields 2021-08-27 09:12:42 -05:00
cfe8832dd3 Revert "Rename existing boolean node to mesh boolean"
This reverts commit 6a5b048658.

I'm in the wrong branch again!
2021-08-26 23:18:32 -05:00
6a5b048658 Rename existing boolean node to mesh boolean 2021-08-26 23:16:10 -05:00
ad0dbde653 Merge branch 'master' into temp-geometry-nodes-fields 2021-08-26 23:15:27 -05:00
f25c1b4950 Revert "Rename existing boolean node to "Mesh Boolean""
This reverts commit 469f752b80.

I thought I was in a different branch.
2021-08-26 23:15:02 -05:00
469f752b80 Rename existing boolean node to "Mesh Boolean" 2021-08-26 23:12:50 -05:00
55f2867db3 Merge branch 'master' into temp-geometry-nodes-fields--fields 2021-08-26 23:11:03 -05:00
80429002d7 Add an index input function test
This one fails because `tot_initialized_` is 0 in the procedure
evaluator. I'm not quite sure what that means yet.
2021-08-26 16:32:04 -05:00
0910b76be3 Add a high-level description to the header file 2021-08-26 15:28:41 -05:00
1ccfd6842b Refactor field storage again, to allow reuse of function outputs 2021-08-26 15:23:53 -05:00
0a0360c8cd Fix constant input test 2021-08-26 11:19:58 -05:00
be0201259a Merge branch 'temp-geometry-nodes-fields' into temp-geometry-nodes-fields--fields 2021-08-26 10:43:32 -05:00
ef2a48329d Merge branch 'master' into temp-geometry-nodes-fields 2021-08-26 10:41:59 -05:00
81a0c384da Experimental simplification: non-virtual multi-function-only fields
The stupidly simple test doesn't pass anymore.
2021-08-25 17:39:19 -05:00
70eaba3cb1 Basic constant input test passes 2021-08-25 16:23:46 -05:00
7e39e78259 Merge branch 'master' into temp-geometry-nodes-fields--fields 2021-08-25 14:28:57 -05:00
c2122c39ae Remove GArray, futher improvement 2021-08-25 09:55:34 -05:00
fb26ee8a7e Initial crappy code that doesn't do anything and wouldn't compile 2021-08-24 17:35:46 -05:00
001072721f Merge branch 'master' into temp-geometry-nodes-fields 2021-08-24 13:45:48 -05:00
65a1ec89ba Merge branch 'temp-geometry-nodes-fields' into temp-geometry-nodes-fields--anonymous-attributes 2021-08-24 17:56:36 +02:00
ef9fbf258b use attribute id in more places 2021-08-24 17:53:15 +02:00
a448949f25 more uses of attribute id 2021-08-24 17:30:56 +02:00
e3232f987a initial attribute id ref 2021-08-24 17:11:24 +02:00
7ebc3140bb Merge branch 'master' into temp-geometry-nodes-fields 2021-08-23 15:12:04 -05:00
c42ceef040 initial anonymous attributes implementation 2021-08-23 18:40:29 +02:00
acc2e8afa9 Merge branch 'master' into temp-geometry-nodes-fields 2021-08-23 15:58:16 +02:00
04bb1bda32 fix comment 2021-08-23 15:57:50 +02:00
eed93aaa07 make dot output more compact 2021-08-22 22:34:25 +02:00
fc0bb6cdee avoid allocating index array in some cases 2021-08-22 20:29:52 +02:00
10f2ad1556 add return instruction and initial procedure validation 2021-08-22 20:16:27 +02:00
6d77b87b13 support span buffer reuse 2021-08-22 15:07:23 +02:00
2101b46802 fix comment 2021-08-22 12:49:22 +02:00
34f6765630 Merge branch 'master' into temp-multi-function-procedure 2021-08-22 12:21:52 +02:00
c58d1acba8 improve naming 2021-08-20 14:29:01 +02:00
0ee79f304e cleanup 2021-08-20 13:38:38 +02:00
e642de3d6f Merge branch 'master' into temp-multi-function-procedure 2021-08-20 13:37:32 +02:00
eca5a8b695 Merge branch 'master' into temp-multi-function-procedure 2021-08-20 12:48:18 +02:00
79c79f3c70 cleanup 2021-08-20 11:37:23 +02:00
a9970d3cb9 bring back clamping in math node 2021-08-20 10:44:29 +02:00
b812f289f5 Merge branch 'master' into mf-procedure 2021-08-20 10:36:04 +02:00
215ce0fb57 fix 2021-08-19 18:19:15 +02:00
5154598845 Merge branch 'master' into mf-procedure 2021-08-19 18:11:51 +02:00
1ee80d792c cleanup 2021-08-19 18:09:52 +02:00
95284d2f1e bring back function nodes 2021-08-19 18:07:36 +02:00
7281f3eb56 start bringing back function nodes 2021-08-19 17:28:15 +02:00
607ef8f6c5 pull out multi function network 2021-08-19 16:49:00 +02:00
1ce640cc0b test vector processing 2021-08-19 16:24:32 +02:00
7bed18fdb1 support creating loops with builder 2021-08-19 15:33:35 +02:00
c827b50d40 add dummy instruction type 2021-08-19 14:06:43 +02:00
3c7e3c8e44 improve naming 2021-08-19 13:46:19 +02:00
98e38ce4f3 cleanup 2021-08-19 13:44:15 +02:00
132cf268c0 add comments 2021-08-19 13:36:52 +02:00
fd7edc9b05 cleanup 2021-08-19 13:28:15 +02:00
ecf7c90840 remove redundant utilties 2021-08-19 13:15:11 +02:00
d78a530af1 initial procedure builder 2021-08-19 13:09:41 +02:00
3ebe61db9f support evaluation on one 2021-08-19 11:22:57 +02:00
86c2f139c6 cleanup 2021-08-19 10:09:02 +02:00
3596c348eb cleanup 2021-08-19 10:07:51 +02:00
41a81474e4 refactor procedure executor 2021-08-18 20:19:12 +02:00
aa2822d137 cleanup 2021-08-18 20:18:19 +02:00
55b333d3e3 Merge branch 'master' into mf-procedure 2021-08-18 16:14:32 +02:00
00cfad8578 add utility method 2021-08-18 10:00:51 +02:00
1891c956e5 refactor variable store 2021-08-17 17:24:01 +02:00
249c050757 add single test 2021-08-17 15:27:46 +02:00
a0081046b6 cleanup instruction scheduling 2021-08-17 15:01:27 +02:00
635f73b7f1 fixes after merge 2021-08-17 14:00:06 +02:00
74fcd50e2f Merge branch 'master' into mf-procedure 2021-08-17 13:44:25 +02:00
b04a2a7be7 add utility 2021-06-13 14:42:22 +02:00
083671e8ac progress 2021-06-13 14:25:23 +02:00
78ea401e19 Merge branch 'master' into mf-procedure 2021-06-13 14:13:22 +02:00
f3ca987bce start constructing procedure from node tree 2021-06-11 13:39:38 +02:00
2245add9f8 Merge branch 'master' into mf-procedure 2021-06-11 12:59:12 +02:00
31004d7fac start with creating procedure for node tree 2021-05-31 10:51:34 +02:00
3d3f66ed41 fix merge conflicts 2021-05-29 12:14:48 +02:00
c9c0195da5 Merge branch 'master' into mf-procedure 2021-05-29 12:07:13 +02:00
70c0403858 fixes 2021-03-27 22:58:44 +01:00
8d4de82c7f initial network to procedure 2021-03-27 22:30:53 +01:00
22c51c2d51 cleanup 2021-03-27 21:22:28 +01:00
158bd7c6a0 cleanup 2021-03-27 21:18:48 +01:00
4a28d0b583 another check 2021-03-27 15:52:13 +01:00
0501e6e693 fix memory leak in test 2021-03-27 15:45:59 +01:00
8450ac09c1 comment containing things to check 2021-03-27 15:36:08 +01:00
1af00015e8 initial destruct support 2021-03-27 15:29:02 +01:00
b44c3a3125 count initializations 2021-03-27 15:12:36 +01:00
d729f1ca37 cleanup 2021-03-27 15:08:21 +01:00
0fc9f00c14 start extracting container 2021-03-27 14:53:39 +01:00
6c9b339af7 refactor variable store 2021-03-27 14:46:53 +01:00
b7a976af01 branch test 2021-03-27 14:07:23 +01:00
a689037917 initial branch instruction 2021-03-27 13:48:18 +01:00
313403c1f1 support mutable params 2021-03-27 13:33:42 +01:00
60409b8823 simplify 2021-03-27 13:19:46 +01:00
773dc2ec94 improve dot graph 2021-03-27 13:14:19 +01:00
2a98c5d06b initial execution 2021-03-27 13:06:50 +01:00
6d1b4ce3c6 simplify 2021-03-27 12:06:40 +01:00
0b2d961b70 move executor to separate file 2021-03-27 11:55:51 +01:00
d553b70470 Merge branch 'master' into mf-procedure 2021-03-27 11:52:12 +01:00
6954f2cdd7 dot export 2021-03-24 18:46:17 +01:00
8cc832110a more 2021-03-24 18:23:36 +01:00
7b8c54b5a1 more 2021-03-24 17:51:37 +01:00
e850d175b5 more 2021-03-24 17:42:18 +01:00
326f79d59b more 2021-03-24 17:39:22 +01:00
ec4954ece2 destructor 2021-03-24 17:34:14 +01:00
b30e782c82 more stuff 2021-03-24 17:30:53 +01:00
e34fe5d28e add destruct instruction 2021-03-24 16:49:52 +01:00
8581a062f1 Merge branch 'master' into mf-procedure 2021-03-24 16:47:48 +01:00
b43971e5e9 add executor class 2021-03-23 16:20:40 +01:00
855382170e initial mf procedure data structure 2021-03-23 16:18:23 +01:00
3087 changed files with 109954 additions and 207964 deletions

View File

@@ -180,7 +180,6 @@ ForEachMacros:
- CTX_DATA_BEGIN_WITH_ID - CTX_DATA_BEGIN_WITH_ID
- DEG_OBJECT_ITER_BEGIN - DEG_OBJECT_ITER_BEGIN
- DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN - DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN
- DRW_ENABLED_ENGINE_ITER
- DRIVER_TARGETS_LOOPER_BEGIN - DRIVER_TARGETS_LOOPER_BEGIN
- DRIVER_TARGETS_USED_LOOPER_BEGIN - DRIVER_TARGETS_USED_LOOPER_BEGIN
- FOREACH_BASE_IN_EDIT_MODE_BEGIN - FOREACH_BASE_IN_EDIT_MODE_BEGIN
@@ -268,6 +267,3 @@ ForEachMacros:
StatementMacros: StatementMacros:
- PyObject_HEAD - PyObject_HEAD
- PyObject_VAR_HEAD - PyObject_VAR_HEAD
MacroBlockBegin: "^BSDF_CLOSURE_CLASS_BEGIN$"
MacroBlockEnd: "^BSDF_CLOSURE_CLASS_END$"

View File

@@ -1,5 +0,0 @@
This repository is only used as a mirror of git.blender.org. Blender development happens on
https://developer.blender.org.
To get started with contributing code, please see:
https://wiki.blender.org/wiki/Process/Contributing_Code

View File

@@ -30,7 +30,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
"CMake generation for blender is not allowed within the source directory!" "CMake generation for blender is not allowed within the source directory!"
"\n Remove \"${CMAKE_SOURCE_DIR}/CMakeCache.txt\" and try again from another folder, e.g.:" "\n Remove \"${CMAKE_SOURCE_DIR}/CMakeCache.txt\" and try again from another folder, e.g.:"
"\n " "\n "
"\n rm -rf CMakeCache.txt CMakeFiles" "\n rm CMakeCache.txt"
"\n cd .." "\n cd .."
"\n mkdir cmake-make" "\n mkdir cmake-make"
"\n cd cmake-make" "\n cd cmake-make"
@@ -156,15 +156,6 @@ get_blender_version()
option(WITH_BLENDER "Build blender (disable to build only the blender player)" ON) option(WITH_BLENDER "Build blender (disable to build only the blender player)" ON)
mark_as_advanced(WITH_BLENDER) mark_as_advanced(WITH_BLENDER)
if(APPLE)
# Currently this causes a build error linking, disable.
set(WITH_BLENDER_THUMBNAILER OFF)
elseif(WIN32)
option(WITH_BLENDER_THUMBNAILER "Build \"BlendThumb.dll\" helper for Windows explorer integration" ON)
else()
option(WITH_BLENDER_THUMBNAILER "Build \"blender-thumbnailer\" thumbnail extraction utility" ON)
endif()
option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON) option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
option(WITH_PYTHON "Enable Embedded Python API (only disable for development)" ON) option(WITH_PYTHON "Enable Embedded Python API (only disable for development)" ON)
@@ -397,59 +388,46 @@ if(WITH_PYTHON_INSTALL)
set(PYTHON_REQUESTS_PATH "" CACHE PATH "Path to python site-packages or dist-packages containing 'requests' module") set(PYTHON_REQUESTS_PATH "" CACHE PATH "Path to python site-packages or dist-packages containing 'requests' module")
mark_as_advanced(PYTHON_REQUESTS_PATH) mark_as_advanced(PYTHON_REQUESTS_PATH)
endif() endif()
option(WITH_PYTHON_INSTALL_ZSTANDARD "Copy zstandard into the blender install folder" ON)
set(PYTHON_ZSTANDARD_PATH "" CACHE PATH "Path to python site-packages or dist-packages containing 'zstandard' module")
mark_as_advanced(PYTHON_ZSTANDARD_PATH)
endif() endif()
option(WITH_CPU_SIMD "Enable SIMD instruction if they're detected on the host machine" ON) option(WITH_CPU_SIMD "Enable SIMD instruction if they're detected on the host machine" ON)
mark_as_advanced(WITH_CPU_SIMD) mark_as_advanced(WITH_CPU_SIMD)
# Cycles # Cycles
option(WITH_CYCLES "Enable Cycles Render Engine" ON) option(WITH_CYCLES "Enable Cycles Render Engine" ON)
option(WITH_CYCLES_OSL "Build Cycles with OpenShadingLanguage support" ON) option(WITH_CYCLES_STANDALONE "Build Cycles standalone application" OFF)
option(WITH_CYCLES_EMBREE "Build Cycles with Embree support" ON) option(WITH_CYCLES_STANDALONE_GUI "Build Cycles standalone with GUI" OFF)
option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON) option(WITH_CYCLES_OSL "Build Cycles with OSL support" ON)
option(WITH_CYCLES_EMBREE "Build Cycles with Embree support" ON)
option(WITH_CYCLES_STANDALONE "Build Cycles standalone application" OFF) option(WITH_CYCLES_CUDA_BINARIES "Build Cycles CUDA binaries" OFF)
option(WITH_CYCLES_STANDALONE_GUI "Build Cycles standalone with GUI" 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_DEBUG_NAN "Build Cycles with additional asserts for detecting NaNs and invalid values" OFF) mark_as_advanced(WITH_CYCLES_CUDA_BUILD_SERIAL)
option(WITH_CYCLES_NATIVE_ONLY "Build Cycles with native kernel only (which fits current CPU, use for development only)" OFF) set(CYCLES_TEST_DEVICES CPU CACHE STRING "Run regression tests on the specified device types (CPU CUDA OPTIX OPENCL)" )
option(WITH_CYCLES_KERNEL_ASAN "Build Cycles kernels with address sanitizer when WITH_COMPILER_ASAN is on, even if it's very slow" OFF) set(CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 sm_70 sm_75 sm_86 compute_75 CACHE STRING "CUDA architectures to build binaries for")
set(CYCLES_TEST_DEVICES CPU CACHE STRING "Run regression tests on the specified device types (CPU CUDA OPTIX HIP)" ) mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
unset(PLATFORM_DEFAULT)
option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON)
option(WITH_CYCLES_DEBUG_NAN "Build Cycles with additional asserts for detecting NaNs and invalid values" OFF)
option(WITH_CYCLES_NATIVE_ONLY "Build Cycles with native kernel only (which fits current CPU, use for development only)" OFF)
option(WITH_CYCLES_KERNEL_ASAN "Build Cycles kernels with address sanitizer when WITH_COMPILER_ASAN is on, even if it's very slow" OFF)
mark_as_advanced(WITH_CYCLES_KERNEL_ASAN) mark_as_advanced(WITH_CYCLES_KERNEL_ASAN)
mark_as_advanced(WITH_CYCLES_CUBIN_COMPILER)
mark_as_advanced(WITH_CYCLES_LOGGING) mark_as_advanced(WITH_CYCLES_LOGGING)
mark_as_advanced(WITH_CYCLES_DEBUG_NAN) mark_as_advanced(WITH_CYCLES_DEBUG_NAN)
mark_as_advanced(WITH_CYCLES_NATIVE_ONLY) mark_as_advanced(WITH_CYCLES_NATIVE_ONLY)
# NVIDIA CUDA & OptiX option(WITH_CYCLES_DEVICE_CUDA "Enable Cycles CUDA compute support" ON)
option(WITH_CYCLES_DEVICE_CUDA "Enable Cycles NVIDIA CUDA compute support" ON) option(WITH_CYCLES_DEVICE_OPTIX "Enable Cycles OptiX support" OFF)
option(WITH_CYCLES_DEVICE_OPTIX "Enable Cycles NVIDIA OptiX support" ON) option(WITH_CYCLES_DEVICE_OPENCL "Enable Cycles OpenCL compute support" ON)
option(WITH_CYCLES_NETWORK "Enable Cycles compute over network support (EXPERIMENTAL and unfinished)" OFF)
mark_as_advanced(WITH_CYCLES_DEVICE_CUDA) mark_as_advanced(WITH_CYCLES_DEVICE_CUDA)
mark_as_advanced(WITH_CYCLES_DEVICE_OPENCL)
mark_as_advanced(WITH_CYCLES_NETWORK)
option(WITH_CYCLES_CUDA_BINARIES "Build Cycles NVIDIA CUDA binaries" OFF) option(WITH_CUDA_DYNLOAD "Dynamically load CUDA libraries at runtime" ON)
set(CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 sm_70 sm_75 sm_86 compute_75 CACHE STRING "CUDA architectures to build binaries for")
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_CUDA_DYNLOAD "Dynamically load CUDA libraries at runtime (for developers, makes cuda-gdb work)" ON)
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
mark_as_advanced(WITH_CYCLES_CUBIN_COMPILER)
mark_as_advanced(WITH_CYCLES_CUDA_BUILD_SERIAL)
mark_as_advanced(WITH_CUDA_DYNLOAD) mark_as_advanced(WITH_CUDA_DYNLOAD)
# AMD HIP
if(WIN32)
option(WITH_CYCLES_DEVICE_HIP "Enable Cycles AMD HIP support" ON)
else()
option(WITH_CYCLES_DEVICE_HIP "Enable Cycles AMD HIP support" OFF)
endif()
option(WITH_CYCLES_HIP_BINARIES "Build Cycles AMD HIP binaries" OFF)
set(CYCLES_HIP_BINARIES_ARCH gfx1010 gfx1011 gfx1012 gfx1030 gfx1031 gfx1032 gfx1034 CACHE STRING "AMD HIP architectures to build binaries for")
mark_as_advanced(WITH_CYCLES_DEVICE_HIP)
mark_as_advanced(CYCLES_HIP_BINARIES_ARCH)
# Draw Manager # Draw Manager
option(WITH_DRAW_DEBUG "Add extra debug capabilities to Draw Manager" OFF) option(WITH_DRAW_DEBUG "Add extra debug capabilities to Draw Manager" OFF)
mark_as_advanced(WITH_DRAW_DEBUG) mark_as_advanced(WITH_DRAW_DEBUG)
@@ -494,8 +472,7 @@ endif()
# This should be turned off when Blender enter beta/rc/release # This should be turned off when Blender enter beta/rc/release
if("${BLENDER_VERSION_CYCLE}" STREQUAL "release" OR if("${BLENDER_VERSION_CYCLE}" STREQUAL "release" OR
"${BLENDER_VERSION_CYCLE}" STREQUAL "rc" OR "${BLENDER_VERSION_CYCLE}" STREQUAL "rc")
"${BLENDER_VERSION_CYCLE}" STREQUAL "beta")
set(WITH_EXPERIMENTAL_FEATURES OFF) set(WITH_EXPERIMENTAL_FEATURES OFF)
else() else()
set(WITH_EXPERIMENTAL_FEATURES ON) set(WITH_EXPERIMENTAL_FEATURES ON)
@@ -647,7 +624,7 @@ if(WIN32)
option(WITH_WINDOWS_PDB "Generate a pdb file for client side stacktraces" ON) option(WITH_WINDOWS_PDB "Generate a pdb file for client side stacktraces" ON)
mark_as_advanced(WITH_WINDOWS_PDB) mark_as_advanced(WITH_WINDOWS_PDB)
option(WITH_WINDOWS_STRIPPED_PDB "Use a stripped PDB file" ON) option(WITH_WINDOWS_STRIPPED_PDB "Use a stripped PDB file" On)
mark_as_advanced(WITH_WINDOWS_STRIPPED_PDB) mark_as_advanced(WITH_WINDOWS_STRIPPED_PDB)
endif() endif()
@@ -848,11 +825,6 @@ if(NOT WITH_CUDA_DYNLOAD)
endif() endif()
endif() endif()
if(WITH_CYCLES_DEVICE_HIP)
# Currently HIP must be dynamically loaded, this may change in future toolkits
set(WITH_HIP_DYNLOAD ON)
endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Check check if submodules are cloned # Check check if submodules are cloned
@@ -1748,12 +1720,6 @@ if(WITH_PYTHON)
elseif(WITH_PYTHON_INSTALL_REQUESTS) elseif(WITH_PYTHON_INSTALL_REQUESTS)
find_python_package(requests "") find_python_package(requests "")
endif() endif()
if(WIN32 OR APPLE)
# pass, we have this in lib/python/site-packages
elseif(WITH_PYTHON_INSTALL_ZSTANDARD)
find_python_package(zstandard "")
endif()
endif() endif()
# Select C++17 as the standard for C++ projects. # Select C++17 as the standard for C++ projects.
@@ -1888,9 +1854,6 @@ elseif(WITH_CYCLES_STANDALONE)
if(WITH_CUDA_DYNLOAD) if(WITH_CUDA_DYNLOAD)
add_subdirectory(extern/cuew) add_subdirectory(extern/cuew)
endif() endif()
if(WITH_HIP_DYNLOAD)
add_subdirectory(extern/hipew)
endif()
if(NOT WITH_SYSTEM_GLEW) if(NOT WITH_SYSTEM_GLEW)
add_subdirectory(extern/glew) add_subdirectory(extern/glew)
endif() endif()
@@ -2025,7 +1988,6 @@ if(FIRST_RUN)
endif() endif()
info_cfg_option(WITH_PYTHON_INSTALL) info_cfg_option(WITH_PYTHON_INSTALL)
info_cfg_option(WITH_PYTHON_INSTALL_NUMPY) info_cfg_option(WITH_PYTHON_INSTALL_NUMPY)
info_cfg_option(WITH_PYTHON_INSTALL_ZSTANDARD)
info_cfg_option(WITH_PYTHON_MODULE) info_cfg_option(WITH_PYTHON_MODULE)
info_cfg_option(WITH_PYTHON_SAFETY) info_cfg_option(WITH_PYTHON_SAFETY)

View File

@@ -27,7 +27,7 @@
define HELP_TEXT define HELP_TEXT
Blender Convenience Targets Blender Convenience Targets
Provided for building Blender (multiple targets can be used at once). Provided for building Blender, (multiple at once can be used).
* debug: Build a debug binary. * debug: Build a debug binary.
* full: Enable all supported dependencies & options. * full: Enable all supported dependencies & options.
@@ -40,8 +40,6 @@ Blender Convenience Targets
* ninja: Use ninja build tool for faster builds. * ninja: Use ninja build tool for faster builds.
* ccache: Use ccache for faster rebuilds. * ccache: Use ccache for faster rebuilds.
Note: when passing in multiple targets their order is not important.
So for a fast build you can for e.g. run 'make lite ccache ninja'.
Note: passing the argument 'BUILD_DIR=path' when calling make will override the default build dir. Note: passing the argument 'BUILD_DIR=path' when calling make will override the default build dir.
Note: passing the argument 'BUILD_CMAKE_ARGS=args' lets you add cmake arguments. Note: passing the argument 'BUILD_CMAKE_ARGS=args' lets you add cmake arguments.

View File

@@ -42,7 +42,6 @@ ExternalProject_Add(nanovdb
URL_HASH ${NANOVDB_HASH_TYPE}=${NANOVDB_HASH} URL_HASH ${NANOVDB_HASH_TYPE}=${NANOVDB_HASH}
PREFIX ${BUILD_DIR}/nanovdb PREFIX ${BUILD_DIR}/nanovdb
SOURCE_SUBDIR nanovdb SOURCE_SUBDIR nanovdb
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/nanovdb/src/nanovdb < ${PATCH_DIR}/nanovdb.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/nanovdb ${DEFAULT_CMAKE_FLAGS} ${NANOVDB_EXTRA_ARGS} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/nanovdb ${DEFAULT_CMAKE_FLAGS} ${NANOVDB_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/nanovdb INSTALL_DIR ${LIBDIR}/nanovdb
) )

View File

@@ -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 ""

View File

@@ -18,20 +18,14 @@
if(WIN32 AND BUILD_MODE STREQUAL Debug) if(WIN32 AND BUILD_MODE STREQUAL Debug)
set(SITE_PACKAGES_EXTRA --global-option build --global-option --debug) set(SITE_PACKAGES_EXTRA --global-option build --global-option --debug)
# zstandard is determined to build and link release mode libs in a debug
# configuration, the only way to make it happy is to bend to its will
# and give it a library to link with.
set(PIP_CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/python/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}_d.lib ${LIBDIR}/python/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}.lib)
else()
set(PIP_CONFIGURE_COMMAND echo ".")
endif() endif()
ExternalProject_Add(external_python_site_packages ExternalProject_Add(external_python_site_packages
DOWNLOAD_COMMAND "" DOWNLOAD_COMMAND ""
CONFIGURE_COMMAND ${PIP_CONFIGURE_COMMAND} CONFIGURE_COMMAND ""
BUILD_COMMAND "" BUILD_COMMAND ""
PREFIX ${BUILD_DIR}/site_packages PREFIX ${BUILD_DIR}/site_packages
INSTALL_COMMAND ${PYTHON_BINARY} -m pip install ${SITE_PACKAGES_EXTRA} cython==${CYTHON_VERSION} idna==${IDNA_VERSION} charset-normalizer==${CHARSET_NORMALIZER_VERSION} urllib3==${URLLIB3_VERSION} certifi==${CERTIFI_VERSION} requests==${REQUESTS_VERSION} zstandard==${ZSTANDARD_VERSION} --no-binary :all: INSTALL_COMMAND ${PYTHON_BINARY} -m pip install ${SITE_PACKAGES_EXTRA} cython==${CYTHON_VERSION} idna==${IDNA_VERSION} chardet==${CHARDET_VERSION} urllib3==${URLLIB3_VERSION} certifi==${CERTIFI_VERSION} requests==${REQUESTS_VERSION} --no-binary :all:
) )
if(USE_PIP_NUMPY) if(USE_PIP_NUMPY)

View File

@@ -189,11 +189,11 @@ set(OSL_HASH 1abd7ce40481771a9fa937f19595d2f2)
set(OSL_HASH_TYPE MD5) set(OSL_HASH_TYPE MD5)
set(OSL_FILE OpenShadingLanguage-${OSL_VERSION}.tar.gz) set(OSL_FILE OpenShadingLanguage-${OSL_VERSION}.tar.gz)
set(PYTHON_VERSION 3.9.7) set(PYTHON_VERSION 3.9.2)
set(PYTHON_SHORT_VERSION 3.9) set(PYTHON_SHORT_VERSION 3.9)
set(PYTHON_SHORT_VERSION_NO_DOTS 39) set(PYTHON_SHORT_VERSION_NO_DOTS 39)
set(PYTHON_URI https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz) set(PYTHON_URI https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz)
set(PYTHON_HASH fddb060b483bc01850a3f412eea1d954) set(PYTHON_HASH f0dc9000312abeb16de4eccce9a870ab)
set(PYTHON_HASH_TYPE MD5) set(PYTHON_HASH_TYPE MD5)
set(PYTHON_FILE Python-${PYTHON_VERSION}.tar.xz) set(PYTHON_FILE Python-${PYTHON_VERSION}.tar.xz)
@@ -215,18 +215,17 @@ set(NANOVDB_HASH e7b9e863ec2f3b04ead171dec2322807)
set(NANOVDB_HASH_TYPE MD5) set(NANOVDB_HASH_TYPE MD5)
set(NANOVDB_FILE nano-vdb-${NANOVDB_GIT_UID}.tar.gz) set(NANOVDB_FILE nano-vdb-${NANOVDB_GIT_UID}.tar.gz)
set(IDNA_VERSION 3.2) set(IDNA_VERSION 2.10)
set(CHARSET_NORMALIZER_VERSION 2.0.6) set(CHARDET_VERSION 4.0.0)
set(URLLIB3_VERSION 1.26.7) set(URLLIB3_VERSION 1.26.3)
set(CERTIFI_VERSION 2021.10.8) set(CERTIFI_VERSION 2020.12.5)
set(REQUESTS_VERSION 2.26.0) set(REQUESTS_VERSION 2.25.1)
set(CYTHON_VERSION 0.29.24) set(CYTHON_VERSION 0.29.21)
set(ZSTANDARD_VERSION 0.15.2 )
set(NUMPY_VERSION 1.21.2) set(NUMPY_VERSION 1.19.5)
set(NUMPY_SHORT_VERSION 1.21) set(NUMPY_SHORT_VERSION 1.19)
set(NUMPY_URI https://github.com/numpy/numpy/releases/download/v${NUMPY_VERSION}/numpy-${NUMPY_VERSION}.zip) set(NUMPY_URI https://github.com/numpy/numpy/releases/download/v${NUMPY_VERSION}/numpy-${NUMPY_VERSION}.zip)
set(NUMPY_HASH 5638d5dae3ca387be562912312db842e) set(NUMPY_HASH f6a1b48717c552bbc18f1adc3cc1fe0e)
set(NUMPY_HASH_TYPE MD5) set(NUMPY_HASH_TYPE MD5)
set(NUMPY_FILE numpy-${NUMPY_VERSION}.zip) set(NUMPY_FILE numpy-${NUMPY_VERSION}.zip)

View File

@@ -371,78 +371,71 @@ NO_BUILD=false
NO_CONFIRM=false NO_CONFIRM=false
USE_CXX11=true USE_CXX11=true
# Note about versions: Min is inclusive, Mex is 'minimum exclusive' (i.e. XXX_VERSION_MIN <= ACTUAL_VERSION < XXX_VERSION_MEX) # Note about versions: Min is inclusive, Max is exclusive (i.e. XXX_VERSION_MIN <= ACTUAL_VERSION < XXX_VERSION_MAX)
# XXX_VERSION is officially supported/used version in official builds. # XXX_VERSION is officially supported/used version in official builds.
# XXX_VERSION_SHORT is used for various things, like preferred version (when distribution provides several of them), # XXX_VERSION_SHORT is used for various things, like preferred version (when distribution provides several of them),
# and to name shortcuts to built libraries' installation directories... # and to name shortcuts to built libraries' installation directories...
CLANG_FORMAT_VERSION_MIN="6.0" CLANG_FORMAT_VERSION_MIN="6.0"
CLANG_FORMAT_VERSION_MEX="10.0" CLANG_FORMAT_VERSION_MAX="10.0"
PYTHON_VERSION="3.9.7" PYTHON_VERSION="3.9.2"
PYTHON_VERSION_SHORT="3.9" PYTHON_VERSION_SHORT="3.9"
PYTHON_VERSION_MIN="3.7" PYTHON_VERSION_MIN="3.7"
PYTHON_VERSION_MEX="3.11" PYTHON_VERSION_MAX="3.11"
PYTHON_VERSION_INSTALLED=$PYTHON_VERSION_SHORT PYTHON_VERSION_INSTALLED=$PYTHON_VERSION_SHORT
PYTHON_FORCE_BUILD=false PYTHON_FORCE_BUILD=false
PYTHON_FORCE_REBUILD=false PYTHON_FORCE_REBUILD=false
PYTHON_SKIP=false PYTHON_SKIP=false
# Additional Python modules. # Additional Python modules.
PYTHON_IDNA_VERSION="3.2" PYTHON_IDNA_VERSION="2.9"
PYTHON_IDNA_VERSION_MIN="2.0" PYTHON_IDNA_VERSION_MIN="2.0"
PYTHON_IDNA_VERSION_MEX="4.0" PYTHON_IDNA_VERSION_MAX="3.0"
PYTHON_IDNA_NAME="idna" PYTHON_IDNA_NAME="idna"
PYTHON_CHARSET_NORMALIZER_VERSION="2.0.6" PYTHON_CHARDET_VERSION="3.0.4"
PYTHON_CHARSET_NORMALIZER_VERSION_MIN="2.0.6" PYTHON_CHARDET_VERSION_MIN="3.0"
PYTHON_CHARSET_NORMALIZER_VERSION_MEX="2.1.0" # requests uses `charset_normalizer~=2.0.0` PYTHON_CHARDET_VERSION_MAX="5.0"
PYTHON_CHARSET_NORMALIZER_NAME="charset-normalizer" PYTHON_CHARDET_NAME="chardet"
PYTHON_URLLIB3_VERSION="1.26.7" PYTHON_URLLIB3_VERSION="1.25.9"
PYTHON_URLLIB3_VERSION_MIN="1.0" PYTHON_URLLIB3_VERSION_MIN="1.0"
PYTHON_URLLIB3_VERSION_MEX="2.0" PYTHON_URLLIB3_VERSION_MAX="2.0"
PYTHON_URLLIB3_NAME="urllib3" PYTHON_URLLIB3_NAME="urllib3"
PYTHON_CERTIFI_VERSION="2021.10.8" PYTHON_CERTIFI_VERSION="2020.4.5.2"
PYTHON_CERTIFI_VERSION_MIN="2021.0" PYTHON_CERTIFI_VERSION_MIN="2020.0"
PYTHON_CERTIFI_VERSION_MEX="2023.0" PYTHON_CERTIFI_VERSION_MAX="2021.0"
PYTHON_CERTIFI_NAME="certifi" PYTHON_CERTIFI_NAME="certifi"
PYTHON_REQUESTS_VERSION="2.23.0" PYTHON_REQUESTS_VERSION="2.23.0"
PYTHON_REQUESTS_VERSION_MIN="2.0" PYTHON_REQUESTS_VERSION_MIN="2.0"
PYTHON_REQUESTS_VERSION_MEX="3.0" PYTHON_REQUESTS_VERSION_MAX="3.0"
PYTHON_REQUESTS_NAME="requests" PYTHON_REQUESTS_NAME="requests"
PYTHON_ZSTANDARD_VERSION="0.15.2" PYTHON_NUMPY_VERSION="1.19.5"
PYTHON_ZSTANDARD_VERSION_MIN="0.15.2"
PYTHON_ZSTANDARD_VERSION_MEX="0.16.0"
PYTHON_ZSTANDARD_NAME="zstandard"
PYTHON_NUMPY_VERSION="1.21.2"
PYTHON_NUMPY_VERSION_MIN="1.14" PYTHON_NUMPY_VERSION_MIN="1.14"
PYTHON_NUMPY_VERSION_MEX="2.0" PYTHON_NUMPY_VERSION_MAX="2.0"
PYTHON_NUMPY_NAME="numpy" PYTHON_NUMPY_NAME="numpy"
# As package-ready parameters (only used with distro packages). # As package-ready parameters (only used with distro packages).
PYTHON_MODULES_PACKAGES=( PYTHON_MODULES_PACKAGES=(
"$PYTHON_IDNA_NAME $PYTHON_IDNA_VERSION_MIN $PYTHON_IDNA_VERSION_MEX" "$PYTHON_IDNA_NAME $PYTHON_IDNA_VERSION_MIN $PYTHON_IDNA_VERSION_MAX"
"$PYTHON_CHARSET_NORMALIZER_NAME $PYTHON_CHARSET_NORMALIZER_VERSION_MIN $PYTHON_CHARSET_NORMALIZER_VERSION_MEX" "$PYTHON_CHARDET_NAME $PYTHON_CHARDET_VERSION_MIN $PYTHON_CHARDET_VERSION_MAX"
"$PYTHON_URLLIB3_NAME $PYTHON_URLLIB3_VERSION_MIN $PYTHON_URLLIB3_VERSION_MEX" "$PYTHON_URLLIB3_NAME $PYTHON_URLLIB3_VERSION_MIN $PYTHON_URLLIB3_VERSION_MAX"
"$PYTHON_CERTIFI_NAME $PYTHON_CERTIFI_VERSION_MIN $PYTHON_CERTIFI_VERSION_MEX" "$PYTHON_CERTIFI_NAME $PYTHON_CERTIFI_VERSION_MIN $PYTHON_CERTIFI_VERSION_MAX"
"$PYTHON_REQUESTS_NAME $PYTHON_REQUESTS_VERSION_MIN $PYTHON_REQUESTS_VERSION_MEX" "$PYTHON_REQUESTS_NAME $PYTHON_REQUESTS_VERSION_MIN $PYTHON_REQUESTS_VERSION_MAX"
"$PYTHON_ZSTANDARD_NAME $PYTHON_ZSTANDARD_VERSION_MIN $PYTHON_ZSTANDARD_VERSION_MEX" "$PYTHON_NUMPY_NAME $PYTHON_NUMPY_VERSION_MIN $PYTHON_NUMPY_VERSION_MAX"
"$PYTHON_NUMPY_NAME $PYTHON_NUMPY_VERSION_MIN $PYTHON_NUMPY_VERSION_MEX"
) )
# As pip-ready parameters (only used when building python). # As pip-ready parameters (only used when building python).
PYTHON_MODULES_PIP=( PYTHON_MODULES_PIP=(
"$PYTHON_IDNA_NAME==$PYTHON_IDNA_VERSION" "$PYTHON_IDNA_NAME==$PYTHON_IDNA_VERSION"
"$PYTHON_CHARSET_NORMALIZER_NAME==$PYTHON_CHARSET_NORMALIZER_VERSION" "$PYTHON_CHARDET_NAME==$PYTHON_CHARDET_VERSION"
"$PYTHON_URLLIB3_NAME==$PYTHON_URLLIB3_VERSION" "$PYTHON_URLLIB3_NAME==$PYTHON_URLLIB3_VERSION"
"$PYTHON_CERTIFI_NAME==$PYTHON_CERTIFI_VERSION" "$PYTHON_CERTIFI_NAME==$PYTHON_CERTIFI_VERSION"
"$PYTHON_REQUESTS_NAME==$PYTHON_REQUESTS_VERSION" "$PYTHON_REQUESTS_NAME==$PYTHON_REQUESTS_VERSION"
"$PYTHON_ZSTANDARD_NAME==$PYTHON_ZSTANDARD_VERSION"
"$PYTHON_NUMPY_NAME==$PYTHON_NUMPY_VERSION" "$PYTHON_NUMPY_NAME==$PYTHON_NUMPY_VERSION"
) )
@@ -450,7 +443,7 @@ PYTHON_MODULES_PIP=(
BOOST_VERSION="1.73.0" BOOST_VERSION="1.73.0"
BOOST_VERSION_SHORT="1.73" BOOST_VERSION_SHORT="1.73"
BOOST_VERSION_MIN="1.49" BOOST_VERSION_MIN="1.49"
BOOST_VERSION_MEX="2.0" BOOST_VERSION_MAX="2.0"
BOOST_FORCE_BUILD=false BOOST_FORCE_BUILD=false
BOOST_FORCE_REBUILD=false BOOST_FORCE_REBUILD=false
BOOST_SKIP=false BOOST_SKIP=false
@@ -459,7 +452,7 @@ TBB_VERSION="2020"
TBB_VERSION_SHORT="2020" TBB_VERSION_SHORT="2020"
TBB_VERSION_UPDATE="_U2" # Used for source packages... TBB_VERSION_UPDATE="_U2" # Used for source packages...
TBB_VERSION_MIN="2018" TBB_VERSION_MIN="2018"
TBB_VERSION_MEX="2022" TBB_VERSION_MAX="2022"
TBB_FORCE_BUILD=false TBB_FORCE_BUILD=false
TBB_FORCE_REBUILD=false TBB_FORCE_REBUILD=false
TBB_SKIP=false TBB_SKIP=false
@@ -467,7 +460,7 @@ TBB_SKIP=false
OCIO_VERSION="2.0.0" OCIO_VERSION="2.0.0"
OCIO_VERSION_SHORT="2.0" OCIO_VERSION_SHORT="2.0"
OCIO_VERSION_MIN="2.0" OCIO_VERSION_MIN="2.0"
OCIO_VERSION_MEX="3.0" OCIO_VERSION_MAX="3.0"
OCIO_FORCE_BUILD=false OCIO_FORCE_BUILD=false
OCIO_FORCE_REBUILD=false OCIO_FORCE_REBUILD=false
OCIO_SKIP=false OCIO_SKIP=false
@@ -475,7 +468,7 @@ OCIO_SKIP=false
OPENEXR_VERSION="2.5.5" OPENEXR_VERSION="2.5.5"
OPENEXR_VERSION_SHORT="2.5" OPENEXR_VERSION_SHORT="2.5"
OPENEXR_VERSION_MIN="2.4" OPENEXR_VERSION_MIN="2.4"
OPENEXR_VERSION_MEX="3.0" OPENEXR_VERSION_MAX="3.0"
OPENEXR_FORCE_BUILD=false OPENEXR_FORCE_BUILD=false
OPENEXR_FORCE_REBUILD=false OPENEXR_FORCE_REBUILD=false
OPENEXR_SKIP=false OPENEXR_SKIP=false
@@ -484,7 +477,7 @@ _with_built_openexr=false
OIIO_VERSION="2.2.15.1" OIIO_VERSION="2.2.15.1"
OIIO_VERSION_SHORT="2.2" OIIO_VERSION_SHORT="2.2"
OIIO_VERSION_MIN="2.1.12" OIIO_VERSION_MIN="2.1.12"
OIIO_VERSION_MEX="2.3.0" OIIO_VERSION_MAX="2.3.0"
OIIO_FORCE_BUILD=false OIIO_FORCE_BUILD=false
OIIO_FORCE_REBUILD=false OIIO_FORCE_REBUILD=false
OIIO_SKIP=false OIIO_SKIP=false
@@ -492,7 +485,7 @@ OIIO_SKIP=false
LLVM_VERSION="12.0.0" LLVM_VERSION="12.0.0"
LLVM_VERSION_SHORT="12.0" LLVM_VERSION_SHORT="12.0"
LLVM_VERSION_MIN="11.0" LLVM_VERSION_MIN="11.0"
LLVM_VERSION_MEX="13.0" LLVM_VERSION_MAX="13.0"
LLVM_VERSION_FOUND="" LLVM_VERSION_FOUND=""
LLVM_FORCE_BUILD=false LLVM_FORCE_BUILD=false
LLVM_FORCE_REBUILD=false LLVM_FORCE_REBUILD=false
@@ -502,7 +495,7 @@ LLVM_SKIP=false
OSL_VERSION="1.11.14.1" OSL_VERSION="1.11.14.1"
OSL_VERSION_SHORT="1.11" OSL_VERSION_SHORT="1.11"
OSL_VERSION_MIN="1.11" OSL_VERSION_MIN="1.11"
OSL_VERSION_MEX="2.0" OSL_VERSION_MAX="2.0"
OSL_FORCE_BUILD=false OSL_FORCE_BUILD=false
OSL_FORCE_REBUILD=false OSL_FORCE_REBUILD=false
OSL_SKIP=false OSL_SKIP=false
@@ -511,7 +504,7 @@ OSL_SKIP=false
OSD_VERSION="3.4.3" OSD_VERSION="3.4.3"
OSD_VERSION_SHORT="3.4" OSD_VERSION_SHORT="3.4"
OSD_VERSION_MIN="3.4" OSD_VERSION_MIN="3.4"
OSD_VERSION_MEX="4.0" OSD_VERSION_MAX="4.0"
OSD_FORCE_BUILD=false OSD_FORCE_BUILD=false
OSD_FORCE_REBUILD=false OSD_FORCE_REBUILD=false
OSD_SKIP=false OSD_SKIP=false
@@ -522,7 +515,7 @@ OPENVDB_BLOSC_VERSION="1.5.0"
OPENVDB_VERSION="8.0.1" OPENVDB_VERSION="8.0.1"
OPENVDB_VERSION_SHORT="8.0" OPENVDB_VERSION_SHORT="8.0"
OPENVDB_VERSION_MIN="8.0" OPENVDB_VERSION_MIN="8.0"
OPENVDB_VERSION_MEX="8.1" OPENVDB_VERSION_MAX="8.1"
OPENVDB_FORCE_BUILD=false OPENVDB_FORCE_BUILD=false
OPENVDB_FORCE_REBUILD=false OPENVDB_FORCE_REBUILD=false
OPENVDB_SKIP=false OPENVDB_SKIP=false
@@ -531,7 +524,7 @@ OPENVDB_SKIP=false
ALEMBIC_VERSION="1.7.16" ALEMBIC_VERSION="1.7.16"
ALEMBIC_VERSION_SHORT="1.7" ALEMBIC_VERSION_SHORT="1.7"
ALEMBIC_VERSION_MIN="1.7" ALEMBIC_VERSION_MIN="1.7"
ALEMBIC_VERSION_MEX="2.0" ALEMBIC_VERSION_MAX="2.0"
ALEMBIC_FORCE_BUILD=false ALEMBIC_FORCE_BUILD=false
ALEMBIC_FORCE_REBUILD=false ALEMBIC_FORCE_REBUILD=false
ALEMBIC_SKIP=false ALEMBIC_SKIP=false
@@ -539,7 +532,7 @@ ALEMBIC_SKIP=false
USD_VERSION="21.02" USD_VERSION="21.02"
USD_VERSION_SHORT="21.02" USD_VERSION_SHORT="21.02"
USD_VERSION_MIN="20.05" USD_VERSION_MIN="20.05"
USD_VERSION_MEX="22.00" USD_VERSION_MAX="22.00"
USD_FORCE_BUILD=false USD_FORCE_BUILD=false
USD_FORCE_REBUILD=false USD_FORCE_REBUILD=false
USD_SKIP=false USD_SKIP=false
@@ -547,7 +540,7 @@ USD_SKIP=false
OPENCOLLADA_VERSION="1.6.68" OPENCOLLADA_VERSION="1.6.68"
OPENCOLLADA_VERSION_SHORT="1.6" OPENCOLLADA_VERSION_SHORT="1.6"
OPENCOLLADA_VERSION_MIN="1.6.68" OPENCOLLADA_VERSION_MIN="1.6.68"
OPENCOLLADA_VERSION_MEX="1.7" OPENCOLLADA_VERSION_MAX="1.7"
OPENCOLLADA_FORCE_BUILD=false OPENCOLLADA_FORCE_BUILD=false
OPENCOLLADA_FORCE_REBUILD=false OPENCOLLADA_FORCE_REBUILD=false
OPENCOLLADA_SKIP=false OPENCOLLADA_SKIP=false
@@ -555,7 +548,7 @@ OPENCOLLADA_SKIP=false
EMBREE_VERSION="3.10.0" EMBREE_VERSION="3.10.0"
EMBREE_VERSION_SHORT="3.10" EMBREE_VERSION_SHORT="3.10"
EMBREE_VERSION_MIN="3.10" EMBREE_VERSION_MIN="3.10"
EMBREE_VERSION_MEX="4.0" EMBREE_VERSION_MAX="4.0"
EMBREE_FORCE_BUILD=false EMBREE_FORCE_BUILD=false
EMBREE_FORCE_REBUILD=false EMBREE_FORCE_REBUILD=false
EMBREE_SKIP=false EMBREE_SKIP=false
@@ -563,7 +556,7 @@ EMBREE_SKIP=false
OIDN_VERSION="1.4.1" OIDN_VERSION="1.4.1"
OIDN_VERSION_SHORT="1.4" OIDN_VERSION_SHORT="1.4"
OIDN_VERSION_MIN="1.4.0" OIDN_VERSION_MIN="1.4.0"
OIDN_VERSION_MEX="1.5" OIDN_VERSION_MAX="1.5"
OIDN_FORCE_BUILD=false OIDN_FORCE_BUILD=false
OIDN_FORCE_REBUILD=false OIDN_FORCE_REBUILD=false
OIDN_SKIP=false OIDN_SKIP=false
@@ -573,7 +566,7 @@ ISPC_VERSION="1.16.0"
FFMPEG_VERSION="4.4" FFMPEG_VERSION="4.4"
FFMPEG_VERSION_SHORT="4.4" FFMPEG_VERSION_SHORT="4.4"
FFMPEG_VERSION_MIN="3.0" FFMPEG_VERSION_MIN="3.0"
FFMPEG_VERSION_MEX="5.0" FFMPEG_VERSION_MAX="5.0"
FFMPEG_FORCE_BUILD=false FFMPEG_FORCE_BUILD=false
FFMPEG_FORCE_REBUILD=false FFMPEG_FORCE_REBUILD=false
FFMPEG_SKIP=false FFMPEG_SKIP=false
@@ -582,7 +575,7 @@ _ffmpeg_list_sep=";"
XR_OPENXR_VERSION="1.0.17" XR_OPENXR_VERSION="1.0.17"
XR_OPENXR_VERSION_SHORT="1.0" XR_OPENXR_VERSION_SHORT="1.0"
XR_OPENXR_VERSION_MIN="1.0.8" XR_OPENXR_VERSION_MIN="1.0.8"
XR_OPENXR_VERSION_MEX="2.0" XR_OPENXR_VERSION_MAX="2.0"
XR_OPENXR_FORCE_BUILD=false XR_OPENXR_FORCE_BUILD=false
XR_OPENXR_FORCE_REBUILD=false XR_OPENXR_FORCE_REBUILD=false
XR_OPENXR_SKIP=false XR_OPENXR_SKIP=false
@@ -1148,11 +1141,10 @@ You may also want to build them yourself (optional ones are [between brackets]):
* Python $PYTHON_VERSION (from $PYTHON_SOURCE). * Python $PYTHON_VERSION (from $PYTHON_SOURCE).
** [IDNA $PYTHON_IDNA_VERSION] (use pip). ** [IDNA $PYTHON_IDNA_VERSION] (use pip).
** [Charset Normalizer $PYTHON_CHARSET_NORMALIZER_VERSION] (use pip). ** [Chardet $PYTHON_CHARDET_VERSION] (use pip).
** [Urllib3 $PYTHON_URLLIB3_VERSION] (use pip). ** [Urllib3 $PYTHON_URLLIB3_VERSION] (use pip).
** [Certifi $PYTHON_CERTIFI_VERSION] (use pip). ** [Certifi $PYTHON_CERTIFI_VERSION] (use pip).
** [Requests $PYTHON_REQUESTS_VERSION] (use pip). ** [Requests $PYTHON_REQUESTS_VERSION] (use pip).
** [ZStandard $PYTHON_ZSTANDARD_VERSION] (use pip).
** [NumPy $PYTHON_NUMPY_VERSION] (use pip). ** [NumPy $PYTHON_NUMPY_VERSION] (use pip).
* Boost $BOOST_VERSION (from $BOOST_SOURCE, modules: $BOOST_BUILD_MODULES). * Boost $BOOST_VERSION (from $BOOST_SOURCE, modules: $BOOST_BUILD_MODULES).
* TBB $TBB_VERSION (from $TBB_SOURCE). * TBB $TBB_VERSION (from $TBB_SOURCE).
@@ -2021,7 +2013,7 @@ compile_OIIO() {
fi fi
# To be changed each time we make edits that would modify the compiled result! # To be changed each time we make edits that would modify the compiled result!
oiio_magic=18 oiio_magic=17
_init_oiio _init_oiio
# Force having own builds for the dependencies. # Force having own builds for the dependencies.
@@ -2096,7 +2088,6 @@ compile_OIIO() {
cmake_d="$cmake_d -D USE_PYTHON=OFF" cmake_d="$cmake_d -D USE_PYTHON=OFF"
cmake_d="$cmake_d -D USE_FFMPEG=OFF" cmake_d="$cmake_d -D USE_FFMPEG=OFF"
cmake_d="$cmake_d -D USE_OPENCV=OFF" cmake_d="$cmake_d -D USE_OPENCV=OFF"
cmake_d="$cmake_d -D USE_OPENVDB=OFF"
cmake_d="$cmake_d -D BUILD_TESTING=OFF" cmake_d="$cmake_d -D BUILD_TESTING=OFF"
cmake_d="$cmake_d -D OIIO_BUILD_TESTS=OFF" cmake_d="$cmake_d -D OIIO_BUILD_TESTS=OFF"
cmake_d="$cmake_d -D OIIO_BUILD_TOOLS=OFF" cmake_d="$cmake_d -D OIIO_BUILD_TOOLS=OFF"
@@ -4036,7 +4027,7 @@ install_DEB() {
INFO "Forced Python building, as requested..." INFO "Forced Python building, as requested..."
_do_compile_python=true _do_compile_python=true
else else
check_package_version_ge_lt_DEB python3-dev $PYTHON_VERSION_MIN $PYTHON_VERSION_MEX check_package_version_ge_lt_DEB python3-dev $PYTHON_VERSION_MIN $PYTHON_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
PYTHON_VERSION_INSTALLED=$(echo `get_package_version_DEB python3-dev` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/') PYTHON_VERSION_INSTALLED=$(echo `get_package_version_DEB python3-dev` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/')
@@ -4049,8 +4040,8 @@ install_DEB() {
module=($module) module=($module)
package="python3-${module[0]}" package="python3-${module[0]}"
package_vmin=${module[1]} package_vmin=${module[1]}
package_vmex=${module[2]} package_vmax=${module[2]}
check_package_version_ge_lt_DEB "$package" $package_vmin $package_vmex check_package_version_ge_lt_DEB "$package" $package_vmin $package_vmax
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_DEB "$package" install_packages_DEB "$package"
else else
@@ -4076,7 +4067,7 @@ install_DEB() {
INFO "Forced Boost building, as requested..." INFO "Forced Boost building, as requested..."
compile_Boost compile_Boost
else else
check_package_version_ge_lt_DEB libboost-dev $BOOST_VERSION_MIN $BOOST_VERSION_MEX check_package_version_ge_lt_DEB libboost-dev $BOOST_VERSION_MIN $BOOST_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_DEB libboost-dev install_packages_DEB libboost-dev
@@ -4097,7 +4088,7 @@ install_DEB() {
INFO "Forced TBB building, as requested..." INFO "Forced TBB building, as requested..."
compile_TBB compile_TBB
else else
check_package_version_ge_lt_DEB libtbb-dev $TBB_VERSION_MIN $TBB_VERSION_MEX check_package_version_ge_lt_DEB libtbb-dev $TBB_VERSION_MIN $TBB_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_DEB libtbb-dev install_packages_DEB libtbb-dev
clean_TBB clean_TBB
@@ -4114,7 +4105,7 @@ install_DEB() {
INFO "Forced OpenColorIO building, as requested..." INFO "Forced OpenColorIO building, as requested..."
compile_OCIO compile_OCIO
else else
check_package_version_ge_lt_DEB libopencolorio-dev $OCIO_VERSION_MIN $OCIO_VERSION_MEX check_package_version_ge_lt_DEB libopencolorio-dev $OCIO_VERSION_MIN $OCIO_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_DEB libopencolorio-dev install_packages_DEB libopencolorio-dev
clean_OCIO clean_OCIO
@@ -4131,7 +4122,7 @@ install_DEB() {
INFO "Forced ILMBase/OpenEXR building, as requested..." INFO "Forced ILMBase/OpenEXR building, as requested..."
compile_OPENEXR compile_OPENEXR
else else
check_package_version_ge_lt_DEB libopenexr-dev $OPENEXR_VERSION_MIN $OPENEXR_VERSION_MEX check_package_version_ge_lt_DEB libopenexr-dev $OPENEXR_VERSION_MIN $OPENEXR_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_DEB libopenexr-dev install_packages_DEB libopenexr-dev
OPENEXR_VERSION=`get_package_version_DEB libopenexr-dev` OPENEXR_VERSION=`get_package_version_DEB libopenexr-dev`
@@ -4152,7 +4143,7 @@ install_DEB() {
INFO "Forced OpenImageIO building, as requested..." INFO "Forced OpenImageIO building, as requested..."
compile_OIIO compile_OIIO
else else
check_package_version_ge_lt_DEB libopenimageio-dev $OIIO_VERSION_MIN $OIIO_VERSION_MEX check_package_version_ge_lt_DEB libopenimageio-dev $OIIO_VERSION_MIN $OIIO_VERSION_MAX
if [ $? -eq 0 -a "$_with_built_openexr" = false ]; then if [ $? -eq 0 -a "$_with_built_openexr" = false ]; then
install_packages_DEB libopenimageio-dev openimageio-tools install_packages_DEB libopenimageio-dev openimageio-tools
clean_OIIO clean_OIIO
@@ -4172,7 +4163,7 @@ install_DEB() {
INFO "Forced LLVM building, as requested..." INFO "Forced LLVM building, as requested..."
_do_compile_llvm=true _do_compile_llvm=true
else else
check_package_version_ge_lt_DEB llvm-dev $LLVM_VERSION_MIN $LLVM_VERSION_MEX check_package_version_ge_lt_DEB llvm-dev $LLVM_VERSION_MIN $LLVM_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_DEB llvm-dev clang libclang-dev install_packages_DEB llvm-dev clang libclang-dev
have_llvm=true have_llvm=true
@@ -4203,7 +4194,7 @@ install_DEB() {
INFO "Forced OpenShadingLanguage building, as requested..." INFO "Forced OpenShadingLanguage building, as requested..."
_do_compile_osl=true _do_compile_osl=true
else else
check_package_version_ge_lt_DEB libopenshadinglanguage-dev $OSL_VERSION_MIN $OSL_VERSION_MEX check_package_version_ge_lt_DEB libopenshadinglanguage-dev $OSL_VERSION_MIN $OSL_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_DEB libopenshadinglanguage-dev install_packages_DEB libopenshadinglanguage-dev
clean_OSL clean_OSL
@@ -4241,7 +4232,7 @@ install_DEB() {
INFO "Forced OpenVDB building, as requested..." INFO "Forced OpenVDB building, as requested..."
compile_OPENVDB compile_OPENVDB
else else
check_package_version_ge_lt_DEB libopenvdb-dev $OPENVDB_VERSION_MIN $OPENVDB_VERSION_MEX check_package_version_ge_lt_DEB libopenvdb-dev $OPENVDB_VERSION_MIN $OPENVDB_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_DEB libopenvdb-dev libblosc-dev install_packages_DEB libopenvdb-dev libblosc-dev
clean_OPENVDB clean_OPENVDB
@@ -4303,7 +4294,7 @@ install_DEB() {
_do_compile_embree=true _do_compile_embree=true
else else
# There is a package, but it does not provide everything that Blender needs... # There is a package, but it does not provide everything that Blender needs...
#~ check_package_version_ge_lt_DEB libembree-dev $EMBREE_VERSION_MIN $EMBREE_VERSION_MEX #~ check_package_version_ge_lt_DEB libembree-dev $EMBREE_VERSION_MIN $EMBREE_VERSION_MAX
#~ if [ $? -eq 0 ]; then #~ if [ $? -eq 0 ]; then
#~ install_packages_DEB libembree-dev #~ install_packages_DEB libembree-dev
#~ clean_Embree #~ clean_Embree
@@ -4345,7 +4336,7 @@ install_DEB() {
# XXX Debian Testing / Ubuntu 16.04 finally includes FFmpeg, so check as usual # XXX Debian Testing / Ubuntu 16.04 finally includes FFmpeg, so check as usual
check_package_DEB ffmpeg check_package_DEB ffmpeg
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
check_package_version_ge_lt_DEB ffmpeg $FFMPEG_VERSION_MIN $FFMPEG_VERSION_MEX check_package_version_ge_lt_DEB ffmpeg $FFMPEG_VERSION_MIN $FFMPEG_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_DEB libavdevice-dev install_packages_DEB libavdevice-dev
clean_FFmpeg clean_FFmpeg
@@ -4679,7 +4670,7 @@ install_RPM() {
INFO "Forced Python building, as requested..." INFO "Forced Python building, as requested..."
_do_compile_python=true _do_compile_python=true
else else
check_package_version_ge_lt_RPM python3-devel $PYTHON_VERSION_MIN $PYTHON_VERSION_MEX check_package_version_ge_lt_RPM python3-devel $PYTHON_VERSION_MIN $PYTHON_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
PYTHON_VERSION_INSTALLED=$(echo `get_package_version_RPM python3-devel` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/') PYTHON_VERSION_INSTALLED=$(echo `get_package_version_RPM python3-devel` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/')
@@ -4691,8 +4682,8 @@ install_RPM() {
module=($module) module=($module)
package="python3-${module[0]}" package="python3-${module[0]}"
package_vmin=${module[1]} package_vmin=${module[1]}
package_vmex=${module[2]} package_vmax=${module[2]}
check_package_version_ge_lt_RPM "$package" $package_vmin $package_vmex check_package_version_ge_lt_RPM "$package" $package_vmin $package_vmax
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_RPM "$package" install_packages_RPM "$package"
else else
@@ -4719,7 +4710,7 @@ install_RPM() {
INFO "Forced Boost building, as requested..." INFO "Forced Boost building, as requested..."
_do_compile_boost=true _do_compile_boost=true
else else
check_package_version_ge_lt_RPM boost-devel $BOOST_VERSION_MIN $BOOST_VERSION_MEX check_package_version_ge_lt_RPM boost-devel $BOOST_VERSION_MIN $BOOST_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_RPM boost-devel install_packages_RPM boost-devel
clean_Boost clean_Boost
@@ -4746,7 +4737,7 @@ install_RPM() {
INFO "Forced TBB building, as requested..." INFO "Forced TBB building, as requested..."
compile_TBB compile_TBB
else else
check_package_version_ge_lt_RPM tbb-devel $TBB_VERSION_MIN $TBB_VERSION_MEX check_package_version_ge_lt_RPM tbb-devel $TBB_VERSION_MIN $TBB_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_RPM tbb-devel install_packages_RPM tbb-devel
clean_TBB clean_TBB
@@ -4764,7 +4755,7 @@ install_RPM() {
compile_OCIO compile_OCIO
else else
if [ "$RPM" = "SUSE" ]; then if [ "$RPM" = "SUSE" ]; then
check_package_version_ge_lt_RPM OpenColorIO-devel $OCIO_VERSION_MIN $OCIO_VERSION_MEX check_package_version_ge_lt_RPM OpenColorIO-devel $OCIO_VERSION_MIN $OCIO_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_RPM OpenColorIO-devel install_packages_RPM OpenColorIO-devel
clean_OCIO clean_OCIO
@@ -4784,7 +4775,7 @@ install_RPM() {
INFO "Forced ILMBase/OpenEXR building, as requested..." INFO "Forced ILMBase/OpenEXR building, as requested..."
compile_OPENEXR compile_OPENEXR
else else
check_package_version_ge_lt_RPM openexr-devel $OPENEXR_VERSION_MIN $OPENEXR_VERSION_MEX check_package_version_ge_lt_RPM openexr-devel $OPENEXR_VERSION_MIN $OPENEXR_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_RPM openexr-devel install_packages_RPM openexr-devel
OPENEXR_VERSION=`get_package_version_RPM openexr-devel` OPENEXR_VERSION=`get_package_version_RPM openexr-devel`
@@ -4802,7 +4793,7 @@ install_RPM() {
INFO "Forced OpenImageIO building, as requested..." INFO "Forced OpenImageIO building, as requested..."
compile_OIIO compile_OIIO
else else
check_package_version_ge_lt_RPM OpenImageIO-devel $OIIO_VERSION_MIN $OIIO_VERSION_MEX check_package_version_ge_lt_RPM OpenImageIO-devel $OIIO_VERSION_MIN $OIIO_VERSION_MAX
if [ $? -eq 0 -a $_with_built_openexr == false ]; then if [ $? -eq 0 -a $_with_built_openexr == false ]; then
install_packages_RPM OpenImageIO-devel OpenImageIO-utils install_packages_RPM OpenImageIO-devel OpenImageIO-utils
clean_OIIO clean_OIIO
@@ -4827,7 +4818,7 @@ install_RPM() {
else else
CLANG_DEV="clang-devel" CLANG_DEV="clang-devel"
fi fi
check_package_version_ge_lt_RPM llvm-devel $LLVM_VERSION_MIN $LLVM_VERSION_MEX check_package_version_ge_lt_RPM llvm-devel $LLVM_VERSION_MIN $LLVM_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_RPM llvm-devel $CLANG_DEV install_packages_RPM llvm-devel $CLANG_DEV
have_llvm=true have_llvm=true
@@ -4863,7 +4854,7 @@ install_RPM() {
else else
OSL_DEV="openshadinglanguage-devel" OSL_DEV="openshadinglanguage-devel"
fi fi
check_package_version_ge_lt_RPM $OSL_DEV $OSL_VERSION_MIN $OSL_VERSION_MEX check_package_version_ge_lt_RPM $OSL_DEV $OSL_VERSION_MIN $OSL_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_RPM $OSL_DEV install_packages_RPM $OSL_DEV
clean_OSL clean_OSL
@@ -4958,7 +4949,7 @@ install_RPM() {
_do_compile_embree=true _do_compile_embree=true
else else
# There is a package, but it does not provide everything that Blender needs... # There is a package, but it does not provide everything that Blender needs...
#~ check_package_version_ge_lt_RPM embree-devel $EMBREE_VERSION_MIN $EMBREE_VERSION_MEX #~ check_package_version_ge_lt_RPM embree-devel $EMBREE_VERSION_MIN $EMBREE_VERSION_MAX
#~ if [ $? -eq 0 ]; then #~ if [ $? -eq 0 ]; then
#~ install_packages_RPM embree-devel #~ install_packages_RPM embree-devel
#~ clean_Embree #~ clean_Embree
@@ -4997,7 +4988,7 @@ install_RPM() {
INFO "Forced FFMpeg building, as requested..." INFO "Forced FFMpeg building, as requested..."
compile_FFmpeg compile_FFmpeg
else else
check_package_version_ge_lt_RPM ffmpeg-devel $FFMPEG_VERSION_MIN $FFMPEG_VERSION_MEX check_package_version_ge_lt_RPM ffmpeg-devel $FFMPEG_VERSION_MIN $FFMPEG_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_RPM ffmpeg ffmpeg-devel install_packages_RPM ffmpeg ffmpeg-devel
clean_FFmpeg clean_FFmpeg
@@ -5222,7 +5213,7 @@ install_ARCH() {
INFO "Forced Python building, as requested..." INFO "Forced Python building, as requested..."
_do_compile_python=true _do_compile_python=true
else else
check_package_version_ge_lt_ARCH python $PYTHON_VERSION_MIN $PYTHON_VERSION_MEX check_package_version_ge_lt_ARCH python $PYTHON_VERSION_MIN $PYTHON_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
PYTHON_VERSION_INSTALLED=$(echo `get_package_version_ARCH python` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/') PYTHON_VERSION_INSTALLED=$(echo `get_package_version_ARCH python` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/')
@@ -5235,8 +5226,8 @@ install_ARCH() {
module=($module) module=($module)
package="python-${module[0]}" package="python-${module[0]}"
package_vmin=${module[1]} package_vmin=${module[1]}
package_vmex=${module[2]} package_vmax=${module[2]}
check_package_version_ge_lt_ARCH "$package" $package_vmin $package_vmex check_package_version_ge_lt_ARCH "$package" $package_vmin $package_vmax
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_ARCH "$package" install_packages_ARCH "$package"
else else
@@ -5262,7 +5253,7 @@ install_ARCH() {
INFO "Forced Boost building, as requested..." INFO "Forced Boost building, as requested..."
compile_Boost compile_Boost
else else
check_package_version_ge_lt_ARCH boost $BOOST_VERSION_MIN $BOOST_VERSION_MEX check_package_version_ge_lt_ARCH boost $BOOST_VERSION_MIN $BOOST_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_ARCH boost install_packages_ARCH boost
clean_Boost clean_Boost
@@ -5279,7 +5270,7 @@ install_ARCH() {
INFO "Forced TBB building, as requested..." INFO "Forced TBB building, as requested..."
compile_TBB compile_TBB
else else
check_package_version_ge_lt_ARCH intel-tbb $TBB_VERSION_MIN $TBB_VERSION_MEX check_package_version_ge_lt_ARCH intel-tbb $TBB_VERSION_MIN $TBB_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_ARCH intel-tbb install_packages_ARCH intel-tbb
clean_TBB clean_TBB
@@ -5296,7 +5287,7 @@ install_ARCH() {
INFO "Forced OpenColorIO building, as requested..." INFO "Forced OpenColorIO building, as requested..."
compile_OCIO compile_OCIO
else else
check_package_version_ge_lt_ARCH opencolorio $OCIO_VERSION_MIN $OCIO_VERSION_MEX check_package_version_ge_lt_ARCH opencolorio $OCIO_VERSION_MIN $OCIO_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_ARCH opencolorio install_packages_ARCH opencolorio
clean_OCIO clean_OCIO
@@ -5313,7 +5304,7 @@ install_ARCH() {
INFO "Forced ILMBase/OpenEXR building, as requested..." INFO "Forced ILMBase/OpenEXR building, as requested..."
compile_OPENEXR compile_OPENEXR
else else
check_package_version_ge_lt_ARCH openexr $OPENEXR_VERSION_MIN $OPENEXR_VERSION_MEX check_package_version_ge_lt_ARCH openexr $OPENEXR_VERSION_MIN $OPENEXR_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_ARCH openexr install_packages_ARCH openexr
OPENEXR_VERSION=`get_package_version_ARCH openexr` OPENEXR_VERSION=`get_package_version_ARCH openexr`
@@ -5332,7 +5323,7 @@ install_ARCH() {
INFO "Forced OpenImageIO building, as requested..." INFO "Forced OpenImageIO building, as requested..."
compile_OIIO compile_OIIO
else else
check_package_version_ge_lt_ARCH openimageio $OIIO_VERSION_MIN $OIIO_VERSION_MEX check_package_version_ge_lt_ARCH openimageio $OIIO_VERSION_MIN $OIIO_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_ARCH openimageio install_packages_ARCH openimageio
clean_OIIO clean_OIIO
@@ -5352,7 +5343,7 @@ install_ARCH() {
INFO "Forced LLVM building, as requested..." INFO "Forced LLVM building, as requested..."
_do_compile_llvm=true _do_compile_llvm=true
else else
check_package_version_ge_lt_ARCH llvm $LLVM_VERSION_MIN $LLVM_VERSION_MEX check_package_version_ge_lt_ARCH llvm $LLVM_VERSION_MIN $LLVM_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_ARCH llvm clang install_packages_ARCH llvm clang
have_llvm=true have_llvm=true
@@ -5383,7 +5374,7 @@ install_ARCH() {
INFO "Forced OpenShadingLanguage building, as requested..." INFO "Forced OpenShadingLanguage building, as requested..."
_do_compile_osl=true _do_compile_osl=true
else else
check_package_version_ge_lt_ARCH openshadinglanguage $OSL_VERSION_MIN $OSL_VERSION_MEX check_package_version_ge_lt_ARCH openshadinglanguage $OSL_VERSION_MIN $OSL_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_ARCH openshadinglanguage install_packages_ARCH openshadinglanguage
clean_OSL clean_OSL
@@ -5409,7 +5400,7 @@ install_ARCH() {
INFO "Forced OpenSubdiv building, as requested..." INFO "Forced OpenSubdiv building, as requested..."
compile_OSD compile_OSD
else else
check_package_version_ge_lt_ARCH opensubdiv $OSD_VERSION_MIN $OSD_VERSION_MEX check_package_version_ge_lt_ARCH opensubdiv $OSD_VERSION_MIN $OSD_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_ARCH opensubdiv install_packages_ARCH opensubdiv
clean_OSD clean_OSD
@@ -5426,7 +5417,7 @@ install_ARCH() {
INFO "Forced OpenVDB building, as requested..." INFO "Forced OpenVDB building, as requested..."
compile_OPENVDB compile_OPENVDB
else else
check_package_version_ge_lt_ARCH openvdb $OPENVDB_VERSION_MIN $OPENVDB_VERSION_MEX check_package_version_ge_lt_ARCH openvdb $OPENVDB_VERSION_MIN $OPENVDB_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_ARCH openvdb install_packages_ARCH openvdb
clean_OPENVDB clean_OPENVDB
@@ -5492,7 +5483,7 @@ install_ARCH() {
_do_compile_embree=true _do_compile_embree=true
else else
# There is a package, but it does not provide everything that Blender needs... # There is a package, but it does not provide everything that Blender needs...
#~ check_package_version_ge_lt_ARCH embree $EMBREE_VERSION_MIN $EMBREE_VERSION_MEX #~ check_package_version_ge_lt_ARCH embree $EMBREE_VERSION_MIN $EMBREE_VERSION_MAX
#~ if [ $? -eq 0 ]; then #~ if [ $? -eq 0 ]; then
#~ install_packages_ARCH embree #~ install_packages_ARCH embree
#~ clean_Embree #~ clean_Embree
@@ -5531,7 +5522,7 @@ install_ARCH() {
INFO "Forced FFMpeg building, as requested..." INFO "Forced FFMpeg building, as requested..."
compile_FFmpeg compile_FFmpeg
else else
check_package_version_ge_lt_ARCH ffmpeg $FFMPEG_VERSION_MIN $FFMPEG_VERSION_MEX check_package_version_ge_lt_ARCH ffmpeg $FFMPEG_VERSION_MIN $FFMPEG_VERSION_MAX
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_ARCH ffmpeg install_packages_ARCH ffmpeg
clean_FFmpeg clean_FFmpeg

View File

@@ -70,18 +70,16 @@
} }
--- a/libavcodec/rl.c --- a/libavcodec/rl.c
+++ b/libavcodec/rl.c +++ b/libavcodec/rl.c
@@ -71,17 +71,19 @@ @@ -71,7 +71,7 @@ av_cold void ff_rl_init(RLTable *rl,
av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size) av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size)
{ {
int i, q; int i, q;
- VLC_TYPE table[1500][2] = {{0}}; - VLC_TYPE table[1500][2] = {{0}};
+ VLC_TYPE (*table)[2] = av_calloc(sizeof(VLC_TYPE), 1500 * 2); + VLC_TYPE (*table)[2] = av_calloc(sizeof(VLC_TYPE), 1500 * 2);
VLC vlc = { .table = table, .table_allocated = static_size }; VLC vlc = { .table = table, .table_allocated = static_size };
- av_assert0(static_size <= FF_ARRAY_ELEMS(table)); av_assert0(static_size <= FF_ARRAY_ELEMS(table));
+ av_assert0(static_size < 1500);
init_vlc(&vlc, 9, rl->n + 1, &rl->table_vlc[0][1], 4, 2, &rl->table_vlc[0][0], 4, 2, INIT_VLC_USE_NEW_STATIC); init_vlc(&vlc, 9, rl->n + 1, &rl->table_vlc[0][1], 4, 2, &rl->table_vlc[0][0], 4, 2, INIT_VLC_USE_NEW_STATIC);
@@ -80,8 +80,10 @@ av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size)
for (q = 0; q < 32; q++) {
int qmul = q * 2; int qmul = q * 2;
int qadd = (q - 1) | 1; int qadd = (q - 1) | 1;
@@ -93,7 +91,7 @@
if (q == 0) { if (q == 0) {
qmul = 1; qmul = 1;
@@ -113,4 +115,5 @@ @@ -113,4 +115,5 @@ av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size)
rl->rl_vlc[q][i].run = run; rl->rl_vlc[q][i].run = run;
} }
} }

View File

@@ -1,374 +0,0 @@
Index: nanovdb/nanovdb/NanoVDB.h
===================================================================
--- a/nanovdb/nanovdb/NanoVDB.h (revision 62751)
+++ b/nanovdb/nanovdb/NanoVDB.h (working copy)
@@ -152,8 +152,8 @@
#endif // __CUDACC_RTC__
-#ifdef __CUDACC__
-// Only define __hostdev__ when using NVIDIA CUDA compiler
+#if defined(__CUDACC__) || defined(__HIP__)
+// Only define __hostdev__ when using NVIDIA CUDA or HIP compiler
#define __hostdev__ __host__ __device__
#else
#define __hostdev__
@@ -461,7 +461,7 @@
/// Maximum floating-point values
template<typename T>
struct Maximum;
-#ifdef __CUDA_ARCH__
+#if defined(__CUDA_ARCH__) || defined(__HIP__)
template<>
struct Maximum<int>
{
@@ -1006,10 +1006,10 @@
using Vec3i = Vec3<int>;
/// @brief Return a single precision floating-point vector of this coordinate
-Vec3f Coord::asVec3s() const { return Vec3f(float(mVec[0]), float(mVec[1]), float(mVec[2])); }
+inline __hostdev__ Vec3f Coord::asVec3s() const { return Vec3f(float(mVec[0]), float(mVec[1]), float(mVec[2])); }
/// @brief Return a double precision floating-point vector of this coordinate
-Vec3d Coord::asVec3d() const { return Vec3d(double(mVec[0]), double(mVec[1]), double(mVec[2])); }
+inline __hostdev__ Vec3d Coord::asVec3d() const { return Vec3d(double(mVec[0]), double(mVec[1]), double(mVec[2])); }
// ----------------------------> Vec4 <--------------------------------------
@@ -1820,7 +1820,7 @@
}; // Map
template<typename Mat4T>
-void Map::set(const Mat4T& mat, const Mat4T& invMat, double taper)
+__hostdev__ void Map::set(const Mat4T& mat, const Mat4T& invMat, double taper)
{
float * mf = mMatF, *vf = mVecF;
float* mif = mInvMatF;
@@ -2170,7 +2170,7 @@
}; // Class Grid
template<typename TreeT>
-int Grid<TreeT>::findBlindDataForSemantic(GridBlindDataSemantic semantic) const
+__hostdev__ int Grid<TreeT>::findBlindDataForSemantic(GridBlindDataSemantic semantic) const
{
for (uint32_t i = 0, n = blindDataCount(); i < n; ++i)
if (blindMetaData(i).mSemantic == semantic)
@@ -2328,7 +2328,7 @@
}; // Tree class
template<typename RootT>
-void Tree<RootT>::extrema(ValueType& min, ValueType& max) const
+__hostdev__ void Tree<RootT>::extrema(ValueType& min, ValueType& max) const
{
min = this->root().valueMin();
max = this->root().valueMax();
@@ -2336,7 +2336,7 @@
template<typename RootT>
template<typename NodeT>
-const NodeT* Tree<RootT>::getNode(uint32_t i) const
+__hostdev__ const NodeT* Tree<RootT>::getNode(uint32_t i) const
{
static_assert(is_same<TreeNodeT<NodeT::LEVEL>, NodeT>::value, "Tree::getNode: unvalid node type");
NANOVDB_ASSERT(i < DataType::mCount[NodeT::LEVEL]);
@@ -2345,7 +2345,7 @@
template<typename RootT>
template<int LEVEL>
-const typename TreeNode<Tree<RootT>, LEVEL>::type* Tree<RootT>::getNode(uint32_t i) const
+__hostdev__ const typename TreeNode<Tree<RootT>, LEVEL>::type* Tree<RootT>::getNode(uint32_t i) const
{
NANOVDB_ASSERT(i < DataType::mCount[LEVEL]);
return reinterpret_cast<const TreeNodeT<LEVEL>*>(reinterpret_cast<const uint8_t*>(this) + DataType::mBytes[LEVEL]) + i;
@@ -2353,7 +2353,7 @@
template<typename RootT>
template<typename NodeT>
-NodeT* Tree<RootT>::getNode(uint32_t i)
+__hostdev__ NodeT* Tree<RootT>::getNode(uint32_t i)
{
static_assert(is_same<TreeNodeT<NodeT::LEVEL>, NodeT>::value, "Tree::getNode: invalid node type");
NANOVDB_ASSERT(i < DataType::mCount[NodeT::LEVEL]);
@@ -2362,7 +2362,7 @@
template<typename RootT>
template<int LEVEL>
-typename TreeNode<Tree<RootT>, LEVEL>::type* Tree<RootT>::getNode(uint32_t i)
+__hostdev__ typename TreeNode<Tree<RootT>, LEVEL>::type* Tree<RootT>::getNode(uint32_t i)
{
NANOVDB_ASSERT(i < DataType::mCount[LEVEL]);
return reinterpret_cast<TreeNodeT<LEVEL>*>(reinterpret_cast<uint8_t*>(this) + DataType::mBytes[LEVEL]) + i;
@@ -2370,7 +2370,7 @@
template<typename RootT>
template<typename NodeT>
-uint32_t Tree<RootT>::getNodeID(const NodeT& node) const
+__hostdev__ uint32_t Tree<RootT>::getNodeID(const NodeT& node) const
{
static_assert(is_same<TreeNodeT<NodeT::LEVEL>, NodeT>::value, "Tree::getNodeID: invalid node type");
const NodeT* first = reinterpret_cast<const NodeT*>(reinterpret_cast<const uint8_t*>(this) + DataType::mBytes[NodeT::LEVEL]);
@@ -2380,7 +2380,7 @@
template<typename RootT>
template<typename NodeT>
-uint32_t Tree<RootT>::getLinearOffset(const NodeT& node) const
+__hostdev__ uint32_t Tree<RootT>::getLinearOffset(const NodeT& node) const
{
return this->getNodeID(node) + DataType::mPFSum[NodeT::LEVEL];
}
@@ -3366,7 +3366,7 @@
}; // LeafNode class
template<typename ValueT, typename CoordT, template<uint32_t> class MaskT, uint32_t LOG2DIM>
-inline void LeafNode<ValueT, CoordT, MaskT, LOG2DIM>::updateBBox()
+inline __hostdev__ void LeafNode<ValueT, CoordT, MaskT, LOG2DIM>::updateBBox()
{
static_assert(LOG2DIM == 3, "LeafNode::updateBBox: only supports LOGDIM = 3!");
if (!this->isActive()) return;
Index: nanovdb/nanovdb/util/SampleFromVoxels.h
===================================================================
--- a/nanovdb/nanovdb/util/SampleFromVoxels.h (revision 62751)
+++ b/nanovdb/nanovdb/util/SampleFromVoxels.h (working copy)
@@ -22,7 +22,7 @@
#define NANOVDB_SAMPLE_FROM_VOXELS_H_HAS_BEEN_INCLUDED
// Only define __hostdev__ when compiling as NVIDIA CUDA
-#ifdef __CUDACC__
+#if defined(__CUDACC__) || defined(__HIP__)
#define __hostdev__ __host__ __device__
#else
#include <cmath> // for floor
@@ -136,7 +136,7 @@
template<typename TreeOrAccT>
template<typename Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const Vec3T& xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const Vec3T& xyz) const
{
const CoordT ijk = Round<CoordT>(xyz);
if (ijk != mPos) {
@@ -147,7 +147,7 @@
}
template<typename TreeOrAccT>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const CoordT& ijk) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const CoordT& ijk) const
{
if (ijk != mPos) {
mPos = ijk;
@@ -158,7 +158,7 @@
template<typename TreeOrAccT>
template<typename Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, false>::operator()(const Vec3T& xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, false>::operator()(const Vec3T& xyz) const
{
return mAcc.getValue(Round<CoordT>(xyz));
}
@@ -195,7 +195,7 @@
}; // TrilinearSamplerBase
template<typename TreeOrAccT>
-void TrilinearSampler<TreeOrAccT>::stencil(CoordT& ijk, ValueT (&v)[2][2][2]) const
+__hostdev__ void TrilinearSampler<TreeOrAccT>::stencil(CoordT& ijk, ValueT (&v)[2][2][2]) const
{
v[0][0][0] = mAcc.getValue(ijk); // i, j, k
@@ -224,7 +224,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType TrilinearSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
+__hostdev__ typename TreeOrAccT::ValueType TrilinearSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
{
#if 0
auto lerp = [](ValueT a, ValueT b, ValueT w){ return fma(w, b-a, a); };// = w*(b-a) + a
@@ -239,7 +239,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-Vec3T<typename TreeOrAccT::ValueType> TrilinearSampler<TreeOrAccT>::gradient(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
+__hostdev__ Vec3T<typename TreeOrAccT::ValueType> TrilinearSampler<TreeOrAccT>::gradient(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
{
static_assert(std::is_floating_point<ValueT>::value, "TrilinearSampler::gradient requires a floating-point type");
#if 0
@@ -270,7 +270,7 @@
}
template<typename TreeOrAccT>
-bool TrilinearSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[2][2][2])
+__hostdev__ bool TrilinearSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[2][2][2])
{
static_assert(std::is_floating_point<ValueT>::value, "TrilinearSampler::zeroCrossing requires a floating-point type");
const bool less = v[0][0][0] < ValueT(0);
@@ -363,7 +363,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(Vec3T<RealT> xyz) const
{
this->cache(xyz);
return BaseT::sample(xyz, mVal);
@@ -370,7 +370,7 @@
}
template<typename TreeOrAccT>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(const CoordT &ijk) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(const CoordT &ijk) const
{
return ijk == mPos ? mVal[0][0][0] : BaseT::mAcc.getValue(ijk);
}
@@ -377,7 +377,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, true>::gradient(Vec3T<RealT> xyz) const
+__hostdev__ Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, true>::gradient(Vec3T<RealT> xyz) const
{
this->cache(xyz);
return BaseT::gradient(xyz, mVal);
@@ -393,7 +393,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-void SampleFromVoxels<TreeOrAccT, 1, true>::cache(Vec3T<RealT>& xyz) const
+__hostdev__ void SampleFromVoxels<TreeOrAccT, 1, true>::cache(Vec3T<RealT>& xyz) const
{
CoordT ijk = Floor<CoordT>(xyz);
if (ijk != mPos) {
@@ -406,7 +406,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
{
ValueT val[2][2][2];
CoordT ijk = Floor<CoordT>(xyz);
@@ -418,7 +418,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
{
auto lerp = [](ValueT a, ValueT b, RealT w) { return a + ValueT(w) * (b - a); };
@@ -463,7 +463,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-inline Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, false>::gradient(Vec3T<RealT> xyz) const
+inline __hostdev__ Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, false>::gradient(Vec3T<RealT> xyz) const
{
ValueT val[2][2][2];
CoordT ijk = Floor<CoordT>(xyz);
@@ -473,7 +473,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-bool SampleFromVoxels<TreeOrAccT, 1, false>::zeroCrossing(Vec3T<RealT> xyz) const
+__hostdev__ bool SampleFromVoxels<TreeOrAccT, 1, false>::zeroCrossing(Vec3T<RealT> xyz) const
{
ValueT val[2][2][2];
CoordT ijk = Floor<CoordT>(xyz);
@@ -510,7 +510,7 @@
}; // TriquadraticSamplerBase
template<typename TreeOrAccT>
-void TriquadraticSampler<TreeOrAccT>::stencil(const CoordT &ijk, ValueT (&v)[3][3][3]) const
+__hostdev__ void TriquadraticSampler<TreeOrAccT>::stencil(const CoordT &ijk, ValueT (&v)[3][3][3]) const
{
CoordT p(ijk[0] - 1, 0, 0);
for (int dx = 0; dx < 3; ++dx, ++p[0]) {
@@ -526,7 +526,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType TriquadraticSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[3][3][3])
+__hostdev__ typename TreeOrAccT::ValueType TriquadraticSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[3][3][3])
{
auto kernel = [](const ValueT* value, double weight)->ValueT {
return weight * (weight * (0.5f * (value[0] + value[2]) - value[1]) +
@@ -545,7 +545,7 @@
}
template<typename TreeOrAccT>
-bool TriquadraticSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[3][3][3])
+__hostdev__ bool TriquadraticSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[3][3][3])
{
static_assert(std::is_floating_point<ValueT>::value, "TrilinearSampler::zeroCrossing requires a floating-point type");
const bool less = v[0][0][0] < ValueT(0);
@@ -624,7 +624,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(Vec3T<RealT> xyz) const
{
this->cache(xyz);
return BaseT::sample(xyz, mVal);
@@ -631,7 +631,7 @@
}
template<typename TreeOrAccT>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(const CoordT &ijk) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(const CoordT &ijk) const
{
return ijk == mPos ? mVal[1][1][1] : BaseT::mAcc.getValue(ijk);
}
@@ -646,7 +646,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-void SampleFromVoxels<TreeOrAccT, 2, true>::cache(Vec3T<RealT>& xyz) const
+__hostdev__ void SampleFromVoxels<TreeOrAccT, 2, true>::cache(Vec3T<RealT>& xyz) const
{
CoordT ijk = Floor<CoordT>(xyz);
if (ijk != mPos) {
@@ -657,7 +657,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, false>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, false>::operator()(Vec3T<RealT> xyz) const
{
ValueT val[3][3][3];
CoordT ijk = Floor<CoordT>(xyz);
@@ -667,7 +667,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-bool SampleFromVoxels<TreeOrAccT, 2, false>::zeroCrossing(Vec3T<RealT> xyz) const
+__hostdev__ bool SampleFromVoxels<TreeOrAccT, 2, false>::zeroCrossing(Vec3T<RealT> xyz) const
{
ValueT val[3][3][3];
CoordT ijk = Floor<CoordT>(xyz);
@@ -710,7 +710,7 @@
}; // TricubicSampler
template<typename TreeOrAccT>
-void TricubicSampler<TreeOrAccT>::stencil(const CoordT& ijk, ValueT (&C)[64]) const
+__hostdev__ void TricubicSampler<TreeOrAccT>::stencil(const CoordT& ijk, ValueT (&C)[64]) const
{
auto fetch = [&](int i, int j, int k) -> ValueT& { return C[((i + 1) << 4) + ((j + 1) << 2) + k + 1]; };
@@ -929,7 +929,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 3, true>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 3, true>::operator()(Vec3T<RealT> xyz) const
{
this->cache(xyz);
return BaseT::sample(xyz, mC);
@@ -937,7 +937,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-void SampleFromVoxels<TreeOrAccT, 3, true>::cache(Vec3T<RealT>& xyz) const
+__hostdev__ void SampleFromVoxels<TreeOrAccT, 3, true>::cache(Vec3T<RealT>& xyz) const
{
CoordT ijk = Floor<CoordT>(xyz);
if (ijk != mPos) {

View 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'])

View File

@@ -79,9 +79,6 @@ set STAGING=%BUILD_DIR%\S
rem for python module build rem for python module build
set MSSdk=1 set MSSdk=1
set DISTUTILS_USE_SDK=1 set DISTUTILS_USE_SDK=1
rem if you let pip pick its own build dirs, it'll stick it somewhere deep inside the user profile
rem and cython will refuse to link due to a path that gets too long.
set TMPDIR=c:\t\
rem for python externals source to be shared between the various archs and compilers rem for python externals source to be shared between the various archs and compilers
mkdir %BUILD_DIR%\downloads\externals mkdir %BUILD_DIR%\downloads\externals

View File

@@ -1,81 +0,0 @@
# - Find HIP compiler
#
# This module defines
# HIP_HIPCC_EXECUTABLE, the full path to the hipcc executable
# HIP_VERSION, the HIP compiler version
#
# HIP_FOUND, if the HIP toolkit is found.
#=============================================================================
# Copyright 2021 Blender Foundation.
#
# Distributed under the OSI-approved BSD 3-Clause License,
# see accompanying file BSD-3-Clause-license.txt for details.
#=============================================================================
# If HIP_ROOT_DIR was defined in the environment, use it.
if(NOT HIP_ROOT_DIR AND NOT $ENV{HIP_ROOT_DIR} STREQUAL "")
set(HIP_ROOT_DIR $ENV{HIP_ROOT_DIR})
endif()
set(_hip_SEARCH_DIRS
${HIP_ROOT_DIR}
)
find_program(HIP_HIPCC_EXECUTABLE
NAMES
hipcc
HINTS
${_hip_SEARCH_DIRS}
PATH_SUFFIXES
bin
)
if(HIP_HIPCC_EXECUTABLE AND NOT EXISTS ${HIP_HIPCC_EXECUTABLE})
message(WARNING "Cached or directly specified hipcc executable does not exist.")
set(HIP_FOUND FALSE)
elseif(HIP_HIPCC_EXECUTABLE)
set(HIP_FOUND TRUE)
set(HIP_VERSION_MAJOR 0)
set(HIP_VERSION_MINOR 0)
set(HIP_VERSION_PATCH 0)
# Get version from the output.
execute_process(COMMAND ${HIP_HIPCC_EXECUTABLE} --version
OUTPUT_VARIABLE HIP_VERSION_RAW
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
# Parse parts.
if(HIP_VERSION_RAW MATCHES "HIP version: .*")
# Strip the HIP prefix and get list of individual version components.
string(REGEX REPLACE
".*HIP version: ([.0-9]+).*" "\\1"
HIP_SEMANTIC_VERSION "${HIP_VERSION_RAW}")
string(REPLACE "." ";" HIP_VERSION_PARTS "${HIP_SEMANTIC_VERSION}")
list(LENGTH HIP_VERSION_PARTS NUM_HIP_VERSION_PARTS)
# Extract components into corresponding variables.
if(NUM_HIP_VERSION_PARTS GREATER 0)
list(GET HIP_VERSION_PARTS 0 HIP_VERSION_MAJOR)
endif()
if(NUM_HIP_VERSION_PARTS GREATER 1)
list(GET HIP_VERSION_PARTS 1 HIP_VERSION_MINOR)
endif()
if(NUM_HIP_VERSION_PARTS GREATER 2)
list(GET HIP_VERSION_PARTS 2 HIP_VERSION_PATCH)
endif()
# Unset temp variables.
unset(NUM_HIP_VERSION_PARTS)
unset(HIP_SEMANTIC_VERSION)
unset(HIP_VERSION_PARTS)
endif()
# Construct full semantic version.
set(HIP_VERSION "${HIP_VERSION_MAJOR}.${HIP_VERSION_MINOR}.${HIP_VERSION_PATCH}")
unset(HIP_VERSION_RAW)
else()
set(HIP_FOUND FALSE)
endif()

View File

@@ -33,23 +33,11 @@ FIND_PATH(OPTIX_INCLUDE_DIR
include include
) )
IF(EXISTS "${OPTIX_INCLUDE_DIR}/optix.h")
FILE(STRINGS "${OPTIX_INCLUDE_DIR}/optix.h" _optix_version REGEX "^#define OPTIX_VERSION[ \t].*$")
STRING(REGEX MATCHALL "[0-9]+" _optix_version ${_optix_version})
MATH(EXPR _optix_version_major "${_optix_version} / 10000")
MATH(EXPR _optix_version_minor "(${_optix_version} % 10000) / 100")
MATH(EXPR _optix_version_patch "${_optix_version} % 100")
SET(OPTIX_VERSION "${_optix_version_major}.${_optix_version_minor}.${_optix_version_patch}")
ENDIF()
# handle the QUIETLY and REQUIRED arguments and set OPTIX_FOUND to TRUE if # handle the QUIETLY and REQUIRED arguments and set OPTIX_FOUND to TRUE if
# all listed variables are TRUE # all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs) INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OptiX FIND_PACKAGE_HANDLE_STANDARD_ARGS(OptiX DEFAULT_MSG
REQUIRED_VARS OPTIX_INCLUDE_DIR OPTIX_INCLUDE_DIR)
VERSION_VAR OPTIX_VERSION)
IF(OPTIX_FOUND) IF(OPTIX_FOUND)
SET(OPTIX_INCLUDE_DIRS ${OPTIX_INCLUDE_DIR}) SET(OPTIX_INCLUDE_DIRS ${OPTIX_INCLUDE_DIR})
@@ -57,7 +45,6 @@ ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
OPTIX_INCLUDE_DIR OPTIX_INCLUDE_DIR
OPTIX_VERSION
) )
UNSET(_optix_SEARCH_DIRS) UNSET(_optix_SEARCH_DIRS)

View File

@@ -168,7 +168,7 @@ def function_parm_wash_tokens(parm):
# if tokens[-1].kind == To # if tokens[-1].kind == To
# remove trailing char # remove trailing char
if tokens[-1].kind == TokenKind.PUNCTUATION: if tokens[-1].kind == TokenKind.PUNCTUATION:
if tokens[-1].spelling in {",", ")", ";"}: if tokens[-1].spelling in (",", ")", ";"):
tokens.pop() tokens.pop()
# else: # else:
# print(tokens[-1].spelling) # print(tokens[-1].spelling)
@@ -179,7 +179,7 @@ def function_parm_wash_tokens(parm):
t_spelling = t.spelling t_spelling = t.spelling
ok = True ok = True
if t_kind == TokenKind.KEYWORD: if t_kind == TokenKind.KEYWORD:
if t_spelling in {"const", "restrict", "volatile"}: if t_spelling in ("const", "restrict", "volatile"):
ok = False ok = False
elif t_spelling.startswith("__"): elif t_spelling.startswith("__"):
ok = False # __restrict ok = False # __restrict

View File

@@ -24,7 +24,6 @@ import project_source_info
import subprocess import subprocess
import sys import sys
import os import os
import tempfile
from typing import ( from typing import (
Any, Any,
@@ -36,6 +35,7 @@ USE_QUIET = (os.environ.get("QUIET", None) is not None)
CHECKER_IGNORE_PREFIX = [ CHECKER_IGNORE_PREFIX = [
"extern", "extern",
"intern/moto",
] ]
CHECKER_BIN = "cppcheck" CHECKER_BIN = "cppcheck"
@@ -47,19 +47,13 @@ CHECKER_ARGS = [
"--max-configs=1", # speeds up execution "--max-configs=1", # speeds up execution
# "--check-config", # when includes are missing # "--check-config", # when includes are missing
"--enable=all", # if you want sixty hundred pedantic suggestions "--enable=all", # if you want sixty hundred pedantic suggestions
# Quiet output, otherwise all defines/includes are printed (overly verbose).
# Only enable this for troubleshooting (if defines are not set as expected for example).
"--quiet",
# NOTE: `--cppcheck-build-dir=<dir>` is added later as a temporary directory.
] ]
if USE_QUIET: if USE_QUIET:
CHECKER_ARGS.append("--quiet") CHECKER_ARGS.append("--quiet")
def cppcheck() -> None: def main() -> None:
source_info = project_source_info.build_info(ignore_prefix_list=CHECKER_IGNORE_PREFIX) source_info = project_source_info.build_info(ignore_prefix_list=CHECKER_IGNORE_PREFIX)
source_defines = project_source_info.build_defines_as_args() source_defines = project_source_info.build_defines_as_args()
@@ -84,10 +78,7 @@ def cppcheck() -> None:
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:" percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
sys.stdout.flush() sys.stdout.flush()
sys.stdout.write("%s %s\n" % ( sys.stdout.write("%s " % percent_str)
percent_str,
os.path.relpath(c, project_source_info.SOURCE_DIR)
))
return subprocess.Popen(cmd) return subprocess.Popen(cmd)
@@ -99,11 +90,5 @@ def cppcheck() -> None:
print("Finished!") print("Finished!")
def main() -> None:
with tempfile.TemporaryDirectory() as temp_dir:
CHECKER_ARGS.append("--cppcheck-build-dir=" + temp_dir)
cppcheck()
if __name__ == "__main__": if __name__ == "__main__":
main() main()

View File

@@ -9,7 +9,6 @@ set(WITH_INSTALL_PORTABLE ON CACHE BOOL "" FORCE)
set(WITH_ALEMBIC OFF CACHE BOOL "" FORCE) set(WITH_ALEMBIC OFF CACHE BOOL "" FORCE)
set(WITH_AUDASPACE OFF CACHE BOOL "" FORCE) set(WITH_AUDASPACE OFF CACHE BOOL "" FORCE)
set(WITH_BLENDER_THUMBNAILER OFF CACHE BOOL "" FORCE)
set(WITH_BOOST OFF CACHE BOOL "" FORCE) set(WITH_BOOST OFF CACHE BOOL "" FORCE)
set(WITH_BUILDINFO OFF CACHE BOOL "" FORCE) set(WITH_BUILDINFO OFF CACHE BOOL "" FORCE)
set(WITH_BULLET OFF CACHE BOOL "" FORCE) set(WITH_BULLET OFF CACHE BOOL "" FORCE)

View File

@@ -81,5 +81,4 @@ if(NOT APPLE)
set(WITH_CYCLES_DEVICE_OPTIX ON CACHE BOOL "" FORCE) set(WITH_CYCLES_DEVICE_OPTIX 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(WITH_CYCLES_HIP_BINARIES ON CACHE BOOL "" FORCE)
endif() endif()

View File

@@ -27,7 +27,7 @@ if(NOT MSVC)
endif() endif()
if(CMAKE_C_COMPILER_ID MATCHES "Clang") if(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(MSVC_CLANG ON) set(MSVC_CLANG On)
set(VC_TOOLS_DIR $ENV{VCToolsRedistDir} CACHE STRING "Location of the msvc redistributables") set(VC_TOOLS_DIR $ENV{VCToolsRedistDir} CACHE STRING "Location of the msvc redistributables")
set(MSVC_REDIST_DIR ${VC_TOOLS_DIR}) set(MSVC_REDIST_DIR ${VC_TOOLS_DIR})
if(DEFINED MSVC_REDIST_DIR) if(DEFINED MSVC_REDIST_DIR)
@@ -53,7 +53,7 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
endif() endif()
if(WITH_WINDOWS_STRIPPED_PDB) if(WITH_WINDOWS_STRIPPED_PDB)
message(WARNING "stripped pdb not supported with clang, disabling..") message(WARNING "stripped pdb not supported with clang, disabling..")
set(WITH_WINDOWS_STRIPPED_PDB OFF) set(WITH_WINDOWS_STRIPPED_PDB Off)
endif() endif()
endif() endif()
@@ -159,7 +159,7 @@ endif()
if(WITH_COMPILER_ASAN AND MSVC AND NOT MSVC_CLANG) if(WITH_COMPILER_ASAN AND MSVC AND NOT MSVC_CLANG)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.28.29828) if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.28.29828)
#set a flag so we don't have to do this comparison all the time #set a flag so we don't have to do this comparison all the time
SET(MSVC_ASAN ON) SET(MSVC_ASAN On)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fsanitize=address") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fsanitize=address")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fsanitize=address") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fsanitize=address")
string(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG " /INCREMENTAL:NO") string(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG " /INCREMENTAL:NO")
@@ -179,22 +179,22 @@ endif()
if(WITH_WINDOWS_SCCACHE AND CMAKE_VS_MSBUILD_COMMAND) if(WITH_WINDOWS_SCCACHE AND CMAKE_VS_MSBUILD_COMMAND)
message(WARNING "Disabling sccache, sccache is not supported with msbuild") message(WARNING "Disabling sccache, sccache is not supported with msbuild")
set(WITH_WINDOWS_SCCACHE OFF) set(WITH_WINDOWS_SCCACHE Off)
endif() endif()
# Debug Symbol format # Debug Symbol format
# sccache # MSVC_ASAN # format # why # sccache # MSVC_ASAN # format # why
# ON # ON # Z7 # sccache will only play nice with Z7 # On # On # Z7 # sccache will only play nice with Z7
# ON # OFF # Z7 # sccache will only play nice with Z7 # On # Off # Z7 # sccache will only play nice with Z7
# OFF # ON # Zi # Asan will not play nice with Edit and Continue # Off # On # Zi # Asan will not play nice with Edit and Continue
# OFF # OFF # ZI # Neither asan nor sscache is enabled Edit and Continue is available # Off # Off # ZI # Neither asan nor sscache is enabled Edit and Continue is available
# Release Symbol format # Release Symbol format
# sccache # MSVC_ASAN # format # why # sccache # MSVC_ASAN # format # why
# ON # ON # Z7 # sccache will only play nice with Z7 # On # On # Z7 # sccache will only play nice with Z7
# ON # OFF # Z7 # sccache will only play nice with Z7 # On # Off # Z7 # sccache will only play nice with Z7
# OFF # ON # Zi # Asan will not play nice with Edit and Continue # Off # On # Zi # Asan will not play nice with Edit and Continue
# OFF # OFF # Zi # Edit and Continue disables some optimizations # Off # Off # Zi # Edit and Continue disables some optimizations
if(WITH_WINDOWS_SCCACHE) if(WITH_WINDOWS_SCCACHE)
@@ -259,7 +259,7 @@ if(NOT DEFINED LIBDIR)
else() else()
message(FATAL_ERROR "32 bit compiler detected, blender no longer provides pre-build libraries for 32 bit windows, please set the LIBDIR cmake variable to your own library folder") message(FATAL_ERROR "32 bit compiler detected, blender no longer provides pre-build libraries for 32 bit windows, please set the LIBDIR cmake variable to your own library folder")
endif() endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.30.30423) if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.29.30130)
message(STATUS "Visual Studio 2022 detected.") message(STATUS "Visual Studio 2022 detected.")
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc15) set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc15)
elseif(MSVC_VERSION GREATER 1919) elseif(MSVC_VERSION GREATER 1919)
@@ -288,7 +288,7 @@ if(CMAKE_GENERATOR MATCHES "^Visual Studio.+" AND # Only supported in the VS IDE
"EnableMicrosoftCodeAnalysis=false" "EnableMicrosoftCodeAnalysis=false"
"EnableClangTidyCodeAnalysis=true" "EnableClangTidyCodeAnalysis=true"
) )
set(VS_CLANG_TIDY ON) set(VS_CLANG_TIDY On)
endif() endif()
# Mark libdir as system headers with a lower warn level, to resolve some warnings # Mark libdir as system headers with a lower warn level, to resolve some warnings
@@ -469,7 +469,7 @@ if(WITH_PYTHON)
set(PYTHON_INCLUDE_DIR ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/include) set(PYTHON_INCLUDE_DIR ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/include)
set(PYTHON_NUMPY_INCLUDE_DIRS ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/lib/site-packages/numpy/core/include) set(PYTHON_NUMPY_INCLUDE_DIRS ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/lib/site-packages/numpy/core/include)
set(NUMPY_FOUND ON) set(NUMPY_FOUND On)
unset(_PYTHON_VERSION_NO_DOTS) unset(_PYTHON_VERSION_NO_DOTS)
# uncached vars # uncached vars
set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}") set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
@@ -853,18 +853,18 @@ if(WITH_GMP)
set(GMP_INCLUDE_DIRS ${LIBDIR}/gmp/include) set(GMP_INCLUDE_DIRS ${LIBDIR}/gmp/include)
set(GMP_LIBRARIES ${LIBDIR}/gmp/lib/libgmp-10.lib optimized ${LIBDIR}/gmp/lib/libgmpxx.lib debug ${LIBDIR}/gmp/lib/libgmpxx_d.lib) set(GMP_LIBRARIES ${LIBDIR}/gmp/lib/libgmp-10.lib optimized ${LIBDIR}/gmp/lib/libgmpxx.lib debug ${LIBDIR}/gmp/lib/libgmpxx_d.lib)
set(GMP_ROOT_DIR ${LIBDIR}/gmp) set(GMP_ROOT_DIR ${LIBDIR}/gmp)
set(GMP_FOUND ON) set(GMP_FOUND On)
endif() endif()
if(WITH_POTRACE) if(WITH_POTRACE)
set(POTRACE_INCLUDE_DIRS ${LIBDIR}/potrace/include) set(POTRACE_INCLUDE_DIRS ${LIBDIR}/potrace/include)
set(POTRACE_LIBRARIES ${LIBDIR}/potrace/lib/potrace.lib) set(POTRACE_LIBRARIES ${LIBDIR}/potrace/lib/potrace.lib)
set(POTRACE_FOUND ON) set(POTRACE_FOUND On)
endif() endif()
if(WITH_HARU) if(WITH_HARU)
if(EXISTS ${LIBDIR}/haru) if(EXISTS ${LIBDIR}/haru)
set(HARU_FOUND ON) set(HARU_FOUND On)
set(HARU_ROOT_DIR ${LIBDIR}/haru) set(HARU_ROOT_DIR ${LIBDIR}/haru)
set(HARU_INCLUDE_DIRS ${HARU_ROOT_DIR}/include) set(HARU_INCLUDE_DIRS ${HARU_ROOT_DIR}/include)
set(HARU_LIBRARIES ${HARU_ROOT_DIR}/lib/libhpdfs.lib) set(HARU_LIBRARIES ${HARU_ROOT_DIR}/lib/libhpdfs.lib)

View File

@@ -243,9 +243,7 @@ def build_defines_as_args() -> List[str]:
# use this module. # use this module.
def queue_processes( def queue_processes(
process_funcs: Sequence[Tuple[Callable[..., subprocess.Popen[Any]], Tuple[Any, ...]]], process_funcs: Sequence[Tuple[Callable[..., subprocess.Popen[Any]], Tuple[Any, ...]]],
*,
job_total: int =-1, job_total: int =-1,
sleep: float = 0.1,
) -> None: ) -> None:
""" Takes a list of function arg pairs, each function must return a process """ Takes a list of function arg pairs, each function must return a process
""" """
@@ -273,20 +271,14 @@ def queue_processes(
if len(processes) <= job_total: if len(processes) <= job_total:
break break
time.sleep(sleep) else:
time.sleep(0.1)
sys.stdout.flush() sys.stdout.flush()
sys.stderr.flush() sys.stderr.flush()
processes.append(func(*args)) processes.append(func(*args))
# Don't return until all jobs have finished.
while 1:
processes[:] = [p for p in processes if p.poll() is None]
if not processes:
break
time.sleep(sleep)
def main() -> None: def main() -> None:
if not os.path.exists(join(CMAKE_DIR, "CMakeCache.txt")): if not os.path.exists(join(CMAKE_DIR, "CMakeCache.txt")):

View File

@@ -5,38 +5,38 @@
update-code: update-code:
git: git:
submodules: submodules:
- branch: blender-v3.0-release - branch: master
commit_id: HEAD commit_id: HEAD
path: release/scripts/addons path: release/scripts/addons
- branch: blender-v3.0-release - branch: master
commit_id: HEAD commit_id: HEAD
path: release/scripts/addons_contrib path: release/scripts/addons_contrib
- branch: blender-v3.0-release - branch: master
commit_id: HEAD commit_id: HEAD
path: release/datafiles/locale path: release/datafiles/locale
- branch: blender-v3.0-release - branch: master
commit_id: HEAD commit_id: HEAD
path: source/tools path: source/tools
svn: svn:
libraries: libraries:
darwin-arm64: darwin-arm64:
branch: tags/blender-3.0-release branch: trunk
commit_id: HEAD commit_id: HEAD
path: lib/darwin_arm64 path: lib/darwin_arm64
darwin-x86_64: darwin-x86_64:
branch: tags/blender-3.0-release branch: trunk
commit_id: HEAD commit_id: HEAD
path: lib/darwin path: lib/darwin
linux-x86_64: linux-x86_64:
branch: tags/blender-3.0-release branch: trunk
commit_id: HEAD commit_id: HEAD
path: lib/linux_centos7_x86_64 path: lib/linux_centos7_x86_64
windows-amd64: windows-amd64:
branch: tags/blender-3.0-release branch: trunk
commit_id: HEAD commit_id: HEAD
path: lib/win64_vc15 path: lib/win64_vc15
tests: tests:
branch: tags/blender-3.0-release branch: trunk
commit_id: HEAD commit_id: HEAD
path: lib/tests path: lib/tests
benchmarks: benchmarks:
@@ -55,7 +55,7 @@ buildbot:
cuda11: cuda11:
version: '11.4.1' version: '11.4.1'
optix: optix:
version: '7.3.0' version: '7.1.0'
cmake: cmake:
default: default:
version: any version: any

View File

@@ -200,20 +200,15 @@ def submodules_update(args, release_version, branch):
if msg: if msg:
skip_msg += submodule_path + " skipped: " + msg + "\n" skip_msg += submodule_path + " skipped: " + msg + "\n"
else: else:
# Find a matching branch that exists. if make_utils.git_branch(args.git_command) != submodule_branch:
call([args.git_command, "fetch", "origin"]) call([args.git_command, "fetch", "origin"])
if make_utils.git_branch_exists(args.git_command, submodule_branch): call([args.git_command, "checkout", submodule_branch])
pass call([args.git_command, "pull", "--rebase", "origin", submodule_branch])
elif make_utils.git_branch_exists(args.git_command, submodule_branch_fallback): # If we cannot find the specified branch for this submodule, fallback to default one (aka master).
submodule_branch = submodule_branch_fallback if make_utils.git_branch(args.git_command) != submodule_branch:
else: call([args.git_command, "fetch", "origin"])
submodule_branch = None call([args.git_command, "checkout", submodule_branch_fallback])
call([args.git_command, "pull", "--rebase", "origin", submodule_branch_fallback])
# Switch to branch and pull.
if submodule_branch:
if make_utils.git_branch(args.git_command) != submodule_branch:
call([args.git_command, "checkout", submodule_branch])
call([args.git_command, "pull", "--rebase", "origin", submodule_branch])
finally: finally:
os.chdir(cwd) os.chdir(cwd)
@@ -227,10 +222,6 @@ 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)
if branch == 'HEAD':
sys.stderr.write('Blender git repository is in detached HEAD state, must be in a branch\n')
sys.exit(1)
tag = make_utils.git_tag(args.git_command) tag = make_utils.git_tag(args.git_command)
release_version = make_utils.git_branch_release_version(branch, tag) release_version = make_utils.git_branch_release_version(branch, tag)

View File

@@ -8,19 +8,14 @@ import subprocess
import sys import sys
def call(cmd, exit_on_error=True, silent=False): def call(cmd, exit_on_error=True):
if not silent: print(" ".join(cmd))
print(" ".join(cmd))
# Flush to ensure correct order output on Windows. # Flush to ensure correct order output on Windows.
sys.stdout.flush() sys.stdout.flush()
sys.stderr.flush() sys.stderr.flush()
if silent: retcode = subprocess.call(cmd)
retcode = subprocess.call(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
else:
retcode = subprocess.call(cmd)
if exit_on_error and retcode != 0: if exit_on_error and retcode != 0:
sys.exit(retcode) sys.exit(retcode)
return retcode return retcode
@@ -43,11 +38,6 @@ def check_output(cmd, exit_on_error=True):
return output.strip() return output.strip()
def git_branch_exists(git_command, branch):
return call([git_command, "rev-parse", "--verify", branch], exit_on_error=False, silent=True) == 0 or \
call([git_command, "rev-parse", "--verify", "remotes/origin/" + branch], exit_on_error=False, silent=True) == 0
def git_branch(git_command): def git_branch(git_command):
# Get current branch name. # Get current branch name.
try: try:
@@ -80,7 +70,7 @@ def git_branch_release_version(branch, tag):
return release_version return release_version
def svn_libraries_base_url(release_version, branch=None): def svn_libraries_base_url(release_version, branch):
if release_version: if release_version:
svn_branch = "tags/blender-" + release_version + "-release" svn_branch = "tags/blender-" + release_version + "-release"
elif branch: elif branch:

View File

@@ -3,7 +3,7 @@ for %%X in (svn.exe) do (set SVN=%%~$PATH:X)
for %%X in (cmake.exe) do (set CMAKE=%%~$PATH:X) for %%X in (cmake.exe) do (set CMAKE=%%~$PATH:X)
for %%X in (ctest.exe) do (set CTEST=%%~$PATH:X) for %%X in (ctest.exe) do (set CTEST=%%~$PATH:X)
for %%X in (git.exe) do (set GIT=%%~$PATH:X) for %%X in (git.exe) do (set GIT=%%~$PATH:X)
set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\39\bin\python.exe set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\37\bin\python.exe
if NOT "%verbose%" == "" ( if NOT "%verbose%" == "" (
echo svn : "%SVN%" echo svn : "%SVN%"
echo cmake : "%CMAKE%" echo cmake : "%CMAKE%"

View File

@@ -10,7 +10,7 @@ exit /b 1
echo found clang-format in %CF_PATH% echo found clang-format in %CF_PATH%
if EXIST %PYTHON% ( if EXIST %PYTHON% (
set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\39\bin\python.exe set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\37\bin\python.exe
goto detect_python_done goto detect_python_done
) )

View File

@@ -116,9 +116,6 @@ if NOT "%1" == "" (
) else if "%1" == "doc_py" ( ) else if "%1" == "doc_py" (
set DOC_PY=1 set DOC_PY=1
goto EOF goto EOF
) else if "%1" == "svnfix" (
set SVN_FIX=1
goto EOF
) else ( ) else (
echo Command "%1" unknown, aborting! echo Command "%1" unknown, aborting!
goto ERR goto ERR

View File

@@ -1,26 +0,0 @@
if "%BUILD_VS_YEAR%"=="2017" set BUILD_VS_LIBDIRPOST=vc15
if "%BUILD_VS_YEAR%"=="2019" set BUILD_VS_LIBDIRPOST=vc15
if "%BUILD_VS_YEAR%"=="2022" set BUILD_VS_LIBDIRPOST=vc15
set BUILD_VS_SVNDIR=win64_%BUILD_VS_LIBDIRPOST%
set BUILD_VS_LIBDIR="%BLENDER_DIR%..\lib\%BUILD_VS_SVNDIR%"
echo Starting cleanup in %BUILD_VS_LIBDIR%.
cd %BUILD_VS_LIBDIR%
:RETRY
"%SVN%" cleanup
"%SVN%" update
if errorlevel 1 (
set /p LibRetry= "Error during update, retry? y/n"
if /I "!LibRetry!"=="Y" (
goto RETRY
)
echo.
echo Error: Download of external libraries failed.
echo This is needed for building, please manually run 'svn cleanup' and 'svn update' in
echo %BUILD_VS_LIBDIR% , until this is resolved you CANNOT make a successful blender build
echo.
exit /b 1
)
echo Cleanup complete

View File

@@ -14,7 +14,7 @@ sound = aud.Sound('music.ogg')
# play the audio, this return a handle to control play/pause # play the audio, this return a handle to control play/pause
handle = device.play(sound) handle = device.play(sound)
# if the audio is not too big and will be used often you can buffer it # if the audio is not too big and will be used often you can buffer it
sound_buffered = aud.Sound.cache(sound) sound_buffered = aud.Sound.buffer(sound)
handle_buffered = device.play(sound_buffered) handle_buffered = device.play(sound_buffered)
# stop the sounds (otherwise they play until their ends) # stop the sounds (otherwise they play until their ends)

View File

@@ -1,40 +0,0 @@
"""
This method enables conversions between Local and Pose space for bones in
the middle of updating the armature without having to update dependencies
after each change, by manually carrying updated matrices in a recursive walk.
"""
def set_pose_matrices(obj, matrix_map):
"Assign pose space matrices of all bones at once, ignoring constraints."
def rec(pbone, parent_matrix):
matrix = matrix_map[pbone.name]
## Instead of:
# pbone.matrix = matrix
# bpy.context.view_layer.update()
# Compute and assign local matrix, using the new parent matrix
if pbone.parent:
pbone.matrix_basis = pbone.bone.convert_local_to_pose(
matrix,
pbone.bone.matrix_local,
parent_matrix=parent_matrix,
parent_matrix_local=pbone.parent.bone.matrix_local,
invert=True
)
else:
pbone.matrix_basis = pbone.bone.convert_local_to_pose(
matrix,
pbone.bone.matrix_local,
invert=True
)
# Recursively process children, passing the new matrix through
for child in pbone.children:
rec(child, matrix)
# Scan all bone trees from their roots
for pbone in obj.pose.bones:
if not pbone.parent:
rec(pbone, None)

View File

@@ -42,13 +42,8 @@ class SimpleMouseOperator(bpy.types.Operator):
self.y = event.mouse_y self.y = event.mouse_y
return self.execute(context) return self.execute(context)
# Only needed if you want to add into a dynamic menu
def menu_func(self, context):
self.layout.operator(SimpleMouseOperator.bl_idname, text="Simple Mouse Operator")
# Register and add to the view menu (required to also use F3 search "Simple Mouse Operator" for quick access)
bpy.utils.register_class(SimpleMouseOperator) bpy.utils.register_class(SimpleMouseOperator)
bpy.types.VIEW3D_MT_view.append(menu_func)
# Test call to the newly defined operator. # Test call to the newly defined operator.
# Here we call the operator and invoke it, meaning that the settings are taken # Here we call the operator and invoke it, meaning that the settings are taken

View File

@@ -43,7 +43,7 @@ def menu_func(self, context):
self.layout.operator(ExportSomeData.bl_idname, text="Text Export Operator") self.layout.operator(ExportSomeData.bl_idname, text="Text Export Operator")
# Register and add to the file selector (required to also use F3 search "Text Export Operator" for quick access) # Register and add to the file selector
bpy.utils.register_class(ExportSomeData) bpy.utils.register_class(ExportSomeData)
bpy.types.TOPBAR_MT_file_export.append(menu_func) bpy.types.TOPBAR_MT_file_export.append(menu_func)

View File

@@ -27,14 +27,8 @@ class DialogOperator(bpy.types.Operator):
wm = context.window_manager wm = context.window_manager
return wm.invoke_props_dialog(self) return wm.invoke_props_dialog(self)
# Only needed if you want to add into a dynamic menu
def menu_func(self, context):
self.layout.operator(DialogOperator.bl_idname, text="Dialog Operator")
# Register and add to the object menu (required to also use F3 search "Dialog Operator" for quick access)
bpy.utils.register_class(DialogOperator) bpy.utils.register_class(DialogOperator)
bpy.types.VIEW3D_MT_object.append(menu_func)
# Test call. # Test call.
bpy.ops.object.dialog_operator('INVOKE_DEFAULT') bpy.ops.object.dialog_operator('INVOKE_DEFAULT')

View File

@@ -41,13 +41,8 @@ class CustomDrawOperator(bpy.types.Operator):
col.prop(self, "my_string") col.prop(self, "my_string")
# Only needed if you want to add into a dynamic menu
def menu_func(self, context):
self.layout.operator(CustomDrawOperator.bl_idname, text="Custom Draw Operator")
# Register and add to the object menu (required to also use F3 search "Custom Draw Operator" for quick access)
bpy.utils.register_class(CustomDrawOperator) bpy.utils.register_class(CustomDrawOperator)
bpy.types.VIEW3D_MT_object.append(menu_func)
# test call # test call
bpy.ops.object.custom_draw('INVOKE_DEFAULT') bpy.ops.object.custom_draw('INVOKE_DEFAULT')

View File

@@ -55,13 +55,8 @@ class ModalOperator(bpy.types.Operator):
context.window_manager.modal_handler_add(self) context.window_manager.modal_handler_add(self)
return {'RUNNING_MODAL'} return {'RUNNING_MODAL'}
# Only needed if you want to add into a dynamic menu
def menu_func(self, context):
self.layout.operator(ModalOperator.bl_idname, text="Modal Operator")
# Register and add to the object menu (required to also use F3 search "Modal Operator" for quick access)
bpy.utils.register_class(ModalOperator) bpy.utils.register_class(ModalOperator)
bpy.types.VIEW3D_MT_object.append(menu_func)
# test call # test call
bpy.ops.object.modal_operator('INVOKE_DEFAULT') bpy.ops.object.modal_operator('INVOKE_DEFAULT')

View File

@@ -31,13 +31,8 @@ class SearchEnumOperator(bpy.types.Operator):
context.window_manager.invoke_search_popup(self) context.window_manager.invoke_search_popup(self)
return {'RUNNING_MODAL'} return {'RUNNING_MODAL'}
# Only needed if you want to add into a dynamic menu
def menu_func(self, context):
self.layout.operator(SearchEnumOperator.bl_idname, text="Search Enum Operator")
# Register and add to the object menu (required to also use F3 search "Search Enum Operator" for quick access)
bpy.utils.register_class(SearchEnumOperator) bpy.utils.register_class(SearchEnumOperator)
bpy.types.VIEW3D_MT_object.append(menu_func)
# test call # test call
bpy.ops.object.search_enum_operator('INVOKE_DEFAULT') bpy.ops.object.search_enum_operator('INVOKE_DEFAULT')

View File

@@ -22,13 +22,8 @@ class HelloWorldOperator(bpy.types.Operator):
print("Hello World") print("Hello World")
return {'FINISHED'} return {'FINISHED'}
# Only needed if you want to add into a dynamic menu
def menu_func(self, context):
self.layout.operator(HelloWorldOperator.bl_idname, text="Hello World Operator")
# Register and add to the view menu (required to also use F3 search "Hello World Operator" for quick access)
bpy.utils.register_class(HelloWorldOperator) bpy.utils.register_class(HelloWorldOperator)
bpy.types.VIEW3D_MT_view.append(menu_func)
# test call to the newly defined operator # test call to the newly defined operator
bpy.ops.wm.hello_world() bpy.ops.wm.hello_world()

View File

@@ -32,7 +32,7 @@ def draw():
context.region, context.region,
view_matrix, view_matrix,
projection_matrix, projection_matrix,
do_color_management=True) True)
gpu.state.depth_mask_set(False) gpu.state.depth_mask_set(False)
draw_texture_2d(offscreen.texture_color, (10, 10), WIDTH, HEIGHT) draw_texture_2d(offscreen.texture_color, (10, 10), WIDTH, HEIGHT)

View File

@@ -10,4 +10,4 @@ requests==2.26.0
# Only needed to match the theme used for the official documentation. # Only needed to match the theme used for the official documentation.
# Without this theme, the default theme will be used. # Without this theme, the default theme will be used.
sphinx_rtd_theme==1.0.0 sphinx_rtd_theme==1.0.0rc1

View File

@@ -106,6 +106,24 @@ including advanced features.
floating-point values. These values are interpreted as a plane equation. floating-point values. These values are interpreted as a plane equation.
.. function:: glColor (red, green, blue, alpha):
B{glColor3b, glColor3d, glColor3f, glColor3i, glColor3s, glColor3ub, glColor3ui, glColor3us,
glColor4b, glColor4d, glColor4f, glColor4i, glColor4s, glColor4ub, glColor4ui, glColor4us,
glColor3bv, glColor3dv, glColor3fv, glColor3iv, glColor3sv, glColor3ubv, glColor3uiv,
glColor3usv, glColor4bv, glColor4dv, glColor4fv, glColor4iv, glColor4sv, glColor4ubv,
glColor4uiv, glColor4usv}
Set a new color.
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glColor.xhtml>`__
:type red, green, blue, alpha: Depends on function prototype.
:arg red, green, blue: Specify new red, green, and blue values for the current color.
:arg alpha: Specifies a new alpha value for the current color. Included only in the
four-argument glColor4 commands. (With '4' colors only)
.. function:: glColorMask(red, green, blue, alpha): .. function:: glColorMask(red, green, blue, alpha):
Enable and disable writing of frame buffer color components Enable and disable writing of frame buffer color components

View File

@@ -1101,18 +1101,14 @@ context_type_map = {
"scene": ("Scene", False), "scene": ("Scene", False),
"sculpt_object": ("Object", False), "sculpt_object": ("Object", False),
"selectable_objects": ("Object", True), "selectable_objects": ("Object", True),
"selected_asset_files": ("FileSelectEntry", True),
"selected_bones": ("EditBone", True), "selected_bones": ("EditBone", True),
"selected_editable_bones": ("EditBone", True), "selected_editable_bones": ("EditBone", True),
"selected_editable_fcurves": ("FCurve", True), "selected_editable_fcurves": ("FCurve", True),
"selected_editable_keyframes": ("Keyframe", True), "selected_editable_keyframes": ("Keyframe", True),
"selected_editable_objects": ("Object", True), "selected_editable_objects": ("Object", True),
"selected_editable_sequences": ("Sequence", True), "selected_editable_sequences": ("Sequence", True),
"selected_ids": ("ID", True),
"selected_files": ("FileSelectEntry", True), "selected_files": ("FileSelectEntry", True),
"selected_ids": ("ID", True),
"selected_nla_strips": ("NlaStrip", True), "selected_nla_strips": ("NlaStrip", True),
"selected_movieclip_tracks": ("MovieTrackingTrack", True),
"selected_nodes": ("Node", True), "selected_nodes": ("Node", True),
"selected_objects": ("Object", True), "selected_objects": ("Object", True),
"selected_pose_bones": ("PoseBone", True), "selected_pose_bones": ("PoseBone", True),
@@ -1123,7 +1119,7 @@ context_type_map = {
"soft_body": ("SoftBodyModifier", False), "soft_body": ("SoftBodyModifier", False),
"speaker": ("Speaker", False), "speaker": ("Speaker", False),
"texture": ("Texture", False), "texture": ("Texture", False),
"texture_slot": ("TextureSlot", False), "texture_slot": ("MaterialTextureSlot", False),
"texture_user": ("ID", False), "texture_user": ("ID", False),
"texture_user_property": ("Property", False), "texture_user_property": ("Property", False),
"ui_list": ("UIList", False), "ui_list": ("UIList", False),

View File

@@ -67,12 +67,9 @@ endif()
if(WITH_CYCLES OR WITH_COMPOSITOR OR WITH_OPENSUBDIV) if(WITH_CYCLES OR WITH_COMPOSITOR OR WITH_OPENSUBDIV)
add_subdirectory(clew) add_subdirectory(clew)
if((WITH_CYCLES_DEVICE_CUDA OR WITH_CYCLES_DEVICE_OPTIX) AND WITH_CUDA_DYNLOAD) if(WITH_CUDA_DYNLOAD)
add_subdirectory(cuew) add_subdirectory(cuew)
endif() endif()
if(WITH_CYCLES_DEVICE_HIP AND WITH_HIP_DYNLOAD)
add_subdirectory(hipew)
endif()
endif() endif()
if(WITH_GHOST_X11 AND WITH_GHOST_XDND) if(WITH_GHOST_X11 AND WITH_GHOST_XDND)

View File

@@ -129,7 +129,6 @@ set(SRC
src/util/Barrier.cpp src/util/Barrier.cpp
src/util/Buffer.cpp src/util/Buffer.cpp
src/util/BufferReader.cpp src/util/BufferReader.cpp
src/util/RingBuffer.cpp
src/util/StreamBuffer.cpp src/util/StreamBuffer.cpp
src/util/ThreadPool.cpp src/util/ThreadPool.cpp
) )
@@ -153,7 +152,6 @@ set(PUBLIC_HDR
include/devices/ThreadedDevice.h include/devices/ThreadedDevice.h
include/Exception.h include/Exception.h
include/file/File.h include/file/File.h
include/file/FileInfo.h
include/file/FileManager.h include/file/FileManager.h
include/file/FileWriter.h include/file/FileWriter.h
include/file/IFileInput.h include/file/IFileInput.h
@@ -246,7 +244,6 @@ set(PUBLIC_HDR
include/util/BufferReader.h include/util/BufferReader.h
include/util/ILockable.h include/util/ILockable.h
include/util/Math3D.h include/util/Math3D.h
include/util/RingBuffer.h
include/util/StreamBuffer.h include/util/StreamBuffer.h
include/util/ThreadPool.h include/util/ThreadPool.h
) )
@@ -963,10 +960,7 @@ endif()
if(BUILD_DEMOS) if(BUILD_DEMOS)
include_directories(${INCLUDE}) include_directories(${INCLUDE})
set(DEMOS audainfo audaplay audaconvert audaremap signalgen randsounds dynamicmusic playbackmanager) set(DEMOS audaplay audaconvert audaremap signalgen randsounds dynamicmusic playbackmanager)
add_executable(audainfo demos/audainfo.cpp)
target_link_libraries(audainfo audaspace)
add_executable(audaplay demos/audaplay.cpp) add_executable(audaplay demos/audaplay.cpp)
target_link_libraries(audaplay audaspace) target_link_libraries(audaplay audaspace)

View File

@@ -39,7 +39,7 @@ extern AUD_API void AUD_PlaybackManager_free(AUD_PlaybackManager* manager);
* Plays a sound through the playback manager, adding it into a category. * Plays a sound through the playback manager, adding it into a category.
* \param manager The PlaybackManager object. * \param manager The PlaybackManager object.
* \param sound The sound to be played. * \param sound The sound to be played.
* \param catKey The key of the category into which the sound will be added. If it doesn't exist a new one will be created. * \param catKey The key of the category into which the sound will be added. If it doesn't exist a new one will be creatd.
*/ */
extern AUD_API void AUD_PlaybackManager_play(AUD_PlaybackManager* manager, AUD_Sound* sound, unsigned int catKey); extern AUD_API void AUD_PlaybackManager_play(AUD_PlaybackManager* manager, AUD_Sound* sound, unsigned int catKey);

View File

@@ -94,40 +94,6 @@ AUD_API int AUD_Sound_getLength(AUD_Sound* sound)
return (*sound)->createReader()->getLength(); return (*sound)->createReader()->getLength();
} }
AUD_API int AUD_Sound_getFileStreams(AUD_Sound* sound, AUD_StreamInfo **stream_infos)
{
assert(sound);
std::shared_ptr<File> file = std::dynamic_pointer_cast<File>(*sound);
if(file)
{
try
{
auto streams = file->queryStreams();
size_t size = sizeof(AUD_StreamInfo) * streams.size();
if(!size)
{
*stream_infos = nullptr;
return 0;
}
*stream_infos = reinterpret_cast<AUD_StreamInfo*>(std::malloc(size));
std::memcpy(*stream_infos, streams.data(), size);
return streams.size();
}
catch(Exception&)
{
}
}
*stream_infos = nullptr;
return 0;
}
AUD_API sample_t* AUD_Sound_data(AUD_Sound* sound, int* length, AUD_Specs* specs) AUD_API sample_t* AUD_Sound_data(AUD_Sound* sound, int* length, AUD_Specs* specs)
{ {
assert(sound); assert(sound);
@@ -286,12 +252,6 @@ AUD_API AUD_Sound* AUD_Sound_bufferFile(unsigned char* buffer, int size)
return new AUD_Sound(new File(buffer, size)); return new AUD_Sound(new File(buffer, size));
} }
AUD_API AUD_Sound* AUD_Sound_bufferFileStream(unsigned char* buffer, int size, int stream)
{
assert(buffer);
return new AUD_Sound(new File(buffer, size, stream));
}
AUD_API AUD_Sound* AUD_Sound_cache(AUD_Sound* sound) AUD_API AUD_Sound* AUD_Sound_cache(AUD_Sound* sound)
{ {
assert(sound); assert(sound);
@@ -312,12 +272,6 @@ AUD_API AUD_Sound* AUD_Sound_file(const char* filename)
return new AUD_Sound(new File(filename)); return new AUD_Sound(new File(filename));
} }
AUD_API AUD_Sound* AUD_Sound_fileStream(const char* filename, int stream)
{
assert(filename);
return new AUD_Sound(new File(filename, stream));
}
AUD_API AUD_Sound* AUD_Sound_sawtooth(float frequency, AUD_SampleRate rate) AUD_API AUD_Sound* AUD_Sound_sawtooth(float frequency, AUD_SampleRate rate)
{ {
return new AUD_Sound(new Sawtooth(frequency, rate)); return new AUD_Sound(new Sawtooth(frequency, rate));

View File

@@ -36,15 +36,7 @@ extern AUD_API AUD_Specs AUD_Sound_getSpecs(AUD_Sound* sound);
* \return The length of the sound in samples. * \return The length of the sound in samples.
* \note This function creates a reader from the sound and deletes it again. * \note This function creates a reader from the sound and deletes it again.
*/ */
extern AUD_API int AUD_Sound_getLength(AUD_Sound* sound); extern AUD_API int AUD_getLength(AUD_Sound* sound);
/**
* Retrieves the stream infos of a sound file.
* \param sound The sound to retrieve from which must be a file sound.
* \param infos A pointer to a AUD_StreamInfo array that will be allocated and must afterwards be freed by the caller.
* \return The number of items in the infos array.
*/
extern AUD_API int AUD_Sound_getFileStreams(AUD_Sound* sound, AUD_StreamInfo** stream_infos);
/** /**
* Reads a sound's samples into memory. * Reads a sound's samples into memory.
@@ -97,15 +89,6 @@ extern AUD_API AUD_Sound* AUD_Sound_buffer(sample_t* data, int length, AUD_Specs
*/ */
extern AUD_API AUD_Sound* AUD_Sound_bufferFile(unsigned char* buffer, int size); extern AUD_API AUD_Sound* AUD_Sound_bufferFile(unsigned char* buffer, int size);
/**
* Loads a sound file from a memory buffer.
* \param buffer The buffer which contains the sound file.
* \param size The size of the buffer.
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
* \return A handle of the sound file.
*/
extern AUD_API AUD_Sound* AUD_Sound_bufferFileStream(unsigned char* buffer, int size, int stream);
/** /**
* Caches a sound into a memory buffer. * Caches a sound into a memory buffer.
* \param sound The sound to cache. * \param sound The sound to cache.
@@ -120,14 +103,6 @@ extern AUD_API AUD_Sound* AUD_Sound_cache(AUD_Sound* sound);
*/ */
extern AUD_API AUD_Sound* AUD_Sound_file(const char* filename); extern AUD_API AUD_Sound* AUD_Sound_file(const char* filename);
/**
* Loads a sound file.
* \param filename The filename of the sound file.
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
* \return A handle of the sound file.
*/
extern AUD_API AUD_Sound* AUD_Sound_fileStream(const char* filename, int stream);
/** /**
* Creates a sawtooth sound. * Creates a sawtooth sound.
* \param frequency The frequency of the generated sawtooth sound. * \param frequency The frequency of the generated sawtooth sound.

View File

@@ -86,6 +86,7 @@ AUD_API AUD_SoundInfo AUD_getInfo(AUD_Sound* sound)
info.specs.channels = AUD_CHANNELS_INVALID; info.specs.channels = AUD_CHANNELS_INVALID;
info.specs.rate = AUD_RATE_INVALID; info.specs.rate = AUD_RATE_INVALID;
info.length = 0.0f; info.length = 0.0f;
info.start_offset = 0.0f;
try try
{ {
@@ -95,6 +96,7 @@ AUD_API AUD_SoundInfo AUD_getInfo(AUD_Sound* sound)
{ {
info.specs = convSpecToC(reader->getSpecs()); info.specs = convSpecToC(reader->getSpecs());
info.length = reader->getLength() / (float) info.specs.rate; info.length = reader->getLength() / (float) info.specs.rate;
info.start_offset = reader->getStartOffset();
} }
} }
catch(Exception&) catch(Exception&)
@@ -107,7 +109,7 @@ AUD_API AUD_SoundInfo AUD_getInfo(AUD_Sound* sound)
AUD_API float* AUD_readSoundBuffer(const char* filename, float low, float high, AUD_API float* AUD_readSoundBuffer(const char* filename, float low, float high,
float attack, float release, float threshold, float attack, float release, float threshold,
int accumulate, int additive, int square, int accumulate, int additive, int square,
float sthreshold, double samplerate, int* length, int stream) float sthreshold, double samplerate, int* length)
{ {
Buffer buffer; Buffer buffer;
DeviceSpecs specs; DeviceSpecs specs;
@@ -115,7 +117,7 @@ AUD_API float* AUD_readSoundBuffer(const char* filename, float low, float high,
specs.rate = (SampleRate)samplerate; specs.rate = (SampleRate)samplerate;
std::shared_ptr<ISound> sound; std::shared_ptr<ISound> sound;
std::shared_ptr<ISound> file = std::shared_ptr<ISound>(new File(filename, stream)); std::shared_ptr<ISound> file = std::shared_ptr<ISound>(new File(filename));
int position = 0; int position = 0;
@@ -245,7 +247,7 @@ AUD_API int AUD_readSound(AUD_Sound* sound, float* buffer, int length, int sampl
buffer[i * 3] = min; buffer[i * 3] = min;
buffer[i * 3 + 1] = max; buffer[i * 3 + 1] = max;
buffer[i * 3 + 2] = std::sqrt(power / len); buffer[i * 3 + 2] = sqrt(power / len); // RMS
if(overallmax < max) if(overallmax < max)
overallmax = max; overallmax = max;

View File

@@ -37,7 +37,7 @@ extern AUD_API float* AUD_readSoundBuffer(const char* filename, float low, float
float attack, float release, float threshold, float attack, float release, float threshold,
int accumulate, int additive, int square, int accumulate, int additive, int square,
float sthreshold, double samplerate, float sthreshold, double samplerate,
int* length, int stream); int* length);
/** /**
* Pauses a playing sound after a specific amount of time. * Pauses a playing sound after a specific amount of time.

View File

@@ -176,17 +176,5 @@ typedef struct
{ {
AUD_Specs specs; AUD_Specs specs;
float length; float length;
double start_offset;
} AUD_SoundInfo; } AUD_SoundInfo;
/// Specification of a sound source.
typedef struct
{
/// Start time in seconds.
double start;
/// Duration in seconds. May be estimated or 0 if unknown.
double duration;
/// Audio data parameters.
AUD_DeviceSpecs specs;
} AUD_StreamInfo;

View File

@@ -89,11 +89,10 @@ Sound_new(PyTypeObject* type, PyObject* args, PyObject* kwds)
self = (Sound*)type->tp_alloc(type, 0); self = (Sound*)type->tp_alloc(type, 0);
if(self != nullptr) if(self != nullptr)
{ {
static const char* kwlist[] = {"filename", "stream", nullptr}; static const char* kwlist[] = {"filename", nullptr};
const char* filename = nullptr; const char* filename = nullptr;
int stream = 0;
if(!PyArg_ParseTupleAndKeywords(args, kwds, "s|i:Sound", const_cast<char**>(kwlist), &filename, &stream)) if(!PyArg_ParseTupleAndKeywords(args, kwds, "s:Sound", const_cast<char**>(kwlist), &filename))
{ {
Py_DECREF(self); Py_DECREF(self);
return nullptr; return nullptr;
@@ -101,7 +100,7 @@ Sound_new(PyTypeObject* type, PyObject* args, PyObject* kwds)
try try
{ {
self->sound = new std::shared_ptr<ISound>(new File(filename, stream)); self->sound = new std::shared_ptr<ISound>(new File(filename));
} }
catch(Exception& e) catch(Exception& e)
{ {
@@ -290,7 +289,7 @@ PyDoc_STRVAR(M_aud_Sound_buffer_doc,
".. classmethod:: buffer(data, rate)\n\n" ".. classmethod:: buffer(data, rate)\n\n"
" Creates a sound from a data buffer.\n\n" " Creates a sound from a data buffer.\n\n"
" :arg data: The data as two dimensional numpy array.\n" " :arg data: The data as two dimensional numpy array.\n"
" :type data: :class:`numpy.ndarray`\n" " :type data: numpy.ndarray\n"
" :arg rate: The sample rate.\n" " :arg rate: The sample rate.\n"
" :type rate: double\n" " :type rate: double\n"
" :return: The created :class:`Sound` object.\n" " :return: The created :class:`Sound` object.\n"
@@ -408,9 +407,8 @@ static PyObject *
Sound_file(PyTypeObject* type, PyObject* args) Sound_file(PyTypeObject* type, PyObject* args)
{ {
const char* filename = nullptr; const char* filename = nullptr;
int stream = 0;
if(!PyArg_ParseTuple(args, "s|i:file", &filename, &stream)) if(!PyArg_ParseTuple(args, "s:file", &filename))
return nullptr; return nullptr;
Sound* self; Sound* self;
@@ -420,7 +418,7 @@ Sound_file(PyTypeObject* type, PyObject* args)
{ {
try try
{ {
self->sound = new std::shared_ptr<ISound>(new File(filename, stream)); self->sound = new std::shared_ptr<ISound>(new File(filename));
} }
catch(Exception& e) catch(Exception& e)
{ {

View File

@@ -70,6 +70,12 @@ public:
*/ */
virtual int getPosition() const=0; virtual int getPosition() const=0;
/**
* Returns the start offset the sound should have to line up with related sources.
* \return The required start offset in seconds.
*/
virtual double getStartOffset() const { return 0.0;}
/** /**
* Returns the specification of the reader. * Returns the specification of the reader.
* \return The Specs structure. * \return The Specs structure.

View File

@@ -23,11 +23,9 @@
*/ */
#include "ISound.h" #include "ISound.h"
#include "FileInfo.h"
#include <string> #include <string>
#include <memory> #include <memory>
#include <vector>
AUD_NAMESPACE_BEGIN AUD_NAMESPACE_BEGIN
@@ -50,14 +48,6 @@ private:
*/ */
std::shared_ptr<Buffer> m_buffer; std::shared_ptr<Buffer> m_buffer;
/**
* The index of the stream within the file if it contains multiple.
* The first audio stream in the file has index 0 and the index increments by one
* for every other audio stream in the file. Other types of streams in the file
* do not count.
*/
int m_stream;
// delete copy constructor and operator= // delete copy constructor and operator=
File(const File&) = delete; File(const File&) = delete;
File& operator=(const File&) = delete; File& operator=(const File&) = delete;
@@ -67,25 +57,16 @@ public:
* Creates a new sound. * Creates a new sound.
* The file is read from the file system using the given path. * The file is read from the file system using the given path.
* \param filename The sound file path. * \param filename The sound file path.
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
*/ */
File(std::string filename, int stream = 0); File(std::string filename);
/** /**
* Creates a new sound. * Creates a new sound.
* The file is read from memory using the supplied buffer. * The file is read from memory using the supplied buffer.
* \param buffer The buffer to read from. * \param buffer The buffer to read from.
* \param size The size of the buffer. * \param size The size of the buffer.
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
*/ */
File(const data_t* buffer, int size, int stream = 0); File(const data_t* buffer, int size);
/**
* Queries the streams of the file.
* \return A vector with as many streams as there are in the file.
* \exception Exception Thrown if the file specified cannot be read.
*/
std::vector<StreamInfo> queryStreams();
virtual std::shared_ptr<IReader> createReader(); virtual std::shared_ptr<IReader> createReader();
}; };

View File

@@ -1,42 +0,0 @@
/*******************************************************************************
* Copyright 2009-2016 Jörg Müller
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
#pragma once
/**
* @file FileInfo.h
* @ingroup file
* The FileInfo data structures.
*/
#include "respec/Specification.h"
AUD_NAMESPACE_BEGIN
/// Specification of a sound source.
struct StreamInfo
{
/// Start time in seconds.
double start;
/// Duration in seconds. May be estimated or 0 if unknown.
double duration;
/// Audio data parameters.
DeviceSpecs specs;
};
AUD_NAMESPACE_END

View File

@@ -22,14 +22,12 @@
* The FileManager class. * The FileManager class.
*/ */
#include "FileInfo.h"
#include "respec/Specification.h" #include "respec/Specification.h"
#include "IWriter.h" #include "IWriter.h"
#include <list> #include <list>
#include <memory> #include <memory>
#include <string> #include <string>
#include <vector>
AUD_NAMESPACE_BEGIN AUD_NAMESPACE_BEGIN
@@ -68,36 +66,18 @@ public:
/** /**
* Creates a file reader for the given filename if a registed IFileInput is able to read it. * Creates a file reader for the given filename if a registed IFileInput is able to read it.
* @param filename The path to the file. * @param filename The path to the file.
* @param stream The index of the audio stream within the file if it contains multiple audio streams.
* @return The reader created. * @return The reader created.
* @exception Exception If no file input can read the file an exception is thrown. * @exception Exception If no file input can read the file an exception is thrown.
*/ */
static std::shared_ptr<IReader> createReader(std::string filename, int stream = 0); static std::shared_ptr<IReader> createReader(std::string filename);
/** /**
* Creates a file reader for the given buffer if a registed IFileInput is able to read it. * Creates a file reader for the given buffer if a registed IFileInput is able to read it.
* @param buffer The buffer to read the file from. * @param buffer The buffer to read the file from.
* @param stream The index of the audio stream within the file if it contains multiple audio streams.
* @return The reader created. * @return The reader created.
* @exception Exception If no file input can read the file an exception is thrown. * @exception Exception If no file input can read the file an exception is thrown.
*/ */
static std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer, int stream = 0); static std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer);
/**
* Queries the streams of a sound file.
* \param filename Path to the file to be read.
* \return A vector with as many streams as there are in the file.
* \exception Exception Thrown if the file specified cannot be read.
*/
static std::vector<StreamInfo> queryStreams(std::string filename);
/**
* Queries the streams of a sound file.
* \param buffer The in-memory file buffer.
* \return A vector with as many streams as there are in the file.
* \exception Exception Thrown if the file specified cannot be read.
*/
static std::vector<StreamInfo> queryStreams(std::shared_ptr<Buffer> buffer);
/** /**
* Creates a file writer that writes a sound to the given file path. * Creates a file writer that writes a sound to the given file path.

View File

@@ -23,11 +23,9 @@
*/ */
#include "Audaspace.h" #include "Audaspace.h"
#include "FileInfo.h"
#include <memory> #include <memory>
#include <string> #include <string>
#include <vector>
AUD_NAMESPACE_BEGIN AUD_NAMESPACE_BEGIN
@@ -50,36 +48,18 @@ public:
/** /**
* Creates a reader for a file to be read. * Creates a reader for a file to be read.
* \param filename Path to the file to be read. * \param filename Path to the file to be read.
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
* \return The reader that reads the file. * \return The reader that reads the file.
* \exception Exception Thrown if the file specified cannot be read. * \exception Exception Thrown if the file specified cannot be read.
*/ */
virtual std::shared_ptr<IReader> createReader(std::string filename, int stream = 0)=0; virtual std::shared_ptr<IReader> createReader(std::string filename)=0;
/** /**
* Creates a reader for a file to be read from memory. * Creates a reader for a file to be read from memory.
* \param buffer The in-memory file buffer. * \param buffer The in-memory file buffer.
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
* \return The reader that reads the file. * \return The reader that reads the file.
* \exception Exception Thrown if the file specified cannot be read. * \exception Exception Thrown if the file specified cannot be read.
*/ */
virtual std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer, int stream = 0)=0; virtual std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer)=0;
/**
* Queries the streams of a sound file.
* \param filename Path to the file to be read.
* \return A vector with as many streams as there are in the file.
* \exception Exception Thrown if the file specified cannot be read.
*/
virtual std::vector<StreamInfo> queryStreams(std::string filename)=0;
/**
* Queries the streams of a sound file.
* \param buffer The in-memory file buffer.
* \return A vector with as many streams as there are in the file.
* \exception Exception Thrown if the file specified cannot be read.
*/
virtual std::vector<StreamInfo> queryStreams(std::shared_ptr<Buffer> buffer)=0;
}; };
AUD_NAMESPACE_END AUD_NAMESPACE_END

View File

@@ -67,4 +67,4 @@ public:
virtual void read(int& length, bool& eos, sample_t* buffer); virtual void read(int& length, bool& eos, sample_t* buffer);
}; };
AUD_NAMESPACE_END AUD_NAMESPACE_END

View File

@@ -1,97 +0,0 @@
/*******************************************************************************
* Copyright 2009-2021 Jörg Müller
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
#pragma once
/**
* @file RingBuffer.h
* @ingroup util
* The RingBuffer class.
*/
#include "Audaspace.h"
#include "Buffer.h"
#include <cstddef>
AUD_NAMESPACE_BEGIN
/**
* This class is a simple ring buffer in RAM which is 32 Byte aligned and provides
* functionality for concurrent reading and writting without locks.
*/
class AUD_API RingBuffer
{
private:
/// The buffer storing the actual data.
Buffer m_buffer;
/// The reading pointer.
volatile size_t m_read;
/// The writing pointer.
volatile size_t m_write;
// delete copy constructor and operator=
RingBuffer(const RingBuffer&) = delete;
RingBuffer& operator=(const RingBuffer&) = delete;
public:
/**
* Creates a new ring buffer.
* \param size The size of the buffer in bytes.
*/
RingBuffer(int size = 0);
/**
* Returns the pointer to the ring buffer in memory.
*/
sample_t* getBuffer() const;
/**
* Returns the size of the ring buffer in bytes.
*/
int getSize() const;
size_t getReadSize() const;
size_t getWriteSize() const;
size_t read(data_t* target, size_t size);
size_t write(data_t* source, size_t size);
/**
* Resets the ring buffer to a state where nothing has been written or read.
*/
void reset();
/**
* Resizes the ring buffer.
* \param size The new size of the ring buffer, measured in bytes.
*/
void resize(int size);
/**
* Makes sure the ring buffer has a minimum size.
* If size is >= current size, nothing will happen.
* Otherwise the ring buffer is resized with keep as parameter.
* \param size The new minimum size of the ring buffer, measured in bytes.
*/
void assureSize(int size);
};
AUD_NAMESPACE_END

View File

@@ -35,24 +35,14 @@ void FFMPEG::registerPlugin()
FileManager::registerOutput(plugin); FileManager::registerOutput(plugin);
} }
std::shared_ptr<IReader> FFMPEG::createReader(std::string filename, int stream) std::shared_ptr<IReader> FFMPEG::createReader(std::string filename)
{ {
return std::shared_ptr<IReader>(new FFMPEGReader(filename, stream)); return std::shared_ptr<IReader>(new FFMPEGReader(filename));
} }
std::shared_ptr<IReader> FFMPEG::createReader(std::shared_ptr<Buffer> buffer, int stream) std::shared_ptr<IReader> FFMPEG::createReader(std::shared_ptr<Buffer> buffer)
{ {
return std::shared_ptr<IReader>(new FFMPEGReader(buffer, stream)); return std::shared_ptr<IReader>(new FFMPEGReader(buffer));
}
std::vector<StreamInfo> FFMPEG::queryStreams(std::string filename)
{
return FFMPEGReader(filename).queryStreams();
}
std::vector<StreamInfo> FFMPEG::queryStreams(std::shared_ptr<Buffer> buffer)
{
return FFMPEGReader(buffer).queryStreams();
} }
std::shared_ptr<IWriter> FFMPEG::createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate) std::shared_ptr<IWriter> FFMPEG::createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate)

View File

@@ -52,10 +52,8 @@ public:
*/ */
static void registerPlugin(); static void registerPlugin();
virtual std::shared_ptr<IReader> createReader(std::string filename, int stream = 0); virtual std::shared_ptr<IReader> createReader(std::string filename);
virtual std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer, int stream = 0); virtual std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer);
virtual std::vector<StreamInfo> queryStreams(std::string filename);
virtual std::vector<StreamInfo> queryStreams(std::shared_ptr<Buffer> buffer);
virtual std::shared_ptr<IWriter> createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate); virtual std::shared_ptr<IWriter> createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate);
}; };

View File

@@ -31,25 +31,6 @@ AUD_NAMESPACE_BEGIN
#define FFMPEG_OLD_CODE #define FFMPEG_OLD_CODE
#endif #endif
SampleFormat FFMPEGReader::convertSampleFormat(AVSampleFormat format)
{
switch(av_get_packed_sample_fmt(format))
{
case AV_SAMPLE_FMT_U8:
return FORMAT_U8;
case AV_SAMPLE_FMT_S16:
return FORMAT_S16;
case AV_SAMPLE_FMT_S32:
return FORMAT_S32;
case AV_SAMPLE_FMT_FLT:
return FORMAT_FLOAT32;
case AV_SAMPLE_FMT_DBL:
return FORMAT_FLOAT64;
default:
AUD_THROW(FileException, "FFMPEG sample format unknown.");
}
}
int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer) int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
{ {
int buf_size = buffer.getSize(); int buf_size = buffer.getSize();
@@ -87,7 +68,7 @@ int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
for(int i = 0; i < m_frame->nb_samples; i++) for(int i = 0; i < m_frame->nb_samples; i++)
{ {
std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos + ((m_codecCtx->channels * i) + channel) * single_size, std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos + ((m_codecCtx->channels * i) + channel) * single_size,
m_frame->data[channel] + i * single_size, single_size); m_frame->data[channel] + i * single_size, single_size);
} }
} }
} }
@@ -128,7 +109,7 @@ int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
for(int i = 0; i < m_frame->nb_samples; i++) for(int i = 0; i < m_frame->nb_samples; i++)
{ {
std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos + ((m_codecCtx->channels * i) + channel) * single_size, std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos + ((m_codecCtx->channels * i) + channel) * single_size,
m_frame->data[channel] + i * single_size, single_size); m_frame->data[channel] + i * single_size, single_size);
} }
} }
} }
@@ -142,10 +123,13 @@ int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
return buf_pos; return buf_pos;
} }
void FFMPEGReader::init(int stream) void FFMPEGReader::init()
{ {
m_position = 0; m_position = 0;
m_start_offset = 0.0f;
m_pkgbuf_left = 0; m_pkgbuf_left = 0;
m_st_time = 0;
m_duration = 0;
if(avformat_find_stream_info(m_formatCtx, nullptr) < 0) if(avformat_find_stream_info(m_formatCtx, nullptr) < 0)
AUD_THROW(FileException, "File couldn't be read, ffmpeg couldn't find the stream info."); AUD_THROW(FileException, "File couldn't be read, ffmpeg couldn't find the stream info.");
@@ -153,22 +137,43 @@ void FFMPEGReader::init(int stream)
// find audio stream and codec // find audio stream and codec
m_stream = -1; m_stream = -1;
double dur_sec = 0;
for(unsigned int i = 0; i < m_formatCtx->nb_streams; i++) for(unsigned int i = 0; i < m_formatCtx->nb_streams; i++)
{ {
#ifdef FFMPEG_OLD_CODE #ifdef FFMPEG_OLD_CODE
if((m_formatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) if(m_formatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
#else #else
if((m_formatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) if(m_formatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
#endif #endif
&& (m_stream < 0))
{ {
if(stream == 0) AVStream *audio_stream = m_formatCtx->streams[i];
double audio_timebase = av_q2d(audio_stream->time_base);
if (audio_stream->start_time != AV_NOPTS_VALUE)
{ {
m_stream=i; m_st_time = audio_stream->start_time;
break; }
int64_t ctx_start_time = 0;
if (m_formatCtx->start_time != AV_NOPTS_VALUE) {
ctx_start_time = m_formatCtx->start_time;
}
m_start_offset = m_st_time * audio_timebase - (double)ctx_start_time / AV_TIME_BASE;
if(audio_stream->duration != AV_NOPTS_VALUE)
{
dur_sec = audio_stream->duration * audio_timebase;
} }
else else
stream--; {
/* If the audio starts after the stream start time, subract this from the total duration. */
dur_sec = (double)m_formatCtx->duration / AV_TIME_BASE - m_start_offset;
}
m_stream=i;
break;
} }
} }
@@ -237,9 +242,10 @@ void FFMPEGReader::init(int stream)
} }
m_specs.rate = (SampleRate) m_codecCtx->sample_rate; m_specs.rate = (SampleRate) m_codecCtx->sample_rate;
m_duration = lround(dur_sec * m_codecCtx->sample_rate);
} }
FFMPEGReader::FFMPEGReader(std::string filename, int stream) : FFMPEGReader::FFMPEGReader(std::string filename) :
m_pkgbuf(), m_pkgbuf(),
m_formatCtx(nullptr), m_formatCtx(nullptr),
m_codecCtx(nullptr), m_codecCtx(nullptr),
@@ -253,7 +259,7 @@ FFMPEGReader::FFMPEGReader(std::string filename, int stream) :
try try
{ {
init(stream); init();
} }
catch(Exception&) catch(Exception&)
{ {
@@ -262,7 +268,7 @@ FFMPEGReader::FFMPEGReader(std::string filename, int stream) :
} }
} }
FFMPEGReader::FFMPEGReader(std::shared_ptr<Buffer> buffer, int stream) : FFMPEGReader::FFMPEGReader(std::shared_ptr<Buffer> buffer) :
m_pkgbuf(), m_pkgbuf(),
m_codecCtx(nullptr), m_codecCtx(nullptr),
m_frame(nullptr), m_frame(nullptr),
@@ -289,7 +295,7 @@ FFMPEGReader::FFMPEGReader(std::shared_ptr<Buffer> buffer, int stream) :
try try
{ {
init(stream); init();
} }
catch(Exception&) catch(Exception&)
{ {
@@ -312,51 +318,6 @@ FFMPEGReader::~FFMPEGReader()
avformat_close_input(&m_formatCtx); avformat_close_input(&m_formatCtx);
} }
std::vector<StreamInfo> FFMPEGReader::queryStreams()
{
std::vector<StreamInfo> result;
for(unsigned int i = 0; i < m_formatCtx->nb_streams; i++)
{
#ifdef FFMPEG_OLD_CODE
if(m_formatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
#else
if(m_formatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
#endif
{
StreamInfo info;
double time_base = av_q2d(m_formatCtx->streams[i]->time_base);
if(m_formatCtx->streams[i]->start_time != AV_NOPTS_VALUE)
info.start = m_formatCtx->streams[i]->start_time * time_base;
else
info.start = 0;
if(m_formatCtx->streams[i]->duration != AV_NOPTS_VALUE)
info.duration = m_formatCtx->streams[i]->duration * time_base;
else if(m_formatCtx->duration != AV_NOPTS_VALUE)
info.duration = double(m_formatCtx->duration) / AV_TIME_BASE - info.start;
else
info.duration = 0;
#ifdef FFMPEG_OLD_CODE
info.specs.channels = Channels(m_formatCtx->streams[i]->codec->channels);
info.specs.rate = m_formatCtx->streams[i]->codec->sample_rate;
info.specs.format = convertSampleFormat(m_formatCtx->streams[i]->codec->sample_fmt);
#else
info.specs.channels = Channels(m_formatCtx->streams[i]->codecpar->channels);
info.specs.rate = m_formatCtx->streams[i]->codecpar->sample_rate;
info.specs.format = convertSampleFormat(AVSampleFormat(m_formatCtx->streams[i]->codecpar->format));
#endif
result.emplace_back(info);
}
}
return result;
}
int FFMPEGReader::read_packet(void* opaque, uint8_t* buf, int buf_size) int FFMPEGReader::read_packet(void* opaque, uint8_t* buf, int buf_size)
{ {
FFMPEGReader* reader = reinterpret_cast<FFMPEGReader*>(opaque); FFMPEGReader* reader = reinterpret_cast<FFMPEGReader*>(opaque);
@@ -407,16 +368,18 @@ void FFMPEGReader::seek(int position)
{ {
if(position >= 0) if(position >= 0)
{ {
double pts_time_base = av_q2d(m_formatCtx->streams[m_stream]->time_base); double pts_time_base =
av_q2d(m_formatCtx->streams[m_stream]->time_base);
uint64_t st_time = m_formatCtx->streams[m_stream]->start_time; uint64_t seek_pts = (((uint64_t)position) / ((uint64_t)m_specs.rate)) / pts_time_base;
uint64_t seek_pos = (uint64_t)(position / (pts_time_base * m_specs.rate));
if(st_time != AV_NOPTS_VALUE) if(m_st_time != AV_NOPTS_VALUE) {
seek_pos += st_time; seek_pts += m_st_time;
}
// a value < 0 tells us that seeking failed // a value < 0 tells us that seeking failed
if(av_seek_frame(m_formatCtx, m_stream, seek_pos, AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY) >= 0) if(av_seek_frame(m_formatCtx, m_stream, seek_pts,
AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY) >= 0)
{ {
avcodec_flush_buffers(m_codecCtx); avcodec_flush_buffers(m_codecCtx);
m_position = position; m_position = position;
@@ -437,7 +400,7 @@ void FFMPEGReader::seek(int position)
if(packet.pts != AV_NOPTS_VALUE) if(packet.pts != AV_NOPTS_VALUE)
{ {
// calculate real position, and read to frame! // calculate real position, and read to frame!
m_position = (packet.pts - (st_time != AV_NOPTS_VALUE ? st_time : 0)) * pts_time_base * m_specs.rate; m_position = (packet.pts - m_st_time) * pts_time_base * m_specs.rate;
if(m_position < position) if(m_position < position)
{ {
@@ -467,25 +430,8 @@ void FFMPEGReader::seek(int position)
int FFMPEGReader::getLength() const int FFMPEGReader::getLength() const
{ {
auto stream = m_formatCtx->streams[m_stream];
double time_base = av_q2d(stream->time_base);
double duration;
if(stream->duration != AV_NOPTS_VALUE)
duration = stream->duration * time_base;
else if(m_formatCtx->duration != AV_NOPTS_VALUE)
{
duration = float(m_formatCtx->duration) / AV_TIME_BASE;
if(stream->start_time != AV_NOPTS_VALUE)
duration -= stream->start_time * time_base;
}
else
duration = -1;
// return approximated remaning size // return approximated remaning size
return (int)(duration * m_codecCtx->sample_rate) - m_position; return m_duration - m_position;
} }
int FFMPEGReader::getPosition() const int FFMPEGReader::getPosition() const
@@ -493,6 +439,11 @@ int FFMPEGReader::getPosition() const
return m_position; return m_position;
} }
double FFMPEGReader::getStartOffset() const
{
return m_start_offset;
}
Specs FFMPEGReader::getSpecs() const Specs FFMPEGReader::getSpecs() const
{ {
return m_specs.specs; return m_specs.specs;
@@ -529,11 +480,13 @@ void FFMPEGReader::read(int& length, bool& eos, sample_t* buffer)
// decode the package // decode the package
pkgbuf_pos = decode(packet, m_pkgbuf); pkgbuf_pos = decode(packet, m_pkgbuf);
// copy to output buffer if (packet.pts >= m_st_time) {
data_size = std::min(pkgbuf_pos, left * sample_size); // copy to output buffer
m_convert((data_t*) buf, (data_t*) m_pkgbuf.getBuffer(), data_size / AUD_FORMAT_SIZE(m_specs.format)); data_size = std::min(pkgbuf_pos, left * sample_size);
buf += data_size / AUD_FORMAT_SIZE(m_specs.format); m_convert((data_t*) buf, (data_t*) m_pkgbuf.getBuffer(), data_size / AUD_FORMAT_SIZE(m_specs.format));
left -= data_size / sample_size; buf += data_size / AUD_FORMAT_SIZE(m_specs.format);
left -= data_size / sample_size;
}
} }
av_packet_unref(&packet); av_packet_unref(&packet);
} }

View File

@@ -29,11 +29,9 @@
#include "respec/ConverterFunctions.h" #include "respec/ConverterFunctions.h"
#include "IReader.h" #include "IReader.h"
#include "util/Buffer.h" #include "util/Buffer.h"
#include "file/FileInfo.h"
#include <string> #include <string>
#include <memory> #include <memory>
#include <vector>
struct AVCodecContext; struct AVCodecContext;
extern "C" { extern "C" {
@@ -56,6 +54,22 @@ private:
*/ */
int m_position; int m_position;
/**
* The start offset in seconds relative to the media container start time.
* IE how much the sound should be delayed to be kept in sync with the rest of the containter streams.
*/
double m_start_offset;
/**
* The start time pts of the stream. All packets before this timestamp shouldn't be played back (only decoded).
*/
int64_t m_st_time;
/**
* The duration of the audio stream in samples.
*/
int64_t m_duration;
/** /**
* The specification of the audio data. * The specification of the audio data.
*/ */
@@ -121,13 +135,6 @@ private:
*/ */
bool m_tointerleave; bool m_tointerleave;
/**
* Converts an ffmpeg sample format to an audaspace one.
* \param format The AVSampleFormat sample format.
* \return The sample format as SampleFormat.
*/
AUD_LOCAL static SampleFormat convertSampleFormat(AVSampleFormat format);
/** /**
* Decodes a packet into the given buffer. * Decodes a packet into the given buffer.
* \param packet The AVPacket to decode. * \param packet The AVPacket to decode.
@@ -138,9 +145,8 @@ private:
/** /**
* Initializes the object. * Initializes the object.
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
*/ */
AUD_LOCAL void init(int stream); AUD_LOCAL void init();
// delete copy constructor and operator= // delete copy constructor and operator=
FFMPEGReader(const FFMPEGReader&) = delete; FFMPEGReader(const FFMPEGReader&) = delete;
@@ -150,33 +156,24 @@ public:
/** /**
* Creates a new reader. * Creates a new reader.
* \param filename The path to the file to be read. * \param filename The path to the file to be read.
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
* \exception Exception Thrown if the file specified does not exist or * \exception Exception Thrown if the file specified does not exist or
* cannot be read with ffmpeg. * cannot be read with ffmpeg.
*/ */
FFMPEGReader(std::string filename, int stream = 0); FFMPEGReader(std::string filename);
/** /**
* Creates a new reader. * Creates a new reader.
* \param buffer The buffer to read from. * \param buffer The buffer to read from.
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
* \exception Exception Thrown if the buffer specified cannot be read * \exception Exception Thrown if the buffer specified cannot be read
* with ffmpeg. * with ffmpeg.
*/ */
FFMPEGReader(std::shared_ptr<Buffer> buffer, int stream = 0); FFMPEGReader(std::shared_ptr<Buffer> buffer);
/** /**
* Destroys the reader and closes the file. * Destroys the reader and closes the file.
*/ */
virtual ~FFMPEGReader(); virtual ~FFMPEGReader();
/**
* Queries the streams of a sound file.
* \return A vector with as many streams as there are in the file.
* \exception Exception Thrown if the file specified cannot be read.
*/
virtual std::vector<StreamInfo> queryStreams();
/** /**
* Reads data to a memory buffer. * Reads data to a memory buffer.
* This function is used for avio only. * This function is used for avio only.
@@ -201,6 +198,7 @@ public:
virtual void seek(int position); virtual void seek(int position);
virtual int getLength() const; virtual int getLength() const;
virtual int getPosition() const; virtual int getPosition() const;
virtual double getStartOffset() const;
virtual Specs getSpecs() const; virtual Specs getSpecs() const;
virtual void read(int& length, bool& eos, sample_t* buffer); virtual void read(int& length, bool& eos, sample_t* buffer);
}; };

View File

@@ -32,26 +32,16 @@ void SndFile::registerPlugin()
FileManager::registerOutput(plugin); FileManager::registerOutput(plugin);
} }
std::shared_ptr<IReader> SndFile::createReader(std::string filename, int stream) std::shared_ptr<IReader> SndFile::createReader(std::string filename)
{ {
return std::shared_ptr<IReader>(new SndFileReader(filename)); return std::shared_ptr<IReader>(new SndFileReader(filename));
} }
std::shared_ptr<IReader> SndFile::createReader(std::shared_ptr<Buffer> buffer, int stream) std::shared_ptr<IReader> SndFile::createReader(std::shared_ptr<Buffer> buffer)
{ {
return std::shared_ptr<IReader>(new SndFileReader(buffer)); return std::shared_ptr<IReader>(new SndFileReader(buffer));
} }
std::vector<StreamInfo> SndFile::queryStreams(std::string filename)
{
return SndFileReader(filename).queryStreams();
}
std::vector<StreamInfo> SndFile::queryStreams(std::shared_ptr<Buffer> buffer)
{
return SndFileReader(buffer).queryStreams();
}
std::shared_ptr<IWriter> SndFile::createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate) std::shared_ptr<IWriter> SndFile::createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate)
{ {
return std::shared_ptr<IWriter>(new SndFileWriter(filename, specs, format, codec, bitrate)); return std::shared_ptr<IWriter>(new SndFileWriter(filename, specs, format, codec, bitrate));

View File

@@ -52,10 +52,8 @@ public:
*/ */
static void registerPlugin(); static void registerPlugin();
virtual std::shared_ptr<IReader> createReader(std::string filename, int stream = 0); virtual std::shared_ptr<IReader> createReader(std::string filename);
virtual std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer, int stream = 0); virtual std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer);
virtual std::vector<StreamInfo> queryStreams(std::string filename);
virtual std::vector<StreamInfo> queryStreams(std::shared_ptr<Buffer> buffer);
virtual std::shared_ptr<IWriter> createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate); virtual std::shared_ptr<IWriter> createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate);
}; };

View File

@@ -118,21 +118,6 @@ SndFileReader::~SndFileReader()
sf_close(m_sndfile); sf_close(m_sndfile);
} }
std::vector<StreamInfo> SndFileReader::queryStreams()
{
std::vector<StreamInfo> result;
StreamInfo info;
info.start = 0;
info.duration = double(getLength()) / m_specs.rate;
info.specs.specs = m_specs;
info.specs.format = FORMAT_FLOAT32;
result.emplace_back(info);
return result;
}
bool SndFileReader::isSeekable() const bool SndFileReader::isSeekable() const
{ {
return m_seekable; return m_seekable;

View File

@@ -28,12 +28,9 @@
* The SndFileReader class. * The SndFileReader class.
*/ */
#include "file/FileInfo.h"
#include <string> #include <string>
#include <sndfile.h> #include <sndfile.h>
#include <memory> #include <memory>
#include <vector>
AUD_NAMESPACE_BEGIN AUD_NAMESPACE_BEGIN
@@ -99,7 +96,6 @@ public:
/** /**
* Creates a new reader. * Creates a new reader.
* \param filename The path to the file to be read. * \param filename The path to the file to be read.
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
* \exception Exception Thrown if the file specified does not exist or * \exception Exception Thrown if the file specified does not exist or
* cannot be read with libsndfile. * cannot be read with libsndfile.
*/ */
@@ -108,7 +104,6 @@ public:
/** /**
* Creates a new reader. * Creates a new reader.
* \param buffer The buffer to read from. * \param buffer The buffer to read from.
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
* \exception Exception Thrown if the buffer specified cannot be read * \exception Exception Thrown if the buffer specified cannot be read
* with libsndfile. * with libsndfile.
*/ */
@@ -119,13 +114,6 @@ public:
*/ */
virtual ~SndFileReader(); virtual ~SndFileReader();
/**
* Queries the streams of a sound file.
* \return A vector with as many streams as there are in the file.
* \exception Exception Thrown if the file specified cannot be read.
*/
virtual std::vector<StreamInfo> queryStreams();
virtual bool isSeekable() const; virtual bool isSeekable() const;
virtual void seek(int position); virtual void seek(int position);
virtual int getLength() const; virtual int getLength() const;

View File

@@ -23,121 +23,95 @@
AUD_NAMESPACE_BEGIN AUD_NAMESPACE_BEGIN
PulseAudioDevice::PulseAudioSynchronizer::PulseAudioSynchronizer(PulseAudioDevice *device) :
m_device(device)
{
}
double PulseAudioDevice::PulseAudioSynchronizer::getPosition(std::shared_ptr<IHandle> handle)
{
pa_usec_t latency;
int negative;
AUD_pa_stream_get_latency(m_device->m_stream, &latency, &negative);
double delay = m_device->m_ring_buffer.getReadSize() / (AUD_SAMPLE_SIZE(m_device->m_specs) * m_device->m_specs.rate) + latency * 1.0e-6;
return handle->getPosition() - delay;
}
void PulseAudioDevice::updateRingBuffer()
{
unsigned int samplesize = AUD_SAMPLE_SIZE(m_specs);
std::unique_lock<std::mutex> lock(m_mixingLock);
Buffer buffer;
while(m_valid)
{
size_t size = m_ring_buffer.getWriteSize();
size_t sample_count = size / samplesize;
if(sample_count > 0)
{
size = sample_count * samplesize;
buffer.assureSize(size);
mix(reinterpret_cast<data_t*>(buffer.getBuffer()), sample_count);
m_ring_buffer.write(reinterpret_cast<data_t*>(buffer.getBuffer()), size);
}
m_mixingCondition.wait(lock);
}
}
void PulseAudioDevice::PulseAudio_state_callback(pa_context *context, void *data) void PulseAudioDevice::PulseAudio_state_callback(pa_context *context, void *data)
{ {
PulseAudioDevice* device = (PulseAudioDevice*)data; PulseAudioDevice* device = (PulseAudioDevice*)data;
device->m_state = AUD_pa_context_get_state(context); std::lock_guard<ILockable> lock(*device);
AUD_pa_threaded_mainloop_signal(device->m_mainloop, 0); device->m_state = AUD_pa_context_get_state(context);
} }
void PulseAudioDevice::PulseAudio_request(pa_stream *stream, size_t total_bytes, void *data) void PulseAudioDevice::PulseAudio_request(pa_stream *stream, size_t total_bytes, void *data)
{ {
PulseAudioDevice* device = (PulseAudioDevice*)data; PulseAudioDevice* device = (PulseAudioDevice*)data;
data_t* buffer; void* buffer;
size_t sample_size = AUD_DEVICE_SAMPLE_SIZE(device->m_specs);
while(total_bytes > 0) while(total_bytes > 0)
{ {
size_t num_bytes = total_bytes; size_t num_bytes = total_bytes;
AUD_pa_stream_begin_write(stream, reinterpret_cast<void**>(&buffer), &num_bytes); AUD_pa_stream_begin_write(stream, &buffer, &num_bytes);
size_t readsamples = device->m_ring_buffer.getReadSize(); device->mix((data_t*)buffer, num_bytes / AUD_DEVICE_SAMPLE_SIZE(device->m_specs));
readsamples = std::min(readsamples, size_t(num_bytes)) / sample_size; AUD_pa_stream_write(stream, buffer, num_bytes, nullptr, 0, PA_SEEK_RELATIVE);
device->m_ring_buffer.read(buffer, readsamples * sample_size);
if(readsamples * sample_size < num_bytes)
std::memset(buffer + readsamples * sample_size, 0, num_bytes - readsamples * sample_size);
if(device->m_mixingLock.try_lock())
{
device->m_mixingCondition.notify_all();
device->m_mixingLock.unlock();
}
AUD_pa_stream_write(stream, reinterpret_cast<void*>(buffer), num_bytes, nullptr, 0, PA_SEEK_RELATIVE);
total_bytes -= num_bytes; total_bytes -= num_bytes;
} }
} }
void PulseAudioDevice::playing(bool playing) void PulseAudioDevice::PulseAudio_underflow(pa_stream *stream, void *data)
{ {
m_playback = playing; PulseAudioDevice* device = (PulseAudioDevice*)data;
AUD_pa_threaded_mainloop_lock(m_mainloop); DeviceSpecs specs = device->getSpecs();
AUD_pa_stream_cork(m_stream, playing ? 0 : 1, nullptr, nullptr);
AUD_pa_threaded_mainloop_unlock(m_mainloop); if(++device->m_underflows > 4 && device->m_buffersize < AUD_DEVICE_SAMPLE_SIZE(specs) * specs.rate * 2)
{
device->m_buffersize <<= 1;
device->m_underflows = 0;
pa_buffer_attr buffer_attr;
buffer_attr.fragsize = -1U;
buffer_attr.maxlength = -1U;
buffer_attr.minreq = -1U;
buffer_attr.prebuf = -1U;
buffer_attr.tlength = device->m_buffersize;
AUD_pa_stream_set_buffer_attr(stream, &buffer_attr, nullptr, nullptr);
}
}
void PulseAudioDevice::runMixingThread()
{
for(;;)
{
{
std::lock_guard<ILockable> lock(*this);
if(shouldStop())
{
AUD_pa_stream_cork(m_stream, 1, nullptr, nullptr);
AUD_pa_stream_flush(m_stream, nullptr, nullptr);
doStop();
return;
}
}
if(AUD_pa_stream_is_corked(m_stream))
AUD_pa_stream_cork(m_stream, 0, nullptr, nullptr);
// similar to AUD_pa_mainloop_iterate(m_mainloop, false, nullptr); except with a longer timeout
AUD_pa_mainloop_prepare(m_mainloop, 1 << 14);
AUD_pa_mainloop_poll(m_mainloop);
AUD_pa_mainloop_dispatch(m_mainloop);
}
} }
PulseAudioDevice::PulseAudioDevice(std::string name, DeviceSpecs specs, int buffersize) : PulseAudioDevice::PulseAudioDevice(std::string name, DeviceSpecs specs, int buffersize) :
m_synchronizer(this),
m_playback(false),
m_state(PA_CONTEXT_UNCONNECTED), m_state(PA_CONTEXT_UNCONNECTED),
m_valid(true),
m_underflows(0) m_underflows(0)
{ {
m_mainloop = AUD_pa_threaded_mainloop_new(); m_mainloop = AUD_pa_mainloop_new();
AUD_pa_threaded_mainloop_lock(m_mainloop); m_context = AUD_pa_context_new(AUD_pa_mainloop_get_api(m_mainloop), name.c_str());
m_context = AUD_pa_context_new(AUD_pa_threaded_mainloop_get_api(m_mainloop), name.c_str());
if(!m_context) if(!m_context)
{ {
AUD_pa_threaded_mainloop_unlock(m_mainloop); AUD_pa_mainloop_free(m_mainloop);
AUD_pa_threaded_mainloop_free(m_mainloop);
AUD_THROW(DeviceException, "Could not connect to PulseAudio."); AUD_THROW(DeviceException, "Could not connect to PulseAudio.");
} }
@@ -146,26 +120,21 @@ PulseAudioDevice::PulseAudioDevice(std::string name, DeviceSpecs specs, int buff
AUD_pa_context_connect(m_context, nullptr, PA_CONTEXT_NOFLAGS, nullptr); AUD_pa_context_connect(m_context, nullptr, PA_CONTEXT_NOFLAGS, nullptr);
AUD_pa_threaded_mainloop_start(m_mainloop);
while(m_state != PA_CONTEXT_READY) while(m_state != PA_CONTEXT_READY)
{ {
switch(m_state) switch(m_state)
{ {
case PA_CONTEXT_FAILED: case PA_CONTEXT_FAILED:
case PA_CONTEXT_TERMINATED: case PA_CONTEXT_TERMINATED:
AUD_pa_threaded_mainloop_unlock(m_mainloop);
AUD_pa_threaded_mainloop_stop(m_mainloop);
AUD_pa_context_disconnect(m_context); AUD_pa_context_disconnect(m_context);
AUD_pa_context_unref(m_context); AUD_pa_context_unref(m_context);
AUD_pa_threaded_mainloop_free(m_mainloop); AUD_pa_mainloop_free(m_mainloop);
AUD_THROW(DeviceException, "Could not connect to PulseAudio."); AUD_THROW(DeviceException, "Could not connect to PulseAudio.");
break; break;
default: default:
AUD_pa_threaded_mainloop_wait(m_mainloop); AUD_pa_mainloop_iterate(m_mainloop, true, nullptr);
break; break;
} }
} }
@@ -213,18 +182,16 @@ PulseAudioDevice::PulseAudioDevice(std::string name, DeviceSpecs specs, int buff
if(!m_stream) if(!m_stream)
{ {
AUD_pa_threaded_mainloop_unlock(m_mainloop);
AUD_pa_threaded_mainloop_stop(m_mainloop);
AUD_pa_context_disconnect(m_context); AUD_pa_context_disconnect(m_context);
AUD_pa_context_unref(m_context); AUD_pa_context_unref(m_context);
AUD_pa_threaded_mainloop_free(m_mainloop); AUD_pa_mainloop_free(m_mainloop);
AUD_THROW(DeviceException, "Could not create PulseAudio stream."); AUD_THROW(DeviceException, "Could not create PulseAudio stream.");
} }
AUD_pa_stream_set_write_callback(m_stream, PulseAudio_request, this); AUD_pa_stream_set_write_callback(m_stream, PulseAudio_request, this);
AUD_pa_stream_set_underflow_callback(m_stream, PulseAudio_underflow, this);
buffersize *= AUD_DEVICE_SAMPLE_SIZE(m_specs); buffersize *= AUD_DEVICE_SAMPLE_SIZE(m_specs);
m_buffersize = buffersize; m_buffersize = buffersize;
@@ -237,53 +204,31 @@ PulseAudioDevice::PulseAudioDevice(std::string name, DeviceSpecs specs, int buff
buffer_attr.prebuf = -1U; buffer_attr.prebuf = -1U;
buffer_attr.tlength = buffersize; buffer_attr.tlength = buffersize;
m_ring_buffer.resize(buffersize); if(AUD_pa_stream_connect_playback(m_stream, nullptr, &buffer_attr, static_cast<pa_stream_flags_t>(PA_STREAM_START_CORKED | PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_ADJUST_LATENCY | PA_STREAM_AUTO_TIMING_UPDATE), nullptr, nullptr) < 0)
if(AUD_pa_stream_connect_playback(m_stream, nullptr, &buffer_attr, static_cast<pa_stream_flags_t>(PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_ADJUST_LATENCY | PA_STREAM_AUTO_TIMING_UPDATE), nullptr, nullptr) < 0)
{ {
AUD_pa_threaded_mainloop_unlock(m_mainloop);
AUD_pa_threaded_mainloop_stop(m_mainloop);
AUD_pa_context_disconnect(m_context); AUD_pa_context_disconnect(m_context);
AUD_pa_context_unref(m_context); AUD_pa_context_unref(m_context);
AUD_pa_threaded_mainloop_free(m_mainloop); AUD_pa_mainloop_free(m_mainloop);
AUD_THROW(DeviceException, "Could not connect PulseAudio stream."); AUD_THROW(DeviceException, "Could not connect PulseAudio stream.");
} }
AUD_pa_threaded_mainloop_unlock(m_mainloop);
create(); create();
m_mixingThread = std::thread(&PulseAudioDevice::updateRingBuffer, this);
} }
PulseAudioDevice::~PulseAudioDevice() PulseAudioDevice::~PulseAudioDevice()
{ {
m_valid = false; stopMixingThread();
m_mixingLock.lock();
m_mixingCondition.notify_all();
m_mixingLock.unlock();
m_mixingThread.join();
AUD_pa_threaded_mainloop_stop(m_mainloop);
AUD_pa_context_disconnect(m_context); AUD_pa_context_disconnect(m_context);
AUD_pa_context_unref(m_context); AUD_pa_context_unref(m_context);
AUD_pa_threaded_mainloop_free(m_mainloop); AUD_pa_mainloop_free(m_mainloop);
destroy(); destroy();
} }
ISynchronizer *PulseAudioDevice::getSynchronizer()
{
return &m_synchronizer;
}
class PulseAudioDeviceFactory : public IDeviceFactory class PulseAudioDeviceFactory : public IDeviceFactory
{ {
private: private:

View File

@@ -26,11 +26,7 @@
* The PulseAudioDevice class. * The PulseAudioDevice class.
*/ */
#include "devices/SoftwareDevice.h" #include "devices/ThreadedDevice.h"
#include "util/RingBuffer.h"
#include <condition_variable>
#include <thread>
#include <pulse/pulseaudio.h> #include <pulse/pulseaudio.h>
@@ -39,65 +35,17 @@ AUD_NAMESPACE_BEGIN
/** /**
* This device plays back through PulseAudio, the simple direct media layer. * This device plays back through PulseAudio, the simple direct media layer.
*/ */
class AUD_PLUGIN_API PulseAudioDevice : public SoftwareDevice class AUD_PLUGIN_API PulseAudioDevice : public ThreadedDevice
{ {
private: private:
class PulseAudioSynchronizer : public DefaultSynchronizer pa_mainloop* m_mainloop;
{
PulseAudioDevice* m_device;
public:
PulseAudioSynchronizer(PulseAudioDevice* device);
virtual double getPosition(std::shared_ptr<IHandle> handle);
};
/// Synchronizer.
PulseAudioSynchronizer m_synchronizer;
/**
* Whether there is currently playback.
*/
volatile bool m_playback;
pa_threaded_mainloop* m_mainloop;
pa_context* m_context; pa_context* m_context;
pa_stream* m_stream; pa_stream* m_stream;
pa_context_state_t m_state; pa_context_state_t m_state;
/**
* The mixing ring buffer.
*/
RingBuffer m_ring_buffer;
/**
* Whether the device is valid.
*/
bool m_valid;
int m_buffersize; int m_buffersize;
uint32_t m_underflows; uint32_t m_underflows;
/**
* The mixing thread.
*/
std::thread m_mixingThread;
/**
* Mutex for mixing.
*/
std::mutex m_mixingLock;
/**
* Condition for mixing.
*/
std::condition_variable m_mixingCondition;
/**
* Updates the ring buffer.
*/
AUD_LOCAL void updateRingBuffer();
/** /**
* Reports the state of the PulseAudio server connection. * Reports the state of the PulseAudio server connection.
* \param context The PulseAudio context. * \param context The PulseAudio context.
@@ -113,13 +61,23 @@ private:
*/ */
AUD_LOCAL static void PulseAudio_request(pa_stream* stream, size_t total_bytes, void* data); AUD_LOCAL static void PulseAudio_request(pa_stream* stream, size_t total_bytes, void* data);
/**
* Reports an underflow from the PulseAudio server.
* Automatically adjusts the latency if this happens too often.
* @param stream The PulseAudio stream.
* \param data The PulseAudio device.
*/
AUD_LOCAL static void PulseAudio_underflow(pa_stream* stream, void* data);
/**
* Streaming thread main function.
*/
AUD_LOCAL void runMixingThread();
// delete copy constructor and operator= // delete copy constructor and operator=
PulseAudioDevice(const PulseAudioDevice&) = delete; PulseAudioDevice(const PulseAudioDevice&) = delete;
PulseAudioDevice& operator=(const PulseAudioDevice&) = delete; PulseAudioDevice& operator=(const PulseAudioDevice&) = delete;
protected:
virtual void playing(bool playing);
public: public:
/** /**
* Opens the PulseAudio audio device for playback. * Opens the PulseAudio audio device for playback.
@@ -135,8 +93,6 @@ public:
*/ */
virtual ~PulseAudioDevice(); virtual ~PulseAudioDevice();
virtual ISynchronizer* getSynchronizer();
/** /**
* Registers this plugin. * Registers this plugin.
*/ */

View File

@@ -25,7 +25,6 @@ PULSEAUDIO_SYMBOL(pa_stream_begin_write);
PULSEAUDIO_SYMBOL(pa_stream_connect_playback); PULSEAUDIO_SYMBOL(pa_stream_connect_playback);
PULSEAUDIO_SYMBOL(pa_stream_cork); PULSEAUDIO_SYMBOL(pa_stream_cork);
PULSEAUDIO_SYMBOL(pa_stream_flush); PULSEAUDIO_SYMBOL(pa_stream_flush);
PULSEAUDIO_SYMBOL(pa_stream_get_latency);
PULSEAUDIO_SYMBOL(pa_stream_is_corked); PULSEAUDIO_SYMBOL(pa_stream_is_corked);
PULSEAUDIO_SYMBOL(pa_stream_new); PULSEAUDIO_SYMBOL(pa_stream_new);
PULSEAUDIO_SYMBOL(pa_stream_set_buffer_attr); PULSEAUDIO_SYMBOL(pa_stream_set_buffer_attr);
@@ -40,13 +39,3 @@ PULSEAUDIO_SYMBOL(pa_mainloop_iterate);
PULSEAUDIO_SYMBOL(pa_mainloop_prepare); PULSEAUDIO_SYMBOL(pa_mainloop_prepare);
PULSEAUDIO_SYMBOL(pa_mainloop_poll); PULSEAUDIO_SYMBOL(pa_mainloop_poll);
PULSEAUDIO_SYMBOL(pa_mainloop_dispatch); PULSEAUDIO_SYMBOL(pa_mainloop_dispatch);
PULSEAUDIO_SYMBOL(pa_threaded_mainloop_free);
PULSEAUDIO_SYMBOL(pa_threaded_mainloop_get_api);
PULSEAUDIO_SYMBOL(pa_threaded_mainloop_lock);
PULSEAUDIO_SYMBOL(pa_threaded_mainloop_new);
PULSEAUDIO_SYMBOL(pa_threaded_mainloop_signal);
PULSEAUDIO_SYMBOL(pa_threaded_mainloop_start);
PULSEAUDIO_SYMBOL(pa_threaded_mainloop_stop);
PULSEAUDIO_SYMBOL(pa_threaded_mainloop_unlock);
PULSEAUDIO_SYMBOL(pa_threaded_mainloop_wait);

View File

@@ -23,31 +23,23 @@
AUD_NAMESPACE_BEGIN AUD_NAMESPACE_BEGIN
File::File(std::string filename, int stream) : File::File(std::string filename) :
m_filename(filename), m_stream(stream) m_filename(filename)
{ {
} }
File::File(const data_t* buffer, int size, int stream) : File::File(const data_t* buffer, int size) :
m_buffer(new Buffer(size)), m_stream(stream) m_buffer(new Buffer(size))
{ {
std::memcpy(m_buffer->getBuffer(), buffer, size); std::memcpy(m_buffer->getBuffer(), buffer, size);
} }
std::vector<StreamInfo> File::queryStreams()
{
if(m_buffer.get())
return FileManager::queryStreams(m_buffer);
else
return FileManager::queryStreams(m_filename);
}
std::shared_ptr<IReader> File::createReader() std::shared_ptr<IReader> File::createReader()
{ {
if(m_buffer.get()) if(m_buffer.get())
return FileManager::createReader(m_buffer, m_stream); return FileManager::createReader(m_buffer);
else else
return FileManager::createReader(m_filename, m_stream); return FileManager::createReader(m_filename);
} }
AUD_NAMESPACE_END AUD_NAMESPACE_END

View File

@@ -43,13 +43,13 @@ void FileManager::registerOutput(std::shared_ptr<aud::IFileOutput> output)
outputs().push_back(output); outputs().push_back(output);
} }
std::shared_ptr<IReader> FileManager::createReader(std::string filename, int stream) std::shared_ptr<IReader> FileManager::createReader(std::string filename)
{ {
for(std::shared_ptr<IFileInput> input : inputs()) for(std::shared_ptr<IFileInput> input : inputs())
{ {
try try
{ {
return input->createReader(filename, stream); return input->createReader(filename);
} }
catch(Exception&) {} catch(Exception&) {}
} }
@@ -57,41 +57,13 @@ std::shared_ptr<IReader> FileManager::createReader(std::string filename, int str
AUD_THROW(FileException, "The file couldn't be read with any installed file reader."); AUD_THROW(FileException, "The file couldn't be read with any installed file reader.");
} }
std::shared_ptr<IReader> FileManager::createReader(std::shared_ptr<Buffer> buffer, int stream) std::shared_ptr<IReader> FileManager::createReader(std::shared_ptr<Buffer> buffer)
{ {
for(std::shared_ptr<IFileInput> input : inputs()) for(std::shared_ptr<IFileInput> input : inputs())
{ {
try try
{ {
return input->createReader(buffer, stream); return input->createReader(buffer);
}
catch(Exception&) {}
}
AUD_THROW(FileException, "The file couldn't be read with any installed file reader.");
}
std::vector<StreamInfo> FileManager::queryStreams(std::string filename)
{
for(std::shared_ptr<IFileInput> input : inputs())
{
try
{
return input->queryStreams(filename);
}
catch(Exception&) {}
}
AUD_THROW(FileException, "The file couldn't be read with any installed file reader.");
}
std::vector<StreamInfo> FileManager::queryStreams(std::shared_ptr<Buffer> buffer)
{
for(std::shared_ptr<IFileInput> input : inputs())
{
try
{
return input->queryStreams(buffer);
} }
catch(Exception&) {} catch(Exception&) {}
} }

View File

@@ -57,4 +57,4 @@ void VolumeReader::read(int& length, bool& eos, sample_t* buffer)
buffer[i] = buffer[i] * m_volumeStorage->getVolume(); buffer[i] = buffer[i] * m_volumeStorage->getVolume();
} }
AUD_NAMESPACE_END AUD_NAMESPACE_END

View File

@@ -1,137 +0,0 @@
/*******************************************************************************
* Copyright 2009-2021 Jörg Müller
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
#include "util/RingBuffer.h"
#include <algorithm>
#include <cstring>
#include <cstdlib>
#define ALIGNMENT 32
#define ALIGN(a) (a + ALIGNMENT - ((long long)a & (ALIGNMENT-1)))
AUD_NAMESPACE_BEGIN
RingBuffer::RingBuffer(int size) :
m_buffer(size),
m_read(0),
m_write(0)
{
}
sample_t* RingBuffer::getBuffer() const
{
return m_buffer.getBuffer();
}
int RingBuffer::getSize() const
{
return m_buffer.getSize();
}
size_t RingBuffer::getReadSize() const
{
size_t read = m_read;
size_t write = m_write;
if(read > write)
return write + getSize() - read;
else
return write - read;
}
size_t RingBuffer::getWriteSize() const
{
size_t read = m_read;
size_t write = m_write;
if(read > write)
return read - write - 1;
else
return read + getSize() - write - 1;
}
size_t RingBuffer::read(data_t* target, size_t size)
{
size = std::min(size, getReadSize());
data_t* buffer = reinterpret_cast<data_t*>(m_buffer.getBuffer());
if(m_read + size > m_buffer.getSize())
{
size_t read_first = m_buffer.getSize() - m_read;
size_t read_second = size - read_first;
std::memcpy(target, buffer + m_read, read_first);
std::memcpy(target + read_first, buffer, read_second);
m_read = read_second;
}
else
{
std::memcpy(target, buffer + m_read, size);
m_read += size;
}
return size;
}
size_t RingBuffer::write(data_t* source, size_t size)
{
size = std::min(size, getWriteSize());
data_t* buffer = reinterpret_cast<data_t*>(m_buffer.getBuffer());
if(m_write + size > m_buffer.getSize())
{
size_t write_first = m_buffer.getSize() - m_write;
size_t write_second = size - write_first;
std::memcpy(buffer + m_write, source, write_first);
std::memcpy(buffer, source + write_first, write_second);
m_write = write_second;
}
else
{
std::memcpy(buffer + m_write, source, size);
m_write += size;
}
return size;
}
void RingBuffer::reset()
{
m_read = 0;
m_write = 0;
}
void RingBuffer::resize(int size)
{
m_buffer.resize(size);
reset();
}
void RingBuffer::assureSize(int size)
{
m_buffer.assureSize(size);
reset();
}
AUD_NAMESPACE_END

View File

@@ -609,7 +609,6 @@ typedef enum cudaError_enum {
CUDA_ERROR_INVALID_GRAPHICS_CONTEXT = 219, CUDA_ERROR_INVALID_GRAPHICS_CONTEXT = 219,
CUDA_ERROR_NVLINK_UNCORRECTABLE = 220, CUDA_ERROR_NVLINK_UNCORRECTABLE = 220,
CUDA_ERROR_JIT_COMPILER_NOT_FOUND = 221, CUDA_ERROR_JIT_COMPILER_NOT_FOUND = 221,
CUDA_ERROR_UNSUPPORTED_PTX_VERSION = 222,
CUDA_ERROR_INVALID_SOURCE = 300, CUDA_ERROR_INVALID_SOURCE = 300,
CUDA_ERROR_FILE_NOT_FOUND = 301, CUDA_ERROR_FILE_NOT_FOUND = 301,
CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND = 302, CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND = 302,
@@ -646,8 +645,7 @@ typedef enum CUdevice_P2PAttribute_enum {
CU_DEVICE_P2P_ATTRIBUTE_PERFORMANCE_RANK = 0x01, CU_DEVICE_P2P_ATTRIBUTE_PERFORMANCE_RANK = 0x01,
CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED = 0x02, CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED = 0x02,
CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED = 0x03, CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED = 0x03,
CU_DEVICE_P2P_ATTRIBUTE_ACCESS_ACCESS_SUPPORTED = 0x04, CU_DEVICE_P2P_ATTRIBUTE_ARRAY_ACCESS_ACCESS_SUPPORTED = 0x04,
CU_DEVICE_P2P_ATTRIBUTE_CUDA_ARRAY_ACCESS_SUPPORTED = 0x04,
} CUdevice_P2PAttribute; } CUdevice_P2PAttribute;
typedef void (CUDA_CB *CUstreamCallback)(CUstream hStream, CUresult status, void* userData); typedef void (CUDA_CB *CUstreamCallback)(CUstream hStream, CUresult status, void* userData);

View File

@@ -736,7 +736,6 @@ const char *cuewErrorString(CUresult result) {
case CUDA_ERROR_INVALID_GRAPHICS_CONTEXT: return "Invalid graphics context"; case CUDA_ERROR_INVALID_GRAPHICS_CONTEXT: return "Invalid graphics context";
case CUDA_ERROR_NVLINK_UNCORRECTABLE: return "Nvlink uncorrectable"; case CUDA_ERROR_NVLINK_UNCORRECTABLE: return "Nvlink uncorrectable";
case CUDA_ERROR_JIT_COMPILER_NOT_FOUND: return "Jit compiler not found"; case CUDA_ERROR_JIT_COMPILER_NOT_FOUND: return "Jit compiler not found";
case CUDA_ERROR_UNSUPPORTED_PTX_VERSION: return "Unsupported PTX version";
case CUDA_ERROR_INVALID_SOURCE: return "Invalid source"; case CUDA_ERROR_INVALID_SOURCE: return "Invalid source";
case CUDA_ERROR_FILE_NOT_FOUND: return "File not found"; case CUDA_ERROR_FILE_NOT_FOUND: return "File not found";
case CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND: return "Link to a shared object failed to resolve"; case CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND: return "Link to a shared object failed to resolve";

View File

@@ -1,39 +0,0 @@
# ***** 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.
#
# The Original Code is Copyright (C) 2021, Blender Foundation
# All rights reserved.
# ***** END GPL LICENSE BLOCK *****
set(INC
.
include
)
set(INC_SYS
)
set(SRC
src/hipew.c
include/hipew.h
)
set(LIB
)
blender_add_lib(extern_hipew "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

12
extern/hipew/README vendored
View File

@@ -1,12 +0,0 @@
The HIP Extension Wrangler Library (HIPEW) is a cross-platform open-source
C/C++ library to dynamically load the HIP library.
HIP (Heterogeneous-Compute Interface for Portability) is an API for C++
programming on AMD GPUs.
It is maintained as part of the Blender project, but included in extern/
for consistency with CUEW and CLEW libraries.
LICENSE
HIPEW is released under the Apache 2.0 license.

View File

@@ -1,5 +0,0 @@
Project: Blender
URL: https://git.blender.org/blender.git
License: Apache 2.0
Upstream version: N/A
Local modifications: None

File diff suppressed because it is too large Load Diff

View File

@@ -1,596 +0,0 @@
/*
* Copyright 2011-2021 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
#ifdef _MSC_VER
# if _MSC_VER < 1900
# define snprintf _snprintf
# endif
# define popen _popen
# define pclose _pclose
# define _CRT_SECURE_NO_WARNINGS
#endif
#include <hipew.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#ifdef _WIN32
# define WIN32_LEAN_AND_MEAN
# define VC_EXTRALEAN
# include <windows.h>
/* Utility macros. */
typedef HMODULE DynamicLibrary;
# define dynamic_library_open(path) LoadLibraryA(path)
# define dynamic_library_close(lib) FreeLibrary(lib)
# define dynamic_library_find(lib, symbol) GetProcAddress(lib, symbol)
#else
# include <dlfcn.h>
typedef void* DynamicLibrary;
# define dynamic_library_open(path) dlopen(path, RTLD_NOW)
# define dynamic_library_close(lib) dlclose(lib)
# define dynamic_library_find(lib, symbol) dlsym(lib, symbol)
#endif
#define _LIBRARY_FIND_CHECKED(lib, name) \
name = (t##name *)dynamic_library_find(lib, #name); \
assert(name);
#define _LIBRARY_FIND(lib, name) \
name = (t##name *)dynamic_library_find(lib, #name);
#define HIP_LIBRARY_FIND_CHECKED(name) \
_LIBRARY_FIND_CHECKED(hip_lib, name)
#define HIP_LIBRARY_FIND(name) _LIBRARY_FIND(hip_lib, name)
static DynamicLibrary hip_lib;
/* Function definitions. */
thipGetErrorName *hipGetErrorName;
thipInit *hipInit;
thipDriverGetVersion *hipDriverGetVersion;
thipGetDevice *hipGetDevice;
thipGetDeviceCount *hipGetDeviceCount;
thipGetDeviceProperties *hipGetDeviceProperties;
thipDeviceGet* hipDeviceGet;
thipDeviceGetName *hipDeviceGetName;
thipDeviceGetAttribute *hipDeviceGetAttribute;
thipDeviceComputeCapability *hipDeviceComputeCapability;
thipDevicePrimaryCtxRetain *hipDevicePrimaryCtxRetain;
thipDevicePrimaryCtxRelease *hipDevicePrimaryCtxRelease;
thipDevicePrimaryCtxSetFlags *hipDevicePrimaryCtxSetFlags;
thipDevicePrimaryCtxGetState *hipDevicePrimaryCtxGetState;
thipDevicePrimaryCtxReset *hipDevicePrimaryCtxReset;
thipCtxCreate *hipCtxCreate;
thipCtxDestroy *hipCtxDestroy;
thipCtxPushCurrent *hipCtxPushCurrent;
thipCtxPopCurrent *hipCtxPopCurrent;
thipCtxSetCurrent *hipCtxSetCurrent;
thipCtxGetCurrent *hipCtxGetCurrent;
thipCtxGetDevice *hipCtxGetDevice;
thipCtxGetFlags *hipCtxGetFlags;
thipCtxSynchronize *hipCtxSynchronize;
thipDeviceSynchronize *hipDeviceSynchronize;
thipCtxGetCacheConfig *hipCtxGetCacheConfig;
thipCtxSetCacheConfig *hipCtxSetCacheConfig;
thipCtxGetSharedMemConfig *hipCtxGetSharedMemConfig;
thipCtxSetSharedMemConfig *hipCtxSetSharedMemConfig;
thipCtxGetApiVersion *hipCtxGetApiVersion;
thipModuleLoad *hipModuleLoad;
thipModuleLoadData *hipModuleLoadData;
thipModuleLoadDataEx *hipModuleLoadDataEx;
thipModuleUnload *hipModuleUnload;
thipModuleGetFunction *hipModuleGetFunction;
thipModuleGetGlobal *hipModuleGetGlobal;
thipModuleGetTexRef *hipModuleGetTexRef;
thipMemGetInfo *hipMemGetInfo;
thipMalloc *hipMalloc;
thipMemAllocPitch *hipMemAllocPitch;
thipFree *hipFree;
thipMemGetAddressRange *hipMemGetAddressRange;
thipHostMalloc *hipHostMalloc;
thipHostFree *hipHostFree;
thipHostGetDevicePointer *hipHostGetDevicePointer;
thipHostGetFlags *hipHostGetFlags;
thipMallocManaged *hipMallocManaged;
thipDeviceGetByPCIBusId *hipDeviceGetByPCIBusId;
thipDeviceGetPCIBusId *hipDeviceGetPCIBusId;
thipMemcpyPeer *hipMemcpyPeer;
thipMemcpyHtoD *hipMemcpyHtoD;
thipMemcpyDtoH *hipMemcpyDtoH;
thipMemcpyDtoD *hipMemcpyDtoD;
thipDrvMemcpy2DUnaligned *hipDrvMemcpy2DUnaligned;
thipMemcpyParam2D *hipMemcpyParam2D;
thipDrvMemcpy3D *hipDrvMemcpy3D;
thipMemcpyHtoDAsync *hipMemcpyHtoDAsync;
thipMemcpyDtoHAsync *hipMemcpyDtoHAsync;
thipMemcpyParam2DAsync *hipMemcpyParam2DAsync;
thipDrvMemcpy3DAsync *hipDrvMemcpy3DAsync;
thipMemsetD8 *hipMemsetD8;
thipMemsetD16 *hipMemsetD16;
thipMemsetD32 *hipMemsetD32;
thipMemsetD8Async *hipMemsetD8Async;
thipMemsetD16Async *hipMemsetD16Async;
thipMemsetD32Async *hipMemsetD32Async;
thipArrayCreate *hipArrayCreate;
thipArrayDestroy *hipArrayDestroy;
thipArray3DCreate *hipArray3DCreate;
thipStreamCreateWithFlags *hipStreamCreateWithFlags;
thipStreamCreateWithPriority *hipStreamCreateWithPriority;
thipStreamGetPriority *hipStreamGetPriority;
thipStreamGetFlags *hipStreamGetFlags;
thipStreamWaitEvent *hipStreamWaitEvent;
thipStreamAddCallback *hipStreamAddCallback;
thipStreamQuery *hipStreamQuery;
thipStreamSynchronize *hipStreamSynchronize;
thipStreamDestroy *hipStreamDestroy;
thipEventCreateWithFlags *hipEventCreateWithFlags;
thipEventRecord *hipEventRecord;
thipEventQuery *hipEventQuery;
thipEventSynchronize *hipEventSynchronize;
thipEventDestroy *hipEventDestroy;
thipEventElapsedTime *hipEventElapsedTime;
thipFuncGetAttribute *hipFuncGetAttribute;
thipFuncSetCacheConfig *hipFuncSetCacheConfig;
thipModuleLaunchKernel *hipModuleLaunchKernel;
thipDrvOccupancyMaxActiveBlocksPerMultiprocessor *hipDrvOccupancyMaxActiveBlocksPerMultiprocessor;
thipDrvOccupancyMaxActiveBlocksPerMultiprocessorWithFlags *hipDrvOccupancyMaxActiveBlocksPerMultiprocessorWithFlags;
thipModuleOccupancyMaxPotentialBlockSize *hipModuleOccupancyMaxPotentialBlockSize;
thipTexRefSetArray *hipTexRefSetArray;
thipTexRefSetAddress *hipTexRefSetAddress;
thipTexRefSetAddress2D *hipTexRefSetAddress2D;
thipTexRefSetFormat *hipTexRefSetFormat;
thipTexRefSetAddressMode *hipTexRefSetAddressMode;
thipTexRefSetFilterMode *hipTexRefSetFilterMode;
thipTexRefSetFlags *hipTexRefSetFlags;
thipTexRefGetAddress *hipTexRefGetAddress;
thipTexRefGetArray *hipTexRefGetArray;
thipTexRefGetAddressMode *hipTexRefGetAddressMode;
thipTexObjectCreate *hipTexObjectCreate;
thipTexObjectDestroy *hipTexObjectDestroy;
thipDeviceCanAccessPeer *hipDeviceCanAccessPeer;
thipCtxEnablePeerAccess *hipCtxEnablePeerAccess;
thipCtxDisablePeerAccess *hipCtxDisablePeerAccess;
thipDeviceGetP2PAttribute *hipDeviceGetP2PAttribute;
thipGraphicsUnregisterResource *hipGraphicsUnregisterResource;
thipGraphicsMapResources *hipGraphicsMapResources;
thipGraphicsUnmapResources *hipGraphicsUnmapResources;
thipGraphicsResourceGetMappedPointer *hipGraphicsResourceGetMappedPointer;
thipGraphicsGLRegisterBuffer *hipGraphicsGLRegisterBuffer;
thipGLGetDevices *hipGLGetDevices;
thiprtcGetErrorString* hiprtcGetErrorString;
thiprtcAddNameExpression* hiprtcAddNameExpression;
thiprtcCompileProgram* hiprtcCompileProgram;
thiprtcCreateProgram* hiprtcCreateProgram;
thiprtcDestroyProgram* hiprtcDestroyProgram;
thiprtcGetLoweredName* hiprtcGetLoweredName;
thiprtcGetProgramLog* hiprtcGetProgramLog;
thiprtcGetProgramLogSize* hiprtcGetProgramLogSize;
thiprtcGetCode* hiprtcGetCode;
thiprtcGetCodeSize* hiprtcGetCodeSize;
static DynamicLibrary dynamic_library_open_find(const char **paths) {
int i = 0;
while (paths[i] != NULL) {
DynamicLibrary lib = dynamic_library_open(paths[i]);
if (lib != NULL) {
return lib;
}
++i;
}
return NULL;
}
/* Implementation function. */
static void hipewHipExit(void) {
if (hip_lib != NULL) {
/* Ignore errors. */
dynamic_library_close(hip_lib);
hip_lib = NULL;
}
}
#ifdef _WIN32
static int hipewHasOldDriver(const char *hip_path) {
DWORD verHandle = 0;
DWORD verSize = GetFileVersionInfoSize(hip_path, &verHandle);
int old_driver = 0;
if (verSize != 0) {
LPSTR verData = (LPSTR)malloc(verSize);
if (GetFileVersionInfo(hip_path, verHandle, verSize, verData)) {
LPBYTE lpBuffer = NULL;
UINT size = 0;
if (VerQueryValue(verData, "\\", (VOID FAR * FAR *)&lpBuffer, &size)) {
if (size) {
VS_FIXEDFILEINFO *verInfo = (VS_FIXEDFILEINFO *)lpBuffer;
/* Magic value from
* https://docs.microsoft.com/en-us/windows/win32/api/verrsrc/ns-verrsrc-vs_fixedfileinfo */
if (verInfo->dwSignature == 0xfeef04bd) {
unsigned int fileVersionLS0 = (verInfo->dwFileVersionLS >> 16) & 0xffff;
unsigned int fileversionLS1 = (verInfo->dwFileVersionLS >> 0) & 0xffff;
/* Corresponds to versions older than AMD Radeon Pro 21.Q4. */
old_driver = ((fileVersionLS0 < 3354) || (fileVersionLS0 == 3354 && fileversionLS1 < 13));
}
}
}
}
free(verData);
}
return old_driver;
}
#endif
static int hipewHipInit(void) {
/* Library paths. */
#ifdef _WIN32
/* Expected in c:/windows/system or similar, no path needed. */
const char *hip_paths[] = {"amdhip64.dll", NULL};
#elif defined(__APPLE__)
/* Default installation path. */
const char *hip_paths[] = {"", NULL};
#else
const char *hip_paths[] = {"/opt/rocm/hip/lib/libamdhip64.so", NULL};
#endif
static int initialized = 0;
static int result = 0;
int error, driver_version;
if (initialized) {
return result;
}
initialized = 1;
error = atexit(hipewHipExit);
if (error) {
result = HIPEW_ERROR_ATEXIT_FAILED;
return result;
}
#ifdef _WIN32
/* Test for driver version. */
if(hipewHasOldDriver(hip_paths[0])) {
result = HIPEW_ERROR_OLD_DRIVER;
return result;
}
#endif
/* Load library. */
hip_lib = dynamic_library_open_find(hip_paths);
if (hip_lib == NULL) {
result = HIPEW_ERROR_OPEN_FAILED;
return result;
}
/* Fetch all function pointers. */
HIP_LIBRARY_FIND_CHECKED(hipGetErrorName);
HIP_LIBRARY_FIND_CHECKED(hipInit);
HIP_LIBRARY_FIND_CHECKED(hipDriverGetVersion);
HIP_LIBRARY_FIND_CHECKED(hipGetDevice);
HIP_LIBRARY_FIND_CHECKED(hipGetDeviceCount);
HIP_LIBRARY_FIND_CHECKED(hipGetDeviceProperties);
HIP_LIBRARY_FIND_CHECKED(hipDeviceGet);
HIP_LIBRARY_FIND_CHECKED(hipDeviceGetName);
HIP_LIBRARY_FIND_CHECKED(hipDeviceGetAttribute);
HIP_LIBRARY_FIND_CHECKED(hipDeviceComputeCapability);
HIP_LIBRARY_FIND_CHECKED(hipDevicePrimaryCtxRetain);
HIP_LIBRARY_FIND_CHECKED(hipDevicePrimaryCtxRelease);
HIP_LIBRARY_FIND_CHECKED(hipDevicePrimaryCtxSetFlags);
HIP_LIBRARY_FIND_CHECKED(hipDevicePrimaryCtxGetState);
HIP_LIBRARY_FIND_CHECKED(hipDevicePrimaryCtxReset);
HIP_LIBRARY_FIND_CHECKED(hipCtxCreate);
HIP_LIBRARY_FIND_CHECKED(hipCtxDestroy);
HIP_LIBRARY_FIND_CHECKED(hipCtxPushCurrent);
HIP_LIBRARY_FIND_CHECKED(hipCtxPopCurrent);
HIP_LIBRARY_FIND_CHECKED(hipCtxSetCurrent);
HIP_LIBRARY_FIND_CHECKED(hipCtxGetCurrent);
HIP_LIBRARY_FIND_CHECKED(hipCtxGetDevice);
HIP_LIBRARY_FIND_CHECKED(hipCtxGetFlags);
HIP_LIBRARY_FIND_CHECKED(hipCtxSynchronize);
HIP_LIBRARY_FIND_CHECKED(hipDeviceSynchronize);
HIP_LIBRARY_FIND_CHECKED(hipCtxGetCacheConfig);
HIP_LIBRARY_FIND_CHECKED(hipCtxSetCacheConfig);
HIP_LIBRARY_FIND_CHECKED(hipCtxGetSharedMemConfig);
HIP_LIBRARY_FIND_CHECKED(hipCtxSetSharedMemConfig);
HIP_LIBRARY_FIND_CHECKED(hipCtxGetApiVersion);
HIP_LIBRARY_FIND_CHECKED(hipModuleLoad);
HIP_LIBRARY_FIND_CHECKED(hipModuleLoadData);
HIP_LIBRARY_FIND_CHECKED(hipModuleLoadDataEx);
HIP_LIBRARY_FIND_CHECKED(hipModuleUnload);
HIP_LIBRARY_FIND_CHECKED(hipModuleGetFunction);
HIP_LIBRARY_FIND_CHECKED(hipModuleGetGlobal);
HIP_LIBRARY_FIND_CHECKED(hipModuleGetTexRef);
HIP_LIBRARY_FIND_CHECKED(hipMemGetInfo);
HIP_LIBRARY_FIND_CHECKED(hipMalloc);
HIP_LIBRARY_FIND_CHECKED(hipMemAllocPitch);
HIP_LIBRARY_FIND_CHECKED(hipFree);
HIP_LIBRARY_FIND_CHECKED(hipMemGetAddressRange);
HIP_LIBRARY_FIND_CHECKED(hipHostMalloc);
HIP_LIBRARY_FIND_CHECKED(hipHostFree);
HIP_LIBRARY_FIND_CHECKED(hipHostGetDevicePointer);
HIP_LIBRARY_FIND_CHECKED(hipHostGetFlags);
HIP_LIBRARY_FIND_CHECKED(hipMallocManaged);
HIP_LIBRARY_FIND_CHECKED(hipDeviceGetByPCIBusId);
HIP_LIBRARY_FIND_CHECKED(hipDeviceGetPCIBusId);
HIP_LIBRARY_FIND_CHECKED(hipMemcpyPeer);
HIP_LIBRARY_FIND_CHECKED(hipMemcpyHtoD);
HIP_LIBRARY_FIND_CHECKED(hipMemcpyDtoH);
HIP_LIBRARY_FIND_CHECKED(hipMemcpyDtoD);
HIP_LIBRARY_FIND_CHECKED(hipMemcpyParam2D);
HIP_LIBRARY_FIND_CHECKED(hipDrvMemcpy3D);
HIP_LIBRARY_FIND_CHECKED(hipMemcpyHtoDAsync);
HIP_LIBRARY_FIND_CHECKED(hipMemcpyDtoHAsync);
HIP_LIBRARY_FIND_CHECKED(hipDrvMemcpy2DUnaligned);
HIP_LIBRARY_FIND_CHECKED(hipMemcpyParam2DAsync);
HIP_LIBRARY_FIND_CHECKED(hipDrvMemcpy3DAsync);
HIP_LIBRARY_FIND_CHECKED(hipMemsetD8);
HIP_LIBRARY_FIND_CHECKED(hipMemsetD16);
HIP_LIBRARY_FIND_CHECKED(hipMemsetD32);
HIP_LIBRARY_FIND_CHECKED(hipMemsetD8Async);
HIP_LIBRARY_FIND_CHECKED(hipMemsetD16Async);
HIP_LIBRARY_FIND_CHECKED(hipMemsetD32Async);
HIP_LIBRARY_FIND_CHECKED(hipArrayCreate);
HIP_LIBRARY_FIND_CHECKED(hipArrayDestroy);
HIP_LIBRARY_FIND_CHECKED(hipArray3DCreate);
HIP_LIBRARY_FIND_CHECKED(hipStreamCreateWithFlags);
HIP_LIBRARY_FIND_CHECKED(hipStreamCreateWithPriority);
HIP_LIBRARY_FIND_CHECKED(hipStreamGetPriority);
HIP_LIBRARY_FIND_CHECKED(hipStreamGetFlags);
HIP_LIBRARY_FIND_CHECKED(hipStreamWaitEvent);
HIP_LIBRARY_FIND_CHECKED(hipStreamAddCallback);
HIP_LIBRARY_FIND_CHECKED(hipStreamQuery);
HIP_LIBRARY_FIND_CHECKED(hipStreamSynchronize);
HIP_LIBRARY_FIND_CHECKED(hipStreamDestroy);
HIP_LIBRARY_FIND_CHECKED(hipEventCreateWithFlags);
HIP_LIBRARY_FIND_CHECKED(hipEventRecord);
HIP_LIBRARY_FIND_CHECKED(hipEventQuery);
HIP_LIBRARY_FIND_CHECKED(hipEventSynchronize);
HIP_LIBRARY_FIND_CHECKED(hipEventDestroy);
HIP_LIBRARY_FIND_CHECKED(hipEventElapsedTime);
HIP_LIBRARY_FIND_CHECKED(hipFuncGetAttribute);
HIP_LIBRARY_FIND_CHECKED(hipFuncSetCacheConfig);
HIP_LIBRARY_FIND_CHECKED(hipModuleLaunchKernel);
HIP_LIBRARY_FIND_CHECKED(hipModuleOccupancyMaxPotentialBlockSize);
HIP_LIBRARY_FIND_CHECKED(hipTexRefSetArray);
HIP_LIBRARY_FIND_CHECKED(hipTexRefSetAddress);
HIP_LIBRARY_FIND_CHECKED(hipTexRefSetAddress2D);
HIP_LIBRARY_FIND_CHECKED(hipTexRefSetFormat);
HIP_LIBRARY_FIND_CHECKED(hipTexRefSetAddressMode);
HIP_LIBRARY_FIND_CHECKED(hipTexRefSetFilterMode);
HIP_LIBRARY_FIND_CHECKED(hipTexRefSetFlags);
HIP_LIBRARY_FIND_CHECKED(hipTexRefGetAddress);
HIP_LIBRARY_FIND_CHECKED(hipTexRefGetAddressMode);
HIP_LIBRARY_FIND_CHECKED(hipTexObjectCreate);
HIP_LIBRARY_FIND_CHECKED(hipTexObjectDestroy);
HIP_LIBRARY_FIND_CHECKED(hipDeviceCanAccessPeer);
HIP_LIBRARY_FIND_CHECKED(hipCtxEnablePeerAccess);
HIP_LIBRARY_FIND_CHECKED(hipCtxDisablePeerAccess);
HIP_LIBRARY_FIND_CHECKED(hipDeviceGetP2PAttribute);
#ifdef _WIN32
HIP_LIBRARY_FIND_CHECKED(hipGraphicsUnregisterResource);
HIP_LIBRARY_FIND_CHECKED(hipGraphicsMapResources);
HIP_LIBRARY_FIND_CHECKED(hipGraphicsUnmapResources);
HIP_LIBRARY_FIND_CHECKED(hipGraphicsResourceGetMappedPointer);
HIP_LIBRARY_FIND_CHECKED(hipGraphicsGLRegisterBuffer);
HIP_LIBRARY_FIND_CHECKED(hipGLGetDevices);
#endif
HIP_LIBRARY_FIND_CHECKED(hiprtcGetErrorString);
HIP_LIBRARY_FIND_CHECKED(hiprtcAddNameExpression);
HIP_LIBRARY_FIND_CHECKED(hiprtcCompileProgram);
HIP_LIBRARY_FIND_CHECKED(hiprtcCreateProgram);
HIP_LIBRARY_FIND_CHECKED(hiprtcDestroyProgram);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetLoweredName);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetProgramLog);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetProgramLogSize);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetCode);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetCodeSize);
result = HIPEW_SUCCESS;
return result;
}
int hipewInit(hipuint32_t flags) {
int result = HIPEW_SUCCESS;
if (flags & HIPEW_INIT_HIP) {
result = hipewHipInit();
if (result != HIPEW_SUCCESS) {
return result;
}
}
return result;
}
const char *hipewErrorString(hipError_t result) {
switch (result) {
case hipSuccess: return "No errors";
case hipErrorInvalidValue: return "Invalid value";
case hipErrorOutOfMemory: return "Out of memory";
case hipErrorNotInitialized: return "Driver not initialized";
case hipErrorDeinitialized: return "Driver deinitialized";
case hipErrorProfilerDisabled: return "Profiler disabled";
case hipErrorProfilerNotInitialized: return "Profiler not initialized";
case hipErrorProfilerAlreadyStarted: return "Profiler already started";
case hipErrorProfilerAlreadyStopped: return "Profiler already stopped";
case hipErrorNoDevice: return "No HIP-capable device available";
case hipErrorInvalidDevice: return "Invalid device";
case hipErrorInvalidImage: return "Invalid kernel image";
case hipErrorInvalidContext: return "Invalid context";
case hipErrorContextAlreadyCurrent: return "Context already current";
case hipErrorMapFailed: return "Map failed";
case hipErrorUnmapFailed: return "Unmap failed";
case hipErrorArrayIsMapped: return "Array is mapped";
case hipErrorAlreadyMapped: return "Already mapped";
case hipErrorNoBinaryForGpu: return "No binary for GPU";
case hipErrorAlreadyAcquired: return "Already acquired";
case hipErrorNotMapped: return "Not mapped";
case hipErrorNotMappedAsArray: return "Mapped resource not available for access as an array";
case hipErrorNotMappedAsPointer: return "Mapped resource not available for access as a pointer";
case hipErrorECCNotCorrectable: return "Uncorrectable ECC error detected";
case hipErrorUnsupportedLimit: return "hipLimit_t not supported by device";
case hipErrorContextAlreadyInUse: return "Context already in use";
case hipErrorPeerAccessUnsupported: return "Peer access unsupported";
case hipErrorInvalidKernelFile: return "Invalid ptx";
case hipErrorInvalidGraphicsContext: return "Invalid graphics context";
case hipErrorInvalidSource: return "Invalid source";
case hipErrorFileNotFound: return "File not found";
case hipErrorSharedObjectSymbolNotFound: return "Link to a shared object failed to resolve";
case hipErrorSharedObjectInitFailed: return "Shared object initialization failed";
case hipErrorOperatingSystem: return "Operating system";
case hipErrorInvalidHandle: return "Invalid handle";
case hipErrorNotFound: return "Not found";
case hipErrorNotReady: return "HIP not ready";
case hipErrorIllegalAddress: return "Illegal address";
case hipErrorLaunchOutOfResources: return "Launch exceeded resources";
case hipErrorLaunchTimeOut: return "Launch exceeded timeout";
case hipErrorPeerAccessAlreadyEnabled: return "Peer access already enabled";
case hipErrorPeerAccessNotEnabled: return "Peer access not enabled";
case hipErrorSetOnActiveProcess: return "Primary context active";
case hipErrorAssert: return "Assert";
case hipErrorHostMemoryAlreadyRegistered: return "Host memory already registered";
case hipErrorHostMemoryNotRegistered: return "Host memory not registered";
case hipErrorLaunchFailure: return "Launch failed";
case hipErrorCooperativeLaunchTooLarge: return "Cooperative launch too large";
case hipErrorNotSupported: return "Not supported";
case hipErrorUnknown: return "Unknown error";
default: return "Unknown HIP error value";
}
}
static void path_join(const char *path1,
const char *path2,
int maxlen,
char *result) {
#if defined(WIN32) || defined(_WIN32)
const char separator = '\\';
#else
const char separator = '/';
#endif
int n = snprintf(result, maxlen, "%s%c%s", path1, separator, path2);
if (n != -1 && n < maxlen) {
result[n] = '\0';
}
else {
result[maxlen - 1] = '\0';
}
}
static int path_exists(const char *path) {
struct stat st;
if (stat(path, &st)) {
return 0;
}
return 1;
}
const char *hipewCompilerPath(void) {
#ifdef _WIN32
const char *hipPath = getenv("HIP_ROCCLR_HOME");
const char *windowsCommand = "perl ";
const char *executable = "bin/hipcc";
static char hipcc[65536];
static char finalCommand[65536];
if(hipPath) {
path_join(hipPath, executable, sizeof(hipcc), hipcc);
if(path_exists(hipcc)) {
snprintf(finalCommand, sizeof(hipcc), "%s %s", windowsCommand, hipcc);
return finalCommand;
} else {
printf("Could not find hipcc. Make sure HIP_ROCCLR_HOME points to the directory holding /bin/hipcc");
}
}
#else
const char *hipPath = "opt/rocm/hip/bin";
const char *executable = "hipcc";
static char hipcc[65536];
if(hipPath) {
path_join(hipPath, executable, sizeof(hipcc), hipcc);
if(path_exists(hipcc)){
return hipcc;
}
}
#endif
{
#ifdef _WIN32
FILE *handle = popen("where hipcc", "r");
#else
FILE *handle = popen("which hipcc", "r");
#endif
if (handle) {
char buffer[4096] = {0};
int len = fread(buffer, 1, sizeof(buffer) - 1, handle);
buffer[len] = '\0';
pclose(handle);
if (buffer[0]) {
return "hipcc";
}
}
}
return NULL;
}
int hipewCompilerVersion(void) {
const char *path = hipewCompilerPath();
const char *marker = "Hip compilation tools, release ";
FILE *pipe;
int major, minor;
char *versionstr;
char buf[128];
char output[65536] = "\0";
char command[65536] = "\0";
if (path == NULL) {
return 0;
}
/* get --version output */
strcat(command, "\"");
strncat(command, path, sizeof(command) - 1);
strncat(command, "\" --version", sizeof(command) - strlen(path) - 1);
pipe = popen(command, "r");
if (!pipe) {
fprintf(stderr, "HIP: failed to run compiler to retrieve version");
return 0;
}
while (!feof(pipe)) {
if (fgets(buf, sizeof(buf), pipe) != NULL) {
strncat(output, buf, sizeof(output) - strlen(output) - 1);
}
}
pclose(pipe);
return 40;
}

View File

@@ -1,5 +0,0 @@
Project: JSON
URL: https://github.com/nlohmann/json/
License: MIT License
Upstream version: 3.10.2
Local modifications: None

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
Project: NanoSVG Project: NanoSVG
URL: https://github.com/memononen/nanosvg URL: https://github.com/memononen/nanosvg
License: zlib License: zlib
Upstream version: 3cdd4a9d7886 Upstream version:
Local modifications: Added some functionality to manage grease pencil layers Local modifications: Added some functionality to manage grease pencil layers
Added a fix to SVG import arc and float errors (https://developer.blender.org/rB11dc674c78b49fc4e0b7c134c375b6c8b8eacbcc) Added a fix to SVG import arc and float errors (https://developer.blender.org/rB11dc674c78b49fc4e0b7c134c375b6c8b8eacbcc)

View File

@@ -574,8 +574,6 @@ Dbl2 AreaDiag::area(Dbl2 p1, Dbl2 p2, int left)
Dbl2 d = p2 - p1; Dbl2 d = p2 - p1;
if (d.x == 0.0) if (d.x == 0.0)
return Dbl2(0.0, 1.0); return Dbl2(0.0, 1.0);
if (d.y == 0.0)
return Dbl2(1.0, 0.0);
double x1 = (double)(1 + left); double x1 = (double)(1 + left);
double x2 = x1 + 1.0; double x2 = x1 + 1.0;

View File

@@ -1,6 +0,0 @@
Project: TinyGLTF
URL: https://github.com/syoyo/tinygltf
License: MIT
Upstream version: 2.5.0, 19a41d20ec0
Local modifications:
* Silence "enum value not handled in switch" warnings due to JSON dependency.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -247,7 +247,7 @@ if(WITH_CYCLES_OSL)
endif() endif()
if(WITH_CYCLES_DEVICE_OPTIX) if(WITH_CYCLES_DEVICE_OPTIX)
find_package(OptiX 7.3.0) find_package(OptiX)
if(OPTIX_FOUND) if(OPTIX_FOUND)
add_definitions(-DWITH_OPTIX) add_definitions(-DWITH_OPTIX)
@@ -286,14 +286,14 @@ if(WITH_OPENSUBDIV)
) )
endif() endif()
if(WITH_OPENIMAGEDENOISE) if(WITH_CYCLES_STANDALONE)
add_definitions(-DWITH_OPENIMAGEDENOISE) set(WITH_CYCLES_DEVICE_OPENCL TRUE)
add_definitions(-DOIDN_STATIC_LIB) set(WITH_CYCLES_DEVICE_CUDA TRUE)
include_directories( # Experimental and unfinished.
SYSTEM set(WITH_CYCLES_NETWORK FALSE)
${OPENIMAGEDENOISE_INCLUDE_DIRS}
)
endif() endif()
# TODO(sergey): Consider removing it, only causes confusion in interface.
set(WITH_CYCLES_DEVICE_MULTI TRUE)
# Logging capabilities using GLog library. # Logging capabilities using GLog library.
if(WITH_CYCLES_LOGGING) if(WITH_CYCLES_LOGGING)
@@ -386,15 +386,20 @@ if(WITH_CYCLES_BLENDER)
add_subdirectory(blender) add_subdirectory(blender)
endif() endif()
add_subdirectory(app) if(WITH_CYCLES_NETWORK)
add_definitions(-DWITH_NETWORK)
endif()
if(WITH_CYCLES_STANDALONE OR WITH_CYCLES_NETWORK OR WITH_CYCLES_CUBIN_COMPILER)
add_subdirectory(app)
endif()
add_subdirectory(bvh) add_subdirectory(bvh)
add_subdirectory(device) add_subdirectory(device)
add_subdirectory(doc) add_subdirectory(doc)
add_subdirectory(graph) add_subdirectory(graph)
add_subdirectory(integrator)
add_subdirectory(kernel) add_subdirectory(kernel)
add_subdirectory(scene) add_subdirectory(render)
add_subdirectory(session)
add_subdirectory(subd) add_subdirectory(subd)
add_subdirectory(util) add_subdirectory(util)

View File

@@ -25,8 +25,7 @@ set(INC_SYS
set(LIBRARIES set(LIBRARIES
cycles_device cycles_device
cycles_kernel cycles_kernel
cycles_scene cycles_render
cycles_session
cycles_bvh cycles_bvh
cycles_subd cycles_subd
cycles_graph cycles_graph
@@ -65,8 +64,6 @@ if(WITH_CYCLES_STANDALONE)
cycles_standalone.cpp cycles_standalone.cpp
cycles_xml.cpp cycles_xml.cpp
cycles_xml.h cycles_xml.h
oiio_output_driver.cpp
oiio_output_driver.h
) )
add_executable(cycles ${SRC} ${INC} ${INC_SYS}) add_executable(cycles ${SRC} ${INC} ${INC_SYS})
unset(SRC) unset(SRC)
@@ -76,7 +73,7 @@ if(WITH_CYCLES_STANDALONE)
if(APPLE) if(APPLE)
if(WITH_OPENCOLORIO) if(WITH_OPENCOLORIO)
set_property(TARGET cycles APPEND_STRING PROPERTY LINK_FLAGS " -framework IOKit -framework Carbon") set_property(TARGET cycles APPEND_STRING PROPERTY LINK_FLAGS " -framework IOKit")
endif() endif()
if(WITH_OPENIMAGEDENOISE AND "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64") if(WITH_OPENIMAGEDENOISE AND "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
# OpenImageDenoise uses BNNS from the Accelerate framework. # OpenImageDenoise uses BNNS from the Accelerate framework.
@@ -93,6 +90,24 @@ if(WITH_CYCLES_STANDALONE)
endif() endif()
endif() endif()
#####################################################################
# Cycles network server executable
#####################################################################
if(WITH_CYCLES_NETWORK)
set(SRC
cycles_server.cpp
)
add_executable(cycles_server ${SRC})
target_link_libraries(cycles_server ${LIBRARIES})
cycles_target_link_libraries(cycles_server)
if(UNIX AND NOT APPLE)
set_target_properties(cycles_server PROPERTIES INSTALL_RPATH $ORIGIN/lib)
endif()
unset(SRC)
endif()
##################################################################### #####################################################################
# Cycles cubin compiler executable # Cycles cubin compiler executable
##################################################################### #####################################################################

View File

@@ -18,13 +18,13 @@
#include "device/device.h" #include "device/device.h"
#include "util/args.h" #include "util/util_args.h"
#include "util/foreach.h" #include "util/util_foreach.h"
#include "util/log.h" #include "util/util_logging.h"
#include "util/path.h" #include "util/util_path.h"
#include "util/stats.h" #include "util/util_stats.h"
#include "util/string.h" #include "util/util_string.h"
#include "util/task.h" #include "util/util_task.h"
using namespace ccl; using namespace ccl;

View File

@@ -17,30 +17,27 @@
#include <stdio.h> #include <stdio.h>
#include "device/device.h" #include "device/device.h"
#include "scene/camera.h" #include "render/buffers.h"
#include "scene/integrator.h" #include "render/camera.h"
#include "scene/scene.h" #include "render/integrator.h"
#include "session/buffers.h" #include "render/scene.h"
#include "session/session.h" #include "render/session.h"
#include "util/args.h" #include "util/util_args.h"
#include "util/foreach.h" #include "util/util_foreach.h"
#include "util/function.h" #include "util/util_function.h"
#include "util/image.h" #include "util/util_image.h"
#include "util/log.h" #include "util/util_logging.h"
#include "util/path.h" #include "util/util_path.h"
#include "util/progress.h" #include "util/util_progress.h"
#include "util/string.h" #include "util/util_string.h"
#include "util/time.h" #include "util/util_time.h"
#include "util/transform.h" #include "util/util_transform.h"
#include "util/unique_ptr.h" #include "util/util_unique_ptr.h"
#include "util/version.h" #include "util/util_version.h"
#include "app/cycles_xml.h"
#include "app/oiio_output_driver.h"
#ifdef WITH_CYCLES_STANDALONE_GUI #ifdef WITH_CYCLES_STANDALONE_GUI
# include "util/view.h" # include "util/util_view.h"
#endif #endif
#include "app/cycles_xml.h" #include "app/cycles_xml.h"
@@ -56,8 +53,7 @@ struct Options {
SessionParams session_params; SessionParams session_params;
bool quiet; bool quiet;
bool show_help, interactive, pause; bool show_help, interactive, pause;
string output_filepath; string output_path;
string output_pass;
} options; } options;
static void session_print(const string &str) static void session_print(const string &str)
@@ -82,7 +78,7 @@ static void session_print_status()
string status, substatus; string status, substatus;
/* get status */ /* get status */
double progress = options.session->progress.get_progress(); float progress = options.session->progress.get_progress();
options.session->progress.get_status(status, substatus); options.session->progress.get_status(status, substatus);
if (substatus != "") if (substatus != "")
@@ -93,6 +89,30 @@ static void session_print_status()
session_print(status); session_print(status);
} }
static bool write_render(const uchar *pixels, int w, int h, int channels)
{
string msg = string_printf("Writing image %s", options.output_path.c_str());
session_print(msg);
unique_ptr<ImageOutput> out = unique_ptr<ImageOutput>(ImageOutput::create(options.output_path));
if (!out) {
return false;
}
ImageSpec spec(w, h, channels, TypeDesc::UINT8);
if (!out->open(options.output_path, spec)) {
return false;
}
/* conversion for different top/bottom convention */
out->write_image(
TypeDesc::UINT8, pixels + (h - 1) * w * channels, AutoStride, -w * channels, AutoStride);
out->close();
return true;
}
static BufferParams &session_buffer_params() static BufferParams &session_buffer_params()
{ {
static BufferParams buffer_params; static BufferParams buffer_params;
@@ -106,7 +126,7 @@ static BufferParams &session_buffer_params()
static void scene_init() static void scene_init()
{ {
options.scene = options.session->scene; options.scene = new Scene(options.scene_params, options.session->device);
/* Read XML */ /* Read XML */
xml_read_file(options.scene, options.filepath.c_str()); xml_read_file(options.scene, options.filepath.c_str());
@@ -127,13 +147,8 @@ static void scene_init()
static void session_init() static void session_init()
{ {
options.output_pass = "combined"; options.session_params.write_render_cb = write_render;
options.session = new Session(options.session_params, options.scene_params); options.session = new Session(options.session_params);
if (!options.output_filepath.empty()) {
options.session->set_output_driver(make_unique<OIIOOutputDriver>(
options.output_filepath, options.output_pass, session_print));
}
if (options.session_params.background && !options.quiet) if (options.session_params.background && !options.quiet)
options.session->progress.set_update_callback(function_bind(&session_print_status)); options.session->progress.set_update_callback(function_bind(&session_print_status));
@@ -144,13 +159,9 @@ static void session_init()
/* load scene */ /* load scene */
scene_init(); scene_init();
options.session->scene = options.scene;
/* add pass for output. */ options.session->reset(session_buffer_params(), options.session_params.samples);
Pass *pass = options.scene->create_node<Pass>();
pass->set_name(ustring(options.output_pass.c_str()));
pass->set_type(PASS_COMBINED);
options.session->reset(options.session_params, session_buffer_params());
options.session->start(); options.session->start();
} }
@@ -183,7 +194,7 @@ static void display_info(Progress &progress)
progress.get_time(total_time, sample_time); progress.get_time(total_time, sample_time);
progress.get_status(status, substatus); progress.get_status(status, substatus);
double progress_val = progress.get_progress(); float progress_val = progress.get_progress();
if (substatus != "") if (substatus != "")
status += ": " + substatus; status += ": " + substatus;
@@ -212,7 +223,9 @@ static void display_info(Progress &progress)
static void display() static void display()
{ {
options.session->draw(); static DeviceDrawParams draw_params = DeviceDrawParams();
options.session->draw(session_buffer_params(), draw_params);
display_info(options.session->progress); display_info(options.session->progress);
} }
@@ -242,7 +255,7 @@ static void motion(int x, int y, int button)
options.session->scene->camera->need_flags_update = true; options.session->scene->camera->need_flags_update = true;
options.session->scene->camera->need_device_update = true; options.session->scene->camera->need_device_update = true;
options.session->reset(options.session_params, session_buffer_params()); options.session->reset(session_buffer_params(), options.session_params.samples);
} }
} }
@@ -259,7 +272,7 @@ static void resize(int width, int height)
options.session->scene->camera->need_flags_update = true; options.session->scene->camera->need_flags_update = true;
options.session->scene->camera->need_device_update = true; options.session->scene->camera->need_device_update = true;
options.session->reset(options.session_params, session_buffer_params()); options.session->reset(session_buffer_params(), options.session_params.samples);
} }
} }
@@ -271,7 +284,7 @@ static void keyboard(unsigned char key)
/* Reset */ /* Reset */
else if (key == 'r') else if (key == 'r')
options.session->reset(options.session_params, session_buffer_params()); options.session->reset(session_buffer_params(), options.session_params.samples);
/* Cancel */ /* Cancel */
else if (key == 27) // escape else if (key == 27) // escape
@@ -308,7 +321,7 @@ static void keyboard(unsigned char key)
options.session->scene->camera->need_flags_update = true; options.session->scene->camera->need_flags_update = true;
options.session->scene->camera->need_device_update = true; options.session->scene->camera->need_device_update = true;
options.session->reset(options.session_params, session_buffer_params()); options.session->reset(session_buffer_params(), options.session_params.samples);
} }
/* Set Max Bounces */ /* Set Max Bounces */
@@ -334,7 +347,7 @@ static void keyboard(unsigned char key)
options.session->scene->integrator->set_max_bounce(bounce); options.session->scene->integrator->set_max_bounce(bounce);
options.session->reset(options.session_params, session_buffer_params()); options.session->reset(session_buffer_params(), options.session_params.samples);
} }
} }
#endif #endif
@@ -349,13 +362,11 @@ static int files_parse(int argc, const char *argv[])
static void options_parse(int argc, const char **argv) static void options_parse(int argc, const char **argv)
{ {
options.width = 1024; options.width = 0;
options.height = 512; options.height = 0;
options.filepath = ""; options.filepath = "";
options.session = NULL; options.session = NULL;
options.quiet = false; options.quiet = false;
options.session_params.use_auto_tile = false;
options.session_params.tile_size = 0;
/* device names */ /* device names */
string device_names = ""; string device_names = "";
@@ -401,7 +412,7 @@ static void options_parse(int argc, const char **argv)
&options.session_params.samples, &options.session_params.samples,
"Number of samples to render", "Number of samples to render",
"--output %s", "--output %s",
&options.output_filepath, &options.output_path,
"File path to write output image", "File path to write output image",
"--threads %d", "--threads %d",
&options.session_params.threads, &options.session_params.threads,
@@ -412,9 +423,12 @@ static void options_parse(int argc, const char **argv)
"--height %d", "--height %d",
&options.height, &options.height,
"Window height in pixel", "Window height in pixel",
"--tile-size %d", "--tile-width %d",
&options.session_params.tile_size, &options.session_params.tile_size.x,
"Tile size in pixels", "Tile width in pixels",
"--tile-height %d",
&options.session_params.tile_size.y,
"Tile height in pixels",
"--list-devices", "--list-devices",
&list, &list,
"List information about all available devices", "List information about all available devices",
@@ -476,9 +490,8 @@ static void options_parse(int argc, const char **argv)
options.session_params.background = true; options.session_params.background = true;
#endif #endif
if (options.session_params.tile_size > 0) { /* Use progressive rendering */
options.session_params.use_auto_tile = true; options.session_params.progressive = true;
}
/* find matching device */ /* find matching device */
DeviceType device_type = Device::type_from_string(devicename.c_str()); DeviceType device_type = Device::type_from_string(devicename.c_str());
@@ -514,6 +527,9 @@ static void options_parse(int argc, const char **argv)
fprintf(stderr, "No file path specified\n"); fprintf(stderr, "No file path specified\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/* For smoother Viewport */
options.session_params.start_resolution = 64;
} }
CCL_NAMESPACE_END CCL_NAMESPACE_END

View File

@@ -22,27 +22,27 @@
#include "graph/node_xml.h" #include "graph/node_xml.h"
#include "scene/background.h" #include "render/background.h"
#include "scene/camera.h" #include "render/camera.h"
#include "scene/film.h" #include "render/film.h"
#include "scene/integrator.h" #include "render/graph.h"
#include "scene/light.h" #include "render/integrator.h"
#include "scene/mesh.h" #include "render/light.h"
#include "scene/object.h" #include "render/mesh.h"
#include "scene/osl.h" #include "render/nodes.h"
#include "scene/scene.h" #include "render/object.h"
#include "scene/shader.h" #include "render/osl.h"
#include "scene/shader_graph.h" #include "render/scene.h"
#include "scene/shader_nodes.h" #include "render/shader.h"
#include "subd/patch.h" #include "subd/subd_patch.h"
#include "subd/split.h" #include "subd/subd_split.h"
#include "util/foreach.h" #include "util/util_foreach.h"
#include "util/path.h" #include "util/util_path.h"
#include "util/projection.h" #include "util/util_projection.h"
#include "util/transform.h" #include "util/util_transform.h"
#include "util/xml.h" #include "util/util_xml.h"
#include "app/cycles_xml.h" #include "app/cycles_xml.h"
@@ -333,7 +333,6 @@ static void xml_read_shader_graph(XMLReadState &state, Shader *shader, xml_node
} }
snode = (ShaderNode *)node_type->create(node_type); snode = (ShaderNode *)node_type->create(node_type);
snode->set_owner(graph);
} }
xml_read_node(graph_reader, snode, node); xml_read_node(graph_reader, snode, node);
@@ -704,7 +703,7 @@ void xml_read_file(Scene *scene, const char *filepath)
xml_read_include(state, path_filename(filepath)); xml_read_include(state, path_filename(filepath));
scene->params.bvh_type = BVH_TYPE_STATIC; scene->params.bvh_type = SceneParams::BVH_STATIC;
} }
CCL_NAMESPACE_END CCL_NAMESPACE_END

View File

@@ -1,71 +0,0 @@
/*
* Copyright 2021 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "app/oiio_output_driver.h"
CCL_NAMESPACE_BEGIN
OIIOOutputDriver::OIIOOutputDriver(const string_view filepath,
const string_view pass,
LogFunction log)
: filepath_(filepath), pass_(pass), log_(log)
{
}
OIIOOutputDriver::~OIIOOutputDriver()
{
}
void OIIOOutputDriver::write_render_tile(const Tile &tile)
{
/* Only write the full buffer, no intermediate tiles. */
if (!(tile.size == tile.full_size)) {
return;
}
log_(string_printf("Writing image %s", filepath_.c_str()));
unique_ptr<ImageOutput> image_output(ImageOutput::create(filepath_));
if (image_output == nullptr) {
log_("Failed to create image file");
return;
}
const int width = tile.size.x;
const int height = tile.size.y;
ImageSpec spec(width, height, 4, TypeDesc::FLOAT);
if (!image_output->open(filepath_, spec)) {
log_("Failed to create image file");
return;
}
vector<float> pixels(width * height * 4);
if (!tile.get_pass_pixels(pass_, 4, pixels.data())) {
log_("Failed to read render pass pixels");
return;
}
/* Manipulate offset and stride to convert from bottom-up to top-down convention. */
image_output->write_image(TypeDesc::FLOAT,
pixels.data() + (height - 1) * width * 4,
AutoStride,
-width * 4 * sizeof(float),
AutoStride);
image_output->close();
}
CCL_NAMESPACE_END

View File

@@ -1,42 +0,0 @@
/*
* Copyright 2021 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "session/output_driver.h"
#include "util/function.h"
#include "util/image.h"
#include "util/string.h"
#include "util/unique_ptr.h"
#include "util/vector.h"
CCL_NAMESPACE_BEGIN
class OIIOOutputDriver : public OutputDriver {
public:
typedef function<void(const string &)> LogFunction;
OIIOOutputDriver(const string_view filepath, const string_view pass, LogFunction log);
virtual ~OIIOOutputDriver();
void write_render_tile(const Tile &tile) override;
protected:
string filepath_;
string pass_;
LogFunction log_;
};
CCL_NAMESPACE_END

View File

@@ -29,39 +29,35 @@ set(INC_SYS
) )
set(SRC set(SRC
camera.cpp blender_camera.cpp
device.cpp blender_device.cpp
display_driver.cpp blender_image.cpp
image.cpp blender_geometry.cpp
geometry.cpp blender_light.cpp
light.cpp blender_mesh.cpp
mesh.cpp blender_object.cpp
object.cpp blender_object_cull.cpp
object_cull.cpp blender_particles.cpp
output_driver.cpp blender_curves.cpp
particles.cpp blender_logging.cpp
curves.cpp blender_python.cpp
logging.cpp blender_session.cpp
python.cpp blender_shader.cpp
session.cpp blender_sync.cpp
shader.cpp blender_texture.cpp
sync.cpp blender_viewport.cpp
texture.cpp blender_volume.cpp
viewport.cpp
volume.cpp
CCL_api.h CCL_api.h
device.h blender_device.h
display_driver.h blender_id_map.h
id_map.h blender_image.h
image.h blender_object_cull.h
object_cull.h blender_sync.h
output_driver.h blender_session.h
sync.h blender_texture.h
session.h blender_util.h
texture.h blender_viewport.h
util.h
viewport.h
) )
set(LIB set(LIB
@@ -69,8 +65,7 @@ set(LIB
cycles_device cycles_device
cycles_graph cycles_graph
cycles_kernel cycles_kernel
cycles_scene cycles_render
cycles_session
cycles_subd cycles_subd
cycles_util cycles_util
@@ -98,9 +93,14 @@ set(ADDON_FILES
add_definitions(${GL_DEFINITIONS}) add_definitions(${GL_DEFINITIONS})
if(WITH_CYCLES_DEVICE_HIP) if(WITH_CYCLES_DEVICE_OPENCL)
add_definitions(-DWITH_HIP) add_definitions(-DWITH_OPENCL)
endif() endif()
if(WITH_CYCLES_NETWORK)
add_definitions(-DWITH_NETWORK)
endif()
if(WITH_MOD_FLUID) if(WITH_MOD_FLUID)
add_definitions(-DWITH_FLUID) add_definitions(-DWITH_FLUID)
endif() endif()

View File

@@ -58,6 +58,7 @@ class CyclesRender(bpy.types.RenderEngine):
bl_use_eevee_viewport = True bl_use_eevee_viewport = True
bl_use_preview = True bl_use_preview = True
bl_use_exclude_layers = True bl_use_exclude_layers = True
bl_use_save_buffers = True
bl_use_spherical_stereo = True bl_use_spherical_stereo = True
bl_use_custom_freestyle = True bl_use_custom_freestyle = True
bl_use_alembic_procedural = True bl_use_alembic_procedural = True
@@ -84,12 +85,6 @@ class CyclesRender(bpy.types.RenderEngine):
def render(self, depsgraph): def render(self, depsgraph):
engine.render(self, depsgraph) engine.render(self, depsgraph)
def render_frame_finish(self):
engine.render_frame_finish(self)
def draw(self, context, depsgraph):
engine.draw(self, depsgraph, context.space_data)
def bake(self, depsgraph, obj, pass_type, pass_filter, width, height): def bake(self, depsgraph, obj, pass_type, pass_filter, width, height):
engine.bake(self, depsgraph, obj, pass_type, pass_filter, width, height) engine.bake(self, depsgraph, obj, pass_type, pass_filter, width, height)
@@ -103,7 +98,7 @@ class CyclesRender(bpy.types.RenderEngine):
engine.sync(self, depsgraph, context.blend_data) engine.sync(self, depsgraph, context.blend_data)
def view_draw(self, context, depsgraph): def view_draw(self, context, depsgraph):
engine.view_draw(self, depsgraph, context.region, context.space_data, context.region_data) engine.draw(self, depsgraph, context.region, context.space_data, context.region_data)
def update_script_node(self, node): def update_script_node(self, node):
if engine.with_osl(): if engine.with_osl():

View File

@@ -18,17 +18,62 @@
from __future__ import annotations from __future__ import annotations
def _is_using_buggy_driver():
import gpu
# We need to be conservative here because in multi-GPU systems display card
# might be quite old, but others one might be just good.
#
# So We shouldn't disable possible good dedicated cards just because display
# card seems weak. And instead we only blacklist configurations which are
# proven to cause problems.
if gpu.platform.vendor_get() == "ATI Technologies Inc.":
import re
version = gpu.platform.version_get()
if version.endswith("Compatibility Profile Context"):
# Old HD 4xxx and 5xxx series drivers did not have driver version
# in the version string, but those cards do not quite work and
# causing crashes.
return True
regex = re.compile(".*Compatibility Profile Context ([0-9]+(\\.[0-9]+)+)$")
if not regex.match(version):
# Skip cards like FireGL
return False
version = regex.sub("\\1", version).split('.')
return int(version[0]) == 8
return False
def _workaround_buggy_drivers():
if _is_using_buggy_driver():
import _cycles
if hasattr(_cycles, "opencl_disable"):
print("Cycles: OpenGL driver known to be buggy, disabling OpenCL platform.")
_cycles.opencl_disable()
def _configure_argument_parser(): def _configure_argument_parser():
import argparse import argparse
# No help because it conflicts with general Python scripts argument parsing # No help because it conflicts with general Python scripts argument parsing
parser = argparse.ArgumentParser(description="Cycles Addon argument parser", parser = argparse.ArgumentParser(description="Cycles Addon argument parser",
add_help=False) add_help=False)
parser.add_argument("--cycles-resumable-num-chunks",
help="Number of chunks to split sample range into",
default=None)
parser.add_argument("--cycles-resumable-current-chunk",
help="Current chunk of samples range to render",
default=None)
parser.add_argument("--cycles-resumable-start-chunk",
help="Start chunk to render",
default=None)
parser.add_argument("--cycles-resumable-end-chunk",
help="End chunk to render",
default=None)
parser.add_argument("--cycles-print-stats", parser.add_argument("--cycles-print-stats",
help="Print rendering statistics to stderr", help="Print rendering statistics to stderr",
action='store_true') action='store_true')
parser.add_argument("--cycles-device", parser.add_argument("--cycles-device",
help="Set the device to use for Cycles, overriding user preferences and the scene setting." help="Set the device to use for Cycles, overriding user preferences and the scene setting."
"Valid options are 'CPU', 'CUDA', 'OPTIX', or 'HIP'" "Valid options are 'CPU', 'CUDA', 'OPTIX' or 'OPENCL'."
"Additionally, you can append '+CPU' to any GPU type for hybrid rendering.", "Additionally, you can append '+CPU' to any GPU type for hybrid rendering.",
default=None) default=None)
return parser return parser
@@ -44,6 +89,21 @@ def _parse_command_line():
parser = _configure_argument_parser() parser = _configure_argument_parser()
args, _ = parser.parse_known_args(argv[argv.index("--") + 1:]) args, _ = parser.parse_known_args(argv[argv.index("--") + 1:])
if args.cycles_resumable_num_chunks is not None:
if args.cycles_resumable_current_chunk is not None:
import _cycles
_cycles.set_resumable_chunk(
int(args.cycles_resumable_num_chunks),
int(args.cycles_resumable_current_chunk),
)
elif args.cycles_resumable_start_chunk is not None and \
args.cycles_resumable_end_chunk:
import _cycles
_cycles.set_resumable_chunk_range(
int(args.cycles_resumable_num_chunks),
int(args.cycles_resumable_start_chunk),
int(args.cycles_resumable_end_chunk),
)
if args.cycles_print_stats: if args.cycles_print_stats:
import _cycles import _cycles
_cycles.enable_print_stats() _cycles.enable_print_stats()
@@ -58,11 +118,23 @@ def init():
import _cycles import _cycles
import os.path import os.path
# Workaround possibly buggy legacy drivers which crashes on the OpenCL
# device enumeration.
#
# This checks are not really correct because they might still fail
# in the case of multiple GPUs. However, currently buggy drivers
# are really old and likely to be used in single GPU systems only
# anyway.
#
# Can't do it in the background mode, so we hope OpenCL is no enabled
# in the user preferences.
if not bpy.app.background:
_workaround_buggy_drivers()
path = os.path.dirname(__file__) path = os.path.dirname(__file__)
user_path = os.path.dirname(os.path.abspath(bpy.utils.user_resource('CONFIG', path=''))) user_path = os.path.dirname(os.path.abspath(bpy.utils.user_resource('CONFIG', path='')))
temp_path = bpy.app.tempdir
_cycles.init(path, user_path, temp_path, bpy.app.background) _cycles.init(path, user_path, bpy.app.background)
_parse_command_line() _parse_command_line()
@@ -105,25 +177,6 @@ def render(engine, depsgraph):
_cycles.render(engine.session, depsgraph.as_pointer()) _cycles.render(engine.session, depsgraph.as_pointer())
def render_frame_finish(engine):
if not engine.session:
return
import _cycles
_cycles.render_frame_finish(engine.session)
def draw(engine, depsgraph, space_image):
if not engine.session:
return
depsgraph_ptr = depsgraph.as_pointer()
space_image_ptr = space_image.as_pointer()
screen_ptr = space_image.id_data.as_pointer()
import _cycles
_cycles.draw(engine.session, depsgraph_ptr, screen_ptr, space_image_ptr)
def bake(engine, depsgraph, obj, pass_type, pass_filter, width, height): def bake(engine, depsgraph, obj, pass_type, pass_filter, width, height):
import _cycles import _cycles
session = getattr(engine, "session", None) session = getattr(engine, "session", None)
@@ -151,14 +204,14 @@ def sync(engine, depsgraph, data):
_cycles.sync(engine.session, depsgraph.as_pointer()) _cycles.sync(engine.session, depsgraph.as_pointer())
def view_draw(engine, depsgraph, region, v3d, rv3d): def draw(engine, depsgraph, region, v3d, rv3d):
import _cycles import _cycles
depsgraph = depsgraph.as_pointer() depsgraph = depsgraph.as_pointer()
v3d = v3d.as_pointer() v3d = v3d.as_pointer()
rv3d = rv3d.as_pointer() rv3d = rv3d.as_pointer()
# draw render image # draw render image
_cycles.view_draw(engine.session, depsgraph, v3d, rv3d) _cycles.draw(engine.session, depsgraph, v3d, rv3d)
def available_devices(): def available_devices():
@@ -171,6 +224,11 @@ def with_osl():
return _cycles.with_osl return _cycles.with_osl
def with_network():
import _cycles
return _cycles.with_network
def system_info(): def system_info():
import _cycles import _cycles
return _cycles.system_info() return _cycles.system_info()
@@ -185,7 +243,6 @@ def list_render_passes(scene, srl):
# Data passes. # Data passes.
if srl.use_pass_z: yield ("Depth", "Z", 'VALUE') if srl.use_pass_z: yield ("Depth", "Z", 'VALUE')
if srl.use_pass_mist: yield ("Mist", "Z", 'VALUE') if srl.use_pass_mist: yield ("Mist", "Z", 'VALUE')
if srl.use_pass_position: yield ("Position", "XYZ", 'VECTOR')
if srl.use_pass_normal: yield ("Normal", "XYZ", 'VECTOR') if srl.use_pass_normal: yield ("Normal", "XYZ", 'VECTOR')
if srl.use_pass_vector: yield ("Vector", "XYZW", 'VECTOR') if srl.use_pass_vector: yield ("Vector", "XYZW", 'VECTOR')
if srl.use_pass_uv: yield ("UV", "UVA", 'VECTOR') if srl.use_pass_uv: yield ("UV", "UVA", 'VECTOR')
@@ -208,9 +265,9 @@ def list_render_passes(scene, srl):
if srl.use_pass_environment: yield ("Env", "RGB", 'COLOR') if srl.use_pass_environment: yield ("Env", "RGB", 'COLOR')
if srl.use_pass_shadow: yield ("Shadow", "RGB", 'COLOR') if srl.use_pass_shadow: yield ("Shadow", "RGB", 'COLOR')
if srl.use_pass_ambient_occlusion: yield ("AO", "RGB", 'COLOR') if srl.use_pass_ambient_occlusion: yield ("AO", "RGB", 'COLOR')
if crl.use_pass_shadow_catcher: yield ("Shadow Catcher", "RGB", 'COLOR')
# Debug passes. # Debug passes.
if crl.pass_debug_render_time: yield ("Debug Render Time", "X", 'VALUE')
if crl.pass_debug_sample_count: yield ("Debug Sample Count", "X", 'VALUE') if crl.pass_debug_sample_count: yield ("Debug Sample Count", "X", 'VALUE')
# Cryptomatte passes. # Cryptomatte passes.
@@ -226,21 +283,30 @@ def list_render_passes(scene, srl):
yield ("CryptoAsset" + '{:02d}'.format(i), "RGBA", 'COLOR') yield ("CryptoAsset" + '{:02d}'.format(i), "RGBA", 'COLOR')
# Denoising passes. # Denoising passes.
if scene.cycles.use_denoising and crl.use_denoising: if (scene.cycles.use_denoising and crl.use_denoising) or crl.denoising_store_passes:
yield ("Noisy Image", "RGBA", 'COLOR') yield ("Noisy Image", "RGBA", 'COLOR')
if crl.use_pass_shadow_catcher: if crl.denoising_store_passes:
yield ("Noisy Shadow Catcher", "RGBA", 'COLOR') yield ("Denoising Normal", "XYZ", 'VECTOR')
if crl.denoising_store_passes: yield ("Denoising Albedo", "RGB", 'COLOR')
yield ("Denoising Normal", "XYZ", 'VECTOR') yield ("Denoising Depth", "Z", 'VALUE')
yield ("Denoising Albedo", "RGB", 'COLOR')
yield ("Denoising Depth", "Z", 'VALUE') if scene.cycles.denoiser == 'NLM':
yield ("Denoising Shadowing", "X", 'VALUE')
yield ("Denoising Variance", "RGB", 'COLOR')
yield ("Denoising Intensity", "X", 'VALUE')
clean_options = ("denoising_diffuse_direct", "denoising_diffuse_indirect",
"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 srl.aovs: for aov in srl.aovs:
if aov.type == 'VALUE': if aov.type == 'VALUE':
yield (aov.name, "X", 'VALUE') yield (aov.name, "X", 'VALUE')
else: else:
yield (aov.name, "RGB", 'COLOR') yield (aov.name, "RGBA", 'COLOR')
def register_passes(engine, scene, view_layer): def register_passes(engine, scene, view_layer):

View File

@@ -40,10 +40,10 @@ class AddPresetIntegrator(AddPresetBase, Operator):
"cycles.transparent_max_bounces", "cycles.transparent_max_bounces",
"cycles.caustics_reflective", "cycles.caustics_reflective",
"cycles.caustics_refractive", "cycles.caustics_refractive",
"cycles.blur_glossy", "cycles.blur_glossy"
"cycles.use_fast_gi", "cycles.use_fast_gi"
"cycles.ao_bounces", "cycles.ao_bounces"
"cycles.ao_bounces_render", "cycles.ao_bounces_render"
] ]
preset_subdir = "cycles/integrator" preset_subdir = "cycles/integrator"
@@ -60,48 +60,32 @@ class AddPresetSampling(AddPresetBase, Operator):
] ]
preset_values = [ preset_values = [
"cycles.use_adaptive_sampling",
"cycles.samples", "cycles.samples",
"cycles.adaptive_threshold", "cycles.preview_samples",
"cycles.adaptive_min_samples", "cycles.aa_samples",
"cycles.time_limit", "cycles.preview_aa_samples",
"cycles.use_denoising", "cycles.diffuse_samples",
"cycles.denoiser", "cycles.glossy_samples",
"cycles.denoising_input_passes", "cycles.transmission_samples",
"cycles.denoising_prefilter", "cycles.ao_samples",
"cycles.mesh_light_samples",
"cycles.subsurface_samples",
"cycles.volume_samples",
"cycles.use_square_samples",
"cycles.progressive",
"cycles.seed",
"cycles.sample_clamp_direct",
"cycles.sample_clamp_indirect",
"cycles.sample_all_lights_direct",
"cycles.sample_all_lights_indirect",
] ]
preset_subdir = "cycles/sampling" preset_subdir = "cycles/sampling"
class AddPresetViewportSampling(AddPresetBase, Operator):
'''Add a Viewport Sampling Preset'''
bl_idname = "render.cycles_viewport_sampling_preset_add"
bl_label = "Add Viewport Sampling Preset"
preset_menu = "CYCLES_PT_viewport_sampling_presets"
preset_defines = [
"cycles = bpy.context.scene.cycles"
]
preset_values = [
"cycles.use_preview_adaptive_sampling",
"cycles.preview_samples",
"cycles.preview_adaptive_threshold",
"cycles.preview_adaptive_min_samples",
"cycles.use_preview_denoising",
"cycles.preview_denoiser",
"cycles.preview_denoising_input_passes",
"cycles.preview_denoising_prefilter",
"cycles.preview_denoising_start_sample",
]
preset_subdir = "cycles/viewport_sampling"
classes = ( classes = (
AddPresetIntegrator, AddPresetIntegrator,
AddPresetSampling, AddPresetSampling,
AddPresetViewportSampling,
) )

View File

@@ -39,6 +39,11 @@ enum_devices = (
('GPU', "GPU Compute", "Use GPU compute device for rendering, configured in the system tab in the user preferences"), ('GPU', "GPU Compute", "Use GPU compute device for rendering, configured in the system tab in the user preferences"),
) )
from _cycles import with_network
if with_network:
enum_devices += (('NETWORK', "Networked Device", "Use networked device for rendering"),)
del with_network
enum_feature_set = ( enum_feature_set = (
('SUPPORTED', "Supported", "Only use finished and supported features"), ('SUPPORTED', "Supported", "Only use finished and supported features"),
('EXPERIMENTAL', "Experimental", "Use experimental and incomplete features that might be broken or change in the future", 'ERROR', 1), ('EXPERIMENTAL', "Experimental", "Use experimental and incomplete features that might be broken or change in the future", 'ERROR', 1),
@@ -79,6 +84,15 @@ enum_curve_shape = (
('THICK', "3D Curves", "Render hair as 3D curve, for accurate results when viewing hair close up"), ('THICK', "3D Curves", "Render hair as 3D curve, for accurate results when viewing hair close up"),
) )
enum_tile_order = (
('CENTER', "Center", "Render from center to the edges"),
('RIGHT_TO_LEFT', "Right to Left", "Render from right to left"),
('LEFT_TO_RIGHT', "Left to Right", "Render from left to right"),
('TOP_TO_BOTTOM', "Top to Bottom", "Render from top to bottom"),
('BOTTOM_TO_TOP', "Bottom to Top", "Render from bottom to top"),
('HILBERT_SPIRAL', "Hilbert Spiral", "Render in a Hilbert Spiral"),
)
enum_use_layer_samples = ( enum_use_layer_samples = (
('USE', "Use", "Per render layer number of samples override scene samples"), ('USE', "Use", "Per render layer number of samples override scene samples"),
('BOUNDED', "Bounded", "Bound per render layer number of samples by global samples"), ('BOUNDED', "Bounded", "Bound per render layer number of samples by global samples"),
@@ -86,8 +100,14 @@ enum_use_layer_samples = (
) )
enum_sampling_pattern = ( enum_sampling_pattern = (
('SOBOL', "Sobol", "Use Sobol random sampling pattern", 0), ('SOBOL', "Sobol", "Use Sobol random sampling pattern"),
('PROGRESSIVE_MULTI_JITTER', "Progressive Multi-Jitter", "Use Progressive Multi-Jitter random sampling pattern", 1), ('CORRELATED_MUTI_JITTER', "Correlated Multi-Jitter", "Use Correlated Multi-Jitter random sampling pattern"),
('PROGRESSIVE_MUTI_JITTER', "Progressive Multi-Jitter", "Use Progressive Multi-Jitter random sampling pattern"),
)
enum_integrator = (
('BRANCHED_PATH', "Branched Path Tracing", "Path tracing integrator that branches on the first bounce, giving more control over the number of light and material samples"),
('PATH', "Path Tracing", "Pure path tracing integrator"),
) )
enum_volume_sampling = ( enum_volume_sampling = (
@@ -111,7 +131,7 @@ enum_device_type = (
('CPU', "CPU", "CPU", 0), ('CPU', "CPU", "CPU", 0),
('CUDA', "CUDA", "CUDA", 1), ('CUDA', "CUDA", "CUDA", 1),
('OPTIX', "OptiX", "OptiX", 3), ('OPTIX', "OptiX", "OptiX", 3),
("HIP", "HIP", "HIP", 4) ('OPENCL', "OpenCL", "OpenCL", 2)
) )
enum_texture_limit = ( enum_texture_limit = (
@@ -125,50 +145,38 @@ enum_texture_limit = (
('8192', "8192", "Limit texture size to 8192 pixels", 7), ('8192', "8192", "Limit texture size to 8192 pixels", 7),
) )
enum_fast_gi_method = (
('REPLACE', "Replace", "Replace global illumination with ambient occlusion after a specified number of bounces"),
('ADD', "Add", "Add ambient occlusion to diffuse surfaces"),
)
# NOTE: Identifiers are expected to be an upper case version of identifiers from `Pass::get_type_enum()`
enum_view3d_shading_render_pass = ( enum_view3d_shading_render_pass = (
('', "General", ""), ('', "General", ""),
('COMBINED', "Combined", "Show the Combined Render pass"), ('COMBINED', "Combined", "Show the Combined Render pass", 1),
('EMISSION', "Emission", "Show the Emission render pass"), ('EMISSION', "Emission", "Show the Emission render pass", 33),
('BACKGROUND', "Background", "Show the Background render pass"), ('BACKGROUND', "Background", "Show the Background render pass", 34),
('AO', "Ambient Occlusion", "Show the Ambient Occlusion render pass"), ('AO', "Ambient Occlusion", "Show the Ambient Occlusion render pass", 35),
('SHADOW', "Shadow", "Show the Shadow render pass"),
('SHADOW_CATCHER', "Shadow Catcher", "Show the Shadow Catcher render pass"),
('', "Light", ""), ('', "Light", ""),
('DIFFUSE_DIRECT', "Diffuse Direct", "Show the Diffuse Direct render pass"), ('DIFFUSE_DIRECT', "Diffuse Direct", "Show the Diffuse Direct render pass", 38),
('DIFFUSE_INDIRECT', "Diffuse Indirect", "Show the Diffuse Indirect render pass"), ('DIFFUSE_INDIRECT', "Diffuse Indirect", "Show the Diffuse Indirect render pass", 39),
('DIFFUSE_COLOR', "Diffuse Color", "Show the Diffuse Color render pass"), ('DIFFUSE_COLOR', "Diffuse Color", "Show the Diffuse Color render pass", 40),
('GLOSSY_DIRECT', "Glossy Direct", "Show the Glossy Direct render pass"), ('GLOSSY_DIRECT', "Glossy Direct", "Show the Glossy Direct render pass", 41),
('GLOSSY_INDIRECT', "Glossy Indirect", "Show the Glossy Indirect render pass"), ('GLOSSY_INDIRECT', "Glossy Indirect", "Show the Glossy Indirect render pass", 42),
('GLOSSY_COLOR', "Glossy Color", "Show the Glossy Color render pass"), ('GLOSSY_COLOR', "Glossy Color", "Show the Glossy Color render pass", 43),
('', "", ""), ('', "", ""),
('TRANSMISSION_DIRECT', "Transmission Direct", "Show the Transmission Direct render pass"), ('TRANSMISSION_DIRECT', "Transmission Direct", "Show the Transmission Direct render pass", 44),
('TRANSMISSION_INDIRECT', "Transmission Indirect", "Show the Transmission Indirect render pass"), ('TRANSMISSION_INDIRECT', "Transmission Indirect", "Show the Transmission Indirect render pass", 45),
('TRANSMISSION_COLOR', "Transmission Color", "Show the Transmission Color render pass"), ('TRANSMISSION_COLOR', "Transmission Color", "Show the Transmission Color render pass", 46),
('VOLUME_DIRECT', "Volume Direct", "Show the Volume Direct render pass"), ('VOLUME_DIRECT', "Volume Direct", "Show the Volume Direct render pass", 50),
('VOLUME_INDIRECT', "Volume Indirect", "Show the Volume Indirect render pass"), ('VOLUME_INDIRECT', "Volume Indirect", "Show the Volume Indirect render pass", 51),
('', "Data", ""), ('', "Data", ""),
('POSITION', "Position", "Show the Position render pass"), ('NORMAL', "Normal", "Show the Normal render pass", 3),
('NORMAL', "Normal", "Show the Normal render pass"), ('UV', "UV", "Show the UV render pass", 4),
('UV', "UV", "Show the UV render pass"), ('MIST', "Mist", "Show the Mist render pass", 32),
('MIST', "Mist", "Show the Mist render pass"),
('DENOISING_ALBEDO', "Denoising Albedo", "Albedo pass used by denoiser"),
('DENOISING_NORMAL', "Denoising Normal", "Normal pass used by denoiser"),
('SAMPLE_COUNT', "Sample Count", "Per-pixel number of samples"),
) )
@@ -200,23 +208,18 @@ def enum_preview_denoiser(self, context):
def enum_denoiser(self, context): def enum_denoiser(self, context):
items = [] 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) items += enum_openimagedenoise_denoiser(self, context)
return items return items
enum_denoising_input_passes = ( enum_denoising_input_passes = (
('RGB', "None", "Don't use utility passes for denoising", 1), ('RGB', "Color", "Use only color as input", 1),
('RGB_ALBEDO', "Albedo", "Use albedo pass for denoising", 2), ('RGB_ALBEDO', "Color + Albedo", "Use color and albedo data as input", 2),
('RGB_ALBEDO_NORMAL', "Albedo and Normal", "Use albedo and normal passes for denoising", 3), ('RGB_ALBEDO_NORMAL', "Color + Albedo + Normal", "Use color, albedo and normal data as input", 3),
) )
enum_denoising_prefilter = (
('NONE', "None", "No prefiltering, use when guiding passes are noise-free", 1),
('FAST', "Fast", "Denoise color and guiding passes together. Improves quality when guiding passes are noisy using least amount of extra processing time", 2),
('ACCURATE', "Accurate", "Prefilter noisy guiding passes before denoising color. Improves quality when guiding passes are noisy using extra processing time", 3),
)
def update_render_passes(self, context): def update_render_passes(self, context):
scene = context.scene scene = context.scene
@@ -249,6 +252,13 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
description="Use Open Shading Language (CPU rendering only)", description="Use Open Shading Language (CPU rendering only)",
) )
progressive: EnumProperty(
name="Integrator",
description="Method to sample lights and materials",
items=enum_integrator,
default='PATH',
)
preview_pause: BoolProperty( preview_pause: BoolProperty(
name="Pause Preview", name="Pause Preview",
description="Pause all viewport preview renders", description="Pause all viewport preview renders",
@@ -258,106 +268,110 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
use_denoising: BoolProperty( use_denoising: BoolProperty(
name="Use Denoising", name="Use Denoising",
description="Denoise the rendered image", description="Denoise the rendered image",
default=True, default=False,
update=update_render_passes, update=update_render_passes,
) )
denoiser: EnumProperty(
name="Denoiser",
description="Denoise the image with the selected denoiser. "
"For denoising the image after rendering",
items=enum_denoiser,
default=4, # Use integer to avoid error in builds without OpenImageDenoise.
update=update_render_passes,
)
denoising_prefilter: EnumProperty(
name="Denoising Prefilter",
description="Prefilter noisy guiding (albedo and normal) passes to improve denoising quality when using OpenImageDenoiser",
items=enum_denoising_prefilter,
default='ACCURATE',
)
denoising_input_passes: EnumProperty(
name="Denoising 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_preview_denoising: BoolProperty( use_preview_denoising: BoolProperty(
name="Use Viewport Denoising", name="Use Viewport Denoising",
description="Denoise the image in the 3D viewport", description="Denoise the image in the 3D viewport",
default=False, default=False,
) )
denoiser: EnumProperty(
name="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,
default=1,
update=update_render_passes,
)
preview_denoiser: EnumProperty( preview_denoiser: EnumProperty(
name="Viewport Denoiser", name="Viewport Denoiser",
description="Denoise the image after each preview update with the selected denoiser", description="Denoise the image after each preview update with the selected denoiser",
items=enum_preview_denoiser, items=enum_preview_denoiser,
default=0, default=0,
) )
preview_denoising_prefilter: EnumProperty(
name="Viewport Denoising Prefilter", use_square_samples: BoolProperty(
description="Prefilter noisy guiding (albedo and normal) passes to improve denoising quality when using OpenImageDenoiser", name="Square Samples",
items=enum_denoising_prefilter, description="Square sampling values for easier artist control",
default='FAST', default=False,
)
preview_denoising_input_passes: EnumProperty(
name="Viewport Denoising Input Passes",
description="Passes used by the denoiser to distinguish noise from shader and geometry detail",
items=enum_denoising_input_passes,
default='RGB_ALBEDO',
)
preview_denoising_start_sample: IntProperty(
name="Start Denoising",
description="Sample to start denoising the preview at",
min=0, max=(1 << 24),
default=1,
) )
samples: IntProperty( samples: IntProperty(
name="Samples", name="Samples",
description="Number of samples to render for each pixel", description="Number of samples to render for each pixel",
min=1, max=(1 << 24), min=1, max=(1 << 24),
default=4096, default=128,
) )
preview_samples: IntProperty( preview_samples: IntProperty(
name="Viewport Samples", name="Viewport Samples",
description="Number of samples to render in the viewport, unlimited if 0", description="Number of samples to render in the viewport, unlimited if 0",
min=0, max=(1 << 24), min=0, max=(1 << 24),
default=1024, default=32,
)
aa_samples: IntProperty(
name="AA Samples",
description="Number of antialiasing samples to render for each pixel",
min=1, max=2097151,
default=128,
)
preview_aa_samples: IntProperty(
name="AA Samples",
description="Number of antialiasing samples to render in the viewport, unlimited if 0",
min=0, max=2097151,
default=32,
) )
time_limit: FloatProperty( diffuse_samples: IntProperty(
name="Time Limit", name="Diffuse Samples",
description="Limit the render time (excluding synchronization time)." description="Number of diffuse bounce samples to render for each AA sample",
"Zero disables the limit", min=1, max=1024,
min=0.0, default=1,
default=0.0, )
step=100.0, glossy_samples: IntProperty(
unit='TIME_ABSOLUTE', name="Glossy Samples",
description="Number of glossy bounce samples to render for each AA sample",
min=1, max=1024,
default=1,
)
transmission_samples: IntProperty(
name="Transmission Samples",
description="Number of transmission bounce samples to render for each AA sample",
min=1, max=1024,
default=1,
)
ao_samples: IntProperty(
name="Ambient Occlusion Samples",
description="Number of ambient occlusion samples to render for each AA sample",
min=1, max=1024,
default=1,
)
mesh_light_samples: IntProperty(
name="Mesh Light Samples",
description="Number of mesh emission light samples to render for each AA sample",
min=1, max=1024,
default=1,
)
subsurface_samples: IntProperty(
name="Subsurface Samples",
description="Number of subsurface scattering samples to render for each AA sample",
min=1, max=1024,
default=1,
)
volume_samples: IntProperty(
name="Volume Samples",
description="Number of volume scattering samples to render for each AA sample",
min=1, max=1024,
default=1,
) )
sampling_pattern: EnumProperty( sampling_pattern: EnumProperty(
name="Sampling Pattern", name="Sampling Pattern",
description="Random sampling pattern used by the integrator. When adaptive sampling is enabled, Progressive Multi-Jitter is always used instead of Sobol", description="Random sampling pattern used by the integrator",
items=enum_sampling_pattern, items=enum_sampling_pattern,
default='PROGRESSIVE_MULTI_JITTER', default='SOBOL',
)
scrambling_distance: FloatProperty(
name="Scrambling Distance",
default=1.0,
min=0.0, max=1.0,
description="Reduce randomization between pixels to improve GPU rendering performance, at the cost of possible rendering artifacts if set too low. Only works when not using adaptive sampling",
)
preview_scrambling_distance: BoolProperty(
name="Scrambling Distance viewport",
default=False,
description="Uses the Scrambling Distance value for the viewport. Faster but may flicker",
)
auto_scrambling_distance: BoolProperty(
name="Automatic Scrambling Distance",
default=False,
description="Automatically reduce the randomization between pixels to improve GPU rendering performance, at the cost of possible rendering artifacts. Only works when not using adaptive sampling",
) )
use_layer_samples: EnumProperty( use_layer_samples: EnumProperty(
@@ -367,6 +381,17 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
default='USE', default='USE',
) )
sample_all_lights_direct: BoolProperty(
name="Sample All Direct Lights",
description="Sample all lights (for direct samples), rather than randomly picking one",
default=True,
)
sample_all_lights_indirect: BoolProperty(
name="Sample All Indirect Lights",
description="Sample all lights (for indirect samples), rather than randomly picking one",
default=True,
)
light_sampling_threshold: FloatProperty( light_sampling_threshold: FloatProperty(
name="Light Sampling Threshold", name="Light Sampling Threshold",
description="Probabilistically terminate light samples when the light contribution is below this threshold (more noise but faster rendering). " description="Probabilistically terminate light samples when the light contribution is below this threshold (more noise but faster rendering). "
@@ -378,39 +403,19 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
use_adaptive_sampling: BoolProperty( use_adaptive_sampling: BoolProperty(
name="Use Adaptive Sampling", name="Use Adaptive Sampling",
description="Automatically reduce the number of samples per pixel based on estimated noise level", description="Automatically reduce the number of samples per pixel based on estimated noise level",
default=True, default=False,
) )
adaptive_threshold: FloatProperty( adaptive_threshold: FloatProperty(
name="Adaptive Sampling Threshold", name="Adaptive Sampling Threshold",
description="Noise level step to stop sampling at, lower values reduce noise at the cost of render time. Zero for automatic setting based on number of AA samples", description="Noise level step to stop sampling at, lower values reduce noise at the cost of render time. Zero for automatic setting based on number of AA samples",
min=0.0, max=1.0, min=0.0, max=1.0,
soft_min=0.001, default=0.0,
default=0.01,
precision=4, precision=4,
) )
adaptive_min_samples: IntProperty( adaptive_min_samples: IntProperty(
name="Adaptive Min Samples", name="Adaptive Min Samples",
description="Minimum AA samples for adaptive sampling, to discover noisy features before stopping sampling. Zero for automatic setting based on noise threshold", description="Minimum AA samples for adaptive sampling, to discover noisy features before stopping sampling. Zero for automatic setting based on number of AA samples",
min=0, max=4096,
default=0,
)
use_preview_adaptive_sampling: BoolProperty(
name="Use Adaptive Sampling",
description="Automatically reduce the number of samples per pixel based on estimated noise level, for viewport renders",
default=True,
)
preview_adaptive_threshold: FloatProperty(
name="Adaptive Sampling Threshold",
description="Noise level step to stop sampling at, lower values reduce noise at the cost of render time. Zero for automatic setting based on number of AA samples, for viewport renders",
min=0.0, max=1.0,
soft_min=0.001,
default=0.1,
precision=4,
)
preview_adaptive_min_samples: IntProperty(
name="Adaptive Min Samples",
description="Minimum AA samples for adaptive sampling, to discover noisy features before stopping sampling. Zero for automatic setting based on noise threshold, for viewport renders",
min=0, max=4096, min=0, max=4096,
default=0, default=0,
) )
@@ -627,6 +632,53 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
default=10.0, default=10.0,
) )
debug_tile_size: IntProperty(
name="Tile Size",
description="",
min=1, max=4096,
default=1024,
)
preview_start_resolution: IntProperty(
name="Start Resolution",
description="Resolution to start rendering preview at, "
"progressively increasing it to the full viewport size",
min=8, max=16384,
default=64,
subtype='PIXEL'
)
preview_denoising_start_sample: IntProperty(
name="Start Denoising",
description="Sample to start denoising the preview at",
min=0, max=(1 << 24),
default=1,
)
preview_denoising_input_passes: EnumProperty(
name="Viewport Input Passes",
description="Passes used by the denoiser to distinguish noise from shader and geometry detail",
items=enum_denoising_input_passes,
default='RGB_ALBEDO',
)
debug_reset_timeout: FloatProperty(
name="Reset timeout",
description="",
min=0.01, max=10.0,
default=0.1,
)
debug_cancel_timeout: FloatProperty(
name="Cancel timeout",
description="",
min=0.01, max=10.0,
default=0.1,
)
debug_text_timeout: FloatProperty(
name="Text timeout",
description="",
min=0.01, max=10.0,
default=1.0,
)
debug_bvh_type: EnumProperty( debug_bvh_type: EnumProperty(
name="Viewport BVH Type", name="Viewport BVH Type",
description="Choose between faster updates, or faster render", description="Choose between faster updates, or faster render",
@@ -649,24 +701,38 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
default=0, default=0,
min=0, max=16, min=0, max=16,
) )
tile_order: EnumProperty(
name="Tile Order",
description="Tile order for rendering",
items=enum_tile_order,
default='HILBERT_SPIRAL',
options=set(), # Not animatable!
)
use_progressive_refine: BoolProperty(
name="Progressive Refine",
description="Instead of rendering each tile until it is finished, "
"refine the whole image progressively "
"(this renders somewhat slower, "
"but time can be saved by manually stopping the render when the noise is low enough)",
default=False,
)
bake_type: EnumProperty( bake_type: EnumProperty(
name="Bake Type", name="Bake Type",
default='COMBINED', default='COMBINED',
description="Type of pass to bake", description="Type of pass to bake",
items=( items=(
('COMBINED', "Combined", "", 0), ('COMBINED', "Combined", ""),
('AO', "Ambient Occlusion", "", 1), ('AO', "Ambient Occlusion", ""),
('SHADOW', "Shadow", "", 2), ('SHADOW', "Shadow", ""),
('POSITION', "Position", "", 11), ('NORMAL', "Normal", ""),
('NORMAL', "Normal", "", 3), ('UV', "UV", ""),
('UV', "UV", "", 4), ('ROUGHNESS', "Roughness", ""),
('ROUGHNESS', "Roughness", "", 5), ('EMIT', "Emit", ""),
('EMIT', "Emit", "", 6), ('ENVIRONMENT', "Environment", ""),
('ENVIRONMENT', "Environment", "", 7), ('DIFFUSE', "Diffuse", ""),
('DIFFUSE', "Diffuse", "", 8), ('GLOSSY', "Glossy", ""),
('GLOSSY', "Glossy", "", 9), ('TRANSMISSION', "Transmission", ""),
('TRANSMISSION', "Transmission", "", 10),
), ),
) )
@@ -747,14 +813,6 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
description="Approximate diffuse indirect light with background tinted ambient occlusion. This provides fast alternative to full global illumination, for interactive viewport rendering or final renders with reduced quality", description="Approximate diffuse indirect light with background tinted ambient occlusion. This provides fast alternative to full global illumination, for interactive viewport rendering or final renders with reduced quality",
default=False, default=False,
) )
fast_gi_method: EnumProperty(
name="Fast GI Method",
default='REPLACE',
description="Fast GI approximation method",
items=enum_fast_gi_method
)
ao_bounces: IntProperty( ao_bounces: IntProperty(
name="AO Bounces", name="AO Bounces",
default=1, default=1,
@@ -769,18 +827,6 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
min=0, max=1024, min=0, max=1024,
) )
use_auto_tile: BoolProperty(
name="Use Tiling",
description="Render high resolution images in tiles to reduce memory usage, using the specified tile size. Tiles are cached to disk while rendering to save memory",
default=True,
)
tile_size: IntProperty(
name="Tile Size",
default=2048,
description="",
min=8, max=16384,
)
# Various fine-tuning debug flags # Various fine-tuning debug flags
def _devices_update_callback(self, context): def _devices_update_callback(self, context):
@@ -798,13 +844,45 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
items=enum_bvh_layouts, items=enum_bvh_layouts,
default='EMBREE', default='EMBREE',
) )
debug_use_cpu_split_kernel: BoolProperty(name="Split Kernel", default=False)
debug_use_cuda_adaptive_compile: BoolProperty(name="Adaptive Compile", default=False) debug_use_cuda_adaptive_compile: BoolProperty(name="Adaptive Compile", default=False)
debug_use_cuda_split_kernel: BoolProperty(name="Split Kernel", default=False)
debug_use_optix_debug: BoolProperty( debug_optix_cuda_streams: IntProperty(name="CUDA Streams", default=1, min=1)
name="OptiX Module Debug", debug_optix_curves_api: BoolProperty(name="Native OptiX Curve Primitive", default=False)
description="Load OptiX module in debug mode: lower logging verbosity level, enable validations, and lower optimization level",
default=False debug_opencl_kernel_type: EnumProperty(
name="OpenCL Kernel Type",
default='DEFAULT',
items=(
('DEFAULT', "Default", ""),
('MEGA', "Mega", ""),
('SPLIT', "Split", ""),
),
update=CyclesRenderSettings._devices_update_callback
)
debug_opencl_device_type: EnumProperty(
name="OpenCL Device Type",
default='ALL',
items=(
('NONE', "None", ""),
('ALL', "All", ""),
('DEFAULT', "Default", ""),
('CPU', "CPU", ""),
('GPU', "GPU", ""),
('ACCELERATOR', "Accelerator", ""),
),
update=CyclesRenderSettings._devices_update_callback
)
debug_use_opencl_debug: BoolProperty(name="Debug OpenCL", default=False)
debug_opencl_mem_limit: IntProperty(
name="Memory limit",
default=0,
description="Artificial limit on OpenCL memory usage in MB (0 to disable limit)"
) )
@classmethod @classmethod
@@ -953,6 +1031,12 @@ class CyclesLightSettings(bpy.types.PropertyGroup):
description="Light casts shadows", description="Light casts shadows",
default=True, default=True,
) )
samples: IntProperty(
name="Samples",
description="Number of light samples to render for each AA sample",
min=1, max=10000,
default=1,
)
max_bounces: IntProperty( max_bounces: IntProperty(
name="Max Bounces", name="Max Bounces",
description="Maximum number of bounces the light will contribute to the render", description="Maximum number of bounces the light will contribute to the render",
@@ -1000,6 +1084,12 @@ class CyclesWorldSettings(bpy.types.PropertyGroup):
min=4, max=8192, min=4, max=8192,
default=1024, default=1024,
) )
samples: IntProperty(
name="Samples",
description="Number of light samples to render for each AA sample",
min=1, max=10000,
default=1,
)
max_bounces: IntProperty( max_bounces: IntProperty(
name="Max Bounces", name="Max Bounces",
description="Maximum number of bounces the background light will contribute to the render", description="Maximum number of bounces the background light will contribute to the render",
@@ -1228,6 +1318,12 @@ class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
class CyclesRenderLayerSettings(bpy.types.PropertyGroup): class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
pass_debug_render_time: BoolProperty(
name="Debug Render Time",
description="Render time in milliseconds per sample and pixel",
default=False,
update=update_render_passes,
)
pass_debug_sample_count: BoolProperty( pass_debug_sample_count: BoolProperty(
name="Debug Sample Count", name="Debug Sample Count",
description="Number of samples/camera rays per pixel", description="Number of samples/camera rays per pixel",
@@ -1247,25 +1343,91 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
update=update_render_passes, update=update_render_passes,
) )
use_pass_shadow_catcher: BoolProperty(
name="Shadow Catcher",
description="Pass containing shadows and light which is to be multiplied into backdrop",
default=False,
update=update_render_passes,
)
use_denoising: BoolProperty( use_denoising: BoolProperty(
name="Use Denoising", name="Use Denoising",
description="Denoise the rendered image", description="Denoise the rendered image",
default=True, default=True,
update=update_render_passes, update=update_render_passes,
) )
denoising_diffuse_direct: BoolProperty(
name="Diffuse Direct",
description="Denoise the direct diffuse lighting",
default=True,
)
denoising_diffuse_indirect: BoolProperty(
name="Diffuse Indirect",
description="Denoise the indirect diffuse lighting",
default=True,
)
denoising_glossy_direct: BoolProperty(
name="Glossy Direct",
description="Denoise the direct glossy lighting",
default=True,
)
denoising_glossy_indirect: BoolProperty(
name="Glossy Indirect",
description="Denoise the indirect glossy lighting",
default=True,
)
denoising_transmission_direct: BoolProperty(
name="Transmission Direct",
description="Denoise the direct transmission lighting",
default=True,
)
denoising_transmission_indirect: BoolProperty(
name="Transmission Indirect",
description="Denoise the indirect transmission lighting",
default=True,
)
denoising_strength: FloatProperty(
name="Denoising Strength",
description="Controls neighbor pixel weighting for the denoising filter (lower values preserve more detail, but aren't as smooth)",
min=0.0, max=1.0,
default=0.5,
)
denoising_feature_strength: FloatProperty(
name="Denoising Feature Strength",
description="Controls removal of noisy image feature passes (lower values preserve more detail, but aren't as smooth)",
min=0.0, max=1.0,
default=0.5,
)
denoising_radius: IntProperty(
name="Denoising Radius",
description="Size of the image area that's used to denoise a pixel (higher values are smoother, but might lose detail and are slower)",
min=1, max=25,
default=8,
subtype="PIXEL",
)
denoising_relative_pca: BoolProperty(
name="Relative Filter",
description="When removing pixels that don't carry information, use a relative threshold instead of an absolute one (can help to reduce artifacts, but might cause detail loss around edges)",
default=False,
)
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. The passes adapt to the denoiser selected for rendering", 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,
) )
denoising_neighbor_frames: IntProperty(
name="Neighbor Frames",
description="Number of neighboring frames to use for denoising animations (more frames produce smoother results at the cost of performance)",
min=0, max=7,
default=0,
)
denoising_optix_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',
)
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',
)
@classmethod @classmethod
def register(cls): def register(cls):
@@ -1292,16 +1454,14 @@ class CyclesPreferences(bpy.types.AddonPreferences):
def get_device_types(self, context): def get_device_types(self, context):
import _cycles import _cycles
has_cuda, has_optix, has_hip = _cycles.get_device_types() has_cuda, has_optix, has_opencl = _cycles.get_device_types()
list = [('NONE', "None", "Don't use compute device", 0)] list = [('NONE', "None", "Don't use compute device", 0)]
if has_cuda: if has_cuda:
list.append(('CUDA', "CUDA", "Use CUDA for GPU acceleration", 1)) list.append(('CUDA', "CUDA", "Use CUDA for GPU acceleration", 1))
if has_optix: if has_optix:
list.append(('OPTIX', "OptiX", "Use OptiX for GPU acceleration", 3)) list.append(('OPTIX', "OptiX", "Use OptiX for GPU acceleration", 3))
if has_hip: if has_opencl:
list.append(('HIP', "HIP", "Use HIP for GPU acceleration", 4)) list.append(('OPENCL', "OpenCL", "Use OpenCL for GPU acceleration", 2))
return list return list
compute_device_type: EnumProperty( compute_device_type: EnumProperty(
@@ -1326,7 +1486,7 @@ class CyclesPreferences(bpy.types.AddonPreferences):
def update_device_entries(self, device_list): def update_device_entries(self, device_list):
for device in device_list: for device in device_list:
if not device[1] in {'CUDA', 'OPTIX', 'CPU', 'HIP'}: if not device[1] in {'CUDA', 'OPTIX', 'OPENCL', 'CPU'}:
continue continue
# Try to find existing Device entry # Try to find existing Device entry
entry = self.find_existing_device_entry(device) entry = self.find_existing_device_entry(device)
@@ -1360,36 +1520,29 @@ class CyclesPreferences(bpy.types.AddonPreferences):
elif entry.type == 'CPU': elif entry.type == 'CPU':
cpu_devices.append(entry) cpu_devices.append(entry)
# Extend all GPU devices with CPU. # Extend all GPU devices with CPU.
if len(devices) and compute_device_type != 'CPU': if compute_device_type in {'CUDA', 'OPTIX', 'OPENCL'}:
devices.extend(cpu_devices) devices.extend(cpu_devices)
return devices return devices
# Refresh device list. This does not happen automatically on Blender # For backwards compatibility, only returns CUDA and OpenCL but still
# startup due to unstable OpenCL implementations that can cause crashes. # refreshes all devices.
def refresh_devices(self): def get_devices(self, compute_device_type=''):
import _cycles import _cycles
# Ensure `self.devices` is not re-allocated when the second call to # Ensure `self.devices` is not re-allocated when the second call to
# get_devices_for_type is made, freeing items from the first list. # get_devices_for_type is made, freeing items from the first list.
for device_type in ('CUDA', 'OPTIX', 'HIP'): for device_type in ('CUDA', 'OPTIX', 'OPENCL'):
self.update_device_entries(_cycles.available_devices(device_type)) self.update_device_entries(_cycles.available_devices(device_type))
# Deprecated: use refresh_devices instead. cuda_devices = self.get_devices_for_type('CUDA')
def get_devices(self, compute_device_type=''): opencl_devices = self.get_devices_for_type('OPENCL')
self.refresh_devices() return cuda_devices, opencl_devices
return None
def get_compute_device_type(self):
if self.compute_device_type == '':
return 'NONE'
return self.compute_device_type
def get_num_gpu_devices(self): def get_num_gpu_devices(self):
import _cycles import _cycles
compute_device_type = self.get_compute_device_type() device_list = _cycles.available_devices(self.compute_device_type)
device_list = _cycles.available_devices(compute_device_type)
num = 0 num = 0
for device in device_list: for device in device_list:
if device[1] != compute_device_type: if device[1] != self.compute_device_type:
continue continue
for dev in self.devices: for dev in self.devices:
if dev.use and dev.id == device[2]: if dev.use and dev.id == device[2]:
@@ -1410,18 +1563,8 @@ class CyclesPreferences(bpy.types.AddonPreferences):
if not found_device: if not found_device:
col = box.column(align=True) col = box.column(align=True)
col.label(text="No compatible GPUs found for Cycles", icon='INFO') col.label(text="No compatible GPUs found for path tracing", icon='INFO')
col.label(text="Cycles will render on the CPU", icon='BLANK1')
if device_type == 'CUDA':
col.label(text="Requires NVIDIA GPU with compute capability 3.0", icon='BLANK1')
elif device_type == 'OPTIX':
col.label(text="Requires NVIDIA GPU with compute capability 5.0", icon='BLANK1')
col.label(text="and NVIDIA driver version 470 or newer", icon='BLANK1')
elif device_type == 'HIP':
import sys
col.label(text="Requires discrete AMD GPU with RDNA architecture", icon='BLANK1')
if sys.platform[:3] == "win":
col.label(text="and AMD Radeon Pro 21.Q4 driver or newer", icon='BLANK1')
return return
for device in devices: for device in devices:
@@ -1431,16 +1574,15 @@ class CyclesPreferences(bpy.types.AddonPreferences):
row = layout.row() row = layout.row()
row.prop(self, "compute_device_type", expand=True) row.prop(self, "compute_device_type", expand=True)
compute_device_type = self.get_compute_device_type() if self.compute_device_type == 'NONE':
if compute_device_type == 'NONE':
return return
row = layout.row() row = layout.row()
devices = self.get_devices_for_type(compute_device_type) devices = self.get_devices_for_type(self.compute_device_type)
self._draw_devices(row, compute_device_type, devices) self._draw_devices(row, self.compute_device_type, devices)
import _cycles import _cycles
has_peer_memory = 0 has_peer_memory = 0
for device in _cycles.available_devices(compute_device_type): for device in _cycles.available_devices(self.compute_device_type):
if device[3] and self.find_existing_device_entry(device).use: if device[3] and self.find_existing_device_entry(device).use:
has_peer_memory += 1 has_peer_memory += 1
if has_peer_memory > 1: if has_peer_memory > 1:
@@ -1459,10 +1601,6 @@ class CyclesView3DShadingSettings(bpy.types.PropertyGroup):
items=enum_view3d_shading_render_pass, items=enum_view3d_shading_render_pass,
default='COMBINED', default='COMBINED',
) )
show_active_pixels: BoolProperty(
name="Show Active Pixels",
description="When using adaptive sampling highlight pixels which are being sampled",
)
def register(): def register():

View File

@@ -26,31 +26,21 @@ from bpy.types import Panel
from bl_ui.properties_grease_pencil_common import GreasePencilSimplifyPanel from bl_ui.properties_grease_pencil_common import GreasePencilSimplifyPanel
from bl_ui.properties_view_layer import ViewLayerCryptomattePanel, ViewLayerAOVPanel from bl_ui.properties_view_layer import ViewLayerCryptomattePanel, ViewLayerAOVPanel
class CyclesPresetPanel(PresetPanel, Panel):
COMPAT_ENGINES = {'CYCLES'}
preset_operator = "script.execute_preset"
@staticmethod class CYCLES_PT_sampling_presets(PresetPanel, Panel):
def post_cb(context):
# Modify an arbitrary built-in scene property to force a depsgraph
# update, because add-on properties don't. (see T62325)
render = context.scene.render
render.filter_size = render.filter_size
class CYCLES_PT_sampling_presets(CyclesPresetPanel):
bl_label = "Sampling Presets" bl_label = "Sampling Presets"
preset_subdir = "cycles/sampling" preset_subdir = "cycles/sampling"
preset_operator = "script.execute_preset"
preset_add_operator = "render.cycles_sampling_preset_add" preset_add_operator = "render.cycles_sampling_preset_add"
COMPAT_ENGINES = {'CYCLES'}
class CYCLES_PT_viewport_sampling_presets(CyclesPresetPanel):
bl_label = "Viewport Sampling Presets"
preset_subdir = "cycles/viewport_sampling"
preset_add_operator = "render.cycles_viewport_sampling_preset_add"
class CYCLES_PT_integrator_presets(CyclesPresetPanel): class CYCLES_PT_integrator_presets(PresetPanel, Panel):
bl_label = "Integrator Presets" bl_label = "Integrator Presets"
preset_subdir = "cycles/integrator" preset_subdir = "cycles/integrator"
preset_operator = "script.execute_preset"
preset_add_operator = "render.cycles_integrator_preset_add" preset_add_operator = "render.cycles_integrator_preset_add"
COMPAT_ENGINES = {'CYCLES'}
class CyclesButtonsPanel: class CyclesButtonsPanel:
@@ -64,15 +54,6 @@ class CyclesButtonsPanel:
return context.engine in cls.COMPAT_ENGINES return context.engine in cls.COMPAT_ENGINES
class CyclesDebugButtonsPanel(CyclesButtonsPanel):
@classmethod
def poll(cls, context):
prefs = bpy.context.preferences
return (CyclesButtonsPanel.poll(context)
and prefs.experimental.use_cycles_debug
and prefs.view.show_developer_ui)
# Adapt properties editor panel to display in node editor. We have to # Adapt properties editor panel to display in node editor. We have to
# copy the class rather than inherit due to the way bpy registration works. # copy the class rather than inherit due to the way bpy registration works.
def node_panel(cls): def node_panel(cls):
@@ -97,23 +78,30 @@ def use_cpu(context):
return (get_device_type(context) == 'NONE' or cscene.device == 'CPU') return (get_device_type(context) == 'NONE' or cscene.device == 'CPU')
def use_opencl(context):
cscene = context.scene.cycles
return (get_device_type(context) == 'OPENCL' and cscene.device == 'GPU')
def use_cuda(context): def use_cuda(context):
cscene = context.scene.cycles cscene = context.scene.cycles
return (get_device_type(context) == 'CUDA' and cscene.device == 'GPU') return (get_device_type(context) == 'CUDA' and cscene.device == 'GPU')
def use_hip(context):
cscene = context.scene.cycles
return (get_device_type(context) == 'HIP' and cscene.device == 'GPU')
def use_optix(context): def use_optix(context):
cscene = context.scene.cycles cscene = context.scene.cycles
return (get_device_type(context) == 'OPTIX' and cscene.device == 'GPU') return (get_device_type(context) == 'OPTIX' and cscene.device == 'GPU')
def use_branched_path(context):
cscene = context.scene.cycles
return (cscene.progressive == 'BRANCHED_PATH' and not use_optix(context))
def use_sample_all_lights(context): def use_sample_all_lights(context):
cscene = context.scene.cycles cscene = context.scene.cycles
@@ -127,93 +115,55 @@ def show_device_active(context):
return context.preferences.addons[__package__].preferences.has_active_device() return context.preferences.addons[__package__].preferences.has_active_device()
def get_effective_preview_denoiser(context): def draw_samples_info(layout, context):
scene = context.scene cscene = context.scene.cycles
cscene = scene.cycles integrator = cscene.progressive
if cscene.preview_denoiser != "AUTO": # Calculate sample values
return cscene.preview_denoiser if integrator == 'PATH':
aa = cscene.samples
if cscene.use_square_samples:
aa = aa * aa
else:
aa = cscene.aa_samples
d = cscene.diffuse_samples
g = cscene.glossy_samples
t = cscene.transmission_samples
ao = cscene.ao_samples
ml = cscene.mesh_light_samples
sss = cscene.subsurface_samples
vol = cscene.volume_samples
if context.preferences.addons[__package__].preferences.get_devices_for_type('OPTIX'): if cscene.use_square_samples:
return 'OPTIX' aa = aa * aa
d = d * d
return 'OIDN' g = g * g
t = t * t
ao = ao * ao
ml = ml * ml
sss = sss * sss
vol = vol * vol
# Draw interface
# Do not draw for progressive, when Square Samples are disabled
if use_branched_path(context) or (cscene.use_square_samples and integrator == 'PATH'):
col = layout.column(align=True)
col.scale_y = 0.6
col.label(text="Total Samples:")
col.separator()
if integrator == 'PATH':
col.label(text="%s AA" % aa)
else:
col.label(text="%s AA, %s Diffuse, %s Glossy, %s Transmission" %
(aa, d * aa, g * aa, t * aa))
col.separator()
col.label(text="%s AO, %s Mesh Light, %s Subsurface, %s Volume" %
(ao * aa, ml * aa, sss * aa, vol * aa))
class CYCLES_RENDER_PT_sampling(CyclesButtonsPanel, Panel): class CYCLES_RENDER_PT_sampling(CyclesButtonsPanel, Panel):
bl_label = "Sampling" bl_label = "Sampling"
def draw(self, context):
pass
class CYCLES_RENDER_PT_sampling_viewport(CyclesButtonsPanel, Panel):
bl_label = "Viewport"
bl_parent_id = "CYCLES_RENDER_PT_sampling"
def draw_header_preset(self, context):
CYCLES_PT_viewport_sampling_presets.draw_panel_header(self.layout)
def draw(self, context):
layout = self.layout
scene = context.scene
cscene = scene.cycles
layout.use_property_split = True
layout.use_property_decorate = False
heading = layout.column(align=True, heading="Noise Threshold")
row = heading.row(align=True)
row.prop(cscene, "use_preview_adaptive_sampling", text="")
sub = row.row()
sub.active = cscene.use_preview_adaptive_sampling
sub.prop(cscene, "preview_adaptive_threshold", text="")
if cscene.use_preview_adaptive_sampling:
col = layout.column(align=True)
col.prop(cscene, "preview_samples", text=" Max Samples")
col.prop(cscene, "preview_adaptive_min_samples", text="Min Samples")
else:
layout.prop(cscene, "preview_samples", text="Samples")
class CYCLES_RENDER_PT_sampling_viewport_denoise(CyclesButtonsPanel, Panel):
bl_label = "Denoise"
bl_parent_id = 'CYCLES_RENDER_PT_sampling_viewport'
bl_options = {'DEFAULT_CLOSED'}
def draw_header(self, context):
scene = context.scene
cscene = scene.cycles
self.layout.prop(context.scene.cycles, "use_preview_denoising", text="")
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
scene = context.scene
cscene = scene.cycles
col = layout.column()
col.active = cscene.use_preview_denoising
col.prop(cscene, "preview_denoiser", text="Denoiser")
col.prop(cscene, "preview_denoising_input_passes", text="Passes")
effective_preview_denoiser = get_effective_preview_denoiser(context)
if effective_preview_denoiser == 'OPENIMAGEDENOISE':
col.prop(cscene, "preview_denoising_prefilter", text="Prefilter")
col.prop(cscene, "preview_denoising_start_sample", text="Start Sample")
class CYCLES_RENDER_PT_sampling_render(CyclesButtonsPanel, Panel):
bl_label = "Render"
bl_parent_id = "CYCLES_RENDER_PT_sampling"
def draw_header_preset(self, context): def draw_header_preset(self, context):
CYCLES_PT_sampling_presets.draw_panel_header(self.layout) CYCLES_PT_sampling_presets.draw_panel_header(self.layout)
@@ -226,32 +176,29 @@ class CYCLES_RENDER_PT_sampling_render(CyclesButtonsPanel, Panel):
layout.use_property_split = True layout.use_property_split = True
layout.use_property_decorate = False layout.use_property_decorate = False
heading = layout.column(align=True, heading="Noise Threshold") if not use_optix(context):
row = heading.row(align=True) layout.prop(cscene, "progressive")
row.prop(cscene, "use_adaptive_sampling", text="")
sub = row.row()
sub.active = cscene.use_adaptive_sampling
sub.prop(cscene, "adaptive_threshold", text="")
col = layout.column(align=True) if not use_branched_path(context):
if cscene.use_adaptive_sampling: col = layout.column(align=True)
col.prop(cscene, "samples", text=" Max Samples") col.prop(cscene, "samples", text="Render")
col.prop(cscene, "adaptive_min_samples", text="Min Samples") col.prop(cscene, "preview_samples", text="Viewport")
else: else:
col.prop(cscene, "samples", text="Samples") col = layout.column(align=True)
col.prop(cscene, "time_limit") col.prop(cscene, "aa_samples", text="Render")
col.prop(cscene, "preview_aa_samples", text="Viewport")
if not use_branched_path(context):
draw_samples_info(layout, context)
class CYCLES_RENDER_PT_sampling_render_denoise(CyclesButtonsPanel, Panel): class CYCLES_RENDER_PT_sampling_sub_samples(CyclesButtonsPanel, Panel):
bl_label = "Denoise" bl_label = "Sub Samples"
bl_parent_id = 'CYCLES_RENDER_PT_sampling_render' bl_parent_id = "CYCLES_RENDER_PT_sampling"
bl_options = {'DEFAULT_CLOSED'}
def draw_header(self, context): @classmethod
scene = context.scene def poll(cls, context):
cscene = scene.cycles return use_branched_path(context)
self.layout.prop(context.scene.cycles, "use_denoising", text="")
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
@@ -261,12 +208,88 @@ class CYCLES_RENDER_PT_sampling_render_denoise(CyclesButtonsPanel, Panel):
scene = context.scene scene = context.scene
cscene = scene.cycles cscene = scene.cycles
col = layout.column() col = layout.column(align=True)
col.active = cscene.use_denoising col.prop(cscene, "diffuse_samples", text="Diffuse")
col.prop(cscene, "denoiser", text="Denoiser") col.prop(cscene, "glossy_samples", text="Glossy")
col.prop(cscene, "denoising_input_passes", text="Passes") col.prop(cscene, "transmission_samples", text="Transmission")
if cscene.denoiser == 'OPENIMAGEDENOISE': col.prop(cscene, "ao_samples", text="AO")
col.prop(cscene, "denoising_prefilter", text="Prefilter")
sub = col.row(align=True)
sub.active = use_sample_all_lights(context)
sub.prop(cscene, "mesh_light_samples", text="Mesh Light")
col.prop(cscene, "subsurface_samples", text="Subsurface")
col.prop(cscene, "volume_samples", text="Volume")
draw_samples_info(layout, context)
class CYCLES_RENDER_PT_sampling_adaptive(CyclesButtonsPanel, Panel):
bl_label = "Adaptive Sampling"
bl_parent_id = "CYCLES_RENDER_PT_sampling"
bl_options = {'DEFAULT_CLOSED'}
def draw_header(self, context):
layout = self.layout
scene = context.scene
cscene = scene.cycles
layout.prop(cscene, "use_adaptive_sampling", text="")
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
scene = context.scene
cscene = scene.cycles
layout.active = cscene.use_adaptive_sampling
col = layout.column(align=True)
col.prop(cscene, "adaptive_threshold", text="Noise Threshold")
col.prop(cscene, "adaptive_min_samples", text="Min Samples")
class CYCLES_RENDER_PT_sampling_denoising(CyclesButtonsPanel, Panel):
bl_label = "Denoising"
bl_parent_id = "CYCLES_RENDER_PT_sampling"
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
scene = context.scene
cscene = scene.cycles
heading = layout.column(align=True, heading="Render")
row = heading.row(align=True)
row.prop(cscene, "use_denoising", text="")
sub = row.row()
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="")
layout.separator()
heading = layout.column(align=False, heading="Viewport")
row = heading.row(align=True)
row.prop(cscene, "use_preview_denoising", text="")
sub = row.row()
sub.active = cscene.use_preview_denoising
sub.prop(cscene, "preview_denoiser", text="")
sub = heading.row(align=True)
sub.active = cscene.use_preview_denoising
sub.prop(cscene, "preview_denoising_start_sample", text="Start Sample")
sub = heading.row(align=True)
sub.active = cscene.use_preview_denoising
sub.prop(cscene, "preview_denoising_input_passes", text="Input Passes")
class CYCLES_RENDER_PT_sampling_advanced(CyclesButtonsPanel, Panel): class CYCLES_RENDER_PT_sampling_advanced(CyclesButtonsPanel, Panel):
@@ -287,18 +310,10 @@ class CYCLES_RENDER_PT_sampling_advanced(CyclesButtonsPanel, Panel):
row.prop(cscene, "use_animated_seed", text="", icon='TIME') row.prop(cscene, "use_animated_seed", text="", icon='TIME')
col = layout.column(align=True) col = layout.column(align=True)
col.active = not (cscene.use_adaptive_sampling and cscene.use_preview_adaptive_sampling) col.active = not(cscene.use_adaptive_sampling)
col.prop(cscene, "sampling_pattern", text="Pattern") col.prop(cscene, "sampling_pattern", text="Pattern")
layout.separator() layout.prop(cscene, "use_square_samples")
heading = layout.column(align=True, heading="Scrambling Distance")
heading.active = not (cscene.use_adaptive_sampling and cscene.use_preview_adaptive_sampling)
heading.prop(cscene, "auto_scrambling_distance", text="Automatic")
sub = heading.row()
sub.active = not cscene.use_preview_adaptive_sampling
sub.prop(cscene, "preview_scrambling_distance", text="Viewport")
heading.prop(cscene, "scrambling_distance", text="Multiplier")
layout.separator() layout.separator()
@@ -307,6 +322,11 @@ class CYCLES_RENDER_PT_sampling_advanced(CyclesButtonsPanel, Panel):
col.prop(cscene, "min_transparent_bounces") col.prop(cscene, "min_transparent_bounces")
col.prop(cscene, "light_sampling_threshold", text="Light Threshold") col.prop(cscene, "light_sampling_threshold", text="Light Threshold")
if cscene.progressive != 'PATH' and use_branched_path(context):
col = layout.column(align=True)
col.prop(cscene, "sample_all_lights_direct")
col.prop(cscene, "sample_all_lights_indirect")
for view_layer in scene.view_layers: for view_layer in scene.view_layers:
if view_layer.samples > 0: if view_layer.samples > 0:
layout.separator() layout.separator()
@@ -314,6 +334,62 @@ class CYCLES_RENDER_PT_sampling_advanced(CyclesButtonsPanel, Panel):
break break
class CYCLES_RENDER_PT_sampling_total(CyclesButtonsPanel, Panel):
bl_label = "Total Samples"
bl_parent_id = "CYCLES_RENDER_PT_sampling"
@classmethod
def poll(cls, context):
scene = context.scene
cscene = scene.cycles
if cscene.use_square_samples:
return True
return cscene.progressive != 'PATH' and use_branched_path(context)
def draw(self, context):
layout = self.layout
cscene = context.scene.cycles
integrator = cscene.progressive
# Calculate sample values
if integrator == 'PATH':
aa = cscene.samples
if cscene.use_square_samples:
aa = aa * aa
else:
aa = cscene.aa_samples
d = cscene.diffuse_samples
g = cscene.glossy_samples
t = cscene.transmission_samples
ao = cscene.ao_samples
ml = cscene.mesh_light_samples
sss = cscene.subsurface_samples
vol = cscene.volume_samples
if cscene.use_square_samples:
aa = aa * aa
d = d * d
g = g * g
t = t * t
ao = ao * ao
ml = ml * ml
sss = sss * sss
vol = vol * vol
col = layout.column(align=True)
col.scale_y = 0.6
if integrator == 'PATH':
col.label(text="%s AA" % aa)
else:
col.label(text="%s AA, %s Diffuse, %s Glossy, %s Transmission" %
(aa, d * aa, g * aa, t * aa))
col.separator()
col.label(text="%s AO, %s Mesh Light, %s Subsurface, %s Volume" %
(ao * aa, ml * aa, sss * aa, vol * aa))
class CYCLES_RENDER_PT_subdivision(CyclesButtonsPanel, Panel): class CYCLES_RENDER_PT_subdivision(CyclesButtonsPanel, Panel):
bl_label = "Subdivision" bl_label = "Subdivision"
bl_options = {'DEFAULT_CLOSED'} bl_options = {'DEFAULT_CLOSED'}
@@ -472,10 +548,9 @@ class CYCLES_RENDER_PT_light_paths_fast_gi(CyclesButtonsPanel, Panel):
layout.use_property_split = True layout.use_property_split = True
layout.use_property_decorate = False layout.use_property_decorate = False
layout.active = cscene.use_fast_gi
col = layout.column(align=True) col = layout.column(align=True)
col.prop(cscene, "fast_gi_method", text="Method") col.prop(cscene, "ao_bounces", text="Viewport Bounces")
col.prop(cscene, "ao_bounces_render", text="Render Bounces")
if world: if world:
light = world.light_settings light = world.light_settings
@@ -483,11 +558,6 @@ class CYCLES_RENDER_PT_light_paths_fast_gi(CyclesButtonsPanel, Panel):
col.prop(light, "ao_factor", text="AO Factor") col.prop(light, "ao_factor", text="AO Factor")
col.prop(light, "distance", text="AO Distance") col.prop(light, "distance", text="AO Distance")
if cscene.fast_gi_method == 'REPLACE':
col = layout.column(align=True)
col.prop(cscene, "ao_bounces", text="Viewport Bounces")
col.prop(cscene, "ao_bounces_render", text="Render Bounces")
class CYCLES_RENDER_PT_motion_blur(CyclesButtonsPanel, Panel): class CYCLES_RENDER_PT_motion_blur(CyclesButtonsPanel, Panel):
bl_label = "Motion Blur" bl_label = "Motion Blur"
@@ -636,8 +706,8 @@ class CYCLES_RENDER_PT_performance_threads(CyclesButtonsPanel, Panel):
sub.prop(rd, "threads") sub.prop(rd, "threads")
class CYCLES_RENDER_PT_performance_memory(CyclesButtonsPanel, Panel): class CYCLES_RENDER_PT_performance_tiles(CyclesButtonsPanel, Panel):
bl_label = "Memory" bl_label = "Tiles"
bl_parent_id = "CYCLES_RENDER_PT_performance" bl_parent_id = "CYCLES_RENDER_PT_performance"
def draw(self, context): def draw(self, context):
@@ -646,13 +716,19 @@ class CYCLES_RENDER_PT_performance_memory(CyclesButtonsPanel, Panel):
layout.use_property_decorate = False layout.use_property_decorate = False
scene = context.scene scene = context.scene
rd = scene.render
cscene = scene.cycles cscene = scene.cycles
col = layout.column() col = layout.column()
col.prop(cscene, "use_auto_tile")
sub = col.column(align=True)
sub.prop(rd, "tile_x", text="Tiles X")
sub.prop(rd, "tile_y", text="Y")
col.prop(cscene, "tile_order", text="Order")
sub = col.column() sub = col.column()
sub.active = cscene.use_auto_tile sub.active = not rd.use_save_buffers and not cscene.use_adaptive_sampling
sub.prop(cscene, "tile_size") sub.prop(cscene, "use_progressive_refine")
class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Panel): class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Panel):
@@ -702,6 +778,7 @@ class CYCLES_RENDER_PT_performance_final_render(CyclesButtonsPanel, Panel):
col = layout.column() col = layout.column()
col.prop(rd, "use_save_buffers")
col.prop(rd, "use_persistent_data", text="Persistent Data") col.prop(rd, "use_persistent_data", text="Persistent Data")
@@ -720,6 +797,7 @@ class CYCLES_RENDER_PT_performance_viewport(CyclesButtonsPanel, Panel):
col = layout.column() col = layout.column()
col.prop(rd, "preview_pixel_size", text="Pixel Size") col.prop(rd, "preview_pixel_size", text="Pixel Size")
col.prop(cscene, "preview_start_resolution", text="Start Pixels")
class CYCLES_RENDER_PT_filter(CyclesButtonsPanel, Panel): class CYCLES_RENDER_PT_filter(CyclesButtonsPanel, Panel):
@@ -740,6 +818,7 @@ class CYCLES_RENDER_PT_filter(CyclesButtonsPanel, Panel):
col = layout.column(heading="Include") col = layout.column(heading="Include")
col.prop(view_layer, "use_sky", text="Environment") col.prop(view_layer, "use_sky", text="Environment")
col.prop(view_layer, "use_ao", text="Ambient Occlusion")
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")
@@ -748,9 +827,6 @@ class CYCLES_RENDER_PT_filter(CyclesButtonsPanel, Panel):
sub = col.row() sub = col.row()
sub.prop(view_layer, "use_motion_blur", text="Motion Blur") sub.prop(view_layer, "use_motion_blur", text="Motion Blur")
sub.active = rd.use_motion_blur sub.active = rd.use_motion_blur
sub = col.row()
sub.prop(view_layer.cycles, 'use_denoising', text='Denoising')
sub.active = scene.cycles.use_denoising
class CYCLES_RENDER_PT_override(CyclesButtonsPanel, Panel): class CYCLES_RENDER_PT_override(CyclesButtonsPanel, Panel):
@@ -796,7 +872,6 @@ class CYCLES_RENDER_PT_passes_data(CyclesButtonsPanel, Panel):
col.prop(view_layer, "use_pass_combined") col.prop(view_layer, "use_pass_combined")
col.prop(view_layer, "use_pass_z") col.prop(view_layer, "use_pass_z")
col.prop(view_layer, "use_pass_mist") col.prop(view_layer, "use_pass_mist")
col.prop(view_layer, "use_pass_position")
col.prop(view_layer, "use_pass_normal") col.prop(view_layer, "use_pass_normal")
sub = col.column() sub = col.column()
sub.active = not rd.use_motion_blur sub.active = not rd.use_motion_blur
@@ -810,6 +885,7 @@ class CYCLES_RENDER_PT_passes_data(CyclesButtonsPanel, Panel):
col.prop(view_layer, "use_pass_material_index") col.prop(view_layer, "use_pass_material_index")
col = layout.column(heading="Debug", align=True) col = layout.column(heading="Debug", align=True)
col.prop(cycles_view_layer, "pass_debug_render_time", text="Render Time")
col.prop(cycles_view_layer, "pass_debug_sample_count", text="Sample Count") col.prop(cycles_view_layer, "pass_debug_sample_count", text="Sample Count")
layout.prop(view_layer, "pass_alpha_threshold") layout.prop(view_layer, "pass_alpha_threshold")
@@ -852,7 +928,6 @@ class CYCLES_RENDER_PT_passes_light(CyclesButtonsPanel, Panel):
col.prop(view_layer, "use_pass_environment") col.prop(view_layer, "use_pass_environment")
col.prop(view_layer, "use_pass_shadow") col.prop(view_layer, "use_pass_shadow")
col.prop(view_layer, "use_pass_ambient_occlusion", text="Ambient Occlusion") col.prop(view_layer, "use_pass_ambient_occlusion", text="Ambient Occlusion")
col.prop(cycles_view_layer, "use_pass_shadow_catcher")
class CYCLES_RENDER_PT_passes_crypto(CyclesButtonsPanel, ViewLayerCryptomattePanel, Panel): class CYCLES_RENDER_PT_passes_crypto(CyclesButtonsPanel, ViewLayerCryptomattePanel, Panel):
@@ -867,6 +942,70 @@ class CYCLES_RENDER_PT_passes_aov(CyclesButtonsPanel, ViewLayerAOVPanel):
bl_parent_id = "CYCLES_RENDER_PT_passes" bl_parent_id = "CYCLES_RENDER_PT_passes"
class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel):
bl_label = "Denoising"
bl_context = "view_layer"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
cscene = context.scene.cycles
return CyclesButtonsPanel.poll(context) and cscene.use_denoising
def draw_header(self, context):
scene = context.scene
view_layer = context.view_layer
cycles_view_layer = view_layer.cycles
layout = self.layout
layout.prop(cycles_view_layer, "use_denoising", text="")
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
scene = context.scene
view_layer = context.view_layer
cycles_view_layer = view_layer.cycles
denoiser = scene.cycles.denoiser
layout.active = denoiser != 'NONE' and cycles_view_layer.use_denoising
col = layout.column()
if denoiser == 'OPTIX':
col.prop(cycles_view_layer, "denoising_optix_input_passes")
return
elif denoiser == 'OPENIMAGEDENOISE':
col.prop(cycles_view_layer, "denoising_openimagedenoise_input_passes")
return
col.prop(cycles_view_layer, "denoising_radius", text="Radius")
col = layout.column()
col.prop(cycles_view_layer, "denoising_strength", slider=True, text="Strength")
col.prop(cycles_view_layer, "denoising_feature_strength", slider=True, text="Feature Strength")
col.prop(cycles_view_layer, "denoising_relative_pca")
layout.separator()
col = layout.column()
col.active = cycles_view_layer.use_denoising or cycles_view_layer.denoising_store_passes
row = col.row(heading="Diffuse", align=True)
row.prop(cycles_view_layer, "denoising_diffuse_direct", text="Direct", toggle=True)
row.prop(cycles_view_layer, "denoising_diffuse_indirect", text="Indirect", toggle=True)
row = col.row(heading="Glossy", align=True)
row.prop(cycles_view_layer, "denoising_glossy_direct", text="Direct", toggle=True)
row.prop(cycles_view_layer, "denoising_glossy_indirect", text="Indirect", toggle=True)
row = col.row(heading="Transmission", align=True)
row.prop(cycles_view_layer, "denoising_transmission_direct", text="Direct", toggle=True)
row.prop(cycles_view_layer, "denoising_transmission_indirect", text="Indirect", toggle=True)
class CYCLES_PT_post_processing(CyclesButtonsPanel, Panel): class CYCLES_PT_post_processing(CyclesButtonsPanel, Panel):
bl_label = "Post Processing" bl_label = "Post Processing"
bl_options = {'DEFAULT_CLOSED'} bl_options = {'DEFAULT_CLOSED'}
@@ -999,8 +1138,8 @@ class CYCLES_PT_context_material(CyclesButtonsPanel, Panel):
row.prop(slot, "link", text="", icon=icon_link, icon_only=True) row.prop(slot, "link", text="", icon=icon_link, icon_only=True)
elif mat: elif mat:
layout.template_ID(space, "pin_id") split.template_ID(space, "pin_id")
layout.separator() split.separator()
class CYCLES_OBJECT_PT_motion_blur(CyclesButtonsPanel, Panel): class CYCLES_OBJECT_PT_motion_blur(CyclesButtonsPanel, Panel):
@@ -1051,7 +1190,7 @@ class CYCLES_OBJECT_PT_motion_blur(CyclesButtonsPanel, Panel):
def has_geometry_visibility(ob): def has_geometry_visibility(ob):
return ob and ((ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META', 'LIGHT', 'VOLUME', 'POINTCLOUD', 'HAIR'}) 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))
@@ -1278,6 +1417,10 @@ class CYCLES_LIGHT_PT_light(CyclesButtonsPanel, Panel):
if not (light.type == 'AREA' and clamp.is_portal): if not (light.type == 'AREA' and clamp.is_portal):
sub = col.column() sub = col.column()
if use_branched_path(context):
subsub = sub.row(align=True)
subsub.active = use_sample_all_lights(context)
subsub.prop(clamp, "samples")
sub.prop(clamp, "max_bounces") sub.prop(clamp, "max_bounces")
sub = col.column(align=True) sub = col.column(align=True)
@@ -1383,6 +1526,34 @@ class CYCLES_WORLD_PT_volume(CyclesButtonsPanel, Panel):
panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Volume') panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Volume')
class CYCLES_WORLD_PT_ambient_occlusion(CyclesButtonsPanel, Panel):
bl_label = "Ambient Occlusion"
bl_context = "world"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
return context.world and CyclesButtonsPanel.poll(context)
def draw_header(self, context):
light = context.world.light_settings
self.layout.prop(light, "use_ambient_occlusion", text="")
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
light = context.world.light_settings
scene = context.scene
col = layout.column()
sub = col.column()
sub.active = light.use_ambient_occlusion or scene.render.use_simplify
sub.prop(light, "ao_factor", text="Factor")
col.prop(light, "distance", text="Distance")
class CYCLES_WORLD_PT_mist(CyclesButtonsPanel, Panel): class CYCLES_WORLD_PT_mist(CyclesButtonsPanel, Panel):
bl_label = "Mist Pass" bl_label = "Mist Pass"
bl_context = "world" bl_context = "world"
@@ -1479,6 +1650,10 @@ class CYCLES_WORLD_PT_settings_surface(CyclesButtonsPanel, Panel):
subsub = sub.row(align=True) subsub = sub.row(align=True)
subsub.active = cworld.sampling_method == 'MANUAL' subsub.active = cworld.sampling_method == 'MANUAL'
subsub.prop(cworld, "sample_map_resolution") subsub.prop(cworld, "sample_map_resolution")
if use_branched_path(context):
subsub = sub.column(align=True)
subsub.active = use_sample_all_lights(context)
subsub.prop(cworld, "samples")
sub.prop(cworld, "max_bounces") sub.prop(cworld, "max_bounces")
@@ -1502,7 +1677,8 @@ class CYCLES_WORLD_PT_settings_volume(CyclesButtonsPanel, Panel):
col = layout.column() col = layout.column()
sub = col.column() sub = col.column()
col.prop(cworld, "volume_sampling", text="Sampling") sub.active = use_cpu(context)
sub.prop(cworld, "volume_sampling", text="Sampling")
col.prop(cworld, "volume_interpolation", text="Interpolation") col.prop(cworld, "volume_interpolation", text="Interpolation")
col.prop(cworld, "homogeneous_volume", text="Homogeneous") col.prop(cworld, "homogeneous_volume", text="Homogeneous")
sub = col.column() sub = col.column()
@@ -1641,7 +1817,8 @@ class CYCLES_MATERIAL_PT_settings_volume(CyclesButtonsPanel, Panel):
col = layout.column() col = layout.column()
sub = col.column() sub = col.column()
col.prop(cmat, "volume_sampling", text="Sampling") sub.active = use_cpu(context)
sub.prop(cmat, "volume_sampling", text="Sampling")
col.prop(cmat, "volume_interpolation", text="Interpolation") col.prop(cmat, "volume_interpolation", text="Interpolation")
col.prop(cmat, "homogeneous_volume", text="Homogeneous") col.prop(cmat, "homogeneous_volume", text="Homogeneous")
sub = col.column() sub = col.column()
@@ -1668,6 +1845,9 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
cbk = scene.render.bake cbk = scene.render.bake
rd = scene.render rd = scene.render
if use_optix(context):
layout.label(text="Baking is performed using CUDA instead of OptiX", icon='INFO')
if rd.use_bake_multires: if rd.use_bake_multires:
layout.operator("object.bake_image", icon='RENDER_STILL') layout.operator("object.bake_image", icon='RENDER_STILL')
layout.prop(rd, "use_bake_multires") layout.prop(rd, "use_bake_multires")
@@ -1725,6 +1905,7 @@ class CYCLES_RENDER_PT_bake_influence(CyclesButtonsPanel, Panel):
col.prop(cbk, "use_pass_diffuse") col.prop(cbk, "use_pass_diffuse")
col.prop(cbk, "use_pass_glossy") col.prop(cbk, "use_pass_glossy")
col.prop(cbk, "use_pass_transmission") col.prop(cbk, "use_pass_transmission")
col.prop(cbk, "use_pass_ambient_occlusion")
col.prop(cbk, "use_pass_emit") col.prop(cbk, "use_pass_emit")
elif cscene.bake_type in {'DIFFUSE', 'GLOSSY', 'TRANSMISSION'}: elif cscene.bake_type in {'DIFFUSE', 'GLOSSY', 'TRANSMISSION'}:
@@ -1808,12 +1989,19 @@ class CYCLES_RENDER_PT_bake_output(CyclesButtonsPanel, Panel):
layout.prop(cbk, "use_clear", text="Clear Image") layout.prop(cbk, "use_clear", text="Clear Image")
class CYCLES_RENDER_PT_debug(CyclesDebugButtonsPanel, Panel): class CYCLES_RENDER_PT_debug(CyclesButtonsPanel, Panel):
bl_label = "Debug" bl_label = "Debug"
bl_context = "render" bl_context = "render"
bl_options = {'DEFAULT_CLOSED'} bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'CYCLES'} COMPAT_ENGINES = {'CYCLES'}
@classmethod
def poll(cls, context):
prefs = bpy.context.preferences
return (CyclesButtonsPanel.poll(context)
and prefs.experimental.use_cycles_debug
and prefs.view.show_developer_ui)
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
@@ -1830,18 +2018,29 @@ class CYCLES_RENDER_PT_debug(CyclesDebugButtonsPanel, Panel):
row.prop(cscene, "debug_use_cpu_avx", toggle=True) row.prop(cscene, "debug_use_cpu_avx", toggle=True)
row.prop(cscene, "debug_use_cpu_avx2", toggle=True) row.prop(cscene, "debug_use_cpu_avx2", toggle=True)
col.prop(cscene, "debug_bvh_layout") col.prop(cscene, "debug_bvh_layout")
col.prop(cscene, "debug_use_cpu_split_kernel")
col.separator() col.separator()
col = layout.column() col = layout.column()
col.label(text="CUDA Flags:") col.label(text="CUDA Flags:")
col.prop(cscene, "debug_use_cuda_adaptive_compile") col.prop(cscene, "debug_use_cuda_adaptive_compile")
col.prop(cscene, "debug_use_cuda_split_kernel")
col.separator() col.separator()
col = layout.column() col = layout.column()
col.label(text="OptiX Flags:") col.label(text="OptiX Flags:")
col.prop(cscene, "debug_use_optix_debug") col.prop(cscene, "debug_optix_cuda_streams")
col.prop(cscene, "debug_optix_curves_api")
col.separator()
col = layout.column()
col.label(text="OpenCL Flags:")
col.prop(cscene, "debug_opencl_device_type", text="Device")
col.prop(cscene, "debug_use_opencl_debug", text="Debug")
col.prop(cscene, "debug_opencl_mem_limit")
col.separator() col.separator()
@@ -1942,22 +2141,20 @@ class CYCLES_RENDER_PT_simplify_culling(CyclesButtonsPanel, Panel):
sub.prop(cscene, "distance_cull_margin", text="") sub.prop(cscene, "distance_cull_margin", text="")
class CyclesShadingButtonsPanel(CyclesButtonsPanel): class CYCLES_VIEW3D_PT_shading_render_pass(Panel):
bl_space_type = 'VIEW_3D' bl_space_type = 'VIEW_3D'
bl_region_type = 'HEADER' bl_region_type = 'HEADER'
bl_label = "Render Pass"
bl_parent_id = 'VIEW3D_PT_shading' bl_parent_id = 'VIEW3D_PT_shading'
COMPAT_ENGINES = {'CYCLES'}
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
return ( return (
CyclesButtonsPanel.poll(context) and context.engine in cls.COMPAT_ENGINES and
context.space_data.shading.type == 'RENDERED' context.space_data.shading.type == 'RENDERED'
) )
class CYCLES_VIEW3D_PT_shading_render_pass(CyclesShadingButtonsPanel, Panel):
bl_label = "Render Pass"
def draw(self, context): def draw(self, context):
shading = context.space_data.shading shading = context.space_data.shading
@@ -1965,26 +2162,6 @@ class CYCLES_VIEW3D_PT_shading_render_pass(CyclesShadingButtonsPanel, Panel):
layout.prop(shading.cycles, "render_pass", text="") layout.prop(shading.cycles, "render_pass", text="")
class CYCLES_VIEW3D_PT_shading_debug(CyclesDebugButtonsPanel,
CyclesShadingButtonsPanel,
Panel):
bl_label = "Debug"
@classmethod
def poll(cls, context):
return (
CyclesDebugButtonsPanel.poll(context) and
CyclesShadingButtonsPanel.poll(context)
)
def draw(self, context):
shading = context.space_data.shading
layout = self.layout
layout.active = context.scene.cycles.use_preview_adaptive_sampling
layout.prop(shading.cycles, "show_active_pixels")
class CYCLES_VIEW3D_PT_shading_lighting(Panel): class CYCLES_VIEW3D_PT_shading_lighting(Panel):
bl_space_type = 'VIEW_3D' bl_space_type = 'VIEW_3D'
bl_region_type = 'HEADER' bl_region_type = 'HEADER'
@@ -2098,13 +2275,11 @@ def get_panels():
classes = ( classes = (
CYCLES_PT_sampling_presets, CYCLES_PT_sampling_presets,
CYCLES_PT_viewport_sampling_presets,
CYCLES_PT_integrator_presets, CYCLES_PT_integrator_presets,
CYCLES_RENDER_PT_sampling, CYCLES_RENDER_PT_sampling,
CYCLES_RENDER_PT_sampling_viewport, CYCLES_RENDER_PT_sampling_sub_samples,
CYCLES_RENDER_PT_sampling_viewport_denoise, CYCLES_RENDER_PT_sampling_adaptive,
CYCLES_RENDER_PT_sampling_render, CYCLES_RENDER_PT_sampling_denoising,
CYCLES_RENDER_PT_sampling_render_denoise,
CYCLES_RENDER_PT_sampling_advanced, CYCLES_RENDER_PT_sampling_advanced,
CYCLES_RENDER_PT_light_paths, CYCLES_RENDER_PT_light_paths,
CYCLES_RENDER_PT_light_paths_max_bounces, CYCLES_RENDER_PT_light_paths_max_bounces,
@@ -2121,7 +2296,6 @@ classes = (
CYCLES_VIEW3D_PT_simplify_greasepencil, CYCLES_VIEW3D_PT_simplify_greasepencil,
CYCLES_VIEW3D_PT_shading_lighting, CYCLES_VIEW3D_PT_shading_lighting,
CYCLES_VIEW3D_PT_shading_render_pass, CYCLES_VIEW3D_PT_shading_render_pass,
CYCLES_VIEW3D_PT_shading_debug,
CYCLES_RENDER_PT_motion_blur, CYCLES_RENDER_PT_motion_blur,
CYCLES_RENDER_PT_motion_blur_curve, CYCLES_RENDER_PT_motion_blur_curve,
CYCLES_RENDER_PT_film, CYCLES_RENDER_PT_film,
@@ -2129,7 +2303,7 @@ classes = (
CYCLES_RENDER_PT_film_transparency, CYCLES_RENDER_PT_film_transparency,
CYCLES_RENDER_PT_performance, CYCLES_RENDER_PT_performance,
CYCLES_RENDER_PT_performance_threads, CYCLES_RENDER_PT_performance_threads,
CYCLES_RENDER_PT_performance_memory, CYCLES_RENDER_PT_performance_tiles,
CYCLES_RENDER_PT_performance_acceleration_structure, CYCLES_RENDER_PT_performance_acceleration_structure,
CYCLES_RENDER_PT_performance_final_render, CYCLES_RENDER_PT_performance_final_render,
CYCLES_RENDER_PT_performance_viewport, CYCLES_RENDER_PT_performance_viewport,
@@ -2140,6 +2314,7 @@ classes = (
CYCLES_RENDER_PT_passes_aov, CYCLES_RENDER_PT_passes_aov,
CYCLES_RENDER_PT_filter, CYCLES_RENDER_PT_filter,
CYCLES_RENDER_PT_override, CYCLES_RENDER_PT_override,
CYCLES_RENDER_PT_denoising,
CYCLES_PT_post_processing, CYCLES_PT_post_processing,
CYCLES_CAMERA_PT_dof, CYCLES_CAMERA_PT_dof,
CYCLES_CAMERA_PT_dof_aperture, CYCLES_CAMERA_PT_dof_aperture,
@@ -2158,6 +2333,7 @@ classes = (
CYCLES_WORLD_PT_preview, CYCLES_WORLD_PT_preview,
CYCLES_WORLD_PT_surface, CYCLES_WORLD_PT_surface,
CYCLES_WORLD_PT_volume, CYCLES_WORLD_PT_volume,
CYCLES_WORLD_PT_ambient_occlusion,
CYCLES_WORLD_PT_mist, CYCLES_WORLD_PT_mist,
CYCLES_WORLD_PT_ray_visibility, CYCLES_WORLD_PT_ray_visibility,
CYCLES_WORLD_PT_settings, CYCLES_WORLD_PT_settings,

View File

@@ -86,7 +86,7 @@ def do_versions(self):
# Device might not currently be available so this can fail # Device might not currently be available so this can fail
try: try:
if system.legacy_compute_device_type == 1: if system.legacy_compute_device_type == 1:
prop.compute_device_type = 'NONE' # Was OpenCL prop.compute_device_type = 'OPENCL'
elif system.legacy_compute_device_type == 2: elif system.legacy_compute_device_type == 2:
prop.compute_device_type = 'CUDA' prop.compute_device_type = 'CUDA'
else: else:
@@ -97,12 +97,6 @@ def do_versions(self):
# Init device list for UI # Init device list for UI
prop.get_devices(prop.compute_device_type) prop.get_devices(prop.compute_device_type)
if bpy.context.preferences.version <= (3, 0, 40):
# Disable OpenCL device
prop = bpy.context.preferences.addons[__package__].preferences
if prop.is_property_set("compute_device_type") and prop['compute_device_type'] == 4:
prop.compute_device_type = 'NONE'
# We don't modify startup file because it assumes to # We don't modify startup file because it assumes to
# have all the default values only. # have all the default values only.
if not bpy.data.is_saved: if not bpy.data.is_saved:
@@ -115,7 +109,7 @@ def do_versions(self):
library_versions.setdefault(library.version, []).append(library) library_versions.setdefault(library.version, []).append(library)
# Do versioning per library, since they might have different versions. # Do versioning per library, since they might have different versions.
max_need_versioning = (3, 0, 25) max_need_versioning = (2, 93, 7)
for version, libraries in library_versions.items(): for version, libraries in library_versions.items():
if version > max_need_versioning: if version > max_need_versioning:
continue continue
@@ -172,6 +166,10 @@ def do_versions(self):
if not cscene.is_property_set("filter_type"): if not cscene.is_property_set("filter_type"):
cscene.pixel_filter_type = 'GAUSSIAN' cscene.pixel_filter_type = 'GAUSSIAN'
# Tile Order
if not cscene.is_property_set("tile_order"):
cscene.tile_order = 'CENTER'
if version <= (2, 76, 10): if version <= (2, 76, 10):
cscene = scene.cycles cscene = scene.cycles
if cscene.is_property_set("filter_type"): if cscene.is_property_set("filter_type"):
@@ -188,6 +186,10 @@ def do_versions(self):
if version <= (2, 79, 0): if version <= (2, 79, 0):
cscene = scene.cycles cscene = scene.cycles
# Default changes # Default changes
if not cscene.is_property_set("aa_samples"):
cscene.aa_samples = 4
if not cscene.is_property_set("preview_aa_samples"):
cscene.preview_aa_samples = 4
if not cscene.is_property_set("blur_glossy"): if not cscene.is_property_set("blur_glossy"):
cscene.blur_glossy = 0.0 cscene.blur_glossy = 0.0
if not cscene.is_property_set("sample_clamp_indirect"): if not cscene.is_property_set("sample_clamp_indirect"):
@@ -201,6 +203,7 @@ def do_versions(self):
view_layer.use_pass_cryptomatte_material = cview_layer.get("use_pass_crypto_material", False) view_layer.use_pass_cryptomatte_material = cview_layer.get("use_pass_crypto_material", False)
view_layer.use_pass_cryptomatte_asset = cview_layer.get("use_pass_crypto_asset", False) view_layer.use_pass_cryptomatte_asset = cview_layer.get("use_pass_crypto_asset", False)
view_layer.pass_cryptomatte_depth = cview_layer.get("pass_crypto_depth", 6) view_layer.pass_cryptomatte_depth = cview_layer.get("pass_crypto_depth", 6)
view_layer.use_pass_cryptomatte_accurate = cview_layer.get("pass_crypto_accurate", True)
if version <= (2, 93, 7): if version <= (2, 93, 7):
if scene.render.engine == 'CYCLES': if scene.render.engine == 'CYCLES':
@@ -226,36 +229,6 @@ def do_versions(self):
cscene.ao_bounces = 1 cscene.ao_bounces = 1
cscene.ao_bounces_render = 1 cscene.ao_bounces_render = 1
if version <= (3, 0, 25):
cscene = scene.cycles
# Default changes.
if not cscene.is_property_set("samples"):
cscene.samples = 128
if not cscene.is_property_set("preview_samples"):
cscene.preview_samples = 32
if not cscene.is_property_set("use_adaptive_sampling"):
cscene.use_adaptive_sampling = False
cscene.use_preview_adaptive_sampling = False
if not cscene.is_property_set("use_denoising"):
cscene.use_denoising = False
if not cscene.is_property_set("use_preview_denoising"):
cscene.use_preview_denoising = False
if not cscene.is_property_set("sampling_pattern") or \
cscene.get('sampling_pattern') >= 2:
cscene.sampling_pattern = 'PROGRESSIVE_MULTI_JITTER'
# Removal of square samples.
cscene = scene.cycles
use_square_samples = cscene.get("use_square_samples", False)
if use_square_samples:
cscene.samples *= cscene.samples
cscene.preview_samples *= cscene.preview_samples
for layer in scene.view_layers:
layer.samples *= layer.samples
cscene["use_square_samples"] = False
# Lamps # Lamps
for light in bpy.data.lights: for light in bpy.data.lights:
if light.library not in libraries: if light.library not in libraries:
@@ -276,6 +249,10 @@ def do_versions(self):
if version <= (2, 76, 9): if version <= (2, 76, 9):
cworld = world.cycles cworld = world.cycles
# World MIS Samples
if not cworld.is_property_set("samples"):
cworld.samples = 4
# World MIS Resolution # World MIS Resolution
if not cworld.is_property_set("sample_map_resolution"): if not cworld.is_property_set("sample_map_resolution"):
cworld.sample_map_resolution = 256 cworld.sample_map_resolution = 256

Some files were not shown because too many files have changed in this diff Show More