1
1

Compare commits

...

368 Commits

Author SHA1 Message Date
6f40a18ecc Version bump: 2.83.21-rc 2022-04-20 12:22:19 +02:00
a56e2faeb7 Version bump: 2.83.20-release 2022-04-19 18:00:14 +02:00
92d3a15239 Fix broken shapekeys: check for 'NULL' from pointer too.
Add check for `NULL` `from` pointer to `BLO_main_validate_shapekeys`,
and delete these shapekeys, as they are fully invalid and impossible to
recover.

Found in a studio production file (`animation
test/snow_parkour/shots/0040/0040.lighting.blend`, svn rev `1111`).
Would be nice to know how this was generated too...
2022-02-22 11:56:48 +01:00
574f685855 Fix T95787: Texture paint: Apply Camera Image crash for certain images
This does not happen with **any** image, but with images that have ID
properties.

ID properties are used to store view projection matrices (e.g. for
reprojection with `Image from View` or `Quick Edit` -- these are the
ones we are interested in), but of course they can be used for anything
else, too. The images in the file from the report have ID properties from
an Addon for example.

So the crash can reliably be reproduced with **any** image doing the
following:
```
bpy.data.images['myImage']['myIDprop'] = "foo"
```
This would lead code in `texture_paint_camera_project_exec` to think the
needed `view_data` is on the image (but in reality it was just some
other IDprop).

Solution is simple: just check `view_data` is really valid after getting
it from the IDprops.

Maniphest Tasks: T95787

Differential Revision: https://developer.blender.org/D14116
2022-02-22 11:55:57 +01:00
Bastien Montagne
ff05921099 Fix T95601: Missing handling of keyingsets ID pointers in lib_query/foreach_id code
Fix T95601: Missing handling of keyingsets ID pointers in lib_query/foreach_id code.
This will have to be backported to 2.93 and possibly 2.83 if possible.
2022-02-22 11:53:02 +01:00
4f16dad6b3 Fix T95137: Spline calc_length not working with just 1 NURB point
The NURB case did not properly handle a curve with only 1 point.

Ref D13904
2022-02-22 11:11:06 +01:00
56958cd2e7 Cleanup: Avoid possible NULL pointer error
In normal conditions, `gpf` always has a value, but better move inside the NULL checking.
2022-02-22 11:06:40 +01:00
b84159e441 Version bump: 2.83.20-rc 2022-02-02 13:17:51 +01:00
86c526d2c7 Version bump: 2.83.19-release 2022-02-01 21:05:11 +01:00
a6d70eecf4 Fix T94837: curve tilt on a 2-point-curve is wrong
2-point-curves are treated separately from 3plus-point-curves (assume a
lot of the twisting reduction can be skipped, so there is a dedicated
function for single segment curves).

And while using the 3plus-point-curves function [`make_bevel_list_3D`]
would actually work in this case, the dedicated function
`make_bevel_list_segment_3D` would only consider the tilt of the second
point and would just copy over the quat to the first point as well. Dont
see a reason for this, now consider the first point's tilt as well.

Maniphest Tasks: T94837

Differential Revision: https://developer.blender.org/D13813
2022-01-18 10:48:16 +01:00
6ea0ecdc51 Fix T94089: GPencil Drawing don't Update after paste in Dopesheet
When paste new frames, the datablock need to be tagged to update the drawings.
2022-01-18 10:46:31 +01:00
05ca297596 Fix T94903: GPencil: Copying keys doesn't preserve Keyframe Type
When a new frame is created, ensure the keytype of source key is used.
2022-01-18 10:44:33 +01:00
Aleksi Juvani
f7b8875ed5 Fix PSYS_GLOBAL_HAIR stripped even if connecting the hair fails
After disconnecting hair on an object, if you then hide the particle system, and try connecting the hair again, the operator is cancelled due to `remap_hair_emitter` returning `false` because `target_psmd->mesh_final` is NULL, but `connect_hair` will still strip the `PSYS_GLOBAL_HAIR` flag, which will cause the hair in the hidden particle system to be positioned incorrectly. The correct behavior is to strip the flag only if `remap_hair_emitter` succeeds.

Differential Revision: https://developer.blender.org/D13703
2022-01-18 10:10:00 +01:00
0ac83d05d7 Fix T94661: Out-of-bounds memory access due to malformed DDS image file
Harden bounds check in the stream reader avoiding integer overflow.
2022-01-18 10:08:02 +01:00
0b2ea1d69b Fix T86952: Buffer overflow reading specific DDS images
Add a data boundary check in the flipping code.

This code now also communicates the number of mipmap levels
it processed with an intent to avoid GPU texture from using
more levels than there are in the DDS data.

Differential Revision: https://developer.blender.org/D13755
2022-01-18 10:05:59 +01:00
63fdcbb588 Fix T94629: The IMB_flip API would fail with large images
Fix IMB_flip[xy] to handle cases where integer overflow might occur when
given sufficiently large image dimensions.

All of these fixes were of a similar class where the intermediate
sub-expression would overflow silently. Widen the types as necessary.

Differential Revision: https://developer.blender.org/D13744
2022-01-18 09:57:59 +01:00
Aleksi Juvani
6570d5596b Fix: connecting hair fails on meshes with no generative modifiers
Fixes a bug introduced in rB5dedb39d447b. `mesh_original` is not set if the
mesh has no generative modifiers, in which case we can use `mesh_final`, which
would seem to be consistent with the rest of the particle code. An alternative
approach would be to make sure that `mesh_original` is always set in
`deformVerts`.

Differential Revision: https://developer.blender.org/D13754
2022-01-18 09:42:27 +01:00
Aleksi Juvani
a4171f4866 Fix T54488: hair disconnect/reconnect not working with modifiers
Take the Use Modifier Stack setting into account when connecting hair, and
fix wrong results results when using deforming modifiers also.

Differential Revision: https://developer.blender.org/D13704
2022-01-18 09:40:52 +01:00
b61a912128 Fix T94564: Mirror clipping is not properly placed in sculpt mode
If a mirror object is used in a mirror modifier, sculptmode did not take
this into account (and instead always clipped on the sculpt objects
local axis).

Now take this into account by storing a matrix in the preparation
function `sculpt_init_mirror_clipping` and use that later in
`SCULPT_clip`.

Maniphest Tasks: T94564

Differential Revision: https://developer.blender.org/D13711
2022-01-18 09:02:31 +01:00
22ce804c7d Fix T94544: crash removing image used as camera background via python
Since 2.8, background images are tied to cameras (in 2.79 these were
tied to a View3D I think).
Code in `BKE_library_id_can_use_idtype` wasnt taking this relation
between `Camera` and `Image` into account, thus leading to ID deletion/
unlinking not working properly -- in particular `libblock_remap_data`
not doing its thing (and leaving the camera as a user of the image),
then things went downhill from there...

Now make the "Camera-can-use-an-Image" relation clear in
`BKE_library_id_can_use_idtype`.

Maniphest Tasks: T94544

Differential Revision: https://developer.blender.org/D13722
2022-01-18 08:45:43 +01:00
8b4d0d7338 Fix T94262: Grease Pencil Blur Effect DoF mode wrong
This was visible outside of camera view and was not respecting the
"Depth of Field" checkbox on the Camera properties.

Now return early if DoF should not be visible.

Maniphest Tasks: T94262

Differential Revision: https://developer.blender.org/D13631
2022-01-18 08:43:04 +01:00
dd9f4e1b81 Fix T94422: Shading/Normals break on array modifier caps
The array modifier does not necessarily tag normals dirty.
If it doesnt, normals are recalculated "internally" using the offset ob
transform. This was happening for the array items, but not for the caps.

Now do the same thing for caps.

Maniphest Tasks: T94422

Differential Revision: https://developer.blender.org/D13681
2022-01-18 08:39:39 +01:00
9d519f1db4 Fix T89081: Freestyle noise seed of zero crash
This leads to division by zero in Freestyle's NoiseShader which also
crashes blender.

Not sure if we really need a do_version patch for old files, as an
alternative we could also force a positive number in the NoiseShader.
This patch does not do either, just force a positive range in RNA from
now on.

Maniphest Tasks: T89081

Differential Revision: https://developer.blender.org/D13332
2022-01-17 17:06:17 +01:00
50733e1479 Fix T93322: Freestyle Sinus Displacement Division by Zero Crash
This happens if the Wavelength is set to 0.0f.

Not sure if we really need a do_version patch for old files, as an
alternative we could also force a slight offset in the
SinusDisplacementShader. This patch does not do either, just force a
positive range from now on.

Maniphest Tasks: T93322

Differential Revision: https://developer.blender.org/D13329
2022-01-17 16:38:44 +01:00
944a705215 Fix T93320: Freestyle LineStyleModifier blend 'Minimum' error
This was just a typo in {rBb408d8af31c9}
Must be 'MINIMUM' (instead of 'MININUM').

Maniphest Tasks: T93320

Differential Revision: https://developer.blender.org/D13328
2022-01-17 16:36:26 +01:00
b82b608e91 Fix T93007: Cycles not updating for animated Object properties like color 2022-01-17 16:21:33 +01:00
fcdaeba778 Fix T94799: GPencil Strokes drawn at 0.0 Strength still visible
There was a clamp with a value greater than 0.
2022-01-17 15:51:28 +01:00
6786100313 Fix T93130: Frame Selected with selected paint mask does not work
This broke with {rB20fac2eca723} (which landed in 2.63), so long
standing bug.

Convention for paint modes is:
- when no paint mask is active, `Frame Selected` will focus the last
stroke
- when paint mask is active, `Frame Selected` will focus the selected
mask faces

To check the right vert coords we have to offset with `mp->loopstart`.

Maniphest Tasks: T93130

Differential Revision: https://developer.blender.org/D13247
2022-01-17 15:44:42 +01:00
5d1efa9759 Fix T93117: Texture paint clone tool crash in certain situation
Caused by {rBaf162658e127}, so long standing bug.

When changing clone slots (report involved a quite complicated sequence
of selecting textures and undo -- but I think this could happen in more
situations) code checks for UV of new clone slot.
However, since above commit the slot and the clone slot were mixed up,
so in this case the responsible NULL check (for when no UV is assigned)
wasnt working.
Now correct this (NULL check the clone slot uv -- instead of the paint
slot UV).

note: not sure why low level CustomData functions actually dont do the
name NULL checks themselves (seems like callers are always responsible).

Maniphest Tasks: T93117

Differential Revision: https://developer.blender.org/D13378
2022-01-17 15:42:26 +01:00
4946f0c5a2 Fix T93563: Crash subdividing with overlapping tri and quad
The first loop was left out when finding the split edge boundary.

Error from f2138686d9.
2022-01-17 15:41:21 +01:00
Bastien Montagne
cbc6c3938d Fix T93353: Reload Library Override file loses Constraints, take II.
When adding `INSERT` operations over RNACollection items, rna diffing
code did not properly report the properties as not being equals.

This in turn triggered the 'purge unused exiting override properties'
mechanism, thus deleting the exitsting (valid) insert override property
operation.

NOTE: This should also be backported to 2.93, and probably 2.83.

Reviewed By: sybren, jbakker

Maniphest Tasks: T93353

Differential Revision: https://developer.blender.org/D13426
2022-01-17 15:40:21 +01:00
Ankit Meel
ca881afef1 Fix T88877: 2.93: Crash on recent OSX with a non-English locale.
Looks like OSX changed the default format of its locale, which is not
valid anymore for gettext/boost::locale.

Solution based on investigations and patch by Kieun Mun (@kieuns), with
some further tweaks by Ankit Meel (@ankitm), many thanks.

Also add an exception catcher on `std::runtime_error` in
`bl_locale_set()`, since in OSX catching the ancestor `std::exception`
does not work with `boost::locale::conv::conversion_error` and the like
for some reasons.

Reviewed By: #platform_macos, brecht

Maniphest Tasks: T88877

Differential Revision: https://developer.blender.org/D13019
2022-01-17 15:30:16 +01:00
70395ff7fd Fix T93194: greasepencil channel lists ignoring collection visibility
Same fix as rB0a3b4d4c64f1, but this time for greasepencil.

To repeat: dopesheet in greasepencil mode was ignoring the temporariy
visibility flag of collections. As a result, even though the dopesheet
was supposed to show animation data of visible greasepencils only was
still showing such data of greasepencils that were hidden by hiding
their collection.
2022-01-17 15:26:13 +01:00
798b989e7d Fix/workaround macOS Rosetta crash running Cycles AVX tests
Just disable these tests on macOS for now as fixing seems hard, and we want to
be able to cross-compile and test x86_64 on Arm machines on the buildbot.
2022-01-05 21:24:13 +01:00
2bd6a9d882 Fix Cycles AVX test failure with x86_64 build running on Arm
Don't create const avx vectors before validating if CPU supports AVX.
2022-01-05 20:29:57 +01:00
22cf8b9532 Fix T91680: viewport selection broken in macOS x86 build with Xcode 13
There is an apparent compiler bug here, tweak the code to avoid it. This did
not affect official builds as we were still using Xcode 12.
2021-12-08 15:45:22 +01:00
95c82513ca Fix potential crash opening 3.0 blend files in older versions.
Affects insertion of constraints in liboverrides. In some cases, when
opening newer post-3.0 .blend files, the source won't be found anymore,
override apply code then needs to fail properly instead of crashing.

Related to refactor from  rB33c5e7bcd5e5.
2021-11-22 14:33:45 +01:00
14b8f6c25b VSE: Implement sanity check for files with more channels than supported
This is a follow up to 8fecc2a852.

This makes sure future .blend files that have more channels than the
limit won't break Blender.

For LTS this happens silently, without warning the users.

This is part of https://developer.blender.org/D12645

Differential Revision: https://developer.blender.org/D12648
2021-10-29 10:33:40 +02:00
b382632665 Add missing "CUDA_ERROR_UNSUPPORTED_PTX_VERSION" to CUEW
This is required for Cycles to report a meaningful error message when it fails to load a PTX module
created with a newer CUDA toolkit version than the driver supports.

Ref T91879
2021-10-29 10:29:25 +02:00
90ee4b94ee Fix LLVM 12 symbol conflict with Mesa drivers, after recent Linux libs update 2021-10-29 10:17:48 +02:00
edee6f911c Blender 2.83.19-rc 2021-09-29 14:43:51 +02:00
00b0253c46 Blender 2.83.18-release 2021-09-28 16:02:53 +02:00
08fe34b7fd Fix T91557: Texture Paint Stencil doesnt use assigned UV Layer
Choosing a UV layer would actually affect the overlay in the viewport
and also painting with the mask brush was in that UV space, but the
resulting stencil mask was always applied with the active UV (not the
explicitly selected stencil UV -- the one one is looking at in the
viewport!) to painting.

This has been like that as far as I have checked back (at least 2.79b),
I am surprised this has not come up before, but it does not seem to make
sense at all...

Now use the UV specified for the stencil layer when applying the mask for
painting, so it corresponds to the stencil mask one is looking at in the
viewport.

Maniphest Tasks: T91557

Differential Revision: https://developer.blender.org/D12583
2021-09-27 08:37:11 +02:00
87237df4fd Fix default surface resolution U/V mis-match
The resolution for surfaces was 12 for U, 4 for V,
where both should have been set to 4.

Regression in 9a076dd95a
2021-09-27 08:36:43 +02:00
c6856da22c Fix memory leak if an error occurred assigning id-property sequence 2021-09-22 08:49:30 +02:00
5f156291cd Fix error scaling thumbnails to zero dimensions
Follow up to fix for T89868.
2021-08-30 11:34:37 +02:00
06317ce957 Fix invalid mask use for the UV-project modifier
Mistake in a30a817933.
2021-08-30 11:33:59 +02:00
161e90f7ac Fix T90651: camera reconstruction crash without scene camera
This was working differently in 2.79, tried tracking this down and it
seems this was wrong since the 2.8 beginning in {rB7907dfc40018}.

This would not only crash without an active scene camera, but would also
result in different tracks from different camera's constraints could not
be selected.

So select id depends on corresponding camera, remove the dependency on
scene camera completely.

Maniphest Tasks: T90651

Differential Revision: https://developer.blender.org/D12230
2021-08-30 11:33:21 +02:00
0367ce4b19 Fix buffer size mismatch in SCRIPT_OT_python_file_run
Reading paths over 512 bytes would cause a buffer overrun.
2021-08-30 11:25:16 +02:00
7dd982a9b8 Pipeline: Use explicit cuda version numbers. 2021-08-23 11:05:49 +02:00
6be85c0eff Fix T90791: Knife project leaks memory with curve/text cutter 2021-08-23 08:26:44 +02:00
e41a8d57d4 Cleanup: rename BKE_mesh_free -> BKE_mesh_free_data
It wasn't obvious this didn't free the memory of the mesh it's self
leading to memory leaks.
2021-08-23 08:24:11 +02:00
e291f482ef Fix memory leak in edit-mesh dissolve degenerate 2021-08-23 08:18:07 +02:00
add1d601dc Fix T90719: Boost sources dowload address needed to be updated. 2021-08-23 08:17:11 +02:00
d3856b7e97 BLI_math: Fix several division-by-zero cases.
Those were caused by various tools used on degenerate geometry, see
T79775.

Note that fixes are as low-level as possible, to ensure they cover as
much as possible of unreported issues too.

We still probably have many more of those hidden in BLI_math though.
2021-08-16 10:01:13 +02:00
dbdf22786d Fix T83164: Spline IK joint_bindings parameter is broken.
Code freeing the array would not properly reset its length value to
zero.

Note that this corrupted data could also be saved in .blend files, so
had to bump fileversion and add some doversion code too.

Fix T90166: crash when creating a liboverride.
2021-08-16 09:48:49 +02:00
103e314be4 Cleanup/Fix RNA array length accessors returning non-zero values in invalid cases.
This was apparently done in two places only, with a very cryptic comment
(`/* for raw_access, untested */`), and... I cannot see how returning a
non-zero length value for an array that does not exist or is not
accessible at least, would be anything but an obvious source of issues.

Note that both commits adding those lines are from stone ages (2009):
rBcbc2c1886dee and rB50e3bb7f5f34.
2021-08-16 09:45:29 +02:00
bca66a2a71 Fix T89835: Crash after Instancing to Scene after making linked Collection local.
Even though the ID itself remain the same after being made local, from
depsgraph point of view this is a different ID. Hence we need to tag all
of its users for COW update, as well as rebuild depsgraph relationships.

Should be also backported to LTS 2.93 (and 2.83 if possible).
2021-08-16 09:44:36 +02:00
a70b625a10 Fix T85436: Separate by loose parts doesn't show new objects
Only the "changed" state from the last edit-object was used,
this meant the operator would not perform the necessary update
with multi-object edit-mode.

Use "changed" & "changed_multi" naming convention.
2021-08-16 09:43:07 +02:00
607e3d3b88 Fix T90417: font loading creates duplicate ID names
Also repair any errors in existing files.

Error from e0dd3fe587.
2021-08-16 09:41:03 +02:00
a609e9f07f Fix T89450: Crash slicing BMEditSelSeq
Slicing with indices greater than the length of the sequence would crash.
2021-08-16 09:34:35 +02:00
120292a190 Fix slicing with negative indices
Negative indices that remained negative after adding the sequence length
caused incorrect slicing.

With the default scene for example:

   bpy.context.scene.objects[-4:2]

Gave a different result to:

   tuple(bpy.context.scene.objects)[-4:2]

Clamp indices above zero so loops that step forward works as intended.
2021-08-16 09:33:41 +02:00
6d1895c681 Fix fix invalid index use for edit-mesh laplacian smooth
Only vertex indices were ensured to be correct.
2021-08-16 09:23:01 +02:00
bbfb29c794 Fix T90493: Undo a knife-project operation crashes
The crash occurred calling because mesh_get_eval_final in edit-mode
freed all derived mesh data without tagging the object for updating.

However meshes in edit-mode weren't meant to be used as knife-project
source-data, adding support for multi object edit-mode  caused this.
2021-08-16 09:17:01 +02:00
4f7dc4c918 Fix T89241: 3D Text "Scale to Fit" wraps onto the second line
Disable wrapping when "scale to fit" is used, assert the error is
small so an invalid scale-to-fit value wont go by unnoticed.
2021-08-16 09:16:31 +02:00
ccc6b688fe Blender 2.83.18-rc 2021-08-11 13:54:48 +02:00
430262b133 Blender 2.83.17-release 2021-08-10 11:03:09 +02:00
86ff78ca09 Remove pipeline_config.json.
File is replaced by pipeline_config.yaml.
2021-08-02 14:44:30 +02:00
1f96166e08 Fix memory leak with Python RNA property get callback errors
Failure to return a list of the expected size & type wasn't
decrementing the value, leaking a reference.

Caused by 127b5423d6 a workaround for the
real error that was fixed f5e020a7a6.
2021-08-02 08:18:59 +02:00
66c65da688 Cycles: upgrade CUDA to 11.4
This fixes a performance regression on Ampere cards, on specific scenes like
classroom. For cycles-x there is little difference, but this is still helpful
for LTS releases, and we need to upgrade at some point anyway.
2021-07-27 14:12:58 +02:00
James Monteath
29001c9c88 2.83 uses gcc 9. 2021-07-26 17:33:59 +02:00
d395109e5a Fix 2.83 uses optix 7.0. 2021-07-26 16:13:00 +02:00
550752a8fb Fix pipeline configuration: Use GCC 8. 2021-07-26 15:39:23 +02:00
5a59c563da Add pipeline config formatted in yaml. 2021-07-26 15:18:36 +02:00
0518bd85f1 Fix merge error in apple build. 2021-07-26 10:32:38 +02:00
41d31be637 macOS: use -fno-strict-aliasing for all build types.
The old code was added in {rBbaa4a9c7d4dd}

While the hotfix committed in {rB2ddecfffc3d3a3a1db4ae45e8665ca} fixed
the id_management test, the correct reason was found at
https://bugs.llvm.org/show_bug.cgi?id=47984

This matches the behavior on Linux.
2021-07-26 09:58:31 +02:00
b2f2daf21f Fix object "Set Origin" operating on linked library data
Regression in d25747ee75
2021-07-26 09:55:53 +02:00
1a1510a3a0 Fix T70356: Scaling up 1x1 pixel image reads past buffer bounds
Also resolve a crash when when displaying thumbnails, see T89868.
2021-07-26 09:52:15 +02:00
Jesse Yurkovich
0de54a9cfe Fix T89868: Crash showing thumbnail of wide-aspect image
Scaling down images could create images with a width or height of zero.

Clamp at 1 to prevent a crash, also add an assert to scaling functions.

Ref D11956
2021-07-26 09:51:44 +02:00
c5c4727d6e Fix T89405: Viewport Render Preview glitching (AMD)
AMD Drivers didn't report an additional space in the renderer. This made
testing for the HQ workaround fail and the issue appeared back on
certain cards.

This fix will test with surrounding spaces or if the renderer name
endswith the given string. If any of these are the case the hq normals
workaround will be enabled.

Original patch {2262d6c45adf}.
2021-06-30 09:01:10 +02:00
Fen
8dd18a77e7 Fix T89247: Dereference arguments to comparison function correctly
`bm_face_len_cmp` incorrectly interpreted its arguments as `BMFace *`
instead of `BMFace **`, causing an out-of-bounds read.

Ref D11637
2021-06-30 08:21:58 +02:00
f6fb695ed8 Fix invalid polygon normal array access building bake data
Pre computed normals index wasn't properly aligned.
Regression from 2ec00ea0c1.
2021-06-30 08:20:04 +02:00
fb67495c7f Versionbump: Blender 2.83.17-rc 2021-06-16 13:36:48 +02:00
051567553d Versionbump: 2.83.16-release 2021-06-15 10:46:31 +02:00
a925c8969d Fix T77651: Black screen on Blender startup on ChromeOS
Apparently `textureSize` doesn't work with
`sampler1DArray` on this OS.

Thanks to @dave1853 for finding the source of the
problem.
2021-06-09 13:01:41 +02:00
531e4fcf3e Fix T88813: Scalable allocator not used on win10
Due to the way we ship the CRT on windows TBB's
malloc proxy was unable to attach it self to
the memory management functions on windows 10.

This change moves ucrtbase.dll out of the blender.crt
folder and back into the main blender folder to side
step some undesirable behaviour on win10 making TBB
once more able to attach it self.

Having this work again, should give a speed
boost in memory allocation heavy workloads
such as mantaflow.

For details on how this only failed on Win10
see T88813
2021-06-09 12:57:06 +02:00
58e3d82108 Fix buffer overrun in paint_line_strokes_spacing
Error in 87cafe92ce
2021-06-01 14:02:30 +02:00
6dde03eb4a Added v2.83 pipeline config for new buildbot. 2021-05-31 08:46:59 +02:00
d553edeb7d Fix T88227: Eevee not working on AMD 535 cards.
Enabled HQ normals workaround for this specific configuration.
2021-05-21 08:13:47 +02:00
3f973791fb Fix T88190: Freed memory use when iterating over id-properties
The id-property iterator referenced a PyObject pointer without
increasing it's user count - allowing for errors if the value
goes out of scope during iteration.
2021-05-21 08:12:15 +02:00
1555809480 Fix memory leak in Python IDproperty iterator
Looping over IDProperty keys or calling iteritems leaked memory.

Error in original Python idproperty support from
8768707610
2021-05-21 08:09:44 +02:00
b779fae993 Fix T88180: Enable HQ normal workaround for RX 580X cards.
This needs to be backported to 2.83.
2021-05-21 08:09:16 +02:00
eee51b3cda Fix T88145: Dynamic Paint initial color using vertex color not working as expected
Mistake in {rBe48c4d73d378}.

Was using the vertex index as a lookup for the loop color (instead of
the loop index).
(Issue was not present in original D1429 btw).

Maniphest Tasks: T88145

Differential Revision: https://developer.blender.org/D11212
2021-05-21 08:06:03 +02:00
0babc7a657 Version bump 2.83.16 rc. 2021-05-21 07:55:53 +02:00
704f56d68f macOS build: set minimum deployment target correctly
Equivalent of D11323 for 2.83. Make `CMAKE_OSX_DEPLOYMENT_TARGET`
independent of buildbot settings and always set to 10.11.
That fixes the launch error on OS older than buildbot's.

Maniphest Tasks: T88419
Differential Revision: https://developer.blender.org/D11328
2021-05-20 22:38:57 +05:30
fd30365201 Version bump 2.83.15 stable.
2.83.14 missed cuda/optix kernels in distribution. Better to bump the
  version.
2021-05-19 13:41:49 +02:00
759fd9e4c2 Version: Blender v2.83.14-release 2021-05-11 08:03:15 +02:00
ae368ff74b Version bump: Blender 2.83.14 rc 2021-05-07 07:57:22 +02:00
9db56e4b7b Fix memory leak in object.mode_set_with_submode 2021-05-07 07:54:56 +02:00
Wannes Malfait
ec0a3ff456 Fix build error: use of unintialized variable
Differential Revision: https://developer.blender.org/D11115
2021-05-07 07:53:38 +02:00
0b61b75151 Fix T87863: Bisect fails when edges of an N-gon lie on the plane
Logic for bisect handled edges in the face crossing the plane,
but not concave N-gons containing multiple edges that lie on the plane.
2021-05-07 07:52:43 +02:00
1e16662de8 Fix T87592: Mirror fail with bisect, axis object & non-uniform scale
Bisect-plane calculation needed to take non-uniform scale into account.
2021-05-07 07:51:22 +02:00
42089fcde0 Fix T86765: Custom properties are included in __dir__
Remove custom properties from `__dir__` method result since these
can't be accessed using `__getattr__`.

Introduced in the 2.5x Python API update.
2021-05-07 07:50:32 +02:00
c5c35e9b47 Fix for building with MSVC 2021-05-07 07:49:22 +02:00
47cc05471d Fix T86170: Memory leak clearing the Python instance for COW id data
As Python can access COW ID's, ensure it's instance is kept on update.

This could happen when the "Use Self" argument was enabled for a driver.
2021-05-07 07:47:56 +02:00
d35974cd87 Fix T87055: Crash applying modifier on mesh with multires data 2021-04-21 14:42:49 +02:00
93472a2389 Versionbump: blender v2.83.14-beta 2021-04-21 14:42:00 +02:00
bb50046730 Version: Blender v2.83.13-release 2021-03-09 08:21:36 +01:00
052156a646 Fix Cycles CUDA build error with Visual Studio 2019 v16.9
Something in this update broke the floor() function in CUDA, instead use
floorf() like we do everywhere else in the kernel code. Thanks to Ray
Molenkamp for identifying the solution.
2021-03-08 14:05:30 +01:00
2833f2b9bf Fix T84988: Armature symmetries crashes with action constraint
Action constraint without an action pointer set was crashing.
2021-03-03 09:34:17 +01:00
e954e565e1 Fix T79999: Double color management applied during viewport animation render
In 2.81 there was a change to increase the performance of viewport
animation rendering. This change would perform the color management on the
GPU if the only 8bit was needed. This saved CPU cycles and data
transfer.

The issue is that in the image editor or when saving the image the CM
will be reapplied. Although the speed is desired, exporting the actual
colors has more priority.

In the ticket there is an analysis that shows that shows that this fix
is the correct short term step to take. It would be better that the
render result is aware of the color space of its buffers so the applying
color management could be skipped when saving to disk or drawing in the
image editor.

The issue with this change is the performance penalty it has.

Reviewed By: Brecht van Lommel

Maniphest Tasks: T79999

Differential Revision: https://developer.blender.org/D10371
2021-03-03 09:24:49 +01:00
7b00b67dfd Version: 2.83.13 rc 2021-02-23 09:50:58 +01:00
738c38cf29 Version: 2.83.13 beta 2021-02-23 07:22:40 +01:00
c661515090 Cycles: Add CUDA 11 build support
With this patch the build system checks whether the "CUDA10_NVCC_EXECUTABLE" CMake
variable is set and if so will use that to build sm_30 kernels. Similarily for sm_8x kernels it
checks "CUDA11_NVCC_EXECUTABLE". All other kernels are built using the default CUDA
toolkit. This makes it possible to use either the CUDA 10 or CUDA 11 toolkit by default and
only selectively use the other for the kernels where its a hard requirement.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9179
2021-02-08 15:50:03 +01:00
8d02177ab0 Fix Cycles CUDA kernels for Ampere not building with CUDA 11
Running Blender on Ampere cards was already possible with ptx, this fix is
needed to support building CUDA binaries.

Note the CUDA version used for official Blender builds is still 10, this is
merely the change to make it possible for those using CUDA 11 and specifying
the sm_8x kernels to be compiled.

Found by Milan Jaros.
2021-02-08 15:50:03 +01:00
f00ba34411 Cycles: Enable OptiX on first generation Maxwell GPUs again 2021-02-08 13:33:04 +01:00
b4bddf2e3b Fix OptiX being shown as available on first generation Maxwell GPUs
The OptiX kernels are compiled for target "compute_sm_52", which is only available on second
generation Maxwell GPUs, so disable support for older ones.
2021-02-08 13:32:55 +01:00
08aaa07adb Cycles: Use pre-compiled PTX kernel for older generation when no matching one is found
This patch changes the discovery of pre-compiled kernels, to look for any PTX, even if
it does not match the current architecture version exactly. It works because the driver can
JIT-compile PTX generated for architectures less than or equal to the current one.
This e.g. makes it possible to render on a new GPU architecture even if no pre-compiled
binary kernel was distributed for it as part of the Blender installation.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8332
2021-02-08 13:32:40 +01:00
510541563e Cycles: Enable OptiX on all Maxwell+ GPUs 2021-02-08 13:32:12 +01:00
ad0da42751 Version bump: Blender v2.83.12 release
Blender v2.83.11 is skipped due to unable to uploading to the windows
store.
2021-01-26 16:41:14 +01:00
f897f122cb GPU: Enabled hq normals workaround for any AMD driver on polaris 2021-01-26 12:36:26 +01:00
949314af2a GPU: Enable HQ normals workaround for AMD 21.1.1 driver.
AMD 21.1.1 still has the same issues as reported in T82856.
2021-01-26 12:35:16 +01:00
79976ba4df Buildbot: Fixed crash when building RC builds
Building RC builds would parse `BLENDER_VERSION_CYCLE_NUMBER` that
doesn't exist anymore. It was removed by {D7748}.

This change removes it from `buildbot_utils.py`.
2021-01-25 11:53:59 +01:00
fbddc8d2e4 Version bump: Blender v2.83.11 rc 2021-01-25 10:13:50 +01:00
Stefan Werner
cde858ae98 Particles: Fixed thread work size calculation.
Dividing the workload by number of tasks in float is imprecise and
lead in some cases to particles not being calculated at all
(example: 20000 particles, 144 tasks).

Switching this calculation to integer makes sure we don't lose count.

Differential Revision: https://developer.blender.org/D10157
2021-01-25 10:10:40 +01:00
Eric Bickle
6265fe8605 Fix T79356: Improved icons for MSIX builds
Fixed an issue that was causing the app icon to render with a
'plated' background color in the taskbar and other areas of Windows.

Updated all app icons in Microsoft Store package to match Microsoft's
design recommendations.

Added multiple scales for app icons for high resolution displays.

Added high contrast app icons.

Reviewed By: pablovazquez, jmonteath

Maniphest Tasks: T79356

