1
1

Compare commits

...

708 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
0849af4591 Linux: update appdata for 2.83 release 2020-06-03 19:10:51 +02:00
86385d7ebd Fix build error for Cycles standalone
This does not affect the Blender release.

Ref D7915
2020-06-03 19:10:51 +02:00
Nathan Letwory
211b6c29f7 Remove trailing space 2020-06-03 17:38:22 +03:00
Nathan Letwory
82e3bd4bbb Ensure submodules are at correct commits for 2.83 2020-06-03 15:23:39 +03:00
Nathan Letwory
3c9f80c898 Move 2.83 from beta to release 2020-06-03 15:21:51 +03:00
Nathan Letwory
dc8475ec6a Splash: new image for 2.83 by Ian Hubert 2020-06-03 15:19:34 +03:00
7fc0053c27 UI: Fix T77173: Report Background Colors for 2.83 Release
This is a temporary solution for T77173 for the 2.83 release. D7203
provides a more long term solution for future releases.

This adds theme colors for the three report backgrounds, setting them
to the color used in 2.82. A separate commit in the addons repository
will follow for changes to the bundled themes.

Differential Revision: https://developer.blender.org/D7908
2020-06-02 15:04:46 -04:00
52cc412e0f Revert "Fix T63588: Cycles unnecessarily updates background importance sampling map"
This reverts commit 33ce0cb5a1.

Fix T77273: crash enabling portal lights. The optimization for background
updates can be added back later for 2.90 and 2.83.1.
2020-06-02 19:44:12 +02:00
eba3aa1837 Revert "Fix T67577: Add-on unregister can't access preferences on factory reset"
This reverts commit f18ed7ad89.

Better leave the fix for 2.9 series.
2020-06-03 00:54:29 +10:00
0a00fbd265 Fix T66967: skin modifier crash scaling skin radius to zero 2020-06-02 23:45:51 +10:00
ae2f21f378 Fix T76533: Gizmo uses active face center in edge selection mode
Only use the active face when it's selected.
2020-06-02 18:38:58 +10:00
6aef27602a Cleanup: use C++'s nullptr instead of our own C NULL define, in C++ code. 2020-06-02 10:32:21 +02:00
428c0f9ad5 Fix T77192: Crash when opening bunny.blend file.
New depsgraph code handling drivers was not checking for possible NULL
rna_path, as done everywhere else in code...
2020-06-02 10:21:19 +02:00
81f817e7b4 Fix T72088: Missing header redraw when transform changes snap 2020-06-02 18:05:00 +10:00
de6c935261 Cleanup: code comments for mode switching
Comment on mode switching cases that are supported,
including the issue from recent regression T77217
which is easy to miss since it's not used in the default key-map.
2020-06-02 16:12:36 +10:00
7881c251f3 Fix build error in Cycles standalone without guarded allocator
Solution suggested by howetuft.

Differential Revision: https://developer.blender.org/D7892
2020-06-02 06:27:39 +02:00
Garry R. Osgood
389d550412 Fix T77106: Cycles crash baking with AO shader node
Differential Revision: https://developer.blender.org/D7890
2020-06-02 06:25:08 +02:00
31cf87a29e Fix py api doc gen script after recent versionning changes. 2020-06-01 12:10:56 +02:00
c204e3348c Fix T77217: Object mode toggle doesn't work
Toggling object mode to the previous wasn't working, also resolves a
case when toggling modes would cause an extra, unnecessary mode switch.
Own regression in 5159b8e1ea.
2020-06-01 18:56:43 +10:00
520f08aa56 Fix T77241: NDOF navigation doesn't work with the knife tool
Also allow NDOF with loop-cut.
2020-06-01 16:21:30 +10:00
f18ed7ad89 Fix T67577: Add-on unregister can't access preferences on factory reset 2020-06-01 14:06:55 +10:00
d5a92b188b Cleanup: warnings 2020-06-01 12:06:34 +10:00
ec26260132 GPencil: Fix unreported wrong Sculpt brushes initialization in Templates
The Sculpt brushes were not properly initialized when use 2D template or other templates.

Also, using the default template (not factory settings) could be situations where the brushes were not updated.

This problem was introduced when some versioning code was removed in order to avoid duplicated brush creation.
2020-05-30 17:33:09 +02:00
691a1e3357 EEVEE: Fix memory leak when using SSS render pass.
Differential Revision: https://developer.blender.org/D7876
2020-05-29 19:42:53 +02:00
Brecht Van Lommel
a86b5df005 Blender: change bugfix release versioning from a/b/c to .1/.2/.3
The file subversion is no longer used in the Python API or user interface,
and is now internal to Blender.

User interface, Python API and file I/O metadata now use more consistent
formatting for version numbers. Official releases use "2.83.0", "2.83.1",
and releases under development use "2.90.0 Alpha", "2.90.0 Beta".

Some Python add-ons may need to lower the Blender version in bl_info to
(2, 83, 0) or (2, 90, 0) if they used a subversion number higher than 0.
https://wiki.blender.org/wiki/Reference/Release_Notes/2.83/Python_API#Compatibility

This change is in preparation of LTS releases, and also brings us more
in line with semantic versioning.

Fixes T76058.

Differential Revision: https://developer.blender.org/D7748
2020-05-29 17:48:26 +02:00
1d2b89304a Fix T77130: Visually broken/stepped wireframe in object mode (regression)
Create a new shader for the selection fix.

Differential Revision: https://developer.blender.org/D7873
2020-05-29 11:59:40 +02:00
ff1040c6fe GPencil: Reduce aliasing for subpixel lines 2020-05-28 13:42:39 +02:00
79e529c5ec Fix T77109: Cycles viewport render crash after object add and undo 2020-05-27 18:03:17 +02:00
735119dd0f Fix T75096: Crash when using liquid simulation as dynamic paint brush
Reviewers: sergey

Differential Revision: https://developer.blender.org/D7853
2020-05-27 16:15:06 +02:00
28d9368538 Fix T76947: Optix realtime denoiser progressively reduces brightness of very bright objects
The input data to the OptiX denoiser was clamped to 0..10000 as required, but it could easily
exceed that range with a high number of samples (since the data contains the overall sum). To
fix that, divide by the number of samples first and multiply it back in after the denoiser ran.
2020-05-27 15:17:47 +02:00
1c3b2b5dd8 Fix T77105: Crashes when clicking "new scene" button
This was introduced on ecc395e473.

Effectively this is reverting that commit for cases when
scene->toolsettings->sculpt is NULL. But since the facesets are only
working for sculpting this should be fine.
2020-05-27 12:00:00 +02:00
f772a4b8fa Fix: A few missing outliner selection sync tags
Add selection syncing for object add named (e.g. drag and drop from
outliner to 3D view), outliner right click (a sync when the context menu
is cancelled), and for object selection from Python.
2020-05-26 16:42:21 -06:00
18f33f293b Fix Cloth Brush grab deformation mode
The grab mode was not correctly implemented, so the way it was working
was confusing for users.
- Grab delta was calculated in increments from the last stroke position, so it did not match the behavior of a grab brush. I refactored the grab delta calculation to make this change more explicit.
- Grab displacement was not calculated from the original coordinates
- Grab was using an incorrect strength

Grab is now setting the position of the affected vertices directly and
the constraints solve the rest of the cloth. I also tried to implement
an alternative version based on applying forces to move the vertices to
the grab position, but I think this is more controllable and the grab
falloff can be adjusted by tweaking the simulation falloff.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7756
2020-05-26 20:48:46 +02:00
9aea7dc7c6 Fix Pose Brush origin position with large brush size
When the brush size is bigger than the entire mesh, fdata.tot_co can be
0, so the pose origin will default to (0,0,0), which does not make much
sense. After this patch, the pose origin will be set to the farthest
vertex from the pose origin, which at least should be in the surface of
the mesh and in most cases in the direction the pose brush was already
detecting the origin.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7773
2020-05-26 20:45:20 +02:00
9b0f65c4a6 Fix naming in the PBVH neighbor iterator macro
The only possible name for the iterator was ni, this should fix that.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7774
2020-05-26 20:43:14 +02:00
5f63344e84 Fix PBVH API returning wrong normal when using shape keys and modifiers
The implementation of this function should match the one in
SCULPT_vertex_co_get. This does not solve the issue when sculpting with
modifiers active but I think this code is wrong

Reviewed By: sergey, brecht

Differential Revision: https://developer.blender.org/D7805
2020-05-26 20:40:27 +02:00
a1c9d42584 Fix T77021: Alembic export of animated mesh with multiple UV maps fails
This was caused by a side-effect of our exporting code's memory
management (Alembic considers data "written" and "final" when its C++
objects go out of scope) in combination with my change in
rB65574463fa2d. I removed an "only export UVs on the first frame" clause
because it was unclear why this restriction was there. As it turns out,
it breaks the export of the 2nd and subsequent UV maps on an animated
mesh. Effectively, on every frame the Alembic library thought we want to
create a new UV map, instead of continuing to write a new frame of data
to the existing one.

This is resolved by keeping a reference to the C++ objects for the UV
maps in memory while the exporter is running.
2020-05-26 16:42:01 +02:00
f3cf29ac96 Fix T77074: Collections: Exclude From ViewLayer toggle crashes
Consider this a bandaid fix (similar to rBe2724abc22d5).

Real issue seems to be that object is still in OB_MODE_PARTICLE_EDIT
whereas it should be in OB_MODE_OBJECT after toggling 'Exclude From
ViewLayer'. So while this patch prevents the crash, it leaves the object
in a weird state (it cannot be selected for example), needs further
investigation.

Maniphest Tasks: T77074

Differential Revision: https://developer.blender.org/D7843
2020-05-26 16:22:41 +02:00
4114e89020 Fix overlapping tabs placement when used in right Top-bar split
Didn't respect alignment rules for split layouts.

Reported in T77075.
2020-05-26 15:42:50 +02:00
d3275178fe Fix T77082: Greasepencil error accessing material dropdown on an object without materials
Differential Revision: https://developer.blender.org/D7841
2020-05-26 14:55:37 +02:00
2299f6b5a7 Fix T77049: VSE Image cache is not refreshed when strip are muted/
unmuted in metastrip

Maniphest Tasks: T77049

Differential Revision: https://developer.blender.org/D7834
2020-05-26 14:49:19 +02:00
2a692e05c8 Fix T77075: Crash omitting optional UILayout.template_ID_tabs parameter 2020-05-26 12:56:53 +02:00
fc2bb44e94 Fix T68209: Crash opening pre 2.8 file with maximized area
Versioning for workspaces didn't update the map used to determine which
layout is active for a workspace in a specific window. Library code now
called the function to make a workspace active (even if it already was
active), which would also use this map to determine the active layout --
the wrong one.

Error in initial workspace integration, but only uncovered recently.
Likely through 0d8a8ce03b.
2020-05-26 12:19:27 +02:00
5a1ab3e9ae Fix T77067: GPencil Object without materials cannot use Vertex Color mode 2020-05-26 12:13:25 +02:00
2dd6d0ce4b Fix T76926: Crash with Full Screen file browser window preference
Alternative fix for T75292 & T73579 (see b75ce05c3b), that does not
cause this crash.

The crash happened because cancelling the file browser removes its
screen (as in bScreen). Before rBb75ce05c3b0f, the file browser event
wouldn't be handled any further then. After it, it would still be passed
to other areas, while the screen pointer was dangling.
Now the event is only skipped for UI handlers.

Reviewed by: Julian Eisel
2020-05-26 10:38:46 +02:00
ecc395e473 Fix T76902: face sets checkbox broken
Due to recent changes the face sets checkbox broke. The cause is that
{7d38f5036794} changed the responsibility of drawing and updating sculpt GPU
buffers to fix render glitches.

This patch moves the checkboxes evaluation to the overlay engine.
2020-05-26 08:48:57 +02:00
77fdd189e4 Fix T76970: Unneccessary update calls viewport
Due to recent changes clicks in the node editor would trigger a
depsgraph update resulting in too many redraws. This patch limits
the updates to when workbench shown in texture mode in any visible
screen.

There are still cases where too many updates are created. For example when
there are a Cycles render viewport and a Workbench texture viewport on the
same screen.

This fix is meant as a workaround. The actual fix should add a mechanism
to the depsgraph and the viewports should check if they need to be redrawn.

Reviewed By: Brecht van Lommel

Differential Revision: https://developer.blender.org/D7830
2020-05-26 08:29:24 +02:00
39aa122a0e DRW: Selection: Extend small object selection workaround to all overlays
Fix T77015 box select doesnt select cameras when zoomed out, lasso and circle select do work.
2020-05-25 19:35:07 +02:00
4a9a8611f2 Fix T72121: Measurements are being drawn incorrectly if one end is off screen
The solution is to distribute the drawing for part to be done in 3d
(dashed lines, arc) and another part in 2d (text and caps).

Ref T72121

Reviewed By: fclem

Maniphest Tasks: T72121

Differential Revision: https://developer.blender.org/D6361
2020-05-25 19:17:59 +02:00
31cb4133b9 Fix T77009: texture baking crash on Windows
Only happens in master, but DynamicArray implementation is wrong also in 2.83.
Thanks to Jesse Y and Ray Molenkamp for investigating.
2020-05-25 18:17:30 +02:00
52c356c199 Cleanup wrong format specifier in a debug printf. 2020-05-25 17:49:58 +02:00
9f1f7ba2bb Fix T76925: more Cycles OpenCL compile errors with some drivers on Linux 2020-05-25 17:06:10 +02:00
f53ae843b3 Fix T76267: Stencil texture with negative scale dissapears after
clicking Image Aspect

Calculate with positive areas here and ensure stencil_dimension stays
positive.

Maniphest Tasks: T76267

Differential Revision: https://developer.blender.org/D7821
2020-05-25 16:57:36 +02:00
ce0db0d329 UI: Fix T76918: 3D Mouse Inconsistent / Inaccessible UI
This consolidates the UI code for NDOF input settings, making all
settings accessible from the preferences. This works around an issue
where the Space Navigator's "Menu" button doesn't trigger the settings
menu in Blender.

I also took the opportunity to redo the UI layout.

Note: Separate commit for 2.83 because UI layouts features
have diverged.

Differential Revision: https://developer.blender.org/D7806
2020-05-25 10:53:17 -04:00
219ce574b5 Revert "UI: View3D Cursor Changes"
This change is yet to be followed by a more comprehensive design
proposal including:

* How to differentiate the modes apart.
* More clear definition of tools and the rules for their components (gizmo, cursor).
* Selection as a non-tool vs drag option.

This can be revisited for 2.90 with more time. For now the UI team
agrees to revert this.

--
This reverts commit 4aa703aa14.
2020-05-25 16:28:55 +02:00
ec0ba8e3b5 VR: Fix big performance bottleneck for simple scenes
Blender's main loop puts the main thread to sleep for 5ms if no user input was
received from the OS. We never want that to happen while the VR session is
running, which runs on the main thread too.

For simpler scenes, where the viewport already draws fast, this may have quite
some impact. E.g. in my tests, the classroom scene went from ~55 to quite
stable 90 FPS in solid mode (total render time as measured and averaged by
Windows Mixed Reality utilities). With Eevee, it only went from 41 to 47 FPS.
In complex files, there's barely a difference. E.g. less than 1 FPS increase in
a Spring file (both Solid mode and Eevee).
2020-05-25 15:52:24 +02:00
026eba8523 Fix T76941: "Set Inverse" in Child Of constraint broken with armatures
When the Child Of constraint is owned by a bone, before the constraint is
run the matrix is converted from world to pose space. However, setting the
inverse should also take the armature object's transform into account.
2020-05-25 15:46:08 +02:00
849f5bee19 Cleanup: ID makelocal code: remove useless and confusing debug code.
Thing is, user code should not have the responsibility to check that
libquery is valid. Such checks are only source of confusion and errors
as nobody will think about finding and updating them in some obscure
specific area of the code...
2020-05-25 15:38:36 +02:00
7a37db6125 Fix T76997: bad handling of embedded IDs in partial append.
Code dealing with embedded data was pre-existing proper generic
handling of those by `BKE_library_foreach_ID_link()` - and was never
updated for scene's master collection it would seem...

Note that such fix/refactor is a bit risky at this point in the release
cycle, but on the other end previous situation was really broken. So
finger crossed. :|
2020-05-25 15:11:36 +02:00
a8a6b3627a Fix autokeyframing masks not updating properly
Spotted while looking into T76872

Maniphest Tasks: T76872

