Commit Graph

122952 Commits

Author SHA1 Message Date
Xavier Hallade
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 https://projects.blender.org/blender/blender/pulls/106266

Co-authored-by: Nikita Sirgienko <nikita.sirgienko@intel.com>
Co-authored-by: Stefan Werner <stefan.werner@intel.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/105974
2023-04-05 11:03:06 +02:00
Campbell Barton
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
Campbell Barton
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
Sergey Sharybin
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: https://projects.blender.org/blender/blender/pulls/106536
2023-04-05 09:27:42 +02:00
Campbell Barton
440cccecdc Cleanup: spelling in comments 2023-04-05 14:39:51 +10:00
Campbell Barton
d683665095 Cleanup: compiler warnings 2023-04-05 14:23:54 +10:00
Campbell Barton
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
Hans Goudey
dec9c593cb Cleanup: Use generic index copying utility for normals 2023-04-04 17:22:14 -04:00
Hans Goudey
f594e951e0 Cleanup: Use generic mesh corner to poly map utility 2023-04-04 17:01:19 -04:00
Hans Goudey
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
Hans Goudey
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: https://projects.blender.org/blender/blender/pulls/106570
2023-04-04 22:12:17 +02:00
Hans Goudey
8d0920ec6d Cycles: Optimize extraction of Blender attributes
Similar to 4bcd59d644c4cc50692e. 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
Hans Goudey
6652d2ee9b Cleanup: Remove unused DerivedMesh vert normals calculation 2023-04-04 14:52:41 -04:00
Hans Goudey
2887557907 Cleanup: Remove unused DerivedMesh functions
Unused after 7adea7ee1580f1a552be.
2023-04-04 14:52:02 -04:00
Hans Goudey
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
Hans Goudey
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: https://projects.blender.org/blender/blender/pulls/105938
2023-04-04 20:39:28 +02:00
Ray molenkamp
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: https://projects.blender.org/blender/blender/pulls/106348
2023-04-04 20:10:06 +02:00
Clément Foucault
4b15f2158f Cleanup: Cycles: LightTree: Fix warning about unused variables 2023-04-04 20:01:55 +02:00
Omar Emara
1ae54bb4fd Fix MSVC C1001 error after texture sampler refactor
This patch fixes the MSVC C1001 error that was introduced after
ff3b2226fb202db4c2f77f7d52f578529b38f35b.

Pull Request: https://projects.blender.org/blender/blender/pulls/106554
2023-04-04 18:20:44 +02:00
Martijn Versteegh
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: https://projects.blender.org/blender/blender/pulls/106537
2023-04-04 18:10:11 +02:00
Hans Goudey
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
Hans Goudey
85bd64ece4 Fix: Crash and broken multires baking
Caused by 16fbadde363c8074ec72. 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
Hans Goudey
547f0d5dab Cleanup: Use const arguments for DerivedMesh functions 2023-04-04 11:11:54 -04:00
Weizhen Huang
87cbdcbe7c Refactor: move part of light tree logic from #LightManager to #LightTree 2023-04-04 16:24:21 +02:00
Weizhen Huang
e58a05ca68 Refactor: renaming a few light-tree-related variables
primitives -> emitters, `index` -> `node_index`
2023-04-04 16:24:21 +02:00
Jeroen Bakker
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: https://projects.blender.org/blender/blender/pulls/106546
2023-04-04 15:58:41 +02:00
YimingWu
f94599c095 Fix #106478: Missing xray check in snapping
Regression caused by 98bfa8d4589cae47d0b7ae9ff576a9acca91ab88

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: https://projects.blender.org/blender/blender/pulls/106495
2023-04-04 15:40:48 +02:00
Omar Emara
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: https://projects.blender.org/blender/blender/pulls/105642
2023-04-04 15:16:07 +02:00
illua1
d0604a1bb2 Fix #106530: Don't try to move unmovable node socket values
Missing checkings for unsupported cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/106545
2023-04-04 14:23:40 +02:00
Jeroen Bakker
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: https://projects.blender.org/blender/blender/pulls/106538
2023-04-04 14:04:09 +02:00
Jeroen Bakker
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
Jeroen Bakker
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: https://projects.blender.org/blender/blender/pulls/106541
2023-04-04 12:46:47 +02:00
Weizhen Huang
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
Jeroen Bakker
d030d12d7b Vulkan: Fix Compilation Error on Windows Platforms.
Automatically conversion not working. Replacing `begin` with
`data` would solve this issue.

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

Caused by 8f543a73abc42843fb924fc6d849e3055e3ae011.

Since 8f543a73abc42843fb924fc6d849e3055e3ae011, 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: https://projects.blender.org/blender/blender/pulls/106493
2023-04-04 12:10:30 +02:00
Campbell Barton
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
Damien Picard
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
Campbell Barton
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]: cde99075e87032d99d986182e98d9c367b22d417
2023-04-04 17:35:42 +10:00
Campbell Barton
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
Campbell Barton
d2ad00d0f5 Cleanup: remove unused RenderData::stereomode 2023-04-04 17:26:37 +10:00
Campbell Barton
ececd71fb2 Cleanup: remove references to the Blender Game Engine Player 2023-04-04 17:26:37 +10:00
Iliya Katueshenock
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: https://projects.blender.org/blender/blender/pulls/105293
2023-04-04 09:25:51 +02:00
Sergey Sharybin
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: https://projects.blender.org/blender/blender/pulls/106502
2023-04-04 09:14:58 +02:00
Philipp Oeser
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: https://projects.blender.org/blender/blender/pulls/105991
2023-04-04 09:12:37 +02:00
Harley Acheson
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: https://projects.blender.org/blender/blender/pulls/106507
2023-04-03 20:55:22 +02:00
Richard Antalik
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
illua1
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: https://projects.blender.org/blender/blender/issues/102854
Original patch: https://archive.blender.org/developer/D16735

Pull Request: https://projects.blender.org/blender/blender/pulls/105972
2023-04-03 19:33:39 +02:00
Hans Goudey
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: https://projects.blender.org/blender/blender/pulls/105614
2023-04-03 18:23:30 +02:00
Brecht Van Lommel
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
Hans Goudey
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