Differential Revision: https://developer.blender.org/D9681
2021-01-25 09:54:33 +01:00
b78d373e96 Fix: Update normals when switching scene quality
Recent commits also updated normals for metaballs, curves and volumetric
objects. This change tags will tag to generate geometry for these new
types.
2021-01-13 11:37:33 +01:00
f6c7da5759 Fix T84397: Creating and removing many objects very quickly causes a crash
The root of the issue was caused by the dependency graph using ID pointer
to map evaluated state from old depsgraph to new one upon relations update.
This was failing when IDs were re-allocated rapidly: was possible that
Object ID's evaluated state assigned to Mesh and vice versa.

Now depsgraph uses Session UUID to identify which IDs to restore evaluated
state to. The session UUID is stored in the IDNode, so that id_orig is not
dereferenced on depsgraph update since the ID might be freed.

The root of the issue is identified by Campbell, original patch was done
by Bastien, thanks! Also thanks to Oliver and Ray and everyone else for
testing!
2021-01-13 11:32:30 +01:00
fa54bf482c Fix T84459: Wireframe not displaying with AMD GPU
Issue appears to be caused by AMD graphics driver later than 20.11.1 and
affects older GPUs (Polaris/FIJI cards). Wireframe drawing uses the same
OpenGL data type for storing normals what is known to be faulty.

This patch enabled storing the normals using GPU_COMP_I16. It also
solves the normals drawing in edit mode for vertex and loop normals.
2021-01-13 11:02:48 +01:00
89eda78d88 Fix T84459: Face normals not displaying (AMD GPU)
This is part two of the fix for T84459.
Issue appears to be caused by AMD graphics driver later than 20.11.1 and
affects older GPUs (Polaris/FIJI cards). Drawing normals in edit mode
uses the same OpenGL data type for storing normals that is known to be
faulty.

This change fixes the face dot normals by using GPU_COMP_I16.
2021-01-13 10:14:00 +01:00
4a61e9ea0f GPU: Enable HQ normal work around for AMD Polaris
THe high quality normals work around is enabled for Polaris cards using
the official drivers. Since driver version 2.11.2 they fail to render
using low quality normals.

The detection of polaris cards is done by matching the opengl renderer.
The renderer strings have been extracted from various reports linked to
{T82856} but isn't complete as some reports are missing the exact
renderer as users don't always report via the help menu.
2021-01-13 09:55:25 +01:00
db7c7486fd GPU: Add HQ normals workaround.
This change makes it possible for platforms to only support high quality
normal rendering. This is part of {T82856} where current AMD drivers
running on the polaris architecture does not support the low quality
setting due to a driver bug.

In a next commit the work around will be enabled.
2021-01-13 09:49:52 +01:00
2f3e97b6d3 DrawManager: High quality normals for non meshes
This adds high quality normals for non meshes. These include

* Volumetric Object Wireframe
* Metaballs
* Extracted Curves
* Curves in edit mode

This is in preparation to fix a regression in recent AMD
drivers where the `GL_INT_2_10_10_10_REV` data type isn't
working in Polaris cards.
2021-01-13 09:39:39 +01:00
6c777ed76b Fix T83625: Shading attribute names cause compilation error.
Some GPU platforms don't support having more than one underscore in
sequence in an attribute name. This change will remove the underscore
as a possible character when encoding to save names.
2021-01-13 09:31:07 +01:00
7edf1e64b3 Fix crash sliding effect sequence strips
Off by one error in array access.
2021-01-13 09:25:23 +01:00
350d490a13 Fix T83280: Crash when deleting hair collision collection.
Root of the issue was missing management of ID pointers in the cloth
modifier data stored in ParticleSystem for hair physics, in the
'foreach_id' particle system code.

Using modifier's 'foreach_id' code in psys one unfortunately requires
some ugly conversion gymnastics, but this is still better than having
dedicated code for that case.

Note that this is actually a fairly critical issue, fix should be
backported to 2.91.1 should we do it, and to 2.83 LTS as well I think.
2021-01-13 09:24:13 +01:00
Nathan Letwory
02ff143f60 Steam Release: Script creation of Steam build files
Script tool for automation of Steam build files for tasks like {T77348}

This script automates creation of the Steam files: download of the archives,
extraction of the archives, preparation of the build scripts (VDF files), actual
building of the Steam game files.

Requirements
============

* MacOS machine - Tested on Catalina 10.15.6. Extracting contents from the DMG
  archive did not work Windows nor on Linux using 7-zip. All DMG archives tested
  failed to be extracted. As such only MacOS is known to work.
* Steam SDK downloaded from SteamWorks - The `steamcmd` is used to generate the
  Steam game files. The path to the `steamcmd` is what is actually needed.
* SteamWorks credentials - Needed to log in using `steamcmd`.
* Login to SteamWorks with the `steamcmd` from the command-line at least once -
  Needded to ensure the user is properly logged in. On a new machine the user
  will have to go through two-factor authentication.
* App ID and Depot IDs - Needed to create the VDF files.
* Python 3.x - 3.7 was tested.
* Base URL - for downloading the archives.

Reviewed By: Jeroen Bakker

Differential Revision: https://developer.blender.org/D8429
2020-12-16 11:17:14 +01:00
f59be64867 Version: Blender 2.83.11 beta 2020-12-16 11:08:34 +01:00
b439a15544 Blender v2.83.10 release
Version bump
2020-12-07 15:09:05 +01:00
c3c3807b05 Fix T82988: Div by zero with curve deform modifier
In `calc_curve_deform` a factor is calculated without checking if
the divisior is zero or close to zero. This patch adds the missing
checks and sets the factor to zero if the division shouldn't be
computed.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D9645
2020-12-02 08:40:49 +01:00
a08a08cb4c Fix T82729: Crash in rna_EffectorWeight_path when object has fluid and dynamic paint modifiers
Looks like prior to the introduction of mantaflow, the former
SmokeModifierData always had a domain initialized (even if its type was
set to None). Since mataflow, the FluidModifierData type needs to be set
to MOD_FLUID_TYPE_DOMAIN (otherwise domain is invalid)

Maniphest Tasks: T82729

Differential Revision: https://developer.blender.org/D9644
2020-12-02 08:36:42 +01:00
50e8072708 Fix T83055: setting rna pointer properties can create bogus custom properties
This was reported in the form of the eyedropper of the 'Parent' property
creating a custom property 'parent' if self was picked.

Problem arises when certain checks for setting rna pointer properties
failed (for example: the PROP_ID_SELF_CHECK check) and then a different
code path was entered (which was only meant for IDProperties).

Problem was introduced in rBa7b3047cefcb.

To solve, now first enter the branch for rna-based pointer properties,
then perform the sanity-checks (and if these fail: dont enter the other
unrelated codepath but instead do nothing)

Maniphest Tasks: T83055

Differential Revision: https://developer.blender.org/D9652
2020-12-02 08:34:19 +01:00
d56111383a Fix memory leak writing PNG when opening the file fails 2020-12-02 08:33:56 +01:00
13b02a724f ImBuf: replace incorrect strstr use with memcmp
Besides being incorrect as only the first two bytes should be tested,
searching binary data using `strstr` can easily read past buffer bounds.
2020-12-02 08:32:33 +01:00
8b59119e10 Fix T82555: Crash using copied object from Python
Also clear `gpd_eval` as this wasn't being copied either.
2020-12-02 08:32:04 +01:00
19b85c5f4b Fix T65585: Knife fails when cursor away from the object
Zeroed mouse coordinates were being used making projection fail.
2020-12-02 08:31:42 +01:00
22c0555cc5 Fix out of bounds array access in mathutils.noise
Regression in 0b2d1badec.
2020-12-02 08:29:23 +01:00
712f79b0fe Blender 2.83.10 beta 2020-12-02 08:28:13 +01:00
4179be6499 Codesign: Report codesign errors from server to worker
Pass codesign errors (if any) from codesign buildbot server to the
buildbot worker, so that the latter one can abort build process if
the error happens. This solves issues when non-properly-notarized
DMG package gets uploaded to the buildbot website.
2020-11-13 11:37:26 +01:00
4abfc0bcd5 Blender 2.83.9 release 2020-11-11 07:30:22 +01:00
670ee877d9 Fix own previous commit re testing of BLI_rel_path.
Windows would need its own version of those tests, for now just
disabling them on that platform.
2020-11-10 14:48:55 +01:00
ffb220590e Fix T81226: Crash opening 64bit files with endian switching
Endian switching when loading 64bit blend files on a 64bit system was
crashing as the endian switching is only applicable when loading
on 32 bit systems.

This crash goes back to 2.7x, it looks like this never worked
all the way back to the first commit.
2020-10-28 09:49:55 +01:00
Jeroen Bakker
6b1042f45a Fix T81254: Incorrect calculation of EEVEE Transmittance Volumetrics
Regular rendering uses a custom blend mode, but render passes renders to
2 separate textures. This wasn't configured correctly inside the
fragment shaders. This patch adds a switch to configure the fragment
shader with the correct attachments.

Backport to Blender 2.83.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D9038
2020-10-28 09:49:37 +01:00
c7236ef4f1 Fix T81688: BPY_thread_save crashes with Python 3.9
Calling PyEval_ReleaseLock() was crashing with Python 3.9
because it accessed the NULL pointer set by PyThreadState_Swap().

This happened when calling ViewLayer.update() for example.

While the existing logic could be fixed by swapping the thread-state
back before calling PyEval_ReleaseLock(), this depends on functions
which are tagged to be removed by v4.0.

Replace use of deprecated functions by calling PyEval_SaveThread(),
instead of inlining the logic, using _PyThreadState_UncheckedGet()
to prevent Python aborting.

The call to PyEval_ThreadsInitialized has been removed
as threads are now initialized with Python.
This could be replaced with Py_IsInitialized() however it doesn't look
like this is necessary.

This is compatible with Python 3.7 & 3.9.
2020-10-28 09:39:57 +01:00
0ff7d21c27 Fix T81520: Crash setting the Cycles device from Python 2020-10-28 09:37:27 +01:00
d5555115e1 Fix T81288:Select Linked fails with multi-object edit mode
Changing options after using select-linked didn't work
when the object being selected wasn't the active object.
2020-10-28 09:34:41 +01:00
0845dc0eec Fix T81854: crash when undoing switch between sculpt and edit mode.
The logic of `BKE_sculpt_update_object_for_edit` was not correct. such
low-level functions should typically never preform depsgraph evaluation
themselves, they should be able to rely on getting a fully evaluated
depsgraph and just get needed data from there.

Supporting that required fixing other broken code higher in the
callstack, namely:
* `ED_object_sculptmode_enter_ex` was freeing evaluated data, for no
  valid reason it would seem.
* `sculpt_undosys_step_decode` was ensuring an evaluated depsgraph
  **before** calling `ED_object_mode_generic_exit`, which would
  invalidate a lot of evaluated data.

Note that it is fairly difficult to track down all code paths leading to
`BKE_sculpt_update_object_for_edit`, so there may be still cases where
this gets called with improperly evaluated depsgraph.

Reviewed By: sergey

Maniphest Tasks: T81854

Differential Revision: https://developer.blender.org/D9270
2020-10-28 09:34:24 +01:00
8926b09fa9 Fix T81421: "Saving As..." a blend file with a Script node file path filled with 1023 symbols crashes Blender.
Usual lack of protection against buffer overflows when manipulating
strings.

Also add some basic tests for `BLI_path_rel`.
2020-10-28 09:26:59 +01:00
c2535dff90 Fix T81942 EEVEE: Reflection Plane glitch with low clip distances
This was happening because the raytrace was not even being performed
due to the tracing line being too small after frustum clipping.
2020-10-28 09:26:02 +01:00
70d7863500 Fix T81939: crash calling bmesh.utils.vert_separate()
Missing NULL check in bmesh_kernel_vert_separate.
2020-10-28 09:25:42 +01:00
05b4d8d13a Fix (studio-reported) Armature: bug in handling of custom bone transform.
This specific pose channel pointer was not handled at all during
rebuilding of poses, meaning that it could end up pointing at some freed
pchan.
2020-10-28 09:21:02 +01:00
7e39e0a9f6 PyAPI: unregister add-ons when exiting
This lets add-on authors avoid false positive leaks when exiting.
In particular GPUShaders's although it applies to any PyObject that
stores memory allocated by guarded-alloc.

While this does add overhead on exit, on my system it's
under 1/100th of a second with all addons enabled.

See: T71362
2020-10-28 09:16:27 +01:00
89b5c9d433 Fix T81633 Workbench: TAA never resolve when enabling both X-Ray and cavity
This was caused by a wrong flag equality check when in xray mode because
the xray mode was masking the effect option flags that are not supported
in this mode. This means the never passed and the TAA was reset before
every redraw, leading to infinite rendering.
2020-10-28 09:05:52 +01:00
f994c8c707 Blender v2.83.9 beta 2020-10-28 08:49:43 +01:00
5949b796f0 BuildBot: Select CUDA 10.1 for Blender v2.83 releases
Buildbot has multiple cuda versions installed. Master selects the right
cuda version based on the architecture that is compiled. {D9179}.
When building BlenderLTS it defaults to CUDA 11.1 what isn't able to
compile `sm_30` architecture. This patch selects CUDA 10.1 as default.
2020-10-21 10:12:17 +02:00
3e104c5c42 Blender v2.83.8 Release 2020-10-21 08:22:15 +02:00
Nathan Letwory
6c9c479048 Windows Release: Script creation of MSIX package
Script create_msix_package.py will download the ZIP file
from the given URL. It will create the MSIX package
with the version number and publisher ID given.

Strongly recommended are the path to a valid PFX file, and the
password to use that PFX file. These are needed for signing
the resulting MSIX package. The signing step is optional though,
but the resulting MSIX package cannot be installed outside of the
Microsoft Store

Example

set VERSION=2.83.2.0
set URL=https://download.blender.org/release/Blender2.83/blender-2.83.2-windows64.zip
set PUBID=CN=PUBIDHERE
set PFX=X:\path\to\cert.pfx
set PFXPW=pwhere

python create_msix_package.py --version %VERSION% --url %URL% --publisher %PUBID% --pfx %PFX% --password %PFXPW%

Requirements:
* Python default from the Microsoft Store should do (3.8)
* requests can be installed with `pip install requests`

Note that for an LTS release that gets uploaded to its own LTS application release
in the store you need to specify the `--lts` switch on the command-line to the script.

Upon completion there will be a file with the
name blender-2.83.2.0-windows64.msix. In case PFX file and its password were
given on the command line MSIX package will also be signed for the Microsoft Store.

Related Wiki page: https://wiki.blender.org/wiki/Process/Release_On_Windows_Store

Reviewed By: jbakker

Maniphest Tasks: T77348, T79356

Differential Revision: https://developer.blender.org/D8310
2020-10-07 10:22:42 +02:00
23bf3b09dd Cycles: Fix usage of memory barriers in split kernel
On user level this fixes dead-lock of OpenCL render on Intel Iris GPUs.
Note that this patch does not include change in the logic which allows
or disallows OpenCL platforms to be used, that will happen after the
kernel fix is known to be fine for the currently officially supported
platforms.

The dead-lock was caused by wrong usage of memory barriers: as per the
OpenCL specification the barrier is to be executed by the entire work
group. This means, that the following code is invalid:

  void foo() {
    if (some_condition) {
      return;
    }
    barrier(CLK_LOCAL_MEM_FENCE);
  }

  void bar() {
    foo();
  }

The Cycles code was mentioning this as an invalid code on CPU, while in
fact this is invalid as per specification. From the implementation side
this change removes the ifdefs around the CPU-only barrier logic, and
is implementing similar logic in the shader setup kernel.

Tested on NUC8i7HVK NUC.

The root cause of the dead-lock was identified by Max Dmitrichenko.

There is no measurable difference in performance of currently supported
OpenCL platforms.

Differential Revision: https://developer.blender.org/D9039
2020-10-07 10:17:56 +02:00
dac242b993 Fix T81459: Memory Leak Cycles Rendered Viewport
The external engine in the draw manager wasn't registered correctly.
This did not free the resources after the external engine was used.
2020-10-07 10:17:34 +02:00
3f2b1f1b66 Fix T81218: Crash in pose mode using a driver on bendy bone Segment
The example file in T81218 has a driver that maps a bone's X-location to
the number of BBone segments. This caused a dependency cycle, which
resulted in bad thread serialisation, which caused the crash.

This patch breaks the dependency cycle `BONE_LOCAL` →
`DRIVER(bones["Bone"].bbone_segments)` → `BONE_LOCAL`. The 'Driver Data'
relation now points to `BONE_SEGMENTS` when the driven property starts
with `bbone_`.

Differential Revision: https://developer.blender.org/D9122
2020-10-07 10:15:56 +02:00
f7c5296f1d Fix T80885: Texture paint camera project crashes after undo/redo
Unmatched ED_image_undo_push_{begin/end},
add doc-strings noting why this is needed.

Thanks to @Baardaap for the initial fix.
2020-10-07 10:10:13 +02:00
38d1bd9cc6 Fix T80630: potential crash in volume grids in Eevee shaders
Found by address sanitizer.
2020-10-07 10:06:27 +02:00
055c0f9077 Fix T62504: Crash accessing depsgraph from evaluated view layer
Use correct owner_id types for depsgraph view_layer properties
instead of inheriting from the Depsgraph which is set to NULL.
2020-10-07 10:05:53 +02:00
63ed7c19d5 Fix T78653 Workbench: Broken Depth of Field in Viewport (Mac OSX)
The output layout was wrong and it's a mistery why it works on most
implementations since it's clearly a wrong usage.

Thanks @sebbas for helping narrowing down the issue.
2020-10-07 10:04:33 +02:00
d745d0a7dc Fix T80426: Crash when deleting custom orientation
Indices referencing other orientations were not being updated,
2020-10-07 09:59:17 +02:00
Germano Cavalcante
bfa485a26f Fix T79973: Re-ordering face maps messes up the names of other face maps
Use a remap function instead a swap.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D8739
2020-10-07 09:58:36 +02:00
394a287714 Fix T80520: Tris to Quads ignores UV delimit option 2020-10-07 09:52:43 +02:00
08b938a343 Fix T61985: NLA Bake exception baking pose with non-pose selection 2020-10-07 09:52:07 +02:00
Cody Winchester
3bdf921e82 Fix invert vertex group weight miscalculation for modifiers
Warp & weight vertex-group editing modifiers miscalculated vertex weight
inversion, the weights were multiplied before being subtracted from 1.

Ref D8241
2020-10-07 09:51:07 +02:00
b72df3a4a4 Fix T81168: 2.8x Crash when loading 2.79 file.
Object in the 2.7x file is on no layer at all, while this is not really
expected nor considered valid, better to cope with the case gracefully
than crash.

To be backported to 2.90 and 2.83.
2020-10-07 09:50:01 +02:00
7ac5695b29 Fix T80905: GPencil: bones cannot be selected using Ctrl + LMB (with Left Selection Preference)
Was missing a dedicated entry for LMB select, this is to be consistent
with how it is done for meshes.

Maniphest Tasks: T80905

Differential Revision: https://developer.blender.org/D8935
2020-10-07 09:49:15 +02:00
094addfe84 Fix OpenCL render error in large scenes
In scenes such as Cosmos Laundromat, there were memory allocations bigger than
2GB which would overflow.

Problem and solution found by AMD, thanks!
2020-10-07 09:44:01 +02:00
6144b5bd4e Blender v2.83.8-beta 2020-10-07 09:42:37 +02:00
192e591af9 Version: Blender 2.83.7 release 2020-09-30 08:12:51 +02:00
0016e73eda Fix T71012: Cycles baking crash with locked-UI & background-mode 2020-09-16 14:36:53 +02:00
32057453ca Fix T80238: Crash adding properties to material node-trees
The localized node-tree was freeing the materials ID properties twice.

This matches how animation data behaves, setting to NULL after freeing.
2020-09-16 14:35:33 +02:00
fe08aa4e2c Fix T80604: BLI_polyfill_calc exceeds stack size allocating points
On systems with 512kb stack this happened at around 13k points.

This happened at times with grease-pencil, although callers that
frequently use complex polygons should be using BLI_polyfill_calc_arena.
2020-09-16 14:34:13 +02:00
bcacd98a6a Fix T80457: Library Override - Custom Property to Drive Child Particles results in Crash.
RNA diffing code was not dealing properly valid NULL PointerRNA (like
the empty texture slots of a ParticleSettings e.g., which were cause of
crash in that report).

To be backported to 2.90 and 2.83.
2020-09-16 14:32:15 +02:00
a4be38c065 Fix T78392: [2.83.5, 2.90, 2.91] Crash on undo/ redo after changing modes.
During undo/redo read code is expected to clear the `OB_MODE_EDIT`
bitflag of `Object.mode`, for some reasons.

This was not done anymore for re-used Objects, we need to add a special
handling case for that too.

Should be backported to 2.90 and 2.83 (will probably not be straight
forward for the latter).
2020-09-16 14:31:46 +02:00
46bdfcab10 Fix T77584: Edit Mode crash with shape keys created on blank mesh
Entering edit-mode after creating shape keys on a blank mesh would crash.

Regression in 9b9f84b317 which prevented initializing empty
shape keys when there is no shape key offset data available.
2020-09-16 14:24:26 +02:00
Aristotelis Dossas
3be5697b88 Fix T79737: ERROR ACCESS VIOLATION when switching to eevee rendered view
This prevents Blender from crashing when switching
to rendered view and the grid_data is NULL in the
lightcache (due to possible corruption), by switching
to the fallback lightcache. The fix extends the solution
for possible corruption in the cube_data as well.

Fix T79737

Reviewed By: fclem
Differential Revision: https://developer.blender.org/D8835
2020-09-16 14:23:09 +02:00
0f928c5841 Fix T80603 Workbench: Inverted alpha when rendering
The state of the passes was not set back after the first sample.

This is a simpler fix than rBecfbc5fb55d5 which needs the new draw manager
features from 2.90.
2020-09-16 14:20:51 +02:00
de0fc2a540 Fix T75061 Grease Pencil: MacOS: broken Gradient and Texture
There is a driver bug that makes all the end of the structure unreadable.
Workaround this by just declaring a vec4 an unpacking manually.
2020-09-16 14:18:28 +02:00
ade72e46fd Version Blender 2.83.7 Beta 2020-09-16 14:17:49 +02:00
8610c69777 Blender 2.83.6 release 2020-09-09 09:32:47 +02:00
1f58b0bbf7 Fix T80530: Crash when switching to Edit Mode
caused by recent merge {33ac3582bbd5}
2020-09-09 08:31:49 +02:00
a9cacb2280 Fix T80159: Custom Normals Averaging crash after clearing
custom split normals data

Clearing custom split normals would get rid of the CD_CUSTOMLOOPNORMAL
layer - but editing data `lnor_spacearr` would be kept.

Adding a CD_CUSTOMLOOPNORMAL layer (if none exists yet) should be done
in `edbm_average_normals_exec` / `BKE_editmesh_lnorspace_update` /
`BM_lnorspace_update` / `BM_lnorspacearr_store`. The thing is that if
the editing data `lnor_spacearr` would still be valid after `Clear
Custom Split Normals Data`, blender would happily call
`BM_lnorspace_rebuild` instead. Doing that without a CD_CUSTOMLOOPNORMAL
layer is asking for trouble.

Now clear lnor_spacearr on `Clear Custom Split Normals Data` as well.

Thx @mont29 for feedback here.

Maniphest Tasks: T80159

Differential Revision: https://developer.blender.org/D8730
2020-09-02 15:03:24 +02:00
006ff64538 Fix crash accessing image space properties without an active window 2020-09-02 15:00:05 +02:00
Yevgeny Makarov
c4b9e2da8c Fix T77900: File Browser in macOS fullscreen crashes
When Blender is started in fullscreen mode from the command line,
or if the fullscreen state is saved in the startup file, all temporary windows
will also open in fullscreen mode. When closing the fullscreen File Browser,
Blender would either crash or parent window becomes black.

This does not happen if the Blender switches to full screen manually.

`NSWindowCollectionBehaviorFullScreenPrimary` should be set for windows that
can enter full-screen mode. Otherwise macOS will turn the wrong window into
full-screen.

Similar fix: rB4b39de677d20

Differential Revision: https://developer.blender.org/D8708

Reviewed by: Julian Eisel
2020-09-02 14:58:42 +02:00
521ae3d458 Fix Outliner allowing to enter Pose Mode on linked armature
If a different object was active, clicking on a linked armature's pose
in the Outliner would enter Pose Mode for it.
This would actually cause a failed assert, but in release builds the
armature would just enter pose mode.

Steps to reproduce were:
* Link in armature object
* Activate a different object
* In the Outliner, un-collapse the armature object
* Activate Pose Mode by clicking on its pose there
2020-09-02 14:57:41 +02:00
cbb5201f09 Fix T80104: Crash on making material local.
Problem is again with the embedded data, we want to make those local
together with their owner ID, but sometimes we are actually dealing with
copies here, which are inheritently already local.

Code did not considered that possibility before, leading to access to a
NULL `lib` pointer.

This should also be back-ported to 2.83 LTS release.

Maniphest Tasks: T80104

Differential Revision: https://developer.blender.org/D8731
2020-09-02 14:56:20 +02:00
812c234377 Fix T80078: Overrides: Crash with animated IK control on linked armature.
Issue was with our dear posebones again... when applying overrides we
keep the same address/pointer for the IDs themselves, (which avoids us
the need to remap their usages), but their inner data is often
re-allocated.

Therefore, we need once again to go over armature objects and invalidate
their posebone pointers.

This should also be back-ported to Blender LTS 2.83.

Maniphest Tasks: T80078

Differential Revision: https://developer.blender.org/D8734
2020-09-02 14:54:35 +02:00
74a9ffc804 Add undo step to Alembic and Collada importers...
Re T77754.
2020-09-02 14:53:45 +02:00
7071daaee3 Fix T80135: Duplicate doesn't preserve active spline
Checks to preserve the active spline on duplication
required an active vertex too.

Now having no active vertex doesn't prevent duplicate
from keeping the spline active.

Reviewed by: @mano-wii

Ref D8729
2020-09-02 14:53:04 +02:00
8cc52ef6e2 VR: SteamVR is now a supported OpenXR runtime! (Windows only)
Steam just released a SteamVR update with OpenXR Developer Preview
support:
https://steamcommunity.com/games/250820/announcements/detail/2396425843528787270.

Once SteamVR is set up for OpenXR (see link above), it works with
Blender "out of the box", thanks to OpenXR!

We have to apply the sRGB transform workaround for SteamVR though,
otherwise it renders way too dark. Done in the next commit.

Note that AMD users may still only see a pink screen, because the
OpenGL-DirectX compatibility fails. I will check on a fix again.
For SteamVR on Linux we may have to wait for until it supports OpenGL
rendering for OpenXR. Alternatively, we *could* add initial Vulkan
support at Ghost level and use Vulkan<->OpenGL interoperability
extensions, Monado uses these as  well.
2020-08-31 11:49:27 +02:00
421ce37f9c Fix T78065: OSL shader compilation fails on macOS 2020-08-26 11:52:14 +02:00
1012569dfa Fix T77683: Cycles baking crash with motion blur enabled and no camera
specified

Maniphest Tasks: T77683

Differential Revision: https://developer.blender.org/D8593
2020-08-26 11:51:09 +02:00
42434d120b BLI: fix memory leak in delaunay 2d
Differential Revision: https://developer.blender.org/D8633
2020-08-26 11:50:21 +02:00
dc61f7c171 Fix T80039: Do not subdivide with Multires is mesh has no faces
This skips the subdivision operation if the mesh has no loops, avoiding
the crash.

Reviewed By: sergey

Maniphest Tasks: T80039

Differential Revision: https://developer.blender.org/D8696
2020-08-26 11:48:15 +02:00
dedab68dcc Fix T80077: Objects disappear when joining with a zero scaled axis
Use invert_m4_m4_safe_ortho when joining objects so zero scaled axis
doesn't cause all points to be scaled to zero.

Instead geometry is left un-scaled on degenerate axes.

Report a warning in this case since users may want to adjust the
active objects scale.
2020-08-26 11:47:41 +02:00
19fe5529d7 BLI_math_matrix: add invert_m4_m4_safe_ortho (m3 version too)
Unlike invert_m4_m4_safe, this calculates zeroed axes.
Useful when we need to use the inverse of an objects matrix,
keeping the valid axis, only filling in the zeroed ones.
2020-08-26 11:40:24 +02:00
676d995d29 Fix T79915: crash when changing to white noise texture
Reviewers: brecht, OmarSquircleArt

Differential Revision: https://developer.blender.org/D8697
2020-08-26 11:33:52 +02:00
a9ae45597c Fix T80012: Bevel Shader node Samples value has too low hardcoded limit
Up the hard limit, keep the UI range max at 16

Maniphest Tasks: T80012

Differential Revision: https://developer.blender.org/D8701
2020-08-26 11:32:42 +02:00
79945c8126 Fix T77359: Crash adding UV's in edit-mode with linked duplicates
This prevents UV layer mix up in
MeshBatchCache.cd_used/cd_needed/cd_used_over_time which depends on the
extraction method.

One object's mesh can be accessed with MR_EXTRACT_MESH, another object
that uses the same mesh can use MR_EXTRACT_BMESH based on
(Object.mode & OB_MODE_EDIT), this causes a problem as the edit-mesh
and the mesh aren't always in sync, the custom data layers wont
necessarily match up, causing T77359.

Reviewed by @jbakker, @brecht

Ref D8645
2020-08-26 11:31:59 +02:00
ec44ab0e89 Fix T79111: Cycles: Image Sequence not rendering
Caused by c7aa0f9d74.

Since above commit, BKE_image_user_frame_calc requires an image (not
just the iuser) to get the framenumber.

Cycles used to call this with NULL image (in `image_user_file_path` and
`image_user_frame_number`), now pass the image as well.

Maniphest Tasks: T79111

Differential Revision: https://developer.blender.org/D8439
2020-08-26 11:20:40 +02:00
d80a95c2ee Fix T78186: Dyntopo panel error with tools that dont have a brush
Maniphest Tasks: T78186

Differential Revision: https://developer.blender.org/D8120
2020-08-26 11:19:26 +02:00
a994e7a4b9 Fix critical bug in foreach ID looper of Scene data-block.
Since stone age of lib_query, the code would iterate over the current
list of active sequences (from a meta strip e.g.), and not over the
whole list of those.

This is a critical issue as it means in some cases (editing a meta strip
typically), some ID pointers would be missed/ignored by this foreach
looper, which is now at the center of most of our ID management code.

This caused a bug here at the studio, leading to loss of all sound IDs
used by sound strips when editing and undoing inside a meta strip, since
ID refcounting would not happen properly on strips using sounds outside
the meta-strip context during file reading of the undo steps.

To be backported to 2.83.

Differential Revision: https://developer.blender.org/D8671
2020-08-26 11:19:00 +02:00
22d8506ae5 Fix T79935: Inonsistent simplify behavior when linking collection with objects in sub-collection.
RNA update function would only update objects from 'main' instantiated
collection, not those from sub-collections.

This should be comitted to 2.90 (and backported to 2.83 too).

Maniphest Tasks: T79935

Differential Revision: https://developer.blender.org/D8654
2020-08-26 11:10:58 +02:00
0fb7d5381e MEM_guardedalloc: allow freeing const arrays with MEM_SAFE_FREE
'const' arrays couldn't use this macro with GNUC.
2020-08-26 11:00:53 +02:00
7369a24f61 GPUTexture: Extend CUBE_MAP_ARRAY_ARB proxy workaround to all Apple gpus
Related to T79716
2020-08-26 10:56:33 +02:00
38ae241020 Fix warning when compiling on Linux with WITH_XR_OPENXR enabled 2020-08-26 10:55:44 +02:00
3a5ef92896 Fix constant lighting change in VR view when rotating head
We have to explicitly enable fixed world space lighting. This was in
fact already done, but overridden by the code to sync the 3D View
shading settings to the VR view.
2020-08-26 10:55:17 +02:00
fe492d922d Fix/workaround graphics issues breaking SteamVR use with Blender
Windows only workaround. I'll have to investigate Linux separately.

Steam's OpenGL compatibility is still new and doesn't work for us yet
(neither does it for standard OpenXR examples from what I've heard and
seen myself). We can work around that by falling back to our DirectX
compatibility layer.
Note that this DirectX compatibility still doesn't work for some
systems, see T76082.

Implementation note: Since the graphics binding extensions have to be
enabled before we can find out which runtime is in use (e.g. SteamVR vs.
Oculus, etc), we can now enable multiple graphics binding extensions but
settle for a single one to use later.

Once the SteamVR OpenGL backend works, we can remove this workaround
again.

Fixes T78267.
2020-08-26 10:48:40 +02:00
70637b303d VR: Properly support outputting sRGB swapchain buffers
Latest SteamVR OpenXR updates brought OpenGL support, but only with sRGB
buffers. I think for DirectX it's the same now.
It's not a big issue for us to use sRGB buffers, so that's what I will
do for now. That way we shouldn't need hardcoded exceptions for specific
runtimes that don't transform linear buffers correctly.
2020-08-26 10:48:17 +02:00
8a129041c5 Fix T78038: Cycles crash rendering with volume object and motion blur 2020-08-26 10:41:15 +02:00
bcff166cc7 Bumped version to blender 2.83.6 beta 2020-08-26 10:39:52 +02:00
c2b144df39 Blender 2.83.5-release 2020-08-19 08:07:09 +02:00
04345dcf89 Fix T79703 EEVEE: Crash on Macos due to lightcache baking 2020-08-12 10:39:23 +02:00
Vincent Blankfield
200de72d26 Fix T77885: crash rendering grease pencil from compositor with multiple scenes 2020-08-12 09:39:15 +02:00
5d42024be6 Fix T79676: Video Sequencer image sequence strip source path breaks when
saving with 'Remap Relative' option

