Commit Graph

121236 Commits

Author SHA1 Message Date
Patrick Mours
129093fbce Cycles: Fix crash when rendering with OSL on multiple GPUs
The `MultiDevice` implementation of `get_cpu_osl_memory` returns a
nullptr when there is no CPU device in the mix. As such access to that
crashed in `update_osl_globals`. But that only updates maps that are not
currently used on the GPU anyway, so can just skip that when the CPU
is not used for rendering.

Maniphest Tasks: T104216
2023-01-30 19:40:22 +01:00
Jeroen Bakker
87a923fdb6 GPU: Add SSBO binding test to new structure.
This test was added to test the shader info structure binding
information for SSBOs. It still used the legacy GLSL structure.
2023-01-30 19:07:33 +01:00
Michael Kowalski
f4deed288b USD export: style fixes to previous commit.
Changed to C-style comments and added braces.
2023-01-30 11:57:28 -05:00
Michael Kowalski
c79b55fc05 USD export: add scale and bias for normal maps.
Changes authored by Michael B Johnson (drwave).

This addresses the issue in T102911.

Add scale and bias inputs to ensure the normals are
in tangent space [(-1,-1,-1), (1,1,1)].

This is following the convention as set in the USD Spec
(https://graphics.pixar.com/usd/dev/spec_usdpreviewsurface.html).

Differential Revision: https://developer.blender.org/D17072
2023-01-30 11:32:03 -05:00
Antonio Vazquez
ad083f925c GPencil: Rename init_time to time_start 2023-01-30 16:27:00 +01:00
Jeroen Bakker
ce13d0d326 GPU: Only compile test shaders when test cases option is enabled.
The glsl files + create infos of shaders that are only used
during development where still being compiled into blender.

This isn't needed and shouldn't be included. This change will
only include them when WITH_GTEST and WITH_OPENGL_DRAW_TESTS are
enabled. All other cases those files will be skipped.
2023-01-30 15:46:12 +01:00
Bastien Montagne
1a50f814e6 Cleanup: Remove unused variable, use switch, and C++ casting. 2023-01-30 15:41:01 +01:00
Jason Fielder
aca9c131fc Metal: Fix issue with premature safe buffer list flush and optimize memory manager overhead.
Resolve an issue where released buffers were returned to the reusable memory pool before GPU work associated with these buffers had been encoded. Usually release of memory pools is dependent on successful completion of GPU work via command buffer callbacks. However, if the pool refresh operation occurs between encoding of work and submission, buffer ref-count is prematurely decremented.

Patch also ensures safe buffer free lists are only flushed once a set number of buffers have been used. This reduces overhead of small and frequent flushes, without raising the memory ceiling significantly.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D17118
2023-01-30 14:54:39 +01:00
Jeroen Bakker
d4d4efd3d3 GPU: Use create info for compute test cases.
Compute test case still used legacy API to construct
GLSL shaders. This change will migrate it to use the
GPUShaderCreateInfo's.

In preparation to run test-cases against non-opengl
back-ends.
2023-01-30 14:45:07 +01:00
Bastien Montagne
62dd0855a9 Cleanup: Remove special handling of 3DCursor in undo code.
Such preserve-across-undo data handling is now done through the IDType
callbacks, see e.g. `scene_undo_preserve` for the 3DCursor case.
2023-01-30 14:40:59 +01:00
Jason Fielder
596ee79a9f Metal: Optimize shader local memory usage.
Due to shader global scope emulation via class interface, global constant arrays in shaders are allocated in per-thread shader local memory. To reduce memory pressure, placing these constant arrays inside function scope will ensure they only reside within device constant memory. This results in a tangible 1.5-2x performance uplift for the specific shaders affected.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D17089
2023-01-30 13:53:00 +01:00
Clément Foucault
dea924a91f GPU: Fix incorrectly commited test compilation of all shaders 2023-01-30 12:30:21 +01:00
Jeroen Bakker
0da74d3ee9 GPU: Fix GLSL compilation on OpenGL backend.
Regression in {d0f55aa671f7}
2023-01-30 12:23:02 +01:00
Jeroen Bakker
411345757c Cleanup: Remove unused variable.
Introduced in recent commit.
2023-01-30 12:04:44 +01:00
Jeroen Bakker
a36c1cabce Vulkan: Changes to CMake config.
Paths to vulkan libraries, paths and related components were
hardcoded in the platform cmake file. This patch separates
this by using adding CMake modules for Vulkan and ShaderC.

This change has only been applied to the macOs configuration as
that is currently our main platform for development. Other platforms
will be added during the development of the Vulkan back-end.
2023-01-30 12:04:44 +01:00
Jeroen Bakker
084dd110c9 Build: Remove unused BLENDER_GL_LIBRARIES.
This CMAKE variable isn't used.
2023-01-30 12:04:44 +01:00
Jason Fielder
6dde185dc4 Metal: Fix edge-case with point primitive restart index removal where all indices are restarts.
Metal backend does not support primtiive restart for point primtiives. Hence strip_restart_indices removes restart indices by swapping them to the end of the index buffer and reducing the length.
An edge-case existed where all indices within the index buffer were restarts and no valid swap-index would be found, resulting in a buffer underflow.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D17088
2023-01-30 11:26:38 +01:00
Jason Fielder
57552f52b2 Metal: Realtime compositor enablement with addition of GPU Compute.
This patch adds support for compilation and execution of GLSL compute shaders. This, along with a few systematic changes and fixes, enable realtime compositor functionality with the Metal backend on macOS. A number of GLSL source modifications have been made to add the required level of type explicitness, allowing all compilations to succeed.

GLSL Compute shader compilation follows a similar path to Vertex/Fragment translation, with added support for shader atomics, shared memory blocks and barriers.

Texture flags have also been updated to ensure correct read/write specification for textures used within the compositor pipeline. GPU command submission changes have also been made in the high level path, when Metal is used, to address command buffer time-outs caused by certain expensive compute shaders.

Authored by Apple: Michael Parkin-White

Ref T96261
Ref T99210

Reviewed By: fclem

Maniphest Tasks: T99210, T96261

Differential Revision: https://developer.blender.org/D16990
2023-01-30 11:06:56 +01:00
Jeroen Bakker
d0f55aa671 Vulkan: Fix GLSL compilation errors.
Recent changes in our GLSL libraries didn't compile on Vulkan. This
change reverts a compile directive that was removed, but required
in order to compile using the Vulkan backend.
2023-01-30 10:55:14 +01:00
Bastien Montagne
2ff08d6d9c Cleanup: Pass explicit type to MEM_cnew.
Better avoid fancy implicit typing in this template, and be clear about
what type is actually being allocated.
2023-01-30 10:41:42 +01:00
Bastien Montagne
be8778355a Cleanup: Unused parameters and variables. 2023-01-30 09:45:42 +01:00
Bastien Montagne
3649c05f57 Cleanup: Run make format on codebase. 2023-01-30 09:40:17 +01:00
Damien Picard
db87e2a638 I18n: extract and disambiguate a few messages
Extract:
- EEVEE: Compiling Shaders (the same message exists in EEVEE Next, but
  it uses string concatenation and I don't know yet how to deal with
  those--see T92758)

Disambiguate:
- Pan (audio, camera)
- Box (TextSequence)
- Mix (noun in constraints, GP materials)
- Volume (object type, file system)
- Floor (math integer part, 3D viewport horizontal plane)
  - Impossible to disambiguate the constraint name because
    bConstraintTypeInfo doesn't have a context field.
- Show Overlay (in the sequence editor, use the same message as other
  editors to avoid a confusion with the Frame Overlay feature, also
  called "Show Overlay")

Additionally, fix a few issues reported by Joan Pujolar (@jpujolar)
in T101830.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D17114
2023-01-30 09:38:57 +01:00
Damien Picard
75c772391d I18n: construct report verbosely when moving objects to collection
When moving or linking an object to a collection, the report was not
properly translatable. In French for instance, it would give
nonsensical half-translated sentences such as "<Object> moved vers
<collection>", instead of "<Object> déplacé vers <collection>".

Instead, separate the report into the four possible translations (one
or multiple objects, linking or moving). This is very verbose and less
legible, but it ensure the sentences can be properly translated,
including plurals in languages which use grammatical agreement.

In addition, use BKE_collection_ui_name_get() to get the collection
name, because the Scene Collection's name is hardcoded, but it can be
localized.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D17112
2023-01-30 09:31:38 +01:00
Richard Antalik
90e9406866 VSE: Add Update scene frame range operator
This operator updates scene strip internal length to reflect target
scene length. Previously scene strip had to be deleted and added from
scratch. Scene strip length in timeline will not be changed.
2023-01-30 07:56:53 +01:00
Richard Antalik
ad146bd17a Fix T103852: Muting timeline channel does not update image
Add RNA update function to invalidate cache for all strips in channel.
2023-01-30 06:48:01 +01:00
Aaron Carlisle
11de4aa0ce Update RNA to User manual mappings 2023-01-29 19:00:47 -05:00
Joseph Eagar
042775ad48 Sculpt: Fix T104068, depth calculation error in trim tools
Also made the coplanar padding factor relative.
2023-01-28 16:10:02 -08:00
Jacques Lucke
e497da5fda Fix: off by one error in previous commit
Fixes rB90253ad2e753acde161b38d82bd650d54d3f6581.
2023-01-29 00:13:37 +01:00
Brecht Van Lommel
52ed8bcb27 Gitea: fix pull request template so commit body can be set as description 2023-01-28 18:11:51 +01:00
Jacques Lucke
90253ad2e7 Geometry Nodes: avoid creating a lazy function many times
It's better to use some statically allocated functions instead
of dynamically allocating them all the time.
2023-01-28 15:28:55 +01:00
Jacques Lucke
b2534fb866 Fix: anonymous attribute output requested even though it's not used
The code removed here was intended to be an optimization that
avoids creating an additional node to join multiple attribute sets.
However, that optimization did not work, because it did not take
into account whether the single attribute set is required or not.
2023-01-28 14:55:39 +01:00
Jacques Lucke
904357d67a Fix: assert when converting between incompatible field types
This results in a compile time error now which hopefully prevents
this specific kind of mistake in the future.
2023-01-28 14:52:15 +01:00
Leon Schittek
89aae4ac82 Node Editor: Controlled node link swapping
Allow to explicitly swap node links by pressing the alt-key while
reconnecting node links. This replaces the old auto-swapping based on
matching prefixes in socket names.

The new behavior works as follows:

* By default plugging links into already occupied (single input)
  sockets will connect the dragged link and remove the existing one.
* Pressing the alt-key while dragging an existing node link from one
  socket to another socket that is already connected will swap the
  links' destinations.
* Pressing the alt-key while dragging a new node link into an already
  linked socket will try to reconnect the existing links into another
  socket of the same type and remove the links, if no matching socket
  is found on the node. This is similar to the old auto-swapping.

Swapping links from or to multi input sockets is not supported.

This commit also makes the link drag tooltip better visible, when using
light themes by using the text theme color.

Reviewed By: Hans Goudey, Simon Thommes

Differential Revision: https://developer.blender.org/D16244
2023-01-28 10:07:29 +01:00
Campbell Barton
fe5c3a0ab3 GNUmakefile: add convenience target 'check_wiki_file_structure'
This target ensures https://wiki.blender.org/wiki/Source/File_Structure
follows Blender's source tree.
2023-01-28 16:41:12 +11:00
Richard Antalik
4e9c6929c1 VSE: Handle drivers when duplicating strips
Most operations where strips are duplicated use `SEQ_animation` API,
which handles keyframe animation. Now drivers are handled as well.

When group of strips is duplicated and driver references other strip,
it will still reference original strip. However, this is much better,
than previous behavior, when strip duplication results in "transfer" of
driver from original strip to duplicated one.

Fixes T104141
2023-01-28 03:24:44 +01:00
Richard Antalik
3a9e589142 Fix (Unreported): VSE side panel flickering when tweaking offset value
Panel was split by factor calculated from property value string length.
Since these properties have float type now, calculated length was
incorrect.
2023-01-28 00:25:56 +01:00
Richard Antalik
d7e914270f Fix (unreported): Pasted strip is not active
Broken by renaming strip before comparing name to reference.
2023-01-28 00:08:07 +01:00
Chris Blackbourn
cef03c867b UV: cleanup winding
Simplify `BM_uv_element_map_create` by using `BM_face_calc_area_uv_signed`.

Remove unused UV winding code in `BM_uv_vert_map_create`.

Fixes unlikely memory leak in `BKE_mesh_uv_vert_map_create`.

No functional changes.

Differential Revision: https://developer.blender.org/D17137
2023-01-28 11:03:45 +13:00
Richard Antalik
8336de03a6 Cleanup: VSE: use context->for_render instead of G.is_rendering 2023-01-27 22:50:38 +01:00
Hans Goudey
9facc5067a Cleanup: Simplify mesh and point cloud conversion
Since mesh positions are stored as a generic attribute,
the attribute doesn't need special handling here.
2023-01-27 14:34:10 -06:00
Colin Basnett
328772f2d9 Mesh: Add operator to flip quad tessellation
This adds a new operator: bpy.ops.mesh.flip_quad_tessellation()

This operator rotates the internal loops of the selected quads, allowing
the user to control tessellation without destructively altering the
mesh.

{F14201995}

This operator can be found in the "Face" menu (Ctrl+F) under "Face
Data".

{F14201997}

Reviewed By: campbellbarton, dbystedt

Differential Revision: https://developer.blender.org/D17056
2023-01-27 11:02:55 -08:00
Hans Goudey
f5e76aa39e Cleanup: Array types, const, math API in workbench code
Some miscellaneous cleanups left over from a fix/cleanup combo:
- Use const variables
- Use the C++ `math` namespace functions
- Use `std::array` for arrays with size known at compile time
- Use `MutableSpan` instead of reference to array

Differential Revision: https://developer.blender.org/D17094
2023-01-27 11:35:08 -06:00
Germano Cavalcante
0050d6d399 Cleanup: move function to file where it is used
`drawLine` is only used for constraint, so it should be in
`transform_constraints.c`
2023-01-27 14:10:43 -03:00
Hans Goudey
8343e841fd Cleanup: Quiet unused variable warning in non-debug builds 2023-01-27 09:59:59 -06:00
Hans Goudey
179605bd2d Fix T104168: No active UV when reading auto-save files
Similar to 6d12d43a054898bbffb, we should skip the
legacy to generic conversion if there's nothing to convert.
2023-01-27 09:59:59 -06:00
Hans Goudey
000e722c7d Geometry Nodes: Optimize start point case of Points of Curve node
In the node groups for T103730, the "Points of Curve" node is often used to
retrieve the root point of every curve. Since the curve point offsets array
already contains that data directly, we can detect this as a special case and
avoid all the other work.

Differential Revision: https://developer.blender.org/D17128
2023-01-27 09:59:59 -06:00
Jeroen Bakker
e99ae0a75d Vulkan: Tweaks to CMake configuration.
MoltenVK wasn't found as it was previous part of lib/vulkan.
as lib/vulkan now doesn't contain
the full sdk, we will use a moltenvk folder.

At this moment the moltenvk folder isn't filled, but will eventually be.
2023-01-27 16:58:14 +01:00
Michael Kowalski
b67b84bd5d Fix T103984: USD exports pass usdchecker
These changes were authored by Michael B Johnson (drwave).

The default Blender USD export currently produces files that trigger
errors in the usdchecker that ships with USD 22.11.

The changes are:

- Set the defaultPrim if no defaultPrim is set. This sets it to the
first prim in the hierarchy which matches the behaviour of Pixar's
referencing (where referencing a USD layer without a defaultPrim will
pick the first prim) as well as matches the logic in Pixar's Maya USD
exporter code.

- Applies the MaterialBindingAPI to prims with material binding
attributes. This is a relatively new requirement for USD as it will
help for efficiency with upcoming changes to Hydra.

- Removes the preview scope in the USD shader hierarchy, because it
is no longer valid for shaders to have any non-container ancestors in
their hierarchy up until the enclosing Material prim.

Reviewed by: Michael Kowalski

Differential Revision: https://developer.blender.org/D17041
2023-01-27 10:29:58 -05:00
Patrick Mours
4635dd6aed Fix T104157: Deleting an active OSL node causes issues
Removing all OSL script nodes from the shader graph would cause that
graph to no longer report it using `KERNEL_FEATURE_SHADER_RAYTRACE`
via `ShaderManager::get_graph_kernel_features`, but the shader object
itself still would have the `has_surface_raytrace` field set.
This caused kernels to be reloaded without shader raytracing support, but
later the `DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE`
kernel would still be invoked since the shader continued to report it
requiring that through the `SD_HAS_RAYTRACE` flag set because of
`has_surface_raytrace`.
Fix that by ensuring `has_surface_raytrace` is reset on every shader update,
so that when all OSL script nodes are deleted it is set to false, and only
stays true when there are still OSL script nodes (or other nodes using it).

Maniphest Tasks: T104157

Differential Revision: https://developer.blender.org/D17140
2023-01-27 16:14:25 +01:00