Differential Revision: https://developer.blender.org/D7786
2020-05-25 13:56:49 +02:00
7e9480b6cd Tests: correct the blender path for non-portable installations 2020-05-25 21:28:03 +10:00
d65f60764b GTest: BLI_ghash_performance_test was failing
Change the seed from 0 to 1, so BLI_ghash_performance_test doesn't
assert with duplicate keys.
2020-05-25 20:52:10 +10:00
baa1886791 Fix T76990: Crash shortest path select with 'face stepping' when no faces.
Note that this sometimes gives no solution when there is a mix of edges
with and without faces... But at leat this should be safe fix.
2020-05-25 12:44:10 +02:00
41bb0548b0 Fix T76897: Lamp Power Not Updating from Driver
Lamps were not tagged with `ID_RECALC_SHADING` when they were updated
from drivers. As a result, Cycles considered the lamp as unchanged. This
is resolved by having a (seemingly non-functional) callback in a new
`LIGHT_UPDATE` depsgraph node.

This patch unconditionally adds the `LIGHT_UPDATE` node + the relation
from the lamp's PARAMETERS node.

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

Reviewed by: brecht
2020-05-25 10:07:10 +02:00
9b9f84b317 Fix crash when converting BMesh to Mesh with shape keys
The `BM_mesh_bm_to_me()` function copies shape keys from the BMesh to
the Mesh. However, it tries to copy the same number of shape keys as are
defined on the target mesh. Since the target mesh does not necessarily
have the same number of shape keys as the BMesh, this would crash if the
target Mesh has more.

Found while performing some tests for {D7785}.

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

Reviewed by: brecht
2020-05-25 09:43:01 +02:00
c15bb3b55f Fix T77031: Blender as pymodule crashes when rendering
No longer enforce WITH_HEADLESS when building as a Python module
as it disables GPU access which is needed for rendering.
2020-05-25 15:53:43 +10:00
31f3e9082a Cleanup: make format 2020-05-25 14:55:48 +10:00
f274b8c102 CMake: disable WITH_USD with blender_lite configurations 2020-05-25 14:54:41 +10:00
0d0df683d9 Fix(unreported): Crash on prefetching while transforming strip.
While investigating T76274, I found crash scenario when playhead is near end
frame and moving a strip. It is not as easy to reproduce, about 5% success
rate, and it will be even harder after rB4066c921fbe5. Exact cause wasn't
identified yet.

I wanted to disable prefetching during modal operator execution in VSE, but
currently I don't have any signalling method in place. Checking for G.moving
seems to resolve this problem, but it doesn't adress root cause of bug.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7820
2020-05-24 21:03:31 +02:00
22462fed00 Fix T77003: GPencil Paint presets not initializated
In som ecases, the Paint was not ready when the brushes and palette were created. Now, first the paint is checked.
2020-05-24 10:22:03 +02:00
6f8d99322c Fix T76578: Show bone visibility driver in outliner
Allow setting drivers and keyframes for the bone visibility restriction
icon in the outliner. Before the button was a simple icon button, but it
is now connected to the RNA property to show the driven or keyframed
state.

Also when hiding a bone from the outliner it would be deselected, but
from the properties editor it would remain selected. This moves the
deselection to the RNA update function to ensure the bone is always
deselected.

Differential Revision: https://developer.blender.org/D7825
2020-05-23 10:36:54 -06:00
b4613e0bca GPencil: Fix unreported Noise modifier does not work in axis aligned strokes
If the stroke is totally straight, the normal was not calculated properly.
2020-05-23 15:25:54 +02:00
Ankit
e8dd8c2829 Cleanup: silence deprecation warnings of Carbon Finder Favorites items
Differential Revision: https://developer.blender.org/D7655
2020-05-22 21:52:38 +02:00
f27e122d95 Fix T76925: Cycles OpenCL compile error with some drivers on Linux 2020-05-22 21:50:24 +02:00
98689f51c0 Fix T74443: No render in VP9 lossless mode
We define Lossless as CRF 0 (which is usually the best quality and is
working fine with other codecs afaict), but since WebM only allows for
CRF values between 2-32 and actually has a dedicated "lossless" mode, I
suggest using that (it produces large files though, so double-checking
would be welcome).

https://trac.ffmpeg.org/wiki/Encode/VP9#LosslessVP9

Maniphest Tasks: T74443

Differential Revision: https://developer.blender.org/D7800
2020-05-22 17:41:27 +02:00
a76e804309 Fix T76960: fluid baking operators not working with pinned object
Maniphest Tasks: T76960

Differential Revision: https://developer.blender.org/D7819
2020-05-22 17:16:31 +02:00
Jeroen Bakker
0236863c6d Fix T73115: In Front Drawing Bone Envelope Distance
The in front drawing was not supported for transparent part of the   armature. This patch adds a second transparent pass for drawing in
front.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7763
2020-05-22 15:09:48 +02:00
69e331201e UV: remove "UV Local View" for UV editing
This feature was added when Blender used tex-face (per-face images),
but doesn't make as much sense since this was removed.

Removing this from UV edit-mode as this wasn't working in any
of the 2.8x releases, causing UV's to be visible but unselectable.

Resolves issue raised in T76958.
2020-05-22 22:18:32 +10:00
Jeroen Bakker
59aed2a255 Fix T73726: Workbench Closest Interpolation Artifacts
All textures in workbench are using linear interpolation. The fragment
shader modifies the uv coordinates to sample always in the center of a
texel. In rare conditions the GPU could sample an incorrect value due to
rounding errors making some rendering artifacts.

This patch skips the interpolation in the fragment shader to remove
these render artifacts.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7816
2020-05-22 14:11:36 +02:00
4066c921fb Fix (unreported): prefetching wastes resources when end frame is reached
This bug is not really visible for user. When end frame is reached by
prefetching thread, it doesn't stop and keeps on getting images from
cache.

Add chech for this situation and simplify logic involved in suspending,
so it's easier to read.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7757
2020-05-22 13:31:49 +02:00
c4edc6f3f7 Fix (unreported): Don't restart prefetching during rendering.
Prefetching is stopped in BKE_sequencer_cache_cleanup, but is restarted quickly.

Prefetching has negative effect on performance while rendering.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7751
2020-05-22 13:05:08 +02:00
a1a333a1e9 Fix T76774: Crash on prefetching sequences from another scene.
When rendering another scene, caching in disabled by setting
local_context.skip_cache = true. Precondition checking for this flag was
missing in BKE_sequencer_cache_get and it wasn't first thing to check in
BKE_sequencer_cache_put.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7750
2020-05-22 12:59:26 +02:00
Jeroen Bakker
42f8d52401 Fix T64277: Inverted Wheelmouse
When using CTRL wheel mouse the items were selected in a different order than when opening the menu and use the wheel mouse.

Reviewed By: Brecht van Lommel

Differential Revision: https://developer.blender.org/D7791
2020-05-22 07:32:44 +02:00
1b994a37f4 Fix Python console cursor height 2020-05-22 12:36:39 +10:00
8a8c61190b Docs: note that the color-ramp uses image alpha
Avoid misunderstanding from T59110
2020-05-21 23:03:24 +10:00
376b69cbff Fix T73568: Vertex selection fails in weight-paint mode
Lasso, circle, box select fails in weight paint mode with modifiers.
2020-05-21 19:32:15 +10:00
d15efbdc56 Fix T76922: Meta-balls created twice the specified size 2020-05-21 18:18:00 +10:00
8d648e0972 Cleanup: spelling 2020-05-21 16:22:37 +10:00
fcfb87def9 Cleanup: excess blank lines and parenthesis 2020-05-21 16:17:44 +10:00
f66bfb5a86 Cleanup: quiet uninitialized warning
It's possible for the value to be uninitialized
in the case of loading newer preferences into an older Blender.
2020-05-21 15:57:46 +10:00
b4a6418e2b Cleanup: add doxy sections for event queue handling
The main function to handle events didn't have it's own section.
2020-05-21 12:22:32 +10:00
522e6c0c06 Cleanup: add asserts for textview drawing
This would have prevented T74298.
2020-05-21 12:22:32 +10:00
af3a55bb1b Overlay: Wireframe: Add visualization for Hairs in wireframe mode
This only works for particle systems for now.

Fix T61928 Wireframe mode hair not visible
2020-05-20 22:54:04 +02:00
e4e31e4f14 Fix T76916: Cycles missing deform motion blur for shape key + subdiv modifier 2020-05-20 18:00:34 +02:00
93b5682444 Fix T76909 GPencil: Layers with mask(s) invisible when using "in front"
The gpSceneDepthTexture is using a dummy 1px texture which was generating
wrong values for uvs when sampling gpMaskTexture.

Use the max size of both since any of the 2 can use dummy texture.
2020-05-20 17:48:24 +02:00
e15ffc0c54 UI: Fix Wideline AA for timeline 2020-05-20 17:48:24 +02:00
8fe448b44d Fix T75197: Eevee does not render instanced smoke
This check was introduced in rBc8005703f298, but does not
seem necessary anymore.

Reviewers: fclem, sebbas, brecht

Differential Revision: https://developer.blender.org/D7799
2020-05-20 16:55:43 +02:00
ccf43fe605 Cycles: Fix rendering instanced smoke domain.
The problem was that Cycles would store a pointer to an object in
`DEGObjectIterData->templ_dupli_object`. This pointer was then accessed
when the iterator was already freed.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D7797
2020-05-20 16:53:28 +02:00
b44101950d Fix T73979: Wrong location of fluid mesh when domain origin is not in center
Reviewers: sebbas

Differential Revision: https://developer.blender.org/D7802
2020-05-20 16:52:03 +02:00
c1545c9a9d Fluid: Fix for non-moving liquid particles
Issue was introduced in 7bb3d9787e with new Mantaflow files from 61280e5af3.
2020-05-20 16:37:29 +02:00
9897ef6a20 Fix T70948: Library Override: Parenting library override objects does not save offset from parent.
Parent inverse matrix needs to be overridable as well...
2020-05-20 15:31:02 +02:00
d33c27d68b Fix T75457: Toggle brushes using same hotkey twice is broken
Caused by rB47da01a4db1d.

Above commit did not change the toolname it was setting when the brush
was actually toggled.

Maniphest Tasks: T75457

Differential Revision: https://developer.blender.org/D7792
2020-05-20 15:05:33 +02:00
eb57377f12 Fix T76794: Number button cursor overrides eyedropper cursor
Pressing 'E' over a number button to pick a distance was keeping
left-right arrows instead of using the eye-dropper cursor.

Workaround this by clearing the active button before setting the cursor.
2020-05-20 22:07:55 +10:00
7d3bf5166d Fix color picker being used for non-color buttons such as rotation
Issue raised in T76794
2020-05-20 22:04:56 +10:00
3360db83c4 Fix T76883: Zero users scenes after undo.
Some tags need to be preserved when we reuse existing ID entirely.
AFAICT, currently this is only the EXTRAUSER one.
2020-05-20 10:39:50 +02:00
db6e267bfc Fix T74298: Incorrect cursor position in Python console 2020-05-20 18:16:52 +10:00
5fe7605f3d Fix the current pixelsize impacting thumbnails 2020-05-20 14:58:57 +10:00
a296dff2c8 Correct invalid limits in last commit 2020-05-20 13:48:25 +10:00
aa02a05bc7 Fix T75977: Lower the merge limit in the bisect/mirror operation in symmetrize
This operation is using the code of the mirror modifier, so no default
is guaranteed to work in all cases. This value matches the defaults of
the mirror modifier.

Reviewed By: jbakker

Maniphest Tasks: T75977

Differential Revision: https://developer.blender.org/D7495
2020-05-20 03:24:51 +02:00
dfe8195dfe Cleanup: compiler warning 2020-05-20 01:15:08 +02:00
8f050b6825 Fix Cycles viewport render fully restarting after undo
With the optimized undo datablock pointers remain the same, so Cycles can now
update just the parts that changed.
2020-05-20 01:11:42 +02:00
499c0229f7 Fix T76858: non-thread safe sculpt memory allocation when using --debug-memory
By default the guarded memory allocator is not thread safe, that needs to be
initialized.
2020-05-20 00:33:49 +02:00
59cfb20fa1 Fix PBVH parallel range not initializing user data correctly in some cases
This was already changed for the TBB-based BLI_task_parallel_range in master.
This task local storage should always be initialized from the template, not
copied from another task which may be executing at the time the copy happens.

This may not fix any actual bug, we only use this user data for parallel reduce
and it's not clear that TBB ever calls the copy constructor for that case.

Ref T76858
2020-05-19 23:36:28 +02:00
8d63d7337c Fix unnecessary buffer reallocation in sculpt mode, causing an assert
Probably did not cause an actual, the assert is a performance warning.

Ref T76858
2020-05-19 23:36:12 +02:00
20c30534aa Fix T75383:Bevel weird behaviour when using bevel weights
Don't use the cube corner special case when the offsets are different
for the three edges involved. The generic VMesh for this situation isn't
perfect, but it's much better than a failed cube corner VMesh.

Tests pass.
2020-05-19 16:54:05 -04:00
42d77fbea1 UI: Make timeline vertical bars thickness work on OSX
Make use of Polyline shader.
2020-05-19 22:43:42 +02:00
13125e0948 GPU: Attempt to fix Crash on startup with Intel HD Graphics 620/630
This only enables the workarounds that we know have effects on intels.
We could add the other workarounds if needed.

Related task T72098
2020-05-19 22:24:25 +02:00
a5a069c272 Fix T76080 Workbench: Background Glitches caused by Screen Cavity effect 2020-05-19 21:37:43 +02:00
d6cc16831a Fix T73594: Scale Cage sometimes has incorrect center in edit mode
Differential Revision: https://developer.blender.org/D6803
2020-05-19 16:30:21 -03:00
5201bc9dd4 Fix T66916 UI: Wrong information in Status bar after cancelling a render
Fixed thanks to @manowii
2020-05-19 21:23:56 +02:00
7bb3d9787e Fix T76812: [Mantaflow] Inflow particles not continuous
Makes use of the new particle skipping option introduced in f25a882955cb.
2020-05-19 21:12:30 +02:00
61280e5af3 Fluid: Updated Mantaflow source files
Includes changes for particle skipping during advection.
2020-05-19 21:12:30 +02:00
fa270a37e8 Fix T76564 Curve: Missing orco cause mesh to not render 2020-05-19 21:01:21 +02:00
a4cbacacbf Fix T73847 Overlay: Camera orthographic scale moves background image 2020-05-19 21:01:21 +02:00
059f79bdd7 Clarify autokeyframe tootip
This applies to masks as well.

Spotted while looking into T76872.

Differential Revision: https://developer.blender.org/D7788
2020-05-19 18:43:30 +02:00
cfb7664d5b Fix: build error due to missing definitions
Reviewers: sergey, brecht

Differential Revision: https://developer.blender.org/D7787
2020-05-19 17:36:40 +02:00
7fcf2e7d4a Fix T74577: world_to_camera_view broken for off-axis projection
The issue was that the projection would be inverted.
So if you shifted 0.1 along the y axis, world_to_camera_view would act
as if you had shited it -0.1 along the y axis.
2020-05-19 16:27:09 +02:00
0c20fce2f2 Fix T76697: [Mantaflow] mesh generation does not account for some particles
Adapted mesh generation to account for domains with disabled fractionstoo.
2020-05-19 16:02:38 +02:00
Josh Belanich
03fa66d274 Fix T72889: Cycles camera motion blur not usng more than 2 steps
Differential Revision: https://developer.blender.org/D7782
2020-05-19 15:40:56 +02:00
9ccc73ade8 Animation: Make dopesheet filter labels consistent
There are three different label styles for the three Dopesheet filter
labels:

- "Display Hidden", which uses "Display" rather than "Show" as the other
  two options.
- "Show Errors", which does not use the word "only" to indicate it will
  hide all the non-error channels.
- "Only Selected", so no "show" or "display" in the label at all.

This commit changes:
- Always use the word "Show", not "Display".
- Always use the word "Only" when enabling the filter hides everything
  else.

Reviewed By: billreynish

Differential Revision: https://developer.blender.org/D7742
2020-05-19 15:23:44 +02:00
Jeroen Bakker
9ac4e4a1c7 Fix T76375: UDIM Rectangular Tiled Image EEVEE freezes Blender
When packing the image the height of the tile was checked to the width
of the packing area. This resulted that the tile was ignored.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7784
2020-05-19 15:20:40 +02:00
a6646fb0d0 Fix T76881: Changing "Use Speed Vectors" deletes all existing cache
Reviewers: sebbas
2020-05-19 15:18:33 +02:00
8c4965f86d Fix build error after 30cbbccc60
That part only applies to master, sorry for the noise
2020-05-19 15:17:11 +02:00
14278cd932 Fix T76694: Fluid cache is deleted when changing Upres Factor
Reviewers: sebbas
2020-05-19 15:13:25 +02:00
30cbbccc60 Fix (unreported) UV shadow not drawing smooth
When showing UV edges after modifiers [draw_uvs_shadow], these were never
drawn anti-aliased [in contrast to the 'main' UVs].

