1
1

Compare commits

..

811 Commits

Author SHA1 Message Date
c396f41e14 Merge branch 'main' into geometry-nodes-simulation 2023-04-22 16:15:41 +02: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
05ddbc20b8 Simulation Nodes: bake simulation states to disk
This adds baking support to simulation nodes.

The following features are supported:
* Bake simulation nodes of selected objects from the new "Baking" panel in the
  object properties.
* Free baked/cached simulation data.
* The bake is stored on disk in a folder next to the .blend file (so it's necessary
  to save before baking works).
* Baked data is detected automatically when reloading the file.
* The data stored on disk is partially deduplicated. Only duplicates that can be
  detected using implicit-sharing are taken into account.
* The baked data can contain meshes, curves, pointclouds and instances.
* The simulation state is written using a combination raw binary files for the
  data arrays and `.json` for meta data. Other formats besides `.json` could be
  used (most code is agnostic to that), but json is the easiest to use right now and
  seems to be good enough the common use cases (note that the size of the `.json`
  files do not depend on how large e.g. the baked mesh is).
* During baking, there is a progress bar and it can be interrupted using escape.

Limitations:
* Volumes are not written to disk yet.
* Currently it always bakes the entire scene frame range.
* Baking subframes is supported internally, but is not exposed in the UI.
* Currently, all attributes are written, but that is likely not necessary in most
  cases (e.g. selection attributes are written as well).

Pull Request: blender/blender#106937
2023-04-22 14:48:43 +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
f307b5ae65 Merge branch 'main' into geometry-nodes-simulation 2023-04-22 13:13:16 +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
a04b39faf4 Merge branch 'main' into geometry-nodes-simulation 2023-04-21 15:26:21 -04: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
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
0865f80591 Merge branch 'main' into geometry-nodes-simulation 2023-04-21 09:26:59 +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
4d34028ce9 use BitArrayVector instead of MultiValueMap for attribute propagation detection
This simplifies the code and also makes it more efficient in many cases
(although not by much in my simple tests).
2023-04-20 14:31:21 +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
80fdf4a88d Merge branch 'main' into geometry-nodes-simulation 2023-04-19 23:25:50 -04:00
716b9cff23 Fix: Search in node editors missing items
Mistake in d6abd2ce72.
2023-04-19 23:19:45 -04:00
945d71b56b Merge branch 'main' into geometry-nodes-simulation 2023-04-19 22:52:35 -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
a5140712cc Merge branch 'main' into geometry-nodes-simulation 2023-04-19 11:25:26 +02: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
40c76a1945 Merge branch 'main' into geometry-nodes-simulation 2023-04-19 08:57:35 +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
95bc1dd0e5 Cleanup: MIssing definition 2023-04-18 16:56:26 -04: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
6f26bb6841 add missing immUnbindProgram() 2023-04-18 14:27:54 +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
e41cd795a6 Small cleanups to zone drawing
- Avoid unnecessary topology tag
- Copy from offsets in one line
- Comment formatting
- Avoid describing future changes in comment, let the code stand on its own
2023-04-18 07:24:06 -04: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
01c6824eaf Cleanup: make format 2023-04-18 12:12:51 +02:00
8981bb4ac6 Geometry Nodes: Simulation Zone drawing updates
* Make the drawing smoother/anti-aliased.
* We use the alpha to blend between the background and the zone color.
* If alpha is 100% we then get to see the dotted background again
* Change zone corner radius to match nodes/layout.

If we want to set the background transparent again we need to do:
```
-    immUniformThemeColorBlend(TH_BACK, TH_NODE_ZONE_SIMULATION, zone_color[3]);
+    immUniformThemeColor(TH_NODE_ZONE_SIMULATION);
```

For the design behind some of those change see #106810
Pull Request: #107043
2023-04-18 12:08:27 +02: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
e4926b4b2a Merge branch 'main' into geometry-nodes-simulation 2023-04-18 11:15:23 +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
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
315cc66bd8 Fix #106732: Support for simulation zones in copy operators
Copying a simulation zone should keep the 1:1 pairing intact (see `remap_pairing` functions)
- When copying a simulation input node on its own, unpair it to avoid ambiguity. Only the old simulation input node is paired to the output.
- When copying a simulation output node on its own, no special action is needed - the node gets a new ID and nothing is paired with it.
- When copying both input and output, remap the `output_node_id` property of the simulation input node, so that it is paired with the output copy.

There are a couple of places where copies happen:
* Node tree copy
* Duplicate nodes
* Group Separate (copies nodes from the group tree into another tree)
* Clipboard (both copy to clipboard and paste into node tree)
* Shader node tree branch copy for execution

These copy operators do mostly the same thing, but in slightly different ways, which makes the code incompatible (e.g. using a `Map<const bNode *, bNode *> node_map` vs. `Map<bNode *, bNode *> node_map`). That's why there are 3 `remap_pairing` implementations.