Caused by rBf7386b97571e.

Logic in BKE_bpath_traverse_main calls the callback multiple times [as
often as there are images in the strip].

Prior to above commit, the callback was
'bpath_relative_convert_visit_cb' [this one did not have this problem -
since it returned early if the path was already made relative once]

After rBf7386b97571e though, the 'bpath_relative_rebase_visit_cb' is
used [this one should not be entered multiple times, it would modifiy the
directy again and again].

Luckily, we have a flag (BKE_BPATH_TRAVERSE_SKIP_MULTIFILE) that can be
used to prevent this (this will take care of only calling the callback
once in BKE_bpath_traverse_main for the VSE case)

Could be backported to 2.83 I think.

Maniphest Tasks: T79676

Differential Revision: https://developer.blender.org/D8536
2020-08-12 09:38:39 +02:00
fa2a13bcb9 Fix T79324: Crash when changing View Layer while VR session runs
Proper handling of View Layers for the VR session was never implemented.
Now the View Layer of the VR session follows the window the session was
started in.
Note that if this window is closed, we fallback to another window. This
is done to avoid the overhead it would take to maintain a separate
depsgraph for the VR view. Instead we always share some already visible
View Layer (and hence the depsgraph).
2020-08-12 09:38:13 +02:00
112416e4fb Fix T77847: "Add plane > align" causes crash when certain rigs are in the scene (2.83, fixed in 2.90).
Root of the issue was not fixed in 2.90, only hidden by the fact that we
now re-read much less data during undo's that we used to, when some new
datablock gets added or removed.

This is not an ideal solution (as usual when dealing with data pointers
shared across data-blocks), but it's decent enough. thanks a lot to
@brecht for it!

To be backported to 2.83 too.
2020-08-12 09:30:18 +02:00
f2b71df549 Fix T79482: Triangulate quads with 'Beauty' can make zero area faces 2020-08-12 09:27:42 +02:00
6cbbe04ced Fix crash switching render slots when there is only one slot 2020-08-12 09:26:46 +02:00
5c917ef032 Fix T79575: Crash loading nested set-scenes 2020-08-12 09:25:48 +02:00
16b4b412e6 EEVEE: LightCache: Add warning if the cache cannot be saved 2020-08-12 09:25:10 +02:00
220470be15 Fix T78529: Blend file corrupted during save caused by high Cubemap Size
This just avoid the corruption. A better fix still need to be finished.

See P1564
2020-08-12 09:24:48 +02:00
02c3428e0c Fix T79246 GPUShader: compile error on AWS Elastic Graphics 2020-08-12 09:19:53 +02:00
c15352dd67 Fix T79509 Workbench: Object color mode broken if more than 4096 objects
This was due to the new DRWShadingGroup not being saved and reused for
the next objects.
2020-08-12 09:19:26 +02:00
0122615d36 Workbench: Fix broken id pass 2020-08-12 09:17:20 +02:00
39d7c111db Fix T78884: GPencil weight paint crash when painting over modifier generated points
The weight must be added only to the real points, not to the autogenerated points by modifiers. This affects, not only to subdivide, but to any modifier that generate points.
2020-08-12 09:13:44 +02:00
1d816e3a66 Fix T46568: UV select-linked failure to de-select
Shift-L was de-selecting all instead of the linked UV's.
2020-08-12 09:10:51 +02:00
ee43580623 Fix usercount not decrementing in gpencil_stroke_separate_exec
This is part of T79273 where separating a stroke would result in
multiuser gpencil data for the original object.
Real underlying issue seems to be that gpencil multiuser objects (also
the ones created by Alt+D duplicating) have a problem evaluating
modifiers correctly [this will need further investigation].
Not sure if this is a limitation of D5470?

This patch only corrects the usercount on separating [which already fixes
the scenario reported because singleuser gpencil modifiers work
correctly].

Note: we could have also called `ED_object_add_duplicate` with the
`USER_DUP_GPENCIL` dupflag -- that would have taken care of the usercount
--, but then the whole following logic in `gpencil_stroke_separate_exec`
would need to change from **adding** layers/frames/strokes to
**removing** these.

Part of T79273

Maniphest Tasks: T79273

Differential Revision: https://developer.blender.org/D8419
2020-08-12 09:04:37 +02:00
2c68c92524 Fix T79207: Crash converting curve to mesh 2020-08-12 09:03:57 +02:00
4a08939e12 Fix T78730: CLOG writes/reads outside allocated memory.
Fix several issues in CLOG code:
* In `clg_str_reserve`, allocated memory may be bigger than requested
  one, do not assign the latter back to `cstr->len_alloc`.
* `clg_str_vappendf` was mis-interpreting returned value from
  `vsnprintf`, and completely mixing total allocated memory and extra
  needed amount of memory to allocate...

Simplified code of `clg_str_vappendf` to only have allocating code
handled in one place, makes things easier to follow too.

Think this should also be beckported to 2.83.
2020-08-12 09:01:49 +02:00
a71490c4b2 Fix T78537: too much memory usage rendering animation with persistent images
For still images, always return 0 for the current frame number. This ensures
Cycles can detects that the image did not change.

Based on patch by Vincent Blankfield.

Differential Revision: https://developer.blender.org/D8242
2020-08-12 08:58:51 +02:00
f47f9a04b1 Fix T79007: Smooth brushes crasing in dyntopo
The custom smooth functions for bmesh and meshes where removed and
replaced by a generic smooth function using the sculpt API, which needs
to initialize the bmesh indices in order to be used

Reviewed By: sergey

Maniphest Tasks: T79007

Differential Revision: https://developer.blender.org/D8333
2020-08-12 08:55:19 +02:00
2d3deb29ea Fix T79158: Eevee cubemaps shows black
Same as T75943 that was fixed by rBff97545c50f4
2020-08-12 08:48:10 +02:00
e48054ece4 Fix T79187: Outliner "Make Single User" crash
When "ID Data" -> "Make Single User" is chosen with selected elements
that are not curves, there is a crash. This fix ensures that the id in the
callback function is an Action.
2020-08-12 08:46:39 +02:00
b7a72778ec Fix interface artifacts on Intel GPUs
This is a continuation of fix for T78307. Turns out instancing do not
work at all, so enforce single widget drawing on macOS and Intel GPU.

It was also reported that certain AMD and Mesa driver suffer from
similar issue, so disabled instancing for this configuration as well.

Differential Revision: https://developer.blender.org/D8374
2020-08-12 08:45:57 +02:00
287d5e8305 Fix T79260: Crash displaying the same mesh in two windows 2020-08-12 08:41:40 +02:00
ce44b1f15e Fix T79254: FCurve editor crash when zooming out to limit 2020-08-12 08:26:07 +02:00
6d30a2b085 Versionbump: v2.83.5-beta 2020-08-05 09:27:09 +02:00
c113af8288 Versionbump: v2.83.4-release 2020-08-05 08:00:58 +02:00
5ab8641492 Fix buildbot macOS packaging error after recent changes 2020-08-04 17:30:21 +02:00
093e7f5cf9 Fix buildbot packaging error after recent changes 2020-08-04 16:59:00 +02:00
aacedd7861 Buildbot: make code signing of packages optional with --codesign parameter
This is in preparation of doing builds per commit that will not be code signed.

Ref D8438

Differential Revision: https://developer.blender.org/D8451
2020-08-04 16:21:47 +02:00
d5809b39d5 Fix T78999: Crash when adjusting sequencer property
Sequencer was not initialized yet, and RNA update function tried to clean up cache.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8323
2020-07-29 10:18:54 +02:00
573972ff41 GPencil: Fix unreported missing strokes in interpolation
Sometimes the interpolated stroke was tagged and removed.
2020-07-29 10:17:33 +02:00
53b98de260 Fix T78867: Crash related to viewing video files
Any time FFmpeg was used to get a picture Blender would crash
when FFmpeg 4.3 is used. This affects thumbnails, VSE, Clip Editor.

Caused by a bug in FFmpeg which lead to crashes when unaligned
buffer was passed to sws_scale(). It got fixed later on in FFmpeg,
but for portability and compatibility reasons still nice to avoid
crash, especially since it's not so difficult to do.

FFmpeg ticked number is #8747
The FFmpeg Git hash with the fix: ba3e771a42c2

Differential Revision: https://developer.blender.org/D8355
2020-07-29 10:12:19 +02:00
650cceb453 Fix T79264: Mantaflow Field weights cannot be animated
rna_EffectorWeight_path() needs to point to "domain_settings" (instead
of "settings"), was a missing change when switching the FluidModifier to
mantaflow.

Maniphest Tasks: T79264

Differential Revision: https://developer.blender.org/D8398
2020-07-29 10:10:27 +02:00
f1f8ac3921 Fix T79031: Batch Generate-Previews doesn't work anymore
Caused by rB19785b96c43f.

Maniphest Tasks: T79031

Differential Revision: https://developer.blender.org/D8400
2020-07-29 10:08:54 +02:00
38aa78c6f4 Fix T79272: Dimensions fail on negative scaled axis 2020-07-29 10:08:00 +02:00
46c3ef5715 Fix mistake in recent fix for text editor overflow 2020-07-29 10:06:51 +02:00
9a4d51c5d9 Fix T77609: Scale to Fit Text Box fails when text is too narrow
Caused by error in fix for T75965 (83d9ba341e).
2020-07-29 10:05:58 +02:00
322c67c974 Fix T77669: Copy-pasting strip twice crashes Blender
In rBeaee2b411935 I removed BKE_sequencer_base_clipboard_pointers_store from
paste function, because I wanted pasted strip to always reference copied
strip, not recently pasted one. This worked well with ordinary strips, but not
if they reference ID.

Add back BKE_sequencer_base_clipboard_pointers_store call.

I thought that always referencing original strip would be more correct approach,
but it doesn't matter now. Referencing recently pasted seems to be cleanest way
to do this.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8129
2020-07-29 10:04:57 +02:00
3058bf0757 Fix T78837: Prefetching can corrupt .blend files
This happened because of typo in seq_dupli() when duplicating effect data.
Instead of duplicating data to new sequence, it was duplicated into original.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8295
2020-07-29 10:03:36 +02:00
c8d0a615ef Fix T78358: random crash editing shader nodes with textures 2020-07-29 10:02:01 +02:00
3f23de9a3f Fix T78920: missing depsgraph relation when using sound strips in VSE
Having a sound strip in the VSE caused a missing relation error to be
logged on the console. This was caused by the AUDIO depsgraph component
not having an entry node. This commits adds that node, and sets up
relations correctly.

Differential Revision: https://developer.blender.org/D8290

Reviewed By: Sergey
2020-07-29 10:00:05 +02:00
Yevgeny Makarov
bf92d262a3 Fix View3D "Mirror" menu, both "Global" and "Local" items are GLOBAL 2020-07-29 09:56:12 +02:00
de3e797d47 Fix T78636: Crash displaying many aligned buttons
Displaying user preferences search crashed on macOS when the search
contained a common character such as 'E'.
This caused alignment to 'alloca' too much memory.

Replace with a heap allocation fallback.
2020-07-29 09:53:28 +02:00
5c806a2f04 Fix T68845: Follow Active Quads, divide by zero error 2020-07-29 09:50:22 +02:00
0471349c90 Fix T78573: Crash when removing strips with prefetching
Stop prefetching before changing content of seqbase.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8256
2020-07-29 09:46:22 +02:00
833f67bf51 Fix T78037: fresh install of blender 2.83.0 not able to save user startup file.
Simply remove that check ob userdef's themes, we are never read any
userdef from startup file anymore, so this check makes no more sense.

To be backported to 2.83.
2020-07-29 09:45:24 +02:00
a3db0850b4 Fix T78306: Weight Transfer Operator target mesh doesn't update when transforming bones.
Data transfer operator was missing tagging DEG for relations updates.

Should be portable to 2.83 as well.
2020-07-29 09:28:56 +02:00
2472615d0a Fix T78308: Weight Transfer Operator "Deform Pose Bones" destination setting doesn't work.
Some modes were working by mere chance in that ugly 'reversed' case, but
the to/from selection modes were not properly swapped...

Should also be safe for 2.83.
2020-07-29 09:25:57 +02:00
1e53ca9b71 Fix T79180: Object disappears when scaled, set origin etc after applying smooth modifier.
Very dummy mistake in modifier code would generate invalid number
(divisions by zero)...

Should also be ported to 2.83.
2020-07-29 09:24:19 +02:00
6ec565d1f5 Version bump: Blender 2.83.4 Beta 2020-07-29 09:13:29 +02:00
353e5bd749 Version Blender 2.83.3 release 2020-07-22 08:01:37 +02:00
6ff5943109 Fix git tag warning when running make update after recent changes 2020-07-16 12:49:10 +02:00
9c41744ef4 Fix alignment/size issue on ARM/RPi architecture
Addresses 964305 from Debian bug tracker.
2020-07-13 17:13:17 +02:00
3e36829394 Fix T75943 EEVEE: Cubemaps shows black
Caused by faulty driver implementation. Force fallback method.
2020-07-13 17:13:17 +02:00
0f95cc8293 Fix T77455: Blender Freezes when using the 3d Scale Gizmo
Issue is reported on Linux ith Intel HD6xx iGPU. Inside
`gpu_select_sample_query.c` the call to `glGetQueryObjectuiv` froze. After
bisecting this lead to the polyline shader. When using a 3d color shader
in stead of the polyline shader during selection seems to fix the issue.

Other parts of blender might also be effective, but I wasn't able to
freeze blender in these areas. When it does, we might want to add
a similar work-around to button2d, cage2d, cage3d & move3d, navigate.

Backport this patch to 2.83.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D8217
2020-07-13 17:13:17 +02:00
Stefan Werner
abdaf4159f GPU: Apple/Nvidia Proxy check
Apple's Nvidia driverPROXY check also fails. Now the
configuration Apple/Nvidia will also bypass the
Proxy test.

Maniphest Tasks: T78175

Differential Revision: https://developer.blender.org/D8160
2020-07-13 17:13:17 +02:00
9949b5098a Fix missing GPU image free in background mode
This is legacy code from before Eevee and Workbench rendering in background
mode was supported. Avoid memory leak by only queueing GPU textures to be
freed when we know they have been allocated.

Differential Revision: https://developer.blender.org/D8172
2020-07-13 17:13:17 +02:00
52be97a91b Fix T77780 Overlay: Weight colors are not in render in the right colorspace
This was just a missing conversion.
2020-07-13 17:13:17 +02:00
080d62d405 Fix T77984: Cycles OpenCL error rendering empty scene 2020-07-13 17:13:17 +02:00
f212a16c6a Fix T77655 Overlay: Edit mode + wire drawtype + infront not transparent 2020-07-13 17:13:17 +02:00
9f6c98534f Fix T76229 Overlay: Sulpt overlay not working if object use in-front option
Simple fix similar to paint overlay.
2020-07-13 17:13:17 +02:00
2087b87807 Fix T77641 Sculpt mode performance regression in 2.83 2020-07-13 17:13:17 +02:00
592e306236 Fix T74024 Faces missing, weird faces added
Workaround by adding a special case for that driver in gpu_extensions.c
2020-07-13 17:13:17 +02:00
d0c986b748 Fix error when filtering in Outliner "Blender File" mode with libraries
Steps to reproduce were:
* Load factory settings
* Link any library
* Change to "Blender File" display mode in Outliner
* Enable filtering
* -> Assert fails

This may have had further side-effects for linked IDs.
Checked with Bastien, the NULL-check seems reasonable. It was initially there
but removed in d74f9c4b7b.

Fine to backport.
2020-07-13 17:13:17 +02:00
e34a751172 Fix compile error in recent commit
This was introduced in rBd7b10e5b740fe2.
2020-07-13 17:13:17 +02:00
78c7e7e3bc Fix T78337: Fix crash when use GPencil merge without materials
If the object hadn't material, the index of material was negative.
2020-07-13 17:13:17 +02:00
e2e9df1520 EEVEE: Fix undefined behavior when using BSDF nodes inside volume shaders
This should fix T76171 Eevee bsdf shaders glitches
2020-07-13 17:13:16 +02:00
3e7310f890 Fix T78134: GPencil interpolation crash
Need to verify active frame not NULL.
2020-07-13 17:13:16 +02:00
2a78504d0c Fix T78042: GPencil: Strokes go missing after Interpolation from another layer
This was due some strokes could be tagged and as the layer was locked, the strokes were not untagged and removed when all tagged strokes are removed.

The tagged strokes are used as temp ghost of the interpolation and removed at the end of the interpolation.
2020-07-13 17:13:16 +02:00
061869fe61 Fix T77759: "Not enough texture slots!" Message lags computer
Patch supplied by Clément Foucault
2020-07-13 17:13:16 +02:00
ad0154aebc Build: make update support for git tags
Previously it only picked the appropriate version with the
blender-vX.XX-release branches.
2020-07-13 15:55:53 +02:00
7329138e82 Fix T78775: broken Embree build in make deps for 2.83
The release was re-issued for unknown reasons, changes seems like they would
have no impact on Cycles and Embree is disabled by default anyway.
2020-07-10 14:28:55 +02:00
b740f7f1c7 Bumped version to Blender 2.83.3-beta 2020-07-09 10:13:46 +02:00
239fbf7d93 Updated version Blender 2.83 Release 2020-07-09 07:50:14 +02:00
2822744b0b Fix T77095: fix Cycles performance regression with AMD RX cards
Apply the workaround only for known problematic drivers. The latest pro driver
appears to work correctly, hopefully the regular driver will as well once it
is updated to the same OpenCL driver version (3075.13).
2020-07-02 09:24:40 +02:00
Vincent Blankfield
6e6954ac83 Fix T77734: random crash when rendering animation
Differential Revision: https://developer.blender.org/D7986
2020-07-02 09:15:55 +02:00
005c66395a Fix T66934 Overlay: "Outline Selected" overlay doesnt affect armatures
This is a really small fix. Could be included in 2.83 LTS branch.
2020-07-02 09:12:10 +02:00
ef0ded4df3 Fix: Crash when closing window while Outliner shows screens
Steps to reproduce were:
* From factory settings, change Outliner Display Mode to "Blender File"
* Open "Screens" item, make sure all listed screens are visible
* Open Preference window, close it
* Mouse hover the outliner -> crash

Fix is to force an Outliner tree rebuild when closing screens.
2020-07-02 09:11:20 +02:00
910b421045 Fix T77328: Crash on undo Draw Face Sets stroke with dyntopo active
Draw Face Sets does not work in Dyntopo and the sculpt API should be
responsible for that without needing to add checks all over the code,
but it was doing an undo push of type SCULPT_UNDO_FACE_SETS which is not
supported, causing the crash.

Reviewed By: sergey

Maniphest Tasks: T77328

Differential Revision: https://developer.blender.org/D7924
2020-07-02 09:10:12 +02:00
2d89951be5 Fix random crash in Cycles smoke volume loading
Don't access evaluated mesh data after freeing Blender depsgraph.

Potentially related to T77954.
2020-07-02 09:09:22 +02:00
000fbef35d UV Editor: Fix Vertex Overlay color not being color managed
Could be backported to 2.83 LTS
2020-07-02 09:08:32 +02:00
a2c1f41d95 Fix T77754: Crash after any alembic import undo in an empty scene
Thanks @mont29 for this patch.

This creates an explicit undo step after the Alembic importer has finished
running. This is necessary when the importer runs as a background job.
2020-07-02 09:07:15 +02:00
bb4f8b76ec Fix T77712: Crash on proxied rig, custom bone shape, driver targeting rig
It turns out that
`DepsgraphNodeBuilder::build_object_data_geometry(Object *object, bool
is_object_visible)` was called for the custom shape with
`is_object_visible=false` when there are drivers, and
`is_object_visible=true` when there aren't any.
2020-07-02 08:52:14 +02:00
089ff4a1dd Fix T77830: Crash in VR session when opening material preview
Draw-manager mutex has to be set before activating OpenGL/GPU context.
Otherwise, parallel jobs (like preview rendering) may try to activate
the context from another thread.

Also: Use WM wrappers for activating/releasing OpenGL context, which
have an additional assert check.

Suggest to backport this for 2.83.1.
2020-07-02 08:51:01 +02:00
91b455c00f Fix memory leak calculating deform modifiers in edit-mode
This bug goes back to 2.80 but doesn't seem to have been reported.
2020-07-02 08:43:05 +02:00
f7e73b5d45 Fix T77913: Incorrect handling of negative-scale bit in DRWResourceHandle
Reviewers: fclem

Differential Revision: https://developer.blender.org/D8103
2020-07-02 08:18:31 +02:00
9a8dd8d623 Fix T78112: VSE Sequencer/Preview crash after fullscreen
The region refresh callback wasn't called, which in the VSE ensures valid
region sizes and removes handlers of invisible regions.
2020-07-02 08:17:27 +02:00
020b8e2c73 Fix T67358: Compositor Disabled Node Config -> SegFault
The issue was caused by wrong conversion happening after some of the
proxies are removed. Easiest solution is to first remove proxies and
then add required converter operations.

Thanks Jeroen for the review!
2020-07-02 08:14:40 +02:00
e936269304 Fix T77460: Easy to create cyclic dependencies in collections and crash Blender.
Cyclic check was not checking for collections instanciated by objects...
2020-06-30 12:52:11 +02:00
9171342185 Fix crash when opening some old/broken .blend files after recent fix.
Now that `BKE_main_collections_parent_relations_rebuild()` is called
from readfile code, we need to make it resilient to potential NULL
master collection pointer in scenes.
2020-06-30 12:49:11 +02:00
b894480d68 Fix (unreported) critical mistake in Collection liblink code in readfile.c.
Prelimenary step to fix T77460.

Not sure how or when that thing was done, but since that call walks
around collections relationships, it's an utterly critical violation of
liblinking principles (code here should never, ever 'get outside' of its
own ID scope).

This was wroking so far only because code called through this function
(`BKE_collection_parent_relations_rebuild`) was only following parents
pointers (in `BKE_collection_find_cycle()`), which would be either valid
or non-existent.

But next commit is going to change that to also check collection's
objects instancing of other collections.
2020-06-30 12:44:19 +02:00
3de9efdc9e Fix T78172: Undo crash due to IDTemplate operations missing undo push.
This should be included in 2.83 as well.
2020-06-30 12:27:55 +02:00
141eb92345 Bumped version o blender v2.83.2-beta 2020-06-25 14:34:31 +02:00
8289fc688b Revert "Fix T77460: Easy to create cyclic dependencies in collections and crash Blender."
This reverts commit 293b00beb5.
2020-06-25 11:47:39 +02:00
f575a14801 Revert "Fix (unreported) critical mistake in Collection liblink code in readfile.c."
This reverts commit 517f32045c.
2020-06-25 11:46:30 +02:00
Bastien Montagne
91f07fbfd6 Fix T77774: New undo code broken by 'make local' behavior.
This is actually a nice issue due to too much optimization...
* Making an ID local just reuse the linked one whenever possible, instead of
  actually making a copy of it.
* Therefore, the collection containing that ID is seen as unchanged, since
  the pointer itself remained the same.
* But on undo step, there is no way to reuse that local object, which then
  gets deleted, and linked one gets re-created - at a different address.
* Collection, however, since unchanged, is not updated at all and thus keeps
  reference to the to-be-deleted local object, instead of the linked one.
* Issue gets even worse with viewlayers, this leads to the crash.

To address this, this patch adds a 'virtual' update flags that does nothing
in update case, but will ensure that the affected IDs using the one made local
are properly detected as changed across the relevant undo step.

Note that the recalc flags were chosen mostly for a logical reason, and also
because they are already properly dealt with and cleared by undo code,
so this looks like the optimal solution.

Note: slightly ammended for 2.83, change should not have any effect in
practice.

Reviewed By: brecht

Maniphest Tasks: T77774

Differential Revision: https://developer.blender.org/D8006
2020-06-25 10:42:27 +02:00
6e13cff487 Revert "Fix T77774: New undo code broken by 'make local' behavior."
This reverts commit 554ed613ae.
2020-06-25 10:17:27 +02:00
68fae13d9b Fix T66786: Audio SDL: Video editor Sound muted without muting it
Porting fix for SDL 2 audio formats from audaspace upstream.
2020-06-25 10:08:14 +02:00
Jeroen Bakker
e553408bee Fix T77803: IK Degrees of freedom drawing glitch
Forgot to update the lineOutput what resulted in that the sphere was not
rendered on all platforms.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D8098
2020-06-25 10:07:59 +02:00
17ddb4c4ea Fix T77803: IK Degrees of freedom drawing glitch
IK degrees of freedom is rendered using wires and a solid sphere. The
solid used the wireframe drawing what resulted into drawing glitches.
This patch adds a new shader to draw the solid shape.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D8044
2020-06-25 10:07:42 +02:00
dceaef92d7 Fix (unreported) wrong size of UserPreferences' dupflag parameter.
Adding volume obdata option to `eDupli_ID_Flags` enum made it go beyond
the 16 bits of a short... Also, enums should typically be stored in
unsigned integers.
2020-06-25 10:07:26 +02:00
465d5c018e Fix T77915: Cycles OSL microfacet closure not working in custom shaders
The code to implement the newer closure in terms of the old one got lost in
the removal of our stdosl.h copy. Now implement it as a builtin closure.
2020-06-25 10:07:09 +02:00
3bbcc4f6e8 Cycles: Refactor microfacet BSDFs to remove separate anisotropy code
Since the sampling and evaluation functions handle both cases anyways,
there's not really a point for keeping the distinction in the kernel,
so we might as well cut down the number of CLOSURE_BSDF_MICROFACETs a bit.

Differential Revision: https://developer.blender.org/D7736
2020-06-25 10:06:52 +02:00
58533aca4d GPencil: Fix unreported Vertex Opacity Overlay not working
This values was not working because was removed by error in refactor.

Reviewed By: mendio, fclem

Differential Revision: https://developer.blender.org/D8061
2020-06-25 09:32:55 +02:00
5f01048dcb Fix T75414: Incorrect masking in Color Balance modifier
Color balance factor was infinity. Clamp to +/- `FLT_MAX`

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7884
2020-06-25 09:32:27 +02:00
945e18f037 Fix T76767: Cycles performance regression with CLI renders
When picking a small tile size when doing a CLI render will
yield many status updates being printed to the console
causing a slowdown in the render process. 2.79 with the
same amount of tiles did not have this slowdown.

The reason for this turned out to be a debugging aid added
in rBd2757d149bf2 which disabled buffering for stdout which
on windows caused every single character being printed to the
console to try to obtain a mutex, and worse the thread being
put to sleep when this mutex was unavailable leading to poor
performance.

This patch changes the behaviour by only disabling the
buffering in debug builds.

CLI render of the default cube with 16x16 tiles at 1080p

2.83 : 37.57s
now  : 17.03s

note: this only affected CLI renders, renders from the UI
do not report this kind of information and had no such
slowdown.
2020-06-25 09:32:04 +02:00
293b00beb5 Fix T77460: Easy to create cyclic dependencies in collections and crash Blender.
Cyclic check was not checking for collections instanciated by objects...
2020-06-25 09:31:45 +02:00
517f32045c Fix (unreported) critical mistake in Collection liblink code in readfile.c.
Prelimenary step to fix T77460.

Not sure how or when that thing was done, but since that call walks
around collections relationships, it's an utterly critical violation of
liblinking principles (code here should never, ever 'get outside' of its
own ID scope).

This was wroking so far only because code called through this function
(`BKE_collection_parent_relations_rebuild`) was only following parents
pointers (in `BKE_collection_find_cycle()`), which would be either valid
or non-existent.

But next commit is going to change that to also check collection's
objects instancing of other collections.
2020-06-25 09:31:20 +02:00
4f3fdf7715 Fix T77853: Error reloading linked library.
Issue related to how ID refcounting was changed when loading blendfile
data...
2020-06-25 09:30:59 +02:00
Bastien Montagne
554ed613ae Fix T77774: New undo code broken by 'make local' behavior.
This is actually a nice issue due to too much optimization...
* Making an ID local just reuse the linked one whenever possible, instead of
  actually making a copy of it.
* Therefore, the collection containing that ID is seen as unchanged, since
  the pointer itself remained the same.
* But on undo step, there is no way to reuse that local object, which then
  gets deleted, and linked one gets re-created - at a different address.
* Collection, however, since unchanged, is not updated at all and thus keeps
  reference to the to-be-deleted local object, instead of the linked one.
* Issue gets even worse with viewlayers, this leads to the crash.

To address this, this patch adds a 'virtual' update flags that does nothing
in update case, but will ensure that the affected IDs using the one made local
are properly detected as changed across the relevant undo step.

Note that the recalc flags were chosen mostly for a logical reason, and also
because they are already properly dealt with and cleared by undo code,
so this looks like the optimal solution.

Reviewed By: brecht

Maniphest Tasks: T77774

Differential Revision: https://developer.blender.org/D8006
2020-06-25 09:30:34 +02:00
783d3c675a Fix missing hinting information in default font
Updates the font file to bring back hinting data, which got lost somehow
in dc3f073d1c.

Second and (hopefully) final fix for T75898.
2020-06-25 09:29:59 +02:00
Nikhil Shringarpurey
e21a903b98 Fix missing hinting information in monospace font
Updates the monospace font file to bring back hinting data, which got
lost somehow in dc3f073d1c.

Partial fix for T75898.
2020-06-25 09:29:08 +02:00
0148059c68 Fix for T77095: work around render artifacts with AMD Radeon RX 4xx and 5xx 2020-06-25 09:28:30 +02:00
d114288f90 Bumped blender version to 2.83.1 2020-06-22 11:26:26 +02:00
3947cbf916 Bumped file subversion to 19 2020-06-18 09:51:03 +02:00
Jeroen Bakker
37a07d8a75 Fix T77657: NVIDIA Quadro FX4800 crash on startup
Limit support for `GLEW_ARB_base_instance` to OpenGL 4.0 and higher. NVIDIA Quadro FX 4800
(TeraScale) report that they support GLEW_ARB_base_instance, but the driver does not support
`GLEW_ARB_draw_indirect` as it has an OpenGL3 context what also matches the minimum needed
requirements.

We use `GLEW_ARB_draw_indirect` as a target for `glMapBuffer(Range)` what is part of the
OpenGL 4 API. So better disable it when we don't have an OpenGL4 context.

Note: fix should be ported to Blender 2.83 LTS

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7994
2020-06-18 09:32:39 +02:00
8e555bf4e3 GPencil: Improve viewlayer masking check
Check if the mask layer is used in a layer that is going to be used in the current viewlayer.

Related to T77667
2020-06-18 09:31:59 +02:00
0178e7b393 Fix T77148: Crash changing multiple values for sequencer strips
This was caused by assuming all strips were the same type.
2020-06-18 09:31:19 +02:00
42a517779a Fix T77047: Dyntopo Sample detail size on hidden mesh causes crash
The `Toolbar` and `Sidebar` hide the corresponding panel
`VIEW3D_PT_sculpt_dyntopo` by polling for context.sculpt_object and
context.tool_settings.sculpt. In the Active Tool in the Properties
Editor this poll does not return False though, thus the
sample_detail_size is possible from there.

Second security check (the operator poll `SCULPT_mode_poll`) checks the
active object -- that is still valid even if hidden, so we are allowed
to execute the operator. However the active object becomes NULL once the
area is switched in `sample_detail()` -- see `CTX_wm_area_set`), leading
to the crash.

Dont think there is a quick and easy way to do this in the poll from the
Properties Editor, so just check for a valid active abject in the
operator and return OPERATOR_CANCELLED if we dont have it.

Maniphest Tasks: T77047

Differential Revision: https://developer.blender.org/D7832
2020-06-18 09:28:21 +02:00
60bf482dba Fix T74101: File Browser in macOS fullscreen crashes or makes windows unusable
When closing the File Browser window after making it fullscreen, Blender would
either crash or all windows would disappear, with no obvious way to bring them
back.

The "fix" is to not allow fullscreen for File Browsers (or any future "dialog"
windows), but only maximizing. From what I can tell that's how secondary
windows are supposed to work on macOS. What we previously did seemed like
something macOS doesn't handle cleanly, and I didn't find a simple way to do so
on our side.
2020-06-18 09:27:40 +02:00
ce11640eef Fix T77504: Operator search gives wrong results
Regression in e8ab0137f8
2020-06-18 09:26:41 +02:00
c26cd6e996 Fix T76894: Disable clipping region selection in material/rendered mode
In this case the draw engine isn't responsible for the selection, but
the editor is.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7955
2020-06-18 09:26:13 +02:00
0a8eeae831 Fix T72936: Incorrect gizmo orientation with inherit rotation disabled 2020-06-18 09:25:43 +02:00
f649e5c418 Fix menu operator/search clipping the last character
Noted in T77504
2020-06-18 09:25:05 +02:00
5439f43e88 Fix T77603: OSL parser fails when script ends with comment without newline
Reviewers: brecht

Differential Revision: https://developer.blender.org/D7958
2020-06-18 09:10:40 +02:00
5fc252feae Fix crash running "Edit Voxel Size" operator outside of a main 3D View region
Accessed `RegionView3D` data from context, which of course would only be set if
actually executed from a main 3D View region.
2020-06-18 09:08:30 +02:00
296e3ee62c Buildbot: Cleanup, remove unused script and change naming
Follow upstream convention.
2020-06-17 17:41:49 +02:00
c310bf4ebe Buildbot: Support multiple workers talking to single codesign server
Is achieved by replacing hard-coded signed/unsigned file names with
"<uuid>" which acts as a "request ID". This way multiple workers can
put their requests into a single directory without collisions. The
code sign server will handle the requests sequentially in an unknown
order.
2020-06-16 17:01:42 +02:00
548312ed82 Buildbot: Don't use builder name in the build directory
The directory layout on worker goes as following:

  <Worker>
    <Builder Name>
      blender.git/
      build/
      install/
      lib/

