1
1

Compare commits

...

1252 Commits

Author SHA1 Message Date
905d1c71b9 Cycles: record path guiding information for dedicated shadow ray
A flag was not enough for this, we actually need to pass along the MIS weight,
so we can compute the direct contribution without the MIS weight.

Pull Request: blender/blender#108195
2023-05-23 16:48:30 +02:00
19f46e1cae Merge branch 'main' into cycles-light-linking 2023-05-23 14:10:30 +02:00
61ed5b3d24 Depsgraph: Add explicit object collection hierarchy tracking
The practical problem this change addresses is ability to have base
flag dependent functionality in Cycles without re-setting the render
on selection. This problem initially arose during the Cycles light
linking project.

The original review happened there:

    blender/blender#105837

Pull Request: blender/blender#108182
2023-05-23 14:02:45 +02:00
94f5ea9731 Refactor instanced collection relation builder in depsgraph
Move the instancing related code to a dedicated function, leaving
the generic `build_collection()` dedicated to the building of the
collection itself.

Should be no functional changes: the code paths should effectively
still be the same. This is because non-instancing cases were passing
object as a null pointer, disabling the non-generic code path.
2023-05-23 14:02:44 +02:00
493856427d Cycles: bumping OpenPGL minimum version to 0.5 and removing version checks 2023-05-23 13:23:09 +02:00
40484a6586 Cleanup: Silence unused parameters warnings 2023-05-23 14:14:07 +03:00
e54a20b2a2 Cleanup: Remove unused collection pointer from depsgraph builder
Pull Request: blender/blender#108177
2023-05-23 12:35:23 +02:00
a9beb62449 EEVEE-Next: Fix int3 packing with MSL 2023-05-23 12:30:29 +02:00
07c59041ac GPU: Add packed_int3 for SSBO/UBO struct alignment
MSL require to use packed_int3 for compatibility
with GLSL memory layout.
2023-05-23 12:17:01 +02:00
4997748e5e Vulkan: Select Compatible Render Surface
In previous implementation the first available render surface was
selected. For NVIDIA platform this was the correct one, but for
AMD and Intel GPUs this was incorrect. This PR goes over all the
available render surfaces and selects a compatible one.

For now when no compatible render surface is found it will still select
the first available one. With the expectation that the screen is drawn
incorrectly and users would report a bug so we can investigate.

Pull Request: blender/blender#108169
2023-05-23 11:03:53 +02:00
9397bc1ed4 Merge branch 'main' into cycles-light-linking 2023-05-23 09:23:14 +02:00
793446cbdc BLI: Replace some macros with inlined functions for C++
Covers the macro ARRAY_SIZE() and STRNCPY.

The problem this change is aimed to solve it to provide cross-platform
compiler-independent safe way pf ensuring that the functions are used
correctly.

The type safety was only ensured for GCC and only for C. The C++
language and Clang compiler would not have detected issues of passing
bare pointer to neither of those macros.

Now the STRNCPY() will only accept a bounded array as the destination
argument, on any compiler.

The ARRAY_SIZE as well, but there are a bit more complications to it
in terms of transparency of the change.

In one place the ARRAY_SIZE was used on float3 type. This worked in the
old code because the type implements subscript operator, and the type
consists of 3 floats. One would argue this is somewhat hidden/implicit
behavior, which better be avoided. So an in-lined value of 3 is used now
there.

Another place is the ARRAY_SIZE used to define a bounded array of the
size which matches bounded array which is a member of a struct. While
the ARRAY_SIZE provides proper size in this case, the compiler does not
believe that the value is known at compile time and errors out with a
message that construction of variable-size arrays is not supported.

Solved by converting the field to std::array<> and adding dedicated
utility to get size of std::array at compile time. There might be a
better way of achieving the same result, or maybe the approach is
fine and just need to find a better place for such utility.

Surely, more macro from the BLI_string.h can be covered with the C++
inlined functions, but need to start somewhere.

There are also quite some changes to ensure the C linkage is not
enforced by code which includes the headers.

Pull Request: blender/blender#108041
2023-05-23 09:21:45 +02:00
a5677d225b Refactor Render Result to allow implicit buffer sharing
Allows to share buffer data between the render result and image buffers.

The storage of the passes and buffers in the render result have been
wrapped into utility structures, with functions to operate on them.

Currently only image buffers which are sharing buffers with the render
results are using the implicit sharing. This allows proper decoupling of
the image buffers from the lifetime of the underlying render result.

Fixes #107248: Compositor ACCESS VIOLATION when updating datablocks from handlers

Additionally, this lowers the memory usage of multi-layer EXR sequences
by avoiding having two copies of render passes in memory.

It is possible to use implicit sharing in more places, but needs
some API to ensure the render result is the only owner of data before
writing to its pixels.

Pull Request: blender/blender#108045
2023-05-23 09:19:37 +02:00
495e4f2d0e PyAPI: remove deprecated 2D_/3D_ prefix (update docs) 2023-05-23 16:24:08 +10:00
9a8fd2f1dd PyAPI: remove deprecated 2D_/3D_ prefix for built-in shader names
Names passed to gpu.shader.from_builtin()
no longer skip the 2D_/3D_ prefix.
2023-05-23 15:51:54 +10:00
fd68f977e0 PyAPI: remove dpi from BLF doc-string
Missed from recent removal of the argument.
2023-05-23 15:45:55 +10:00
7bc34283ea PyAPI: Operator.bl_property no longer defaults to "type"
This hard-coded assumption meant that operators would behave as if
bl_property = "type" was assigned in the operator - when the variable
wasn't found.

Remove the hard coded name. Operators that depended on this now need
to assign bl_property = "type" in the operator class explicitly.

Remove this because it wasn't documented as means operator behavior
could change unexpectedly when renaming a property.
2023-05-23 15:38:33 +10:00
345fc2b1f6 PyAPI: remove deprecated bpy.app.version_char 2023-05-23 15:25:47 +10:00
472e6563b0 Cleanup: replace strncpy calls with BLI_strncpy
Prefer BLI_strncpy as it ensures the string is null terminated.
2023-05-23 15:09:58 +10:00
d1cc16913d PyAPI: use faster argument parsing for internal bpy.ops call & poll
No functional changes.
2023-05-23 14:55:37 +10:00
ac263a9bce PyAPI: remove context override argument from bpy.ops
Remove deprecated context override argument to operator execution and
poll() method in favor of context.temp_override().
2023-05-23 14:34:09 +10:00
ab5fc46872 PyAPI: remove deprecated Mesh.calc_normals 2023-05-23 13:02:12 +10:00
8d2679e1c5 Fix wrong buffer size passed to snprintf, use BLI_snprintf
Also remove redundant call to snprintf.
2023-05-23 12:46:55 +10:00
9357f7b606 PyAPI: remove deprecated blf.size() dpi argument
Scripts can be updated by scaling the font size, e.g.

blf.size(id, size, dpi) -> blf.size(id, size * (dpi / 72.0))
2023-05-23 12:02:10 +10:00
7fbac7e235 UI: set the waiting cursor from pack/unpack operators
Remove the guimode argument which used to set the cursor back in v2.4x.
2023-05-23 11:58:20 +10:00
ad87bf3dc7 Cleanup: spelling, wording improvements 2023-05-23 11:50:34 +10:00
63074dddb1 Merge branch 'blender-v3.6-release' 2023-05-23 11:34:50 +10:00
bceb1adb20 Fix potential buffer overflow in AssetList::setup
While in practice an overflow seems unlikely in this particular case,
internal path manipulation assume FILE_MAX_LIBEXTRA so passing in
smaller buffer sizes is error prone.
2023-05-23 11:30:52 +10:00
5659e83e04 Cleanup: remove incorrect use of the r_ prefix, use sized argument
Rename `r_dir` to `dirpath` as this isn't a return only argument.
Also add the maximum size in the argument as a hint for the maximum size.
2023-05-23 11:21:02 +10:00
c440efb23a Fix invalid buffer size used in ED_asset_handle_get_full_library_path
Relatively harmless as the length was shorter, however all callers
used the larger size.
2023-05-23 10:56:22 +10:00
6ac6e63eaf Merge branch 'blender-v3.6-release' 2023-05-23 10:52:24 +10:00
93ca0444f3 Fix #108129: exception editing custom properties
Regression in [0], caused by the sub-type enum not containing NONE.

[0]: 6e2721da30
2023-05-23 10:50:36 +10:00
2c1338f67b Merge branch 'blender-v3.6-release' 2023-05-23 10:19:09 +10:00
7d682fa107 Fix missing include 2023-05-23 10:18:02 +10:00
c06e8f6549 UI: Change tooltip for edit mode display shapekey
Change terminology from Apply to Display.
Apply suggests a destructive change to
the base mesh.

Display is also used in modifiers.
2023-05-22 17:15:38 -06:00
6609ca4593 UI: Shapekey pin tooltip change
Use correct terminology "value" vs strength
2023-05-22 16:45:53 -06:00
f85fb56a4a Merge branch 'blender-v3.6-release' 2023-05-23 09:41:01 +12:00
43fe7bec4f Cleanup: format 2023-05-23 09:38:47 +12:00
a569344a81 Fix: Build error from ae9ac99d2b 2023-05-23 09:38:07 +12:00
ae9ac99d2b Fix #108117: Crash in uv editor with hidden geometry
Many "UV island" style operations internally use #UvElementMap, including:

- Transform tools
- Smart-Stitch
- UV Pinch, UV Grab and UV Relax sculpt tools.

Normally, every UV in the mesh is included in the #UvElementMap.
However, with hidden geometry, only the visible geometry is included in the map. [0]
This change enforces stricter usage, reducing the chance of crashes in other areas.

Regression from [0] which was a fix for "UV Island calculation doesn't ignore hidden faces" [1].

[0]: 8f543a73ab
[1]: #99659

Pull Request: blender/blender#108130
2023-05-22 23:23:23 +02:00
ae405639e7 Metal: Stencil texture view support
Adds stencil texture view support for Metal, allowing reading of
stencil component during texture sample/read.

Stencil view creation refactored to use additional parameter in
textureview creation function, due to deferred stencil parameter
causing double texture view creation in Metal, when this should
ideally be provided upfront.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#107971
2023-05-22 20:40:38 +02:00
5eab240f7f Merge branch 'blender-v3.6-release' 2023-05-22 18:53:56 +02:00
e25d58a866 I18n: Updated UI translations from SVN trunk (r6538). 2023-05-22 18:52:33 +02:00
ce7b006136 Fix light linking crash when raytrace shaders are used
When light-linked mesh emitter has raytrace dependent node (such as
bevel) OptiX render would have failed with an invalid address.

Pull Request: blender/blender#108154
2023-05-22 17:54:12 +02:00
4080cf1232 Refactor: change light linking object storage be dynamically allocated
To reduce memory usage of Object a bit when no light linking is in use.

Pull Request: blender/blender#108090
2023-05-22 17:51:03 +02:00
c93bb9f323 LibOverride: Minor improvement to recent liboverride API changes.
Avoid two GHash lookups when deleting an override property by its RNA
path.
2023-05-22 17:15:13 +02:00
e2fbf0193f Merge branch 'main' into cycles-light-linking 2023-05-22 17:09:26 +02:00
7d416ece82 Cleanup: fix compiler warnings 2023-05-22 17:08:50 +02:00
f9ec539a51 Merge branch 'blender-v3.6-release' 2023-05-22 10:55:21 -04:00
24ca886ac0 Revert "Animation: Update NLA "TAB" tweak mode to be full stack evaluation"
This reverts commit 0f67ac4547.
2023-05-22 10:54:57 -04:00
Sebastian Herholz
8d17458569 Cycles: Path Guiding: Adding guiding on glossy surfaces via RIS
Pull Request: blender/blender#107782
2023-05-22 16:47:05 +02:00
6cce149144 Merge branch 'blender-v3.6-release' 2023-05-22 15:27:55 +02:00
23de320878 Cycles: fix multi-device rendering with oneAPI and Hardware Raytracing
Only Embree CPU BVH was built in the multi-device case. However, one
Embree GPU BVH is needed per GPU, so we now reuse the same logic as in
the other backends.

Pull Request: blender/blender#107992
2023-05-22 15:26:58 +02:00
7b818e7bcb Merge branch 'blender-v3.6-release' 2023-05-22 15:25:35 +02:00
adb36b89c7 Fix #107988: Spreadsheet not updating when playing animation
Similar to other screen options, add one for Spreadsheet editors that
makes them update when playing animation.

NOTE: there are some editors that always update when playback was
invoked from an animation editor while others only do this when their
respective option is specifically set (think the later behavior fits the
spreadsheet better).

Pull Request: #108002
2023-05-22 15:15:22 +02:00
e70051ae3d Merge branch 'blender-v3.6-release' 2023-05-22 14:02:28 +02:00
9692262b9d Fix #108122: onion skin disappears after scrubbing timeline
This was broken in 037b3f87bd.
2023-05-22 14:01:14 +02:00
2164515fab DrawManager: Fix Incorrect Resource Binding Hair/Curves
In the DrawManager a dummy texture was attached to the a, au, c, ac
binding points. In the shader those binding points are actual texture
buffers.

The reason for the dummy texture was to work around some OpenGL driver
bugs. In Vulkan (and expected also in Metal) it is not allowed to attach
a texture as a texel buffer. Fixing this would require copying buffers into a
buffer during binding.

This patch will remove the binding of the textures and use the vbos
instead. Also it fixes an issue where a platform does support compute
shaders, but don't support transform feedback. This is currently the
case for the Vulkan backend.

Pull Request: blender/blender#108139
2023-05-22 12:59:09 +02:00
b9049411a8 I18n: disambiguate more "A" and "B" messages
In dd32dac60f, the "A" and "B" input socket from the Mix node were
disambiguated, so as not to confuse them with Alpha and Blue.

These messages are used in other nodes and elsewhere in the same
sense, so this commit adds translation contexts to these occurrences
as well.

Pull Request: blender/blender#108051
2023-05-22 12:54:39 +02:00
1ab265f535 Merge branch 'blender-v3.6-release' 2023-05-22 12:07:08 +02:00
94fd2efc96 Cleanup: remove translation headers from node files
After 22f641e7f8, translation macros were removed and thus in many
files inclusion of the translation header is no longer needed.

Pull Request: blender/blender#107986
2023-05-22 12:06:46 +02:00
0af41365e6 Cleanup: remove translation headers from node files
After 22f641e7f8, translation macros were removed and thus in many
files inclusion of the translation header is no longer needed.

Pull Request: blender/blender#107986
2023-05-22 12:05:39 +02:00
60ac9ab7a1 Fix: I18n: Vector Math node label translation function
The Vector Math node's label has a special function used to compute
its label based on the currently selected operation. This operation,
like that of the Math node, is extracted using the "NodeTree"
translation context.

Therefore, in this function it must also use the same context to
translate the label.

In addition, a few node types can have an "Unknown" label if there is
a problem with their internal state (operation, filter type, blending
type). This message can also be translated.

Pull Request: blender/blender#108029
2023-05-22 12:04:29 +02:00
1277f7a476 Merge branch 'blender-v3.6-release' 2023-05-22 12:01:45 +02:00
94934301e9 I18n: Add translation contexts to properties declared from Python
Some property labels need a context to disambiguate them from others
which have the same name.

The only way to show the proper text currently for such properties is
to override it in the UI code with a translation context, like:

```python
    layout.prop(obj, "area", text="Area",
                context=i18n_contexts.amount)
```

Python properties already store a translation context though, but this
context cannot be chosen from a Python script.

For instance, typing:

```python
bpy.types.Scene.test_area = bpy.props.BoolProperty(name="Area")
print(bpy.context.scene.bl_rna.properties['test_area'].translation_context)
```

will print `*`, the default context for Python props.

This commit allows specifying a context in this manner:

```python
from bpy.app.translations import contexts as i18n_contexts
bpy.types.Scene.test_number_area = bpy.props.BoolProperty(
    name="Area", translation_context=i18n_contexts.amount
)
print(bpy.context.scene.bl_rna.properties['test_number_area'].translation_context)
```

will now print `Amount` and can be translated differently from other
labels. In this instance, the word for a surface area measurement,
instead of a UI area.

-----

This is what translated properties look like using the existing ("Area", "") and ("Area", "Amount") messages:
![python_prop_contexts_test.png](/attachments/b0d9737e-4b31-4c91-a08e-b347db31225f)

The panel can be generated with this script:
[python_prop_contexts_test.py](/attachments/ab613cdc-8eba-46bc-8f3c-ad0a97e7a6e5)

Pull Request: blender/blender#107150
2023-05-22 11:41:48 +02:00
2decfe4f00 I18n: Add translation contexts to properties declared from Python
Some property labels need a context to disambiguate them from others
which have the same name.

The only way to show the proper text currently for such properties is
to override it in the UI code with a translation context, like:

```python
    layout.prop(obj, "area", text="Area",
                context=i18n_contexts.amount)
```

Python properties already store a translation context though, but this
context cannot be chosen from a Python script.

For instance, typing:

```python
bpy.types.Scene.test_area = bpy.props.BoolProperty(name="Area")
print(bpy.context.scene.bl_rna.properties['test_area'].translation_context)
```

will print `*`, the default context for Python props.

This commit allows specifying a context in this manner:

```python
from bpy.app.translations import contexts as i18n_contexts
bpy.types.Scene.test_number_area = bpy.props.BoolProperty(
    name="Area", translation_context=i18n_contexts.amount
)
print(bpy.context.scene.bl_rna.properties['test_number_area'].translation_context)
```

will now print `Amount` and can be translated differently from other
labels. In this instance, the word for a surface area measurement,
instead of a UI area.

-----

This is what translated properties look like using the existing ("Area", "") and ("Area", "Amount") messages:
![python_prop_contexts_test.png](/attachments/b0d9737e-4b31-4c91-a08e-b347db31225f)

The panel can be generated with this script:
[python_prop_contexts_test.py](/attachments/ab613cdc-8eba-46bc-8f3c-ad0a97e7a6e5)

Pull Request: blender/blender#107150
2023-05-22 11:38:51 +02:00
e718f29ec3 I18n: fix node socket extraction regexes
The node socket extraction regexes introduced in 6d39ba7b41 suffered
from two issues:

1. the contextless name extraction would also extract socket names
   which did have a context. To solve, this, use a negative lookahead
   at the end of the regex, containing ".translation_context(".
2. the number of characters in a message was limited to 1, because the
   _str_base component would match one or more chars after the first
   one, while it should have matched zero or more.

This last issues existed before, and the fix allows the extraction of
three new messages.

Pull Request: blender/blender#108052
2023-05-22 11:36:59 +02:00
a440386654 Merge branch 'blender-v3.6-release' 2023-05-22 11:18:37 +02:00
PaulKristoffersson
b7a71d65f8 Fix Estonian language name from #105461
Pull Request: blender/blender#108042
2023-05-22 11:13:55 +02:00
PaulKristoffersson
963c4a8baa Fix Estonian language name from #105461
Pull Request: blender/blender#108042
2023-05-22 11:10:14 +02:00
eb3e32b653 Fix #108136: Regression : Texture paint is broken
Mistake in the 406cfd214a which was calculating the offset wrongly.

Pull Request: blender/blender#108138
2023-05-22 10:45:15 +02:00
7a06588f05 Fix #102662: NLA-Strip Corrupted after reopening file w/ lib override
Mark `NlaStrip.frame_{start,end}` and `NlaStrip.frame_{start,end}_ui` as
to-be-ignored for the library override system, and add a new set of RNA
properties `frame_{start,end}_raw` that the library override system can
use.

Versioning code ensures that overrides on `frame_{start,end}` are
altered to be applied to the `..._raw` counterpart instead.

The override system uses RNA to update properties one-by-one, and the
RNA code trying its best to keep things consistent / valid. This is very
much desired behaviour while a human is editing the data.

However, when the library override system is doing this, it is not
replaying the individual steps (that each end in a valid configuration),
but just setting each property one by one. As a result, the intermediate
state can be invalid (for example moving one strip into another) even
when the end result is perfectly fine.

This is what the `..._raw` properties do -- they set the values without
doing any validation, so they allow the library overrides system to move
strips around.

This assumes that the result of the override is still valid. Logic to
detect invalid situations, and reshuffle the NLA strips if necessary, is
left for a future commit as it is related to #107990 (NLA Vertical
Reorder).

Additionally, this commit adds functions
`BKE_lib_override_library_property_rna_path_change()` and
`BKE_lib_override_library_property_search_and_delete()` to the library
override API. The former is used to change RNA paths of property
overrides, and the latter is used to remove a property override
identified by its RNA path.
2023-05-22 10:36:50 +02:00
7f4aa0b553 Merge branch 'blender-v3.6-release' 2023-05-22 10:17:40 +02:00
3695f0dffc Cycles: fix device settings update for Multi-device
Hardware Raytracing wasn't properly disabled or enabled in the
subdevices of the multi-device.

This construct:
foreach ( DeviceInfo &info,
  (device.multi_devices.size() != 0 ?
    device.multi_devices : vector<DeviceInfo>({device}))
)
was a nice trap - it was giving a copy to iterate on.

Pull Request: blender/blender#107989
2023-05-22 10:14:35 +02:00
64c33871bd Cleanup: add missing inline
This is necessary for correctness of the code to avoid duplicate symbols.
In practice, this wasn't necessary yet, because usually we pass lambdas
into these functions which cause every instantiation to have a different
signature.
2023-05-22 09:32:35 +02:00
7725bacd6a BLI: support aligned parallel reduce
Alignment here means that the size of the range passed into callback
is a multiple of the alignment value (which has to be a power of two).
This can help with performance when loops in the callback are are
unrolled and/or vectorized. Otherwise, it can potentially reduce
performance by splitting work into more unequally sized chunks.
For example, chunk sizes might be 4 and 8 instead of 6 and 6 when
alignment is 4.
2023-05-22 09:30:51 +02:00
3895261454 BLI: add size_in_bytes method to MutableSpan 2023-05-22 09:25:25 +02:00
2b49d4eeea BLI: support transferring ownership of buffers between linear allocators
This can be useful when e.g. each thread has its own `LinearAllocator`,
but in the end they are combined into one.
2023-05-22 09:25:09 +02:00
92512f224d BLI: support keeping track of how much memory a linear allocator uses
This is useful when debugging how much memory a particular function
allocates from this allocator. The change also reduces the size of
`LinearAllocator`.
2023-05-22 09:15:43 +02:00
153e1c0492 BLI: fix overload resolution with FunctionRef parameters 2023-05-22 09:03:21 +02:00
e83a2386b5 Fix #107411: Non-visible objects in the viewport affect selection collusion
When using edit mode with a mesh, if you have the retopology overlay active,
the selection of vertices, edges, or faces is occluded by the other objects.
However, if local view is on or collections with objects are hidden,
these non-visible objects can occlude the selection.

This patch discards objects that are not visible in the viewport so they
do not occlude selection.
2023-05-22 08:27:05 +02:00
fd887bcb15 Merge branch 'blender-v3.6-release' 2023-05-22 15:58:47 +12:00
96101a66fc UV: Use correct uv packing method when all/none islands are pinned.
During packing, some combinations of `Fraction` margin method, and
various locking options, interact with situations where all or none
of the islands are pinned.

Previously, the settings were queried to choose the best packing method.

Now, the islands themselves are queried if they can translate or scale,
and the packing method is chosen based on the input, rather than the
parameters.

Fixes unreported crash with "Locked Position" when all islands are pinned.

Reported as #108037 "3. In some case locked position is not respected"
2023-05-22 15:54:38 +12:00
47cbeabb11 UV: Fix uv packing problem with rotate and scale line-search
When rotation is enabled and doing a scale line-search (locked islands
or "fraction" margin method), if the `rotate_inside_square` would
result in a a tighter packing, the wrong scale value was being used,
resulting in UVs outside of the unit square.

Reported as #108037 "1. Use locked scale on after scaling UV..."
2023-05-22 15:44:01 +12:00
de4f456ea2 UV: Fix overlap problem during uv packing with scale locked islands
If an island overlaps a pinned island, and that pinned island has
locked scale, then the pinning information must be copied to the
first island so it can be scaled correctly.

Reported in #108037 as "2. Use with Merge Overlapped"
2023-05-22 15:36:03 +12:00
737f582329 Merge branch 'blender-v3.6-release' 2023-05-22 03:58:29 +02:00
a928d6d6b7 Fix #107588: Sound strip has negative length
Make sure pitch property has positive value in versioning.
Cause of 0 value pitch is unknown.
2023-05-22 03:55:52 +02:00
52f991b1a9 Fix #106484: Show all rotations with same precision
Increase precision of some rotational inputs so that they all show the
same precision. And have the arrows change in full degrees.

Pull Request: #106515
2023-05-21 10:38:07 -07:00
d81646cbce Fix #102574: Don't Show "Rename" for Volume and & System lists
For File Browser "System" and "Volumes" lists, the item names cannot be
changed by users yet the tooltip says "Double click to rename". This PR
just removes that text for these non-editable lists.

Pull Request: #106873
2023-05-21 10:29:22 -07:00
8c6908eba5 Merge branch 'blender-v3.6-release' 2023-05-21 19:30:43 +05:30
6c4da68ad2 Fix #107718: Extend channel selection not working due to key conflicts
In 80feb13665, preference for extend channel selection is changed to
ctrl-click. But some channel type invokes rename operation due to key
conflicts. Since double-click is also used for renaming, remove
ctrl-click keys for renaming.

Pull Request: blender/blender#107719
2023-05-21 15:56:01 +02:00
b58cfde48a BLI: improve IndexRange
Defining `operator-` for the iterator allows it to be used in more generic
iterator code. The `index_range` method is the same that exists on many
other containers like `Vector`.
2023-05-21 15:13:57 +02:00
f6d824bca6 BLI: move tbb part of parallel_for to implementation file
Previously, `tbb::parallel_for` was instantiated every time `threading::parallel_for`
is used. However, when actual parallelism is used, the overhead of a function
call is negilible. Therefor it is possible to move that part out of the header
without causing noticable performance regressions.

This reduces the size of the Blender binary from 308.2 to 303.5 MB, which is
a reduction of about 1.5%.
2023-05-21 13:31:32 +02:00
57f593b7ca Merge branch 'blender-v3.6-release' 2023-05-21 13:50:45 +10:00
047ff43ee4 Fix GHOST/Wayland configuring an XDG surface before it was handled
xdg_surface_ack_configure must run once the events have been handled
which is not the case configure runs from the event handling thread.

In practice this could lead to glitches resizing windows, although some
flickering on startup remains on KDE which would be good to resolve.
2023-05-21 13:47:56 +10:00
43d66f6760 Cleanup: Fix copyright date in new bke header
Pull Request: blender/blender#108112
2023-05-21 03:43:06 +02:00
f637b8c095 UI: Rename Copy Vertex Group to Duplicate Vertex Group
Change display name of OBJECT_OT_vertex_group_copy to "Duplicate Vertex
Group" from "Copy Vertex Group". The word "duplicate" is a better
unambiguous descriptor of this operation.

Pull Request: blender/blender#107691
2023-05-21 02:02:10 +02:00
ab294b4ebb Cleanup: spelling in comments, colon after doxy parameters 2023-05-20 21:24:42 +10:00
8925ea1890 Merge branch 'blender-v3.6-release' 2023-05-20 21:18:02 +10:00
bf36a61e62 Cleanup: spelling in comments & some corrections 2023-05-20 21:17:09 +10:00
8783a51583 Merge branch 'blender-v3.6-release' 2023-05-20 20:31:36 +10:00
7c169ddd67 Cleanup: format 2023-05-20 20:31:31 +10:00
1d6eb9bc93 Fix UV vertex snap while transforming snapping to itself
When the mouse cursor was close to the selection being transformed,
the UV's could snap to themselves.
2023-05-20 20:28:11 +10:00
8e38e45be5 Cycles: skip non-emissive and non-linked meshes when finding mesh lights with ray
Ref #104972

Pull Request: blender/blender#108091
2023-05-19 23:53:51 +02:00
33c13ae6e3 Transform: support navigation while transforming in 3D view
Implements a new option in keymap settings:
- "Navigate during Transform"

Note that with the option enabled, the keymap changes as follows:

|Modal Map (Blender):| Conflict: | Current: | New:
|---|---|---|---
| Increase Proportional Influence | VIEW3D_OT_zoom | Wheel Down | Alt Wheel Down
| Decrease Proportional Influence | VIEW3D_OT_zoom | Wheel Up | Alt Wheel Up
| Adjust Proportional Influence | VIEW3D_OT_rotate | Mouse/Trackpad Pan | Alt Mouse/Trackpad Pan
| Increase Max AutoIK Chain Length | VIEW3D_OT_zoom | Wheel Down | Alt Wheel Down
| Decrease Max AutoIK Chain Length | VIEW3D_OT_zoom | Wheel Up | Alt Wheel Up
| Automatic Constraint | VIEW3D_OT_rotate | Middle Mouse | Alt Middle Mouse
| Automatic Constraint Plane | VIEW3D_OT_move | Shift Middle Mouse | Shift Alt Middle Mouse

Design Task: #106008
Pull Request: blender/blender#105764
2023-05-19 23:45:27 +02:00
2ce365efc7 View 3D: new utility to provide navigation in operators
Implements a new API consisting of:
- `ED_view3d_navigation_init`,
- `ED_view3d_navigation_do` and
- `ED_view3d_navigation_free`,

With these functions, any operator can create their own navigation
context and navigate in the 3D View without having to use
`PASS_THROUGH`.
2023-05-19 18:20:13 -03:00
552c262cee Merge branch 'blender-v3.6-release' 2023-05-19 23:00:34 +02:00
575772d70d install_linux_packages: update library versions for 3.6 release.
Following #104895 specs for versions.
2023-05-19 22:47:53 +02:00
f17ea1f2a7 Geometry Nodes: Remove realize instances legacy behavior
The option was added f5ce243a56 when the node was
rewritten to add support for propagating instance attributes.
2023-05-19 14:02:53 -04:00
ea64b2ce08 Cleanup: Remove deprecated unused fields in raycast node 2023-05-19 14:02:53 -04:00
c435d2f856 Metal: Always add GPU_TEXTURE_USAGE_ATTACHMENT flag
Texture clearing is done using framebuffer clear.
To avoid adding the flag everywhere we add it as part
of the texture creation process.

This should have no performance impact.
2023-05-19 18:48:07 +02:00
8bca0e1075 Cleanup: Format python after recent changes
Pull Request: blender/blender#108086
2023-05-19 18:20:27 +02:00
b40b59935d Metal: Force Compute shaders workgroup max thread count
This forces the max thread count to be inlined with what
blender expects. While this will make some shaders less
eficient it avoid crashes / assert on shaders that
could not compile. The performance impacts can be fixed
by tackling the individual cases.
2023-05-19 18:08:49 +02:00
cc662e55bb Fix shadow linking using indirect clamping values
Follow the main path rules for the light clamping.

Pull Request: blender/blender#108084
2023-05-19 18:08:41 +02:00
560e9c654b UI: Edit Mode Options panel cleanup
AutoMerge is a property of transform operations, so it seems more
convenient to have this option bundled with transform settings.

Another thing is that the 'Live Unwrap' option has no real relation to
Transform.

Therefore, remove the 'AutoMerge' sub-panel and create two sub-panels
for the Options Panel:
- Transform
- UVs

Merge the 'AutoMerge' settings into the 'Transform' sub-panel.

Move 'Live Unwrap' to the 'UVs' sub-panel.

Pull Request: blender/blender#108056
2023-05-19 17:32:46 +02:00
8cc22d2809 Workaround Cycles regression test failures
The failure happens since the recent changes in the make_orthonormals.

The only difference is the underwater caustics test file, and the
difference seems to be a noise floor.

There seems to be nothing wrong with the math in the function itself:
the return values are all without quite small epsilon when comparing
Linux with M2 macOS. The thing is: the very first input is already a
bit different on different platforms. So the difference is already
somewhere else.

For now increase the threshold to avoid confusion of the rest of the
team, and to allow builds to be deployed.

Pull Request: blender/blender#108080
2023-05-19 16:42:08 +02:00
e0e182d5e9 Cleanup: deduplicate code to obtain the object for the transform space 2023-05-19 11:09:50 -03:00
b060beae17 Merge branch 'blender-v3.6-release' 2023-05-19 15:53:44 +02:00
370b7ae917 Fix #107889: Scale Cage gizmo wrong in editmode with rotated objects
Object transforms were already respected, issue was just pre vs. post
matrix multiplication when local axis were used.

Should go into LTS as well I guess.

Pull Request: blender/blender#108076
2023-05-19 15:51:28 +02:00
2a56403cb0 Mesh: Move bevel weight to generic attribute
Store bevel weights in two new named float attributes:
- `bevel_weight_vert`
- `bevel_weight_edge`

These attributes are naming conventions. Blender doesn't enforce
their data type or domain at all, but some editing features and
modifiers use the hard-coded name. Eventually those tools should
become more generic, but this is a simple change to allow more
flexibility in the meantime.

The largest user-visible changes are that the attributes populate the
attribute list, and are propagated by geometry nodes. The method of
removing this data is now the attribute list as well.

This is a breaking change. Forward compatibility is not preserved, and
the vertex and edge `bevel_weight` properties are removed. Python API
users are expected to use the attribute API to get and set the values.

Fixes #106949

Pull Request: blender/blender#108023
2023-05-19 14:31:31 +02:00
51923c09e2 Cycles: implement faster #make_orthonormals()
Pull Request: #106053
2023-05-19 12:13:39 +02:00
3a286a735f Merge branch 'blender-v3.6-release' 2023-05-19 19:56:20 +10:00
c007e6a346 Fix occasional crash on exit under Wayland
pthread_cancel was sometimes called once the thread had exited,
resolve this by having the function wait to be canceled.
2023-05-19 19:51:42 +10:00
e620ae054f Merge branch 'blender-v3.6-release' 2023-05-19 19:26:01 +10:00
8a4ab1b3fe Fix assertion in BLI_path_normalize & add test 2023-05-19 19:25:08 +10:00
9e5e06136a Fix motion tracking not tracking at all
A mistake in the recent ImBuf API refactor: the Libmv image accessor
was copying destination to destination (possibly using the wrong
number of channels as well).

Pull Request: blender/blender#108070
2023-05-19 10:48:49 +02:00
c267256f01 Fix #105830: Add depth bias for overlay faces in Metal
Resolves z-fighting blocking artifacts on faces due to limited
depth precision at certain camera positions. Depth bias
offsets the calculation enough without affecting display.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#108048
2023-05-19 09:23:17 +02:00
9af19822f0 Merge branch 'blender-v3.6-release' 2023-05-19 16:27:42 +10:00
2ce7f3ec71 Fix crash on exit under Wayland with multiple windows open
Exiting with multiple overlapping windows (a file selector for e.g.)
reliably crashes.

Closing the windows on exit caused the the keyboard enter handler to be
called with a NULL window surface (wl_surface).

While this doesn't look to be documented anywhere, SDL's code-comments
note this happens when windows have just been closed.
GTK also check surfaces for NULL.
2023-05-19 16:25:56 +10:00
3db0bde21d Merge branch 'blender-v3.6-release' 2023-05-19 15:14:27 +10:00
2eaacbaa3f Fix memory leak on exit under GHOST/Wayland 2023-05-19 15:10:51 +10:00
712d177aa3 Cleanup: avoid strcpy for initializing ID names
While strcpy is safe in this case, it's use requires extra scrutiny
and can cause problems if the strings are later translated.

Also move the ID code assignment into material_init_data
as the ID-code is more of an internal detail.
2023-05-19 15:01:03 +10:00
ec8a4cfcb7 Merge branch 'blender-v3.6-release' 2023-05-19 14:34:42 +10:00
2c6e88da96 Fix memory leak in copy_to_selected_button
Memory leak introduced in [0] early return cleanup.

[0]: a25a1f39aa
2023-05-19 14:29:46 +10:00
71d22331b1 Cleanup: Rename mesh loose edges tag function
To match the more recently added `tag_loose_verts_none`.
2023-05-18 23:06:15 -04:00
381fae91b1 Geometry Nodes: Keep loose vert/edge tags for extrude and split edges
If there are no loose vertices or edges, it's basically free to
propagate that information to the result and save calculating
it later in case it's necessary. I observed a peformance increase
from 3.6 to 4.1 FPS when extruding a 1 million face grid.
2023-05-18 23:06:15 -04:00
c7a508be50 Cleanup: pass boolean to text_drawcache_tag_update
Also remove redundant CTX_wm_space_text(C) calls.
2023-05-19 13:02:15 +10:00
6fbad2ce7e Merge branch 'blender-v3.6-release' 2023-05-19 12:53:53 +10:00
bb543620ae Fix invalid UTF8 strings being copied into the Python console
Add a ensure_utf8 argument to WM_clipboard_text_get so callers don't
have to handle validation themselves.

Copying non-utf8 text into the Python console and buttons was possible,
causing invalid cursor position and a UnicodeDecodeError accessing
ConsoleLine.body from Python.
2023-05-19 12:49:27 +10:00
8ad2ee7f12 Cleanup: function style C++ casts, use printing & ELEM macros 2023-05-19 11:35:59 +10:00
2aa01c3807 Cleanup: quiet discard const warning 2023-05-19 11:34:45 +10:00
dad9e8e621 Fix #102574: Don't Show "Rename" for Volume and & System lists
For File Browser "System" and "Volumes" lists, the item names cannot be
changed by users yet the tooltip says "Double click to rename". This PR
just removes that text for these non-editable lists.

Pull Request: blender/blender#106873
2023-05-19 01:17:28 +02:00
40ccc37fc6 VSE: Add go to current frame operator to view menu 2023-05-19 00:46:53 +02:00
b34ece48f8 Fix #106484: Show all rotations with same precision
Increase precision of some rotational inputs so that they all show the
same precision.  And have the arrows change in full degrees.

Pull Request: blender/blender#106515
2023-05-19 00:25:05 +02:00
8cde7d8f8a Cycles: Merge Anisotropic BSDF node into Glossy BSDF node
Used to be https://archive.blender.org/developer/D17123.

Internally these are already using the same code path anyways, there's no point in maintaining two distinct nodes.

The obvious approach would be to add Anisotropy controls to the Glossy BSDF node and remove the Anisotropic BSDF node. However, that would break forward compability, since older Blender versions don't know how to handle the Anisotropy input on the Glossy BSDF node.

Therefore, this commit technically removes the Glossy BSDF node, uses versioning to replace them with an Anisotropic BSDF node, and renames that node to "Glossy BSDF".

That way, when you open a new file in an older version, all the nodes show up as Anisotropic BSDF nodes and render correctly.

This is a bit ugly internally since we need to preserve the old `idname` which now no longer matches the UI name, but that's not too bad.

Also removes the "Sharp" distribution option and replaces it with GGX, sets Roughness to zero and disconnects any input to the Roughness socket.

Pull Request: blender/blender#104445
2023-05-18 23:12:20 +02:00
3a839cc52b Merge branch 'blender-v3.6-release' 2023-05-18 16:07:41 -04:00
0f67ac4547 Animation: Update NLA "TAB" tweak mode to be full stack evaluation
This PR updates the key mapping (TAB) for Tweak mode (Lower stack) to Full stack for the NLA editor

[Issue](blender/blender#108026)

Pull Request: blender/blender#108050
2023-05-18 22:06:19 +02:00
fc06a471f1 Geometry Nodes: Only use realized geometry in mesh boolean node
Since 44e4f077a9 and related commits, geometry nodes doesn't
try to hide the difference between real geometry data and instances from
the user. Other nodes were updated to only support real geometry, but
the "Mesh Boolean" node was never updated and still implicitly gathered
all the instances. This commit removes the special instance behavior in the
boolean node and adds realize instances nodes to keep existing behavior
in most cases. Typically this doesn't make a difference in the result,
though it could in the union mode for instance inputs. Shifting more of
the work to realizing instances should generally be better for
performance, since it's much faster.
2023-05-18 15:08:53 -04:00
30a20b4def Nodes: Remove deprecated useless width_hidden property
See 7b82d8f029
2023-05-18 13:37:55 -04:00
0eba8ac85a Fix #108034: Multires simple subdivide crash
Before 9f78530d80, the -1 coarse_edge_index values in the
foreach_edge calls would return false in BLI_BITMAP_TEST_BOOL,
which made them look like loose edges. BitSpan doesn't have this
problem, so the return for negative indices must be explicit.
2023-05-18 13:28:37 -04:00
406cfd214a Refactor ImBuf buffer access
The goal is to make it more explicit and centralized operation to
assign and steal buffer data, with proper ownership tracking.

The buffers and ownership flags are wrapped into their dedicated
structures now.

There should be no functional changes currently, it is a preparation
for allowing implicit sharing of the ImBuf buffers. Additionally, in
the future it is possible to more buffer-specific information (such
as color space) next to the buffer data itself. It is also possible
to clean up the allocation flags (IB_rect, ...) to give them more
clear naming and not have stored in the ImBuf->flags as they are only
needed for allocation.

The most dangerous part of this change is the change of byte buffer
data from `int*` to `uint8_t*`. In a lot of cases the byte buffer was
cast to `uchar*`, so those casts are now gone. But some code is
operating on `int*` so now there are casts in there. In practice this
should be fine, since we only support 64bit platforms, so allocations
are aligned. The real things to watch out for here is the fact that
allocation and offsetting from the byte buffer now need an explicit 4
channel multiplier.

Once everything is C++ it will be possible to simplify public
functions even further.

Pull Request: blender/blender#107609
2023-05-18 10:19:01 +02:00
07058765b9 Merge branch 'blender-v3.6-release' 2023-05-18 13:32:23 +10:00
6dcebc68d6 Fix "~" expanding to the default document directory instead of HOME
Originally this function expanded to the home however on WIN32
functionality changed to return the default Documents directory & the
function was renamed. Always expand "~" to the users home directory
since that's what it represents when used at the beginning of a path.
2023-05-18 13:30:40 +10:00
9fbadc98cd Merge branch 'blender-v3.6-release' 2023-05-18 09:34:42 +10:00
a9358f5274 Fix Blender failing to start in Gnome when X11 isn't available
Only make libdecor a hard-requirement for using Wayland in gnome-shell
when X11 is available, as it's possible to disable Xwayland.

This also fixes window-borders not being used in gnome-shell when
WITH_GHOST_X11 is off.

Now it's possible to test Blender under gnome without libdecor by
uninstalling libdecor & running with DISPLAY environment variable
set to an empty string - useful for troubleshooting issues which
could be caused by libdecor.
2023-05-18 09:33:46 +10:00
4368b0e296 Merge branch 'blender-v3.6-release' into main 2023-05-17 16:41:37 -06:00
96867a713b CMake/Windows: Blacklist MSVC 17.6.x
Code gen bugs can happen, ad usually they can be worked around
MSVC 17.6 is not one of those cases:

59% tests passed, 120 tests failed out of 296

There really is no other choice than to refuse to build with this
compiler. Alternates that CAN be used are both 17.5 and the current
17.7 preview builds.

Upstream tracking ticket kindly submitted by @deadpin :
https://developercommunity.visualstudio.com/t/vs176/10293729

If a compiler is released in the 17.6.x series that has the bug
fixed, we can contract the range of blacklisted compiler versions
to cover just the affected range, for now however all of 17.6 marked
bad
2023-05-17 16:40:51 -06:00
180c72a708 Cleanup: Add version after linking function for 4.0 series 2023-05-17 17:02:07 -04:00
468295cb7c Cleanup: Add a function to sample mesh point normals
This simplifies #108014 and is consistent with the existing function
for face corners, `sample_corner_normals`.
2023-05-17 16:54:22 -04:00
f106579a9a Cleanup: Add function to check if named custom data layer exists 2023-05-17 16:16:54 -04:00
9bdfb15e98 Cleanup: Remove redundant writing of old face set type
Face sets are now always saved with the generic float type
2023-05-17 14:34:52 -04:00
d41021a7d4 Mesh: Remove deprecated face/vert custom data API
Remove six collection properties from Mesh that are redundant
with the attribute API which has a nicer API and more features.
- `vertex_layers_float`
- `vertex_layers_int`
- `vertex_layers_string`
- `polygon_layers_float`
- `polygon_layers_int`
- `polygon_layers_string`
2023-05-17 14:10:00 -04:00
6805657a39 Mesh: Remove sculpt vertex colors from RNA API
Added in f7bbc7cdbb, these were never exposed in an
official release, and were eventually replaced by the attribute system.

Ref #100153
2023-05-17 13:41:16 -04:00
1b63a290c6 Core: Write mesh and movieclip with new format
Finish the transition from #95966 and fe38715600 by
writing files with the new format for meshes and some movie clip fields.
This removes overhead when saving files, and makes meshes saved in
files smaller (a file with a 1 million face grid changed from 32 to 28 MB).

3.6 can still read files saved with this format, but older versions will
crash. Older files are automatically converted by versioning code when
opened.

This also allows removing all the code that converts from the new
format to the legacy format, previously used when saving files.

Pull Request: blender/blender#108015
2023-05-17 19:03:16 +02:00
79e85d3acb Light linking: Reduce noise for shadow linked distant lights
If there is a default blocker at the path to the distant light
the code did not ignore distant lights.

The blockers from the default set were already leading to the
other light types from being ignored because of the assignment
of the ray->tmax.

Pull Request: blender/blender#108022
2023-05-17 18:36:34 +02:00
39a5025032 UI: Use fixed width for grid view items, don't stretch to full width
No user visible changes expected (since grid-views are only used in
branches right now).

This just makes grid view UIs feel more "stable" while scaling areas,
since things don't move around as much anymore. The tradeoff is that
there may be some empty space on the right, if there's not enough space
for a full column. This is how the file browser already behaves, and can
be mitigated by a smaller preview size.
2023-05-17 18:20:34 +02:00
f68860a364 Fix light linking multiple light pick criteria
The probability was inverted.
2023-05-17 18:14:23 +02:00
c89354da80 UI: Properly center text under previews
The text under previews would be quite close to the preview, so that
there was more space below it than above. Center it vertically in the
available space now. Also, the horizontal padding was only applied to
the right side of the text rectangle, meaning horizontally centered text
would be too far left. Apply the padding equally, this doesn't affect
available space for the text too much.

See #108018 for before/after pictures.

Pull Request: blender/blender#108018
2023-05-17 18:10:54 +02:00
479aa64326 Merge branch 'blender-v3.6-release' 2023-05-17 12:00:39 -04:00
112a5196f6 Fix: Missing loose vertices converting BMesh to Mesh
Mistake in 6323d56eb5
2023-05-17 11:58:49 -04:00
76112f1439 Fix double highlighting of preview tiles in asset view template
The highlighting of preview tiles would be too strong in asset view
templates and grid views (only used in branches so far). This is because
two buttons are overlayed on top of each other, and both would
highlight. Ensure the overlayed preview tile button doesn't use any
highlighting.
2023-05-17 17:54:35 +02:00
d4217c278e Fix excessive vertical margin between items in asset view template
The UI list and asset view preview size calculations were out of sync,
so the UI list made more space than the preview actually used. Making
them match made the previews quite large though, so compensate that by
scaling the layout down.
Remove the related TODO comment, since this uses a common function for
getting the preview size now.

Before/after:
![Screenshot from 2023-05-17 17-33-19.png](/attachments/0ac713a3-12d9-41b6-ab50-85790da765a9) ![Screenshot from 2023-05-17 17-42-15.png](/attachments/0def65b5-6b16-4431-9a9e-592ed3d9675f)

Pull Request: blender/blender#108017
2023-05-17 17:49:16 +02:00
430b2716c8 Workbench Next: Volumes: Don't draw on top of "in front" objects 2023-05-17 17:34:16 +02:00
7a5a69a6b6 Fix compilation error after merge
The BLO API was changed: need to pass an id now.
2023-05-17 16:53:14 +02:00
27944ab156 Merge branch 'main' into cycles-light-linking 2023-05-17 16:46:44 +02:00
086dada878 Fix/Update the 'search previous startup data' versioning logic.
`PREFERENCES_OT_copy_prev` handling of versionning was for older release
cycles type (pre-3.0), now that we are in 4.0, we can use a simpler
logic: Just look for startup data from this major release cycle (i.e.
4.x currently) and the previous one (i.e. all 3.x releases).

Fixes the 're-use previous settings' option not showing when first
starting 4.0 build.
2023-05-17 16:38:56 +02:00
a9193a9ad2 Refactor ID liblinking on readfile to take ID pointer.
The usage of the lib pointer was cryptic to say the least, it was
essentialy used to allow or not local IDs results in the mapping
old_id_pointer -> new_id_pointer lookup result.

Now:
- Explicitely pass a boolean to allow or not local ID as result in
  lower-level code.
- Pass the 'self ID' pointer instead of its library to the whole
  liblinking code (that was already the case in a few places).

Note that naming of the 'self id' pointer is currently very inconsistent
throughout the readfile liblink code, this will have to be cleaned up in
a separate step later. For now, `self_id` has been chosen for new code
as it matches the terminology in lib_query code.

The later change can also allow finer handling of lookup on undo, based
on how it was re-read (or not), should the need for this arise.
2023-05-17 16:38:56 +02:00
ac6af0be7b Cleanup: Add enum type for drag data type definitions
Adds type safety and enables compiler features like warnings on missing
enumerator in switches.
2023-05-17 16:10:51 +02:00
aa2eb422a7 Merge branch 'blender-v3.6-release' 2023-05-17 14:44:19 +02:00
5531d610f9 Fix warning in USD curves exporter
Use timecode.GetValue() to fix warning about passing correct 'double' type to 'WM_reportf'

Co-authored-by: DESKTOP-ON14TH5\Sonny Campbell <sonny.campbell@unity3d.com>
Pull Request: blender/blender#108008
2023-05-17 14:43:59 +02:00
df48490db2 Fix warning in USD curves exporter
Use timecode.GetValue() to fix warning about passing correct 'double' type to 'WM_reportf'

Co-authored-by: DESKTOP-ON14TH5\Sonny Campbell <sonny.campbell@unity3d.com>
Pull Request: blender/blender#108008
2023-05-17 13:39:26 +02:00
feaeb7e6ad Revert "Release cycle: 3.6 enters beta, Bcon3."
This reverts commit 2dd0a08aff.
2023-05-17 13:05:32 +02:00
04166c0af6 Merge branch 'blender-v3.6-release' 2023-05-17 13:05:15 +02:00
2dd0a08aff Release cycle: 3.6 enters beta, Bcon3.
Splash screen: Pet Projects, Blender Studio.
2023-05-17 13:02:49 +02:00
9dfb00c500 Merge branch 'main' into cycles-light-linking 2023-05-17 12:49:38 +02:00
7be3a0a727 Release cycle: Bcon1 for Blender 4.0, alpha. 2023-05-17 12:39:01 +02:00
2d66a0ef84 EEVEE: Add Transparent Render-Pass option
This renderpass pass outputs alpha blender surface
to allow combining them with the opaque passes.

Limitation: This only supports monochromatic opacity.
Colored opacity will show differently than in combined pass.

Pull Request: blender/blender#107890
2023-05-17 11:57:36 +02:00
39644e7f71 Workbench: Fix compiler warnings 2023-05-17 11:52:49 +02:00
bafd82c9c1 Cycles: oneAPI: use local memory for faster shader sorting
Co-authored-by: Stefan Werner <stefan.werner@intel.com>

Pull Request: blender/blender#107994
2023-05-17 11:07:57 +02:00
04fc6fd8a7 Cycles: avoid doing zero-sized allocations with partitioned shader sorting 2023-05-17 11:07:56 +02:00
eac3d37ab1 Fix #107422: Mesh context menus do not open with the last used option
Caused by 99e5024e97

Above commit changed behavior in that it only flagged the `uiBlock` with
`UI_BLOCK_POPUP_MEMORY` in case a Menu's title was provided to
`ui_popup_menu_create_block`. Now when is the title provided? This
depends on the `bl_label` set in the menu class. But this is not always
the case, there are some menus that have a blank `bl_label` (as seen
with `VIEW3D_MT_edit_mesh_context_menu` for example -- this specifies its
own label inside the draw function depending on vertex/edge/face mode).
Thus the provided title is not really reliable as source information to
do the flagging (also see for example
a38b98478a), flagging should **always** be
done [and only check a title for actually inserting in the puphash].

Choosing an entry in a menu will still handle puphash later (see
`button_activate_exit`) though multiple menus without a label might fight for the
same storage of the menu memory. Using idname instead (or in combination with
the label) for the hash could be looked at to solve this.

Pull Request: blender/blender#107427
2023-05-17 10:41:17 +02:00
a5207ae24d Fix error returning the path length from BLI_path_normalize
Error in [0] caused the returned length to be wrong when skipping the
prefix. Also fix normalized path comparison failing on windows.

[0]: f45a985217
2023-05-17 17:47:35 +10:00
e27cb91442 BLI_path: add native path canonicalize function
This function handles cleaning valid system paths that are functional
when passed to `open(..)` but may be relative to the current working
directory or have redundant slashers that can be normalized.
2023-05-17 13:42:51 +10:00
0099f51cdd Cleanup: sort file, uppercase booleans, add missing headers
Also update files to ignore for check_cmake.
2023-05-17 13:13:10 +10:00
139f4981d4 Cleanup: return early, reduce indentation 2023-05-17 13:13:10 +10:00
1d32a36540 Cleanup: add utility functions for checking WIN32 drive letters
Avoid character checks in-line.
2023-05-17 13:13:10 +10:00
52eb1f2ba0 Cleanup: use BLI_rename where overwriting isn't needed
Use BLI_rename as the destination is removed before renaming.
2023-05-17 13:13:10 +10:00
f45a985217 Cleanup: use BLI_path_slash_ensure instead of performing this in-line
- Add BLI_path_slash_ensure_ex which takes the string length.
- Normalize functions now return the string length,
  so ensuring trailing a trailing slash is a simple check.

This would have avoided the off-by-one error from
761eac2f5d.
2023-05-17 13:12:49 +10:00
761eac2f5d Fix buffer overflow in BLI_path_append 2023-05-17 13:11:17 +10:00
0ae286be03 Fix trailing slashes causing normalized path comparison to fail 2023-05-17 13:11:17 +10:00
f1d436a3aa Core: Improve error message for make relative/make absolute operators
This improves the warning messages when make relative/absolute fails to add more context and help in tracking down problems.

Pull Request: blender/blender#107914
2023-05-17 05:02:39 +02:00
c8b5b17d40 Cleanup: format 2023-05-17 11:35:46 +12:00
354ef89d20 Fix lite build error
Missing dummy function definition in 4dc026ec8e.
2023-05-17 01:03:47 +02:00
b8173278b0 Cycles: oneAPI: set correct work group sizes for kernels that have a predefined one 2023-05-17 00:02:12 +02:00
a17d07ee87 Cycles: oneAPI: Fix prevented execution with sycl runtime > 20230323
NanoVDB headers have unused code using "double" type, which is not supported on Arc GPUs.
Recent DPC++ changes enforced runtime verifications:
7663dc201d
which prevents execution when such type has been present even if unused.
This is a solution to avoid double to be compiled at all, similar as how it is done for Metal.
2023-05-17 00:00:52 +02:00
4dc026ec8e VSE: Smooth transition for retiming tool
This feature implements smooth transition between 2 retimed segments.

A transition can be added by dragging retiming handle while holding
shift key. When any handle defining transition is removed, the
transition segment is removed and 2 linear segments are restored to
state before transition was created.

These transitions work with video and sound and changes are reflected
in waveforms with correct seeking, therefore it replaces usage of
`speed_factor` or earlier sound `pitch` property.

Smooth transition is achieved by evaluating Y value of circular arc,
that is tangent to lines of linear retimed segments. Because of this,
when transition length is changed both handles are moved symetrically.
This way it is possible to make transition without affecting content in
linear segments.
When linear segment after transition is further retimed, this shifts
content inside of a transition segment.

To support sound, `SEQ_retiming_sound_animation_data_set` and related
data structures has been updated to build speed table for each smooth
transition segment. Layering of retiming data via meta strips is still
fully supported.

Pull Request: blender/blender#107197
2023-05-16 22:33:13 +02:00
35be844c34 Fix #106621: Crash Adding GN Menus to Quick Favorites
Check for empty AssetItemTree when accessing Quick Favorite menu items.

Pull Request: blender/blender#107984
2023-05-16 20:50:46 +02:00
75c2d511ad Fix: Add 'typename' to fix build error
A `typename` was missing in 3195c1a669 which caused build errors
on all platforms except Windows.
2023-05-16 20:05:17 +02:00
1164976dd8 USD Export: New Curves/Hair Support
Previous patch location: https://archive.blender.org/developer/D16545

This patch addresses blender/blender#102376

A new writer is added, the usd_writer_curves.cc to handle transforming the new curves system into USD.

The goal was to enable export of the new curves type, but @HooglyBoogly mentioned there is a `curve_legacy_to_curves` utility function that could also handle converting legacy curves to the new Curves type. This very trivially enables the legacy curves for export too so I have included that change in this patch.

Co-authored-by: DESKTOP-ON14TH5\Sonny Campbell <sonny.campbell@unity3d.com>
Pull Request: blender/blender#105375
2023-05-16 20:04:18 +02:00
6ae44c4770 UI: Allow Configuration of Some Operator Confirmations
Allow users to disable/enable 14 operator confirmations in the Keymap
Editor.

Pull Request: blender/blender#107765
2023-05-16 20:03:45 +02:00
6644f08d65 Fix wrong light tree PDF with light linking, due to wrong node skipping 2023-05-16 19:27:09 +02:00
fc70eb1fb5 Fix #106655: Update Mesh Symmetry Buttons
Update the XYZ Symmetry buttons if they are toggled without mouse
click, for example from a script or keyboard shortcut.

Pull Request: blender/blender#106679
2023-05-16 19:24:44 +02:00
3195c1a669 Geometry Nodes: Add Sample Volume node
This commit adds a new experimental node "Sample Volume".
It's purpose is to be able to sample values from a volume grid given
a position field.
The 'Grid' input accepts a named attribute input with the name
of the volume grid to sample. Values will be implicitly converted
from the grid type to the specified value type.

Pull Request: #107656
2023-05-16 19:08:08 +02:00
1cc95b280e Light Linking: Support shadow linking to emissive meshes
This includes picking up a mesh emitter with the check for a fully
blocked light by a blocker with default linking configuration.

Implemented using an intersection loop, which might not have the
best performance compared to intersect-all behavior, but allows to
use some specialized for the shadow linking ray manipulations and
object flags check.

Ref #104972

Pull Request: blender/blender#107981
2023-05-16 18:39:21 +02:00
cc498697ab Cleanup: Core: lib_query: Make names of self and owner ID data consistent.
Internal private struct was using `owner_id`/`self_id`, while the public
callback data struct was using `id_owner`/`id_self`.

Now using internal naming everywhere in lib_query related code, as
`owner_id` is already used in very low-level 'fundamental' part of the
code, e.g. in the `PointerRNA` struct, or in ID's 'loopback' pointers
for embedded data.

Note that this is only a very small first step toward proper naming
consistency for these type of data, the mismatch is currently spread all
over the code base.

We also need to document more formally the meaning and differences
between `self` and `owner` here.
2023-05-16 18:37:35 +02:00
54855dcec3 UI: Add timeline to Geometry Nodes workspace
With simulations integrated into geometry nodes it makes more sense than
ever to have a timeline in the Geometry Nodes workspace by default.

Pull Request: blender/blender#107982
2023-05-16 18:31:27 +02:00
5d89b6a113 Light linking: Support distant lights for shadow linking
Follows the logic of the non-distant lights.

Ref #104972

Pull Request: blender/blender#107979
2023-05-16 17:59:52 +02:00
122adc9e69 Fix asset list not providing some previews
Fixes preview images not showing up in asset-view templates or the in
development asset shelf.

The sliding-window optimization to only load previews that are in view
(or close to it) can't really be used by the asset-list API, since
figuring out what's actually in view is a bit tricky. So we have to
ensure all previews are loaded for now.
2023-05-16 17:48:02 +02:00
74b5e62d2a Fix #107633: USD import: duplicate shader nodes
This pull request addresses bug blender/blender#107633

Added logic to avoid creating duplicate Blender shader nodes when
converting USD Preview Surface shaders that are connected to more
than one input.

This change adds a `NodePlacementContext::node_cache` map to record
Blender nodes converted for given USD shaders.  The node creation
logic has been updated to query this cache to check if a node was
previously created for a given USD shader, before creating a
new node.

Pull Request: blender/blender#107945
2023-05-16 17:46:25 +02:00
859c0d9edf Cleanup: Remove redundant node type lookup function
Using the topology map gives a constant time lookup, since it has a map
of nodes per type. The collada code used the old function, but had been
ifdef'd for four years, so it's removed here.
2023-05-16 11:09:42 -04:00
216cb9e3f0 Fix: Assert loading undefined geometry node 2023-05-16 11:09:42 -04:00
eb0e03bae7 Workbench Next: Volumes
Port of the Workbench volumes to Workbench Next using the new Draw Manager API.

Pull Request: blender/blender#105501
2023-05-16 16:56:21 +02:00
ea42227e2f Light Linking: Unify meaning of the light sets
Previously the default (affect all) light set would depend on
whether there is light linking in the scene or not: if there is
light linking the set would be set to 0, but when there is light
linking and light is not linked to anything the set would be all
bits set.

This change makes it so the light set is always all bits sets
regardless of whether there is no light linking in the scene at
all, or the light is not explicitly linked to anything.

This simplifies the mental model while working on the kernel
code and should not cause any functional changes. Additionally,
it seems that it will allow to avoid some of the kernel_features
check in the kernel prior to access the bitmask.

Pull Request: blender/blender#107978
2023-05-16 16:47:29 +02:00
689062e067 Light Linking: Select one of dedicated lights
Before this change the shadow ray for shadow linking was picking the
closest light. Now a random light on the ray is chosen.

This is more noisy than integrating all lights in the direction of the
main path, but this is the only way to properly support complex
scenarios where there are multiple blockers between the shading point
and the light sources, with different linked settings.

Another unfortunate aspect of this change is increased state size.
This is because the light sample needs to be scaled, so some extra
information is needed. From the intersection kernel it is not yet
possible to write to the shadow path state as this intersection kernel
is marked as not generating shadow rays for the performance reasons.

Perhaps proper solution would be to run profiler to see if the current
dedicated light intersection + shading kernel split actually gives
speedup (by allowing the shadow and main path to run in parallel as
much as possible) or if the speedup is neglectable and it is better to
save memory of the state.

Ref #104972

Pull Request: blender/blender#107739
2023-05-16 16:24:27 +02:00
e92943ff50 Fix compilation error with shadow linking disabled
Pull Request: blender/blender#107975
2023-05-16 16:11:29 +02:00
ce83b26a33 Fix #107903: USD export: output emissiveColor in UsdPreviewSurface
Added support for emissiveColor in UsdPreviewSurface export, mapping the
PrincipledShader's Emission input to it.

Co-authored-by: pwflocal <drwave@apple.com>
Pull Request: blender/blender#107947

A similar solution was also proposed and discussed in pull request
blender/blender#104490
by Ashley Ruglys <ashley.ruglys@gmail.com>.
2023-05-16 15:57:26 +02:00
d87547abd5 Cleanup: Remove unused node function for finding link
Nowadays it's much better to use the topology cache.
2023-05-16 09:44:41 -04:00
320ac28f75 Cleanup: Remove unnecessary struct keywords in node header 2023-05-16 09:43:05 -04:00
f1e86f28ce Fix excluded light linking behavior
The light intersection was always using the default receiver set
because the receiver_forward was always set to OBJECT_NONE.

This also fixes the case when there is a scene with a single object,
multiple lights lights linked to it, and one default light: the
render result now matches with the main branch.

This breaks the regression test.
The brighter result in the `light link simple` is expected, but the
`light link simple tree` seems to be too bright.

Pull Request: blender/blender#107973
2023-05-16 15:41:02 +02:00
f3babec2df Cleanup: Undo move of functions in previous node cleanup commit
Functions were moved as part of f7388e3be5, which was
unnecessarily noisy. Instead of reverting, move the definitions back
to their original place in node.cc. Also move a few more things to
the blender::bke namespace.
2023-05-16 09:39:53 -04:00
3b4354d4fb EEVEE Next: Default world null check before free
Fix previous commit
2023-05-16 15:35:44 +02:00
d0e635d077 EEVEE Next: Fix crash on Scenes without a World
Create a default world when scenes don't have one.
This is a 1:1 copy of the current EEVEE implementation.

Pull Request: blender/blender#107891
2023-05-16 15:06:43 +02:00
932baa18b7 Fix #106558: Add Primitive tool options not saving
Since a generic snap cursor was implemented (which can be used by Tools and by DragDrop), the Placement Settings are no longer a settings of the "VIEW3D_OT_interactive_add" Operator.

With that implementation, those properties started to be defined in a
static struct, filled in at runtime and accessed in the UI through
workarrounds.

As they are properties initialized at runtime, they are not saved in
the file.

The solution is to move the Placement Settings to `ToolSettings`.

Co-authored-by: Germano Cavalcante <germano.costa@ig.com.br>
Pull Request: blender/blender#107951
2023-05-16 15:00:45 +02:00
3f1ea280cf I18n: translate node group socket type and subtype
Node group sockets have user-exposed data types, and sometimes
subtypes for some data types (e.g. Percentage or Angle for floats).
The UI to select these types and subtypes use an operator menu with a
text depending on the current type or subtype.

This button needs to be manually translated since its label is
manually defined.

Additionally, some subtypes need to be extracted from the Property
class's RNA_ENUM_PROPERTY_SUBTYPE_NUMBER_ITEMS, so this commit also
removes Property from the extraction blacklist in
bl_extract_messages.py. This has the side effect that it introduces a
few dozens translations, which are probably not used anywhere.

Pull Request: blender/blender#107100
2023-05-16 14:53:28 +02:00
b905b02222 Remove newly added "Theme" i18n context, replace its use by "Color"
Pull Request: blender/blender#107139
2023-05-16 14:52:05 +02:00
dc999d83b4 I18n: disambiguate a few messages
- "Out" meaning "one end of a bone". Same as in 9120c86c3f.
- "Canvas" meaning a painting support for Dynamic Paint.
- "Twist" meaning an action verb, as opposed to an amount.
- "Solid" meaning a textureless, single-color material.
- "Blend mode" meaning material opacity blending, as opposed to color
  blending.
- "Pixel Size" meaning "a size measured using pixels as the unit".
- "Light" meaning "not dark", as in "Light Theme".

Ref #43295
2023-05-16 14:51:52 +02:00
22f641e7f8 Cleanup: I18n: Remove extraction macros from node socket declarations
The previous two commits introduced new regexes to extract node socket
names and descriptions automatically from the i18n Python module,
including socket labels.

This commit removes the extraction macros from all node files since
they are now redundant.

Pull Request: blender/blender#107258
2023-05-16 14:12:54 +02:00
f7ffcd84cc I18n: Add message extraction regexes for node socket labels
Some node sockets get their names from a "label", instead of the
declaration. These labels are not necessarily the same as the
declaration, so they need to be extracted to the translation files.

They are always in a `node_sock_label()` function. It has two args,
the second of which is the string we want to extract.
2023-05-16 14:12:51 +02:00
6d39ba7b41 I18n: Add message extraction regexes for node socket declarations
The node socket declarations use the `N_()` macro to extract the name
and description of the socket.

This is quite redundant because since the syntax is always the same,
the extraction can be done automatically from the Python translation
module using regexes.

Four new regexes are introduced in bl_i18n_utils.settings:
- one extracts contextless messages from `add_input()` and
  `add_output()`, the basic socket declarations with the names;
- one does the same, but for those sockets which declare a context
  through `.translation_context()`;
- one extracts descriptions and error messages;
- one extracts geometry nodes field inputs.

In addition to making the code simpler and more legible, this change
extracts a few dozen messages which were not tagged with the proper
macro.
2023-05-16 14:12:51 +02:00
f0701bdf73 Refactor: add reduce functions for float2 for consistency
Pull Request: blender/blender#107970
2023-05-16 13:56:08 +02:00
8fb6b51410 GPU: Fix false positive include of debug_draw
This created unfulfilled resources binds that would
trigger an assert when running with Metal Backend.
2023-05-16 12:54:29 +02:00
88f536dc02 Add always-positive modulo function
Add modulo function `mod_f_positive(f, n)` that returns a positive result,
regardless of the sign of `f`.

For example, `mod_f_positive(-0.1, 1.0)` returns `0.9`, whereas the
standard `fmodf()` function would return `-0.1`.

This is useful for rewrapping values to a specific interval.
2023-05-16 11:41:17 +02:00
02502db832 Light linking: Add light tests directory
Pull Request: blender/blender#107964
2023-05-16 11:12:54 +02:00
072002a672 I18n: translate Quick Fur data
The Quick Fur operator creates a curves object with hair modifiers and
a material.
These modifiers' and material's names can be translated if the user
chose to translate data in the preferences.

Only the modifier names are translated, the node groups are not
because they may be reused instead of appended again.

Pull Request: blender/blender#107909
2023-05-16 10:46:10 +02:00
56df93bfc6 I18n: Asset browser: do not translate non-editable tags
Asset tags are data and should not be translated, even if they are
built-in data such as hair nodes.

Issue reported by @SatoshiYamasaki in #43295.

Pull Request: blender/blender#107907
2023-05-16 10:45:15 +02:00
7849857dfb I18n: extract messages related to paint curves
Two new messages are extracted:
- "New" in the context of paint curves. Used for the template_ID to
  create a new curve;
- "PaintCurve", the default name of a newly-created paint curve.

Pull Request: blender/blender#107888
2023-05-16 10:42:32 +02:00
e268f42e02 I18n: extract a few messages
A few new messages were extracted.

- "Catalog", the default name when creating a new catalog.
- Tooltips related to drag and dropping catalogs in the asset browser.
  Some use `fmt::format()` as a possible solution to messages
  currently extracted with string concatenation as mentioned in
  #92758.

Pull Request: blender/blender#107710
2023-05-16 10:41:25 +02:00
02202dd5a1 Glog: fixed OpenBSD support
- Usage of syscall() is not allowed
- Use getthrid() to retreive the thread ID

Pull Request: blender/blender#107818
2023-05-16 09:30:35 +02:00
6daa3f6b8a UV: Fix packing problem with locked-position and large island count 2023-05-16 17:19:31 +12:00
36c682c551 Cleanup: remove redundant call to mat4_to_size 2023-05-16 14:41:21 +10:00
0de1791164 Cleanup: quiet C4189 warning for MSVC 2023-05-16 14:33:02 +10:00
802af4e04b BLI_file: split BLI_rename into two functions
Include the term "overwrite" so users of this function are aware
this function will delete the destination file (unlike LIBC rename).

- Add BLI_rename_overwrite (previously called BLI_rename).
- BLI_rename is now a wrapper for rename.

Use BLI_rename when renaming in the file selector.
2023-05-16 13:15:48 +10:00
d2a3689b4a Docs: add doc-string for BLI_rename
Since this may delete the destination file,
it's important to note when that happens.

Also note why path comparison isn't used in code-comments.
2023-05-16 13:01:39 +10:00
8ab0196607 BLI_file: BLI_rename no longer checks for the destination path on WIN32
This change was made to prevent renaming files in the file selector from
deleting the file, see: #12255 & [0]. This check is no longer needed as
file selectors now checks the destination doesn't exist before renaming.

Generally, having low level file handling functions behave differently
between platforms is something to avoid with the potential of leading
to unexpected behavior.

Also unify WIN32/UNIX BLI_rename.

[0]: 41ad6f9d0a
2023-05-16 12:59:50 +10:00
8d5255d6a1 Fix BLI_rename returning success on failure for WIN32
When the `from` file didn't exist, BLI_rename returned success,
the in-line doc-string was incorrect - remove in favor of the header's
doc-string. This error existed since the initial revision.
Note that this was fixed [0] for other systems.

[0]: 622019a085
2023-05-16 11:24:49 +10:00
5d695b4f06 Fix memory leak in BLI_file_older for WIN32
Error from [0] which added UTF16 path support,
resolve using `BLI_stat` to avoid inline allocation.

[0]: f11a6d3a84
2023-05-16 11:24:14 +10:00
4b4babae8b UV: Improve correctness of uv packer
Minor corrections including:
* Fast packer wasn't treating locked islands correctly.
* Pointer aliasing.
* Fix and some assumptions that might not be always true.
* Improve variable names.
* Improved comments.
2023-05-16 11:00:35 +12:00
0b1a5dfba4 Cleanup: format 2023-05-16 10:15:56 +12:00
dd32dac60f I18n: disambiguate Mix node A and B inputs
In some languages, the A and B sockets need to be disambiguated
because because they can have different letters depending on context.

In Spanish, A is used for B (Blue -> Azul), while the greek letter
alpha is used for A, to disambiguate Azul / alpha.

Pull Request: blender/blender#107706
2023-05-15 19:55:36 +02:00
a3a36e7f75 I18n: remove operator categories from the translation files
Many messages were no longer needed since Blender 2.80.

Those messages appeared in the operator search menu and described what
category each operator belonged to. After Blender 2.80, this was
replaced by a place in the UI from where the operator can be called.

Pull Request: blender/blender#107700
2023-05-15 19:53:01 +02:00
9603c38ab8 I18n: translate node assets in Add Search menu
Asset nodes got translated in the Add Node menu, but not in the Add
Search menu.

Pull Request: blender/blender#107316
2023-05-15 19:00:31 +02:00
9b64abc236 I18n: Fix some language names from #105461
Some language names were confirmed by native speakers to be
incorrectly spelled (Dutch and Hindi).

Two others were simply capitalized (Vietnamese and Kazakh).

Suspicions remain for other language names, see #105461 for details.

Pull Request: blender/blender#107707
2023-05-15 18:06:06 +02:00
66df452df2 Cycles: oneAPI: enable hardware raytracing by default 2023-05-15 16:36:51 +02:00
42342124f8 USD export: option to add a root prim.
This  pull request adds a 'root_prim_path' USD export string parameter.  If this option is set to a well-formed prim path (e.g., '/World'), a transform primitive with the given path will be added to the stage as the parent of all exported primitives. This will allow transforming the scene by this root node in other applications and is also required for loading the exported scene as a reference in other USDs.

As part of this change, the '_materials' node, which contains all exported materials, is also created under the root prim.   This is required so that materials are imported correctly when the USD is referenced in another stage.

Finally, added an export_params_valid() function to verify that the 'root_prim_path' is valid before starting the export job.  This function can be extended in the future to perform additional validation of other export parameters.

This update combines work in pull request
blender/blender#104506
and an implementation in the 'universal-scene-description' branch.

Co-authored-by: Ashley Ruglys <ashley.ruglys@gmail.com>
Pull Request: blender/blender#107855
2023-05-15 16:00:59 +02:00
1d6464cf97 Fix error when adding a simulation zone while using i18n
When adding a new simulation zone, the input and output would be
accessed by their name, however the name can be translated if the user
has enabled translation of data.

Instead, get the first socket of type 'GEOMETRY' in the simulation
input and output nodes.

Pull Request: blender/blender#107819
2023-05-15 15:38:35 +02:00
f7388e3be5 Cleanup: Move BKE_node.h to C++
See: blender/blender#103343

Changes:
1. Added `BKE_node.hh` file. New file includes old one.
2. Functions moved to new file. Redundant `(void)`, `struct` are removed.
3. All cpp includes replaced from `.h` on `.hh`.
4. Everything in `BKE_node.hh` is on `blender::bke` namespace.
5. All implementation functions moved in namespace.
6. Function names (`BKE_node_*`) changed to `blender::bke::node_*`.
7. `eNodeSizePreset` now is a class, with renamed items.

Pull Request: blender/blender#107790
2023-05-15 15:14:22 +02:00
2a8c20853c Fix LibOverride broken resync behavior in some cases after recent changes.
The issue was that in case an ID was only related to its liboverride
hierarchy through a 'to' pointer (e.g. the parent pointer of an object),
it would now be tagged as 'isolated' from its hierarchy, since nothing
in said hierarchy actually points to it. It would then be deleted during
resync process.

This is once again the infamous 'inverted dependency logic of object
parenting' case...

Note that this did not have any consequences on typical liboverride
usages (based on using a hierarchy of collections0, since all objects
would then be referenced by one or more collection.

Reported by @dr.sybren while investigating #102662.
2023-05-15 13:47:15 +02:00
b196109dac Cycles: enable HIP-RT for AMD hardware ray-tracing
Upgrade to the latest SDK, and enable in daily and release builds where it's
available as an option under Preferences > System.

There are some known limitations, see #104110 and release notes.

Pull Request: blender/blender#105538
2023-05-15 13:46:06 +02:00
a85ad2d0eb Cleanup: remove f-string use, single quote enums 2023-05-15 20:58:00 +10:00
98dd91f418 WM: make all blend file paths absolute & normalized on read/write
Ensure the file path G.main->filepath is always absolute and normalized.

- It was possible to call WM_OT_open_mainfile with only a filename,
  if this resolved from the CWD, Blender's internal filepath
  would not be absolute as expected.

- It was possible to open files on UNIX with an additional forward slash
  causing the blend file path it's self to contain a '//' prefix,
  this is error prone as running BLI_path_abs(..) multiple times would
  add the blend file prefix each time.

- Remove requirement for "filepath" to be an absolute path when saving.
  Instead, expand the path - making it absolute, as this constraint
  wasn't applied open opening files, prefer making save/open behave
  consistently.

- Assert when BLI_path_abs/BLI_path_rel receive a basepath that has
  a "//" (relative) prefix itself.
2023-05-15 19:58:40 +10:00
5285cd9a7b BLI_path: use native normalize (avoids // prefix on UNIX) 2023-05-15 19:58:39 +10:00
7eb55a5fa9 BLI_path: add BLI_path_normalize_native for non-blend file paths
System paths with multiple leading slashes get normalized to one slash.
2023-05-15 19:58:39 +10:00
b68a7dd7a6 Cleanup: unused argument warning 2023-05-15 19:58:39 +10:00
652c7b152a I18N: Updated UI translation from svn trunk (r6526). 2023-05-15 11:54:00 +02:00
51c2a0f816 Fix #104606: iTaSC solver moves root bone to origin and imobilizes it
Add a new flag that determines whether root bones (i.e. bones without a
parent) should be translated to the armature object's origin. This can
be found in the Armature's IK properties panel.

By default this flag is disabled, so new rigs will not see this 'locking
to the origin' behaviour. Versioning code ensures that the flag is
enabled on older files, to preserve the behaviour of existing rigs.

This also bumps the Blender subversion and at the same time fixes an
incorrect bump in ee08b2ddff (where the
'minimum compatible version' was updated instead of the current Blender
version).

Pull request: blender/blender#107869
2023-05-15 10:46:26 +02:00
b0bef8354d Fix #107906: sculpt box hide missing update with non-deform modifiers
When not drawing from PBVH (e.g. with non-deform modifiers), we have to
tag with ID_RECALC_GEOMETRY.

Pull Request: blender/blender#107938
2023-05-15 10:38:57 +02:00
5c57b9aa79 Cleanup: avoid warning on unused argument in cycles_device 2023-05-15 07:35:03 +02:00
d91f0bf8d2 Realtime Compositor: Implement Convert Color Space node
This patch implements the Convert Color Space node for the realtime
compositor. A custom OCIO GpuShaderCreator was implemented to use the
ShaderCreateInfo in constructing the OCIO GPU processor shader. That
shader is then cached inside the cache manager and is invalidated when
the OCIO configuration changes.

Pull Request: blender/blender#107878
2023-05-15 07:20:08 +02:00
a0c6dde5a2 Fix word selection failing when the selected word boundary wasn't space
Double-clicking between alpha-numeric & punctuation for e.g.
did nothing instead of selecting the word.

Instead of a special check for white-space, use the enum values as a
priority so alpha-numeric characters are priories above others
in a way that doesn't prevent groups of other character types
from being selected.
2023-05-15 11:04:25 +10:00
26362f283f Cleanup: pass an immutable position to BLI_str_cursor_step_bounds_*
Having some arguments be input/output and others output only was
confusing, a function that detects a range from a position
can simply calculate the range - modifying the input position isn't
needed.

Instead, note that word select puts the cursor at the end by convention.

Also use `r_` prefix for output only arguments.
2023-05-15 10:52:27 +10:00
5eee40a63e Cleanup: remove empty lines before function doc-string 2023-05-15 10:29:38 +10:00
c6f3fc5d9b Cleanup: use doxygen groups for BLI_path_util.h 2023-05-15 10:24:13 +10:00
d32fc1a3ea Cleanup: rename BLI_path_rel basename -> basepath
"basename" typically refers to the filename without any slashes
(as returned by `BLI_path_basename`), making the argument misleading.
2023-05-15 09:54:52 +10:00
fcca4298ef Cleanup: improve doc-string & naming for internal frame-range extraction 2023-05-15 09:54:52 +10:00
1715f1c1f4 Fix potential buffer overflows from incorrect strcpy use
BLI_path_sequence_decode & BLI_path_filename_ensure ignored maximum
buffer size arguments.
2023-05-15 09:54:51 +10:00
ab2dfc842a BLI_path: include FILE_MAX in BLI_path_{abs,rel} function signatures
These are now the only two BLI_path functions which assume paths are
FILE_MAX size which makes sense as they're using the `//` file prefix.
Something that's specific to file paths stored in DNA.

Use FILE_MAX in the function signature as a form of documentation.
2023-05-15 09:53:40 +10:00
e225a53e54 BLI_path: use PATH_MAX instead of FILE_MAX for system paths
FILE_MAX is used mainly for blend-file paths, avoid using this
when paths may be system-paths.
2023-05-15 09:53:40 +10:00
fd71bb7844 BLI_path: remove FILE_MAX size limit for BLI_path_cmp_normalized
Allocate larger paths if necessary, as this may be used for system
paths where the blend-file size limit isn't implied.
2023-05-15 09:53:40 +10:00
13a3dfd788 BLI_path: remove FILE_MAX limit on BLI_path_frame{_range} functions
- Use BLI_str_replace_range to avoid a temporary string copy.
- Also add a buffer size argument to BLI_path_frame_range.
2023-05-15 09:09:08 +10:00
1d371706cf BLI_string: add BLI_str_replace_range for replacing a range
Add a convenient way to replace a range of text in the middle of a
string that make shrink or grow the string that handles corner cases
and keeps the string null terminated.
2023-05-15 09:08:59 +10:00
1ad4f67d78 BLI: New functions specifically for word/sequence selection
Double-clicking to select words/sequences now using the same functions
specifically for this task, rather than boundary-seeking functions.

Pull Request: blender/blender#107927
2023-05-14 21:50:53 +02:00
f62add82ab Sculpt: Fix #105326: Fill brush function invert(ctrl) only works one way
Problem was the use or OR instead of XOR.

Note: I decided to use an if statement with the !
operator instead of XOR for code clarity.
2023-05-14 09:44:08 -07:00
eb15da661e Sculpt: Fix #106895: Brush textures broken for round brushes 2023-05-14 09:32:25 -07:00
d17f9f4872 UI: Capitalize "Python" in UI messages, improve a few others
- "... (matches pythons ...)": capitalize and use possessive ('s).
- "Layer Proxy Protection": replace proxy by override, following 2.80.
- "Enable Plane Trim": expand description.
- "Make curve path children to rotate along the path": remove "to".
- "Option for curve-deform: make deformed child to stretch along
  entire path": remove "to".
- "... apply the curve radius with path following it and deforming":
  rephrase unclear description.
- "Custom light falloff curve" : unrelated to lights, used in Grease
  Pencil modifiers.
- "Grease Pencil layer assigned to the generated strokes": rephrase
  because a GP stroke is assigned to a layer, not the other way
  around.
- "Attribute domain where the attribute domain is stored in the
  simulation state": remove second "domain" (typo).

Pull Request: blender/blender#107916
2023-05-14 15:23:43 +02:00
018f3dbf85 Cleanup: format 2023-05-14 11:11:51 +12:00
f44795ce17 Fix #107898: UV packer regression
Layouts with >1024 rectangle islands would leave empty UV space.

Regression from ccb2dbddac.
2023-05-14 11:07:24 +12:00
69d6210e38 UI: Improve description for shapekey pin
New tooltip provides more useful information.
2023-05-13 15:24:43 -06:00
eac620f7bf Cleanup in readfile code area.
Mostly some minor renaming of parameters and variables, adding a few
comments...

The only actual behavior change is a more correct handling of the
`LIB_TAG_KEEP_ON_UNDO` on ID tag. This should not have any consequences
in current code though.

So no actual change in behavior is expected from this commit.
2023-05-13 19:45:29 +02:00
2117af10ab Cleanup: Clear non-ID pointers in Outliner tree's readfile code.
Not really critical, but cleaner, and should ensure a hard crash in case
these (assumed invalid) pointers get ever accessed.
2023-05-13 19:35:17 +02:00
b960a4fdb8 Fix (unreported) BKE_main_id_refcount_recompute wrong handling of some ID types.
Scene, WindowManager and Workspace types of IDs should always have a
'virtual' user, to ensure they are always written to file.
2023-05-13 19:26:02 +02:00
5a2f159ba4 Cleanup: Minor fixes to comments and CLOG reports. 2023-05-13 19:24:41 +02:00
a23275a6ea Fix #107810: SVG exported line thickness wrong
Due a limitation in the precission of the thickness
calculation, the result could be wrong.

As the code tried to use the real thickness, in some
cases this was wrong.

Related to old fix for #103061

Pull Request: blender/blender#107835
2023-05-13 16:11:40 +02:00
79f4405039 RNA: correct BLI_strncpy buffer size argument 2023-05-13 17:55:02 +10:00
bfeb687cb4 Remove use of FILENAME_MAX
GCC documented FILENAME_MAX is the maximum length of a file that can
be opened, not to be used for allocation as it may be INT_MAX for e.g.

Even though this wasn't the case on supported systems,
prefer FILE_MAX which is used for full paths in most places.
2023-05-13 17:54:16 +10:00
169dd2a2b4 Use UTF8 copy function to ensure valid UTF8 output 2023-05-13 17:38:48 +10:00
4e85d17000 Cleanup: use native path separator 2023-05-13 17:38:46 +10:00
a534e05476 Cleanup: use dirpath & filename for directories and file names
Use `filename` instead of `names`, `dirpath` instead of `dir`.
2023-05-13 17:34:29 +10:00
557344b64c Cleanup: correct UTF8 code-commets, remove imbdds reference 2023-05-13 17:34:25 +10:00
e89939ca26 Cleanup: reserve the term 'len' for string length 2023-05-13 17:34:23 +10:00
b1a426eac7 Cleanup: use string copy & printf macros 2023-05-13 17:34:21 +10:00
302137b14b Fix #107759: Crash when running modal operator in load_post handler
Regression in [0] which caused the window to be NULL when the load_post
handler was called. While this can be worked around using
context.temp_override, keep the previous behavior as this
change wasn't intentional.

[0]: 46be42f6b1
2023-05-13 17:34:19 +10:00
3d45004552 Fix tangent layer extraction using an empty attribute name
The attribute name was always "" as the size argument was `sizeof(char)`
instead of the buffer length.
2023-05-13 17:34:17 +10:00
88938f03c7 Fix buffer overflow with seq_proxy_get_custom_file_fname
The file path was 256 bytes, passing in a buffer size of 1792
for string join & making the path absolute could also overflow
as it assumes a size of 1024.
2023-05-13 17:34:14 +10:00
7433f34c4d Fix incorrect buffer size passed to BLI_strncpy 2023-05-13 17:34:13 +10:00
654cfc06c5 Cleanup: format 2023-05-13 11:03:59 +12:00
3d96cab01f Fix wrong area light pdf in Cycles MNEE
Area light sampling use special techniques to reduce noise with small
spread angles; the change in sampled area was not taken into
consideration when computing the pdf in MNEE.

Pull Request: blender/blender#107897
2023-05-12 23:07:28 +02:00
9870d8fd27 Fix missing Jacobian in rect area light pdf when in volume segment 2023-05-12 22:40:02 +02:00
078b2d7174 Fix #107777: Cycles baking of Shadow not working anymore
After the removal of the Shadow pass this no longer worked. Now it works by
marking the object as a shadow catcher and returning the Shadow Catcher pass.

The result is different than before, since it also takes into account indirect
light now and uses a different method to weight the contribution of lights that
is adaptive to the light strength.
2023-05-12 21:00:52 +02:00
36e5157693 Cleanup: remove redundant lerp function, mix already does the same 2023-05-12 21:00:52 +02:00
a05a7988dc Fix #106929: Gap in node links when sockets are aligned
Fix an issue when drawing node links that caused gaps, when sockets were
horizontally or vertically aligned.

When the inner and outer points of the node link's bezier control
polygon overlap, the link's tangent can be a zero vector. The shader
didn't check for this before normalizing the tangent leading to an
undefined vector which prevented the outermost segments of the link
from being drawn.
Since this only happens when the end points of the node link are
horizontally or vertically aligned, we can use the vector between the
link's end points instead of the tangent.

Fix #106929
Fix #89282

Pull Request: blender/blender#107636
2023-05-12 20:35:22 +02:00
1a1f06bd9a Fix #107365: keep ls->D fixed in MNEE for area light with zero spread 2023-05-12 20:09:23 +02:00
ee08b2ddff Geometry Nodes: Add display toggle for simulation cache in timeline
Similar to the existing options for toggling physics cache display.
2023-05-12 13:48:52 -04:00
34e29440f7 Fix #107151: Multires data from external file is not loaded
Making the custom data API const correct in 3a3d9488a1 caused
the issue, because it previously relied on non-threadsafe behavior. As a
workaround, just restore the thread-unsafety, and note the issue in a
new comment.
2023-05-12 13:48:11 -04:00
995802d68e Fix #107893: Attribute Statistic produces wrong Variance value
The division must be by the amount, not the index of the latter.

Pull Request: blender/blender#107894
2023-05-12 19:43:26 +02:00
3b647faec8 Fix (unreported) three wrong next/prev pointers order in ListBase link structs.
There was even one case in BLI ListBase tests!

Order was opposite of the one expected by the BLI ListBase code... Not
sure how, but this did not cause any issue apparently? But would expect
it to at least affect the order in which items in the list would be
iterated.
2023-05-12 19:02:39 +02:00
ddd6e05c8d BKE: Collection: Add a basic validation tool for collections.
Mainly for debug purposes, makes it easy to detect invalid collections
(e.g. having more than once a same collection as child).
2023-05-12 19:02:39 +02:00
d87d2dd4ba BLI: Add basic validation tool for ListBase.
Mainly a debug tool, makes it very easy to detect broken listbase.
2023-05-12 19:02:39 +02:00
d9f5ce2546 UI: Changes to NLA Solo Button
Move the NLA Solo button to right side of channel row.

Pull Request: blender/blender#107672
2023-05-12 18:55:06 +02:00
f91c1cd1df Fix light tree + linking crash with shared subtrees
The assumption that the left child node follows the parent immediately is
not true in this case. For now just store both the left and right child index
as there is already padding anyway.

Later this could be optimized by storing the left and right child next to
each other, and then ensuring both are always specialized together.
2023-05-12 18:47:05 +02:00
f5e3ed77c7 Geometry Nodes: Change "Separate Components" node output order to match Spreadsheet
The order of geometry components should match between
the Separate Components node and the spreadsheet editor.
This switches the Curve and Point Cloud outputs.

Resolves #107837

Pull Request: blender/blender#107868
2023-05-12 18:08:06 +02:00
846e0801ab Fix crash in transform code if there was no active pose channel 2023-05-12 17:42:46 +02:00
4ecbb3f1d5 Fix IDManagement remapping missing some required remapping with some liboverrides.
`BKE_library_id_can_use_filter_id` would not handle properly cases where
the ID is a liboverride - it's hierarchy root pointer can point back to
virtually any kind of ID (although typically a Collection or Object).

This was breaking liboverride resync process in some rare cases, by
failing to remap the 'hierarchy root' pointer of some liboverrides.
2023-05-12 17:02:18 +02:00
6491387fba Fix: Incorrect value retrieval in simulation subframe mixing 2023-05-12 10:40:51 -04:00
84c5953882 Add the sm_89 arch to the default CUDA binaries
Without this, support for newer NVIDIA cards will not be compiled with pre-compiling the CUDA binaries.

Includes changes needed for the buildbot building pipeline.

Co-authored-by: Sergey Sharybin <sergey@blender.org>
Pull Request: blender/blender#107585
2023-05-12 16:30:23 +02:00
4d7a93930c Fix: Build error after previous commit 2023-05-12 10:15:57 -04:00
e6e6fb3a62 Geometry Nodes: Implement simulation subframe mixing
Generally render engines can do subframe mixing themselves, but the
purpose of subframe mixing in the simulation output node is to support
higher quality motion blur with bakes when there are topology-changing
operations after the simulation output node. Linear mixing can fill the
gaps while maintaining lower memory usage.

All point/instance domain attributes are mixed, but mixing is only
supported when the domain size is unchanged or when an `id` attribute
gives a mapping between elements. Theoretically it may be possible, but
nested instance geometry is not mixed in this commit due to the
difficulty of finding matching geometries across arbitrary instance
hierarchy changes. Attributes that are completely unchanged are ignored
using implicit sharing for better performance.

Pull Request: blender/blender#107599
2023-05-12 15:58:54 +02:00
676c6d8e9a utm_source: use blender version as part of the URL
This makes the URL links to blender.org to have more information than
just utm_source=blender

For example:
* utm_source=blender-3.6.0-alpha
* utm_source=blender-3.3.16-release

Pull Request #107849
2023-05-12 15:29:46 +02:00
a15c637e63 Introduce utm_source=blender to urls pointing to blender.org
This fuctionality allow the Blender project to know if users
are reaching our websites from within Blender:

 * User Manual
 * Python API
 * Release Notes
 * Development Fund

Pull Request #107849
2023-05-12 15:29:46 +02:00
cbd838d077 Cleanup: Unify operators to use wm.url_open 2023-05-12 15:29:46 +02:00
fb584456e8 Revert "Fix #107759: Crash when running modal operator in load_post handler"
This reverts commit 95a114f3ca.

This broke bl_rigging_symmetrize, it seems likely the window was not
NULL on load in this case, setting it to NULL caused the the active
object not to be recognized.

This needs further investigation, reverting for now.
2023-05-12 23:23:49 +10:00
3d53078dbe deps_builder: update Embree to 4.1.0
This allows to drop patches and workarounds, and reenable Hardware
Raytracing support for MNEE and Raytrace kernels for oneAPI device.

Pull Request: blender/blender#107853
2023-05-12 14:53:53 +02:00
4f2ac09886 Cleanup: Reduce binary size by deduplicating attribute processing
This makes the Blender binary 350 KB smaller. The largest change comes
from using `FunctionRef` instead of a template when gathering indices to
mix in the extrude node (which has no performance cost). The rest of the
change comes from consolidating uses of code generation for all
attribute types. This brings us a bit further in the direction of
unifying attribute propagation.

Pull Request: blender/blender#107823
2023-05-12 14:44:39 +02:00
5ec2495550 Cycles: oneAPI: enable Hardware Raytracing for Raytrace/MNEE kernels
We do so if Embree 4.1+ is present.
2023-05-12 14:17:50 +02:00
38416e7ad2 RNA: use correct ui scale type string in generated rna code
Previously, it printed the elements of `PropertyScaleType` as floats which does
not make sense. It also resulted in compile errors when attempting to compile
the generated code as c++ code.

Pull Request: blender/blender#107724
2023-05-12 13:50:06 +02:00
4cf7b95a15 Vulkan: Fix Compilation Issues on Windows
VKVertexAttributeObject was both defined as a class and a struct.
Settled on being a class.

Also removed an assert that is currently failing as workbench has
more attributes defined than actually used.

Pull Request: blender/blender#107874
2023-05-12 12:38:42 +02:00
7a52ad1161 Vulkan: Fix Incorrect Vertex Buffer State
After uploading the vertex buffer the state got corrupted.
Reason of this corruption is an assign-compare operation that should
just be an compare operation.

Pull Request: blender/blender#107875
2023-05-12 12:33:37 +02:00
cgtinker
aaf56d7aa5 Refactor: Anim, Symmetrize Armature operator
Remove some nested `if` statements to improve readablilty. My main
intention has been to improve readability and therefore making it easier
to implement changes in the future.

Seperating the symmetrize operator selection logic from the temp pointer
logic may reduces performance but it seems acceptable in this case. The
change allows focussing on the selection logic without taking care of
the temp pointers at the same time.

No functional changes.

Pull Request: blender/blender#106487
2023-05-12 12:13:35 +02:00
83a2904d1a Vulkan: IndexBuffer as Subrange
Add support for index buffers as subrange. When an index buffer
is a subrange it should bind the source buffer and use the index start
as an offset in the buffer.

Pull Request: blender/blender#107871
2023-05-12 12:12:43 +02:00
f9d094ba9e Vulkan: Initial Draw List
Dummy implementation of the VKDrawList that isn't caching the draw calls
but just execute them when they are appended to the list.

Pull Request: blender/blender#107873
2023-05-12 12:09:41 +02:00
149d364307 Fix #107863: Handles NULL pose constraint list
When the the armature doesn't have an active pose bone yet so
`ED_object_pose_constraint_list` returns NULL unhandled during
`edit_constraint_property_get`, now fixed.

Pull Request: blender/blender#107864
2023-05-12 10:56:53 +02:00
95a114f3ca Fix #107759: Crash when running modal operator in load_post handler
Regression in [0] which caused the window to be NULL when the load_post
handler was called. While this can be worked around using
context.temp_override, keep the previous behavior as this
change wasn't intentional.

[0]: 46be42f6b1
2023-05-12 17:23:56 +10:00
cddbd2dfb3 CMake: use a custom message when Python is not found
When Python is not found, inform developers how they can use a newer
version. Even though it's not officially supported - we typically keep
the latest stable version of Python working.
2023-05-12 17:00:12 +10:00
b2ebb01255 Fix crash when adding a modal operator from Python with no active window
Reported as part of #107759.
2023-05-12 16:19:24 +10:00
edc12436c6 UV: During packing, add progress bar and ability to cancel
Uses job system.

Co-authored-by: Campbell Barton <campbell@blender.org>
Pull Request: blender/blender#107859
2023-05-12 14:50:40 +12:00
85ddc1b0de Cleanup: Use OffsetIndices class in extrude node and merge by distance node 2023-05-11 22:15:41 -04:00
225d111357 UV: Rename ED_UVPACK_PIN_NORMAL to ED_UVPACK_PIN_DEFAULT 2023-05-12 11:09:27 +12:00
eb273143c6 Cleanup: format 2023-05-12 11:00:26 +12:00
7495a1dee1 Fix #98475: Full frame compositor: File Output node using EXR-Multilayer is broken
The same input (original image) was used for all layers. Now the operation correctly assigns the right input to the right output buffer.

Pull Request: blender/blender#107709
2023-05-11 21:01:44 +02:00
36983fb5e4 Geometry Nodes: Add 'Signed Distance' input node
Adds an input node Signed Distance that can
be used to refer to the distance-grid of an SDF volume.
Right now it's experimental and can be enabled by enabling
"New Volume Nodes" in the preferences.

It returns a float AttributeFieldInput called 'distance' which
can tell Volume nodes which grid to get.

See #103248.
2023-05-11 18:25:34 +02:00
8a9f3b2a68 Shader Nodes: Move socket defaults to node declaration
Solves the same issue that was reported in #108726.
2023-05-11 18:00:12 +02:00
2db23d38ca Fix #107826: Missing defaults for principlied volume string sockets
Caused by the dynamic declaration changes in 0de54b84c6.
The fix is to use the declaration to store the socket defaults.
2023-05-11 11:32:42 -04:00
5d09699d3c Cleanup: use more descriptive names for snap cursor API
Inform in the name that:
- the state is being edited
- the active state is the one used
- a state can be created and freed
2023-05-11 11:46:09 -03:00
b3c02cfcfd Cleanup: remove unused snap_3d functions 2023-05-11 11:43:02 -03:00
16228f2d71 Fix #107830: missing snap indication in measure tool
Error happened because the activated snap state was different from the
one being drawn.

So create a utility that activates the correct state.
2023-05-11 11:43:02 -03:00
64f9a30cbd Test: actually use the right matrix for unit test
No functional changes, just a test working in debug mode too ;-)
2023-05-11 16:38:17 +02:00
53bccfe34a CMake/Win: fftw adjust for filename changes in 3.6
Preparation for the the 3.6 library update landing.

The filenames for these libs will change a little bit and 3.6 will add
new library for the fp32 version of fftw.
2023-05-11 08:36:33 -06:00
6f3cf1e436 LibOverride: Fix resync process no properly tagging newly used linked data as directly linked.
LibOverride resync process would not properly 'make local' newly created
overrides (copied from their linked reference). The main consequence was
that some linked data used by these new liboverrides would not be
properly tagged as directly linked.

While this would not be an issue in current codebase, this was breaking
upcomming readfile undo refactor, since some linked data did not get
their local 'placeholder reference' data written in memfile blendfiles.

NOTE: this is more of a quick fix, whole handling of library data in
complex copying cases like that need some more general work, see #107848
and #107847.
2023-05-11 15:55:57 +02:00
061712fcc6 Add ORIENTATION_PARENT icon
Add ORIENTATION_PARENT icon for Parent Orientation enum

The Parent orientation was introduced in 5c4b0c98d3.

Pull Request: blender/blender#107763
2023-05-11 14:50:15 +02:00
39ba60e88d Math: add unit test for mat3_normalized_to_quat_fast
Add a unit test for the fix in 98334b8f7d

No functional changes.
2023-05-11 14:29:48 +02:00
b029db5461 Vulkan: AMD Swapchain
This PR enabled the swapchain to be used with AMD GPUs.
The issue is that we had to separate the swapchain into
2 functions and therefore the rendering is also not
controlled at the same time.

Semaphores were finished, before being used and the
driver stalled when waiting for those Semaphores.

This doesn't solve the issue that renderdoc can still
crash the graphics driver.

Pull Request: blender/blender#107840
2023-05-11 14:29:38 +02:00
809a5aa418 Vulkan: Initial Graphics Pipeline
Initial graphic pipeline targeting. The goal of this PR is to have an initial
graphics pipeline with missing features. It should help identifying
areas that requires engineering.

Current state is that developers of the GPU module can help with the many
smaller pieces that needs to be engineered in order to get it working. It is not
intended for users or developers from other modules, but your welcome to learn
and give feedback on the code and engineering part.

We do expect that large parts of the code still needs to be re-engineered into
a more future-proof implementation.

**Some highlights**:
- In Vulkan the state is kept in the pipeline. Therefore the state is tracked
  per pipeline. In the near future this could be used as a cache. More research
  is needed against the default pipeline cache that vulkan already provides.
- This PR is based on the work that Kazashi Yoshioka already did. And include
  work from him in the next areas
  - Vertex attributes
  - Vertex data conversions
  - Pipeline state
- Immediate support working.
- This PR modifies the VKCommandBuffer to keep track of the framebuffer and its
  binding state(render pass). Some Vulkan commands require no render pass to be
  active, other require a render pass. As the order of our commands on API level
  can not be separated this PR introduces a state engine to keep track of the
  current state and desired state. This is a temporary solution, the final
  solution will be proposed when we have a pixel on the screen. At that time
  I expect that we can design a command encoder that supports all the cases
  we need.

**Notices**:
- This branch works on NVIDIA GPUs and has been validated on a Linux system. AMD
  is known not to work (stalls) and Intel GPUs have not been tested at all. Windows might work
  but hasn't been validated yet.
- The graphics pipeline is implemented with pixels in mind, not with performance. Currently
  when a draw call is scheduled it is flushed and waited until it is finished drawing, before
  other draw calls can be scheduled. We expected the performance to be worse that it actually
  is, but we expect huge performance gains in the future.
- Any advanced drawing (that is used by the image editor, compositor or 3d viewport) isn't
  implemented and might crash when used.
- Using multiple windows or resizing of window isn't supported and will stall the system.

Pull Request: blender/blender#106224
2023-05-11 13:01:56 +02:00
6a20b0022c Vulkan: Swap Chain
This PR replaces the previous implementation of the swap chain.
The previous implementation was based on a gaming loop where
inside a single function an image is requested, the drawing occurs
and the requested image is presented on screen.

In blender the drawing isn't controlled in a single function and
this approach lead to freezes, missing frames and other
artifacts.

This approach is not be the final approach but a step into a
direction where the acquiring of the next image in the swap chain
is separated from the swapping.

Pull Request: blender/blender#107740
2023-05-11 12:51:05 +02:00
98334b8f7d Fix #107745: Matrix conversion can produce non-unit quaternion
Due to cumulative floating point errors the quaternions produced by
`mat3_normalized_to_quat_fast()` could be non-unit length. This is now
detected, and quaternions are normalised when necessary.

This is a slight roll-back of 756538b4a1,
which removed the normalisation altogether, but did introduce this issue.
2023-05-11 12:28:04 +02:00
8aff713270 Vulkan: Convert VertexBuffer to Contain Supported Attributes
Vulkan doesn't have a conversion from uint32_t/int32_t to float. It does
have conversions from 16/8 bits. Main reason is that Vulkan expects that
there is no benefit when converting 32 bits from one type to the other
and should be solved by passing the right data type.

In Blender however this isn't the case as there are benefits on other
GPU backends (OpenGL for example).

This PR adds helper function to check if conversion is needed and
perform any conversions in place. It also implements the function to
upload vertex buffers to the GPU.

NOTE: Test cases have been added to validate this, but they are not
able to run on the Vulkan backend just yet, because they require the
graphics pipeline to be available.

Pull Request: blender/blender#107733
2023-05-11 12:23:23 +02:00
8e70ab9905 Fix #107603: queried the area of an empty bounding box 2023-05-11 11:18:12 +02:00
d9293ca478 Fix missing include, unused argument warning 2023-05-11 17:46:23 +10:00
575c3f3b25 BLI_string: replace UTF8 skip table & macros with functions
Using a function that operates on ranges instead of the lookup table
makes BLI_strncpy_utf8 around 2.8x faster in my tests.
2023-05-11 17:35:34 +10:00
a9c1d47255 GPU: Added Tests For Blend state And Immediate Mode
This PR adds several tests to GTest for testing blend states
and immediate mode. The immediate mode test are basic and will
be extended in the near future.

The tests have been developed in order to get the first pixel on
screen for the Vulkan backend. In the first phase of this goal we
had to validate that everything was working as expected without
being able to validate it by starting Blender.

Pull Request: blender/blender#107834
2023-05-11 09:15:39 +02:00
a0ea40034b Vulkan: Make ShaderInput Optional
ShaderInput lookup used to be explicit as in we know for sure that the
shader input exists. This was guarded by a assert. During development
of the graphics pipeline we came to the conclusion that this isn't
always the case due to its late bindings of resources.

This PR Makes the shader input lookup return an optional result.
This result can then be checked depending on the area where it is used
to validate the existence.

Pull Request: blender/blender#107735
2023-05-11 08:44:57 +02:00
6698e8f4a0 Realtime Compositor: Implemenet Plane Track Deform node
This patch implements the Plane Track Deform node for the realtime
compositor. The implementation is mostly similar to the Corner Pin node,
but it is generalized to multiple homography matrices to take motion
blur into account.

Pull Request: blender/blender#107811
2023-05-11 07:16:24 +02:00
ccb2dbddac UV: Simplify packer, improving performance, efficiency and fixing bugs
Adds a generic `is_larger` and `get_aspect_scaled_extent` function to
simplify packing logic.

Migrate several packing functions so that they only improve a layout,
and early-exit packing if a better layout already exists.

Fix a `rotate_inside_square` logic error during xatlas packing.
2023-05-11 17:13:05 +12:00
cc9678b5fe Fix BLI_strncpy_utf8 over-read for code points containing a null byte
BLI_strncpy_utf8 didn't check for null bytes within bytes stepped
over by the variable length UTF8 encoding.

While a valid UTF8 string wont include these, it's possible Latin1
encoding or a truncated string includes such characters.

In this case, the entire string is copied as it's not the purpose of
this function to correct or strip invalid/truncated encoding,
only to prevent it from happening in the first place.
2023-05-11 11:44:38 +10:00
8612dfea44 Cleanup: format 2023-05-11 12:08:28 +12:00
da43c42e40 Cleanup: Avoid redundant attribute adding in extrude node
These attributes already exist, not need to use the "or_add" function.
2023-05-10 15:27:27 -04:00
143ca272bd Geometry Nodes: Slightly optimize mesh to curve node
Use the offset indices pattern to avoid keeping separate arrays for the
offset of a vertex's neighbors and the number of neighbors. This gave
a 9% speedup for the conversion, from 42.9 ms to 39.3 ms.
2023-05-10 15:24:12 -04:00
5b5e6a846a Geometry Nodes: Extrude: Skip topology map with no edge attributes
In vertex extrusion mode, when there are no edge attributes we can avoid
creating a topology map meant for mixing old values. This makes
simulation caching for a curl noise demo file from user Higgsas 10%
faster (from 44s to 40s to calculate 230 frames).
2023-05-10 15:24:12 -04:00
3958f4cb02 Cleanup: Fix build warning with MSVC
This cleans up the following warning

BLI_mempool.c(291):warning C4100: 'pool':unreferenced formal parameter

Warning introduced by c1d4b6f339
2023-05-10 12:59:11 -06:00
2158c92d9b CMake/Windows: Install FFMpeg 6.0 dlls when available
Needed for the 3.6 library update.
2023-05-10 12:18:54 -06:00
3913d22757 Fix #107779: Support simulation zone remapping in node group operators
Adds a `remap_pairing` function for node group operators that ensures
the simulation input nodes' `output_node_id` matches the new node are
creating a group, ungrouping a node group, or separating from a group.

Also fixes a crash in the "Group Separate" operator when group
input/output nodes are included in the selection.

Pull Request: blender/blender#107807
2023-05-10 17:56:23 +02:00
939f7e8010 Fix: Empty built-in attributes are duplicated by some nodes
The attributes API does not have the error that a null attribute
does not exist and requires a new layer to be created.

Pull Request: blender/blender#107814
2023-05-10 17:40:37 +02:00
de21a0c901 Fix (unreported) remapping code wrongly skipping UI data when it should not.
Issue was that, when UI-related code _is_ requested in foreach_id
processing, `ID_SCR` screen ID type can actually use any kind of ID
(through e.g. the Outliner space).

So `BKE_library_id_can_use_filter_id` had to be updated with a new
parameter (whether UI-related data should be taken into account or not).
2023-05-10 16:36:29 +02:00
ade83b21d1 Fix (unreported) crash in readfile code when deleting an invalid shapekey.
The root of the issue was that while reading a new blendfile, the
current `G_MAIN` is still the old one, not the one in which new data is
being read.

Since the remapping callback taking care of UI data during ID remapping
is using `G_MAIN`, it is processing the wrong data, so when deleting the
invalid shapekey (from `BLO_main_validate_shapekeys`), the UI data of
the new bmain would not be properly remapped, causing invalid memory
access later when recomputing user counts (calls to
`BKE_main_id_refcount_recompute`).

This is fixed by adding a new `BKE_id_delete_ex` function that takes
extra remapping options parameter, and calling it from
`BLO_main_validate_shapekeys` with extra option to enforce handling of
UI data by remapping code.

NOTE: At some point we have to check if that whole UI-callback thing is
still needed, would be good to get rid of it and systematically process
UI-related ID pointers like any others. Current situation is... fragile
to say the least.
2023-05-10 16:35:49 +02:00
ab106607bd deps_builder: 3.6 library update
- OIIO 2.4.11.0
- OpenEXR 3.1.7 with additional fix for threadpool shutdown
- FreeType 2.13.0
- Fmt 9.1.0
- Python 3.10.11
- Flac 1.4.2
- FFMpeg 6.0
- OpenSSL 1.1.1t
- SQLite 3.40.1
- USD 23.05 with MaterialX Support and Render module

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Co-authored-by: Campbell Barton <campbell@blender.org>
Pull Request: blender/blender#107783
2023-05-10 16:20:16 +02:00
8efd6d5f82 Geometry Nodes: Make simulation caching optional
For realtime use cases, storing the geometry's state in memory at every
frame can be prohibitively expensive. This commit adds an option to
disable the caching, stored per object and accessible in the baking
panel. The default is still to enable caching.

Pull Request: blender/blender#107767
2023-05-10 16:01:38 +02:00
c7e9932c46 Fix #107677: Hair particle edit wrong on object with mirror modifier
Caused by 2fb31f34af.

Since above commit, we are now calling `BKE_mesh_orco_verts_transform`
not only from `psys_face_mat` and `psys_mat_hair_to_orco`, but now also
from `psys_particle_on_dm` > `psys_interpolate_face`, so we get double
transforms with mirror.

Remove the "extra" call in `psys_mat_hair_to_orco`.

Should be backported to 3.3 LTS as well.

Pull Request: blender/blender#107804
2023-05-10 15:16:18 +02:00
179c419115 Fix #107608 : Changing color for simulation zone doesn't save
This looks like a missing version bump for 0de54b84c6, now added.
Also included the change for 493c4dd65b here.

Pull Request: blender/blender#107808
2023-05-10 15:06:50 +02:00
db6eda6c60 Geometry Nodes: show simulated frames only when there is a simulation
Previously, the timeline would sometimes show cached frames even when
there is no simulation zone in the node tree.
2023-05-10 14:41:37 +02:00
17d161f565 Mesh: Reduce custom normal calculation memory usage
Avoid storing redundant and unnecessary data in temporary arrays during
face corner normal calculation with custom normals. Previously we used
96 bytes per normal space (`MLoopNorSpace` (64), `MLoopNorSpace *` (8),
`LinkData` (24)), now we use 36 (`CornerNormalSpace` (32), `int` (4)).
This is achieved with a few changes:
- Avoid sharing the data storage with the BMesh implementation
- Use indices to refer to normal fan spaces rather than pointers
- Only calculate indices of all corners in each fan when necessary
- Don't duplicate automatic normal in space storage
- Avoid storing redundant flags in space struct

Reducing memory usage gives a significant performance improvement in
my test files, which is consistent with findings from previous commits
(see 9fcfba4aae). In my test, the time used to calculate
normals for a character model with 196 thousand faces reduced from
20.2 ms to 14.0 ms, a 44% improvement.

Edit mode isn't affected by this change.

A note about the `reverse_index_array` function added here: this is the
same as the mesh mapping functions (for example for mapping from
vertices to face corners). I'm planning on working this area and hoping
to generalize/reuse the implementation in the near future.

Pull Request: blender/blender#107592
2023-05-10 14:41:10 +02:00
493c4dd65b Geometry Nodes: add theme option for simulated frames in timeline
The new theme setting for the dope sheet (timeline) allows changing the
color of the bar that shows which frames are cached/baked. The
invalid/cached/baked status is differentiated by hardcoded transparency
values. In theory, those could be separate theme settings though.

Pull Request: blender/blender#107738
2023-05-10 14:19:27 +02:00
d6092a6c36 Fix #107670: Lattice undo misses vertex group weights data
Operations such as assigning or removing weights were simply not
undoable (no previous weights were applied back to the EditLatt). Now
add MDeformVert data to UndoLattice and handle with
appropriate functions during Undo.

Pull Request: blender/blender#107776
2023-05-10 09:23:40 +02:00
fc7b5f993b Cleanup: Follow naming conventions for Plane Track node 2023-05-10 09:51:47 +03:00
ed5dee857e Fix blender failing to link WITH_USD when building for the first time
Blender would fail to link to USD before MaterialX files were
copied to the install targets lib/ directory.
Resolve by including ${LIBDIR}/materialx/lib in link_directories.
2023-05-10 16:25:17 +10:00
0d171bc5be Cleanup: quiet enumerated type warning 2023-05-10 14:44:12 +10:00
ee09d75e80 Cleanup: naming of looptri indexing variables
looptris were referred to as both tris & faces, sometimes polygons
were referred to as faces too. Was especially error prone with
callbacks that took both a tri and a tri_i arguments.
Sometimes tri_i represented a looptri index, other times the corner of
the triangle from 0-2. Causing expressions such as:
`args->mlooptri[tri].tri[tri_i]`

- Rename tri & tri_index -> looptri_i.
- Rename faces -> looptris.
- Rename face_index/poly_index/poly -> poly_i.
- Declare looptri_i at the start of the loop and reuse it,
  in some cases it was declared with args->prim_indices[i] being
  used as well.
2023-05-10 14:21:39 +10:00
0168c4b893 Cleanup: remove unused "dds" directory
Missing from [0] which duplicates some code into format_dds.cc.

[0]: aa3bdfd76a
2023-05-10 12:35:41 +10:00
46479f41e1 Cleanup: quiet dangling-reference warnings with GCC13 2023-05-10 12:06:27 +10:00
bb51cdedb7 Cleanup: Clang-format 2023-05-09 22:47:57 +02:00
ac02f94caf Fix #107123: Refactor sculpt normal calculation to require vert poly map
Change PBVH normal calculation to also update vertices connected to
vertices with an update tag. This is necessary because vertex normals
are the mixed face normals, so changing any face's normal will change
the normals of all connected faces.

This change requires that the PBVH always have a vertex to face
topology map available. In the future this will likely be cached on
meshes though, which will reduce the delay it adds when entering sculpt
mode.

Now, first all face normals are updated, then the normals for
connected vertices are mixed from the face normals. This is a
significant simplification to the whole process, which previously
worked with atomics and normals at the triangle level. Similar changes
changes for regular non-sculpt normal calculation are being worked on
in #105920.

Pull Request: blender/blender#107458
2023-05-09 22:36:30 +02:00
c9be925f7d Fix #107289: Sound strips are invisible and overlap
In some cases strips may end up with speed factor of 0 which causes
offsets and position to be invalid. The exact cause is unknown, but
most likely caused by `do_versions_sequencer_init_retiming_tool_data()`.

This could possibly happen if 3.6 file is saved with 3.5 version and
then opened again with 3.6 version.

To fix strips, retiming data is removed, start offset reset and speed
factor is set to 1. Previous versioning code is fixed, so speed factor
is never set to 0.

Pull Request: blender/blender#107798
2023-05-09 22:14:17 +02:00
3a0d17ceea Cleanup: Correct commet about curves bounds
Missing from 97a8bb450c
2023-05-09 13:03:08 -04:00
3f44b24cf2 BLI: Use inline instead of static for bounds functions
Avoid instantiating the templates separately in every translation unit.
This saves 20 KB in my Blender binary. Also remove a timer mistakenly
committed.
2023-05-09 12:54:55 -04:00
aefda7cb0b Fix Blender failing to start to due to missing sycl shared library
After recent Linux library updates. The EMBREE_SYCL_SUPPORT variable that
this relied on was not cached.

Always install the sycl shared libraries regardless of build options, as
we do for other shared libraries.
2023-05-09 18:36:32 +02:00
d65d9f4b97 CMake/Windows: Install materialX render dll's when available
This is in preparation for the 3.6 library update landing on windows.
2023-05-09 10:21:32 -06:00
6323d56eb5 Mesh: Tag no loose verts and edges when converting from BMesh
This saves about 6 ms every update when in edit mode on a 1 million
face grid. For reference, the BMesh to Mesh conversion took 80 ms,
before and after the change.
2023-05-09 12:13:09 -04:00
521e79b869 Fix oslc error missing libtbb.so.2 after recent Linux libs update
A wrong ; separator in LD_LIBRARY_PATH broke the TBB path.
2023-05-09 17:20:17 +02:00
7e492fcaa2 Cycles: build specialized light trees for light linking
This starts by building a light tree for all lights in the scene as usual.

Then for every unique light set, a specialized light tree is created. Each
light tree node has a mask with the light sets it is a member of, and for
each specialized light tree only the matching subset of nodes is used.

Subtrees with identical bitmasks are shared between light trees to reduce
memory usage.

Light tree sampling works the same as before, the only difference is that a
different root node is used depending on the receiver object.

Computing the light tree pdf needed a change as the bit trails are not the
same for the specialized light tree. Each light tree node now includes a
bit shift value, to skip nodes that were left out of the specialized light
tree.

Pull Request: blender/blender#107561
2023-05-09 16:34:10 +02:00
8ce040cf1a Anim: avoid increasing NULL pointer
Avoid calling `next++` when `next` is `NULL`.

In practice this should be a non-functional change, but it avoids ASAN
messages.
2023-05-09 16:05:40 +02:00
Sebastian Herholz
d864b5ce28 Cycles: BSDF ensuring that eval, pdf and label are intialized to zero and None 2023-05-09 15:40:05 +02:00
263bf63509 Cleanup: Remove versioning for simulation zone socket identifiers
This was added temporarily during development.
Loading files created in the geometry-nodes-simulation branch (3.5.4
and older) will remove links from simulation zones, which need to be
added back manually.

Pull Request: blender/blender#107781
2023-05-09 15:15:40 +02:00
4436909c1d Workbench-Next: Fix shader compilation
Was a missing case from recent fix:
aa31d9be80
2023-05-09 14:37:13 +02:00
a68c78a3ee Vulkan: Don't Use Tiled Drawing
Similare to the Metal backend, Vulkan keeps data of the full texture
around as they will be executed by the same submission. So there are
no benefits to splice a texture into smaller parts, but adds overhead
as more commands are required to be processed.

Pull Request: blender/blender#107728
2023-05-09 14:12:44 +02:00
f9b5b0efd2 Fix #107583: HSV node gives differ from CPU compositor
The HSV node in the realtime compositor produces different values from
the CPU compositor in its identity settings.

This happens because the realtime compositor clamped the saturation
value after HSV correction, while the CPU compositor did not, so this
patch unifies that behavior. Additionally, negative values are now
clamped in both the HSV node and Hue correction node to also match the
CPU compositor.
2023-05-09 14:22:35 +03:00
322dab936f Build: fixes for OpenBSD
Pull Request: blender/blender#107666
2023-05-09 13:19:16 +02:00
8ba9d7b67a Functions: improve handling of thread-local data in lazy functions
The main goal here is to reduce the number of times thread-local data has
to be looked up using e.g. `EnumerableThreadSpecific.local()`. While this
isn't a bottleneck in many cases, it is when the action performed on the local
data is very short and that happens very often (e.g. logging used sockets
during geometry nodes evaluation).

The solution is to simply pass the thread-local data as parameter to many
functions that use it, instead of looking it up in those functions which
generally is more costly.

The lazy-function graph executor now only looks up the local data if
it knows that it might be on a new thread, otherwise it uses the local data
retrieved earlier.

Alongside with `UserData` there is `LocalUserData` now. This allows users
of the lazy-function evaluation (such as geometry nodes) to have custom
thread-local data that is passed to all the lazy-functions automatically.
This is used for logging now.
2023-05-09 13:13:52 +02:00
21e6677682 Fix renaming bookmarks stripping non-UTF8 characters 2023-05-09 20:33:47 +10:00
768948f51b Cleanup: correct strcpy use for RNA string access 2023-05-09 20:33:11 +10:00
c183962c5d Cleanup: quiet unused variable warnings in release builds 2023-05-09 20:32:13 +10:00
7f7804e62d Cleanup: use doxygen groups for BLI_string_tests 2023-05-09 20:32:13 +10:00
5532d05622 Anim: remove assumption of array_index order when blending quaternions
The pose library blending code assumed that quaternions would be keyed
in order of `array_index`. This is normally the case when creating a
pose asset, but when manually editing a pose asset Action this
assumption may not hold.

The code still assumes that all FCurves of a single quaternion are
sequential, i.e. are not inter-mixed with other keyed properties. They
just no longer have to be ordered by array index.

Ref: blender-addons/issues#104591
2023-05-09 11:26:27 +02:00
e8c660b855 Realtime Compositor: Implement Denoise node
This patch implements the Denoise node for the realtime compositor. The
denoiser executes on the CPU and we pay for the CPU<->GPU round trip to
memory, so this is not realtime, as one might expected. And is just a
temporary implementation until OIDN supports GPU execution.

This is different from the CPU implementation in that it doesn't use the
auxiliary passes if they were not provided, because using an inflated
buffer of an undefined value doesn't make much sense.

Pull Request: blender/blender#107375
2023-05-09 11:09:06 +02:00
43bee6ea69 Vulkan: Ensure Minimum Size of VKBuffer
In Vulkan it is not allowed to allocate a buffer of zero bytes. This
would generate an error. In Blender it is possible that a buffer is zero
bytes. For example when the draw manager is drawing instances and there
are no instanced in the scene.

This PR ensures that at least a single byte is allocated in order to not
fail later on.

Co-authored-by: Jeroen Bakker <j.bakker@atmind.nl>
Pull Request: blender/blender#107731
2023-05-09 10:20:54 +02:00
63cc5a1e61 Vulkan: Frame Buffer Flipping
Vulkan coordinate system is flipped compared to OpenGL. This PR
flips the drawing when drawn to the on-screen frame buffer.
Offscreen frame buffers are still drawn upside down.

The flipping is done by making the viewport of the framebuffer negative.

Pull Request: blender/blender#107743
2023-05-09 09:22:26 +02:00
4768348583 Sculpt: fix topology automasking not working when factor cache exists 2023-05-08 22:18:38 -07:00
47149d2532 Cleanup: order string size argument after the string
This is the convention almost everywhere.
2023-05-09 15:06:41 +10:00
788a57c6ef Cleanup: reserve the suffix 'len' for string length 2023-05-09 15:02:12 +10:00
c49a0fa474 Cleanup: remove redundant use of BLI_snprintf (no formatting args given)
The SNPRINTF macro isn't usable as it expectes at least one argument.
2023-05-09 14:08:19 +10:00
3958ae7241 Cleanup: use STRNCPY, SNPRINTF macros 2023-05-09 14:08:19 +10:00
2f9538a8c7 code_clean: add utility for replacing BLI string copy/printf with macros
These macros have the advantage of being less verbose and disallowing
sizeof(..) referencing the size of a pointer. e.g. #107443.
2023-05-09 13:16:09 +10:00
2d99b935f3 BLI_string: add macros to wrap BLI_vsnprintf 2023-05-09 13:16:09 +10:00
e151425c5c Fix #107694: Assert adding custom normals to empty mesh 2023-05-08 18:41:06 -04:00
150943e084 Cleanup: Move remaining sculpt_paint files to C++
See #103343

Pull Request: blender/blender#107757
2023-05-08 23:48:38 +02:00
ce96abd33a Fix: Build error after simulation header cleanup
Making the geometry state's geometry public to remove
the accessors didn't work without the constructor.
2023-05-08 17:21:15 -04:00
2f349ce884 Cleanup: Add comments to simulation state header
Pull Request: blender/blender#107744
2023-05-08 21:42:38 +02:00
8e4e616a4b Fix #106023: File Browser Lists with Incomplete Previews
Ensure all File Browser list items get previews.

Pull Request: blender/blender#107698
2023-05-08 20:53:08 +02:00
819cd58864 Cleanup: Make Accumulate Attribute node more generic
Geometry Nodes strives to reduce template usage in code,
to use it only for extremely important loops or for template math
processing on attributes. Due to this, this pull request cleans up
to delete template classes and uses `convert_to_static_type` in
accumulate function directly.

Pull Request: blender/blender#104440
2023-05-08 20:36:12 +02:00
50d49e24c4 Asset Views: Decrease default preview cache size
This was set to a higher value than intended, because the actual caching
doubles the size internally. So it would keep up to 512 previews in
memory which is a bit excessive. See discussion in #107711.
2023-05-08 19:57:56 +02:00
6a7ca67a98 Fix #107725: ray-offset was incorrectly applied on motion triangles
79f1cc601c introduces a ray-offset to improve ray tracing precision near
triangle edges, but motion triangles still read the static vertices,
causing incorrect intersection detection

Pull Request: blender/blender#107748
2023-05-08 19:11:11 +02:00
07ac8cb15a Fix #107506: Depsgraph: non-geometry component is treated as geometry component
Pull Request: blender/blender#107509
2023-05-08 18:51:15 +02:00
527b21f0ae LibOverride: Restore local references to virtual linked liboverrides on resync.
When resyncing linked liboverride data, new IDs may be created that do
not exist in actual library file (since the lib file has not been resynced).

If such 'virtual linked liboverrides' data-blocks are used locally (e.g.
by adding such object to a local collection), on next file read they will be
detected as missing.

Now resync code will list such missing linked IDs that were
liboverrides, and try to re-use them when matching (by root name and
library) with newly generated virtual liboverrides.

The process may not be 100% perfect, especially a perfect one-to-one
remapping cannot be ensured if source data keep being changed over and
over (because of the order in which virtual linked liboverrides
generated by resync may change over time). However, in practice this
should fix the vast majority of issues, especially if sane naming
practices are used on IDs.

---------------

For the record, an attempt was made to write liboverride data together
with the placeholders for linked IDs in .blendfile. In theory, this
should ensure a perfect and fully valid re-usage of such IDs.

However, for this to work, not only the liboverride data of linked IDs need
to be written on disk, but also all ID references in this data has to be
considered as directly linked, to ensure that such liboverride data can
be re-read properly.

Otherwise, these placeholders would get a liboverride data with NULL ID
pointers, which is useless.

Such change feels way to intrusive for the very limited benefit, so for
now would consider current solution as the best option.

Pull Request: blender/blender#107144
2023-05-08 18:22:33 +02:00
0327d2c963 Add missing notifier when setting cursor.matrix
Add a notifier when setting `scene.cursor.matrix`. This was already in
place for `cursor.location` and `cursor.rotation`, but was still missing
for `cursor.matrix`, which caused the cursor to remain displayed in its
old transform.
2023-05-08 16:58:26 +02:00
8759ae1760 GPU: Initialize SRGB In TestCases
Vulkan test cases uses SRGB conversion. These test cases where failing
as the conversion table wasn't initialized.

This PR initializes the conversion table and fix the Vulkan data
conversion tests.
2023-05-08 15:32:15 +02:00
7e79e0eec0 File Browser: Avoid filling file cache needlessly on auto-complete
This would iterate over all files and call the sneaky `filelist_file()`,
meaning each file would be added to the cache for a minor query. That's
plenty of unnecessary work and kinda defeats the purpose of the partial
cache design.
2023-05-08 15:01:00 +02:00
be19edf356 Cleanup: Add API comment on side-effect of file browser query function
`filelist_file()` is an easy way to do a bunch of unnecessary work and
fill the file browser caching for little reason. Unfortunately the
caching affects too many things to be a mere API implementation detail,
so rather be clear about this and point out alternatives.
2023-05-08 15:01:00 +02:00
c0ce427760 Cleanup: Move file cache lookup into function
The details on the file cache lookup just look confusing and make the
function look daunting. Encapsulate it into a function so it's trivial
to see what's going on
2023-05-08 15:01:00 +02:00
967cd7f99e Fix: Viewer node crashes when the editor is pinned and has no Object ID
This case was not properly handled by the previous fix in #107621.

The viewer node path function still assumes that the node editor space
has a valid ID pointer (`snode.id`) and that it is an `Object`.
The ID pointer can be null when setting a pinned node tree through the
python API, like so:
```Py
space.pin = True
space.node_tree = some_other_node_tree
```

In this case the `ED_node_tree_start` function is called without and ID
pointer, which is allowed! This patch makes sure that the viewer node
path function is only used with a valid object context.

Pull Request: blender/blender#107737
2023-05-08 14:52:06 +02:00
304e8a842d Fix: editor crashes during simulation bake
Fixes crashes in timeline and spreadsheet editors during simulation
nodes baking:
* Timeline tries to access the `states_at_frames_` list of the cache to
  determine which frames to draw as baked. This can collide with the
  baking thread. Needs a mutex to safely access the cache state.
  Note: the old point cache has a pre-allocated flag array
  `cached_frames` which the baking thread writes into while timeline is
  reading it concurrently - not thread-safe but harmless.
* Spreadsheet keeps a data pointer during drawing, which may become
  deallocated when the cache is updated. Common approach here is to use
  `G.is_rendering` to lock the editor while baking.

Pull Request: blender/blender#107621
2023-05-08 14:34:21 +02:00
f3be425e97 Fix Pose Library: crash when using partially-keyed quaternions
Remove the assumption that quaternions are always fully keyed in a pose
asset. Even though quaternions really should be fully keyed, better not
make Blender crash when this assumption doesn't hold.

If the quaternion is only partially keyed, the other components are taken
to be from the unit quaternion (`[1, 0, 0, 0]`) and the result is
normalized before blending into the existing pose.

This fixes blender/blender-addons#104591, which was reported against the
pose library add-on, but actually was caused by an issue in Blender.
2023-05-08 13:54:07 +02:00
3e888d77ba Geometry Nodes: Simulation calculate to frame operator
Adds a new operator that resets caches and then iterates from the start
frame to the current frame in order to update caches.

Pull Request: blender/blender#107627
2023-05-08 13:41:21 +02:00
b4fb17f11c Geometry Nodes: allow skipping frames during simulation
The maximum delta time is still capped to one frame even if multiple
frames are skipped. Passing in a too large delta time is mostly unexpected
and can reduce the stability of the simulation. Also it can be very slow
when the simulation uses the delta time to determine e.g. how many particles
should be added.
2023-05-08 13:10:30 +02:00
309775a28b I18N: updated UI messages translations from SVN trunk (r6511). 2023-05-08 13:02:16 +02:00
1f3fda16e6 Vulkan: Extract Correct UniformBuf Name From Interface
Fixes an issue as the uniformbuf name was incorrectly extracted
from the shader interface.

Pull Request: blender/blender#107736
2023-05-08 13:01:10 +02:00
f6b492c43d Build: use versioned TBB library to avoid conflicts with Linux system libs
Other shared libraries already do this, but for TBB it was off by default.

The conflict would happen when LD_LIBRARY_PATH is set which overrides rpath,
either manually by the user or by the Steam launcher.

Ref #107385, #104895

Pull Request: blender/blender#107587
2023-05-08 12:47:32 +02:00
3c2dc42712 Fix (studio-reported) crash in liboverride resync code after recent changes. 2023-05-08 12:46:03 +02:00
ae1c52b3f2 Cleanup: remove dead code 2023-05-08 11:48:01 +02:00
d8388ef36a Fix: avoid extra depsgraph evaluation when stopping animation playback
The `NC_SCENE | ND_FRAME` was originally added so that the sequencer
preview is redrawn so that the fps stops showing (2855485565).

Using this specific notifier has the side effect that it also causes a depsgraph
update in `wm_event_do_notifiers`. However, that is not necessary just to
trigger the redraw. Using the `NC_SPACE | ND_SPACE_SEQUENCER` notifier
also triggers the redraw without causing a depsgraph update.
2023-05-08 11:27:50 +02:00
8e9ada0079 Fix: force frame update only when starting animation timer
Otherwise this always causes an extra depsgraph update when
animation playback is stopped.
2023-05-08 11:27:50 +02:00
037b3f87bd Fix: scrubbing time always has extra update that is only used by sequencer
The sequencer has a feature where it only draws a preview while scrubbing.
This was introduced in 8abdc89912.
When scrubbing ends, the sequencer requires an extra update so that the
non-preview version is shown again.

This is only needed by the sequencer and hence the update should not be
done if the sequencer is not used.

Changing `screen->scrubbing` is moved out of the sequencer specific
functions, because it's used elsewhere as well.
2023-05-08 11:27:50 +02:00
2fbbc7acbb Fix: unnecessary depsgraph update when scrubbing in timeline
Previously, there was always a depsgraph update when the mouse moves
while scrubbing in the timeline. Even when the mouse movement does
not change the actual frame. This can happen when e.g. the mouse first
hovers over frame 5.2 and then it moves to frame 5.3. In both cases the
actual frame is rounded to 5, so no update is necessary (that is unless
subframes are used).
2023-05-08 11:27:50 +02:00
cd49cb08e3 BLI_string: call BLI_string_debug_size from functions with a buffer size 2023-05-08 19:12:48 +10:00
55f7f082a8 Cleanup: avoid BLI_path_basename when the filename is known 2023-05-08 19:12:48 +10:00
c3365666e5 Fix #107637: crash when using density brush on empty hair 2023-05-08 09:26:15 +02:00
04d50f4b23 UI: support operator enums in Quick Favorites
Part of #59244

This was heavily requested since there are a lot of usages of
`operator_menu_enum` around in our UI [and these menus all cannot be
added to Quick Favorites atm.].

The following are just a small sample from the 3D viewport menus (object
mode), but there are many more.

- Object
-- Set Origin
-- Relations >> Make Local...
-- Convert To
- Add
-- Grease Pencil
-- Empty
-- Force Field
-- Collection Instance
- Select
-- Select All by Type
-- Select Grouped
-- Select Linked
- ...

So in order to make this work, `USER_MENU_TYPE_OPERATOR` /
`bUserMenuItem_Op` is reused (but extended with a string to the property
in question). (Alternatively, a new type could be introduced -- but
would share most of the code with the type that is reused in this
patch).

Depending on being used with an enum or not [detected by the usage of
that new string] we then either call `uiItemFullO_ptr` or
`uiItemMenuEnumFullO_ptr` in `screen_user_menu_draw`.

NOTE: support for other enums (property enums such as pivot point or
transform orientations) will follow in a separate commit (building upon
6a13b6324b, trying to solve the way these draw as menus)

NOTE: opening User Preferences with such "new" Quick Favorites even
works (just not drawn with a menu)

Pull Request: blender/blender#107616
2023-05-08 09:14:45 +02:00
f080dca2c0 Fix #107717: Missing looptri_polys loading lineart
The `looptri_polys` array was missing likely due to a mesh data
structure update, causing lineart loading function to crash. Now fixed.
2023-05-08 12:18:11 +08:00
bb5a22539c Cleanup: correct path size argument
BKE_appdir_folder_documents clamps to FILE_MAXDIR internally.
2023-05-08 12:49:44 +10:00
8a852de147 BLI_fileops: change BLI_dir_create_recursive string size handling
Replace MAXPATHLEN with FILE_MAX, always allocate if the buffer isn't
big enough since creating a truncated directory isn't useful.

Having some code-paths only run in an ifdef complicated the code
and made it more difficult to follow.

Also assert the path doesn't contain ".." directories as they aren't
supported.
2023-05-08 12:49:44 +10:00
64674b10d1 Cleanup: quiet compiler warnings 2023-05-08 11:47:27 +10:00
893bd37bc0 Cleanup: formatting 2023-05-08 01:20:41 +02:00
c431b69a8a Fix #72011: Visible artifacts after baking normals with bevel shader
Pull Request: blender/blender#106988
2023-05-07 22:41:47 +02:00
c502d3ac53 Fix #105147: Rename geometry node to Is Face Planar
Renamed geometry node "Face Is Planar" to "Is Face Planar"
so that the name in the menu and in the node are the same.
Translations now also works as expected.

Pull Request: blender/blender#107713
2023-05-07 22:37:05 +02:00
31d71f39ad UI: fix or improve many messages
- The official spelling of FFMPEG is FFmpeg (upper, then lower case).
- The normal vector copy and paste operators shoud be singular because
  they can only be used on a single element.
- The "Parent File" file browser operator goes up one level in the
  file hierarchy. It should be called "Parent Directory", like the
  current description "Go to the parent directory".
- "Mass Vertex Group" used to define the mass, but was reused at some
  point and now actually defines cloth pinning so it should be called
  "Pin Vertex Group", as in the UI.
- The Transformation constraint's Map To Type suffered from a
  typo (probably of -> on).
- "Fall-off" is more commonly spelled "Falloff".
- "Effected" should really be "Affected" in this case.
- Rephrase the descriptions for the curve painting tools drawing
  plane, which did not seem to match what the settings do. Namely,
  they allow selecting in which plane to draw curves using the Curve
  Draw tool.

Reported by @Joan-Pujolar in #43295:
- Force exporting animation on every objects [objects singular]
- Color of the interface widgets text insertion cursor (caret) [delete
  interface widgets]
- Index of active aov [AOV in uppercase everywhere else]
- Does this tool use an painting canvas [an]
- This script was written Blender version %d.%d.%d ["for" missing
  before "Blender"]
- [fcurve -> F-curve]
- unknown error stating file [statting]
- Offset into each stroke before the beginning of  the dashed segment
  generation [Two spaces between of and the]
- Find the nearest element in the a group. [either "the" or "a"]

Pull Request: blender/blender#107699
2023-05-07 15:27:28 +02:00
de5aca9418 Refactor: unify UNIX/WIN32 BLI_dir_create_recursive & some improvements
- Don't duplicate/allocate the path on each recursion,
  instead make a single copy which is modified in-place.

- Move slash-stepping to a BLI_path utility function that accesses
  the end position of the parent directory, handles multiple slashes
  and '/./'.
2023-05-07 23:09:56 +10:00
f7d3115d97 Cleanup: replace BLI_strncpy with memcpy when the size is known
Also remove temporary filename buffer which is no longer needed.
2023-05-07 16:55:40 +10:00
0d1362bfd7 Cleanup: spelling in comments 2023-05-07 16:46:37 +10:00
df54b627b3 Cleanup: use of the term 'len' & 'maxlen'
Only use the term len & maxlen when they represent the length & maximum
length of a string. Instead of the available bytes to use.

Also include the data they're referencing as a suffix, otherwise it's
not always clear what the length is in reference to.
2023-05-07 16:46:37 +10:00
5abb3c96cf UV: Add pinned island support to uv packer
New pinned modes:
 * Ignore pinned islands
 * Normal (default)
 * Lock scale
 * Lock rotation
 * Lock position of pinned UV islands.
2023-05-07 17:54:51 +12:00
5258604531 Cleanup: use of the term 'len' in BLI_string_utf8, BLI_string_utils
Reserve the term `len` for string length, some functions used this for
an string/array length, others a destination buffer size
(even within a single function declaration).

Also improve naming consistency across different functions.
2023-05-07 14:56:11 +10:00
7966888af5 Cleanup: don't use an inline function which is passed as an argument
GCC13 fails to compile this with `-O1`, while it should be supported,
there is no advantage to this being an inline function so remove it.
2023-05-07 14:50:27 +10:00
464a40c1a5 Cleanup: use the name of the CMake WITH_STRSIZE_DEBUG for the define
Prefer matching names so there is no reason to confuse the identifiers.
2023-05-07 13:55:19 +10:00
7f8495c44b CMake: add WITH_STRSIZE_DEBUG option, RNA support
Support string size debug so it can be used for regular development.

It works be writing values into strings, ensuring the buffer size
given is actually available. Developers can use this with memory
checking tools such as ASAN/valgrind to force an error when
the value used for the size of a buffer is larger than the buffer.

Resolve remaining issue with RNA using BLI_strncpy* in generated
callback functions where the size argument didn't represent the
size of the destination buffer.

This is automatically enabled along with ASAN for the
blender_developer.cmake configuration.

Ref PR !107602.
2023-05-07 13:52:49 +10:00
0cf682f570 RNA: ensure string size with RNA_property_string_get_alloc 2023-05-07 13:22:35 +10:00
3ed297633d Fix unintended fall-through in ANIM_is_active_channel
Regression in [0] would treat many eAnim_ChannelType types data as a
bActionGroup. Resolve by including the NULL check in the return.

[0]: 80feb13665
2023-05-07 13:14:20 +10:00
0eba9e41bf Cleanup: Convert float to double during uv unwrap
`sinf(float_angle)` is sometimes producing different results on
x86_64 cpus and apple silicon cpus. Convert to double precision
to increase accuracy and consistency.

Partial fix for #104513. More to come.
2023-05-07 12:07:40 +12:00
a684e61cbf Cleanup: fix warnings 2023-05-07 11:47:54 +12:00
07dfc6eccc LibOverride: Further fixes/improvements to partial recursive resync process.
This addresses the 'liboverrides still tagged for resync after resync
process' error reports.

Turns out, this situation is (unfortunately) normal in some rare cases,
hwne the hierarchies in the liboverride and the reference data have
drastically diverged.Since the detection of liboverrides to resync, and
which one are valid partial resync roots, happens on the 'old' override
hierarchy, it may not match the actual hierarchy recreated from the
reference data, leading to some part of it being ignored by the resync
code.

There is no real way to avoid this situation, the only thing that can be
done is detect it, and re-process the resync code again when it happens.

From quick limited tests in (extremely dirty/outdated) Pets production files,
most of the time only one resync process is needed. Worst case so far
required 5 reprocessing of the same set of data.

There is no error messages from resync anymore in these tests, so at the
very least resync process should now be significantly more reliable than
before...
2023-05-06 16:27:50 +02:00
40d79e3d2b LibOverride: Fix/Improve partial resync detection code.
This issue tackled here is essentially the same as in ac1ac6be9a
(recursive Purge of unused IDs could delete actually used IDs): handling
of dependency loops is extremely delicate...

This commit essentially rewrites from scratch the code that ensures that
all liboverrides and their dependencies that need it are tagged for resync,
and identifies the partial resync roots.

Dependency loops whitin a hierarchy make this process very complex, as
they can lead to having to recursively process more than once some IDs.
Partial resync roots are also a source of complexity, since some IDs may
be detected a potential roots, and later as dependencies of another
partial resync hierarchy.

This new code generates waaaaaayyyyy less error messages when resyncing
nightmare-like production files (i.e. production files which libraries
have been _heavily_ modified). There are still a few error reports in
some cases though, which are the synptoms of another issue that will be
fixed in the next commit.
2023-05-06 16:21:46 +02:00
370a2bb416 LibOverride: Resync: Do not ignore embedded IDs in hierarchy processing.
While in practice this was probably not a big issue (since usually e.g.
objects used by a nodetree would also be used by other objects or
collections in the liboverride hierarchy), in some corner cases it could
have caused missing 'tag for resync' and improper partial resync roots
detection.
2023-05-06 12:36:52 +02:00
bd412c9e71 Fix crash when accessing length of material_slots on evaluated Empty object.
`BKE_object_material_count_eval` did not take into account the Empty
object case at all.
2023-05-06 12:25:45 +02:00
60283c63f1 Cleanup: Remove redundant ImBuf channels assignment
Setting channels is already handled as part of `IMB_allocImBuf`

Pull Request: blender/blender#107675
2023-05-06 06:39:17 +02:00
b01f5444a3 UV: Improve packing efficiency
Introduces "Optimal" packing, where the layout is a theoretical
best possible for a given input.

e.g. https://erich-friedman.github.io/packing/squinsqu

Also calls multiple packing algorithms, and chooses the best one.
2023-05-06 10:39:00 +12:00
3609ed7eb0 Cleanup: format 2023-05-06 10:39:00 +12:00
5cc8fea7e9 Fix #107212: Fix file browser thumbnails for images
Fix several issues found while investigating missing browser thumbnails.

TIFF, PSD, and PNG now use their old file check code. This is due to
OIIO not having an early-out check within `.open`. Calling `.open`
required a large portion of the file to be available (more than 8192
bytes). The code here can be removed in the future if/when a new API is
available which alleviates this problem.

PSD files often carry along a large blob of ICCProfile metadata.
Attempting to roundtrip this metadata when we cache the thumbnail to
.png was leading to problems. We suppress this metadata now as ICC
profiles are not supported in general and are quite large.

Lastly, even after the mentioned new API is available, OIIO will want to
validate the full header of some file formats. DPX is the largest at a
full 2048 bytes so we must have this as our minimum now too. OS's should
be servicing this read call just as efficiently as when using 64. I
could spot no performance difference here at least.

This was missed during development because Blender will cache thumbnails
into a special .thumbnails directory and the images I was using to test
had already been cached there.

Pull Request: blender/blender#107515
2023-05-06 00:16:19 +02:00
fcddc1a1af Fix #107648: Proportional Edit sometimes cancels GPencil keyframe transformation
The selection flag (`TD_SELECTED`) of transform data is essential for
Proportional Edit. If set up incorrectly, it may result in early
cancellation.
2023-05-05 18:47:20 -03:00
356e26a4e6 Shadow linking: Initial work towards MIS support
The goal of this change is to make it so the emitters are not forced
to have MIS disabled when shadow linking in used. On the user level
it means that lights sources sources which are behind excluded shadow
blocker will be visible in sharp glossy reflection.

In order to support this an extra shadow ray is traced in the direction
of the main path, to gather contribution of emitters behind shadow
blockers. This is done in the two new kernels.

First kernel performs light intersection to see if the extra shadow
ray is needed. It is not needed if, for example, there are no light
sources in the direction of the main path.

The second kernel shades the light source and generates the actual
shadow path.

Such separation allows to keep kernels small (so that no intersection
and shading happens in the same kernel). It also helps having good
occupancy on the GPU: the main path will not wait for the shadow
kernels to complete before continuing (the main path is needed by the
extra shadow path generation, to have access to direction and shading
reading state).

Current implementation is limited to lights only: there is no support
of mesh lights yet.

The MIS weight of the new shadow ray needs to be double-checked. It was
verified to give same result as the main path when the same light is
hit.

To avoid contribution from the same light source counted by the shadow
ray and the main path the light source which was chosen to trace the
shadow ray to is excluded from intersection via transparent bounces.
This seems unideal and feels that it could be done via some MIS wights
as well. Doing so is an exercise for later.

The kernel naming could be improved. Suggestions are welcome.
There are also quiet some TODOs in the code. Not sure how much of those
must be resolved prior to merge to the cycles-light-linking branch.
Would be cool to have extra eyes on some of the MIS aspects, which is
easier in the shared branch.

Tested on the CPU and Metal on M2 GPU.

Ref #104972

Pull Request: blender/blender#107439
2023-05-05 21:44:07 +02:00
d1bfda16bb Cycles: re-enable HIP on Linux
Using the new ROCm 5.5 compiler.

Ref #104786

Pull Request: blender/blender#107662
2023-05-05 19:36:55 +02:00
25fe9d74c9 Cycles: Fix hang when MSL->AIR compilation fails
Follow up to [#100066](https://projects.blender.org/blender/blender/pulls/105122/files). Scenes that do pre-render work on the GPU (e.g. the bake unit tests) will still hang if there are MSL compile failures. This patch adds a loop break out in case of an error.

Pull Request: https://projects.blender.org/blender/blender/pulls/107657
2023-05-05 18:52:54 +02:00
ef587a8a0b Cleanup: Fix strict compiler warning
Fixes no previous declaration for function warning.

Pull Request: blender/blender#107660
2023-05-05 18:29:45 +02:00
80feb13665 Allow select range in animation editor
This patch will add support to select all channels between active channel
and last-clicked channel without deselecting previous selection. `Shift` key is
now assigned for the range selection and `ctrl` key to extend the selection. This
changes will make multi-selection similar as outliner tree-elements. New function is
created `animchannel_select_range` to handle the range selection of channels.

Old Differential revision: https://archive.blender.org/developer/D17079

Pull Request: blender/blender#104565
2023-05-05 17:46:05 +02:00
c9b51591da Refactor: Allow to explicitly set the range on the slider UI element
The current implementation goes like this
* default to a 0-1 range
* you can set `is_bidirectional` to get a -1/1 range
* if the slider is bidirectional the overshoot goes both ways, otherwise only on the positive side

The issue is that it is not possible to have a 0-1 range but overshoot both ways.
This is useful for example on the "Blend to Default" operator, where 0 means current position and 1 default.
But overshoot also makes sense for this operator since the other way just scales away from default.

So this patch:
* removes `is_bidirectional`
* adds `float range[2]` to `tSlider` and a setter for it
* rewrite some logic to handle arbitrary ranges
* split the `allow_overshoot` flag into one flag for either side

Pull Request: blender/blender#107406
2023-05-05 17:22:39 +02:00
9665b5da96 Merge branch 'main' into cycles-light-linking 2023-05-05 16:40:30 +02:00
0ffde36fe7 Refactor: flatten light tree in recursive function
This will make further changes for light linking easier, where we want to
build multiple trees specialized for each light linking set.

It's also easier to understand than the stack used previously.

Pull Request: blender/blender#107560
2023-05-05 16:32:59 +02:00
c796cbebef Metal: Add atomicExchange and mat3x4 support 2023-05-05 16:18:24 +02:00
9654b96ffa Refactor: pose_slide.c
* add const where possible
* reduce calls to `ED_slider_factor_get` and instead store that in `const float factor`
* rename variables from camel case to snake case, using full words, to conform to naming convention
* use interpf where possible

no functional changes

Pull Request: blender/blender#107610
2023-05-05 15:30:29 +02:00
878477f250 Fix broken UI view notifier listening
(UI views: https://wiki.blender.org/wiki/Source/Interface/Views)

Noticed while working on asset UIs with views, when async loading of
assets wouldn't trigger redraws.
2023-05-05 15:20:05 +02:00
48abc09d84 Cleanup: format 2023-05-05 23:44:56 +12:00
29053c5c02 EEVEE-Next: Fix validation layer errors on Metal
This only fixes the culling tile group size.
2023-05-05 12:52:47 +02:00
5a88afeaec DRW: Fix mixed type comparison warning 2023-05-05 12:52:47 +02:00
eab0cd475a EEVEE-Next: Fix wrong texture usage flag 2023-05-05 12:52:47 +02:00
c11ac86e03 Cleanup: Metal: Better function name and comments for buffer bindings 2023-05-05 12:52:47 +02:00
2f1bf2ff1e EEVEE-Next: World: Fix missing SSBO bind 2023-05-05 12:52:47 +02:00
f74ad1d9f4 Fix shadow linking crash and invalid result
Was a mistake in the kernel features check flag.

Noticed when running the regression test suit with forced
shadow linking:

    light_linking.runtime.blocker_shadow_set = 1;
    light_linking.runtime.shadow_set_membership = 2;

Pull Request: blender/blender#107649
2023-05-05 12:37:59 +02:00
95fa4d73d6 Cleanup: Avoid nested conditional blocks in WM-jobs code
Conditional blocks introduce scopes that need to be kept track of,
linear code is easier to follow. So use early exiting (`continue`s in
this case) to reduce cognitive load, a number of devs consider this good
practice.
2023-05-05 12:15:38 +02:00
8284bb1ff4 Fix potentially missing redraws when file browser loads recursively
The `do_update` boolean would be overridden with false whenever a single
directory didn't add new items. It should not modify it in this case.
2023-05-05 11:52:54 +02:00
ecb8d7f8ab Tests: Add test for broken EXR files
To make sure non-trivial cases like #106977 are not re-introduced.

Pull Request: blender/blender#107643
2023-05-05 11:00:54 +02:00
70cd2a9741 RNA: use memcpy for copying strings when the length is known
There is no advantage in using BLI_strncpy/BLI_strncpy_utf8 when the
destination string has been allocated and won't be concatenated.

Also no need to calloc memory which is filled by strcpy afterwards.
2023-05-05 15:36:50 +10:00
c80e9641ed Cleanup: replace UTF8 string copy macro with function 2023-05-05 14:36:09 +10:00
dc4e48fca0 Cleanup: quiet clang-tidy char subscript warning 2023-05-05 14:21:13 +10:00
b0aa8fb16a Cleanup: quiet warning 2023-05-05 14:09:38 +10:00
f665b73c89 RNA: replace BLI_strncpy with strcpy/memcpy when the size is known
Follow up on [0] handle remaining cases where BLI_strncpy was used
it RNA string get callbacks.

[0]: c891dbd162
2023-05-05 14:01:57 +10:00
6796cce11d Refactor: add a function to access images extensions from it's format
Previously accessing the extension needed to ensure an extension
on an empty path.

This conflicted with DEBUG_STRSIZE as it was assumed the input was
FILE_MAX, where as it was a small buffer with RNA, see: !107602.

Resolve by separating the function that ensures the extension
with the function that finds valid extensions for a format.

Also pass the size of the filepath to functions that ensure the
extension.
2023-05-05 14:01:57 +10:00
f15889a9f9 Sculpt: Split face set visibility invert into its own operator
Visibility invert should not use OPTYPE_DEPENDS_ON_CURSOR.
2023-05-04 17:49:40 -07:00
e5598d067b BKE_image: simplify UDIM tile label access, return string length 2023-05-05 10:26:17 +10:00
a79272a790 Sculpt: fix broken pbvh draw
foreach_faces now passes looptri index instead of a
MLoopTri pointer.
2023-05-04 17:09:53 -07:00
8cbb42c640 Cleanup: de-duplicate internal function for file/directory split
Also note that BLI_path_basename can be used in place of
BLI_path_split_file_part when a copy isn't needed.
2023-05-05 10:02:46 +10:00
831bacec92 Cleanup: use function style casts & nullptr in C++ code 2023-05-05 09:46:28 +10:00
ba3d7499fa Cleanup: spelling, use term polygons in polygon callbacks 2023-05-05 09:46:28 +10:00
49c09d7640 Cleanup: remove inline pointcache extension stripping
No need to perform inline, and it would not have worked properly for
*.blend1 files.
2023-05-05 09:46:28 +10:00
f2bbcc317f Cleanup: format 2023-05-05 09:46:04 +10:00
e858aa7181 Fix #107623: Do not allow dragging search menu from custom socket
To prevent invalid links, simply disable them for this socket type.
Other nodes with such sockets may appear in the future.

Pull Request: blender/blender#107628
2023-05-04 19:27:55 +02:00
93d464dcd1 Fix snapping with constraint flickering
Flickering observed when snapping to edge or face with axis constraint.

It was probably introduced in 4eda60c2d8

The snapping code has a timer, so `t->tsnap.snapElem` isn't always set.

So avoid changing the value of `t->tsnap.snapElem`.
2023-05-04 14:05:47 -03:00
730b11034f Cleanup: Move remaining modifier files to C++
See #103343

Pull Request: blender/blender#107626
2023-05-04 18:35:37 +02:00
8d19f4a62a Cleanup: Apply clang-format 2023-05-04 17:38:33 +02:00
8735be293e Merge branch 'main' into cycles-light-linking 2023-05-04 17:37:40 +02:00
eca8e6bf5e Refactor: Convert mask module to C++
Pull Request: blender/blender#107615
2023-05-04 17:36:01 +02:00
5aa51cf607 EEVEE-Next: Fix warning when using Metal backend 2023-05-04 17:01:28 +02:00
78d2f162e8 Metal: Fix EEVEE-Next shader compilation errors 2023-05-04 17:01:28 +02:00
aa31d9be80 Metal: Fix Workbench-Next shader compilation errors 2023-05-04 17:01:28 +02:00
6b5b777ca3 UI: add Proportional Size to Proportional Edit popover
Rather than forcing the user to initiate a transform operation to edit the `Proportional Size`, allow editing of the `Proportional Size` through the UI.

The affected headers are:
- View 3D
- Dop Sheet
- Image Editor
- Graph Editor
- Mask Editor

Pull Request: blender/blender#107507
2023-05-04 16:39:22 +02:00
239c1194a0 Fix #107545: Mistakes in recent node.cc cleanup
1. Early return needs inverted null checking.
2. `BLO_expand` macros expect value, not a pointer.

Pull Request: blender/blender#107622
2023-05-04 16:32:15 +02:00
42d3df25f3 Cleanup: pass a const context to menu UI funcitons 2023-05-05 00:19:31 +10:00
fc6418ae94 Cleanup: quiet "undef" compiler warning 2023-05-05 00:19:23 +10:00
2e7b896928 Fix strict compiler warning in ImBuf
Solves the warning C4060: switch statement contains no 'case'
or 'default' labels warning with lite builds.

Pull Request: blender/blender#107619
2023-05-04 15:51:24 +02:00
d0705bd697 Mesh: Split MLoopTri poly indices into a separate array
For derived mesh triangulation information, currently the three face
corner indices are stored in the same struct as index of the mesh
polygon the triangle is part of. While those pieces of information are
often used together, they often aren't, and combining them prevents
the indices from being used with generic utilities. It also means that
1/3 more memory has to be written when recalculating the triangulation
after deforming the mesh, and that the entire triangle data has to be
read when only the polygon indices are needed.

This commit splits the polygon index into a separate cache on `Mesh`.
The triangulation data isn't saved to files, so this doesn't affect
.blend files at all.

In a simple test deforming a mesh with geometry nodes, the time used
to recalculate the triangulation reduced from 2.0 ms to 1.6 ms,
increasing overall FPS from 14.6 to 15.

Pull Request: blender/blender#106774
2023-05-04 15:39:10 +02:00
bf77d3436d Cleanup: Comment formatting for preview image enums definitions 2023-05-04 15:22:49 +02:00
9d422f2fbc Cleanup: Avoid nesting (use early exit) in icon code
Conditional blocks introduce scopes that need to be kept track of,
linear code is easier to follow. So use early exiting to reduce
cognitive load, a number of devs (including myself) consider this good
practice.
2023-05-04 15:05:49 +02:00
1049f11cc0 Fix #107566: Gesture face set respect hidden faces
Gesture face set selection (box and lasso selection) didn't respect hidden
faces, causing selection to bleed unexpectedly, now fixed.

Pull Request: blender/blender#107575
2023-05-04 14:51:36 +02:00
5e1470d1b3 Animation: Clean up "Key" menu in Graph Editor
* remove "Keyframe" label from the Key menu
* "Jump To Keyframe" -> "Jump to Selected"
* added a new menu "Density" with Decimate, Sample and Clean operators
* removed the "Clean Channels" entry. It does the same as the "Clean" operator but also removes channels IF the remaining keys are at the default value. The feature is still available in the redo panel
* Split the slider operators out by functionality
* Move Euler filter to Channel menu
* Remove "Add F-Curve modifier" from Key menu (it already is in the Channel menu)
* Move Bake/Unbake Curve functions to Channel menu
* Move "Bake Sound to FCurves" to Channel menu

Pull Request: blender/blender#106113
2023-05-04 14:10:27 +02:00
22e4e97310 macOS: Reduce Edit Mode Drawing Artifacts
Apple Silicon uses tile rendering and can discard tiles if it
is covered. The retopology overlay made some changes to the
shader that introduced some blocking and striping artifacts when
the overlay was disabled.

This PR changes the minimum used offset to reduce the drawing
artifacts. Tweaking the GLSL shader itself didn't work.

Fix #105830

Pull Request: blender/blender#107611
2023-05-04 12:42:37 +02:00
e674e32aa1 Fix: missing null check leads to crash when rendering
The simulation cache is allocated lazily during evaluation when the
depsgraph is active. However, during rendering, the depsgraph is not
active, so it's not created.
2023-05-04 11:04:42 +02:00
9d6659bf07 Metal: Shader: Remove assertion of compilation success
This allow the compilation tests to finish even on failure.
2023-05-04 10:59:26 +02:00
2815f46883 Metal: ShaderLog: Add initial implementation
This is a really rough implementation. Since the MSL sources
do not correspond 1:1 to the GLSL sources, some mapping is
needed to retreive the GLSL source file for a given generated
line. This will be implemented in a later commit.
2023-05-04 10:59:26 +02:00
e39c3c600c GPU: ShaderLog: Add more const correctness & notes supports
The metal shader compiler can produce `note` reports.
Treat them as warnings.
2023-05-04 10:59:26 +02:00
b0c7e83805 Cleanup: formatting
In recent changes to vulkan.
2023-05-04 10:23:15 +02:00
1c57ac6ce7 Cleanup: remove unused member variable 2023-05-04 10:19:40 +02:00
10a93aebf1 Fix #95855: prioritize selecting keys on active fcurve
This addresses #95855 by prioritizing the selection of keys in the following order:

1. Keys on the active curve.
2. Keys on any selected curve.
3. Other keys.

Additionally, this fixes an as-yet unreported issue where you couldn't select the main vertex of a key if it was overlapping with another one and one or more of its handle vertices were already selected.  This was due to the selection status of a key and its handles not being properly considered separately.

Pull Request: blender/blender#107223
2023-05-04 10:10:34 +02:00
f428fd8229 Vulkan: Share Device Between Contexts
Previous GHOST_ContextVK would create a logical device for each
context. Blender uses multiple contexts at the same time and wasn't able
to share resources between them as the logical device where different.

This patch will create a single logical device and share them between
multiple contexts. This allows sharing memory/shaders between contexts
and make sure that all memory allocations are freed from the device it
was allocated from.

Some allocations in Blender are freed when there isn't a context, this
was failing in the previous implementation. We didn't noticed it before
as we didn't test multiple contexts.

This patch also moves device specific data structures from VKContext to
VKDevice like the descriptor pools, debug layers etc.

Pull Request: blender/blender#107606
2023-05-04 10:06:48 +02:00
93b6463113 Assert ImBuf & Main paths never use blend-file relative prefix
Add assertion on free because the final path isn't always known on
creation.
2023-05-04 13:43:28 +10:00
4395a35641 Cleanup: reduce indentation with early returns in allocimbuf 2023-05-04 13:18:42 +10:00
cf16eab370 Cleanup: avoid calling stat twice in BLI_dir_create_recursive 2023-05-04 13:12:35 +10:00
aa7d7c8e4b Cleanup: naming in BLI_path, reserve len for string length
- Names ending with len sometimes referred to the buffer size.
  The same names were used for both buffer size and string length
  depending on the function in some cases.

- Rename str/string to path for generic path functions.

- Rename BLI_path_rel arguments (file, relfile) to (path, basename)
  as it wasn't so clear which is being made relative, `file` can be a
  directory so rename to `path` (matches naming for BLI_path_abs).
2023-05-04 13:09:28 +10:00
c891dbd162 RNA: replace BLI_strncpy with strcpy when when the size isn't meaningful
The size limit used in RNA string access wasn't meaningful as the size
of buffers passed into these functions is defined by the length+1 which
uses strlen, unterminated strings would already cause a buffer overflow.
Note that strcpy for accessing RNA is already widely used,
there were just some cases that used BLI_strncpy too.

This also removes use of BLI_strncpy_utf8 in texture slot access as
names are expected to be utf8, sanitizing when copying in this
particular case doesn't make sense and isn't done elsewhere.
2023-05-04 13:09:28 +10:00
069db83152 BLI_string: move DEBUG_STRSIZE check into a macro, check sizes after nil
- Avoid inline ifdef checks for DEBUG_STRSIZE
- Add BLI_string_debug_size_after_nil to ensure strings to manipulate
  have the expected buffer size after the nil terminator.
- Add checks to more string manipulation functions.

Further changes are required for this to be enabled during regular
development as the RNA currently allocates the strings length but
passes in the buffer size as a limit which conflicts with DEBUG_STRSIZE.
2023-05-04 13:09:28 +10:00
40ff2cfdc5 BLI_path: correct buffer size argument
Pass the size of the string passed in, although in practice
this didn't cause any problems.
2023-05-04 13:09:28 +10:00
9ebe819579 Fix #107577: Cycles crash with denoising and Ashikhmin-Shirley BSDF 2023-05-04 03:14:20 +02:00
54e397cc78 Cleanup: convert node_exec.h to C++
Ref: #103343

Pull Request: blender/blender#107591
2023-05-04 00:09:29 +02:00
2390abf1d3 Cleanup: Reduce indentation when setting custom normals 2023-05-03 16:53:00 -04:00
96f9930de1 Cleanup: Miscellaneous changes in corner fan normal calculation
- Use C++ float3 type, and math function
- Remove non-helpful braces, comment
- Use slightly longer variable name
2023-05-03 16:21:08 -04:00
a7d652e459 Fix Unreported: GPencil grab tool doesn't work on strokes changed by modifiers
The grab tool in Grease Pencil sculpt mode doesn't work correctly on strokes affected by modifiers.
You had to grab over the original vertex positions to see any effect.

Pull Request: blender/blender#106744
2023-05-03 21:48:19 +02:00
367145209c Cleanup: Move attribute_math to proper blenkernel namespace
The fact that blenlib doesn't know about the set of attribute types is
actually an important detail right now that can influence how things
are designed. Longer term it would be good to consolidate many of
these attribute propagation algorithms anyway.
2023-05-03 12:10:54 -04:00
d9a7f1285f Cleanup: Rename field input classes to match UI names 2023-05-03 12:10:54 -04:00
7f040099e3 Cleanup: Deduplicate sampling at index in geometry nodes
The "Evaluate at Index" and "Sample Index" nodes are exactly the same
once they retrieve the values to copy and the indices (apart from the
clamping option anyway). This also allows devirtualizing the index input
in the evaluate at index node like the sample index node.
2023-05-03 12:10:54 -04:00
09c1a93c21 Cleanup: Simplify CurvesGeometry deletion copying
Use span slicing instead of the POINTER_OFFSET macro
2023-05-03 12:10:54 -04:00
1f76863f80 BLI: Remove clamping from generic span slicing
Similar to a5e7657cee
2023-05-03 12:10:54 -04:00
42cdd39618 Fix return of stack memory
The fix is suggested by Jacques.

Pull Request: blender/blender#107586
2023-05-03 17:59:12 +02:00
ac1ac6be9a Fix #107573: Purging orphan data deletes used data.
The logic in the initial commit (97dd107070) was broken in some cases,
and would end up tagging as unused IDs that had valid usages. It is
reverted by this commit..

For this new solution to #98029 (deleting unused archipelagos of data),
the logic handling dependency loops detection is reworked to rely on a
new tag in the relations entry of the relevant IDs, instead of
pre-tagging as unused the ID itself.

Further more, when a dependency loop is detected, the IDs in it cannot
be immediately tagged as unused, since it may be that the entry point
of that loop is later detected as actually used. So their relations
entries are not tagged as processed, and only the entry point of the
potential archipelago can be checked in that case, outside of the
recursive processing of dependencies.

The other IDs of the archipelago will then be processed again later, in
a state where at least one ID in the archipelago has a known state for
sure, which then allows for a safe evaluation of the other related data.

This commit should be backported to 3.3LTS.
2023-05-03 16:32:33 +02:00
109c1b92cd Fix #105621: USD export: incorrect texture alpha mapping
Fixed bug where texture alpha was incorrectly remapped to red when exporting material shaders.

Now connecting the UsdPreviewSurface 'opacity' input to the UsdUVTexture 'a' output if the Blender texture image node source socket identifier is 'Alpha'.

Changes include the following:

The InputSpec::source_name struct member was removed, as the connection source name is now determined at runtime based on the Blender node input socket identifier.

The traverse_channel() utility function now returns a bNodeLink*, so that the source socket identifier can be queried from the link.

In create_usd_preview_surface_materia(), the code for creating and connecting a UsdUVTexture shader was reorganized to group it within one conditional block, to make it easier to follow.  Also replaced a call to a deprecated version of UsdShadeInput::ConnectToSource().

Pull Request: blender/blender#107022
2023-05-03 16:12:52 +02:00
7ff752b789 Cleanup: Unify mesh sampling multifunctions
Change the implementation of the raycast and sample nearest surface
node to split separate loops into separate multi-functions. This
clarifies the task of each function, gives more information to the
field evaluator, and gives more opportunity for memory reuse.

Sampling mesh attributes with triangle barycentric weights is now
implemented in a single place. Two other new multi-functions
handle conversion of sampled positions into barycentric weights.
Normalizing the ray directions for the raycast node is split out
too, so it can be skipped in some cases in the future.

The mesh attribute interpolator helper class is also removed,
since it didn't give much benefit over a more functional approach.

I didn't notice a performance improvement from this change.

Pull Request: blender/blender#107563
2023-05-03 15:07:16 +02:00
743f57e95e Cleanup: Move draw_manager_profiling to C++
See: #103343

Pull Request: blender/blender#107508
2023-05-03 14:30:58 +02:00
642e18e889 Cleanup: Move node_util.h to C++
Ref: #103343

Pull Request: blender/blender#107569
2023-05-03 14:21:14 +02:00
0de54b84c6 Geometry Nodes: add simulation support
This adds support for building simulations with geometry nodes. A new
`Simulation Input` and `Simulation Output` node allow maintaining a
simulation state across multiple frames. Together these two nodes form
a `simulation zone` which contains all the nodes that update the simulation
state from one frame to the next.

A new simulation zone can be added via the menu
(`Simulation > Simulation Zone`) or with the node add search.

The simulation state contains a geometry by default. However, it is possible
to add multiple geometry sockets as well as other socket types. Currently,
field inputs are evaluated and stored for the preceding geometry socket in
the order that the sockets are shown. Simulation state items can be added
by linking one of the empty sockets to something else. In the sidebar, there
is a new panel that allows adding, removing and reordering these sockets.

The simulation nodes behave as follows:
* On the first frame, the inputs of the `Simulation Input` node are evaluated
  to initialize the simulation state. In later frames these sockets are not
  evaluated anymore. The `Delta Time` at the first frame is zero, but the
  simulation zone is still evaluated.
* On every next frame, the `Simulation Input` node outputs the simulation
  state of the previous frame. Nodes in the simulation zone can edit that
  data in arbitrary ways, also taking into account the `Delta Time`. The new
  simulation state has to be passed to the `Simulation Output` node where it
  is cached and forwarded.
* On a frame that is already cached or baked, the nodes in the simulation
  zone are not evaluated, because the `Simulation Output` node can return
  the previously cached data directly.

It is not allowed to connect sockets from inside the simulation zone to the
outside without going through the `Simulation Output` node. This is a necessary
restriction to make caching and sub-frame interpolation work. Links can go into
the simulation zone without problems though.

Anonymous attributes are not propagated by the simulation nodes unless they
are explicitly stored in the simulation state. This is unfortunate, but
currently there is no practical and reliable alternative. The core problem
is detecting which anonymous attributes will be required for the simulation
and afterwards. While we can detect this for the current evaluation, we can't
look into the future in time to see what data will be necessary. We intend to
make it easier to explicitly pass data through a simulation in the future,
even if the simulation is in a nested node group.

There is a new `Simulation Nodes` panel in the physics tab in the properties
editor. It allows baking all simulation zones on the selected objects. The
baking options are intentially kept at a minimum for this MVP. More features
for simulation baking as well as baking in general can be expected to be added
separately.

All baked data is stored on disk in a folder next to the .blend file. #106937
describes how baking is implemented in more detail. Volumes can not be baked
yet and materials are lost during baking for now. Packing the baked data into
the .blend file is not yet supported.

The timeline indicates which frames are currently cached, baked or cached but
invalidated by user-changes.

Simulation input and output nodes are internally linked together by their
`bNode.identifier` which stays the same even if the node name changes. They
are generally added and removed together. However, there are still cases where
"dangling" simulation nodes can be created currently. Those generally don't
cause harm, but would be nice to avoid this in more cases in the future.

Co-authored-by: Hans Goudey <h.goudey@me.com>
Co-authored-by: Lukas Tönne <lukas@blender.org>

Pull Request: blender/blender#104924
2023-05-03 13:18:59 +02:00
7d5d1eae9e Cleanup: add commit to .git-blame-ignore-revs
Add brace-placement formatting commit.
2023-05-03 20:31:11 +10:00
1dcc8e6ffa Fix #107356: Cycles: improve oneAPI error handling 2023-05-03 12:06:08 +02:00
8775cf804e Fix compilation on Windows after f30434ac99. 2023-05-03 11:55:24 +02:00
88ace032a6 Metal: Storage buffer and explicit bind location support
Adds support for Storage buffers, including changes to the resource
binding model to ensure explicit resource bind locations are supported
for all resource types.

Storage buffer support also includes required changes for shader
source generation and SSBO wrapper support for other resource
types such as GPUVertBuf, GPUIndexBuf and GPUUniformBuf.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#107175
2023-05-03 11:46:30 +02:00
bcedbdcf6f Cleanup: improve code-comments, naming, use defines, correct spelling 2023-05-03 17:34:27 +10:00
5f0a5c9b15 Cleanup: remove redundant path splitting in font loading
BLI_path_split_file_part ran for every filename comparison,
replace with BLI_path_basename and run once.

Also rename FaceDetails::name -> filename.
2023-05-03 17:23:19 +10:00
e5e17c5a81 Cleanup: rename "name" to "filepath"
Missed in recent cleanup.
2023-05-03 17:13:42 +10:00
7ec1456b43 Cleanup: remove BLI_path_abs call on ImBuf path when saving a sequence 2023-05-03 17:12:25 +10:00
d824030782 Fix blend file relative path being copied into ImBuf::filepath
ImBuf paths don't support blend file relative prefix,
make absolute after copying.
2023-05-03 16:54:30 +10:00
f9fbbd8f80 Cleanup: expand on code-comments
Rename layout_old to layout_ref as the layout is a reference
(the old layout has been freed).
Also use boolean for save_copy argument.
2023-05-03 16:31:37 +10:00
b690b8c16f Fix incorrect buffer size copying to StudioLight::filepath
Use STRNCPY macro so these don't get out of sync.
2023-05-03 16:26:42 +10:00
d770fd5ac4 Cleanup: remove unused BLI_dir_* functions
Loading a font in BLF would search a list of directory presets
however these presets were never used.
Remove them as all callers pass in full paths.

Also rename FontBLF::name to mem_name as it's only needed as an ID
for in-memory fonts (to prevent them being loaded multiple times).

Non-unique font loading now compares against the filepath or mem_name
when loading from files or memory (before both used `name` which was
often the filepath, sometimes the full ID-name).
2023-05-03 16:08:31 +10:00
6b9a500a3a Cleanup: disambiguate terms "name", "file" & "str" / "string"
- Rename name/filename/path to filepath when it's used for full paths.
- Rename name/path to dirpath when it refers to a directory.
- Rename file to filepath or path (when it may be a file or dir).
- Rename ImBuf::name & anim::name to filepath.
2023-05-03 15:26:14 +10:00
1f96fa1129 Cleanup: rename BLI_make_existing_file for clarity
Rename BLI_make_existing_file to BLI_file_ensure_parent_dir_exists.
The previous name read as if it would make (touch) the file,
where as it ensures the directory component of the path exists.

Move from BLI_path to BLI_fileops as path utilities should only
manipulate paths and not deal with file IO creation
(this has more in common with BLI_file_touch for e.g.).
2023-05-03 11:49:47 +10:00
bb341eaf12 BLI_path: use module prefix for BLI_filename_make_safe
Rename BLI_filename_make_safe -> BLI_path_make_safe_filename.
2023-05-03 11:48:52 +10:00
01aead42fc Cleanup: re-order split prefix/suffix return arguments last 2023-05-03 11:25:30 +10:00
947465c511 Cleanup: rename BLI_split_name_num, order return arguments last 2023-05-03 11:25:30 +10:00
f30434ac99 BLI_string_utils: BLI_uniquename no longer accepts NULL defname
A NULL defname would early exit (doing nothing) this isn't good behavior
as this function should always make the name unique and a NULL defname
is likely an error in the code which would allow duplicate names.
This is also inconsistent with BLI_uniquename_cb which always
wrote the defname into the name if it was empty.

Mark this argument as never-NULL.
2023-05-03 11:25:30 +10:00
4115fcbc38 Cleanup: update, add function attributes for BLI_string & BLI_path
Explicitly list ATTR_NONNULL indices in most cases so it's explicit
that arguments aren't NULL (and adding new arguments that can be NULL
isn't such a hassle).
2023-05-03 11:25:30 +10:00
381de3bd9e Cleanup: format 2023-05-03 11:25:30 +10:00
d5fc1b9ba4 Fix #107505: Temporary stack not cleared in BMesh normal calculation
Mistake in f8eebd3b25.
2023-05-02 17:24:00 -04:00
c2a2c2dcab Cleanup: Use array and span in weighted normal modifier 2023-05-02 17:08:14 -04:00
2e50e0a849 Fix #107514: Broken normals wtih weighted normal "keep sharp" option
The data indices for all loops in a fan weren't set, only the first.
2023-05-02 17:08:14 -04:00
f865e67593 Refactor: Replace move_key with BKE_fcurve_keyframe_move_value_with_handles
The helper function `move_key` did exactly the same things as `BKE_fcurve_keyframe_move_value_with_handles`
It was only created because I wasn't aware that such logic already existed
No functional changes

Pull Request: blender/blender#107402
2023-05-02 22:12:54 +02:00
dc0251df72 Fix: Graph Editor - add operator flags for cursor wrapping
The slider operators in the Graph Editor were missing operator flags for the cursor wrapping to work.
I've added it to the operators that allow overshoot, because for those it is really important to have no limits on scrolling.

Pull Request: blender/blender#107435
2023-05-02 21:38:57 +02:00
b3a3b94976 Cleanup: Avoid allocating extra array in sample nearest node
The distances array was filled but never used.
2023-05-02 15:07:52 -04:00
5b876b810f Fix #106776: Volume cube won't render in Cycles
In some cases the Geometry Nodes Volume Cube generates
a Volume grid that doesn't contain any leaf nodes. This can happen
when only tiles are needed to represent the volume.

This PR changes the `empty_grid` check function to also check if
there are any active tiles in the grid before returning `true`.

Pull Request: blender/blender#107551
2023-05-02 20:13:58 +02:00
22245115fd Fix #107499: Text Object Selection with Scale To Fit Mode
Allow mouse text selection and cursor positioning to work correctly
when the text box has overflow mode set to "Scale to Fit."

Pull Request: blender/blender#107510
2023-05-02 19:32:47 +02:00
71e4f48180 Nodes: Improve link drag search value moving
Now, when link drag search is used to create new input value nodes, it
also moves socket values into node storage. This means, by design, that
result of evaluation on node tree will not be changed. For data blocks,
the original value is set to null, thus avoiding the existence of
unused pointers.

Right now a few nodes (in shader in many cases) are implemented without
node storage, but by storing value in socket itself. Float value input
node is unsupported in this way too.

Pull Request: blender/blender#107470
2023-05-02 18:50:34 +02:00
dc73b63460 Fix: crash baking empty rigid body world
Found investigating #107420.

Steps to reproduce were:
- remove all objects from the scene
- add rigid body world
- bake
- crash

BKE_ptcache_bake would assume a cache can always be found, but with an
empty rigid body world this is not the case -- accessing flags would then
crash.

Now just check if we actually have a cache.

Pull Request: blender/blender#107537
2023-05-02 17:57:21 +02:00
d0c6117196 Fix #107420: crash getting PTCacheID when baking scene rigid body world
`ptcache_baker_create` falsely assumed the PointCache owner id is always
an **object**, but when baking rigid body world it is a **scene**. Code
would cast the ID to an object and passed that to `BKE_ptcache_id_find` /
`BKE_ptcache_ids_from_object` (which can get terribly wrong -- reading
_something_ on the scene as something from the assumed object).

Prior to f61ff22967 this was less likely to be a problem, but that
commit introduced a `DrawDataList` into the `struct Scene`. In the file
from the report, this would lead to `foreach_object_particle_ptcache`
now recognizing garbage memory as a particle system, accessing its
`ParticleSettings` `phystype` would then crash (buffer-overflow).

Now pass a NULL object to `BKE_ptcache_id_find` in case we are having a
scene, following code still handles rigid bodies just fine (the scene is
actually passed separately as well).

Pull Request: blender/blender#107536
2023-05-02 17:56:17 +02:00
88d03d15c1 Realtime Compositor: Implement Stabilize 2D node
This patch implements the Stabilize 2D node for the realtime compositor.

Pull Request: blender/blender#107401
2023-05-02 17:11:59 +02:00
1a5ad33a57 Cleanup: Move pipeline.h to C++
Ref: #103343

Pull Request: blender/blender#107516
2023-05-02 16:55:45 +02:00
9954a5d07c Cleanup: Remove left-over debug prints in own previous commits.
Sorry for the noise.
2023-05-02 16:21:00 +02:00
96dcdbfc51 Vulkan: Correct Aspectbits for Depth Textures
Vulkan spec only wants to have a single aspect bit when a texture
contains both a stencil and a depth part. As for Blender depth
is more used than stencil we standardize to depth aspect.

Pull Request: blender/blender#107542
2023-05-02 16:20:25 +02:00
5095ecc67b Cleanup: Rename LibOverride-related enum flags/tags.
Mainly use a shorter, straight-forward prefix (`LIBOVERRIDE`), and
unify/make these enum names more consistant. No functional changes
expected here.
2023-05-02 16:14:53 +02:00
9ea2170cce LibOverride: Resync: Fix some issues with partial resync.
In some cases, some partial resync roots would be missed during the
partial resync process, leading to incomplete resync of all the needed
data.

This was caused by tagging some liboverrides for resync _after_ they had
already be evaluated as part of parenting hierarchy of other
liboverrides. Fix is simply to split both steps apart, such that all IDs
that need it are tagged to resync first, and then hierarchies are
evaluated to find the required partial resync roots whithin a hierarchy.
2023-05-02 16:14:53 +02:00
ba9ca7afb6 LibOverride: Resync: Delete non-user-edited 'isolated from root' liboverrides.
These should not be needed anymore. Follow-up to previous commit.
2023-05-02 16:14:53 +02:00
5574a1bfc1 LibOverride: Fix/Improve resync behavior in some complex cases.
This commit mainly addresses issues when a part of an override hierarchy
does not match anymore the linked reference data, and gets isolated form
the hierarchy root (there is no parenting chain to the root anymore).

The typical case being an object or sub-collection being moved to
another subcollection in the linked data.

Case identified while working on some Pets production files.

Note that in some cases this isolated chunk of the hierarchy will be
linked back into the appropriate place, in others it should be fully
removed (instead of staying as unused data). The later will be handled
in a another future commit.

This commit mainly detect and use a new tag for such cases, and correct
the checks to take it into account.

It also does a bit of cleanup, and replaces some asserts by `CLOG_ERROR`
reports.
2023-05-02 16:14:53 +02:00
b724015840 LibOverride: Fix wrong assert in some cases in RNA tracks handling.
Due to index-only referencing in insertion of new NLA tracks in
liboverride data, it may happen that the source of an inserted track
cannot be found.

This index-only based handling of NLA tracks in liboverrides is very
weak, in the future this will be solved by ensure uniqueness of their
names, then name-based reference can be used instead, as already done with
modifiers, constraints, etc.
2023-05-02 16:14:53 +02:00
17201752d9 Vulkan: Add FLOAT to SRGB and Depth24 Conversion
This PR adds support to convert host/device data from floats
to GPU_SRGB8_A8 and GPU_DEPTH_COMPONENT24.

Pull Request: blender/blender#107544
2023-05-02 15:57:17 +02:00
13fe6d0170 Vulkan: Silence Compilation Warnings
This PR silences some compilation warnings in the command buffer.

Pull Request: blender/blender#107541
2023-05-02 15:52:53 +02:00
5e3bf37982 Cleanup: Add internal header for View2D files
Code was exposing apparently internal functions to the public header, so
it could reuse it in other View2D files. Worse even, a struct was
defined twice in different source files and they would have to be kept
in sync, just because there is no shared header file.
Such internal header files are useful and don't really cause any harm.
2023-05-02 15:02:06 +02:00
20b19f2b12 Fix: calculating duplicates in kdtree does not work with selection
This fixes a crash where merging vertices by distance leads to a crash since
0652945dbd. The change did not cause
the bug though, it just made the underlying issue visible.

The issue was that `kdtree_order` assumed that the `KDTreeNode.index` didn't
have gaps, i.e. every index in a certain range is used. However, that is not the
case when only a subset of the vertices of a mesh are added to the kdtree.

Pull Request: blender/blender#107535
2023-05-02 14:25:55 +02:00
c04e709c6a Bump blender file format subversion
This change is required for 0001485365. File version bump was included
in PR but it was behind the main branch. In main, version was updated
by 5d0595fded.
2023-05-02 17:37:58 +05:30
3b5aba8cf8 Fix invalid argument to BLI_path_split_dir_file
get_index_dir passed in the wrong size, also remove strange use of
BLI_path_split_dir_file which copied the directory into `file`,
only to overwrite it with the `file` afterwards.
2023-05-02 21:32:51 +10:00
27e4ab80fb BLI_path: disallow passing NULL arguments to BLI_path_split_dir_file
Instead BLI_path_split_dir_part & BLI_path_split_file_part can be used.
2023-05-02 21:32:51 +10:00
1ab72e8459 Cleanup: use BLI_path_* prefix for path splitting functions
Also order string size after each string instead of grouping strings and
their sizes afterwards.
2023-05-02 21:08:13 +10:00
0001485365 Allow renaming F-curve modifier
Modifier name is being displayed as label in panel header which has restricted
the editing of it. This PR will allow to change the name of F-curve modifier
by exposing string property "name"
Included versioning code for modifier name. This will add suffix to the name if
multiple instances of same modifier exists in modifier stack.

Differential Revision: https://archive.blender.org/developer/D17142

Pull Request: blender/blender#104949
2023-05-02 13:07:48 +02:00
90361278d7 Cleanup: use function style casts, remove redundant parenthesis 2023-05-02 20:26:17 +10:00
93b9b79b19 Fix strict compiler warning
Mismatched array bounds in function declaration and definition.

Pull Request: blender/blender#107530
2023-05-02 11:32:45 +02:00
e3f14b99c3 Refactor: Convert ImBuf to C++
Pull Request: blender/blender#107503
2023-05-02 11:32:27 +02:00
a54c399b41 Fix crash doing a stroke in the weight paint
A regression since 2d2f4d9d28: the sculpt session is re-used by the
weight paint, so changes to semantic in one place requires same
changes in another.

Before the change the `original` was intiialized to false (due to the
clear-alloc), but after the change it was the accum with an inverted
meaning which was initialized to false.

Pull Request: blender/blender#107533
2023-05-02 11:02:13 +02:00
cc84d83929 Fix #106853: Tooltip fix of OT_constraints_clear
The existing tooltip of Clear Constraints modifier in object mode
(`object.constraints_clear`) didn't match its functionality. It said it
works only on the active object, but it affects all selected objects.

Hence, the tooltip has been changed from 'Clear all the constraints for
the active object only' to 'Clear all the constraints for the selected
objects'.

Also the tooltip for 'Clear Pose Constraints' in Pose Mode was updated
for consistency with the above update.

Pull Request: blender/blender#106918
2023-05-02 10:23:51 +02:00
4c99043a85 Weight Paint: Fix wrongly used lookup_or_default()
This function is changed by #107059 since my original patch in #106417,
so when merged it caused compilation error. Now fixed.

Pull Request: blender/blender#107529
2023-05-02 10:19:35 +02:00
03377281d2 Cleanup: avoid nullptr casts to access a struct members size 2023-05-02 17:19:49 +10:00
015343033c Cleanup: use FILE_MAX instead of PATH_MAX for sequencer add code
This is clamped by StripElem::name which is a filename component,
so no need to use PATH_MAX which is much larger.
2023-05-02 17:19:48 +10:00
b315a17902 Cleanup: replace strcpy, strcat with BLI_string_join
Avoids buffer overflows & more straightforward.
2023-05-02 17:19:48 +10:00
f154d37335 BLI_path: add a size argument to BLI_path_frame
Resolves potential buffer overflow in
USDVolumeWriter::construct_vdb_file_path which passed in a smaller
fixed size buffer than FILE_MAX.
2023-05-02 17:19:48 +10:00
0428043967 BLI_string: add BLI_strncat, replace use of strcat that could overflow 2023-05-02 17:19:48 +10:00
0a0a29887d Fix #106354: Account for hidden vertices in weight gradient operator
Weight gradient operator didn't respect hidden vertices. Now fixed.

Pull Request: blender/blender#106417
2023-05-02 09:05:26 +02:00
2483c19ad3 BKE_idprop: string size argument consistency, fix off by one errors
The length passed to IDP_NewString included the nil terminator
unlike IDP_AssignString. Callers to IDP_AssignString from MOD_nodes.cc
passed in an invalid size for e.g. There where also callers passing in
the strlen(..) of the value unnecessarily.

Resolve with the following changes:

- Add `*MaxSize()` versions of IDP_AssignString & IDP_NewString which
  take a size argument.

- Remove the size argument from the existing functions as most callers
  don't need to clamp the length of the string, avoid calculating &
  passing in length values when they're unnecessary.

- When clamping the size is needed, both functions now include the nil
  byte in the size since this is the convention for BLI_string and other
  BLI API's dealing with nil terminated strings,
  it avoids having to pass in `sizeof(value) - 1`.
2023-05-02 15:15:40 +10:00
d5d3305280 Cleanup: IMB_metadata_set_field assigned the string twice in some cases 2023-05-02 14:11:40 +10:00
ae76fa2da3 Fix #107525: Crash loading pre 2.5x files with multiple windows open 2023-05-02 13:36:16 +10:00
b6a7b786c6 Cleanup: reduce line wrapping caused by trailing comments 2023-05-02 10:42:24 +10:00
a0db0a5580 Cleanup: move comments wrapped with MultiLine control statements
In some cases comments at the end of control statements were wrapped
onto new lines which made it read as if they applied to the next line
instead of the (now) previous line.

Relocate comments to the previous line or in some cases the end of the
line (before the brace) to avoid confusion.

Note that in quite a few cases these blocks didn't read well
even before MultiLine was used as comments after the brace caused
wrapping across multiple lines in a way that didn't follow
formatting used everywhere else.
2023-05-02 09:54:48 +10:00
6859bb6e67 Cleanup: format (with BraceWrapping::AfterControlStatement "MultiLine") 2023-05-02 09:37:49 +10:00
391f86bc38 clang-format: set BraceWrapping::AfterControlStatement to "MultiLine"
This was the code-style Blender used before switching to clang-format
which did not support this style of brace placement at the time.

Since then support was added, this helps readability as the beginning
of braces isn't as clear in the case of multi-line conditionals.

This implements a proposal from #75956.
2023-05-02 09:37:08 +10:00
ec25c7b341 Cleanup: remove outdated/invalid comment 2023-05-02 09:36:51 +10:00
6a5ab77dcc Cleanup: format 2023-05-02 08:41:10 +10:00
0652945dbd Fix #107306: Merge by distance node is not deterministic
In some cases the node didn't reproduce the same results given the
same input. Based on the test results (just 2 very detailed cubes
and a transformation), it doesn't seem to affect performance that
much. Credit to @MMMM who pointed out this option.

Pull Request: blender/blender#107312
2023-05-01 22:15:19 +02:00
c7f1ad1058 Fix #107474: Proportional Size not saved when canceling the operation
cc623ee7b0 did not consider some implications such as the habit of
users initiating transform operations just to change the size of the
Proportional Edit.

Therefore, partially revert the cc623ee7b0.
2023-05-01 13:58:17 -03:00
5525e5b942 Fix #107480: Crashes in mesh format conversion for old files
There were a few issues, but they mostly came from the fact that some
versioning was done in the "after linking" versioning, which came after
the regular legacy mesh conversion. Also, the `MFace` array wasn't
necessarily part of CustomData for some very old files.

The `BKE_mesh_strip_loose_faces` function was moved because it now
uses the deprecated `me->mface` pointer.
2023-05-01 11:33:42 -04:00
3c74575dac Fix #107062: support opacityThreshold when exporting USD
This PR addresses issue “USD export does not respect opacity threshold for clip alpha blend mode #107062”

This commit extends the USD Preview Surface material support to author the opacityThreshold attribute of materials on export, when the Alpha Clip blend mode is selected.

When authoring alpha cutouts in Blender, one sets the Blend Mode to "Alpha Clip", and the Clip Threshold to some value greater than zero.
When this case is detected on export, we now author the opacityThreshold attribute to match the specified clip threshold.

Note that opacityThreshold is already handled correctly on import, so this change allows the feature to be fully round-tripped.

Co-authored-by: Matt McLin <mmclin@apple.com>
Pull Request: blender/blender#107149
2023-05-01 17:28:23 +02:00
f59fdc40ec Fix: Missing normalization for sampled normals when adding curves
Mistake when splitting up commits for 0a5f0890cc.
2023-05-01 08:41:20 -04:00
314866eb3a Fix #107431: tag node tree topology as changed when changing socket order
Pull Request: blender/blender#107437
2023-05-01 13:22:44 +02:00
3ea060860a UV: Tuning rotating to minimum square during packing
* Perform rotate_inside_square earler in the pipeline. (improved layout)
* #rotate_inside_square with AABB margin if there is only one island.
* Conservative bounds when using xatlas on non-D4 transforms.
2023-05-01 23:18:15 +12:00
d68ed238b9 Cycles: solve compilation errors with OptiX 7.7
* User simpler API names that accept both PTX and OptiX-IR
* New argument for optixProgramGroupGetStackSize, leave to default
* Remove OptixPipelineLinkOptions::debugLevel that does nothing

Pull Request: blender/blender#107450
2023-05-01 12:07:26 +02:00
3f6912ece2 Realtime Compositor: Implement Mask node
This patch implements the Mask node for the realtime compositor. The
evaluation of the mask is not GPU accelerated, but is cached as a form
of temporary implementation until we implement a GPU evaluator for
masks.

One limitation currently is that we do not redraw the viewport while the
mask is getting edited by the user, because always doing that will be
redundant in most situations, and conditioning the redraw requires a lot
of work that should be handled outside of this patch.

This is similar to the Texture node implementation in 151a53110c.

Pull Request: blender/blender#107464
2023-05-01 11:29:06 +02:00
92983967cb Cleanup: Improve readability of Mask node flags
This patch improves the readability of the Mask node flags by using the
same naming conventions as other node flags.
2023-05-01 12:07:57 +03:00
f8d2156dda Fix #104722: Outliner renaming uses wrong item
The property value should be reset for the next operator execution, not
remembered. Also hide it from auto-generated UIs, this is an internal
property nothing meant for the user to edit.

Also see discussion in #105872.
2023-05-01 11:03:39 +02:00
20f54a5698 Asset Browser: Let "Clear Asset" act on entire selection
Users were confused that "Clear Asset" would only act on the clicked on
asset, not the entire selection. They would have to clear them one by
one, which can be quite annoying. The previous commit prepared the asset
clearing operator for this, so all this commit has to do is expose the
selected IDs to context.
2023-05-01 10:47:55 +02:00
f22e2bab72 Assets: Prefer selected IDs over single active ID for asset mark/clear
Shouldn't cause user visible changes.

Usually batch operations are more handy, so prefer editing multiple
items over a single one. That is, act on the whole selection not the
active item. Mark and clear will now respect this when retrieving IDs
from context, however right now there's no case where actually both
selected and the active ID are exposed in context. Because of this there
shouldn't be a user visible change until the following commit.
2023-05-01 10:47:55 +02:00
36e1ebc78d Metal: Resolve runtime issues with texture views
When creating a texture view, Metal may require that the original
GPUTexture state is modified in some way. This may be a result
of deferred creation, or, to cache the texture view against the
source.

As a result, GPUTexture passed into GPU_texture_create_view
cannot be const.

Small fixes have also been made in the Metal texture
implementation to ensure correct function of texture views.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#107167
2023-05-01 09:14:00 +02:00
46316b29dc GHOST/Wayland: remove keyboard modifier mismatch warning suppression
Detecting when to show warnings about GHOST/XKB modifier
mismatches was rather involved, remove the check as it's
unnecessary for Gnome-Shell >= v43.

Older versions of Gnome-Shell will show warnings on window activation
with modifier keys held.
2023-05-01 11:57:45 +10:00
4efacf7e85 GHOST/Wayland: use GHOST modifiers, not XKB without an active windows
Reading modifiers from XKB caused a complications in getModifierKeys(..)
when called on a window that was activated, before the keyboard enter
handler had run - because the keys held by GHOST had not yet been
updated by XKB. This caused a problem which Gnome-shell which runs
the keyboard-enter handler after window activation.

This change would have fixed the Super key being stuck, see: #107314.
Keep the previous fix since in the unlikely case GHOST & XKB get out of
sync, stuck modifier keys should still be prevented.

This change means the warning for GHOST & XKB getting out of sync
can be enabled for Gnome-shell again, as it was previously suppressed
as it happened frequently on window activation.
2023-05-01 11:57:13 +10:00
358ce4f52b Fix more crashes attempting to run operators in unexpected contexts
Add missing NULL checks for:

- OBJECT_OT_transform_to_mouse
- GPENCIL_OT_time_segment_remove
2023-04-30 15:23:43 +10:00
5d59f4ad7b Cleanup: use term "Delete" for sequence strips
Use consistent terminology with the rest of Blender,
the menu items already overrode this with the term "Delete".
2023-04-30 15:10:49 +10:00
44d13c787d Fix various crashes attempting to run operators in unexpected contexts
Use bl_run_operators to detect cases when operators would crash
when run in an expected context for the following operators:

- GIZMOGROUP_OT_gizmo_select
- GIZMOGROUP_OT_gizmo_tweak
- GPENCIL_OT_time_segment_move
- OBJECT_OT_add_named
- OBJECT_OT_data_instance_add
- OBJECT_OT_drop_named_material
- SCULPT_OT_mask_by_color
- SEQUENCER_OT_delete
- SEQUENCER_OT_rename_channel
- SEQUENCER_OT_retiming_handle_move
- SPREADSHEET_OT_change_spreadsheet_data_source
- UI_OT_drop_color

Note that some of these situations users were unlikely to encounter,
however there were cases script authors could run into such as deleting
sequence strips without a region or masking by color without a 3D view.
2023-04-30 15:08:27 +10:00
d302901ce0 Fix bl_run_operators test running without a window context
While technically valid, a context without a window set can't access
the active object or view layer, causing object mode setting to fail,
making the checks not all that useful.

Use Context.temp_override(..) to set the context's window.
2023-04-30 15:08:27 +10:00
91325378cb Fix potential buffer overflow with FileListEntryPreview::filepath 2023-04-30 15:08:27 +10:00
635cccc54e Fix curve-sculpt invoke function accessing the wrong brush
The brush used to check if curve sculpt should run didn't necessarily
match the brush which was used for curve sculpt.
2023-04-30 15:08:27 +10:00
0a7f2486ec Fix apply as shape operator accessing properties that don't exist 2023-04-30 15:08:27 +10:00
951c31e258 Fix use-after-free error in sculpt color filter 2023-04-30 15:08:26 +10:00
03ad5c17e6 Fix crash accessing the image clipboard in background mode 2023-04-30 15:08:26 +10:00
fa5cc84a0a WM: avoid Python exceptions in poll functions 2023-04-30 15:08:26 +10:00
cfe25e6efb Use native path separators for run-time generated paths 2023-04-30 15:08:26 +10:00
1c026befca Cleanup: spelling in comments, remove annotations that aren't validated 2023-04-30 15:08:26 +10:00
5c1c45cd59 UV: Improve packing efficiency by rotating to minimum square
After primary packing is completed, perform a deep earch for any
rotation of the entire layout which improves efficiency even further.

This can sometime provides *optimal* packing results. e.g. When packing
a single island, the layout will now touch all 4 sides of the unit square.
2023-04-30 16:55:39 +12:00
adb63a5102 Gizmo: Add anti aliasing to transform constraints
Transform constraints were being drawn on screen without anti-aliasing,
now fixed to make them look smoother.
See #107038

Adding a comparison of before and after the change

Pull Request: blender/blender#107394
2023-04-29 22:06:39 +02:00
Sebastian Herholz
3298c61d1f Deps: Updating to Open PGL 0.5.0
Pull Request: blender/blender#107343
2023-04-29 12:58:08 +02:00
ca00cb5470 Cleanup: format 2023-04-29 13:50:23 +12:00
d145dfdae0 Fix #107443 movie clip fails to load
Regression with incorrect sizeof argument to BLI_path_sequence_encode.

[0]: 6701d24084
2023-04-29 11:31:16 +10:00
2d2f4d9d28 Cleanup: Rename StrokeCache.original to .accum
Note: the value is inverted, StrokeCache.accum = !StrokeCache.original.
2023-04-28 17:58:26 -07:00
15d2487e26 Sculpt: Fix #105303: improper setting of SculptCache.original
I'm going to rename this in a seperate commit
2023-04-28 17:53:47 -07:00
69d52c5f1c UV: Fix uv packing overflow with fraction margin method
When UV Packing with the `fraction` margin method, if the UVs
overflowed the unit square, the UVs could sometimes overlap.

(island_index was incorrect.)
2023-04-29 10:25:40 +12:00
bf56df3236 UV: Add new packing option, scale_to_fit
When `scale_to_fit` is enabled, the existing behavior is used,
UVs will be scaled to fill the unit square.

If disabled, UVs will not be rescaled. They will be packed to the
bottom-left corner, possibly overflowing the unit square, or not
filling space.
2023-04-29 09:50:33 +12:00
97222519de Fix #106945: IES file parsing failures
There were two issues here preventing the proper display of the IES
files in question.

The primary one was that these lights are actually vertical. Their
profiles actually point upwards from 90deg to 180deg but our parser was
trying hard to adjust it to start at 0deg incorrectly.

Lastly, the files in question ended with the parser in the `eof`
state - they are "missing" the final carriage return that other IES
files tend to have but other viewers don't seem to mind. Change the
`eof` check instead for a better one that will indicate if any parsing
errors occurred along the way.

Pull Request: blender/blender#107320
2023-04-28 23:29:04 +02:00
a20bb83c21 Fix 3D text selection & cursor mismatch when not on curve
Commit 5c184525ed improved text cursor
placement when text is on a curve, but when not on a curve it is now
on the baseline. This corrects for that, placing 25% below baseline.
2023-04-28 14:12:56 -07:00
609010f5c0 Cleanup: format 2023-04-29 08:41:33 +12:00
44103f5529 I18n: improve geometry nodes field tooltips
Node socket tooltips suffered from several issues.

- Some could not be translated because they were not properly
  extracted, so extraction macros were added.

- Some were extracted but included newlines at the end which did not
  get translated, such as `ss << TIP_("Geometry:\n")`, changed to
  `ss << TIP_("Geometry:") << "\n"`.

- Some translations were not functional, such as:
  `TIP_(attributes_num == 1 ? " Named Attribute" : " Named Attributes");`
  because `TIP_()` needs to be around a single string.

- Some extraction macros had no effect and were removed, such as:
  `.description(N_(leading_out_description));`
  This is a no-op macro which can be used only around a string literal.

Pull Request: blender/blender#107257
2023-04-28 21:37:33 +02:00
e33974effb Fix Auto Depth not working
Error in 67203c0ec8

The wrong Auto Depth flag was being read.
2023-04-28 16:38:15 -03:00
96fd14a65f Cleanup: Fix typo in mesh sample function name 2023-04-28 14:45:22 -04:00
bec033e057 Cleanup: Simplify and deduplicate mesh sampling code
It arguably reads easier if simple operations like reading from indices
of an array don't each get their own line. Also the same corner
attribute sampling was repeated in a few places. And add a new
function to sample normals from the corner domain, and use
lower level arguments to the lower level functions (i.e. not just
a mesh pointer, but the necessary data arrays).
2023-04-28 14:45:22 -04:00
f8cc6cc866 Cleanup: Simplify passing empty anonymous attribute set 2023-04-28 14:45:22 -04:00
696b56c1da Cleanup: Add note about adding attributes while iterating 2023-04-28 14:45:22 -04:00
0a5f0890cc Cleanup: Use helper function to sample normals when adding curves 2023-04-28 14:45:22 -04:00
b367a2b5f9 UI: Measure/Ruler Text Position
Small improvements to the placement of text with Ruler tool.

Pull Request: blender/blender#107350
2023-04-28 20:25:20 +02:00
bea6391188 Fix: Wrong logic in recent extrude node fix
A local change that I forgot to add to the commit before pushing.
2023-04-28 14:14:32 -04:00
060216ac31 Cleanup: Implement "make available" for extrude node individual input
Since the faces mode is already the default, this won't change
anything, but it makes sense to have for consistency anyway.
2023-04-28 14:00:10 -04:00
82769653f8 Cleanup: Use short2 for custom normals, simplify access
Use a span instead of a pointer, which allows using `fill_indices`
to set values and using the assign operator in the future.
2023-04-28 14:00:10 -04:00
5ce4447f02 Cleanup: Remove unnecessary vertex normal custom data masks
These are handled lazily now, these masks have no effect.
2023-04-28 14:00:10 -04:00
0f47722d82 Fix: Extrude node propagates all anonymous attributes
Usually anonymous attributes are removed earlier, but otherwise
the extrude node can end up doing extra work.We need to retrieve the
propagation set and remove not-propagated attributes. And also fix
a case where in vertex mode, the offsets array could be freed when
the mesh is resized.
2023-04-28 14:00:10 -04:00
5b69be00a6 Fix Cycles MetalRT not working after recent oneAPI changes
Forgot to initialize the device info.
2023-04-28 19:54:49 +02:00
2fcf34a6bd I18N: Updated UI translations from svn trunk (r6490). 2023-04-28 19:51:22 +02:00
d1219b727c Fix #97530: Overlapping Content Causing Region Scrolling
Selecting filter in NLA/Graph Editor causes scrolling in the region
below it. This PR makes `UI_but_ensure_in_view` not occur if the block
has UI_BLOCK_CLIP_EVENTS.

Pull Request: blender/blender#107404
2023-04-28 19:06:30 +02:00
252b0a023e Cycles: use intrinsics for fast_rint
MSVC can't optimize it out and even keeps an external call to CRT
function rintf: https://godbolt.org/z/Ex9vjf8vj

It does translate to a real speedup on windows on some scenes, here are the ratios I had on my 13900K:
classroom	101.53%
junkshop	100.71%
monster	100.76%
attic	107.98%
bistro	113.00%

Pull Request: blender/blender#107371
2023-04-28 18:49:46 +02:00
5e217fdec1 Deps: Bump version of sse2neon
This brings the following improvements:

- Implementation of _MM_SET_FLUSH_ZERO_MODE and _MM_SET_DENORMALS_ZERO_MODE
- Implementation of _mm_round_ss

Does not seem to be any performance impact with just this upgrade.

Pull Request: blender/blender#107396
2023-04-28 17:36:04 +02:00
7738f93d56 Cycles: Support newer version of sse2neon
Since the version v1.5.0 of sse2neon the functionality for denormals
flushing is implemented in the library. This commit makes it so the
_MM_SET_FLUSH_ZERO_MODE and _MM_SET_DENORMALS_ZERO_MODE are used from
the ss2neon if available.

This solves macro re-definition when a newer sse2neon is used.

The change is implemented in a way that both current and new sse2neon
are supported.
2023-04-28 17:36:02 +02:00
7d38cef6d1 Geometry Nodes: use new BitGroupVector to find attribute propagation sets
A `BitGroupVector` is a compact data structure that allows storing multiple
bits per element, for example 5 bits per vertex. The implementation is
mostly just a wrapper around `BitVector`. There is some additional logic
to make sure that the bit span of every element is bounded (according
to the `is_bounded_span` function). This makes it more efficient to operate
on groups as a whole (e.g. `or` one group into another). In some sense,
this data structure can also be interpreted as a 2D bit array. Functions
like `append` can be added when they become necessary.

The new data structure is used to replace some `MultiValueMap` in
geometry nodes. This simplifies the code.
2023-04-28 16:54:43 +02:00
d6c61ccadc Cleanup: Extract function to make extend node declaration 2023-04-28 10:24:32 -04:00
098e58ea24 Attributes: Allow attribute API to create non-deleteable attributes
This can be useful to allow creating these core attributes with shared
arrays. Otherwise CustomData has to be used directly, which is nice
to avoid. This was done in e45ed69349, but not everywhere.
2023-04-28 10:24:32 -04:00
fee9a3796c Cleanup: Add not equal operator to compute constext hash 2023-04-28 10:24:32 -04:00
ac1827edda BLI: Add utility method to check if CPPType matches multiple types 2023-04-28 10:24:32 -04:00
67700ced54 BLI: Add "take front" and "take back" methods to bit spans
This is consistent with `Span`, and also allows returning a bounded
bit span when taking the front of an existing bounded span, which
can simplify using optimized bit processing.

Pull Request: blender/blender#107441
2023-04-28 16:14:03 +02:00
6beaf1dc7d Fix error in recent navigation refactor
Error in 67203c0ec8

The modal zoom operation was always being activated.
2023-04-28 11:11:13 -03:00
5a1013f6a8 Fix #106289: Copy optimal display edges in mirror, array modifiers
These aren't propagated as attributes since interpolating them with the
generic rules often gives strange results, and they're intended to as
an optimization. Though theoretically it would be nice if this
copying became more generic in the future.
2023-04-28 10:05:57 -04:00
b87ccedd75 BLI: Add bit span operations and bounded bit spans
Most of this patch is by Jacques Lucke, from the simulation branch.

This commit adds generic expression evaluation for bit spans, helping
to generalize the optimizations that avoid processing a single bit
at a time. Operations like "for each 1 index", "or", and "and" are
already implemented in this pull request. Bits in full integers are
processed 64 at a time, then remaining bits are processed all at once.
The operations allow implementing a `copy_from` method for bit spans.

Currently this optimized evaluation is only implemented for simpler
bounded bit spans. Bounded bit spans have constraints on their bit
ranges that make them more efficient to process. Large spans must start
at the beginning of the first int, and small spans must start and end
within the first int.

Knowing these constraints at compile time reduces the number of edge
cases in the operations, but mainly allows skipping alignment between
multiple spans with different offsets.

Pull Request: blender/blender#107408
2023-04-28 15:43:34 +02:00
d74f3895e7 Overlay: do not draw grids with undefined units
The `ED_view3d_grid_steps` function creates steps of units other than
those defined in `unit.c`.

This seems to be used for grid drawing in order to draw a unit after
the miles (in this case it would be something like 10 miles).

But that doesn't seem right as it's an undefined unit.

Therefore, the solution is not to create these different unit values.

The change in the overlay is that the softer grid that used to
correspond to 10 miles now corresponds to mile.

Pull Request: blender/blender#107405
2023-04-28 14:38:38 +02:00
67203c0ec8 3D View: Refactor navigation operators
No functional changes.

Merge the modal callbacks of the `VIEW3D_OT_move`, `VIEW3D_OT_rotate`
and `VIEW3D_OT_zoom` operators into a single simplified
`view3d_navigate_modal_fn` callback.

Deduplicate code for initialization, also the code for finalization and
the code to get the `event_code`.

Improve support for operation switching by the existing (but unused)
modal keymap items `VIEWROT_MODAL_SWITCH_ZOOM`,
`VIEWROT_MODAL_SWITCH_MOVE` and
`VIEWROT_MODAL_SWITCH_ROTATE`.

Pull Request: blender/blender#106279
2023-04-28 14:11:00 +02:00
ff0cf45bc2 Fix potential buffer overflows from invalid string size arguments
- FILENAME_MAX was used when the output was later limited by FILE_MAX.
- Some were passing in incorrect/dummy sizes in a couple of places.
2023-04-28 21:49:05 +10:00
ba978e1b68 Fix potential buffer overflow in internal pointcache logic
Buffer lengths in internal point-cache logic offent didn't match
the actual buffer size.
2023-04-28 21:45:19 +10:00
e462e20e21 Fix buffer overflow in BKE_image_ensure_tile_token use
BKE_image_ensure_tile_token took only the file name component but used
FILE_MAX to limit the input buffer.

Split this function in two, one that takes the full path as this is the
most common usage and another which takes only the filename.
Both now take a string size argument.
2023-04-28 21:40:04 +10:00
6701d24084 BLI_path: add string size arguments to sequence encode/decode functions 2023-04-28 21:33:38 +10:00
bfcc2b1c4c BLI: add utility methods for serialization
This simplifies the code that works with the `BLI_serialize.hh` header.
The various `lookup` methods do a linear search. If there are only a
few elements that can even be faster than building the map first.
In the future it might be nice to transparently build and cache the
map internally if necessary.
2023-04-28 13:30:26 +02:00
5c184525ed Fix 3D text selection & cursor mismatch with text-on-curve enabled
The cursor & selection were shifted down in local (object) space,
ignoring character rotation.
2023-04-28 21:15:38 +10:00
6586c4c73f Fix negative index in text cursor drawing
Recent changes to cursor drawing read an index of -1 when there was no
text.
2023-04-28 21:14:07 +10:00
6e0870fc5d Merge branch 'main' into cycles-light-linking 2023-04-28 12:15:20 +02:00
c40b92b039 Fix strict warnings in external code
Happens with a default build on Debian stable with Clang-13 compiler.
2023-04-28 12:14:14 +02:00
b4d914b676 BLI: support weak users and version in implicit sharing info
The main goal of these changes is to support checking if some data has
been changed over time. This is used by the WIP simulation nodes during
baking to detect which attributes have to be stored in every frame because
they have changed.

By using a combination of a weak user count and a version counter, it is
possible to detect that an attribute (or any data controlled by implicit
sharing) has not been changed with O(1) memory and time. It's still
possible that the data has been changed multiple times and is the same
in the end and beginning of course. That wouldn't be detected using this
mechanism.

The `ImplicitSharingInfo` struct has a new weak user count. A weak
reference is one that does not keep the referenced data alive, but makes sure
that the `ImplicitSharingInfo` itself is not deleted. If some piece of
data has one strong and multiple weak users, it is still mutable. If the
strong user count goes down to zero, the referenced data is freed.
Remaining weak users can check for this condition using `is_expired`.

This is a bit similar to `std::weak_ptr` but there is an important difference:
a weak user can not become a strong user while one can create a `shared_ptr`
from a `weak_ptr`. This restriction is necessary, because some code might
be changing the referenced data assuming that it is the only owner. If
another thread suddenly adds a new owner, the data would be shared again
and the first thread would not have been allowed to modify the data in
the first place.

There is also a new integer version counter in `ImplicitSharingInfo`.
It is incremented whenever some code wants to modify the referenced data.
Obviously, this can only be done when the data is not shared because then
it would be immutable. By comparing an old and new version number of the
same sharing info, one can check if the data has been modified. One has
to keep a weak reference to the sharing info together with the old version
number to ensure that the new sharing info is still the same as the old one.
Without this, it can happen that the sharing info was freed and a new
one was allocated at the same pointer address. Using a strong reference
for this purpose does not work, because then the data would never be
modified because it's shared.
2023-04-28 12:05:00 +02:00
19aaf980d5 Cleanup: format 2023-04-28 11:46:25 +02:00
86a14faf69 Fix CUDA/OptiX compilation error in Cycles
Apparently, it does not seem to support hex notation for
floating point values.

Pull Request: blender/blender#107424
2023-04-28 10:51:03 +02:00
2bb4abdc27 Cleanup: assign variables & use 'match' to avoid redundant lookups
Also use more verbose names for RNA subtype enum variables.
2023-04-28 16:56:34 +10:00
5fa8f7746c Realtime Compositor: Prioritize Viewer output node
This patch changes the priority for choosing the active output to
prioritize viewer nodes as opposed to composite nodes. This is done to
better work with the workflow of using the Connect To Viewer operator
and better match the expected behavior from users.
2023-04-28 08:47:44 +02:00
7b8ba7f101 Fix #107314: OS key stuck when switching windows with GNOME/Wayland
Tapping the OS key to switch windows could cause the OS key to stick.

On window deactivation the OS key was considered held, activating the
window later read the XKB modifier state before the keyboard_enter &
keyboard_modifier callbacks had run.

When they ran later, the mis-match between XKB and GHOST was not taken
into account, causing the OS key to stick.
2023-04-28 16:06:37 +10:00
6e2721da30 Core: Add sub-types for float-type custom properties
This adds the ability for users to assign sub-types to `Float` type custom properties (e.g., distance, angle, time, power etc.)

Pull Request: blender/blender#106700
2023-04-28 05:44:50 +02:00
1777f40c27 Cleanup: Remove global mesh threading size macro
The grain size depends on the algorithm, it doesn't make sense to use
the same value for multiple areas just because they relate to `Mesh`.
The comment mentions OpenMP which isn't used anymore.

Also remove an unused forward declaration.
2023-04-27 22:46:07 -04:00
a1e472615f BKE_unit: assert index access is in range 2023-04-28 12:23:29 +10:00
0c27c6f876 Cleanup: spelling in comments
Also remove redundant comment.
2023-04-28 12:23:29 +10:00
3ad82ec5a4 Refactor: path normalize now collapses multiple '..' directories at once
- Avoid a separate memmove call for each `..`.
- Avoid ambiguous path stepping, where separator literals
  needed to be checked to avoid fence post errors.
- Correct & update the doc-string.
2023-04-28 12:23:29 +10:00
d36af92e5f USD: Release ImBuf objects during export
ImBuf objects need to be released after they are acquired.

Would cause a memory leak otherwise.

Pull Request: blender/blender#107361
2023-04-27 22:35:28 +02:00
38ad653d77 Cleanup: prefer nullptr inside extract_mesh.hh
Replaced NULL with nullptr [std::nullptr_t].

Pull Request: blender/blender#107413
2023-04-27 22:07:43 +02:00
1d2eab9ab3 VFont: Corrections to Cursor When on Curve
Corrections to transformation and placement of the text cursor when the
text is being deformed by a curve.

Pull Request: blender/blender#107307
2023-04-27 22:07:03 +02:00
59b6e8900f Fix #106965: HSV/HSL conversion differ from CPU compositor
The CPU compositor sanitizes the colors after HSV/HSL conversion by
clamping negative values to zero. The realtime compositor did no such
sanitization. This patch fixes that by introducing similar sanitization.
2023-04-27 19:21:55 +02:00
a32dbb892f Realtime Compositor: Optimize image textures
This patch optimizes the evaluation of image textures by using and
prefetching a unified texture pool for the evaluation.
2023-04-27 17:09:27 +02:00
9292e094e7 Mesh: Reduce memory usage calculating custom normals
Reduces the size of the struct storing normal space from 72 to 64.
2023-04-27 10:31:34 -04:00
18f4fd6b85 Attributes: Add function to rename attribute
This is implemented by removing the attribute and adding it again with
a different name. In the expected case though, implicit sharing is used
to avoid copying the array.

For now this doesn't rename UV sublayers or replace active/default color
attribute names. It's not clear where that should happen, but for now
things are clearer if those stay at a higher level.
2023-04-27 10:31:34 -04:00
3c0b15b7eb Fix #107274: Crash zooming out with imperial unit-system 2023-04-27 23:45:27 +10:00
d086249f4d Fix: Compile error in debug build in normals code 2023-04-27 09:39:59 -04:00
3c43632651 Mesh: Allocate custom normal spaces in array
Avoid many small allocations and just allocate all the structs in one
array, which is 4 times faster. In a test with an armature modifier and
custom normals, corner normal calculation went from 2.7 to 2.3 ms.
2023-04-27 08:50:41 -04:00
f8eebd3b25 Cleanup: Use simpler C++ types in mesh corner normals code
The various stacks are just filled and then emptied. We also expect
them to be fairly small. A vector can handle these cases fairly well.
Also store indices rather than pointers. I didn't notice any performance
changes from these changes.
2023-04-27 08:50:41 -04:00
a6baf7beae BLI: Allow different integer types when filling span indices 2023-04-27 08:50:41 -04:00
9fcfba4aae Mesh: Reduce memory corner normals memory usage and simplify threading
Instead of storing a 24 byte struct for every face corner we must do
calculations for, just gather the face corner index in the first single
threaded loop. And don't fill them in chunks and use the task pool API.
Instead just fill vectors and use standard "parallel_for" threading.
The check that avoided threading for tiny meshes becomes redundant this
way too, which simplifies the code more. Overall this removes over
100 lines of code.

On a Ryzen 7950x, face corner ("split"/"loop") normal calculation in a
small armature modifier setup with custom normals went from 4.1 ms to
2.8 ms. Calculation for a 12 million face mesh generated with curve to
mesh with end caps went from 776 ms to 568 ms.

Similar commits:
- 9e9ebcdd72
- 9338ab1d62
2023-04-27 08:50:41 -04:00
61849d3b5b Revert "Fix: Knife tool does not interpolate vertex customdata in
interior cuts"

This reverts commit 129f79debe.

That commit changed the behavior of how booleans handled vertex weights
as well and made the CubeMaskFirst test modifier test fail.

Not entirely clear to me what the desired behavior would be (current
situation is "wrong" in certain situations as well I think), but until
this is further discussed with the #modeling-module , I think reverting
is the better choice.
2023-04-27 11:57:07 +02:00
107536f359 Refactor: Deduplicate code in graph_slider_ops.c
In most of the operators the code that loops through the FCurve segments and draws the status header were pretty much identical.

To combat that, create abstract helper functions that can be used.

They are not useful in all cases, e.g. the blend to default operator needs a bit of special code.

Pull Request: blender/blender#107170
2023-04-27 11:17:59 +02:00
129f79debe Fix: Knife tool does not interpolate vertex customdata in interior cuts
Using the Knife tool, making cuts that split an edge exactly interpolate
fine for vertex customdata (weights or attributes on the vertex domain)
due to `BM_edge_split` taking care of data layers from the edge and
vertex domain (also mdisps -- which unfortunately dont seem to work
well, but that is for another patch...).

However, making cuts _inside_ a face though dont interpolate at all
(giving default values on new vertices).

With this patch, also interpolate vertex customdata in
`BM_face_split_edgenet`.

Pull Request: blender/blender#107367
2023-04-27 09:24:04 +02:00
c104b135c9 Cleanup: use term "space" in blend file read/write callbacks
Otherwise some function names are the same as data-block IO,
which is inconvenient for inserting break-points.
2023-04-27 16:06:27 +10:00
fa2dbceadd Realtime Compositor: Implement Corner Pin node
This patch implements the Corner Pin node for the realtime compositor.
This is different from the existing compositor in that single value
inputs produce single value outputs, instead of assuming the size of the
render.

Pull Request: blender/blender#107363
2023-04-27 07:18:19 +02:00
e0a3212176 Curves: Avoid retrieving arrays many times
Avoids a string lookup for positions at every curve index
in the sculpt add brush when interpolation is used.
2023-04-26 23:50:57 -04:00
4daa7ae649 BLI: Add methods to generic spans to retrieve size in bytes 2023-04-26 23:50:57 -04:00
4b96af6cdd Cleanup: Remove timer in node, improve comment 2023-04-26 23:50:57 -04:00
be53da087d Fix #107390: Image transformation in VSE is very slow
71d7c919c0 introduced usage of `threading::parallel_for()`, but
`WITH_TBB` was not defined for imbuf module.
2023-04-27 04:35:34 +02:00
5c6f254a66 UV: Simplify storage and logic for UV Packing 2023-04-27 11:52:40 +12:00
249f677a1f Cleanup: format 2023-04-27 10:36:43 +12:00
032e69527d Cleanup: Fix spelling in subdiv function name 2023-04-26 12:42:48 -04:00
d8f4387ac9 Geometry Nodes: Index of Nearest: Use grain size based on tree sizes
Use a grain size for the final tree creation/balancing/lookup that
depends on the average size of each tree. When the trees are larger,
fewer trees are processed on each thread and vice versa. I didn't notice
a difference when there are hundreds of thousands of groups, but
when there are few (i.e. around the number of cores), I noticed a 6x
performance improvement, from over 1 second to around 0.2 s.

Note that generally the performance is better with many small groups,
because the creation and balancing of trees is single threaded.
2023-04-26 12:34:48 -04:00
4346314351 Geometry Nodes: Index of Nearest: Use span for non-single ids
If the Group ID input isn't a single value, it's likely to be a span,
so making sure that's true should generally be free, at least in
most cases. This brought a test with 1 million points from 37
to 34 ms, roughtly an 8% improvement.
2023-04-26 12:26:38 -04:00
45cecb101c Nodes: Support adding multiple nodes from search menu
Needed for the simulation zone addition to the add menu search.
Link-drag search isn't supported yet, but a similar change should be
possible there.

Now the search item exposed through the public nodes namespace returns
several items directly, and the "after add function" is just handled as
a sub-case of that for convenience.
2023-04-26 11:40:54 -04:00
f6931a9ead CMake: only generate & install the man-page when it may be outdated
Check if the man-page is missing or older than files that generate it
before re-running the generator.

Previously the install target would re-run the man-page generator
every time, even when no other changes to the build were detected.
2023-04-26 23:01:02 +10:00
bdaf8e3715 Cleanup: Avoid storing redundant information in corner normals task data
Though alignment means the size of the struct doesn't change
if the data is split up a bit more it could give further improvement.
2023-04-26 08:50:31 -04:00
803f03ae32 Cleanup: Remove redundant namespaces in mesh normals code
Also use int instead of uint.
2023-04-26 08:46:11 -04:00
93f99859bc Cleanup: Standardize mesh corner normals code
Use consistent variable names: for example "vert" instead of "mv" and
"edge" instead of "me", etc. Also use helper functions like "edge other
vert" to make the code easier to read.
2023-04-26 08:46:11 -04:00
b54398c16c Geometry Nodes: Use implicit sharing in store/capture attribute nodes
Some fields reference attributes directly. When the referenced attribute
has the requested type and domain, the captured/stored attribute can
share its array, avoiding the cost of duplication and reducing memory
usage, at least temporarily until either attribute is modified.

This only works when the attribute doesn't need validation and when
the selection input isn't used, since those potentially need to change
values in the arrays.

I saw this save 200MB and 11 ms of copying for a simple grid with
16 million points (creating the grid takes about 60ms).

Pull Request: blender/blender#107357
2023-04-26 14:38:56 +02:00
5ad5edea40 Merge branch 'main' into cycles-light-linking 2023-04-26 11:40:10 +02:00
02b5c04b2b Fix intersection distance offset in Cycles
The intersection distance offset in Cycles could have returned
a denormal floating point value for the input values of 0 (and
for the denormal input value).

This could lead to a situation when ray is unable to be advanced
when it hits an edge between two triangles: the intersection will
keep bouncing between two adjacent triangles. This is because the
ray->tmin is compared inclusively, and 0 >= <denormal zero>.

The solution is to return the smallest possible normalized floating
point value from the intersection_t_offset if the input is zero
or a denormal value (which is covered by the same t == 0 check).

This fix is hard to measure on the user level. The old code did
not cause any infinite traversal loop because of the way how the
integration is organized (some kernels offset ray.P, others check
for the number of bounces). It is possible that this fixes some
corner cases of noise: i.e. if some shadow rays falsefully were
considered occluded due to reached maximum number of bounces.

The actual problematic case was discovered during working on a
prototype which had an in-lined intersection loop with the ray
tmin offset.

Pull Request: blender/blender#107364
2023-04-26 11:36:37 +02:00
029ce2b656 Cleanup: remove redundant casts 2023-04-26 19:03:21 +10:00
0a3a6cd154 Cleanup: use ptrdiff_t in assertion to prevent overflow 2023-04-26 19:02:24 +10:00
bf58af2d65 Cleanup: fix build errors/warnings 2023-04-26 10:55:45 +02:00
8ebabac003 Cleanup: store less data per node that is already stored together 2023-04-26 10:42:46 +02:00
c1d4b6f339 Core: Add ASAN support to BLI_mempool
This patch adds address sanitizer support to memory pools.

when ASAN is enabled the following happens:
* 32 byte red zones are inserted between pool elements.
* The BLI_mempool struct itself is marked as a red zone.
* Access to the pool goes through a thread mutex (except when compiling makesdna).

This is very useful for finding bugs in code that uses BMesh.

Pull Request: #104668
2023-04-26 01:32:41 -07:00
536144983b Fix: group node inputs always requested unnecessarily
This triggered an assert during evaluation, because the group inputs
were first requested and later the set unused, which is not allowed.

The issue was likely introduced in 258678916f.
2023-04-26 10:10:22 +02:00
5a5c0e879c Cleanup: correct exception message & remove unused iterator variable 2023-04-26 17:51:50 +10:00
89afdd6f24 Vulkan: Texture Unpacking
This PR adds support for `GPU_unpack_row_length_set` to the vulkan
backend.

Texture unpacking is used when uploading a part of a texture from
host memory to device memory.

Pull Request: blender/blender#107360
2023-04-26 09:23:58 +02:00
6a49041be3 Fix string lookups asserting or failing with unsupported collections
A recent change from [0] added an assert when a string lookup was
performed on a collection item with no name-property,
but silently failed with release builds.

This isn't correct in a couple of ways.
The assert makes it seem like the RNA API needs to be updated when
it's in fact valid to have collection items without a name-property.
It also misleads script authors to silently fail since it implies a
key that exists would return a result.

Raise a TypeError exception when string lookups are attempted on
collections that don't support them.

This change also applies to get() & __contains__().

[0]: 5bb3a3f157
2023-04-26 16:16:19 +10:00
c81e6d3ff3 Keymap: cancel 3D viewport operations using Escape
While RMB was canceling, the check for Escape was overridden by the
modal keymap, causing Escape to confirm.

Resolve by:

- Removing Escape binding from the modal keymap, rely on hard coded
  check as Escape to cancel is an assumption made in many places.
- Move RMB hard-coded check into the modal keymap since it's non-default
  keymaps may use mouse buttons differently.
2023-04-26 16:14:07 +10:00
20f7dc46a7 Cleanup: remove redundant modal keymap items for 3D view operations
These operators already check for release events matching the event
that launched them.

Also remove hard-coded model keys (rely on the default key-map).
2023-04-26 16:14:07 +10:00
db1af0e325 Cleanup: spelling in comments 2023-04-26 16:14:07 +10:00
ca98185f84 Cleanup: quiet unused function warning WITH_OPENSUBDIV=OFF 2023-04-26 16:14:07 +10:00
7691d19ad2 Vulkan: Index Buffer
This PR adds the binding of index buffers.

Pull Request: blender/blender#107358
2023-04-26 08:09:28 +02:00
f0e768c198 Vulkan: Conversions between Blender and Vulkan Enums
Add conversions to convert from Blender enums to their Vulkan
counterpart.

Pull Request: blender/blender#107336
2023-04-26 07:56:35 +02:00
5727851d65 Cleanup: Declare field context variables const 2023-04-25 22:23:38 -04:00
91020ccde1 Cleanup: Simplify UV Packing storage of temporary layout 2023-04-26 11:13:38 +12:00
838b258b22 Cleanup: format 2023-04-26 10:37:56 +12:00
ae57d86d42 Fix #107095: Spikes during multires reshape propagation
Linear subdivision or interpolating from a lower multires level gave
spikes at some vertices. Caused by incorrect corner edge indexing.
This was simple to solve by building the old MLoop array on demand
and reverting parts of 16fbadde36.
2023-04-25 15:59:05 -04:00
700d168a5c Volumes: Generate proper fog volume in Mesh to Volume node
Currently `Mesh to Volume` creates a volume using
`openvdb::tools::meshToVolume` which is then filled with the specified
density and the class set to Fog Volume. This is wrong because
`meshToVolume` creates a signed distance field by default that needs
to be converted to a Fog Volume with `openvdb::tools::sdfToFogVolume`
to get a proper Fog volume.

Here is the description of what that function does (from OpenVDB):

"The active and negative-valued interior half of the narrow band
becomes a linear ramp from 0 to 1; the inactive interior becomes
active with a constant value of 1; and the exterior, including the
background and the active exterior half of the narrow band, becomes
inactive with a constant value of 0. The interior, though active,
remains sparse."

This means with this commit old files will not look the same.
There is no way to version this as the options for external band width
and not filling the volume is removed (they don't make any sense for a
proper fog volume).

Pull Request: blender/blender#107279
2023-04-25 21:56:14 +02:00
5d0595fded Suport relative path option per-asset library
This option is true by default, but it can be changed for
any asset library (that may be using Link as import method).

This also fix "Reset to Default Value" for the Import Method
since this was originally not using the defaults.

Pull Request: blender/blender#107345
2023-04-25 20:56:57 +02:00
Sahar A. Kashi
557a245dd5 Cycles: add HIP RT device, for AMD hardware ray tracing on Windows
HIP RT enables AMD hardware ray tracing on RDNA2 and above, and falls back to a
to shader implementation for older graphics cards. It offers an average 25%
sample rendering rate improvement in Cycles benchmarks, on a W6800 card.

The ray tracing feature functions are accessed through HIP RT SDK, available on
GPUOpen. HIP RT traversal functionality is pre-compiled in bitcode format and
shipped with the SDK.

This is not yet enabled as there are issues to be resolved, but landing the
code now makes testing and further changes easier.

Known limitations:
* Not working yet with current public AMD drivers.
* Visual artifact in motion blur.
* One of the buffers allocated for traversal has a static size. Allocating it
  dynamically would reduce memory usage.
* This is for Windows only currently, no Linux support.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>

Ref #105538
2023-04-25 20:19:43 +02:00
Sahar A. Kashi
7026d9ac43 HIP: hipew and build system updates for new APIs, including HIP-RT
* Add HIP-RT API functions and library loading
* Add more HIP API types and functions
* Find HIP linker executable in CMake module
* New CMake module to find HIP-RT SDK

Co-authored-by: Brecht Van Lommel <brecht@blender.org>

Ref #105538
2023-04-25 20:19:43 +02:00
63dfbdc187 Fix mistake in Cycles float4 pow
Not currently used anywhere, so should be no user visible change.
2023-04-25 20:19:43 +02:00
ca52f0fae3 Cleanup: make format 2023-04-25 20:19:43 +02:00
19899a8dee Cleanup: remove removed variable from CMake config 2023-04-25 20:19:11 +02:00
5a6db19da4 Cleanup: make format. 2023-04-25 12:48:36 -04:00
239af1705d Fix #102594: USD Import: mask multiple prim paths.
These changes enhance the prim_path_mask USD import option to allow masking on multiple paths.

Changed the prim_path_mask import property to a string of arbitrary size.

Multiple paths may be specified in a list delimited by commas or semicolons.

Reviewed by Bastien and Matt McLin.

Pull Request: blender/blender#106974
2023-04-25 16:32:52 +02:00
cbcf9058cd Fix (unreported) potential missing deletion of some linked liboverrides during resync.
The code checking whether old liboverrides which have been resynced into
new ones should be deleted was still assuming it was only working on
local liboverrides.

However, since recursive resync was implemented, this is not true
anymore, it can also handle resynced linked liboverrides.

This could have lead to missing deletion of some old linked liboverrides
after resyncing them.
2023-04-25 15:51:03 +02:00
5f67b25c28 LibOverride: Do not attempt to resync a hierarchy when the root goes missing.
This addresses an issue here at the Blender studio, where a root
collection of a set was removed by mistake from the set library .blend file.

Since all the other linked data (sub collections, actual objects etc.)
of the set were still available, the liboverride resync code went crazy
trying to resync all these scattered pieces of a set, finding new valid
root IDs for the hierarchies, and so on.

So from now on, do not attempt to resync anything that is part of a
liboverride hierarchy which root ID linked reference has gone missing.
2023-04-25 15:51:03 +02:00
b666d2d1bd Fix further (unreported) issues in object collection cache cleanup code.
`BKE_collection_object_cache_free` can be called from some points in
code (e.g. during ID remapping) where proper parenting relationships
between collections cannot be ensured.

Would be good to check if recursive cache cleanup is actually needed
from these points, it would almost certainly be better and safer to
instead tag parent collections as dirty too, but this will be for
another time.

For now, just add a NULL-check on the parent collection pointer.
2023-04-25 15:51:03 +02:00
250d35928e Fix (unreported) broken code in BKE_collection_object_cache_free.
This call should be recursive, only freeing cache of immediate parents
of the collection is not enough, the whole parenting chain needs to be
processed.
2023-04-25 15:51:03 +02:00
94a93b9290 Fix snap package failing to launch on some systems after core20 update 2023-04-25 15:50:26 +02:00
1fad165c1a Cleanup: Avoid unnecessary & misleading Outliner context function call
The function used to be needed for recursing the tree, as the name
indicated. But it has recently been ported to the new tree iterators
so the recursion isn't necessary anymore.
2023-04-25 15:49:25 +02:00
d5cd51f089 Vulkan: Add streaming buffers.
Add support for streaming buffers.

Pull Request: blender/blender#107335
2023-04-25 15:48:52 +02:00
a813b65c7d Vulkan: Command Buffer.
Changes to the internal workings of the VKCommandBuffer:
- Use state engine to track correct usage.
- Switch between render pass/no render pass automatically.

Eventually the command buffer should be rewritten to use custom command
encoding to improve performance.

Pull Request: blender/blender#107337
2023-04-25 15:32:41 +02:00
468a152fe1 Vulkan: Uniform Buffer
Add implementation to clear and bind uniform buffers.

Pull Request: blender/blender#107334
2023-04-25 15:30:55 +02:00
fd7f21af8c Vulkan: Shader Interface Attribute Extraction.
Add extraction of attributes from shader interface.

Pull Request: blender/blender#107333
2023-04-25 15:09:25 +02:00
70504a35dd Cleanup: Type conversions in node.cc
Make sure that function style, reinterpret_cast, and static_cast are
used for all type conversions, without of casting to void *. Some other
related minor changes: add temporal variables, lost space, asserts for
case to avoid type conversions by using `->id` way.

Pull Request: blender/blender#107097
2023-04-25 14:38:24 +02:00
d742223197 Fix #107273: Group input is not listed in the node search
Group input/output nodes are not listed in search list
after cc925b9282. Similar to 5b2b114a2a
add these nodes in search list with the help of `gather_add_node_search_ops`.

Reviewed by: deadpin, HooglyBoogly

Pull Request: blender/blender#107323
2023-04-25 14:28:16 +02:00
1c3d67d4cc Realtime Compositor: Split cache into containers
This patch refactors the static cache manager to be split into multiple
smaller Cached Resources Containers. This is a non factional change, and
was done to simplify future implementations of cached resources as they
become more elaborate.
2023-04-25 13:20:00 +02:00
a57584e40d BLI: extract MapItem type to simplify iterating over map items 2023-04-25 12:15:02 +02:00
5fde2b34ba GPU: Ensure Absolute Ratio During SDF-Widget Drawing
In the GPU_SHADER_2D_WIDGET_BASE the deriviates were assumed to be
positive. This is not always the case. In Vulkan this leads to
incorrect rendering of the widgets due to incorrect SDF values.

This change will ensure that the shader make the ratio variable
absolute.

Pull Request: blender/blender#107327
2023-04-25 12:08:43 +02:00
e6a9db0c88 Merge branch 'main' into cycles-light-linking 2023-04-25 11:31:01 +02:00
eda88466ee Fix #107186: Curve assets don't generate preview images
e7bea3fb6e disabled this.

I do believe excluding `OB_CURVES_LEGACY` is wrong though. While it
_might_ not have real geometry, it certainly _can_ have real geometry,
so now legacy curves are enabled again in `OB_TYPE_IS_GEOMETRY`.

A more elaborate check for real geo on legacy curves could be set up in
a following commit.

Since `OB_TYPE_IS_GEOMETRY` is also used in depsgraph driver handling,
will seek additional review from more devs.

Pull Request: blender/blender#107214
2023-04-25 11:25:21 +02:00
6124f4dbb4 ID RNA: Add accessor to the 'IS_MISSING" status tag of IDs.
This tag is set for linked data that cannot be found anymore on
fileread, and for which an empty placeholder ID is generated instead.
2023-04-25 10:47:56 +02:00
2f0b166dce Fix #107294 : Node Editor "Frame All/Selected" ignore Smooth View
Caused by 3a1cf838ca.

Smooth view transitions only work when an operator is **invoked** (wont
work from **exec**, see `WM_operator_smooth_viewtx_get`).

Now 3a1cf838ca changed the `operator_context` for some other operators
in the menu to 'EXEC_REGION_WIN' (for good reason). But setting
`operator_context` on a `uiLayout` will set context on the **root**
layout (not the actual sublayout alone), so all following operators
"inherited" the [changed] context.

Now make sure following operators get properly invoked again by giving
the right context.

Pull Request: blender/blender#107296
2023-04-25 10:29:55 +02:00
74d68238be Light linking: Dedicated link menu entries for include/exclude
Allows from the Link Menu (Ctrl-L) to link receivers and blockers
with the desired link state.

Pull Request: blender/blender#107220
2023-04-25 10:15:51 +02:00
6de3e35119 Light linking: Simplify toggling receiver/blocker inclusion
It seems more clear to store the inclusion flag as an enumeration
internally, but on the interface it is more convenient to use a
single click to toggle the state.

With a bit of code the best of both worlds is achieved!

Pull Request: blender/blender#107222
2023-04-25 09:12:52 +02:00
151a53110c Realtime Compositor: Implement Texture node
This patch implements the Texture node for the realtime compositor. The
evaluation of the texture is not GPU accelerated, but is cached as a
form of temporary implementation since the Texture node is deprecated
and will be removed in the future. Furthermore, texture node evaluation
is not supported for now.

This patch also introduces the concept of an ID static cache, which
uses the DrawDataList mechanism to invalidate the cache as needed,
consequently, a DrawDataList was added to the Tex ID structure.

An improvement that should be implemented outside of this patch is to
implement support for proxy textures in results to avoid redundant
copies in the execute method of the texture node. This should be
straightforward bit will be implemented in a separate patch.

Pull Request: blender/blender#107291
2023-04-25 09:04:35 +02:00
2cbf536605 Cleanup: Use consistent enum type in header
Fixes a warning on GCC 13 about `uint` being used in the declaration and
the proper enum type `eDupli_ID_Flags` being used in the definition for
`BKE_id_copy_for_duplicate`.
2023-04-24 21:45:12 -04:00
30f8e688c3 Fix: Wrong crease accessed for multires reshape
Also fix one more case of incorrect conversions from char to float.
2023-04-24 21:42:12 -04:00
9f78530d80 Multires: Use cached loose edge information
Avoids iterating over poly and corner edge index arrays.
2023-04-24 21:39:50 -04:00
3507431c30 Subdiv: Optimize coarse position extraction with cache
The coarse positions given to the evaluator are skipped if there are
vertices not attached to faces. Use the cache from 8e967cfeaf
to skip that topology query, or even to tell if there are no such vertices,
so we can skip a copy completely. I observed a 12x improvement for this
step, from 7.5 ms to 0.6 ms on a 1 million vertex grid.
2023-04-24 17:01:12 -04:00
c4e4184c50 Sculpt: Fix #107092: ss->filter_cache not being null'd on free 2023-04-24 12:20:03 -07:00
ae7c71ef09 Fix Python error when trying to call the Search Menu with no object
When pressing F3 to bring up the Search Menu, an error appeared
because the MoveModifierToNodes operator's poll method did not
consider the context where no object was selected.

Pull Request: blender/blender#107310
2023-04-24 20:47:20 +02:00
a649ff7b98 Fix broken 'replace object in collection' code.
Code was not handling properly the case where the new object that should
replace the old one in given collection is already in the collection. In
such case, remove the old object from the collection, but do not attempt
to add the new one again.
2023-04-24 19:35:11 +02:00
4f08eeae9c Nodes: Make spacings unitless in String to Curves node
The String to Curves node allows selecting various metrics for the
characters. Size is the absolute height between two lines, and is
correctly marked as a distance. Character, Word and Line Spacing, on
the other hand, do not represent any distance, but are proportional to
the base size and should not have distance units.

This commit simply removes the properties' `PROP_DISTANCE` subtype.

Pull Request: blender/blender#106660
2023-04-24 18:31:25 +02:00
aeb15e4e76 Cleanup: fix compiler warning
Warning C4551: function call missing argument list.

Pull Request: blender/blender#107237
2023-04-24 17:37:31 +02:00
4504a13bd9 Fix #107262: snap source of type Active Element sometimes fails
Remove micro optimization that seeks to reuse the active center 
alculation.

This operation is lightweight and reusing its result only adds an
unnecessary dependency.
2023-04-24 11:41:40 -03:00
32c7d41b76 Make missing libdecor only fail in strict build mode
libdecor is not a hard requirement, so only fail the configure phase if
the building in strict mode.

This makes it behave like most other dependencies in Blender.

Pull Request: blender/blender#107304
2023-04-24 16:21:33 +02:00
9a671c401d Fix several issues in recent changes to ID swap and lib_query.
Fix #107297: Crash on undoing "Use Nodes" step.
Fix (unreported) crash on undoing certain type of data deletion (like
collections) in some specific cases.

Main serious issues were in new handling of embedded IDs in ID swap code
(#107297), and in general in lib_query remapping code from
`BKE_lib_id_swap_full` in readfile code in undo case which could access
other IDs data, when it is not guaranteed to be valid at this point in
code.

Added an option flag to lib_query code to forbid access to the original
ID pointers in such cases.
2023-04-24 15:49:59 +02:00
d9621add55 Vulkan: Initialize Device Capabilities.
Load the device capabilities into the context. This makes sure
that GPU framework already takes care of the capabilities.

Pull Request: blender/blender#107302
2023-04-24 15:35:27 +02:00
b94a0ec8db WindowManager: Context Creation
Currently window manager always tried to create an OpenGL context.
This is incorrect and will fail when using Vulkan. Somehow this
doesn't fail for Metal.

This PR creates a context based on the current selected backend.

Pull Request: blender/blender#107301
2023-04-24 15:33:35 +02:00
26147b29a7 Vulkan: Construct a Vulkan 1.2 Context.
Apparently we always constructed a Vulkan 1.0 Context, although we
are targetting Vulkan 1.2. This also lead to incorrect expectations
when using the Vulkan Memory allocator.

Pull Request: blender/blender#107300
2023-04-24 15:32:17 +02:00
d0467a277a Cycles: MetalRT: Don't apply local object transform if it is baked
This patch fixes the failing shader/bevel unit test when MetalRT is enabled. The ray was being transformed into local object space even when the SD_OBJECT_TRANSFORM_APPLIED flag was set.

Pull Request: blender/blender#107292
2023-04-24 15:20:21 +02:00
b68b3e7b8f Cleanup: Add missing domain priority for mask nodes
This patch adds missing domain priority specifications for the Box and
Ellipse mask. This is a non-functional change because the inputs
happened to be properly ordered anyways.
2023-04-24 14:05:50 +02:00
85ed2e8c36 Animation: add function for deduplicating FCurve keys
Introduce `BKE_fcurve_deduplicate_keys()` to merge keys that are on the
same time, or within the time comparison threshold (1/100th of a frame).

When merging two consecutive keys, the last one 'wins' and determines
the final key *value*. The first key's *time* is retained, to ensure the
reference point for the next comparisons is stable. The only exception
here is when there is a key exactly on an integer frame number, in which
case that one is preferred.

The function is exposed in RNA as `fcurve.keyframe_points.deduplicate()`

This commit also introduces a new function `BKE_fcurve_bezt_shrink(fcu,
new_totvert);` that can reallocate the `bezt` array to ensure removed
keys no longer take up memory.

The RNA function `fcurve.update()` currently performs two steps, which
are now exposed to RNA as well, as `keyframe_points.sort()` and
`keyframe_points.handles_recalc()`. This is so that Python code can
sort, deduplicate, and then recalculate the handles only once (calling
`update` + `deduplicate` would do the latter twice).

In Blender 4.0 the deduplication will also be part of `fcurve.update()`,
see #107126.

Reviewed on blender/blender#107089
2023-04-24 12:07:28 +02:00
92ab89c6d9 Anim: add simple unit test for stability of sort_time_fcurve()
The `sort_time_fcurve()` function should be stable, i.e. not change the
relative order of keys that have the same X-coordinate. This is now
enforced by a unit test.

I want to build a new function that can deduplicate the keyframes after
sorting, for which it's important that the 'last key wins' to get reliable
results.
2023-04-24 12:07:28 +02:00
017d83790c Refactor: move keyframe-adding function from RNA to editors/animation
The RNA function `fcurve.keyframe_points.add(N)` was purely implemented
in the RNA wrapper. It now sits in `ED_keyframes_add(fcu, N)` where it
can be used by other C code as well.

It's in the editors code, as regular keyframe insertion is there as
well.

No functional changes.
2023-04-24 12:07:28 +02:00
e4afa06dab Fix #107261: bpy.types.Text (region_as_string/region_from_string) crash
These two didnt check if keywords were passed in, crashed on running
`PyDict_GET_SIZE` on NULL (in case of no keywords).

Oversight in ee292a1d66.

Now just check if keywords are actually passed in.

Pull Request: blender/blender#107285
2023-04-24 11:48:22 +02:00
ca32fb604e Geometry Nodes: support outputting field without computing full node
Many nodes output anonymous attributes (e.g. the top selection in the
Cylinder node). The actual data is only contained in the geometry output
though. The field output just contains a reference to this data (essentially
just the generated name of an attribute). This data can be output even
without computing the geometry itself.

As of right now, this only simplifies the code a bit, but does not have a
bigger impact, because to use the anonymous attribute, you always need
the geometry anyway. However, with the upcoming simulation nodes,
it's possible to create the anonymous attribute in one frame and to access
it in another frame. In the other frame we only need the anonymous
attribute reference and don't have to create the actual geometry again.
Skipping creating the actual attribute on the geometry can have a
significant performance benefit.
2023-04-24 11:42:05 +02:00
4259105d68 Clean up: Fix spacing on Cycles debug message "Use MNEE"
This changes the Cycles Debug message for "Use MNEE" from:
"Use MNEEFalse"
to
"Use MNEE False"

Pull Request: blender/blender#107269
2023-04-24 08:49:14 +02:00
10fc2d6d96 Cleanup: remove basepath argument from BLI_path_normalize{_dir}
Keep these operations separate to simplify path handling logic & docs.
Many callers passed NULL and there were times paths were passed in which
didn't make any sense (where the paths had already been made absolute).
2023-04-24 12:23:04 +10:00
20eb682967 Cleanup: rename main_name to main_filepath
It wasn't clear this is a file-path, previous name was left over from
when the blend files path was called `name`.
2023-04-24 12:11:40 +10:00
6ab225074d Cleanup: minor changes to BLI_path_normalize
- Don't attempt to skip the WIN32 drive component on relative paths
  it's possible this would have unexpected behavior but paths like
  are already unlikely to work as expected, e.g. "//C:\".
- Remove early returns for empty paths as there is no need for special
  handling.
- Add path normalize NOP tests
2023-04-24 11:58:47 +10:00
2166fd2685 Geometry Nodes: Delete value moving for drag and drop group inputs
Initially, this function was for node data. At Simon's suggestion, it
was extended to a node group inputs as well. However, this overlaps with
another function. It has been missing for a while, but has recently been
fixed by blender/blender#107179. Now this functionality is redundant.

Pull Request: blender/blender#107255
2023-04-24 03:54:59 +02:00
8b1c54cd50 Cleanup: remove redundant path functions
- BLI_path_normalize ran BLI_path_abs on a path that had already
  been made absolute.
- BLI_path_slash_ensure was called after BLI_path_normalize_dir
  which already ensures a slash.
2023-04-24 11:25:56 +10:00
993d24c174 Cleanup: Miscellaneous improvements to subdivision geometry nodes
- Implement mesh creation in GeometrySet agnostic way, with less context
- Remove useless comments
- Use a field to clamp crease values instead of clamping when copying
- Small variable name tweaks
- Use `BKE_subdiv_new_from_mesh` instead of "update"
- Remove crease layers before writing, avoiding potential copy
2023-04-23 15:27:20 -04:00
e7eb8fd908 Cleanup: Remove unused includes, correct comments 2023-04-23 15:27:20 -04:00
54072154c5 Subdiv: Tag result mesh with no loose edges/verts
Avoid possible calculations of loose edges later on if the coarse mesh
doesn't have loose edges or vertices. We expect these counts to be
cached already since `BKE_subdiv_converter_init_for_mesh` calls
`verts_no_face()` and `loose_edges()` already.

Related commits:
- 63689e4756
- 8e967cfeaf
2023-04-23 15:27:20 -04:00
473bb8a8b0 Cleanup: Remove else after return in subdiv modifier code 2023-04-23 15:27:20 -04:00
5bed959e81 Cleanup: Avoid magic number for bits per integer 2023-04-23 15:27:20 -04:00
aa327e4ea5 Cleanup: Simplify subdiv check for crease usage
Now that crease arrays are separate arrays, we can just
not set the array pointers when crease usage is turned off.
2023-04-23 15:27:20 -04:00
2f581a779c Cleanup: Use utility constructor to create field operations 2023-04-23 15:27:20 -04:00
18291930ce Cleanup: Avoid redundant custom data lookups
We pass false for the "selected" argument, so the boolean layer values
aren't used anyway.
2023-04-23 15:27:20 -04:00
c5702ee87d Fix: Wrong conversion for crease type in multires reshape
a8a454287a missed a few places when
moving edge creases out of the MEdge struct.
2023-04-23 15:27:20 -04:00
3389cc8083 Fix: Incorrect mesh cache tagging causing excess calculation
8e967cfeaf only meant to tag the "verts no face" cache
calculated eagerly if both loose edges and loose verts were already
calculated. Instead it caused the calculation of one of the caches.
2023-04-23 15:27:20 -04:00
2ed6f738da BLI_path: support normalizing relative paths
Follow Python's os.path.normpath's handing on relative paths in more
situations.

- Leading './' is always stripped.
- Relative paths such as `//./a` & `///a` normalize to `//a`.
- Support for trailing `/..` on the end of paths.
- Avoid empty paths for relative paths that would otherwise
  resolve to an empty string, e.g:  `a/b/c/../../..` resolves to `.`.
2023-04-23 22:22:08 +10:00
1e5f2698af Cleanup: minor improvements to BLI_path_normalize
- Calculate spans of redundant `//` & `/./` before calling `memmove`.
- Loop backwards when removing path elements for greater efficiency.
- When removing `/../` components, avoid continuously searching from
  the start of the path and instead search from the last found '/../'.
2023-04-23 14:35:09 +10:00
651f9404a1 Cleanup: rename path_util 'Clean' tests to 'Normalize'
The function was renamed from `clean` but the tests weren't.
2023-04-23 14:30:52 +10:00
ac251cbe25 BLI_path: de-duplicate WIN32 logic for BLI_path_normalize
The only WIN32 specific behavior the drive or UNC prefix is skipped
(except for it's slash), allowing WIN32 & Unix paths to share the same
code-path.

Note that this changes behavior for WIN32 when there are too many parent
directories, where ".." that move before the root directory are removed
instead of being left in the path. e.g:
`C:\a\..\..\b` resolved to `C:\..\b` whereas now the result is `C:\b`.
This matches Python's `os.path.normpath`.
2023-04-23 14:30:51 +10:00
a9f02cd8d8 Geometry Nodes: add map from bsocket index to lf socket index
The socket indices in `bNode` and their corresponding `lf::Node`
don't match exactly, because `lf::Node` does not contain the
unavailable sockets. A simple mapping from `bNodeSocket` index
to `lf::Socket` index is required for future work. For now it
only removes the need for various tempory vectors.
2023-04-22 16:14:45 +02:00
1e81e27557 Cleanup: use hash value that fits into int to fix compile error 2023-04-22 15:28:26 +02:00
8523e361e8 BLI: use decay_t to determine type to hash
Goal is to fix a compile error on macos.
2023-04-22 15:01:56 +02:00
8e967cfeaf Mesh: Cache loose vertices
Similar to the cache of loose edges added in 1ea169d90e,
cache the number of loose vertices and which are loose in a bit map.
This can save significant time when drawing large meshes in the
viewport, because recalculations can be avoided when the data doesn't
change, and because many geometry nodes set the loose geometry
caches eagerly when the meshes contain no loose elements.

There are two types of loose vertices:
1. Vertices not used by any edges or faces
   `Mesh.loose_verts()`
2. Vertices not used by any faces (may be used by loose edges)
   `Mesh.verts_no_face()`

Because both are used by Blender in various places, because the cost
is only a bit per vertex (or constant at best) and for design consistency,
we cache both types of loose elements. The bit maps will only be
allocated when they're actually used, but they are already accessed
in a few important places:
- Attribute domain interpolation
- Subdivision surface modifier
- Viewport drawing

Just skipping viewport drawing calculation after certain geometry
nodes setups can have a large impact. Here is the time taken by
viewport loose geometry extraction before and after the change:
- 4 million vertex grid node: 28 ms to 0 ms
- Large molecular nodes setup (curve to mesh node): 104 ms to 0 ms
- Realize instances with 1 million cubes: 131 ms to 0 ms

Pull Request: blender/blender#105567
2023-04-22 13:46:11 +02:00
8fbf0a79fc Geometry Nodes: replace more maps with array
This is the same as 8b6777edc2 but for node groups instead
of built-in nodes.
2023-04-22 13:36:58 +02:00
15f9e42c4f Geometry Nodes: new Index of Nearest node
The node outputs the index of the closest element to itself. See #102387
for the original design.

This is different from the Sample Nearest node in two important ways:
* It does not have a geometry input, instead the geometry is taken from the
  field evaluation context.
* The node can exclude the "current" element from the search.
* The group id input can be used to build subsets of elements that only
  consider each other as neighbors and ignore elements with other ids.

Pull Request: blender/blender#104619
2023-04-22 13:11:51 +02:00
8b6777edc2 Geometry Nodes: replace multiple maps with single array
The goal here is to avoid creating to many `Map` which are fairly
large compared to simple arrays. Also, access in arrays is more
efficient.
2023-04-22 13:01:28 +02:00
0e82510ea2 Sculpt: Fix #107068: Crash in multires unsubdivide
A BMesh customdata offset was being pulled from
the base mesh's customdata.
2023-04-21 18:08:42 -07:00
21b51e7b88 Cleanup: Use function ref instead of pointer for transform gizmo
Avoid the need to cast to and from `void *` and use
lambda capture to make things a bit more automatic.

Pull Request: blender/blender#107225
2023-04-21 21:41:35 +02:00
c547ff1ebd Fix VSE thumbnails are displayed from incorrect scene
Add scene to rendering context, so it can be used for cache hashing.
2023-04-21 20:33:52 +02:00
968ecf6f8b Fix #106993: Slowness with Orbiting around select + Mesh Symmetry
The issue happens because the algorithm used to calculate the center of
the selection first needs to create a TransData array. In this array,
the code calculates the "mirrored" elements which can be quite slow in
dense meshes.

The solution is replace this slow algorithm used for calculating the pivot
point with the fast algorithm used to calculate the position of transform
gizmos.

Pull Request: blender/blender#107203
2023-04-21 20:07:05 +02:00
7bf56e5c75 Fix failing lite build
Caused by b21695a507.
2023-04-21 19:29:16 +02:00
271ddc303d Fix Build Warning
Removing unused variable in font_cursor_text_index_from_event
2023-04-21 10:27:24 -07:00
68f8253c71 VFONT: Text Selection Operator
An operator to allow interactive text selection for 3D Text Objects.
This is from the code of Yash Dabhade (yashdabhade) for GSoC 2022
with corrections and simplifications. Also includes double-click for
word selection.

Pull Request: blender/blender#106915
2023-04-21 19:08:44 +02:00
29a4903eb8 Metal: Resolve high memory pressure on EEVEE render
When EEVEE is rendering multiple samples via
eevee_draw_scene, the command submission and in-flight
memory pressure would grow until all samples completed,
due to lack of intermediate flushing of GPU work and memory.

This patch adds a command flush and memory clear for this case
which occurs with high TAA sample counts during saving, similar
to the process in EEVEE_render_draw.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#107221
2023-04-21 18:24:30 +02:00
35a8341d7b UI: Make it possible to add shortcuts to UI operators.
Function `WM_keymap_guess_opname()` skipped `UI_OT` operator types. In
some cases this is detremental to workflow, see #105371.

To exclude operators from getting keyboard shortcut it was suggested by
Campbell to use flag `OPTYPE_INTERNAL` or make new one.

Pull Request: blender/blender#105383
2023-04-21 17:09:41 +02:00
b21695a507 VSE: Add sound strip retiming support
This patch contains changes needed for retiming sound strips.

`BKE_sound_set_scene_sound_pitch()` is replaced by
`BKE_sound_set_scene_sound_pitch_constant_range()` which uses new
Audaspace interface to set pitch in bulk.
This is done in `SEQ_retiming_sound_animation_data_set()` where retimed
sections are created for each strip. When strip is inside of meta
strip(s), the retimed sections of meta and actual strip are split where
they intersect and pitch is multiplied where they overlap. Each section
will have pitch value that is provided to audaspace.

Waveform overlay now represents retimed audio accurately.

Ref: #100337

Pull Request: blender/blender#105072
2023-04-21 16:53:27 +02:00
e7ac5c4164 Merge branch 'main' into cycles-light-linking 2023-04-21 15:37:51 +02:00
b44dace9d8 Build: remove smatch, sparse & splint checking scripts
These checkers were all C-only making them increasingly less useful.
2023-04-21 23:32:55 +10:00
5e76622f47 Cleanup: remove redundant code 2023-04-21 23:27:21 +10:00
bc338aac74 Cleanup: Avoid switch fallthrough, avoid copying bit span
Duplicating a few function calls makes this section easier to follow.
2023-04-21 08:43:18 -04:00
0dd16758f0 Core: libquery: change Collection's parent pointer to master collection to 'not owned'. 2023-04-21 14:24:54 +02:00
3ee21d1098 Cleanup: rename anonymous attribute id pointer type 2023-04-21 14:14:27 +02:00
88f6d584ca Fix: wrong field inferencing in Sample Curve node
Whether the outputs are fields only depends on whether at least one of the
last three inputs is a field. It does not matter whether the `Value` input is
a field.

Pull Request: blender/blender#106007
2023-04-21 13:27:09 +02:00
e6ec1e4baf Vulkan: Attach debug utils to GPU_debug_group.
Also removes some unneeded CPP keywords.

Pull Request: blender/blender#107217
2023-04-21 12:49:36 +02:00
09a2b5c70f Docs: note that renaming data-blocks sorted them which impacts iteration
Address issue raised in #107027.
2023-04-21 20:36:29 +10:00
3650b36141 Metal: TF more optimal for hair refinement
Patch prefers usage of Transform Feedback for hair refinement
as opposed to compute, as vertex work can be pipelined with
existing rendering work which is in-flight.

This approach is ~20% faster depending on the scene. Note that
the current implementation only uses TF, as storage buffer support
is disabled. Though once storage buffer support is added, we should
still use the TF path.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#107166
2023-04-21 12:35:21 +02:00
bebb17a973 Vulkan: Provide Debug Utilities
This PR uses the VK_EXT_debug_utils extension, but it's only for labeling, so it doesn't rely on the VK_LAYER_KHRONOS_validation functionality.

The functions that do these things are loaded into the runtime as vulkan extensions.

Declare the function pointers in a struct and make them members of vk_context.

Pull Request: blender/blender#106098
2023-04-21 12:32:40 +02:00
fc288ec856 Fix: missing variable initialization 2023-04-21 11:44:56 +02:00
99f5e60b86 RNA: ignore some large arrays in override code
This speeds up saving `070_0100.anim.blend` from the Heist project
from ~3s to ~300ms by adding PROPOVERRIDE_IGNORE in a few
places. It's not completely obvious to me when `PROPOVERRIDE_IGNORE`
should be used and when it shouldn't. Given that the same is done for
meshes already, it seems correct.

Pull Request: blender/blender#107196
2023-04-21 10:15:51 +02:00
680a54c7d0 EEVEE Next: Ensure correct texture usage for views
Add texture usage flags for textures which are used as texture views
or require texture views for backing implementation.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#107163
2023-04-21 10:06:55 +02:00
25138fd6e0 EEVEE Next: GLSL Metal shader type compatibility
Apply compilation fixes for Metal compatibility.
This includes explicit type casts, packed data types
where vec3 alignment is inconsistent, constructor replacement
with factory function.

The Metal shader generator also needs knowledge of when bound
resources are fundamental data types, so
SHADOWS_TILE_DATA_PACKED must be described as uint in
ShaderCreateInfo.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#107178
2023-04-21 09:55:37 +02:00
4134682ec2 Fix #107156: UV Cylinder/Sphere Projection fails after other operators
Caused by 6b8cdd5979.

Above commit introduced element tagging for boundary calculations but
only cleared them properly on all faces if the new `Preserve Seams`
option was chosen. We cannot be sure about the state of element tags
from prior operators though, so correct the culprit check to also only
be in effect if the new `Preserve Seams` option was chosen.

Pull Request: blender/blender#107161
2023-04-21 08:28:03 +02:00
c18351f670 Metal: Increase concurrent shader compilation threads
Leverage new API call in Metal to increase the number of threads
dedicated to concurrent shader compilation. First step to improve
parallel compilation times when multiple engines are active.

Would also enable an increase in worker threads for shader
compilation jobs within the DRWManager.

Note that this is only available in the latest
version of macOS Ventura (13.3).

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#106625
2023-04-21 07:52:17 +02:00
fdf920bf5d Metal: Add textureGrad support
Fixes compilation errors in viewport compositor.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#106805
2023-04-21 07:45:30 +02:00
19dbe049db Fix #106469: unstable tessellation with quad-flipping detection
The result of detecting if a quad should flip the default 0-2 split
when tessellated only used a pre-calculated normal when available,
since the method of detecting the flip was different, the check for a
concave face could change depending on the existence of polygon-normals.

In practice this meant cycles render preview could use a different
tessellation than the GPU display.

While [0] exposed the bug, it's an inherent problem with having 2
methods of detecting concave quads.

Remove is_quad_flip_v3_first_third_fast_with_normal(..) and always
use is_quad_flip_v3_first_third_fast(..), because having to calculate
the normal inline has significant overhead.

Note that "bow-tie" quads may now render with a subdivision in a
different direction although they must be very distorted with both
triangles along the 0-2 split pointing away from each other.

Thanks to @HooglyBoogly for investigating the issue.

[0]: 16fbadde36.
2023-04-21 15:02:47 +10:00
5721b34e53 Cleanup: add win32 suffix to BLI_path_is_abs
Naming made it seem this might be the opposite of BLI_path_is_rel,
when it checks for WIN32 specific path prefixes.
2023-04-21 09:46:06 +10:00
417b62522d Cleanup: code-comments in path_util.c
- Remove duplicate doc-string.
- Use full sentences.
- Use back-ticks for path literals
  (to avoid confusion with doxy-slash commands).
2023-04-21 09:34:30 +10:00
fc749d9d25 Cleanup: replace binary '&' with '&&' check
As the intention is to check both statements are true, avoid bitwise
operations on boolean results.
2023-04-21 09:13:09 +10:00
54ce0ac922 Cleanup: use const variables when reading X11 events 2023-04-21 09:12:31 +10:00
62806012ed Cleanup: resolve uninitialized members in GHOST Window & SystemX11
While this didn't cause bugs, initialize members to avoid problems
in the future.

GHOST::SystemX11
- m_keyboard_vector
- m_keycode_last_repeat_key

GHOST::Window
- m_cursorGrabInitPos
- m_userData
2023-04-21 09:06:25 +10:00
ae24fe56a3 Cleanup: quiet shadowed variable warning 2023-04-21 08:42:10 +10:00
04faf12bd8 Cleanup: use BLI_listbase_is_single to avoid unnecessary counting 2023-04-21 08:35:09 +10:00
8e69b41bdf Cleanup: use const for implicit sharing info
Generally, one does not know if the sharing info is currently shared
and should therefore be const. Better keep it const almost all the
time and only remove the constness when absolutely necessary
and the code has checked that it is valid.
2023-04-20 23:32:33 +02:00
491f098edf Cleanup: Fix custom data memcpy call null argument
The data was only null if the size was also zero, but it's simple
to avoid the ASAN warning anyway.
2023-04-20 17:31:29 -04:00
f6ec11741c Fix #106208: data-block socket defaults not used for node group
The main challenge is to avoid dangling pointers. Currently, the lifetime of socket
declarations is somewhat unbounded (at least we didn't restrict it explicitly yet).
Therefore, storing non-owning pointers in it tricky. For ID pointers one could
potentially use the foreach-id iterator to update pointers in declarations as well,
but that's a bit out of scope and might not be the right solution anyway, since it's
not obvious that all node declarations are reachable from IDs stored in `bmain`.

The solution now is to use a callback that retrieves the right ID pointer when it
is used. The important thing is that the callback does not capture any potentially
dangling pointer either.

Pull Request: blender/blender#107179
2023-04-20 22:27:45 +02:00
4babb7c02e Cycles: oneAPI: Fix volume intersection for Embree GPU execution 2023-04-20 21:20:33 +02:00
0d9fa73b42 Cycles: oneAPI: Fix motion blur rendering for Embree GPU execution
CPU non-unified shared memory was used for shared geometry buffers.
For the Embree GPU case, we now create new geometry buffers on GPU instead.
2023-04-20 21:20:33 +02:00
7e92fb92ec Cycles: oneAPI: Fix kernels preloading in case of incompatible AoT binaries
When running oneAPI with AoT binaries, on hardware that's not compatible with
these, recompilation could have been missing from the kernels loading phase and
happen during execution instead.

These changes fixes it, any kernel compilation will now happen during the
kernels loading phase.
2023-04-20 21:20:33 +02:00
13d30b0481 Cleanup: fix various warnings on Windows
Ensure windows.h is included before some other headers to avoid
redefining macros.

Pull Request: blender/blender#107189
2023-04-20 20:46:13 +02:00
c732d901a7 Fix : Iteration for BMLayerCollection was broken
It was broken in two ways:
- bpy_bmlayercollection_iter passed PY_SSIZE_T_MIN, while
PY_SSIZE_T_MAX was needed.
- bpy_bmlayercollection_subscript_slice() contained an
off-by-one error.

Pull Request: blender/blender#107165
2023-04-20 20:28:25 +02:00
f04a7a07e3 macOS: Add open files to system recent files
Completes the TODO in GHOST_SystemPathsCocoa::addToSystemRecentFiles
Also renames the filename parameter to the more appropriate filepath.

The recently opened/saved file will now also show up in:
- Blender Dock icon > Right click.
- Three finger swipe down in Open Blender i.e., App Expose

Based on a earlier contribution by @jenkm.

Pull Request: blender/blender#107174
2023-04-20 23:53:08 +05:30
82ca3d3604 Fix #107185: Edit mode or existing attribute break rest position
After e45ed69349 we need to remove the existing attribute
when adding the rest position before evaluating modifiers. Also, adding
the rest position attribute was completely skipped in edit mode.

Pull Request: blender/blender#107190
2023-04-20 20:18:02 +02:00
2f4a8ecf18 Fix: Spreadsheet missing other geometry types for edit mode mesh objects
We need to add to the spreadsheet's display geometry set
rather than completely replacing it with just the mesh.
2023-04-20 13:06:01 -04:00
b2c822065c Fix #106977: Crash when OpenEXR IO fails
The crash can occur in the following situations:

- Attempt to open a corrupted EXR file
- Attempt to save an EXR file under a non-existing directory.

The root cause is not really clear: for some reason the OpenEXE API on
the Blender side can not catch OpenEXE exceptions by a constant
reference to a std::exception, although it can by a constant reference
to an Iex::BaseExc.

This does not seem to be an issue with the OpenEXR library itself as
the idiff tool from our SVN folder catches the exceptions correctly.
It is also not caused by the symbols_apple.map as erasing it does not
make the problem go away.

It could still be some compiler/visibility flag which we were unable
to nail down yet.

The proposed solution is to add catch-all cases, mimicking the OIIO
tools. This solves the problem with the downside is that there are
no friendly error messages in the terminal. Those messages could be
brought as part of the workaround by additionally catching the
Iex::BaseExc exception. But probably nobody relies on those error
prints anyway, so added complexity in the code is likely does not
worth it.

Pull Request: blender/blender#107184
2023-04-20 18:40:07 +02:00
5c4b0c98d3 Animation: Add in Parent space alignment option to the Transform Orientation gizmo
Animation: Adds a new "Parent Space" Orientation option for the Transformation Gizmo.

---
For child targets (objects, bones, etc) being able to transform in parent space is a desired feature (especially when it comes to rigging / animation).

For objects:
* with a parent, the gizmo orients to it's parents orientation
* without a parent, the gizmo orients to Global space

For Armatures:
* Child bone shows parent's space regardless if "Local Location" is set for parent bone
* For root bone **without** "Local Location" set, use the armature objects space.
* For root bone **with** "Local Location" set, use local bone space.

---

No new transformation orientation code needs to be written, we can achieve the desired results be using the existing `transform_orientations_create_from_axis`, `ED_getTransformOrientationMatrix`, and `unit_m3` methods. To do this, we check to see if the bone has a parent, if so, we use the bones pose matrix (`pose_mat`). This is done similarly for objects using the parent's object matrix (`object_to_world`).

Pull Request: blender/blender#104724
2023-04-20 17:40:19 +02:00
0e23aef6b6 Fix build error when not using unity build 2023-04-20 15:46:15 +02:00
475f9a3e23 Cycles: Break up geometry.cpp and scene.cpp file into smaller pieces
Scene.cpp  and Geometry.cpp are large file it can be broken up into smaller easier to handle files. This change has been broken out from #105403 to make understanding the changes easier.

geometry.cpp is broken up into:
1. geometry.cpp
2. geometry_attributes.cpp
3. geometry_bvh.cpp
4. geometry_mesh.cpp

scene.h & scene.cpp is broken into:
1. scene.h
2. scene.cpp
3. devicescene.h
4. devicescene.cpp

Pull Request: blender/blender#107079
2023-04-20 12:26:02 +02:00
100f37af49 Fix #100053: Incorrect saving asset catalogs after renaming parent item
When a parent item was renamed, the `TreeView` was doing everything as
expected, however `AssetCatalogService::update_catalog_path` is supposed
to also update the catalog paths of all sub-catalogs [which it does --
but it does not tag sub-catalogs as having unsaved changes, resulting in
wrong saving of catalogs afterwards, meaning the parent item was saved
with the old name and a new item with the new name was created].

Now also tag sub-catalogs for having unsaved changes.

This should also go into 3.3 LTS

Pull Request: blender/blender#107121
2023-04-20 11:21:27 +02:00
7ce10ebbbf Cycles: oneAPI: Remove excess quotes in a capabilities output 2023-04-20 11:09:16 +02:00
770b193253 Cleanup: use function style casts & nullptr, spelling in comments 2023-04-20 18:28:50 +10:00
0fa68d1a01 Cleanup: format 2023-04-20 18:28:50 +10:00
6d35e1c238 Fix missing include causing build error & invalid NULL check 2023-04-20 18:28:50 +10:00
fe7815e117 Fix #106771: Selection offset in timeline when NLA track is offset
The selection (box select, click select...) had an offset when selecting keys in the timeline.
That was because the function to get the NLA mapping ignored the timeline.

Pull Request: blender/blender#106904
2023-04-20 10:26:26 +02:00
60ced5283a Animation: make properties from motion path library overrideable
The following properties were not library overrideable, but now are
* Line Thickness
* Color
* Custom Color Checkbox

Pull Request: blender/blender#106959
2023-04-20 10:08:39 +02:00
4054d76749 Fix: Normalization with baked curves and preview range
Currently when a baked curve is in the Graph Editor and normalization is enabled, it doesn't work.
It even throws a warning.

This patch adds the missing logic to normalize baked FCurves within a preview range.

Pull Request: blender/blender#106890
2023-04-20 10:07:49 +02:00
88b125e75d Fix regression tests failure on the latest Xcode
When using Xcode version 14.3 on Apple Silicon hardware a number of
regression tests fails. This change fixes this problem.

The root cause comes to the floating point contraction. It was already
disabled for GCC on Linux, but not for Clang on neither of Linux or
macOS.

Also corrected the comment about Clang default, as it as set to on
somewhere in 2021.

Pull Request: blender/blender#107136
2023-04-20 08:56:55 +02:00
b69f8de5b5 Fix #105450: Resolve box selection issue in Metal
Occlusion query buffers not being cleared to zero resulted in
erroneoues selection in certain situations.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#107135
2023-04-20 08:47:56 +02:00
dda4c0721c EEVEE-Next: Resolve compilation errors in Metal
Shader source requires explicit conversions and shader address
space qualifers in certain places in order to compile for Metal.

We also require constructors for a number of default struct types.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#106219
2023-04-20 08:03:31 +02:00
397a14deff GPencil: Several Weight Paint additions
This patch adds several tools and options to the weight paint mode of Grease Pencil.

* Blur tool: smooths out vertex weights, by calculating a gaussian blur of adjacent vertices.
* Average tool: painting the average weight from all weights under the brush.
* Smear tool: smudges weights by grabbing the weights under the brush and 'dragging' them.

* With the + and - icons in the toolbar, the user can easily switch between adding and subtracting weight while drawing weights.
* With shortcut `D` you can toggle between these two.

* The auto-normalize options ensures that all bone-deforming vertex groups add up to 1.0 while weight painting.
* With `Ctrl-F` a radial control for weight is invoked (in addition to the radial controls for brush size and strength).
* With `Ctrl-RMB` the user can sample the weight. This sets the brush Weight from the weight under the cursor.

* When painting weights in vertex groups for bones, the user can quickly switch to another vertex group by clicking on a bone with `Ctrl-LMB`.
For this to work, follow these steps:
* Select the armature and switch to Pose Mode.
* Select your Grease Pencil object and switch immediately to Weight Paint Mode.
* Select a bone in the armature with `Ctrl-LMB`. The corresponding vertex group is automatically activated.

Pull Request: blender/blender#106663
2023-04-20 07:55:24 +02:00
3d6117994c Realtime Compositor: Implement ID Mask node
This patch implements the ID Mask node for the realtime compositor.

The node can be implemented as a GPU shader operation when the
anti-aliasing option is disabled, which is something we should do when
the evaluator allows nodes be executed as both standard and GPU shader
operations.

Pull Request: blender/blender#106593
2023-04-20 07:20:58 +02:00
335d32153e Cleanup: remove dead code, reduce variable scope 2023-04-20 13:57:31 +10:00
62cc09f267 Cleanup: match argument names between functions & declarations 2023-04-20 13:52:58 +10:00
92f79e002e Cleanup: format 2023-04-20 13:35:35 +10:00
3f0d2cf9e1 Add scripts dir to the make format paths for Python
`make format` uses autopep8 to format Python, using a list of paths
specified in `tools/utils_maintenance/autopep8_format_paths.py`. The
scripts folder used to be a submodule inside release, but it is now at
the root of the blender repo.

This commit adds `scripts` to the list of paths to format.

Ref !107143
2023-04-20 05:30:34 +02:00
716b9cff23 Fix: Search in node editors missing items
Mistake in d6abd2ce72.
2023-04-19 23:19:45 -04:00
5ca7e1301f Cleanup: Remove redundant custom data initialization
The comment didn't really make sense, since the removed code did the
same thing as the CustomData function anyway, and that's already done
in `mesh_init_data`.
2023-04-19 22:45:48 -04:00
a32fb96311 Cleanup: Use more specific arguments to calc edges function 2023-04-19 22:45:48 -04:00
3e41b98295 Cleanup: Use utility to create mesh in metaball tessellation
Avoid the need to add each data array manually.
2023-04-19 22:45:48 -04:00
b633b460b8 Cleanup: STL Import: Use utility to copy corner verts data 2023-04-19 22:45:48 -04:00
639ec2e5a9 BLI_path: add BLI_path_extension_or_end
Some callers that access the extension operated on the end of the path
even when there was no extension. Using this avoids having to assign
the end of the string using a separate check.
2023-04-20 12:32:25 +10:00
b778e09492 Cleanup: use memmove instead of a string copy for BLI_path_suffix 2023-04-20 11:58:30 +10:00
7884de02f3 Tests: add BLI_path_extension replace/ensure tests for overflow handling 2023-04-20 11:58:29 +10:00
95296dc3aa Cleanup: remove "Path" prefix from path_utils tests 2023-04-20 11:58:27 +10:00
9be0304b67 Cleanup: order expected value last in path_util tests 2023-04-20 11:58:25 +10:00
b6e527febb Tests: add more path extension tests 2023-04-20 11:58:23 +10:00
373cfa731f Cleanup: use EXPECT_STREQ instead of EXPECT_EQ_ARRAY
While both work, the output of strings being different is more useful.
2023-04-20 11:58:22 +10:00
7cc7cd0e80 Cleanup: use a define for all style flags
This ensures new styles only need to be added in one place.
2023-04-20 11:58:20 +10:00
5294758830 Fix buffer overflow in BLI_path_frame_strip with long extensions
The file extension was copied into a buffer without checking it's size.
While large extensions aren't typical, some callers used small fixed
size buffers so an unusually named file could crash.
2023-04-20 11:47:22 +10:00
80edd10168 Fix regression in BLI_path_suffix for long extensions
Changes from [0] passed in a pointer size to BLI_strncpy.

[0]: f8e23e495b
2023-04-20 11:18:26 +10:00
f87e474af0 Cleanup: Move view3d_gizmo_ruler.c to C++
Move view3d_gizmo_ruler.c to C++ to make further changes easier.
See #103343

Pull Request: blender/blender#107148
2023-04-20 00:06:49 +02:00
911f9bea84 Fix #107067: Properly clear CD_FLAG_ACTIVE/DEFAULT_COLOR flags
Runtime this information is stored in the active_color_attribute and
default_color_attribute strings on the mesh, however when saving it
is still saved in the old format with flags on the CustomData layers.
When converting from the strings to the layers not all flags were
properly cleared from the CustomData layers, leading to multiple
layers having the CD_FLAG_COLOR_ACTIVE/RENDER flag.
2023-04-19 22:26:31 +02:00
e05cbad0d1 Sculpt: Fix #107093: expand helper function not specialized to pbvh
sculpt_expand_is_face_in_active_component wasn't specialzied for
the different PBVH types.
2023-04-19 12:59:09 -07:00
2ab500c234 Cleanup: Remove unnecessary point cloud function argument
The "nomain to main" function for point clouds now always takes
ownership of the source data-block, just like the mesh version.
2023-04-19 15:52:56 -04:00
7535ab412a Cleanup: Remove redundant "reference" argument to geometry copy
Implicit sharing means attribute ownership is shared between geometry
data-blocks, and the sharing happens automatically. So it's unnecessary
to choose whether to enable it when copying a mesh.
2023-04-19 15:52:56 -04:00
10d175e223 Cleanup: Use consistent argument order for mesh creation functions
The typical order is vertex, edge, face(polygon), corner(loop), but in
these three functions polys and loops were reversed. Also use more
typical "num" variable names rather than "len"
2023-04-19 15:52:56 -04:00
60bb57663a Cleanup: IO: Separate creating mesh and adding to Main
Create a "nomain" mesh when converting intermediate representations
to a Mesh, meaning those areas don't have to know about data-block
names or the main database, and also that the boilerplate of adding
attributes individually can be avoided. The attribute arrays aren't
copied here, so the performance should be unaffected.
2023-04-19 15:52:56 -04:00
9344deed89 UI: Change the name of Invert nodes to Invert Color
The nodes for inverting a color are named simply Invert, which begs the question: invert what?

This patch changes the naming for the node in Shading, Texture and Compositing nodes to *Invert Color*

This matches the naming of other color dedicated nodes like Separate Color or Combine Color

Pull Request: blender/blender#106750
2023-04-19 21:52:20 +02:00
c6d4de9e49 Render: Fix crash in baking
corner_edges was being passed to a function that expected
corner_verts.
2023-04-19 12:40:50 -07:00
199c7da06d Assets: Do Not Show Blank Read-Only Metadata
Do not show asset metadata "description", "license", "copyright", or
"author" if they are empty AND read-only, since they can't be edited
and contain no useful information to show.

Pull Request: blender/blender#105812
2023-04-19 19:55:26 +02:00
acb34c718e Fix #107120: Small fixes to OS File Operations
Small fixes to recent file operations changes. FileOperations enum
starting with zero results in bad behavior with EnumPropertyItem. Typo
fix.

Pull Request: blender/blender#107138
2023-04-19 19:43:15 +02:00
097b9c5a36 Fix: Build error after last commit
Also fix fallthrough warnings
2023-04-19 13:05:08 -04:00
98ccee78fe Geometry Nodes: Slightly optimize mesh to curve node
Avoid copying the selected edges if all edges are selected, and
parallelize gathering the selection otherwise. Also use `int2` instead
of `std::pair`.

In simple test file I observed an approximate 10% FPS improvement,
though in real world cases the impact is probably much smaller.
2023-04-19 12:35:09 -04:00
d5757a0a10 Cycles: re-enable AMD GPU binaries on Windows
Using the new HIP SDK 5.5 that includes a fix for the compiler bug.

This also enables the light tree.

For Linux the binaries are still disabled. ROCm 5.5 is planned to
include the same fix but not released yet. When that happens we
should be able to enable Linux as well.

Ref #104786
Fix #104085

Pull Request: blender/blender#107098
2023-04-19 18:18:05 +02:00
45c0762f1b Fix #107125: Entering Grease Pencil Vertex Paint mode crashes
Caused by uninitialized `ToolSettings` `GpPaint` [which was later
accessed in `BKE_gpencil_palette_ensure`].

Not 100% sure why `ToolSettings` `GpPaint` is properly initialized in a
default startup fille, but for some files, this was not the case (as in
the report)

See 22462fed00 for a similar commit.

Now initialize `ToolSettings` `GpPaint` (alongside `GpVertexPaint`) when
entering grease pencil vertex paint mode.

Should probably go into LTS releases as well.

Pull Request: blender/blender#107131
2023-04-19 16:50:46 +02:00
599e52119f Fix #107101: Update depsgraph on muting VSE channel
Muting a VSE channel does not mute the sound, this is caused by lack
of depsgraph updates for sound when mute state changed for the channel.
Now fixed.

Caused by ad146bd17a

Pull Request: blender/blender#107116
2023-04-19 16:27:21 +02:00
a7422f3cd7 deps_builder/windows: Cleanup dpcpp harvest
The dpcpp folder grew from 200M to 500M with the last update
due to lld being enabled and having 5 different copies in the bin
folder. We do not need to ship lld so it can be safely removed.

However previous harvest cleaned up the build folder before copying
the libs to their final destination in output, this will no longer
work, since we actually do need lld to build embree.

So copy to the full build folder to output first, then remove the
binaries we do not need. Embree will use the binaries in the build
folder so it will be unaffected by this.
2023-04-19 07:57:46 -06:00
d6abd2ce72 Fix #106138: Node add searches missing context-based poll
Before the add node search refactor and link-drag-search, nodes were
filtered out based on whether they worked with the active render
engine. For example, the Principled Hair BSDF node doesn't work with
EEVEE, so it isn't displayed in the UI. While we might want to relax
this in the future, we have no better way to show that they don't work
right now, so it's best to keep that behavior.

The filtering is implemented with a new node type callback, mainly
to reduce the boilerplate of implementing many node search callbacks
otherwise. It's also relatively clear this way I think. The only
downside is that now there are three poll functions.

I didn't port the "eevee_cycles_shader_nodes_poll" to the new
searches, since I don't understand the purpose of it.

Pull Request: blender/blender#106829
2023-04-19 15:48:18 +02:00
91a29c9b9a Fix #107127: Context property driver to view layer does not work
The resolution of the driver value RNA path was using the wrong
property (it was forced to be referenced relative to the ID).

Pull Request: blender/blender#107129
2023-04-19 15:32:37 +02:00
5ab48a53e4 Cleanup: Use generic edge calculation for legacy curve to mesh
Change the "displist to mesh" conversion to use the edge calculation
function used everywhere else, to allow removing the old code. This
changes edge vertex and corner edge indices, requiring a test update,
but the visual result should be the same.
2023-04-19 09:29:08 -04:00
b647c2b88d Cleanup: Remove unused variables/functions
Also change from `unsigned int` to `uint` for consistency
between function declarations and definitions.
2023-04-19 08:52:48 -04:00
86611a5fcc Tests: add tests for BLI_path_extension ensure & replace 2023-04-19 21:15:43 +10:00
7f2c7feaee Fix #107113: VSE channel buttons invisible in Light theme
Also fix inconsistency in Movie Clip and Status Bar headers.
2023-04-19 12:39:33 +02:00
c0f7801660 Fix regression in BLI_path_extension_ensure
Error in [0] removed trailing '.' stripping.

[0]: f8e23e495b
2023-04-19 20:33:55 +10:00
e45ed69349 Attributes: Integrate implicit sharing with the attribute API
Add the ability to retrieve implicit sharing info directly from the
C++ attribute API, which simplifies memory usage and performance
optimizations making use of it. This commit uses the additions to
the API to avoid copies in a few places:
- The "rest_position" attribute in the mesh modifier stack
- Instance on Points node
- Instances to points node
- Mesh to points node
- Points to vertices node

Many files are affected because in order to include the new information
in the API's returned data, I had to switch a bunch of types from
`VArray` to `AttributeReader`. This generally makes sense anyway, since
it allows retrieving the domain, which wasn't possible before in some
cases. I overloaded the `*` deference operator for some syntactic sugar
to avoid the (very ugly) `.varray` that would be necessary otherwise.

Pull Request: blender/blender#107059
2023-04-19 11:21:06 +02:00
19ac02767c Fix regression in recent BLI_path extension logic
Error in [0] meant BLI_path_extension_replace &
BLI_path_extension_ensure did nothing when the input path had no
extension.

[0]: f8e23e495b
2023-04-19 18:38:56 +10:00
fd10ecaeaf Fix bitwise logical operation in Metal backend
Pull Request: blender/blender#107084
2023-04-19 10:02:12 +02:00
187998970a Fix unused variable in release build in Metal backend 2023-04-19 10:02:09 +02:00
c872b6b930 Fix set but unused variable in Freestyle 2023-04-19 10:02:09 +02:00
3c34b13cf8 Fix set but unused variable in mesh intersect
A bit tricky, since there is also variable shadowing involved.
2023-04-19 10:02:09 +02:00
9e63c3cee8 Fix strict prototypes in Audio 2023-04-19 10:02:09 +02:00
a20f45bab9 Fix unqualified access to std::move in OpenSubdiv 2023-04-19 10:02:09 +02:00
63c20e08c4 Fix set but unused variable in Libmv 2023-04-19 10:02:09 +02:00
4f7dc1e4b6 Fix set but unused variable in IK solver 2023-04-19 10:02:09 +02:00
8ed543c6f2 Fix set but unused variable in dualcon octree 2023-04-19 10:02:09 +02:00
daaed83a32 Fix set but unused variables in Cycles 2023-04-19 10:02:09 +02:00
7982d86117 Fix unqualified access to std::move in Cycles 2023-04-19 10:02:09 +02:00
33e5cd4e2f Fix bitwise operation used on boolean in Mantaflow 2023-04-19 10:02:09 +02:00
8365bce958 CMake: Add extra strict flags cancellation for Clang 2023-04-19 10:02:09 +02:00
b0ec4d889a Fix #106998: selection of bones in grease pencil weightpaint mode fails
Caused by 2eeec49640.

Above commit would early out when falling through the specialized
greasepencil selection operator to view3d_select_exec. But in order to
select posebones in grease pencil weightpaint mode, we still have to
continue with view3d_select_exec.

Now check this special case [with convenient
`BKE_object_pose_armature_get_with_wpaint_check`] and DONT early out in
that case.

Should go into 3.3 LTS as well.

Pull Request: blender/blender#107076
2023-04-19 09:13:21 +02:00
c10e8e4166 Fix #106751: No implicit conversion for group inputs
When a node input is connected to a group node input that is unlinked
and is of a different type, no implicit conversion takes place, so the
value is unexpected.

This patch fixes that by considering the types of both sockets and do
implicit conversion if necessary.
2023-04-19 06:24:39 +02:00
ed590e9181 macOS/GTests: simplify blender_test library linking
Reverts dcb2821292 but handles
the linker error by relying on target_link_libraries deduplication.

Reverts 18a15bafe8 but handles
blender_test linking after dependency change by passing
lib to target_link_libraries itself.

Closes #107033
2023-04-19 09:05:43 +05:30
26a194abbd BLI_path: add BLI_path_extension_strip as an alternative to replace
While replacing the extension with an empty string works,
it required a redundant string-size argument which took a dummy
value in some cases. Avoid having to pass in a redundant string size by
adding a function that strips the extension.
2023-04-19 12:59:43 +10:00
9e6757f20f Cleanup: expand on why the extension isn't replaced for blend-file save 2023-04-19 12:58:54 +10:00
61fe8da989 Cleanup: avoid changing the filepath for alembic frame range calculation
The internal utility get_sequence_len would make it's filename
argument absolute so as to scan it's directory for files.

Perform this on the directory instead so the filename can be const.
2023-04-19 12:33:28 +10:00
643f8bcedd Cleanup: avoid redundant string copy
This may have been done because BLI_path_frame_get used to take a
non-const string.
2023-04-19 12:32:42 +10:00
f8e23e495b BLI_path: improve behavior of BLI_path_extension
Finding the extension included hidden files (starting with a '.'),
now finding the extension matches Python's `os.path.splitext` behavior
which has the advantate a hidden file is not considered one long
extension - with an empty name part.

Also update code to use BLI_path_extension in cases which previously
in-lined this logic.

BLI_path_frame_get path argument is now const,
it was being manipulated unnecessarily.
2023-04-19 11:33:26 +10:00
7f241fc773 Tests: add test for BLI_path_suffix & BLI_path_sequence_decode 2023-04-19 11:33:26 +10:00
6d2351d26b Text object: operators to move cursor to the top or bottom
This adds new movement types TEXT_BEGIN and TEXT_END to allow
FONT_OT_move and FONT_OT_move_select operators move the text
cursor (caret) to the top and bottom of the text.

Pull Request: blender/blender#106196
2023-04-19 02:18:19 +02:00
846d78b09a Cleanup: improve doc-strings for EditFont 2023-04-19 09:06:24 +10:00
b132118f89 Cleanup: balance doxygen grouping, minor grouping adjustment 2023-04-19 09:02:21 +10:00
88f5dd3c72 Cleanup: format 2023-04-19 08:02:42 +10:00
eb2867de90 Cleanup: spelling in comments 2023-04-19 08:02:41 +10:00
Mateusz Albecki
0fd14d659b GHOST/Wayland: Fix disposeContext with VK
During createOffscreenContext with VK backend enabled wl_surface
was not stored in the context's user data. This resulted in nullptr
dereference later on during disposeContext. Added a line that sets
user data and additionally added nullptr checks in disposeContext.

Ref !107057.
2023-04-19 07:44:06 +10:00
1469613d65 Fix Build Warnings
A differing const argument and an unused var caused by conditionals.

Introduced in 694f792ee1
2023-04-18 13:59:07 -07:00
4382a0b350 Cleanup: avoid warnings from gcc in oneAPI device compilation
When building using GCC and with Embree without GPU support, there were
a few unused variables and a non-defined macro.
2023-04-18 22:40:40 +02:00
70892e82ac Cycles: oneAPI: use specialization constant to compile with/without Embree on GPU 2023-04-18 22:09:42 +02:00
9821a2d397 Cycles: pass kernel features to get_bvh_layout_mask
This allows to selectively disable Hardware Raytracing in oneAPI
backend, depending on features used.
2023-04-18 22:09:42 +02:00
3f8c995109 Cycles: add hardware raytracing support to oneAPI device
Updated Embree 4 library with GPU support is required for it to be
compiled - compatiblity with Embree 3 and Embree 4 without GPU support
is maintained.
Enabling hardware raytracing is an opt-in user setting for now.

Pull Request: blender/blender#106266
2023-04-18 22:09:42 +02:00
887022257d Cycles: update DPCPP to 2022-12 release
We also backport a patch to program_manager to it as
61e51015a5
helps avoid unnecessary recompilation when enumerating available
kernels.
2023-04-18 22:09:41 +02:00
5cdf0c9ee9 Cycles: update compute-runtime to 23.05.25593.18
This fixes oneAPI AoT compilation on Linux when using Embree on GPU.
2023-04-18 22:09:41 +02:00
66b4e426cc Cycles: build Embree 4 with GPU support 2023-04-18 22:09:41 +02:00
72aeee96ac Fix Build Warning in fileops.c
Marking unused function arguments caused by conditionals.

Introduced in 694f792ee1
2023-04-18 12:53:45 -07:00
f7ba61d3a6 Fix #107009: Setting Text Object Styles
This allows toggling of text styles of selected text and at the current
mouse cursor position if nothing is selected.

Pull Request: blender/blender#107048
2023-04-18 21:24:38 +02:00
70d854538b Curves: Optimize edit mode selection draw extraction
Use the attribute API for domain and type interpolation instead of doing
it manually. I observed a 3.8x improvement in curve selection mode and
an 18x improvement in point selection mode.
2023-04-18 14:57:04 -04:00
694f792ee1 UI: OS File Operations Within File Browser
Adds a submenu to the File Browser selected item context menu that
allows opening the item or viewing the location in an OS browsing
window. On Win32 also allows other actions like editing, searching,
opening command prompt, etc.

Pull Request: blender/blender#104531
2023-04-18 20:39:30 +02:00
4edcae75aa Cleanup: Remove unused using keyword 2023-04-18 13:38:11 -04:00
954c6c0ae6 Revert "Cycles: move oneAPI kernels dynamic library to blender.shared"
This reverts commit df096eab77.
There is a corner case for when WITH_CYCLES_ONEAPI_BINARIES is set to on
and later turned off during config, in case there is no ocloc.
2023-04-18 18:48:37 +02:00
3a72442f63 Fix comment style in previous commit.
Pull Request: blender/blender#107091
2023-04-18 17:28:53 +02:00
5bb3a3f157 Fix: segfault when indexing into some collections with strings.
This happens when the collection's item type doesn't have a
'nameproperty' to index with.  For debug builds we error out with an
assert, since in general this shouldn't happen.  For release builds
Python will report item not found.

Pull Request: blender/blender#107086
2023-04-18 17:15:22 +02:00
d818d05415 Cleanup: Remove unnecessary attribute provider callbacks
We don't use the callbacks that create virtual arrays from the custom data
anymore, they just add extra indirection. The only non-obvious case was
the crease attribute which had a setter function. Replace that with an
attribute validator like the other similar attributes.

Pull Request: blender/blender#107088
2023-04-18 17:13:38 +02:00
7c927155b5 Fix #90159: Inconsistent display of active filters for import/export file dialogs
Use `filter_glob` property to list only operator extension files.
PR includes filtering for collada, usd, alembic file formats.

Old Revision: https://archive.blender.org/developer/D16739

Pull Request: blender/blender#107034
2023-04-18 15:57:45 +02:00
63f309df11 Fix #107081: Slow selection with context variables
A solution for an older bug was causing it.

Added a special case to avoid an extra relation for context
variables as they do not change during the dependency graph
evaluation,

Pull Request: blender/blender#107082
2023-04-18 15:40:07 +02:00
66158498de BLI: Return number of values removed from remove_if
Make the `remove_if` function for `Vector`, `VectorSet`, `Set`, and `Map` return the number of elements it removed.

Pull Request: blender/blender#107069
2023-04-18 13:28:14 +02:00
89c67ec8ce Merge branch 'main' into cycles-light-linking 2023-04-18 13:26:05 +02:00
25747301db Cycles: fix SYCL debug library linking on Windows 2023-04-18 12:33:48 +02:00
b623be3377 Cleanup: remove clang-format: off for EnumPropertyItem definitions
These aren't special cases so format them as is done with all other
enum-property declarations.
2023-04-18 20:30:00 +10:00
77268dbe3b WM: add versioning for 3.5 sculpt brushes (part of fix for #106057)
Add a versioning function for tool ID's which can be used if these
need to be changed in future.
2023-04-18 20:30:00 +10:00
7b4d71683f Fix #107060: Curves sculpt mode does not select default tool
Regression in [0] when curve tool names changed to use brush names
with the utility function generate_from_enum_ex().

[0]: 786734e6c8
2023-04-18 20:16:31 +10:00
58b1c54671 Cleanup: remove "Curves" suffix from curve sculpting enum
This isn't necessary information & types aren't included in other
brush names.
2023-04-18 20:16:31 +10:00
732fa26413 Fix #107032: API Document: matrix_channel (PoseBone) description incorrect
Update the RNA and DNA documentation for two bone matrices:

- `PoseBone.matrix_channel` (`bPoseChannel::chan_mat` in DNA) contains
  the evaluated loc/rot/scale channels, including constraints and drivers.
- `PoseBone.matrix` (`bPoseChannel::pose_mat` in DNA) contains the same
  transform, but then expressed in the armature object space.

No functional changes, just clarifications in comments / tooltips.
2023-04-18 12:01:45 +02:00
4d7a7ce67c Fix #107050: accessing nullptr after progress is canceled 2023-04-18 11:58:07 +02:00
6e75581e65 BKE: Rework ID swap code to properly handle embedded ID pointers.
While embedded IDs are usually considered as private local data of their
owner ID, some areas of code, like the depsgraph, can consider them as
regular IDs in some aspects.

So when swapping IDs, also properly 'counter-swap' their potential
embedded IDs, such that the pointers to the embedded IDs remain as before
swapping, even though the data of the embedded IDs is swapped.

The main target of this change is memfile undo code. There, newly read
IDs are swapped with their oldder version, so that the old address
contains the new data. This allows to avoid rebuilding some of the
depsgraph. Doing the same thing for embedded IDs should reduce even
further the needs for depsgrah rebuilds on undo steps.

This commit also gives more control over the remapping of 'self' ID
pointers inside themselves.

Pull Request: blender/blender#107044
2023-04-18 11:09:36 +02:00
a68566a197 Light linking: Changes to address artists feedback
Two main aspects:

1. Split the light linking collection into two: light and shadow linking.
   It is easier to understand than light+shadow state plus the state of
   None.

2. Inherit instancer receiver and blocker sets.
   This solves usecase when there are multiple rocks (instances of the
   same object) and only some of the instances are to be linked to the
   light.

There is notable internal difference: the is-linked-id check was removed
from the only function in the blenkernel. This allows to potentially do
python-level overrides in the shot file. Check somewhere else in the
interface might be needed.

Pull Request: blender/blender#106950
2023-04-18 10:11:12 +02:00
664b31ea73 Cleanup: make format 2023-04-18 09:45:01 +02:00
4d75f10a8a EEVEE: Optimise texture usage flags
Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#107037
2023-04-18 08:11:46 +02:00
982392ca13 Docs: Update RNA to user manual url map
Fixes #107005
2023-04-18 01:12:27 -04:00
ab8acbbfe5 Cleanup: Use curve positions accessor function
There's no particular reason to use the attribute API instead here.
2023-04-17 23:38:10 -04:00
c234a802ba Cleanup: Remove unused using keyword 2023-04-17 23:38:10 -04:00
7bb8c8a5cf Cleanup: Improve comments about curves and mesh offset spans 2023-04-17 23:38:10 -04:00
c615ccde68 Fix splash preference overriding Read Home File's use_splash property
- Split out WM_init_splash_on_startup(..) which performs startup checks.
- WM_init_splash(..) now shows the splash (ignoring preferences).
- Avoid calling BLI_exists on an empty string (in some cases).
2023-04-18 12:59:13 +10:00
1bb77d9eae Cleanup: Better logging for imbuf tests
Recent failures requiring investigation have exposed some shortcomings
that this addresses:
- When creating the diff image for offline comparison, use a higher
  threshold to prevent idiff from printing more output which will often
  contradict the primary failure output just above it (very confusing)
- For metadata failures, make sure these get printed so it's obvious
  what kind of failure we're dealing with

Pull Request: blender/blender#107058
2023-04-18 03:32:20 +02:00
302eb1e0d7 Cleanup: compile warning, correct wording 2023-04-18 11:04:08 +10:00
c4c1cc7cd3 Cleanup: double quotes for non-enum strings
Also use back-ticks for code-references in comments.
2023-04-18 10:51:32 +10:00
2f743b0a92 Cleanup: Replace manual flag checking with methods in node.cc
Not all flags have methods, and not all node primitive types have this.
Replacement of rather simple cases.

Pull Request: blender/blender#107055
2023-04-18 00:29:10 +02:00
29f137e138 Sculpt: fix brush.falloff_shape not being reset in "reset brush" op 2023-04-17 15:16:35 -07:00
96fa5fc2b3 Sculpt: Fix #106996: Mising null check in BKE_sculpt_update_object_before_eval 2023-04-17 14:05:29 -07:00
df096eab77 Cycles: move oneAPI kernels dynamic library to blender.shared
After 17800e0c03, the oneAPI kernels library was still able to find sycl6.dll but that wasn't reliable.
We fix this by moving the oneAPI kernels library also into blender.shared.

Pull Request: blender/blender#106894
2023-04-17 21:47:35 +02:00
09b770388a Fix #107004: Cycles shadow caustics not working with area lights
Tested the wrong variable after a refactor for light spread.
2023-04-17 20:46:08 +02:00
870930bc32 Fix build error using WITH_CYCLES_LOGGING=OFF
Mismatch between glog and stubs. CHECK_NULL does not exist also. Tests
also require logging to be available.
2023-04-17 20:36:18 +02:00
74eda0b6fc Fix build error on macOS after previous commit 2023-04-17 17:47:29 +02:00
92919864a0 Fix #106293: Cycles importance sampling with multiple suns works poorly
Keep sun in importance map in this case, as we do not use special sun
importance sampling in this case.
2023-04-17 17:30:47 +02:00
cff94a808e Fix #106706: fireflies with Nishita sky sun sampling at certain angles
Due to floating point differences between importance sampling and
texture evaluation, disagreeing on whether or not a ray lies within
the sun disc.

* Use the same input values for geographical_to_direction() in
  sky_radiance_nishita() and kernel_data.background.sun.
* The mathematical operations in pdf_uniform_cone() were adjusted to
  match sky_radiance_nishita().

Pull Request: blender/blender#106764
2023-04-17 17:29:27 +02:00
a8feb20e1c DNA: Move irradiance grid light cache data to Object level
This is the first step for refactoring the lightcache system.
Each probe instance (as in `Object`) will now store its own baked data.
The data is currently stored in uncompressed readable format.

This introduces two new operators for baking to avoid confusion with
the previous light baking pipeline. These do nothing other than
creating empty caches that will be populated by EEVEE later on.

The DNA storage is made to be able to include multiple caches
in case of baked simulation over time but it isn't yet supported.

I prefer to keep the implementation simple for now as the long term
goals for this feature are uncertain.
There is still a type flag (`LightProbeObjectCache.cache_type`) that
will be used for versioning.

The naming convention of structs is a bit weird but that's all I
found in order to avoid interfering with the old scene light cache
that is still used by (old) EEVEE.

Related task #106449.

Pull Request: blender/blender#106808
2023-04-17 17:12:19 +02:00
b1703bd902 Fix #107020: crash when canceling Sky Resize with mesh symmetry
Like `t->data` use calloc to `tc->data_mirror`.

This way you make sure that all values are properly initialized.
2023-04-17 11:32:36 -03:00
c041a36286 Fix #91966: Alembic/USD export ignores bone parent animation
For non-object parents (so bones & vertices), the parent is now also
explicitly checked for animation. In other words: having an animated
parent will cause the transform of the child to be written to Alembic/USD
on every frame (as if it is animated itself).
2023-04-17 16:21:39 +02:00
b75b734969 Core: Memfile Undo: Optimize handling of 'no undo' IDs.
Do not read IDs from types flagged as 'no undo', whether they are local
or linked.

This should have no effect currently, since all 'no undo' ID types
currently are supposedly only local data anyways (Screen, WindowManager
and WorkSpace).
2023-04-17 16:08:41 +02:00
915b8b6093 Core: Memfile undo: Add ID tag for IDs that are 'reused in place'.
These IDs kept their address, but their content has been replaced
(re-read from the memfile undo step). Add an ID tag to identify them.

As a further cleanup, systematically tag these IDs for despgraph COW,
since their data is effectively modified (though in practice all of
these IDs are expected to already have other update tags anyway).

No change in behavior is expected from this commit.
2023-04-17 15:46:21 +02:00
a16bcb6576 Core: ID remapping: Do remap 'not owning embedded' ID pointers.
This should not have much effective consequences with current code, but
fixes potential missed remappings for e.g. some nodetree pointers in the
node editor, or the `parent` pointer of collections to a scene's master
collection.
2023-04-17 15:46:21 +02:00
0bc957063c Fix #106405: Cycles multi GPU crash with vertex color baking
Avoid division by zero when one of the devices gets no work.
2023-04-17 15:31:35 +02:00
38bf3e1911 I18n: translate default preset name
The "New Preset" message was already translated and used in some
preset panels, but not all.

Pull Request: blender/blender#106973
2023-04-17 15:00:07 +02:00
48979c6cdc Py module i18n utils: return subprocess.run result to catch output of external commands.
Avoids having prints in random order in multi-processes concurrent
context.
2023-04-17 14:38:51 +02:00
e45746591b Metal: Add new files for Storage Buffers support 2023-04-17 14:12:32 +02:00
2a4323c2f5 Mesh: Move edges to a generic attribute
Implements #95966, as the final step of #95965.

This commit changes the storage of mesh edge vertex indices from the
`MEdge` type to the generic `int2` attribute type. This follows the
general design for geometry and the attribute system, where the data
storage type and the usage semantics are separated.

The main benefit of the change is reduced memory usage-- the
requirements of storing mesh edges is reduced by 1/3. For example,
this saves 8MB on a 1 million vertex grid. This also gives performance
benefits to any memory-bound mesh processing algorithm that uses edges.

Another benefit is that all of the edge's vertex indices are
contiguous. In a few cases, it's helpful to process all of them as
`Span<int>` rather than `Span<int2>`. Similarly, the type is more
likely to match a generic format used by a library, or code that
shouldn't know about specific Blender `Mesh` types.

Various Notes:
- The `.edge_verts` name is used to reflect a mapping between domains,
  similar to `.corner_verts`, etc. The period means that it the data
  shouldn't change arbitrarily by the user or procedural operations.
- `edge[0]` is now used instead of `edge.v1`
- Signed integers are used instead of unsigned to reduce the mixing
  of signed-ness, which can be error prone.
- All of the previously used core mesh data types (`MVert`, `MEdge`,
  `MLoop`, `MPoly` are now deprecated. Only generic types are used).
- The `vec2i` DNA type is used in the few C files where necessary.

Pull Request: blender/blender#106638
2023-04-17 13:47:41 +02:00
f588a0596b Fix #106943: driver on inactive view layer doesn't work
Animation data (including drivers) on inactive view layers now work. The
removal of such view layers was too optimistic; they are now kept
around. The bases are still removed, mostly for safety sake and to keep
the changes to a minimum.

`scene_remove_unused_view_layers()` has been renamed to
`scene_minimize_unused_view_layers()` to reflect its new functionality.

For compatibility with assumptions in other areas of the code, the
function still ensures the input view layer is at index 0.

This also introduces a new function
`BKE_view_layer_free_object_content(view_layer)`, which is a subset of
the functionality of `BKE_view_layer_free()`.
2023-04-17 12:59:03 +02:00
fe7540d39a Cleanup: Define type for object type enum
Having a type defined allows the compiler to help with type safety. For
example we can use it in switches to trigger a warning when a new object
type is added but not covered by the switch yet (but probably should).
2023-04-17 12:39:42 +02:00
62d9e55eec Graph editor: fix box select when scene has annotations
The graph editor box select operator now works properly again, when there
is an annotation layer in the scene.
2023-04-17 12:15:24 +02:00
0ed0165eea Refactor: anim, simplify range check
Simple application of De Morgan's law. No functional changes.
2023-04-17 12:15:24 +02:00
c8435185e1 I18n: Updated translation files from SVN trunk (r6467). 2023-04-17 12:00:22 +02:00
dfa42c614f Cleanup: UI messages fixes and tweaks. 2023-04-17 11:41:10 +02:00
5491563e59 Fix #106982: crash with muted node
The lazy function for muted nodes did request inputs
even if they were not required.
2023-04-17 10:59:05 +02:00
6e59d0b20f Cleanup: document type of Scene::view_layers 2023-04-17 10:57:09 +02:00
3a02d760f7 Python API: Expose background drawing argument for GPUOffScreen.draw_view3d
Currently, when using the python api for offscreen drawing, the
default background will always be rendered into the GPUOffScreen's
framebuffer, rendering the alpha channel essentially useless and
making it difficult to separate objects from the background.

This patch allows offscreen drawing of a 3d view with transparent
background by exposing an optional parameter to the python api,
enabling, for example, compositing the result over another image.

The new parameter to draw_view3d() is optional, with the default
value matching the previous behavior, so this change is fully

Pull Request: blender/blender#105748
2023-04-17 09:28:02 +02:00
15f464019a Geometry Nodes: avoid last buffer copy in Blur Attribute node
Previously, there was a "main" and "tmp" buffer and the final
result was expected to be in the "main" buffer. Now the two buffers
are called a and b and the final result can be in either of those.

This can improve performance especially if the number of iterations is low.

Pull Request: blender/blender#106860
2023-04-17 08:08:46 +02:00
348f57bcec Fix #107017: Missing checks for #PyObject_GetBuffer success
`PyObject_GetBuffer` was used without checking that it was successful.
This could cause the code to access an incompatible or uninitialized
`Py_buffer`.

Add the missing checks, and clears the raised `PyExc_BufferError`
to silently fall back to accessing the PyObject as a sequence.
2023-04-17 16:07:20 +10:00
1d8389cd09 Fix: missing cache to get evaluated positions
Without this, there is a crash in the
`geo_node_geometry_test_duplicate_elements_curve_points` test in
a debug build. This was broken in 7bd7043a74.
2023-04-17 06:32:30 +02:00
c7d80b8c70 Fix crash saving an image when ImageOutput::open fails
Saving a PNG into path without write access would crash,
caused by recent move to OIIO.
2023-04-17 13:31:10 +10:00
0b1fb22f69 Fix screenshot path defaulting to the root directory for unsaved files
Using a "//" prefix resolves to the root directory which isn't a good
default as it typically doesn't have write permissions.
Only set the name and let the file selector pick a directory to use
(matches how saving from the text editor works).
2023-04-17 13:31:08 +10:00
153cb7e1df Cleanup: remove inline checks for GPU front-buffer reading
Add WM_window_pixels_read & WM_window_pixels_read_sample that
use front-buffer pixel reading when supported.

Note that direct access to reading from the front-buffer is still needed
for writing thumbnails - where redrawing can cause problems
(see code-comments).
2023-04-17 12:28:56 +10:00
e78c3c9d96 Docs: comments for disabling the front-buffer & view3d offset correction
Expand on why front-buffer support is always disabled on Wayland &
why viewport orbit around selection offset correction isn't used for
perspective views.
2023-04-17 12:27:34 +10:00
7bd7043a74 Fix #106927: Crash when removing handle position attribute
Bezier curve position evaluation expects the handle position attributes
to exist and doesn't handle the case where they don't. Swith to using
a utility function to evaluate each curve type so Bezier evaluation can
stop early in that case.
2023-04-16 21:34:35 -04:00
2fade47a9d Fix: Transform geometry node doesn't translate volumes correctly
Fixes a bug introduced in b0b9e746fa.
The volume transformation matrix is multiplied in the wrong order
which means the grid scale is applied on the translation.
2023-04-17 03:10:40 +02:00
Henry Chang
bd86e719ab UI: Sculpt Paint tool defaults #97616 #105759
Default settings changed for Sculpt mode's
Paint Brush, Smear Brush, and Smear Brush.

~~This includes updates of PR review #105691.~~

Updated to only include commits relevant to this PR.

Reviewed by: Joseph Eagar & Julian Kaspar
Pull Request: #105759
2023-04-16 15:24:47 -07:00
4563a47ac5 Squashed commit of the following:
commit 7aa5e65dcbda862dcb17ecfc6727eb241a12c316
Merge: c08a9ec19f 7c9e493da55
Author: Joseph Eagar <joeedh@gmail.com>
Date:   Sun Apr 16 15:11:53 2023 -0700

    Merge branch 'main' of https://projects.blender.org/ChengduLittleA/blender into ChengduLittleA-main

commit 7c9e493da55a4adbfa2415b711e6d0daa2720ad9
Author: YimingWu <xp8110@outlook.com>
Date:   Fri Mar 31 17:46:32 2023 +0800

    Fix #106358: Handles null evaluated object when entering sculpting workspace.

    The setup where everything in the scene is invisible/not enabled could
    trigger a crash when switched to sculpting workspace, triggered when
    opening the file.

    This patch handles such situation.
2023-04-16 15:14:11 -07:00
Patrick Foley
c08a9ec19f Sculpt: updated Mask and Face Set menu operators
Changed the menu operators:

    Expand Mask by Topology (hotkey Shift A)
    Expand Mask by Normals (hotkey Shift Alt A)
    Expand Face Set by Topology (hotkey Shift W)
    Expand Active Face Set (hotkey Shift Alt W)

so that their hotkeys would appear in their menu entries.

Resolves #104023

Co-authored-by: DisquietingFridge <30654622+DisquietingFridge@users.noreply.github.com>
Pull Request: #104568

Rebased for main instead of sculpt-dev
2023-04-16 15:04:58 -07:00
45ef51d0fb Fix #106242 "Edit Dyntopo Detail Size" status bar missing info
Fixed issue#106242 "Edit Dyntopo Detail Size" status bar missing info

Pull Request: blender/blender#106476
2023-04-16 23:54:48 +02:00
9d4949f80b Cleanup: Reduce nesting in node.cc
Decompose most of the nesting in the code to make the code
more consistent along the line of program execution.
Mainly achieved through:
- Remove redundant else
- Invert condition
- Add temporary variable to redistribute and name conditions

Pull Request: blender/blender#105509
2023-04-16 22:53:09 +02:00
de7e3454fb UI: Capabilities Flag for Clipboard Image copy/paste
This adds an WM_capabilities_flag to indicate that a platform
implements support for copying and pasting images using a shared
clipboard.

Pull Request: blender/blender#106990
2023-04-16 21:04:55 +02:00
254d148458 Fix: PLY export behavior with multiple meshes
A few fixes included here:
- Use `reserve` properly to add space after the first mesh
- Add to the end of the UVs array instead of replacing it for every mesh

Also, a cleanup/simplification:
- Split face size and face vertex loops, they are independent

Pull Request: blender/blender#106967
2023-04-16 20:00:16 +02:00
e1571cb105 Cleanup: correct terms, spelling in comments 2023-04-16 20:41:22 +10:00
5f40118899 Cleanup: rename GPU_offscreen_read_{pixels=>color} noted as a TODO 2023-04-16 20:38:19 +10:00
6cc2c16d06 Fix #106264: Color picker broken with Wayland & AMD GPU
- Use off-screen drawing when reading from the front-buffer isn't
  supported.

- Add a capabilities flag for reading the front-buffer which is always
  disabled on WAYLAND.

- Add GPU_offscreen_read_pixels_region, used for reading a sub-region of
  an off-screen buffer - use for color-picking a single pixel.
2023-04-16 20:16:54 +10:00
6722f90734 Cleanup: quiet mypy warnings in gitea_inactive_developers
Also add to the list of scripts to check with "make check_mypy".
2023-04-16 17:03:56 +10:00
b827c8cd1e Fix #104385: Unexpected clipping in ortho view & orbit around selection
Orbit around selection didn't work well in orthographic views,
potentially causing viewport offset to drift during navigation
to the point content would be outside the far clipping range.

Resolve by aligning the view offset depth with the dynamic offset
being orbited around.
2023-04-16 16:24:41 +10:00
8afb8db66e Cleanup: spelling in comments 2023-04-16 16:24:38 +10:00
cffc9bdb93 Cleanup: quiet unused argument warning 2023-04-16 16:24:36 +10:00
bb25302fc3 Docs: Fix wrong function return type
Fixes blender/blender-manual#104384
2023-04-15 21:03:47 -04:00
b601ae87d0 UV: add overlapping island support for uv packing
From the UV Packing options, choose:

 "Merge Overlapped" / "Overlapping islands stick together"
2023-04-15 13:59:12 +12:00
e078419c9c UV: cleanup uv_parametrizer, simplify types 2023-04-15 10:58:18 +12:00
6a0b90bc92 Cleanup: move pre-rotation inside uv packing engine 2023-04-15 10:33:32 +12:00
1924045142 Cleanup: format 2023-04-15 10:04:07 +12:00
db47f82626 GPU: Add Texture Usage Parameter to GPUOffscreen.
Currently the Textures used for offscreen rendering don't have
the `GPU_TEXTURE_USAGE_HOST_READ` flag. But some cases it is
needed. This PR adds a parameter when creating an offscreen
buffer.

Other solution could be to add this flag to all textures, but
we chose not to do this as that reduces the amount of fine-tuning
options for Metal/Vulkan backends. GPU can store textures
differently based on its actual usage.

This option isn't available in the python API as we don't expect
add-on developers to fine-tune texture usages to this extent.

For convenience `GPU_TEXTURE_USAGE_ATTACHMENT` is by default
always added.

Pull Request: blender/blender#106899
2023-04-14 22:02:51 +02:00
b86fc55d30 Cleanup: Use Vector for passing lists of PBVHNodes around
Cleaned up sculpt code to store lists of `PBVHNodes` with
`blender::Vector` instead of simple pointer arrays.  This is much
simpler and eliminates memory leaks caused by forgetting to free
the result of `BKE_pbvh_search_gather`.

Notes:

* `BKE_pbvh_search_gather` is now `blender::pbvh::search_gather`.
* `FilterCache` and `ExpandCache` have ownership over their .nodes
  members; as a result they're no longer pure C structs and
  are allocated with `MEM_new`/`MEM_delete`.
* The word 'totnode' no longer occurs anywhere in
  `source/blender/editors/sculpt_paint`

Todo (not for this PR): create a new properly C++ task API for sculpt
      (with lambdas) and use it for brushes.

Pull Request: blender/blender#106884
2023-04-14 21:16:42 +02:00
15683d81be Fix: Mesh validate missing mesh polygon removal tags
This was done in a macro before 7966cd16d6.
2023-04-14 14:24:42 -04:00
8df6974a15 Fix #106879: Texture Node add search is broken 2023-04-14 13:52:13 -04:00
7d4edcfa68 Cleanup: Use consistent mesh vertex position names 2023-04-14 13:42:28 -04:00
62548acb1a Cleanup: Re-organize our ID tags.
Re-organize ID tags in a more logical way, and keep their values
strictly increasing, splitting the free available ones in-between the
main groups (to avoid having to edit all tags values when adding a new
one).

Note that shuffling around these ID tags values should not be an issue
anymore, all of these are strictly run-time, and fully cleared in write
code when writing into a .blend file.

This also lead to the second cleanup, which is removing some asserts on
ID tag values in readcode, these are useless since the tag is cleared on
write.
2023-04-14 19:23:40 +02:00
c43d493cce blendfile write: Fix handling of embedded IDs.
Embedded IDs did not benefit from any of the recent optimizations
(especially for undo case) when writing regular IDs (cleaning up of some
pure runtime data that would generate a lot of fake 'changed on undo'
status).

Now factor out of `write_file_handle` this part of the code generating
temp ID copy with cleaned-up data for writing, and expose it in BLO API
such that IDs owning embedded ones can also use it.
2023-04-14 19:20:58 +02:00
bfd1836861 Cycles: add instancing support in light tree
Build a subtree for each unique mesh light.

Pull Request: #106683
2023-04-14 19:12:16 +02:00
910f60de4c Fix (unreported) wrong code in foreach_id code for Editors.
Code there was fairly naive and simple, missing some ID pointers,
sometimes improperly accessing non-ID data as IDs (usual dear Outliner
tree element usages of its 'ID' pointer...).

And code was especially quite severely broken in case these UI ID
usages were processed in a non-readonly context (i.e. if some of these
ID pointers were expected to be modified).

Code has been updated following existing very similar code in
`lib_link_workspace_layout_restore` from `readfile.cc`.
2023-04-14 19:06:58 +02:00
495f679246 Fix (unreported) outliner readfile code doing invalid ID pointer reading.
Code re-reading new ID pointers addresses inside readfile process would
not ensure that the 'ID' pointer of the outliner's treestore element is
actually a real ID pointer, and not a 'fake' one.

Probably harmless in practice, though this could have potentially been
the cause of extremely random rare crashes or corruption...
2023-04-14 19:06:58 +02:00
0cb17a7036 Fix (unreported) invalid pointer assignment in 2.80 collection doversion code.
Code would assign a LayerCollection pointer to an ID pointer... Funny
enough, it never seemed to have been an issue until now.
2023-04-14 19:06:58 +02:00
d633d9fd02 Curves: Define "lookup int" function for RNA arrays
The build seems to complain without this, though theoretically it isn't
meant to be necessary. Though keeping them defined can potentially
avoid quadratic lookups too.
2023-04-14 12:42:28 -04:00
dcb3b1c1f9 Geometry: Use implicit sharing for curve and mesh offsets
Similar to 7eee378ecc, this change decreases memory usage and
improves performance when copying curves and meshes without changing
their topology. The same change used for custom data layers is applied
to face and curve offset indices, which aren't stored as a custom data
layer.

The implicit sharing info for the offsets is stored in the mesh and
curve runtime structs, since it doesn't need to be written to files
directly. When changing the offsets pointer directly, the sharing info
must be updated accordingly. To make that easier, a few utility
functions take care of common operations like making an array mutable,
resizing an array, and creating sharing info for allocated data.

This commit also clarifies the intention to not allocate the offsets
at all when there are no curves/faces. That slightly complicates some
of the logic, but there's no reason for the single `0` integer to be
allocated.

Pull Request: blender/blender#106907
2023-04-14 17:58:13 +02:00
fed463df78 IDManagement: Extend ID remapping code.
This commits adds some new, specific flags to further control ID
remapping process (like and option to skip user refcounting completely).

It also adds a new function to do 'raw' remapping, without any extra
post-processing, depsgraph tagging, etc. This is not used currently, but
will soon be needed by readfile post-processing code changes.

There is also some small cleanups and reorganization in that area of code,
the main noticeable change being the switch from a short to an int for
the flags controlling remapping code (using short here does not give
any benefit, and makes it harder to switch to integers when it becomes
necessary).

No change in behaviors are expected from this commit.
2023-04-14 16:59:47 +02:00
988f23cec3 Attributes: Add 2D integer vector attribute type
This type will be used to store mesh edges in #106638, but it could
be used for anything else too. This commit adds support for:
- The new type in the Python API
- Editing the type in the edit mode "Attribute Set" operator
- Rendering the type in EEVEE and Cycles for all geometry types
- Geometry nodes attribute interpolation and mixing
- Viewing the type in the spreadsheet and using row filters

The attribute uses the `blender::int2` type in most code, and
the `vec2i` DNA type in C code when necessary. The enum names
are based on `INT32_2D` for consistency with `INT8` and `INT32`.

Pull Request: blender/blender#106677
2023-04-14 16:08:05 +02:00
80f3f59555 Fix: Remove unsupported data types in extrude and split edges nodes
The extrude node resizes an existing mesh, but doesn't initialize new
data for most non-generic data types like shape keys or freestyle tags,
or custom normals. The split edges node doesn't process some
similar vertex data too.

In the future this data can become generic attributes, or it can be
supported in the nodes anyway. But now the new data is un-initialized
after being allocated.

Fixes #106926
2023-04-14 10:06:48 -04:00
3f31ac2e1a Cleanup: Make deprecated custom data type handling consistent
Mark some types deprecated where they weren't already, remove redundant
comments, and remove the type masks for deprecated types.
2023-04-14 10:06:48 -04:00
2b4a62fa18 Fix: Respect preview range when auto normalizing in Graph Editor
When hitting normalize in the Graph Editor, it would frame the y-extents of the visible part of the FCurves.
Now, when a preview range is set, it frames the part of the FCurves in the preview range.

Pull Request: blender/blender#106888
2023-04-14 15:23:58 +02:00
23bce32888 Tools: util to get inactive member of teams from gitea
Note, at the moment it is using the last login as a criteria to
whether the person should be listed (comparing it to 2 years past).

However anyone who hasn't logged in in gitea yet shows as last login 1970.

To run this you need to install all the required python packages and
generate a token with scope "read:org" or "admin:org".

See:
infrastructure/blender-projects-platform#55
2023-04-14 14:54:26 +02:00
a1cc15f239 Fix: Assert when converting curves object to mesh object
`BKE_mesh_nomain_to_mesh` expects the object's data to be the mesh.
Also, the curve to mesh conversion can return a null pointer, so use
an empty mesh in that case. Thanks to Falk David for finding these.
2023-04-14 08:51:00 -04:00
4d1acf42e9 Cleanup: Minor fix to comments. 2023-04-14 14:24:40 +02:00
e0a3fcb622 Fix #106856: Pose library does not autokey mirrored poses
The auto-keying system was still considering the input Action, and not the
mirrored one. This is now fixed.
2023-04-14 14:19:28 +02:00
10f20bf5d5 Refactor: Rename more grease pencil files to legacy
This renames more files and folders to indicate that it is grease pencil legacy code.

Pull Request: blender/blender#106862
2023-04-14 13:35:08 +02:00
c9258e6e19 Cleanup: BKE: lib_query: Add a new type of callback flags for not-owned embedded ID pointers.
This is the case e.g. of the `parent` collection pointer of collections
children of a scene's master collection, or some nodetree pointers in
the UI data (node editor).

Right now handling of this new flag is exactly the same as in owning
embedded case, the distiction between both usages will happen in future
commits.

This commit is expected to have no behavioral change at all.
2023-04-14 13:29:19 +02:00
c63b2e5187 BLI timeit utils: Add accessor to time value for TIMEBLOCK macros. 2023-04-14 13:29:19 +02:00
4c793a5b20 Fix: Dangling pointer when clearing mesh
Missed in 1db918f948.
2023-04-14 07:00:28 -04:00
786734e6c8 Fix #106057: setting the sculpt curve brush in Python clears active tool
The built-in brush identifier didn't match the enum name causing
brush assignment not to update the tool-system (clearing the tool).

Resolve by using generate_from_enum_ex(..) to avoid each brush
definition having to manually duplicate enum definitions.
2023-04-14 20:14:06 +10:00
10b7d4f601 WM: support separators when generating tools from enums & icon map
Currently this is disabled for sculpt, we may want to enable this in the
future. Also add an icon map argument for brushes to use generic icons.
2023-04-14 20:14:06 +10:00
bf6f69399f RNA: add EnumProperty.enum_items_static_ui to access separators & titles
Expose the full enum including separators and section titles,
useful for the tool system so it's possible to read separators
from brush enums (not part of this commit).
2023-04-14 20:14:06 +10:00
fba960301f Cleanup: use the tool-order for the curve-sculpt tool enum
Prepare for using the enum for brush definitions.
2023-04-14 20:14:06 +10:00
40683e524c Cleanup: remove unused argument for tool-systems generate_from_enum_ex
Also avoid using a dict as a default argument. While it didn't cause
problems - in general it's bad practice and worth avoiding as any
modifications produce strange behavior.
2023-04-14 20:14:06 +10:00
e9d4e571d0 Cleanup: use identity comparisons with False 2023-04-14 20:14:06 +10:00
84e216fcee UI: replace "copy/paste buffer" by "internal clipboard"
A buffer is a technical term most often referred to using the metaphor
of a "clipboard" in applications. However, the "clipboard" is usually
the system clipboard, used to carry data accross applications. To
avoid confusion, this replaces "clipboard" by "internal clipboard"
when not dealing with the system clipboard.

In addition, a few places still used the "[copy/paste] buffer"
terminology, so they are replaced with "internal clipboard as well.

The replacement from "[copy/paste] buffer" to "clipboard" was
undertaken in previous commits da6d6f99a8, 14b60c3a1c. This
commit should tackle the remaining occurrences.

Pull Request: blender/blender#106060
2023-04-14 12:12:30 +02:00
1b94e60fb0 UI: Quick tooltip showing tab name for Properties editor tabs
Adds "quick tooltips" to quickly see the name of a tab in the Properties
editor. (See patch for visuals.)

From own experience users are often confused about the name of the different
tabs, and I always found the delay to see it in the tooltip annoying. These
quick tooltips have been introduced for the toolshelf and solve this issue
nicely here. There is still a delay so that simple mouse movements won't
trigger the tooltips, but they show up a lot faster than normal tooltips now.

This may have the side-effect that icon only enum-item buttons will show the
enum name when there is no RNA property description. Previously we wouldn't
show this, even if available.

Pull Request: blender/blender#106906
2023-04-14 11:43:20 +02:00
33bfbb2a0c USD IO: Move to the new Mesh Attributes API for Colors
This revision moves the vertex color reading and writing in the USD import and export functions over to the new Mesh Attributes API. I have removed anything else (new features or unnecessary changes) that was present in the prior patches to focus only on this task.

On the import side, I've introduced a class method named read_custom_data. In this function is the call-out for reading mesh colors. As requested, this function is intended to be the starting point for future Attribute reads, with methods like the new read_color_data* methods being called when a USD primvar matches a specific heuristic. UVs will (in the future, not in this revision) also need to be processed here. In a later patch, any primvars that do not match a heuristic can be imported as generic Attributes. There is a matching function on the export side, write_custom_data.

Attached is a .blend file for testing. The plane has five Color Attributes. The colors should be visibly the same when exported and re-imported.

I have also enabled color attribute imports by default. I believe it would be counter intuitive for most users for this feature to be off-- it means that at some point, a person round-tripping with default settings will lose data.

Pull Request: blender/blender#105347
2023-04-14 11:05:26 +02:00
86b39e0aac Vulkan: Fix Compilation Issue on Windows.
Vulkan uses IMath. IMath on windows requires an option to indicate
it is used as dll file. This option wasn't set for the GPU module.

Thanks to Kazashi Yoshioka for mentioning this.

Pull Request: blender/blender#106932
2023-04-14 10:17:35 +02:00
46385c0221 Merge branch 'main' into cycles-light-linking 2023-04-14 09:59:45 +02:00
71c4b7f1d0 Fix compilation warning
GHOST_getClipboardImage expects signed integers to be passed by pointer.

Pull Request: blender/blender#106933
2023-04-14 09:58:30 +02:00
26dc9f90d2 Fix: Metal null buffer initialization
Buffer wasn't actually initialized and read out of bounds.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#106807
2023-04-14 07:59:45 +02:00
2745cacd95 Fix #106704: Resolve flashing Metal viewport
Previous fix to resolve GPU hang which could occur in the
Metal backend caused additional flickering to occur as
as side effect, due to removal of required execution
dependencies in certain places.

This patch resolves both problems by only removing the
GPU hang dependency stall when additional synchronization
primitives are used along-side the global sync primitive.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#106914
2023-04-14 07:54:08 +02:00
dc1b36f288 Cleanup: correct naming of struct member comments
Also reduce right-shift for DupliGenerator declarations.
2023-04-14 14:33:28 +10:00
26aa1b1367 Cleanup: correct doc-string & naming for BMUVOffsets access function
Changes to [0] which worked as intended but used confusing naming.

- The note on using -1 for the active layer causes an assertion.
- The doc-string was above the wrong function.
- The meaning of the `_n()` suffix was flipped,
  where the `layer_index_n` refers to an absolute index across all
  layer types which is done internally for an index calculated from the
  `layer` argument, not the argument it's self which is a UV index.
  Rename BM_uv_map_get_offsets_n to BM_uv_map_get_offsets_from_layer.

[0]: 412b6a8f65
2023-04-14 14:33:25 +10:00
37b7702d74 Cleanup: comment blocks, #if 0 commented code 2023-04-14 13:51:38 +10:00
1633fca4a4 Cleanup: order return arguments last, minor doc-string clarification 2023-04-14 13:36:49 +10:00
a3e954e0a7 UV: paste now skips tagging objects for update when they aren't changed 2023-04-14 13:36:49 +10:00
39bcf6bdc9 UI: Allow Clipboard Copy/Paste Images
Adds operators to copy and paste to and from the OS clipboard, but only
implemented for Windows.

Pull Request: blender/blender#105833
2023-04-14 03:48:17 +02:00
29c2722753 Cleanup: remove stray white-space & redundant addition 2023-04-14 11:25:59 +10:00
89aa86cb0a Cleanup: remove unused ImBuf::c_handle
Cache limiting is implemented in moviecache.cc.
Marked for possible removal in 2011.
2023-04-14 11:25:10 +10:00
3fadaa4fca Cleanup: Remove unused PBVH "respect hide" variable
Pull Request: blender/blender#106832
2023-04-13 22:15:01 +02:00
dda9c59044 Cleanup: remove useless macro
Could cause:
```
warning C4005: 'DIAL_RESOLUTION': macro redefinition
```

Missed in 97c05aa288
2023-04-13 16:02:23 -03:00
97c05aa288 Transform: improve visualization when dragging Gizmos
Apply the changes suggested at #103782

It includes:
- Draw dot at the origin the active gizmo
- Hide other gizmos while dragging (except the move arrows)

Other changes:
- Draw shadow for the move and scale circle gizmos (while transforming)

Pull Request: blender/blender#104624
2023-04-13 20:23:03 +02:00
bdd6e617ea Cleanup: expose utility that finds a gizmo through its properties
Some properties may have the pointer stored in the gizmo structure
itself.

Reading from the struct directly is useful for cases where the value is
accessed frequently but not often required by the caller.

A disadvantage is that the property may not be saved in the file.
2023-04-13 15:18:44 -03:00
fa13058fa6 UI: Color Picker Positioning
If there is not enough space for the Color Picker either above or below
the launching button, adjust the position to fit instead of clipping.

Pull Request: blender/blender#106122
2023-04-13 19:44:54 +02:00
71ed98debe Point Cloud: Avoid unnecessarily initializing initial positions
Similar to e35f971da1. We aren't meant to rely on the
zero-initiatialization on creation anyway. I observed a small (a few
percent) decrease in minimum runtime in the geometry nodes points node.
2023-04-13 12:49:16 -04:00
197e9b9f80 Cleanup: Use more descriptive function name in extrude node 2023-04-13 12:49:16 -04:00
a7bee90c1d Cleanup: Add access method for point cloud positions
The position attribute has special meaning for point clouds, and
meshes and curves have access methods for the attribute as well.
This saves boilerplate and gives more consistency between types.
2023-04-13 12:49:16 -04:00
cef128e68a Fix menu padding in Console editor header
The View menu was a few pixels to the right compared to all other editors.
2023-04-13 18:06:12 +02:00
5ba35b3d15 Fix #106748: Rendering with OSL fails with OPTIX_ERROR_PIPELINE_LINK_ERROR
The OSL GPU services implementation of noise intrinsics was missing the
overloads for derivatives and therefore OptiX pipeline creation would fail if
those were referenced.
2023-04-13 15:52:23 +02:00
936e608382 Cleanup: Deduplicate curves data-block copying
After 7eee378ecc, the logic is the same in the
CurvesGeometry copy constructor and the curves data-block
copying.
2023-04-13 09:26:13 -04:00
1db918f948 Fix #106901: Dangling pointer after freeing mesh runtime data
This lead to a double-free when deleting the mesh runtime
struct after explicitly clearing the derived caches separately.
2023-04-13 09:21:22 -04:00
7eee378ecc Custom Data: support implicit sharing for custom data layers
This integrates the new implicit-sharing system (from fbcddfcd68)
with `CustomData`. Now the potentially long arrays referenced by custom
data layers can be shared between different systems but most importantly
between different geometries. This makes e.g. copying a mesh much cheaper
because none of the attributes has to be copied. Only when an attribute
is modified does it have to be copied.

Also see the original design task: #95845.

This reduces memory and improves performance by avoiding unnecessary
data copies. For example, the used memory after loading a highly
subdivided mesh is reduced from 2.4GB to 1.79GB. This is about 25%
less which is the expected amount because in `main` there are 4 copies
of the data:
1. The original data which is allocated when the file is loaded.
2. The copy for the depsgraph allocated during depsgraph evaluation.
3. The copy for the undo system allocated when the first undo step is
  created right after loading the file.
4. GPU buffers allocated for drawing.

This patch only gets rid of copy number 2 for the depsgraph. In theory
the other copies can be removed as part of follow up PRs as well though.

-----

The patch has three main components:
* Slightly modified `CustomData` API to make it work better with implicit
  sharing:
  * `CD_REFERENCE` and `CD_DUPLICATE` have been removed because they are
    meaningless when implicit-sharing is used.
  * `CD_ASSIGN` has been removed as well because it's not an allocation
    type anyway. The functionality of using existing arrays as custom
    data layers has not been removed though.
  * This can still be done with `CustomData_add_layer_with_data` which
    also has a new argument that allows passing in information about
    whether the array is shared.
  * `CD_FLAG_NOFREE` has been removed because it's no longer necessary. It
    only existed because of `CD_REFERENCE`.
  * `CustomData_copy` and `CustomData_merge` have been split up into a
    functions that do copy the actual attribute values and those that do
    not. The latter functions now have the `_layout` suffix
    (e.g. `CustomData_copy_layout`).
* Changes in `customdata.cc` to make it actually use implicit-sharing.
* Changes in various other files to adapt to the changes in `BKE_customdata.h`.

Pull Request: blender/blender#106228
2023-04-13 14:57:57 +02:00
7e764ec692 GPU: Texture: Expose depth dimension extent
This function was not exposed outside of internal GPU module.

Renaming `draw::Texture::depth()` to `is_depth` for consistency
and removing the ambiguity.
2023-04-13 14:06:53 +02:00
aa6e95281f Add support for OpenPGL 0.5.0
Some functions changed slightly for this non beta release.
No functional changes though as we didn't use what was removed.

Pull Request: blender/blender#106861
2023-04-13 11:44:35 +02:00
c26083b6be Fix warning in the STL code
The fast_float is an external library, so move it to the
system includes which has less strict compiler flags applied.

This matches how other IO module use this library as well.

Pull Request: blender/blender#106892
2023-04-13 11:06:42 +02:00
e5d50b1787 Fix Cycles unknown passes logged when build with Cycles debug
When WITH_CYCLES_DEBUG is set to ON the following errors are
printed to the console:

E0412 15:51:22.588564 7996345 sync.cpp:737] Unknown pass Guiding Color
E0412 15:51:22.588605 7996345 sync.cpp:737] Unknown pass Guiding Probability
E0412 15:51:22.588613 7996345 sync.cpp:737] Unknown pass Guiding Average Roughness

This change fixes this by treating the guiding passes the same
way as all other passes, solving the errors and making it possible
to visualize guiding passes in the viewport later on.

Pull Request: blender/blender#106863
2023-04-13 10:27:07 +02:00
34739f6a6d Fix #106672: MacOS/OpenGL doesn't draw anything Eevee related.
This PR reverts the breaking part of the #106535. This part doesn't seem
to be required to fix the HD4400-HD5500 issue.

Might also fix #106844.

Pull Request: blender/blender#106887
2023-04-13 10:18:44 +02:00
a899d57e57 Fix: Ignore hidden FCurves when framing y-extents
On hitting normalize,
when the y-extents of the Graph Editor are framed to the FCurves,
it didn't ignore hidden FCurves.
2023-04-13 09:52:05 +02:00
0e5c941049 Fix #106773: resolve Metal grease pencil fill
Changes to viewport state to resolve texture paint color
selection introduced a side effect wherein the correct
attachment size of a framebuffer was reset. This size is
needed when scissor regions are disabled to return the
state to its correct default. When this default was wrong,
certain operators would have incorrect offsets.

To maintain consistency with the OpenGL backend, the
Metal backend independently tracks the raw attachment
size using default_width/height. This will also reset to zero
when attachments are all removed, unlike other state which
may be retained.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#106857
2023-04-13 08:23:34 +02:00
ed4374f089 Fix #66722: file doesn't open if app not focused
After double clicking a file, user can click on a different app and
Blender will lose focus. Then it stays on splash screen. So fetch any
window instead of relying on active one to open the file.

pull request #106769
2023-04-13 10:48:29 +05:30
0a270e3513 Revert "GHOST/Wayland: avoid up-scaling window content"
This reverts commit 4fe2685615.

Always use the preferred_scale requested by the compositor as this
did not work so well in the intended use case (where the low resolution
monitor text was scaled down and difficult to see).

After discussion with @ZedDB, revert this change since there are cases
where either functionality might be preferred - to ensure Blender's UI
is visible on a low resolution mirrored projector for e.g.

Changing the behavior of the preferred scale makes most sense in the
compositor, instead of controlling it on a per-application basis.
2023-04-13 13:14:24 +10:00
684dcd3680 CMake: use GCC's -fuse-ld=mold support (mold now requires GCC 12.1)
GCC did not support mold when support was initially added,
since then GCC has been updated to add support, removing the need
to point to a binary directory containing an alternative `ld` command.

Support for MOLD_BIN CMake option has been kept as mold may be installed
to standard location.
2023-04-13 13:14:19 +10:00
a7462f58d1 Fix missing import for DJV on APPLE
We might removing support for this if it's not used,
correct the import for now.
2023-04-13 13:14:17 +10:00
11ad851fbe Fix lightmap UV calculation ignoring unselected objects in edit-mode 2023-04-13 13:14:15 +10:00
ad5ec544c8 Cleanup: remove unused apply-image option from uvcalc_lightmap
Note that this was a quick update from Blender 2.4's API,
while many other improvements could be made - remove this option as
it does nothing.
2023-04-13 13:14:13 +10:00
61cb302dd5 Cleanup: sort cmake file lists 2023-04-13 13:14:11 +10:00
678dc456e3 Cleanup: remove duplicate class
Introduced in ba982119cd.
2023-04-13 13:14:09 +10:00
14905cd1d5 Cleanup: quiet pylint's inconsistent-return-statements warning
No functional changes as the return value either relied on None
evaluating to False or wasn't used.
2023-04-13 13:14:06 +10:00
6482f9fffe Cleanup: quiet various pylint warnings 2023-04-13 13:14:05 +10:00
84e72e8170 Cleanup: remove duplicate assignments, assign 'layout' early in draw(..)
Also remove unused assignments.
2023-04-13 13:14:03 +10:00
ab64bd264a Cleanup: consistent naming for tool_settings & operator properties
Use names:
- `tool_settings` instead of `ts`.

- `props` instead of `op` / `prop` / `op_props`
  As Python may reference operators, don't confuse the operator
  properties with an instance of the operator.

In both cases these names were already used for most scripts.
2023-04-13 13:14:01 +10:00
b0edd63752 Cleanup: avoid early imports, remove unused variable 2023-04-13 13:13:59 +10:00
741d8dc1e2 Cleanup: format, use C++ nullptr & function style casts 2023-04-13 13:13:57 +10:00
4bccbceb34 Cleanup: quiet GCC warnings 2023-04-13 13:13:56 +10:00
35071af465 Sculpt: Fix #104631: Tip Roundness on Paint brush causes jitering
I cleaned up the cube brush tip code quite a bit; more remains
to be done.  There is a new function to initialize cube
tip matrices, SCULPT_cube_tip_init.  It's currently only
used by the paint brush, I'll need to do a bit of testing
before using it for clay strips and multiplane scrape.

Note: SCULPT_cube_tip_init uses the brush local matrix code
to avoid code duplication (and to take advantage of the debouncing
that is done there).
2023-04-12 18:33:53 -07:00
d48939f103 Cleanup: Simplify uv packing engine
Migrating to use uv_phi[] for placement.
2023-04-13 10:05:19 +12:00
5ba30e07f2 Cleanup: Simplify uv packing api
Migrating preprocessing into the packing engine.
2023-04-13 10:01:43 +12:00
ecfdbaef9b Cleanup: format 2023-04-13 09:58:15 +12:00
2b565c6bd0 UI: Add slash character support to fuzzy search initials mode
Nodes with names separated by a slash / can
not be searched by their initials.

This commit adds the slash character to
the list of separators for this type of
fuzzy search.

Pull Request: blender/blender#106838
2023-04-12 23:53:36 +02:00
01e47b435f Light linking: use default light set if no object, instead of all lights 2023-04-07 20:17:17 +02:00
bdb905ddfa Refactor: split feature and define between light and shadow linking 2023-04-07 20:14:53 +02:00
9af07e8a58 Merge branch 'main' into cycles-light-linking 2023-04-07 16:51:50 +02:00
87ae0546c3 Fix shadow linking on GPU in complex scenes
The memory saving trick to re-use intersection array to store the ray self
primitives does not work reliably when there are more than 4 transparent
intersections: second time the shadow intersection kernel is invoked the
self primitives are assigned to the intersection result from the previous
kernel execution.

This did not manifest as an issue to artists before because the indices
were from the corresponding entities: self light object was stored in the
object index, and the light primitive was stored in the primitive index.
This would lead to a incorrect render result (worst case), but will not
lead to the off-the-bounds array access.

With the light ID the same trick does lead to the off-the-bounds access
as there is likely to be more objects than lights in the scene.

Likely there was unused `object` field in the `shadow_ray` of the shadow
path state, which seemed to have been always allocated. This field is now
renamed to `self_light` and the light index for the shadow linking is stored
there. This makes it possible to have reliable way of accessing light data
from the intersection kernel, as well as should lower the memory usage for
the scenes where no light linking is used.

It is not really clear what is the best way of solving the rest of the
shadow ray self primitives issue. Perhaps, save more memory in the state
and store those indices explicitly.

Even despite an extra condition added the performance is within a noise
floor different in the benchmark scenes.
2023-04-06 11:43:12 +02:00
3f3be72f2e Refactor: Move shadow ray self primitives read/write to utilities 2023-04-06 10:14:55 +02:00
28a0cf67fd Fix possible uninitialized access to ray self light
Make the volume shadow ray consistent with the surface.
2023-04-05 17:07:47 +02:00
4d13933e2e Fix uninitialized masks for the light linking sets builder 2023-04-05 12:37:13 +02:00
51136250c2 Merge branch 'main' into cycles-light-linking 2023-04-04 13:00:22 +02:00
7724c87167 Light linking: Initial support of shadow linking
The shadow linking is based on the Shadow State settings in the
light linking collection:

- None: the object is not shadow linked to the emitter

- Include: the object casts the shadow when lit by the emitter
  (and the emitter does not cast shadows from objects which are
  not linked to it).

- Exclude: the object does not cast shadow when is lit by the
  emitter (but the emitter casts shadows from other objects).

Linking shadows to the emitter implicitly disables MIS for lamps.
This is because getting MIS+shadow linking to work needs more
time (and it's not that trivial). The MIS for mesh emitters is
not disabled automatically, as it is a bit tricky: the MIS is a
shader setting, not an object setting.

The MIS support will be worked on later.

Another limitation is the Metal RT support which does not support
shadow linking yet, Need to get a development environment where
compilation takes less than 10min per kernel.

Ref #104972
2023-04-03 16:52:34 +02:00
745523604e Light linking: Initial implementation of shadow linking sets
Works similar to the light linking sets, just uses different set of
bit masks and the settings are coming from the collection shadow state.

Ref #104972
2023-04-03 16:52:22 +02:00
011bba9f46 Light linking: Use more deterministic linking order
This change fixes confusion when a collection is added to
the light linking collection and is excluded, and an object
from that collection is added to the same light linking
collection and is included.

The mental model is: the more detailed object information
wins. IN a case of a tie the latest specification wins.

The current limitation is that it is very hard to re-order
the light linking collection in the list representation.
This will be worked on further after the underlying supports
hinting about items being dropped in-between of elements.

Ref #104972

Pull Request: blender/blender#106389
2023-03-31 16:03:28 +02:00
80833a7c21 Merge branch 'main' into cycles-light-linking 2023-03-31 11:54:05 +02:00
741a5bc734 Cleanup: Remove fullstop from file headers
Make style consistent with the rest of the Blender and Cycles.
2023-03-30 11:25:04 +02:00
9f103c4d65 Merge branch 'main' into cycles-light-linking 2023-03-30 11:20:51 +02:00
33176b4e74 Cleanup: Remove checks for reports not being nullptr
If the reports are nullptr then the report is printed to the console.
2023-03-30 11:05:00 +02:00
2bd6a435d5 Light linking: Optimize memory usage during build
The idea is to replace the actual sets with corresponding
collection bitmasks during build.

The code generalizes some accessors and moves code around
to hopefully help readability. It fees like some of the
concepts will be needed for the shadow linking, but deeper
generalization is better to happen once we start working
on it.

Ref #104972
2023-03-30 10:59:15 +02:00
5480a03d68 Light linking: Implement light exclusion
Allows to easily exclude specific objects from specific lights by linking
the object to the light ans setting Light State to Exclude.

The dependency graph builder is reworked once more and now it does more
explicit tracking of receiver-centric view.

The downside of this is that it kind of cancels out the memory optimization
from previous change in the builder from Brecht.

The upside is that the code is much easier to follow.

The mitigation for the increased memory consumption during the build is to
clear the receiver-centric view after the light linking has finished building.
This makes it so the overall memory footprint of the dependency graph does not
change that much at all. This is because the extra memory used by the light
linking builder is freed before the relations builder. This means that there
are no relations crated yet, and no temporary memory is used by the relation
builder (and it could be a lot!). So from the overall dependency graph build
process this change is very unlikely to become a problem.

Note that this does not mean optimizations would not happen in the future,
but it will be easier to do them once the shadow linking is laid down, and
thee are automated regression tests to help catching possible issues.

Alternatively, depending on a desired UI representations and the USD
integration we might decide that having the receiver view cached is good
to have.

Ref #104972
2023-03-29 16:54:30 +02:00
1b84a2655d Light linking: Use new inclusion flags for light linking
This change makes it so the INCLUDE light linking state is handled
the way it is expected to.

The exclusion flags and shadow linking is still not taken into
account.

Ref #104972
2023-03-29 16:54:30 +02:00
8ccb8d1195 Light linking: Initialize light linking state for receivers
Makes it so the linking receivers to emitter via an operator or
drag-n-drop initialized the light linking sate to INCLUDE.

Ref #104972
2023-03-29 16:54:30 +02:00
5bec5a4508 Light linking: Interface for inclusion/exclusion, as well as shadow linking
The membership in the light linking collection now has two extra options:
light state and shadow state. They define the relation of the emitter such
as inclusion/inclusion to the light reception, and same thing for shadow
casting.

The masks calculated in the dependency graph needs to be adjusted to use
the new logic. Currently they still only consider the membership in the
light linking collection.

Ref #104972
2023-03-29 16:54:30 +02:00
9dc5537053 Refactor: Generalize concept of the light linking collection
The plan is to have a single collection set up for the ling linking
which will control inclusion/exclusion of the light contribution.

Ref #104972
2023-03-29 16:54:30 +02:00
8e898214cc Light linking: Set minimal height for the light linking collection list
Makes it easier to drop new items into a collection which is yet empty.
2023-03-29 14:10:19 +02:00
b8a258a1d5 Merge branch 'main' into cycles-light-linking 2023-03-28 15:58:49 +02:00
21e34b5a6f Fix integer overflows, the left side of << must be uint64_t 2023-03-28 15:08:52 +02:00
98861a8912 Fix wrong active object used in light linking operators
Allow using object used from the pinned context.
2023-03-27 15:04:27 +02:00
080a166b5a Cycles: compute unique light sets for light linking
We plan to build specialized light trees for every unique set of light
emitters. This requires knowing unique combinations of lights used by
receiver. However for easier library linking and USD compatibility the
relation is stored in the opposite direction.

This modifies the depsgraph and Cycles code to compute and use a unique
bit for every combination of lights.

Pull Request: blender/blender#106115
2023-03-24 17:12:31 +01:00
cef041f46b Fix removal from light linking collection from pinned context 2023-03-24 16:54:26 +01:00
22f772504d Fix ID name reported when removing object from non-existing light linking 2023-03-24 16:36:29 +01:00
ff2e6d4268 Fix missing undo push on light linking drop event 2023-03-24 16:35:51 +01:00
97b089ace0 Light linking: Implement drop on the receiver collection list
It is possible to drop objects and collections onto the receiver collection
list in the shading panel of object to add them to the collection.

Is not as useful yet as it could be: we need to make the list to have some
minimum height to make it possible to drop on the empty collection.

Ref #104972

Pull Request: blender/blender#106101
2023-03-24 14:31:03 +01:00
fbc35f9a23 Cleanup: Strict compiler warnings in the light linking 2023-03-24 12:29:29 +01:00
941b61573c Merge branch 'main' into cycles-light-linking 2023-03-24 11:54:37 +01:00
d939188006 Fix light linking template for changes in the main branch 2023-03-23 12:16:43 +01:00
ac2d129f45 Merge branch 'main' into cycles-light-linking 2023-03-23 11:43:49 +01:00
c15c8d80fd Fix Cycles test after addition of uint64 socket type
Need to add a type map to the `SocketType::type_name`, otherwise
the naming of types (used for conversion, i.e.) is off.

Also, added a static assert to help detecting such mismatch early
in in the future.

Pull Request: blender/blender#105984
2023-03-22 11:53:20 +01:00
f1e883a986 Light linking: Implement link operator
Is available via the Ctrl-L menu, where there is now an entry
to link selected receivers to the active emitter.
2023-03-21 15:42:08 +01:00
a922746065 Light linking: Implement operator to select receivers of the emitter
Handy for lighting artists to investigate the scenes.
2023-03-21 14:57:13 +01:00
e7d239313f Light linking: Implement unlinking from the receiver collection
Is visualized as an "X" button when hovering items in the receiver
collection list. The behavior is the same as in outliner's Unlink
operation.
2023-03-21 14:27:53 +01:00
5438cdd623 Light linking: Initial collection interface implementation
The goal is to have some list-looking widget where a content of
a light-linking-specific collection can be managed. The imagined
workflow is:

- Add a new collection for the receiving collection
- This will show a list of the top-level elements in the collection
- Drag-drop objects and collections which needs to be linked to the
  emitter.

Currently the implementation is limited to creation of the new
receiver collection, and visualization the content.
2023-03-21 14:27:53 +01:00
946e3e599d Depsgraph: Add explicit object collection hierarchy tracking
The practical problem this change fixes is the Cycles render
re-set on object selection.

The described behavior was introduced in the initial light
linking evaluation implementation which was only possible in the
same manner as the base flags evaluation. This is because the
outliner does not provide explicit tag when object or collection
is moved across collections.

This change limits the number of objects which are updating
their receiver mask and are updated on the Cycles side.

Pull Request: blender/blender#105837
2023-03-21 14:00:20 +01:00
aa6fa874f2 Fix: Missing relations for nested receiver collections 2023-03-17 15:43:21 +01:00
f9d4acfaa9 Cycles: Hook up emitter/receiver flags from Blender
Ref #104972
2023-03-16 13:45:38 +01:00
a91669d1e6 Light linking: Implementation of dependency graph evaluation
The idea is to make it so all pre-computation is done by the
dependency graph, and accessed by render engines without extra
tricky accumulation logic on their side.

Ref #104972
2023-03-16 13:45:38 +01:00
8807c4edab Refactor instanced collection relation builder in depsgraph
Move the instancing related code to a dedicated function, leaving
the generic `build_collection()` dedicated to the building of the
collection itself.

Should be no functional changes: the code paths should effectively
still be the same. This is because non-instancing cases were passing
object as a null pointer, disabling the non-generic code path.
2023-03-16 13:45:38 +01:00
8046efda4a Light linking: initial DNA and RNA implementation
The light linking is defined by a collection which contains objects
which are receiving light. The collection itself is stored on a light
emitters.

In order to support both lamps and mesh lights the collection is
stored on the Object level.

The collection is referenced: as in, it is not one of those embedded
collections.

The dependency graph needs more work, as it currently designed to
use collections as an instancing entity. So, some refactor is needed.

Ref #104972
2023-03-16 13:45:38 +01:00
b642b2c773 Cycles: start of light linking implementation
Inefficient in many ways, purpose is to first get something working correctly
with multiple importance sampling, transparency, volumes, etc.

Also abuses pass index as a stand-in for proper data from Blender.

Ref #104972
2023-03-16 13:45:38 +01:00
71df854747 Cycles: add uint64 socket type for bitmasks 2023-03-16 13:45:38 +01:00
3140 changed files with 109879 additions and 78266 deletions

View File

@@ -62,7 +62,7 @@ ContinuationIndentWidth: 4
BreakBeforeBraces: Custom
BraceWrapping: {
AfterClass: 'false',
AfterControlStatement: 'false',
AfterControlStatement: 'MultiLine',
AfterEnum : 'false',
AfterFunction : 'true',
AfterNamespace : 'false',

View File

@@ -102,3 +102,6 @@ b5d310b569e07a937798a2d38539cfd290149f1c
# Cleanup: clang-format.
40d4a4cb1a6b4c3c2a486e8f2868f547530e0811
# Code Style: format (with BraceWrapping::AfterControlStatement "MultiLine").
6859bb6e67031765e79e525ae62bf2ebf4df2330

View File

@@ -503,7 +503,7 @@ if(NOT APPLE)
mark_as_advanced(WITH_CYCLES_DEVICE_CUDA)
option(WITH_CYCLES_CUDA_BINARIES "Build Cycles NVIDIA CUDA binaries" OFF)
set(CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 sm_70 sm_75 sm_86 compute_75 CACHE STRING "CUDA architectures to build binaries for")
set(CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 sm_70 sm_75 sm_86 sm_89 compute_75 CACHE STRING "CUDA architectures to build binaries for")
option(WITH_CYCLES_CUDA_BUILD_SERIAL "Build cubins one after another (useful on machines with limited RAM)" OFF)
option(WITH_CUDA_DYNLOAD "Dynamically load CUDA libraries at runtime (for developers, makes cuda-gdb work)" ON)
@@ -521,9 +521,16 @@ endif()
if(NOT APPLE)
option(WITH_CYCLES_DEVICE_HIP "Enable Cycles AMD HIP support" ON)
option(WITH_CYCLES_HIP_BINARIES "Build Cycles AMD HIP binaries" OFF)
set(CYCLES_HIP_BINARIES_ARCH gfx900 gfx906 gfx90c gfx902 gfx1010 gfx1011 gfx1012 gfx1030 gfx1031 gfx1032 gfx1034 gfx1035 gfx1100 gfx1101 gfx1102 CACHE STRING "AMD HIP architectures to build binaries for")
# Radeon VII (gfx906) not currently working with HIP SDK, so left out of the list.
set(CYCLES_HIP_BINARIES_ARCH gfx900 gfx90c gfx902 gfx1010 gfx1011 gfx1012 gfx1030 gfx1031 gfx1032 gfx1034 gfx1035 gfx1100 gfx1101 gfx1102 CACHE STRING "AMD HIP architectures to build binaries for")
mark_as_advanced(WITH_CYCLES_DEVICE_HIP)
mark_as_advanced(CYCLES_HIP_BINARIES_ARCH)
# HIPRT is only available on Windows for now.
if(WIN32)
option(WITH_CYCLES_DEVICE_HIPRT "Enable Cycles AMD HIPRT support" OFF)
mark_as_advanced(WITH_CYCLES_DEVICE_HIPRT)
endif()
endif()
# Apple Metal
@@ -644,6 +651,12 @@ if(WIN32)
set(CPACK_INSTALL_PREFIX ${CMAKE_GENERIC_PROGRAM_FILES}/${})
endif()
option(WITH_STRSIZE_DEBUG "\
Ensure string operations on fixed size buffers \
(works well with with \"WITH_COMPILER_ASAN\" & valgrind to detect incorrect buffer size arguments)"
OFF)
mark_as_advanced(WITH_STRSIZE_DEBUG)
# Compiler tool-chain.
if(UNIX)
if(CMAKE_COMPILER_IS_GNUCC)
@@ -1580,6 +1593,9 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_NORETURN -Wno-missing-noreturn)
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_BUT_SET_VARIABLE -Wno-unused-but-set-variable)
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_STRICT_PROTOTYPES -Wno-strict-prototypes)
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_BITWISE_INSTEAD_OF_LOGICAL -Wno-bitwise-instead-of-logical)
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_IMPLICIT_CONST_INT_FLOAT_CONVERSION -Wno-implicit-const-int-float-conversion)
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PRIVATE_FIELD -Wno-unused-private-field)
@@ -1593,6 +1609,8 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNDEFINED_VAR_TEMPLATE -Wno-undefined-var-template)
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_INSTANTIATION_AFTER_SPECIALIZATION -Wno-instantiation-after-specialization)
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_MISLEADING_INDENTATION -Wno-misleading-indentation)
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_BITWISE_INSTEAD_OF_LOGICAL -Wno-bitwise-instead-of-logical)
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_IMPLICIT_CONST_INT_FLOAT_CONVERSION -Wno-implicit-const-int-float-conversion)
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
@@ -1977,10 +1995,13 @@ if(FIRST_RUN)
info_cfg_option(WITH_CYCLES_DEVICE_OPTIX)
info_cfg_option(WITH_CYCLES_DEVICE_CUDA)
info_cfg_option(WITH_CYCLES_CUDA_BINARIES)
info_cfg_option(WITH_CYCLES_DEVICE_HIP)
info_cfg_option(WITH_CYCLES_HIP_BINARIES)
info_cfg_option(WITH_CYCLES_DEVICE_ONEAPI)
info_cfg_option(WITH_CYCLES_ONEAPI_BINARIES)
info_cfg_option(WITH_CYCLES_DEVICE_HIP)
info_cfg_option(WITH_CYCLES_HIP_BINARIES)
endif()
if(WIN32)
info_cfg_option(WITH_CYCLES_DEVICE_HIPRT)
endif()
endif()

View File

@@ -58,9 +58,6 @@ Static Source Code Checking
* check_cppcheck: Run blender source through cppcheck (C & C++).
* check_clang_array: Run blender source through clang array checking script (C & C++).
* check_deprecated: Check if there is any deprecated code to remove.
* check_splint: Run blenders source through splint (C only).
* check_sparse: Run blenders source through sparse (C only).
* check_smatch: Run blenders source through smatch (C only).
* check_descriptions: Check for duplicate/invalid descriptions.
* check_licenses: Check license headers follow the SPDX license specification,
using one of the accepted licenses in 'doc/license/SPDX-license-identifiers.txt'
@@ -474,21 +471,6 @@ check_clang_array: .FORCE
@cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_clang_array.py"
check_splint: .FORCE
@$(CMAKE_CONFIG)
@cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_splint.py"
check_sparse: .FORCE
@$(CMAKE_CONFIG)
@cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py"
check_smatch: .FORCE
@$(CMAKE_CONFIG)
@cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_smatch.py"
check_mypy: .FORCE
@$(PYTHON) "$(BLENDER_DIR)/tools/check_source/check_mypy.py"

View File

@@ -90,28 +90,26 @@ include(cmake/haru.cmake)
# Boost needs to be included after `python.cmake` due to the PYTHON_BINARY variable being needed.
include(cmake/boost.cmake)
include(cmake/pugixml.cmake)
include(cmake/ispc.cmake)
include(cmake/openimagedenoise.cmake)
include(cmake/embree.cmake)
include(cmake/openpgl.cmake)
include(cmake/fmt.cmake)
include(cmake/robinmap.cmake)
include(cmake/xml2.cmake)
include(cmake/fribidi.cmake)
include(cmake/harfbuzz.cmake)
if(NOT APPLE)
include(cmake/xr_openxr.cmake)
if(NOT WIN32 OR BUILD_MODE STREQUAL Release)
include(cmake/dpcpp.cmake)
include(cmake/dpcpp_deps.cmake)
endif()
include(cmake/dpcpp.cmake)
include(cmake/dpcpp_deps.cmake)
if(NOT WIN32)
include(cmake/igc.cmake)
include(cmake/gmmlib.cmake)
include(cmake/ocloc.cmake)
endif()
endif()
include(cmake/ispc.cmake)
include(cmake/openimagedenoise.cmake)
# Embree needs to be included after dpcpp as it uses it for compiling with GPU support
include(cmake/embree.cmake)
include(cmake/openpgl.cmake)
include(cmake/fmt.cmake)
include(cmake/robinmap.cmake)
include(cmake/xml2.cmake)
# OpenColorIO and dependencies.
include(cmake/expat.cmake)

View File

@@ -156,6 +156,7 @@ download_source(OPENCLHEADERS)
download_source(ICDLOADER)
download_source(MP11)
download_source(SPIRV_HEADERS)
download_source(UNIFIED_RUNTIME)
download_source(IGC)
download_source(IGC_LLVM)
download_source(IGC_OPENCL_CLANG)

View File

@@ -5,6 +5,9 @@
# for now.
string(REPLACE "-DCMAKE_CXX_STANDARD=17" " " DPCPP_CMAKE_FLAGS "${DEFAULT_CMAKE_FLAGS}")
# DPCPP already generates debug libs, there isn't much point in compiling it in debug mode itself.
string(REPLACE "-DCMAKE_BUILD_TYPE=Debug" "-DCMAKE_BUILD_TYPE=Release" DPCPP_CMAKE_FLAGS "${DPCPP_CMAKE_FLAGS}")
if(WIN32)
set(LLVM_GENERATOR "Ninja")
else()
@@ -38,17 +41,18 @@ set(DPCPP_EXTRA_ARGS
-DLEVEL_ZERO_LIBRARY=${LIBDIR}/level-zero/lib/${LIBPREFIX}ze_loader${SHAREDLIBEXT}
-DLEVEL_ZERO_INCLUDE_DIR=${LIBDIR}/level-zero/include
-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=${BUILD_DIR}/spirvheaders/src/external_spirvheaders/
-DUNIFIED_RUNTIME_SOURCE_DIR=${BUILD_DIR}/unifiedruntime/src/external_unifiedruntime/
# Below here is copied from an invocation of buildbot/config.py
-DLLVM_ENABLE_ASSERTIONS=ON
-DLLVM_TARGETS_TO_BUILD=X86
-DLLVM_EXTERNAL_PROJECTS=sycl^^llvm-spirv^^opencl^^libdevice^^xpti^^xptifw
-DLLVM_EXTERNAL_PROJECTS=sycl^^llvm-spirv^^opencl^^libdevice^^xpti^^xptifw^^lld
-DLLVM_EXTERNAL_SYCL_SOURCE_DIR=${DPCPP_SOURCE_ROOT}/sycl
-DLLVM_EXTERNAL_LLVM_SPIRV_SOURCE_DIR=${DPCPP_SOURCE_ROOT}/llvm-spirv
-DLLVM_EXTERNAL_XPTI_SOURCE_DIR=${DPCPP_SOURCE_ROOT}/xpti
-DXPTI_SOURCE_DIR=${DPCPP_SOURCE_ROOT}/xpti
-DLLVM_EXTERNAL_XPTIFW_SOURCE_DIR=${DPCPP_SOURCE_ROOT}/xptifw
-DLLVM_EXTERNAL_LIBDEVICE_SOURCE_DIR=${DPCPP_SOURCE_ROOT}/libdevice
-DLLVM_ENABLE_PROJECTS=clang^^sycl^^llvm-spirv^^opencl^^libdevice^^xpti^^xptifw
-DLLVM_ENABLE_PROJECTS=clang^^sycl^^llvm-spirv^^opencl^^libdevice^^xpti^^xptifw^^lld
-DLIBCLC_TARGETS_TO_BUILD=
-DLIBCLC_GENERATE_REMANGLED_VARIANTS=OFF
-DSYCL_BUILD_PI_HIP_PLATFORM=AMD
@@ -104,13 +108,20 @@ add_dependencies(
external_mp11
external_level-zero
external_spirvheaders
external_unifiedruntime
)
if(BUILD_MODE STREQUAL Release AND WIN32)
ExternalProject_Add_Step(external_dpcpp after_install
COMMAND ${CMAKE_COMMAND} -E rm -f ${LIBDIR}/dpcpp/bin/clang-cl.exe
COMMAND ${CMAKE_COMMAND} -E rm -f ${LIBDIR}/dpcpp/bin/clang-cpp.exe
COMMAND ${CMAKE_COMMAND} -E rm -f ${LIBDIR}/dpcpp/bin/clang.exe
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/dpcpp ${HARVEST_TARGET}/dpcpp
COMMAND ${CMAKE_COMMAND} -E rm -f ${HARVEST_TARGET}/dpcpp/bin/clang-cl.exe
COMMAND ${CMAKE_COMMAND} -E rm -f ${HARVEST_TARGET}/dpcpp/bin/clang-cpp.exe
COMMAND ${CMAKE_COMMAND} -E rm -f ${HARVEST_TARGET}/dpcpp/bin/clang.exe
COMMAND ${CMAKE_COMMAND} -E rm -f ${HARVEST_TARGET}/dpcpp/bin/ld.lld.exe
COMMAND ${CMAKE_COMMAND} -E rm -f ${HARVEST_TARGET}/dpcpp/bin/ld64.lld.exe
COMMAND ${CMAKE_COMMAND} -E rm -f ${HARVEST_TARGET}/dpcpp/bin/lld.exe
COMMAND ${CMAKE_COMMAND} -E rm -f ${HARVEST_TARGET}/dpcpp/bin/lld-link.exe
COMMAND ${CMAKE_COMMAND} -E rm -f ${HARVEST_TARGET}/dpcpp/bin/wasm-ld.exe
DEPENDEES install
)
endif()

View File

@@ -59,3 +59,13 @@ ExternalProject_Add(external_spirvheaders
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
)
ExternalProject_Add(external_unifiedruntime
URL file://${PACKAGE_DIR}/${UNIFIED_RUNTIME_FILE}
URL_HASH ${UNIFIED_RUNTIME_HASH_TYPE}=${UNIFIED_RUNTIME_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/unifiedruntime
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
)

View File

@@ -3,6 +3,8 @@
# Note the utility apps may use png/tiff/gif system libraries, but the
# library itself does not depend on them, so should give no problems.
set(EMBREE_CMAKE_FLAGS ${DEFAULT_CMAKE_FLAGS})
set(EMBREE_EXTRA_ARGS
-DEMBREE_ISPC_SUPPORT=OFF
-DEMBREE_TUTORIALS=OFF
@@ -12,6 +14,7 @@ set(EMBREE_EXTRA_ARGS
-DEMBREE_BACKFACE_CULLING=OFF
-DEMBREE_BACKFACE_CULLING_CURVES=ON
-DEMBREE_BACKFACE_CULLING_SPHERES=ON
-DEMBREE_NO_SPLASH=ON
-DEMBREE_TASKING_SYSTEM=TBB
-DEMBREE_TBB_ROOT=${LIBDIR}/tbb
-DTBB_ROOT=${LIBDIR}/tbb
@@ -31,6 +34,43 @@ if(NOT BLENDER_PLATFORM_ARM)
)
endif()
if(NOT APPLE)
if(WIN32)
# Levels below -O2 don't work well for Embree+SYCL.
string(REGEX REPLACE "-O[A-Za-z0-9]" "" EMBREE_CLANG_CMAKE_CXX_FLAGS_DEBUG ${BLENDER_CLANG_CMAKE_C_FLAGS_DEBUG})
string(APPEND EMBREE_CLANG_CMAKE_CXX_FLAGS_DEBUG " -O2")
string(REGEX REPLACE "-O[A-Za-z0-9]" "" EMBREE_CLANG_CMAKE_C_FLAGS_DEBUG ${BLENDER_CLANG_CMAKE_C_FLAGS_DEBUG})
string(APPEND EMBREE_CLANG_CMAKE_C_FLAGS_DEBUG " -O2")
set(EMBREE_CMAKE_FLAGS
-DCMAKE_BUILD_TYPE=${BUILD_MODE}
-DCMAKE_CXX_FLAGS_RELEASE=${BLENDER_CLANG_CMAKE_CXX_FLAGS_RELEASE}
-DCMAKE_CXX_FLAGS_MINSIZEREL=${BLENDER_CLANG_CMAKE_CXX_FLAGS_MINSIZEREL}
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=${BLENDER_CLANG_CMAKE_CXX_FLAGS_RELWITHDEBINFO}
-DCMAKE_CXX_FLAGS_DEBUG=${EMBREE_CLANG_CMAKE_CXX_FLAGS_DEBUG}
-DCMAKE_C_FLAGS_RELEASE=${BLENDER_CLANG_CMAKE_C_FLAGS_RELEASE}
-DCMAKE_C_FLAGS_MINSIZEREL=${BLENDER_CLANG_CMAKE_C_FLAGS_MINSIZEREL}
-DCMAKE_C_FLAGS_RELWITHDEBINFO=${BLENDER_CLANG_CMAKE_C_FLAGS_RELWITHDEBINFO}
-DCMAKE_C_FLAGS_DEBUG=${EMBREE_CLANG_CMAKE_C_FLAGS_DEBUG}
-DCMAKE_CXX_STANDARD=17
)
set(EMBREE_EXTRA_ARGS
-DCMAKE_CXX_COMPILER=${LIBDIR}/dpcpp/bin/clang++.exe
-DCMAKE_C_COMPILER=${LIBDIR}/dpcpp/bin/clang.exe
-DCMAKE_SHARED_LINKER_FLAGS=-L"${LIBDIR}/dpcpp/lib"
-DEMBREE_SYCL_SUPPORT=ON
${EMBREE_EXTRA_ARGS}
)
else()
set(EMBREE_EXTRA_ARGS
-DCMAKE_CXX_COMPILER=${LIBDIR}/dpcpp/bin/clang++
-DCMAKE_C_COMPILER=${LIBDIR}/dpcpp/bin/clang
-DCMAKE_SHARED_LINKER_FLAGS=-L"${LIBDIR}/dpcpp/lib"
-DEMBREE_SYCL_SUPPORT=ON
${EMBREE_EXTRA_ARGS}
)
endif()
endif()
if(TBB_STATIC_LIBRARY)
set(EMBREE_EXTRA_ARGS
${EMBREE_EXTRA_ARGS}
@@ -42,16 +82,25 @@ ExternalProject_Add(external_embree
URL file://${PACKAGE_DIR}/${EMBREE_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${EMBREE_HASH_TYPE}=${EMBREE_HASH}
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PREFIX ${BUILD_DIR}/embree
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/embree/src/external_embree < ${PATCH_DIR}/embree.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/embree ${DEFAULT_CMAKE_FLAGS} ${EMBREE_EXTRA_ARGS}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/embree ${EMBREE_CMAKE_FLAGS} ${EMBREE_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/embree
)
add_dependencies(
external_embree
external_tbb
)
if(NOT APPLE)
add_dependencies(
external_embree
external_tbb
external_dpcpp
)
else()
add_dependencies(
external_embree
external_tbb
)
endif()
if(WIN32)
if(BUILD_MODE STREQUAL Release)
@@ -66,6 +115,7 @@ if(WIN32)
ExternalProject_Add_Step(external_embree after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/bin/embree4_d.dll ${HARVEST_TARGET}/embree/bin/embree4_d.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree4_d.lib ${HARVEST_TARGET}/embree/lib/embree4_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree4_sycl_d.lib ${HARVEST_TARGET}/embree/lib/embree4_sycl_d.lib
DEPENDEES install
)
endif()

View File

@@ -46,7 +46,7 @@ ${temp_LIBDIR}/vpx/lib/pkgconfig:\
${temp_LIBDIR}/theora/lib/pkgconfig:\
${temp_LIBDIR}/openjpeg/lib/pkgconfig:\
${temp_LIBDIR}/opus/lib/pkgconfig:\
${temp_LIBDIR}/aom/lib/pkgconfig"
${temp_LIBDIR}/aom/lib/pkgconfig:"
)
unset(temp_LIBDIR)

View File

@@ -2,35 +2,45 @@
set(FFTW_EXTRA_ARGS)
if(WIN32)
set(FFTW3_PATCH_COMMAND ${PATCH_CMD} --verbose -p 0 -N -d ${BUILD_DIR}/fftw3/src/external_fftw3 < ${PATCH_DIR}/fftw3.diff)
set(FFTW_EXTRA_ARGS --disable-static --enable-shared)
set(FFTW_INSTALL install-strip)
else()
set(FFTW_EXTRA_ARGS --enable-static)
set(FFTW_INSTALL install)
endif()
macro(fftw_build FFTW_POSTFIX)
if(WIN32)
set(FFTW3_PATCH_COMMAND ${PATCH_CMD} --verbose -p 0 -N -d ${BUILD_DIR}/fftw3/src/external_fftw3_${FFTW_POSTFIX} < ${PATCH_DIR}/fftw3.diff)
set(FFTW_EXTRA_ARGS --disable-static --enable-shared)
set(FFTW_INSTALL install-strip)
else()
set(FFTW_EXTRA_ARGS --enable-static)
set(FFTW_INSTALL install)
endif()
ExternalProject_Add(external_fftw3_${FFTW_POSTFIX}
URL file://${PACKAGE_DIR}/${FFTW_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${FFTW_HASH_TYPE}=${FFTW_HASH}
PREFIX ${BUILD_DIR}/fftw3
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/fftw3/src/external_fftw3_${FFTW_POSTFIX}/ && ${CONFIGURE_COMMAND} ${FFTW_EXTRA_ARGS} ${ARGN} --prefix=${mingw_LIBDIR}/fftw3
PATCH_COMMAND ${FFTW3_PATCH_COMMAND}
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/fftw3/src/external_fftw3_${FFTW_POSTFIX}/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/fftw3/src/external_fftw3_${FFTW_POSTFIX}/ && make ${FFTW_INSTALL}
INSTALL_DIR ${LIBDIR}/fftw3
)
endmacro()
ExternalProject_Add(external_fftw3
URL file://${PACKAGE_DIR}/${FFTW_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${FFTW_HASH_TYPE}=${FFTW_HASH}
PREFIX ${BUILD_DIR}/fftw3
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/fftw3/src/external_fftw3/ && ${CONFIGURE_COMMAND} ${FFTW_EXTRA_ARGS} --prefix=${mingw_LIBDIR}/fftw3
PATCH_COMMAND ${FFTW3_PATCH_COMMAND}
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/fftw3/src/external_fftw3/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/fftw3/src/external_fftw3/ && make ${FFTW_INSTALL}
INSTALL_DIR ${LIBDIR}/fftw3
)
fftw_build(double)
fftw_build(float --enable-float)
if(MSVC)
set_target_properties(external_fftw3 PROPERTIES FOLDER Mingw)
set_target_properties(external_fftw3_double PROPERTIES FOLDER Mingw)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_fftw3 after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/fftw3/lib/libfftw3.dll.a ${HARVEST_TARGET}/fftw3/lib/libfftw.lib
ExternalProject_Add_Step(external_fftw3_double after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/fftw3/lib/libfftw3.dll.a ${HARVEST_TARGET}/fftw3/lib/libfftw3-3.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/fftw3/bin/libfftw3-3.dll ${HARVEST_TARGET}/fftw3/lib/libfftw3-3.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/fftw3/include/fftw3.h ${HARVEST_TARGET}/fftw3/include/fftw3.h
DEPENDEES install
)
ExternalProject_Add_Step(external_fftw3_float after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/fftw3/lib/libfftw3f.dll.a ${HARVEST_TARGET}/fftw3/lib/libfftw3f.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/fftw3/bin/libfftw3f-3.dll ${HARVEST_TARGET}/fftw3/lib/libfftw3f-3.dll
DEPENDEES install
)
endif()
endif()

View File

@@ -218,7 +218,7 @@ else()
harvest(openimagedenoise/lib openimagedenoise/lib "*.a")
harvest(embree/include embree/include "*.h")
harvest(embree/lib embree/lib "*.a")
harvest(embree/lib embree/lib "*${SHAREDLIBEXT}*")
harvest_rpath_lib(embree/lib embree/lib "*${SHAREDLIBEXT}*")
harvest(openpgl/include openpgl/include "*.h")
harvest(openpgl/lib openpgl/lib "*.a")
harvest(openpgl/lib/cmake/openpgl-${OPENPGL_SHORT_VERSION} openpgl/lib/cmake/openpgl "*.cmake")
@@ -254,7 +254,7 @@ else()
harvest(spnav/include spnav/include "*.h")
harvest(spnav/lib spnav/lib "*.a")
harvest(tbb/include tbb/include "*.h")
harvest_rpath_lib(tbb/lib tbb/lib "libtbb${SHAREDLIBEXT}")
harvest_rpath_lib(tbb/lib tbb/lib "libtbb${SHAREDLIBEXT}*")
harvest(theora/lib ffmpeg/lib "*.a")
harvest(tiff/include tiff/include "*.h")
harvest(tiff/lib tiff/lib "*.a")

View File

@@ -11,7 +11,7 @@ if(WIN32)
elseif(APPLE)
# Use bison and flex installed via Homebrew.
# The ones that come with Xcode toolset are too old.
if("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64")
if(BLENDER_PLATFORM_ARM)
set(ISPC_EXTRA_ARGS_APPLE
-DBISON_EXECUTABLE=/opt/homebrew/opt/bison/bin/bison
-DFLEX_EXECUTABLE=/opt/homebrew/opt/flex/bin/flex

View File

@@ -2,11 +2,12 @@
set(MATERIALX_EXTRA_ARGS
-DMATERIALX_BUILD_PYTHON=ON
-DMATERIALX_BUILD_RENDER=OFF
-DMATERIALX_BUILD_RENDER=ON
-DMATERIALX_INSTALL_PYTHON=OFF
-DMATERIALX_PYTHON_EXECUTABLE=${PYTHON_BINARY}
-DMATERIALX_PYTHON_VERSION=${PYTHON_SHORT_VERSION}
-DMATERIALX_BUILD_SHARED_LIBS=ON
-DMATERIALX_BUILD_TESTS=OFF
-DCMAKE_DEBUG_POSTFIX=_d
-Dpybind11_ROOT=${LIBDIR}/pybind11
-DPython_EXECUTABLE=${PYTHON_BINARY}

View File

@@ -27,6 +27,7 @@ ExternalProject_Add(external_openexr
URL file://${PACKAGE_DIR}/${OPENEXR_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OPENEXR_HASH_TYPE}=${OPENEXR_HASH}
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openexr/src/external_openexr < ${PATCH_DIR}/openexr_b18905772e.diff
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PREFIX ${BUILD_DIR}/openexr
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openexr ${DEFAULT_CMAKE_FLAGS} ${OPENEXR_EXTRA_ARGS}

View File

@@ -54,7 +54,7 @@ set(OPENIMAGEIO_EXTRA_ARGS
-DUSE_DCMTK=OFF
-DUSE_LIBHEIF=OFF
-DUSE_OPENGL=OFF
-DUSE_TBB=OFF
-DUSE_TBB=ON
-DUSE_QT=OFF
-DUSE_PYTHON=ON
-DUSE_GIF=OFF
@@ -96,6 +96,7 @@ set(OPENIMAGEIO_EXTRA_ARGS
-DImath_ROOT=${LIBDIR}/imath
-Dpybind11_ROOT=${LIBDIR}/pybind11
-DPython_EXECUTABLE=${PYTHON_BINARY}
-DTBB_ROOT=${LIBDIR}/tbb
)
ExternalProject_Add(external_openimageio
@@ -104,7 +105,8 @@ ExternalProject_Add(external_openimageio
URL_HASH ${OPENIMAGEIO_HASH_TYPE}=${OPENIMAGEIO_HASH}
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PREFIX ${BUILD_DIR}/openimageio
PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/ < ${PATCH_DIR}/openimageio.diff
PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/ < ${PATCH_DIR}/openimageio.diff &&
${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/ < ${PATCH_DIR}/oiio_3832.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openimageio ${DEFAULT_CMAKE_FLAGS} ${OPENIMAGEIO_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/openimageio
)
@@ -125,6 +127,7 @@ add_dependencies(
external_webp
external_python
external_pybind11
external_tbb
)
if(WIN32)

View File

@@ -31,8 +31,7 @@ if(WIN32)
else()
set(OPENSUBDIV_EXTRA_ARGS
${OPENSUBDIV_EXTRA_ARGS}
-DTBB_INCLUDE_DIR=${LIBDIR}/tbb/include
-DTBB_tbb_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}tbb${SHAREDLIBEXT}
-DTBB_LOCATION=${LIBDIR}/tbb
)
endif()

View File

@@ -74,6 +74,27 @@ if(WIN32)
set(BLENDER_CMAKE_CXX_FLAGS_RELEASE "/MD ${COMMON_MSVC_FLAGS} /D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD ${COMMON_MSVC_FLAGS} /D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS /Zi /O2 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
# Set similar flags for CLANG compilation.
set(COMMON_CLANG_FLAGS "-D_DLL -D_MT") # Equivalent to MSVC /MD
if(WITH_OPTIMIZED_DEBUG)
set(BLENDER_CLANG_CMAKE_C_FLAGS_DEBUG "${COMMON_CLANG_FLAGS} -Xclang --dependent-lib=msvcrtd -O2 -D_DEBUG -DPSAPI_VERSION=2 -DTINYFORMAT_ALLOW_WCHAR_STRINGS")
else()
set(BLENDER_CLANG_CMAKE_C_FLAGS_DEBUG "${COMMON_CLANG_FLAGS} -Xclang --dependent-lib=msvcrtd -g -D_DEBUG -DPSAPI_VERSION=2 -DTINYFORMAT_ALLOW_WCHAR_STRINGS")
endif()
set(BLENDER_CLANG_CMAKE_C_FLAGS_MINSIZEREL "${COMMON_CLANG_FLAGS} -Xclang --dependent-lib=msvcrt -Os -DNDEBUG -DPSAPI_VERSION=2 -DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CLANG_CMAKE_C_FLAGS_RELEASE "${COMMON_CLANG_FLAGS} -Xclang --dependent-lib=msvcrt -O2 -DNDEBUG -DPSAPI_VERSION=2 -DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CLANG_CMAKE_C_FLAGS_RELWITHDEBINFO "${COMMON_CLANG_FLAGS} -Xclang --dependent-lib=msvcrt -g -O2 -DNDEBUG -DPSAPI_VERSION=2 -DTINYFORMAT_ALLOW_WCHAR_STRINGS")
if(WITH_OPTIMIZED_DEBUG)
set(BLENDER_CLANG_CMAKE_CXX_FLAGS_DEBUG "${COMMON_CLANG_FLAGS} -Xclang --dependent-lib=msvcrtd -D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS -O2 -D_DEBUG -DPLATFORM_WINDOWS -DPSAPI_VERSION=2 -DTINYFORMAT_ALLOW_WCHAR_STRINGS -DBOOST_DEBUG_PYTHON -DBOOST_ALL_NO_LIB")
else()
set(BLENDER_CLANG_CMAKE_CXX_FLAGS_DEBUG "${COMMON_CLANG_FLAG} -Xclang --dependent-lib=msvcrtd -D_DEBUG -DPLATFORM_WINDOWS -D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS -g -DPSAPI_VERSION=2 -DTINYFORMAT_ALLOW_WCHAR_STRINGS -DBOOST_DEBUG_PYTHON -DBOOST_ALL_NO_LIB")
endif()
set(BLENDER_CLANG_CMAKE_CXX_FLAGS_MINSIZEREL "${COMMON_CLANG_FLAGS} -Xclang --dependent-lib=msvcrt -D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS -O2 -DNDEBUG -DPLATFORM_WINDOWS -DPSAPI_VERSION=2 -DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CLANG_CMAKE_CXX_FLAGS_RELEASE "${COMMON_CLANG_FLAGS} -Xclang --dependent-lib=msvcrt -D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS -O2 -DNDEBUG -DPLATFORM_WINDOWS -DPSAPI_VERSION=2 -DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CLANG_CMAKE_CXX_FLAGS_RELWITHDEBINFO "${COMMON_CLANG_FLAGS} -Xclang --dependent-lib=msvcrt -D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS -g -O2 -DNDEBUG -DPLATFORM_WINDOWS -DPSAPI_VERSION=2 -DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(PLATFORM_FLAGS)
set(PLATFORM_CXX_FLAGS)
set(PLATFORM_CMAKE_FLAGS)

View File

@@ -35,7 +35,7 @@ if(WIN32)
# regardless of the version actually in there.
PATCH_COMMAND mkdir ${PYTHON_EXTERNALS_FOLDER_DOS} &&
mklink /J ${PYTHON_EXTERNALS_FOLDER_DOS}\\zlib-1.2.13 ${ZLIB_SOURCE_FOLDER_DOS} &&
mklink /J ${PYTHON_EXTERNALS_FOLDER_DOS}\\openssl-1.1.1q ${SSL_SOURCE_FOLDER_DOS} &&
mklink /J ${PYTHON_EXTERNALS_FOLDER_DOS}\\openssl-1.1.1t ${SSL_SOURCE_FOLDER_DOS} &&
${CMAKE_COMMAND} -E copy ${ZLIB_SOURCE_FOLDER}/../external_zlib-build/zconf.h ${PYTHON_EXTERNALS_FOLDER}/zlib-1.2.13/zconf.h &&
${PATCH_CMD} --verbose -p1 -d ${BUILD_DIR}/python/src/external_python < ${PATCH_DIR}/python_windows.diff
CONFIGURE_COMMAND echo "."

View File

@@ -1,7 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(SSL_CONFIGURE_COMMAND ./Configure)
set(SSL_PATCH_CMD echo .)
if(WIN32)
# Python will build this with its preferred build options and patches. We only need to unpack openssl
@@ -18,7 +17,6 @@ if(WIN32)
else()
if(APPLE)
set(SSL_OS_COMPILER "blender-darwin-${CMAKE_OSX_ARCHITECTURES}")
set(SSL_PATCH_CMD ${PATCH_CMD} --verbose -p 0 -d ${BUILD_DIR}/ssl/src/external_ssl < ${PATCH_DIR}/ssl.diff)
else()
if(BLENDER_PLATFORM_ARM)
set(SSL_OS_COMPILER "blender-linux-aarch64")
@@ -35,7 +33,6 @@ else()
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${SSL_HASH_TYPE}=${SSL_HASH}
PREFIX ${BUILD_DIR}/ssl
PATCH_COMMAND ${SSL_PATCH_CMD}
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ssl/src/external_ssl/ && ${SSL_CONFIGURE_COMMAND} --prefix=${LIBDIR}/ssl
--openssldir=${LIBDIR}/ssl
no-shared

View File

@@ -7,6 +7,12 @@ set(TBB_EXTRA_ARGS
-DTBB_BUILD_TESTS=Off
-DCMAKE_DEBUG_POSTFIX=_debug
)
# TBB does not use soversion by default unlike other libs, but it's needed
# to avoid conflicts with incompatible TBB system libs in LD_LIBRARY_PATH
# or the Steam environment.
if(UNIX AND NOT APPLE)
list(APPEND TBB_EXTRA_ARGS -DTBB_SET_SOVERSION=ON)
endif()
set(TBB_LIBRARY tbb)
set(TBB_STATIC_LIBRARY Off)

View File

@@ -15,8 +15,7 @@ if(WIN32)
-D_PXR_CXX_DEFINITIONS=/DBOOST_ALL_NO_LIB
-DCMAKE_SHARED_LINKER_FLAGS_INIT=/LIBPATH:${LIBDIR}/tbb/lib
-DPython_FIND_REGISTRY=NEVER
-DPYTHON_INCLUDE_DIRS=${LIBDIR}/python/include
-DPYTHON_LIBRARY=${LIBDIR}/python/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}${PYTHON_POSTFIX}${LIBEXT}
-DPython3_EXECUTABLE=${PYTHON_BINARY}
)
if(BUILD_MODE STREQUAL Debug)
list(APPEND USD_PLATFORM_FLAGS -DPXR_USE_DEBUG_PYTHON=ON)
@@ -27,6 +26,12 @@ elseif(UNIX)
# part of the interpret in the USD library. Allow undefined Python symbols and replace
# Python library with TBB so it doesn't complain about missing library.
set(USD_PLATFORM_FLAGS
# NOTE(@ideasman42): Setting the root is needed, without this an older version of Python
# is detected from the system. Referencing the root-directory may remove the need
# to explicitly set the `PYTHON_INCLUDE_DIR` & `PYTHON_LIBRARY`.
# Keep them as it's known these are the libraries to use and it avoids any ambiguity.
-DPython3_ROOT_DIR=${LIBDIR}/python/
-DPYTHON_INCLUDE_DIR=${LIBDIR}/python/include/python${PYTHON_SHORT_VERSION}/
-DPYTHON_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${SHAREDLIBEXT}
)
@@ -44,6 +49,7 @@ set(USD_EXTRA_ARGS
${USD_PLATFORM_FLAGS}
-DOPENSUBDIV_ROOT_DIR=${LIBDIR}/opensubdiv
-DOpenImageIO_ROOT=${LIBDIR}/openimageio
-DMaterialX_ROOT=${LIBDIR}/materialx
-DOPENEXR_LIBRARIES=${LIBDIR}/imath/lib/${LIBPREFIX}Imath${OPENEXR_VERSION_POSTFIX}${SHAREDLIBEXT}
-DOPENEXR_INCLUDE_DIR=${LIBDIR}/imath/include
-DImath_DIR=${LIBDIR}/imath
@@ -56,9 +62,10 @@ set(USD_EXTRA_ARGS
-DPXR_BUILD_TUTORIALS=OFF
-DPXR_BUILD_USDVIEW=OFF
-DPXR_ENABLE_HDF5_SUPPORT=OFF
-DPXR_ENABLE_MATERIALX_SUPPORT=OFF
-DPXR_ENABLE_MATERIALX_SUPPORT=ON
-DPXR_ENABLE_OPENVDB_SUPPORT=ON
-DPYTHON_EXECUTABLE=${PYTHON_BINARY}
-DPython3_EXECUTABLE=${PYTHON_BINARY}
-DPXR_BUILD_MONOLITHIC=ON
# OSL is an optional dependency of the Imaging module. However, since that
# module was included for its support for converting primitive shapes (sphere,
@@ -95,7 +102,12 @@ ExternalProject_Add(external_usd
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
PREFIX ${BUILD_DIR}/usd
LIST_SEPARATOR ^^
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/usd/src/external_usd < ${PATCH_DIR}/usd.diff
# usd_pull_1965.diff https://github.com/PixarAnimationStudios/USD/pull/1965
# usd_hydra.diff - https://github.com/bnagirniak/RPRHydraRenderBlenderAddon/blob/master/usd.diff
# usd_hydra.diff also included the blender changes and usd_pull_1965 and has been edited to remove those sections.
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/usd/src/external_usd < ${PATCH_DIR}/usd.diff &&
${PATCH_CMD} -p 1 -d ${BUILD_DIR}/usd/src/external_usd < ${PATCH_DIR}/usd_pull_1965.diff &&
${PATCH_CMD} -p 1 -d ${BUILD_DIR}/usd/src/external_usd < ${PATCH_DIR}/usd_hydra.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/usd -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${USD_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/usd
)
@@ -107,6 +119,7 @@ add_dependencies(
external_opensubdiv
external_python
external_openimageio
external_materialx
openvdb
)

View File

@@ -58,16 +58,16 @@ set(PTHREADS_HASH f3bf81bb395840b3446197bcf4ecd653)
set(PTHREADS_HASH_TYPE MD5)
set(PTHREADS_FILE pthreads4w-code-${PTHREADS_VERSION}.zip)
set(OPENEXR_VERSION 3.1.5)
set(OPENEXR_VERSION 3.1.7)
set(OPENEXR_URI https://github.com/AcademySoftwareFoundation/openexr/archive/v${OPENEXR_VERSION}.tar.gz)
set(OPENEXR_HASH a92f38eedd43e56c0af56d4852506886)
set(OPENEXR_HASH ae68f0cb8b30a49c961fa87d31c60394)
set(OPENEXR_HASH_TYPE MD5)
set(OPENEXR_FILE openexr-${OPENEXR_VERSION}.tar.gz)
set(OPENEXR_CPE "cpe:2.3:a:openexr:openexr:${OPENEXR_VERSION}:*:*:*:*:*:*:*")
set(IMATH_VERSION 3.1.5)
set(IMATH_VERSION 3.1.7)
set(IMATH_URI https://github.com/AcademySoftwareFoundation/Imath/archive/v${OPENEXR_VERSION}.tar.gz)
set(IMATH_HASH dd375574276c54872b7b3d54053baff0)
set(IMATH_HASH 5cedab446ab296c080957c3037c6d097)
set(IMATH_HASH_TYPE MD5)
set(IMATH_FILE imath-${IMATH_VERSION}.tar.gz)
@@ -88,9 +88,9 @@ else()
set(OPENEXR_VERSION_POSTFIX)
endif()
set(FREETYPE_VERSION 2.12.1)
set(FREETYPE_VERSION 2.13.0)
set(FREETYPE_URI http://prdownloads.sourceforge.net/freetype/freetype-${FREETYPE_VERSION}.tar.gz)
set(FREETYPE_HASH 8bc5c9c9df7ac12c504f8918552a7cf2)
set(FREETYPE_HASH 98bc3cf234fe88ef3cf24569251fe0a4)
set(FREETYPE_HASH_TYPE MD5)
set(FREETYPE_FILE freetype-${FREETYPE_VERSION}.tar.gz)
SET(FREETYPE_CPE "cpe:2.3:a:freetype:freetype:${FREETYPE_VERSION}:*:*:*:*:*:*:*")
@@ -112,7 +112,6 @@ set(ALEMBIC_URI https://github.com/alembic/alembic/archive/${ALEMBIC_VERSION}.ta
set(ALEMBIC_HASH 2cd8d6e5a3ac4a014e24a4b04f4fadf9)
set(ALEMBIC_HASH_TYPE MD5)
set(ALEMBIC_FILE alembic-${ALEMBIC_VERSION}.tar.gz)
SET(FREETYPE_CPE "cpe:2.3:a:freetype:freetype:${FREETYPE_VERSION}:*:*:*:*:*:*:*")
set(OPENSUBDIV_VERSION v3_5_0)
set(OPENSUBDIV_URI https://github.com/PixarAnimationStudios/OpenSubdiv/archive/${OPENSUBDIV_VERSION}.tar.gz)
@@ -165,17 +164,17 @@ set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${
set(OPENMP_HASH_TYPE MD5)
set(OPENMP_FILE openmp-${OPENMP_VERSION}.src.tar.xz)
set(OPENIMAGEIO_VERSION v2.4.9.0)
set(OPENIMAGEIO_VERSION v2.4.11.0)
set(OPENIMAGEIO_URI https://github.com/OpenImageIO/oiio/archive/refs/tags/${OPENIMAGEIO_VERSION}.tar.gz)
set(OPENIMAGEIO_HASH 7da92a7d6029921a8599a977ff1efa2a)
set(OPENIMAGEIO_HASH 7eb997479ecfe7d9fa59cc8ddd35d0ae)
set(OPENIMAGEIO_HASH_TYPE MD5)
set(OPENIMAGEIO_FILE OpenImageIO-${OPENIMAGEIO_VERSION}.tar.gz)
# 8.0.0 is currently oiio's preferred version although never versions may be available.
# 9.1.0 is currently oiio's preferred version although never versions may be available.
# the preferred version can be found in oiio's externalpackages.cmake
set(FMT_VERSION 8.0.0)
set(FMT_VERSION 9.1.0)
set(FMT_URI https://github.com/fmtlib/fmt/archive/refs/tags/${FMT_VERSION}.tar.gz)
set(FMT_HASH 7bce0e9e022e586b178b150002e7c2339994e3c2bbe44027e9abb0d60f9cce83)
set(FMT_HASH 5dea48d1fcddc3ec571ce2058e13910a0d4a6bab4cc09a809d8b1dd1c88ae6f2)
set(FMT_HASH_TYPE SHA256)
set(FMT_FILE fmt-${FMT_VERSION}.tar.gz)
set(FMT_CPE "cpe:2.3:a:fmt:fmt:${FMT_VERSION}:*:*:*:*:*:*:*")
@@ -209,11 +208,11 @@ set(OSL_FILE OpenShadingLanguage-${OSL_VERSION}.tar.gz)
# BZIP2, FFI, SQLITE and change the versions in this file as well. For compliance
# reasons there can be no exceptions to this.
set(PYTHON_VERSION 3.10.9)
set(PYTHON_VERSION 3.10.11)
set(PYTHON_SHORT_VERSION 3.10)
set(PYTHON_SHORT_VERSION_NO_DOTS 310)
set(PYTHON_URI https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz)
set(PYTHON_HASH dc8c0f274b28ee9e95923d20cfc364c9)
set(PYTHON_HASH 1bf8481a683e0881e14d52e0f23633a6)
set(PYTHON_HASH_TYPE MD5)
set(PYTHON_FILE Python-${PYTHON_VERSION}.tar.xz)
set(PYTHON_CPE "cpe:2.3:a:python:python:${PYTHON_VERSION}:-:*:*:*:*:*:*")
@@ -296,9 +295,9 @@ set(THEORA_HASH b6ae1ee2fa3d42ac489287d3ec34c5885730b1296f0801ae577a35193d3affbc
set(THEORA_HASH_TYPE SHA256)
set(THEORA_FILE libtheora-${THEORA_VERSION}.tar.bz2)
set(FLAC_VERSION 1.3.4)
set(FLAC_VERSION 1.4.2)
set(FLAC_URI http://downloads.xiph.org/releases/flac/flac-${FLAC_VERSION}.tar.xz)
set(FLAC_HASH 8ff0607e75a322dd7cd6ec48f4f225471404ae2730d0ea945127b1355155e737 )
set(FLAC_HASH e322d58a1f48d23d9dd38f432672865f6f79e73a6f9cc5a5f57fcaa83eb5a8e4 )
set(FLAC_HASH_TYPE SHA256)
set(FLAC_FILE flac-${FLAC_VERSION}.tar.xz)
set(FLAC_CPE "cpe:2.3:a:flac_project:flac:${FLAC_VERSION}:*:*:*:*:*:*:*")
@@ -336,9 +335,9 @@ set(OPENJPEG_HASH_TYPE SHA256)
set(OPENJPEG_FILE openjpeg-v${OPENJPEG_VERSION}.tar.gz)
set(OPENJPEG_CPE "cpe:2.3:a:uclouvain:openjpeg:${OPENJPEG_VERSION}:*:*:*:*:*:*:*")
set(FFMPEG_VERSION 5.1.2)
set(FFMPEG_VERSION 6.0)
set(FFMPEG_URI http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2)
set(FFMPEG_HASH 39a0bcc8d98549f16c570624678246a6ac736c066cebdb409f9502e915b22f2b)
set(FFMPEG_HASH 47d062731c9f66a78380e35a19aac77cebceccd1c7cc309b9c82343ffc430c3d)
set(FFMPEG_HASH_TYPE SHA256)
set(FFMPEG_FILE ffmpeg-${FFMPEG_VERSION}.tar.bz2)
set(FFMPEG_CPE "cpe:2.3:a:ffmpeg:ffmpeg:${FFMPEG_VERSION}:*:*:*:*:*:*:*")
@@ -460,9 +459,9 @@ set(LZMA_HASH_TYPE SHA256)
set(LZMA_FILE xz-${LZMA_VERSION}.tar.bz2)
# NOTE: Python's build has been modified to use our ssl version.
set(SSL_VERSION 1.1.1q)
set(SSL_VERSION 1.1.1t)
set(SSL_URI https://www.openssl.org/source/openssl-${SSL_VERSION}.tar.gz)
set(SSL_HASH d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca)
set(SSL_HASH 8dee9b24bdb1dcbf0c3d1e9b02fb8f6bf22165e807f45adeb7c9677536859d3b)
set(SSL_HASH_TYPE SHA256)
set(SSL_FILE openssl-${SSL_VERSION}.tar.gz)
set(SSL_CPE "cpe:2.3:a:openssl:openssl:${SSL_VERSION}:*:*:*:*:*:*:*")
@@ -470,23 +469,23 @@ set(SSL_CPE "cpe:2.3:a:openssl:openssl:${SSL_VERSION}:*:*:*:*:*:*:*")
# Note: This will *HAVE* to match the version python ships on windows which
# is hardcoded in pythons PCbuild/get_externals.bat for compliance reasons there
# can be no exceptions to this.
set(SQLITE_VERSION 3.39.4)
set(SQLLITE_LONG_VERSION 3390400)
set(SQLITE_VERSION 3.40.1)
set(SQLLITE_LONG_VERSION 3400100)
set(SQLITE_URI https://www.sqlite.org/2022/sqlite-autoconf-${SQLLITE_LONG_VERSION}.tar.gz)
set(SQLITE_HASH c4c5c39269d1b9bb1487cff580c1f583608229b2)
set(SQLITE_HASH b8c2d4bc0094f5c0ce985dc0e237dfcbaa1f6275)
set(SQLITE_HASH_TYPE SHA1)
set(SQLITE_FILE sqlite-autoconf-${SQLLITE_LONG_VERSION}.tar.gz)
set(SQLITE_CPE "cpe:2.3:a:sqlite:sqlite:${SQLITE_VERSION}:*:*:*:*:*:*:*")
set(EMBREE_VERSION 4.0.1)
set(EMBREE_VERSION 4.1.0)
set(EMBREE_URI https://github.com/embree/embree/archive/v${EMBREE_VERSION}.zip)
set(EMBREE_HASH dd26617719a587e126b341d1b32f7fd0)
set(EMBREE_HASH 4b525955b08e1249a700dea5b5ffc8b2)
set(EMBREE_HASH_TYPE MD5)
set(EMBREE_FILE embree-v${EMBREE_VERSION}.zip)
set(USD_VERSION 22.11)
set(USD_VERSION 23.05)
set(USD_URI https://github.com/PixarAnimationStudios/USD/archive/v${USD_VERSION}.tar.gz)
set(USD_HASH 8c89459e48a2ef0e7ae9e7e490377507)
set(USD_HASH 56684f4fdd1a9209dabf03856be5eca6)
set(USD_HASH_TYPE MD5)
set(USD_FILE usd-v${USD_VERSION}.tar.gz)
@@ -579,9 +578,9 @@ set(ZSTD_HASH_TYPE SHA256)
set(ZSTD_FILE zstd-${ZSTD_VERSION}.tar.gz)
set(ZSTD_CPE "cpe:2.3:a:facebook:zstandard:${ZSTD_VERSION}:*:*:*:*:*:*:*")
set(SSE2NEON_VERSION fe5ff00bb8d19b327714a3c290f3e2ce81ba3525)
set(SSE2NEON_VERSION v1.6.0)
set(SSE2NEON_URI https://github.com/DLTcollab/sse2neon/archive/${SSE2NEON_VERSION}.tar.gz)
set(SSE2NEON_HASH 0780253525d299c31775ef95853698d03db9c7739942af8570000f4a25a5d605)
set(SSE2NEON_HASH 06f4693219deccb91b457135d836fc514a1c0a57e9fa66b143982901d2d19677)
set(SSE2NEON_HASH_TYPE SHA256)
set(SSE2NEON_FILE sse2neon-${SSE2NEON_VERSION}.tar.gz)
@@ -592,22 +591,22 @@ set(BROTLI_HASH_TYPE SHA256)
set(BROTLI_FILE brotli-v${BROTLI_VERSION}.tar.gz)
set(BROTLI_CPE "cpe:2.3:a:google:brotli:${BROTLI_VERSION}:*:*:*:*:*:*:*")
set(OPENPGL_VERSION v0.4.1-beta)
set(OPENPGL_SHORT_VERSION 0.4.1)
set(OPENPGL_VERSION v0.5.0)
set(OPENPGL_SHORT_VERSION 0.5.0)
set(OPENPGL_URI https://github.com/OpenPathGuidingLibrary/openpgl/archive/refs/tags/${OPENPGL_VERSION}.tar.gz)
set(OPENPGL_HASH db63f5dac5cfa8c110ede241f0c413f00db0c4748697381c4fa23e0f9e82a754)
set(OPENPGL_HASH 1ec806d434d45e43e098f82ee9be0cb74928343898c57490b34ff80584e9805a)
set(OPENPGL_HASH_TYPE SHA256)
set(OPENPGL_FILE openpgl-${OPENPGL_VERSION}.tar.gz)
set(LEVEL_ZERO_VERSION v1.8.5)
set(LEVEL_ZERO_VERSION v1.8.8)
set(LEVEL_ZERO_URI https://github.com/oneapi-src/level-zero/archive/refs/tags/${LEVEL_ZERO_VERSION}.tar.gz)
set(LEVEL_ZERO_HASH b6e9663bbcc53c148d32376998298bec6f7c434ef2218c61fa708963e3a09394)
set(LEVEL_ZERO_HASH 3553ae8fa0d2d69c4210a8f3428bd6612bd8bb8a627faf52c3658a01851e66d2)
set(LEVEL_ZERO_HASH_TYPE SHA256)
set(LEVEL_ZERO_FILE level-zero-${LEVEL_ZERO_VERSION}.tar.gz)
set(DPCPP_VERSION 20221019)
set(DPCPP_URI https://github.com/intel/llvm/archive/refs/tags/sycl-nightly/${DPCPP_VERSION}.tar.gz)
set(DPCPP_HASH 2f533946e91ce3829431758ea17b0b834b960c1a796e9e4563c86e03eb9603a2)
set(DPCPP_VERSION 2022-12)
set(DPCPP_URI https://github.com/intel/llvm/archive/refs/tags/${DPCPP_VERSION}.tar.gz)
set(DPCPP_HASH 13151d5ae79f7c9c4a9b072a0c486ae7b3c4993e301bb1268c92214451025790)
set(DPCPP_HASH_TYPE SHA256)
set(DPCPP_FILE DPCPP-${DPCPP_VERSION}.tar.gz)
@@ -620,9 +619,9 @@ set(DPCPP_FILE DPCPP-${DPCPP_VERSION}.tar.gz)
# will take care of building them, unpack is being done in dpcpp_deps.cmake
# Source llvm/lib/SYCLLowerIR/CMakeLists.txt
set(VCINTRINSICS_VERSION abce9184b7a3a7fe1b02289b9285610d9dc45465)
set(VCINTRINSICS_VERSION 782fbf7301dc73acaa049a4324c976ad94f587f7)
set(VCINTRINSICS_URI https://github.com/intel/vc-intrinsics/archive/${VCINTRINSICS_VERSION}.tar.gz)
set(VCINTRINSICS_HASH 3e9fd471246b87633b26f7e15e17ab7733d357458c53d5c5881c03929d6c551f)
set(VCINTRINSICS_HASH f4c0ccad8c1f77760364c551c65e8e1cf194d058889fa46d3b1b2d19ec4dc33f)
set(VCINTRINSICS_HASH_TYPE SHA256)
set(VCINTRINSICS_FILE vc-intrinsics-${VCINTRINSICS_VERSION}.tar.gz)
@@ -657,6 +656,13 @@ set(SPIRV_HEADERS_HASH ec8ecb471a62672697846c436501638ab25447ae9d4a6761e0bfe8a9a
set(SPIRV_HEADERS_HASH_TYPE SHA256)
set(SPIRV_HEADERS_FILE SPIR-V-Headers-${SPIRV_HEADERS_VERSION}.tar.gz)
# Source llvm/sycl/plugins/unified_runtime/CMakeLists.txt
set(UNIFIED_RUNTIME_VERSION fd711c920acc4434cb52ff18b078c082d9d7f44d)
set(UNIFIED_RUNTIME_URI https://github.com/oneapi-src/unified-runtime/archive/${UNIFIED_RUNTIME_VERSION}.tar.gz)
set(UNIFIED_RUNTIME_HASH 535ca2ee78f68c5e7e62b10f1bbabd909179488885566e6d9b1fc50e8a1be65f)
set(UNIFIED_RUNTIME_HASH_TYPE SHA256)
set(UNIFIED_RUNTIME_FILE unified-runtime-${UNIFIED_RUNTIME_VERSION}.tar.gz)
######################
### DPCPP DEPS END ###
######################
@@ -730,9 +736,9 @@ set(GMMLIB_HASH c1f33e1519edfc527127baeb0436b783430dfd256c643130169a3a71dc86aff9
set(GMMLIB_HASH_TYPE SHA256)
set(GMMLIB_FILE ${GMMLIB_VERSION}.tar.gz)
set(OCLOC_VERSION 22.49.25018.21)
set(OCLOC_VERSION 23.05.25593.18)
set(OCLOC_URI https://github.com/intel/compute-runtime/archive/refs/tags/${OCLOC_VERSION}.tar.gz)
set(OCLOC_HASH 92362dae08b503a34e5d3820ed284198c452bcd5e7504d90eb69887b20492c06)
set(OCLOC_HASH 122415028e631922ae999c996954dfd98ce9a32decd564d5484c31476ec9306e)
set(OCLOC_HASH_TYPE SHA256)
set(OCLOC_FILE ocloc-${OCLOC_VERSION}.tar.gz)

View File

@@ -14,6 +14,7 @@ graph[autosize = false, size = "25.7,8.3!", resolution = 300];
external_dpcpp -- external_mp11;
external_dpcpp -- external_level_zero;
external_dpcpp -- external_spirvheaders;
external_dpcpp -- external_unifiedruntime;
external_embree -- external_tbb;
external_ffmpeg -- external_zlib;
external_ffmpeg -- external_openjpeg;

View File

@@ -689,7 +689,7 @@ PACKAGES_ALL = (
DISTRO_ID_ARCH: "clang", # clang-format is part of the main clang package.
},
),
Package(name="Python", is_mandatory=True, version="3.10.9", version_short="3.10", version_min="3.10", version_mex="3.12",
Package(name="Python", is_mandatory=True, version="3.10.11", version_short="3.10", version_min="3.10", version_mex="3.12",
sub_packages=PYTHON_SUBPACKAGES,
distro_package_names={DISTRO_ID_DEBIAN: "python3-dev",
DISTRO_ID_FEDORA: "python3-devel",
@@ -721,7 +721,7 @@ PACKAGES_ALL = (
DISTRO_ID_ARCH: "opencolorio",
},
),
Package(name="IMath Library", is_mandatory=False, version="3.1.5", version_short="3.1", version_min="3.0", version_mex="4.0",
Package(name="IMath Library", is_mandatory=False, version="3.1.7", version_short="3.1", version_min="3.0", version_mex="4.0",
sub_packages=(),
distro_package_names={DISTRO_ID_DEBIAN: "libimath-dev",
DISTRO_ID_FEDORA: "imath-devel",
@@ -729,7 +729,7 @@ PACKAGES_ALL = (
DISTRO_ID_ARCH: "imath",
},
),
Package(name="OpenEXR Library", is_mandatory=False, version="3.1.5", version_short="3.1", version_min="3.0", version_mex="4.0",
Package(name="OpenEXR Library", is_mandatory=False, version="3.1.7", version_short="3.1", version_min="3.0", version_mex="4.0",
sub_packages=(),
distro_package_names={DISTRO_ID_DEBIAN: "libopenexr-dev",
DISTRO_ID_FEDORA: "openexr-devel",
@@ -737,7 +737,7 @@ PACKAGES_ALL = (
DISTRO_ID_ARCH: "openexr",
},
),
Package(name="OpenImageIO Library", is_mandatory=True, version="2.4.9.0", version_short="2.4", version_min="2.2.0", version_mex="2.5.0",
Package(name="OpenImageIO Library", is_mandatory=True, version="2.4.11.0", version_short="2.4", version_min="2.2.0", version_mex="2.5.0",
sub_packages=(
Package(name="OpenImageIO Tools", is_mandatory=False,
distro_package_names={DISTRO_ID_DEBIAN: "openimageio-tools",
@@ -836,7 +836,7 @@ PACKAGES_ALL = (
DISTRO_ID_ARCH: "materialx-git",
},
),
Package(name="USD Library", is_mandatory=False, version="22.11", version_short="22.11", version_min="20.05", version_mex="23.00",
Package(name="USD Library", is_mandatory=False, version="23.05", version_short="23.05", version_min="20.05", version_mex="24.00",
sub_packages=(),
distro_package_names={DISTRO_ID_DEBIAN: None,
DISTRO_ID_FEDORA: "usd-devel",
@@ -851,7 +851,7 @@ PACKAGES_ALL = (
DISTRO_ID_ARCH: "opencollada",
},
),
Package(name="Embree Library", is_mandatory=False, version="3.13.4", version_short="3.13", version_min="3.13", version_mex="5.0",
Package(name="Embree Library", is_mandatory=False, version="4.1.0", version_short="4.1", version_min="3.13", version_mex="5.0",
sub_packages=(),
distro_package_names={DISTRO_ID_DEBIAN: "libembree-dev",
DISTRO_ID_FEDORA: "embree-devel",
@@ -867,7 +867,7 @@ PACKAGES_ALL = (
DISTRO_ID_ARCH: "openimagedenoise",
},
),
Package(name="Level Zero Library", is_mandatory=False, version="1.7.15", version_short="1.7", version_min="1.7", version_mex="2.0",
Package(name="Level Zero Library", is_mandatory=False, version="1.8.8", version_short="1.8", version_min="1.7", version_mex="2.0",
sub_packages=(),
distro_package_names={DISTRO_ID_DEBIAN: None,
DISTRO_ID_FEDORA: "oneapi-level-zero-devel",
@@ -875,7 +875,7 @@ PACKAGES_ALL = (
DISTRO_ID_ARCH: "level-zero-headers", # ???
},
),
Package(name="OpenPGL Library", is_mandatory=False, version="0.4.1", version_short="0.4", version_min="0.4.1", version_mex="0.5",
Package(name="OpenPGL Library", is_mandatory=False, version="0.5.0", version_short="0.5", version_min="0.5.0", version_mex="0.6",
sub_packages=(),
distro_package_names={DISTRO_ID_DEBIAN: None,
DISTRO_ID_FEDORA: "openpgl-devel",
@@ -891,7 +891,7 @@ PACKAGES_ALL = (
DISTRO_ID_ARCH: "openxr",
},
),
Package(name="FFMPEG Library", is_mandatory=False, version="5.1.2", version_short="5.1", version_min="4.0", version_mex="7.0",
Package(name="FFMPEG Library", is_mandatory=False, version="6.0", version_short="6.0", version_min="4.0", version_mex="7.0",
sub_packages=(
Package(name="AVDevice FFMPEG Library", is_mandatory=False,
distro_package_names={DISTRO_ID_DEBIAN: "libavdevice-dev",

View File

@@ -8,7 +8,7 @@
# It also supports non-standard names for the library components.
#
# To use a custom IlmBase:
# - Set the variable ILMBASE_CUSTOM to True
# - Set the variable ILMBASE_CUSTOM to TRUE
# - Set the variable ILMBASE_CUSTOM_LIBRARIES to a list of the libraries to
# use, e.g. "SpiImath SpiHalf SpiIlmThread SpiIex"
# - Optionally set the variable ILMBASE_CUSTOM_INCLUDE_DIR to any
@@ -20,7 +20,7 @@
#
# ILMBASE_INCLUDE_DIR - where to find half.h, IlmBaseConfig.h, etc.
# ILMBASE_LIBRARIES - list of libraries to link against when using IlmBase.
# ILMBASE_FOUND - True if IlmBase was found.
# ILMBASE_FOUND - TRUE if IlmBase was found.
# Other standard issue macros
include(FindPackageHandleStandardArgs)

View File

@@ -8,7 +8,7 @@
# It also supports non-standard names for the library components.
#
# To use a custom OpenEXR
# - Set the variable OPENEXR_CUSTOM to True
# - Set the variable OPENEXR_CUSTOM to TRUE
# - Set the variable OPENEXR_CUSTOM_LIBRARY to the name of the library to
# use, e.g. "SpiIlmImf"
# - Optionally set the variable OPENEXR_CUSTOM_INCLUDE_DIR to any
@@ -22,7 +22,7 @@
# OPENEXR_LIBRARIES - list of libraries to link against when using OpenEXR.
# This list does NOT include the IlmBase libraries.
# These are defined by the FindIlmBase module.
# OPENEXR_FOUND - True if OpenEXR was found.
# OPENEXR_FOUND - TRUE if OpenEXR was found.
# Other standard issue macros
include(SelectLibraryConfigurations)

View File

@@ -34,3 +34,156 @@ diff -Naur llvm-sycl-nightly-20220208.orig/libdevice/cmake/modules/SYCLLibdevice
libsycldevice-obj
libsycldevice-spv)
diff --git a/sycl/source/detail/program_manager/program_manager.cpp b/sycl/source/detail/program_manager/program_manager.cpp
index 17eeaafae194..09e6d2217aaa 100644
--- a/sycl/source/detail/program_manager/program_manager.cpp
+++ b/sycl/source/detail/program_manager/program_manager.cpp
@@ -1647,46 +1647,120 @@ ProgramManager::getSYCLDeviceImagesWithCompatibleState(
}
assert(BinImages.size() > 0 && "Expected to find at least one device image");
+ // Ignore images with incompatible state. Image is considered compatible
+ // with a target state if an image is already in the target state or can
+ // be brought to target state by compiling/linking/building.
+ //
+ // Example: an image in "executable" state is not compatible with
+ // "input" target state - there is no operation to convert the image it
+ // to "input" state. An image in "input" state is compatible with
+ // "executable" target state because it can be built to get into
+ // "executable" state.
+ for (auto It = BinImages.begin(); It != BinImages.end();) {
+ if (getBinImageState(*It) > TargetState)
+ It = BinImages.erase(It);
+ else
+ ++It;
+ }
+
std::vector<device_image_plain> SYCLDeviceImages;
- for (RTDeviceBinaryImage *BinImage : BinImages) {
- const bundle_state ImgState = getBinImageState(BinImage);
-
- // Ignore images with incompatible state. Image is considered compatible
- // with a target state if an image is already in the target state or can
- // be brought to target state by compiling/linking/building.
- //
- // Example: an image in "executable" state is not compatible with
- // "input" target state - there is no operation to convert the image it
- // to "input" state. An image in "input" state is compatible with
- // "executable" target state because it can be built to get into
- // "executable" state.
- if (ImgState > TargetState)
- continue;
- for (const sycl::device &Dev : Devs) {
+ // If a non-input state is requested, we can filter out some compatible
+ // images and return only those with the highest compatible state for each
+ // device-kernel pair. This map tracks how many kernel-device pairs need each
+ // image, so that any unneeded ones are skipped.
+ // TODO this has no effect if the requested state is input, consider having
+ // a separate branch for that case to avoid unnecessary tracking work.
+ struct DeviceBinaryImageInfo {
+ std::shared_ptr<std::vector<sycl::kernel_id>> KernelIDs;
+ bundle_state State = bundle_state::input;
+ int RequirementCounter = 0;
+ };
+ std::unordered_map<RTDeviceBinaryImage *, DeviceBinaryImageInfo> ImageInfoMap;
+
+ for (const sycl::device &Dev : Devs) {
+ // Track the highest image state for each requested kernel.
+ using StateImagesPairT =
+ std::pair<bundle_state, std::vector<RTDeviceBinaryImage *>>;
+ using KernelImageMapT =
+ std::map<kernel_id, StateImagesPairT, LessByNameComp>;
+ KernelImageMapT KernelImageMap;
+ if (!KernelIDs.empty())
+ for (const kernel_id &KernelID : KernelIDs)
+ KernelImageMap.insert({KernelID, {}});
+
+ for (RTDeviceBinaryImage *BinImage : BinImages) {
if (!compatibleWithDevice(BinImage, Dev) ||
!doesDevSupportImgAspects(Dev, *BinImage))
continue;
- std::shared_ptr<std::vector<sycl::kernel_id>> KernelIDs;
- // Collect kernel names for the image
- {
- std::lock_guard<std::mutex> KernelIDsGuard(m_KernelIDsMutex);
- KernelIDs = m_BinImg2KernelIDs[BinImage];
- // If the image does not contain any non-service kernels we can skip it.
- if (!KernelIDs || KernelIDs->empty())
- continue;
+ auto InsertRes = ImageInfoMap.insert({BinImage, {}});
+ DeviceBinaryImageInfo &ImgInfo = InsertRes.first->second;
+ if (InsertRes.second) {
+ ImgInfo.State = getBinImageState(BinImage);
+ // Collect kernel names for the image
+ {
+ std::lock_guard<std::mutex> KernelIDsGuard(m_KernelIDsMutex);
+ ImgInfo.KernelIDs = m_BinImg2KernelIDs[BinImage];
+ }
}
+ const bundle_state ImgState = ImgInfo.State;
+ const std::shared_ptr<std::vector<sycl::kernel_id>> &ImageKernelIDs =
+ ImgInfo.KernelIDs;
+ int &ImgRequirementCounter = ImgInfo.RequirementCounter;
- DeviceImageImplPtr Impl = std::make_shared<detail::device_image_impl>(
- BinImage, Ctx, Devs, ImgState, KernelIDs, /*PIProgram=*/nullptr);
+ // If the image does not contain any non-service kernels we can skip it.
+ if (!ImageKernelIDs || ImageKernelIDs->empty())
+ continue;
- SYCLDeviceImages.push_back(
- createSyclObjFromImpl<device_image_plain>(Impl));
- break;
+ // Update tracked information.
+ for (kernel_id &KernelID : *ImageKernelIDs) {
+ StateImagesPairT *StateImagesPair;
+ // If only specific kernels are requested, ignore the rest.
+ if (!KernelIDs.empty()) {
+ auto It = KernelImageMap.find(KernelID);
+ if (It == KernelImageMap.end())
+ continue;
+ StateImagesPair = &It->second;
+ } else
+ StateImagesPair = &KernelImageMap[KernelID];
+
+ auto &[KernelImagesState, KernelImages] = *StateImagesPair;
+
+ if (KernelImages.empty()) {
+ KernelImagesState = ImgState;
+ KernelImages.push_back(BinImage);
+ ++ImgRequirementCounter;
+ } else if (KernelImagesState < ImgState) {
+ for (RTDeviceBinaryImage *Img : KernelImages) {
+ auto It = ImageInfoMap.find(Img);
+ assert(It != ImageInfoMap.end());
+ assert(It->second.RequirementCounter > 0);
+ --(It->second.RequirementCounter);
+ }
+ KernelImages.clear();
+ KernelImages.push_back(BinImage);
+ KernelImagesState = ImgState;
+ ++ImgRequirementCounter;
+ } else if (KernelImagesState == ImgState) {
+ KernelImages.push_back(BinImage);
+ ++ImgRequirementCounter;
+ }
+ }
}
}
+ for (const auto &ImgInfoPair : ImageInfoMap) {
+ if (ImgInfoPair.second.RequirementCounter == 0)
+ continue;
+
+ DeviceImageImplPtr Impl = std::make_shared<detail::device_image_impl>(
+ ImgInfoPair.first, Ctx, Devs, ImgInfoPair.second.State,
+ ImgInfoPair.second.KernelIDs, /*PIProgram=*/nullptr);
+
+ SYCLDeviceImages.push_back(createSyclObjFromImpl<device_image_plain>(Impl));
+ }
+
return SYCLDeviceImages;
}

View File

@@ -24,128 +24,3 @@ index 7c2f43d..106b1d5 100644
DISABLE_STACK_PROTECTOR_FOR_INTERSECTORS(${EMBREE_LIBRARY_FILES_AVX2})
ADD_LIBRARY(embree_avx2 STATIC ${EMBREE_LIBRARY_FILES_AVX2})
TARGET_LINK_LIBRARIES(embree_avx2 PRIVATE tasking)
diff --git a/include/embree4/rtcore_device.h b/include/embree4/rtcore_device.h
index 45bf95583..62ee7787d 100644
--- a/include/embree4/rtcore_device.h
+++ b/include/embree4/rtcore_device.h
@@ -55,6 +55,7 @@ enum RTCDeviceProperty
RTC_DEVICE_PROPERTY_FILTER_FUNCTION_SUPPORTED = 66,
RTC_DEVICE_PROPERTY_IGNORE_INVALID_RAYS_ENABLED = 67,
RTC_DEVICE_PROPERTY_COMPACT_POLYS_ENABLED = 68,
+ RTC_DEVICE_PROPERTY_BACKFACE_CULLING_SPHERES_ENABLED = 69,
RTC_DEVICE_PROPERTY_TRIANGLE_GEOMETRY_SUPPORTED = 96,
RTC_DEVICE_PROPERTY_QUAD_GEOMETRY_SUPPORTED = 97,
diff --git a/kernels/common/device.cpp b/kernels/common/device.cpp
index 3ffac7e37..215ccc961 100644
--- a/kernels/common/device.cpp
+++ b/kernels/common/device.cpp
@@ -170,6 +170,9 @@ namespace embree
#if defined (EMBREE_BACKFACE_CULLING_CURVES)
v += "backfacecullingcurves ";
#endif
+#if defined (EMBREE_BACKFACE_CULLING_SPHERES)
+ v += "backfacecullingspheres ";
+#endif
#if defined(EMBREE_FILTER_FUNCTION)
v += "intersection_filter ";
#endif
@@ -477,6 +480,12 @@ namespace embree
case RTC_DEVICE_PROPERTY_BACKFACE_CULLING_CURVES_ENABLED: return 0;
#endif
+#if defined(EMBREE_BACKFACE_CULLING_SPHERES)
+ case RTC_DEVICE_PROPERTY_BACKFACE_CULLING_SPHERES_ENABLED: return 1;
+#else
+ case RTC_DEVICE_PROPERTY_BACKFACE_CULLING_SPHERES_ENABLED: return 0;
+#endif
+
#if defined(EMBREE_COMPACT_POLYS)
case RTC_DEVICE_PROPERTY_COMPACT_POLYS_ENABLED: return 1;
#else
diff --git a/kernels/config.h.in b/kernels/config.h.in
index f02c90360..ba9acde56 100644
--- a/kernels/config.h.in
+++ b/kernels/config.h.in
@@ -5,6 +5,7 @@
#cmakedefine EMBREE_STAT_COUNTERS
#cmakedefine EMBREE_BACKFACE_CULLING
#cmakedefine EMBREE_BACKFACE_CULLING_CURVES
+#cmakedefine EMBREE_BACKFACE_CULLING_SPHERES
#cmakedefine EMBREE_FILTER_FUNCTION
#cmakedefine EMBREE_IGNORE_INVALID_RAYS
#cmakedefine EMBREE_GEOMETRY_TRIANGLE
diff --git a/kernels/geometry/sphere_intersector.h b/kernels/geometry/sphere_intersector.h
index 074f910a2..30f490818 100644
--- a/kernels/geometry/sphere_intersector.h
+++ b/kernels/geometry/sphere_intersector.h
@@ -106,8 +106,13 @@ namespace embree
const vbool<M> valid_front = valid & (ray.tnear() <= t_front) & (t_front <= ray.tfar);
const vbool<M> valid_back = valid & (ray.tnear() <= t_back ) & (t_back <= ray.tfar);
+#if defined (EMBREE_BACKFACE_CULLING_SPHERES)
+ /* check if there is a first hit */
+ const vbool<M> valid_first = valid_front;
+#else
/* check if there is a first hit */
const vbool<M> valid_first = valid_front | valid_back;
+#endif
if (unlikely(none(valid_first)))
return false;
@@ -120,7 +125,8 @@ namespace embree
/* invoke intersection filter for first hit */
const bool is_hit_first = epilog(valid_first, hit);
-
+
+#if !defined (EMBREE_BACKFACE_CULLING_SPHERES)
/* check for possible second hits before potentially accepted hit */
const vfloat<M> t_second = t_back;
const vbool<M> valid_second = valid_front & valid_back & (t_second <= ray.tfar);
@@ -131,7 +137,9 @@ namespace embree
const Vec3vf<M> Ng_second = td_back * ray_dir - perp;
hit = SphereIntersectorHitM<M> (t_second, Ng_second);
const bool is_hit_second = epilog(valid_second, hit);
-
+#else
+ constexpr bool is_hit_second = false;
+#endif
return is_hit_first | is_hit_second;
}
@@ -186,8 +194,13 @@ namespace embree
const vbool<M> valid_front = valid & (ray.tnear()[k] <= t_front) & (t_front <= ray.tfar[k]);
const vbool<M> valid_back = valid & (ray.tnear()[k] <= t_back ) & (t_back <= ray.tfar[k]);
+#if defined (EMBREE_BACKFACE_CULLING_SPHERES)
+ /* check if there is a first hit */
+ const vbool<M> valid_first = valid_front;
+#else
/* check if there is a first hit */
const vbool<M> valid_first = valid_front | valid_back;
+#endif
if (unlikely(none(valid_first)))
return false;
@@ -200,7 +213,8 @@ namespace embree
/* invoke intersection filter for first hit */
const bool is_hit_first = epilog(valid_first, hit);
-
+
+#if !defined (EMBREE_BACKFACE_CULLING_SPHERES)
/* check for possible second hits before potentially accepted hit */
const vfloat<M> t_second = t_back;
const vbool<M> valid_second = valid_front & valid_back & (t_second <= ray.tfar[k]);
@@ -211,7 +225,9 @@ namespace embree
const Vec3vf<M> Ng_second = td_back * ray_dir - perp;
hit = SphereIntersectorHitM<M> (t_second, Ng_second);
const bool is_hit_second = epilog(valid_second, hit);
-
+#else
+ constexpr bool is_hit_second = false;
+#endif
return is_hit_first | is_hit_second;
}
};

View File

@@ -9,77 +9,3 @@
enabled libopenmpt && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++"
enabled libopus && {
enabled libopus_decoder && {
--- a/libavcodec/cfhddata.c
+++ b/libavcodec/cfhddata.c
@@ -276,10 +276,10 @@
av_cold int ff_cfhd_init_vlcs(CFHDContext *s)
{
int i, j, ret = 0;
- uint32_t new_cfhd_vlc_bits[NB_VLC_TABLE_18 * 2];
- uint8_t new_cfhd_vlc_len[NB_VLC_TABLE_18 * 2];
- uint16_t new_cfhd_vlc_run[NB_VLC_TABLE_18 * 2];
- int16_t new_cfhd_vlc_level[NB_VLC_TABLE_18 * 2];
+ uint32_t *new_cfhd_vlc_bits = av_calloc(sizeof(uint32_t), NB_VLC_TABLE_18 * 2);
+ uint8_t *new_cfhd_vlc_len = av_calloc(sizeof(uint8_t), NB_VLC_TABLE_18 * 2);
+ uint16_t *new_cfhd_vlc_run = av_calloc(sizeof(uint16_t), NB_VLC_TABLE_18 * 2);
+ int16_t *new_cfhd_vlc_level = av_calloc(sizeof(int16_t), NB_VLC_TABLE_18 * 2);
/** Similar to dv.c, generate signed VLC tables **/
@@ -305,8 +305,13 @@
ret = init_vlc(&s->vlc_9, VLC_BITS, j, new_cfhd_vlc_len,
1, 1, new_cfhd_vlc_bits, 4, 4, 0);
- if (ret < 0)
+ if (ret < 0) {
+ av_free(new_cfhd_vlc_bits);
+ av_free(new_cfhd_vlc_len);
+ av_free(new_cfhd_vlc_run);
+ av_free(new_cfhd_vlc_level);
return ret;
+ }
for (i = 0; i < s->vlc_9.table_size; i++) {
int code = s->vlc_9.table[i][0];
int len = s->vlc_9.table[i][1];
@@ -346,8 +351,14 @@
ret = init_vlc(&s->vlc_18, VLC_BITS, j, new_cfhd_vlc_len,
1, 1, new_cfhd_vlc_bits, 4, 4, 0);
- if (ret < 0)
+ if (ret < 0) {
+ av_free(new_cfhd_vlc_bits);
+ av_free(new_cfhd_vlc_len);
+ av_free(new_cfhd_vlc_run);
+ av_free(new_cfhd_vlc_level);
return ret;
+ }
+
av_assert0(s->vlc_18.table_size == 4572);
for (i = 0; i < s->vlc_18.table_size; i++) {
@@ -367,5 +378,10 @@
s->table_18_rl_vlc[i].run = run;
}
+ av_free(new_cfhd_vlc_bits);
+ av_free(new_cfhd_vlc_len);
+ av_free(new_cfhd_vlc_run);
+ av_free(new_cfhd_vlc_level);
+
return ret;
}
diff --git a/libavcodec/x86/simple_idct.asm b/libavcodec/x86/simple_idct.asm
index dcf0da6df121..982b2f0bbba1 100644
--- a/libavcodec/x86/simple_idct.asm
+++ b/libavcodec/x86/simple_idct.asm
@@ -25,9 +25,9 @@
%include "libavutil/x86/x86util.asm"
-%if ARCH_X86_32
SECTION_RODATA
+%if ARCH_X86_32
cextern pb_80
wm1010: dw 0, 0xffff, 0, 0xffff

View File

@@ -0,0 +1,13 @@
diff --git a/src/python/py_oiio.cpp b/src/python/py_oiio.cpp
index 6031d2c23..e71105da5 100644
--- a/src/python/py_oiio.cpp
+++ b/src/python/py_oiio.cpp
@@ -153,7 +153,7 @@ oiio_bufinfo::oiio_bufinfo(const py::buffer_info& pybuf, int nchans, int width,
format = TypeUnknown; // No idea what's going on -- error
error = Strutil::fmt::format(
"Python array shape is [{:,}] but expecting h={}, w={}, ch={}",
- cspan<ssize_t>(pybuf.shape), height, width, nchans);
+ cspan<py::ssize_t>(pybuf.shape), height, width, nchans);
}
} else if (pixeldims == 1) {
// Reading a 1D scanline span

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
diff --git a/pxr/usd/usdMtlx/reader.cpp b/pxr/usd/usdMtlx/reader.cpp
index 29e901816..e6fc68b20 100644
--- a/pxr/usd/usdMtlx/reader.cpp
+++ b/pxr/usd/usdMtlx/reader.cpp
@@ -797,6 +797,15 @@ _NodeGraphBuilder::_CreateInterfaceInputs(
// We deliberately ignore tokens here.
}
+mx::StringSet _GetStdlibIncludes() {
+ mx::StringSet stdlibIncludes = UsdMtlxGetDocument("")->getReferencedSourceUris();
+ mx::StringSet normStdlibIncludes;
+ for (std::string const& entry : stdlibIncludes) {
+ normStdlibIncludes.insert(TfNormPath(entry));
+ }
+ return normStdlibIncludes;
+}
+
// Returns True if the mtlxNodeDef corresponds to a locally defined custom node
// with an associated nodegraph.
// XXX Locally defined custom nodes without nodegraphs are not supported
@@ -818,13 +827,14 @@ _NodeGraphBuilder::_IsLocalCustomNode(const mx::ConstNodeDefPtr &mtlxNodeDef)
}
// Combine with the nodeDef relative path
nodeDefUri = TfNormPath(fullMtlxPath + nodeDefUri);
+ } else {
+ nodeDefUri = TfNormPath(nodeDefUri);
}
// This is a locally defined custom node if the absolute path to the
// nodedef is not included in the stdlibDoc.
static mx::StringSet customNodeDefNames;
- static const mx::StringSet stdlibIncludes =
- UsdMtlxGetDocument("")->getReferencedSourceUris();
+ static const mx::StringSet stdlibIncludes = _GetStdlibIncludes();
if (stdlibIncludes.find(nodeDefUri) == stdlibIncludes.end()) {
// Check if we already used this custom node
if (std::find(customNodeDefNames.begin(), customNodeDefNames.end(),

View File

@@ -0,0 +1,106 @@
diff --git a/build_scripts/build_usd.py b/build_scripts/build_usd.py
index cfe243effb..a4bb94eee1 100644
--- a/build_scripts/build_usd.py
+++ b/build_scripts/build_usd.py
@@ -1415,7 +1415,7 @@ def InstallDraco(context, force, buildArgs):
############################################################
# MaterialX
-MATERIALX_URL = "https://github.com/materialx/MaterialX/archive/v1.38.4.zip"
+MATERIALX_URL = "https://github.com/materialx/MaterialX/archive/v1.38.5.zip"
def InstallMaterialX(context, force, buildArgs):
with CurrentWorkingDirectory(DownloadURL(MATERIALX_URL, context, force)):
diff --git a/pxr/imaging/hdSt/materialXShaderGen.cpp b/pxr/imaging/hdSt/materialXShaderGen.cpp
index df80ff119f..e4b5f04a73 100644
--- a/pxr/imaging/hdSt/materialXShaderGen.cpp
+++ b/pxr/imaging/hdSt/materialXShaderGen.cpp
@@ -136,8 +136,7 @@ HdStMaterialXShaderGen::HdStMaterialXShaderGen(
"st" : mxHdInfo.defaultTexcoordName;
// Register the customized version of the Surface node generator
- registerImplementation("IM_surface_" + GlslShaderGenerator::TARGET,
- HdStMaterialXSurfaceNodeGen::create);
+ registerImplementation("IM_surface_genglsl", HdStMaterialXSurfaceNodeGen::create);
}
// Based on GlslShaderGenerator::generate()
@@ -273,8 +272,7 @@ HdStMaterialXShaderGen::_EmitMxFunctions(
mx::ShaderStage& mxStage) const
{
// Add global constants and type definitions
- emitLibraryInclude("stdlib/" + mx::GlslShaderGenerator::TARGET
- + "/lib/mx_math.glsl", mxContext, mxStage);
+ emitLibraryInclude("stdlib/genglsl/lib/mx_math.glsl", mxContext, mxStage);
emitLine("#if NUM_LIGHTS > 0", mxStage, false);
emitLine("#define MAX_LIGHT_SOURCES NUM_LIGHTS", mxStage, false);
emitLine("#else", mxStage, false);
@@ -394,16 +392,24 @@ HdStMaterialXShaderGen::_EmitMxFunctions(
emitSpecularEnvironment(mxContext, mxStage);
}
if (shadowing) {
- emitLibraryInclude("pbrlib/" + mx::GlslShaderGenerator::TARGET
- + "/lib/mx_shadow.glsl", mxContext, mxStage);
+ emitLibraryInclude("pbrlib/genglsl/lib/mx_shadow.glsl", mxContext, mxStage);
}
+#if MATERIALX_MAJOR_VERSION > 1 || \
+ (MATERIALX_MAJOR_VERSION == 1 && MATERIALX_MINOR_VERSION > 38) || \
+ (MATERIALX_MAJOR_VERSION == 1 && MATERIALX_MINOR_VERSION == 38 && MATERIALX_BUILD_VERSION > 4)
+ // MaterialX 1.38.5 changes the default transmission method to "refraction".
+ mxContext.getOptions().hwTransmissionRenderMethod = mx::TRANSMISSION_OPACITY;
+
+ // Emit transmission code
+ emitTransmissionRender(mxContext, mxStage);
+#endif
+
// Emit directional albedo table code.
if (mxContext.getOptions().hwDirectionalAlbedoMethod ==
mx::HwDirectionalAlbedoMethod::DIRECTIONAL_ALBEDO_TABLE ||
mxContext.getOptions().hwWriteAlbedoTable) {
- emitLibraryInclude("pbrlib/" + mx::GlslShaderGenerator::TARGET
- + "/lib/mx_table.glsl", mxContext, mxStage);
+ emitLibraryInclude("pbrlib/genglsl/lib/mx_table.glsl", mxContext, mxStage);
emitLineBreak(mxStage);
}
@@ -421,7 +427,7 @@ HdStMaterialXShaderGen::_EmitMxFunctions(
// Emit uv transform code globally if needed.
if (mxContext.getOptions().hwAmbientOcclusion) {
emitLibraryInclude(
- "stdlib/" + mx::GlslShaderGenerator::TARGET + "/lib/" +
+ "stdlib/genglsl/lib/" +
_tokenSubstitutions[ShaderGenerator::T_FILE_TRANSFORM_UV],
mxContext, mxStage);
}
@@ -490,10 +496,30 @@ HdStMaterialXShaderGen::_EmitMxSurfaceShader(
// closure/shader nodes and need to be emitted first.
emitFunctionCalls(mxGraph, mxContext, mxStage, mx::ShaderNode::Classification::TEXTURE);
+#if MATERIALX_MAJOR_VERSION == 1 && \
+ MATERIALX_MINOR_VERSION == 38 && \
+ MATERIALX_BUILD_VERSION <= 4
// Emit function calls for all surface shader nodes.
// These will internally emit their closure function calls.
emitFunctionCalls(mxGraph, mxContext, mxStage, mx::ShaderNode::Classification::SHADER |
mx::ShaderNode::Classification::SURFACE);
+#else
+ // Emit function calls for "root" closure/shader nodes.
+ // These will internally emit function calls for any dependent closure nodes upstream.
+ for (mx::ShaderGraphOutputSocket* socket : mxGraph.getOutputSockets())
+ {
+ if (socket->getConnection())
+ {
+ const mx::ShaderNode* upstream = socket->getConnection()->getNode();
+ if (upstream->getParent() == &mxGraph &&
+ (upstream->hasClassification(mx::ShaderNode::Classification::CLOSURE) ||
+ upstream->hasClassification(mx::ShaderNode::Classification::SHADER)))
+ {
+ emitFunctionCall(*upstream, mxContext, mxStage);
+ }
+ }
+ }
+#endif
}
else
{

View File

@@ -108,7 +108,8 @@ set oiio_paths=%Staging%\%BuildDir%%ARCH%R\Release\openimageio\bin;%Staging%\%Bu
set boost_paths=%Staging%\%BuildDir%%ARCH%R\Release\boost\lib;%Staging%\%BuildDir%%ARCH%D\Debug\boost\lib
set openexr_paths=%Staging%\%BuildDir%%ARCH%R\Release\openexr\bin;%Staging%\%BuildDir%%ARCH%D\Debug\openexr\bin
set imath_paths=%Staging%\%BuildDir%%ARCH%R\Release\imath\bin;%Staging%\%BuildDir%%ARCH%D\Debug\imath\bin
set path=%BUILD_DIR%\downloads\mingw\mingw64\msys\1.0\bin\;%BUILD_DIR%\downloads\nasm-2.12.01\;%path%;%boost_paths%;%oiio_paths%;%openexr_paths%;%imath_paths%
set tbb_paths=%Staging%\%BuildDir%%ARCH%R\Release\tbb\bin;%Staging%\%BuildDir%%ARCH%D\Debug\tbb\bin
set path=%BUILD_DIR%\downloads\mingw\mingw64\msys\1.0\bin\;%BUILD_DIR%\downloads\nasm-2.12.01\;%path%;%boost_paths%;%oiio_paths%;%openexr_paths%;%imath_paths%;%tbb_paths%
mkdir %STAGING%\%BuildDir%%ARCH%R
cd %Staging%\%BuildDir%%ARCH%R
echo %DATE% %TIME% : Start > %StatusFile%

View File

@@ -1,12 +1,9 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2021 Blender Foundation.
# - Find HIP compiler
#
# This module defines
# Find HIP compiler. This module defines
# HIP_HIPCC_EXECUTABLE, the full path to the hipcc executable
# HIP_VERSION, the HIP compiler version
#
# HIP_FOUND, if the HIP toolkit is found.
# If HIP_ROOT_DIR was defined in the environment, use it.
@@ -27,51 +24,70 @@ find_program(HIP_HIPCC_EXECUTABLE
bin
)
if(HIP_HIPCC_EXECUTABLE AND NOT EXISTS ${HIP_HIPCC_EXECUTABLE})
message(WARNING "Cached or directly specified hipcc executable does not exist.")
set(HIP_FOUND FALSE)
elseif(HIP_HIPCC_EXECUTABLE)
set(HIP_FOUND TRUE)
if(WIN32)
# Needed for HIP-RT on Windows.
find_program(HIP_LINKER_EXECUTABLE
NAMES
clang++
HINTS
${_hip_SEARCH_DIRS}
PATH_SUFFIXES
bin
NO_DEFAULT_PATH
NO_CMAKE_PATH
)
endif()
if(HIP_HIPCC_EXECUTABLE)
set(HIP_VERSION_MAJOR 0)
set(HIP_VERSION_MINOR 0)
set(HIP_VERSION_PATCH 0)
if(WIN32)
set(_hipcc_executable ${HIP_HIPCC_EXECUTABLE}.bat)
else()
set(_hipcc_executable ${HIP_HIPCC_EXECUTABLE})
endif()
# Get version from the output.
execute_process(COMMAND ${HIP_HIPCC_EXECUTABLE} --version
OUTPUT_VARIABLE HIP_VERSION_RAW
execute_process(COMMAND ${_hipcc_executable} --version
OUTPUT_VARIABLE _hip_version_raw
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
# Parse parts.
if(HIP_VERSION_RAW MATCHES "HIP version: .*")
if(_hip_version_raw MATCHES "HIP version: .*")
# Strip the HIP prefix and get list of individual version components.
string(REGEX REPLACE
".*HIP version: ([.0-9]+).*" "\\1"
HIP_SEMANTIC_VERSION "${HIP_VERSION_RAW}")
string(REPLACE "." ";" HIP_VERSION_PARTS "${HIP_SEMANTIC_VERSION}")
list(LENGTH HIP_VERSION_PARTS NUM_HIP_VERSION_PARTS)
_hip_semantic_version "${_hip_version_raw}")
string(REPLACE "." ";" _hip_version_parts "${_hip_semantic_version}")
list(LENGTH _hip_version_parts _num_hip_version_parts)
# Extract components into corresponding variables.
if(NUM_HIP_VERSION_PARTS GREATER 0)
list(GET HIP_VERSION_PARTS 0 HIP_VERSION_MAJOR)
if(_num_hip_version_parts GREATER 0)
list(GET _hip_version_parts 0 HIP_VERSION_MAJOR)
endif()
if(NUM_HIP_VERSION_PARTS GREATER 1)
list(GET HIP_VERSION_PARTS 1 HIP_VERSION_MINOR)
if(_num_hip_version_parts GREATER 1)
list(GET _hip_version_parts 1 HIP_VERSION_MINOR)
endif()
if(NUM_HIP_VERSION_PARTS GREATER 2)
list(GET HIP_VERSION_PARTS 2 HIP_VERSION_PATCH)
if(_num_hip_version_parts GREATER 2)
list(GET _hip_version_parts 2 HIP_VERSION_PATCH)
endif()
# Unset temp variables.
unset(NUM_HIP_VERSION_PARTS)
unset(HIP_SEMANTIC_VERSION)
unset(HIP_VERSION_PARTS)
unset(_num_hip_version_parts)
unset(_hip_semantic_version)
unset(_hip_version_parts)
endif()
# Construct full semantic version.
set(HIP_VERSION "${HIP_VERSION_MAJOR}.${HIP_VERSION_MINOR}.${HIP_VERSION_PATCH}")
unset(HIP_VERSION_RAW)
else()
set(HIP_FOUND FALSE)
unset(_hip_version_raw)
unset(_hipcc_executable)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(HIP
REQUIRED_VARS HIP_HIPCC_EXECUTABLE
VERSION_VAR HIP_VERSION)

View File

@@ -0,0 +1,47 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2021 Blender Foundation.
# Find HIPRT SDK. This module defines:
# HIPRT_INCLUDE_DIR, path to HIPRT include directory
# HIPRT_BITCODE, bitcode file with ray-tracing functionality
# HIPRT_FOUND, if SDK found
# If HIPRT_ROOT_DIR was defined in the environment, use it.
if(NOT HIPRT_ROOT_DIR AND NOT $ENV{HIPRT_ROOT_DIR} STREQUAL "")
set(HIPRT_ROOT_DIR $ENV{HIPRT_ROOT_DIR})
endif()
set(_hiprt_SEARCH_DIRS
${HIPRT_ROOT_DIR}
)
find_path(HIPRT_INCLUDE_DIR
NAMES
hiprt/hiprt.h
HINTS
${_hiprt_SEARCH_DIRS}
)
if(HIPRT_INCLUDE_DIR)
file(STRINGS "${HIPRT_INCLUDE_DIR}/hiprt/hiprt.h" _hiprt_version
REGEX "^#define HIPRT_VERSION_STR[ \t]\".*\"$")
string(REGEX MATCHALL "[0-9]+[.0-9]+" _hiprt_version ${_hiprt_version})
find_file(HIPRT_BITCODE
NAMES
hiprt${_hiprt_version}_amd_lib_win.bc
HINTS
${HIPRT_ROOT_DIR}/dist/bin/Release
NO_DEFAULT_PATH
)
unset(_hiprt_version)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(HIPRT DEFAULT_MSG
HIPRT_INCLUDE_DIR HIPRT_BITCODE)
mark_as_advanced(
HIPRT_INCLUDE_DIR
)

View File

@@ -31,7 +31,8 @@ IF(NOT PYTHON_ROOT_DIR AND NOT $ENV{PYTHON_ROOT_DIR} STREQUAL "")
SET(PYTHON_ROOT_DIR $ENV{PYTHON_ROOT_DIR})
ENDIF()
SET(PYTHON_VERSION 3.10 CACHE STRING "Python Version (major and minor only)")
SET(_PYTHON_VERSION_SUPPORTED 3.10)
SET(PYTHON_VERSION ${_PYTHON_VERSION_SUPPORTED} CACHE STRING "Python Version (major and minor only)")
MARK_AS_ADVANCED(PYTHON_VERSION)
@@ -178,8 +179,24 @@ UNSET(_IS_LIB_PATH_DEF)
# handle the QUIETLY and REQUIRED arguments and SET PYTHONLIBSUNIX_FOUND to TRUE IF
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibsUnix DEFAULT_MSG
PYTHON_LIBRARY PYTHON_LIBPATH PYTHON_INCLUDE_DIR PYTHON_INCLUDE_CONFIG_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibsUnix
# NOTE(@ideasman42): Instead of `DEFAULT_MSG` use a custom message because users
# may have newer versions Python and not be using pre-compiled libraries
# (on other UNIX systems or using an esoteric architecture).
# Some Python developers might want to use the newer features of Python too.
# While we could automatically detect and use newer versions but this would result in
# developers using a configuration which isn't officially supported without realizing it.
# So warn that the officially supported Python version is not found and let the developer
# explicitly set the newer version if they wish.
# From a maintenance perspective it's typically not a problem to support newer versions,
# doing so can help ease the process of upgrading too, nevertheless these versions don't
# have the same level of testing & support.
"\
'PYTHON_VERSION=${_PYTHON_VERSION_SUPPORTED}' not found! \
This is the only officially supported version. \
If you wish to use a newer Python version you may set 'PYTHON_VERSION' \
however we do not guarantee full compatibility in this case."
PYTHON_LIBRARY PYTHON_LIBPATH PYTHON_INCLUDE_DIR PYTHON_INCLUDE_CONFIG_DIR)
IF(PYTHONLIBSUNIX_FOUND)
# Assign cache items
@@ -215,6 +232,7 @@ IF(PYTHONLIBSUNIX_FOUND)
ENDIF()
UNSET(_PYTHON_ABI_FLAGS)
UNSET(_PYTHON_VERSION_SUPPORTED)
UNSET(_python_SEARCH_DIRS)
MARK_AS_ADVANCED(

View File

@@ -108,7 +108,11 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(SYCL
IF(SYCL_FOUND)
SET(SYCL_INCLUDE_DIR ${SYCL_INCLUDE_DIR} ${SYCL_INCLUDE_DIR}/sycl)
SET(SYCL_LIBRARIES ${SYCL_LIBRARY})
IF(WIN32 AND SYCL_LIBRARY_DEBUG)
SET(SYCL_LIBRARIES optimized ${SYCL_LIBRARY} debug ${SYCL_LIBRARY_DEBUG})
ELSE()
SET(SYCL_LIBRARIES ${SYCL_LIBRARY})
ENDIF()
ELSE()
SET(SYCL_SYCL_FOUND FALSE)
ENDIF()

View File

@@ -1,58 +0,0 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",
]
CHECKER_BIN = "smatch"
CHECKER_ARGS = [
"--full-path",
"--two-passes",
]
import project_source_info
import subprocess
import sys
import os
USE_QUIET = (os.environ.get("QUIET", None) is not None)
def main():
source_info = project_source_info.build_info(use_cxx=False, ignore_prefix_list=CHECKER_IGNORE_PREFIX)
source_defines = project_source_info.build_defines_as_args()
check_commands = []
for c, inc_dirs, defs in source_info:
cmd = ([CHECKER_BIN] +
CHECKER_ARGS +
[c] +
[("-I%s" % i) for i in inc_dirs] +
[("-D%s" % d) for d in defs] +
source_defines
)
check_commands.append((c, cmd))
def my_process(i, c, cmd):
if not USE_QUIET:
percent = 100.0 * (i / len(check_commands))
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
sys.stdout.flush()
sys.stdout.write("%s %s\n" % (percent_str, c))
return subprocess.Popen(cmd)
process_functions = []
for i, (c, cmd) in enumerate(check_commands):
process_functions.append((my_process, (i, c, cmd)))
project_source_info.queue_processes(process_functions)
if __name__ == "__main__":
main()

View File

@@ -1,56 +0,0 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",
]
CHECKER_BIN = "sparse"
CHECKER_ARGS = [
]
import project_source_info
import subprocess
import sys
import os
USE_QUIET = (os.environ.get("QUIET", None) is not None)
def main():
source_info = project_source_info.build_info(use_cxx=False, ignore_prefix_list=CHECKER_IGNORE_PREFIX)
source_defines = project_source_info.build_defines_as_args()
check_commands = []
for c, inc_dirs, defs in source_info:
cmd = ([CHECKER_BIN] +
CHECKER_ARGS +
[c] +
[("-I%s" % i) for i in inc_dirs] +
[("-D%s" % d) for d in defs] +
source_defines
)
check_commands.append((c, cmd))
def my_process(i, c, cmd):
if not USE_QUIET:
percent = 100.0 * (i / len(check_commands))
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
sys.stdout.flush()
sys.stdout.write("%s %s\n" % (percent_str, c))
return subprocess.Popen(cmd)
process_functions = []
for i, (c, cmd) in enumerate(check_commands):
process_functions.append((my_process, (i, c, cmd)))
project_source_info.queue_processes(process_functions)
if __name__ == "__main__":
main()

View File

@@ -1,86 +0,0 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",
]
CHECKER_BIN = "splint"
CHECKER_ARGS = [
"-weak",
"-posix-lib",
"-linelen", "10000",
"+ignorequals",
"+relaxtypes",
"-retvalother",
"+matchanyintegral",
"+longintegral",
"+ignoresigns",
"-nestcomment",
"-predboolothers",
"-ifempty",
"-unrecogcomments",
# we may want to remove these later
"-type",
"-fixedformalarray",
"-fullinitblock",
"-fcnuse",
"-initallelements",
"-castfcnptr",
# -forcehints,
"-bufferoverflowhigh", # warns a lot about sprintf()
# re-definitions, rna causes most of these
"-redef",
"-syntax",
# dummy, witjout this splint complains with:
# /usr/include/bits/confname.h:31:27: *** Internal Bug at cscannerHelp.c:2428: Unexpanded macro not function or constant: int _PC_MAX_CANON
"-D_PC_MAX_CANON=0",
]
import project_source_info
import subprocess
import sys
import os
USE_QUIET = (os.environ.get("QUIET", None) is not None)
def main():
source_info = project_source_info.build_info(use_cxx=False, ignore_prefix_list=CHECKER_IGNORE_PREFIX)
check_commands = []
for c, inc_dirs, defs in source_info:
cmd = ([CHECKER_BIN] +
CHECKER_ARGS +
[c] +
[("-I%s" % i) for i in inc_dirs] +
[("-D%s" % d) for d in defs]
)
check_commands.append((c, cmd))
def my_process(i, c, cmd):
if not USE_QUIET:
percent = 100.0 * (i / len(check_commands))
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
sys.stdout.write("%s %s\n" % (percent_str, c))
sys.stdout.flush()
return subprocess.Popen(cmd)
process_functions = []
for i, (c, cmd) in enumerate(check_commands):
process_functions.append((my_process, (i, c, cmd)))
project_source_info.queue_processes(process_functions)
if __name__ == "__main__":
main()

View File

@@ -12,6 +12,7 @@ set(WITH_BUILDINFO OFF CACHE BOOL "" FORCE)
# developer profile for now.
if(NOT WIN32)
set(WITH_COMPILER_ASAN ON CACHE BOOL "" FORCE)
set(WITH_STRSIZE_DEBUG ON CACHE BOOL "" FORCE)
endif()
set(WITH_CYCLES_NATIVE_ONLY ON CACHE BOOL "" FORCE)
set(WITH_DOC_MANPAGE OFF CACHE BOOL "" FORCE)

View File

@@ -81,8 +81,10 @@ if(NOT APPLE)
set(WITH_CYCLES_DEVICE_OPTIX ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_CUDA_BINARIES ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_CUBIN_COMPILER OFF CACHE BOOL "" FORCE)
set(WITH_CYCLES_HIP_BINARIES OFF CACHE BOOL "" FORCE)
set(WITH_CYCLES_HIP_BINARIES ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_DEVICE_ONEAPI ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_ONEAPI_BINARIES ON CACHE BOOL "" FORCE)
endif()
if(WIN32)
set(WITH_CYCLES_DEVICE_HIPRT ON CACHE BOOL "" FORCE)
endif()

View File

@@ -1384,4 +1384,3 @@ macro(windows_process_platform_bundled_libraries library_deps)
endforeach()
endif()
endmacro()

View File

@@ -174,7 +174,7 @@ if(SYSTEMSTUBS_LIBRARY)
list(APPEND PLATFORM_LINKLIBS SystemStubs)
endif()
string(APPEND PLATFORM_CFLAGS " -pipe -funsigned-char -fno-strict-aliasing")
string(APPEND PLATFORM_CFLAGS " -pipe -funsigned-char -fno-strict-aliasing -ffp-contract=off")
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"
)

View File

@@ -20,14 +20,14 @@ else()
# Choose the best suitable libraries.
if(EXISTS ${LIBDIR_NATIVE_ABI})
set(LIBDIR ${LIBDIR_NATIVE_ABI})
set(WITH_LIBC_MALLOC_HOOK_WORKAROUND True)
set(WITH_LIBC_MALLOC_HOOK_WORKAROUND TRUE)
elseif(EXISTS ${LIBDIR_GLIBC228_ABI})
set(LIBDIR ${LIBDIR_GLIBC228_ABI})
if(WITH_MEM_JEMALLOC)
# jemalloc provides malloc hooks.
set(WITH_LIBC_MALLOC_HOOK_WORKAROUND False)
set(WITH_LIBC_MALLOC_HOOK_WORKAROUND FALSE)
else()
set(WITH_LIBC_MALLOC_HOOK_WORKAROUND True)
set(WITH_LIBC_MALLOC_HOOK_WORKAROUND TRUE)
endif()
endif()
@@ -314,7 +314,7 @@ if(WITH_CYCLES AND WITH_CYCLES_OSL)
endif()
endif()
if(WITH_CYCLES AND (WITH_CYCLES_DEVICE_ONEAPI OR (WITH_CYCLES_EMBREE AND EMBREE_SYCL_SUPPORT)))
if(WITH_CYCLES AND WITH_CYCLES_DEVICE_ONEAPI)
set(CYCLES_LEVEL_ZERO ${LIBDIR}/level-zero CACHE PATH "Path to Level Zero installation")
if(EXISTS ${CYCLES_LEVEL_ZERO} AND NOT LEVEL_ZERO_ROOT_DIR)
set(LEVEL_ZERO_ROOT_DIR ${CYCLES_LEVEL_ZERO})
@@ -324,6 +324,13 @@ if(WITH_CYCLES AND (WITH_CYCLES_DEVICE_ONEAPI OR (WITH_CYCLES_EMBREE AND EMBREE_
if(EXISTS ${CYCLES_SYCL} AND NOT SYCL_ROOT_DIR)
set(SYCL_ROOT_DIR ${CYCLES_SYCL})
endif()
endif()
# add_bundled_libraries for SYCL, but custom since we need to filter the files.
if(DEFINED LIBDIR)
if(NOT DEFINED SYCL_ROOT_DIR)
set(SYCL_ROOT_DIR ${LIBDIR}/dpcpp)
endif()
file(GLOB _sycl_runtime_libraries
${SYCL_ROOT_DIR}/lib/libsycl.so
${SYCL_ROOT_DIR}/lib/libsycl.so.*
@@ -692,10 +699,12 @@ if(WITH_GHOST_WAYLAND)
if(WITH_GHOST_WAYLAND_LIBDECOR)
if(_use_system_wayland)
pkg_check_modules(libdecor REQUIRED libdecor-0>=0.1)
pkg_check_modules(libdecor libdecor-0>=0.1)
else()
set(libdecor_INCLUDE_DIRS "${LIBDIR}/wayland_libdecor/include/libdecor-0")
set(libdecor_FOUND ON)
endif()
set_and_warn_library_found("libdecor" libdecor_FOUND WITH_GHOST_WAYLAND_LIBDECOR)
endif()
if(WITH_GHOST_WAYLAND_DBUS)
@@ -803,8 +812,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
# Automatically turned on when building with "-march=native". This is
# explicitly turned off here as it will make floating point math give a bit
# different results. This will lead to automated test failures. So disable
# this until we support it. Seems to default to off in clang and the intel
# compiler.
# this until we support it.
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing -ffp-contract=off")
# `maybe-uninitialized` is unreliable in release builds, but fine in debug builds.
@@ -815,64 +823,49 @@ if(CMAKE_COMPILER_IS_GNUCC)
string(PREPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO "${GCC_EXTRA_FLAGS_RELEASE} ")
unset(GCC_EXTRA_FLAGS_RELEASE)
# NOTE(@campbellbarton): Eventually mold will be able to use `-fuse-ld=mold`,
# however at the moment this only works for GCC 12.1+ (unreleased at time of writing).
# So a workaround is used here "-B" which points to another path to find system commands
# such as `ld`.
if(WITH_LINKER_MOLD AND _IS_LINKER_DEFAULT)
find_program(MOLD_BIN "mold")
mark_as_advanced(MOLD_BIN)
if(NOT MOLD_BIN)
message(STATUS "The \"mold\" binary could not be found, using system linker.")
set(WITH_LINKER_MOLD OFF)
elseif(CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1)
message(STATUS "GCC 12.1 or newer is required for th MOLD linker.")
set(WITH_LINKER_MOLD OFF)
else()
# By default mold installs the binary to:
# - `{PREFIX}/bin/mold` as well as a symbolic-link in...
# - `{PREFIX}/lib/mold/ld`.
# (where `PREFIX` is typically `/usr/`).
#
# This block of code finds `{PREFIX}/lib/mold` from the `mold` binary.
# Other methods of searching for the path could also be made to work,
# we could even make our own directory and symbolic-link, however it's more
# convenient to use the one provided by mold.
#
# Use the binary path to "mold", to find the common prefix which contains "lib/mold".
# The parent directory: e.g. `/usr/bin/mold` -> `/usr/bin/`.
get_filename_component(MOLD_PREFIX "${MOLD_BIN}" DIRECTORY)
# The common prefix path: e.g. `/usr/bin/` -> `/usr/` to use as a hint.
get_filename_component(MOLD_PREFIX "${MOLD_PREFIX}" DIRECTORY)
# Find `{PREFIX}/lib/mold/ld`, store the directory component (without the `ld`).
# Then pass `-B {PREFIX}/lib/mold` to GCC so the `ld` located there overrides the default.
find_path(
MOLD_BIN_DIR "ld"
HINTS "${MOLD_PREFIX}"
# The default path is `libexec`, Arch Linux for e.g.
# replaces this with `lib` so check both.
PATH_SUFFIXES "libexec/mold" "lib/mold" "lib64/mold"
NO_DEFAULT_PATH
NO_CACHE
get_filename_component(MOLD_BIN_DIR "${MOLD_BIN}" DIRECTORY)
# Check if the `-B` argument is required.
# This will happen when `MOLD_BIN` points to a non-standard location.
# Keep this option as mold is not yet a standard system component and
# users may have it installed in some unexpected place.
set(_mold_args "-fuse-ld=mold")
execute_process(
COMMAND ${CMAKE_C_COMPILER} -B ${MOLD_BIN_DIR} ${_mold_args} -Wl,--version
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION_WITH_DIR
)
if(NOT MOLD_BIN_DIR)
message(STATUS
"The mold linker could not find the directory containing the linker command "
"(typically "
"\"${MOLD_PREFIX}/libexec/mold/ld\") or "
"\"${MOLD_PREFIX}/lib/mold/ld\") using system linker."
)
set(WITH_LINKER_MOLD OFF)
execute_process(
COMMAND ${CMAKE_C_COMPILER} ${_mold_args} -Wl,--version
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION
)
if(NOT (LD_VERSION STREQUAL LD_VERSION_WITH_DIR))
string(PREPEND _mold_args "-B \"${MOLD_BIN_DIR}\" ")
set(LD_VERSION "${LD_VERSION_WITH_DIR}")
endif()
unset(MOLD_PREFIX)
endif()
if(WITH_LINKER_MOLD)
# GCC will search for `ld` in this directory first.
string(APPEND CMAKE_EXE_LINKER_FLAGS " -B \"${MOLD_BIN_DIR}\"")
string(APPEND CMAKE_SHARED_LINKER_FLAGS " -B \"${MOLD_BIN_DIR}\"")
string(APPEND CMAKE_MODULE_LINKER_FLAGS " -B \"${MOLD_BIN_DIR}\"")
set(_IS_LINKER_DEFAULT OFF)
if("${LD_VERSION}" MATCHES "mold ")
string(APPEND CMAKE_EXE_LINKER_FLAGS " ${_mold_args}")
string(APPEND CMAKE_SHARED_LINKER_FLAGS " ${_mold_args}")
string(APPEND CMAKE_MODULE_LINKER_FLAGS " ${_mold_args}")
set(_IS_LINKER_DEFAULT OFF)
else()
message(STATUS "GNU mold linker isn't available, using the default system linker.")
endif()
unset(_mold_args)
unset(MOLD_BIN_DIR)
unset(LD_VERSION)
endif()
unset(MOLD_BIN)
unset(MOLD_BIN_DIR)
endif()
if(WITH_LINKER_GOLD AND _IS_LINKER_DEFAULT)
@@ -907,7 +900,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
# CLang is the same as GCC for now.
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing -ffp-contract=off")
if(WITH_LINKER_MOLD AND _IS_LINKER_DEFAULT)
find_program(MOLD_BIN "mold")
@@ -1019,7 +1012,7 @@ if(PLATFORM_BUNDLED_LIBRARIES)
# Environment variables to run precompiled executables that needed libraries.
list(JOIN PLATFORM_BUNDLED_LIBRARY_DIRS ":" _library_paths)
set(PLATFORM_ENV_BUILD "LD_LIBRARY_PATH=\"${_library_paths};${LD_LIBRARY_PATH}\"")
set(PLATFORM_ENV_BUILD "LD_LIBRARY_PATH=\"${_library_paths}:${LD_LIBRARY_PATH}\"")
set(PLATFORM_ENV_INSTALL "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/lib/;$LD_LIBRARY_PATH")
unset(_library_paths)
endif()

View File

@@ -39,8 +39,14 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(WITH_WINDOWS_STRIPPED_PDB OFF)
endif()
else()
if(WITH_BLENDER AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.28.29921) # MSVC 2019 16.9.16
message(FATAL_ERROR "Compiler is unsupported, MSVC 2019 16.9.16 or newer is required for building blender.")
if(WITH_BLENDER)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.28.29921) # MSVC 2019 16.9.16
message(FATAL_ERROR "Compiler is unsupported, MSVC 2019 16.9.16 or newer is required for building blender.")
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.36.32532 AND # MSVC 2022 17.6.0 has a bad codegen
CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.37.32705) # But it is fixed in 2022 17.7 preview 1
message(FATAL_ERROR "Compiler is unsupported, MSVC 2022 17.6.x has codegen issues and cannot be used to build blender. Please use MSVC 17.5 for the time being.")
endif()
endif()
endif()
@@ -363,7 +369,11 @@ windows_find_package(Freetype REQUIRED)
if(WITH_FFTW3)
set(FFTW3 ${LIBDIR}/fftw3)
set(FFTW3_LIBRARIES ${FFTW3}/lib/libfftw.lib)
if(EXISTS ${FFTW3}/lib/libfftw3-3.lib) # 3.6 libraries
set(FFTW3_LIBRARIES ${FFTW3}/lib/libfftw3-3.lib ${FFTW3}/lib/libfftw3f.lib)
else()
set(FFTW3_LIBRARIES ${FFTW3}/lib/libfftw.lib) # 3.5 Libraries
endif()
set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
set(FFTW3_LIBPATH ${FFTW3}/lib)
endif()
@@ -1030,7 +1040,7 @@ endif()
if(WITH_VULKAN_BACKEND)
if(EXISTS ${LIBDIR}/vulkan)
set(VULKAN_FOUND On)
set(VULKAN_FOUND ON)
set(VULKAN_ROOT_DIR ${LIBDIR}/vulkan)
set(VULKAN_INCLUDE_DIR ${VULKAN_ROOT_DIR}/include)
set(VULKAN_INCLUDE_DIRS ${VULKAN_INCLUDE_DIR})
@@ -1044,7 +1054,7 @@ endif()
if(WITH_VULKAN_BACKEND)
if(EXISTS ${LIBDIR}/shaderc)
set(SHADERC_FOUND On)
set(SHADERC_FOUND ON)
set(SHADERC_ROOT_DIR ${LIBDIR}/shaderc)
set(SHADERC_INCLUDE_DIR ${SHADERC_ROOT_DIR}/include)
set(SHADERC_INCLUDE_DIRS ${SHADERC_INCLUDE_DIR})

View File

@@ -8,8 +8,12 @@ buildbot:
version: '10.1.243'
cuda11:
version: '11.4.1'
cuda12:
version: '12.1.1'
hip:
version: '5.3.22480'
version: '5.5.30571'
hiprt:
version: '2.0.3a134c7'
optix:
version: '7.3.0'
ocloc:

View File

@@ -38,7 +38,7 @@ PROJECT_NAME = Blender
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = V3.6
PROJECT_NUMBER = V4.0
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a

View File

@@ -302,10 +302,6 @@
* \ingroup imbuf
*/
/** \defgroup imbdds DDS
* \ingroup imbuf
*/
/** \defgroup openexr OpenEXR
* \ingroup imbuf
*/

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
'''
"""
This script generates the blender.1 man page, embedding the help text
from the Blender executable itself. Invoke it as follows:
@@ -9,7 +9,7 @@ from the Blender executable itself. Invoke it as follows:
where <path-to-blender> is the path to the Blender executable,
and <output-filename> is where to write the generated man page.
'''
"""
import argparse
import os
@@ -87,29 +87,29 @@ def man_page_from_blender_help(fh: TextIO, blender_bin: str, verbose: bool) -> N
(blender_info["date"], blender_info["version"].replace(".", "\\&."))
)
fh.write(r'''
fh.write(r"""
.SH NAME
blender \- a full-featured 3D application''')
blender \- a full-featured 3D application""")
fh.write(r'''
fh.write(r"""
.SH SYNOPSIS
.B blender [args ...] [file] [args ...]''')
.B blender [args ...] [file] [args ...]""")
fh.write(r'''
fh.write(r"""
.br
.SH DESCRIPTION
.PP
.B blender
is a full-featured 3D application. It supports the entirety of the 3D pipeline - '''
'''modeling, rigging, animation, simulation, rendering, compositing, motion tracking, and video editing.
is a full-featured 3D application. It supports the entirety of the 3D pipeline - """
"""modeling, rigging, animation, simulation, rendering, compositing, motion tracking, and video editing.
Use Blender to create 3D images and animations, films and commercials, content for games, '''
r'''architectural and industrial visualizations, and scientific visualizations.
Use Blender to create 3D images and animations, films and commercials, content for games, """
r"""architectural and industrial visualizations, and scientific visualizations.
https://www.blender.org''')
https://www.blender.org""")
fh.write(r'''
.SH OPTIONS''')
fh.write(r"""
.SH OPTIONS""")
fh.write("\n\n")
@@ -152,7 +152,7 @@ https://www.blender.org''')
# Footer Content.
fh.write(r'''
fh.write(r"""
.br
.SH SEE ALSO
.B luxrender(1)
@@ -162,7 +162,7 @@ https://www.blender.org''')
This manpage was written for a Debian GNU/Linux system by Daniel Mester
<mester@uni-bremen.de> and updated by Cyril Brulebois
<cyril.brulebois@enst-bretagne.fr> and Dan Eicher <dan@trollwerks.org>.
''')
""")
def create_argparse() -> argparse.ArgumentParser:

View File

@@ -37,7 +37,7 @@ def draw_callback_px(self, context):
# BLF drawing routine
font_id = font_info["font_id"]
blf.position(font_id, 2, 80, 0)
blf.size(font_id, 50)
blf.size(font_id, 50.0)
blf.draw(font_id, "Hello World")

View File

@@ -20,7 +20,7 @@ you would pass ``{'active_object': object}`` to :class:`bpy.types.Context.temp_o
# Remove all objects in scene rather than the selected ones.
import bpy
from bpy import context
override = context.copy()
override["selected_objects"] = list(context.scene.objects)
with context.temp_override(**override):
context_override = context.copy()
context_override["selected_objects"] = list(context.scene.objects)
with context.temp_override(**context_override):
bpy.ops.object.delete()

View File

@@ -27,17 +27,11 @@ Keywords and Positional Arguments
For calling operators keywords are used for operator properties and
positional arguments are used to define how the operator is called.
There are 3 optional positional arguments (documented in detail below).
There are 2 optional positional arguments (documented in detail below).
.. code-block:: python
bpy.ops.test.operator(override_context, execution_context, undo)
- override_context - ``dict`` type.
.. deprecated:: 3.2
:class:`bpy.types.Context.temp_override` should be used instead of this argument.
bpy.ops.test.operator(execution_context, undo)
- execution_context - ``str`` (enum).
- undo - ``bool`` type.

View File

@@ -77,7 +77,7 @@ Typically multiple shaders are linked together into a *Program*.
However, in the Blender Python API the term *Shader* refers to an OpenGL Program.
Every :class:`gpu.types.GPUShader` consists of a vertex shader, a fragment shader and an optional geometry shader.
For common drawing tasks there are some built-in shaders accessible from :class:`gpu.shader.from_builtin`
with an identifier such as `2D_UNIFORM_COLOR` or `3D_FLAT_COLOR`.
with an identifier such as `UNIFORM_COLOR` or `FLAT_COLOR`.
Every shader defines a set of attributes and uniforms that have to be set in order to use the shader.
Attributes are properties that are set using a vertex buffer and can be different for individual vertices.
@@ -129,7 +129,7 @@ import gpu
from gpu_extras.batch import batch_for_shader
coords = [(1, 1, 1), (-2, 0, 0), (-2, -1, 3), (0, 1, 1)]
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
shader = gpu.shader.from_builtin('UNIFORM_COLOR')
batch = batch_for_shader(shader, 'LINES', {"pos": coords})

View File

@@ -17,7 +17,7 @@ indices = (
(4, 5), (4, 6), (5, 7), (6, 7),
(0, 4), (1, 5), (2, 6), (3, 7))
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
shader = gpu.shader.from_builtin('UNIFORM_COLOR')
batch = batch_for_shader(shader, 'LINES', {"pos": coords}, indices=indices)

View File

@@ -21,7 +21,7 @@ mesh.loop_triangles.foreach_get(
vertex_colors = [(random(), random(), random(), 1) for _ in range(len(mesh.vertices))]
shader = gpu.shader.from_builtin('3D_SMOOTH_COLOR')
shader = gpu.shader.from_builtin('SMOOTH_COLOR')
batch = batch_for_shader(
shader, 'TRIS',
{"pos": vertices, "color": vertex_colors},

View File

@@ -13,7 +13,7 @@ vertices = (
indices = (
(0, 1, 2), (2, 1, 3))
shader = gpu.shader.from_builtin('2D_UNIFORM_COLOR')
shader = gpu.shader.from_builtin('UNIFORM_COLOR')
batch = batch_for_shader(shader, 'TRIS', {"pos": vertices}, indices=indices)

View File

@@ -12,7 +12,7 @@ IMAGE_NAME = "Untitled"
image = bpy.data.images[IMAGE_NAME]
texture = gpu.texture.from_image(image)
shader = gpu.shader.from_builtin('2D_IMAGE')
shader = gpu.shader.from_builtin('IMAGE')
batch = batch_for_shader(
shader, 'TRI_FAN',
{
@@ -45,7 +45,7 @@ IMAGE_NAME = "Untitled"
image = bpy.data.images[IMAGE_NAME]
texture = gpu.texture.from_image(image)
shader = gpu.shader.from_builtin('3D_IMAGE')
shader = gpu.shader.from_builtin('IMAGE')
batch = batch_for_shader(
shader, 'TRIS',
{

View File

@@ -865,29 +865,40 @@ Unfortunate Corner Cases
Besides all expected cases listed above, there are a few others that should not be
an issue but, due to internal implementation details, currently are:
- ``Object.hide_viewport``, ``Object.hide_select`` and ``Object.hide_render``:
Setting any of those Booleans will trigger a rebuild of Collection caches,
thus breaking any current iteration over ``Collection.all_objects``.
Collection Objects
^^^^^^^^^^^^^^^^^^
Changing: ``Object.hide_viewport``, ``Object.hide_select`` or ``Object.hide_render``
will trigger a rebuild of Collection caches, thus breaking any current iteration over ``Collection.all_objects``.
.. rubric:: Do not:
.. code-block:: python
# `all_objects` is an iterator. Using it directly while performing operations on its members that will update
# the memory accessed by the `all_objects` iterator will lead to invalid memory accesses and crashes.
for object in bpy.data.collections["Collection"].all_objects:
object.hide_viewport = True
.. rubric:: Do not:
.. rubric:: Do:
.. code-block:: python
.. code-block:: python
# `all_objects` is an iterator. Using it directly while performing operations on its members that will update
# the memory accessed by the `all_objects` iterator will lead to invalid memory accesses and crashes.
for object in bpy.data.collections["Collection"].all_objects:
object.hide_viewport = True
# `all_objects[:]` is an independent list generated from the iterator. As long as no objects are deleted,
# its content will remain valid even if the data accessed by the `all_objects` iterator is modified.
for object in bpy.data.collections["Collection"].all_objects[:]:
object.hide_viewport = True
.. rubric:: Do:
Data-Blocks Renaming During Iteration
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: python
# `all_objects[:]` is an independent list generated from the iterator. As long as no objects are deleted,
# its content will remain valid even if the data accessed by the `all_objects` iterator is modified.
for object in bpy.data.collections["Collection"].all_objects[:]:
object.hide_viewport = True
Data-blocks accessed from ``bpy.data`` are sorted when their name is set.
Any loop that iterates of a data such as ``bpy.data.objects`` for example,
and sets the objects ``name`` must get all items from the iterator first (typically by converting to a list or tuple)
to avoid missing some objects and iterating over others multiple times.
sys.exit

View File

@@ -8,3 +8,5 @@ Local modifications:
* Added special definitions of HAVE_SNPRINTF and HAVE_LIB_GFLAGS
in Windows' specific config.h.
* Silenced syscall deprecation warnings on macOS >= 10.12.
* Usage of syscall() is not allowed and use getthrid() to
retreive the thread ID on OpenBSD

View File

@@ -2,6 +2,8 @@
#include "config_mac.h"
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#include "config_freebsd.h"
#elif defined(__OpenBSD__)
#include "config_openbsd.h"
#elif defined(__MINGW32__)
#include "windows/config.h"
#elif defined(__linux__)

192
extern/glog/src/config_openbsd.h vendored Normal file
View File

@@ -0,0 +1,192 @@
/* define if glog doesn't use RTTI */
/* #undef DISABLE_RTTI */
/* Namespace for Google classes */
#define GOOGLE_NAMESPACE google
/* Define if you have the `dladdr' function */
/* #undef HAVE_DLADDR */
/* Define if you have the `snprintf' function */
#define HAVE_SNPRINTF
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H
/* Define to 1 if you have the <execinfo.h> header file. */
/* #undef HAVE_EXECINFO_H */
/* Define if you have the `fcntl' function */
#define HAVE_FCNTL
/* Define to 1 if you have the <glob.h> header file. */
#define HAVE_GLOB_H
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `pthread' library (-lpthread). */
#define HAVE_LIBPTHREAD
/* Define to 1 if you have the <libunwind.h> header file. */
/* #undef HAVE_LIBUNWIND_H */
/* define if you have google gflags library */
#define HAVE_LIB_GFLAGS
/* define if you have google gmock library */
/* #undef HAVE_LIB_GMOCK */
/* define if you have google gtest library */
/* #undef HAVE_LIB_GTEST */
/* define if you have libunwind */
/* #undef HAVE_LIB_UNWIND */
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H
/* define to disable multithreading support. */
/* #undef NO_THREADS */
/* define if the compiler implements namespaces */
#define HAVE_NAMESPACES
/* Define if you have the 'pread' function */
#define HAVE_PREAD
/* Define if you have POSIX threads libraries and header files. */
#define HAVE_PTHREAD
/* Define to 1 if you have the <pwd.h> header file. */
#define HAVE_PWD_H
/* Define if you have the 'pwrite' function */
#define HAVE_PWRITE
/* define if the compiler implements pthread_rwlock_* */
#define HAVE_RWLOCK 1
/* Define if you have the 'sigaction' function */
#define HAVE_SIGACTION
/* Define if you have the `sigaltstack' function */
#define HAVE_SIGALTSTACK 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H
/* Define to 1 if you have the <syscall.h> header file. */
/* #undef HAVE_SYSCALL_H */
/* Define to 1 if you have the <syslog.h> header file. */
#define HAVE_SYSLOG_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/syscall.h> header file. */
#define HAVE_SYS_SYSCALL_H
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/ucontext.h> header file. */
/* #undef HAVE_SYS_UCONTEXT_H */
/* Define to 1 if you have the <sys/utsname.h> header file. */
#define HAVE_SYS_UTSNAME_H
/* Define to 1 if you have the <ucontext.h> header file. */
/* #undef HAVE_UCONTEXT_H */
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the <unwind.h> header file. */
#define HAVE_UNWIND_H 1
/* define if the compiler supports using expression for operator */
#define HAVE_USING_OPERATOR
/* define if your compiler has __attribute__ */
#define HAVE___ATTRIBUTE__
/* define if your compiler has __builtin_expect */
#define HAVE___BUILTIN_EXPECT 1
/* define if your compiler has __sync_val_compare_and_swap */
#define HAVE___SYNC_VAL_COMPARE_AND_SWAP
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
/* #undef LT_OBJDIR */
/* Name of package */
/* #undef PACKAGE */
/* Define to the address where bug reports for this package should be sent. */
/* #undef PACKAGE_BUGREPORT */
/* Define to the full name of this package. */
/* #undef PACKAGE_NAME */
/* Define to the full name and version of this package. */
/* #undef PACKAGE_STRING */
/* Define to the one symbol short name of this package. */
/* #undef PACKAGE_TARNAME */
/* Define to the home page for this package. */
/* #undef PACKAGE_URL */
/* Define to the version of this package. */
/* #undef PACKAGE_VERSION */
/* How to access the PC from a struct ucontext */
/* #undef PC_FROM_UCONTEXT */
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
/* #undef PTHREAD_CREATE_JOINABLE */
/* The size of `void *', as computed by sizeof. */
#define SIZEOF_VOID_P 8
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* the namespace where STL code like vector<> is defined */
#define STL_NAMESPACE std
/* location of source code */
#define TEST_SRC_DIR "."
/* Version number of package */
/* #undef VERSION */
/* Stops putting the code inside the Google namespace */
#define _END_GOOGLE_NAMESPACE_ }
/* Puts following code inside the Google namespace */
#define _START_GOOGLE_NAMESPACE_ namespace google {
#define GOOGLE_GLOG_DLL_DECL
/* isn't getting defined by configure script when clang compilers are used
and cuases compilation errors in stactrace/unwind modules */
#ifdef __clang__
# define NO_FRAME_POINTER
#endif

View File

@@ -59,7 +59,8 @@
# include <unistd.h>
#endif
#if (defined(HAVE_SYSCALL_H) || defined(HAVE_SYS_SYSCALL_H)) && (!(defined OS_MACOSX))
#if (defined(HAVE_SYSCALL_H) || defined(HAVE_SYS_SYSCALL_H)) && \
(!(defined OS_MACOSX) && !(defined OS_OPENBSD))
# define safe_write(fd, s, len) syscall(SYS_write, fd, s, len)
#else
// Not so safe, but what can you do?

View File

@@ -282,6 +282,8 @@ pid_t GetTID() {
return getpid(); // Linux: getpid returns thread ID when gettid is absent
#elif defined OS_WINDOWS && !defined OS_CYGWIN
return GetCurrentThreadId();
#elif defined OS_OPENBSD
return getthrid();
#else
// If none of the techniques above worked, we use pthread_self().
return (pid_t)(uintptr_t)pthread_self();

View File

@@ -12,11 +12,21 @@ set(INC_SYS
set(SRC
src/hipew.c
include/hipew.h
)
set(LIB
)
if(HIPRT_INCLUDE_DIR)
list(APPEND INC_SYS
${HIPRT_INCLUDE_DIR}
)
list(APPEND SRC
src/hiprtew.cc
include/hiprtew.h
)
endif()
blender_add_lib(extern_hipew "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

View File

@@ -43,9 +43,9 @@ extern "C" {
#define HIP_TRSA_OVERRIDE_FORMAT 0x01
#define HIP_TRSF_READ_AS_INTEGER 0x01
#define HIP_TRSF_NORMALIZED_COORDINATES 0x02
#define HIP_LAUNCH_PARAM_END ((void*)0x00)
#define HIP_LAUNCH_PARAM_BUFFER_POINTER ((void*)0x01)
#define HIP_LAUNCH_PARAM_BUFFER_SIZE ((void*)0x02)
#define HIP_LAUNCH_PARAM_END ((void*)0x03)
/* Functions which changed 3.1 -> 3.2 for 64 bit stuff,
* the cuda library has both the old ones for compatibility and new
@@ -55,6 +55,7 @@ extern "C" {
#define hipMemGetInfo hipMemGetInfo
#define hipMemAllocPitch hipMemAllocPitch
#define hipMemGetAddressRange hipMemGetAddressRange
#define hipMemcpy hipMemcpy
#define hipMemcpyHtoD hipMemcpyHtoD
#define hipMemcpyDtoH hipMemcpyDtoH
#define hipMemcpyDtoD hipMemcpyDtoD
@@ -68,6 +69,7 @@ extern "C" {
#define hipMemsetD32 hipMemsetD32
#define hipArrayCreate hipArrayCreate
#define hipArray3DCreate hipArray3DCreate
#define hipPointerGetAttributes hipPointerGetAttributes
#define hipTexRefSetAddress hipTexRefSetAddress
#define hipTexRefGetAddress hipTexRefGetAddress
#define hipStreamDestroy hipStreamDestroy
@@ -108,11 +110,20 @@ typedef struct hipMipmappedArray_st* hipMipmappedArray_t;
typedef struct ihipEvent_t* hipEvent_t;
typedef struct ihipStream_t* hipStream_t;
typedef unsigned long long hipTextureObject_t;
typedef void* hipExternalMemory_t;
typedef struct HIPuuid_st {
char bytes[16];
} HIPuuid;
typedef enum hipMemcpyKind {
hipMemcpyHostToHost = 0,
hipMemcpyHostToDevice = 1,
hipMemcpyDeviceToHost = 2,
hipMemcpyDeviceToDevice = 3,
hipMemcpyDefault = 4
} hipMemcpyKind;
typedef enum hipChannelFormatKind {
hipChannelFormatKindSigned = 0,
hipChannelFormatKindUnsigned = 1,
@@ -1048,28 +1059,105 @@ typedef enum HIPGLmap_flags_enum {
HIP_GL_MAP_RESOURCE_FLAGS_WRITE_DISCARD = 0x02,
} HIPGLmap_flags;
typedef enum hipExternalMemoryHandleType_enum {
hipExternalMemoryHandleTypeOpaqueFd = 1,
hipExternalMemoryHandleTypeOpaqueWin32 = 2,
hipExternalMemoryHandleTypeOpaqueWin32Kmt = 3,
hipExternalMemoryHandleTypeD3D12Heap = 4,
hipExternalMemoryHandleTypeD3D12Resource = 5,
hipExternalMemoryHandleTypeD3D11Resource = 6,
hipExternalMemoryHandleTypeD3D11ResourceKmt = 7,
} hipExternalMemoryHandleType;
typedef struct hipExternalMemoryHandleDesc_st {
hipExternalMemoryHandleType type;
union {
int fd;
struct {
void *handle;
const void *name;
} win32;
} handle;
unsigned long long size;
unsigned int flags;
} hipExternalMemoryHandleDesc;
typedef struct hipExternalMemoryBufferDesc_st {
unsigned long long offset;
unsigned long long size;
unsigned int flags;
} hipExternalMemoryBufferDesc;
/**
* hipRTC related
*/
typedef struct _hiprtcProgram* hiprtcProgram;
typedef enum hiprtcResult {
HIPRTC_SUCCESS = 0,
HIPRTC_ERROR_OUT_OF_MEMORY = 1,
HIPRTC_ERROR_PROGRAM_CREATION_FAILURE = 2,
HIPRTC_ERROR_INVALID_INPUT = 3,
HIPRTC_ERROR_INVALID_PROGRAM = 4,
HIPRTC_ERROR_INVALID_OPTION = 5,
HIPRTC_ERROR_COMPILATION = 6,
HIPRTC_ERROR_BUILTIN_OPERATION_FAILURE = 7,
HIPRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION = 8,
HIPRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION = 9,
HIPRTC_ERROR_NAME_EXPRESSION_NOT_VALID = 10,
HIPRTC_ERROR_INTERNAL_ERROR = 11
HIPRTC_SUCCESS = 0,
HIPRTC_ERROR_OUT_OF_MEMORY = 1,
HIPRTC_ERROR_PROGRAM_CREATION_FAILURE = 2,
HIPRTC_ERROR_INVALID_INPUT = 3,
HIPRTC_ERROR_INVALID_PROGRAM = 4,
HIPRTC_ERROR_INVALID_OPTION = 5,
HIPRTC_ERROR_COMPILATION = 6,
HIPRTC_ERROR_BUILTIN_OPERATION_FAILURE = 7,
HIPRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION = 8,
HIPRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION = 9,
HIPRTC_ERROR_NAME_EXPRESSION_NOT_VALID = 10,
HIPRTC_ERROR_INTERNAL_ERROR = 11,
HIPRTC_ERROR_LINKING = 100
} hiprtcResult;
typedef enum hiprtcJIT_option {
HIPRTC_JIT_MAX_REGISTERS = 0,
HIPRTC_JIT_THREADS_PER_BLOCK,
HIPRTC_JIT_WALL_TIME,
HIPRTC_JIT_INFO_LOG_BUFFER,
HIPRTC_JIT_INFO_LOG_BUFFER_SIZE_BYTES,
HIPRTC_JIT_ERROR_LOG_BUFFER,
HIPRTC_JIT_ERROR_LOG_BUFFER_SIZE_BYTES,
HIPRTC_JIT_OPTIMIZATION_LEVEL,
HIPRTC_JIT_TARGET_FROM_HIPCONTEXT,
HIPRTC_JIT_TARGET,
HIPRTC_JIT_FALLBACK_STRATEGY,
HIPRTC_JIT_GENERATE_DEBUG_INFO,
HIPRTC_JIT_LOG_VERBOSE,
HIPRTC_JIT_GENERATE_LINE_INFO,
HIPRTC_JIT_CACHE_MODE,
HIPRTC_JIT_NEW_SM3X_OPT,
HIPRTC_JIT_FAST_COMPILE,
HIPRTC_JIT_GLOBAL_SYMBOL_NAMES,
HIPRTC_JIT_GLOBAL_SYMBOL_ADDRESS,
HIPRTC_JIT_GLOBAL_SYMBOL_COUNT,
HIPRTC_JIT_LTO,
HIPRTC_JIT_FTZ,
HIPRTC_JIT_PREC_DIV,
HIPRTC_JIT_PREC_SQRT,
HIPRTC_JIT_FMA,
HIPRTC_JIT_NUM_OPTIONS,
} hiprtcJIT_option;
typedef enum hiprtcJITInputType {
HIPRTC_JIT_INPUT_CUBIN = 0,
HIPRTC_JIT_INPUT_PTX,
HIPRTC_JIT_INPUT_FATBINARY,
HIPRTC_JIT_INPUT_OBJECT,
HIPRTC_JIT_INPUT_LIBRARY,
HIPRTC_JIT_INPUT_NVVM,
HIPRTC_JIT_NUM_LEGACY_INPUT_TYPES,
HIPRTC_JIT_INPUT_LLVM_BITCODE = 100,
HIPRTC_JIT_INPUT_LLVM_BUNDLED_BITCODE = 101,
HIPRTC_JIT_INPUT_LLVM_ARCHIVES_OF_BUNDLED_BITCODE = 102,
HIPRTC_JIT_NUM_INPUT_TYPES = ( HIPRTC_JIT_NUM_LEGACY_INPUT_TYPES + 3 )
} hiprtcJITInputType;
typedef struct ihiprtcLinkState* hiprtcLinkState;
/* Function types. */
typedef hipError_t HIPAPI thipGetErrorName(hipError_t error, const char** pStr);
typedef const char* HIPAPI thipGetErrorString(hipError_t error);
typedef hipError_t HIPAPI thipGetLastError(hipError_t error);
typedef hipError_t HIPAPI thipInit(unsigned int Flags);
typedef hipError_t HIPAPI thipDriverGetVersion(int* driverVersion);
typedef hipError_t HIPAPI thipGetDevice(int* device);
@@ -1078,6 +1166,8 @@ typedef hipError_t HIPAPI thipGetDeviceProperties(hipDeviceProp_t* props, int de
typedef hipError_t HIPAPI thipDeviceGet(hipDevice_t* device, int ordinal);
typedef hipError_t HIPAPI thipDeviceGetName(char* name, int len, hipDevice_t dev);
typedef hipError_t HIPAPI thipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attrib, hipDevice_t dev);
typedef hipError_t HIPAPI thipDeviceGetLimit(size_t* pValue, enum hipLimit_t limit);
typedef hipError_t HIPAPI thipDeviceSetLimit(enum hipLimit_t limit, size_t value);
typedef hipError_t HIPAPI thipDeviceComputeCapability(int* major, int* minor, hipDevice_t dev);
typedef hipError_t HIPAPI thipDevicePrimaryCtxRetain(hipCtx_t* pctx, hipDevice_t dev);
typedef hipError_t HIPAPI thipDevicePrimaryCtxRelease(hipDevice_t dev);
@@ -1114,13 +1204,14 @@ typedef hipError_t HIPAPI thipMemGetAddressRange(hipDeviceptr_t* pbase, size_t*
typedef hipError_t HIPAPI thipHostMalloc(void** pp, size_t bytesize, unsigned int flags);
typedef hipError_t HIPAPI thipHostFree(void* p);
typedef hipError_t HIPAPI thipMemHostAlloc(void** pp, size_t bytesize, unsigned int Flags);
typedef hipError_t HIPAPI thipHostRegister(void* p, size_t bytesize, unsigned int Flags);
typedef hipError_t HIPAPI thipHostGetDevicePointer(hipDeviceptr_t* pdptr, void* p, unsigned int Flags);
typedef hipError_t HIPAPI thipHostGetFlags(unsigned int* pFlags, void* p);
typedef hipError_t HIPAPI thipMallocManaged(hipDeviceptr_t* dptr, size_t bytesize, unsigned int flags);
typedef hipError_t HIPAPI thipDeviceGetByPCIBusId(hipDevice_t* dev, const char* pciBusId);
typedef hipError_t HIPAPI thipDeviceGetPCIBusId(char* pciBusId, int len, hipDevice_t dev);
typedef hipError_t HIPAPI thipMemHostUnregister(void* p);
typedef hipError_t HIPAPI thipMemcpy(hipDeviceptr_t dst, hipDeviceptr_t src, size_t ByteCount);
typedef hipError_t HIPAPI thipHostUnregister(void* p);
typedef hipError_t HIPAPI thipMemcpy(void* dst, const void* src, size_t ByteCount, hipMemcpyKind kind);
typedef hipError_t HIPAPI thipMemcpyPeer(hipDeviceptr_t dstDevice, hipCtx_t dstContext, hipDeviceptr_t srcDevice, hipCtx_t srcContext, size_t ByteCount);
typedef hipError_t HIPAPI thipMemcpyHtoD(hipDeviceptr_t dstDevice, void* srcHost, size_t ByteCount);
typedef hipError_t HIPAPI thipMemcpyDtoH(void* dstHost, hipDeviceptr_t srcDevice, size_t ByteCount);
@@ -1130,8 +1221,10 @@ typedef hipError_t HIPAPI thipMemcpyParam2D(const hip_Memcpy2D* pCopy);
typedef hipError_t HIPAPI thipDrvMemcpy3D(const HIP_MEMCPY3D* pCopy);
typedef hipError_t HIPAPI thipMemcpyHtoDAsync(hipDeviceptr_t dstDevice, const void* srcHost, size_t ByteCount, hipStream_t hStream);
typedef hipError_t HIPAPI thipMemcpyDtoHAsync(void* dstHost, hipDeviceptr_t srcDevice, size_t ByteCount, hipStream_t hStream);
typedef hipError_t HIPAPI thipMemcpyDtoDAsync(hipDeviceptr_t dstDevice, hipDeviceptr_t srcDevice, size_t ByteCount, hipStream_t hStream);
typedef hipError_t HIPAPI thipMemcpyParam2DAsync(const hip_Memcpy2D* pCopy, hipStream_t hStream);
typedef hipError_t HIPAPI thipDrvMemcpy3DAsync(const HIP_MEMCPY3D* pCopy, hipStream_t hStream);
typedef hipError_t HIPAPI thipMemset(void* dstDevice, int value, size_t sizeBytes);
typedef hipError_t HIPAPI thipMemsetD8(hipDeviceptr_t dstDevice, unsigned char uc, size_t N);
typedef hipError_t HIPAPI thipMemsetD16(hipDeviceptr_t dstDevice, unsigned short us, size_t N);
typedef hipError_t HIPAPI thipMemsetD32(hipDeviceptr_t dstDevice, unsigned int ui, size_t N);
@@ -1144,7 +1237,8 @@ typedef hipError_t HIPAPI thipMemsetD2D32Async(hipDeviceptr_t dstDevice, size_t
typedef hipError_t HIPAPI thipArrayCreate(hArray ** pHandle, const HIP_ARRAY_DESCRIPTOR* pAllocateArray);
typedef hipError_t HIPAPI thipArrayDestroy(hArray hArray);
typedef hipError_t HIPAPI thipArray3DCreate(hArray * pHandle, const HIP_ARRAY3D_DESCRIPTOR* pAllocateArray);
typedef hipError_t HIPAPI hipPointerGetAttributes(hipPointerAttribute_t* attributes, const void* ptr);
typedef hipError_t HIPAPI thipPointerGetAttributes(hipPointerAttribute_t* attributes, const void* ptr);
typedef hipError_t HIPAPI thipStreamCreate(hipStream_t* phStream);
typedef hipError_t HIPAPI thipStreamCreateWithFlags(hipStream_t* phStream, unsigned int Flags);
typedef hipError_t HIPAPI thipStreamCreateWithPriority(hipStream_t* phStream, unsigned int flags, int priority);
typedef hipError_t HIPAPI thipStreamGetPriority(hipStream_t hStream, int* priority);
@@ -1189,7 +1283,10 @@ typedef hipError_t HIPAPI thipGraphicsMapResources(unsigned int count, hipGraphi
typedef hipError_t HIPAPI thipGraphicsUnmapResources(unsigned int count, hipGraphicsResource* resources, hipStream_t hStream);
typedef hipError_t HIPAPI thipGraphicsGLRegisterBuffer(hipGraphicsResource* pCudaResource, GLuint buffer, unsigned int Flags);
typedef hipError_t HIPAPI thipGLGetDevices(unsigned int* pHipDeviceCount, int* pHipDevices, unsigned int hipDeviceCount, hipGLDeviceList deviceList);
typedef hiprtcResult HIPAPI thiprtcGetErrorString(hiprtcResult result);
typedef hipError_t HIPAPI thipImportExternalMemory(hipExternalMemory_t* extMem_out, const hipExternalMemoryHandleDesc* memHandleDesc);
typedef hipError_t HIPAPI thipExternalMemoryGetMappedBuffer(void **devPtr, hipExternalMemory_t extMem, const hipExternalMemoryBufferDesc *bufferDesc);
typedef hipError_t HIPAPI thipDestroyExternalMemory(hipExternalMemory_t extMem);
typedef const char* HIPAPI thiprtcGetErrorString(hiprtcResult result);
typedef hiprtcResult HIPAPI thiprtcAddNameExpression(hiprtcProgram prog, const char* name_expression);
typedef hiprtcResult HIPAPI thiprtcCompileProgram(hiprtcProgram prog, int numOptions, const char** options);
typedef hiprtcResult HIPAPI thiprtcCreateProgram(hiprtcProgram* prog, const char* src, const char* name, int numHeaders, const char** headers, const char** includeNames);
@@ -1197,20 +1294,30 @@ typedef hiprtcResult HIPAPI thiprtcDestroyProgram(hiprtcProgram* prog);
typedef hiprtcResult HIPAPI thiprtcGetLoweredName(hiprtcProgram prog, const char* name_expression, const char** lowered_name);
typedef hiprtcResult HIPAPI thiprtcGetProgramLog(hiprtcProgram prog, char* log);
typedef hiprtcResult HIPAPI thiprtcGetProgramLogSize(hiprtcProgram prog, size_t* logSizeRet);
typedef hiprtcResult HIPAPI thiprtcGetBitcode( hiprtcProgram prog, char* bitcode );
typedef hiprtcResult HIPAPI thiprtcGetBitcodeSize( hiprtcProgram prog, size_t* bitcodeSizeRet );
typedef hiprtcResult HIPAPI thiprtcGetCode(hiprtcProgram prog, char* code);
typedef hiprtcResult HIPAPI thiprtcGetCodeSize(hiprtcProgram prog, size_t* codeSizeRet);
typedef hiprtcResult HIPAPI thiprtcLinkCreate( unsigned int num_options, hiprtcJIT_option* option_ptr, void** option_vals_pptr, hiprtcLinkState* hip_link_state_ptr );
typedef hiprtcResult HIPAPI thiprtcLinkAddFile( hiprtcLinkState hip_link_state, hiprtcJITInputType input_type, const char* file_path, unsigned int num_options, hiprtcJIT_option* options_ptr, void** option_values );
typedef hiprtcResult HIPAPI thiprtcLinkAddData( hiprtcLinkState hip_link_state, hiprtcJITInputType input_type, void* image, size_t image_size, const char* name, unsigned int num_options, hiprtcJIT_option* options_ptr, void** option_values );
typedef hiprtcResult HIPAPI thiprtcLinkComplete( hiprtcLinkState hip_link_state, void** bin_out, size_t* size_out );
typedef hiprtcResult HIPAPI thiprtcLinkDestroy( hiprtcLinkState hip_link_state );
/* Function declarations. */
extern thipGetErrorName *hipGetErrorName;
extern thipGetErrorString* hipGetErrorString;
extern thipGetLastError* hipGetLastError;
extern thipInit *hipInit;
extern thipDriverGetVersion *hipDriverGetVersion;
extern thipGetDevice *hipGetDevice;
extern thipGetDeviceCount *hipGetDeviceCount;
extern thipGetDeviceProperties *hipGetDeviceProperties;
extern thipDeviceGet* hipDeviceGet;
extern thipDeviceGet *hipDeviceGet;
extern thipDeviceGetName *hipDeviceGetName;
extern thipDeviceGetAttribute *hipDeviceGetAttribute;
extern thipDeviceGetLimit *hipDeviceGetLimit;
extern thipDeviceSetLimit *hipDeviceSetLimit;
extern thipDeviceComputeCapability *hipDeviceComputeCapability;
extern thipDevicePrimaryCtxRetain *hipDevicePrimaryCtxRetain;
extern thipDevicePrimaryCtxRelease *hipDevicePrimaryCtxRelease;
@@ -1246,11 +1353,14 @@ extern thipFree *hipFree;
extern thipMemGetAddressRange *hipMemGetAddressRange;
extern thipHostMalloc *hipHostMalloc;
extern thipHostFree *hipHostFree;
extern thipHostRegister *hipHostRegister;
extern thipHostGetDevicePointer *hipHostGetDevicePointer;
extern thipHostGetFlags *hipHostGetFlags;
extern thipHostUnregister *hipHostUnregister;
extern thipMallocManaged *hipMallocManaged;
extern thipDeviceGetByPCIBusId *hipDeviceGetByPCIBusId;
extern thipDeviceGetPCIBusId *hipDeviceGetPCIBusId;
extern thipMemcpy *hipMemcpy;
extern thipMemcpyPeer *hipMemcpyPeer;
extern thipMemcpyHtoD *hipMemcpyHtoD;
extern thipMemcpyDtoH *hipMemcpyDtoH;
@@ -1260,8 +1370,10 @@ extern thipMemcpyParam2D *hipMemcpyParam2D;
extern thipDrvMemcpy3D *hipDrvMemcpy3D;
extern thipMemcpyHtoDAsync *hipMemcpyHtoDAsync;
extern thipMemcpyDtoHAsync *hipMemcpyDtoHAsync;
extern thipMemcpyDtoDAsync *hipMemcpyDtoDAsync;
extern thipMemcpyParam2DAsync *hipMemcpyParam2DAsync;
extern thipDrvMemcpy3DAsync *hipDrvMemcpy3DAsync;
extern thipMemset *hipMemset;
extern thipMemsetD8 *hipMemsetD8;
extern thipMemsetD16 *hipMemsetD16;
extern thipMemsetD32 *hipMemsetD32;
@@ -1271,6 +1383,8 @@ extern thipMemsetD32Async *hipMemsetD32Async;
extern thipArrayCreate *hipArrayCreate;
extern thipArrayDestroy *hipArrayDestroy;
extern thipArray3DCreate *hipArray3DCreate;
extern thipPointerGetAttributes *hipPointerGetAttributes;
extern thipStreamCreate* hipStreamCreate;
extern thipStreamCreateWithFlags *hipStreamCreateWithFlags;
extern thipStreamCreateWithPriority *hipStreamCreateWithPriority;
extern thipStreamGetPriority *hipStreamGetPriority;
@@ -1316,6 +1430,9 @@ extern thipGraphicsUnmapResources *hipGraphicsUnmapResources;
extern thipGraphicsGLRegisterBuffer *hipGraphicsGLRegisterBuffer;
extern thipGLGetDevices *hipGLGetDevices;
extern thipImportExternalMemory *hipImportExternalMemory;
extern thipExternalMemoryGetMappedBuffer *hipExternalMemoryGetMappedBuffer;
extern thipDestroyExternalMemory *hipDestroyExternalMemory;
extern thiprtcGetErrorString* hiprtcGetErrorString;
extern thiprtcAddNameExpression* hiprtcAddNameExpression;
@@ -1325,9 +1442,17 @@ extern thiprtcDestroyProgram* hiprtcDestroyProgram;
extern thiprtcGetLoweredName* hiprtcGetLoweredName;
extern thiprtcGetProgramLog* hiprtcGetProgramLog;
extern thiprtcGetProgramLogSize* hiprtcGetProgramLogSize;
extern thiprtcGetBitcode* hiprtcGetBitcode;
extern thiprtcGetBitcodeSize* hiprtcGetBitcodeSize;
extern thiprtcGetCode* hiprtcGetCode;
extern thiprtcGetCodeSize* hiprtcGetCodeSize;
extern thiprtcLinkCreate* hiprtcLinkCreate;
extern thiprtcLinkAddFile* hiprtcLinkAddFile;
extern thiprtcLinkAddData* hiprtcLinkAddData;
extern thiprtcLinkComplete* hiprtcLinkComplete;
extern thiprtcLinkDestroy* hiprtcLinkDestroy;
/* HIPEW API. */
enum {
HIPEW_SUCCESS = 0,
@@ -1344,7 +1469,6 @@ int hipewInit(hipuint32_t flags);
const char *hipewErrorString(hipError_t result);
const char *hipewCompilerPath(void);
int hipewCompilerVersion(void);
int hipewNvrtcVersion(void);
#ifdef __cplusplus
}

102
extern/hipew/include/hiprtew.h vendored Normal file
View File

@@ -0,0 +1,102 @@
/*
* Copyright 2011-2021 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
#ifndef __HIPRTEW_H__
#define __HIPRTEW_H__
#include <hiprt/hiprt_types.h>
#define HIPRT_MAJOR_VERSION 2
#define HIPRT_MINOR_VERSION 0
#define HIPRT_PATCH_VERSION 0xb68861
#define HIPRT_API_VERSION 2000
#define HIPRT_VERSION_STR "02000"
typedef unsigned int hiprtuint32_t;
/* Function types. */
typedef hiprtError(thiprtCreateContext)(hiprtuint32_t hiprtApiVersion,
hiprtContextCreationInput &input,
hiprtContext *outContext);
typedef hiprtError(thiprtDestroyContext)(hiprtContext context);
typedef hiprtError(thiprtCreateGeometry)(hiprtContext context,
const hiprtGeometryBuildInput *buildInput,
const hiprtBuildOptions *buildOptions,
hiprtGeometry *outGeometry);
typedef hiprtError(thiprtDestroyGeometry)(hiprtContext context,
hiprtGeometry outGeometry);
typedef hiprtError(thiprtBuildGeometry)(hiprtContext context,
hiprtBuildOperation buildOperation,
const hiprtGeometryBuildInput *buildInput,
const hiprtBuildOptions *buildOptions,
hiprtDevicePtr temporaryBuffer,
hiprtApiStream stream,
hiprtGeometry outGeometry);
typedef hiprtError(thiprtGetGeometryBuildTemporaryBufferSize)(
hiprtContext context,
const hiprtGeometryBuildInput *buildInput,
const hiprtBuildOptions *buildOptions,
size_t *outSize);
typedef hiprtError(thiprtCreateScene)(hiprtContext context,
const hiprtSceneBuildInput *buildInput,
const hiprtBuildOptions *buildOptions,
hiprtScene *outScene);
typedef hiprtError(thiprtDestroyScene)(hiprtContext context, hiprtScene outScene);
typedef hiprtError(thiprtBuildScene)(hiprtContext context,
hiprtBuildOperation buildOperation,
const hiprtSceneBuildInput *buildInput,
const hiprtBuildOptions *buildOptions,
hiprtDevicePtr temporaryBuffer,
hiprtApiStream stream,
hiprtScene outScene);
typedef hiprtError(thiprtGetSceneBuildTemporaryBufferSize)(
hiprtContext context,
const hiprtSceneBuildInput *buildInput,
const hiprtBuildOptions *buildOptions,
size_t *outSize);
typedef hiprtError(thiprtCreateFuncTable)(hiprtContext context,
hiprtuint32_t numGeomTypes,
hiprtuint32_t numRayTypes,
hiprtFuncTable *outFuncTable);
typedef hiprtError(thiprtSetFuncTable)(hiprtContext context,
hiprtFuncTable funcTable,
hiprtuint32_t geomType,
hiprtuint32_t rayType,
hiprtFuncDataSet set);
typedef hiprtError(thiprtDestroyFuncTable)(hiprtContext context,
hiprtFuncTable funcTable);
/* Function declarations. */
extern thiprtCreateContext *hiprtCreateContext;
extern thiprtDestroyContext *hiprtDestroyContext;
extern thiprtCreateGeometry *hiprtCreateGeometry;
extern thiprtDestroyGeometry *hiprtDestroyGeometry;
extern thiprtBuildGeometry *hiprtBuildGeometry;
extern thiprtGetGeometryBuildTemporaryBufferSize *hiprtGetGeometryBuildTemporaryBufferSize;
extern thiprtCreateScene *hiprtCreateScene;
extern thiprtDestroyScene *hiprtDestroyScene;
extern thiprtBuildScene *hiprtBuildScene;
extern thiprtGetSceneBuildTemporaryBufferSize *hiprtGetSceneBuildTemporaryBufferSize;
extern thiprtCreateFuncTable *hiprtCreateFuncTable;
extern thiprtSetFuncTable *hiprtSetFuncTable;
extern thiprtDestroyFuncTable *hiprtDestroyFuncTable;
/* HIPEW API. */
bool hiprtewInit();
#endif /* __HIPRTEW_H__ */

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2021 Blender Foundation
* Copyright 2011-2023 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,14 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License
*/
#ifdef _MSC_VER
# if _MSC_VER < 1900
# define snprintf _snprintf
# endif
# define popen _popen
# define pclose _pclose
# define _CRT_SECURE_NO_WARNINGS
#endif
#include "util.h"
#include <hipew.h>
#include <assert.h>
@@ -28,44 +21,18 @@
#include <string.h>
#include <sys/stat.h>
#ifdef _WIN32
# define WIN32_LEAN_AND_MEAN
# define VC_EXTRALEAN
# include <windows.h>
/* Utility macros. */
typedef HMODULE DynamicLibrary;
# define dynamic_library_open(path) LoadLibraryA(path)
# define dynamic_library_close(lib) FreeLibrary(lib)
# define dynamic_library_find(lib, symbol) GetProcAddress(lib, symbol)
#else
# include <dlfcn.h>
typedef void* DynamicLibrary;
# define dynamic_library_open(path) dlopen(path, RTLD_NOW)
# define dynamic_library_close(lib) dlclose(lib)
# define dynamic_library_find(lib, symbol) dlsym(lib, symbol)
#endif
#define _LIBRARY_FIND_CHECKED(lib, name) \
name = (t##name *)dynamic_library_find(lib, #name); \
assert(name);
#define _LIBRARY_FIND(lib, name) \
name = (t##name *)dynamic_library_find(lib, #name);
static DynamicLibrary hip_lib;
#define HIP_LIBRARY_FIND_CHECKED(name) \
_LIBRARY_FIND_CHECKED(hip_lib, name)
#define HIP_LIBRARY_FIND(name) _LIBRARY_FIND(hip_lib, name)
static DynamicLibrary hip_lib;
name = (t##name *)dynamic_library_find(hip_lib, #name); \
assert(name);
#define HIP_LIBRARY_FIND(name) \
name = (t##name *)dynamic_library_find(hip_lib, #name);
/* Function definitions. */
thipGetErrorName *hipGetErrorName;
thipGetErrorString *hipGetErrorString;
thipGetLastError *hipGetLastError;
thipInit *hipInit;
thipDriverGetVersion *hipDriverGetVersion;
thipGetDevice *hipGetDevice;
@@ -74,6 +41,8 @@ thipGetDeviceProperties *hipGetDeviceProperties;
thipDeviceGet* hipDeviceGet;
thipDeviceGetName *hipDeviceGetName;
thipDeviceGetAttribute *hipDeviceGetAttribute;
thipDeviceGetLimit *hipDeviceGetLimit;
thipDeviceSetLimit *hipDeviceSetLimit;
thipDeviceComputeCapability *hipDeviceComputeCapability;
thipDevicePrimaryCtxRetain *hipDevicePrimaryCtxRetain;
thipDevicePrimaryCtxRelease *hipDevicePrimaryCtxRelease;
@@ -109,11 +78,14 @@ thipFree *hipFree;
thipMemGetAddressRange *hipMemGetAddressRange;
thipHostMalloc *hipHostMalloc;
thipHostFree *hipHostFree;
thipHostRegister *hipHostRegister;
thipHostGetDevicePointer *hipHostGetDevicePointer;
thipHostGetFlags *hipHostGetFlags;
thipHostUnregister *hipHostUnregister;
thipMallocManaged *hipMallocManaged;
thipDeviceGetByPCIBusId *hipDeviceGetByPCIBusId;
thipDeviceGetPCIBusId *hipDeviceGetPCIBusId;
thipMemcpy *hipMemcpy;
thipMemcpyPeer *hipMemcpyPeer;
thipMemcpyHtoD *hipMemcpyHtoD;
thipMemcpyDtoH *hipMemcpyDtoH;
@@ -123,8 +95,10 @@ thipMemcpyParam2D *hipMemcpyParam2D;
thipDrvMemcpy3D *hipDrvMemcpy3D;
thipMemcpyHtoDAsync *hipMemcpyHtoDAsync;
thipMemcpyDtoHAsync *hipMemcpyDtoHAsync;
thipMemcpyDtoDAsync *hipMemcpyDtoDAsync;
thipMemcpyParam2DAsync *hipMemcpyParam2DAsync;
thipDrvMemcpy3DAsync *hipDrvMemcpy3DAsync;
thipMemset *hipMemset;
thipMemsetD8 *hipMemsetD8;
thipMemsetD16 *hipMemsetD16;
thipMemsetD32 *hipMemsetD32;
@@ -134,6 +108,8 @@ thipMemsetD32Async *hipMemsetD32Async;
thipArrayCreate *hipArrayCreate;
thipArrayDestroy *hipArrayDestroy;
thipArray3DCreate *hipArray3DCreate;
thipPointerGetAttributes* hipPointerGetAttributes;
thipStreamCreate* hipStreamCreate;
thipStreamCreateWithFlags *hipStreamCreateWithFlags;
thipStreamCreateWithPriority *hipStreamCreateWithPriority;
thipStreamGetPriority *hipStreamGetPriority;
@@ -179,6 +155,9 @@ thipGraphicsResourceGetMappedPointer *hipGraphicsResourceGetMappedPointer;
thipGraphicsGLRegisterBuffer *hipGraphicsGLRegisterBuffer;
thipGLGetDevices *hipGLGetDevices;
thipImportExternalMemory *hipImportExternalMemory;
thipExternalMemoryGetMappedBuffer *hipExternalMemoryGetMappedBuffer;
thipDestroyExternalMemory *hipDestroyExternalMemory;
thiprtcGetErrorString* hiprtcGetErrorString;
thiprtcAddNameExpression* hiprtcAddNameExpression;
@@ -188,10 +167,15 @@ thiprtcDestroyProgram* hiprtcDestroyProgram;
thiprtcGetLoweredName* hiprtcGetLoweredName;
thiprtcGetProgramLog* hiprtcGetProgramLog;
thiprtcGetProgramLogSize* hiprtcGetProgramLogSize;
thiprtcGetBitcode* hiprtcGetBitcode;
thiprtcGetBitcodeSize* hiprtcGetBitcodeSize;
thiprtcGetCode* hiprtcGetCode;
thiprtcGetCodeSize* hiprtcGetCodeSize;
thiprtcLinkCreate* hiprtcLinkCreate;
thiprtcLinkAddFile* hiprtcLinkAddFile;
thiprtcLinkAddData* hiprtcLinkAddData;
thiprtcLinkComplete* hiprtcLinkComplete;
thiprtcLinkDestroy* hiprtcLinkDestroy;
static DynamicLibrary dynamic_library_open_find(const char **paths) {
int i = 0;
@@ -217,14 +201,14 @@ static void hipewHipExit(void) {
#ifdef _WIN32
static int hipewHasOldDriver(const char *hip_path) {
DWORD verHandle = 0;
DWORD verSize = GetFileVersionInfoSize(hip_path, &verHandle);
DWORD verSize = GetFileVersionInfoSizeA(hip_path, &verHandle);
int old_driver = 0;
if (verSize != 0) {
LPSTR verData = (LPSTR)malloc(verSize);
if (GetFileVersionInfo(hip_path, verHandle, verSize, verData)) {
if (GetFileVersionInfoA(hip_path, verHandle, verSize, verData)) {
LPBYTE lpBuffer = NULL;
UINT size = 0;
if (VerQueryValue(verData, "\\", (VOID FAR * FAR *)&lpBuffer, &size)) {
if (VerQueryValueA(verData, "\\", (VOID FAR * FAR *)&lpBuffer, &size)) {
if (size) {
VS_FIXEDFILEINFO *verInfo = (VS_FIXEDFILEINFO *)lpBuffer;
/* Magic value from
@@ -247,8 +231,9 @@ static int hipewHasOldDriver(const char *hip_path) {
static int hipewHipInit(void) {
/* Library paths. */
#ifdef _WIN32
/* Expected in c:/windows/system or similar, no path needed. */
/* Expected in C:/Windows/System32 or similar, no path needed. */
const char *hip_paths[] = {"amdhip64.dll", NULL};
#elif defined(__APPLE__)
/* Default installation path. */
const char *hip_paths[] = {"", NULL};
@@ -289,6 +274,8 @@ static int hipewHipInit(void) {
/* Fetch all function pointers. */
HIP_LIBRARY_FIND_CHECKED(hipGetErrorName);
HIP_LIBRARY_FIND_CHECKED(hipGetErrorString);
HIP_LIBRARY_FIND_CHECKED(hipGetLastError);
HIP_LIBRARY_FIND_CHECKED(hipInit);
HIP_LIBRARY_FIND_CHECKED(hipDriverGetVersion);
HIP_LIBRARY_FIND_CHECKED(hipGetDevice);
@@ -297,6 +284,8 @@ static int hipewHipInit(void) {
HIP_LIBRARY_FIND_CHECKED(hipDeviceGet);
HIP_LIBRARY_FIND_CHECKED(hipDeviceGetName);
HIP_LIBRARY_FIND_CHECKED(hipDeviceGetAttribute);
HIP_LIBRARY_FIND(hipDeviceGetLimit);
HIP_LIBRARY_FIND(hipDeviceSetLimit);
HIP_LIBRARY_FIND_CHECKED(hipDeviceComputeCapability);
HIP_LIBRARY_FIND_CHECKED(hipDevicePrimaryCtxRetain);
HIP_LIBRARY_FIND_CHECKED(hipDevicePrimaryCtxRelease);
@@ -332,11 +321,14 @@ static int hipewHipInit(void) {
HIP_LIBRARY_FIND_CHECKED(hipMemGetAddressRange);
HIP_LIBRARY_FIND_CHECKED(hipHostMalloc);
HIP_LIBRARY_FIND_CHECKED(hipHostFree);
HIP_LIBRARY_FIND_CHECKED(hipHostRegister);
HIP_LIBRARY_FIND_CHECKED(hipHostGetDevicePointer);
HIP_LIBRARY_FIND_CHECKED(hipHostGetFlags);
HIP_LIBRARY_FIND_CHECKED(hipHostUnregister);
HIP_LIBRARY_FIND_CHECKED(hipMallocManaged);
HIP_LIBRARY_FIND_CHECKED(hipDeviceGetByPCIBusId);
HIP_LIBRARY_FIND_CHECKED(hipDeviceGetPCIBusId);
HIP_LIBRARY_FIND_CHECKED(hipMemcpy);
HIP_LIBRARY_FIND_CHECKED(hipMemcpyPeer);
HIP_LIBRARY_FIND_CHECKED(hipMemcpyHtoD);
HIP_LIBRARY_FIND_CHECKED(hipMemcpyDtoH);
@@ -345,9 +337,11 @@ static int hipewHipInit(void) {
HIP_LIBRARY_FIND_CHECKED(hipDrvMemcpy3D);
HIP_LIBRARY_FIND_CHECKED(hipMemcpyHtoDAsync);
HIP_LIBRARY_FIND_CHECKED(hipMemcpyDtoHAsync);
HIP_LIBRARY_FIND_CHECKED(hipMemcpyDtoDAsync);
HIP_LIBRARY_FIND_CHECKED(hipDrvMemcpy2DUnaligned);
HIP_LIBRARY_FIND_CHECKED(hipMemcpyParam2DAsync);
HIP_LIBRARY_FIND_CHECKED(hipDrvMemcpy3DAsync);
HIP_LIBRARY_FIND_CHECKED(hipMemset);
HIP_LIBRARY_FIND_CHECKED(hipMemsetD8);
HIP_LIBRARY_FIND_CHECKED(hipMemsetD16);
HIP_LIBRARY_FIND_CHECKED(hipMemsetD32);
@@ -357,6 +351,8 @@ static int hipewHipInit(void) {
HIP_LIBRARY_FIND_CHECKED(hipArrayCreate);
HIP_LIBRARY_FIND_CHECKED(hipArrayDestroy);
HIP_LIBRARY_FIND_CHECKED(hipArray3DCreate);
HIP_LIBRARY_FIND_CHECKED(hipPointerGetAttributes);
HIP_LIBRARY_FIND_CHECKED(hipStreamCreate);
HIP_LIBRARY_FIND_CHECKED(hipStreamCreateWithFlags);
HIP_LIBRARY_FIND_CHECKED(hipStreamCreateWithPriority);
HIP_LIBRARY_FIND_CHECKED(hipStreamGetPriority);
@@ -399,16 +395,10 @@ static int hipewHipInit(void) {
HIP_LIBRARY_FIND_CHECKED(hipGraphicsGLRegisterBuffer);
HIP_LIBRARY_FIND_CHECKED(hipGLGetDevices);
#endif
HIP_LIBRARY_FIND_CHECKED(hiprtcGetErrorString);
HIP_LIBRARY_FIND_CHECKED(hiprtcAddNameExpression);
HIP_LIBRARY_FIND_CHECKED(hiprtcCompileProgram);
HIP_LIBRARY_FIND_CHECKED(hiprtcCreateProgram);
HIP_LIBRARY_FIND_CHECKED(hiprtcDestroyProgram);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetLoweredName);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetProgramLog);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetProgramLogSize);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetCode);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetCodeSize);
HIP_LIBRARY_FIND_CHECKED(hipImportExternalMemory);
HIP_LIBRARY_FIND_CHECKED(hipExternalMemoryGetMappedBuffer);
HIP_LIBRARY_FIND_CHECKED(hipDestroyExternalMemory);
result = HIPEW_SUCCESS;
return result;
}

97
extern/hipew/src/hiprtew.cc vendored Normal file
View File

@@ -0,0 +1,97 @@
/*
* Copyright 2011-2023 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
#include "util.h"
#include <hiprtew.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
static DynamicLibrary hiprt_lib;
#define HIPRT_LIBRARY_FIND(name) \
name = (t##name *)dynamic_library_find(hiprt_lib, #name);
/* Function definitions. */
thiprtCreateContext *hiprtCreateContext;
thiprtDestroyContext *hiprtDestroyContext;
thiprtCreateGeometry *hiprtCreateGeometry;
thiprtDestroyGeometry *hiprtDestroyGeometry;
thiprtBuildGeometry *hiprtBuildGeometry;
thiprtGetGeometryBuildTemporaryBufferSize *hiprtGetGeometryBuildTemporaryBufferSize;
thiprtCreateScene *hiprtCreateScene;
thiprtDestroyScene *hiprtDestroyScene;
thiprtBuildScene *hiprtBuildScene;
thiprtGetSceneBuildTemporaryBufferSize *hiprtGetSceneBuildTemporaryBufferSize;
thiprtCreateFuncTable *hiprtCreateFuncTable;
thiprtSetFuncTable *hiprtSetFuncTable;
thiprtDestroyFuncTable *hiprtDestroyFuncTable;
static void hipewHipRtExit(void)
{
if (hiprt_lib != NULL) {
/* Ignore errors. */
dynamic_library_close(hiprt_lib);
hiprt_lib = NULL;
}
}
bool hiprtewInit()
{
static bool result = false;
static bool initialized = false;
if (initialized) {
return result;
}
#ifdef _WIN32
initialized = true;
if (atexit(hipewHipRtExit)) {
return false;
}
std::string hiprt_ver(HIPRT_VERSION_STR);
std::string hiprt_path = "hiprt" + hiprt_ver + "64.dll";
hiprt_lib = dynamic_library_open(hiprt_path.c_str());
if (hiprt_lib == NULL) {
return false;
}
HIPRT_LIBRARY_FIND(hiprtCreateContext)
HIPRT_LIBRARY_FIND(hiprtDestroyContext)
HIPRT_LIBRARY_FIND(hiprtCreateGeometry)
HIPRT_LIBRARY_FIND(hiprtDestroyGeometry)
HIPRT_LIBRARY_FIND(hiprtBuildGeometry)
HIPRT_LIBRARY_FIND(hiprtGetGeometryBuildTemporaryBufferSize)
HIPRT_LIBRARY_FIND(hiprtCreateScene)
HIPRT_LIBRARY_FIND(hiprtDestroyScene)
HIPRT_LIBRARY_FIND(hiprtBuildScene)
HIPRT_LIBRARY_FIND(hiprtGetSceneBuildTemporaryBufferSize)
HIPRT_LIBRARY_FIND(hiprtCreateFuncTable)
HIPRT_LIBRARY_FIND(hiprtSetFuncTable)
HIPRT_LIBRARY_FIND(hiprtDestroyFuncTable)
result = true;
#endif
return result;
}

51
extern/hipew/src/util.h vendored Normal file
View File

@@ -0,0 +1,51 @@
/*
* Copyright 2011-2023 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
#pragma once
/* Portable snprintf and popen/pclose. */
#ifdef _MSC_VER
# if _MSC_VER < 1900
# define snprintf _snprintf
# endif
# define popen _popen
# define pclose _pclose
# define _CRT_SECURE_NO_WARNINGS
#endif
/* Macros for loading libraries. */
#ifdef _WIN32
# define WIN32_LEAN_AND_MEAN
# define VC_EXTRALEAN
# include <windows.h>
typedef HMODULE DynamicLibrary;
# define dynamic_library_open(path) LoadLibraryA(path)
# define dynamic_library_close(lib) FreeLibrary(lib)
# define dynamic_library_find(lib, symbol) GetProcAddress(lib, symbol)
#else
# include <dlfcn.h>
typedef void* DynamicLibrary;
# define dynamic_library_open(path) dlopen(path, RTLD_NOW)
# define dynamic_library_close(lib) dlclose(lib)
# define dynamic_library_find(lib, symbol) dlsym(lib, symbol)
#endif

View File

@@ -572,7 +572,7 @@ template<class T> inline bool cmpMinMax(T &minv, T &maxv, const T &val)
}
template<> inline bool cmpMinMax<Vec3>(Vec3 &minv, Vec3 &maxv, const Vec3 &val)
{
return (cmpMinMax(minv.x, maxv.x, val.x) | cmpMinMax(minv.y, maxv.y, val.y) |
return (cmpMinMax(minv.x, maxv.x, val.x) || cmpMinMax(minv.y, maxv.y, val.y) ||
cmpMinMax(minv.z, maxv.z, val.z));
}

View File

@@ -21,7 +21,7 @@
#define __WCWIDTH_H__
#ifndef __cplusplus
# if defined(__APPLE__) || defined(__NetBSD__)
# if defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__)
/* The <uchar.h> standard header is missing on macOS. */
#include <stddef.h>
typedef unsigned int char32_t;

View File

@@ -67,7 +67,7 @@ if(UNIX AND NOT APPLE)
add_subdirectory(libc_compat)
endif()
if (WITH_RENDERDOC)
if(WITH_RENDERDOC)
add_subdirectory(renderdoc_dynload)
endif()

View File

@@ -156,7 +156,8 @@ int CLG_color_support_get(CLG_LogRef *clg_ref);
{ \
CLG_LogType *_lg_ty = CLOG_ENSURE(clg_ref); \
if (((_lg_ty->flag & CLG_FLAG_USE) && (_lg_ty->level >= verbose_level)) || \
(severity >= CLG_SEVERITY_WARN)) { \
(severity >= CLG_SEVERITY_WARN)) \
{ \
CLG_logf(_lg_ty, severity, __FILE__ ":" STRINGIFY(__LINE__), __func__, __VA_ARGS__); \
} \
} \
@@ -166,7 +167,8 @@ int CLG_color_support_get(CLG_LogRef *clg_ref);
{ \
CLG_LogType *_lg_ty = CLOG_ENSURE(clg_ref); \
if (((_lg_ty->flag & CLG_FLAG_USE) && (_lg_ty->level >= verbose_level)) || \
(severity >= CLG_SEVERITY_WARN)) { \
(severity >= CLG_SEVERITY_WARN)) \
{ \
CLG_log_str(_lg_ty, severity, __FILE__ ":" STRINGIFY(__LINE__), __func__, str); \
} \
} \
@@ -176,7 +178,8 @@ int CLG_color_support_get(CLG_LogRef *clg_ref);
{ \
CLG_LogType *_lg_ty = CLOG_ENSURE(clg_ref); \
if (((_lg_ty->flag & CLG_FLAG_USE) && (_lg_ty->level >= verbose_level)) || \
(severity >= CLG_SEVERITY_WARN)) { \
(severity >= CLG_SEVERITY_WARN)) \
{ \
const char *_str = str; \
CLG_log_str(_lg_ty, severity, __FILE__ ":" STRINGIFY(__LINE__), __func__, _str); \
MEM_freeN((void *)_str); \

View File

@@ -316,7 +316,8 @@ static bool clg_ctx_filter_check(CLogContext *ctx, const char *identifier)
}
else if ((len >= 2) && (STREQLEN(".*", &flt->match[len - 2], 2))) {
if (((identifier_len == len - 2) && STREQLEN(identifier, flt->match, len - 2)) ||
((identifier_len >= len - 1) && STREQLEN(identifier, flt->match, len - 1))) {
((identifier_len >= len - 1) && STREQLEN(identifier, flt->match, len - 1)))
{
return (bool)i;
}
}

View File

@@ -249,6 +249,13 @@ endif()
if(WITH_CYCLES_DEVICE_HIP)
add_definitions(-DWITH_HIP)
if(WITH_CYCLES_DEVICE_HIPRT)
include_directories(
${HIPRT_INCLUDE_DIR}
)
add_definitions(-DWITH_HIPRT)
endif()
if(WITH_HIP_DYNLOAD)
include_directories(
../../extern/hipew/include
@@ -281,6 +288,9 @@ endif()
if(WITH_CYCLES_EMBREE)
add_definitions(-DWITH_EMBREE)
if(WITH_CYCLES_DEVICE_ONEAPI AND EMBREE_SYCL_SUPPORT)
add_definitions(-DWITH_EMBREE_GPU)
endif()
add_definitions(-DEMBREE_MAJOR_VERSION=${EMBREE_MAJOR_VERSION})
include_directories(
SYSTEM

View File

@@ -511,7 +511,8 @@ static void options_parse(int argc, const char **argv)
exit(EXIT_FAILURE);
}
else if (options.scene_params.shadingsystem == SHADINGSYSTEM_OSL &&
options.session_params.device.type != DEVICE_CPU) {
options.session_params.device.type != DEVICE_CPU)
{
fprintf(stderr, "OSL shading system only works with CPU device\n");
exit(EXIT_FAILURE);
}

View File

@@ -59,7 +59,8 @@ void OIIOOutputDriver::write_render_tile(const Tile &tile)
/* Apply gamma correction for (some) non-linear file formats.
* TODO: use OpenColorIO view transform if available. */
if (ColorSpaceManager::detect_known_colorspace(
u_colorspace_auto, "", image_output->format_name(), true) == u_colorspace_srgb) {
u_colorspace_auto, "", image_output->format_name(), true) == u_colorspace_srgb)
{
const float g = 1.0f / 2.2f;
ImageBufAlgo::pow(image_buffer, image_buffer, {g, g, g, 1.0f});
}

View File

@@ -314,7 +314,8 @@ void window_main_loop(const char *title,
}
else if (event.type == SDL_WINDOWEVENT) {
if (event.window.event == SDL_WINDOWEVENT_RESIZED ||
event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
{
window_reshape(event.window.data1, event.window.data2);
}
}

View File

@@ -26,6 +26,7 @@ set(SRC
image.cpp
geometry.cpp
light.cpp
light_linking.cpp
mesh.cpp
object.cpp
object_cull.cpp
@@ -47,6 +48,7 @@ set(SRC
display_driver.h
id_map.h
image.h
light_linking.h
object_cull.h
output_driver.h
sync.h

View File

@@ -106,7 +106,7 @@ class CyclesRender(bpy.types.RenderEngine):
from . import osl
osl.update_script_node(node, self.report)
else:
self.report({'ERROR'}, "OSL support disabled in this build.")
self.report({'ERROR'}, "OSL support disabled in this build")
def update_render_passes(self, scene, srl):
engine.register_passes(self, scene, srl)

View File

@@ -172,6 +172,8 @@ def system_info():
def list_render_passes(scene, srl):
import _cycles
crl = srl.cycles
# Combined pass.
@@ -250,6 +252,12 @@ def list_render_passes(scene, srl):
for lightgroup in srl.lightgroups:
yield ("Combined_%s" % lightgroup.name, "RGB", 'COLOR')
# Path guiding debug passes.
if _cycles.with_debug:
yield ("Guiding Color", "RGB", 'COLOR')
yield ("Guiding Probability", "X", 'VALUE')
yield ("Guiding Average Roughness", "X", 'VALUE')
def register_passes(engine, scene, view_layer):
for name, channelids, channeltype in list_render_passes(scene, view_layer):

View File

@@ -209,6 +209,21 @@ enum_guiding_distribution = (
('VMM', "VMM", "Use von Mises-Fisher models as directional distribution", 2),
)
enum_guiding_directional_sampling_types = (
('MIS',
"Diffuse Product MIS",
"Guided diffuse BSDF component based on the incoming light distribution and the cosine product (closed form product)",
0),
('RIS',
"Re-sampled Importance Sampling",
"Perform RIS sampling to guided based on the product of the incoming light distribution and the BSDF",
1),
('ROUGHNESS',
"Roughness-based",
"Adjust the guiding probability based on the roughness of the material components",
2),
)
def enum_openimagedenoise_denoiser(self, context):
import _cycles
@@ -568,6 +583,13 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
default='PARALLAX_AWARE_VMM',
)
guiding_directional_sampling_type: EnumProperty(
name="Directional Sampling Type",
description="Type of the directional sampling used for guiding",
items=enum_guiding_directional_sampling_types,
default='RIS',
)
use_surface_guiding: BoolProperty(
name="Surface Guiding",
description="Use guiding when sampling directions on a surface",
@@ -617,6 +639,13 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
default=True,
)
guiding_roughness_threshold: FloatProperty(
name="Guiding Roughness Threshold",
description="The minimal roughness value of a material to apply guiding",
min=0.0, max=1.0,
default=0.05,
)
max_bounces: IntProperty(
name="Max Bounces",
description="Total maximum number of bounces",
@@ -1507,7 +1536,7 @@ class CyclesPreferences(bpy.types.AddonPreferences):
def get_device_types(self, context):
import _cycles
has_cuda, has_optix, has_hip, has_metal, has_oneapi = _cycles.get_device_types()
has_cuda, has_optix, has_hip, has_metal, has_oneapi, has_hiprt = _cycles.get_device_types()
list = [('NONE', "None", "Don't use compute device", 0)]
if has_cuda:
@@ -1544,6 +1573,19 @@ class CyclesPreferences(bpy.types.AddonPreferences):
default=False,
)
use_hiprt: BoolProperty(
name="HIP RT (Experimental)",
description="HIP RT enables AMD hardware ray tracing on RDNA2 and above, with shader fallback on older cards. "
"This feature is experimental and some scenes may render incorrectly",
default=False,
)
use_oneapirt: BoolProperty(
name="Embree on GPU",
description="Embree on GPU enables the use of hardware ray tracing on Intel GPUs, providing better overall performance",
default=True,
)
kernel_optimization_level: EnumProperty(
name="Kernel Optimization",
description="Kernels can be optimized based on scene content. Optimized kernels are requested at the start of a render. "
@@ -1676,20 +1718,17 @@ class CyclesPreferences(bpy.types.AddonPreferences):
col.label(text=iface_("and NVIDIA driver version %s or newer") % driver_version,
icon='BLANK1', translate=False)
elif device_type == 'HIP':
if True:
col.label(text="HIP temporarily disabled due to compiler bugs", icon='BLANK1')
else:
import sys
if sys.platform[:3] == "win":
driver_version = "21.Q4"
col.label(text="Requires AMD GPU with Vega or RDNA architecture", icon='BLANK1')
col.label(text=iface_("and AMD Radeon Pro %s driver or newer") % driver_version,
icon='BLANK1', translate=False)
elif sys.platform.startswith("linux"):
driver_version = "22.10"
col.label(text="Requires AMD GPU with Vega or RDNA architecture", icon='BLANK1')
col.label(text=iface_("and AMD driver version %s or newer") % driver_version, icon='BLANK1',
translate=False)
import sys
if sys.platform[:3] == "win":
driver_version = "21.Q4"
col.label(text="Requires AMD GPU with Vega or RDNA architecture", icon='BLANK1')
col.label(text=iface_("and AMD Radeon Pro %s driver or newer") % driver_version,
icon='BLANK1', translate=False)
elif sys.platform.startswith("linux"):
driver_version = "22.10"
col.label(text="Requires AMD GPU with Vega or RDNA architecture", icon='BLANK1')
col.label(text=iface_("and AMD driver version %s or newer") % driver_version, icon='BLANK1',
translate=False)
elif device_type == 'ONEAPI':
import sys
if sys.platform.startswith("win"):
@@ -1763,6 +1802,16 @@ class CyclesPreferences(bpy.types.AddonPreferences):
col.prop(self, "kernel_optimization_level")
col.prop(self, "use_metalrt")
if compute_device_type == 'HIP':
has_cuda, has_optix, has_hip, has_metal, has_oneapi, has_hiprt = _cycles.get_device_types()
row = layout.row()
row.enabled = has_hiprt
row.prop(self, "use_hiprt")
elif compute_device_type == 'ONEAPI' and _cycles.with_embree_gpu:
row = layout.row()
row.prop(self, "use_oneapirt")
def draw(self, context):
self.draw_impl(self.layout, context)

View File

@@ -7,7 +7,7 @@ from bpy.app.translations import contexts as i18n_contexts
from bpy_extras.node_utils import find_node_input
from bl_ui.utils import PresetPanel
from bpy.types import Panel
from bpy.types import Panel, Menu
from bl_ui.properties_grease_pencil_common import GreasePencilSimplifyPanel
from bl_ui.properties_render import draw_curves_settings
@@ -337,6 +337,8 @@ class CYCLES_RENDER_PT_sampling_path_guiding_debug(CyclesDebugButtonsPanel, Pane
layout.active = cscene.use_guiding
layout.prop(cscene, "guiding_distribution_type", text="Distribution Type")
layout.prop(cscene, "guiding_roughness_threshold")
layout.prop(cscene, "guiding_directional_sampling_type", text="Directional Sampling Type")
col = layout.column(align=True)
col.prop(cscene, "surface_guiding_probability")
@@ -1299,6 +1301,7 @@ class CYCLES_OBJECT_PT_lightgroup(CyclesButtonsPanel, Panel):
bl_label = "Light Group"
bl_parent_id = "CYCLES_OBJECT_PT_shading"
bl_context = "object"
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
@@ -1319,6 +1322,88 @@ class CYCLES_OBJECT_PT_lightgroup(CyclesButtonsPanel, Panel):
sub.operator("scene.view_layer_add_lightgroup", icon='ADD', text="").name = ob.lightgroup
class CYCLES_OBJECT_MT_light_linking_context_menu(Menu):
bl_label = "Light Linking Specials"
def draw(self, _context):
layout = self.layout
layout.operator("object.light_linking_receivers_select")
class CYCLES_OBJECT_MT_shadow_linking_context_menu(Menu):
bl_label = "Shadow Linking Specials"
def draw(self, _context):
layout = self.layout
layout.operator("object.light_linking_blockers_select")
class CYCLES_OBJECT_PT_light_linking(CyclesButtonsPanel, Panel):
bl_label = "Light Linking"
bl_parent_id = "CYCLES_OBJECT_PT_shading"
bl_context = "object"
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
layout.use_property_split = True
object = context.object
light_linking = object.light_linking
col = layout.column()
col.template_ID(
light_linking,
"receiver_collection",
new="object.light_linking_receiver_collection_new")
if not light_linking.receiver_collection:
return
row = layout.row()
col = row.column()
col.template_light_linking_collection(light_linking, "receiver_collection")
col = row.column()
sub = col.column(align=True)
sub.menu("CYCLES_OBJECT_MT_light_linking_context_menu", icon='DOWNARROW_HLT', text="")
class CYCLES_OBJECT_PT_shadow_linking(CyclesButtonsPanel, Panel):
bl_label = "Shadow Linking"
bl_parent_id = "CYCLES_OBJECT_PT_shading"
bl_context = "object"
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
layout.use_property_split = True
object = context.object
light_linking = object.light_linking
col = layout.column()
col.template_ID(
light_linking,
"blocker_collection",
new="object.light_linking_blocker_collection_new")
if not light_linking.blocker_collection:
return
row = layout.row()
col = row.column()
col.template_light_linking_collection(light_linking, "blocker_collection")
col = row.column()
sub = col.column(align=True)
sub.menu("CYCLES_OBJECT_MT_shadow_linking_context_menu", icon='DOWNARROW_HLT', text="")
class CYCLES_OBJECT_PT_visibility(CyclesButtonsPanel, Panel):
bl_label = "Visibility"
bl_context = "object"
@@ -2449,6 +2534,10 @@ classes = (
CYCLES_OBJECT_PT_shading_gi_approximation,
CYCLES_OBJECT_PT_shading_caustics,
CYCLES_OBJECT_PT_lightgroup,
CYCLES_OBJECT_MT_light_linking_context_menu,
CYCLES_OBJECT_PT_light_linking,
CYCLES_OBJECT_MT_shadow_linking_context_menu,
CYCLES_OBJECT_PT_shadow_linking,
CYCLES_OBJECT_PT_visibility,
CYCLES_OBJECT_PT_visibility_ray_visibility,
CYCLES_OBJECT_PT_visibility_culling,

View File

@@ -432,7 +432,8 @@ static void blender_camera_sync(Camera *cam,
/* panorama sensor */
if (bcam->type == CAMERA_PANORAMA && (bcam->panorama_type == PANORAMA_FISHEYE_EQUISOLID ||
bcam->panorama_type == PANORAMA_FISHEYE_LENS_POLYNOMIAL)) {
bcam->panorama_type == PANORAMA_FISHEYE_LENS_POLYNOMIAL))
{
float fit_xratio = (float)bcam->render_width * bcam->pixelaspect.x;
float fit_yratio = (float)bcam->render_height * bcam->pixelaspect.y;
bool horizontal_fit;

View File

@@ -55,13 +55,15 @@ static bool ObtainCacheParticleData(
for (BL::Modifier &b_mod : b_ob->modifiers) {
if ((b_mod.type() == b_mod.type_PARTICLE_SYSTEM) &&
(background ? b_mod.show_render() : b_mod.show_viewport())) {
(background ? b_mod.show_render() : b_mod.show_viewport()))
{
BL::ParticleSystemModifier psmd((const PointerRNA)b_mod.ptr);
BL::ParticleSystem b_psys((const PointerRNA)psmd.particle_system().ptr);
BL::ParticleSettings b_part((const PointerRNA)b_psys.settings().ptr);
if ((b_part.render_type() == BL::ParticleSettings::render_type_PATH) &&
(b_part.type() == BL::ParticleSettings::type_HAIR)) {
(b_part.type() == BL::ParticleSettings::type_HAIR))
{
int shader = clamp(b_part.material() - 1, 0, hair->get_used_shaders().size() - 1);
int display_step = background ? b_part.render_step() : b_part.display_step();
int totparts = b_psys.particles.length();
@@ -150,13 +152,15 @@ static bool ObtainCacheParticleUV(Hair *hair,
for (BL::Modifier &b_mod : b_ob->modifiers) {
if ((b_mod.type() == b_mod.type_PARTICLE_SYSTEM) &&
(background ? b_mod.show_render() : b_mod.show_viewport())) {
(background ? b_mod.show_render() : b_mod.show_viewport()))
{
BL::ParticleSystemModifier psmd((const PointerRNA)b_mod.ptr);
BL::ParticleSystem b_psys((const PointerRNA)psmd.particle_system().ptr);
BL::ParticleSettings b_part((const PointerRNA)b_psys.settings().ptr);
if ((b_part.render_type() == BL::ParticleSettings::render_type_PATH) &&
(b_part.type() == BL::ParticleSettings::type_HAIR)) {
(b_part.type() == BL::ParticleSettings::type_HAIR))
{
int totparts = b_psys.particles.length();
int totchild = background ? b_psys.child_particles.length() :
(int)((float)b_psys.child_particles.length() *
@@ -212,13 +216,15 @@ static bool ObtainCacheParticleVcol(Hair *hair,
for (BL::Modifier &b_mod : b_ob->modifiers) {
if ((b_mod.type() == b_mod.type_PARTICLE_SYSTEM) &&
(background ? b_mod.show_render() : b_mod.show_viewport())) {
(background ? b_mod.show_render() : b_mod.show_viewport()))
{
BL::ParticleSystemModifier psmd((const PointerRNA)b_mod.ptr);
BL::ParticleSystem b_psys((const PointerRNA)psmd.particle_system().ptr);
BL::ParticleSettings b_part((const PointerRNA)b_psys.settings().ptr);
if ((b_part.render_type() == BL::ParticleSettings::render_type_PATH) &&
(b_part.type() == BL::ParticleSettings::type_HAIR)) {
(b_part.type() == BL::ParticleSettings::type_HAIR))
{
int totparts = b_psys.particles.length();
int totchild = background ? b_psys.child_particles.length() :
(int)((float)b_psys.child_particles.length() *
@@ -283,7 +289,8 @@ static void ExportCurveSegments(Scene *scene, Hair *hair, ParticleCurveData *CDa
for (int sys = 0; sys < CData->psys_firstcurve.size(); sys++) {
for (int curve = CData->psys_firstcurve[sys];
curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys];
curve++) {
curve++)
{
num_keys += CData->curve_keynum[curve];
num_curves++;
}
@@ -298,12 +305,14 @@ static void ExportCurveSegments(Scene *scene, Hair *hair, ParticleCurveData *CDa
for (int sys = 0; sys < CData->psys_firstcurve.size(); sys++) {
for (int curve = CData->psys_firstcurve[sys];
curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys];
curve++) {
curve++)
{
size_t num_curve_keys = 0;
for (int curvekey = CData->curve_firstkey[curve];
curvekey < CData->curve_firstkey[curve] + CData->curve_keynum[curve];
curvekey++) {
curvekey++)
{
const float3 ickey_loc = CData->curvekey_co[curvekey];
const float curve_time = CData->curvekey_time[curvekey];
const float curve_length = CData->curve_length[curve];
@@ -311,7 +320,8 @@ static void ExportCurveSegments(Scene *scene, Hair *hair, ParticleCurveData *CDa
float radius = shaperadius(
CData->psys_shape[sys], CData->psys_rootradius[sys], CData->psys_tipradius[sys], time);
if (CData->psys_closetip[sys] &&
(curvekey == CData->curve_firstkey[curve] + CData->curve_keynum[curve] - 1)) {
(curvekey == CData->curve_firstkey[curve] + CData->curve_keynum[curve] - 1))
{
radius = 0.0f;
}
hair->add_curve_key(ickey_loc, radius);
@@ -379,7 +389,7 @@ static float4 LerpCurveSegmentMotionCV(ParticleCurveData *CData, int sys, int cu
}
const float4 mP = CurveSegmentMotionCV(CData, sys, curve, first_curve_key + curvekey);
const float4 mP2 = CurveSegmentMotionCV(CData, sys, curve, first_curve_key + curvekey2);
return lerp(mP, mP2, remainder);
return mix(mP, mP2, remainder);
}
static void export_hair_motion_validate_attribute(Hair *hair,
@@ -433,7 +443,8 @@ static void ExportCurveSegmentsMotion(Hair *hair, ParticleCurveData *CData, int
for (int sys = 0; sys < CData->psys_firstcurve.size(); sys++) {
for (int curve = CData->psys_firstcurve[sys];
curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys];
curve++) {
curve++)
{
/* Curve lengths may not match! Curves can be clipped. */
int curve_key_end = (num_curves + 1 < (int)hair->get_curve_first_key().size() ?
hair->get_curve_first_key()[num_curves + 1] :
@@ -444,7 +455,8 @@ static void ExportCurveSegmentsMotion(Hair *hair, ParticleCurveData *CData, int
if (!is_num_keys_different) {
for (int curvekey = CData->curve_firstkey[curve];
curvekey < CData->curve_firstkey[curve] + CData->curve_keynum[curve];
curvekey++) {
curvekey++)
{
if (i < hair->get_curve_keys().size()) {
mP[i] = CurveSegmentMotionCV(CData, sys, curve, curvekey);
if (!have_motion) {
@@ -489,13 +501,15 @@ bool BlenderSync::object_has_particle_hair(BL::Object b_ob)
/* Test if the object has a particle modifier with hair. */
for (BL::Modifier &b_mod : b_ob.modifiers) {
if ((b_mod.type() == b_mod.type_PARTICLE_SYSTEM) &&
(preview ? b_mod.show_viewport() : b_mod.show_render())) {
(preview ? b_mod.show_viewport() : b_mod.show_render()))
{
BL::ParticleSystemModifier psmd((const PointerRNA)b_mod.ptr);
BL::ParticleSystem b_psys((const PointerRNA)psmd.particle_system().ptr);
BL::ParticleSettings b_part((const PointerRNA)b_psys.settings().ptr);
if ((b_part.render_type() == BL::ParticleSettings::render_type_PATH) &&
(b_part.type() == BL::ParticleSettings::type_HAIR)) {
(b_part.type() == BL::ParticleSettings::type_HAIR))
{
return true;
}
}
@@ -677,7 +691,8 @@ static void fill_generic_attribute(const int num_curves,
static void attr_create_motion(Hair *hair, BL::Attribute &b_attribute, const float motion_scale)
{
if (!(b_attribute.domain() == BL::Attribute::domain_POINT) &&
(b_attribute.data_type() == BL::Attribute::data_type_FLOAT_VECTOR)) {
(b_attribute.data_type() == BL::Attribute::data_type_FLOAT_VECTOR))
{
return;
}
@@ -748,7 +763,8 @@ static void attr_create_generic(Scene *scene,
/* Weak, use first float2 attribute as standard UV. */
if (need_uv && !have_uv && b_data_type == BL::Attribute::data_type_FLOAT2 &&
b_domain == BL::Attribute::domain_CURVE) {
b_domain == BL::Attribute::domain_CURVE)
{
attr_create_uv(attributes, num_curves, num_keys, b_attribute, name);
have_uv = true;
continue;
@@ -803,6 +819,16 @@ static void attr_create_generic(Scene *scene,
num_curves, num_keys, data, element, [&](int i) { return float(src[i]); });
break;
}
case BL::Attribute::data_type_INT32_2D: {
BL::Int2Attribute b_int2_attribute{b_attribute};
const int2 *src = static_cast<const int2 *>(b_int2_attribute.data[0].ptr.data);
Attribute *attr = attributes.add(name, TypeFloat2, element);
float2 *data = attr->data_float2();
fill_generic_attribute(num_curves, num_keys, data, element, [&](int i) {
return make_float2(float(src[i][0]), float(src[i][1]));
});
break;
}
case BL::Attribute::data_type_FLOAT_VECTOR: {
BL::FloatVectorAttribute b_vector_attribute{b_attribute};
const float(*src)[3] = static_cast<const float(*)[3]>(b_vector_attribute.data[0].ptr.data);
@@ -873,9 +899,9 @@ static float4 interpolate_curve_points(const float (*b_attr_position)[3],
const int point_a = clamp((int)curve_t, 0, num_points - 1);
const int point_b = min(point_a + 1, num_points - 1);
const float t = curve_t - (float)point_a;
return lerp(curve_point_as_float4(b_attr_position, b_attr_radius, first_point_index + point_a),
curve_point_as_float4(b_attr_position, b_attr_radius, first_point_index + point_b),
t);
return mix(curve_point_as_float4(b_attr_position, b_attr_radius, first_point_index + point_a),
curve_point_as_float4(b_attr_position, b_attr_radius, first_point_index + point_b),
t);
}
static void export_hair_curves(Scene *scene,
@@ -1090,7 +1116,8 @@ void BlenderSync::sync_hair(BL::Depsgraph b_depsgraph, BObjectInfo &b_ob_info, H
for (const SocketType &socket : new_hair.type->inputs) {
/* Those sockets are updated in sync_object, so do not modify them. */
if (socket.name == "use_motion_blur" || socket.name == "motion_steps" ||
socket.name == "used_shaders") {
socket.name == "used_shaders")
{
continue;
}
hair->set_value(socket, new_hair, socket);

View File

@@ -30,6 +30,25 @@ int blender_device_threads(BL::Scene &b_scene)
return 0;
}
void adjust_device_info_from_preferences(DeviceInfo &info, PointerRNA cpreferences)
{
if (!get_boolean(cpreferences, "peer_memory")) {
info.has_peer_memory = false;
}
if (info.type == DEVICE_METAL && !get_boolean(cpreferences, "use_metalrt")) {
info.use_hardware_raytracing = false;
}
if (info.type == DEVICE_ONEAPI && !get_boolean(cpreferences, "use_oneapirt")) {
info.use_hardware_raytracing = false;
}
if (info.type == DEVICE_HIP && !get_boolean(cpreferences, "use_hiprt")) {
info.use_hardware_raytracing = false;
}
}
DeviceInfo blender_device_info(BL::Preferences &b_preferences,
BL::Scene &b_scene,
bool background,
@@ -108,12 +127,16 @@ DeviceInfo blender_device_info(BL::Preferences &b_preferences,
}
}
if (!get_boolean(cpreferences, "peer_memory")) {
device.has_peer_memory = false;
}
adjust_device_info_from_preferences(device, cpreferences);
foreach (DeviceInfo &info, device.multi_devices) {
adjust_device_info_from_preferences(info, cpreferences);
if (get_boolean(cpreferences, "use_metalrt")) {
device.use_metalrt = true;
/* There is an accumulative logic here, because Multi-devices are supported only for
* the same backend + CPU in Blender right now, and both oneAPI and Metal have a
* global boolean backend setting for enabling/disabling Hardware Ray Tracing,
* so all sub-devices in the multi-device should enable (or disable) Hardware Ray Tracing
* simultaneously (and CPU device is expected to ignore `use_hardware_raytracing` setting). */
device.use_hardware_raytracing |= info.use_hardware_raytracing;
}
if (preview) {

View File

@@ -312,7 +312,8 @@ class DisplayGPUPixelBuffer {
/* Try to re-use the existing PBO if it has usable size. */
if (gpu_pixel_buffer) {
if (new_width != width || new_height != height ||
GPU_pixel_buffer_size(gpu_pixel_buffer) < required_size) {
GPU_pixel_buffer_size(gpu_pixel_buffer) < required_size)
{
gpu_resources_destroy();
}
}
@@ -513,7 +514,8 @@ bool BlenderDisplayDriver::update_begin(const Params &params,
const int buffer_height = params.size.y;
if (!current_tile_buffer_object.gpu_resources_ensure(buffer_width, buffer_height) ||
!current_tile.texture.gpu_resources_ensure(texture_width, texture_height)) {
!current_tile.texture.gpu_resources_ensure(texture_width, texture_height))
{
tiles_->current_tile.gpu_resources_destroy();
gpu_context_disable();
return false;
@@ -563,7 +565,8 @@ void BlenderDisplayDriver::update_end()
* renders while Blender is drawing. As a workaround update texture during draw, under assumption
* that there is no graphics interop on macOS and viewport render has a single tile. */
if (!background_ &&
GPU_type_matches_ex(GPU_DEVICE_NVIDIA, GPU_OS_MAC, GPU_DRIVER_ANY, GPU_BACKEND_ANY)) {
GPU_type_matches_ex(GPU_DEVICE_NVIDIA, GPU_OS_MAC, GPU_DRIVER_ANY, GPU_BACKEND_ANY))
{
tiles_->current_tile.need_update_texture_pixels = true;
}
else {
@@ -708,7 +711,8 @@ static void draw_tile(const float2 &zoom,
GPU_texture_bind_ex(texture.gpu_texture, GPUSamplerState::default_sampler(), 0);
}
else if (zoomed_width - draw_tile.params.size.x > 0.5f ||
zoomed_height - draw_tile.params.size.y > 0.5f) {
zoomed_height - draw_tile.params.size.y > 0.5f)
{
GPU_texture_bind_ex(texture.gpu_texture, GPUSamplerState::default_sampler(), 0);
}
else {

View File

@@ -28,7 +28,8 @@ static Geometry::Type determine_geom_type(BObjectInfo &b_ob_info, bool use_parti
if (b_ob_info.object_data.is_a(&RNA_Volume) ||
(b_ob_info.object_data == b_ob_info.real_object.data() &&
object_fluid_gas_domain_find(b_ob_info.real_object))) {
object_fluid_gas_domain_find(b_ob_info.real_object)))
{
return Geometry::VOLUME;
}
@@ -192,7 +193,8 @@ void BlenderSync::sync_geometry_motion(BL::Depsgraph &b_depsgraph,
Geometry *geom = object->get_geometry();
if (geometry_motion_synced.find(geom) != geometry_motion_synced.end() ||
geometry_motion_attribute_synced.find(geom) != geometry_motion_attribute_synced.end()) {
geometry_motion_attribute_synced.find(geom) != geometry_motion_attribute_synced.end())
{
return;
}
@@ -218,7 +220,8 @@ void BlenderSync::sync_geometry_motion(BL::Depsgraph &b_depsgraph,
sync_hair_motion(b_depsgraph, b_ob_info, hair, motion_step);
}
else if (b_ob_info.object_data.is_a(&RNA_Volume) ||
object_fluid_gas_domain_find(b_ob_info.real_object)) {
object_fluid_gas_domain_find(b_ob_info.real_object))
{
/* No volume motion blur support yet. */
}
else if (b_ob_info.object_data.is_a(&RNA_PointCloud)) {

View File

@@ -3,6 +3,7 @@
#include "scene/light.h"
#include "blender/light_linking.h"
#include "blender/sync.h"
#include "blender/util.h"
@@ -145,8 +146,12 @@ void BlenderSync::sync_light(BL::Object &b_parent,
light->set_use_scatter((visibility & PATH_RAY_VOLUME_SCATTER) != 0);
light->set_is_shadow_catcher(b_ob_info.real_object.is_shadow_catcher());
/* lightgroup */
/* Light group and linking. */
light->set_lightgroup(ustring(b_ob_info.real_object.lightgroup()));
light->set_light_set_membership(
BlenderLightLink::get_light_set_membership(PointerRNA_NULL, b_ob_info.real_object));
light->set_shadow_set_membership(
BlenderLightLink::get_shadow_set_membership(PointerRNA_NULL, b_ob_info.real_object));
/* tag */
light->tag_update(scene);
@@ -169,7 +174,8 @@ void BlenderSync::sync_background_light(BL::SpaceView3D &b_v3d, bool use_portal)
ObjectKey key(b_world, 0, b_world, false);
if (light_map.add_or_update(&light, b_world, b_world, key) || world_recalc ||
b_world.ptr.data != world_map) {
b_world.ptr.data != world_map)
{
light->set_light_type(LIGHT_BACKGROUND);
if (sampling_method == SAMPLING_MANUAL) {
light->set_map_resolution(get_int(cworld, "sample_map_resolution"));

View File

@@ -0,0 +1,63 @@
/* SPDX-License-Identifier: Apache-2.0
* Copyright 2011-2023 Blender Foundation */
#include "blender/light_linking.h"
#include "scene/object.h"
#include "DNA_object_types.h"
CCL_NAMESPACE_BEGIN
static const ::Object *get_blender_object(const BL::Object &object)
{
return reinterpret_cast<::Object *>(object.ptr.data);
}
static const ::LightLinking *get_light_linking(const BL::Object &object)
{
const ::Object *blender_object = get_blender_object(object);
return blender_object->light_linking;
}
uint64_t BlenderLightLink::get_light_set_membership(const BL::Object & /*parent*/,
const BL::Object &object)
{
const ::LightLinking *light_linking = get_light_linking(object);
return (light_linking) ? light_linking->runtime.light_set_membership : LIGHT_LINK_MASK_ALL;
}
uint BlenderLightLink::get_receiver_light_set(const BL::Object &parent, const BL::Object &object)
{
if (parent) {
const ::LightLinking *parent_light_linking = get_light_linking(parent);
if (parent_light_linking && parent_light_linking->runtime.receiver_light_set) {
return parent_light_linking->runtime.receiver_light_set;
}
}
const ::LightLinking *light_linking = get_light_linking(object);
return (light_linking) ? light_linking->runtime.receiver_light_set : 0;
}
uint64_t BlenderLightLink::get_shadow_set_membership(const BL::Object & /*parent*/,
const BL::Object &object)
{
const ::LightLinking *light_linking = get_light_linking(object);
return (light_linking) ? light_linking->runtime.shadow_set_membership : LIGHT_LINK_MASK_ALL;
}
uint BlenderLightLink::get_blocker_shadow_set(const BL::Object &parent, const BL::Object &object)
{
if (parent) {
const ::LightLinking *parent_light_linking = get_light_linking(parent);
if (parent_light_linking && parent_light_linking->runtime.blocker_shadow_set) {
return parent_light_linking->runtime.blocker_shadow_set;
}
}
const ::LightLinking *light_linking = get_light_linking(object);
return (light_linking) ? light_linking->runtime.blocker_shadow_set : 0;
}
CCL_NAMESPACE_END

View File

@@ -0,0 +1,22 @@
/* SPDX-License-Identifier: Apache-2.0
* Copyright 2011-2023 Blender Foundation */
#pragma once
#include <cstdint>
#include "MEM_guardedalloc.h"
#include "RNA_blender_cpp.h"
CCL_NAMESPACE_BEGIN
class BlenderLightLink {
public:
static uint64_t get_light_set_membership(const BL::Object &parent, const BL::Object &object);
static uint get_receiver_light_set(const BL::Object &parent, const BL::Object &object);
static uint64_t get_shadow_set_membership(const BL::Object &parent, const BL::Object &object);
static uint get_blocker_shadow_set(const BL::Object &parent, const BL::Object &object);
};
CCL_NAMESPACE_END

View File

@@ -280,7 +280,7 @@ static void fill_generic_attribute(BL::Mesh &b_mesh,
assert(0);
}
else {
const MEdge *edges = static_cast<const MEdge *>(b_mesh.edges[0].ptr.data);
const int2 *edges = static_cast<const int2 *>(b_mesh.edges[0].ptr.data);
const size_t verts_num = b_mesh.vertices.length();
vector<int> count(verts_num, 0);
@@ -288,11 +288,11 @@ static void fill_generic_attribute(BL::Mesh &b_mesh,
for (int i = 0; i < edges_num; i++) {
TypeInCycles value = get_value_at_index(i);
const MEdge &b_edge = edges[i];
data[b_edge.v1] += value;
data[b_edge.v2] += value;
count[b_edge.v1]++;
count[b_edge.v2]++;
const int2 &b_edge = edges[i];
data[b_edge[0]] += value;
data[b_edge[1]] += value;
count[b_edge[0]]++;
count[b_edge[1]]++;
}
for (size_t i = 0; i < verts_num; i++) {
@@ -319,10 +319,10 @@ static void fill_generic_attribute(BL::Mesh &b_mesh,
}
else {
const int tris_num = b_mesh.loop_triangles.length();
const MLoopTri *looptris = static_cast<const MLoopTri *>(
b_mesh.loop_triangles[0].ptr.data);
const int *looptri_polys = static_cast<const int *>(
b_mesh.loop_triangle_polygons[0].ptr.data);
for (int i = 0; i < tris_num; i++) {
data[i] = get_value_at_index(looptris[i].poly);
data[i] = get_value_at_index(looptri_polys[i]);
}
}
break;
@@ -337,7 +337,8 @@ static void fill_generic_attribute(BL::Mesh &b_mesh,
static void attr_create_motion(Mesh *mesh, BL::Attribute &b_attribute, const float motion_scale)
{
if (!(b_attribute.domain() == BL::Attribute::domain_POINT) &&
(b_attribute.data_type() == BL::Attribute::data_type_FLOAT_VECTOR)) {
(b_attribute.data_type() == BL::Attribute::data_type_FLOAT_VECTOR))
{
return;
}
@@ -384,7 +385,8 @@ static void attr_create_generic(Scene *scene,
}
if (!(mesh->need_attribute(scene, name) ||
(is_render_color && mesh->need_attribute(scene, ATTR_STD_VERTEX_COLOR)))) {
(is_render_color && mesh->need_attribute(scene, ATTR_STD_VERTEX_COLOR))))
{
continue;
}
if (attributes.find(name)) {
@@ -528,6 +530,19 @@ static void attr_create_generic(Scene *scene,
});
break;
}
case BL::Attribute::data_type_INT32_2D: {
BL::Int2Attribute b_int2_attribute{b_attribute};
if (b_int2_attribute.data.length() == 0) {
continue;
}
const int2 *src = static_cast<const int2 *>(b_int2_attribute.data[0].ptr.data);
Attribute *attr = attributes.add(name, TypeFloat2, element);
float2 *data = attr->data_float2();
fill_generic_attribute(b_mesh, data, b_domain, subdivision, [&](int i) {
return make_float2(float(src[i][0]), float(src[i][1]));
});
break;
}
default:
/* Not supported. */
break;
@@ -728,13 +743,15 @@ static void attr_create_pointiness(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh, b
const float3 &vert_co = mesh->get_verts()[vert_index];
bool found = false;
for (int other_sorted_vert_index = sorted_vert_index + 1; other_sorted_vert_index < num_verts;
++other_sorted_vert_index) {
++other_sorted_vert_index)
{
const int other_vert_index = sorted_vert_indeices[other_sorted_vert_index];
const float3 &other_vert_co = mesh->get_verts()[other_vert_index];
/* We are too far away now, we wouldn't have duplicate. */
if ((other_vert_co.x + other_vert_co.y + other_vert_co.z) -
(vert_co.x + vert_co.y + vert_co.z) >
3 * FLT_EPSILON) {
3 * FLT_EPSILON)
{
break;
}
/* Found duplicate. */
@@ -783,13 +800,13 @@ static void attr_create_pointiness(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh, b
EdgeMap visited_edges;
memset(&counter[0], 0, sizeof(int) * counter.size());
const MEdge *edges = static_cast<MEdge *>(b_mesh.edges[0].ptr.data);
const int2 *edges = static_cast<int2 *>(b_mesh.edges[0].ptr.data);
const int edges_num = b_mesh.edges.length();
for (int i = 0; i < edges_num; i++) {
const MEdge &b_edge = edges[i];
const int v0 = vert_orig_index[b_edge.v1];
const int v1 = vert_orig_index[b_edge.v2];
const int2 &b_edge = edges[i];
const int v0 = vert_orig_index[b_edge[0]];
const int v1 = vert_orig_index[b_edge[1]];
if (visited_edges.exists(v0, v1)) {
continue;
}
@@ -825,9 +842,9 @@ static void attr_create_pointiness(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh, b
memset(&counter[0], 0, sizeof(int) * counter.size());
visited_edges.clear();
for (int i = 0; i < edges_num; i++) {
const MEdge &b_edge = edges[i];
const int v0 = vert_orig_index[b_edge.v1];
const int v1 = vert_orig_index[b_edge.v2];
const int2 &b_edge = edges[i];
const int v0 = vert_orig_index[b_edge[0]];
const int v1 = vert_orig_index[b_edge[1]];
if (visited_edges.exists(v0, v1)) {
continue;
}
@@ -894,12 +911,12 @@ static void attr_create_random_per_island(Scene *scene,
DisjointSet vertices_sets(number_of_vertices);
const MEdge *edges = static_cast<MEdge *>(b_mesh.edges[0].ptr.data);
const int2 *edges = static_cast<int2 *>(b_mesh.edges[0].ptr.data);
const int edges_num = b_mesh.edges.length();
const int *corner_verts = find_corner_vert_attribute(b_mesh);
for (int i = 0; i < edges_num; i++) {
vertices_sets.join(edges[i].v1, edges[i].v2);
vertices_sets.join(edges[i][0], edges[i][1]);
}
AttributeSet &attributes = (subdivision) ? mesh->subd_attributes : mesh->attributes;
@@ -1078,9 +1095,10 @@ static void create_mesh(Scene *scene,
}
if (material_indices) {
const int *looptri_polys = static_cast<const int *>(
b_mesh.loop_triangle_polygons[0].ptr.data);
for (int i = 0; i < numtris; i++) {
const int poly_index = looptris[i].poly;
shader[i] = clamp_material_index(material_indices[poly_index]);
shader[i] = clamp_material_index(material_indices[looptri_polys[i]]);
}
}
else {
@@ -1088,9 +1106,10 @@ static void create_mesh(Scene *scene,
}
if (sharp_faces && !(use_loop_normals && corner_normals)) {
const int *looptri_polys = static_cast<const int *>(
b_mesh.loop_triangle_polygons[0].ptr.data);
for (int i = 0; i < numtris; i++) {
const int poly_index = looptris[i].poly;
smooth[i] = !sharp_faces[poly_index];
smooth[i] = !sharp_faces[looptri_polys[i]];
}
}
else {
@@ -1221,12 +1240,12 @@ static void create_subd_mesh(Scene *scene,
mesh->reserve_subd_creases(num_creases);
const MEdge *edges = static_cast<MEdge *>(b_mesh.edges[0].ptr.data);
const int2 *edges = static_cast<int2 *>(b_mesh.edges[0].ptr.data);
for (int i = 0; i < edges_num; i++) {
const float crease = creases[i];
if (crease != 0.0f) {
const MEdge &b_edge = edges[i];
mesh->add_edge_crease(b_edge.v1, b_edge.v2, crease);
const int2 &b_edge = edges[i];
mesh->add_edge_crease(b_edge[0], b_edge[1], crease);
}
}
}
@@ -1312,7 +1331,8 @@ void BlenderSync::sync_mesh(BL::Depsgraph b_depsgraph, BObjectInfo &b_ob_info, M
for (const SocketType &socket : new_mesh.type->inputs) {
/* Those sockets are updated in sync_object, so do not modify them. */
if (socket.name == "use_motion_blur" || socket.name == "motion_steps" ||
socket.name == "used_shaders") {
socket.name == "used_shaders")
{
continue;
}
mesh->set_value(socket, new_mesh, socket);

View File

@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: Apache-2.0
* Copyright 2011-2022 Blender Foundation */
#include "blender/light_linking.h"
#include "blender/object_cull.h"
#include "blender/sync.h"
#include "blender/util.h"
@@ -63,7 +64,8 @@ bool BlenderSync::object_is_geometry(BObjectInfo &b_ob_info)
BL::Object::type_enum type = b_ob_info.iter_object.type();
if (type == BL::Object::type_VOLUME || type == BL::Object::type_CURVES ||
type == BL::Object::type_POINTCLOUD) {
type == BL::Object::type_POINTCLOUD)
{
/* Will be exported attached to mesh. */
return true;
}
@@ -325,7 +327,8 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
* transform comparison should not be needed, but duplis don't work perfect
* in the depsgraph and may not signal changes, so this is a workaround */
if (object->is_modified() || object_updated ||
(object->get_geometry() && object->get_geometry()->is_modified())) {
(object->get_geometry() && object->get_geometry()->is_modified()))
{
object->name = b_ob.name().c_str();
object->set_pass_id(b_ob.pass_index());
const BL::Array<float, 4> object_color = b_ob.color();
@@ -346,9 +349,14 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
object->set_random_id(hash_uint2(hash_string(object->name.c_str()), 0));
}
/* lightgroup */
/* Light group and linking. */
object->set_lightgroup(ustring(b_ob.lightgroup()));
object->set_light_set_membership(BlenderLightLink::get_light_set_membership(b_parent, b_ob));
object->set_receiver_light_set(BlenderLightLink::get_receiver_light_set(b_parent, b_ob));
object->set_shadow_set_membership(BlenderLightLink::get_shadow_set_membership(b_parent, b_ob));
object->set_blocker_shadow_set(BlenderLightLink::get_blocker_shadow_set(b_parent, b_ob));
object->tag_update(scene);
}
@@ -408,7 +416,8 @@ bool BlenderSync::sync_object_attributes(BL::DepsgraphObjectInstance &b_instance
BlenderAttributeType type = blender_attribute_name_split_type(name, &real_name);
if (type == BL::ShaderNodeAttribute::attribute_type_OBJECT ||
type == BL::ShaderNodeAttribute::attribute_type_INSTANCER) {
type == BL::ShaderNodeAttribute::attribute_type_INSTANCER)
{
bool use_instancer = (type == BL::ShaderNodeAttribute::attribute_type_INSTANCER);
float4 value = lookup_instance_property(b_instance, real_name, use_instancer);
@@ -556,7 +565,8 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
for (b_depsgraph.object_instances.begin(b_instance_iter);
b_instance_iter != b_depsgraph.object_instances.end() && !cancel;
++b_instance_iter) {
++b_instance_iter)
{
BL::DepsgraphObjectInstance b_instance = *b_instance_iter;
BL::Object b_ob = b_instance.object();
@@ -667,7 +677,8 @@ void BlenderSync::sync_motion(BL::RenderSettings &b_render,
float frame_center_delta = 0.0f;
if (scene->need_motion() != Scene::MOTION_PASS &&
scene->camera->get_motion_position() != MOTION_POSITION_CENTER) {
scene->camera->get_motion_position() != MOTION_POSITION_CENTER)
{
float shuttertime = scene->camera->get_shuttertime();
if (scene->camera->get_motion_position() == MOTION_POSITION_END) {
frame_center_delta = -shuttertime * 0.5f;

View File

@@ -21,7 +21,8 @@ static void attr_create_motion(PointCloud *pointcloud,
const float motion_scale)
{
if (!(b_attribute.domain() == BL::Attribute::domain_POINT) &&
(b_attribute.data_type() == BL::Attribute::data_type_FLOAT_VECTOR)) {
(b_attribute.data_type() == BL::Attribute::data_type_FLOAT_VECTOR))
{
return;
}
@@ -102,6 +103,16 @@ static void copy_attributes(PointCloud *pointcloud,
}
break;
}
case BL::Attribute::data_type_INT32_2D: {
BL::Int2Attribute b_int2_attribute{b_attribute};
const int2 *src = static_cast<const int2 *>(b_int2_attribute.data[0].ptr.data);
Attribute *attr = attributes.add(name, TypeFloat2, element);
float2 *data = attr->data_float2();
for (int i = 0; i < num_points; i++) {
data[i] = make_float2(float(src[i][0]), float(src[i][1]));
}
break;
}
case BL::Attribute::data_type_FLOAT_VECTOR: {
BL::FloatVectorAttribute b_vector_attribute{b_attribute};
const float(*src)[3] = static_cast<const float(*)[3]>(b_vector_attribute.data[0].ptr.data);
@@ -303,7 +314,8 @@ void BlenderSync::sync_pointcloud(PointCloud *pointcloud, BObjectInfo &b_ob_info
for (const SocketType &socket : new_pointcloud.type->inputs) {
/* Those sockets are updated in sync_object, so do not modify them. */
if (socket.name == "use_motion_blur" || socket.name == "motion_steps" ||
socket.name == "used_shaders") {
socket.name == "used_shaders")
{
continue;
}
pointcloud->set_value(socket, new_pointcloud, socket);

View File

@@ -163,7 +163,8 @@ static PyObject *create_func(PyObject * /*self*/, PyObject *args)
&pyregion,
&pyv3d,
&pyrv3d,
&preview_osl)) {
&preview_osl))
{
return NULL;
}
@@ -522,7 +523,8 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
}
else if (param->type.vecsemantics == TypeDesc::POINT ||
param->type.vecsemantics == TypeDesc::VECTOR ||
param->type.vecsemantics == TypeDesc::NORMAL) {
param->type.vecsemantics == TypeDesc::NORMAL)
{
socket_type = "NodeSocketVector";
data_type = BL::NodeSocket::type_VECTOR;
@@ -738,7 +740,8 @@ static PyObject *denoise_func(PyObject * /*self*/, PyObject *args, PyObject *key
&pyscene,
&pyviewlayer,
&pyinput,
&pyoutput)) {
&pyoutput))
{
return NULL;
}
@@ -876,20 +879,23 @@ static PyObject *enable_print_stats_func(PyObject * /*self*/, PyObject * /*args*
static PyObject *get_device_types_func(PyObject * /*self*/, PyObject * /*args*/)
{
vector<DeviceType> device_types = Device::available_types();
bool has_cuda = false, has_optix = false, has_hip = false, has_metal = false, has_oneapi = false;
bool has_cuda = false, has_optix = false, has_hip = false, has_metal = false, has_oneapi = false,
has_hiprt = false;
foreach (DeviceType device_type, device_types) {
has_cuda |= (device_type == DEVICE_CUDA);
has_optix |= (device_type == DEVICE_OPTIX);
has_hip |= (device_type == DEVICE_HIP);
has_metal |= (device_type == DEVICE_METAL);
has_oneapi |= (device_type == DEVICE_ONEAPI);
has_hiprt |= (device_type == DEVICE_HIPRT);
}
PyObject *list = PyTuple_New(5);
PyObject *list = PyTuple_New(6);
PyTuple_SET_ITEM(list, 0, PyBool_FromLong(has_cuda));
PyTuple_SET_ITEM(list, 1, PyBool_FromLong(has_optix));
PyTuple_SET_ITEM(list, 2, PyBool_FromLong(has_hip));
PyTuple_SET_ITEM(list, 3, PyBool_FromLong(has_metal));
PyTuple_SET_ITEM(list, 4, PyBool_FromLong(has_oneapi));
PyTuple_SET_ITEM(list, 5, PyBool_FromLong(has_hiprt));
return list;
}
@@ -1034,6 +1040,14 @@ void *CCL_python_module_init()
Py_INCREF(Py_False);
#endif /* WITH_EMBREE */
#ifdef WITH_EMBREE_GPU
PyModule_AddObject(mod, "with_embree_gpu", Py_True);
Py_INCREF(Py_True);
#else /* WITH_EMBREE_GPU */
PyModule_AddObject(mod, "with_embree_gpu", Py_False);
Py_INCREF(Py_False);
#endif /* WITH_EMBREE_GPU */
if (ccl::openimagedenoise_supported()) {
PyModule_AddObject(mod, "with_openimagedenoise", Py_True);
Py_INCREF(Py_True);

View File

@@ -202,7 +202,8 @@ void BlenderSession::reset_session(BL::BlendData &b_data, BL::Depsgraph &b_depsg
b_scene, background, use_developer_ui);
if (scene->params.modified(scene_params) || session->params.modified(session_params) ||
!this->b_render.use_persistent_data()) {
!this->b_render.use_persistent_data())
{
/* if scene or session parameters changed, it's easier to simply re-create
* them rather than trying to distinguish which settings need to be updated
*/
@@ -376,8 +377,8 @@ void BlenderSession::render(BL::Depsgraph &b_depsgraph_)
}
int view_index = 0;
for (b_rr.views.begin(b_view_iter); b_view_iter != b_rr.views.end();
++b_view_iter, ++view_index) {
for (b_rr.views.begin(b_view_iter); b_view_iter != b_rr.views.end(); ++b_view_iter, ++view_index)
{
b_rview_name = b_view_iter->name();
buffer_params.layer = b_view_layer.name();
@@ -514,6 +515,7 @@ void BlenderSession::render_frame_finish()
static bool bake_setup_pass(Scene *scene, const string &bake_type_str, const int bake_filter)
{
Integrator *integrator = scene->integrator;
Film *film = scene->film;
const char *bake_type = bake_type_str.c_str();
PassType type = PASS_NONE;
@@ -541,13 +543,29 @@ static bool bake_setup_pass(Scene *scene, const string &bake_type_str, const int
else if (strcmp(bake_type, "ENVIRONMENT") == 0) {
type = PASS_BACKGROUND;
}
/* AO passes. */
/* AO pass. */
else if (strcmp(bake_type, "AO") == 0) {
type = PASS_AO;
}
/* Shadow pass. */
else if (strcmp(bake_type, "SHADOW") == 0) {
/* Bake as combined pass, together with marking the object as a shadow catcher. */
type = PASS_SHADOW_CATCHER;
film->set_use_approximate_shadow_catcher(true);
use_direct_light = true;
use_indirect_light = true;
include_albedo = true;
integrator->set_use_diffuse(true);
integrator->set_use_glossy(true);
integrator->set_use_transmission(true);
integrator->set_use_emission(true);
}
/* Combined pass. */
else if (strcmp(bake_type, "COMBINED") == 0) {
type = PASS_COMBINED;
film->set_use_approximate_shadow_catcher(true);
use_direct_light = (bake_filter & BL::BakeSettings::pass_filter_DIRECT) != 0;
use_indirect_light = (bake_filter & BL::BakeSettings::pass_filter_INDIRECT) != 0;
@@ -562,7 +580,8 @@ static bool bake_setup_pass(Scene *scene, const string &bake_type_str, const int
/* Light component passes. */
else if (strcmp(bake_type, "DIFFUSE") == 0) {
if ((bake_filter & BL::BakeSettings::pass_filter_DIRECT) &&
bake_filter & BL::BakeSettings::pass_filter_INDIRECT) {
bake_filter & BL::BakeSettings::pass_filter_INDIRECT)
{
type = PASS_DIFFUSE;
use_direct_light = true;
use_indirect_light = true;
@@ -583,7 +602,8 @@ static bool bake_setup_pass(Scene *scene, const string &bake_type_str, const int
}
else if (strcmp(bake_type, "GLOSSY") == 0) {
if ((bake_filter & BL::BakeSettings::pass_filter_DIRECT) &&
bake_filter & BL::BakeSettings::pass_filter_INDIRECT) {
bake_filter & BL::BakeSettings::pass_filter_INDIRECT)
{
type = PASS_GLOSSY;
use_direct_light = true;
use_indirect_light = true;
@@ -604,7 +624,8 @@ static bool bake_setup_pass(Scene *scene, const string &bake_type_str, const int
}
else if (strcmp(bake_type, "TRANSMISSION") == 0) {
if ((bake_filter & BL::BakeSettings::pass_filter_DIRECT) &&
bake_filter & BL::BakeSettings::pass_filter_INDIRECT) {
bake_filter & BL::BakeSettings::pass_filter_INDIRECT)
{
type = PASS_TRANSMISSION;
use_direct_light = true;
use_indirect_light = true;
@@ -679,17 +700,23 @@ void BlenderSession::bake(BL::Depsgraph &b_depsgraph_,
/* Object might have been disabled for rendering or excluded in some
* other way, in that case Blender will report a warning afterwards. */
bool object_found = false;
Object *bake_object = nullptr;
if (!session->progress.get_cancel()) {
foreach (Object *ob, scene->objects) {
if (ob->name == b_object.name()) {
object_found = true;
bake_object = ob;
break;
}
}
}
if (object_found && !session->progress.get_cancel()) {
/* For the shadow pass, temporarily mark the object as a shadow catcher. */
const bool was_shadow_catcher = (bake_object) ? bake_object->get_is_shadow_catcher() : false;
if (bake_object && bake_type == "SHADOW") {
bake_object->set_is_shadow_catcher(true);
}
if (bake_object && !session->progress.get_cancel()) {
/* Get session and buffer parameters. */
const SessionParams session_params = BlenderSync::get_session_params(
b_engine, b_userpref, b_scene, background);
@@ -710,10 +737,15 @@ void BlenderSession::bake(BL::Depsgraph &b_depsgraph_,
}
/* Perform bake. Check cancel to avoid crash with incomplete scene data. */
if (object_found && !session->progress.get_cancel()) {
if (bake_object && !session->progress.get_cancel()) {
session->start();
session->wait();
}
/* Restore object state. */
if (bake_object) {
bake_object->set_is_shadow_catcher(was_shadow_catcher);
}
}
void BlenderSession::synchronize(BL::Depsgraph &b_depsgraph_)
@@ -1061,7 +1093,7 @@ void BlenderSession::ensure_display_driver_if_needed()
unique_ptr<BlenderDisplayDriver> display_driver = make_unique<BlenderDisplayDriver>(
b_engine, b_scene, background);
display_driver_ = display_driver.get();
session->set_display_driver(move(display_driver));
session->set_display_driver(std::move(display_driver));
}
CCL_NAMESPACE_END

View File

@@ -523,27 +523,6 @@ static ShaderNode *add_node(Scene *scene,
else if (b_node.is_a(&RNA_ShaderNodeHoldout)) {
node = graph->create_node<HoldoutNode>();
}
else if (b_node.is_a(&RNA_ShaderNodeBsdfAnisotropic)) {
BL::ShaderNodeBsdfAnisotropic b_aniso_node(b_node);
AnisotropicBsdfNode *aniso = graph->create_node<AnisotropicBsdfNode>();
switch (b_aniso_node.distribution()) {
case BL::ShaderNodeBsdfAnisotropic::distribution_BECKMANN:
aniso->set_distribution(CLOSURE_BSDF_MICROFACET_BECKMANN_ID);
break;
case BL::ShaderNodeBsdfAnisotropic::distribution_GGX:
aniso->set_distribution(CLOSURE_BSDF_MICROFACET_GGX_ID);
break;
case BL::ShaderNodeBsdfAnisotropic::distribution_MULTI_GGX:
aniso->set_distribution(CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID);
break;
case BL::ShaderNodeBsdfAnisotropic::distribution_ASHIKHMIN_SHIRLEY:
aniso->set_distribution(CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID);
break;
}
node = aniso;
}
else if (b_node.is_a(&RNA_ShaderNodeBsdfDiffuse)) {
node = graph->create_node<DiffuseBsdfNode>();
}
@@ -566,24 +545,21 @@ static ShaderNode *add_node(Scene *scene,
node = subsurface;
}
else if (b_node.is_a(&RNA_ShaderNodeBsdfGlossy)) {
BL::ShaderNodeBsdfGlossy b_glossy_node(b_node);
else if (b_node.is_a(&RNA_ShaderNodeBsdfAnisotropic)) {
BL::ShaderNodeBsdfAnisotropic b_glossy_node(b_node);
GlossyBsdfNode *glossy = graph->create_node<GlossyBsdfNode>();
switch (b_glossy_node.distribution()) {
case BL::ShaderNodeBsdfGlossy::distribution_SHARP:
glossy->set_distribution(CLOSURE_BSDF_REFLECTION_ID);
break;
case BL::ShaderNodeBsdfGlossy::distribution_BECKMANN:
case BL::ShaderNodeBsdfAnisotropic::distribution_BECKMANN:
glossy->set_distribution(CLOSURE_BSDF_MICROFACET_BECKMANN_ID);
break;
case BL::ShaderNodeBsdfGlossy::distribution_GGX:
case BL::ShaderNodeBsdfAnisotropic::distribution_GGX:
glossy->set_distribution(CLOSURE_BSDF_MICROFACET_GGX_ID);
break;
case BL::ShaderNodeBsdfGlossy::distribution_ASHIKHMIN_SHIRLEY:
case BL::ShaderNodeBsdfAnisotropic::distribution_ASHIKHMIN_SHIRLEY:
glossy->set_distribution(CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID);
break;
case BL::ShaderNodeBsdfGlossy::distribution_MULTI_GGX:
case BL::ShaderNodeBsdfAnisotropic::distribution_MULTI_GGX:
glossy->set_distribution(CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID);
break;
}
@@ -593,9 +569,6 @@ static ShaderNode *add_node(Scene *scene,
BL::ShaderNodeBsdfGlass b_glass_node(b_node);
GlassBsdfNode *glass = graph->create_node<GlassBsdfNode>();
switch (b_glass_node.distribution()) {
case BL::ShaderNodeBsdfGlass::distribution_SHARP:
glass->set_distribution(CLOSURE_BSDF_SHARP_GLASS_ID);
break;
case BL::ShaderNodeBsdfGlass::distribution_BECKMANN:
glass->set_distribution(CLOSURE_BSDF_MICROFACET_BECKMANN_GLASS_ID);
break;
@@ -612,9 +585,6 @@ static ShaderNode *add_node(Scene *scene,
BL::ShaderNodeBsdfRefraction b_refraction_node(b_node);
RefractionBsdfNode *refraction = graph->create_node<RefractionBsdfNode>();
switch (b_refraction_node.distribution()) {
case BL::ShaderNodeBsdfRefraction::distribution_SHARP:
refraction->set_distribution(CLOSURE_BSDF_REFRACTION_ID);
break;
case BL::ShaderNodeBsdfRefraction::distribution_BECKMANN:
refraction->set_distribution(CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID);
break;
@@ -981,22 +951,8 @@ static ShaderNode *add_node(Scene *scene,
sky->set_sun_disc(b_sky_node.sun_disc());
sky->set_sun_size(b_sky_node.sun_size());
sky->set_sun_intensity(b_sky_node.sun_intensity());
/* Patch sun position to be able to animate daylight cycle while keeping the shading code
* simple. */
float sun_rotation = b_sky_node.sun_rotation();
/* Wrap into [-2PI..2PI] range. */
float sun_elevation = fmodf(b_sky_node.sun_elevation(), M_2PI_F);
/* Wrap into [-PI..PI] range. */
if (fabsf(sun_elevation) >= M_PI_F) {
sun_elevation -= copysignf(2.0f, sun_elevation) * M_PI_F;
}
/* Wrap into [-PI/2..PI/2] range while keeping the same absolute position. */
if (sun_elevation >= M_PI_2_F || sun_elevation <= -M_PI_2_F) {
sun_elevation = copysignf(M_PI_F, sun_elevation) - sun_elevation;
sun_rotation += M_PI_F;
}
sky->set_sun_elevation(sun_elevation);
sky->set_sun_rotation(sun_rotation);
sky->set_sun_elevation(b_sky_node.sun_elevation());
sky->set_sun_rotation(b_sky_node.sun_rotation());
sky->set_altitude(b_sky_node.altitude());
sky->set_air_density(b_sky_node.air_density());
sky->set_dust_density(b_sky_node.dust_density());
@@ -1260,7 +1216,8 @@ static void add_nodes(Scene *scene,
}
}
else if (b_node.is_a(&RNA_ShaderNodeGroup) || b_node.is_a(&RNA_NodeCustomGroup) ||
b_node.is_a(&RNA_ShaderNodeCustomGroup)) {
b_node.is_a(&RNA_ShaderNodeCustomGroup))
{
BL::ShaderNodeTree b_group_ntree(PointerRNA_NULL);
if (b_node.is_a(&RNA_ShaderNodeGroup))
@@ -1396,7 +1353,8 @@ static void add_nodes(Scene *scene,
/* Ignore invalid links to avoid unwanted cycles created in graph.
* Also ignore links with unavailable sockets. */
if (!(b_link.is_valid() && b_link.from_socket().enabled() && b_link.to_socket().enabled()) ||
b_link.is_muted()) {
b_link.is_muted())
{
continue;
}
/* get blender link data */
@@ -1545,7 +1503,8 @@ void BlenderSync::sync_materials(BL::Depsgraph &b_depsgraph, bool update_all)
/* test if we need to sync */
if (shader_map.add_or_update(&shader, b_mat) || update_all ||
scene_attr_needs_recalc(shader, b_depsgraph)) {
scene_attr_needs_recalc(shader, b_depsgraph))
{
ShaderGraph *graph = new ShaderGraph();
shader->name = b_mat.name().c_str();
@@ -1628,12 +1587,14 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d,
if (world_recalc || update_all || b_world.ptr.data != world_map ||
viewport_parameters.shader_modified(new_viewport_parameters) ||
scene_attr_needs_recalc(shader, b_depsgraph)) {
scene_attr_needs_recalc(shader, b_depsgraph))
{
ShaderGraph *graph = new ShaderGraph();
/* create nodes */
if (new_viewport_parameters.use_scene_world && b_world && b_world.use_nodes() &&
b_world.node_tree()) {
b_world.node_tree())
{
BL::ShaderNodeTree b_ntree(b_world.node_tree());
add_nodes(scene, b_engine, b_data, b_depsgraph, b_scene, graph, b_ntree);
@@ -1795,7 +1756,8 @@ void BlenderSync::sync_lights(BL::Depsgraph &b_depsgraph, bool update_all)
/* test if we need to sync */
if (shader_map.add_or_update(&shader, b_light) || update_all ||
scene_attr_needs_recalc(shader, b_depsgraph)) {
scene_attr_needs_recalc(shader, b_depsgraph))
{
ShaderGraph *graph = new ShaderGraph();
/* create nodes */

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