Dynamic node declarations are problematic:
Copying nodes invokes `nodeDeclarationEnsure` to generate declarations for new nodes. It does not, however, change the socket lists. If a dynamic declaration for a node copy alters the sockets (in this case: remove all because the node is unpaired), the subsequent `update_socket_declarations` will crash because it expects sockets to match the declaration.
At the end of operators there is usually a `BKE_ntree_update_main` or similar, which invokes `update_node_declaration_and_sockets`. This method _does_ update the socket lists as well (see #106732), but only if a node is tagged for a respective update.

The solution here is to use `update_node_declaration_and_sockets` for dynamic declarations instead of just `build_node_declaration_dynamic`.

Pull Request: blender/blender#106812
2023-04-17 16:10:55 +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
8f3796e90a Merge branch 'main' into geometry-nodes-simulation 2023-04-17 06:34:09 +02: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
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
cbc5b17c1a Cleanup: Use const int cast 2023-04-13 22:20:47 -04:00
a76c714c26 Cleanup: Whitespace 2023-04-13 22:20:35 -04:00
c22fed5c01 Cleanup: Unnecessary null check
See comment on MEM_delete
2023-04-13 22:20:26 -04:00
c38d259779 Cleanup: Use const pointers 2023-04-13 22:17:06 -04:00
8497737d92 Cleanup: Use reference 2023-04-13 22:16:42 -04:00
c385369e07 Cleanup: Fix typo in function name 2023-04-13 22:12:47 -04:00
4ebe696e85 Cleanup: Comment formatting and const casts 2023-04-13 22:12:09 -04:00
b180fea69e Cleanup: Proper doxygen section 2023-04-13 22:08:57 -04:00
a066d62798 Cleanup: Function and variable naming 2023-04-13 22:08:02 -04:00
c226954d03 Cleanup: Proper doxygen syntax 2023-04-13 22:06:43 -04:00
9e4f58a8eb Merge branch 'main' into geometry-nodes-simulation 2023-04-13 22:06:08 -04: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
baeb386410 Merge branch 'main' into geometry-nodes-simulation 2023-04-13 16:41:16 +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
e35f971da1 Mesh: Avoid unnecessarily initializing corner topology arrays
This data should be initialized when building the mesh. If the arrays
aren't already initialized, there is already a bug. Theoretically this
could improve performance, since we can use `malloc` instead of
`calloc`. In practice I observed less than a 1% difference though.
2023-04-12 15:49:09 -04:00
a04098ebba Fix: Incorrect creation of deform mesh with no deform modifiers
Logic error in 99c630cd9c, hidden by a null check
in `BKE_id_copy_ex`.
2023-04-12 15:42:14 -04:00
16de3ba759 Fix #106845: Extrude node crash when no faces added
The non-individual face mode needs to check if there are any new faces
before accumulating their corner offsets.
2023-04-12 15:40:55 -04:00
e03da77033 Curves: Avoid unnecessary allocations in copy and move constructors
These aren't used much in current code, but currently they created
offsets on the result curves, then just freed them again when copying
from the source data. In the future it might be better to completely
avoid using the base constructor in the first place.
2023-04-12 15:32:30 -04:00
dccd42766c Cleanup: Use swap to take ownership of mesh data
Swap is commonly used to implement move assignment since it's short
and the logic is relatively simple. Use is here to avoid the need to
spell out the copying and freeing manually. The `BKE_id_free` call
at the end of the function will free whatever data was swapped.
2023-04-12 15:08:15 -04:00
642bc5546a Cleanup: Access curves offsets in RNA with C wrapper function
This simplifies the process of adding implicit sharing to the curve
offsets in the future.
2023-04-12 14:58:17 -04:00
b7e9906337 Cleanup: Remove unnecessary check when allocating mesh face offsets
The assert already checks this, but even in release builds,
doing nothing is probably worse than a memory leak here.
2023-04-12 14:56:28 -04:00
dd229a9d54 Cleanup: Slightly CurvesGeometry reorganize read function
The curve types and the runtime always have to be created when reading
the file from disk, so we might as well do that in `blend_read`, which
will help in the future when the offsets use implicit sharing.
2023-04-12 14:54:18 -04:00
87cd22f643 Cleanup: Use early return in legacy curve conversion
Return null instead of an empty curves data-block, which amounts to
the same thing in geometry nodes, with less potential for error in
the rest of the function.
2023-04-12 14:51:24 -04:00
2b6c1600cf UI: Allow Float Kerning for Text Objects
Change Text Object character `kern` member to float from int, and allow
fractional changes to kerning with Shift-Alt-arrows.

Pull Request: blender/blender#105181
2023-04-12 19:11:53 +02:00
0ee0e8c0d4 UI: Tooltips for Assets
Show tooltips for Asset Browser items.

Pull Request: blender/blender#106189
2023-04-12 18:44:47 +02:00
000aef6e5e Cleanup: Use references in mesh.cc 2023-04-12 11:49:43 -04:00
baf6892270 Cleanup: Add utility function for clearing mesh geometry
The existing utility cleared vertex group names and active attribute
names, which doesn't always make sense when the geometry is
replaced but the custom data layout remains mainly unchanged.
2023-04-12 11:49:43 -04:00
2771f53cb7 UI: Fix disconnected and non-clickable checkbox labels in popovers
For popovers, draw the checkbox in header as usual with label, but
hide the panel header label, see ed870f87b9.

Patch by Yevgeny Makarov (@jenkm) in
https://archive.blender.org/developer/D9586

Co-authored-by: Yevgeny Makarov <jenkm>
Pull Request: blender/blender#105657
2023-04-12 17:00:51 +02:00
c738d8df84 Cleanup: VSE clipboard: Remove code in blo_lib_link_restore.
This code (looking for matching new IDs to restore by name) is called
from `set_app_data` after a .blend file has been read (also in memfile
undo case).

The part handling VSE clipboard to restore ID pointers is not really
needed, since pasting VSE strips already ensures stored ID pointers are
still valid, and tries to find a new matching one otherwise.
2023-04-12 16:18:25 +02:00
c40ce3baae Cleanup: I18n: sort disambiguation contexts from BLT_translation.h
The contexts appear twice, in the list of #defines and in the
BLT_I18NCONTEXTS_DESC. Both had gotten out of alphabetical order, and
out of sync.

Pull Request: blender/blender#106718
2023-04-12 15:09:21 +02:00
5cf365554b I18n: disambiguate a few messages
- "Lens" can be a transparent object used in cameras, or specifically
  its property of focal length
- "Empty" can be an adjective meaning void, or an object type. The
  latter is already disambiguated using `ID_ID`
- "New" and "Old" are adjectives that can have agreements in some
  languages
- "Modified" is an adjective that can have agreement in some languages
- "Clipping" can be a property of a camera, or a behavior of the
  mirror modifier
- "Value" in HSV nodes, see #105113
- "Area" in the Face Area geometry node, can mean a measurement or a
  window type
- "New" is an adjective that can have agreement
- "Tab" can be a UI element or a whitespace character
- "Volume" can mean a measurement or an object type. The latter is
  already disambiguated using `ID_ID`

These changes introduce the new `BLT_I18NCONTEXT_TIME` translation
context.

They also remove `BLT_I18NCONTEXT_VIRTUAL_REALITY`, which I added at
one point but then couldn't find which messages I wanted to fix with
it.

Ref #43295

Pull Request: #106718
2023-04-12 15:09:17 +02:00
c31434a570 Cleanup: Remove setting polygon loop total from Python
This property is not editable after 7966cd16d6,
though doing so didn't seem to give an error. It doesn't have
to be set anymore, since the data is redundant with the
"loop_start" anyway.
2023-04-12 08:38:32 -04:00
30d8cb3be8 Fix #106246: Outliner: Crash on deleting the multi-level objects hierarchy.
Existing code was intrisically wrong, and also potentially very
innefficient.

Now tagging objects for deletion and removal is separated from actual
collection removal and object deletion. This makes the code safer,
simpler and more efficient.

NOTE: There is still an unsolved (already existing in original code)
issue with checks on objects that should not be deleted, noted in code.

Pull Request: blender/blender#106821
2023-04-12 14:25:40 +02:00
81815681d0 Python API: Add function to create links to virtual sockets
Links created through the normal Python API are invalid since
7026096099. Before then, one could create links to or from virtual
sockets from Python (grayed out sockets in Group Input and Group
Output nodes), as is still possible in the GUI.

This is documented as an API change, and it broke at least Node
Wrangler, see blender/blender-addons#104470. Instead of just fixing
that, let's introduce an API to make this operation simpler.

Pull Request: blender/blender#105975
2023-04-12 14:18:29 +02:00
9ffd413008 macOS/Linker: support mold and lld
If someone buys "sold", mold should work on macOS too.
With lld, Blender (700 MB) intel i5: 26s -> 17s.

Pull Request #106843
2023-04-12 17:01:53 +05:30
da75495ada Fix user add-ons not showing up with "User" filter in Preferences
Mistake in ba25023d22, updated the drawing code with the wrong function
call. So when setting the add-ons category to "User", add-ons installed
in the user paths (custom paths configured in Preferences) wouldn't show
up.
2023-04-12 13:04:54 +02:00
ac09d18e4e Fix #106840: Add-ons not loading from custom script directories
`script_paths()` wasn't updated correctly, but that was hidden by some
compabtibility logic that was in the patch earlier. Only with my last
change to the PR before merging it that was removed and the error became
quite visible.
2023-04-12 13:02:31 +02:00
3f4f975228 I18n: fix footer in the text editor when loading an external file
When loading an external file in the text editor, the footer text
stating "File: <file>" or "File: <file> (unsaved)" was not translated,
because the translation happened after string formatting, and the
message was thus not found in the po files.

Pull Request: blender/blender#106716
2023-04-12 12:19:00 +02:00
007c9e4e47 Fix #106427: Vector Math node does not appear in node search
When trying to search for the Vector Math node with a translated
interface, the node did not come up because it did not use the proper
translation context.

The Vector Math node's RNA had a translation context added in
db87e2a638, in order for the Floor operation to be disambiguated. I
made a mistake and added the context to the entire node struct instead
of just the Operation prop. This had the result that the Vector Math
was searched with an empty context in the search menu, but could not
be found.

Replacing the translation context from the struct to the property
fixes the issue, and actually allows disambiguating operations such as
Floor, which wasn't achieved previously.

Pull Request: blender/blender#106579
2023-04-12 12:01:48 +02:00
1771ded381 Fix: Call OpenImageIO correctly when creating grayscale images
The call to `channel_sum` requires that the `weights` array is at least
as large as the number of channels in the originating buffer.

Switch to use the span overload as well since the method that takes a
raw weights array is deprecated.

Thanks to @aras_p for debugging the issue.

Pull Request: blender/blender#106847
2023-04-12 10:23:34 +02:00
022652beb9 Fix #106794: Changing active camera changes other viewport local cameras
f36543c5f5 took care of syncing multiple viewport`s cameras, but wasnt
fully meeting intentions [which was to only do this if both viewports
are locked to the scene camera].

Check was only done for the viewport this was executed in (if this was
locked to the scene camera, it would change all other viewports as
well), now also check if the target viewport prefers to use its own
local camera instead and skip it in that case.

Pull Request: blender/blender#106799
2023-04-12 10:10:12 +02:00
13d9a6c929 Cleanup: improve comments for makesrna dependency workaround 2023-04-12 17:23:08 +10:00
28a8a3c086 Fix crash on startup under the RIVER Wayland compositor
Defer acting on the tag to update scale as it caused the window
to use the wrong scale on startup & exit.

GTK/KDE applications seem to postpone updating scale so use this by
default as glitches with scale tend to be caused by updating the scale
too frequently instead of not quickly enough.
2023-04-12 15:54:06 +10:00
ddb6928882 GHOST/Wayland: resize the EGL buffer & change surface scale immediately
There is no need to postpone these operations when configuring the frame
only postpone committing the surface change.

Deferring these operations caused flickering when moving windows
between monitors of different scale on both GNOME & KDE.
2023-04-12 15:54:06 +10:00
1f3949f1cf Fix building WITH_CINEON=OFF 2023-04-12 15:54:06 +10:00
aa3bdfd76a Image: Use OpenImageIO for loading and saving a variety of image formats
This checkin will use OIIO to replace the image save/load code for BMP,
DDS, DPX, HDR, PNG, TGA, and TIFF.

This simplifies our build environment, reduces binary duplication,
removes large amounts of hard to maintain code, and fixes some bugs
along the way.

It should also help reduce rare differences between Blender and Cycles
which already uses OIIO for most situations. Or potentially makes them
easier to solve once discovered.

This is a continuation of the work for #101413

Pull Request: blender/blender#105785
2023-04-12 05:22:26 +02:00
c6d6869171 GHOST/Wayland: suppress EGL_BAD_SURFACE error on exit
Freeing ContextEGL would attempt to free the context's EGLSurface,
which was already freed by the native-window, causing 2x bad-surface
errors on exit.

Suppress the warning by clearing the surface from releaseNativeHandles
when the surface was created by a native window.
2023-04-12 13:12:01 +10:00
b6457dc568 Fix #106740: VSE Image sequence can't be loaded from python
Caused by introduction of `SEQ_SINGLE_FRAME_CONTENT` flag (66eedc542b).
The flag was not updated in `SequenceElements` `append` and `pop`
functions.
2023-04-12 03:40:07 +02:00
6fa80d1e1d Cleanup: add doc-strings to upper/lowecase functions
Move detailed note into the implementation.
2023-04-12 11:24:12 +10:00
ccea39b538 Cleanup: spelling in comments 2023-04-12 11:24:10 +10:00
5df8e35da7 UI: Add slash separators to Hue/Saturation/Value
It was that names of related "combo" operations
like Hue/Saturation/Value, *Dilate/Erode*
and Brightness/Contrast should be separated
by slashes in their names.

This patch changes this for the multiple nodes
and operators concerning Hue/Saturation/Value
across Blender.

Note1: This patch should only touch UI names
which do not need versioning and should not
break scripts.

Note2: This breaks first letter fuzzy search
for "hsv". It was noted by @HooglyBoogly that
the "/" character needs to be added to the
fuzzy search split list. Note however that such
search is already broken in Main for nodes like
Brightness/Contrast and Dilate/Erode which
already use slash separators

Pull Request: blender/blender#106721
2023-04-11 23:48:05 +02:00
4170545dc5 Fix #106828: Extrude individual mode crash on mesh with no faces
Caused by 7966cd16d6
2023-04-11 15:34:03 -04:00
f8108d6dfd UI: Rename Bright/Contrast to Brightness/Contrast
Rename *Bright/Contrast* to *Brightness/Contrast* in order to avoid the use of shortened names and improve consistency within Blender and with industry conventions.

Reasoning:

The modified color characteristic is called *brightness*, not *bright*. You don't modify the *bright* of an image.

This also interferes with search in case someone searches for brightness, producing no results.

*Note: This patch should only touch UI names which do not need versioning. It leaves the actual property name in nodes for a future breaking release.*

Pull Request: blender/blender#104998
2023-04-11 21:32:29 +02:00
fd234fe1ce Fix #106745: Subdivision surface crash with more than 8 UV maps
Before 6c774feba2, the maximum number of UV maps was
enforced throughout Blender. Now it has to be enforced in the few places
that actually have the limit. In the future the limit of the subsurf
could be lifted, but that isn't done now to keep the crash fix simple.
2023-04-11 15:28:08 -04:00
99c630cd9c Fix #106802: Incorrect modifier deform evaluation result
Since the positions of the final mesh are modified rather than a
separate array after d20f992322, the final mesh has
to become the deformed mesh after the deform modifiers, rather
than the input mesh. The arrays can't be shared anymore, but that
performance loss will be solved by implicit sharing shortly.
2023-04-11 14:00:16 -04:00
1a6cfa1ae1 Fix: Incorrect mesh data used in mesh remap code
Mistake in 7966cd16d6
Related to #106671
2023-04-11 13:29:12 -04:00
c7995f3185 Fix #106366: Handle exceptions in add fur operator
Give errors in a few cases:
- The mesh has no UV map
- The faces have no area
- The applied modifier has no curve data (it may have been modified)

Use errors instead of cancelling the operator completely so the
operator can still do something useful when many meshes are
selected and only some fail.

Pull Request: blender/blender#106823
2023-04-11 19:19:41 +02:00
03c4173d81 Fix #106780: Crash with sculpt undo and poly offsets
The poly offsets need to be copied when converting a geometry
undo step into a full mesh, they were only assigned.
2023-04-11 12:35:52 -04:00
cd30bce7f1 Fix #106743: Crash writing with legacy mesh format
The new poly offsets were needed to interpolate attribute to a different
domain, but they were cleared when the legacy MPoly array was built.
Instead just clear the offsets a bit later after the other conversions.
2023-04-11 12:27:41 -04:00
90ad930a01 Fix #106778: Incomplete copy of curves radius to Cycles
The number of curves was used as a number of points by mistake.
Caused by ae017b3ab7.
2023-04-11 12:02:05 -04:00
4472717de2 Cleanup: Remove unnecessary PBVH attribute pointer
Material indices are only used when the structure is built. It's simpler
not to keep a longer-term reference available if it isn't needed.
2023-04-11 11:06:36 -04:00
b03174782e Fix #106775: File Draw Negative Width Buttons
Do not include Fake Draggable button in file lists if the space is so
constrained that they have negative widths. Avoids debug assert.

Pull Request: blender/blender#106777
2023-04-11 17:00:52 +02:00
9477ab65a4 ImageEngine: Improve Performance and Quality.
Blender 3.5 has a performance regression in the image engine
that made the image engine 3-4x slower then 3.4. The cause of
this was the new way how panning was implemented.

This PR disables the new panning for now as a short term fix.
In the future the panning and improvements we did ensured
better performance when dealing with higher resolution images.
But the regression for regular images weren't acceptable.

This fix might introduce other performance regressions on
lower end systems.

In the future we still want to improve the performance to
get back to Blender 3.0 performance, but that requires more
work and has a different priority.

Pull Request: blender/blender#106803
2023-04-11 16:20:26 +02:00
43b37fbc93 Fix #106722: Motion tracking data lost on recovering autosave
This is mistake in the refactor of the DNA storage which unified
the camera and object storage. The bit which was missed from the
initial logic is that the autosave does not use regular file
write.

Detect this in the do-versioning code and rely on the new data
format when it exists.

A candidate for 3.5.1 release.

Pull Request: blender/blender#106811
2023-04-11 15:59:39 +02:00
d299b1157f Cleanup: Update versioning code after subversion bump
Subversion was bumped in ba25023d22, so no need to execute this always
now, just do it for necessary file versions.
2023-04-11 15:34:31 +02:00
ba25023d22 Python: Support multiple custom script directories in Preferences
Makes it possible to select multiple custom script directories in Preferences >
File Paths, replacing the single Scripts path option. Each of these directories
supports the regular script directory layout with a startup file (or files?),
add-ons, modules and presets.
When installing an add-on, the script directory can be chosen.

NOTE: Deprecates the `bpy.types.PreferencesFilePaths.script_directory`
property, and replaces `bpy.utils.script_path_pref` with
`bpy.utils.script_paths_pref`.

Pull Request: blender/blender#104876
2023-04-11 15:20:52 +02:00
dc402a8b96 Core: Fix ASAN on Clang-14 / Linux
When using ASAN on Clang / Linux, the call to `find_library(... asan ...)`
works against us, as it finds GCC's `libasan.so`. To work with Clang,
we should simply not pass any explicit library, as Clang will figure things
out by itself with the `-fsanitize=xxx` options.

Furthermore, Clang is incompatible with `-fsanitize=object-size`, so that's
now also no longer passed on Linux (mimicking the Apple) configuration.

For the long run, it would be better to rewrite this entire section to
select behaviour on a per-compiler basis, rather than per platform. That's
tracked in #105956

Pull Request: blender/blender#106675
2023-04-11 14:15:34 +02:00
d07b82d16d GPU: Use Same Type in Comparisons.
Legacy drivers don't support auto type casting in comparisons.
This PR fixes some comparisons cast.

Thanks to Johannes J. for working/thinking along with the PR.

Pull Request: blender/blender#106789
2023-04-11 13:46:09 +02:00
cd5ada3f7d I18n: Updated UI translations from SVN repo (r6454). 2023-04-11 12:49:36 +02:00
bca2090724 Gitea: update bug report template for security policy 2023-04-11 12:14:01 +02:00
2884f92de1 GPU: Fix Crash Sampling in Texture Paint Mode.
Added additional check if occlude pass is created.

Fix: #106762

Pull Request: blender/blender#106791
2023-04-11 11:24:17 +02:00
28a11c007e Fix #106440: EEVEE: World lighting does not affect volumetrics
The shader was compiled without the right define, disabling the world
volume lighting.

This had nothing to do with the light path node as the lighting
was totally disabled.

Pull Request: blender/blender#106787
2023-04-11 11:08:12 +02:00
43eb3fe21a UI: enable string properties for alt-click buttons for multiple objects
This came up in #106591 which reported that changing a Light Group would
not work when alt-clicking the property field (which is the usual method
to edit a property for multiple objects at once).

This is because string properties were not supported in
`ui_selectcontext_apply` which is now done.

Similar to 1318660b04 [which added support for pointer properties].

Adding general support for string properties means this method can now
be used for many more things:
- changing all sorts of ID names (objects, meshes, ...)
- many settings in modifiers (e.g. vertexgroups)
- geometry nodes modifier properties (e.g. attribute names)
- ...

Fixes #106591

Pull Request: blender/blender#106599
2023-04-11 10:27:51 +02:00
a277117b3e Merge branch 'main' into geometry-nodes-simulation 2023-04-11 09:19:12 +02:00
17e2862603 Fix new windows on Hi-DPI monitors having incorrect size under Wayland
Updating the buffer scale increased the window size based on the
previous window scale. Since the previous scale (DPI) newly created
windows restored from a `.blend` file isn't known, don't scale the
window size when updating the window's scale for the first time.
2023-04-11 16:05:27 +10:00
4fe2685615 GHOST/Wayland: avoid up-scaling window content
When a window overlaps multiple outputs, always use the resolution
on the output with the highest resolution. This means Blender never
shows low resolution content up-scaled.
2023-04-11 16:00:59 +10:00
f50c319a4b GHOST/Wayland: refactor window scaling logic
Share logic between fractional & non-fractional window scaling.

This also enables fractional-scaling without scaling fixed sized buffers
for compositors without support for fractional_scale_manager_v1.
2023-04-11 16:00:56 +10:00
34f386c730 GHOST/Wayland: store API compatible fractional scaling values
Use values compatible with Wayland's fractional-scale API.

No funcitonal changes.
2023-04-11 16:00:54 +10:00
8dae058768 Fix: Crash in install_linux_packages.py script
There is a `KeyError` exception when the `install_linux_packages.py` build script is ran with `--distro-id`:

```console
$ ./build_files/build_environment/install_linux_packages.py --distro-id arch
INFO:     Distribution identifier forced by user to arch.
Traceback (most recent call last):
  File "file:///blender/./build_files/build_environment/install_linux_packages.py", line 1656, in <module>
    main()
  File "file:///blender/./build_files/build_environment/install_linux_packages.py", line 1646, in main
    distro_package_installer = PackageInstaller(settings) if settings.show_deps else get_distro_package_installer(settings)
  File "file:///blender/./build_files/build_environment/install_linux_packages.py", line 1570, in get_distro_package_installer
    return DISTRO_IDS_INSTALLERS[get_distro(settings)](settings)
KeyError: None
```

This happens because the `get_distro` function returns `None` if the distribution ID is forced with the `--distro-id` option, when it should return the provided value.

Pull Request: blender/blender#106461
2023-04-10 21:12:56 +02:00
f7029bc960 Cleanup: Incorrect assignment in previous cleanup commit 2023-04-10 14:02:32 -04:00
47ab0403f0 Cleanup: Slight improvements to Python BVH tree utility
- Reduce indentation
- Use Span instead of raw pointers in a few places
- Decrease variables scope
2023-04-10 13:48:37 -04:00
c71f66daa8 Cleanup: Remove commented code 2023-04-10 13:47:36 -04:00
0c01e0f489 Realtime Compositor: Implement Map UV node
This patch implements the Map UV node for the realtime compositor. This
is different from the CPU implementation in that it relies on the
approximate EWA filtering provided by the driver's implementation of
anisotropic filtering to displace the texture. This is easier and faster
than implementing EWA manually in the shader and has identical quality
where it matters.

Pull Request: blender/blender#106765
2023-04-10 17:29:39 +02:00
ad7e6d5e43 Fix wrong gradients in Displace node shader
This patches fixes a typo in the Displace node shader for the realtime
compositor where the vertical gradient used the horizontal table index.
2023-04-10 15:18:22 +02:00
f8c964de87 GPU: Improve the shader cache GC behavior
Improves the shader cache GC behavior, so the passes are only
deleted after being orphaned for over 1 minute.

Pull Request: blender/blender#106386
2023-04-10 11:39:00 +02:00
4bbbad49c8 Fix missing includes 2023-04-10 15:10:04 +10:00
0a460d4707 UV: refactor uv packing for readability and performance 2023-04-10 11:42:24 +12:00
cc5128f6ca Realtime Compositor: Implement Fog Glow Glare node
This patch implements the Fog Glow option in the Glare node. The
implementation does not match the existing implementation in the CPU
compositor, because it is computationally infeasible for the realtime
compositor. Instead, this implementation is similar to how Bloom is
implemented in EEVEE, based on the talk:

"Next Generation Post Processing in Call of Duty: Advanced Warfare".

This is just a temporary solution as requested by users until we either
implement an accurate implementation using FFT, provide a separate
option for EEVEE bloom, or roll out a different solution altogether.

Pull Request: blender/blender#106042
2023-04-09 15:42:20 +02:00
625ba3cb5d Realtime Compositor: Implement Displace node
This patch implements the Displace node for the realtime compositor.
This is different from the CPU implementation in that it relies on the
approximate EWA filtering provided by the driver's implementation of
anisotropic filtering to displace the texture. This is easier and faster
than implementing EWA manually in the shader and has identical quality
where it matters.

Pull Request: blender/blender#106681
2023-04-09 09:15:28 +02:00
b939b60c3f Realtime Compositor: Implement Z Combine node
This patch implements the Z Combine node for the realtime compositor.
The patch also extends the SMAA implementation to work with float
textures as a prerequisite to the Z Combine implementation. Moreover, a
mechanism for computing multi-output operations was implemented, in
which unneeded outputs will allocate a dummy 1x1 texture for a correct
shader invocation, then those dummy textures will be cleaned up by
calling a routine right after evaluation.

This is different from the CPU implementation in that the while combine
mask is anti-aliased, including the alpha mask, which is not considered
in the CPU case.

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#106637
2023-04-09 09:06:41 +02:00
7a267aa000 DRW: Selection Occlusion
#### Summary
Occlude edit mode selection behind objects in object mode.

#### Problem
When doing retopology, you want to be able to select your edit mesh,
but only when you can see it.
Being able to select geometry behind reference objects is not
desirable.

#### Solution
Make it so reference objects occlude selection, while the edit mesh is
pushed towards the view using retopology offset.

#### Limitations
Poly Build is not supported, because it doesn't use the depth buffer.
It behaves the same as normal, unoccluded by reference meshes.

#### Notes
Selection occlusion is not used when xray is enabled. This is
intentional.

Pull Request: blender/blender#105498
2023-04-09 08:08:01 +02:00
bc86223975 Cleanup: readability improvements in uv packer
Moved alpaca_rotate code closer to alpaca_turbo.
Improve const correctness.
Added some simple optimizations which improve readability.
2023-04-09 11:23:31 +12:00
cde565c26c PBVH: update mesh data pointers stored in pbvh
This is necessary for #106228. Without this, `PBVH` might contain pointers to
data that either does not exist anymore or that must not be edited because
it is shared.

Pull Request: blender/blender#106271
2023-04-08 13:29:37 +02:00
5cc5d6391b Cleanup: simplify customData_resize
There is no point in checking if the allocation of this relatively
small array was successful. We only do that in very few places,
but here it just adds unnecessary complexity.
2023-04-08 13:09:30 +02:00
9182851afe Cleanup: use BLO_CODE_ prefix for BHead codes
Having names like `DATA`, `TEST` and `USER` in the global namespace feels a bit wrong.

Pull Request: blender/blender#106673
2023-04-08 12:42:40 +02:00
68af6f6836 Audaspace: porting changes from upstream. 2023-04-08 10:36:40 +02:00
e369bf4a6d UI: Text Object International Case Change
Allow Text Object operator FONT_OT_case_set to correctly transform the case
of strings written in almost all scripts that differentiate letter case.

Pull Request: blender/blender#106581
2023-04-07 23:40:42 +02:00
8906aa77cd Cleanup: Comment formatting, remove debug print
Also rename a few functions from "hair" to "curves"
2023-04-07 16:33:11 -04:00
5a86c4cc88 Fix: Cycles ignores point cloud and curves byte color attributes
Support was never added for byte color attributes, since for a while
it wasn't obvious that they were also considered "generic attributes."
2023-04-07 16:19:41 -04:00
ae017b3ab7 Cycles: Optimize Blender curves attribute extraction
Similar to 8d0920ec6d and aef0e72e5a.

In a test case with 2 million curves and 15 million points
I observed a 10x performance improvement, from 2.2s to 0.2s
to copy the data from Blender to Cycles.
2023-04-07 16:05:23 -04:00
aef0e72e5a Cycles: Optimize Blender point cloud attribute extraction
Similar to 8d0920ec6d.

In a test case with 8 million points and 3 attributes, I observed
around a 9x performance improvement, from 1.8s to 0.2s to copy
the data from Blender to Cycles. For some attribute types, using
implicit sharing could remove the need to copy entirely, but removing
the overhead from the RNA API makes sense anyway.
2023-04-07 16:04:12 -04:00
e665a50fb6 Cleanup: rename region to zone in theme settings 2023-04-07 16:53:21 +02:00
44d5a894c1 Fix #106667: Cycles: Multi-device denoise runs denoising data passes
Only use the denoised buffer for access of denoised passes, and
access the rest of the passes from the original render buffer.

This allows in-place modification of the guiding passes needed
by the denoiser without affecting the final render result pixels.

Pull Request: blender/blender#106668
2023-04-07 16:49:43 +02:00
ade103d7b8 Depsgrpah: Fix 'use after free' invalid access to stored keys names.
Stored `ComponentIDKey` and `OperationIDKey` would still use string
references (char pointers) to data in related IDs, instead of using the
already locally stored std::string name of their matching `ComponentNode`
or `OperationNode` for that.

During undo, to reduce updates and speedup undo steps, a lot of IDs get
'replaced in place', i.e. new data read from the undo memfile is moved
into the existing 'old' ID memory address. And the depsgraph is also
re-used from the old BMain.

Calling `DEG_id_tag_update` and similar on the ID could then cause
depsgraph code to access freed memory from the 'old' data.

Joint effort with @sergey and the rest of the depsgraph team, thanks!
2023-04-07 15:46:19 +02:00
4ab7bb5b1f Fix : Show 'Exit group' menu entry also for non group nodes.
The Exit Group menu entry was mistakenly only whown for nodes who are
themselves also group nodes. It should be show for any node inside a
group.

Pull Request: blender/blender#106643
2023-04-07 13:09:33 +02:00
75c0e808b8 Fix #106103: Resolve texture paint selection in Metal
Issue caused by inconsistency in GPUFramebuffer viewport state
between Metal and OpenGL. The MTLFramebuffer code has been
modified such that framebuffer viewport/scissor state is retained
and only updated if attachments are modified during bind.

This is consistent with OpenGL. Previously, other updates to the
framebuffer in Metal would reset the viewport region, especially
if attachments were temporarily removed. This caused the color
picker selection to be misaligned.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#106619
2023-04-07 13:05:51 +02:00
d85520f297 Python: bl_ui_utils.layout.operator_context context manager
Introduce a context manager that temporarily overrides a UILayout's
operator context.

Instead of writing this:

```py
default_op_context = layout.context
layout.context = 'OTHER_VALUE'
layout.do_stuff()
layout.context = default_op_context
```

you can now write this:

```py
from bl_ui_utils.layout import operator_context

with operator_context(layout, 'OTHER_VALUE'):
    layout.do_stuff()
```

This is also exception-safe; it will always ensure the layout's operator
context is restored when the `with` body is exited, regardless of
whether that's done with an exception or regularly.

Idea in-the-hallway approved by @Sergey.
2023-04-07 11:34:48 +02:00
564418f6a4 UV: support for non-square bitmaps in uv packer, alpaca_rotate 2023-04-07 20:17:19 +12:00
520c112732 GHOST: comment on use of libunity for the taskbar in X11
While the DBUS API's libunity uses are still in wide use,
libunity.so it's self isn't. Note that we should use DBUS directly.
2023-04-07 13:39:19 +10:00
43476e2d71 UV: improve layout efficiency of uv packing when rotation enabled
Add rotation support to the `xatlas` strategy.
2023-04-07 13:33:58 +12:00
984da82283 Cleanup: format 2023-04-07 12:58:46 +12:00
fcd4b58427 CMake/Windows: Fix debug ONEAPI build
the debug dll does not have an _d just a regular d as postfix
issue introduced in 17800e0c03
2023-04-06 18:02:59 -06:00
dc71530d9c Core: Fix broken CustomData IO with Autosave files
Autosave files are created from memfile undo, which
doesn't save legacy mesh data. This leads to a crash
on file load.

In addition the mesh code can now add CustomData
layers when saving files, which did not work if
the original domain had no layers.  In that case
CustomData.layers is NULL and DNA has nothing to
key off of when loading the file later.

Pull Request: blender/blender#106648
2023-04-07 02:02:20 +02:00
3681ed377b Fix #106628: Use correct function to get active uv layer
CustomData_get_active_layer_index() was used by accident. But that
returns the CustomData layer index (in all layers) as opposed to
CustomData_get_active_layer(), which returns the active UV layer.

Pull Request: blender/blender#106644
2023-04-06 22:17:19 +02:00
972dad8fbf Cleanup: Add forgotten const to function parameter. 2023-04-06 21:32:41 +02:00
11ba8c6ab4 Fix #106622: Various errors filling cone/cylinder primitive faces
The change in 7966cd16d6 had a few logical mistakes.
2023-04-06 12:48:46 -04:00
a041297e54 Fix: build error after moving lightprobe.c to c++
Error introduced in 3dd24b9ae7

Pull Request: blender/blender#106635
2023-04-06 18:40:58 +02:00
3dd24b9ae7 Cleanup: Move lightprobe.c to c++
This is to allow clearner code in the new object-level lightprobe
cache. See #106449 .
2023-04-06 17:41:59 +02:00
390a63b264 Refactor: de-duplicate motion triangle vertices and normals computation
Barycentric coordinate convention was changed at some point, which is
reflected in `motion_triangle_shader.h` (1c2c468abc) but not in
`motion_triangle.h`, this is also fixed by sharing functions between the
two header files.

Pull Request: blender/blender#106629
2023-04-06 17:28:41 +02:00
65da3a3c5a Fix 106590: GPencil Paste stroke duplicates to the next selected
If the multiframe is not enabled, the loop must be not done or
the first selected frame is pasted too.

Now, the loop is only done in multiframe mode.
2023-04-06 15:30:24 +02:00
e9ec506890 Fix #106548: Repeat Last operator reuses orientation for extrusion
Check the specific case of `OP_IS_REPEAT_LAST` and recalculate
the orientation.

To that, pass the `OP_IS_REPEAT` and `OP_IS_REPEAT_LAST` flags as
inheritance to macro operators.
2023-04-06 15:17:03 +02:00
7d8740f06d Fix #103571: Force field absorption for rigid bodies
Force field absorption allows dampening of force fields by colliders, but it does not currently work when the scene only contains a rigid body simulation. It requires a particle simulation, cloth, dynamic paint, fluid sim, or softbodies for the feature to work correctly.

The reasons is that the effector function computing force field strength uses depsgraph relations to determine which colliders "absorb" the force field. If there are no dependencies between colliders and effectors registered in the depsgraph, the visibility function `eff_calc_visibility` does not add any absorption.

There is a function build_collision_relations which adds a dependency between the absorption object (the one with a collision modifier) and the forcefield object. It's currently only called by
1. Particle systems (DepsgraphRelationBuilder::add_particle_collision_relations)
2. Cloth, DynPaint, Fluid, and Softbody (DEG_add_collision_relations and indirectly through DEG_add_forcefield_relations).

The `DepsgraphRelationsBuilder` now adds the effector relations also when building rigid body relations.

Pull Request: blender/blender#106503
2023-04-06 14:49:04 +02:00
792da15d53 Fix #106394: motion triangles could have unnormalized normals 2023-04-06 13:48:45 +02:00
bd319f6561 Texture Paint: always respect edit mode hiding
Since e3801a2bd4, we would always respect
hiding for vertex paint and weight paint (drawing code and stroke based
painting), leaving an inconsistency between the different paintmodes.

To rectify this, now also always respect edit mode hiding for projection
painting as well.

Some feedback was gathered in #sculpt-paint-texture-module to ensure
this is desired behavior.

Note: this does not change the (experimental) texture painting in
sculptmode [this already respects hiding via PBVH, albeit in a manner
that bleeds into hidden faces if the brush center is over visible faces]

ref #106354

Pull Request: blender/blender#106544
2023-04-06 09:28:25 +02:00
ce9be92adf Fix 106278: Intel iGPU Crashes When Switching to Eevee
After investigating the crash logs it looked like the macro
unrolling wasn't working on Windows systems with these GPUs.

Macro unrolling was changed in order to cross compile to Metal and
in the future to Vulkan. The macro unrolling in OpenGL can be removed
by using a different naming scema.

This PR removes the macro unrolling by changing the generated GLSL
code:

**Before**
```
layout(std140) uniform _probe_block
{
  ProbeBlock probe_block;
};
```

**After**
```
layout(std140) uniform probe_block
{
  ProbeBlock _probe_block;
};
```

Some tweaks had to be done to the Eevee-shaders to make sure that
the macro unrolling is done correctly and could be compiled using
legacy opengl drivers.

Fix: #106278
Fix: #106555
(and others)

Pull Request: blender/blender#106535
2023-04-06 08:03:25 +02:00
Jon Denning
bbf756ddf1 Text Editor: update syntax highlighting for different Python strings
Python has several different string types [0], each using a prefix to
indicate the type. Presently Blender's Text Editor / syntax highlighting
does not include the prefix as part of the string, which makes the
prefix appear as a syntax error. This patch looks for these prefixes,
and includes them with the string highlighting.

Note: prefixes can appear in either case (ex: f and F mean the same
thing), and some prefixes can be combined (ex: fr is a raw f-string).

[0]: https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals

Ref D14739
2023-04-06 14:01:54 +10:00
68092297ca Cleanup: Remove unused DerivedMesh edges/corners code
The edge hash is only needed for the corner edge array,
and the mloop_index variable is unused.
2023-04-05 22:35:26 -04:00
d727f64ad2 PyAPI DocS: Fix source code link markup
FIxes blender/blender#106212#
2023-04-05 22:27:51 -04:00
a2b259aa2c Fix: Wrong attribute name used for corner edges array
My regex to check for this didn't catch the mistake because
the repetition was split between two lines.
2023-04-05 22:18:30 -04:00
63c0e1be31 UV: paste-uvs will return OPERATOR_CANCELLED if uvs were unchanged 2023-04-06 13:48:29 +12:00
6e1c048250 Fix #106314: warn user when paste-uvs fails to find a match
Pull Request: blender/blender#106606
2023-04-06 03:36:57 +02:00
2e878690e5 WM: include the GHOST backend in bug report when non-default
It wasn't possible to know if users were running X11/Wayland.
The field is omitted for WIN32 & APPLE.
2023-04-06 10:29:44 +10:00
d34abea26a Cleanup: format 2023-04-06 11:02:47 +12:00
b626f1fd18 Cleanup: use ".cc" & ".hh" extensions for intern/ghost 2023-04-06 08:29:57 +10:00
d1bbb32cb4 Fix #106602: Cyclic link in versioning code
Fix link from capture_node to node.

Pull Request: blender/blender#106605
2023-04-06 00:11:12 +02:00
302e858273 Fix #104507: Show Splash if New Version
Show Splash screen if there are no Preferences found even if we are
launched with a filename, so that users can migrate old settings.

Pull Request: blender/blender#105863
2023-04-05 22:35:05 +02:00
8f8548e964 Fix libs harvesting for Embree as a dynamic library
libembree4.so was missing from make deps target location.
2023-04-05 22:13:02 +02:00
70edef1311 Cycles: Fix Metal use-after-free bug
`entryPoint` was being used unsafely following its release.

Pull Request: blender/blender#106572
2023-04-05 21:50:14 +02:00
92c9c1d400 Fix #106568: Overlay: Resolve motion path rendering in Metal
Resolve small indexing issue in Metal implementation
of motion path line rendering.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#106595
2023-04-05 20:55:14 +02:00
6cb5b14f16 Fix #106598: Cone primitive crash after MPoly removal
The sizes of the bottom faces weren't filled.
2023-04-05 14:11:18 -04:00
b288c4004e Cleanup: fix various Cycles compilar warnings
Mainly for the build configuration of the Hydra render delegate and
standalone repo.
2023-04-05 19:48:19 +02:00
920ffd3253 Cleanup: fix clang 10 compiler warning 2023-04-05 19:48:19 +02:00
c6d8da0e97 Remove simulation inputs when deleting outputs and vice versa
To avoid unpaired simulation inputs or outputs, whenever deleting such
nodes the respective paired node should be deleted as well. A simple
utility function selects paired nodes before the delete operator removes
them.

This does not affect API methods, which still remove only individual
nodes. The feature is primarily a workflow improvement.

Resolves #105728

Pull Request: blender/blender#106597
2023-04-05 18:28:36 +02:00
42a9c62bff Fix #106584: Active/default UV map legacy conversion with name conflict
The legacy conversion from MLoopUV to generic attributes used the
active and default layer names to copy the active/render status to the
new layers. But sometimes the names can change, and they weren't
updated in that case. Instead, store the active status with an index
into the names array (use an array instead of Vector for clarity).
2023-04-05 11:46:35 -04:00
18ad154cf9 Fix CUdeviceptr and hipDeviceptr_t build error on ppc64le architecture
Pull Request: blender/blender#106575
2023-04-05 17:42:01 +02:00
892f985227 Fix mismatch in Sequencer preview region versioning
Make the versioning for the sequencer preview region match the state of
new sequencers, the zooming range would be different.
2023-04-05 17:21:11 +02:00
56640440f0 Fix crash loading pre 2.5 test file (Cycles test failure)
fa0f295b53 exposed that there was a region missing because of some
faulty versioning.

The `fluid_motion_blur.blend` Cycles test file was crashing. Seems like
this is a pre 2.5 file that was resaved in newer versions, but the
preview region for the Sequencer was missing. Before mentioned commit,
the region would be broken when activating the preview view mode in the
Sequencer, now it would crash even on startup.

Ensure the region exists, as expected.
2023-04-05 16:57:56 +02:00
68ec019a40 Fix: Typos, grammar, writing style in UI messages
Issues reported by Joan Pujolar:

See the pull request for a full list of reasoning.

Pull Request: blender/blender#106580
2023-04-05 16:40:16 +02:00
98bc439e47 Add simulation input and output node as a pair
Simulation input and output nodes are currently added individually, but they always need to exist as pair. This PR modifies the _Add Node_ menu so that a single menu entry adds and input and output node together.

The `NODE_OT_add_node` operator currently adds just a single node type. A new variant of this operator is added which adds a _simulation zone_ with origin + target node instead. This requires some modification of the `NodeAddOperator` base class, moving the `node_type` property into the final implementation. Unlike the `NODE_OT_add_node` operator, the `NODE_OT_add_simulation_zone` adds 2 different node types.

After adding the two nodes, a reference needs to be added to "pair" them: Input node ("origin") stores the UID of the output node ("target") in its `output_node_id` property. So far this was detected automatically when adding an input, but this method is not very robust (e.g. it depends on order of adding nodes and adding multiple pairs can be tricky).

Now the pairing is done explicitly through an API function `node_geo_simulation_input_pair_with_output`. The `NODE_OT_add_simulation_zone` operator performs pairing of the input/output nodes after adding them. The function is accessible through RNA, so an operator may be added if necessary to allow users to fix unpaired nodes.

In addition to pairing the two nodes, the operator also positions them at a comfortable distance, as well as adding a default link between the two Geometry sockets for convenience.

Resolves #105727

Pull Request: blender/blender#106557
2023-04-05 16:20:41 +02:00
4c66e0fe61 Fix windows tests failing due to comparison with NaN
which returns false on other platforms but true on windows with fast math
2023-04-05 16:00:03 +02:00
d17b1da572 Fix FindEmbree.cmake
When EMBREE_INCLUDE_DIR was cached, it ended up wrongly assuming it
was Embree 4.
2023-04-05 15:53:20 +02:00
8f0829f2a0 Cleanup: Remove accidentally committed TODO comment
Committed in fa0f295b53 but not necessary anymore. The regions are
creating in versioning already now.
2023-04-05 15:46:25 +02:00
ad031029cf Fix #106467: Crash when loading files with custom node groups
Loading a blend file containing custom material node groups crashed Blender.
See #106467 for more information.

Pull Request: blender/blender#106559
2023-04-05 15:36:24 +02:00
fa0f295b53 UI: Region polling support
Introduces *ARegionType.poll()* as a way to dynamically add/remove a region. The region is still there internally, but is not accessible to the user.

Previously editors would to this manually, by either removing/adding regions altogether, or hiding them, unsetting their alignment (so no AZones are added I assume) and removing their event handlers. Polling makes this much simpler.

We plan to use this in #102879.

This patch refactors multiple editors to use region polling:
- File Browser
- Sequencer
- Clip Editor
- Preferences

Notes:
- Previously, editors would lazy-create some of the regions. Versioning is added here to ensure they are always there. Could be a separate patch.
- Some editors reuse a region in different display modes, and so additional work needs to be done to reinit regions they become available or the mode changes. Typically `V2D_IS_INIT` is unset for that, which isn't great. Could be improved, but not a new issue.

Behavior change:
- When the Preferences are opened as a regular editor, the "execution" region in the preferences that displays the *Save Preferences* button would still be there, but empty with a scrollbar.
  This patch makes it disappear entirely.

## Implementation

- Introduces `ARegionType.poll()`
- Before a window is drawn, all contained regions have their poll checked, and the result is stored in a flag (`RGN_FLAG_POLL_FAILED` - runtime-only flag).
- If the result of the poll changes, the area is re-initialized and event handlers are added/removed.
- UI code checks the flag as needed.

Pull Request: blender/blender#105088
2023-04-05 15:30:32 +02:00
3d8d142205 Check if output node exists before creating a sim input lazy function.
Avoid creating a lazy function for the `Simulation Input` node if the `output_node_id` is invalid. This can happen when e.g. the output node is deleted without also deleting the input node. The lazy function assumes a valid output ID and will crash if the output node does not exist.

Pull Request: blender/blender#106585
2023-04-05 14:28:58 +02:00
075d92184b Cleanup: correct comment, quiet warnings 2023-04-05 20:11:08 +10:00
a76bf65c9d Cycles: Refactored GPU denoising code
To prepare for OIDN2 with GPU support, some of the code that was exclusive to the OptiXDenoiser is being moved to the DenoiserGPU superclass.

Co-authored-by: Stefan Werner <stefan.werner@intel.com>
Pull Request: blender/blender#106496
2023-04-05 11:19:15 +02:00
9e9baa9085 Cycles: Upgrade to new Embree 4 while staying compatible with Embree 3
For more information about Embree 3->4 API changes:
https://github.com/embree/embree/blob/master/doc/src/api.md#upgrading-from-embree-3-to-embree-4

This is not yet enabling HW RT on Arc GPUs using Embree, which is worked on in blender/blender#106266

Co-authored-by: Nikita Sirgienko <nikita.sirgienko@intel.com>
Co-authored-by: Stefan Werner <stefan.werner@intel.com>
Pull Request: blender/blender#105974
2023-04-05 11:03:06 +02:00
2c446d2de3 Cleanup: use bool for render pipeline & related API's
Also add doc-string for RenderEngine::reports.
2023-04-05 17:52:28 +10:00
7e99470a85 Fix headless render silently failing when called from Python
Any errors from calling `bpy.ops.render.render(write_still=True)` would
be suppressed, making it impossible to know what went wrong.

Now the operator now reports errors when run via `exec` which mainly
occurs when the operator is called from scripts.

Interactively rendering via `invoke` is left as-is since users can see
the error in the UI and showing a popup error is disruptive.
2023-04-05 17:42:19 +10:00
a245e294a3 Fix missing assets in the source archive
The assets are required to build proper Blender release, so they can not be
skipped from packing.

The packing ignores the `working` directory as it seems to be big and sounds
that it is not needed for the release.

The assets are bundled under the `release/datafiles/assets` folder in the
blender sources. This is where they will reside after switch to the Git LFS.

Pull Request: blender/blender#106536
2023-04-05 09:27:42 +02:00
440cccecdc Cleanup: spelling in comments 2023-04-05 14:39:51 +10:00
d683665095 Cleanup: compiler warnings 2023-04-05 14:23:54 +10:00
8216623e25 Build: bump wayland to v1.22
Use the latest Wayland version, resolves inverted track-pad scroll
direction #104272 by adding support for physical scroll direction.
Updates to GHOST/Wayland have already been made.
2023-04-05 14:04:18 +10:00
dec9c593cb Cleanup: Use generic index copying utility for normals 2023-04-04 17:22:14 -04:00
f594e951e0 Cleanup: Use generic mesh corner to poly map utility 2023-04-04 17:01:19 -04:00
e785d956c4 Fix: Crash loading autosave/last session file after MPoly removal
We need to check CustomData for the MPoly layer rather
than the deprecated mesh customdata pointer.
2023-04-04 16:13:39 -04:00
4b2ea18ec9 Cleanup: Deduplicate OffsetIndices utility for meshes and curves
The "reverse map" of corners to faces and points to curves is the same
for meshes and curves now. Move it to the offset indices header to
reflect this.

This unification can go further in the future, but I'd rather wait
until the design is clearer for now.

Pull Request: blender/blender#106570
2023-04-04 22:12:17 +02:00
8d0920ec6d Cycles: Optimize extraction of Blender attributes
Similar to 4bcd59d644. This probably got worse recently with
the generic attribute refactors for `Mesh`, but the final performance is
probably much better than older versions too.

Timings extracting attributes from a 16 million vertex grid (seconds):
- Corner float attribute: 0.72 -> 0.19
- Face float attribute: 0.60 -> 0.07
- UV map: 3.18 -> 0.05
2023-04-04 15:38:12 -04:00
6652d2ee9b Cleanup: Remove unused DerivedMesh vert normals calculation 2023-04-04 14:52:41 -04:00
2887557907 Cleanup: Remove unused DerivedMesh functions
Unused after 7adea7ee15.
2023-04-04 14:52:02 -04:00
6f2263bc79 Cleanup: Remove unused DerivedMesh variables
`needsFree` was always set to `true`, and same with `deformedOnly`,
but it was also never even used.
2023-04-04 14:47:39 -04:00
7966cd16d6 Mesh: Replace MPoly struct with offset indices
Implements #95967.

Currently the `MPoly` struct is 12 bytes, and stores the index of a
face's first corner and the number of corners/verts/edges. Polygons
and corners are always created in order by Blender, meaning each
face's corners will be after the previous face's corners. We can take
advantage of this fact and eliminate the redundancy in mesh face
storage by only storing a single integer corner offset for each face.
The size of the face is then encoded by the offset of the next face.
The size of a single integer is 4 bytes, so this reduces memory
usage by 3 times.

The same method is used for `CurvesGeometry`, so Blender already has
an abstraction to simplify using these offsets called `OffsetIndices`.
This class is used to easily retrieve a range of corner indices for
each face. This also gives the opportunity for sharing some logic with
curves.

Another benefit of the change is that the offsets and sizes stored in
`MPoly` can no longer disagree with each other. Storing faces in the
order of their corners can simplify some code too.

Face/polygon variables now use the `IndexRange` type, which comes with
quite a few utilities that can simplify code.

Some:
- The offset integer array has to be one longer than the face count to
  avoid a branch for every face, which means the data is no longer part
  of the mesh's `CustomData`.
- We lose the ability to "reference" an original mesh's offset array
  until more reusable CoW from #104478 is committed. That will be added
  in a separate commit.
- Since they aren't part of `CustomData`, poly offsets often have to be
  copied manually.
- To simplify using `OffsetIndices` in many places, some functions and
  structs in headers were moved to only compile in C++.
- All meshes created by Blender use the same order for faces and face
  corners, but just in case, meshes with mismatched order are fixed by
  versioning code.
- `MeshPolygon.totloop` is no longer editable in RNA. This API break is
  necessary here unfortunately. It should be worth it in 3.6, since
  that's the best way to allow loading meshes from 4.0, which is
  important for an LTS version.

Pull Request: blender/blender#105938
2023-04-04 20:39:28 +02:00
17800e0c03 CMake/Win: use manifest for PLATFORM_BUNDLED_LIBRARIES
`PLATFORM_BUNDLED_LIBRARIES` was installing right next to the blender
executable rather than the `blender.shared` folder,
`PLATFORM_BUNDLED_LIBRARIES` wasn't used very much on windows, just
by the ONEAPI code which likely wasn't aware this plumbing was
still missing.

This diff adds support for using `PLATFORM_BUNDLED_LIBRARIES` on
windows in both debug and release configurations.

You can differentiate between a .dll being installed for debug/release
or all configurations, by prefixing the library with either `DEBUG`,
`RELEASE` or `All`, if no prefix is given `ALL` is assumed.

Pull Request: blender/blender#106348
2023-04-04 20:10:06 +02:00
4b15f2158f Cleanup: Cycles: LightTree: Fix warning about unused variables 2023-04-04 20:01:55 +02:00
1ae54bb4fd Fix MSVC C1001 error after texture sampler refactor
This patch fixes the MSVC C1001 error that was introduced after
ff3b2226fb.

Pull Request: blender/blender#106554
2023-04-04 18:20:44 +02:00
412b6a8f65 Fix #106430: Index the right UVmap in BMesh
When accessing UVmaps from python in BMesh, the UVmap name/index was ignored
and the active UVmap always used. This fixes this by passing the layer index
to the underlying CustomData function.

Pull Request: blender/blender#106537
2023-04-04 18:10:11 +02:00
7adea7ee15 Cleanup: Removed DerivedMesh triangle cache
This was only used in a single place, multires baking, where it's simple
to just retrieve the looptris from the temporary `Mesh` that we already
create to simplify accessing normals. This allows removing a bunch of
complexity from `DerivedMesh`, to help progress towards its complete
removal at some point in the future.

Also use `Span` more instead of raw pointers in multires baking,
and pass around the spans instead of the low-resolution DerivedMesh.
2023-04-04 11:26:14 -04:00
85bd64ece4 Fix: Crash and broken multires baking
Caused by 16fbadde36. The first mistake was passing a pointer
to a poly to what was meant to be the pointer to the start of the array.
Use Span instead to avoid that confusion. The second was a logic error
in CCGDerivedMesh's lazy initialization of corner data. The data was
copied when the mesh is created so it wasn't initialized.
2023-04-04 11:16:04 -04:00
547f0d5dab Cleanup: Use const arguments for DerivedMesh functions 2023-04-04 11:11:54 -04:00
87cbdcbe7c Refactor: move part of light tree logic from #LightManager to #LightTree 2023-04-04 16:24:21 +02:00
e58a05ca68 Refactor: renaming a few light-tree-related variables
primitives -> emitters, `index` -> `node_index`
2023-04-04 16:24:21 +02:00
6f60b09f51 Vulkan: Enable Step-by-Step Debugging in Renderdoc.
This PR adds debug information inside the spir-v assembly to enable
step-by-step debugging of Shaders using renderdoc. The debugging
information can be fairly large so are only generated when used
with the `--debug-gpu-renderdoc` feature.

During debugging shader optimizations are turned off.

Pull Request: blender/blender#106546
2023-04-04 15:58:41 +02:00
f94599c095 Fix #106478: Missing xray check in snapping
Regression caused by 98bfa8d458

The `XRAY_ENABLED(v3d)` check was lost during a modification to
`transform_snap_context_project_view3d_mixed_impl` function.

This caused vertex snapping in solid shading to jump between visible
and occluded faces.

Pull Request: blender/blender#106495
2023-04-04 15:40:48 +02:00
ff3b2226fb GPU: Refactor texture samplers
This patch refactors the texture samples code by mainly splitting the
eGPUSamplerState enum into multiple smaller enums and packing them
inside a GPUSamplerState struct. This was done because many members of
the enum were mutually exclusive, which was worked around during setting
up the samplers in the various backends, and additionally made the API
confusing, like the GPU_texture_wrap_mode function, which had two
mutually exclusive parameters.

The new structure also improved and clarified the backend sampler cache,
reducing the cache size from 514 samplers to just 130 samplers, which
also slightly improved the initialization time. Further, the
GPU_SAMPLER_MAX signal value was naturally incorporated into the
structure using the GPU_SAMPLER_STATE_TYPE_INTERNAL type.

The only expected functional change is in the realtime compositor, which
now supports per-axis repetition control, utilizing new API functions
for that purpose.

This patch is loosely based on an older patch D14366 by Ethan Hall.

Pull Request: blender/blender#105642
2023-04-04 15:16:07 +02:00
d0604a1bb2 Fix #106530: Don't try to move unmovable node socket values
Missing checkings for unsupported cases.

Pull Request: blender/blender#106545
2023-04-04 14:23:40 +02:00
96c8fcde0f Vulkan: Reduce Macro Unrolling In GLSL.
Related to #106535 where a similar fix was done for OpenGL. A small
cleanup that might reduce the complexity during GLSL shader compilation.

Pull Request: blender/blender#106538
2023-04-04 14:04:09 +02:00
09effd579b Renderdoc: Use Main Context Workaround.
Renderdoc requires all calls/updates to originate from the same
context. It also doesn't support multithreading. For now we
enable main context workaround.
2023-04-04 13:27:41 +02:00
fc46d6408f GPU: Use --debug-gpu-renderdoc For Renderdoc Integration.
The renderdoc integration used to be behind the `--debug-gpu`
command line option. When using `--debug-gpu` outside renderdoc
error messages where displayed that aren't relevant.

This PR adds a specific command line option for the renderdoc
integration. This option will also enable `--debug-gpu`.

Pull Request: blender/blender#106541
2023-04-04 12:46:47 +02:00
d872240983 Fix #106528: light tree nodes could have a NaN axis
Caused by collinear vectors not detected due to numerical issue.
2023-04-04 12:40:28 +02:00
d030d12d7b Vulkan: Fix Compilation Error on Windows Platforms.
Automatically conversion not working. Replacing `begin` with
`data` would solve this issue.

Pull Request: blender/blender#106539
2023-04-04 12:13:01 +02:00
58c54b5859 Fix #106396: UV stitch crash with hidden faces
This was the case with hidden faces and `Sync Selection` turned ON.

Caused by 8f543a73ab.

Since 8f543a73ab, the UV element map
respects the hidden state of geometry, but stitching [which also
respected this on its own even prior to the culprit commit in its
calculation of connectivity] did this differently [it only skipped
hidden geo when UV_SYNC_SELECTION was OFF -- even though UVs would not
be visible which is probably the real error here, I believe there is
this principle that we "dont act on stuff we dont see"].

To fix this, also skip hidden geo (even with UV_SYNC_SELECTION = ON) in
the stitch calculation of connectivity, just as
`BM_uv_element_map_create` does it.

Should go into 3.3 LTS as well.

Pull Request: blender/blender#106493
2023-04-04 12:10:30 +02:00
f2f8884f95 CMake: reset WAYLAND_PROTOCOLS_DIR when it's missing the reference XML
Depending on newer API's could cause build failure for existing
builds using wayland-protocols outside of Blender's 'lib' directory.
Now the existence of the most recent XML file is checked on each CMake
execution, resetting the cache when not found so the protocols in
`../lib/linux_x86_64_glibc_228/` will be used instead.
2023-04-04 19:15:00 +10:00
cf9f3919a8 I18n: fix add-on extraction when UI code appears in __init__.py
The function which collects files to process in add-on extraction
returned only files that did not start with '_', in the case where the
add-on was a module in a directory. This excluded __init__.py, which
may very well contain UI code, so an exception is added for this case.

This change currently allows the extraction of 42 new messages.
2023-04-04 10:07:02 +02:00
648417bfff GHOST/Wayland: improve internal fractional scaling behavior
Logic for the recently included fractional scaling support [0] was
difficult to reason about as it depended on two different callbacks
one that listened to a preferred scale, another that tracked which
physical displays the window overlapped.
Checking if fractional scaling was in used depended on the order
the callbacks ran - which is undefined.

In practice - mixing non-fractional and fractional displays would
flicker when the window was moved between monitors.

Resolve this problem with the following changes:

- When the fractional-scale manager is supported,
  only respond to the scale from it's preferred_scale callback.
- When no fractional-scale manager is available,
  set the scale based on the scale of overlapping outputs.
- Add support for postponing the buffers commit call to prevent
  flickering when changing the windows scale.

Other changes:

- Use a lock before setting the pending frame state from
  wp_fractional_scale_handle_preferred_scale.
- Ensure pending actions that themselves trigger pending actions
  run in the time gwl_window_pending_actions_handle is called.
- Rename GWL_Window::scale -> GWL_WindowFrame::buffer_scale.

[0]: cde99075e8
2023-04-04 17:35:42 +10:00
95ffc4ba3a GHOST/Wayland: remove fractional-scale ifdef's
Depend on fractional-scale when searching for wayland-protocols

This will impact builders that don't use Blender's `../lib/` and
have wayland-protocols older than v1.31.
2023-04-04 17:26:37 +10:00
d2ad00d0f5 Cleanup: remove unused RenderData::stereomode 2023-04-04 17:26:37 +10:00
ececd71fb2 Cleanup: remove references to the Blender Game Engine Player 2023-04-04 17:26:37 +10:00
b5a7724262 Fix #105268: Avoid creating redundant dependencies for the lattice modifier
For some reason, lattice modifier always depend on self object transform.
This fix just move extra dependencies in to if case statement, also some
cleaning of this code area.

Pull Request: blender/blender#105293
2023-04-04 09:25:51 +02:00
b1bf1db656 Fix source_archive ignoring addons
Caused by the changes in the submodules configuration.

Can no longer rely on the `git submodule` command to
show list of external references to be packed.

Needs to be backported to 3.5.1.

Pull Request: blender/blender#106502
2023-04-04 09:14:58 +02:00
e952083652 Fix #105989: Outliner: Make Single User duplicates data
This happens even though there is only one user.

The Outliner only implements this `Make Single User` for worlds
(`singleuser_world_fn`) and actions (`singleuser_action_fn`) [it is
questionable if the whole functionality could be removed really, but
this is for another report] and it uses `id_single_user` to do so --
this function does not check if we even have more than one user though,
so data gets duplicated resulting in duplicate worlds or actions even if
they only have one user and shouldnt be touched.

Now let `id_single_user` check usercount and only act if we have more
than one real users.

Pull Request: blender/blender#105991
2023-04-04 09:12:37 +02:00
14b112ef82 Fix #106422: Mesh Data Attributes Using tip_ for iface_
pgettext_tip incorrectly imported as iface_ instead of importing
pgettext_iface. These leads to incorrectly translated attribute text
shown when the user elects to translate only tooltips.

Pull Request: blender/blender#106507
2023-04-03 20:55:22 +02:00
3e8f85c743 Fix: VSE Channels region unhides when changing font
Caused by filebrowser calling space `refresh` function. The intention of
refresh function was mainly to hide channels when view type is changed.
Unhiding channels when view is changed back seems logical, but this
causes issues when region is too thin, which results in hiding side
panel, which is more important.
2023-04-03 19:46:10 +02:00
9726e4a0ad Nodes: Move data-block default values with link drag search
When creating nodes by dragging a link, it can be convenient to
transfer values from input socket. For reference values, like images,
this may be necessary to avoid unnecessary data-block users. This
patch starts adding such a system. At this moment this only makes sense
for one node (Image Input), but this can be extended to work with other
reference types, different non-reference types and support auto-casting
(if a float is transferred to the Integer Input node).

See task: blender/blender#102854
Original patch: https://archive.blender.org/developer/D16735

Pull Request: blender/blender#105972
2023-04-03 19:33:39 +02:00
e7f395dd20 Nodes: Add dropdown to select group socket subtype
Previously the only way to control the subtype was to remove the group
input or output and create it again. This commit adds a dropdown to
change an existing socket, for supported socket types.

Based on a patch by Angus Stanton: https://developer.blender.org/D15715

It was necessary to fix the UI code slightly; the layout's context
wasn't being used in calls to an operator's enum items callback.

Pull Request: blender/blender#105614
2023-04-03 18:23:30 +02:00
4cb670e68f Fix #105148: Cycles Metal memory leak on AMD GPU
After NanoVDB support from 02c2970982, this line should not have been
removed.
2023-04-03 18:18:01 +02:00
7a1ec82af4 Cleanup: Remove poly normal writing
The potential optimization in the normal edit modifier when flipping
faces isn't worth the "API impurity" and complexity introduced by
adding poly normal editing as part of the API. This change simplifies
future changes to the ownership of poly normals with a shared cache,
which can prevent recomputing poly normals completely.
2023-04-03 12:11:21 -04:00
e76f4d9f9a Mesh: Use more efficient update tag when flipping faces
Vertex positions and faces aren't changed, so most caches shouldn't
need to be tagged. This removes unnecessary re-computation of bounds,
triangulation, loose edges, etc.

Pull Request: blender/blender#106250
2023-04-03 18:01:16 +02:00
da6dfc2b43 VSE: Clarify why frame range is drawn differently than in other editors. 2023-04-03 17:44:04 +02:00
45f7e2b6ba Fix Snap package error on startup in older Linux version
With the new glibc requirement, the core version needs to be increased.
2023-04-03 17:32:35 +02:00
dbf1049d41 Cycles: bump version to 3.6.0 2023-04-03 17:32:35 +02:00
861debcb10 Fix Cycles standalone and Hydra build issues in some configurations
Bring the build in sync with the Cycles standalone repo.
2023-04-03 17:32:35 +02:00
Alex Fuller
4f0092c1ff Refactor: add native Cycles Normalize option on lights for Hydra
Make it a native Cycles light option instead of counter-acting the inverse
area calculation in Hydra.

Differential Revision: https://developer.blender.org/D16838
2023-04-03 17:23:46 +02:00
Alex Fuller
945579c203 Fix Cycles build issue with USD 23.02
HdRenderDelegate got a change with the interface, adding gpuSupported. It
currently is just a dummy implementation without checking for anything
GPU-related.

Differential Revision: https://developer.blender.org/D17207
2023-04-03 17:23:46 +02:00
Alex Fuller
cbf3bd0efc Fix Cycles missing geometry header in object header, causing crashes
The problem is that `set_geometry()` otherwise ends up implicitly
casting `Geometry*` to bool. In Blender this worked because the
geometry header was always included before the object header.

Differential Revision: https://developer.blender.org/D16737
2023-04-03 17:23:46 +02:00
8833f5dbf9 Animation: Allow NLA strips to be horizontally shuffled
Allows NLA strips to horizontally translated over each other. If a strip is dropped when translating, it'll cause the strip to shuffle into place.

---

Abstracted large conditional branch in `recalcData_nla` into it's own `nlastrip_fix_overlapping` method for increased readability. No logical changes were made.

---
[Archived Phabricator Patch](https://archive.blender.org/developer/D10102)

Pull Request: blender/blender#105532
2023-04-03 17:10:37 +02:00
4bcd59d644 Cycles: Avoid overhead from RNA when extracting mesh data
Use raw Blender structs and mesh data rather than using the RNA API.
There isn't any benefit from using the RNA when Cycles is compiled
with Blender anyway, and a profile showed that the majority of time
was spent in Blender RNA API functions.

This gives a significant improvement in performance when ingesting
meshes. Here are some tests of the runtime of the `create_mesh`
function (in seconds):

|                           | Before | After |
| ------------------------- | ------ | ----- |
| Grid                      | 0.66   | 0.11  |
| Many realized cubes       | 2.60   | 0.48  |
| Large curve to mesh setup | 4.18   | 1.14  |

Also change to resizing the arrays and filling them by index rather
than appending. This makes the parallel aspect of the logic clearer,
and makes the loops easier to parallelize in the future, and makes
it easier to have a performance benefit when an attribute like
`sharp_face` doesn't exist.

Pull Request: blender/blender#106275
2023-04-03 17:04:58 +02:00
1380ee74ff Overlay: use edge-connected polygons to calculate wireframe factor
Use the dot product of the normal of the two polygons connected to the
edge to calculate the edge factor.

This fixes #90641 and #102545 and ensures more predictable results for
boundary and non-manifold edges.

Co-authored-by: Germano Cavalcante <mano-wii>
Pull Request: blender/blender#105352
2023-04-03 16:22:41 +02:00
d1fe11c79f DRW: remove edges hidden by Optimal Display in IBO creation
No functional changes.

Edges hidden by Optimal Display are hidden by edge factor Shader.
But there is not much advantage in doing this, as the number of edges
hidden by the Optimal Display is usually much higher than the number of
visible edges.

And the lines extractor does not include invisible edges due to other
factors.

So this change makes:
- Visibility test more consistent with what is actually seen.
- Smaller buffer for IBO sent to GPU
- consistency with GPU Subdivision that already considers Optimal Display
- Allows possible improvement in the "Edge Factor" extraction by making
it unnecessary to check the Optimal Display (except for optimization).

Co-authored-by: Germano Cavalcante <mano-wii>
Pull Request: blender/blender#106402
2023-04-03 15:59:41 +02:00
d1ec8a2ae5 I18n: translate popover descriptions
Popover menu buttons had their labels translated but not their
descriptions, although they were properly extracted.

This commit fixes that using the `TIP_()` macro.
2023-04-03 15:55:48 +02:00
da764ee357 I18n: translate viewport grid unit
This information is displayed in the top left of the 3D Viewport with
other text info. The units of the grid are already extracted, but they
were not translated in the drawing code.
2023-04-03 15:28:16 +02:00
e4cd7d2fed Updated translations from SVN trunk (r6419). 2023-04-03 12:58:50 +02:00
e05010b2f2 Cleanup: make format on new install_linux_packages py script.
Also some minor fixes to generator for version numbers of packages.
2023-04-03 12:00:13 +02:00
f692010ae1 Cleanup: remove redundant call to #free() for light tree arrays 2023-04-03 11:48:09 +02:00
b81472d20f Cleanup: remove useless comments
Remove comments from `eBConstraint_Types` that
- were used long ago during a big refactor effort, but are no longer
  necessary, or
- just repeated the name of the enum constant.

No functional changes.
2023-04-03 11:24:39 +02:00
1205111fe9 Refactor: move #object_usable_as_light() from #LightManager class to #Object
so that the function can also be used by other classes.
Also change `!bounds.valid()` to `!is_traceable()` so zero-sized objects
are skipped.
2023-04-03 11:16:00 +02:00
4aed240b02 CMake: Disable Options Depending on OpenEXR Dependecies
OpenEXR has some dependecies that other other modules in Blender
requires. When disabling OpenEXR these dependecies could not match
and building blender would fail.

This PR disables the next options when `WITH_IMAGE_OPENEXR=Off`

- `WITH_OPENVDB`
- `WITH_ALEMBIC`
- `WITH_VULKAN_BACKEND`
- `WITH_CYCLES_OSL`

Additionally windows stores the IMath libraries in `IMATH_LIBRARIES`
Linux and Mac stored the IMath libraries in `IMATH_LIBRARY`. This
change will also adds `IMATH_LIBRARIES` variable to all platforms.

Pull Request: blender/blender#106209
2023-04-03 09:50:50 +02:00
8954df63ef Fix #106431: Resolve Metal workload dependency
Splitting workload dependency chains such that they
only exist within the context of a single frame.
Dependencies are required to ensure sequential
command buffer submissions execute in order,
but the additional dependencies between frames
could incur GPU timeouts, if a signal was delayed.

This could be triggered by both CPU/GPU cycles
texture updates and Viewport Compositor operations.

Should also resolve #106401

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#106443
2023-04-03 08:53:42 +02:00
682cb6ecd3 Metal: Optimize SSR shader for Apple Silicon
Reduce register spill to global memory in raytrace_resolve
function. Results in a 20% uplift for this particular shader on
Apple Silicon GPUs. Contributing to 3-5% uplift for scenes
which have SSR enabled. This is achieved via reducing
memory pressure using a packed data type for the sampling
kernel.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#106231
2023-04-03 08:37:24 +02:00
dc63f75837 Fix #106414: Handle mat==None case in GPencil Change Active Material operator
Some material slots could be empty, the operator could encounter a python
exception. Now fixed.

Pull Request: blender/blender#106418
2023-04-02 17:08:50 +02:00
45104ddd14 Cleanup: Remove code asserted as unreachable,
This piece of code has been assserted as unreachable for 3 years now,
time to clean it up.
2023-04-01 20:17:26 +02:00
8a364ef72c Fix (unreported) misisng handling of XR data object pointer in foreach_id.
Very sadge to see this kind of mistakes still exist in 2023 code...

While in theory this commit could be backported to (LTS) releases, would
rather only do it if/when proven it actually fixes user-facing issues.
Fixing such issues so deep in ID management code can have completely
unexpected side effects.
2023-04-01 20:10:48 +02:00
7592ec35d3 GPU: Fix compilation with option WITH_GPU_BUILDTIME_SHADER_BUILDER
Breakage caused by 84c93f3a06
2023-04-01 17:16:54 +02:00
e652d0002b GPU: FrameBuffer: Fix empty framebuffer update
The framebuffer default size was only set during the first bind. This
is because the `dirty_attachments_ tag` wasn't set and thus the
framebuffer size was never passed down to the GL.

Split to `default_size_set()` to not affect other code paths that use
`size_set()`.
2023-04-01 13:24:48 +02:00
897a735151 BLI: Rotation: Add CartesianBasis transform_point and invert 2023-04-01 13:24:35 +02:00
957ac41237 Fix #78396: Pack UVs to original bounding box
Adds the ability to pack UVs back into the original bounding box.

Choose UV Editor > Menu > UV > Pack Islands

Then change "Pack To" to "Original bounding box"
2023-04-01 21:13:58 +13:00
531f99ffbd UV: simplify uv packing api and simplify uv packing
Fix #invert_m2_m2 with repeated arguments.

Change UV Packing to use {pivot, half_diagonal} representation.
2023-04-01 11:35:07 +13:00
6778460e53 Fix #106323: Snap to Face Nearest not working
Face Nearest only works with individual projection, so always set the
`SCE_SNAP_PROJECT` flag in this case.

Also gray out the `Project Individual Elements` option in the UI if
`Face Nearest` is enabled.

And change the description to indicate that `Project Individual Elements`
is always enabled with the `Face Nearest` option.

(I feel a better design for this option needs to be considered).
2023-03-31 17:30:26 -03:00
f898c22349 Fix #106363: snap toggle affecting operators not set to 'Affect'
Regression due 88e2542398.

Although the "Non-Affect" operators continue to use incremental,
this snapping should not be enabled by default.
2023-03-31 16:32:53 -03:00
389025bee2 Cleanup: Use consistent type in function definition 2023-03-31 14:24:23 -04:00
1a956ce196 Cleanup: Mode most of MOD_nodes.cc to the blender namespace
Avoid introducing another `::modifiers` namespace for now, since it's
not clear if we'll want that long term. This just avoids a bunch of
boilerplate and makes things easier to read.
2023-03-31 13:19:37 -04:00
60cac27ccc Cleanup: Use helper function to create AttributeFieldInput 2023-03-31 13:00:51 -04:00
1113a25d1f Cleanup: Make geometry nodes execution functions more reusable
Use the node group and the properties as arguments instead of
the modifier. This may help to allow reusing the functions outside
of the modifier execution context.
2023-03-31 12:53:21 -04:00
7d548b5735 Refactor: Cleaning up NLA Draws Non_solo boolean option
Refactor: Clean up boolean logic naming in nla_draw to be more readable.
Pull Request: blender/blender#106119
2023-03-31 17:49:26 +02:00
0187943a3d Animation: Weight Paint select more/less for faces
This adds the select more/less operators to the weight paint mode face selection.

Just like in edit mode, press `CTRL`+`Numpad Plus/Minus` to use them.
They have also been added to the `Select` menu.

Pull Request: blender/blender#105607
2023-03-31 14:53:00 +02:00
0d1a0cb453 Animation: Weight Paint select more/less for vertices
This adds the select more/less operators to the weight paint mode vertex selection.

Just like in edit mode, press CTRL+Numpad Plus/Minus to use them.
They have also been added to the Select menu.

Pull Request: blender/blender#105633
2023-03-31 14:47:57 +02:00
0face8bd22 Fix #105912: Texture paint removes evaluated mesh attributes
When retrieving the evaluated mesh to paint on, it can be reevalauted,
where a smaller set of attributes are requested than for regular
evaluated meshes. That reevaluation should be completely removed
(see #106186), but a simple fix in the meantime is to manually
request that data.
2023-03-31 08:15:58 -04:00
7775fecb14 Animation: Graph Editor - grey out area outside of normalization range
When normalization is enabled in the Graph Editor,
the area outside the -1/1 range on the y axis isn't meaningful.
To visually represent that this patch greys out that area
just as it does with anything outside the current frame range.

Pull Request: blender/blender#106302
2023-03-31 13:54:32 +02:00
324ba509b5 Fix: don't access 4th element of float3
The issue here is that `float3` implicitely casts to `float *`
which is then passed into the `float4` constructor.
2023-03-31 11:41:05 +02:00
ca0ec55d59 Update license document. 2023-03-31 11:39:39 +02:00
b73ae802fb Fix OBJ test expectations after fast_float.h update 2023-03-31 11:36:25 +03:00
e1426e6319 Externals/IO: update fast_float.h to latest version
fast_float.h currently is only used by OBJ, STL and PLY I/O importers.
Update it to the latest release from upstream (from 3.4.0 2020 Nov to
4.0.0 2023 Mar).

No behavior changes, but they have optimized the performance a bit.
Importing a 6-level subdivided Suzanne OBJ file (330MB) goes from 3.5sec
down to 3.2sec on Win10, Ryzen 5950X, VS2022 build.
2023-03-31 11:03:13 +03:00
cde99075e8 GHOST/Wayland: add fractional-scale interface support
Previously, fractional scaling was detected but set an integer buffer
scale which the compositor would down-scale causing blurry output.

Now the fractional scaling interface is used when available to set the
DPI and set the internal buffers size & viewport transformation to
ensure 1:1 pixels from Blender to the Wayland output.

Tested to work with multiple monitors with mixed
fractional/non-fractional scale.

Note that this change causes a regression for when fractional scaling
is set on a compositor without support for fractional-scale-v1.
Supporting fractional scaling in both cases is possible but overly
complicated. This case already wasn't working so well - with blurry
output due to image scaling, now the DPI wont be accurate in this case
although Blender is still usable.
2023-03-31 13:03:50 +11:00
75127f9b09 Build: upgrade wayland protocols to 1.31
Needed for fractional-scale-v1 protocol.
2023-03-31 13:02:54 +11:00
a9d15ee8a0 Cleanup: pass rect as a constant pointer 2023-03-31 13:02:53 +11:00
498287bca0 Cleanup: Geometry Nodes: Split modifier property update function
It's a bit easier to follow this way, and we can make better use of
const. It's also more reusable in case we have to use it elsewhere
too (for node group operators?).
2023-03-30 18:51:33 -04:00
3d5ba79050 Cleanup: Use const arguments for IDProperty functions 2023-03-30 18:51:33 -04:00
ed0e4f4043 UV: refactor uv packing, reduce usage of #BoxPack
No functional changes.
2023-03-31 10:09:48 +13:00
cbb813886c Geometry Nodes: Simplify retrieval of node dependencies
Use checks for certain node types with better algorithmic complexity.
They should perform better in some edge case with a lot of nodes or
node group nesting. They're now a bit more similar to each other too.
2023-03-30 16:30:23 -04:00
76e0ca6b91 Build: suppress CMake warnings about newer Boost versions
This is the only package that warns about this type of thing, and gets in the
way of actual warnigns on build logs. This requires CMake 3.19+ to take effect,
older versions still show the warnings.
2023-03-30 22:29:14 +02:00
40f050aadc UV: simplify packing usage of #BoxPack
No functional changes.
2023-03-31 09:02:01 +13:00
f6e89233a3 Workbench: Optimize texture usage flags
Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#106229
2023-03-30 21:49:41 +02:00
ec94b1da58 Metal: Optimize texture usage in glutil
Ensure compression is enabled by using shader_read
flag only. Also ensure that MTLTexture contents
remain in optimal layout for reading after any
data modifications.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#106234
2023-03-30 21:45:45 +02:00
1658b8ab46 Fix Cycles Metal failing when run in parallel, always run serial
The command buffer fails to execute, the cause is unknown. It does not
appear to be related to the binary archive cache as disabling that does
not prevent the issue.

Pull Request: blender/blender#106328
2023-03-30 19:46:49 +02:00
55d642ba2f Fix non-deterministic behavior of mask compositor node
The issue was caused by uninitialized offset used for the scale
variable.

Follow the rest of the usages of the operation which initialize
it explicitly. This makes it very safe and easy fix to backport
to any LTS or corrective release.

Ideally should probably initialize all members in the class
itself, to avoid such situations in the future.

Pull Request: blender/blender#106325
2023-03-30 18:57:22 +02:00
a145d1563a Cleanup: move flip faces code from nodes to geometry module 2023-03-30 18:44:11 +02:00
55d473ee40 Cleanup: use better default name for unknown parameter
The `<` and `>` don't work well when the name is inserted into a .dot graph.
2023-03-30 18:44:11 +02:00
bdc3f1581d Fix #106261: When geometry output is viewed the cycling operator picks wrong sockets.
The cycling method for the viewer connection starts searching from the next socket
after the last current connection. If a geometry socket is is the last connected
output this caused the method to jump to the next socket after the geometry,
potentially skipping over valid data sockets that are not viewed yet.

The solution is to ignore the geometry sockets in the cycling entirely and only
consider data sockets (i.e. non-geometry sockets).

Pull Request: blender/blender#106318
2023-03-30 16:56:56 +02:00
8785862ee4 Replace install-deps bash script by a python one, and only handle distro packages.
This tool now only supports installing packages, it won't build any
dependency anymore. This implies that on most distributions, it wont
make a complete Blender build possible, some features will likely be
misisng.

By default, it only install basic dev environment to enable building
Blender with the precompiled libraries (which is the recommended way).

Passing the `--all` option will make it try to install all known
dependencies from distro packages. This is a development option,
regular Blender build should be done with the precompiled libraries.

Tested on Debian Testing, Arch, Fedora and Suse Tumbleweed.

With the new design, it should be fairly trivial to add more
distributions if desired, and maintenance should also be way simpler.

NOTE: side effect is that a working python3 interpreter is expected on
system running this script. In practice this should not be an issue,
since Python3 is installed by default in almost all regular desktop
linux installations.
2023-03-30 16:30:45 +02:00
be733c240e Animation: Insert Keyframe only on active FCurve
The insert key operator allowed to insert a keyframe on all selected FCurves
and on the Active FCurve at cursor value.
But it didn't allow to insert a keyframe only on the active FCurve.

This patch adds that. It is available in the redo panel and under Key->Insert Keyframes (which can also be called with the I hotkey)

Pull Request: blender/blender#106307
2023-03-30 16:29:50 +02:00
12b001ebce Fix OBJ tests using release folder
This change aimed to solve the following issues:

- Possible threading issue of two tests writing to the same
  file, depending on how the ctest is invoked

- Test using the release directory, and potentially leaving
  temp file behind on test failure, breaking code sign on
  macOS.

Pull Request: blender/blender#106311
2023-03-30 15:55:01 +02:00
8f1925c2f6 Cleanup: make format 2023-03-30 15:28:21 +02:00
f9b9430982 Fix: Crash when loading 3.4 autosave file
The MVert to float3 vertex position conversion was skipped using
the wrong case, mesh->mvert wasn't always set when writing
apparently.
2023-03-30 08:37:05 -04:00
80319035e6 Fix: Debug assert extracting multiple UV maps in edit mode 2023-03-30 08:24:29 -04:00
7eda8e5367 Fix: unnecessary edge pan updates
Found together with a fix for #106043.

Edge panning (in Node Editors, Outliner and VSE) does unnecessary
updates when the view has not changed at all. This includes adding
`MOUSEMOVE` events (even if you dont move the mouse at all).

Adding `MOUSEMOVE` events results in the transform system constantly running (even if you dont move the mouse) which we certainly want to avoid.

Rectify this by only calling these updates when the view changes.

Pull Request: blender/blender#106301
2023-03-30 14:08:57 +02:00
2a6f177e8e Fix #106043: Moving frame node jittering while cursor is still
The fix for #105363 (6d3ce8273a) made the transform system respect
(Frame) nodes `offsetx`/`offsety`.

Now Node Editors run the transform system even if the mouse is still (due to edge panning -- unnecessarily, see PR #106301 for fixing this). And due to the way `frame_node_prepare_for_draw` recalculates these offsets (based on
on updated positions and `node.runtime->totr` [which in turn gets rounded in `node_update_basis` -- so subpixel precision is lost there, see [1]]), this can lead to slight imprecisions/noise/jitter during transform (if we use float offsets, see the PR for more info).

So to counter this, use rounded offsets now [which will keep the whole circle stable].

NOTE: PR #106301 would fix this already for having the cursor still, but this patch still improves slight jitter when moving, so will commit separately.

[1] comment from `node_update_basis`
> /* Round the node origin because text contents are always pixel-aligned. */

Pull Request: blender/blender#106096
2023-03-30 14:02:45 +02:00
d90795bc3c Asset System: New "weak" asset reference for storing in .blend files
No user visible changes expected.

For brush assets, we need a way to store a reference to a brush in .blend files, so that the last active brush can be restored from the file. See #101908. It seems like a generally useful thing to have.

Adds a new DNA struct to store a "weak" asset reference, that is, a reference that can break under a number of circumstances, but should work reliably enough under normal usage. There's no way to reliably reference an asset currently, so this works on a "best effort" basis. It can break when assets are moved inside the asset library, asset libraries are unregistered from the Preferences, or a file is opened on a different machine with different Preferences, for example. It can also break currently if an asset library is renamed.
It contains:
- Information to identify the asset library the asset can be found in.
- A relative "identifier" (currently a relative path) for the asset within the asset library.

There's further code to resolve a weak reference to file paths and Blender library paths.

Part of #101908.

Co-authored-by: Bastien Montagne <bastien@blender.org>

Pull Request: blender/blender#105603
2023-03-30 12:25:42 +02:00
a12a8a71bb Remove "All Rights Reserved" from Blender Foundation copyright code
The goal is to solve confusion of the "All rights reserved" for licensing
code under an open-source license.

The phrase "All rights reserved" comes from a historical convention that
required this phrase for the copyright protection to apply. This convention
is no longer relevant.

However, even though the phrase has no meaning in establishing the copyright
it has not lost meaning in terms of licensing.

This change makes it so code under the Blender Foundation copyright does
not use "all rights reserved". This is also how the GPL license itself
states how to apply it to the source code:

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software ...

This change does not change copyright notice in cases when the copyright
is dual (BF and an author), or just an author of the code. It also does
mot change copyright which is inherited from NaN Holding BV as it needs
some further investigation about what is the proper way to handle it.
2023-03-30 10:51:59 +02:00
7e940f184f Animation: Auto frame curves Y extents when hitting normalize
When hitting the "normalize" button in the graph editor, set the y extents of the view to the extents of the `FCurves`.
Previously you had to search for your curves after pressing that button.

Pull Request: blender/blender#105857
2023-03-30 10:01:12 +02:00
d9de76f5d1 Cleanup: PLY exporter headers cleanup
Move private functions out of headers, cleanup unnecessary includes,
forward declarations instead of includes where possible, avoid global
variables.
2023-03-30 09:56:23 +03:00
0fcecc5c1e Cleanup: use methods to convert to/from window scale
Simplifies adding support for the fractional-scale protocol which
requires events to be fractially scaled.
2023-03-30 17:36:31 +11:00
3cfc3eab93 UV: fix unreported, bad uv packing with convex shape_method.
Pivot wasn't set with convex shape_method when an island has only one triangle.

Regression from 86b1e5e3b6
2023-03-30 12:35:45 +13:00
9ea6771d10 Cleanup: simplify sorting during uv packing
Prevent double-sorting during uv packing with bounding-box packing.

Slight speed improvement, slight packing efficiency improvement.
2023-03-30 12:23:49 +13:00
a62f6c8290 Fix out-of-bounds array access when building with GHOST_OPENGL_ALPHA
While this is off by default, best replace hard coded sizes to avoid
out of bounds access if the enum is expanded.
2023-03-30 09:51:44 +11:00
abb879175e Fix #106283: several uv operations producing missing uvs
Uninitialized memory, regression from in p_flush_uvs [0]

[0] 8ac67a798b
2023-03-30 10:28:41 +13:00
7b94e86dd9 PLY: improve UV values merging in the exporter
Similar to recent OBJ UV values merging commit (05a63e3705) - build
mapping of (vertex, UV) by going over the face loops directly, instead
of using BKE_mesh_uv_vert_map_get_vert and then having an additional
map on top. Provide the mapping into ready to use flat arrays, instead
of building a map and then building arrays out of that in a separate
pass.

While at it, avoid the extra cost of building all this complicated
mapping when we don't have or are not exporting UVs.

Timing tests on exporting several models into binary PLY file
(Win10, Ryzen 5950X):

- Suzanne subdivided to level 6 (2.1M verts): 0.93s -> 0.68s
- Rungholt Minecraft level (9.7M verts): 3.3s -> 2.3s
- Stanford Lucy 3D scan (14.0M verts, no UVs): 5.2s -> 1.5s
2023-03-29 23:00:06 +03:00
5f61eca7af Cycles: Exploit non-uniform threadgroup sizes on Metal
This patch replaces `dispatchThreadgroups` with `dispatchThreads` which takes care of non-uniform threadgroup bounds. This allows us to remove the bounds guards in the integrator kernel entry points.

Pull Request: blender/blender#106217
2023-03-29 21:46:11 +02:00
8eb9d5342f Fix build error on Ubuntu 20.04 with Wayland after recent changes
The system wayland-protocols version is too old, and xdg-activation-v1.xml
is a more recent addition than xdg-decoration-unstable-v1.xml so check for
that.
2023-03-29 20:28:37 +02:00
944a5854c6 Cycles: Fix MetalRT shadow all hit bug
This patch fixes a MetalRT issue where viable shadow hits are discounted based on the false assumption that hits are ordered by distance. With this patch, the following unit tests now pass:

- openvdb smoke
- shadow catcher pt transparent lamp only 0.8
- shadow catcher pt transparent lamp only 1.0

Pull Request: blender/blender#106276
2023-03-29 20:20:07 +02:00
8ce3bb6e05 Fix: Curves: crash when requesting write access for attribute from multiple threads
This is preparation for #106228, the crash does not happen in `main` currently.
The issue was `positions_for_write` might make a copy of the data if it was
shared. This operation is not thread safe on a single mesh. The solution is to
get write-access to the positions only once before threading starts.
2023-03-29 18:40:13 +02:00
84c93f3a06 Cleanup: use eCustomDataType instead of int
This makes the APIs more correct and simplifies debugging, because
some debuggers can now show the enum name instead of the integer.

Pull Request: blender/blender#106268
2023-03-29 17:10:49 +02:00
431d9858c5 Cleanup: Retrieve const custom data layers 2023-03-29 11:09:14 -04:00
5efa39096c Fix #106134: Broken triangulation without cached face normals
Logic broken in 16fbadde36
2023-03-29 11:09:14 -04:00
d32d787f5f Clang-Format: Allow empty functions to be single-line
For example

```
OIIOOutputDriver::~OIIOOutputDriver()
{
}
```

becomes

```
OIIOOutputDriver::~OIIOOutputDriver() {}
```

Saves quite some vertical space, which is especially handy for
constructors.

Pull Request: blender/blender#105594
2023-03-29 16:50:54 +02:00
cc7634f2ea Cleanup: deduplicate code 2023-03-29 09:47:41 -03:00
bb2c89b20d Fix #106251: "Shift to extend" doesn't work in 3D View Collections panel
Regression in [0], use shift to initialize the extend option when unset.

[0]: d7dd7403a8
2023-03-29 20:05:44 +11:00
c0a252b833 Fix #105895: UI scaled down with 125% fractional scaling on Wayland
The DPI returned by the GHOST/Wayland didn't account the buffer being
rendered at a higher (non-fractional) resolution, then scaled down.

This caused the software cursor and UI to rendered very small.
A fractional scale of 101% would show the UI just over 50% of the size
(making the UI to be close to half the scale it should have been).

Resolve by accounting for down-scaling of the buffer to it's
fractional size.
2023-03-29 17:48:53 +11:00
68d146d57d Fix error in WM_capabilities_flag (all capabilities were set)
Mistake in [0] caused the flag not to be reset.

[0]: 4e51008a82
2023-03-29 17:33:38 +11:00
86b1e5e3b6 Cleanup: simplify uv packing api 2023-03-29 17:09:36 +13:00
2bc331981d Cleanup: function style casts, remove UNUSED(..) & use nullptr in C++ 2023-03-29 14:37:53 +11:00
1ddbe7cadd Cleanup: move doc-strings into headers, remove duplicates
In some cases move implementation details into the function body.
2023-03-29 14:37:34 +11:00
ce659dbc4e Cleanup: use doxygen sections 2023-03-29 14:17:32 +11:00
35f770a689 Cleanup: duplicate words in comments 2023-03-29 14:17:32 +11:00
43f6df853f Merge branch 'blender-v3.5-release' 2023-03-28 22:52:27 -04:00
7d0251ed9a Fix #105855: Crash with node add menu assets and keyboard navigation
The UI needs persistent pointers to catalog paths that it can pass
around via context. It was trying to manage this in own storage, but
this didn't work. Not entirely sure why - the menus get redrawn
continuously while assets load, and the root menu rebuilds the mentioned
storage every time. Maybe the submenus redraw a bit later, or the
keyboard navigation handling still accessed data from a previous redraw
somehow.

Either way, instead of managing own catalog path storage, point into the
asset system, which already has persistent storage for the catalog
paths.

Pull Request: blender/blender#106237
2023-03-28 22:36:30 -04:00
df824e2015 Cleanup: use function style casts
Missed in 901a804f9e.
2023-03-28 23:10:11 -03:00
901a804f9e Cleanup: convert 'view3d_navigate.c' to C++
Anticipate porting this file as changes are planned to it and we are
gradually porting files to C++.
2023-03-29 04:02:16 +02:00
8d16e8f726 Merge branch 'blender-v3.5-release' 2023-03-28 16:33:34 +02:00
6e51f8d202 Fix Python Module build on Windows
Don't install libraries in blender.shared and don't generate manifest
as it's not working and not important to have a clean directory here.

Always detect MSVC_REDIST_DIR as it is used by oneAPI. The way
InstallRequiredSystemLibraries is called it already only sets some
variables and doesn't install anything by itself.

Pull Request: blender/blender#105999
2023-03-28 16:32:25 +02:00
Sebastian Herholz
ac0ed09735 Fix #104329 viewport render with path guiding crashes
This is a workaround fix for Open PGL 0.4.1 when the first volume
samples are collected in a later training iteration.

The problem is fixed in Open PGL > 0.5.0 and the workaround
can be removed after upgrading Open PGL.
2023-03-28 14:45:35 +02:00
a58c951c98 Merge branch 'blender-v3.5-release' 2023-03-28 14:30:12 +02:00
45c16f43ad Fix #105953: division by zero in quadriflow leads to crash
The bug was found by ASAN when running the file from #105953. It's not
entirely clear what the root issue for the division by zero is, but
at least now the result is more predictable.

Pull Request: blender/blender#106165
2023-03-28 14:25:19 +02:00
d81d743537 BLI: support == and != for Set
This makes it more convenient to check if two sets contain the same keys.
2023-03-28 14:16:57 +02:00
fbcddfcd68 BLI: add core types for supporting implicit-sharing
The overall goal is to use implicit-sharing in many places in Blender
that currently do unnecessary copies. See #95845 for more details.

This commit only adds the base data structures in blenlib and uses those
in `GeometrySet` and `AnonymousAttributeID`, which used a more ad-hoc
version of implicit sharing already. #105994 lists some more places where
support for implicit sharing can be added (most notably: custom data layers).

Pull Request: blender/blender#105994
2023-03-28 13:57:51 +02:00
1987cbb12a Merge branch 'blender-v3.5-release' 2023-03-28 13:41:43 +02:00
aa7293f555 Update license doc for OIIO lib update. 2023-03-28 13:40:39 +02:00
d98988d872 Simulation Nodes: indicate which frames are cached in timeline 2023-03-28 13:37:57 +02:00
b14668ae03 Simulation Nodes: refactor automatic caching
The most important part of this change is that the simulation
state at a specific point in time is more self contained now.
This way, only the modifier has to deal with finding the old/new
simulation states and not every simulation individually.

Furthermore, this also includes some simple cache invalidation
when the user changes something that might affect the result.
2023-03-28 13:37:30 +02:00
3d49d738b7 Fix references to some nodegroups from new essentials staying around.
Previous fix/hack a60f651502  made it so that all 'Fake User' linked
IDs are considered as directly linked, so that some IDs (like linked
Text) references are not lost on file save becaus they are not
effectively used.

However, this created unwanted references to all linked assets data,
because an asset always has its fake user set. This ended up keeping
lots of references to sub-assets when appending from the new Essentials
node groups.

NOTE: This is adding another hack to the collection, the whole handling
of 'which unused linked data reference to keep on file save' needs to be
reworked for Blender 3.6.
2023-03-28 13:29:03 +02:00
57712d7b18 Fix #106177: modal operator does not work from Node menu
This was an issue with the `operator_context`. It's a bit confusing because it
looks like every `uiLayout` has its own, but in `uiLayoutSetOperatorContext`
you can see that the `operator_context` is always set on the root layout for
some reason.

The fix is to set `INVOKE_REGION_WIN` as the operator context after it has been
set to something else (I found this to be the default by printing the operator
context before it was changed).

Pull Request: blender/blender#106213
2023-03-28 13:13:30 +02:00
0256bfd309 UI: Support minimum row count for tree views
No user visible changes expected.

With this, empty rows will be added to the tree view so that the
background box is at least a few lines high (like with UI lists). If the
view is used as a drop target, data can be dropped on these empty rows
too then.
This was requested for the Cycles light linking project.
2023-03-28 12:39:24 +02:00
3ea5a8fbb9 Fix #105590: Compositor: Masks don't consider anamorphic aspect ratio
This PR adds support for anamorphic aspect rations when using
masks. As viewport compositor doesn't support masks yet, this
has not been added yet.

Pull Request: blender/blender#106121
2023-03-28 12:36:14 +02:00
aa69ec7f80 Vulkan: Clearing Framebuffer + Scissors
This PR adds support for clearing framebuffers and scissor testing.
Tweaks had to be made to VKTexture to keep track of its layout
on the device. Based on the actual call the layout can switch
to a more optimum layout.

For example during upload of a texture the texture will be converted
to a transfer destination optimized layout. When reading from the
texture it will be converted to a transfer source optimized layout.

The order of the attachments in the framebuffer follows the next rules

- When only color attachments are there the color attachments will
  be placed in the slot they are defined. This way it will match
  the ShaderCreateInfo binding location.
- When a stencil/depth attachment is added it will be placed
  right after the color attachments. When there isn't a color
  attachment it will be the first attachment.

Pull Request: blender/blender#106044
2023-03-28 11:51:32 +02:00
f04787e87b Merge branch 'main' into geometry-nodes-simulation 2023-03-28 11:48:25 +02:00
eb9ab4fae4 Refactor: draw code for anim channel widget
A few small refactors of the `draw_setting_widget()` function for drawing
animation channel widgets (like 'modifier mute', etc.)

- Use `const` where appropriate.
- Move some variable declarations to their actual use, to clarify their
  scope and make it possible to use `const`.
- Return earlier where possible, which should improve performance as some
  unnecessary code gets skipped.

No functional changes.
2023-03-28 11:19:30 +02:00
a64877f045 Vulkan: Added prerequisite checks for using VK_Layer_Validation
This PR adds pre-checks when enabling validation layers.

For validation layers to work some platforms require that
the Vulkan SDK is installed. Validation layers are activated
when running blender with `--debug-gpu`.

Sometimes we expect users to run with `--debug-gpu` for
narrowing down an issue and we cannot expect them to have
the Vulkan SDK installed.

This patch will check if the `VK_LAYER_PATH` is available
and that the configuration file of the validation layer is
present. If this isn't the case we don't activate the
requested validation layer.

Pull Request: blender/blender#105922
2023-03-28 10:45:44 +02:00
f8e190aac5 Cleanup: Silence Compilation Warnings
In recent Vulkan changes.

Pull Request: blender/blender#106204
2023-03-28 08:53:56 +02:00
a88c77eaac Cleanup: use struct comments for gwl_registry_handlers declaration 2023-03-28 17:05:25 +11:00
1cf2ad8e15 Fix #106203: Memory leak with dynamics enabled in particle edit mode
particle_batch_cache_init was called with allocated memory in
ParticleBatchCache. Now particle_batch_cache_clear frees all allocated
memory.
2023-03-28 16:58:50 +11:00
3071ec486b GHOST/Wayland: support window activation
Calling render (for example) with an existing window open now activates
the window on Wayland. Tested to work on GNOME & KDE.

Use the xdg-activation protocol which typically brings the
window to the foreground.

Partially resolves #102985.
2023-03-28 16:08:10 +11:00
8132b4a927 GHOST/Wayland: GWL_Seat::data_source_serial when modifiers are set
All keyboard/cursor events should set the data_source_serial,
also update doc-string.
2023-03-28 16:05:32 +11:00
4ee705ca4f Cleanup: use a system method to access the APP_ID
Move the app-id out window initialization code.
Make it possible for other methods to access the APP_ID.
2023-03-28 16:05:31 +11:00
10b03e66b9 Cleanup: remove unreachable code 2023-03-28 15:57:48 +11:00
4bead379c6 Cleanup: remove redundant (void) in C++ function declarations 2023-03-28 15:57:48 +11:00
2ec4ce18ae Cleanup: use 'override' specifier for GHOST: X11, SDL & None with CLANG
Clang would warn about failure to use 'override' when a single
method was added that used 'override' when none of the other methods
did.

This meant a single correct use of override caused noisy compiler
warnings (for CLANG but not GCC).
Avoid this by using 'override' where appropriate.
2023-03-28 15:57:48 +11:00
47e065f165 Cleanup: quiet unused but set warnings with CLANG 2023-03-28 15:57:48 +11:00
bbcfdb844c Cleanup: quiet strict-prototypes warning with CLANG 2023-03-28 15:57:48 +11:00
1b0816929f Cleanup: quiet unreachable-code-generic-assoc warnings with CLANG
Duplicate types in type checking macros caused many warnings.
2023-03-28 15:57:48 +11:00
5379c0aa00 Fix particle system creating over-sized KD-tree
Particles were counted but the result was ignored.
2023-03-28 15:57:48 +11:00
55f6c97185 Fix redundant memcmp in BLI_array_store, correct assertion
Assert failed in BLI_array_store_test, failing to compare chunks
caused an unnecessary memcmp call in rare cases.
2023-03-28 15:57:48 +11:00
8ac67a798b Cleanup: Simplify aspect ratio usage in uv unwrapper
Replace `aspx` and `aspy` with `aspect_y`.

No functional changes.
2023-03-28 15:52:34 +13:00
ceaaf7f0ca Cleanup: format 2023-03-28 15:05:54 +13:00
16576beb22 Fix: Mistake in mesh vertex normal dirty tag in previous commit
The "clear dirty" call was removed, that shouldn't happen (yet!).
2023-03-27 19:56:21 -04:00
9bb6f92fe0 Cleanup: Use Vector for metaball tessellation vertex data
Avoid manually reallocating arrays here, and simplify future changes
to the ownership and assignment of mesh vertex normals.
2023-03-27 19:48:04 -04:00
b828641a93 UV: Add alpaca_rotate variant for improved packing efficiency
Improvements to packing efficiency and updating UV packing API.

* Add #pack_islands_alpaca_rotate, the fast alpaca-style packer with rotation.

* Update heuristic for sorting islands based on longest edge.
(Improves pack efficiency when rotation is enabled.)

* Add `aspect_y` to UV Packing API, to support non-square materials in the future.

Pull Request: blender/blender#105977
2023-03-28 00:35:27 +02:00
00bb30c0e9 Geometry Nodes: Copy cached no loose edge status in realize instances
When all of the input meshes have no loose edges, the output won't have
any either, but finding that out for the output is much more expensive.
Copy this tag to the output mesh to save processing time when drawing.
In my test creating 1 million instances of a 16 face mesh, this changed
the time for the draw cache loose geometry extraction from 220 ms to
131 ms.

For now, only do this when the loose edges of the inputs are already
cached (primitive nodes, for example). This avoids paying the cost of
calculation when we don't know it will be necessary.
2023-03-27 16:40:04 -04:00
63689e4756 Geometry Nodes: Tag no loose edges after curve to mesh node
It doesn't take much time to know whether all of the curves have more
than a single point, and if that's the case, we know for sure there are
no loose edges in the mesh. This can save time when creating the mesh
draw cache. The time for finding loose geometry goes from 180 ms to
104 ms for a large molecular nodes test file.
2023-03-27 16:39:33 -04:00
52eced3eef Geometry Nodes: Slightly improve curve to mesh performance
For the single-threaded part of the curve to mesh conversion, avoid
writing to two logically separate arrays in the same loop. Instead
run the calculation on two separate threads if the output is large.

Timing for `calculate_result_offsets` when processing 1 million curves:
Before: Average: 10.4 ms, Min: 9.4 ms
After: Average: 9.2 ms, Min: 7.7 ms
2023-03-27 15:53:34 -04:00
de5ec852f3 Merge branch 'blender-v3.5-release' 2023-03-27 14:52:51 -04:00
ba4442ef41 Fix #105965: Add fur modifier properties missing UI data
Currently assigning values to IDProperties clears their UI data.
That is fixed by #106161, but that is too risky for 3.5. Instead,
work around the issue by triggering `MOD_nodes_update_interface`
function which recreates the UI data of the modifier properties.

Pull Request: blender/blender#106190
2023-03-27 20:51:35 +02:00
59c0e19db2 Geometry: Skip recomputing bounds after translation
Now that mesh primitive nodes calculate their bounds in constant time,
it's worth updating the bounds eagerly when translating a geometry
since doing so should be very cheap and might save a more significant
amount of time if they're needed later.

Also slightly unify the translation functions for the different types.

Pull Request: blender/blender#106159
2023-03-27 20:51:01 +02:00
05a63e3705 OBJ: improve UV values merging in the exporter
Previous code was using BKE_mesh_uv_vert_map_get_vert to somewhat
detect identical UV values on mesh vertices. But this was not
handling the case when separate mesh vertices still use the same UV
values (e.g. cube with all six faces mapped to whole image).

Replace usage of BKE_mesh_uv_vert_map_get_vert with a simple "unique UV
value" map, very similar to how OBJ normals are calculated for export.

Measurements on a somewhat extreme case: exporting "Rungholt" Minecraft
level from https://casual-effects.com/data time (Win10, Ryzen 5950X)
goes 2.9sec -> 2.2sec, and resulting file size 486MB -> 231MB. This
particular model has a lot of mesh faces mapping to the same places
in UV map.

On less extreme cases the timings are similar between old and new
code, with a tiny speedup in most tests I've tried.
2023-03-27 21:39:13 +03:00
8ad0935ed6 Fix #106108: Allow Arrow Increment on Sequence Values
Allow clicking the "up" and "down" arrows to increment/decrement by a
frame for Video Sequencer strip Frame Start, Strip Offset Start, and
Strip Offset End.

Pull Request: blender/blender#106117
2023-03-27 20:26:56 +02:00
2215ee9358 UI: Noto Emoji Font with Unicode 15.0 Updates
Updated version of our monochrome Noto Emoji (variable) font with 31
new emojis that were released as part of Unicode 15.0

Pull Request: blender/blender#106142
2023-03-27 20:05:44 +02:00
bb67d4c298 Transform: expose hardcoded 'Rotate Normals' key
"Rotate Normals" is a changeable operation like any other and does not
need to be hardcoded.

An advantage of exposing this modal is that the shortcut key now
appears in the header when rotating an edited mesh.
2023-03-27 14:38:47 -03:00
040ea1637d Cleanup: deduplicate code that changes transform mode
Avoid calling `restoreTransObjects`, `resetTransModal`,
`resetTransRestrictions` and `initSnapping` for each change.

Also bring `applyMouseInput` close to the rest of the code.
2023-03-27 14:05:59 -03:00
7af13f0ae9 Cleanup: remove unnecessary code
Since `t->values_final` was created, `t->values` is no longer changed
by the mode, so the solution in dfaf26412d is no longer needed.
2023-03-27 14:05:59 -03:00
195c2b77ae Transform: modify constants for improved readability
No functional changes.

The lack of organization in the values of the constants that indicate
the properties was prone to errors.

One error that can be noticed is that the values of
`P_ORIENT_AXIS_ORTHO` and `P_VIEW2D_EDGE_PAN` were the same.
(not really a problem though)
2023-03-27 14:05:59 -03:00
6cfc43fd76 Merge branch 'blender-v3.5-release' 2023-03-27 18:49:43 +02:00
3ea5006416 Updated from SVN trunk (r6409). 2023-03-27 18:49:00 +02:00
2bbb483b5c Merge branch 'blender-v3.5-release' 2023-03-27 19:35:01 +03:00
14efe70004 Fix #106128: OBJ exporter crash when a mesh only has loose vertices
UV attribute refactor in 6c774feb has changed the logic from "UV data does not exist" to "there's no active UV layer". The repro mesh has a UV layer, but not UV data due to the mesh being only a point cloud.

Pull Request: blender/blender#106185
2023-03-27 18:31:53 +02:00
fea567651b Fix building Blender with some versions of gcc.
Seems like quadriflow was missing a header, which somehow made the build
fails on Suse Tumbleweed (gcc 13).
2023-03-27 18:29:39 +02:00
1af3c16962 Cleanup: Use const pointers for evaluated meshes
Helps with the fix to #105912
2023-03-27 11:48:10 -04:00
efda95840d Cleanup: Remove unused variable 2023-03-27 11:42:23 -04:00
0351ce9769 Merge branch 'main' into geometry-nodes-simulation 2023-03-22 11:35:08 +01:00
c4b3e0e0bb Merge branch 'main' into geometry-nodes-simulation 2023-03-21 17:56:34 +01:00
2ddddf6e36 fix simulation zone background color 2023-03-21 16:02:37 +01:00
b652bcbe92 remove use_persistent_cache from simulation output node 2023-03-21 12:38:47 +01:00
8b47a252b1 Merge branch 'main' into geometry-nodes-simulation 2023-03-21 12:25:13 +01:00
d9fb08133a Geometry Nodes: improve simulation zone discovery 2023-03-20 16:59:44 +01:00
753af18573 BLI: improve bit data structures and processing 2023-03-20 16:59:16 +01:00
7b62cc943d fix 2023-03-20 16:25:02 +01:00
e5c63abece Merge branch 'main' into geometry-nodes-simulation 2023-03-20 16:15:08 +01:00
e21afd2f2f Merge branch 'main' into geometry-nodes-simulation 2023-03-16 12:47:11 +01:00
3bad7a51cb Implement simulation nodes as lazy functions directly
Support for multiple sockets will be slightly more complete now too,
but that part hasn't been tested.
2023-03-13 17:29:06 -04:00
ecb91d46a8 Merge branch 'main' into geometry-nodes-simulation 2023-03-13 13:45:05 -04:00
f36dd06609 Add initial infrastructure for multiple simulation state items
- Use dynamic declarations to build simulation node sockets
- Fixes in some node code for futher use of dynamic declarations
- Copying, freeing, reading, and writing of simulation state array
- Add simulation state items with link drag operator

The new sockets won't do anything yet, only geometry sockets are
supported, and there is no way to remove sockets yet.
2023-03-10 16:17:24 -05:00
b2e508f7af Merge branch 'main' into geometry-nodes-simulation 2023-03-10 12:31:50 -05:00
a90f02d5f4 Merge branch 'main' into geometry-nodes-simulation 2023-03-10 11:33:03 -05:00
9241ab1d7c Merge branch 'main' into geometry-nodes-simulation 2023-02-28 11:48:47 -05:00
6f56fee3bb Fixes after merge 2023-02-17 17:44:56 -05:00
9393c2aba9 Merge branch 'main' into geometry-nodes-simulation 2023-02-17 17:09:21 -05:00
508fd044b4 Revert "Fix simulation"
This reverts commit 468f43c7a6.

Revert "Add initial dynamic declarations"

This reverts commit 50a2c77c4e.

Revert "Add initial simulation state items array to output node"

This reverts commit 3f1027567d.
2022-12-19 12:04:46 -06:00
38567bc023 Cleanup: Slightly refactor cancelling link drag operator
Clarify that the dragged links aren't stored in the tree, use a
separate function for cancelling vs. applying the links to the tree.
2022-12-19 12:04:46 -06:00
8fa664fd33 Cleanup: Return early in node link operator, remove useless comments 2022-12-19 12:04:46 -06:00
1b24140d9f Cleanup: Remove redundant information from node link drag struct 2022-12-19 12:04:46 -06:00
aeea690e00 Cleanup: Remove unnecessary node link flag
Links that are currently being dragged are now stored outside
of the node tree, so we don't need a flag to distinguish them
from "proper" links.
2022-12-19 12:04:46 -06:00
6ecb1cb780 Fix: socket tooltip not showing when there was no type conversion 2022-12-19 12:04:46 -06:00
988241e23e Geometry Nodes: simplify handling of invalid group interface sockets
Previously, the code tried to keep node groups working even if some of
their input/output sockets had undefined type. This caused some
complexity with no benefit because not all places outside of this file
would handle the case correctly. Now node groups with undefined
interface sockets are disabled and have to be fixed manually before
they work again.

Undefined interface sockets are mostly caused by invalid Python
API usage and incomplete forward compatibility (e.g. when newer
versions introduce new socket types that the older version does
not know).
2022-12-19 12:04:46 -06:00
a2cee52617 Fix std::optional value() build error on older macOS SDK
Patch from @dupoxy

Differential Revision: https://developer.blender.org/D16796
2022-12-19 12:04:46 -06:00
a0ed3601c9 Fix T103187: Opening node search menu is slow because of assets.
Avoid utility function call that would query the file system, this was a
bottleneck. The path joining was also problematic. See patch for more
details.

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

Reviewed by: Jacques Lucke
2022-12-19 12:04:46 -06:00
8226abc111 Cleanup: Remove duplicate UV islands header
This code was duplicated from `pbvh_uv_islands.hh`,
which was the version that was actually used.
2022-12-19 12:04:46 -06:00
Christophe Hery
807be888a5 Fix: Crash after mesh color attribute name commit
6514bb05ea missed a null check when accessing the active
and default color attribute names, since the CustomData API does not
do that check itself.
2022-12-19 12:04:46 -06:00
f92a85d7d2 Nodes: Add Exclusion color mix mode
Expands Color Mix nodes with new Exclusion mode.

Similar to Difference but produces less contrast.

Requested by Pierre Schiller @3D_director and
@OmarSquircleArt on twitter.

Differential Revision: https://developer.blender.org/D16543
2022-12-19 12:04:46 -06:00
6bd6d7aec7 Fix T103258: Deleting a shader with OptiX OSL results in an illegal address error
Materials without connections to the output node would crash with OSL
in OptiX, since the Cycles `OSLCompiler` generates an empty shader
group reference for them, which resulted in the OptiX device
implementation setting an empty SBT entry for the corresponding direct
callables, which then crashed when calling those direct callables was
attempted in `osl_eval_nodes`. This fixes that by setting the SBT entries
for empty shader groups to a dummy direct callable that does nothing.
2022-12-19 12:04:46 -06:00
cfb77c54b0 Fix T103257: Enabling or disabling viewport denoising while using OptiX OSL results in an error
Switching viewport denoising causes kernels to be reloaded with a new
feature mask, which would destroy the existing OptiX pipelines. But OSL
kernels were not reloaded as well, leaving the shading pipeline
uninitialized and therefore causing an error when it is later attempted to
execute it. This fixes that by ensuring OSL kernels are always reloaded
when the normal kernels are too.
2022-12-19 12:04:46 -06:00
0d18005d2b Cleanup: indentation in CMake files 2022-12-19 12:04:46 -06:00
06525747c0 Build: resolve failure to copy indirect dependencies for USD on Linux
Even when building without OpenImageIO and OpenVDB, USD depends on these
libraries.

Ensure these libraries are copied when building with USD.
2022-12-19 12:04:46 -06:00
74171ff3b0 CMake: warn Linux references old linux_centos7_x86_64 paths
When the centos7 library dir is found, warn when the values of cached
variables reference it, listing the variables and their values.
2022-12-19 12:04:46 -06:00
32a7384c0b Geometry Nodes: improve dot graph export of lazy function graph
* Dim default input values.
* Print default input values instead of type name.
* Add node/socket names to group input/output nodes.
2022-12-19 12:04:46 -06:00
54942e5ea6 Fix T102792: Sculpt cursor jumps to random place
Restrict the condition under which paint cursors read use the cursor
location from the the operating-system.

This caused a glitch when dragging UI elements in painting context
popup. Since the paint cursor would display using mouse motion
which was clamped to the window center - an internal detail of hidden
cursor grabbing.

Now only read the cursor coordinates when clamped to a region which
is used for the transform cursor to stay visible even when the cursor
wraps around.
2022-12-19 12:04:46 -06:00
5d1ed47d6c Fix T103253: Infinite drag of number buttons is broken on WIN32
Recent reverting of changes to cursor grabbing intended to match
Blender 3.3 release. This is the case for 3.4x branch, however there is
an additional change to grabbing on WIN32 by Germano [0] which is a
significant improvement on old grabbing logic for Windows.
So instead of matching 3.3x behavior, restore logic that keeps
the cursor centered while grabbing & hidden.

This re-introduces T102792 issue displaying the paint-brush while
dragging buttons, this will have to be solved separately.

Re-apply [1] & [2], revert [3] & [4].

[4]: a3a9459050
[0]: 9fd6dae793
[1]: 4cac8025f0
[2]: 230744d6fd
[3]: 0240b89599
2022-12-19 12:04:46 -06:00
bb8cbf0c10 UI: don't change mouse cursor while it's grabbed
The paint cursor was continuously set which meant hiding the cursor
while interacting with buttons would immediately show it again.

This exposed cursor warping.
2022-12-19 12:04:22 -06:00
b3386868fe Build: correct extension type for SNDFILE 2022-12-19 12:04:22 -06:00
c9bd78890a Build: remove opus workaround for sndfile
For some reason SNDFILE now builds without this workaround,
which broke building FFMPEG.
2022-12-19 12:04:22 -06:00
a12614d166 Fix T102923: replace zero check with epsilons with uv constrain to bounds
Small roundoff errors during UV editing can sometimes occur, most likely
due to so-called "catastrophic cancellation".

Here we set a tolerance around zero when using Constrain-To-Bounds and UV Scaling.

The tolerance is set at one quarter of a texel, on a 65536 x 65536 texture.

TODO: If this fix holds, we should formalize the tolerance into the UV editing
subsystem, perhaps as a helper function, and investigate where else it needs
to be applied.

Differential Revision: https://developer.blender.org/D16702
2022-12-19 12:04:22 -06:00
0403d77a0f Fix T103237: Prevent UV Unwrap from packing hidden UV islands
When migrating to the new packing API, pin_unselected was not
implemented correctly.

Regression from rB143e74c0b8eb, rBe3075f3cf7ce, rB0ce18561bc82.

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

Reviewed By: Campbell Barton

Duplicated in blender-v3.4-release as rB3dcd9992676a
2022-12-19 12:04:22 -06:00
fe7a0ebce4 Cleanup: format 2022-12-19 12:04:22 -06:00
af7c34716b Fix active/default color names not being editable
Revert [0] and enable the editable flag as the intent for [1] was that
these values would be editable.

[0]: e58f5422c3
[1]: 6514bb05ea
2022-12-19 12:04:22 -06:00
Damien Picard
34f307547b Fix T103183: UV map name of mesh converted from curve is untranslated
Upon conversion, the newly-created UV map with default name "UVMap"
should be translated.

Reviewed By: mont29

Maniphest Tasks: T103183

Differential Revision: https://developer.blender.org/D16775
2022-12-19 12:04:22 -06:00
bb9b2b556f Cleanup: remove unused active name set callback functions 2022-12-19 12:04:22 -06:00
a3a132ea74 Build: upgrade pre-built libraries for Linux
Replace ../lib/linux_centos7_x86_64 with ../lib/linux_x86_64_glibc_228,
built with Rocky8 Linux, compatible with the VFX platform CY2023,
see: T99618.

- Update build-bot configuration.
- Remove unnecessary check for Blosc, this is part of OpenVDB lib now.
- Remove WITH_CXX11_ABI, always use new C++11 ABI now
- Replace centos7 by glibc_228 everywhere

Note that existing builds with cached paths pointing to
"../lib/linux_centos7_x86_64" will need to be updated.

Includes contributions by Brecht.
2022-12-19 12:04:21 -06:00
ac59dfeffd Fix T103049: Cycles specular light leak regression
The logic here is not ideal but was unintentionally changed in refactoring
for path guiding, now restore it back to 3.3 behavior again.
2022-12-19 12:04:21 -06:00
24523726d7 Mesh: Store active & default color attributes with strings
Attributes are unifying around a name-based API, and we would like to
be able to move away from CustomData in the future. This patch moves
the identification of active and fallback (render) color attributes
to strings on the mesh from flags on CustomDataLayer. This also
removes some ugliness used to retrieve these attributes and maintain
the active status.

The design is described more here: T98366

The patch keeps forward compatibility working until 4.0 with
the same method as the mesh struct of array refactors (T95965).

The strings are allowed to not correspond to an attribute, to allow
setting the active/default attribute independently of actually filling
its data. When applying a modifier, if the strings don't match an
attribute, they will be removed.

The realize instances / join node and join operator take the names from
the first / active input mesh. While other heuristics may be helpful
(and could be a future improvement), just using the first is simple
and predictable.

Differential Revision: https://developer.blender.org/D15169
2022-12-19 12:04:21 -06:00
20cab8f8f2 Geometry Nodes: Add error message when applying modifier with no mesh
If the resulting geometry from applying a geometry nodes modifier
contains no mesh, give an error message. This gives people something to
search and makes the behavior more purposeful.

Also remove the `modifyMesh` implementation from the geometry nodes
modifier, since it isn't necessary anymore. And remove the existing
"Modifier returned error, skipping apply" message which was cryptic
and redundant if applying returns an actual error message.

Resolves T103229

Differential Revision: https://developer.blender.org/D16782
2022-12-19 12:04:21 -06:00
f9b621a9d9 Nodes: Allow skipping node attachment after dragging
This patch allows skipping the automatic insertion of nodes on top of
links when the transform operator ends. When putting nodes into small
spaces this often gets in the way and wastes time. Now, when holding
`alt`, this is turned off.

The header text is also improved to add this shortcut and to remove
the Dx and Dy values and improve the formatting a bit.

Making this functionality optional might allow us to use it in more
places in the future, like for the nodes added by link-drag-search.

Differential Revision: https://developer.blender.org/D16230
2022-12-19 12:04:21 -06:00
Iliya Katueshenock
f1b16f3ceb Fix: ignore unavailable sockets linked to multi-input socket
Differential Revision: https://developer.blender.org/D16784
2022-12-19 12:04:21 -06:00
cc9d9c7724 Fix make deps harvest error on Linux, due to macOS specific folder in Vulkan 2022-12-19 12:04:21 -06:00
f1f2ff1116 Fix T103170: missing Cycles viewport light threshold update after exposure edit 2022-12-19 12:04:21 -06:00
6b26b0db21 Fix build issue with NanoVDB and HIP on Linux
This patch was already accepted upstream, so this is temporary until we update
to a new OpenVDB release that includes it.
2022-12-19 12:04:21 -06:00
8848cfdf4b Cleanup: fix warning 2022-12-19 12:04:21 -06:00
e50d567c97 Cleanup: Various improvements to modifier apply operator
Use C++ casts, decrease variable scope, use references, use const.
2022-12-19 12:04:21 -06:00
496e344015 Cleanup: Move mesh modifier apply function to editors module
The function was highly related to the apply modifier operator,
and only used once. This was too specific to be in the blenkernel,
especially in a mesh conversion file.
2022-12-19 12:04:21 -06:00
c30718ded9 cmake/win: Allow running blender_test from the VS debugger
This was missing some paths setup in the environment, ctest
normally sets this up before running the tests from the CLI
but that does not help the IDE all that much.
2022-12-19 12:04:21 -06:00
1965e31d17 Fix T101130: Scaling of NLA Strip Via S Hotkey Not Working
After switching over to using start_frame / end_frame, scaling an NLA strip didn't scale the strip, it just repeated the action.

Now withing the NLA transform code, we look for TFM_TIME_EXTEND / TFM_TIME_SCALE transform mode, and handle the update to strip scale accordingly
2022-12-19 12:04:21 -06:00
5e384860a6 Merge branch 'master' into geometry-nodes-simulation 2022-12-15 13:29:14 +01:00
468f43c7a6 Fix simulation 2022-12-14 16:42:48 -06:00
50a2c77c4e Add initial dynamic declarations 2022-12-14 16:02:43 -06:00
c82b1aa1c0 Merge branch 'master' into geometry-nodes-simulation 2022-12-14 14:41:42 -06:00
3f1027567d Add initial simulation state items array to output node 2022-12-14 14:34:20 -06:00
ab8d77359b Merge branch 'master' into geometry-nodes-simulation 2022-12-14 14:02:15 -06:00
3ef95d7f19 add theme color for simulation region 2022-12-13 11:44:14 +01:00
02a264f5ab Merge branch 'master' into geometry-nodes-simulation 2022-12-13 11:15:20 +01:00
2525c1c023 Add initial "Extend" socket. Doesn't do anything yet 2022-12-10 15:12:17 -06:00
620b190e52 Fix delta time output
Output time in seconds rather than frame units
2022-12-10 14:07:09 -06:00
657ffe9aa7 Fix: Simulation resets when playback stops 2022-12-10 14:06:32 -06:00
3fcf50d37a Make the simulation always run, remove run socket
Note: Still unstable. Simulation resets when playback stops bug.

Since the "Run" behavior can basically be implemented with the switch
node already, it's just adding unnecessary complexity to the interface
now, when it's use case isn't clear. We decided to remove it for now,
and only consider it later as a possible convenience feature, rather
than an essential part of the design.

Also, the simulation nodes are now considered "side effect nodes"
for the evaluator, meaning they are *always* evaluated, even if they
aren't needed because of switch nodes, etc. This was the best way
we thought of to make simulations run consistently even through
situations like that.
2022-12-10 00:01:20 -06:00
49e8218edf Remove Started and Ended booleans
These aren't theoretically necessary, since you can just created them
as regular outputs. Maybe we will eventually add them back for
convenience, but that's not clear.
2022-12-09 18:31:07 -06:00
94e6f87ebc Remove "Persistent Cache" option from the UI
I will keep it internally, but for the simulation MVP we want to focus
on the most basic "last frame's cache" features at first.
2022-12-09 17:12:12 -06:00
3dcb437d5c Remove elapsed time sockets
Since this is theoretically redundant with simulating a float
with the delta time value, we decided to remove it for now to
make the whole interface simpler.
2022-12-09 17:11:05 -06:00
ffe0db184a Merge branch 'master' into geometry-nodes-simulation 2022-12-09 17:05:29 -06:00
8648cf4717 Merge branch 'master' into geometry-nodes-simulation 2022-12-09 15:23:58 -06:00
c9958c8e9f Basics of temporary and persistent cache working again
Edge cases not really tested still though
2022-12-08 00:06:35 -06:00
24e2d08b49 Merge branch 'master' into geometry-nodes-simulation 2022-12-07 16:29:07 -06:00
bb732c240d Half finished refactoring to simulation cache
- Cache is accessed with a string identifier, allowing multiple sockets in the future
- Cache is meant to be stored in a simple array, not sparsely like before
- Persistent cache and temporary "last run" cache are separated more clearly
- Use a "Time Point" class instead of integers, to maybe clarify adding subframe support in the future
- Use a different "sim" namespace (not sure if that will last)
- The value from the last frame is moved, to avoid a copy when no persistent cache is used

I don't think this works now, at least I haven't tested it.
2022-12-04 15:06:28 -06:00
850aa3d26a Allow multiple caches in the same node group
The caches now hash the identifier of the output node as well.
2022-12-02 16:13:18 -06:00
1ba264d5f0 Be more forgiving when simulation nodes lost their storage 2022-12-02 16:06:03 -06:00
92a1234830 Add hint to add simulation output node first
Until we can add both nodes at the same time, or we find
an improve simulation to link the two nodes
2022-12-02 15:49:11 -06:00
afe5d0b9f2 Merge branch 'master' into geometry-nodes-simulation 2022-12-02 14:48:03 -06:00
cff291d1f3 Merge branch 'master' into geometry-nodes-simulation 2022-12-02 14:32:09 -06:00
bbcdca1378 Merge branch 'master' into geometry-nodes-simulation 2022-12-02 11:24:32 -06:00
a0caa03942 Merge branch 'master' into geometry-nodes-simulation 2022-12-02 09:17:54 -06:00
7469e19446 Add basic UI support for multiple simulations in a group
Just allows multiple simulation "frames"/regions/contexts to be drawn
in the editor, doesn't include any changes to caching yet.
2022-12-01 19:49:05 -06:00
0019d6cc8f Fix property name for node UI 2022-12-01 18:11:11 -06:00
e9c3e4f14e Merge branch 'master' into geometry-nodes-simulation 2022-12-01 17:57:14 -06:00
bdd71c129c Set "Run" input default to true 2022-12-01 16:34:50 -06:00
18b2ec1963 Rename "Use Cache" to "Persistent Cache"
This is a temporary option anyway, the caches will be controlled in a
more unified place at the object or scene level. But for now the name
can be a bit better anyway.
2022-12-01 16:32:01 -06:00
97df619be7 Move "Run" input to simulation output node
It's the output node that decides whether to requiest the values
from the nodes inside the simulation, so it makes more sense
for it to be there. This is part of a general effort to have less
redundancy in the options.
2022-12-01 16:30:46 -06:00
3059f1743e Merge branch 'master' into geometry-nodes-simulation 2022-12-01 15:45:46 -06:00
4726803e85 Fixed typo in Simulation Input node
"Delta Time" was set instead of "Elapsed Time" output.
2022-11-30 23:35:48 +01:00
fa277178e8 Merge branch 'master' into geometry-nodes-simulation 2022-11-26 13:51:16 +01:00
7cf192956b Move simulation input/output node a bit more into the convex frame 2022-11-25 12:04:04 +01:00
f7cf6e957d Merge branch 'master' into geometry-nodes-simulation 2022-11-25 11:20:53 +01:00
b5ea0d2f41 Add frame around nodes in simulation 2022-11-24 16:35:40 +01:00
c2a632cd41 Basic working simulation and in-memory caching 2022-11-23 17:19:25 -06:00
7ad2b93ec4 More semi-working sockets, lazyness, more TODOs, RNA 2022-11-23 16:02:39 -06:00
6d930d0b4a Merge branch 'master' into geometry-nodes-simulation 2022-11-23 12:04:46 -06:00
f55f2b5ff4 Add some input sockets 2022-11-22 21:57:06 -06:00
5aaa435ac7 Simulation output and input nodes 2022-11-22 18:23:26 -06:00
3305 changed files with 103167 additions and 51242 deletions

View File

@@ -130,7 +130,7 @@ PenaltyReturnTypeOnItsOwnLine: 10000
#
PenaltyBreakAssignment: 100
AllowShortFunctionsOnASingleLine: None
AllowShortFunctionsOnASingleLine: Empty
SortIncludes: true

View File

@@ -15,6 +15,7 @@ body:
* Test [daily builds](https://builder.blender.org/) to verify if the issue is already fixed.
* Test [previous versions](https://download.blender.org/release/) to find an older working version.
* For feature requests, feedback, questions or build issues, see [communication channels](https://wiki.blender.org/wiki/Communication/Contact#User_Feedback_and_Requests).
* Security vulnerabilities should be [reported privately](https://wiki.blender.org/wiki/Process/Vulnerability_Reports).
* If there are multiple bugs, make multiple bug reports.
- type: textarea

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2006 Blender Foundation. All rights reserved.
# Copyright 2006 Blender Foundation
# -----------------------------------------------------------------------------
# Early Initialization
@@ -164,7 +164,7 @@ get_blender_version()
# Declare Options
# Blender internal features
option(WITH_BLENDER "Build blender (disable to build only the blender player)" ON)
option(WITH_BLENDER "Build blender (disable to build only Cycles stand-alone)." ON)
mark_as_advanced(WITH_BLENDER)
if(WIN32)
@@ -333,10 +333,7 @@ option(WITH_MOD_OCEANSIM "Enable Ocean Modifier" ON)
# Image format support
option(WITH_IMAGE_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" ON)
option(WITH_IMAGE_OPENJPEG "Enable OpenJpeg Support (http://www.openjpeg.org)" ON)
option(WITH_IMAGE_TIFF "Enable LibTIFF Support" ON)
option(WITH_IMAGE_DDS "Enable DDS Image Support" ON)
option(WITH_IMAGE_CINEON "Enable CINEON and DPX Image Support" ON)
option(WITH_IMAGE_HDR "Enable HDR Image Support" ON)
option(WITH_IMAGE_WEBP "Enable WebP Image Support" ON)
# Audio/Video format support
@@ -524,7 +521,8 @@ 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)
endif()
@@ -648,15 +646,15 @@ if(WIN32)
endif()
# Compiler tool-chain.
if(UNIX AND NOT APPLE)
if(UNIX)
if(CMAKE_COMPILER_IS_GNUCC)
option(WITH_LINKER_GOLD "Use ld.gold linker which is usually faster than ld.bfd" ON)
mark_as_advanced(WITH_LINKER_GOLD)
option(WITH_LINKER_LLD "Use ld.lld linker which is usually faster than ld.gold" OFF)
mark_as_advanced(WITH_LINKER_LLD)
endif()
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
option(WITH_LINKER_MOLD "Use ld.mold linker which is usually faster than ld.gold & ld.lld." OFF)
option(WITH_LINKER_LLD "Use ld.lld linker which is usually faster than ld.gold" OFF)
mark_as_advanced(WITH_LINKER_LLD)
option(WITH_LINKER_MOLD "Use ld.mold linker which is usually faster than ld.gold & ld.lld. Needs \"sold\" subscription on macOS." OFF)
mark_as_advanced(WITH_LINKER_MOLD)
endif()
endif()
@@ -693,8 +691,10 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
else()
string(APPEND _asan_defaults " -fsanitize=object-size")
endif()
else()
elseif(CMAKE_COMPILER_IS_GNUCC)
string(APPEND _asan_defaults " -fsanitize=leak -fsanitize=object-size")
else()
string(APPEND _asan_defaults " -fsanitize=leak")
endif()
set(COMPILER_ASAN_CFLAGS "${_asan_defaults}" CACHE STRING "C flags for address sanitizer")
@@ -711,6 +711,7 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\LLVM\\LLVM;]/lib/clang/7.0.0/lib/windows
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\LLVM\\LLVM;]/lib/clang/6.0.0/lib/windows
)
mark_as_advanced(COMPILER_ASAN_LIBRARY)
elseif(APPLE)
execute_process(COMMAND ${CMAKE_CXX_COMPILER}
-print-file-name=lib
@@ -725,13 +726,14 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
"${CLANG_LIB_DIR}/darwin/"
)
unset(CLANG_LIB_DIR)
else()
mark_as_advanced(COMPILER_ASAN_LIBRARY)
elseif(CMAKE_COMPILER_IS_GNUCC)
find_library(
COMPILER_ASAN_LIBRARY asan ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}
)
mark_as_advanced(COMPILER_ASAN_LIBRARY)
endif()
mark_as_advanced(COMPILER_ASAN_LIBRARY)
endif()
endif()
@@ -886,11 +888,11 @@ set_and_warn_dependency(WITH_TBB WITH_MOD_FLUID OFF)
# NanoVDB requires OpenVDB to convert the data structure
set_and_warn_dependency(WITH_OPENVDB WITH_NANOVDB OFF)
# OpenVDB and OpenColorIO uses 'half' type from OpenEXR
# OpenVDB, Alembic and Vulkan, OSL uses 'half' or 'imath' from OpenEXR
set_and_warn_dependency(WITH_IMAGE_OPENEXR WITH_OPENVDB OFF)
# Haru needs `TIFFFaxBlackCodes` & `TIFFFaxWhiteCodes` symbols from TIFF.
set_and_warn_dependency(WITH_IMAGE_TIFF WITH_HARU OFF)
set_and_warn_dependency(WITH_IMAGE_OPENEXR WITH_ALEMBIC OFF)
set_and_warn_dependency(WITH_IMAGE_OPENEXR WITH_VULKAN_BACKEND OFF)
set_and_warn_dependency(WITH_IMAGE_OPENEXR WITH_CYCLES_OSL OFF)
# auto enable openimageio for cycles
if(WITH_CYCLES)
@@ -1579,6 +1581,8 @@ 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_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)
@@ -1592,6 +1596,7 @@ 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)
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
@@ -1934,11 +1939,8 @@ if(FIRST_RUN)
info_cfg_text("Image Formats:")
info_cfg_option(WITH_IMAGE_CINEON)
info_cfg_option(WITH_IMAGE_DDS)
info_cfg_option(WITH_IMAGE_HDR)
info_cfg_option(WITH_IMAGE_OPENEXR)
info_cfg_option(WITH_IMAGE_OPENJPEG)
info_cfg_option(WITH_IMAGE_TIFF)
info_cfg_text("Audio:")
info_cfg_option(WITH_CODEC_AVI)

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,19 @@ 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
)
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,18 +3,29 @@
# 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
-DEMBREE_STATIC_LIB=ON
-DEMBREE_STATIC_LIB=OFF
-DEMBREE_RAY_MASK=ON
-DEMBREE_FILTER_FUNCTION=ON
-DEMBREE_BACKFACE_CULLING=OFF
-DEMBREE_BACKFACE_CULLING_CURVES=ON
-DEMBREE_BACKFACE_CULLING_SPHERES=ON
-DEMBREE_TASKING_SYSTEM=TBB
-DEMBREE_TBB_ROOT=${LIBDIR}/tbb
-DTBB_ROOT=${LIBDIR}/tbb
)
if(WIN32)
set(EMBREE_EXTRA_ARGS
${EMBREE_EXTRA_ARGS}
-DCMAKE_DEBUG_POSTFIX=_d
)
endif()
if(NOT BLENDER_PLATFORM_ARM)
set(EMBREE_EXTRA_ARGS
${EMBREE_EXTRA_ARGS}
@@ -22,6 +33,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}
@@ -33,37 +81,41 @@ 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(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_embree after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/embree ${HARVEST_TARGET}/embree
DEPENDEES install
)
else()
ExternalProject_Add_Step(external_embree after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree3.lib ${HARVEST_TARGET}/embree/lib/embree3_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree_avx.lib ${HARVEST_TARGET}/embree/lib/embree_avx_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree_avx2.lib ${HARVEST_TARGET}/embree/lib/embree_avx2_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree_sse42.lib ${HARVEST_TARGET}/embree/lib/embree_sse42_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/lexers.lib ${HARVEST_TARGET}/embree/lib/lexers_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/math.lib ${HARVEST_TARGET}/embree/lib/math_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/simd.lib ${HARVEST_TARGET}/embree/lib/simd_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/sys.lib ${HARVEST_TARGET}/embree/lib/sys_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/tasking.lib ${HARVEST_TARGET}/embree/lib/tasking_d.lib
DEPENDEES install
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)
ExternalProject_Add_Step(external_embree after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/embree/include ${HARVEST_TARGET}/embree/include
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/embree/lib ${HARVEST_TARGET}/embree/lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/embree/share ${HARVEST_TARGET}/embree/share
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/bin/embree4.dll ${HARVEST_TARGET}/embree/bin/embree4.dll
DEPENDEES install
)
else()
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()
endif()

View File

@@ -218,6 +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(openpgl/include openpgl/include "*.h")
harvest(openpgl/lib openpgl/lib "*.a")
harvest(openpgl/lib/cmake/openpgl-${OPENPGL_SHORT_VERSION} openpgl/lib/cmake/openpgl "*.cmake")

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

@@ -478,9 +478,9 @@ 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 3.13.4)
set(EMBREE_VERSION 4.0.1)
set(EMBREE_URI https://github.com/embree/embree/archive/v${EMBREE_VERSION}.zip)
set(EMBREE_HASH 52d0be294d6c88ba7a6c9e046796e7be)
set(EMBREE_HASH dd26617719a587e126b341d1b32f7fd0)
set(EMBREE_HASH_TYPE MD5)
set(EMBREE_FILE embree-v${EMBREE_VERSION}.zip)
@@ -528,16 +528,16 @@ set(XR_OPENXR_SDK_HASH a2623ebab3d0b340bc16311b14f02075)
set(XR_OPENXR_SDK_HASH_TYPE MD5)
set(XR_OPENXR_SDK_FILE OpenXR-SDK-${XR_OPENXR_SDK_VERSION}.tar.gz)
set(WL_PROTOCOLS_VERSION 1.21)
set(WL_PROTOCOLS_VERSION 1.31)
set(WL_PROTOCOLS_FILE wayland-protocols-${WL_PROTOCOLS_VERSION}.tar.gz)
set(WL_PROTOCOLS_URI https://gitlab.freedesktop.org/wayland/wayland-protocols/-/archive/${WL_PROTOCOLS_VERSION}/${WL_PROTOCOLS_FILE})
set(WL_PROTOCOLS_HASH af5ca07e13517cdbab33504492cef54a)
set(WL_PROTOCOLS_HASH a28ff59a56e2ebb746048b6ef8d931d6)
set(WL_PROTOCOLS_HASH_TYPE MD5)
set(WAYLAND_VERSION 1.21.0)
set(WAYLAND_VERSION 1.22.0)
set(WAYLAND_FILE wayland-${WAYLAND_VERSION}.tar.xz)
set(WAYLAND_URI https://gitlab.freedesktop.org/wayland/wayland/-/releases/1.21.0/downloads/wayland-${WAYLAND_VERSION}.tar.xz)
set(WAYLAND_HASH f2653a2293bcd882d756c6a83d278903)
set(WAYLAND_URI https://gitlab.freedesktop.org/wayland/wayland/-/releases/${WAYLAND_VERSION}/downloads/wayland-${WAYLAND_VERSION}.tar.xz)
set(WAYLAND_HASH 7410ab549e3928fce9381455b17b0803)
set(WAYLAND_HASH_TYPE MD5)
set(WAYLAND_LIBDECOR_VERSION 0.1.0)
@@ -599,15 +599,15 @@ set(OPENPGL_HASH db63f5dac5cfa8c110ede241f0c413f00db0c4748697381c4fa23e0f9e82a75
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 +620,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 +657,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 +737,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;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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

@@ -1,19 +1,8 @@
diff -Naur org/kernels/rtcore_config.h.in embree-3.13.4/kernels/rtcore_config.h.in
--- org/kernels/rtcore_config.h.in 2022-06-14 22:13:52 -0600
+++ embree-3.13.4/kernels/rtcore_config.h.in 2022-06-24 15:20:12 -0600
@@ -14,6 +14,7 @@
#cmakedefine01 EMBREE_MIN_WIDTH
#define RTC_MIN_WIDTH EMBREE_MIN_WIDTH
+#cmakedefine EMBREE_STATIC_LIB
#cmakedefine EMBREE_API_NAMESPACE
#if defined(EMBREE_API_NAMESPACE)
diff --git a/kernels/CMakeLists.txt b/kernels/CMakeLists.txt
index 7c2f43d..106b1d5 100644
--- a/kernels/CMakeLists.txt
+++ b/kernels/CMakeLists.txt
@@ -201,6 +201,12 @@ embree_files(EMBREE_LIBRARY_FILES_AVX512 ${AVX512})
@@ -208,6 +208,12 @@ embree_files(EMBREE_LIBRARY_FILES_AVX512 ${AVX512})
#message("AVX2: ${EMBREE_LIBRARY_FILES_AVX2}")
#message("AVX512: ${EMBREE_LIBRARY_FILES_AVX512}")
@@ -26,7 +15,7 @@ index 7c2f43d..106b1d5 100644
# replaces all .cpp files with a dummy file that includes that .cpp file
# this is to work around an ICC name mangling issue related to lambda functions under windows
MACRO (CreateISADummyFiles list isa)
@@ -277,7 +283,7 @@ IF (EMBREE_ISA_AVX AND EMBREE_LIBRARY_FILES_AVX)
@@ -311,7 +317,7 @@ IF (EMBREE_ISA_AVX AND EMBREE_LIBRARY_FILES_AVX)
ENDIF()
ENDIF()
@@ -35,3 +24,144 @@ 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;
}
};
diff -ruN a/kernels/sycl/rthwif_embree_builder.cpp b/kernels/sycl/rthwif_embree_builder.cpp
--- a/kernels/sycl/rthwif_embree_builder.cpp 2023-03-28 17:23:06.429190200 +0200
+++ b/kernels/sycl/rthwif_embree_builder.cpp 2023-03-28 17:35:01.291938600 +0200
@@ -540,7 +540,12 @@
assert(offset <= geomDescrData.size());
}
+ /* Force running BVH building sequentially from the calling thread if using TBB < 2021, as it otherwise leads to runtime issues. */
+#if TBB_VERSION_MAJOR<2021
+ RTHWIF_PARALLEL_OPERATION parallelOperation = nullptr;
+#else
RTHWIF_PARALLEL_OPERATION parallelOperation = rthwifNewParallelOperation();
+#endif
/* estimate static accel size */
BBox1f time_range(0,1);

View File

@@ -23,6 +23,7 @@ SET(_embree_SEARCH_DIRS
FIND_PATH(EMBREE_INCLUDE_DIR
NAMES
embree4/rtcore.h
embree3/rtcore.h
HINTS
${_embree_SEARCH_DIRS}
@@ -30,28 +31,67 @@ FIND_PATH(EMBREE_INCLUDE_DIR
include
)
IF(NOT (("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64") OR (APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64"))))
SET(_embree_SIMD_COMPONENTS
embree_sse42
embree_avx
embree_avx2
)
IF(EXISTS ${EMBREE_INCLUDE_DIR}/embree4/rtcore_config.h)
SET(EMBREE_MAJOR_VERSION 4)
ELSE()
SET(EMBREE_MAJOR_VERSION 3)
ENDIF()
SET(_embree_FIND_COMPONENTS
embree3
${_embree_SIMD_COMPONENTS}
lexers
math
simd
sys
tasking
)
IF(EMBREE_INCLUDE_DIR)
FILE(READ ${EMBREE_INCLUDE_DIR}/embree${EMBREE_MAJOR_VERSION}/rtcore_config.h _embree_config_header)
IF(_embree_config_header MATCHES "#define EMBREE_STATIC_LIB")
SET(EMBREE_STATIC_LIB TRUE)
ELSE()
SET(EMBREE_STATIC_LIB FALSE)
ENDIF()
IF(_embree_config_header MATCHES "#define EMBREE_SYCL_SUPPORT")
SET(EMBREE_SYCL_SUPPORT TRUE)
ELSE()
SET(EMBREE_SYCL_SUPPORT FALSE)
ENDIF()
UNSET(_embree_config_header)
ENDIF()
IF(EMBREE_STATIC_LIB)
IF(NOT (("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64") OR (APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64"))))
SET(_embree_SIMD_COMPONENTS
embree_sse42
embree_avx
embree_avx2
)
ENDIF()
IF(EMBREE_SYCL_SUPPORT)
SET(_embree_GPU_COMPONENTS
embree4_sycl
embree_rthwif
)
ENDIF()
SET(_embree_FIND_COMPONENTS
embree${EMBREE_MAJOR_VERSION}
${_embree_SIMD_COMPONENTS}
${_embree_GPU_COMPONENTS}
lexers
math
simd
sys
tasking
)
ELSE()
SET(_embree_FIND_COMPONENTS
embree${EMBREE_MAJOR_VERSION}
)
IF(EMBREE_SYCL_SUPPORT)
LIST(APPEND _embree_FIND_COMPONENTS
embree4_sycl
)
ENDIF()
ENDIF()
SET(_embree_LIBRARIES)
FOREACH(COMPONENT ${_embree_FIND_COMPONENTS})
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
FIND_LIBRARY(EMBREE_${UPPERCOMPONENT}_LIBRARY
NAMES
${COMPONENT}
@@ -60,18 +100,9 @@ FOREACH(COMPONENT ${_embree_FIND_COMPONENTS})
PATH_SUFFIXES
lib64 lib
)
IF(NOT EMBREE_${UPPERCOMPONENT}_LIBRARY)
IF(EMBREE_EMBREE3_LIBRARY)
# If we can't find all the static libraries, try to fall back to the shared library if found.
# This allows building with a shared embree library
SET(_embree_LIBRARIES ${EMBREE_EMBREE3_LIBRARY})
BREAK()
ENDIF()
ENDIF()
LIST(APPEND _embree_LIBRARIES "${EMBREE_${UPPERCOMPONENT}_LIBRARY}")
ENDFOREACH()
# handle the QUIETLY and REQUIRED arguments and set EMBREE_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
@@ -85,6 +116,9 @@ ENDIF()
MARK_AS_ADVANCED(
EMBREE_INCLUDE_DIR
EMBREE_MAJOR_VERSION
EMBREE_SYCL_SUPPORT
EMBREE_STATIC_LIB
)
FOREACH(COMPONENT ${_embree_FIND_COMPONENTS})

View File

@@ -37,18 +37,24 @@ elseif(HIP_HIPCC_EXECUTABLE)
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}")
HIP_SEMANTIC_VERSION "${_hip_version_raw}")
string(REPLACE "." ";" HIP_VERSION_PARTS "${HIP_SEMANTIC_VERSION}")
list(LENGTH HIP_VERSION_PARTS NUM_HIP_VERSION_PARTS)
@@ -71,7 +77,13 @@ elseif(HIP_HIPCC_EXECUTABLE)
# Construct full semantic version.
set(HIP_VERSION "${HIP_VERSION_MAJOR}.${HIP_VERSION_MINOR}.${HIP_VERSION_PATCH}")
unset(HIP_VERSION_RAW)
unset(_hip_version_raw)
unset(_hipcc_executable)
else()
set(HIP_FOUND FALSE)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(HIP
REQUIRED_VARS HIP_HIPCC_EXECUTABLE
VERSION_VAR HIP_VERSION)

View File

@@ -120,9 +120,8 @@ UNSET(_openexr_libs_ver)
IF(OPENEXR_VERSION VERSION_GREATER_EQUAL "3.0.0")
# For OpenEXR 3.x, we also need to find the now separate Imath library.
# For simplicity we add it to the OpenEXR includes and libraries, as we
# have no direct dependency on Imath and it's simpler to support both
# 2.x and 3.x this way.
# For simplicity we also add it to the OpenEXR includes and libraries,
# as it's simpler to support both 2.x and 3.x this way.
# Find include directory
FIND_PATH(IMATH_INCLUDE_DIR
@@ -169,6 +168,12 @@ IF(OPENEXR_VERSION VERSION_GREATER_EQUAL "3.0.0")
UNSET(_imath_build_specification)
ENDIF()
IF(OPENEXR_VERSION VERSION_GREATER_EQUAL "3.0.0")
SET(IMATH_LIBRARIES ${IMATH_LIBRARY})
ELSE()
SET(IMATH_LIBRARIES ${OPENEXR_IMATH_LIBRARY})
ENDIF()
# handle the QUIETLY and REQUIRED arguments and set OPENEXR_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
@@ -196,6 +201,7 @@ MARK_AS_ADVANCED(
OPENEXR_VERSION
IMATH_INCLUDE_DIR
IMATH_LIBRARY
IMATH_LIBRARIES
)
FOREACH(COMPONENT ${_openexr_FIND_COMPONENTS})
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)

View File

@@ -108,6 +108,11 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(SYCL
IF(SYCL_FOUND)
SET(SYCL_INCLUDE_DIR ${SYCL_INCLUDE_DIR} ${SYCL_INCLUDE_DIR}/sycl)
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

@@ -26,11 +26,8 @@ set(WITH_HARU ON CACHE BOOL "" FORCE)
set(WITH_IK_ITASC ON CACHE BOOL "" FORCE)
set(WITH_IK_SOLVER ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_CINEON ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_DDS ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_HDR ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENEXR ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENJPEG ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_TIFF ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_WEBP ON CACHE BOOL "" FORCE)
set(WITH_INPUT_NDOF ON CACHE BOOL "" FORCE)
set(WITH_INPUT_IME ON CACHE BOOL "" FORCE)

View File

@@ -27,11 +27,8 @@ set(WITH_HARU OFF CACHE BOOL "" FORCE)
set(WITH_IK_ITASC OFF CACHE BOOL "" FORCE)
set(WITH_IK_SOLVER OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_CINEON OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_DDS OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_HDR OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENEXR OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENJPEG OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_TIFF OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_WEBP OFF CACHE BOOL "" FORCE)
set(WITH_INPUT_IME OFF CACHE BOOL "" FORCE)
set(WITH_INPUT_NDOF OFF CACHE BOOL "" FORCE)

View File

@@ -27,11 +27,8 @@ set(WITH_HARU ON CACHE BOOL "" FORCE)
set(WITH_IK_ITASC ON CACHE BOOL "" FORCE)
set(WITH_IK_SOLVER ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_CINEON ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_DDS ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_HDR ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENEXR ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENJPEG ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_TIFF ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_WEBP ON CACHE BOOL "" FORCE)
set(WITH_INPUT_NDOF ON CACHE BOOL "" FORCE)
set(WITH_INPUT_IME ON CACHE BOOL "" FORCE)
@@ -85,7 +82,7 @@ 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()

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2022 Blender Foundation. All rights reserved.
# Copyright 2022 Blender Foundation
# This file is used to test the system for headers & symbols.
# Variables should use the `HAVE_` prefix.

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2006 Blender Foundation. All rights reserved.
# Copyright 2006 Blender Foundation
macro(list_insert_after
list_id item_check item_add
@@ -1300,16 +1300,29 @@ macro(windows_install_shared_manifest)
endif()
if(WINDOWS_INSTALL_DEBUG)
set(WINDOWS_CONFIGURATIONS "${WINDOWS_CONFIGURATIONS};Debug")
list(APPEND WINDOWS_SHARED_MANIFEST_DEBUG ${WINDOWS_INSTALL_FILES})
endif()
if(WINDOWS_INSTALL_RELEASE)
list(APPEND WINDOWS_SHARED_MANIFEST_RELEASE ${WINDOWS_INSTALL_FILES})
set(WINDOWS_CONFIGURATIONS "${WINDOWS_CONFIGURATIONS};Release;RelWithDebInfo;MinSizeRel")
endif()
install(FILES ${WINDOWS_INSTALL_FILES}
CONFIGURATIONS ${WINDOWS_CONFIGURATIONS}
DESTINATION "./blender.shared"
)
if(NOT WITH_PYTHON_MODULE)
# Blender executable with manifest.
if(WINDOWS_INSTALL_DEBUG)
list(APPEND WINDOWS_SHARED_MANIFEST_DEBUG ${WINDOWS_INSTALL_FILES})
endif()
if(WINDOWS_INSTALL_RELEASE)
list(APPEND WINDOWS_SHARED_MANIFEST_RELEASE ${WINDOWS_INSTALL_FILES})
endif()
install(FILES ${WINDOWS_INSTALL_FILES}
CONFIGURATIONS ${WINDOWS_CONFIGURATIONS}
DESTINATION "./blender.shared"
)
else()
# Python module without manifest.
install(FILES ${WINDOWS_INSTALL_FILES}
CONFIGURATIONS ${WINDOWS_CONFIGURATIONS}
DESTINATION "./bpy"
)
endif()
endmacro()
macro(windows_generate_manifest)
@@ -1326,24 +1339,48 @@ macro(windows_generate_manifest)
endmacro()
macro(windows_generate_shared_manifest)
windows_generate_manifest(
FILES "${WINDOWS_SHARED_MANIFEST_DEBUG}"
OUTPUT "${CMAKE_BINARY_DIR}/Debug/blender.shared.manifest"
NAME "blender.shared"
)
windows_generate_manifest(
FILES "${WINDOWS_SHARED_MANIFEST_RELEASE}"
OUTPUT "${CMAKE_BINARY_DIR}/Release/blender.shared.manifest"
NAME "blender.shared"
)
install(
FILES ${CMAKE_BINARY_DIR}/Release/blender.shared.manifest
DESTINATION "./blender.shared"
CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
)
install(
FILES ${CMAKE_BINARY_DIR}/Debug/blender.shared.manifest
DESTINATION "./blender.shared"
CONFIGURATIONS Debug
)
if(WINDOWS_SHARED_MANIFEST_DEBUG)
windows_generate_manifest(
FILES "${WINDOWS_SHARED_MANIFEST_DEBUG}"
OUTPUT "${CMAKE_BINARY_DIR}/Debug/blender.shared.manifest"
NAME "blender.shared"
)
install(
FILES ${CMAKE_BINARY_DIR}/Debug/blender.shared.manifest
DESTINATION "./blender.shared"
CONFIGURATIONS Debug
)
endif()
if(WINDOWS_SHARED_MANIFEST_RELEASE)
windows_generate_manifest(
FILES "${WINDOWS_SHARED_MANIFEST_RELEASE}"
OUTPUT "${CMAKE_BINARY_DIR}/Release/blender.shared.manifest"
NAME "blender.shared"
)
install(
FILES ${CMAKE_BINARY_DIR}/Release/blender.shared.manifest
DESTINATION "./blender.shared"
CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
)
endif()
endmacro()
macro(windows_process_platform_bundled_libraries library_deps)
if(NOT "${library_deps}" STREQUAL "")
set(next_library_mode "ALL")
foreach(library ${library_deps})
string(TOUPPER "${library}" library_upper)
if(("${library_upper}" STREQUAL "RELEASE") OR
("${library_upper}" STREQUAL "DEBUG") OR
("${library_upper}" STREQUAL "ALL"))
set(next_library_mode "${library_upper}")
else()
windows_install_shared_manifest(
FILES ${library}
${next_library_mode}
)
set(next_library_mode "ALL")
endif()
endforeach()
endif()
endmacro()

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2016 Blender Foundation. All rights reserved.
# Copyright 2016 Blender Foundation
# Libraries configuration for Apple.
@@ -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"
)
@@ -221,10 +221,8 @@ find_package(PNG REQUIRED)
set(JPEG_ROOT ${LIBDIR}/jpeg)
find_package(JPEG REQUIRED)
if(WITH_IMAGE_TIFF)
set(TIFF_ROOT ${LIBDIR}/tiff)
find_package(TIFF REQUIRED)
endif()
set(TIFF_ROOT ${LIBDIR}/tiff)
find_package(TIFF REQUIRED)
if(WITH_IMAGE_WEBP)
set(WEBP_ROOT_DIR ${LIBDIR}/webp)
@@ -245,6 +243,7 @@ if(WITH_BOOST)
if(WITH_USD AND USD_PYTHON_SUPPORT)
list(APPEND _boost_FIND_COMPONENTS python${PYTHON_VERSION_NO_DOTS})
endif()
set(Boost_NO_WARN_NEW_VERSIONS ON)
find_package(Boost COMPONENTS ${_boost_FIND_COMPONENTS})
# Boost Python is separate to avoid linking Python into tests that don't need it.
@@ -329,6 +328,7 @@ if(WITH_CYCLES AND WITH_CYCLES_EMBREE)
endforeach()
set(EMBREE_LIBRARIES ${_embree_libraries_force_load})
endif()
add_bundled_libraries(embree/lib)
if(WITH_OPENIMAGEDENOISE)
find_package(OpenImageDenoise REQUIRED)
@@ -451,6 +451,31 @@ if(WITH_COMPILER_CCACHE)
endif()
endif()
unset(_custom_LINKER_FUSE_FLAG)
if(WITH_LINKER_LLD)
find_program(LLD_PROGRAM ld.lld)
if(LLD_PROGRAM)
set(_custom_LINKER_FUSE_FLAG "-fuse-ld=lld")
else()
message(WARNING "LLD linker NOT found, disabling WITH_LINKER_LLD")
set(WITH_LINKER_LLD OFF)
endif()
endif()
if(WITH_LINKER_MOLD)
find_program(MOLD_PROGRAM mold)
if(MOLD_PROGRAM)
set(_custom_LINKER_FUSE_FLAG "-fuse-ld=mold")
else()
message(WARNING "Mold linker NOT found, disabling WITH_LINKER_MOLD")
set(WITH_LINKER_MOLD OFF)
endif()
endif()
if(_custom_LINKER_FUSE_FLAG)
add_link_options(${_custom_LINKER_FUSE_FLAG})
endif()
if(WITH_COMPILER_ASAN)
list(APPEND PLATFORM_BUNDLED_LIBRARIES ${COMPILER_ASAN_LIBRARY})
endif()

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2016 Blender Foundation. All rights reserved.
# Copyright 2016 Blender Foundation
# Xcode and system configuration for Apple.

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2022 Blender Foundation. All rights reserved.
# Copyright 2022 Blender Foundation
# Auto update existing CMake caches for new libraries.

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2016 Blender Foundation. All rights reserved.
# Copyright 2016 Blender Foundation
# Libraries configuration for any *nix system including Linux and Unix (excluding APPLE).
@@ -109,6 +109,10 @@ find_package_wrapper(ZLIB REQUIRED)
find_package_wrapper(Zstd REQUIRED)
find_package_wrapper(Epoxy REQUIRED)
# XXX Linking errors with debian static tiff :/
# find_package_wrapper(TIFF REQUIRED)
find_package(TIFF)
if(WITH_VULKAN_BACKEND)
find_package_wrapper(Vulkan REQUIRED)
find_package_wrapper(ShaderC REQUIRED)
@@ -190,13 +194,6 @@ if(WITH_IMAGE_OPENJPEG)
set_and_warn_library_found("OpenJPEG" OPENJPEG_FOUND WITH_IMAGE_OPENJPEG)
endif()
if(WITH_IMAGE_TIFF)
# XXX Linking errors with debian static tiff :/
# find_package_wrapper(TIFF)
find_package(TIFF)
set_and_warn_library_found("TIFF" TIFF_FOUND WITH_IMAGE_TIFF)
endif()
if(WITH_OPENAL)
find_package_wrapper(OpenAL)
set_and_warn_library_found("OpenAL" OPENAL_FOUND WITH_OPENAL)
@@ -317,7 +314,7 @@ if(WITH_CYCLES AND WITH_CYCLES_OSL)
endif()
endif()
if(WITH_CYCLES AND WITH_CYCLES_DEVICE_ONEAPI)
if(WITH_CYCLES AND (WITH_CYCLES_DEVICE_ONEAPI OR (WITH_CYCLES_EMBREE AND EMBREE_SYCL_SUPPORT)))
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})
@@ -394,6 +391,7 @@ if(WITH_BOOST)
list(APPEND __boost_packages python${PYTHON_VERSION_NO_DOTS})
endif()
list(APPEND __boost_packages system)
set(Boost_NO_WARN_NEW_VERSIONS ON)
find_package(Boost 1.48 COMPONENTS ${__boost_packages})
if(NOT Boost_FOUND)
# try to find non-multithreaded if -mt not found, this flag
@@ -452,6 +450,7 @@ add_bundled_libraries(opencolorio/lib)
if(WITH_CYCLES AND WITH_CYCLES_EMBREE)
find_package(Embree 3.8.0 REQUIRED)
endif()
add_bundled_libraries(embree/lib)
if(WITH_OPENIMAGEDENOISE)
find_package_wrapper(OpenImageDenoise)
@@ -640,15 +639,29 @@ if(WITH_GHOST_WAYLAND)
pkg_check_modules(wayland-egl wayland-egl)
pkg_check_modules(wayland-scanner wayland-scanner)
pkg_check_modules(wayland-cursor wayland-cursor)
pkg_check_modules(wayland-protocols wayland-protocols>=1.15)
pkg_check_modules(wayland-protocols wayland-protocols>=1.31)
pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
else()
# NOTE: this file must always refer to the newest API which is used, so older
# `wayland-protocols` are never found and used which then fail to locate required protocols.
set(_wayland_protocols_reference_file "staging/fractional-scale/fractional-scale-v1.xml")
# Reset the protocols directory the reference file from `wayland-protocols` is not found.
# This avoids developers having build failures when a cached directory is used that no
# longer contains the required file.
if(DEFINED WAYLAND_PROTOCOLS_DIR)
if(NOT EXISTS "${WAYLAND_PROTOCOLS_DIR}/${_wayland_protocols_reference_file}")
unset(WAYLAND_PROTOCOLS_DIR CACHE)
endif()
endif()
# Rocky8 packages have too old a version, a newer version exist in the pre-compiled libraries.
find_path(WAYLAND_PROTOCOLS_DIR
NAMES unstable/xdg-decoration/xdg-decoration-unstable-v1.xml
NAMES ${_wayland_protocols_reference_file}
PATH_SUFFIXES share/wayland-protocols
PATHS ${LIBDIR}/wayland-protocols
)
unset(_wayland_protocols_reference_file)
if(EXISTS ${WAYLAND_PROTOCOLS_DIR})
set(wayland-protocols_FOUND ON)
@@ -790,8 +803,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.
@@ -802,64 +814,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)
@@ -894,7 +891,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")

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2016 Blender Foundation. All rights reserved.
# Copyright 2016 Blender Foundation
# Libraries configuration for Windows.
@@ -114,12 +114,13 @@ add_definitions(-D_WIN32_WINNT=0x603)
# First generate the manifest for tests since it will not need the dependency on the CRT.
configure_file(${CMAKE_SOURCE_DIR}/release/windows/manifest/blender.exe.manifest.in ${CMAKE_CURRENT_BINARY_DIR}/tests.exe.manifest @ONLY)
if(WITH_WINDOWS_BUNDLE_CRT)
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
set(CMAKE_INSTALL_OPENMP_LIBRARIES ${WITH_OPENMP})
include(InstallRequiredSystemLibraries)
# Always detect CRT paths, but only manually install with WITH_WINDOWS_BUNDLE_CRT.
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
set(CMAKE_INSTALL_OPENMP_LIBRARIES ${WITH_OPENMP})
include(InstallRequiredSystemLibraries)
if(WITH_WINDOWS_BUNDLE_CRT)
# ucrtbase(d).dll cannot be in the manifest, due to the way windows 10 handles
# redirects for this dll, for details see #88813.
foreach(lib ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS})
@@ -141,7 +142,9 @@ if(WITH_WINDOWS_BUNDLE_CRT)
install(FILES ${CMAKE_BINARY_DIR}/blender.crt.manifest DESTINATION ./blender.crt)
set(BUNDLECRT "<dependency><dependentAssembly><assemblyIdentity type=\"win32\" name=\"blender.crt\" version=\"1.0.0.0\" /></dependentAssembly></dependency>")
endif()
set(BUNDLECRT "${BUNDLECRT}<dependency><dependentAssembly><assemblyIdentity type=\"win32\" name=\"blender.shared\" version=\"1.0.0.0\" /></dependentAssembly></dependency>")
if(NOT WITH_PYTHON_MODULE)
set(BUNDLECRT "${BUNDLECRT}<dependency><dependentAssembly><assemblyIdentity type=\"win32\" name=\"blender.shared\" version=\"1.0.0.0\" /></dependentAssembly></dependency>")
endif()
configure_file(${CMAKE_SOURCE_DIR}/release/windows/manifest/blender.exe.manifest.in ${CMAKE_CURRENT_BINARY_DIR}/blender.exe.manifest @ONLY)
@@ -484,14 +487,12 @@ if(WITH_IMAGE_OPENEXR)
endif()
endif()
if(WITH_IMAGE_TIFF)
# Try to find tiff first then complain and set static and maybe wrong paths
windows_find_package(TIFF)
if(NOT TIFF_FOUND)
warn_hardcoded_paths(libtiff)
set(TIFF_LIBRARY ${LIBDIR}/tiff/lib/libtiff.lib)
set(TIFF_INCLUDE_DIR ${LIBDIR}/tiff/include)
endif()
# Try to find tiff first then complain and set static and maybe wrong paths
windows_find_package(TIFF)
if(NOT TIFF_FOUND)
warn_hardcoded_paths(libtiff)
set(TIFF_LIBRARY ${LIBDIR}/tiff/lib/libtiff.lib)
set(TIFF_INCLUDE_DIR ${LIBDIR}/tiff/include)
endif()
if(WITH_JACK)
@@ -847,27 +848,75 @@ endif()
if(WITH_CYCLES AND WITH_CYCLES_EMBREE)
windows_find_package(Embree)
if(NOT Embree_FOUND)
set(EMBREE_ROOT_DIR ${LIBDIR}/embree)
set(EMBREE_INCLUDE_DIRS ${LIBDIR}/embree/include)
set(EMBREE_LIBRARIES
optimized ${LIBDIR}/embree/lib/embree3.lib
optimized ${LIBDIR}/embree/lib/embree_avx2.lib
optimized ${LIBDIR}/embree/lib/embree_avx.lib
optimized ${LIBDIR}/embree/lib/embree_sse42.lib
optimized ${LIBDIR}/embree/lib/lexers.lib
optimized ${LIBDIR}/embree/lib/math.lib
optimized ${LIBDIR}/embree/lib/simd.lib
optimized ${LIBDIR}/embree/lib/sys.lib
optimized ${LIBDIR}/embree/lib/tasking.lib
debug ${LIBDIR}/embree/lib/embree3_d.lib
debug ${LIBDIR}/embree/lib/embree_avx2_d.lib
debug ${LIBDIR}/embree/lib/embree_avx_d.lib
debug ${LIBDIR}/embree/lib/embree_sse42_d.lib
debug ${LIBDIR}/embree/lib/lexers_d.lib
debug ${LIBDIR}/embree/lib/math_d.lib
debug ${LIBDIR}/embree/lib/simd_d.lib
debug ${LIBDIR}/embree/lib/sys_d.lib
debug ${LIBDIR}/embree/lib/tasking_d.lib
if(EXISTS ${LIBDIR}/embree/include/embree4/rtcore_config.h)
set(EMBREE_MAJOR_VERSION 4)
else()
set(EMBREE_MAJOR_VERSION 3)
endif()
file(READ ${LIBDIR}/embree/include/embree${EMBREE_MAJOR_VERSION}/rtcore_config.h _embree_config_header)
if(_embree_config_header MATCHES "#define EMBREE_STATIC_LIB")
set(EMBREE_STATIC_LIB TRUE)
else()
set(EMBREE_STATIC_LIB FALSE)
endif()
if(_embree_config_header MATCHES "#define EMBREE_SYCL_SUPPORT")
set(EMBREE_SYCL_SUPPORT TRUE)
else()
set(EMBREE_SYCL_SUPPORT FALSE)
endif()
set(EMBREE_LIBRARIES
optimized ${LIBDIR}/embree/lib/embree${EMBREE_MAJOR_VERSION}.lib
debug ${LIBDIR}/embree/lib/embree${EMBREE_MAJOR_VERSION}_d.lib
)
if(EMBREE_SYCL_SUPPORT)
set(EMBREE_LIBRARIES
${EMBREE_LIBRARIES}
optimized ${LIBDIR}/embree/lib/embree4_sycl.lib
debug ${LIBDIR}/embree/lib/embree4_sycl_d.lib
)
endif()
if(EMBREE_STATIC_LIB)
set(EMBREE_LIBRARIES
${EMBREE_LIBRARIES}
optimized ${LIBDIR}/embree/lib/embree_avx2.lib
optimized ${LIBDIR}/embree/lib/embree_avx.lib
optimized ${LIBDIR}/embree/lib/embree_sse42.lib
optimized ${LIBDIR}/embree/lib/lexers.lib
optimized ${LIBDIR}/embree/lib/math.lib
optimized ${LIBDIR}/embree/lib/simd.lib
optimized ${LIBDIR}/embree/lib/sys.lib
optimized ${LIBDIR}/embree/lib/tasking.lib
debug ${LIBDIR}/embree/lib/embree_avx2_d.lib
debug ${LIBDIR}/embree/lib/embree_avx_d.lib
debug ${LIBDIR}/embree/lib/embree_sse42_d.lib
debug ${LIBDIR}/embree/lib/lexers_d.lib
debug ${LIBDIR}/embree/lib/math_d.lib
debug ${LIBDIR}/embree/lib/simd_d.lib
debug ${LIBDIR}/embree/lib/sys_d.lib
debug ${LIBDIR}/embree/lib/tasking_d.lib
)
if(EMBREE_SYCL_SUPPORT)
set(EMBREE_LIBRARIES
${EMBREE_LIBRARIES}
optimized ${LIBDIR}/embree/lib/embree_rthwif.lib
debug ${LIBDIR}/embree/lib/embree_rthwif_d.lib
)
endif()
endif()
endif()
if(NOT EMBREE_STATIC_LIB)
list(APPEND PLATFORM_BUNDLED_LIBRARIES
RELEASE ${EMBREE_ROOT_DIR}/bin/embree${EMBREE_MAJOR_VERSION}.dll
DEBUG ${EMBREE_ROOT_DIR}/bin/embree${EMBREE_MAJOR_VERSION}_d.dll
)
endif()
endif()
@@ -1026,7 +1075,7 @@ endif()
set(ZSTD_INCLUDE_DIRS ${LIBDIR}/zstd/include)
set(ZSTD_LIBRARIES ${LIBDIR}/zstd/lib/zstd_static.lib)
if(WITH_CYCLES AND WITH_CYCLES_DEVICE_ONEAPI)
if(WITH_CYCLES AND (WITH_CYCLES_DEVICE_ONEAPI OR (WITH_CYCLES_EMBREE AND EMBREE_SYCL_SUPPORT)))
set(LEVEL_ZERO_ROOT_DIR ${LIBDIR}/level_zero)
set(CYCLES_SYCL ${LIBDIR}/dpcpp CACHE PATH "Path to oneAPI DPC++ compiler")
if(EXISTS ${CYCLES_SYCL} AND NOT SYCL_ROOT_DIR)
@@ -1037,8 +1086,9 @@ if(WITH_CYCLES AND WITH_CYCLES_DEVICE_ONEAPI)
${SYCL_ROOT_DIR}/bin/sycl[0-9].dll
)
foreach(sycl_runtime_library IN LISTS _sycl_runtime_libraries_glob)
string(REPLACE ".dll" "$<$<CONFIG:Debug>:d>.dll" sycl_runtime_library ${sycl_runtime_library})
list(APPEND _sycl_runtime_libraries ${sycl_runtime_library})
string(REPLACE ".dll" "d.dll" sycl_runtime_library_debug ${sycl_runtime_library})
list(APPEND _sycl_runtime_libraries RELEASE ${sycl_runtime_library})
list(APPEND _sycl_runtime_libraries DEBUG ${sycl_runtime_library_debug})
endforeach()
unset(_sycl_runtime_libraries_glob)
@@ -1051,6 +1101,8 @@ if(WITH_CYCLES AND WITH_CYCLES_DEVICE_ONEAPI)
list(APPEND PLATFORM_BUNDLED_LIBRARIES ${_sycl_runtime_libraries})
unset(_sycl_runtime_libraries)
set(SYCL_LIBRARIES optimized ${SYCL_LIBRARY} debug ${SYCL_LIBRARY_DEBUG})
endif()

View File

@@ -9,7 +9,7 @@ buildbot:
cuda11:
version: '11.4.1'
hip:
version: '5.3.22480'
version: '5.5.30571'
optix:
version: '7.3.0'
ocloc:

View File

@@ -112,6 +112,7 @@ def create_manifest(
print(f'Building manifest of files: "{outpath}"...', end="", flush=True)
with outpath.open("w", encoding="utf-8") as outfile:
main_files_to_manifest(blender_srcdir, outfile)
assets_to_manifest(blender_srcdir, outfile)
submodules_to_manifest(blender_srcdir, version, outfile)
if packages_dir:
@@ -131,9 +132,7 @@ def submodules_to_manifest(
skip_addon_contrib = version.is_release()
assert not blender_srcdir.is_absolute()
for line in git_command("-C", blender_srcdir, "submodule"):
submodule = line.split()[1]
for submodule in ("scripts/addons", "scripts/addons_contrib"):
# Don't use native slashes as GIT for MS-Windows outputs forward slashes.
if skip_addon_contrib and submodule == "scripts/addons_contrib":
continue
@@ -142,6 +141,18 @@ def submodules_to_manifest(
print(path, file=outfile)
def assets_to_manifest(blender_srcdir: Path, outfile: TextIO) -> None:
assert not blender_srcdir.is_absolute()
assets_dir = blender_srcdir.parent / "lib" / "assets"
for path in assets_dir.glob("*"):
if path.name == "working":
continue
if path.name in SKIP_NAMES:
continue
print(path, file=outfile)
def packages_to_manifest(outfile: TextIO, packages_dir: Path) -> None:
for path in packages_dir.glob("*"):
if not path.is_file():
@@ -172,7 +183,9 @@ def create_tarball(
command += [
"--transform",
f"s,^{blender_srcdir.name}/,blender-{version}/,g",
"--use-compress-program=xz -9",
"--transform",
f"s,^lib/assets/,blender-{version}/release/datafiles/assets/,g",
"--use-compress-program=xz -1",
"--create",
f"--file={tarball}",
f"--files-from={manifest}",

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

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

@@ -1853,8 +1853,6 @@ def pyrna2sphinx(basepath):
fw(" %s\n\n" % operator_description)
for prop in op.args:
write_param(" ", fw, prop)
if op.args:
fw("\n")
location = op.get_location()
if location != (None, None):
@@ -1865,9 +1863,12 @@ def pyrna2sphinx(basepath):
else:
url_base = API_BASEURL
fw(" :file:`%s\\:%d <%s/%s#L%d>`_\n\n" %
fw(" :File: `%s\\:%d <%s/%s#L%d>`__\n\n" %
(location[0], location[1], url_base, location[0], location[1]))
if op.args:
fw("\n")
file.close()
if "bpy.ops" not in EXCLUDE_MODULES:

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2006 Blender Foundation. All rights reserved.
# Copyright 2006 Blender Foundation
# Libs that adhere to strict flags
add_subdirectory(curve_fit_nd)

View File

@@ -14,3 +14,13 @@ The first three of them were employed by the Blender Foundation during that time
Some features (random sounds, dynamic music, playback manager, convolution and HRTFs support) were added as part of the VALS (Virtual Alliances for Learning Society) project by
- Juan Francisco Crespo Galán <dethon_5@outlook.com>
The Equalizer sound effect has been added by
- Marcos Perez
Several people provided fixes:
- Aaron Carlisle
- Sebastian Parborg
- Leon Zandman

View File

@@ -1,3 +1,104 @@
Audaspace 1.4
- Support for OS specific/native audio devices/backends has been added, that is PulseAudio (Linux), WASAPI (Windows) and CoreAudio (MacOS).
- New sound effects have been added, namely Modulator and Equalizer. Thanks to Marcos Perez for contributing the Equalizer.
- File stream info: if an audio file contains multiple streams you can choose which one to process instead of taking the first one (this feature is only supported by ffmpeg, not libsndfile).
- API Change: double instead of float for time values for more precise timing control.
- There have been lots of bugfixes, which are basically the majority of all changes.
- And some other minor improvements were implemented as well.
Detailed list of changes:
d4042d9 Port changes in Blender to upstream.
b60fb45 Equalizer
ab04e84 Fixes
8f0c305 Fix build error with MSVC 17.4+ ported from Blender.
ce44342 Minor documentation update.
cdcb3f4 Migrate from distuils to setuptools for python module.
21eccef Fix FindFFTW to find the float version fftw3f.
ab15e2f Bugfix: API change in new ffmpeg version.
a097be8 Clang format file added, valid from now on.
2fc9fb7 Porting bugfix from Blender upstream.
bb655b7 Bugfix: wrong sample size computation for PulseAudio.
a150495 Bugfix: Buffer did not support buffers > 2 GB.
034645c Update for ffmpeg 5.
932739c Bugfix: WASAPI hangs.
4fcd47c WASAPI: fix bug when switching the default device while there is no playback.
a16fbd2 Python API: fix to get convolution in the python API.
27ac5c1 WASAPI: always switch to default audio device.
1b03e6c Bugfix: catch exception if file cannot be read.
369ff6e PulseAudio: remove unused underflow callback.
2d8bf3a PulseAudio: improve synchronization accuracy.
4868e14 Revert PulseAudioDevice back from ThreadedDevice to threaded mainloop.
6a04446 Adding a jack style mixing thread with a ring buffer for pulseaudio.
5d4b57b Implement RingBuffer class.
e02d3aa FFMPEG: fix seeking and duration calculation.
07b9fa0 Adding file stream functionality.
5a8ad27 Porting changes from Blender.
fa47258 Bugfix: PulseAudio writing to little data on request.
ca3edb5 PulseAudio: increase buffersize.
6d36f3e Pulseaudio: may fix crackling playback start bug.
dbeac4b WASAPI: reinitialize device when lost.
0cba4d3 Bugfix Pulseaudio: might hang.
b73dc6d Bugfix: ffmpeg 4.4 requires channels to be set.
f1ecbe0 Fixed typo.
09e4f27 Rewrite PulseAudioDevice to use ThreadedDevice.
9516924 WASAPI: refactor to simplify and use ThreadedDevice.
749c974 Add ThreadedDevice.
e68b355 Fix some locks in SoftwareDevice.
44b57af Bugfix for deadlock in WASAPIDevice.
8c4b266 CMake: fix ERROR to FATAL_ERROR in MESSAGE.
5a17338 Rename NullDevice's reported name to None.
cd138d7 PulseAudio: add dynamic loading and threading fixes.
6e0250f CoreAudio: add CoreAudioClock as synchronizer.
43aff35 Fix leakage in CoreAudioDevice.cpp
7f6f059 Remove unnecessary cmake code.
a5c1a02 Add CoreAudio device for Apple.
af96f67 Indentation fix.
eec8fd5 WASAPI: use padding also for first buffer submission.
c63bd9b WASAPI: deal with IsFormatSupported case.
079cccb Hide WITH_PULSEAUDIO when not on Linux.
67b5013 Add mingw64 cross compilation toolchain on Linux.
a7bfa58 Add WASAPI backend for Windows.
be1cb25 Allow AUD_init with nullptr to use default device.
fc68868 Compilation fix for mingw.
bb79d25 Add a PulseAudio output device.
a11f593 Bugfix for unwanted volume fading at the beginning of sounds.
8510acf Bugfix: more accurate positioning of sequences.
cb816c1 Fix API docs for python playback manager play function
d125fa2 Add callback for mixing down audio.
789832e Fix numpy import.
9a6a802 Bugfix: JOS resampling type bugfix caused integer underflow.
ece0842 Fix corrupted document in python bindings
28b2ea2 SDL 2: support more audio formats.
a39b7e3 Trying to fix Travis CI build for OS X.
c924007 Some more changes of times from flaot to double.
659afd4 Porting fixes from blender.
8e5e2e6 Fix documentation warnings.
7a6054f API: All times are now double instead of float.
452a724 Mixer sample buffer added channels twice
8ddb6c1 Docs: Cleanup Line Wrapping for python examples
a0c37b2 Docs: Use class methods for api docs
2f8b2e3 Bugfix for invalid offsets provided by ffmpeg's seeking code.
20a7a28 Bug fixes for files with more than 8 channels.
94dc527 Bugfix: Fading from full volume.
2fb9862 Fix: Missing include in FileManager.h.
afadb94 Minor CMakeLists.txt formatting fixes.
734ef03 Add sample rate parameter to silence generation.
ed50f3b Bugfix: Return correct length for modulator and superpose.
cb7a314 Adding a modulator sound effect.
101c714 Bugfix: don't add non-existing devices to the device manager.
7ad99df OpenAL: recreate device if disconnected.
a2ff4e8 Bugfix: memory leak in python API.
5fb21bb Silence some warnings.
9b38605 Some fixes backported from Blender.
40a0a34 Udpate for travis.ci.
212b4b6 Support newer ffmpeg versions.
d27746c Build option: configure whether to build versioned plugins.
19c8d9f Make fftw3 optional.
aa11968 Bugfix for building with gcc7.
10413c5 Fix for seeking with modified pitch.
Audaspace 1.3
=============
@@ -10,6 +111,8 @@ Audaspace 1.3
- filter python API parameter check
- finding ffmpeg with pkgconfig
Detailed list of changes:
64884a7 Windows fixes.
53ba3e6 Implemented JACK dynamic loading.
5ee0ee1 Continues last commit.
@@ -46,6 +149,8 @@ Audaspace 1.2
- assuring numpy is installed
- building the Python module on Mac OS X with CMake
Detailed list of changes:
a6b6e70 Changing default sample rate from 44.1 to 48 kHz.
20f0164 Bugfix: CMake custom command for python module on OS X.
98679a2 Bugfix: using standard library (s)rand.

View File

@@ -23,7 +23,7 @@ endif()
project(audaspace)
set(AUDASPACE_VERSION 1.3)
set(AUDASPACE_VERSION 1.4)
set(AUDASPACE_LONG_VERSION ${AUDASPACE_VERSION}.0)
if(DEFINED AUDASPACE_CMAKE_CFG)

View File

@@ -15,7 +15,7 @@ Audaspace is written in C++ 11 so a fairly recent compiler (g++ 4.8.2, clang 3.3
- Jack (output device)
- libsndfile (file access)
- ffmpeg (file access)
- Python (language binding)
- Python (language binding, needs NumPy as well)
Getting the Code
----------------

View File

@@ -32,7 +32,7 @@ The following (probably incomplete) features are supported by audaspace:
License
-------
> Copyright © 2009-2015 Jörg Müller. All rights reserved.
> Copyright © 2009-2023 Jörg Müller. All rights reserved.
>
> Licensed under the Apache License, Version 2.0 (the "License");
> you may not use this file except in compliance with the License.

View File

@@ -165,6 +165,12 @@ AUD_API void AUD_SequenceEntry_move(AUD_SequenceEntry* entry, double begin, doub
(*entry)->move(begin, end, skip);
}
AUD_API void AUD_SequenceEntry_setConstantRangeAnimationData(AUD_SequenceEntry* entry, AUD_AnimateablePropertyType type, int frame_start, int frame_end, float* data)
{
AnimateableProperty* prop = (*entry)->getAnimProperty(static_cast<AnimateablePropertyType>(type));
prop->writeConstantRange(data, frame_start, frame_end);
}
AUD_API void AUD_SequenceEntry_setAnimationData(AUD_SequenceEntry* entry, AUD_AnimateablePropertyType type, int frame, float* data, char animated)
{
AnimateableProperty* prop = (*entry)->getAnimProperty(static_cast<AnimateablePropertyType>(type));

View File

@@ -68,6 +68,16 @@ extern AUD_API void AUD_Sequence_remove(AUD_Sound* sequence, AUD_SequenceEntry*
* Writes animation data to a sequence.
* \param sequence The sound scene.
* \param type The type of animation data.
* \param frame_start Start of the frame range.
* \param frame_end End of the frame range.
* \param data The data to write.
*/
AUD_API void AUD_SequenceEntry_setConstantRangeAnimationData(AUD_SequenceEntry* entry, AUD_AnimateablePropertyType type, int frame_start, int frame_end, float* data);
/**
* Writes animation data to a sequenced entry.
* \param entry The sequenced entry.
* \param type The type of animation data.
* \param frame The frame this data is for.
* \param data The data to write.
* \param animated Whether the attribute is animated.

View File

@@ -112,6 +112,14 @@ public:
*/
void write(const float* data, int position, int count);
/**
* Fills the properties frame range with constant value and marks it animated.
* \param data The new value.
* \param position_start The start position in the animation in frames.
* \param position_end The end position in the animation in frames.
*/
void writeConstantRange(const float* data, int position_start, int position_end);
/**
* Reads the properties value.
* \param position The position in the animation in frames.

View File

@@ -198,12 +198,13 @@ public:
/**
* Adds a new entry to the scene.
* \param sound The sound this entry should play.
* \param sequence_data Reference to sequence_data. Mainly needed to get the FPS of the scene.
* \param begin The start time.
* \param end The end time or a negative value if determined by the sound.
* \param skip How much seconds should be skipped at the beginning.
* \return The entry added.
*/
std::shared_ptr<SequenceEntry> add(std::shared_ptr<ISound> sound, double begin, double end, double skip);
std::shared_ptr<SequenceEntry> add(std::shared_ptr<ISound> sound, std::shared_ptr<SequenceData> sequence_data, double begin, double end, double skip);
/**
* Removes an entry from the scene.

View File

@@ -23,6 +23,7 @@
*/
#include "sequence/AnimateableProperty.h"
#include "sequence/SequenceData.h"
#include "util/ILockable.h"
#include <mutex>
@@ -63,6 +64,9 @@ private:
/// How many seconds are skipped at the beginning.
double m_skip;
/// reference to sequence_data. Mainly needed to get the FPS of the scene.
std::shared_ptr<SequenceData> m_sequence_data;
/// Whether the entry is muted.
bool m_muted;
@@ -122,9 +126,10 @@ public:
* \param begin The start time.
* \param end The end time or a negative value if determined by the sound.
* \param skip How much seconds should be skipped at the beginning.
* \param sequence_data Reference to sequence_data. Mainly needed to get the FPS of the scene.
* \param id The ID of the entry.
*/
SequenceEntry(std::shared_ptr<ISound> sound, double begin, double end, double skip, int id);
SequenceEntry(std::shared_ptr<ISound> sound, double begin, double end, double skip, std::shared_ptr<SequenceData> sequence_data, int id);
virtual ~SequenceEntry();
/**

View File

@@ -65,6 +65,19 @@ void AnimateableProperty::write(const float* data)
std::memcpy(getBuffer(), data, m_count * sizeof(float));
}
void AnimateableProperty::writeConstantRange(const float* data, int position_start, int position_end)
{
assureSize(position_end * m_count * sizeof(float), true);
float* buffer = getBuffer();
for(int i = position_start; i < position_end; i++)
{
std::memcpy(buffer + i * m_count, data, m_count * sizeof(float));
}
m_isAnimated = true;
}
void AnimateableProperty::write(const float* data, int position, int count)
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);

View File

@@ -92,7 +92,7 @@ AnimateableProperty* Sequence::getAnimProperty(AnimateablePropertyType type)
std::shared_ptr<SequenceEntry> Sequence::add(std::shared_ptr<ISound> sound, double begin, double end, double skip)
{
return m_sequence->add(sound, begin, end, skip);
return m_sequence->add(sound, m_sequence, begin, end, skip);
}
void Sequence::remove(std::shared_ptr<SequenceEntry> entry)

View File

@@ -149,11 +149,11 @@ AnimateableProperty* SequenceData::getAnimProperty(AnimateablePropertyType type)
}
}
std::shared_ptr<SequenceEntry> SequenceData::add(std::shared_ptr<ISound> sound, double begin, double end, double skip)
std::shared_ptr<SequenceEntry> SequenceData::add(std::shared_ptr<ISound> sound, std::shared_ptr<SequenceData> sequence_data, double begin, double end, double skip)
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);
std::shared_ptr<SequenceEntry> entry = std::shared_ptr<SequenceEntry>(new SequenceEntry(sound, begin, end, skip, m_id++));
std::shared_ptr<SequenceEntry> entry = std::shared_ptr<SequenceEntry>(new SequenceEntry(sound, begin, end, skip, sequence_data, m_id++));
m_entries.push_back(entry);
m_entry_status++;

View File

@@ -22,7 +22,7 @@
AUD_NAMESPACE_BEGIN
SequenceEntry::SequenceEntry(std::shared_ptr<ISound> sound, double begin, double end, double skip, int id) :
SequenceEntry::SequenceEntry(std::shared_ptr<ISound> sound, double begin, double end, double skip, std::shared_ptr<SequenceData> sequence_data, int id) :
m_status(0),
m_pos_status(1),
m_sound_status(0),
@@ -31,6 +31,7 @@ SequenceEntry::SequenceEntry(std::shared_ptr<ISound> sound, double begin, double
m_begin(begin),
m_end(end),
m_skip(skip),
m_sequence_data(sequence_data),
m_muted(false),
m_relative(true),
m_volume_max(1.0f),

View File

@@ -241,10 +241,38 @@ bool SequenceHandle::seek(double position)
return false;
std::lock_guard<ILockable> lock(*m_entry);
double seekpos = position - m_entry->m_begin;
if(seekpos < 0)
seekpos = 0;
seekpos += m_entry->m_skip;
double seek_frame = (position - m_entry->m_begin) * m_entry->m_sequence_data->getFPS();
if(seek_frame < 0)
seek_frame = 0;
seek_frame += m_entry->m_skip * m_entry->m_sequence_data->getFPS();
AnimateableProperty* pitch_property = m_entry->getAnimProperty(AP_PITCH);
double target_frame = 0;
if(pitch_property != nullptr)
{
int frame_start = (m_entry->m_begin - m_entry->m_skip) * m_entry->m_sequence_data->getFPS();
for(int i = 0; seek_frame > 0; i++)
{
float pitch;
pitch_property->read(frame_start + i, &pitch);
const double factor = seek_frame > 1.0 ? 1.0 : seek_frame;
target_frame += pitch * factor;
seek_frame--;
}
}
else
{
target_frame = seek_frame;
}
double seekpos = target_frame / m_entry->m_sequence_data->getFPS();
m_handle->setPitch(1.0f);
m_handle->seek(seekpos);

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2008 Blender Foundation. All rights reserved.
# Copyright 2008 Blender Foundation
set(INC
include

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2006 Blender Foundation. All rights reserved.
# Copyright 2006 Blender Foundation
# avoid noisy warnings
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2012 Blender Foundation. All rights reserved.
# Copyright 2012 Blender Foundation
set(INC
.

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2006 Blender Foundation. All rights reserved.
# Copyright 2006 Blender Foundation
set(INC
.

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2006 Blender Foundation. All rights reserved.
# Copyright 2006 Blender Foundation
set(INC
.

View File

@@ -127,7 +127,7 @@ typedef uint32_t cuuint32_t;
typedef uint64_t cuuint64_t;
#endif
#if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64) || defined (__aarch64__)
#if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64) || defined (__aarch64__) || defined(__ppc64__) || defined(__PPC64__)
typedef unsigned long long CUdeviceptr;
#else
typedef unsigned int CUdeviceptr;

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2019 Blender Foundation. All rights reserved.
# Copyright 2019 Blender Foundation
# Build Draco library.
add_subdirectory(draco)

View File

@@ -1,7 +1,7 @@
Project: fast_float
URL: https://github.com/fastfloat/fast_float
License: MIT
Upstream version: 3.4.0 (b7f9d6c)
Upstream version: 4.0.0 (fbd5bd7, 2023 Mar 31)
Local modifications:
- Took only the fast_float.h header and the license/readme files

View File

@@ -1,12 +1,5 @@
## fast_float number parsing library: 4x faster than strtod
![Ubuntu 20.04 CI (GCC 9)](https://github.com/lemire/fast_float/workflows/Ubuntu%2020.04%20CI%20(GCC%209)/badge.svg)
![Ubuntu 18.04 CI (GCC 7)](https://github.com/lemire/fast_float/workflows/Ubuntu%2018.04%20CI%20(GCC%207)/badge.svg)
![Alpine Linux](https://github.com/lemire/fast_float/workflows/Alpine%20Linux/badge.svg)
![MSYS2-CI](https://github.com/lemire/fast_float/workflows/MSYS2-CI/badge.svg)
![VS16-CLANG-CI](https://github.com/lemire/fast_float/workflows/VS16-CLANG-CI/badge.svg)
[![VS16-CI](https://github.com/fastfloat/fast_float/actions/workflows/vs16-ci.yml/badge.svg)](https://github.com/fastfloat/fast_float/actions/workflows/vs16-ci.yml)
The fast_float library provides fast header-only implementations for the C++ from_chars
functions for `float` and `double` types. These functions convert ASCII strings representing
decimal values (e.g., `1.3e10`) into binary types. We provide exact rounding (including
@@ -28,8 +21,8 @@ struct from_chars_result {
```
It parses the character sequence [first,last) for a number. It parses floating-point numbers expecting
a locale-independent format equivalent to the C++17 from_chars function.
The resulting floating-point value is the closest floating-point values (using either float or double),
a locale-independent format equivalent to the C++17 from_chars function.
The resulting floating-point value is the closest floating-point values (using either float or double),
using the "round to even" convention for values that would otherwise fall right in-between two values.
That is, we provide exact parsing according to the IEEE standard.
@@ -47,7 +40,7 @@ Example:
``` C++
#include "fast_float/fast_float.h"
#include <iostream>
int main() {
const std::string input = "3.1416 xyz ";
double result;
@@ -60,39 +53,60 @@ int main() {
Like the C++17 standard, the `fast_float::from_chars` functions take an optional last argument of
the type `fast_float::chars_format`. It is a bitset value: we check whether
the type `fast_float::chars_format`. It is a bitset value: we check whether
`fmt & fast_float::chars_format::fixed` and `fmt & fast_float::chars_format::scientific` are set
to determine whether we allow the fixed point and scientific notation respectively.
The default is `fast_float::chars_format::general` which allows both `fixed` and `scientific`.
The library seeks to follow the C++17 (see [20.19.3](http://eel.is/c++draft/charconv.from.chars).(7.1)) specification.
The library seeks to follow the C++17 (see [20.19.3](http://eel.is/c++draft/charconv.from.chars).(7.1)) specification.
* The `from_chars` function does not skip leading white-space characters.
* [A leading `+` sign](https://en.cppreference.com/w/cpp/utility/from_chars) is forbidden.
* It is generally impossible to represent a decimal value exactly as binary floating-point number (`float` and `double` types). We seek the nearest value. We round to an even mantissa when we are in-between two binary floating-point numbers.
* It is generally impossible to represent a decimal value exactly as binary floating-point number (`float` and `double` types). We seek the nearest value. We round to an even mantissa when we are in-between two binary floating-point numbers.
Furthermore, we have the following restrictions:
* We only support `float` and `double` types at this time.
* We only support the decimal format: we do not support hexadecimal strings.
* For values that are either very large or very small (e.g., `1e9999`), we represent it using the infinity or negative infinity value.
* For values that are either very large or very small (e.g., `1e9999`), we represent it using the infinity or negative infinity value and the returned `ec` is set to `std::errc::result_out_of_range`.
We support Visual Studio, macOS, Linux, freeBSD. We support big and little endian. We support 32-bit and 64-bit systems.
We assume that the rounding mode is set to nearest (`std::fegetround() == FE_TONEAREST`).
## C++20: compile-time evaluation (constexpr)
In C++20, you may use `fast_float::from_chars` to parse strings
at compile-time, as in the following example:
```C++
// consteval forces compile-time evaluation of the function in C++20.
consteval double parse(std::string_view input) {
double result;
auto answer = fast_float::from_chars(input.data(), input.data()+input.size(), result);
if(answer.ec != std::errc()) { return -1.0; }
return result;
}
// This function should compile to a function which
// merely returns 3.1415.
constexpr double constexptest() {
return parse("3.1415 input");
}
```
## Using commas as decimal separator
The C++ standard stipulate that `from_chars` has to be locale-independent. In
particular, the decimal separator has to be the period (`.`). However,
some users still want to use the `fast_float` library with in a locale-dependent
particular, the decimal separator has to be the period (`.`). However,
some users still want to use the `fast_float` library with in a locale-dependent
manner. Using a separate function called `from_chars_advanced`, we allow the users
to pass a `parse_options` instance which contains a custom decimal separator (e.g.,
to pass a `parse_options` instance which contains a custom decimal separator (e.g.,
the comma). You may use it as follows.
```C++
#include "fast_float/fast_float.h"
#include <iostream>
int main() {
const std::string input = "3,1416 xyz ";
double result;
@@ -104,25 +118,62 @@ int main() {
}
```
You can parse delimited numbers:
```C++
const std::string input = "234532.3426362,7869234.9823,324562.645";
double result;
auto answer = fast_float::from_chars(input.data(), input.data()+input.size(), result);
if(answer.ec != std::errc()) {
// check error
}
// we have result == 234532.3426362.
if(answer.ptr[0] != ',') {
// unexpected delimiter
}
answer = fast_float::from_chars(answer.ptr + 1, input.data()+input.size(), result);
if(answer.ec != std::errc()) {
// check error
}
// we have result == 7869234.9823.
if(answer.ptr[0] != ',') {
// unexpected delimiter
}
answer = fast_float::from_chars(answer.ptr + 1, input.data()+input.size(), result);
if(answer.ec != std::errc()) {
// check error
}
// we have result == 324562.645.
```
## Reference
- Daniel Lemire, [Number Parsing at a Gigabyte per Second](https://arxiv.org/abs/2101.11408), Software: Pratice and Experience 51 (8), 2021.
## Relation With Other Work
The fast_float library is part of:
- GCC (as of version 12): the `from_chars` function in GCC relies on fast_float.
- [WebKit](https://github.com/WebKit/WebKit), the engine behind Safari (Apple's web browser)
The fastfloat algorithm is part of the [LLVM standard libraries](https://github.com/llvm/llvm-project/commit/87c016078ad72c46505461e4ff8bfa04819fe7ba).
There is a [derived implementation part of AdaCore](https://github.com/AdaCore/VSS).
The fast_float library provides a performance similar to that of the [fast_double_parser](https://github.com/lemire/fast_double_parser) library but using an updated algorithm reworked from the ground up, and while offering an API more in line with the expectations of C++ programmers. The fast_double_parser library is part of the [Microsoft LightGBM machine-learning framework](https://github.com/microsoft/LightGBM).
## References
- Daniel Lemire, [Number Parsing at a Gigabyte per Second](https://arxiv.org/abs/2101.11408), Software: Practice and Experience 51 (8), 2021.
- Noble Mushtak, Daniel Lemire, [Fast Number Parsing Without Fallback](https://arxiv.org/abs/2212.06644), Software: Practice and Experience (to appear)
## Other programming languages
- [There is an R binding](https://github.com/eddelbuettel/rcppfastfloat) called `rcppfastfloat`.
- [There is a Rust port of the fast_float library](https://github.com/aldanor/fast-float-rust/) called `fast-float-rust`.
- [There is a Java port of the fast_float library](https://github.com/wrandelshofer/FastDoubleParser) called `FastDoubleParser`.
- [There is a Java port of the fast_float library](https://github.com/wrandelshofer/FastDoubleParser) called `FastDoubleParser`. It used for important systems such as [Jackson](https://github.com/FasterXML/jackson-core).
- [There is a C# port of the fast_float library](https://github.com/CarlVerret/csFastFloat) called `csFastFloat`.
## Relation With Other Work
The fastfloat algorithm is part of the [LLVM standard libraries](https://github.com/llvm/llvm-project/commit/87c016078ad72c46505461e4ff8bfa04819fe7ba).
The fast_float library provides a performance similar to that of the [fast_double_parser](https://github.com/lemire/fast_double_parser) library but using an updated algorithm reworked from the ground up, and while offering an API more in line with the expectations of C++ programmers. The fast_double_parser library is part of the [Microsoft LightGBM machine-learning framework](https://github.com/microsoft/LightGBM).
## Users
The fast_float library is used by [Apache Arrow](https://github.com/apache/arrow/pull/8494) where it multiplied the number parsing speed by two or three times. It is also used by [Yandex ClickHouse](https://github.com/ClickHouse/ClickHouse) and by [Google Jsonnet](https://github.com/google/jsonnet).
@@ -135,14 +186,14 @@ It can parse random floating-point numbers at a speed of 1 GB/s on some systems.
<img src="http://lemire.me/blog/wp-content/uploads/2020/11/fastfloat_speed.png" width="400">
```
$ ./build/benchmarks/benchmark
$ ./build/benchmarks/benchmark
# parsing random integers in the range [0,1)
volume = 2.09808 MB
netlib : 271.18 MB/s (+/- 1.2 %) 12.93 Mfloat/s
doubleconversion : 225.35 MB/s (+/- 1.2 %) 10.74 Mfloat/s
strtod : 190.94 MB/s (+/- 1.6 %) 9.10 Mfloat/s
abseil : 430.45 MB/s (+/- 2.2 %) 20.52 Mfloat/s
fastfloat : 1042.38 MB/s (+/- 9.9 %) 49.68 Mfloat/s
volume = 2.09808 MB
netlib : 271.18 MB/s (+/- 1.2 %) 12.93 Mfloat/s
doubleconversion : 225.35 MB/s (+/- 1.2 %) 10.74 Mfloat/s
strtod : 190.94 MB/s (+/- 1.6 %) 9.10 Mfloat/s
abseil : 430.45 MB/s (+/- 2.2 %) 20.52 Mfloat/s
fastfloat : 1042.38 MB/s (+/- 9.9 %) 49.68 Mfloat/s
```
See https://github.com/lemire/simple_fastfloat_benchmark for our benchmarking code.
@@ -183,23 +234,23 @@ You should change the `GIT_TAG` line so that you recover the version you wish to
## Using as single header
The script `script/amalgamate.py` may be used to generate a single header
The script `script/amalgamate.py` may be used to generate a single header
version of the library if so desired.
Just run the script from the root directory of this repository.
Just run the script from the root directory of this repository.
You can customize the license type and output file if desired as described in
the command line help.
You may directly download automatically generated single-header files:
https://github.com/fastfloat/fast_float/releases/download/v1.1.2/fast_float.h
https://github.com/fastfloat/fast_float/releases/download/v3.4.0/fast_float.h
## Credit
Though this work is inspired by many different people, this work benefited especially from exchanges with
Michael Eisel, who motivated the original research with his key insights, and with Nigel Tao who provided
Though this work is inspired by many different people, this work benefited especially from exchanges with
Michael Eisel, who motivated the original research with his key insights, and with Nigel Tao who provided
invaluable feedback. Rémy Oudompheng first implemented a fast path we use in the case of long digits.
The library includes code adapted from Google Wuffs (written by Nigel Tao) which was originally published
The library includes code adapted from Google Wuffs (written by Nigel Tao) which was originally published
under the Apache 2.0 license.
## License

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2016 Blender Foundation. All rights reserved.
# Copyright 2016 Blender Foundation
# Too noisy for code we don't maintain.
if(CMAKE_COMPILER_IS_GNUCC)

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2016 Blender Foundation. All rights reserved.
# Copyright 2016 Blender Foundation
set(INC
src

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2014 Blender Foundation. All rights reserved.
# Copyright 2014 Blender Foundation
set(INC
.

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2014 Blender Foundation. All rights reserved.
# Copyright 2014 Blender Foundation
# avoid noisy warnings
if(CMAKE_COMPILER_IS_GNUCC)

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2021 Blender Foundation. All rights reserved.
# Copyright 2021 Blender Foundation
set(INC
.

View File

@@ -84,7 +84,7 @@ typedef uint32_t hipuint32_t;
typedef uint64_t hipuint64_t;
#endif
#if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64) || defined (__aarch64__)
#if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64) || defined (__aarch64__) || defined(__ppc64__) || defined(__PPC64__)
typedef unsigned long long hipDeviceptr_t;
#else
typedef unsigned int hipDeviceptr_t;

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2006 Blender Foundation. All rights reserved.
# Copyright 2006 Blender Foundation
# avoid noisy warnings
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2006 Blender Foundation. All rights reserved.
# Copyright 2006 Blender Foundation
remove_strict_flags()

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2016 Blender Foundation. All rights reserved.
# Copyright 2016 Blender Foundation
# The Original Code is: all of this file.
# Contributor(s): Sebastian Barschkis (sebbas).

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

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2019 Blender Foundation. All rights reserved.
# Copyright 2019 Blender Foundation
# avoid noisy warnings
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")

View File

@@ -231,3 +231,22 @@ index 355ee008246..a770bbee60c 100644
}
allocator.deallocate(values, capacity);
capacity = 0;
diff --git a/extern/quadriflow/src/hierarchy.cpp b/extern/quadriflow/src/hierarchy.cpp
index 8cc41da23d0..70a9628320f 100644
--- a/extern/quadriflow/src/hierarchy.cpp
+++ b/extern/quadriflow/src/hierarchy.cpp
@@ -269,7 +269,13 @@ void Hierarchy::DownsampleGraph(const AdjacentMatrix adj, const MatrixXd& V, con
for (auto it = ad.begin(); it != ad.end(); ++it, ++entry_it) {
int k = it->id;
double dp = N.col(i).dot(N.col(k));
- double ratio = A[i] > A[k] ? (A[i] / A[k]) : (A[k] / A[i]);
+ double ratio;
+ if (A[i] > A[k]) {
+ ratio = (A[k] == 0.0f) ? 1.0f : A[i] / A[k];
+ }
+ else {
+ ratio = (A[i] == 0.0f) ? 1.0f : A[k] / A[i];
+ }
*entry_it = Entry(i, k, dp * ratio);
}
}

View File

@@ -269,7 +269,13 @@ void Hierarchy::DownsampleGraph(const AdjacentMatrix adj, const MatrixXd& V, con
for (auto it = ad.begin(); it != ad.end(); ++it, ++entry_it) {
int k = it->id;
double dp = N.col(i).dot(N.col(k));
double ratio = A[i] > A[k] ? (A[i] / A[k]) : (A[k] / A[i]);
double ratio;
if (A[i] > A[k]) {
ratio = (A[k] == 0.0f) ? 1.0f : A[i] / A[k];
}
else {
ratio = (A[i] == 0.0f) ? 1.0f : A[k] / A[i];
}
*entry_it = Entry(i, k, dp * ratio);
}
}

View File

@@ -8,6 +8,7 @@
#include "loader.hpp"
#include <cstdint>
#include <fstream>
#include <unordered_map>

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2006 Blender Foundation. All rights reserved.
# Copyright 2006 Blender Foundation
set(INC
.

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2017 Blender Foundation. All rights reserved.
# Copyright 2017 Blender Foundation
# The Original Code is: all of this file.
# Contributor(s): IRIE Shinsuke.

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2022 Blender Foundation. All rights reserved.
# Copyright 2022 Blender Foundation
set(INC
.

View File

@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright 2022 Blender Foundation. All rights reserved. */
* Copyright 2022 Blender Foundation */
#ifdef __APPLE__
# include <MoltenVK/vk_mvk_moltenvk.h>

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2013 Blender Foundation. All rights reserved.
# Copyright 2013 Blender Foundation
set(INC
.

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2012 Blender Foundation. All rights reserved.
# Copyright 2012 Blender Foundation
set(INC
.

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2006 Blender Foundation. All rights reserved.
# Copyright 2006 Blender Foundation
# add_subdirectory(atomic) # header only
add_subdirectory(atomic)

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2020 Blender Foundation. All rights reserved.
# Copyright 2020 Blender Foundation
set(INC
.

View File

@@ -38,10 +38,8 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
*
* The Original Code is: adapted from jemalloc.
* The Original Code is adapted from jemalloc.
* Modifications Copyright (C) 2016 Blender Foundation.
*/
/** \file

View File

@@ -38,10 +38,8 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
*
* The Original Code is: adapted from jemalloc.
* The Original Code is adapted from jemalloc.
* Modifications Copyright (C) 2016 Blender Foundation.
*/
/** \file

View File

@@ -38,10 +38,8 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
*
* The Original Code is: adapted from jemalloc.
* The Original Code is adapted from jemalloc.
* Modifications Copyright (C) 2016 Blender Foundation.
*/
/** \file

View File

@@ -38,10 +38,8 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2016 Blender Foundation.
* All rights reserved.
*
* The Original Code is: adapted from jemalloc.
* The Original Code is adapted from jemalloc.
* Modifications Copyright (C) 2016 Blender Foundation.
*/
/** \file

View File

@@ -281,6 +281,10 @@ 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
${EMBREE_INCLUDE_DIRS}
@@ -393,6 +397,10 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_C_COMPILER_ID MATCHES "Clang")
unset(_has_no_error_unused_macros)
endif()
if(WITH_USD)
add_definitions(-DWITH_USD)
endif()
if(WITH_CYCLES_HYDRA_RENDER_DELEGATE AND (NOT WITH_USD))
set_and_warn_library_found("USD" WITH_USD WITH_CYCLES_HYDRA_RENDER_DELEGATE)
endif()

View File

@@ -50,6 +50,22 @@ if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI)
list(APPEND LIB ${Epoxy_LIBRARIES} ${SDL2_LIBRARIES})
endif()
if(WITH_USD)
# Silence warning from USD headers using deprecated TBB header.
add_definitions(
-D__TBB_show_deprecation_message_atomic_H
-D__TBB_show_deprecation_message_task_H
)
list(APPEND INC_SYS
${USD_INCLUDE_DIRS}
)
list(APPEND LIB
cycles_hydra
${USD_LIBRARIES}
)
endif()
cycles_external_libraries_append(LIB)
# Common configuration.

View File

@@ -17,9 +17,7 @@ OIIOOutputDriver::OIIOOutputDriver(const string_view filepath,
{
}
OIIOOutputDriver::~OIIOOutputDriver()
{
}
OIIOOutputDriver::~OIIOOutputDriver() {}
void OIIOOutputDriver::write_render_tile(const Tile &tile)
{

View File

@@ -22,9 +22,7 @@ OpenGLDisplayDriver::OpenGLDisplayDriver(const function<bool()> &gl_context_enab
{
}
OpenGLDisplayDriver::~OpenGLDisplayDriver()
{
}
OpenGLDisplayDriver::~OpenGLDisplayDriver() {}
/* --------------------------------------------------------------------
* Update procedure.

View File

@@ -149,9 +149,7 @@ void OpenGLShader::bind(int width, int height)
glUniform2f(fullscreen_location_, width, height);
}
void OpenGLShader::unbind()
{
}
void OpenGLShader::unbind() {}
uint OpenGLShader::get_shader_program()
{

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

@@ -403,7 +403,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
time_limit: FloatProperty(
name="Time Limit",
description="Limit the render time (excluding synchronization time)."
description="Limit the render time (excluding synchronization time). "
"Zero disables the limit",
min=0.0,
default=0.0,
@@ -1544,6 +1544,13 @@ class CyclesPreferences(bpy.types.AddonPreferences):
default=False,
)
use_oneapirt: BoolProperty(
name="Embree on GPU (Experimental)",
description="Embree GPU execution will allow to use hardware ray tracing on Intel GPUs, which will provide better performance. "
"However this support is experimental and some scenes may render incorrectly",
default=False,
)
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,16 +1683,16 @@ 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"):
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"):
if True:
col.label(text="HIP temporarily disabled due to compiler bugs", icon='BLANK1')
else:
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',
@@ -1763,6 +1770,11 @@ class CyclesPreferences(bpy.types.AddonPreferences):
col.prop(self, "kernel_optimization_level")
col.prop(self, "use_metalrt")
if compute_device_type == 'ONEAPI' and _cycles.with_embree_gpu:
row = layout.row()
row.use_property_split = True
row.prop(self, "use_oneapirt")
def draw(self, context):
self.draw_impl(self.layout, context)

View File

@@ -3,6 +3,7 @@
from __future__ import annotations
import bpy
from bpy.app.translations import contexts as i18n_contexts
from bpy_extras.node_utils import find_node_input
from bl_ui.utils import PresetPanel
@@ -318,7 +319,7 @@ class CYCLES_RENDER_PT_sampling_path_guiding(CyclesButtonsPanel, Panel):
col = layout.column(align=True)
col.prop(cscene, "use_surface_guiding", text="Surface")
col.prop(cscene, "use_volume_guiding", text="Volume")
col.prop(cscene, "use_volume_guiding", text="Volume", text_ctxt=i18n_contexts.id_id)
class CYCLES_RENDER_PT_sampling_path_guiding_debug(CyclesDebugButtonsPanel, Panel):
@@ -530,7 +531,7 @@ class CYCLES_RENDER_PT_light_paths_max_bounces(CyclesButtonsPanel, Panel):
col.prop(cscene, "diffuse_bounces", text="Diffuse")
col.prop(cscene, "glossy_bounces", text="Glossy")
col.prop(cscene, "transmission_bounces", text="Transmission")
col.prop(cscene, "volume_bounces", text="Volume")
col.prop(cscene, "volume_bounces", text="Volume", text_ctxt=i18n_contexts.id_id)
col = layout.column(align=True)
col.prop(cscene, "transparent_max_bounces", text="Transparent")
@@ -980,7 +981,7 @@ class CYCLES_RENDER_PT_passes_light(CyclesButtonsPanel, Panel):
col.prop(view_layer, "use_pass_transmission_indirect", text="Indirect")
col.prop(view_layer, "use_pass_transmission_color", text="Color")
col = layout.column(heading="Volume", align=True)
col = layout.column(heading="Volume", heading_ctxt=i18n_contexts.id_id, align=True)
col.prop(cycles_view_layer, "use_pass_volume_direct", text="Direct")
col.prop(cycles_view_layer, "use_pass_volume_indirect", text="Indirect")
@@ -1577,6 +1578,7 @@ class CYCLES_WORLD_PT_surface(CyclesButtonsPanel, Panel):
class CYCLES_WORLD_PT_volume(CyclesButtonsPanel, Panel):
bl_label = "Volume"
bl_translation_context = i18n_contexts.id_id
bl_context = "world"
bl_options = {'DEFAULT_CLOSED'}
@@ -1696,6 +1698,7 @@ class CYCLES_WORLD_PT_settings_surface(CyclesButtonsPanel, Panel):
class CYCLES_WORLD_PT_settings_volume(CyclesButtonsPanel, Panel):
bl_label = "Volume"
bl_translation_context = i18n_contexts.id_id
bl_parent_id = "CYCLES_WORLD_PT_settings"
bl_context = "world"
@@ -1791,6 +1794,7 @@ class CYCLES_MATERIAL_PT_surface(CyclesButtonsPanel, Panel):
class CYCLES_MATERIAL_PT_volume(CyclesButtonsPanel, Panel):
bl_label = "Volume"
bl_translation_context = i18n_contexts.id_id
bl_context = "material"
bl_options = {'DEFAULT_CLOSED'}
@@ -1874,6 +1878,7 @@ class CYCLES_MATERIAL_PT_settings_surface(CyclesButtonsPanel, Panel):
class CYCLES_MATERIAL_PT_settings_volume(CyclesButtonsPanel, Panel):
bl_label = "Volume"
bl_translation_context = i18n_contexts.id_id
bl_parent_id = "CYCLES_MATERIAL_PT_settings"
bl_context = "material"

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