Adding an extra <Builder Name> after build is redundant.

Differential Revision: https://developer.blender.org/D8045
2020-06-16 17:01:38 +02:00
56b345adc6 GPencil: Fix unreported error in Dots Strokes material initialization
The materials was not initializated in the right mode.
2020-06-11 09:34:39 +02:00
404c3adfcc GPencil: Fix unreported Shift+F OPacity key not working
This wa snot working since the new scale thickness was included.
2020-06-11 09:34:10 +02:00
9d5e5e282c Calculate epsilon values for interp_weights_poly to improve accuracy
interp_weights_poly_v2 would have too large epsilon values for small
polygons. To solve this we now calculate the appropriate epsilon value
so it can gracefully handle big and small values.

To make sure there was no regression, these changes were tested with the
files in T36105, T31581. Also with a surface deform modifier test file
attached in the differential below.

Reviewed By: Brecht

Differential Revision: http://developer.blender.org/D7772
2020-06-11 08:37:07 +02:00
7b754c8c99 Fix T76273 Glitches caused by glCopyImageSubData on windows + intel gpu
We limit this fix to Windows Intel GPU whose driver reports at most GL 4.4
support. This limits the fix to the range of reported GPU.
2020-06-11 08:34:34 +02:00
1510c04d41 Fix T77358: Gpencil can't select geometry within transparent layers
This was an old check of opacity for editable layers, but with new system it's not needed because you can use the edit lines.
2020-06-11 08:33:47 +02:00
2c3ef36a0b Fix T77520: GPencil viewlayer filter produce crash with masking layers
If a layer is used for masking, it cannot be filtered by viewlayer because the masked layer needs to have the mask layers in the draw pipeline.

This check is only done in final render.
2020-06-11 08:32:49 +02:00
0402cc7e9e Fix T77164: scaling/rotation fails for 3 selected NURB points 2020-06-11 08:30:40 +02:00
09db0f2a34 Fix T77156: GPencil view layer filter by layer not working
This was removed by error during the refactor done in 2.83.

Differential Revision: https://developer.blender.org/D7909

Reviewers: @fclem
2020-06-11 08:29:51 +02:00
e4ac4769f1 Fix T77456: Broken vertex paint undo on high-poly objects.
This is a critical fix that should also be backported to 2.83.1

Fairly stupid bug in fact, code detecting changes across undo steps was
assuming that each BHEAD (a block of data in blendfiles) would not be larger
than one memory chunk... Which is the case in alsmost every situation,
besides some super-heavy geometries, and other similar things (images
would also be affected e.g.).
2020-06-11 08:29:04 +02:00
864f8cbb86 Fix T77448: Camera Solver constraint can't be converted to f-curve
A regression caused by c57f65c088 as a fix of another issue.

Added an exception for camera solver as that is always pointing
to camera object.

Since this is a regression which happened in 2.83.0 this change is
a candidate to be ported to the 2.83.1.
2020-06-11 08:27:22 +02:00
488bf53207 Fix T77367: Blender's snap package ignores command line options 2020-06-08 13:16:33 +02:00
483 changed files with 5321 additions and 1909 deletions

View File

@@ -369,7 +369,7 @@ option(WITH_CYCLES_CUDA_BINARIES "Build Cycles CUDA binaries" OFF)
option(WITH_CYCLES_CUBIN_COMPILER "Build cubins with nvrtc based compiler instead of nvcc" OFF)
option(WITH_CYCLES_CUDA_BUILD_SERIAL "Build cubins one after another (useful on machines with limited RAM)" OFF)
mark_as_advanced(WITH_CYCLES_CUDA_BUILD_SERIAL)
set(CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 sm_70 sm_75 CACHE STRING "CUDA architectures to build binaries for")
set(CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 sm_70 sm_75 sm_86 compute_75 CACHE STRING "CUDA architectures to build binaries for")
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
unset(PLATFORM_DEFAULT)
option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON)

View File

@@ -301,7 +301,7 @@ set(SQLITE_HASH fb558c49ee21a837713c4f1e7e413309aabdd9c7)
set(EMBREE_VERSION 3.8.0)
set(EMBREE_URI https://github.com/embree/embree/archive/v${EMBREE_VERSION}.zip)
set(EMBREE_HASH ac504d5426945fe25dec1267e0c39d52)
set(EMBREE_HASH 837b297bfe9c328152e9ce42c301d340)
set(USD_VERSION 19.11)
set(USD_URI https://github.com/PixarAnimationStudios/USD/archive/v${USD_VERSION}.tar.gz)

View File

@@ -898,8 +898,8 @@ PYTHON_SOURCE=( "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHO
NUMPY_SOURCE=( "https://github.com/numpy/numpy/releases/download/v$NUMPY_VERSION/numpy-$NUMPY_VERSION.tar.gz" )
_boost_version_nodots=`echo "$BOOST_VERSION" | sed -r 's/\./_/g'`
BOOST_SOURCE=( "http://sourceforge.net/projects/boost/files/boost/$BOOST_VERSION/boost_$_boost_version_nodots.tar.bz2/download" )
BOOST_BUILD_MODULES="--with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time --with-wave --with-iostreams --with-python --with-program_options"
BOOST_SOURCE=( "https://boostorg.jfrog.io/artifactory/main/release/$BOOST_VERSION/source/boost_$_boost_version_nodots.tar.bz2" )
BOOST_BUILD_MODULES="--with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time --with-wave --with-iostreams --with-python --with-program_options --with-serialization --with-atomic"
OCIO_USE_REPO=false
OCIO_SOURCE=( "https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/v$OCIO_VERSION.tar.gz")

View File

@@ -8,7 +8,7 @@ Code signing is done as part of INSTALL target, which makes it possible to sign
files which are aimed into a bundle and coming from a non-signed source (such as
libraries SVN).
This is achieved by specifying `slave_codesign.cmake` as a post-install script
This is achieved by specifying `worker_codesign.cmake` as a post-install script
run by CMake. This CMake script simply involves an utility script written in
Python which takes care of an actual signing.

View File

@@ -33,15 +33,16 @@ def is_tool(name):
return which(name) is not None
class Builder:
def __init__(self, name, branch):
def __init__(self, name, branch, codesign):
self.name = name
self.branch = branch
self.is_release_branch = re.match("^blender-v(.*)-release$", branch) is not None
self.codesign = codesign
# Buildbot runs from build/ directory
self.blender_dir = os.path.abspath(os.path.join('..', 'blender.git'))
self.build_dir = os.path.abspath(os.path.join('..', 'build', name))
self.install_dir = os.path.abspath(os.path.join('..', 'install', name))
self.build_dir = os.path.abspath(os.path.join('..', 'build'))
self.install_dir = os.path.abspath(os.path.join('..', 'install'))
self.upload_dir = os.path.abspath(os.path.join('..', 'install'))
# Detect platform
@@ -67,8 +68,9 @@ def create_builder_from_arguments():
parser = argparse.ArgumentParser()
parser.add_argument('builder_name')
parser.add_argument('branch', default='master', nargs='?')
parser.add_argument("--codesign", action="store_true")
args = parser.parse_args()
return Builder(args.builder_name, args.branch)
return Builder(args.builder_name, args.branch, args.codesign)
class VersionInfo:
@@ -83,7 +85,6 @@ class VersionInfo:
self.short_version = "%d.%02d" % (version_numbers[0], version_numbers[1])
self.version = "%d.%02d.%d" % version_numbers
self.version_cycle = self._parse_header_file(blender_h, 'BLENDER_VERSION_CYCLE')
self.version_cycle_number = self._parse_header_file(blender_h, 'BLENDER_VERSION_CYCLE_NUMBER')
self.hash = self._parse_header_file(buildinfo_h, 'BUILD_HASH')[1:-1]
if self.version_cycle == "release":
@@ -92,8 +93,7 @@ class VersionInfo:
self.is_development_build = False
elif self.version_cycle == "rc":
# Release candidate
version_cycle = self.version_cycle + self.version_cycle_number
self.full_version = self.version + version_cycle
self.full_version = self.version + self.version_cycle
self.is_development_build = False
else:
# Development build

View File

@@ -18,12 +18,72 @@
# <pep8 compliant>
import dataclasses
import json
import os
from pathlib import Path
from typing import Optional
import codesign.util as util
class ArchiveStateError(Exception):
message: str
def __init__(self, message):
self.message = message
super().__init__(self.message)
@dataclasses.dataclass
class ArchiveState:
"""
Additional information (state) of the archive
Includes information like expected file size of the archive file in the case
the archive file is expected to be successfully created.
If the archive can not be created, this state will contain error message
indicating details of error.
"""
# Size in bytes of the corresponding archive.
file_size: Optional[int] = None
# Non-empty value indicates that error has happenned.
error_message: str = ''
def has_error(self) -> bool:
"""
Check whether the archive is at error state
"""
return self.error_message
def serialize_to_string(self) -> str:
payload = dataclasses.asdict(self)
return json.dumps(payload, sort_keys=True, indent=4)
def serialize_to_file(self, filepath: Path) -> None:
string = self.serialize_to_string()
filepath.write_text(string)
@classmethod
def deserialize_from_string(cls, string: str) -> 'ArchiveState':
try:
object_as_dict = json.loads(string)
except json.decoder.JSONDecodeError:
raise ArchiveStateError('Error parsing JSON')
return cls(**object_as_dict)
@classmethod
def deserialize_from_file(cls, filepath: Path):
string = filepath.read_text()
return cls.deserialize_from_string(string)
class ArchiveWithIndicator:
"""
The idea of this class is to wrap around logic which takes care of keeping
@@ -79,6 +139,19 @@ class ArchiveWithIndicator:
if not self.ready_indicator_filepath.exists():
return False
try:
archive_state = ArchiveState.deserialize_from_file(
self.ready_indicator_filepath)
except ArchiveStateError as error:
print(f'Error deserializing archive state: {error.message}')
return False
if archive_state.has_error():
# If the error did happen during codesign procedure there will be no
# corresponding archive file.
# The caller code will deal with the error check further.
return True
# Sometimes on macOS indicator file appears prior to the actual archive
# despite the order of creation and os.sync() used in tag_ready().
# So consider archive not ready if there is an indicator without an
@@ -88,23 +161,11 @@ class ArchiveWithIndicator:
f'({self.archive_filepath}) to appear.')
return False
# Read archive size from indicator/
#
# Assume that file is either empty or is fully written. This is being checked
# by performing ValueError check since empty string will throw this exception
# when attempted to be converted to int.
expected_archive_size_str = self.ready_indicator_filepath.read_text()
try:
expected_archive_size = int(expected_archive_size_str)
except ValueError:
print(f'Invalid archive size "{expected_archive_size_str}"')
return False
# Wait for until archive is fully stored.
actual_archive_size = self.archive_filepath.stat().st_size
if actual_archive_size != expected_archive_size:
if actual_archive_size != archive_state.file_size:
print('Partial/invalid archive size (expected '
f'{expected_archive_size} got {actual_archive_size})')
f'{archive_state.file_size} got {actual_archive_size})')
return False
return True
@@ -129,7 +190,7 @@ class ArchiveWithIndicator:
print(f'Exception checking archive: {e}')
return False
def tag_ready(self) -> None:
def tag_ready(self, error_message='') -> None:
"""
Tag the archive as ready by creating the corresponding indication file.
@@ -138,13 +199,34 @@ class ArchiveWithIndicator:
If it is violated, an assert will fail.
"""
assert not self.is_ready()
# Try the best to make sure everything is synced to the file system,
# to avoid any possibility of stamp appearing on a network share prior to
# an actual file.
if util.get_current_platform() != util.Platform.WINDOWS:
os.sync()
archive_size = self.archive_filepath.stat().st_size
self.ready_indicator_filepath.write_text(str(archive_size))
archive_size = -1
if self.archive_filepath.exists():
archive_size = self.archive_filepath.stat().st_size
archive_info = ArchiveState(
file_size=archive_size, error_message=error_message)
self.ready_indicator_filepath.write_text(
archive_info.serialize_to_string())
def get_state(self) -> ArchiveState:
"""
Get state object for this archive
The state is read from the corresponding state file.
"""
try:
return ArchiveState.deserialize_from_file(self.ready_indicator_filepath)
except ArchiveStateError as error:
return ArchiveState(error_message=f'Error in information format: {error}')
def clean(self) -> None:
"""

View File

@@ -48,6 +48,7 @@ import shutil
import subprocess
import time
import tarfile
import uuid
from pathlib import Path
from tempfile import TemporaryDirectory
@@ -57,6 +58,7 @@ import codesign.util as util
from codesign.absolute_and_relative_filename import AbsoluteAndRelativeFileName
from codesign.archive_with_indicator import ArchiveWithIndicator
from codesign.exception import CodeSignException
logger = logging.getLogger(__name__)
@@ -121,21 +123,10 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
# Consider this an input of the code signing server.
unsigned_storage_dir: Path
# Information about archive which contains files which are to be signed.
#
# This archive is created by the buildbot worked and acts as an input for
# the code signing server.
unsigned_archive_info: ArchiveWithIndicator
# Storage where signed files are stored.
# Consider this an output of the code signer server.
signed_storage_dir: Path
# Information about archive which contains signed files.
#
# This archive is created by the code signing server.
signed_archive_info: ArchiveWithIndicator
# Platform the code is currently executing on.
platform: util.Platform
@@ -146,50 +137,44 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
# Unsigned (signing server input) configuration.
self.unsigned_storage_dir = absolute_shared_storage_dir / 'unsigned'
self.unsigned_archive_info = ArchiveWithIndicator(
self.unsigned_storage_dir, 'unsigned_files.tar', 'ready.stamp')
# Signed (signing server output) configuration.
self.signed_storage_dir = absolute_shared_storage_dir / 'signed'
self.signed_archive_info = ArchiveWithIndicator(
self.signed_storage_dir, 'signed_files.tar', 'ready.stamp')
self.platform = util.get_current_platform()
"""
General note on cleanup environment functions.
It is expected that there is only one instance of the code signer server
running for a given input/output directory, and that it serves a single
buildbot worker.
By its nature, a buildbot worker only produces one build at a time and
never performs concurrent builds.
This leads to a conclusion that when starting in a clean environment
there shouldn't be any archives remaining from a previous build.
However, it is possible to have various failure scenarios which might
leave the environment in a non-clean state:
- Network hiccup which makes buildbot worker to stop current build
and re-start it after connection to server is re-established.
Note, this could also happen during buildbot server maintenance.
- Signing server might get restarted due to updates or other reasons.
Requiring manual interaction in such cases is not something good to
require, so here we simply assume that the system is used the way it is
intended to and restore environment to a prestine clean state.
"""
def cleanup_environment_for_builder(self) -> None:
self.unsigned_archive_info.clean()
self.signed_archive_info.clean()
# TODO(sergey): Revisit need of cleaning up the existing files.
# In practice it wasn't so helpful, and with multiple clients
# talking to the same server it becomes even more tricky.
pass
def cleanup_environment_for_signing_server(self) -> None:
# Don't clear the requested to-be-signed archive since we might be
# restarting signing machine while the buildbot is busy.
self.signed_archive_info.clean()
# TODO(sergey): Revisit need of cleaning up the existing files.
# In practice it wasn't so helpful, and with multiple clients
# talking to the same server it becomes even more tricky.
pass
def generate_request_id(self) -> str:
"""
Generate an unique identifier for code signing request.
"""
return str(uuid.uuid4())
def archive_info_for_request_id(
self, path: Path, request_id: str) -> ArchiveWithIndicator:
return ArchiveWithIndicator(
path, f'{request_id}.tar', f'{request_id}.ready')
def signed_archive_info_for_request_id(
self, request_id: str) -> ArchiveWithIndicator:
return self.archive_info_for_request_id(
self.signed_storage_dir, request_id);
def unsigned_archive_info_for_request_id(
self, request_id: str) -> ArchiveWithIndicator:
return self.archive_info_for_request_id(
self.unsigned_storage_dir, request_id);
############################################################################
# Buildbot worker side helpers.
@@ -232,23 +217,43 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
if self.check_file_is_to_be_signed(file)]
return files_to_be_signed
def wait_for_signed_archive_or_die(self) -> None:
def wait_for_signed_archive_or_die(self, request_id) -> None:
"""
Wait until archive with signed files is available.
Will only return if the archive with signed files is available. If there
was an error during code sign procedure the SystemExit exception is
raised, with the message set to the error reported by the codesign
server.
Will only wait for the configured time. If that time exceeds and there
is still no responce from the signing server the application will exit
with a non-zero exit code.
"""
signed_archive_info = self.signed_archive_info_for_request_id(
request_id)
unsigned_archive_info = self.unsigned_archive_info_for_request_id(
request_id)
timeout_in_seconds = self.config.TIMEOUT_IN_SECONDS
time_start = time.monotonic()
while not self.signed_archive_info.is_ready():
while not signed_archive_info.is_ready():
time.sleep(1)
time_slept_in_seconds = time.monotonic() - time_start
if time_slept_in_seconds > timeout_in_seconds:
self.unsigned_archive_info.clean()
signed_archive_info.clean()
unsigned_archive_info.clean()
raise SystemExit("Signing server didn't finish signing in "
f"{timeout_in_seconds} seconds, dying :(")
f'{timeout_in_seconds} seconds, dying :(')
archive_state = signed_archive_info.get_state()
if archive_state.has_error():
signed_archive_info.clean()
unsigned_archive_info.clean()
raise SystemExit(
f'Error happenned during codesign procedure: {archive_state.error_message}')
def copy_signed_files_to_directory(
self, signed_dir: Path, destination_dir: Path) -> None:
@@ -303,13 +308,19 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
return
logger_builder.info('Found %d files to sign.', len(files))
request_id = self.generate_request_id()
signed_archive_info = self.signed_archive_info_for_request_id(
request_id)
unsigned_archive_info = self.unsigned_archive_info_for_request_id(
request_id)
pack_files(files=files,
archive_filepath=self.unsigned_archive_info.archive_filepath)
self.unsigned_archive_info.tag_ready()
archive_filepath=unsigned_archive_info.archive_filepath)
unsigned_archive_info.tag_ready()
# Wait for the signing server to finish signing.
logger_builder.info('Waiting signing server to sign the files...')
self.wait_for_signed_archive_or_die()
self.wait_for_signed_archive_or_die(request_id)
# Extract signed files from archive and move files to final location.
with TemporaryDirectory(prefix='blender-buildbot-') as temp_dir_str:
@@ -317,7 +328,7 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
logger_builder.info('Extracting signed files from archive...')
extract_files(
archive_filepath=self.signed_archive_info.archive_filepath,
archive_filepath=signed_archive_info.archive_filepath,
extraction_dir=unpacked_signed_files_dir)
destination_dir = path
@@ -327,19 +338,39 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
unpacked_signed_files_dir, destination_dir)
logger_builder.info('Removing archive with signed files...')
self.signed_archive_info.clean()
signed_archive_info.clean()
############################################################################
# Signing server side helpers.
def wait_for_sign_request(self) -> None:
def wait_for_sign_request(self) -> str:
"""
Wait for the buildbot to request signing of an archive.
Returns an identifier of signing request.
"""
# TOOD(sergey): Support graceful shutdown on Ctrl-C.
while not self.unsigned_archive_info.is_ready():
logger_server.info(
'Waiting for a READY indicator of any signign request.')
request_id = None
while request_id is None:
for file in self.unsigned_storage_dir.iterdir():
if file.suffix != '.ready':
continue
request_id = file.stem
logger_server.info(f'Found READY for request ID {request_id}.')
if request_id is None:
time.sleep(1)
unsigned_archive_info = self.unsigned_archive_info_for_request_id(
request_id)
while not unsigned_archive_info.is_ready():
time.sleep(1)
return request_id
@abc.abstractmethod
def sign_all_files(self, files: List[AbsoluteAndRelativeFileName]) -> None:
"""
@@ -348,7 +379,7 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
NOTE: Signing should happen in-place.
"""
def run_signing_pipeline(self):
def run_signing_pipeline(self, request_id: str):
"""
Run the full signing pipeline starting from the point when buildbot
worker have requested signing.
@@ -360,9 +391,14 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
with TemporaryDirectory(prefix='blender-codesign-') as temp_dir_str:
temp_dir = Path(temp_dir_str)
signed_archive_info = self.signed_archive_info_for_request_id(
request_id)
unsigned_archive_info = self.unsigned_archive_info_for_request_id(
request_id)
logger_server.info('Extracting unsigned files from archive...')
extract_files(
archive_filepath=self.unsigned_archive_info.archive_filepath,
archive_filepath=unsigned_archive_info.archive_filepath,
extraction_dir=temp_dir)
logger_server.info('Collecting all files which needs signing...')
@@ -370,15 +406,21 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
temp_dir)
logger_server.info('Signing all requested files...')
self.sign_all_files(files)
try:
self.sign_all_files(files)
except CodeSignException as error:
signed_archive_info.tag_ready(error_message=error.message)
unsigned_archive_info.clean()
logger_server.info('Signing is complete with errors.')
return
logger_server.info('Packing signed files...')
pack_files(files=files,
archive_filepath=self.signed_archive_info.archive_filepath)
self.signed_archive_info.tag_ready()
archive_filepath=signed_archive_info.archive_filepath)
signed_archive_info.tag_ready()
logger_server.info('Removing signing request...')
self.unsigned_archive_info.clean()
unsigned_archive_info.clean()
logger_server.info('Signing is complete.')
@@ -389,11 +431,11 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
while True:
logger_server.info('Waiting for the signing request in %s...',
self.unsigned_storage_dir)
self.wait_for_sign_request()
request_id = self.wait_for_sign_request()
logger_server.info(
'Got signing request, beging signign procedure.')
self.run_signing_pipeline()
f'Beging signign procedure for request ID {request_id}.')
self.run_signing_pipeline(request_id)
############################################################################
# Command executing.

View File

@@ -18,20 +18,9 @@
# <pep8 compliant>
# Runs on buildbot slave, rsync zip directly to buildbot server rather
# than using upload which is much slower
class CodeSignException(Exception):
message: str
import buildbot_utils
import os
import sys
if __name__ == "__main__":
builder = buildbot_utils.create_builder_from_arguments()
# rsync, this assumes ssh keys are setup so no password is needed
local_zip = "buildbot_upload.zip"
remote_folder = "builder.blender.org:/data/buildbot-master/uploaded/"
remote_zip = remote_folder + "buildbot_upload_" + builder.name + ".zip"
command = ["rsync", "-avz", local_zip, remote_zip]
buildbot_utils.call(command)
def __init__(self, message):
self.message = message
super().__init__(self.message)

View File

@@ -33,6 +33,7 @@ from buildbot_utils import Builder
from codesign.absolute_and_relative_filename import AbsoluteAndRelativeFileName
from codesign.base_code_signer import BaseCodeSigner
from codesign.exception import CodeSignException
logger = logging.getLogger(__name__)
logger_server = logger.getChild('server')
@@ -45,6 +46,10 @@ EXTENSIONS_TO_BE_SIGNED = {'.dylib', '.so', '.dmg'}
NAME_PREFIXES_TO_BE_SIGNED = {'python'}
class NotarizationException(CodeSignException):
pass
def is_file_from_bundle(file: AbsoluteAndRelativeFileName) -> bool:
"""
Check whether file is coming from an .app bundle
@@ -186,7 +191,7 @@ class MacOSCodeSigner(BaseCodeSigner):
file.absolute_filepath]
self.run_command_or_mock(command, util.Platform.MACOS)
def codesign_all_files(self, files: List[AbsoluteAndRelativeFileName]) -> bool:
def codesign_all_files(self, files: List[AbsoluteAndRelativeFileName]) -> None:
"""
Run codesign tool on all eligible files in the given list.
@@ -225,8 +230,6 @@ class MacOSCodeSigner(BaseCodeSigner):
file_index + 1, num_signed_files,
signed_file.relative_filepath)
return True
def codesign_bundles(
self, files: List[AbsoluteAndRelativeFileName]) -> None:
"""
@@ -273,8 +276,6 @@ class MacOSCodeSigner(BaseCodeSigner):
files.extend(extra_files)
return True
############################################################################
# Notarization.
@@ -334,7 +335,40 @@ class MacOSCodeSigner(BaseCodeSigner):
logger_server.error('xcrun command did not report RequestUUID')
return None
def notarize_wait_result(self, request_uuid: str) -> bool:
def notarize_review_status(self, xcrun_output: str) -> bool:
"""
Review status returned by xcrun's notarization info
Returns truth if the notarization process has finished.
If there are errors during notarization, a NotarizationException()
exception is thrown with status message from the notarial office.
"""
# Parse status and message
status = xcrun_field_value_from_output('Status', xcrun_output)
status_message = xcrun_field_value_from_output(
'Status Message', xcrun_output)
if status == 'success':
logger_server.info(
'Package successfully notarized: %s', status_message)
return True
if status == 'invalid':
logger_server.error(xcrun_output)
logger_server.error(
'Package notarization has failed: %s', status_message)
raise NotarizationException(status_message)
if status == 'in progress':
return False
logger_server.info(
'Unknown notarization status %s (%s)', status, status_message)
return False
def notarize_wait_result(self, request_uuid: str) -> None:
"""
Wait for until notarial office have a reply
"""
@@ -351,29 +385,11 @@ class MacOSCodeSigner(BaseCodeSigner):
timeout_in_seconds = self.config.MACOS_NOTARIZE_TIMEOUT_IN_SECONDS
while True:
output = self.check_output_or_mock(
xcrun_output = self.check_output_or_mock(
command, util.Platform.MACOS, allow_nonzero_exit_code=True)
# Parse status and message
status = xcrun_field_value_from_output('Status', output)
status_message = xcrun_field_value_from_output(
'Status Message', output)
# Review status.
if status:
if status == 'success':
logger_server.info(
'Package successfully notarized: %s', status_message)
return True
elif status == 'invalid':
logger_server.error(output)
logger_server.error(
'Package notarization has failed: %s', status_message)
return False
elif status == 'in progress':
pass
else:
logger_server.info(
'Unknown notarization status %s (%s)', status, status_message)
if self.notarize_review_status(xcrun_output):
break
logger_server.info('Keep waiting for notarization office.')
time.sleep(30)
@@ -394,8 +410,6 @@ class MacOSCodeSigner(BaseCodeSigner):
command = ['xcrun', 'stapler', 'staple', '-v', file.absolute_filepath]
self.check_output_or_mock(command, util.Platform.MACOS)
return True
def notarize_dmg(self, file: AbsoluteAndRelativeFileName) -> bool:
"""
Run entire pipeline to get DMG notarized.
@@ -414,10 +428,7 @@ class MacOSCodeSigner(BaseCodeSigner):
return False
# Staple.
if not self.notarize_staple(file):
return False
return True
self.notarize_staple(file)
def notarize_all_dmg(
self, files: List[AbsoluteAndRelativeFileName]) -> bool:
@@ -432,10 +443,7 @@ class MacOSCodeSigner(BaseCodeSigner):
if not self.check_file_is_to_be_signed(file):
continue
if not self.notarize_dmg(file):
return False
return True
self.notarize_dmg(file)
############################################################################
# Entry point.
@@ -443,11 +451,6 @@ class MacOSCodeSigner(BaseCodeSigner):
def sign_all_files(self, files: List[AbsoluteAndRelativeFileName]) -> None:
# TODO(sergey): Handle errors somehow.
if not self.codesign_all_files(files):
return
if not self.codesign_bundles(files):
return
if not self.notarize_all_dmg(files):
return
self.codesign_all_files(files)
self.codesign_bundles(files)
self.notarize_all_dmg(files)

View File

@@ -29,6 +29,7 @@ from buildbot_utils import Builder
from codesign.absolute_and_relative_filename import AbsoluteAndRelativeFileName
from codesign.base_code_signer import BaseCodeSigner
from codesign.exception import CodeSignException
logger = logging.getLogger(__name__)
logger_server = logger.getChild('server')
@@ -40,6 +41,9 @@ BLACKLIST_FILE_PREFIXES = (
'api-ms-', 'concrt', 'msvcp', 'ucrtbase', 'vcomp', 'vcruntime')
class SigntoolException(CodeSignException):
pass
class WindowsCodeSigner(BaseCodeSigner):
def check_file_is_to_be_signed(
self, file: AbsoluteAndRelativeFileName) -> bool:
@@ -50,12 +54,41 @@ class WindowsCodeSigner(BaseCodeSigner):
return file.relative_filepath.suffix in EXTENSIONS_TO_BE_SIGNED
def get_sign_command_prefix(self) -> List[str]:
return [
'signtool', 'sign', '/v',
'/f', self.config.WIN_CERTIFICATE_FILEPATH,
'/tr', self.config.WIN_TIMESTAMP_AUTHORITY_URL]
def run_codesign_tool(self, filepath: Path) -> None:
command = self.get_sign_command_prefix() + [filepath]
codesign_output = self.check_output_or_mock(command, util.Platform.WINDOWS)
logger_server.info(f'signtool output:\n{codesign_output}')
got_number_of_success = False
for line in codesign_output.split('\n'):
line_clean = line.strip()
line_clean_lower = line_clean.lower()
if line_clean_lower.startswith('number of warnings') or \
line_clean_lower.startswith('number of errors'):
number = int(line_clean_lower.split(':')[1])
if number != 0:
raise SigntoolException('Non-clean success of signtool')
if line_clean_lower.startswith('number of files successfully signed'):
got_number_of_success = True
number = int(line_clean_lower.split(':')[1])
if number != 1:
raise SigntoolException('Signtool did not consider codesign a success')
if not got_number_of_success:
raise SigntoolException('Signtool did not report number of files signed')
def sign_all_files(self, files: List[AbsoluteAndRelativeFileName]) -> None:
# NOTE: Sign files one by one to avoid possible command line length
# overflow (which could happen if we ever decide to sign every binary
@@ -73,12 +106,7 @@ class WindowsCodeSigner(BaseCodeSigner):
file_index + 1, num_files, file.relative_filepath)
continue
command = self.get_sign_command_prefix()
command.append(file.absolute_filepath)
logger_server.info(
'Running signtool command for file [%d/%d] %s...',
file_index + 1, num_files, file.relative_filepath)
# TODO(sergey): Check the status somehow. With a missing certificate
# the command still exists with a zero code.
self.run_command_or_mock(command, util.Platform.WINDOWS)
# TODO(sergey): Report number of signed and ignored files.
self.run_codesign_tool(file.absolute_filepath)

View File

@@ -30,7 +30,7 @@ from tempfile import TemporaryDirectory, NamedTemporaryFile
from typing import List
BUILDBOT_DIRECTORY = Path(__file__).absolute().parent
CODESIGN_SCRIPT = BUILDBOT_DIRECTORY / 'slave_codesign.py'
CODESIGN_SCRIPT = BUILDBOT_DIRECTORY / 'worker_codesign.py'
BLENDER_GIT_ROOT_DIRECTORY = BUILDBOT_DIRECTORY.parent.parent
DARWIN_DIRECTORY = BLENDER_GIT_ROOT_DIRECTORY / 'release' / 'darwin'
@@ -82,6 +82,10 @@ def create_argument_parser():
type=Path,
help="Optional path to applescript to set up folder looks of DMG."
"If not provided default Blender's one is used.")
parser.add_argument(
'--codesign',
action="store_true",
help="Code sign and notarize DMG contents.")
return parser
@@ -395,7 +399,8 @@ def create_final_dmg(app_bundles: List[Path],
dmg_filepath: Path,
background_image_filepath: Path,
volume_name: str,
applescript: Path) -> None:
applescript: Path,
codesign: bool) -> None:
"""
Create DMG with all app bundles
@@ -421,7 +426,8 @@ def create_final_dmg(app_bundles: List[Path],
#
# This allows to recurs into the content of bundles without worrying about
# possible interfereice of Application symlink.
codesign_app_bundles_in_dmg(mount_directory)
if codesign:
codesign_app_bundles_in_dmg(mount_directory)
copy_background_if_needed(background_image_filepath, mount_directory)
create_applications_link(mount_directory)
@@ -434,7 +440,8 @@ def create_final_dmg(app_bundles: List[Path],
compress_dmg(writable_dmg_filepath, dmg_filepath)
writable_dmg_filepath.unlink()
codesign_and_notarize_dmg(dmg_filepath)
if codesign:
codesign_and_notarize_dmg(dmg_filepath)
def ensure_dmg_extension(filepath: Path) -> Path:
@@ -521,6 +528,7 @@ def main():
source_dir = args.source_dir.absolute()
background_image_filepath = get_background_image(args.background_image)
applescript = get_applescript(args.applescript)
codesign = args.codesign
app_bundles = collect_and_log_app_bundles(source_dir)
if not app_bundles:
@@ -535,7 +543,8 @@ def main():
dmg_filepath,
background_image_filepath,
volume_name,
applescript)
applescript,
codesign)
if __name__ == "__main__":

View File

@@ -33,7 +33,7 @@ else()
endif()
execute_process(
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_LIST_DIR}/slave_codesign.py"
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_LIST_DIR}/worker_codesign.py"
"${CMAKE_INSTALL_PREFIX}"
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
RESULT_VARIABLE exit_code