Also: they did not respect the new 'UV Opacity' setting.

Differential Revision: https://developer.blender.org/D7764
2020-05-19 14:42:19 +02:00
675ba2073d Fix T75694: Compositor Backdrop boundbox missing updates
This adds notifiers for backimage_move & backimage_fit.

Maniphest Tasks: T75694

Differential Revision: https://developer.blender.org/D7778
2020-05-19 14:16:22 +02:00
82bda82ec4 Fix T76541: OpenGl Depth Picking not selecting frontmost object
The issue was that we used GL_ALWAYS for depth checking here which would
lead to the depth information from objects being messed up.

It would not represent which object was closest to the camera.

Reviewed By: Clément Foucault, Jeroen Bakker, Campbell Barton

Differential Revision: http://developer.blender.org/D7710
2020-05-19 12:22:28 +02:00
25dea3e65e Fix T76717: Set Rotation Mode Incorrectly Recalculates Bone Rotation In Pose Mode
The issue was that we didn't convert the current rotational values.
We simply just switched mode without doing any data conversions.
2020-05-19 12:22:18 +02:00
10528a5cd4 Fix Frame Dropping not dropping the correct amount of frames
Previously the playback mode "Frame Dropping" would not drop the correct
number of frames which would lead to slow playback.

For example, the playback target is 60fps.  However we can only muster
around 32 fps.

The delta frames from the last step is in this case ~1.98 or so.

With the previous code, we would floor this.  That would lead us to step
forward one frame each time, effectively playing back the animation at
half the speed as we will try to render every frame.

To fix this we simply save the remaining fraction from the previous
frame and use it to compute the current frame step.

Reviewed By: Sybren

Differential Revision: http://developer.blender.org/D7694
2020-05-19 12:22:07 +02:00
24e5c64ea2 Made pose push/relax to breakdown behave smooth on rotations
A follow up to T67212. I missed that the rotation interpolation had its
own code path.

The previous rotation push code was actually wrong (but smooth).

Now all of the actions behave correctly and is smoothly interpolated.
2020-05-19 12:21:53 +02:00
cddfa7a449 Fix T72729: Mask Modifier Loose Edges Not Shown
When using the mask modifier loose edges could be added to the mesh.
These edges weren't marked as loose edges and wasn't picked up by other
areas of blender.

This fix recalculates the loose edges so they have the correct flag
`ME_LOOSE_EDGE`.

Reviewed By: Sybren Stüvel

Differential Revision: https://developer.blender.org/D7766
2020-05-19 10:12:57 +02:00
b96ccb5126 Fix T76865: Vertex paint draws hidden but cannot be painted onto 2020-05-19 18:06:27 +10:00
f89b89fa7f CMake: Enable WITH_USD by default
Having USD disabled by default was an oversight, and could have been
corrected earlier. It's already enabled by default in the
`blender_release.cmake` and `blender_full.cmake`.
2020-05-19 09:39:51 +02:00
291136eece Fix T76689: Armature layers not indicating the existence of bones
From what I can see, there are two issues at play in {T76689} and its merged-in report {T76590}:

- In Blender ≤ 2.79 the bone layer dots were updated in the draw code. This ensured the info was up to date before drawing. This is no longer possible, as the drawing code uses evaluated objects, and those should not be written to. This has been addressed in rB709f126e8143 by calling the update function explicitly in various places in the code. The problem is that this wasn't added to all necessary spots.
- When in edit mode, changes are made to the edit bones but not to the 'actual' bones (this is synced when exiting edit mode). This causes undo to mess up the layer indicators.

I think both issues can be addressed by having the dependency graph update the used layer info as part of the armature evaluation. This will make the undo system work properly, and allows the removal of some `BKE_armature_refresh_layer_used()` from various places.

There is still the issue that there are two functions (`BKE_armature_refresh_layer_used()` and `ED_armature_edit_refresh_layer_used()`) that are both responsible for updating `bArmature::layer_used`. This is a trickier thing to solve, though, as the definition of the `EditBone` struct resides in the armature editor module. This means that blenkernel can't iterate over edit bones, but on the other hand the dependency graph shouldn't call any editor functions either. This is why I left the `ED_armature_edit_refresh_layer_used()` calls untouched.

The downside of recalculating `layer_used` from the dependency graph (at least in the way that I did it now) is that it is called every time a user moves a bone in pose mode. This frequency of updates is not necessary.

Differential Revision: https://developer.blender.org/D7709
2020-05-19 09:39:51 +02:00
888427cabb Fix T76780: Freestyle pass for one scene not accessible in compositor in other scenes
Current implementation would update the nodetree of the freestyle scene not the composite scene.

Reviewed By: Dalai Felinto

Differential Revision: https://developer.blender.org/D7770
2020-05-19 08:24:52 +02:00
fc06c248ed Fix T73169: Side by Side Stereo Rendering Glitches
Side by side and top down views were rendered using an unset matrix.
This fix will reset the matrix just before copying the views to the
screen.

Reviewed By: Clément Foucault, Dalai Felinto

Differential Revision: https://developer.blender.org/D7777
2020-05-19 08:22:05 +02:00
ac8b36535e Cleanup: Creator Args Spelling
Differential Revision: https://developer.blender.org/D7735
2020-05-19 00:54:37 -04:00
5fa58fb8a2 Fix T76821: Generalize Use Flow Tooltip 2020-05-19 00:53:59 -04:00
15bf81268c Fix switching to particle edit-mode from editmode
Similar to T76859
2020-05-19 13:27:08 +10:00
1afa97d547 Fix T76859: Cannot switch from editmode to texturepaint mode
Caused by 5159b8e1ea.
2020-05-19 13:18:10 +10:00
ff7a30d928 Fix sculpt mask interpolation in subdivisions
The interpolation function of the datalayer was misssing so the sculpt
mask data was corrupted every time a subdivision surface modifier was
applied.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7640
2020-05-19 01:31:55 +02:00
7c9c8cee7b Fix T76397: Missing value property on Clear Mask pie menu
Without this value defined it was reusing the same 1.0 value after using
fill mask, so it was not working.

Reviewed By: jbakker

Maniphest Tasks: T76397

Differential Revision: https://developer.blender.org/D7699
2020-05-19 01:07:38 +02:00
497cd3d7dd Fix: T71040 / T58983 Ocean Modifier crashes at high resolutions
This is not as much a fix as a work around, but given the real
involves replacing how we build fftw, it is not eligible for 2.83
which is in BCON3 already.

The root of the issue lies with (how we build) fftw3

The first issue is: fftw does not build with MSVC, there are other
dependencies that are not compatible with MSVC and for those we
build the libraries required with mingw64, same for fftw

The second issue is: for reasons unknown we really really really
liked all deps to link statically so wherever possible we did so.

Now during the building of the fftw it linked a few symbols from
libgcc (which we do not ship) like __chkstk_ms, for which we passed
some flags to stop generating calls to it. Problem solved! There
is no way this could possibly turn around and bite us in the rear.

fast forward to today mystery crashes that look like a race condition.

What is happening is, we tell the linker that each thread will require
a 2-megabyte stack, now if every thread immediately allocated 2 megs,
that be 'rough' on the memory usage. So, what happens is (for all apps
not just blender), 2 megs are reserved but not backed by any real memory
and the first page is allocated for use by the stack, now as the stack
grows, it will eventually grow out of that first page, and end up in
an area that has not been allocated yet, to deal with that the allocated
page is followed by a guard page, someone touches the guard page it's
time to grow the stack!

Meanwhile in FFTW is it's doing substantial allocation using alloca
(up to 64 kb) on the stack, jumping over the guard page, and ending
up in reserved but not yet committed memory, causing an access violation.

Now if you think, that doesn't sound right! something should have
protected us from that! You are correct! That thing was __chkstk_ms
which we disabled.

Given we do not want a dependency on libgcc while building with MSVC
the proper solution is to build fftw as a shared library which will
statically link any bits and pieces it needs, however that change
is a little bit too big to be doing in BCON3.

So as a work around, we change the size the stack grows from 8k to
68k which gives fftw a little bit more wiggle room to keep it out
of trouble most of the time.

Note this only sidesteps the issue, this may come up again if the
conditions are just right, and a proper solution will need to be
implemented for 2.90.
2020-05-18 16:35:53 -06:00
c4ee94328f Fix invalid bit shift when GPU shader attribute is not found 2020-05-18 21:22:02 +02:00
0bdb827bdf Fix NULL pointer access reported by ASAN (harmless in practice but still weak) 2020-05-18 21:20:10 +02:00
e0ae229acb Fix potential crash due to dyntopo GPU buffer invalid memory access
When the number of triangles in a node became zero, the wireframe batch was
not freed along with the triangles batch and could still reference a freed
vertex buffer.

Ref T76858
2020-05-18 21:01:41 +02:00
46a4a53824 Outliner: Fix (unreported) more data-changing operators missing undo. 2020-05-18 17:56:33 +02:00
20b94257dc Fix part of T76544: dyntopo sculpt undo stack memory leak 2020-05-18 17:25:09 +02:00
9bc7ea5496 Fix T76814: [Mantaflow] Surface Tension always works
Initialize the curvature grid and compute the laplacian only if the diffusion flag is set.
2020-05-18 17:19:51 +02:00
fa116a9bbe Fix T76795: Missing node tree update after remove-on-cancel
Reviewers: brecht

Differential Revision: https://developer.blender.org/D7775
2020-05-18 17:08:57 +02:00
0d57ab611c Fix T76851: GPencil brush is reset after change mode
This was introduced by commit rBe58525706328

Now, the brush is not changed when change mode.

Thanks @Alaska for helping with this bug.
2020-05-18 17:04:17 +02:00
6eb00fb02e Fix T76730 DRW: Sorting of empty shading groups.
This is to fix an assert in EEVEE caused by a transparent shading group
that is create but not populated by any drawcall.
2020-05-18 16:59:04 +02:00
cb8d8335b2 Fix T76828 Grease Pencil: Toggle Caps doesn't work
This was a logic error.
2020-05-18 16:01:07 +02:00
19413c4a82 Cleanup: GPencil: Fix float double promotion 2020-05-18 16:01:07 +02:00
121b2c0424 Fix T76799: Crash from undoing the copy-pasting of multiple data blocks.
Bug was actually in outliner code, paste operator would not generate any
undo step...

This was not correct ever, but with new undo code this has become a
critical issue, it cannot survive a situation where current main data
has been changed without a proper undo push.

This illustrates again how much of a catastrophic mess the 'tools'
callbacks of the outliner are currently, it has already caused us quiet
some pain in the past, and will keep doing so until this is fully
sanitized am afraid.

Would strongly suggest getting rid of thosw nasty mix of custom
callbacks requiring manual undo pushes, I do not see the added value of
this compared to regular menus calling regular operators. It only adds
confusion and extra code for nothing...
2020-05-18 15:47:03 +02:00
b487ef6116 Fix T76593: Coordinate limit of 10,000 units
This is no longer needed for number button dragging to work properly.
2020-05-18 21:16:00 +10:00
b75ce05c3b Fix T75292: File-select events not handled while modal handler is active
Reviewers: Severin

Differential Revision: https://developer.blender.org/D7720
2020-05-18 11:59:53 +02:00
008e964940 Fix T76852: Breakdowner remembers limits last used 2020-05-18 18:49:40 +10:00
04d15f1625 Fix T76573: Make links with Multires leading to crash 2020-05-18 10:48:45 +02:00
52d8b3a014 Fix T76849: Duplicate templates show in the New menu 2020-05-18 17:59:52 +10:00
98e18c41b6 Cleanup: unused warning in last commit 2020-05-18 17:11:48 +10:00
2a3797b109 Cleanup: remove NULL checks from object mode switching take #2
Re-apply changes from 54ea356240,
with a poll function that uses the same active object as the operator,
matching other mode switching functions.
2020-05-18 17:07:23 +10:00
ff144edd8c Revert "Cleanup: remove redundant active object NULL check & poll"
This reverts commit 54ea356240 it
introduced crashes when trying to go to edit mode when the active
object was hidden.

Fix T76837
2020-05-18 08:32:07 +02:00
cfea716128 Fix error mixing incompatible enums when generating the proxy name 2020-05-18 16:12:17 +10:00
9af72792a3 Cleanup: quiet enum conversion warning 2020-05-18 14:36:02 +10:00
e5ace51295 Fix T76734: Changing Envelope FModifier controlpoints missing update
Issue is that update functions defined in
`rna_def_fmodifier_envelope_ctrl` (namely `rna_FModifier_update`) are
actually never called.

This is because UI code for FCurve modifiers often does not use RNA
buttons but uses custom update functions (or non at all). For example,
rB9a88bd55903a did this for the generators, envelope control points did
not have this at all.

This is now changed to use RNA buttons for the envelope control points,
this could done for other non-RNA buttons as well to get rid of
'validate_fmodifier_cb()'.

Maniphest Tasks: T76734

Differential Revision: https://developer.blender.org/D7732
2020-05-15 19:29:33 +02:00
abcb23f5a3 Fix T76698: Movie clip stabilize display ignore footage colorspace
settings

Stabilized ImBuf just needs to use the same colorspace and alpha
settings as the original one.

Maniphest Tasks: T76698

Differential Revision: https://developer.blender.org/D7713
2020-05-15 19:08:58 +02:00
001d70eb2b Fix T76277: Remove wrong cast in rna_NodeTree_update
This patch fixes T76277 by removing the incorrect cast from
`ptr->data` to `bNode`. The address of `ptr->owner_id` and
`ptr->data` both point to the node tree. Passing the node tree
incorrectly as a node into the `ED_node_tag_update_nodetree`
corrupts the data, because it attempts to set flags on the
node.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7747
2020-05-15 18:29:42 +02:00
9632a06201 Fix embedded IDs not being enough/properly initialized.
Among other things, they were missing library pointer, session uuid
initialization, etc.

Fix T74546: Corrupted nodegroups crash blender when copy pasting or
appending them.

Fix (unreported) asserts when undoing some production scenes (from
coffee run e.g.).

Initialy caused by rB0aac74f18f2d.
2020-05-15 17:57:13 +02:00
0541906162 Cleanup: rename readfile utils dealing with embedded IDs to proper name. 2020-05-15 16:54:03 +02:00
1cad0a627e GPencil: Fix unreported missing Sculpt/Vertex/Weight paint brushes
This error was introduced wit the change in commit https://developer.blender.org/rB6a850f3cc840

As the brushes were not created, all modes except Edit were broken. 

Now, the brushes and palette are not created when load the file in versioning code, but when the mode is enabled.

Also, if the brush already exist, the parameters are not reset as it was done in the versioning code in order to keep user settings.

The same logic is used for the default palette.
2020-05-15 16:50:38 +02:00
a269761ec1 Cleanup: clang format
Sorry for the noise, somehow missed that in rB0a32f6c8686c.
2020-05-15 16:31:18 +02:00
266caa1820 Fix T76755: texture paint on udims crash
Caused by rB5593efec01c2.

Use first texture if we dont have an ImageUser (instead of multiview
one). Same fix as in rB9ace7e243978 / T74925.

Maniphest Tasks: T76755

Differential Revision: https://developer.blender.org/D7743
2020-05-15 15:56:35 +02:00
fe0036c586 Fix T76563: Transforming an auto-aligned point won't set it aligned
When local origins are used or a single control point is selected,
change the handle types from auto to aligned.
2020-05-15 23:13:57 +10:00
0a32f6c868 Fix T76710: objects get lost in linked/overridden collections
Right now:
- drag-drop in the Outliner prevents dropping inside linked collections
- drag-drop in the Outliner allows dropping inside overridden
collections (should not be the case)
- `Object Properties` > `Collections` panel allows to add to overridden
collection (should not be the case)
- `Object Properties` > `Collections` panel filters out non-local
collections (so adding to linked collections is forbidden)
- `bpy collection.objects.link()` allows to add to linked collections
(should not be the case)
- `bpy collection.objects.link()` allows to add to overridden
collections (should not be the case)

While this might be supported in the future for overriden collections,
these cases should not be allowed atm. since objects get lost on file
reload.

Note: for the case of the `Object Properties` > `Collections` panel,
this could be improved further to filter out overridden collections as
well.

Reviewers: mont29, brecht