View File

@@ -24,8 +24,8 @@ import shutil
import buildbot_utils
def get_cmake_options(builder):
post_install_script = os.path.join(
builder.blender_dir, 'build_files', 'buildbot', 'slave_codesign.cmake')
codesign_script = os.path.join(
builder.blender_dir, 'build_files', 'buildbot', 'worker_codesign.cmake')
config_file = "build_files/cmake/config/blender_release.cmake"
options = ['-DCMAKE_BUILD_TYPE:STRING=Release',
@@ -36,13 +36,26 @@ def get_cmake_options(builder):
options.append('-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9')
elif builder.platform == 'win':
options.extend(['-G', 'Visual Studio 15 2017 Win64'])
options.extend(['-DPOSTINSTALL_SCRIPT:PATH=' + post_install_script])
if builder.codesign:
options.extend(['-DPOSTINSTALL_SCRIPT:PATH=' + codesign_script])
elif builder.platform == 'linux':
config_file = "build_files/buildbot/config/blender_linux.cmake"
optix_sdk_dir = os.path.join(builder.blender_dir, '..', '..', 'NVIDIA-Optix-SDK')
options.append('-DOPTIX_ROOT_DIR:PATH=' + optix_sdk_dir)
# Workaround to build sm_30 kernels with CUDA 10, since CUDA 11 no longer supports that architecture
if builder.platform == 'win':
options.append('-DCUDA10_TOOLKIT_ROOT_DIR:PATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1')
options.append('-DCUDA10_NVCC_EXECUTABLE:FILEPATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/bin/nvcc.exe')
options.append('-DCUDA11_TOOLKIT_ROOT_DIR:PATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1')
options.append('-DCUDA11_NVCC_EXECUTABLE:FILEPATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1/bin/nvcc.exe')
elif builder.platform == 'linux':
options.append('-DCUDA10_TOOLKIT_ROOT_DIR:PATH=/usr/local/cuda-10.1')
options.append('-DCUDA10_NVCC_EXECUTABLE:FILEPATH=/usr/local/cuda-10.1/bin/nvcc')
options.append('-DCUDA11_TOOLKIT_ROOT_DIR:PATH=/usr/local/cuda-11.1')
options.append('-DCUDA11_NVCC_EXECUTABLE:FILEPATH=/usr/local/cuda-11.1/bin/nvcc')
options.append("-C" + os.path.join(builder.blender_dir, config_file))
options.append("-DCMAKE_INSTALL_PREFIX=%s" % (builder.install_dir))

View File

@@ -18,7 +18,7 @@
# <pep8 compliant>
# Runs on buildbot slave, creating a release package using the build
# Runs on buildbot worker, creating a release package using the build
# system and zipping it into buildbot_upload.zip. This is then uploaded
# to the master in the next buildbot step.
@@ -110,13 +110,15 @@ def pack_mac(builder):
release_dir = os.path.join(builder.blender_dir, 'release', 'darwin')
buildbot_dir = os.path.join(builder.blender_dir, 'build_files', 'buildbot')
bundle_script = os.path.join(buildbot_dir, 'slave_bundle_dmg.py')
bundle_script = os.path.join(buildbot_dir, 'worker_bundle_dmg.py')
command = [bundle_script]
command += ['--dmg', package_filepath]
if info.is_development_build:
background_image = os.path.join(release_dir, 'buildbot', 'background.tif')
command += ['--background-image', background_image]
if builder.codesign:
command += ['--codesign']
command += [builder.install_dir]
buildbot_utils.call(command)
@@ -150,7 +152,8 @@ def pack_win(builder):
package_filename = package_name + '.msi'
package_filepath = os.path.join(builder.build_dir, package_filename)
sign_file_or_directory(package_filepath)
if builder.codesign:
sign_file_or_directory(package_filepath)
package_files += [(package_filepath, package_filename)]

View File

@@ -52,7 +52,7 @@ set(WITH_USD ON CACHE BOOL "" FORCE)
set(WITH_MEM_JEMALLOC ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_CUDA_BINARIES ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_CUBIN_COMPILER OFF CACHE BOOL "" FORCE)
set(CYCLES_CUDA_BINARIES_ARCH sm_30;sm_35;sm_37;sm_50;sm_52;sm_60;sm_61;sm_70;sm_75 CACHE STRING "" FORCE)
set(CYCLES_CUDA_BINARIES_ARCH sm_30;sm_35;sm_37;sm_50;sm_52;sm_60;sm_61;sm_70;sm_75;sm_86;compute_75 CACHE STRING "" FORCE)
set(WITH_CYCLES_DEVICE_OPTIX ON CACHE BOOL "" FORCE)
# platform dependent options

View File

@@ -186,7 +186,7 @@ if(SYSTEMSTUBS_LIBRARY)
list(APPEND PLATFORM_LINKLIBS SystemStubs)
endif()
set(PLATFORM_CFLAGS "-pipe -funsigned-char")
set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
set(PLATFORM_LINKFLAGS
"-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework Metal -framework QuartzCore"
)
@@ -369,8 +369,9 @@ if(WITH_CYCLES_OSL)
list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} -force_load ${OSL_LIB_EXEC} ${OSL_LIB_QUERY})
find_path(OSL_INCLUDE_DIR OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
find_path(OSL_SHADER_DIR NAMES stdosl.h PATHS ${CYCLES_OSL}/shaders)
if(OSL_INCLUDE_DIR AND OSL_LIBRARIES AND OSL_COMPILER)
if(OSL_INCLUDE_DIR AND OSL_LIBRARIES AND OSL_COMPILER AND OSL_SHADER_DIR)
set(OSL_FOUND TRUE)
else()
message(STATUS "OSL not found")
@@ -429,8 +430,8 @@ endif()
set(EXETYPE MACOSX_BUNDLE)
set(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")
set(CMAKE_CXX_FLAGS_DEBUG "-fno-strict-aliasing -g")
set(CMAKE_C_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR CMAKE_OSX_ARCHITECTURES MATCHES "i386")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic -msse -msse2 -msse3 -mssse3")
set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic -msse -msse2 -msse3 -mssse3")
@@ -439,8 +440,8 @@ if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR CMAKE_OSX_ARCHITECTURES MATCHES "
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ftree-vectorize -fvariable-expansion-in-unroller")
endif()
else()
set(CMAKE_C_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
set(CMAKE_CXX_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
set(CMAKE_C_FLAGS_RELEASE "-mdynamic-no-pic")
set(CMAKE_CXX_FLAGS_RELEASE "-mdynamic-no-pic")
endif()
if(${XCODE_VERSION} VERSION_EQUAL 5 OR ${XCODE_VERSION} VERSION_GREATER 5)

View File

@@ -134,14 +134,7 @@ endif()
unset(OSX_SDKROOT)
# 10.11 is our min. target, if you use higher sdk, weak linking happens
if(CMAKE_OSX_DEPLOYMENT_TARGET)
if(${CMAKE_OSX_DEPLOYMENT_TARGET} VERSION_LESS 10.11)
message(STATUS "Setting deployment target to 10.11, lower versions are not supported")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE STRING "" FORCE)
endif()
else()
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE STRING "" FORCE)
endif()
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE STRING "" FORCE)
if(NOT ${CMAKE_GENERATOR} MATCHES "Xcode")
# Force CMAKE_OSX_DEPLOYMENT_TARGET for makefiles, will not work else (CMake bug?)

View File

@@ -7,6 +7,15 @@ if(WITH_WINDOWS_BUNDLE_CRT)
set(CMAKE_INSTALL_OPENMP_LIBRARIES ${WITH_OPENMP})
include(InstallRequiredSystemLibraries)
# ucrtbase(d).dll cannot be in the manifest, due to the way windows 10 handles
# redirects for this dll, for details see T88813.
foreach(lib ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS})
string(FIND ${lib} "ucrtbase" pos)
if(NOT pos EQUAL -1)
list(REMOVE_ITEM CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ${lib})
install(FILES ${lib} DESTINATION . COMPONENT Libraries)
endif()
endforeach()
# Install the CRT to the blender.crt Sub folder.
install(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ./blender.crt COMPONENT Libraries)

View File

@@ -0,0 +1,70 @@
#
# Do NOT merge to master
#
#
# Used by Buildbot build pipeline make_update.py script only for now
# We intended to udpate the make_update.py in the branches to use this file eventually
#
update-code:
git:
submodules:
- branch: blender-v2.83-release
commit_id: HEAD
path: release/scripts/addons
- branch: blender-v2.83-release
commit_id: HEAD
path: release/scripts/addons_contrib
- branch: blender-v2.83-release
commit_id: HEAD
path: release/datafiles/locale
- branch: blender-v2.83-release
commit_id: HEAD
path: source/tools
svn:
libraries:
darwin-arm64:
branch: tags/blender-2.83-release
commit_id: HEAD
path: lib/darwin_arm64
darwin-x86_64:
branch: tags/blender-2.83-release
commit_id: HEAD
path: lib/darwin
linux-x86_64:
branch: tags/blender-2.83-release
commit_id: HEAD
path: lib/linux_centos7_x86_64
windows-amd64:
branch: tags/blender-2.83-release
commit_id: HEAD
path: lib/win64_vc15
tests:
branch: tags/blender-2.83-release
commit_id: HEAD
path: lib/tests
#
# Buildbot only configs
#
buildbot:
gcc:
version: '9.0.0'
cuda10:
version: '10.1.243'
cuda11:
version: '11.4.1'
optix:
version: '7.0.0'
cmake:
default:
overrides: {}
version: any
darwin-arm64:
overrides: {}
darwin-x86_64:
overrides: {}
linux-x86_64:
overrides: {}
windows-amd64:
overrides: {}

View File

@@ -40,7 +40,8 @@ if make_utils.command_missing(git_command):
# Test if we are building a specific release version.
branch = make_utils.git_branch(git_command)
release_version = make_utils.git_branch_release_version(branch)
tag = make_utils.git_tag(git_command)
release_version = make_utils.git_branch_release_version(branch, tag)
lib_tests_dirpath = os.path.join('..', 'lib', "tests")
if not os.path.exists(lib_tests_dirpath):

View File

@@ -197,7 +197,8 @@ if __name__ == "__main__":
# Test if we are building a specific release version.
branch = make_utils.git_branch(args.git_command)
release_version = make_utils.git_branch_release_version(branch)
tag = make_utils.git_tag(args.git_command)
release_version = make_utils.git_branch_release_version(branch, tag)
if not args.no_libraries:
svn_update(args, release_version)

View File