Subscribers:
2020-05-15 13:32:15 +02:00
0ae64a9945 Fix T76695: Not exporting normals properly in Alembic format
When auto-smooth enabled, but no custom normals layer present, the Alembic
exporter would incorrectly assume the mesh was shaded smooth. This is now
corrected, and normals are always written when auto-smooth is enabled.
2020-05-15 12:58:48 +02:00
7049d2dc58 Fix T76778: Dopesheet "Show Errors" affects timeline
Since the timeline is a variation of the dopesheet, it also respects
some of the dopesheet settings.

The "Selected Only" setting is overridden from a scene property (since
rB4904eadc0f38) and the "Display Hidden" dopesheet setting seems to be
ignored.

This commit adds the remaining "Show Errors" setting to the menu,
allowing it to be updated from the timeline.
2020-05-15 11:54:17 +02:00
19d822c677 Fix T76740: Static Override - Library Override Crash
Missing proper tagging of 'backward' pointer from fcurve to its group in
RNA would lead to infinite loop...

Issue was triggered by override, but crash could be generated from other
places as well (like from py console), on any action actually...
2020-05-15 10:46:55 +02:00
3c0fd51cf4 Fix T76738: Duplicate brushes cause assertion on undo 2020-05-15 17:45:41 +10:00
6a850f3cc8 Fix duplicate ID's being created when appending/linking
This removes grease pencil brush creation/dat-block delete on load,
since this causes duplicate data-blocks.

Add assert to prevent this happening in the future
since the error is isn't obvious.
2020-05-15 17:42:01 +10:00
c361f911f9 Fix error versioning paint-slots pre-2.80 2020-05-15 16:51:33 +10:00
4ce1829289 Cleanup: don't check flags as booleans
Causes unexpected behavior when adding new flags.
2020-05-15 12:47:47 +10:00
f716bb3b71 GPencil: Add licence text at header 2020-05-14 21:49:44 +02:00
6716baa1f7 Fix T76476 EEVEE: Invalid Vector to Float conversion for nodegroups
The previous code only handled the RGBA socket case. For vectors, we simply
use the average of the 3 compoments. This is done using a temp Vector Math
node using the dot operation.
2020-05-14 19:57:51 +02:00
5f31e5031c GPencil: Fix unreported problem filling textured strokes
The internal image used for filling was not correct when the texture was used in stroke and this makes impossible get a right filling.
2020-05-14 19:53:55 +02:00
Tautvydas Andrikys
33ce0cb5a1 Fix T63588: Cycles unnecessarily updates background importance sampling map 2020-05-14 17:56:50 +02:00
5940485369 Fix T76168 Workbench: Shadows behind a culled backface are inverted 2020-05-14 17:41:05 +02:00
16d8a683be Fix T73984: unnecessary Cycles viewport updates with object texture coordinates
Remove old code that added extra updates for shaders that have a dependency on
objects. The dependency graph can now tell Cycles when a material is affected by
an object transform.
2020-05-14 17:39:37 +02:00
72492eb2a2 Update RNA Manual References after camera fix
There was no link to the base camera* properties (e.g., lens).
2020-05-14 17:13:52 +02:00
78e3b7c28d Sculpt: Render Face Sets always as flat shading
This removes the smooth shading rendering from the face set overlay when
smooth shading is enabled.

Reviewed By: jbakker

Maniphest Tasks: T74906, T74622, T75331, T76530

Differential Revision: https://developer.blender.org/D7105
2020-05-14 16:47:50 +02:00
e585257063 GPencil: Changes in 2D template
Differential Revision: https://developer.blender.org/D7619
2020-05-14 16:31:51 +02:00
Ankit
b7386c66f9 Fix T76150: Viewport Axes not toggling correctly when 'Floor' and 'Grid' are turned off
Fix T76150
While comparing with the deleted file [1] in the commit [2], saw this
little addition which most probably was added for optimisation.
Removing it fixes the behaviour too.

To test:
- In Viewport Overlays > Guides, uncheck both Grid & Floor.
- Try toggling all three axes individually.
- Z just sticks. X cannot be shown without Y enabled.

[1] https://developer.blender.org/diffusion/B/change/master/source/blender/draw/modes/object_mode.c;9516921c05bd9fee5c94942eb8e38f47ba7e4351
[2] {rB9516921c05bd9fee5c94942eb8e38f47ba7e4351}

Reviewed By: fclem

Maniphest Tasks: T76150

Differential Revision: https://developer.blender.org/D7568
2020-05-14 16:22:55 +02:00
ada03e8673 UI: Fix Unreported missing background for azone arrow
This was caused by the sRGB viewport changes. The fix is to modify the
alpha values manually. The shader was also missing a srgb fix.
2020-05-14 16:16:29 +02:00
0909b564a9 Fix T76413 Gizmos: Trackball's preselection highlighting is too bright
This was caused by the sRGB viewport changes. The fix is to modify the
alpha values manually.
2020-05-14 16:16:29 +02:00
c233271b0b Fix T76126 Overlay: Glitch when hiding Nurb vertices 2020-05-14 16:16:29 +02:00
97f50c71b9 Fix --debug-cycles printing CUDA devices twice
Reuse the CUDA devices list for Optix device detection.
2020-05-14 16:07:22 +02:00
16b9841fc1 Cleanup: Remove unused variable 2020-05-14 15:09:12 +02:00
Jeroen Bakker
7965c735f1 Fix T73286: Projection Painting Dense Mesh Bleed
When projection painting a dense mesh a face can be marked
PROJ_FACE_DEGENERATE when it is too small. Degenerative faces are
handled differently and as documented can create incorrect results.

Not sure what these incorrect results are and if there could be a better
solution for handling these results.

This fix would only mark a face degenerative when all the verts are the
same.

Reviewed By: Campbell Barton

Differential Revision: https://developer.blender.org/D7662
2020-05-14 14:30:02 +02:00
Jeroen Bakker
eb23b39b7f Fix T76558: Decreasing Viewport Anti-Aliasing Samples Makes Scene Whiter
When setting the Viewport Anti-Aliasing samples in the user preferences
to a lower sample count the anti-aliasing was not reset. This lead to
incorrect result as the accum buffer would still hold the values of the
larger sample count.

This fix resets the TAA when the sample count is changed.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7728
2020-05-14 12:44:42 +02:00
Jeroen Bakker
80fffba132 Fix T76729: Particle Hair Get Occluded by Overlays
When using an external render engine Blender will still draw an OpenGL
depth buffer for the overlay engine to work correctly. Particle systems
were ignored, what lead to occluded hair and other artifacts.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7730
2020-05-14 12:43:14 +02:00
a88316b4a6 Cleanup: Remove uneeded loop
The Region loop was not required.
2020-05-14 12:29:44 +02:00
Jeroen Bakker
7d38f50367 Fix T75908: Sculpt GPU Batches + Render Artifacts
When sculpting the GPU batches are constructed with only the required data
for a single viewport. When that viewport changes shading or coloring mode (object
to vertex) batches might not hold all the needed information.

There is also a case when you have two 3d viewport one in object color
mode and the other in vertex color mode that the GPU batches were
updated without any vertex colors.

In order to fix these category of issues this patch would always
construct the full GPU batches for sculpting.

Reviewed By: Clément Foucault, Pablo Dobarro

Maniphest Tasks: T75908

Differential Revision: https://developer.blender.org/D7701
2020-05-14 11:58:33 +02:00
975c45df9a Cleanup: don't use deprecated exception specifications
Usage of exception specifications is discouraged by the C++ core guidelines.
2020-05-14 11:24:50 +02:00
9ebb3a386e Fix T76732: Error detecting modifier key clicks
At the time of checking, the previous type isn't the last key pressed.
2020-05-14 18:02:37 +10:00
fee46615f4 WM: include previous value, type in event printing 2020-05-14 17:59:14 +10:00
e22ea3dc0e Cleanup: sync clang-format with master
Avoid noisy diff's & conflicts.
2020-05-14 17:11:24 +10:00
1cbc3a8f2b Fix undo-push assert for some modes with zero undo steps
Also fixes files not being tagged as modified with zero undo steps.
2020-05-14 15:18:51 +10:00
0cd9b1243c Fix sculpt/paint missing undo-step limiting 2020-05-14 14:52:07 +10:00
95a47ff226 Cleanup: move assignment out of loop 2020-05-14 13:52:56 +10:00
4341b5b2fe Fix T59954: View all Sequences doesn't show all sequences
Set boundbox_seq start X minimum value to SFRA.

This should be part of rBf66b5edf98c9, but I forgot to include this change.
2020-05-14 04:10:29 +02:00
27ef012ac7 Fix T52782: crash rendering more virtual parent particles than children 2020-05-14 03:42:09 +02:00
ec324d8741 Fix T59089: --engine command line option does not affect 3D viewport render 2020-05-14 03:08:08 +02:00
2c61b7f354 Fix T75071: rendering fails when all render layers disabled, but using compositor 2020-05-14 02:45:43 +02:00
88841559de Fix T66005: crash deleting render slot while rendering to it 2020-05-14 02:38:02 +02:00
e2eb47191d Fix T75715: crash rendering animation with persistent images 2020-05-14 02:14:18 +02:00
bd18ffe1f8 Fix T76388: Freestyle not respecting Show Emitter settings 2020-05-14 02:14:18 +02:00
71298a1da9 Revert "GPencil: Add new X-Ray option for Canvas Grid"
This reverts commit fd025b0b7a.
2020-05-13 22:48:52 +02:00
5ee71320c6 Revert "GPencil: Change tooltip"
This reverts commit 7b688a6b04.
2020-05-13 22:48:44 +02:00
7b688a6b04 GPencil: Change tooltip 2020-05-13 22:44:15 +02:00
fd025b0b7a GPencil: Add new X-Ray option for Canvas Grid
In some situations is good to have a grid visible anot beeing occulde by meshes.

By default is OFF.

Differential Revision: https://developer.blender.org/D7721
2020-05-13 22:44:04 +02:00
16cc424bc5 Fix T75365: memory leak when writing PNG fails due to lack of disk space 2020-05-13 21:22:06 +02:00
2bc5c18714 Fix wrong Volume object step size tooltip 2020-05-13 21:22:06 +02:00
5e96c43854 Fix T76556: Apply parenting when joining parent into object
The current behavior isn't necessarily "incorrect," but it's unintuitive
and confusing. A simple fix is to apply parentinv before finishing the
operator.

However, there may still be issues when the object's parent has a parent.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7723
2020-05-13 15:21:30 -04:00
2b5e301ea4 Fix T75574: Instant crash: averaging custom normals on model.
Fairly critical code mistake actually, since it uses malloca,
BLI_smallstack should *never* be declared inside a loop...

Also optimized handling of the `loop_weight` heapsimple, we can also
only create and use a single one for all edited objects...

Found two other operators potentially affected by same issue (split
normals, and weld edges into faces).
2020-05-13 18:47:44 +02:00
c7f74863dd Fix T76711: override data-blocks could be renamed in the outliner
Overriding datablock should never have an editable name.

This also moves the check for linked/overridden datablocks above the
check for master-collection (otherwise a linked/overriden collection
could still be renamed)

Maniphest Tasks: T76711

Differential Revision: https://developer.blender.org/D7718
2020-05-13 15:30:16 +02:00
5159b8e1ea Fix extra undo step when switching object modes
Changing between modes would always add a user visible undo step
that set object mode.

Avoid storing this extra undo step on object mode switching.
2020-05-13 23:14:01 +10:00
54ea356240 Cleanup: remove redundant active object NULL check & poll
This was from 66da2f537a but never did anything,
as a NULL object always exited at the beginning of the operator.
2020-05-13 23:14:01 +10:00
4e32398668 Cleanup: unused arg 2020-05-13 23:14:01 +10:00
cbcc15bdaf Fix T65426: GPencil mirror modifier doesn't work as expected
The mirror was not working if the original object had transformations.

Also some code cleanup.
2020-05-13 13:00:24 +02:00
2afb597572 Fix T76665: Wrong files selected when using box select
Reviewers: Severin

Differential Revision: https://developer.blender.org/D7705
2020-05-13 12:50:14 +02:00
eb27595ac4 Fix T76703: GPencil bone parenting missing dependency update
Maniphest Tasks: T76703

Differential Revision: https://developer.blender.org/D7715
2020-05-13 11:30:37 +02:00
cda25f8f38 Fix T76646: Crash when changing Size in Add Cube pop-up in some cases.
Remove resetting of ID uuid session counter, it is not really needed
anymore, and not trivial to do this properly everytime.

Thanks @brecht for investigating this.
2020-05-13 10:37:02 +02:00
79511fca20 Fix zero tablet pressure for simulated events
Impacted sculpt/paint tests.
2020-05-13 18:19:54 +10:00
0e0ebdb65c Fix crash accessing the clipboard
The clipboard can change between checking it's length and
copying into the allocated buffer.

Move this from RNA to the C/Python API.
2020-05-13 16:01:26 +10:00
75d0287cee PyAPI: support PyGetSetDef when extending RNA types
Support extending properties as well as methods.
2020-05-13 15:57:29 +10:00
8f4f3cce03 Cleanup: split RNA type extension methods into it's own API
This isn't so closely related to the RNA API,
it's a way to use the C/Python API to extend RNA types
and can be in it's own file.
2020-05-13 15:54:09 +10:00
13130ca293 Cleanup: warning 2020-05-13 15:47:51 +10:00
9253386dcb Fix T76488: fix mask extract poll function
This was returning true in edit mode, causing the crash

Reviewed By: jbakker

Maniphest Tasks: T76488

Differential Revision: https://developer.blender.org/D7645
2020-05-13 02:59:31 +02:00
05dd9ca06c Fix T75347: Update cloth brushes in versioning with a valid mass value
The file attached in the report has a cloth brush saved with a particle
mass of 0.0, which causes all sort of issues in the solver. I don't know
how that brush was created, but it does not seems to be possible to do
in the current version (reset values are correct, property limits are
correct and a default brush is created in versioning_defaults). This
resets all brushes with an invalid value to 1.0.

Reviewed By: jbakker

Maniphest Tasks: T75347

Differential Revision: https://developer.blender.org/D7698
2020-05-13 02:55:30 +02:00
ce35cfd208 Fix T76306: Disable use creases when there is displacement data
Use creases changes the limit surface, so the displacemente data is
won't be correct if this option is modified without updating the
displacement.

Reviewed By: sergey

Maniphest Tasks: T76306

Differential Revision: https://developer.blender.org/D7700
2020-05-13 02:52:46 +02:00
bf0a554114 Fix T75968: PBVH raycast returns wrong active vertex
nearest_vertex_co was not reset when a new triangle was intersected by
the ray, so it was always returning the closest vertex to the real
cursor position in any triangle, which was not always the triangle under
the cursor.

Reviewed By: sergey

Maniphest Tasks: T75968

Differential Revision: https://developer.blender.org/D7485
2020-05-13 02:49:38 +02:00
50ef801a79 Fix T76320: Thread race condition on undo with prefetching enabled
Stop prefetch jobs before undoing.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7633
2020-05-13 00:10:58 +02:00
be69f23b68 Fix T70612: Sequencer Crash on enabling Prefetch
Disable (skip) preftching scene strips if they target 3D scene.
Try to continue prefetching complete frame if disk cache images are found.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7514
2020-05-12 23:13:18 +02:00
4930eb15f7 Fix T74012: missing fluid simulation domain panels in workbench
Maniphest Tasks: T74012

Differential Revision: https://developer.blender.org/D7706
2020-05-12 22:19:53 +02:00
829dce524d Fix T72920: Snap package fails to play audio and blocks audio in other apps
ALSA and OSS are not available for the snap packages, and trying to initialize
them seems to cause some problems for other applications. Instead configure
OpenAL and SDL to use PulseAudio, and set PULSE_SERVER environment variable to
make it work.
2020-05-12 21:52:43 +02:00
a5eee1f935 Fix T76535: Eevee + Freestyle render crash with many strokes
Freestyle would create a huge amount of material slots with the same material,
causing issues in Eevee use of alloca().
2020-05-12 21:51:12 +02:00
bfdb27f494 Fix incorrect assert in Cycles node socket get/set functions
Thanks to Subrahmanya Oruganti for spotting these.
2020-05-12 21:50:49 +02:00
80953aed33 Fix CMake using different OpenEXR / USD includes and libraries in some cases
Search for all potential library names in each directory, otherwise e.g.
libImath-2_2.a from a system directory will be preferred over libImath.a even
if we specified a directory.
2020-05-12 21:50:49 +02:00
122a3169e2 Fix missing standard OpenColorIO roles, as reported by ociocheck
These are not used by Blender, but can be used by other software using our
configuration.
2020-05-12 21:50:42 +02:00
ac1a6565df Fix T76113 GPU: Crash closing file browsers with AMD GPUs
This fixes crash in the free mesa driver for amd gpus. This crash seems to
only happen on linux.
2020-05-12 18:00:00 +02:00
f24e9bb038 GPencil: Add new parameter for SMAA threshold
This parameter allows to define the threshold for SMAA algorithm.

Differential Revision: https://developer.blender.org/D7708
2020-05-12 17:48:28 +02:00
be4b3c64ad Fix T74694: Sculpt Mask Influences Weight/Vertex Paint Drawing
Sculpt overlay assumed that the sculpt session was always in sculpt
mode. But the sculpt session was also used for Vertex/Weight painting.
This resulted that when a mask was defined in the sculpt mode this
resulted into render artifacts.

This patch adds a check to see if the object has a sculpt session for
OB_MODE_SCULPT.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7704
2020-05-12 16:21:38 +02:00
8da7ab11cf Fix T76053: Rigid Body properties disappears after deleting rigid body constraint object and undoing.
Since we re-use same addresses of IDs with newly read data, and never
remap old IDs to 'proper' 'old' ID pointers, it implies that old IDs
being deleted will have many ID pointers to new, valid data that we want
to keep.

In general anyway, code from IDTypeInfo (i.e. low-level ID management
code) should never do anything outside of its own ID scope, we cannot
guarantee that given ID is in fully valid state regarding its relations
to other data-blocks.
2020-05-12 16:13:52 +02:00
08b4c9a815 Multires: Correct NULL-pointer check
There is some hard-to-reproduce scenario when top level
would have masks allocated, but without masks on the sculpt
level.

Need to check proper array before accessing its elements.
The check for top-level masks is done by the caller.
2020-05-12 15:49:31 +02:00
94cbfb71bc Fix T76132: Can't import Alembic with changing UVs
In the Alembic importer, the animation of UVs and normals was
overlooked; when the mesh geometry is not animated, the entire mesh was
considered constant.

T76132 concerns both the exporting and importing of changing UVs. This
commit fixes the importing.
2020-05-12 15:07:09 +02:00
65574463fa Fix T76132: Can't export Alembic with changing UVs
In the Alembic exporter, UVs were only exported on the first frame. This
is an issue, as when exporting an animated mesh the topology can change,
and then the UV coordinates of the first frame are no longer valid.

T76132 concerns both exporting and importing changing UVs. This fixes
the exporting.
2020-05-12 15:07:09 +02:00
e5bb02aaa4 Fix T76669: Crash when doing right click on channel
Reviewers: lichtwerk, sybren

Differential Revision: https://developer.blender.org/D7702
2020-05-12 14:47:21 +02:00
65381e220e Fix T76507: Reading clipboard blocks keyboard input on X11 2020-05-12 22:09:11 +10:00
2b7741003e Cleanup: tag unused function 2020-05-12 22:09:03 +10:00
973ab436f0 Fix T76514: Invalid geometry in Alembic crashes Blender
Even though {T76514} is caused by invalid geometry, and thus technically
constitutes a bug in the software that created the Alembic file, I would
like Blender not to crash on importing such a file.

The error in the Alembic file consists of invalid mesh loops, where
consecutive loops refer to the same vertex. The `BKE_mesh_validate()`
can actually correct these errors, so this commit focuses on two things:

- Letting Blender survive the situation until the mesh is loaded, and
- Detecting the error so that `BKE_mesh_validate()` can be called only
  when necessary. This ensures there is only a minimal impact on
  performance when loading actually valid data.

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

Reviewed By: JacquesLucke
2020-05-12 13:58:40 +02:00
fffcb6e480 Fix T74818: improve tooltip for initial fluid velocity 2020-05-12 13:55:58 +02:00
cfbcc94451 Fix T75492: Only positive shrink factor values can be animated
A better fix would probably be to check if the value is animated,
but I'm not sure how to do that.

Reviewers: zeddb

Differential Revision: https://developer.blender.org/D7692
2020-05-12 12:22:36 +02:00
a50c131a0d Fix T75889: Cannot bake mantaflow via Python API
The issue was the usage of the global `__main__` Python module.
When running scripts in the text editor, Blender would overwrite
the `__main__` module.

Reviewers: sebbas

Differential Revision: https://developer.blender.org/D7690
2020-05-12 12:18:09 +02:00
2008bcb0bb Fluid: remove special treatment for running Python code on windows
We discussed this in D7690 and could not find a reason for this
code anymore. It might just be leftover from some even older code.
2020-05-12 12:18:09 +02:00
390d27548c Cleanup: Remove print statement 2020-05-12 12:05:48 +02:00
d896df3ccd Fix T73973: GPencil Fill fails when zoom the image
The problem was related of how the initial pixel to create outline was detected. Now, a limit is set for any image to keep a fillable image in all situations, not only when some strokes contain the fill.
2020-05-12 10:35:56 +02:00
c1d8eb01c5 GPencil: Cleanup wrong ID delete
Differential Revision: https://developer.blender.org/D7691
2020-05-12 10:35:49 +02:00
Jeroen Bakker
24140444f2 Fix T75556: Select Emitter Object via Hair
{rB3685347b4172} introduced a conservative depth rendering for
selection. The conservative depth rendering assumed that all geometry
are triangle based. Hair is lined base.

This patch will use a normal depth shader for rendering hair.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7661
2020-05-12 07:58:37 +02:00
eaa21df505 Fix T71882: Offset Edge Slide doesn't switch selection mode
Based on D6335 with modifications.
2020-05-12 14:38:01 +10:00
Anthony Edlin
750b370c25 Fix EDBM_selectmode_disable_multi_ex return value
This always return changed, even when no changes were made.
2020-05-12 14:33:29 +10:00
bff679f8f9 UI: add offset edge slide to edge menu
This was only available in the context menu which only shows
when the selection was set to edge-mode, even though this
works in other modes.
2020-05-12 13:53:46 +10:00
8770f35305 Cleanup: remove DNA_screen_types.h, use struct qualifier
Also remove draw-manager & depsgraph headers in interface_icons.c

Change this in 2.83 to prevent merge issues in master with
interface_intern.h header.
2020-05-12 12:46:29 +10:00
5852f97dc2 API Docs: Fix broken url markup 2020-05-11 21:35:33 -04:00
8956e9e5f6 Fix mathutils box_pack_2d docstring
Differential Revision: https://developer.blender.org/D7667
2020-05-11 21:18:42 +02:00
a116912fd6 Fix (unreported) greasepencil crash calling transform_fill from outside
3DView

Operator relies on 3DView, poll for it.

Spotted while looking into T76522.

Reviewers: antoniov

Differential Revision: https://developer.blender.org/D7665
2020-05-11 20:46:13 +02:00
acd5f5285e Fix T76538: Prevent nodesocket creation on certain nodes
- no sockets on Frame nodes
- no Input sockets on Group Input nodes
- no Output sockets on Group Output nodes

Maniphest Tasks: T76538

Differential Revision: https://developer.blender.org/D7671
2020-05-11 20:26:00 +02:00
365e9cb6aa Overlay: Replace depth blitting by GPU_texture_copy
This is an attempt to fix the related T74243.
2020-05-11 17:53:45 +02:00
a1363f74bf Fix T76216 Workbench: Glicht when switching from quad views to normal view
This was because of the use of uninitialized buffers for TAA.
This patch is a quick fix for the issue which is a missing tagging for a
complete viewport update.
2020-05-11 17:53:45 +02:00
e3861b949a DRW: Fix debug performance stats 2020-05-11 17:53:45 +02:00
4e1a6b48e7 Fix T76559: Crash after deleting material leaves invalid pointer in node editor.
No idea why node editor remap callback was only handling scene IDs (and
not any other ntree owner)...

Note that this should be a safe fix, but it unvails a nice can of worm,
at some point we should ba able to handle all of that through libquery
only, get rid of editor's remap callbacks, and probably sanitize usages
of ID pointers by some of them, like that nodetree editor.

Current situation remains a fairly fragile mess...
2020-05-11 17:24:56 +02:00
249ccab111 Fix T76621: UILayout.prop_search() broken for data-block names
If the search menu was used for a string property, and a data-block was
selected from the search, the value set would be an invalid name. The property
would get the modified UI string, not the proper data name set.

Mistake in rBd6cefef98f87.

This is more of a temporary fix to make the menu behave like before above's
commit. So the library hints this added will not be shown for string properties
anymore. This would need further changes in the UI code (see
https://developer.blender.org/P1380) but is too unsafe for 2.83 at this point.
Even if this is done, the note below still applies.

NOTE: Data-blocks should not be referenced by name only, as it's possible to
have duplicate data-block names with linking and especially with library
overriding.
Instead, pointer properties should be used, `UILayout.prop_search()` can then
properly deal with linked and overridden data-blocks.
2020-05-11 17:13:04 +02:00
Sergey Sharybin
27e3361eb5 Fix T74713: Unpredictable active texture node for Workbench
The selection operator was not being correctly marked for update.
This restores the behavior seen in blender 2.79.
2020-05-11 10:44:19 -03:00
86a16e7381 Fix T76512: Sculpt mode: crash when applying base
Differential Revision: https://developer.blender.org/D7663
2020-05-11 15:26:09 +02:00
815855b91b Fix T76642: Incorrect behavior limiting undo steps 2020-05-11 22:20:51 +10:00
3d3a75fc2a Fix T76598: GPencil - Set a lower limit for Thickness modifier
The old value was too high. Now, the limit of pressure is 0, but anyway, the stroke will be always visible because there is a minimum thickness of 1 pixel.
2020-05-11 13:55:21 +02:00
668867558e UI: apply vertical tool-tip offset in pixel-space
Was applying in ui-block space which changed offset
at different zoom levels.
2020-05-11 18:30:02 +10:00
d6f48e21fc Cleanup: unused arg, clang-format 2020-05-11 18:08:21 +10:00
0461727553 Fix T75998: Precision of 'Unit Scale' and 'Grid Scale' are mismatched
Change hard limits of scale_length RNA property to 1e-9 - 1e+9.
This makes it easier to work with small or large metric units.
2020-05-11 07:23:22 +02:00
eaee2b4119 Fix T36263: Pasted strip doesnt have F-Curve keyframes from the original
Original code for copying strips tried to change strip name 2 times before
copying and once again after pasting.

Store structs in clipboard in unchanged state, so we can reference data after
pasting easily.

Better method would probably be storing animation data in clipboard as well,
so we can copy animated strips even between scenes.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7638
2020-05-10 08:26:24 +02:00
a1b3effd55 Fix T71300: Crash on rendering scene recursively from sequencer
Adding recursive scenes has been disabled, but old files still can be opened.

Add check if scene will render itself.
Opening such file will produce warning on open and error on running render.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D7562
2020-05-10 07:51:20 +02:00
Robert Guetzkow
ce76e17584 Fix T65012: Update depsgraph for matcap flipping
The matcap flipping didn't work with the workbench engine in rendered mode because
of a missing depedency graph update. This commit tags the scene id for a dependency
graph update in `toggle_matcap_flip`.

Reviewed By: fclem, sergey

Differential Revision: https://developer.blender.org/D7657
2020-05-08 16:49:54 +02:00
b1c4db1fbe Fix T76484: Infinite event handling when loading with load_ui=False
When loading a file from the Python console with load_ui=False,
the event was never freed from the queue causing the command
to continuously be executed.
2020-05-08 18:55:24 +10:00
7f5570ceff Fix T76324: face set operators not working from Python console by default
Operators should almost always implement exec() so that they can work without
user event input. In this case there was no reason to have invoke() at all
since no event is needed.
2020-05-08 02:02:49 +02:00
2a8ba9c08e Fix T76471: timer not removed after changing file browser to another type
The file browser exit() callback was not called. RNA get functions should never
modify data, here the area type info to be changed before the screen and area
were properly updated.
2020-05-08 01:51:40 +02:00
7a4e045d8f Fix T76525: crash drawing metaballs with multiple material slots 2020-05-08 00:51:32 +02:00
e6dd29ce6e Fix T75958 Overlay: Blender Crashes when selecting without Depth Picking 2020-05-07 23:33:01 +02:00
933c721ccb Fix T76045 Gizmo: line_width does not work in latest version 2020-05-07 23:33:01 +02:00
4d5af14852 Fix T76393 Gizmo: Crash on assert(batch->program_in_use == 0)
This also fix line width support for button2D shape batch
2020-05-07 23:33:01 +02:00
05fafb05b1 Fix T76510: Eevee OpenVDB render artifacts due to texture clamping 2020-05-07 22:02:39 +02:00
5473f0c49d Fix T76468: volume sequence render not using correct frame in renders
Render datablocks were copying state from original datablocks, where the frame
number and loaded volume grids were out of sync.
2020-05-07 21:14:30 +02:00
d8c3aad800 GPencil: Add support for Link Modifiers
This adds support to the Link modifiers data. This was missing.

Also I did a small cleanup using LISTBASE_FOREACH macro.

Related to T76478

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D7643
2020-05-07 15:12:36 +02:00
Nicolas Fauvet
1c0e22b982 VR: Fix OpenXR state freeze on Oculus after taking off HMD
With the Oculus runtime, the VR session would freeze when taking off the HMD
and putting it back on. This was caused by the deletion of graphics resources
too early in the OpenXR state machine, at least for Oculus.
The resources will now only be freed once the session is actually destroyed.

Also fixes an issue where it wasn't possible to stop the session via the UI
when the HMD was taken off.

Reviewed By: Julian Eisel

Differential Revision: https://developer.blender.org/D7635
2020-05-07 14:38:10 +02:00
Jeroen Bakker
ed1fb242a8 Fix T76469: OpenCL 1.2 Compilation
Recent changes assumed OpenCL 2.0 platform. This adds a check to see if
we are compiling on an OpenCL 2.0 platform.

Patch was tested on:
* AMD Radeon Pro WX 7100 with amdgpu-pro-19.50-1011208-ubuntu-18.04 drivers
* AMD Vega 64 with amdgpu-pro-20.10-1048554-ubuntu-18.04 drivers
* AMD RX 5700 with amdgpu-pro-20.10-1048554-ubuntu-18.04 drivers

Reviewed By: Brecht van Lommel

Differential Revision: https://developer.blender.org/D7637
2020-05-07 14:34:50 +02:00
18dbc8f5c1 Resolve keymap conflict for poselib
Caused by rBe07b245fe1f4 (new 'Select Linked' posemode op).
Above commit took CTRL+L (and this is kept for consistency with other
'Select Linked' operators).

So now keymap for poselib is:
poselib browse: ALT+L (was CTRL+L -- conflict here)
poselib add pose: SHIFT+L (same as before)
poselib remove pose: SHIFT+ALT+L (was ALT+L)
poselib rename pose: SHIFT+CTRL+L (same as before)

ref. D7542
2020-05-07 13:22:13 +02:00
2a2aa6abd0 Fix T75793: Mirror modifier UV flip only works on first UDIM Tile
Was flipping around the 0-1 range, now (optionally) flip around each tile.

Also added this option for BMesh bmo_mirror.

Reviewed By: campbellbarton

Maniphest Tasks: T75793

Differential Revision: https://developer.blender.org/D7460
2020-05-07 12:48:58 +02:00
3fed85f9d2 Fix T76500: Annotation Tooltip in Movie Clip Editor is using old grease pencil text 2020-05-07 12:16:33 +02:00
9605c26166 Fix Python error in scene without sequencer 2020-05-06 18:18:32 +02:00
c57f65c088 Fix T76440: Follow Track -> Constraint to F-Curve has no effect
Differential Revision: https://developer.blender.org/D7630
2020-05-06 11:11:32 -03:00
11d440f1a2 Fix T76430: Quick smoke not rendering Cycles and Eevee
Temporary fix that will skip cache invalidation from flow / effector objects.
2020-05-06 13:25:00 +02:00
7043f8b815 Fix T76416: Armature Deform parenting option doesn't work with Grease Pencil objects
If we parent with type `PAR_ARMATURE` (where vertexgroups are already
set up and named correctly according to the corresponding bones), we
still need an armature modifier. This just wasnt added.

In contrast to meshes [which add their armature modifier early in
`ED_object_parent_set`], grease pencil used to do this (adding the
armature modifier) in `ED_gpencil_add_armature_weights`.

Now split ED_gpencil_add_armature_weights in two:
- ED_gpencil_add_armature
- ED_gpencil_add_armature_weights (which calls ED_gpencil_add_armature)
- use ED_gpencil_add_armature for the PAR_ARMATURE case

Maniphest Tasks: T76416

Differential Revision: https://developer.blender.org/D7625
2020-05-06 12:26:56 +02:00
c98240139e Fix T76470: GPencil sequence interpolate crash when not enough frames in layer
If try to interpolate a layer without an active a next frame, the interpolation failed.

Now, check for both frames before start interpolation.
2020-05-06 12:21:53 +02:00
c6aa014d3a Fix T76445: Selecting an object no longer cycles past the active
In 2.79, selecting an object would cycle past the first object
even if selection cycling wasn't in use.

Restore this behavior as it wasn't intentionally removed
and it's useful to be able to select an object behind the
current active object.
2020-05-06 12:18:18 +10:00
c036ef1369 Fix T76392: Crash loading app-template with Load UI disabled 2020-05-06 08:28:20 +10:00
39ea222339 Cleanup: warnings 2020-05-06 08:18:00 +10:00
e6fab27d6a Fix T75743: Implement restore for brushes that modify their own data
This implements the restore function for Draw Face Sets and Layer, which
don't affect coordinates or masks directly. This is needed for the
anchored and dot brush strokes.

Layer frees the current displacement and a new one is created on each
stroke sample. Draw Face Sets copies the data back from the first undo
node to the mesh datalayer.

Also fixes T75727

Reviewed By: jbakker

Maniphest Tasks: T75727

Differential Revision: https://developer.blender.org/D7442
2020-05-05 17:14:30 +02:00
9d8a583482 Fix T76414: crash using Python module that uses NVRTC
Hide the nvrtc* symbols just like we did for cu* already.
2020-05-05 16:01:18 +02:00
bb7a23bdff Fix build with precompiled libraries picking up OpenEXR from install_deps.sh 2020-05-05 15:06:49 +02:00
d97c83712c Cycles: mark CUDA 10.2 as officially supported
It appears to work fine after a recent bugfix and testing for the past few
weeks.
2020-05-05 15:06:49 +02:00
da48defcfa Fix T76402: App templates prevent factory settings theme reset 2020-05-05 19:20:53 +10:00
36ad59b550 Fix T76224: Grid fill offset doesn't work
Regression in own recent commit b1037aa88f.
2020-05-05 13:13:48 +10:00
d8133b3eb9 Fix T76318: lower part of new preferences window does not work
Regression after recent changes. The precise cause is unclear to me, but
we do not need to update the size right after creating a new window.
2020-05-04 23:58:58 +02:00
ac6be6759e Fix Cycles Python error when device name is not a valid UTF-8 string
This may fix or help diagnose T76378.
2020-05-04 23:07:01 +02:00
8b5868cc15 Fix T75883: Smoke simulations with Adaptive Domain broken for 'Final' bakes with OpenVDB in 2.83
Config files always use the .uni extenstion.
2020-05-04 18:16:09 +02:00
0c8b872188 Fix T76355: USD test fails in debug mode
Thanks @LazyDodo for the help!

No functional changes.
2020-05-04 18:03:19 +02:00
4a38a12024 Fix T76251: Animated procedural texture does not influence particle system
Dependancy missing while building depsgraph for particle systems.
fix: adding a relation texture->particles when texture has animation data.

Reviewed By: sergey

Maniphest Tasks: T76251

Differential Revision: https://developer.blender.org/D7573
2020-05-04 17:48:26 +02:00
1222f561a2 Revert "Fix T76313: Redo in Multires doesn't bring back stroke made after a subdivide"
The fix was actually missing few bits:

- Firstly, the operator itself is not to do UNDO push
- Secondly, multires sculpt/top level are not pushed to the undo
  node, so undo can not happen reliably.

It should be possible to incorporate some of the work from WIP patch
for propagation undo, but it needs more work.

Reverting code base to the previous state, since currently things
are actually a bit more confusing then they used to be.

This reverts commit 0c928087a3.
2020-05-04 17:38:15 +02:00
0c928087a3 Fix T76313: Redo in Multires doesn't bring back stroke made after a subdivide
Differential Revision: https://developer.blender.org/D7620
2020-05-04 17:10:16 +02:00
133c2381ec Fix T76062: Interpolate Radius in Curve Subdivide Special Case
Differential Revision: https://developer.blender.org/D7523
2020-05-04 10:20:25 -04:00
37182c369a GPU: Set Default Buffer Size Immediate Mode
We set the default buffer size for strict buffers to 0. This increased
the performance on intel but reduced the performance on old AMD cards.
This patch sets back the default buffer size for strict buffers. After
testing I didn't detect a slow-down anymore.

Note that today new firmwares were pushed to the device what might fix
some issues.
2020-05-04 16:00:47 +02:00
079fc65e0a T76121 Driver depending on animated modifier property does not update
This fixes an issue where an animated modifier property that's used as
variable in a driver wouldn't animate that driver's value.

Building the relations for the driver target creates the relation
`PARAMETERS_EVAL` → `DRIVER(variable)`. Building the relations for the
FCurve targeting the modifier property creates the relation
`ANIMATION_EXIT` → `GEOMETRY_EVAL_INIT`.

This means that there is NOT a relation `ANIMATION_EXIT` →
`PARAMETERS_EVAL`, and as a result, the driver is not properly updated
when its variable reads animated data. This is resolved in this commit
by adding the missing relation.

Differential Revision: https://developer.blender.org/D7615
2020-05-04 15:29:19 +02:00
785 changed files with 9881 additions and 4501 deletions

View File

@@ -256,6 +256,7 @@ ForEachMacros:
- SEQ_BEGIN
- SURFACE_QUAD_ITER_BEGIN
- foreach
- ED_screen_areas_iter
# Use once we bump the minimum version to version 8.
# # Without this string literals that in-line 'STRINGIFY' behave strangely (a bug?).

View File

@@ -278,7 +278,7 @@ option(WITH_ALEMBIC "Enable Alembic Support" ON)
option(WITH_ALEMBIC_HDF5 "Enable Legacy Alembic Support (not officially supported)" OFF)
# Universal Scene Description support
option(WITH_USD "Enable Universal Scene Description (USD) Support" OFF)
option(WITH_USD "Enable Universal Scene Description (USD) Support" ON)
# 3D format support
# Disable opencollada when we don't have precompiled libs
@@ -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)
@@ -608,12 +608,6 @@ if(WITH_PYTHON_MODULE AND WITH_PYTHON_INSTALL)
message(FATAL_ERROR "WITH_PYTHON_MODULE requires WITH_PYTHON_INSTALL to be OFF")
endif()
# may as well build python module without a UI
if(WITH_PYTHON_MODULE)
set(WITH_HEADLESS ON)
endif()
if(NOT WITH_PYTHON)
set(WITH_CYCLES OFF)
set(WITH_DRACO OFF)

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:
@@ -78,27 +80,24 @@ class VersionInfo:
blender_h = os.path.join(builder.blender_dir, "source", "blender", "blenkernel", "BKE_blender_version.h")
version_number = int(self._parse_header_file(blender_h, 'BLENDER_VERSION'))
self.version = "%d.%d" % (version_number // 100, version_number % 100)
self.version_char = self._parse_header_file(blender_h, 'BLENDER_VERSION_CHAR')
version_number_patch = int(self._parse_header_file(blender_h, 'BLENDER_VERSION_PATCH'))
version_numbers = (version_number // 100, version_number % 100, version_number_patch)
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":
# Final release
self.full_version = self.version + self.version_char
self.full_version = self.version
self.is_development_build = False
elif self.version_cycle == "rc":
# Release candidate
version_cycle = self.version_cycle + self.version_cycle_number
if len(self.version_char) == 0:
self.full_version = self.version + version_cycle
else:
self.full_version = self.version + self.version_char + '-' + version_cycle
self.full_version = self.version + self.version_cycle
self.is_development_build = False
else:
# Development build
self.full_version = self.version + self.version_char + '-' + self.hash
self.full_version = self.version + '-' + self.hash
self.is_development_build = True
def _parse_header_file(self, filename, define):

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)]
@@ -167,7 +170,7 @@ def pack_linux(builder):
buildbot_utils.call(builder.command_prefix + ['strip', '--strip-all', blender_executable])
print("Stripping python...")
py_target = os.path.join(builder.install_dir, info.version)
py_target = os.path.join(builder.install_dir, info.short_version)
buildbot_utils.call(builder.command_prefix + ['find', py_target, '-iname', '*.so', '-exec', 'strip', '-s', '{}', ';'])
# Construct package name