@@ -36,7 +36,7 @@ def check_output(cmd, exit_on_error=True):
return output.strip()
def git_branch(git_command):
# Test if we are building a specific release version.
# Get current branch name.
try:
branch = subprocess.check_output([git_command, "rev-parse", "--abbrev-ref", "HEAD"])
except subprocess.CalledProcessError as e:
@@ -45,10 +45,23 @@ def git_branch(git_command):
return branch.strip().decode('utf8')
def git_branch_release_version(branch):
def git_tag(git_command):
# Get current tag name.
try:
tag = subprocess.check_output([git_command, "describe", "--exact-match"], stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
return None
return tag.strip().decode('utf8')
def git_branch_release_version(branch, tag):
release_version = re.search("^blender-v(.*)-release$", branch)
if release_version:
release_version = release_version.group(1)
elif tag:
release_version = re.search("^v([0-9]*\.[0-9]*).*", tag)
if release_version:
release_version = release_version.group(1)
return release_version
def svn_libraries_base_url(release_version):

View File

@@ -52,7 +52,7 @@ SDLDevice::SDLDevice(DeviceSpecs specs, int buffersize) :
if(specs.channels == CHANNELS_INVALID)
specs.channels = CHANNELS_STEREO;
if(specs.format == FORMAT_INVALID)
specs.format = FORMAT_S16;
specs.format = FORMAT_FLOAT32;
if(specs.rate == RATE_INVALID)
specs.rate = RATE_48000;
@@ -61,10 +61,25 @@ SDLDevice::SDLDevice(DeviceSpecs specs, int buffersize) :
SDL_AudioSpec format, obtained;
format.freq = m_specs.rate;
if(m_specs.format == FORMAT_U8)
switch(m_specs.format)
{
case FORMAT_U8:
format.format = AUDIO_U8;
else
break;
case FORMAT_S16:
format.format = AUDIO_S16SYS;
break;
case FORMAT_S32:
format.format = AUDIO_S32SYS;
break;
case FORMAT_FLOAT32:
format.format = AUDIO_F32SYS;
break;
default:
format.format = AUDIO_F32SYS;
break;
}
format.channels = m_specs.channels;
format.samples = buffersize;
format.callback = SDLDevice::SDL_mix;
@@ -75,14 +90,25 @@ SDLDevice::SDLDevice(DeviceSpecs specs, int buffersize) :
m_specs.rate = (SampleRate)obtained.freq;
m_specs.channels = (Channels)obtained.channels;
if(obtained.format == AUDIO_U8)
m_specs.format = FORMAT_U8;
else if(obtained.format == AUDIO_S16LSB || obtained.format == AUDIO_S16MSB)
m_specs.format = FORMAT_S16;
else
switch(obtained.format)
{
case AUDIO_U8:
m_specs.format = FORMAT_U8;
break;
case AUDIO_S16SYS:
m_specs.format = FORMAT_S16;
break;
case AUDIO_S32SYS:
m_specs.format = FORMAT_S32;
break;
case AUDIO_F32SYS:
m_specs.format = FORMAT_FLOAT32;
break;
default:
SDL_CloseAudio();
AUD_THROW(DeviceException, "The sample format obtained from SDL is not supported.");
break;
}
create();

View File

@@ -609,6 +609,7 @@ typedef enum cudaError_enum {
CUDA_ERROR_INVALID_GRAPHICS_CONTEXT = 219,
CUDA_ERROR_NVLINK_UNCORRECTABLE = 220,
CUDA_ERROR_JIT_COMPILER_NOT_FOUND = 221,
CUDA_ERROR_UNSUPPORTED_PTX_VERSION = 222,
CUDA_ERROR_INVALID_SOURCE = 300,
CUDA_ERROR_FILE_NOT_FOUND = 301,
CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND = 302,

View File

@@ -736,6 +736,7 @@ const char *cuewErrorString(CUresult result) {
case CUDA_ERROR_INVALID_GRAPHICS_CONTEXT: return "Invalid graphics context";
case CUDA_ERROR_NVLINK_UNCORRECTABLE: return "Nvlink uncorrectable";
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_FILE_NOT_FOUND: return "File not found";
case CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND: return "Link to a shared object failed to resolve";

View File

@@ -153,7 +153,6 @@ static void clg_str_reserve(CLogStringBuf *cstr, const uint len)
cstr->data = data;
cstr->is_alloc = true;
}
cstr->len_alloc = len;
}
}
@@ -179,26 +178,34 @@ static void clg_str_vappendf(CLogStringBuf *cstr, const char *fmt, va_list args)
{
/* Use limit because windows may use '-1' for a formatting error. */
const uint len_max = 65535;
uint len_avail = (cstr->len_alloc - cstr->len);
if (len_avail == 0) {
len_avail = CLOG_BUF_LEN_INIT;
clg_str_reserve(cstr, len_avail);
}
while (true) {
uint len_avail = cstr->len_alloc - cstr->len;
va_list args_cpy;
va_copy(args_cpy, args);
int retval = vsnprintf(cstr->data + cstr->len, len_avail, fmt, args_cpy);
va_end(args_cpy);
if (retval != -1) {
cstr->len += retval;
if (retval < 0) {
/* Some encoding error happened, not much we can do here, besides skipping/cancelling this
* message. */
break;
}
else if ((uint)retval <= len_avail) {
/* Copy was successful. */
cstr->len += (uint)retval;
break;
}
else {
len_avail *= 2;
if (len_avail >= len_max) {
/* vsnprintf was not successful, due to lack of allocated space, retval contains expected
* length of the formated string, use it to allocate required amount of memory. */
uint len_alloc = cstr->len + (uint)retval;
if (len_alloc >= len_max) {
/* Safe upper-limit, just in case... */
break;
}
clg_str_reserve(cstr, len_avail);
clg_str_reserve(cstr, len_alloc);
len_avail = cstr->len_alloc - cstr->len;
}
}
}

View File

@@ -313,7 +313,7 @@ if(WITH_CYCLES_CUDA_BINARIES AND (NOT WITH_CYCLES_CUBIN_COMPILER))
set(MAX_MSVC 1910)
elseif(${CUDA_VERSION} EQUAL "9.1")
set(MAX_MSVC 1911)
elseif(${CUDA_VERSION} LESS "11.0")
elseif(${CUDA_VERSION} VERSION_GREATER_EQUAL 10.0)
set(MAX_MSVC 1999)
endif()
if(NOT MSVC_VERSION LESS ${MAX_MSVC} OR CMAKE_C_COMPILER_ID MATCHES "Clang")

View File

@@ -84,7 +84,7 @@ def update_script_node(node, report):
if script.is_in_memory or script.is_dirty or script.is_modified or not os.path.exists(osl_path):
# write text datablock contents to temporary file
osl_file = tempfile.NamedTemporaryFile(mode='w', suffix=".osl", delete=False)
osl_file.write(script.as_string())
osl_file.write(script.as_string() + "\n")
osl_file.close()
ok, oso_path = osl_compile(osl_file.name, report)

View File

@@ -1577,8 +1577,13 @@ class CyclesPreferences(bpy.types.AddonPreferences):
# For backwards compatibility, only returns CUDA and OpenCL but still
# refreshes all devices.
def get_devices(self, compute_device_type=''):
import _cycles
# Ensure `self.devices` is not re-allocated when the second call to
# get_devices_for_type is made, freeing items from the first list.
for device_type in ('CUDA', 'OPTIX', 'OPENCL'):
self.update_device_entries(_cycles.available_devices(device_type))
cuda_devices = self.get_devices_for_type('CUDA')
self.get_devices_for_type('OPTIX')
opencl_devices = self.get_devices_for_type('OPENCL')
return cuda_devices, opencl_devices

View File

@@ -456,15 +456,19 @@ void BlenderSync::sync_motion(BL::RenderSettings &b_render,
python_thread_state_restore(python_thread_state);
b_engine.frame_set(frame, subframe);
python_thread_state_save(python_thread_state);
sync_camera_motion(b_render, b_cam, width, height, 0.0f);
if (b_cam) {
sync_camera_motion(b_render, b_cam, width, height, 0.0f);
}
sync_objects(b_depsgraph, b_v3d, 0.0f);
}
/* Insert motion times from camera. Motion times from other objects
* have already been added in a sync_objects call. */
uint camera_motion_steps = object_motion_steps(b_cam, b_cam);
for (size_t step = 0; step < camera_motion_steps; step++) {
motion_times.insert(scene->camera->motion_time(step));
if (b_cam) {
uint camera_motion_steps = object_motion_steps(b_cam, b_cam);
for (size_t step = 0; step < camera_motion_steps; step++) {
motion_times.insert(scene->camera->motion_time(step));
}
}
/* note iteration over motion_times set happens in sorted order */

View File

@@ -384,16 +384,16 @@ static ShaderNode *add_node(Scene *scene,
switch (b_aniso_node.distribution()) {
case BL::ShaderNodeBsdfAnisotropic::distribution_BECKMANN:
aniso->distribution = CLOSURE_BSDF_MICROFACET_BECKMANN_ANISO_ID;
aniso->distribution = CLOSURE_BSDF_MICROFACET_BECKMANN_ID;
break;
case BL::ShaderNodeBsdfAnisotropic::distribution_GGX:
aniso->distribution = CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID;
aniso->distribution = CLOSURE_BSDF_MICROFACET_GGX_ID;
break;
case BL::ShaderNodeBsdfAnisotropic::distribution_MULTI_GGX:
aniso->distribution = CLOSURE_BSDF_MICROFACET_MULTI_GGX_ANISO_ID;
aniso->distribution = CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID;
break;
case BL::ShaderNodeBsdfAnisotropic::distribution_ASHIKHMIN_SHIRLEY:
aniso->distribution = CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ANISO_ID;
aniso->distribution = CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID;
break;
}
@@ -678,7 +678,7 @@ static ShaderNode *add_node(Scene *scene,
* builtin names for packed images and movies
*/
int scene_frame = b_scene.frame_current();
int image_frame = image_user_frame_number(b_image_user, scene_frame);
int image_frame = image_user_frame_number(b_image_user, b_image, scene_frame);
image->handle = scene->image_manager->add_image(
new BlenderImageLoader(b_image, image_frame), image->image_params());
}
@@ -713,7 +713,7 @@ static ShaderNode *add_node(Scene *scene,
if (is_builtin) {
int scene_frame = b_scene.frame_current();
int image_frame = image_user_frame_number(b_image_user, scene_frame);
int image_frame = image_user_frame_number(b_image_user, b_image, scene_frame);
env->handle = scene->image_manager->add_image(new BlenderImageLoader(b_image, image_frame),
env->image_params());
}

View File

@@ -693,7 +693,11 @@ void BlenderSync::free_data_after_sync(BL::Depsgraph &b_depsgraph)
* footprint during synchronization process.
*/
const bool is_interface_locked = b_engine.render() && b_engine.render().use_lock_interface();
const bool can_free_caches = BlenderSession::headless || is_interface_locked;
const bool can_free_caches = (BlenderSession::headless || is_interface_locked) &&
/* Baking re-uses the depsgraph multiple times, clearing crashes
* reading un-evaluated mesh data which isn't aligned with the
* geometry we're baking, see T71012. */
!scene->bake_manager->get_baking();
if (!can_free_caches) {
return;
}

View File

@@ -238,7 +238,7 @@ static inline string image_user_file_path(BL::ImageUser &iuser,
{
char filepath[1024];
iuser.tile(0);
BKE_image_user_frame_calc(NULL, iuser.ptr.data, cfra);
BKE_image_user_frame_calc(ima.ptr.data, iuser.ptr.data, cfra);
BKE_image_user_file_path(iuser.ptr.data, ima.ptr.data, filepath);
string filepath_str = string(filepath);
@@ -248,9 +248,9 @@ static inline string image_user_file_path(BL::ImageUser &iuser,
return filepath_str;
}
static inline int image_user_frame_number(BL::ImageUser &iuser, int cfra)
static inline int image_user_frame_number(BL::ImageUser &iuser, BL::Image &ima, int cfra)
{
BKE_image_user_frame_calc(NULL, iuser.ptr.data, cfra);
BKE_image_user_frame_calc(ima.ptr.data, iuser.ptr.data, cfra);
return iuser.frame_current();
}

View File

@@ -35,8 +35,10 @@ CCL_NAMESPACE_BEGIN
class BlenderSmokeLoader : public ImageLoader {
public:
BlenderSmokeLoader(BL::Object &b_ob, AttributeStandard attribute)
: b_domain(object_fluid_gas_domain_find(b_ob)), b_mesh(b_ob.data()), attribute(attribute)
: b_domain(object_fluid_gas_domain_find(b_ob)), attribute(attribute)
{
BL::Mesh b_mesh(b_ob.data());
mesh_texture_space(b_mesh, texspace_loc, texspace_size);
}
bool load_metadata(ImageMetaData &metadata) override
@@ -77,9 +79,7 @@ class BlenderSmokeLoader : public ImageLoader {
/* Create a matrix to transform from object space to mesh texture space.
* This does not work with deformations but that can probably only be done
* well with a volume grid mapping of coordinates. */
float3 loc, size;
mesh_texture_space(b_mesh, loc, size);
metadata.transform_3d = transform_translate(-loc) * transform_scale(size);
metadata.transform_3d = transform_translate(-texspace_loc) * transform_scale(texspace_size);
metadata.use_transform_3d = true;
return true;
@@ -177,7 +177,7 @@ class BlenderSmokeLoader : public ImageLoader {
}
BL::FluidDomainSettings b_domain;
BL::Mesh b_mesh;
float3 texspace_loc, texspace_size;
AttributeStandard attribute;
};
@@ -216,25 +216,16 @@ static void sync_smoke_volume(Scene *scene, BL::Object &b_ob, Mesh *mesh, float
class BlenderVolumeLoader : public VDBImageLoader {
public:
BlenderVolumeLoader(BL::Volume b_volume, const string &grid_name)
: VDBImageLoader(grid_name),
b_volume(b_volume),
b_volume_grid(PointerRNA_NULL),
unload(false)
BlenderVolumeLoader(BL::BlendData &b_data, BL::Volume &b_volume, const string &grid_name)
: VDBImageLoader(grid_name), b_data(b_data), b_volume(b_volume), unload(false)
{
#ifdef WITH_OPENVDB
/* Find grid with matching name. */
BL::Volume::grids_iterator b_grid_iter;
for (b_volume.grids.begin(b_grid_iter); b_grid_iter != b_volume.grids.end(); ++b_grid_iter) {
if (b_grid_iter->name() == grid_name) {
b_volume_grid = *b_grid_iter;
}
}
#endif
}
bool load_metadata(ImageMetaData &metadata) override
{
b_volume.grids.load(b_data.ptr.data);
BL::VolumeGrid b_volume_grid = find_grid();
if (!b_volume_grid) {
return false;
}
@@ -255,6 +246,9 @@ class BlenderVolumeLoader : public VDBImageLoader {
const size_t pixel_size,
const bool associate_alpha) override
{
b_volume.grids.load(b_data.ptr.data);
BL::VolumeGrid b_volume_grid = find_grid();
if (!b_volume_grid) {
return false;
}
@@ -266,19 +260,38 @@ class BlenderVolumeLoader : public VDBImageLoader {
{
/* TODO: detect multiple volume datablocks with the same filepath. */
const BlenderVolumeLoader &other_loader = (const BlenderVolumeLoader &)other;
return b_volume == other_loader.b_volume && b_volume_grid == other_loader.b_volume_grid;
return b_volume == other_loader.b_volume && grid_name == other_loader.grid_name;
}
void cleanup() override
{
VDBImageLoader::cleanup();
BL::VolumeGrid b_volume_grid = find_grid();
if (b_volume_grid && unload) {
b_volume_grid.unload();
}
}
/* Find grid with matching name. Grid point not stored in the class since
* grids may be unloaded before we load the pixels, for example for motion
* blur where we move between frames. */
BL::VolumeGrid find_grid()
{
#ifdef WITH_OPENVDB
BL::Volume::grids_iterator b_grid_iter;
for (b_volume.grids.begin(b_grid_iter); b_grid_iter != b_volume.grids.end(); ++b_grid_iter) {
if (b_grid_iter->name() == grid_name) {
return *b_grid_iter;
}
}
#endif
return BL::VolumeGrid(PointerRNA_NULL);
}
BL::BlendData b_data;
BL::Volume b_volume;
BL::VolumeGrid b_volume_grid;
bool unload;
};
@@ -325,7 +338,7 @@ static void sync_volume_object(BL::BlendData &b_data, BL::Object &b_ob, Scene *s
mesh->attributes.add(std) :
mesh->attributes.add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_VOXEL);
ImageLoader *loader = new BlenderVolumeLoader(b_volume, name.string());
ImageLoader *loader = new BlenderVolumeLoader(b_data, b_volume, name.string());
ImageParams params;
params.frame = b_volume.grids.frame();

View File

@@ -352,11 +352,24 @@ string CUDADevice::compile_kernel(const DeviceRequestedFeatures &requested_featu
}
}
const string ptx = path_get(string_printf("lib/%s_compute_%d%d.ptx", name, major, minor));
VLOG(1) << "Testing for pre-compiled kernel " << ptx << ".";
if (path_exists(ptx)) {
VLOG(1) << "Using precompiled kernel.";
return ptx;
/* The driver can JIT-compile PTX generated for older generations, so find the closest one. */
int ptx_major = major, ptx_minor = minor;
while (ptx_major >= 3) {
const string ptx = path_get(
string_printf("lib/%s_compute_%d%d.ptx", name, ptx_major, ptx_minor));
VLOG(1) << "Testing for pre-compiled kernel " << ptx << ".";
if (path_exists(ptx)) {
VLOG(1) << "Using precompiled kernel.";
return ptx;
}
if (ptx_minor > 0) {
ptx_minor--;
}
else {
ptx_major--;
ptx_minor = 9;
}
}
}
@@ -413,18 +426,19 @@ string CUDADevice::compile_kernel(const DeviceRequestedFeatures &requested_featu
const int nvcc_cuda_version = cuewCompilerVersion();
VLOG(1) << "Found nvcc " << nvcc << ", CUDA version " << nvcc_cuda_version << ".";
if (nvcc_cuda_version < 80) {
if (nvcc_cuda_version < 101) {
printf(
"Unsupported CUDA version %d.%d detected, "
"you need CUDA 8.0 or newer.\n",
"you need CUDA 10.1 or newer.\n",
nvcc_cuda_version / 10,
nvcc_cuda_version % 10);
return string();
}
else if (!(nvcc_cuda_version == 101 || nvcc_cuda_version == 102)) {
else if (!(nvcc_cuda_version == 101 || nvcc_cuda_version == 102 || nvcc_cuda_version == 111 ||
nvcc_cuda_version == 112 || nvcc_cuda_version == 113 || nvcc_cuda_version == 114)) {
printf(
"CUDA version %d.%d detected, build may succeed but only "
"CUDA 10.1 and 10.2 are officially supported.\n",
"CUDA 10.1 to 11.4 are officially supported.\n",
nvcc_cuda_version / 10,
nvcc_cuda_version % 10);
}
@@ -531,9 +545,9 @@ bool CUDADevice::load_kernels(const DeviceRequestedFeatures &requested_features)
if (result == CUDA_SUCCESS) {
reserve_local_memory(requested_features);
}
load_functions();
load_functions();
}
return (result == CUDA_SUCCESS);
}

View File

@@ -1537,34 +1537,22 @@ bool device_optix_init()
void device_optix_info(const vector<DeviceInfo> &cuda_devices, vector<DeviceInfo> &devices)
{
devices.reserve(cuda_devices.size());
// Simply add all supported CUDA devices as OptiX devices again
for (const DeviceInfo &cuda_info : cuda_devices) {
DeviceInfo info = cuda_info;
for (DeviceInfo info : cuda_devices) {
assert(info.type == DEVICE_CUDA);
int major;
cuDeviceGetAttribute(&major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, info.num);
if (major < 5) {
continue; // Only Maxwell and up are supported by OptiX
}
info.type = DEVICE_OPTIX;
info.id += "_OptiX";
// Figure out RTX support
CUdevice cuda_device = 0;
CUcontext cuda_context = NULL;
unsigned int rtcore_version = 0;
if (cuDeviceGet(&cuda_device, info.num) == CUDA_SUCCESS &&
cuDevicePrimaryCtxRetain(&cuda_context, cuda_device) == CUDA_SUCCESS) {
OptixDeviceContext optix_context = NULL;
if (optixDeviceContextCreate(cuda_context, nullptr, &optix_context) == OPTIX_SUCCESS) {
optixDeviceContextGetProperty(optix_context,
OPTIX_DEVICE_PROPERTY_RTCORE_VERSION,
&rtcore_version,
sizeof(rtcore_version));
optixDeviceContextDestroy(optix_context);
}
cuDevicePrimaryCtxRelease(cuda_device);
}
// Only add devices with RTX support
if (rtcore_version != 0 || getenv("CYCLES_OPTIX_TEST")) {
devices.push_back(info);
}
devices.push_back(info);
}
}

View File

@@ -1892,10 +1892,8 @@ void OpenCLDevice::shader(DeviceTask &task)
}
}
string OpenCLDevice::kernel_build_options(const string *debug_src)
static bool kernel_build_opencl_2(cl_device_id cdDevice)
{
string build_options = "-cl-no-signed-zeros -cl-mad-enable ";
/* Build with OpenCL 2.0 if available, this improves performance
* with AMD OpenCL drivers on Windows and Linux (legacy drivers).
* Note that OpenCL selects the highest 1.x version by default,
@@ -1903,10 +1901,36 @@ string OpenCLDevice::kernel_build_options(const string *debug_src)
int version_major, version_minor;
if (OpenCLInfo::get_device_version(cdDevice, &version_major, &version_minor)) {
if (version_major >= 2) {
build_options += "-cl-std=CL2.0 ";
/* This appears to trigger a driver bug in Radeon RX cards with certain
* driver version, so don't use OpenCL 2.0 for those. */
string device_name = OpenCLInfo::get_readable_device_name(cdDevice);
if (string_startswith(device_name, "Radeon RX 4") ||
string_startswith(device_name, "Radeon (TM) RX 4") ||
string_startswith(device_name, "Radeon RX 5") ||
string_startswith(device_name, "Radeon (TM) RX 5")) {
char version[256] = "";
int driver_major, driver_minor;
clGetDeviceInfo(cdDevice, CL_DEVICE_VERSION, sizeof(version), &version, NULL);
if (sscanf(version, "OpenCL 2.0 AMD-APP (%d.%d)", &driver_major, &driver_minor) == 2) {
return !(driver_major == 3075 && driver_minor <= 12);
}
}
return true;
}
}
return false;
}
string OpenCLDevice::kernel_build_options(const string *debug_src)
{
string build_options = "-cl-no-signed-zeros -cl-mad-enable ";
if (kernel_build_opencl_2(cdDevice)) {
build_options += "-cl-std=CL2.0 ";
}
if (platform_name == "NVIDIA CUDA") {
build_options +=
"-D__KERNEL_OPENCL_NVIDIA__ "

View File

@@ -64,6 +64,9 @@ void MemoryManager::DeviceBuffer::update_device_memory(OpenCLDevice *device)
total_size += alloc_size;
}
/* Always allocate non-empty buffer, NULL pointers cause problems with some drivers. */
total_size = std::max(total_size, (size_t)16);
if (need_realloc) {
cl_ulong max_buffer_size;
clGetDeviceInfo(
@@ -251,7 +254,7 @@ void MemoryManager::set_kernel_arg_buffers(cl_kernel kernel, cl_uint *narg)
device->kernel_set_args(kernel, (*narg)++, *device_buffer.buffer);
}
else {
device->kernel_set_args(kernel, (*narg)++, 0);
device->kernel_set_args(kernel, (*narg)++);
}
}
}

View File

@@ -375,11 +375,16 @@ if(WITH_CYCLES_CUDA_BINARIES)
set(CUDA_VERSION "${CUDA_VERSION_MAJOR}${CUDA_VERSION_MINOR}")
# warn for other versions
if((CUDA_VERSION MATCHES "101") OR (CUDA_VERSION MATCHES "102"))
if((CUDA_VERSION MATCHES "101") OR
(CUDA_VERSION MATCHES "102") OR
(CUDA_VERSION MATCHES "111") OR
(CUDA_VERSION MATCHES "112") OR
(CUDA_VERSION MATCHES "113") OR
(CUDA_VERSION MATCHES "114"))
else()
message(WARNING
"CUDA version ${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR} detected, "
"build may succeed but only CUDA 10.1 and 10.2 are officially supported")
"build may succeed but only CUDA 10.1 to 11.4 are officially supported")
endif()
# build for each arch
@@ -445,10 +450,10 @@ if(WITH_CYCLES_CUDA_BINARIES)
# cycles_cubin_cc since the env variable is read before main()
if(APPLE)
set(CUBIN_CC_ENV ${CMAKE_COMMAND}
-E env DYLD_LIBRARY_PATH="${CUDA_TOOLKIT_ROOT_DIR}/lib")
-E env DYLD_LIBRARY_PATH="${cuda_toolkit_root_dir}/lib")
elseif(UNIX)
set(CUBIN_CC_ENV ${CMAKE_COMMAND}
-E env LD_LIBRARY_PATH="${CUDA_TOOLKIT_ROOT_DIR}/lib64")
-E env LD_LIBRARY_PATH="${cuda_toolkit_root_dir}/lib64")
endif()
add_custom_command(
@@ -459,12 +464,12 @@ if(WITH_CYCLES_CUDA_BINARIES)
-i ${CMAKE_CURRENT_SOURCE_DIR}${cuda_kernel_src}
${cuda_flags}
-v
-cuda-toolkit-dir "${CUDA_TOOLKIT_ROOT_DIR}"
-cuda-toolkit-dir "${cuda_toolkit_root_dir}"
DEPENDS ${kernel_sources} cycles_cubin_cc)
else()
add_custom_command(
OUTPUT ${cuda_file}
COMMAND ${CUDA_NVCC_EXECUTABLE}
COMMAND ${cuda_nvcc_executable}
-arch=${arch}
${CUDA_NVCC_FLAGS}
--${format}
@@ -481,11 +486,35 @@ if(WITH_CYCLES_CUDA_BINARIES)
set(prev_arch "none")
foreach(arch ${CYCLES_CUDA_BINARIES_ARCH})
if(${arch} MATCHES "sm_2.")
if(${arch} MATCHES ".*_2.")
message(STATUS "CUDA binaries for ${arch} are no longer supported, skipped.")
elseif(${arch} MATCHES "sm_7." AND ${CUDA_VERSION} LESS 100)
elseif(${arch} MATCHES ".*_30")
if(DEFINED CUDA10_NVCC_EXECUTABLE)
set(cuda_nvcc_executable ${CUDA10_NVCC_EXECUTABLE})
set(cuda_toolkit_root_dir ${CUDA10_TOOLKIT_ROOT_DIR})
elseif(${CUDA_VERSION} LESS 110) # Support for sm_30 was removed in CUDA 11
set(cuda_nvcc_executable ${CUDA_NVCC_EXECUTABLE})
set(cuda_toolkit_root_dir ${CUDA_TOOLKIT_ROOT_DIR})
else()
message(STATUS "CUDA binaries for ${arch} require CUDA 10 or earlier, skipped.")
endif()
elseif(${arch} MATCHES ".*_7." AND ${CUDA_VERSION} LESS 100)
message(STATUS "CUDA binaries for ${arch} require CUDA 10.0+, skipped.")
elseif(${arch} MATCHES ".*_8.")
if(DEFINED CUDA11_NVCC_EXECUTABLE)
set(cuda_nvcc_executable ${CUDA11_NVCC_EXECUTABLE})
set(cuda_toolkit_root_dir ${CUDA11_TOOLKIT_ROOT_DIR})
elseif(${CUDA_VERSION} GREATER_EQUAL 111) # Support for sm_86 was introduced in CUDA 11
set(cuda_nvcc_executable ${CUDA_NVCC_EXECUTABLE})
set(cuda_toolkit_root_dir ${CUDA_TOOLKIT_ROOT_DIR})
else()
message(STATUS "CUDA binaries for ${arch} require CUDA 11.1+, skipped.")
endif()
else()
set(cuda_nvcc_executable ${CUDA_NVCC_EXECUTABLE})
set(cuda_toolkit_root_dir ${CUDA_TOOLKIT_ROOT_DIR})
endif()
if(DEFINED cuda_nvcc_executable AND DEFINED cuda_toolkit_root_dir)
# Compile regular kernel
CYCLES_CUDA_KERNEL_ADD(${arch} ${prev_arch} filter "" "${cuda_filter_sources}" FALSE)
CYCLES_CUDA_KERNEL_ADD(${arch} ${prev_arch} kernel "" "${cuda_sources}" FALSE)
@@ -498,6 +527,9 @@ if(WITH_CYCLES_CUDA_BINARIES)
if(WITH_CYCLES_CUDA_BUILD_SERIAL)
set(prev_arch ${arch})
endif()
unset(cuda_nvcc_executable)
unset(cuda_toolkit_root_dir)
endif()
endforeach()
@@ -549,7 +581,7 @@ if(WITH_CYCLES_DEVICE_OPTIX AND WITH_CYCLES_CUDA_BINARIES)
${SRC_UTIL_HEADERS}
COMMAND ${CUBIN_CC_ENV}
"$<TARGET_FILE:cycles_cubin_cc>"
-target 30
-target 50
-ptx
-i ${CMAKE_CURRENT_SOURCE_DIR}/${input}
${cuda_flags}
@@ -573,7 +605,7 @@ if(WITH_CYCLES_DEVICE_OPTIX AND WITH_CYCLES_CUDA_BINARIES)
COMMAND
${CUDA_NVCC_EXECUTABLE}
--ptx
-arch=sm_30
-arch=sm_50
${cuda_flags}
${input}
WORKING_DIRECTORY

View File

@@ -229,8 +229,6 @@ ccl_device_inline int bsdf_sample(KernelGlobals *kg,
case CLOSURE_BSDF_MICROFACET_GGX_ID:
case CLOSURE_BSDF_MICROFACET_GGX_FRESNEL_ID:
case CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID:
case CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID:
case CLOSURE_BSDF_MICROFACET_GGX_ANISO_FRESNEL_ID:
case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID:
label = bsdf_microfacet_ggx_sample(kg,
sc,
@@ -281,7 +279,6 @@ ccl_device_inline int bsdf_sample(KernelGlobals *kg,
&sd->lcg_state);
break;
case CLOSURE_BSDF_MICROFACET_BECKMANN_ID:
case CLOSURE_BSDF_MICROFACET_BECKMANN_ANISO_ID:
case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
label = bsdf_microfacet_beckmann_sample(kg,
sc,
@@ -298,7 +295,6 @@ ccl_device_inline int bsdf_sample(KernelGlobals *kg,
pdf);
break;
case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID:
case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ANISO_ID:
label = bsdf_ashikhmin_shirley_sample(sc,
sd->Ng,
sd->I,
@@ -504,8 +500,6 @@ ccl_device_inline
case CLOSURE_BSDF_MICROFACET_GGX_ID:
case CLOSURE_BSDF_MICROFACET_GGX_FRESNEL_ID:
case CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID:
case CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID:
case CLOSURE_BSDF_MICROFACET_GGX_ANISO_FRESNEL_ID:
case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID:
eval = bsdf_microfacet_ggx_eval_reflect(sc, sd->I, omega_in, pdf);
break;
@@ -519,12 +513,10 @@ ccl_device_inline
sc, sd->I, omega_in, pdf, &sd->lcg_state);
break;
case CLOSURE_BSDF_MICROFACET_BECKMANN_ID:
case CLOSURE_BSDF_MICROFACET_BECKMANN_ANISO_ID:
case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
eval = bsdf_microfacet_beckmann_eval_reflect(sc, sd->I, omega_in, pdf);
break;
case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID:
case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ANISO_ID:
eval = bsdf_ashikhmin_shirley_eval_reflect(sc, sd->I, omega_in, pdf);
break;
case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID:
@@ -595,8 +587,6 @@ ccl_device_inline
case CLOSURE_BSDF_MICROFACET_GGX_ID:
case CLOSURE_BSDF_MICROFACET_GGX_FRESNEL_ID:
case CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID:
case CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID:
case CLOSURE_BSDF_MICROFACET_GGX_ANISO_FRESNEL_ID:
case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID:
eval = bsdf_microfacet_ggx_eval_transmit(sc, sd->I, omega_in, pdf);
break;
@@ -610,12 +600,10 @@ ccl_device_inline
sc, sd->I, omega_in, pdf, &sd->lcg_state);
break;
case CLOSURE_BSDF_MICROFACET_BECKMANN_ID:
case CLOSURE_BSDF_MICROFACET_BECKMANN_ANISO_ID:
case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
eval = bsdf_microfacet_beckmann_eval_transmit(sc, sd->I, omega_in, pdf);
break;
case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID:
case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ANISO_ID:
eval = bsdf_ashikhmin_shirley_eval_transmit(sc, sd->I, omega_in, pdf);
break;
case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID:
@@ -679,18 +667,14 @@ ccl_device void bsdf_blur(KernelGlobals *kg, ShaderClosure *sc, float roughness)
case CLOSURE_BSDF_MICROFACET_GGX_ID:
case CLOSURE_BSDF_MICROFACET_GGX_FRESNEL_ID:
case CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID:
case CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID:
case CLOSURE_BSDF_MICROFACET_GGX_ANISO_FRESNEL_ID:
case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID:
bsdf_microfacet_ggx_blur(sc, roughness);
break;
case CLOSURE_BSDF_MICROFACET_BECKMANN_ID:
case CLOSURE_BSDF_MICROFACET_BECKMANN_ANISO_ID:
case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
bsdf_microfacet_beckmann_blur(sc, roughness);
break;
case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID:
case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ANISO_ID:
bsdf_ashikhmin_shirley_blur(sc, roughness);
break;
case CLOSURE_BSDF_HAIR_PRINCIPLED_ID:
@@ -719,18 +703,14 @@ ccl_device bool bsdf_merge(ShaderClosure *a, ShaderClosure *b)
case CLOSURE_BSDF_MICROFACET_GGX_ID:
case CLOSURE_BSDF_MICROFACET_GGX_FRESNEL_ID:
case CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID:
case CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID:
case CLOSURE_BSDF_MICROFACET_GGX_ANISO_FRESNEL_ID:
case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID:
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID:
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_FRESNEL_ID:
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID:
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID:
case CLOSURE_BSDF_MICROFACET_BECKMANN_ID:
case CLOSURE_BSDF_MICROFACET_BECKMANN_ANISO_ID:
case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID:
case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ANISO_ID:
return bsdf_microfacet_merge(a, b);
case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID:
return bsdf_ashikhmin_velvet_merge(a, b);

View File

@@ -32,20 +32,11 @@ Other than that, the implementation directly follows the paper.
CCL_NAMESPACE_BEGIN
ccl_device int bsdf_ashikhmin_shirley_setup(MicrofacetBsdf *bsdf)
{
bsdf->alpha_x = clamp(bsdf->alpha_x, 1e-4f, 1.0f);
bsdf->alpha_y = bsdf->alpha_x;
bsdf->type = CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID;
return SD_BSDF | SD_BSDF_HAS_EVAL;
}
ccl_device int bsdf_ashikhmin_shirley_aniso_setup(MicrofacetBsdf *bsdf)
{
bsdf->alpha_x = clamp(bsdf->alpha_x, 1e-4f, 1.0f);
bsdf->alpha_y = clamp(bsdf->alpha_y, 1e-4f, 1.0f);
bsdf->type = CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ANISO_ID;
bsdf->type = CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID;
return SD_BSDF | SD_BSDF_HAS_EVAL;
}

View File

@@ -256,9 +256,7 @@ ccl_device_forceinline float3 reflection_color(const MicrofacetBsdf *bsdf, float
{
float3 F = make_float3(1.0f, 1.0f, 1.0f);
bool use_fresnel = (bsdf->type == CLOSURE_BSDF_MICROFACET_GGX_FRESNEL_ID ||
bsdf->type == CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID ||
bsdf->type == CLOSURE_BSDF_MICROFACET_GGX_ANISO_FRESNEL_ID);
bsdf->type == CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID);
if (use_fresnel) {
float F0 = fresnel_dielectric_cos(1.0f, bsdf->ior);
@@ -311,19 +309,27 @@ ccl_device int bsdf_microfacet_ggx_setup(MicrofacetBsdf *bsdf)
bsdf->extra = NULL;
bsdf->alpha_x = saturate(bsdf->alpha_x);
bsdf->alpha_y = bsdf->alpha_x;
bsdf->alpha_y = saturate(bsdf->alpha_y);
bsdf->type = CLOSURE_BSDF_MICROFACET_GGX_ID;
return SD_BSDF | SD_BSDF_HAS_EVAL;
}
/* Required to maintain OSL interface. */
ccl_device int bsdf_microfacet_ggx_isotropic_setup(MicrofacetBsdf *bsdf)
{
bsdf->alpha_y = bsdf->alpha_x;
return bsdf_microfacet_ggx_setup(bsdf);
}
ccl_device int bsdf_microfacet_ggx_fresnel_setup(MicrofacetBsdf *bsdf, const ShaderData *sd)
{
bsdf->extra->cspec0 = saturate3(bsdf->extra->cspec0);
bsdf->alpha_x = saturate(bsdf->alpha_x);
bsdf->alpha_y = bsdf->alpha_x;
bsdf->alpha_y = saturate(bsdf->alpha_y);
bsdf->type = CLOSURE_BSDF_MICROFACET_GGX_FRESNEL_ID;
@@ -361,32 +367,6 @@ ccl_device bool bsdf_microfacet_merge(const ShaderClosure *a, const ShaderClosur
(bsdf_a->extra->clearcoat == bsdf_b->extra->clearcoat)));
}
ccl_device int bsdf_microfacet_ggx_aniso_setup(MicrofacetBsdf *bsdf)
{
bsdf->extra = NULL;
bsdf->alpha_x = saturate(bsdf->alpha_x);
bsdf->alpha_y = saturate(bsdf->alpha_y);
bsdf->type = CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID;
return SD_BSDF | SD_BSDF_HAS_EVAL;
}
ccl_device int bsdf_microfacet_ggx_aniso_fresnel_setup(MicrofacetBsdf *bsdf, const ShaderData *sd)
{
bsdf->extra->cspec0 = saturate3(bsdf->extra->cspec0);
bsdf->alpha_x = saturate(bsdf->alpha_x);
bsdf->alpha_y = saturate(bsdf->alpha_y);
bsdf->type = CLOSURE_BSDF_MICROFACET_GGX_ANISO_FRESNEL_ID;
bsdf_microfacet_fresnel_color(sd, bsdf);
return SD_BSDF | SD_BSDF_HAS_EVAL;
}
ccl_device int bsdf_microfacet_ggx_refraction_setup(MicrofacetBsdf *bsdf)
{
bsdf->extra = NULL;
@@ -636,8 +616,7 @@ ccl_device int bsdf_microfacet_ggx_sample(KernelGlobals *kg,
*eval = make_float3(1e6f, 1e6f, 1e6f);
bool use_fresnel = (bsdf->type == CLOSURE_BSDF_MICROFACET_GGX_FRESNEL_ID ||
bsdf->type == CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID ||
bsdf->type == CLOSURE_BSDF_MICROFACET_GGX_ANISO_FRESNEL_ID);
bsdf->type == CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID);
/* if fresnel is used, calculate the color with reflection_color(...) */
if (use_fresnel) {
@@ -811,19 +790,18 @@ ccl_device int bsdf_microfacet_ggx_sample(KernelGlobals *kg,
ccl_device int bsdf_microfacet_beckmann_setup(MicrofacetBsdf *bsdf)
{
bsdf->alpha_x = saturate(bsdf->alpha_x);
bsdf->alpha_y = bsdf->alpha_x;
bsdf->alpha_y = saturate(bsdf->alpha_y);
bsdf->type = CLOSURE_BSDF_MICROFACET_BECKMANN_ID;
return SD_BSDF | SD_BSDF_HAS_EVAL;
}
ccl_device int bsdf_microfacet_beckmann_aniso_setup(MicrofacetBsdf *bsdf)
/* Required to maintain OSL interface. */
ccl_device int bsdf_microfacet_beckmann_isotropic_setup(MicrofacetBsdf *bsdf)
{
bsdf->alpha_x = saturate(bsdf->alpha_x);
bsdf->alpha_y = saturate(bsdf->alpha_y);
bsdf->alpha_y = bsdf->alpha_x;
bsdf->type = CLOSURE_BSDF_MICROFACET_BECKMANN_ANISO_ID;
return SD_BSDF | SD_BSDF_HAS_EVAL;
return bsdf_microfacet_beckmann_setup(bsdf);
}
ccl_device int bsdf_microfacet_beckmann_refraction_setup(MicrofacetBsdf *bsdf)

View File

@@ -384,32 +384,10 @@ ccl_device int bsdf_microfacet_multi_ggx_common_setup(MicrofacetBsdf *bsdf)
return SD_BSDF | SD_BSDF_HAS_EVAL | SD_BSDF_NEEDS_LCG;
}
ccl_device int bsdf_microfacet_multi_ggx_aniso_setup(MicrofacetBsdf *bsdf)
{
if (is_zero(bsdf->T))
bsdf->T = make_float3(1.0f, 0.0f, 0.0f);
bsdf->type = CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID;
return bsdf_microfacet_multi_ggx_common_setup(bsdf);
}
ccl_device int bsdf_microfacet_multi_ggx_aniso_fresnel_setup(MicrofacetBsdf *bsdf,
const ShaderData *sd)
{
if (is_zero(bsdf->T))
bsdf->T = make_float3(1.0f, 0.0f, 0.0f);
bsdf->type = CLOSURE_BSDF_MICROFACET_MULTI_GGX_FRESNEL_ID;
bsdf_microfacet_fresnel_color(sd, bsdf);
return bsdf_microfacet_multi_ggx_common_setup(bsdf);
}
ccl_device int bsdf_microfacet_multi_ggx_setup(MicrofacetBsdf *bsdf)
{
bsdf->alpha_y = bsdf->alpha_x;
if (is_zero(bsdf->T))
bsdf->T = make_float3(1.0f, 0.0f, 0.0f);
bsdf->type = CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID;
@@ -418,7 +396,8 @@ ccl_device int bsdf_microfacet_multi_ggx_setup(MicrofacetBsdf *bsdf)
ccl_device int bsdf_microfacet_multi_ggx_fresnel_setup(MicrofacetBsdf *bsdf, const ShaderData *sd)
{
bsdf->alpha_y = bsdf->alpha_x;
if (is_zero(bsdf->T))
bsdf->T = make_float3(1.0f, 0.0f, 0.0f);
bsdf->type = CLOSURE_BSDF_MICROFACET_MULTI_GGX_FRESNEL_ID;

View File

@@ -70,8 +70,8 @@
# endif
# define CUDA_KERNEL_BRANCHED_MAX_REGISTERS 63
/* 7.x */
#elif __CUDA_ARCH__ <= 799
/* 7.x, 8.x */
#elif __CUDA_ARCH__ <= 899
# define CUDA_MULTIPRESSOR_MAX_REGISTERS 65536
# define CUDA_MULTIPROCESSOR_MAX_BLOCKS 32
# define CUDA_BLOCK_MAX_THREADS 1024

View File

@@ -66,8 +66,8 @@ kernel_tex_image_interp_bicubic(const TextureInfo &info, CUtexObject tex, float
x = (x * info.width) - 0.5f;
y = (y * info.height) - 0.5f;
float px = floor(x);
float py = floor(y);
float px = floorf(x);
float py = floorf(y);
float fx = x - px;
float fy = y - py;
@@ -91,9 +91,9 @@ ccl_device T kernel_tex_image_interp_bicubic_3d(
y = (y * info.height) - 0.5f;
z = (z * info.depth) - 0.5f;
float px = floor(x);
float py = floor(y);
float pz = floor(z);
float px = floorf(x);
float py = floorf(y);
float pz = floorf(z);
float fx = x - px;
float fy = y - py;
float fz = z - pz;

View File

@@ -100,14 +100,14 @@ CLOSURE_FLOAT3_PARAM(DiffuseClosure, params.N),
BSDF_CLOSURE_CLASS_END(AshikhminVelvet, ashikhmin_velvet)
BSDF_CLOSURE_CLASS_BEGIN(AshikhminShirley,
ashikhmin_shirley_aniso,
ashikhmin_shirley,
MicrofacetBsdf,
LABEL_GLOSSY | LABEL_REFLECT)
CLOSURE_FLOAT3_PARAM(AshikhminShirleyClosure, params.N),
CLOSURE_FLOAT3_PARAM(AshikhminShirleyClosure, params.T),
CLOSURE_FLOAT_PARAM(AshikhminShirleyClosure, params.alpha_x),
CLOSURE_FLOAT_PARAM(AshikhminShirleyClosure, params.alpha_y),
BSDF_CLOSURE_CLASS_END(AshikhminShirley, ashikhmin_shirley_aniso)
BSDF_CLOSURE_CLASS_END(AshikhminShirley, ashikhmin_shirley)
BSDF_CLOSURE_CLASS_BEGIN(DiffuseToon, diffuse_toon, ToonBsdf, LABEL_DIFFUSE)
CLOSURE_FLOAT3_PARAM(DiffuseToonClosure, params.N),
@@ -121,42 +121,42 @@ CLOSURE_FLOAT3_PARAM(DiffuseClosure, params.N),
CLOSURE_FLOAT_PARAM(GlossyToonClosure, params.smooth),
BSDF_CLOSURE_CLASS_END(GlossyToon, glossy_toon)
BSDF_CLOSURE_CLASS_BEGIN(MicrofacetGGXIsotropic,
microfacet_ggx_isotropic,
MicrofacetBsdf,
LABEL_GLOSSY | LABEL_REFLECT)
CLOSURE_FLOAT3_PARAM(MicrofacetGGXIsotropicClosure, params.N),
CLOSURE_FLOAT_PARAM(MicrofacetGGXIsotropicClosure, params.alpha_x),
BSDF_CLOSURE_CLASS_END(MicrofacetGGXIsotropic, microfacet_ggx_isotropic)
BSDF_CLOSURE_CLASS_BEGIN(MicrofacetGGX,
microfacet_ggx,
MicrofacetBsdf,
LABEL_GLOSSY | LABEL_REFLECT)
CLOSURE_FLOAT3_PARAM(MicrofacetGGXClosure, params.N),
CLOSURE_FLOAT3_PARAM(MicrofacetGGXClosure, params.T),
CLOSURE_FLOAT_PARAM(MicrofacetGGXClosure, params.alpha_x),
CLOSURE_FLOAT_PARAM(MicrofacetGGXClosure, params.alpha_y),
BSDF_CLOSURE_CLASS_END(MicrofacetGGX, microfacet_ggx)
BSDF_CLOSURE_CLASS_BEGIN(MicrofacetGGXAniso,
microfacet_ggx_aniso,
BSDF_CLOSURE_CLASS_BEGIN(MicrofacetBeckmannIsotropic,
microfacet_beckmann_isotropic,
MicrofacetBsdf,
LABEL_GLOSSY | LABEL_REFLECT)
CLOSURE_FLOAT3_PARAM(MicrofacetGGXAnisoClosure, params.N),
CLOSURE_FLOAT3_PARAM(MicrofacetGGXAnisoClosure, params.T),
CLOSURE_FLOAT_PARAM(MicrofacetGGXAnisoClosure, params.alpha_x),
CLOSURE_FLOAT_PARAM(MicrofacetGGXAnisoClosure, params.alpha_y),
BSDF_CLOSURE_CLASS_END(MicrofacetGGXAniso, microfacet_ggx_aniso)
CLOSURE_FLOAT3_PARAM(MicrofacetBeckmannIsotropicClosure, params.N),
CLOSURE_FLOAT_PARAM(MicrofacetBeckmannIsotropicClosure, params.alpha_x),
BSDF_CLOSURE_CLASS_END(MicrofacetBeckmannIsotropic, microfacet_beckmann_isotropic)
BSDF_CLOSURE_CLASS_BEGIN(MicrofacetBeckmann,
microfacet_beckmann,
MicrofacetBsdf,
LABEL_GLOSSY | LABEL_REFLECT)
CLOSURE_FLOAT3_PARAM(MicrofacetBeckmannClosure, params.N),
CLOSURE_FLOAT3_PARAM(MicrofacetBeckmannClosure, params.T),
CLOSURE_FLOAT_PARAM(MicrofacetBeckmannClosure, params.alpha_x),
CLOSURE_FLOAT_PARAM(MicrofacetBeckmannClosure, params.alpha_y),
BSDF_CLOSURE_CLASS_END(MicrofacetBeckmann, microfacet_beckmann)
BSDF_CLOSURE_CLASS_BEGIN(MicrofacetBeckmannAniso,
microfacet_beckmann_aniso,
MicrofacetBsdf,
LABEL_GLOSSY | LABEL_REFLECT)
CLOSURE_FLOAT3_PARAM(MicrofacetBeckmannAnisoClosure, params.N),
CLOSURE_FLOAT3_PARAM(MicrofacetBeckmannAnisoClosure, params.T),
CLOSURE_FLOAT_PARAM(MicrofacetBeckmannAnisoClosure, params.alpha_x),
CLOSURE_FLOAT_PARAM(MicrofacetBeckmannAnisoClosure, params.alpha_y),
BSDF_CLOSURE_CLASS_END(MicrofacetBeckmannAniso, microfacet_beckmann_aniso)
BSDF_CLOSURE_CLASS_BEGIN(MicrofacetGGXRefraction,
microfacet_ggx_refraction,
MicrofacetBsdf,
@@ -362,13 +362,16 @@ void OSLShader::register_closures(OSLShadingSystem *ss_)
id++,
closure_bsdf_transparent_params(),
closure_bsdf_transparent_prepare);
register_closure(
ss, "microfacet_ggx", id++, bsdf_microfacet_ggx_params(), bsdf_microfacet_ggx_prepare);
ss, "microfacet", id++, closure_bsdf_microfacet_params(), closure_bsdf_microfacet_prepare);
register_closure(ss,
"microfacet_ggx_aniso",
"microfacet_ggx",
id++,
bsdf_microfacet_ggx_aniso_params(),
bsdf_microfacet_ggx_aniso_prepare);
bsdf_microfacet_ggx_isotropic_params(),
bsdf_microfacet_ggx_isotropic_prepare);
register_closure(
ss, "microfacet_ggx_aniso", id++, bsdf_microfacet_ggx_params(), bsdf_microfacet_ggx_prepare);
register_closure(ss,
"microfacet_ggx_refraction",
id++,
@@ -417,13 +420,13 @@ void OSLShader::register_closures(OSLShadingSystem *ss_)
register_closure(ss,
"microfacet_beckmann",
id++,
bsdf_microfacet_beckmann_params(),
bsdf_microfacet_beckmann_prepare);
bsdf_microfacet_beckmann_isotropic_params(),
bsdf_microfacet_beckmann_isotropic_prepare);
register_closure(ss,
"microfacet_beckmann_aniso",
id++,
bsdf_microfacet_beckmann_aniso_params(),
bsdf_microfacet_beckmann_aniso_prepare);
bsdf_microfacet_beckmann_params(),
bsdf_microfacet_beckmann_prepare);
register_closure(ss,
"microfacet_beckmann_refraction",
id++,
@@ -432,8 +435,8 @@ void OSLShader::register_closures(OSLShadingSystem *ss_)
register_closure(ss,
"ashikhmin_shirley",
id++,
bsdf_ashikhmin_shirley_aniso_params(),
bsdf_ashikhmin_shirley_aniso_prepare);
bsdf_ashikhmin_shirley_params(),
bsdf_ashikhmin_shirley_prepare);
register_closure(
ss, "ashikhmin_velvet", id++, bsdf_ashikhmin_velvet_params(), bsdf_ashikhmin_velvet_prepare);
register_closure(
@@ -508,6 +511,82 @@ bool CBSDFClosure::skip(const ShaderData *sd, int path_flag, int scattering)
return false;
}
/* Standard Microfacet Closure */
class MicrofacetClosure : public CBSDFClosure {
public:
MicrofacetBsdf params;
ustring distribution;
int refract;
void setup(ShaderData *sd, int path_flag, float3 weight)
{
static ustring u_ggx("ggx");
static ustring u_default("default");
const int label = (refract) ? LABEL_TRANSMIT : LABEL_REFLECT;
if (skip(sd, path_flag, LABEL_GLOSSY | label)) {
return;
}
MicrofacetBsdf *bsdf = (MicrofacetBsdf *)bsdf_alloc_osl(
sd, sizeof(MicrofacetBsdf), weight, &params);
if (!bsdf) {
return;
}
/* GGX */
if (distribution == u_ggx || distribution == u_default) {
if (!refract) {
if (params.alpha_x == params.alpha_y) {
/* Isotropic */
sd->flag |= bsdf_microfacet_ggx_isotropic_setup(bsdf);
}
else {
/* Anisotropic */
sd->flag |= bsdf_microfacet_ggx_setup(bsdf);
}
}
else {
sd->flag |= bsdf_microfacet_ggx_refraction_setup(bsdf);
}
}
/* Beckmann */
else {
if (!refract) {
if (params.alpha_x == params.alpha_y) {
/* Isotropic */
sd->flag |= bsdf_microfacet_beckmann_isotropic_setup(bsdf);
}
else {
/* Anisotropic */
sd->flag |= bsdf_microfacet_beckmann_setup(bsdf);
}
}
else {
sd->flag |= bsdf_microfacet_beckmann_refraction_setup(bsdf);
}
}
}
};
ClosureParam *closure_bsdf_microfacet_params()
{
static ClosureParam params[] = {CLOSURE_STRING_PARAM(MicrofacetClosure, distribution),
CLOSURE_FLOAT3_PARAM(MicrofacetClosure, params.N),
CLOSURE_FLOAT3_PARAM(MicrofacetClosure, params.T),
CLOSURE_FLOAT_PARAM(MicrofacetClosure, params.alpha_x),
CLOSURE_FLOAT_PARAM(MicrofacetClosure, params.alpha_y),
CLOSURE_FLOAT_PARAM(MicrofacetClosure, params.ior),
CLOSURE_INT_PARAM(MicrofacetClosure, refract),
CLOSURE_STRING_KEYPARAM(MicrofacetClosure, label, "label"),
CLOSURE_FINISH_PARAM(MicrofacetClosure)};
return params;
}
CCLOSURE_PREPARE(closure_bsdf_microfacet_prepare, MicrofacetClosure)
/* GGX closures with Fresnel */
class MicrofacetFresnelClosure : public CBSDFClosure {
@@ -582,7 +661,7 @@ class MicrofacetGGXAnisoFresnelClosure : public MicrofacetFresnelClosure {
return;
}
sd->flag |= bsdf_microfacet_ggx_aniso_fresnel_setup(bsdf, sd);
sd->flag |= bsdf_microfacet_ggx_fresnel_setup(bsdf, sd);
}
};
@@ -676,7 +755,7 @@ class MicrofacetMultiGGXAnisoClosure : public MicrofacetMultiClosure {
}
bsdf->ior = 0.0f;
sd->flag |= bsdf_microfacet_multi_ggx_aniso_setup(bsdf);
sd->flag |= bsdf_microfacet_multi_ggx_setup(bsdf);
}
};
@@ -801,7 +880,7 @@ class MicrofacetMultiGGXAnisoFresnelClosure : public MicrofacetMultiFresnelClosu
return;
}
sd->flag |= bsdf_microfacet_multi_ggx_aniso_fresnel_setup(bsdf, sd);
sd->flag |= bsdf_microfacet_multi_ggx_fresnel_setup(bsdf, sd);
}
};

View File

@@ -51,6 +51,7 @@ OSL::ClosureParam *closure_bsdf_transparent_params();
OSL::ClosureParam *closure_bssrdf_params();
OSL::ClosureParam *closure_absorption_params();
OSL::ClosureParam *closure_henyey_greenstein_params();
OSL::ClosureParam *closure_bsdf_microfacet_params();
OSL::ClosureParam *closure_bsdf_microfacet_multi_ggx_params();
OSL::ClosureParam *closure_bsdf_microfacet_multi_ggx_glass_params();
OSL::ClosureParam *closure_bsdf_microfacet_multi_ggx_aniso_params();
@@ -70,6 +71,7 @@ void closure_bsdf_transparent_prepare(OSL::RendererServices *, int id, void *dat
void closure_bssrdf_prepare(OSL::RendererServices *, int id, void *data);
void closure_absorption_prepare(OSL::RendererServices *, int id, void *data);
void closure_henyey_greenstein_prepare(OSL::RendererServices *, int id, void *data);
void closure_bsdf_microfacet_prepare(OSL::RendererServices *, int id, void *data);
void closure_bsdf_microfacet_multi_ggx_prepare(OSL::RendererServices *, int id, void *data);
void closure_bsdf_microfacet_multi_ggx_glass_prepare(OSL::RendererServices *, int id, void *data);
void closure_bsdf_microfacet_multi_ggx_aniso_prepare(OSL::RendererServices *, int id, void *data);

View File

@@ -59,23 +59,7 @@ ccl_device void kernel_buffer_update(KernelGlobals *kg,
kernel_split_params.queue_size,
1);
#ifdef __COMPUTE_DEVICE_GPU__
/* If we are executing on a GPU device, we exit all threads that are not
* required.
*
* If we are executing on a CPU device, then we need to keep all threads
* active since we have barrier() calls later in the kernel. CPU devices,
* expect all threads to execute barrier statement.
*/
if (ray_index == QUEUE_EMPTY_SLOT) {
return;
}
#endif
#ifndef __COMPUTE_DEVICE_GPU__
if (ray_index != QUEUE_EMPTY_SLOT) {
#endif
ccl_global char *ray_state = kernel_split_state.ray_state;
ccl_global PathState *state = &kernel_split_state.path_state[ray_index];
PathRadiance *L = &kernel_split_state.path_radiance[ray_index];
@@ -153,10 +137,7 @@ ccl_device void kernel_buffer_update(KernelGlobals *kg,
}
}
}
#ifndef __COMPUTE_DEVICE_GPU__
}
#endif
/* Enqueue RAY_REGENERATED rays into QUEUE_ACTIVE_AND_REGENERATED_RAYS;
* These rays will be made active during next SceneIntersectkernel.

View File

@@ -73,23 +73,7 @@ ccl_device void kernel_holdout_emission_blurring_pathtermination_ao(
kernel_split_params.queue_size,
0);
#ifdef __COMPUTE_DEVICE_GPU__
/* If we are executing on a GPU device, we exit all threads that are not
* required.
*
* If we are executing on a CPU device, then we need to keep all threads
* active since we have barrier() calls later in the kernel. CPU devices,
* expect all threads to execute barrier statement.
*/
if (ray_index == QUEUE_EMPTY_SLOT) {
return;
}
#endif /* __COMPUTE_DEVICE_GPU__ */
#ifndef __COMPUTE_DEVICE_GPU__
if (ray_index != QUEUE_EMPTY_SLOT) {
#endif
ccl_global PathState *state = 0x0;
float3 throughput;
@@ -148,10 +132,7 @@ ccl_device void kernel_holdout_emission_blurring_pathtermination_ao(
}
}
#endif /* __AO__ */
#ifndef __COMPUTE_DEVICE_GPU__
}
#endif
#ifdef __AO__
/* Enqueue to-shadow-ray-cast rays. */

View File

@@ -33,18 +33,15 @@ ccl_device void kernel_shader_setup(KernelGlobals *kg,
int ray_index = ccl_global_id(1) * ccl_global_size(0) + ccl_global_id(0);
int queue_index = kernel_split_params.queue_index[QUEUE_ACTIVE_AND_REGENERATED_RAYS];
if (ray_index >= queue_index) {
return;
}
ray_index = get_ray_index(kg,
ray_index,
QUEUE_ACTIVE_AND_REGENERATED_RAYS,
kernel_split_state.queue_data,
kernel_split_params.queue_size,
0);
if (ray_index == QUEUE_EMPTY_SLOT) {
return;
if (ray_index < queue_index) {
ray_index = get_ray_index(kg,
ray_index,
QUEUE_ACTIVE_AND_REGENERATED_RAYS,
kernel_split_state.queue_data,
kernel_split_params.queue_size,
0);
} else {
ray_index = QUEUE_EMPTY_SLOT;
}
char enqueue_flag = (IS_STATE(kernel_split_state.ray_state, ray_index, RAY_TO_REGENERATE)) ? 1 :

View File

@@ -320,9 +320,9 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg,
/* setup bsdf */
if (distribution == CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID ||
roughness <= 0.075f) /* use single-scatter GGX */
sd->flag |= bsdf_microfacet_ggx_aniso_fresnel_setup(bsdf, sd);
sd->flag |= bsdf_microfacet_ggx_fresnel_setup(bsdf, sd);
else /* use multi-scatter GGX */
sd->flag |= bsdf_microfacet_multi_ggx_aniso_fresnel_setup(bsdf, sd);
sd->flag |= bsdf_microfacet_multi_ggx_fresnel_setup(bsdf, sd);
}
}
# ifdef __CAUSTICS_TRICKS__
@@ -515,12 +515,34 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg,
float roughness = sqr(param1);
bsdf->N = N;
bsdf->T = make_float3(0.0f, 0.0f, 0.0f);
bsdf->alpha_x = roughness;
bsdf->alpha_y = roughness;
bsdf->ior = 0.0f;
bsdf->extra = NULL;
if (data_node.y == SVM_STACK_INVALID) {
bsdf->T = make_float3(0.0f, 0.0f, 0.0f);
bsdf->alpha_x = roughness;
bsdf->alpha_y = roughness;
}
else {
bsdf->T = stack_load_float3(stack, data_node.y);
/* rotate tangent */
float rotation = stack_load_float(stack, data_node.z);
if (rotation != 0.0f)
bsdf->T = rotate_around_axis(bsdf->T, bsdf->N, rotation * M_2PI_F);
/* compute roughness */
float anisotropy = clamp(param2, -0.99f, 0.99f);
if (anisotropy < 0.0f) {
bsdf->alpha_x = roughness / (1.0f + anisotropy);
bsdf->alpha_y = roughness * (1.0f + anisotropy);
}
else {
bsdf->alpha_x = roughness * (1.0f - anisotropy);
bsdf->alpha_y = roughness / (1.0f - anisotropy);
}
}
/* setup bsdf */
if (type == CLOSURE_BSDF_REFLECTION_ID)
sd->flag |= bsdf_reflection_setup(bsdf);
@@ -529,10 +551,10 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg,
else if (type == CLOSURE_BSDF_MICROFACET_GGX_ID)
sd->flag |= bsdf_microfacet_ggx_setup(bsdf);
else if (type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID) {
kernel_assert(stack_valid(data_node.z));
kernel_assert(stack_valid(data_node.w));
bsdf->extra = (MicrofacetExtra *)closure_alloc_extra(sd, sizeof(MicrofacetExtra));
if (bsdf->extra) {
bsdf->extra->color = stack_load_float3(stack, data_node.z);
bsdf->extra->color = stack_load_float3(stack, data_node.w);
bsdf->extra->cspec0 = make_float3(0.0f, 0.0f, 0.0f);
bsdf->extra->clearcoat = 0.0f;
sd->flag |= bsdf_microfacet_multi_ggx_setup(bsdf);
@@ -675,64 +697,6 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg,
sd->flag |= bsdf_microfacet_multi_ggx_glass_setup(bsdf);
break;
}
case CLOSURE_BSDF_MICROFACET_BECKMANN_ANISO_ID:
case CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID:
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_ANISO_ID:
case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ANISO_ID: {
#ifdef __CAUSTICS_TRICKS__
if (!kernel_data.integrator.caustics_reflective && (path_flag & PATH_RAY_DIFFUSE))
break;
#endif
float3 weight = sd->svm_closure_weight * mix_weight;
MicrofacetBsdf *bsdf = (MicrofacetBsdf *)bsdf_alloc(sd, sizeof(MicrofacetBsdf), weight);
if (bsdf) {
bsdf->N = N;
bsdf->extra = NULL;
bsdf->T = stack_load_float3(stack, data_node.y);
/* rotate tangent */
float rotation = stack_load_float(stack, data_node.z);
if (rotation != 0.0f)
bsdf->T = rotate_around_axis(bsdf->T, bsdf->N, rotation * M_2PI_F);
/* compute roughness */
float roughness = sqr(param1);
float anisotropy = clamp(param2, -0.99f, 0.99f);
if (anisotropy < 0.0f) {
bsdf->alpha_x = roughness / (1.0f + anisotropy);
bsdf->alpha_y = roughness * (1.0f + anisotropy);
}
else {
bsdf->alpha_x = roughness * (1.0f - anisotropy);
bsdf->alpha_y = roughness / (1.0f - anisotropy);
}
bsdf->ior = 0.0f;
if (type == CLOSURE_BSDF_MICROFACET_BECKMANN_ANISO_ID) {
sd->flag |= bsdf_microfacet_beckmann_aniso_setup(bsdf);
}
else if (type == CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID) {
sd->flag |= bsdf_microfacet_ggx_aniso_setup(bsdf);
}
else if (type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_ANISO_ID) {
kernel_assert(stack_valid(data_node.w));
bsdf->extra = (MicrofacetExtra *)closure_alloc_extra(sd, sizeof(MicrofacetExtra));
if (bsdf->extra) {
bsdf->extra->color = stack_load_float3(stack, data_node.w);
bsdf->extra->cspec0 = make_float3(0.0f, 0.0f, 0.0f);
bsdf->extra->clearcoat = 0.0f;
sd->flag |= bsdf_microfacet_multi_ggx_aniso_setup(bsdf);
}
}
else
sd->flag |= bsdf_ashikhmin_shirley_aniso_setup(bsdf);
}
break;
}
case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID: {
float3 weight = sd->svm_closure_weight * mix_weight;
VelvetBsdf *bsdf = (VelvetBsdf *)bsdf_alloc(sd, sizeof(VelvetBsdf), weight);

View File

@@ -539,12 +539,6 @@ typedef enum ClosureType {
CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID,
CLOSURE_BSDF_MICROFACET_MULTI_GGX_FRESNEL_ID,
CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID,
CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID,
CLOSURE_BSDF_MICROFACET_GGX_ANISO_FRESNEL_ID,
CLOSURE_BSDF_MICROFACET_MULTI_GGX_ANISO_ID,
CLOSURE_BSDF_MICROFACET_MULTI_GGX_ANISO_FRESNEL_ID,
CLOSURE_BSDF_MICROFACET_BECKMANN_ANISO_ID,
CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ANISO_ID,
CLOSURE_BSDF_ASHIKHMIN_VELVET_ID,
CLOSURE_BSDF_PHONG_RAMP_ID,
CLOSURE_BSDF_GLOSSY_TOON_ID,
@@ -605,10 +599,9 @@ typedef enum ClosureType {
#define CLOSURE_IS_BSDF_TRANSPARENT(type) (type == CLOSURE_BSDF_TRANSPARENT_ID)
#define CLOSURE_IS_BSDF_MULTISCATTER(type) \
(type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID || \
type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_ANISO_ID || \
type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID)
#define CLOSURE_IS_BSDF_MICROFACET(type) \
((type >= CLOSURE_BSDF_MICROFACET_GGX_ID && type <= CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ANISO_ID) || \
((type >= CLOSURE_BSDF_MICROFACET_GGX_ID && type <= CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID) || \
(type >= CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID && \
type <= CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID) || \
(type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID))
@@ -616,8 +609,7 @@ typedef enum ClosureType {
(type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_FRESNEL_ID || \
type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID || \
type == CLOSURE_BSDF_MICROFACET_GGX_FRESNEL_ID || \
type == CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID || \
type == CLOSURE_BSDF_MICROFACET_GGX_ANISO_FRESNEL_ID)
type == CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID)
#define CLOSURE_IS_BSDF_OR_BSSRDF(type) (type <= CLOSURE_BSSRDF_PRINCIPLED_RANDOM_WALK_ID)
#define CLOSURE_IS_BSSRDF(type) \
(type >= CLOSURE_BSSRDF_CUBIC_ID && type <= CLOSURE_BSSRDF_PRINCIPLED_RANDOM_WALK_ID)

View File

@@ -2166,12 +2166,11 @@ NODE_DEFINE(AnisotropicBsdfNode)
SOCKET_IN_FLOAT(surface_mix_weight, "SurfaceMixWeight", 0.0f, SocketType::SVM_INTERNAL);
static NodeEnum distribution_enum;
distribution_enum.insert("beckmann", CLOSURE_BSDF_MICROFACET_BECKMANN_ANISO_ID);
distribution_enum.insert("GGX", CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID);
distribution_enum.insert("Multiscatter GGX", CLOSURE_BSDF_MICROFACET_MULTI_GGX_ANISO_ID);
distribution_enum.insert("ashikhmin_shirley", CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ANISO_ID);
SOCKET_ENUM(
distribution, "Distribution", distribution_enum, CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID);
distribution_enum.insert("beckmann", CLOSURE_BSDF_MICROFACET_BECKMANN_ID);
distribution_enum.insert("GGX", CLOSURE_BSDF_MICROFACET_GGX_ID);
distribution_enum.insert("Multiscatter GGX", CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID);
distribution_enum.insert("ashikhmin_shirley", CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID);
SOCKET_ENUM(distribution, "Distribution", distribution_enum, CLOSURE_BSDF_MICROFACET_GGX_ID);
SOCKET_IN_VECTOR(tangent, "Tangent", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TANGENT);
@@ -2186,7 +2185,7 @@ NODE_DEFINE(AnisotropicBsdfNode)
AnisotropicBsdfNode::AnisotropicBsdfNode() : BsdfNode(node_type)
{
closure = CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID;
closure = CLOSURE_BSDF_MICROFACET_GGX_ID;
}
void AnisotropicBsdfNode::attributes(Shader *shader, AttributeRequestSet *attributes)
@@ -2205,7 +2204,7 @@ void AnisotropicBsdfNode::compile(SVMCompiler &compiler)
{
closure = distribution;
if (closure == CLOSURE_BSDF_MICROFACET_MULTI_GGX_ANISO_ID)
if (closure == CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID)
BsdfNode::compile(
compiler, input("Roughness"), input("Anisotropy"), input("Rotation"), input("Color"));
else
@@ -2299,7 +2298,7 @@ void GlossyBsdfNode::compile(SVMCompiler &compiler)
if (closure == CLOSURE_BSDF_REFLECTION_ID)
BsdfNode::compile(compiler, NULL, NULL);
else if (closure == CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID)
BsdfNode::compile(compiler, input("Roughness"), NULL, input("Color"));
BsdfNode::compile(compiler, input("Roughness"), NULL, NULL, input("Color"));
else
BsdfNode::compile(compiler, input("Roughness"), NULL);
}

View File

@@ -108,7 +108,12 @@ CYCLES_TEST(util_path "cycles_util;${OPENIMAGEIO_LIBRARIES};${BOOST_LIBRARIES}")
CYCLES_TEST(util_string "cycles_util;${OPENIMAGEIO_LIBRARIES};${BOOST_LIBRARIES}")
CYCLES_TEST(util_task "cycles_util;${OPENIMAGEIO_LIBRARIES};${BOOST_LIBRARIES};bf_intern_numaapi")
CYCLES_TEST(util_time "cycles_util;${OPENIMAGEIO_LIBRARIES};${BOOST_LIBRARIES}")
set_source_files_properties(util_avxf_avx_test.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_AVX_KERNEL_FLAGS}")
CYCLES_TEST(util_avxf_avx "cycles_util;bf_intern_numaapi;${OPENIMAGEIO_LIBRARIES};${BOOST_LIBRARIES}")
set_source_files_properties(util_avxf_avx2_test.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_AVX2_KERNEL_FLAGS}")
CYCLES_TEST(util_avxf_avx2 "cycles_util;bf_intern_numaapi;${OPENIMAGEIO_LIBRARIES};${BOOST_LIBRARIES}")
# Disable AVX tests on macOS. Rosetta has problems running them, and other
# platforms should be enough to verify AVX operations are implemented correctly.
if(NOT APPLE)
set_source_files_properties(util_avxf_avx_test.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_AVX_KERNEL_FLAGS}")
CYCLES_TEST(util_avxf_avx "cycles_util;bf_intern_numaapi;${OPENIMAGEIO_LIBRARIES};${BOOST_LIBRARIES}")
set_source_files_properties(util_avxf_avx2_test.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_AVX2_KERNEL_FLAGS}")
CYCLES_TEST(util_avxf_avx2 "cycles_util;bf_intern_numaapi;${OPENIMAGEIO_LIBRARIES};${BOOST_LIBRARIES}")
endif()

View File

@@ -32,9 +32,13 @@ bool validate_cpu_capabilities()
#endif
}
#define VALIDATECPU \
#define INIT_AVX_TEST \
if (!validate_cpu_capabilities()) \
return;
return; \
\
const avxf avxf_a(0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f); \
const avxf avxf_b(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f); \
const avxf avxf_c(1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f);
#define compare_vector_scalar(a, b) \
for (size_t index = 0; index < a.size; index++) \
@@ -49,22 +53,19 @@ bool validate_cpu_capabilities()
EXPECT_NEAR(a[index], b[index], abserror);
#define basic_test_vv(a, b, op) \
VALIDATECPU \
INIT_AVX_TEST \
avxf c = a op b; \
for (size_t i = 0; i < a.size; i++) \
EXPECT_FLOAT_EQ(c[i], a[i] op b[i]);
/* vector op float tests */
#define basic_test_vf(a, b, op) \
VALIDATECPU \
INIT_AVX_TEST \
avxf c = a op b; \
for (size_t i = 0; i < a.size; i++) \
EXPECT_FLOAT_EQ(c[i], a[i] op b);
const avxf avxf_a(0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f);
const avxf avxf_b(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f);
const avxf avxf_c(1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f);
const float float_b = 1.5f;
static const float float_b = 1.5f;
TEST(util_avx, avxf_add_vv){basic_test_vv(avxf_a, avxf_b, +)} TEST(util_avx, avxf_sub_vv){
basic_test_vv(avxf_a, avxf_b, -)} TEST(util_avx, avxf_mul_vv){
@@ -77,7 +78,7 @@ TEST(util_avx, avxf_add_vv){basic_test_vv(avxf_a, avxf_b, +)} TEST(util_avx, avx
TEST(util_avx, avxf_ctor)
{
VALIDATECPU
INIT_AVX_TEST
compare_vector_scalar(avxf(7.0f, 6.0f, 5.0f, 4.0f, 3.0f, 2.0f, 1.0f, 0.0f),
static_cast<float>(index));
compare_vector_scalar(avxf(1.0f), 1.0f);
@@ -90,28 +91,28 @@ TEST(util_avx, avxf_ctor)
TEST(util_avx, avxf_sqrt)
{
VALIDATECPU
INIT_AVX_TEST
compare_vector_vector(mm256_sqrt(avxf(1.0f, 4.0f, 9.0f, 16.0f, 25.0f, 36.0f, 49.0f, 64.0f)),
avxf(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f));
}
TEST(util_avx, avxf_min_max)
{
VALIDATECPU
INIT_AVX_TEST
compare_vector_vector(min(avxf_a, avxf_b), avxf_a);
compare_vector_vector(max(avxf_a, avxf_b), avxf_b);
}
TEST(util_avx, avxf_set_sign)
{
VALIDATECPU
INIT_AVX_TEST
avxf res = set_sign_bit<1, 0, 0, 0, 0, 0, 0, 0>(avxf_a);
compare_vector_vector(res, avxf(0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, -0.8f));
}
TEST(util_avx, avxf_msub)
{
VALIDATECPU
INIT_AVX_TEST
avxf res = msub(avxf_a, avxf_b, avxf_c);
avxf exp = avxf((avxf_a[7] * avxf_b[7]) - avxf_c[7],
(avxf_a[6] * avxf_b[6]) - avxf_c[6],
@@ -126,7 +127,7 @@ TEST(util_avx, avxf_msub)
TEST(util_avx, avxf_madd)
{
VALIDATECPU
INIT_AVX_TEST
avxf res = madd(avxf_a, avxf_b, avxf_c);
avxf exp = avxf((avxf_a[7] * avxf_b[7]) + avxf_c[7],
(avxf_a[6] * avxf_b[6]) + avxf_c[6],
@@ -141,7 +142,7 @@ TEST(util_avx, avxf_madd)
TEST(util_avx, avxf_nmadd)
{
VALIDATECPU
INIT_AVX_TEST
avxf res = nmadd(avxf_a, avxf_b, avxf_c);
avxf exp = avxf(avxf_c[7] - (avxf_a[7] * avxf_b[7]),
avxf_c[6] - (avxf_a[6] * avxf_b[6]),
@@ -156,7 +157,7 @@ TEST(util_avx, avxf_nmadd)
TEST(util_avx, avxf_compare)
{
VALIDATECPU
INIT_AVX_TEST
avxf a(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f);
avxf b(7.0f, 6.0f, 5.0f, 4.0f, 3.0f, 2.0f, 1.0f, 0.0f);
avxb res = a <= b;
@@ -175,28 +176,28 @@ TEST(util_avx, avxf_compare)
TEST(util_avx, avxf_permute)
{
VALIDATECPU
INIT_AVX_TEST
avxf res = permute<3, 0, 1, 7, 6, 5, 2, 4>(avxf_b);
compare_vector_vector(res, avxf(4.0f, 6.0f, 3.0f, 2.0f, 1.0f, 7.0f, 8.0f, 5.0f));
}
TEST(util_avx, avxf_blend)
{
VALIDATECPU
INIT_AVX_TEST
avxf res = blend<0, 0, 1, 0, 1, 0, 1, 0>(avxf_a, avxf_b);
compare_vector_vector(res, avxf(0.1f, 0.2f, 3.0f, 0.4f, 5.0f, 0.6f, 7.0f, 0.8f));
}
TEST(util_avx, avxf_shuffle)
{
VALIDATECPU
INIT_AVX_TEST
avxf res = shuffle<0, 1, 2, 3, 1, 3, 2, 0>(avxf_a);
compare_vector_vector(res, avxf(0.4f, 0.2f, 0.1f, 0.3f, 0.5f, 0.6f, 0.7f, 0.8f));
}
TEST(util_avx, avxf_cross)
{
VALIDATECPU
INIT_AVX_TEST
avxf res = cross(avxf_b, avxf_c);
compare_vector_vector_near(res,
avxf(0.0f,
@@ -212,7 +213,7 @@ TEST(util_avx, avxf_cross)
TEST(util_avx, avxf_dot3)
{
VALIDATECPU
INIT_AVX_TEST
float den, den2;
dot3(avxf_a, avxf_b, den, den2);
EXPECT_FLOAT_EQ(den, 14.9f);

View File

@@ -56,7 +56,8 @@ class GHOST_IXrGraphicsBinding {
std::string *r_requirement_info) const = 0;
virtual void initFromGhostContext(class GHOST_Context *ghost_ctx) = 0;
virtual bool chooseSwapchainFormat(const std::vector<int64_t> &runtime_formats,
int64_t *r_result) const = 0;
int64_t &r_result,
bool &r_is_rgb_format) const = 0;
virtual std::vector<XrSwapchainImageBaseHeader *> createSwapchainImages(
uint32_t image_count) = 0;
virtual void submitToSwapchainImage(XrSwapchainImageBaseHeader *swapchain_image,

View File

@@ -411,17 +411,17 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(GHOST_SystemCocoa *systemCocoa,
NSTIFFPboardType,
nil]];
if (state != GHOST_kWindowStateFullScreen) {
if (is_dialog && parentWindow) {
[parentWindow->getCocoaWindow() addChildWindow:m_window ordered:NSWindowAbove];
[m_window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary];
}
else {
[m_window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
}
if (state == GHOST_kWindowStateFullScreen)
setState(GHOST_kWindowStateFullScreen);
if (is_dialog && parentWindow) {
[parentWindow->getCocoaWindow() addChildWindow:m_window ordered:NSWindowAbove];
}
setNativePixelSize();
[pool drain];

View File

@@ -88,18 +88,26 @@ void GHOST_XrContext::initialize(const GHOST_XrContextCreateInfo *create_info)
printAvailableAPILayersAndExtensionsInfo();
}
m_gpu_binding_type = determineGraphicsBindingTypeToEnable(create_info);
/* Multiple graphics binding extensions can be enabled, but only one will actually be used
* (determined later on). */
const std::vector<GHOST_TXrGraphicsBinding> graphics_binding_types =
determineGraphicsBindingTypesToEnable(create_info);
assert(m_oxr->instance == XR_NULL_HANDLE);
createOpenXRInstance();
createOpenXRInstance(graphics_binding_types);
storeInstanceProperties();
/* Multiple bindings may be enabled. Now that we know the runtime in use, settle for one. */
m_gpu_binding_type = determineGraphicsBindingTypeToUse(graphics_binding_types);
printInstanceInfo();
if (isDebugMode()) {
initDebugMessenger();
}
}
void GHOST_XrContext::createOpenXRInstance()
void GHOST_XrContext::createOpenXRInstance(
const std::vector<GHOST_TXrGraphicsBinding> &graphics_binding_types)
{
XrInstanceCreateInfo create_info = {XR_TYPE_INSTANCE_CREATE_INFO};
@@ -108,7 +116,7 @@ void GHOST_XrContext::createOpenXRInstance()
create_info.applicationInfo.apiVersion = XR_CURRENT_API_VERSION;
getAPILayersToEnable(m_enabled_layers);
getExtensionsToEnable(m_enabled_extensions);
getExtensionsToEnable(graphics_binding_types, m_enabled_extensions);
create_info.enabledApiLayerCount = m_enabled_layers.size();
create_info.enabledApiLayerNames = m_enabled_layers.data();
create_info.enabledExtensionCount = m_enabled_extensions.size();
@@ -126,6 +134,7 @@ void GHOST_XrContext::storeInstanceProperties()
const std::map<std::string, GHOST_TXrOpenXRRuntimeID> runtime_map = {
{"Monado(XRT) by Collabora et al", OPENXR_RUNTIME_MONADO},
{"Oculus", OPENXR_RUNTIME_OCULUS},
{"SteamVR/OpenXR", OPENXR_RUNTIME_STEAMVR},
{"Windows Mixed Reality Runtime", OPENXR_RUNTIME_WMR}};
decltype(runtime_map)::const_iterator runtime_map_iter;
@@ -392,14 +401,11 @@ static const char *openxr_ext_name_from_wm_gpu_binding(GHOST_TXrGraphicsBinding
/**
* Gather an array of names for the extensions to enable.
*/
void GHOST_XrContext::getExtensionsToEnable(std::vector<const char *> &r_ext_names)
void GHOST_XrContext::getExtensionsToEnable(
const std::vector<GHOST_TXrGraphicsBinding> &graphics_binding_types,
std::vector<const char *> &r_ext_names)
{
assert(m_gpu_binding_type != GHOST_kXrGraphicsUnknown);
const char *gpu_binding = openxr_ext_name_from_wm_gpu_binding(m_gpu_binding_type);
static std::vector<std::string> try_ext;
try_ext.clear();
std::vector<std::string> try_ext;
/* Try enabling debug extension. */
#ifndef WIN32
@@ -408,12 +414,15 @@ void GHOST_XrContext::getExtensionsToEnable(std::vector<const char *> &r_ext_nam
}
#endif
r_ext_names.reserve(try_ext.size() + 1); /* + 1 for graphics binding extension. */
r_ext_names.reserve(try_ext.size() + graphics_binding_types.size());
/* Add graphics binding extension. */
assert(gpu_binding);
assert(openxr_extension_is_available(m_oxr->extensions, gpu_binding));
r_ext_names.push_back(gpu_binding);
/* Add graphics binding extensions (may be multiple ones, we'll settle for one to use later, once
* we have more info about the runtime). */
for (GHOST_TXrGraphicsBinding type : graphics_binding_types) {
const char *gpu_binding = openxr_ext_name_from_wm_gpu_binding(type);
assert(openxr_extension_is_available(m_oxr->extensions, gpu_binding));
r_ext_names.push_back(gpu_binding);
}
for (const std::string &ext : try_ext) {
if (openxr_extension_is_available(m_oxr->extensions, ext)) {
@@ -426,9 +435,10 @@ void GHOST_XrContext::getExtensionsToEnable(std::vector<const char *> &r_ext_nam
* Decide which graphics binding extension to use based on
* #GHOST_XrContextCreateInfo.gpu_binding_candidates and available extensions.
*/
GHOST_TXrGraphicsBinding GHOST_XrContext::determineGraphicsBindingTypeToEnable(
std::vector<GHOST_TXrGraphicsBinding> GHOST_XrContext::determineGraphicsBindingTypesToEnable(
const GHOST_XrContextCreateInfo *create_info)
{
std::vector<GHOST_TXrGraphicsBinding> result;
assert(create_info->gpu_binding_candidates != NULL);
assert(create_info->gpu_binding_candidates_count > 0);
@@ -437,11 +447,35 @@ GHOST_TXrGraphicsBinding GHOST_XrContext::determineGraphicsBindingTypeToEnable(
const char *ext_name = openxr_ext_name_from_wm_gpu_binding(
create_info->gpu_binding_candidates[i]);
if (openxr_extension_is_available(m_oxr->extensions, ext_name)) {
return create_info->gpu_binding_candidates[i];
result.push_back(create_info->gpu_binding_candidates[i]);
}
}
return GHOST_kXrGraphicsUnknown;
if (result.empty()) {
throw GHOST_XrException("No supported graphics binding found.");
}
return result;
}
GHOST_TXrGraphicsBinding GHOST_XrContext::determineGraphicsBindingTypeToUse(
const std::vector<GHOST_TXrGraphicsBinding> &enabled_types)
{
/* Return the first working type. */
for (GHOST_TXrGraphicsBinding type : enabled_types) {
#ifdef WIN32
/* The SteamVR OpenGL backend fails currently. Disable it and allow falling back to the DirectX
* one. */
if ((m_runtime_id == OPENXR_RUNTIME_STEAMVR) && (type == GHOST_kXrGraphicsOpenGL)) {
continue;
}
#endif
assert(type != GHOST_kXrGraphicsUnknown);
return type;
}
throw GHOST_XrException("Failed to determine a graphics binding to use.");
}
/** \} */ /* OpenXR API-Layers and Extensions */

View File

@@ -49,6 +49,7 @@ struct GHOST_XrCustomFuncs {
enum GHOST_TXrOpenXRRuntimeID {
OPENXR_RUNTIME_MONADO,
OPENXR_RUNTIME_OCULUS,
OPENXR_RUNTIME_STEAMVR,
OPENXR_RUNTIME_WMR, /* Windows Mixed Reality */
OPENXR_RUNTIME_UNKNOWN
@@ -114,7 +115,7 @@ class GHOST_XrContext : public GHOST_IXrContext {
bool m_debug = false;
bool m_debug_time = false;
void createOpenXRInstance();
void createOpenXRInstance(const std::vector<GHOST_TXrGraphicsBinding> &graphics_binding_types);
void storeInstanceProperties();
void initDebugMessenger();
@@ -126,9 +127,12 @@ class GHOST_XrContext : public GHOST_IXrContext {
void initExtensions();
void initExtensionsEx(std::vector<XrExtensionProperties> &extensions, const char *layer_name);
void getAPILayersToEnable(std::vector<const char *> &r_ext_names);
void getExtensionsToEnable(std::vector<const char *> &r_ext_names);
GHOST_TXrGraphicsBinding determineGraphicsBindingTypeToEnable(
void getExtensionsToEnable(const std::vector<GHOST_TXrGraphicsBinding> &graphics_binding_types,
std::vector<const char *> &r_ext_names);
std::vector<GHOST_TXrGraphicsBinding> determineGraphicsBindingTypesToEnable(
const GHOST_XrContextCreateInfo *create_info);
GHOST_TXrGraphicsBinding determineGraphicsBindingTypeToUse(
const std::vector<GHOST_TXrGraphicsBinding> &enabled_types);
};
#endif // __GHOST_XRCONTEXT_H__

View File

@@ -36,7 +36,7 @@
static bool choose_swapchain_format_from_candidates(std::vector<int64_t> gpu_binding_formats,
std::vector<int64_t> runtime_formats,
int64_t *r_result)
int64_t &r_result)
{
if (gpu_binding_formats.empty()) {
return false;
@@ -50,7 +50,7 @@ static bool choose_swapchain_format_from_candidates(std::vector<int64_t> gpu_bin
return false;
}
*r_result = *res;
r_result = *res;
return true;
}
@@ -132,10 +132,20 @@ class GHOST_XrGraphicsBindingOpenGL : public GHOST_IXrGraphicsBinding {
}
bool chooseSwapchainFormat(const std::vector<int64_t> &runtime_formats,
int64_t *r_result) const override
int64_t &r_result,
bool &r_is_srgb_format) const override
{
std::vector<int64_t> gpu_binding_formats = {GL_RGBA8};
return choose_swapchain_format_from_candidates(gpu_binding_formats, runtime_formats, r_result);
std::vector<int64_t> gpu_binding_formats = {
GL_RGBA8,
GL_SRGB8_ALPHA8,
};
if (choose_swapchain_format_from_candidates(gpu_binding_formats, runtime_formats, r_result)) {
r_is_srgb_format = (r_result == GL_SRGB8_ALPHA8);
return true;
}
return false;
}
std::vector<XrSwapchainImageBaseHeader *> createSwapchainImages(uint32_t image_count) override
@@ -248,10 +258,19 @@ class GHOST_XrGraphicsBindingD3D : public GHOST_IXrGraphicsBinding {
}
bool chooseSwapchainFormat(const std::vector<int64_t> &runtime_formats,
int64_t *r_result) const override
int64_t &r_result,
bool &r_is_srgb_format) const override
{
std::vector<int64_t> gpu_binding_formats = {DXGI_FORMAT_R8G8B8A8_UNORM};
return choose_swapchain_format_from_candidates(gpu_binding_formats, runtime_formats, r_result);
std::vector<int64_t> gpu_binding_formats = {
DXGI_FORMAT_R8G8B8A8_UNORM,
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
};
if (choose_swapchain_format_from_candidates(gpu_binding_formats, runtime_formats, r_result)) {
r_is_srgb_format = (r_result == DXGI_FORMAT_R8G8B8A8_UNORM_SRGB);
return true;
}
return false;
}
std::vector<XrSwapchainImageBaseHeader *> createSwapchainImages(uint32_t image_count) override

View File

@@ -375,14 +375,6 @@ static void ghost_xr_draw_view_info_from_view(const XrView &view, GHOST_XrDrawVi
r_info.fov.angle_down = view.fov.angleDown;
}
static bool ghost_xr_draw_view_expects_srgb_buffer(const GHOST_XrContext *context)
{
/* Monado seems to be faulty and doesn't do OETF transform correctly. So expect a SRGB buffer to
* compensate. You get way too dark rendering without this, it's pretty obvious (even in the
* default startup scene). */
return (context->getOpenXRRuntimeID() == OPENXR_RUNTIME_MONADO);
}
void GHOST_XrSession::drawView(GHOST_XrSwapchain &swapchain,
XrCompositionLayerProjectionView &r_proj_layer_view,
XrSpaceLocation &view_location,
@@ -397,7 +389,7 @@ void GHOST_XrSession::drawView(GHOST_XrSwapchain &swapchain,
r_proj_layer_view.fov = view.fov;
swapchain.updateCompositionLayerProjectViewSubImage(r_proj_layer_view.subImage);
draw_view_info.expects_srgb_buffer = ghost_xr_draw_view_expects_srgb_buffer(m_context);
draw_view_info.expects_srgb_buffer = swapchain.isBufferSRGB();
draw_view_info.ofsx = r_proj_layer_view.subImage.imageRect.offset.x;
draw_view_info.ofsy = r_proj_layer_view.subImage.imageRect.offset.y;
draw_view_info.width = r_proj_layer_view.subImage.imageRect.extent.width;

View File

@@ -68,7 +68,7 @@ GHOST_XrSwapchain::GHOST_XrSwapchain(GHOST_IXrGraphicsBinding &gpu_binding,
"Failed to get swapchain image formats.");
assert(swapchain_formats.size() == format_count);
if (!gpu_binding.chooseSwapchainFormat(swapchain_formats, &chosen_format)) {
if (!gpu_binding.chooseSwapchainFormat(swapchain_formats, chosen_format, m_is_srgb_buffer)) {
throw GHOST_XrException(
"Error: No format matching OpenXR runtime supported swapchain formats found.");
}
@@ -95,7 +95,8 @@ GHOST_XrSwapchain::GHOST_XrSwapchain(GHOST_IXrGraphicsBinding &gpu_binding,
GHOST_XrSwapchain::GHOST_XrSwapchain(GHOST_XrSwapchain &&other)
: m_oxr(std::move(other.m_oxr)),
m_image_width(other.m_image_width),
m_image_height(other.m_image_height)
m_image_height(other.m_image_height),
m_is_srgb_buffer(other.m_is_srgb_buffer)
{
/* Prevent xrDestroySwapchain call for the moved out item. */
other.m_oxr = nullptr;
@@ -132,6 +133,11 @@ void GHOST_XrSwapchain::updateCompositionLayerProjectViewSubImage(XrSwapchainSub
r_sub_image.imageRect.extent = {m_image_width, m_image_height};
}
bool GHOST_XrSwapchain::isBufferSRGB()
{
return m_is_srgb_buffer;
}
void GHOST_XrSwapchain::releaseImage()
{
XrSwapchainImageReleaseInfo release_info = {XR_TYPE_SWAPCHAIN_IMAGE_RELEASE_INFO};

View File

@@ -38,9 +38,12 @@ class GHOST_XrSwapchain {
void updateCompositionLayerProjectViewSubImage(XrSwapchainSubImage &r_sub_image);
bool isBufferSRGB();
private:
std::unique_ptr<OpenXRSwapchainData> m_oxr; /* Could use stack, but PImpl is preferable. */
int32_t m_image_width, m_image_height;
bool m_is_srgb_buffer = false;
};
#endif // GHOST_XRSWAPCHAIN_H

View File

@@ -204,7 +204,8 @@ extern size_t (*MEM_get_peak_memory)(void) ATTR_WARN_UNUSED_RESULT;
do { \
typeof(&(v)) _v = &(v); \
if (*_v) { \
MEM_freeN(*_v); \
/* Cast so we can free constant arrays. */ \
MEM_freeN((void *)*_v); \
*_v = NULL; \
} \
} while (0)

View File

@@ -117,6 +117,13 @@ void bl_locale_set(const char *locale)
#undef LOCALE_INFO
}
// Extra catch on `std::runtime_error` is needed for macOS/Clang as it seems that exceptions
// like `boost::locale::conv::conversion_error` (which inherit from `std::runtime_error`) are
// not caught by their ancestor `std::exception`. See
// https://developer.blender.org/T88877#1177108 .
catch (std::runtime_error const &e) {
std::cout << "bl_locale_set(" << locale << "): " << e.what() << " \n";
}
catch (std::exception const &e) {
std::cout << "bl_locale_set(" << locale << "): " << e.what() << " \n";
}

View File

@@ -14,7 +14,17 @@ const char *osx_user_locale()
CFLocaleRef myCFLocale = CFLocaleCopyCurrent();
NSLocale *myNSLocale = (NSLocale *)myCFLocale;
[myNSLocale autorelease];
NSString *nsIdentifier = [myNSLocale localeIdentifier];
// This produces gettext-invalid locale in recent macOS versions (11.4),
// like `ko-Kore_KR` instead of `ko_KR`. See T88877.
// NSString *nsIdentifier = [myNSLocale localeIdentifier];
const NSString *nsIdentifier = [myNSLocale languageCode];
const NSString *const nsIdentifier_country = [myNSLocale countryCode];
if ([nsIdentifier length] != 0 && [nsIdentifier_country length] != 0) {
nsIdentifier = [NSString stringWithFormat:@"%@_%@", nsIdentifier, nsIdentifier_country];
}
user_locale = ::strdup([nsIdentifier UTF8String]);
[pool drain];

View File

@@ -16,4 +16,4 @@ if [ -n "$XDG_RUNTIME_DIR" ]; then
fi
# Run Blender
$SNAP/blender
$SNAP/blender "$@"

View File

@@ -164,7 +164,7 @@ class ScalarBlendModifier(StrokeShader):
v1 = facm * v1 + fac * v1 / v2 if v2 != 0.0 else v1
elif self.blend_type == 'DIFFERENCE':
v1 = facm * v1 + fac * abs(v1 - v2)
elif self.blend_type == 'MININUM':
elif self.blend_type == 'MINIMUM':
v1 = min(fac * v2, v1)
elif self.blend_type == 'MAXIMUM':
v1 = max(fac * v2, v1)

View File

@@ -314,7 +314,7 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern):
do_save = True
if do_data_intern:
bpy.ops.wm.previews_clear(id_type='SHADING')
bpy.ops.wm.previews_clear(id_type={'SHADING'})
bpy.ops.wm.previews_ensure()
render_contexts = {}
@@ -439,7 +439,7 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern):
def do_clear_previews(do_objects, do_collections, do_scenes, do_data_intern):
if do_data_intern:
bpy.ops.wm.previews_clear(id_type='SHADING')
bpy.ops.wm.previews_clear(id_type={'SHADING'})
if do_objects:
for ob in ids_nolib(bpy.data.objects):

View File

@@ -3604,6 +3604,12 @@ def km_grease_pencil_stroke_weight_mode(params):
*_template_items_context_panel("VIEW3D_PT_gpencil_weight_context_menu", params.context_menu_event),
])
if params.select_mouse == 'LEFTMOUSE':
# Bone selection for combined weight paint + pose mode.
items.extend([
("view3d.select", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True}, None),
])
return keymap

View File

@@ -260,7 +260,13 @@ class NLA_OT_bake(Operator):
def execute(self, context):
from bpy_extras import anim_utils
do_pose = 'POSE' in self.bake_types
do_object = 'OBJECT' in self.bake_types
objects = context.selected_editable_objects
if do_pose and not do_object:
objects = [obj for obj in objects if obj.pose is not None]
object_action_pairs = (
[(obj, getattr(obj.animation_data, "action", None)) for obj in objects]
if self.use_current_action else
@@ -271,8 +277,8 @@ class NLA_OT_bake(Operator):
object_action_pairs,
frames=range(self.frame_start, self.frame_end + 1, self.step),
only_selected=self.only_selected,
do_pose='POSE' in self.bake_types,
do_object='OBJECT' in self.bake_types,
do_pose=do_pose,
do_object=do_object,
do_visual_keying=self.visual_keying,
do_constraint_clear=self.clear_constraints,
do_parents_clear=self.clear_parents,

View File

@@ -486,7 +486,10 @@ class CLIP_OT_constraint_to_fcurve(Operator):
return {'FINISHED'}
# Find start and end frames.
if con.object:
if con.type == 'CAMERA_SOLVER':
# Camera solver constraint is always referring to camera.
tracks = clip.tracking.tracks
elif con.object:
tracking_object = clip.tracking.objects.get(con.object, None)
if not tracking_object:
self.report({'ERROR'}, "Motion Tracking object not found")

View File

@@ -163,7 +163,12 @@ def extend(obj, EXTEND_MODE):
l_b_uv = [l[uv_act].uv for l in l_b]
if EXTEND_MODE == 'LENGTH_AVERAGE':
fac = edge_lengths[l_b[2].edge.index][0] / edge_lengths[l_a[1].edge.index][0]
d1 = edge_lengths[l_a[1].edge.index][0]
d2 = edge_lengths[l_b[2].edge.index][0]
try:
fac = d2 / d1
except ZeroDivisionError:
fac = 1.0
elif EXTEND_MODE == 'LENGTH':
a0, b0, c0 = l_a[3].vert.co, l_a[0].vert.co, l_b[3].vert.co
a1, b1, c1 = l_a[2].vert.co, l_a[1].vert.co, l_b[2].vert.co

View File

@@ -1078,7 +1078,7 @@ class VIEW3D_MT_mirror(Menu):
for axis_index, axis_name in enumerate("XYZ"):
props = layout.operator("transform.mirror", text=f"{axis_name!s} {space_name!s}")
props.constraint_axis[axis_index] = True
props.orient_type = 'GLOBAL'
props.orient_type = space_id
if space_id == 'GLOBAL':
layout.separator()
@@ -6768,7 +6768,10 @@ class VIEW3D_PT_overlay_gpencil_options(Panel):
if context.object.mode in {'PAINT_GPENCIL', 'VERTEX_GPENCIL'}:
layout.label(text="Vertex Paint")
layout.prop(overlay, "gpencil_vertex_paint_opacity", text="Opacity", slider=True)
row = layout.row()
shading = VIEW3D_PT_shading.get_shading(context)
row.enabled = shading.type not in {'WIREFRAME', 'RENDERED'}
row.prop(overlay, "gpencil_vertex_paint_opacity", text="Opacity", slider=True)
class VIEW3D_PT_quad_view(Panel):

View File

@@ -799,7 +799,8 @@ class VIEW3D_PT_sculpt_dyntopo(Panel, View3DPaintPanel):
@classmethod
def poll(cls, context):
return (context.sculpt_object and context.tool_settings.sculpt)
paint_settings = cls.paint_settings(context)
return (context.sculpt_object and context.tool_settings.sculpt and paint_settings)
def draw_header(self, context):
is_popover = self.is_popover

70
release/steam/README.md Normal file
View File

@@ -0,0 +1,70 @@
Creating Steam builds for Blender
=================================
This script automates creation of the Steam files: download of the archives,
extraction of the archives, preparation of the build scripts (VDF files), actual
building of the Steam game files.
Requirements
============
* MacOS machine - Tested on Catalina 10.15.6. Extracting contents from the DMG
archive did not work Windows nor on Linux using 7-zip. All DMG archives tested
failed to be extracted. As such only MacOS is known to work.
* Steam SDK downloaded from SteamWorks - The `steamcmd` is used to generate the
Steam game files. The path to the `steamcmd` is what is actually needed.
* SteamWorks credentials - Needed to log in using `steamcmd`.
* Login to SteamWorks with the `steamcmd` from the command-line at least once -
Needded to ensure the user is properly logged in. On a new machine the user
will have to go through two-factor authentication.
* App ID and Depot IDs - Needed to create the VDF files.
* Python 3.x - 3.7 was tested.
* Base URL - for downloading the archives.
Usage
=====
```bash
$ export STEAMUSER=SteamUserName
$ export STEAMPW=SteamUserPW
$ export BASEURL=https://download.blender.org/release/Blender2.83/
$ export VERSION=2.83.3
$ export APPID=appidnr
$ export WINID=winidnr
$ export LINID=linuxidnr
$ export MACOSID=macosidnr
# log in to SteamWorks from command-line at least once
$ ../sdk/tools/ContentBuilder/builder_osx/steamcmd +login $STEAMUSER $STEAMPW
# once that has been done we can now actually start our tool
$ python3.7 create_steam_builds.py --baseurl $BASEURL --version $VERSION --appid $APPID --winid $WINID --linuxid $LINID --macosid $MACOSID --steamuser $STEAMUSER --steampw $STEAMPW --steamcmd ../sdk/tools/ContentBuilder/builder_osx/steamcmd
```
All arguments in the above example are required.
At the start the tool will login using `steamcmd`. This is necessary to let the
Steam SDK update itself if necessary.
There are a few optional arguments:
* `--dryrun`: If set building the game files will not actually happen. A set of
log files and a preview manifest per depot will be created in the output folder.
This can be used to double-check everything works as expected.
* `--skipdl`: If set will skip downloading of the archives. The tool expects the
archives to already exist in the correct content location.
* `--skipextract`: If set will skip extraction of all archives. The tool expects
the archives to already have been correctly extracted in the content location.
Run the tool with `-h` for detailed information on each argument.
The content and output folders are generated through appending the version
without dots to the words `content` and `output` respectively, e.g. `content2833`
and `output2833`. These folders are created next to the tool.
From all `.template` files the Steam build scripts will be generated also in the
same directory as the tool. The files will have the extension `.vdf`.
In case of errors the tool will have a non-zero return code.

View File

@@ -0,0 +1,17 @@
"appbuild"
{
"appid" "[APPID]"
"desc" "Blender [VERSION]" // description for this build
"buildoutput" "./[OUTPUT]" // build output folder for .log, .csm & .csd files, relative to location of this file
"contentroot" "./[CONTENT]" // root content folder, relative to location of this file
"setlive" "" // branch to set live after successful build, non if empty
"preview" "[DRYRUN]" // 1 to enable preview builds, 0 to commit build to steampipe
"local" "" // set to flie path of local content server
"depots"
{
"[WINID]" "depot_build_win.vdf"
"[LINUXID]" "depot_build_linux.vdf"
"[MACOSID]" "depot_build_macos.vdf"
}
}

View File

@@ -0,0 +1,397 @@
#!/usr/bin/env python3
import argparse
import pathlib
import requests
import shutil
import subprocess
from typing import Callable, Iterator, List, Tuple
# supported archive and platform endings, used to create actual archive names
archive_endings = ["windows64.zip", "linux64.tar.xz", "macOS.dmg"]
def add_optional_argument(option: str, help: str) -> None:
global parser
"""Add an optional argument
Args:
option (str): Option to add
help (str): Help description for the argument
"""
parser.add_argument(option, help=help, action='store_const', const=1)
def blender_archives(version: str) -> Iterator[str]:
"""Generator for Blender archives for version.
Yields for items in archive_endings an archive name in the form of
blender-{version}-{ending}.
Args:
version (str): Version string of the form 2.83.2
Yields:
Iterator[str]: Name in the form of blender-{version}-{ending}
"""
global archive_endings
for ending in archive_endings:
yield f"blender-{version}-{ending}"
def get_archive_type(archive_type: str, version: str) -> str:
"""Return the archive of given type and version.
Args:
archive_type (str): extension for archive type to check for
version (str): Version string in the form 2.83.2
Raises:
Exception: Execption when archive type isn't found
Returns:
str: archive name for given type
"""
for archive in blender_archives(version):
if archive.endswith(archive_type):
return archive
raise Exception("Unknown archive type")
def execute_command(cmd: List[str], name: str, errcode: int, cwd=".", capture_output=True) -> str:
"""Execute the given command.
Returns the process stdout upon success if any.
On error print message the command with name that has failed. Print stdout
and stderr of the process if any, and then exit with given error code.
Args:
cmd (List[str]): Command in list format, each argument as their own item
name (str): Name of command to use when printing to command-line
errcode (int): Error code to use in case of exit()
cwd (str, optional): Folder to use as current work directory for command
execution. Defaults to ".".
capture_output (bool, optional): Whether to capture command output or not.
Defaults to True.
Returns:
str: stdout if any, or empty string
"""
cmd_process = subprocess.run(
cmd, capture_output=capture_output, encoding="UTF-8", cwd=cwd)
if cmd_process.returncode == 0:
if cmd_process.stdout:
return cmd_process.stdout
else:
return ""
else:
print(f"ERROR: {name} failed.")
if cmd_process.stdout:
print(cmd_process.stdout)
if cmd_process.stderr:
print(cmd_process.stderr)
exit(errcode)
return ""
def download_archives(base_url: str, archives: Callable[[str], Iterator[str]], version: str, dst_dir: pathlib.Path):
"""Download archives from the given base_url.
Archives is a generator for Blender archive names based on version.
Archive names are appended to the base_url to load from, and appended to
dst_dir to save to.
Args:
base_url (str): Base URL to load archives from
archives (Callable[[str], Iterator[str]]): Generator for Blender archive
names based on version
version (str): Version string in the form of 2.83.2
dst_dir (pathlib.Path): Download destination
"""
if base_url[-1] != '/':
base_url = base_url + '/'
for archive in archives(version):
download_url = f"{base_url}{archive}"
target_file = dst_dir.joinpath(archive)
download_file(download_url, target_file)
def download_file(from_url: str, to_file: pathlib.Path) -> None:
"""Download from_url as to_file.
Actual downloading will be skipped if --skipdl is given on the command-line.
Args:
from_url (str): Full URL to resource to download
to_file (pathlib.Path): Full path to save downloaded resource as
"""
global args
if not args.skipdl or not to_file.exists():
print(f"Downloading {from_url}")
with open(to_file, "wb") as download_zip:
response = requests.get(from_url)
if response.status_code != requests.codes.ok:
print(f"ERROR: failed to download {from_url} (status code: {response.status_code})")
exit(1313)
download_zip.write(response.content)
else:
print(f"Downloading {from_url} skipped")
print(" ... OK")
def copy_contents_from_dmg_to_path(dmg_file: pathlib.Path, dst: pathlib.Path) -> None:
"""Copy the contents of the given DMG file to the destination folder.
Args:
dmg_file (pathlib.Path): Full path to DMG archive to extract from
dst (pathlib.Path): Full path to destination to extract to
"""
hdiutil_attach = ["hdiutil",
"attach",
"-readonly",
f"{dmg_file}"
]
attached = execute_command(hdiutil_attach, "hdiutil attach", 1)
# Last line of output is what we want, it is of the form
# /dev/somedisk Apple_HFS /Volumes/Blender
# We want to retain the mount point, and the folder the mount is
# created on. The mounted disk we need for detaching, the folder we
# need to be able to copy the contents to where we can use them
attachment_items = attached.splitlines()[-1].split()
mounted_disk = attachment_items[0]
source_location = pathlib.Path(attachment_items[2], "Blender.app")
print(f"{source_location} -> {dst}")
shutil.copytree(source_location, dst)
hdiutil_detach = ["hdiutil",
"detach",
f"{mounted_disk}"
]
execute_command(hdiutil_detach, "hdiutil detach", 2)
def create_build_script(template_name: str, vars: List[Tuple[str, str]]) -> pathlib.Path:
"""
Create the Steam build script
Use the given template and template variable tuple list.
Returns pathlib.Path to the created script.
Args:
template_name (str): [description]
vars (List[Tuple[str, str]]): [description]
Returns:
pathlib.Path: Full path to the generated script
"""
build_script = pathlib.Path(".", template_name).read_text()
for var in vars:
build_script = build_script.replace(var[0], var[1])
build_script_file = template_name.replace(".template", "")
build_script_path = pathlib.Path(".", build_script_file)
build_script_path.write_text(build_script)
return build_script_path
def clean_up() -> None:
"""Remove intermediate files depending on given command-line arguments
"""
global content_location, args
if not args.leavearch and not args.leaveextracted:
shutil.rmtree(content_location)
if args.leavearch and not args.leaveextracted:
shutil.rmtree(content_location.joinpath(zip_extract_folder))
shutil.rmtree(content_location.joinpath(tarxz_extract_folder))
shutil.rmtree(content_location.joinpath(dmg_extract_folder))
if args.leaveextracted and not args.leavearch:
import os
os.remove(content_location.joinpath(zipped_blender))
os.remove(content_location.joinpath(tarxz_blender))
os.remove(content_location.joinpath(dmg_blender))
def extract_archive(archive: str, extract_folder_name: str,
cmd: List[str], errcode: int) -> None:
"""Extract all files from archive to given folder name.
Will not extract if
target folder already exists, or if --skipextract was given on the
command-line.
Args:
archive (str): Archive name to extract
extract_folder_name (str): Folder name to extract to
cmd (List[str]): Command with arguments to use
errcode (int): Error code to use for exit()
"""
global args, content_location
extract_location = content_location.joinpath(extract_folder_name)
pre_extract = set(content_location.glob("*"))
if not args.skipextract or not extract_location.exists():
print(f"Extracting files from {archive}...")
cmd.append(content_location.joinpath(archive))
execute_command(cmd, cmd[0], errcode, cwd=content_location)
# in case we use a non-release archive the naming will be incorrect.
# simply rename to expected target name
post_extract = set(content_location.glob("*"))
diff_extract = post_extract - pre_extract
if not extract_location in diff_extract:
folder_to_rename = list(diff_extract)[0]
folder_to_rename.rename(extract_location)
print(" OK")
else:
print(f"Skipping extraction {archive}!")
# ==============================================================================
parser = argparse.ArgumentParser()
parser.add_argument("--baseurl", required=True,
help="The base URL for files to download, "
"i.e. https://download.blender.org/release/Blender2.83/")
parser.add_argument("--version", required=True,
help="The Blender version to release, in the form 2.83.3")
parser.add_argument("--appid", required=True,
help="The Blender App ID on Steam")
parser.add_argument("--winid", required=True,
help="The Windows depot ID")
parser.add_argument("--linuxid", required=True,
help="The Linux depot ID")
parser.add_argument("--macosid", required=True,
help="The MacOS depot ID")
parser.add_argument("--steamcmd", required=True,
help="Path to the steamcmd")
parser.add_argument("--steamuser", required=True,
help="The login for the Steam builder user")
parser.add_argument("--steampw", required=True,
help="Login password for the Steam builder user")
add_optional_argument("--dryrun",
"If set the Steam files will not be uploaded")
add_optional_argument("--leavearch",
help="If set don't clean up the downloaded archives")
add_optional_argument("--leaveextracted",
help="If set don't clean up the extraction folders")
add_optional_argument("--skipdl",
help="If set downloading the archives is skipped if it already exists locally.")
add_optional_argument("--skipextract",
help="If set skips extracting of archives. The tool assumes the archives"
"have already been extracted to their correct locations")
args = parser.parse_args()
VERSIONNODOTS = args.version.replace('.', '')
OUTPUT = f"output{VERSIONNODOTS}"
CONTENT = f"content{VERSIONNODOTS}"
# ===== set up main locations
content_location = pathlib.Path(".", CONTENT).absolute()
output_location = pathlib.Path(".", OUTPUT).absolute()
content_location.mkdir(parents=True, exist_ok=True)
output_location.mkdir(parents=True, exist_ok=True)
# ===== login
# Logging into Steam once to ensure the SDK updates itself properly. If we don't
# do that the combined +login and +run_app_build_http at the end of the tool
# will fail.
steam_login = [args.steamcmd,
"+login",
args.steamuser,
args.steampw,
"+quit"
]
print("Logging in to Steam...")
execute_command(steam_login, "Login to Steam", 10)
print(" OK")
# ===== prepare Steam build scripts
template_vars = [
("[APPID]", args.appid),
("[OUTPUT]", OUTPUT),
("[CONTENT]", CONTENT),
("[VERSION]", args.version),
("[WINID]", args.winid),
("[LINUXID]", args.linuxid),
("[MACOSID]", args.macosid),
("[DRYRUN]", f"{args.dryrun}" if args.dryrun else "0")
]
blender_app_build = create_build_script(
"blender_app_build.vdf.template", template_vars)
create_build_script("depot_build_win.vdf.template", template_vars)
create_build_script("depot_build_linux.vdf.template", template_vars)
create_build_script("depot_build_macos.vdf.template", template_vars)
# ===== download archives
download_archives(args.baseurl, blender_archives,
args.version, content_location)
# ===== set up file and folder names
zipped_blender = get_archive_type("zip", args.version)
zip_extract_folder = zipped_blender.replace(".zip", "")
tarxz_blender = get_archive_type("tar.xz", args.version)
tarxz_extract_folder = tarxz_blender.replace(".tar.xz", "")
dmg_blender = get_archive_type("dmg", args.version)
dmg_extract_folder = dmg_blender.replace(".dmg", "")
# ===== extract
unzip_cmd = ["unzip", "-q"]
extract_archive(zipped_blender, zip_extract_folder, unzip_cmd, 3)
untarxz_cmd = ["tar", "-xf"]
extract_archive(tarxz_blender, tarxz_extract_folder, untarxz_cmd, 4)
if not args.skipextract or not content_location.joinpath(dmg_extract_folder).exists():
print("Extracting files from Blender MacOS archive...")
blender_dmg = content_location.joinpath(dmg_blender)
target_location = content_location.joinpath(
dmg_extract_folder, "Blender.app")
copy_contents_from_dmg_to_path(blender_dmg, target_location)
print(" OK")
else:
print("Skipping extraction of .dmg!")
# ===== building
print("Build Steam game files...")
steam_build = [args.steamcmd,
"+login",
args.steamuser,
args.steampw,
"+run_app_build_http",
blender_app_build.absolute(),
"+quit"
]
execute_command(steam_build, "Build with steamcmd", 13)
print(" OK")
clean_up()

View File

@@ -0,0 +1,31 @@
"DepotBuildConfig"
{
// Set your assigned depot ID here
"DepotID" "[LINUXID]"
// Set a root for all content.
// All relative paths specified below (LocalPath in FileMapping entries, and FileExclusion paths)
// will be resolved relative to this root.
// If you don't define ContentRoot, then it will be assumed to be
// the location of this script file, which probably isn't what you want
"ContentRoot" "./blender-[VERSION]-linux64/"
// include all files recursivley
"FileMapping"
{
// This can be a full path, or a path relative to ContentRoot
"LocalPath" "*"
// This is a path relative to the install folder of your game
"DepotPath" "."
// If LocalPath contains wildcards, setting this means that all
// matching files within subdirectories of LocalPath will also
// be included.
"recursive" "1"
}
// but exclude all symbol files
// This can be a full path, or a path relative to ContentRoot
"FileExclusion" "*.pdb"
}

View File

@@ -0,0 +1,30 @@
"DepotBuildConfig"
{
// Set your assigned depot ID here
"DepotID" "[MACOSID]"
// Set a root for all content.
// All relative paths specified below (LocalPath in FileMapping entries, and FileExclusion paths)
// will be resolved relative to this root.
// If you don't define ContentRoot, then it will be assumed to be
// the location of this script file, which probably isn't what you want
"ContentRoot" "./blender-[VERSION]-macOS/"
// include all files recursivley
"FileMapping"
{
// This can be a full path, or a path relative to ContentRoot
"LocalPath" "*"
// This is a path relative to the install folder of your game
"DepotPath" "."
// If LocalPath contains wildcards, setting this means that all
// matching files within subdirectories of LocalPath will also
// be included.
"recursive" "1"
}
// but exclude all symbol files
// This can be a full path, or a path relative to ContentRoot
"FileExclusion" "*.pdb"
}

View File

@@ -0,0 +1,31 @@
"DepotBuildConfig"
{
// Set your assigned depot ID here
"DepotID" "[WINID]"
// Set a root for all content.
// All relative paths specified below (LocalPath in FileMapping entries, and FileExclusion paths)
// will be resolved relative to this root.
// If you don't define ContentRoot, then it will be assumed to be
// the location of this script file, which probably isn't what you want
"ContentRoot" "./blender-[VERSION]-windows64/"
// include all files recursivley
"FileMapping"
{
// This can be a full path, or a path relative to ContentRoot
"LocalPath" "*"
// This is a path relative to the install folder of your game
"DepotPath" "."
// If LocalPath contains wildcards, setting this means that all
// matching files within subdirectories of LocalPath will also
// be included.
"recursive" "1"
}
// but exclude all symbol files
// This can be a full path, or a path relative to ContentRoot
"FileExclusion" "*.pdb"
}

View File

@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap2="http://schemas.microsoft.com/appx/manifest/uap/windows10/2" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" xmlns:uap4="http://schemas.microsoft.com/appx/manifest/uap/windows10/4" xmlns:uap6="http://schemas.microsoft.com/appx/manifest/uap/windows10/6" xmlns:uap7="http://schemas.microsoft.com/appx/manifest/uap/windows10/7" xmlns:uap8="http://schemas.microsoft.com/appx/manifest/uap/windows10/8" xmlns:uap10="http://schemas.microsoft.com/appx/manifest/uap/windows10/10" xmlns:mobile="http://schemas.microsoft.com/appx/manifest/mobile/windows10" xmlns:iot="http://schemas.microsoft.com/appx/manifest/iot/windows10" xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10" xmlns:desktop2="http://schemas.microsoft.com/appx/manifest/desktop/windows10/2" xmlns:desktop6="http://schemas.microsoft.com/appx/manifest/desktop/windows10/6" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:rescap3="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities/3" xmlns:rescap6="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities/6" xmlns:com="http://schemas.microsoft.com/appx/manifest/com/windows10" xmlns:com2="http://schemas.microsoft.com/appx/manifest/com/windows10/2" xmlns:com3="http://schemas.microsoft.com/appx/manifest/com/windows10/3" IgnorableNamespaces="uap uap2 uap3 uap4 uap6 uap7 uap8 uap10 mobile iot desktop desktop2 desktop6 rescap rescap3 rescap6 com com2 com3">
<Identity Name="BlenderFoundation.Blender[PACKAGETYPE]" Publisher="[PUBLISHER]" Version="[VERSION]" ProcessorArchitecture="x64" />
<Properties>
<DisplayName>Blender[LTSORNOT]</DisplayName>
<PublisherDisplayName>Blender Foundation</PublisherDisplayName>
<Description>Blender [VERSION] is the Free and Open Source 3D creation suite</Description>
<Logo>Assets\StoreLogo.scale-100.png</Logo>
</Properties>
<Resources>
<Resource Language="en-us" />
</Resources>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.18335.0" />
</Dependencies>
<Capabilities>
<rescap:Capability Name="runFullTrust" />
</Capabilities>
<Applications>
<Application Id="BLENDER" Executable="Blender\blender.exe" EntryPoint="Windows.FullTrustApplication">
<uap:VisualElements
BackgroundColor="transparent"
DisplayName="Blender [VERSION]"
Square150x150Logo="Assets\Square150x150Logo.png"
Square44x44Logo="Assets\Square44x44Logo.png"
Description="Blender is the Free and Open Source 3D creation suite"
>
<uap:DefaultTile
Wide310x150Logo="Assets\Wide310x150Logo.png"
Square310x310Logo="Assets\Square310x310Logo.png"
Square71x71Logo="Assets\Square71x71Logo.png"
ShortName="Blender [VERSION]"
>
<uap:ShowNameOnTiles>
<uap:ShowOn Tile="square150x150Logo"/> <!-- Show app name on the 150x150 tile -->
<uap:ShowOn Tile="wide310x150Logo"/> <!-- …and also on the 310x150 tile -->
<uap:ShowOn Tile="square310x310Logo"/> <!-- …and also on the 310x150 tile -->
</uap:ShowNameOnTiles>
</uap:DefaultTile>
</uap:VisualElements>
<Extensions>
<uap3:Extension Category="windows.fileTypeAssociation">
<uap3:FileTypeAssociation Name="blend">
<uap:SupportedFileTypes>
<uap:FileType>.blend</uap:FileType>
</uap:SupportedFileTypes>
<uap2:SupportedVerbs>
<uap3:Verb Id="open" Parameters="&quot;%1&quot;">open</uap3:Verb>
</uap2:SupportedVerbs>
</uap3:FileTypeAssociation>
</uap3:Extension>
<uap3:Extension Category="windows.appExecutionAlias" Executable="Blender\blender.exe" EntryPoint="Windows.FullTrustApplication">
<uap3:AppExecutionAlias>
<desktop:ExecutionAlias Alias="blender.exe" />
</uap3:AppExecutionAlias>
</uap3:Extension>
</Extensions>
</Application>
</Applications>
</Package>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 918 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

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