View File

@@ -104,6 +104,7 @@ FOREACH(COMPONENT ${_openexr_FIND_COMPONENTS})
FIND_LIBRARY(OPENEXR_${UPPERCOMPONENT}_LIBRARY
NAMES
${COMPONENT}-${_openexr_libs_ver} ${COMPONENT}
NAMES_PER_DIR
HINTS
${_openexr_SEARCH_DIRS}
PATH_SUFFIXES

View File

@@ -43,6 +43,7 @@ FIND_PATH(USD_INCLUDE_DIR
FIND_LIBRARY(USD_LIBRARY
NAMES
usd_m usd_ms
NAMES_PER_DIR
HINTS
${_usd_SEARCH_DIRS}
PATH_SUFFIXES

View File

@@ -52,6 +52,7 @@ set(WITH_OPENVDB OFF CACHE BOOL "" FORCE)
set(WITH_QUADRIFLOW OFF CACHE BOOL "" FORCE)
set(WITH_SDL OFF CACHE BOOL "" FORCE)
set(WITH_TBB OFF CACHE BOOL "" FORCE)
set(WITH_USD OFF CACHE BOOL "" FORCE)
if(UNIX AND NOT APPLE)
set(WITH_GHOST_XDND OFF CACHE BOOL "" FORCE)

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

@@ -748,8 +748,7 @@ function(get_blender_version)
# - BLENDER_VERSION (major.minor)
# - BLENDER_VERSION_MAJOR
# - BLENDER_VERSION_MINOR
# - BLENDER_SUBVERSION (used for internal versioning mainly)
# - BLENDER_VERSION_CHAR (a, b, c, ...or empty string)
# - BLENDER_VERSION_PATCH
# - BLENDER_VERSION_CYCLE (alpha, beta, rc, release)
# So cmake depends on BKE_blender.h, beware of inf-loops!
@@ -759,25 +758,15 @@ function(get_blender_version)
file(STRINGS ${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender_version.h _contents REGEX "^#define[ \t]+BLENDER_.*$")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION[ \t]+([0-9]+).*" "\\1" _out_version "${_contents}")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_SUBVERSION[ \t]+([0-9]+).*" "\\1" _out_subversion "${_contents}")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION_CHAR[ \t]+([a-z]+).*" "\\1" _out_version_char "${_contents}")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION_PATCH[ \t]+([0-9]+).*" "\\1" _out_version_patch "${_contents}")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION_CYCLE[ \t]+([a-z]+).*" "\\1" _out_version_cycle "${_contents}")
if(NOT ${_out_version} MATCHES "[0-9]+")
message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION")
endif()
if(NOT ${_out_subversion} MATCHES "[0-9]+")
message(FATAL_ERROR "Version parsing failed for BLENDER_SUBVERSION")
endif()
# clumsy regex, only single char are ok but it could be unset
string(LENGTH "${_out_version_char}" _out_version_char_len)
if(NOT _out_version_char_len EQUAL 1)
set(_out_version_char "")
elseif(NOT ${_out_version_char} MATCHES "[a-z]+")
message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION_CHAR")
if(NOT ${_out_version_patch} MATCHES "[0-9]+")
message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION_PATCH")
endif()
if(NOT ${_out_version_cycle} MATCHES "[a-z]+")
@@ -787,23 +776,11 @@ function(get_blender_version)
math(EXPR _out_version_major "${_out_version} / 100")
math(EXPR _out_version_minor "${_out_version} % 100")
# for packaging, alpha to numbers
string(COMPARE EQUAL "${_out_version_char}" "" _out_version_char_empty)
if(${_out_version_char_empty})
set(_out_version_char_index "0")
else()
set(_char_ls a b c d e f g h i j k l m n o p q r s t u v w x y z)
list(FIND _char_ls ${_out_version_char} _out_version_char_index)
math(EXPR _out_version_char_index "${_out_version_char_index} + 1")
endif()
# output vars
set(BLENDER_VERSION "${_out_version_major}.${_out_version_minor}" PARENT_SCOPE)
set(BLENDER_VERSION_MAJOR "${_out_version_major}" PARENT_SCOPE)
set(BLENDER_VERSION_MINOR "${_out_version_minor}" PARENT_SCOPE)
set(BLENDER_SUBVERSION "${_out_subversion}" PARENT_SCOPE)
set(BLENDER_VERSION_CHAR "${_out_version_char}" PARENT_SCOPE)
set(BLENDER_VERSION_CHAR_INDEX "${_out_version_char_index}" PARENT_SCOPE)
set(BLENDER_VERSION_PATCH "${_out_version_patch}" PARENT_SCOPE)
set(BLENDER_VERSION_CYCLE "${_out_version_cycle}" PARENT_SCOPE)
endfunction()

View File

@@ -7,7 +7,7 @@ set(PROJECT_VENDOR "Blender Foundation")
set(MAJOR_VERSION ${BLENDER_VERSION_MAJOR})
set(MINOR_VERSION ${BLENDER_VERSION_MINOR})
set(PATCH_VERSION ${BLENDER_VERSION_CHAR_INDEX})
set(PATCH_VERSION ${BLENDER_VERSION_PATCH})
set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
set(CPACK_PACKAGE_DESCRIPTION ${PROJECT_DESCRIPTION})

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

@@ -57,6 +57,7 @@ if(EXISTS ${LIBDIR})
set(BOOST_ROOT ${LIBDIR}/boost)
set(BOOST_LIBRARYDIR ${LIBDIR}/boost/lib)
set(Boost_NO_SYSTEM_PATHS ON)
set(OPENEXR_ROOT_DIR ${LIBDIR}/openexr)
endif()
if(WITH_STATIC_LIBS)

View File

@@ -166,7 +166,7 @@ if(MSVC_VERSION GREATER 1914 AND NOT MSVC_CLANG)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /JMC")
endif()
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO ")
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /SUBSYSTEM:CONSOLE /STACK:2097152,70656 /INCREMENTAL:NO ")
set(PLATFORM_LINKFLAGS_RELEASE "/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib")
set(PLATFORM_LINKFLAGS_DEBUG "${PLATFORM_LINKFLAGS_DEBUG} /IGNORE:4099 /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:libcmtd.lib")

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

@@ -7,15 +7,14 @@ BASE_DIR="$PWD"
blender_srcdir=$(dirname -- $0)/../..
blender_version=$(grep "BLENDER_VERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version_patch=$(grep "BLENDER_VERSION_PATCH\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100).$blender_version_patch
if [ "$blender_version_cycle" = "release" ] ; then
VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100)$blender_version_char
SUBMODULE_EXCLUDE="^\(release/scripts/addons_contrib\)$"
else
VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100)_$blender_subversion
VERSION=$VERSION-$blender_version_cycle
SUBMODULE_EXCLUDE="^$" # dummy regex
fi

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

@@ -403,32 +403,21 @@ MODULE_GROUPING = {
# -------------------------------BLENDER----------------------------------------
blender_version_strings = [str(v) for v in bpy.app.version]
is_release = bpy.app.version_cycle in {"rc", "release"}
# converting bytes to strings, due to T30154
BLENDER_REVISION = str(bpy.app.build_hash, 'utf_8')
if is_release:
# '2.62a'
BLENDER_VERSION_DOTS = ".".join(blender_version_strings[:2]) + bpy.app.version_char
else:
# '2.62.1'
BLENDER_VERSION_DOTS = ".".join(blender_version_strings)
# '2.83.0 Beta' or '2.83.0' or '2.83.1'
BLENDER_VERSION_DOTS = bpy.app.version_string
if BLENDER_REVISION != "Unknown":
# '2.62a SHA1' (release) or '2.62.1 SHA1' (non-release)
# SHA1 Git hash
BLENDER_VERSION_HASH = BLENDER_REVISION
else:
# Fallback: Should not be used
BLENDER_VERSION_HASH = "Hash Unknown"
if is_release:
# '2_62a_release'
BLENDER_VERSION_PATH = "%s%s_release" % ("_".join(blender_version_strings[:2]), bpy.app.version_char)
else:
# '2_62_1'
BLENDER_VERSION_PATH = "_".join(blender_version_strings)
# '2_83'
BLENDER_VERSION_PATH = "%d_%d" % (bpy.app.version[0], bpy.app.version[1])
# --------------------------DOWNLOADABLE FILES----------------------------------
@@ -512,7 +501,7 @@ def is_struct_seq(value):
def undocumented_message(module_name, type_name, identifier):
return "Undocumented `contribute <https://developer.blender.org/T51061>`"
return "Undocumented, consider `contributing <https://developer.blender.org/T51061>`__."
def range_str(val):

View File

@@ -36,16 +36,10 @@ fi
blender_srcdir=$(dirname -- $0)/../..
blender_version_header="$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h"
blender_version=$(grep "BLENDER_VERSION\s" "$blender_version_header" | awk '{print $3}')
blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_version_header" | awk '{print $3}')
blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_version_header" | awk '{print $3}')
blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_version_header" | awk '{print $3}')
unset blender_version_header
if [ "$blender_version_cycle" = "release" ] ; then
BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)$blender_version_char"_release"
else
BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)_$blender_subversion
fi
BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)
SSH_UPLOAD_FULL=$SSH_UPLOAD/"blender_python_api_"$BLENDER_VERSION

View File

@@ -127,11 +127,10 @@ def main():
" f.write('%d\\n' % is_release)\n"
" f.write('%d\\n' % is_beta)\n"
" f.write('%s\\n' % branch)\n"
" f.write('%d.%d%s\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char))\n"
" f.write('%d.%d%s\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
" f.write('%d.%d\\n' % (bpy.app.version[0], bpy.app.version[1]))\n"
" f.write('%d.%d\\n' % (bpy.app.version[0], bpy.app.version[1])\n"
" if (is_release or is_beta) else '%s\\n' % branch)\n"
" f.write('%d_%d%s_release' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
" if is_release else '%d_%d_%d' % bpy.app.version)\n"
" f.write('%d_%d' % (bpy.app.version[0], bpy.app.version[1]))\n"
)
get_ver_cmd = (args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1",
"--python-expr", getver_script, "--", getver_file)

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

@@ -1,3 +1,3 @@
#define MANTA_GIT_VERSION "commit 21303fab2eda588ec22988bf9e5762d2001c131f"
#define MANTA_GIT_VERSION "commit b61bf9efa7a1d8ca98635076a7e9f2c4dacb2914"

View File

@@ -469,6 +469,7 @@ template<class S> class ParticleSystem : public ParticleBase {
const int integrationMode,
const bool deleteInObstacle = true,
const bool stopInObstacle = true,
const bool skipNew = false,
const ParticleDataImpl<int> *ptype = NULL,
const int exclude = 0);
static PyObject *_W_9(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
@@ -486,13 +487,20 @@ template<class S> class ParticleSystem : public ParticleBase {
const int integrationMode = _args.get<int>("integrationMode", 2, &_lock);
const bool deleteInObstacle = _args.getOpt<bool>("deleteInObstacle", 3, true, &_lock);
const bool stopInObstacle = _args.getOpt<bool>("stopInObstacle", 4, true, &_lock);
const bool skipNew = _args.getOpt<bool>("skipNew", 5, false, &_lock);
const ParticleDataImpl<int> *ptype = _args.getPtrOpt<ParticleDataImpl<int>>(
"ptype", 5, NULL, &_lock);
const int exclude = _args.getOpt<int>("exclude", 6, 0, &_lock);
"ptype", 6, NULL, &_lock);
const int exclude = _args.getOpt<int>("exclude", 7, 0, &_lock);
pbo->_args.copy(_args);
_retval = getPyNone();
pbo->advectInGrid(
flags, vel, integrationMode, deleteInObstacle, stopInObstacle, ptype, exclude);
pbo->advectInGrid(flags,
vel,
integrationMode,
deleteInObstacle,
stopInObstacle,
skipNew,
ptype,
exclude);
pbo->_args.check();
}
pbFinalizePlugin(pbo->getParent(), "ParticleSystem::advectInGrid", !noTiming);
@@ -1863,6 +1871,7 @@ template<class S> struct _GridAdvectKernel : public KernelBase {
const Real dt,
const bool deleteInObstacle,
const bool stopInObstacle,
const bool skipNew,
const ParticleDataImpl<int> *ptype,
const int exclude,
std::vector<Vec3> &u)
@@ -1873,6 +1882,7 @@ template<class S> struct _GridAdvectKernel : public KernelBase {
dt(dt),
deleteInObstacle(deleteInObstacle),
stopInObstacle(stopInObstacle),
skipNew(skipNew),
ptype(ptype),
exclude(exclude),
u(u)
@@ -1885,11 +1895,13 @@ template<class S> struct _GridAdvectKernel : public KernelBase {
const Real dt,
const bool deleteInObstacle,
const bool stopInObstacle,
const bool skipNew,
const ParticleDataImpl<int> *ptype,
const int exclude,
std::vector<Vec3> &u) const
{
if ((p[idx].flag & ParticleBase::PDELETE) || (ptype && ((*ptype)[idx] & exclude))) {
if ((p[idx].flag & ParticleBase::PDELETE) || (ptype && ((*ptype)[idx] & exclude)) ||
(skipNew && (p[idx].flag & ParticleBase::PNEW))) {
u[idx] = 0.;
return;
}
@@ -1910,7 +1922,7 @@ template<class S> struct _GridAdvectKernel : public KernelBase {
void operator()(const tbb::blocked_range<IndexInt> &__r) const
{
for (IndexInt idx = __r.begin(); idx != (IndexInt)__r.end(); idx++)
op(idx, p, vel, flags, dt, deleteInObstacle, stopInObstacle, ptype, exclude, u);
op(idx, p, vel, flags, dt, deleteInObstacle, stopInObstacle, skipNew, ptype, exclude, u);
}
void run()
{
@@ -1922,6 +1934,7 @@ template<class S> struct _GridAdvectKernel : public KernelBase {
const Real dt;
const bool deleteInObstacle;
const bool stopInObstacle;
const bool skipNew;
const ParticleDataImpl<int> *ptype;
const int exclude;
std::vector<Vec3> &u;
@@ -1933,6 +1946,7 @@ template<class S> struct GridAdvectKernel : public KernelBase {
const Real dt,
const bool deleteInObstacle,
const bool stopInObstacle,
const bool skipNew,
const ParticleDataImpl<int> *ptype,
const int exclude)
: KernelBase(p.size()),
@@ -1943,6 +1957,7 @@ template<class S> struct GridAdvectKernel : public KernelBase {
dt,
deleteInObstacle,
stopInObstacle,
skipNew,
ptype,
exclude,
u),
@@ -1952,6 +1967,7 @@ template<class S> struct GridAdvectKernel : public KernelBase {
dt(dt),
deleteInObstacle(deleteInObstacle),
stopInObstacle(stopInObstacle),
skipNew(skipNew),
ptype(ptype),
exclude(exclude),
u((size))
@@ -2001,16 +2017,21 @@ template<class S> struct GridAdvectKernel : public KernelBase {
return stopInObstacle;
}
typedef bool type5;
inline const ParticleDataImpl<int> *getArg6()
inline const bool &getArg6()
{
return skipNew;
}
typedef bool type6;
inline const ParticleDataImpl<int> *getArg7()
{
return ptype;
}
typedef ParticleDataImpl<int> type6;
inline const int &getArg7()
typedef ParticleDataImpl<int> type7;
inline const int &getArg8()
{
return exclude;
}
typedef int type7;
typedef int type8;
void runMessage()
{
debMsg("Executing kernel GridAdvectKernel ", 3);
@@ -2025,6 +2046,7 @@ template<class S> struct GridAdvectKernel : public KernelBase {
const Real dt;
const bool deleteInObstacle;
const bool stopInObstacle;
const bool skipNew;
const ParticleDataImpl<int> *ptype;
const int exclude;
std::vector<Vec3> u;
@@ -2195,6 +2217,7 @@ void ParticleSystem<S>::advectInGrid(const FlagGrid &flags,
const int integrationMode,
const bool deleteInObstacle,
const bool stopInObstacle,
const bool skipNew,
const ParticleDataImpl<int> *ptype,
const int exclude)
{
@@ -2208,8 +2231,15 @@ void ParticleSystem<S>::advectInGrid(const FlagGrid &flags,
}
// update positions
GridAdvectKernel<S> kernel(
mData, vel, flags, getParent()->getDt(), deleteInObstacle, stopInObstacle, ptype, exclude);
GridAdvectKernel<S> kernel(mData,
vel,
flags,
getParent()->getDt(),
deleteInObstacle,
stopInObstacle,
skipNew,
ptype,
exclude);
integratePointSet(kernel, integrationMode);
if (!deleteInObstacle) {
@@ -2438,15 +2468,15 @@ template<class S> void ParticleSystem<S>::compress()
//! insert buffered positions as new particles, update additional particle data
template<class S> void ParticleSystem<S>::insertBufferedParticles()
{
// clear new flag everywhere
for (IndexInt i = 0; i < (IndexInt)mData.size(); ++i)
mData[i].flag &= ~PNEW;
if (mNewBufferPos.size() == 0)
return;
IndexInt newCnt = mData.size();
resizeAll(newCnt + mNewBufferPos.size());
// clear new flag everywhere
for (IndexInt i = 0; i < (IndexInt)mData.size(); ++i)
mData[i].flag &= ~PNEW;
for (IndexInt i = 0; i < (IndexInt)mNewBufferPos.size(); ++i) {
int flag = (mNewBufferFlag.size() > 0) ? mNewBufferFlag[i] : 0;
// note, other fields are not initialized here...

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

@@ -26,6 +26,7 @@
#include "util/util_args.h"
#include "util/util_foreach.h"
#include "util/util_function.h"
#include "util/util_image.h"
#include "util/util_logging.h"
#include "util/util_path.h"
#include "util/util_progress.h"

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,13 +456,20 @@ 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);
}
/* always sample these times for camera motion */
motion_times.insert(-1.0f);
motion_times.insert(1.0f);
/* Insert motion times from camera. Motion times from other objects
* have already been added in a sync_objects call. */
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 */
foreach (float relative_time, motion_times) {
@@ -487,10 +494,8 @@ void BlenderSync::sync_motion(BL::RenderSettings &b_render,
b_engine.frame_set(frame, subframe);
python_thread_state_save(python_thread_state);
/* sync camera, only supports two times at the moment */
if (relative_time == -1.0f || relative_time == 1.0f) {
sync_camera_motion(b_render, b_cam, width, height, relative_time);
}
/* Syncs camera motion if relative_time is one of the camera's motion times. */
sync_camera_motion(b_render, b_cam, width, height, relative_time);
/* sync object */
sync_objects(b_depsgraph, b_v3d, relative_time);

View File

@@ -60,6 +60,12 @@ void *pylong_as_voidptr_typesafe(PyObject *object)
return PyLong_AsVoidPtr(object);
}
PyObject *pyunicode_from_string(const char *str)
{
/* Ignore errors if device API returns invalid UTF-8 strings. */
return PyUnicode_DecodeUTF8(str, strlen(str), "ignore");
}
/* Synchronize debug flags from a given Blender scene.
* Return truth when device list needs invalidation.
*/
@@ -429,9 +435,9 @@ static PyObject *available_devices_func(PyObject * /*self*/, PyObject *args)
DeviceInfo &device = devices[i];
string type_name = Device::string_from_type(device.type);
PyObject *device_tuple = PyTuple_New(3);
PyTuple_SET_ITEM(device_tuple, 0, PyUnicode_FromString(device.description.c_str()));
PyTuple_SET_ITEM(device_tuple, 1, PyUnicode_FromString(type_name.c_str()));
PyTuple_SET_ITEM(device_tuple, 2, PyUnicode_FromString(device.id.c_str()));
PyTuple_SET_ITEM(device_tuple, 0, pyunicode_from_string(device.description.c_str()));
PyTuple_SET_ITEM(device_tuple, 1, pyunicode_from_string(type_name.c_str()));
PyTuple_SET_ITEM(device_tuple, 2, pyunicode_from_string(device.id.c_str()));
PyTuple_SET_ITEM(ret, i, device_tuple);
}
@@ -642,7 +648,7 @@ static PyObject *osl_compile_func(PyObject * /*self*/, PyObject *args)
static PyObject *system_info_func(PyObject * /*self*/, PyObject * /*value*/)
{
string system_info = Device::device_capabilities();
return PyUnicode_FromString(system_info.c_str());
return pyunicode_from_string(system_info.c_str());
}
#ifdef WITH_OPENCL

View File

@@ -168,9 +168,13 @@ void BlenderSession::create_session()
void BlenderSession::reset_session(BL::BlendData &b_data, BL::Depsgraph &b_depsgraph)
{
/* Update data, scene and depsgraph pointers. These can change after undo. */
this->b_data = b_data;
this->b_depsgraph = b_depsgraph;
this->b_scene = b_depsgraph.scene_eval();
if (sync) {
sync->reset(this->b_data, this->b_scene);
}
if (preview_osl) {
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");

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());
}
@@ -1231,12 +1231,11 @@ void BlenderSync::sync_materials(BL::Depsgraph &b_depsgraph, bool update_all)
Shader *shader;
/* test if we need to sync */
if (shader_map.add_or_update(&shader, b_mat) || shader->need_sync_object || update_all) {
if (shader_map.add_or_update(&shader, b_mat) || update_all) {
ShaderGraph *graph = new ShaderGraph();
shader->name = b_mat.name().c_str();
shader->pass_id = b_mat.pass_index();
shader->need_sync_object = false;
/* create nodes */
if (b_mat.use_nodes() && b_mat.node_tree()) {

View File

@@ -78,6 +78,14 @@ BlenderSync::~BlenderSync()
{
}
void BlenderSync::reset(BL::BlendData &b_data, BL::Scene &b_scene)
{
/* Update data and scene pointers in case they change in session reset,
* for example after undo. */
this->b_data = b_data;
this->b_scene = b_scene;
}
/* Sync */
void BlenderSync::sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d)
@@ -85,8 +93,6 @@ void BlenderSync::sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d
/* Sync recalc flags from blender to cycles. Actual update is done separate,
* so we can do it later on if doing it immediate is not suitable. */
bool has_updated_objects = b_depsgraph.id_type_updated(BL::DriverTarget::id_type_OBJECT);
if (experimental) {
/* Mark all meshes as needing to be exported again if dicing changed. */
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
@@ -189,19 +195,6 @@ void BlenderSync::sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d
if (viewport_parameters.modified(new_viewport_parameters)) {
world_recalc = true;
}
/* Updates shader with object dependency if objects changed. */
if (has_updated_objects) {
if (scene->default_background->has_object_dependency) {
world_recalc = true;
}
foreach (Shader *shader, scene->shaders) {
if (shader->has_object_dependency) {
shader->need_sync_object = true;
}
}
}
}
void BlenderSync::sync_data(BL::RenderSettings &b_render,
@@ -700,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

@@ -61,6 +61,8 @@ class BlenderSync {
Progress &progress);
~BlenderSync();
void reset(BL::BlendData &b_data, BL::Scene &b_scene);
/* sync */
void sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d);
void sync_data(BL::RenderSettings &b_render,

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

@@ -34,15 +34,15 @@ CCL_NAMESPACE_BEGIN
/* TODO: verify this is not loading unnecessary attributes. */
class BlenderSmokeLoader : public ImageLoader {
public:
BlenderSmokeLoader(const BL::Object &b_ob, AttributeStandard attribute)
: b_ob(b_ob), attribute(attribute)
BlenderSmokeLoader(BL::Object &b_ob, AttributeStandard 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
{
BL::FluidDomainSettings b_domain = object_fluid_gas_domain_find(b_ob);
if (!b_domain) {
return false;
}
@@ -79,10 +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. */
BL::Mesh b_mesh(b_ob.data());
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;
@@ -90,9 +87,6 @@ class BlenderSmokeLoader : public ImageLoader {
bool load_pixels(const ImageMetaData &, void *pixels, const size_t, const bool) override
{
/* smoke volume data */
BL::FluidDomainSettings b_domain = object_fluid_gas_domain_find(b_ob);
if (!b_domain) {
return false;
}
@@ -179,10 +173,11 @@ class BlenderSmokeLoader : public ImageLoader {
bool equals(const ImageLoader &other) const override
{
const BlenderSmokeLoader &other_loader = (const BlenderSmokeLoader &)other;
return b_ob == other_loader.b_ob && attribute == other_loader.attribute;
return b_domain == other_loader.b_domain && attribute == other_loader.attribute;
}
BL::Object b_ob;
BL::FluidDomainSettings b_domain;
float3 texspace_loc, texspace_size;
AttributeStandard attribute;
};
@@ -221,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;
}
@@ -260,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;
}
@@ -271,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;
};
@@ -330,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) {
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 is 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

@@ -494,16 +494,18 @@ vector<DeviceInfo> Device::available_devices(uint mask)
}
#endif
#ifdef WITH_CUDA
if (mask & DEVICE_MASK_CUDA) {
#if defined(WITH_CUDA) || defined(WITH_OPTIX)
if (mask & (DEVICE_MASK_CUDA | DEVICE_MASK_OPTIX)) {
if (!(devices_initialized_mask & DEVICE_MASK_CUDA)) {
if (device_cuda_init()) {
device_cuda_info(cuda_devices);
}
devices_initialized_mask |= DEVICE_MASK_CUDA;
}
foreach (DeviceInfo &info, cuda_devices) {
devices.push_back(info);
if (mask & DEVICE_MASK_CUDA) {
foreach (DeviceInfo &info, cuda_devices) {
devices.push_back(info);
}
}
}
#endif
@@ -512,7 +514,7 @@ vector<DeviceInfo> Device::available_devices(uint mask)
if (mask & DEVICE_MASK_OPTIX) {
if (!(devices_initialized_mask & DEVICE_MASK_OPTIX)) {
if (device_optix_init()) {
device_optix_info(optix_devices);
device_optix_info(cuda_devices, optix_devices);
}
devices_initialized_mask |= DEVICE_MASK_OPTIX;
}

View File

@@ -45,7 +45,7 @@ Device *device_multi_create(DeviceInfo &info, Stats &stats, Profiler &profiler,
void device_cpu_info(vector<DeviceInfo> &devices);
void device_opencl_info(vector<DeviceInfo> &devices);
void device_cuda_info(vector<DeviceInfo> &devices);
void device_optix_info(vector<DeviceInfo> &devices);
void device_optix_info(const vector<DeviceInfo> &cuda_devices, vector<DeviceInfo> &devices);
void device_network_info(vector<DeviceInfo> &devices);
string device_cpu_capabilities();

View File

@@ -924,7 +924,8 @@ class OptiXDevice : public CUDADevice {
&rtiles[9].h,
&rtiles[9].offset,
&rtiles[9].stride,
&task.pass_stride};
&task.pass_stride,
&rtile.sample};
launch_filter_kernel(
"kernel_cuda_filter_convert_from_rgb", rtiles[9].w, rtiles[9].h, output_args);
# endif
@@ -1534,43 +1535,25 @@ bool device_optix_init()
return true;
}
void device_optix_info(vector<DeviceInfo> &devices)
void device_optix_info(const vector<DeviceInfo> &cuda_devices, vector<DeviceInfo> &devices)
{
// Simply add all supported CUDA devices as OptiX devices again
vector<DeviceInfo> cuda_devices;
device_cuda_info(cuda_devices);
devices.reserve(cuda_devices.size());
for (auto it = cuda_devices.begin(); it != cuda_devices.end();) {
DeviceInfo &info = *it;
// Simply add all supported CUDA devices as OptiX devices again
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"))
it = cuda_devices.erase(it);
else
++it;
devices.push_back(info);
}
devices.insert(devices.end(), cuda_devices.begin(), cuda_devices.end());
}
Device *device_optix_create(DeviceInfo &info, Stats &stats, Profiler &profiler, bool background)

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

@@ -133,7 +133,7 @@ void Node::set(const SocketType &input, const Transform &value)
void Node::set(const SocketType &input, Node *value)
{
assert(input.type == SocketType::TRANSFORM);
assert(input.type == SocketType::NODE);
get_socket_value<Node *>(this, input) = value;
}
@@ -213,7 +213,7 @@ float Node::get_float(const SocketType &input) const
float2 Node::get_float2(const SocketType &input) const
{
assert(input.type == SocketType::FLOAT);
assert(input.type == SocketType::POINT2);
return get_socket_value<float2>(this, input);
}
@@ -272,7 +272,7 @@ const array<float> &Node::get_float_array(const SocketType &input) const
const array<float2> &Node::get_float2_array(const SocketType &input) const
{
assert(input.type == SocketType::FLOAT_ARRAY);
assert(input.type == SocketType::POINT2_ARRAY);
return get_socket_value<array<float2>>(this, input);
}

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")
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 is 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

@@ -300,7 +300,9 @@ ccl_device_intersect bool scene_intersect_local(KernelGlobals *kg,
// Is set to zero on miss or if ray is aborted, so can be used as return value
uint p5 = max_hits;
local_isect->num_hits = 0; // Initialize hit count to zero
if (local_isect) {
local_isect->num_hits = 0; // Initialize hit count to zero
}
optixTrace(scene_intersect_valid(ray) ? kernel_data.bvh.scene : 0,
ray->P,
ray->D,
@@ -323,7 +325,9 @@ ccl_device_intersect bool scene_intersect_local(KernelGlobals *kg,
return p5;
# else /* __KERNEL_OPTIX__ */
if (!scene_intersect_valid(ray)) {
local_isect->num_hits = 0;
if (local_isect) {
local_isect->num_hits = 0;
}
return false;
}

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

@@ -185,19 +185,19 @@ ccl_device bool kernel_do_adaptive_filter_x(KernelGlobals *kg, int y, ccl_global
ccl_global float *buffer = tile->buffer + index * kernel_data.film.pass_stride;
ccl_global float4 *aux = (ccl_global float4 *)(buffer +
kernel_data.film.pass_adaptive_aux_buffer);
if (aux->w == 0.0f) {
if ((*aux).w == 0.0f) {
any = true;
if (x > tile->x && !prev) {
index = index - 1;
buffer = tile->buffer + index * kernel_data.film.pass_stride;
aux = (ccl_global float4 *)(buffer + kernel_data.film.pass_adaptive_aux_buffer);
aux->w = 0.0f;
(*aux).w = 0.0f;
}
prev = true;
}
else {
if (prev) {
aux->w = 0.0f;
(*aux).w = 0.0f;
}
prev = false;
}
@@ -214,19 +214,19 @@ ccl_device bool kernel_do_adaptive_filter_y(KernelGlobals *kg, int x, ccl_global
ccl_global float *buffer = tile->buffer + index * kernel_data.film.pass_stride;
ccl_global float4 *aux = (ccl_global float4 *)(buffer +
kernel_data.film.pass_adaptive_aux_buffer);
if (aux->w == 0.0f) {
if ((*aux).w == 0.0f) {
any = true;
if (y > tile->y && !prev) {
index = index - tile->stride;
buffer = tile->buffer + index * kernel_data.film.pass_stride;
aux = (ccl_global float4 *)(buffer + kernel_data.film.pass_adaptive_aux_buffer);
aux->w = 0.0f;
(*aux).w = 0.0f;
}
prev = true;
}
else {
if (prev) {
aux->w = 0.0f;
(*aux).w = 0.0f;
}
prev = false;
}

View File

@@ -43,12 +43,17 @@
#define ccl_local __local
#define ccl_local_param __local
#define ccl_private __private
#define ccl_loop_no_unroll __attribute__((opencl_unroll_hint(1)))
#define ccl_restrict restrict
#define ccl_ref
#define ccl_align(n) __attribute__((aligned(n)))
#define ccl_optional_struct_init
#if __OPENCL_VERSION__ >= 200
# define ccl_loop_no_unroll __attribute__((opencl_unroll_hint(1)))
#else
# define ccl_loop_no_unroll
#endif
#ifdef __SPLIT_KERNEL__
# define ccl_addr_space __global
#else

View File

@@ -28,13 +28,13 @@ ccl_device float4 film_get_pass_result(KernelGlobals *kg,
int display_pass_components = kernel_data.film.display_pass_components;
if (display_pass_components == 4) {
ccl_global float4 *in = (ccl_global float4 *)(buffer + display_pass_stride +
index * kernel_data.film.pass_stride);
float4 in = *(ccl_global float4 *)(buffer + display_pass_stride +
index * kernel_data.film.pass_stride);
float alpha = use_display_sample_scale ?
(kernel_data.film.use_display_pass_alpha ? in->w : 1.0f / sample_scale) :
(kernel_data.film.use_display_pass_alpha ? in.w : 1.0f / sample_scale) :
1.0f;
pass_result = make_float4(in->x, in->y, in->z, alpha);
pass_result = make_float4(in.x, in.y, in.z, alpha);
int display_divide_pass_stride = kernel_data.film.display_divide_pass_stride;
if (display_divide_pass_stride != -1) {

View File

@@ -662,7 +662,7 @@ ccl_device void kernel_path_trace(
if (kernel_data.film.pass_adaptive_aux_buffer) {
ccl_global float4 *aux = (ccl_global float4 *)(buffer +
kernel_data.film.pass_adaptive_aux_buffer);
if (aux->w > 0.0f) {
if ((*aux).w > 0.0f) {
return;
}
}

View File

@@ -526,7 +526,7 @@ ccl_device void kernel_branched_path_trace(
if (kernel_data.film.pass_adaptive_aux_buffer) {
ccl_global float4 *aux = (ccl_global float4 *)(buffer +
kernel_data.film.pass_adaptive_aux_buffer);
if (aux->w > 0.0f) {
if ((*aux).w > 0.0f) {
return;
}
}

View File

@@ -99,7 +99,7 @@ ccl_device bool get_next_work(KernelGlobals *kg,
ccl_global float *buffer = kernel_split_params.tile.buffer + buffer_offset;
ccl_global float4 *aux = (ccl_global float4 *)(buffer +
kernel_data.film.pass_adaptive_aux_buffer);
if (aux->w == 0.0f) {
if ((*aux).w == 0.0f) {
break;
}
}

View File

@@ -57,9 +57,9 @@ kernel_cuda_filter_convert_to_rgb(float *rgb, float *buf, int sw, int sh, int st
if (num_inputs > 0) {
float *in = buf + x * pass_stride + (y * stride + pass_offset.x) / sizeof(float);
float *out = rgb + (x + y * sw) * 3;
out[0] = clamp(in[0], 0.0f, 10000.0f);
out[1] = clamp(in[1], 0.0f, 10000.0f);
out[2] = clamp(in[2], 0.0f, 10000.0f);
out[0] = clamp(in[0] / num_samples, 0.0f, 10000.0f);
out[1] = clamp(in[1] / num_samples, 0.0f, 10000.0f);
out[2] = clamp(in[2] / num_samples, 0.0f, 10000.0f);
}
if (num_inputs > 1) {
float *in = buf + x * pass_stride + (y * stride + pass_offset.y) / sizeof(float);
@@ -80,16 +80,16 @@ kernel_cuda_filter_convert_to_rgb(float *rgb, float *buf, int sw, int sh, int st
extern "C" __global__ void
CUDA_LAUNCH_BOUNDS(CUDA_THREADS_BLOCK_WIDTH, CUDA_KERNEL_MAX_REGISTERS)
kernel_cuda_filter_convert_from_rgb(float *rgb, float *buf, int ix, int iy, int iw, int ih, int sx, int sy, int sw, int sh, int offset, int stride, int pass_stride)
kernel_cuda_filter_convert_from_rgb(float *rgb, float *buf, int ix, int iy, int iw, int ih, int sx, int sy, int sw, int sh, int offset, int stride, int pass_stride, int num_samples)
{
int x = blockDim.x*blockIdx.x + threadIdx.x;
int y = blockDim.y*blockIdx.y + threadIdx.y;
if(x < sw && y < sh) {
float *in = rgb + ((ix + x) + (iy + y) * iw) * 3;
float *out = buf + (offset + (sx + x) + (sy + y) * stride) * pass_stride;
out[0] = in[0];
out[1] = in[1];
out[2] = in[2];
out[0] = in[0] * num_samples;
out[1] = in[1] * num_samples;
out[2] = in[2] * num_samples;
}
}

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

@@ -204,10 +204,6 @@ class ShaderNode : public Node {
{
return false;
}
virtual bool has_object_dependency()
{
return false;
}
virtual bool has_attribute_dependency()
{
return false;

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

@@ -359,10 +359,6 @@ class PointDensityTextureNode : public ShaderNode {
{
return true;
}
bool has_object_dependency()
{
return true;
}
/* Parameters. */
ustring filename;
@@ -896,10 +892,6 @@ class TextureCoordinateNode : public ShaderNode {
{
return true;
}
bool has_object_dependency()
{
return use_transform;
}
float3 normal_osl;
bool from_dupli;

View File

@@ -764,10 +764,6 @@ void OSLCompiler::add(ShaderNode *node, const char *name, bool isfilepath)
current_shader->has_volume_attribute_dependency = true;
}
if (node->has_object_dependency()) {
current_shader->has_object_dependency = true;
}
if (node->has_integrator_dependency()) {
current_shader->has_integrator_dependency = true;
}
@@ -1142,7 +1138,6 @@ void OSLCompiler::compile(OSLGlobals *og, Shader *shader)
shader->has_surface_spatial_varying = false;
shader->has_volume_spatial_varying = false;
shader->has_volume_attribute_dependency = false;
shader->has_object_dependency = false;
shader->has_integrator_dependency = false;
/* generate surface shader */

View File

@@ -206,7 +206,6 @@ Shader::Shader() : Node(node_type)
has_surface_spatial_varying = false;
has_volume_spatial_varying = false;
has_volume_attribute_dependency = false;
has_object_dependency = false;
has_integrator_dependency = false;
has_volume_connected = false;
prev_volume_step_rate = 0.0f;
@@ -218,7 +217,6 @@ Shader::Shader() : Node(node_type)
need_update = true;
need_update_geometry = true;
need_sync_object = false;
}
Shader::~Shader()

View File

@@ -98,7 +98,6 @@ class Shader : public Node {
/* synchronization */
bool need_update;
bool need_update_geometry;
bool need_sync_object;
/* If the shader has only volume components, the surface is assumed to
* be transparent.
@@ -121,7 +120,6 @@ class Shader : public Node {
bool has_surface_spatial_varying;
bool has_volume_spatial_varying;
bool has_volume_attribute_dependency;
bool has_object_dependency;
bool has_integrator_dependency;
/* displacement */

View File

@@ -448,10 +448,6 @@ void SVMCompiler::generate_node(ShaderNode *node, ShaderNodeSet &done)
current_shader->has_volume_attribute_dependency = true;
}
if (node->has_object_dependency()) {
current_shader->has_object_dependency = true;
}
if (node->has_integrator_dependency()) {
current_shader->has_integrator_dependency = true;
}
@@ -863,7 +859,6 @@ void SVMCompiler::compile(Shader *shader, array<int4> &svm_nodes, int index, Sum
shader->has_surface_spatial_varying = false;
shader->has_volume_spatial_varying = false;
shader->has_volume_attribute_dependency = false;
shader->has_object_dependency = false;
shader->has_integrator_dependency = false;
/* generate bump shader */

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

@@ -18,6 +18,7 @@
#define __UTIL_GUARDED_ALLOCATOR_H__
#include <cstddef>
#include <cstdlib>
#include <memory>
#ifdef WITH_BLENDER_GUARDEDALLOC

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

@@ -2172,14 +2172,24 @@ GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const
else if (owner == None)
return (NULL);
/* Restore events so copy doesn't swallow other event types (keyboard/mouse). */
vector<XEvent> restore_events;
while (1) {
/* only get an event if xcout() is doing something */
if (context != XCLIB_XCOUT_NONE)
bool restore_this_event = false;
if (context != XCLIB_XCOUT_NONE) {
XNextEvent(m_display, &evt);
restore_this_event = (evt.type != SelectionNotify);
}
/* fetch the selection, or part of it */
getClipboard_xcout(&evt, sseln, target, &sel_buf, &sel_len, &context);
if (restore_this_event) {
restore_events.push_back(evt);
}
/* fallback is needed. set XA_STRING to target and restart the loop. */
if (context == XCLIB_XCOUT_FALLBACK) {
context = XCLIB_XCOUT_NONE;
@@ -2208,6 +2218,11 @@ GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const
break;
}
while (!restore_events.empty()) {
XPutBackEvent(m_display, &restore_events.back());
restore_events.pop_back();
}
if (sel_len) {
/* only print the buffer out, and free it, if it's not
* empty
@@ -2456,7 +2471,7 @@ GHOST_TSuccess GHOST_SystemX11::showMessageBox(const char *title,
string cmd = "xdg-open \"" + string(link) + "\"";
if (system(cmd.c_str()) != 0) {
GHOST_PRINTF("GHOST_SystemX11::showMessageBox: Unable to run system command [%s]",
cmd);
cmd.c_str());
}
}
break;

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 */
@@ -465,7 +499,14 @@ void GHOST_XrContext::startSession(const GHOST_XrSessionBeginInfo *begin_info)
void GHOST_XrContext::endSession()
{
m_session->requestEnd();
if (m_session) {
if (m_session->isRunning()) {
m_session->requestEnd();
}
else {
m_session = nullptr;
}
}
}
bool GHOST_XrContext::isSessionRunning() const

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

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