This PR adds a clear on creation for draw region framebuffers, which
fixes issue https://projects.blender.org/blender/blender/issues/139443.
When using the "Lock Interface" option, redrawing is disabled until the
rendering process has finished. When the GPU driver does not initialize
framebuffer textures with zero, this means that visual corruption can
be perceived when resizing the main window while rendering.
This fix makes sure that framebuffer textures are initialized with zero
on all GPU platforms.
Pull Request: https://projects.blender.org/blender/blender/pulls/139445
Error in [0] could read past the array bounds for small arrays
containing uniform values.
For tests this wasn't reporting issues with ASAN unless `malloc` was
used (instead of `MEM_malloc_arrayN`).
Resolve and add tests that run with different alignments.
[0]: f9842107aa
Part one.
We have to determine distances for proportional editing for all three
`TransData` (representing the key as well as both handles). The way
#bezt_to_transdata sets up the `TransData`, the `td->center[0]` will
always be based on the **key** (bezt->vec[1]) which means that
#graph_key_shortest_dist will return the same for all of them and we can
reuse that (expensive) result if needed.
Depending on the situation, we can save two thirds of the time spent
here... (42sec >> 14sec before we can actually start transforming keys
in the file from #139042)
Might be worth looking into using a 2D KDTree in the future as well.
(also corrects a code comment about what is actually done in a
particular code path)
Noticed while looking into #139042
Pull Request: https://projects.blender.org/blender/blender/pulls/139164
Reported for Grease Pencil, but also true for Curves.
This was simply missing the call to
`transform_snap_project_individual_apply`.
Even though we cannot snap **onto** Grease Pencil / Curves faces, we can
snap Grease Pencil / Curves onto other suitable face geometry.
So to resolve, just add the calls to
`transform_snap_project_individual_apply` in both
`recalcData_grease_pencil` and `recalcData_curves`
Pull Request: https://projects.blender.org/blender/blender/pulls/139489
Previously, each Viewer node in a different loop iteration would have a separate
table with a separate column ordering. This is annoying when using the
inspection index to look at different iterations.
This patch changes it so that the iteration index of the table identifier is
ignored.
Pull Request: https://projects.blender.org/blender/blender/pulls/139511
This mainly results in an error when trying to use the a simulation zone in
a node tool which is not supported yet. It might become supported in the
future though.
Unit tests veryfying expectation for curves::nurbs::calculate_knots.
While useful to avoid regressions, they might be more valuable as
reference of the output from the knot vector generator for different
options.
Pull Request: https://projects.blender.org/blender/blender/pulls/139508
Function nodes can be evaluated when determining which inputs are used. However,
for general function nodes the output value is considered to be unknown if any
of the inputs is considered to be unknown. For some built-in nodes we can do
better than that.
This patch improves the behavior for the following cases, previously the output
was always unknown:
* Float Math:
* `0.0 * x = 0.0`
* `x * 0.0 = 0.0`
* Integer Math:
* `0 * x = 0`
* `x * 0 = 0`
* Boolean Math:
* `false AND x = false`
* `x AND false = false`
* `true OR x = true`
* `x OR true = true`
* `false NAND x = true`
* `x NAND false = true`
* `true NOR x = false`
* `x NOR true = false`
* `false IMPLY x = true`
* `x IMPLY true = true`
* `false NIMPLY x = false`
* `x NIMPLY true = false`
This helps the inferencing code to be smarter on some cases.
This partially solves #139319. Although in the provided file even more complex
reasoning is necessary to fully support it. For integers it would need to keep
track of the current possible values e.g. `{0, 1}` so that when the integer is
compared to 2, it can be determined that this will always be false. This kind of
inferencing is a bit out of reach for the time being, it's not impossible
though.
Pull Request: https://projects.blender.org/blender/blender/pulls/139331
Implementation of #127106.
This is just a visual representation of the field/single/grid
status of sockets to make the workflow more intuitive. With
a visual representation for volume grid sockets, volume features
should be unblocked for further development. The structure type
will also be used to distinguish list sockets in the interface.
Group input nodes now have a "Structure Type" option instead of
the existing "Single Value Only". Usually the auto option should be
enough, but in some cases where the inferencing cannot (yet) make
a clear determination, it can be helpful to choose a specific type.
The new visualization and the group input structure type option
are hidden behind a new experimental option for now.
Pull Request: https://projects.blender.org/blender/blender/pulls/134811
When using Vulkan HgiOpenGL was still selected. This PR changes the Hgi selectiong
to be based on the active GPU backend.
With this PR the correct Hgi could be selected, this requires the USD/Hydra libs to be
compiled with Vulkan support.
The previous implementation used `HGI_ENABLE_VULKAN` but had an issue:
- Depending on the platform the environment variable was stored inside a global
and initialized when loading blender (even before our main entry point is triggered)
- Storm render engine in Blender has been adapted to do not do any detection.
Ref #133717
Pull Request: https://projects.blender.org/blender/blender/pulls/135780
The crop node default values produces an image of size 100x100. While
this is better than 0x0, it still makes the backdrop image look like it
disappeared after adding a crop node when the new image happens to be
behind a node.
Ideally, the default should be the render resolution, but we don't have
this information at node declaration time, so initialize width and
height to 1920 x 1080 such that the node has no apparent effect for the
default blend file.
<img width="216" alt="default.png" src="attachments/a904a92c-3c0c-4075-80ea-f6168bfb0966">
Pull Request: https://projects.blender.org/blender/blender/pulls/139493
Not really critical in current main, since such 'copying in library'
behavior is fairly rare, but once it start being applied to e.g.
geometry IDs owning shape keys, it would make Blender unhappy because
unlinkable IDs (the shape keys) would be tagged as directly linked.
This is similar to how Value/Vector/Integer/... nodes are automatically
initialized when they are created using link-drag-search.
Strings require some special case handling here but that seems fine. The
`node_socket_move_default_value` function is already fairly specific for the
different value nodes.
Pull Request: https://projects.blender.org/blender/blender/pulls/139478
This is not something we support currently. Before, the simulation would just
not do anything. Now there is an error message.
In theory, a limited version of that could be supported eventually but it does
not have high priority currently. The tricky aspect of supporting this is that
each simulation has a cache, can be baked etc and we need a persistent identify
for those. That's not possible if simulations can be added and removed
dynamically all the time.
Pull Request: https://projects.blender.org/blender/blender/pulls/139479
After exposing options as inputs, the following gizmos may be drawn but
have no effect when tweaked:
- Sun beams
- Ellipse mask
- Box mask
- Split
This patch hides the gizmo when the relevant node inputs are linked
Pull Request: https://projects.blender.org/blender/blender/pulls/139491
This adds a new function `set_vertex_weights` to the `GreasePencilDrawing`.
Given an existing vertex group, this function writes the given weights to the
provided point indices.
Example code for GP Stroke:
```Py
import bpy
ob = bpy.context.active_object
# Add a vertex group
ob.vertex_groups.new(name="Group")
# Get the drawing
frame = ob.data.layers.active.current_frame()
drawing = frame.drawing
# Set the vertex weights of points at index 0, 5, 10, and 15
drawing.set_vertex_weights("Group", [0, 5, 10, 15], [0.1, 0.2, 0.5, 1.0], assign_mode='ADD')
```
Pull Request: https://projects.blender.org/blender/blender/pulls/127216
It appears that previously, assembly was straight up disabled for all ARM64 platforms in x264 - this re-enables it.
This also updates the version of FFmpeg to 7.1.1. I updated the patch files so that they would cleanly apply to 7.1.1.
For Windows ARM64, it also switches both of these libraries to use the copy of LLVM we build as part of the deps, instead of MSVC - this gives a small performance increase. To do this for x264, I added a small patch taken from VCPKG - this should be harmless to other platforms.
With all these changes, I was able to get a ~20-30% perf improvement in video transcoding in the sequence editor.
Pull Request: https://projects.blender.org/blender/blender/pulls/137670
`IMB_load_image_from_file_descriptor` use mmap to read images, and mmap
sometimes can have erroreous state llike accessing a file from network
drives. This patch tries to handle these exceptions like `BLI_mmap_read`
on Win32 (On unix the `sigbus_handler` will be called instead).
Pull Request: https://projects.blender.org/blender/blender/pulls/139472
During rendering when main thread is blocked or all screens are minimized the
garbage collection will not happen resulting in crashes as resources are not freed.
A better solution would be to do garbage collection in a separate thread but that requires a
ref counting system. The specifics of such a system is still unclear.
A possible solution for a Vulkan specific ref counting is to store the ref counts in the
resource tracker. That would only handle images and buffers, but it would solve the most
resource hungry issues.
Pull Request: https://projects.blender.org/blender/blender/pulls/139475
This patch uses 2D and 4D sockets for relevant node sockets in the
compositor. This only on the UI side, internally, some of the sockets
still store 3D data, which will be handled in a later patch in the 5.0
release.
Pull Request: https://projects.blender.org/blender/blender/pulls/139452
Meshes with millions of vertices could freeze when storing
edit-mode undo steps. This occurred when de-duplicating boolean arrays
(typically selection & hidden data).
This problem occurred after v3.3 because vert/edge/face flags were
moved into their own boolean custom-data layers.
Resolve using run-length encoding, used to encode all boolean
custom-data layers before adding them to the BArrayStore.
The overall speedup depends on the order of elements in the mesh
as well as the previous state of the mesh used for comparison.
Testing box selection with subdivided cubes (3.9 million vertices)
shows a speedup from an around between 8..16 seconds to ~0.025 seconds.
Even though this ran in a background thread, adding undo steps
waits for the previous step to finish which could freeze.
Tweaks to BLI_array_store such as increasing the block-size used by
edit-mesh undo and increasing length of hashed data helped but didn't
resolve the issue, see: !138975.
See code-comments for details.
Add RLE encoding/decoding functions for byte arrays for the purpose
of pre-processing arrays with large spans of (mostly) uniform values
before storing them in a BArrayState.
Part of a fix for #136737.
Previously, it was possible for the number of stored columns per table to grow
unbounded. While this likely isn't a problem in practice in most cases, one can
imagine cases where people temporarily have thousands of attributes when are
then never used again. We shouldn't have to store any data for these columns
forever.
This patch adds some simple garbage collection mechanism that keeps the number
of stored unavailable columns per spreadsheet table below a certain threshold
(50 currently). Least recently used columns are removed first.
Pull Request: https://projects.blender.org/blender/blender/pulls/139469
It was intended that pointers instancers would be skipped if they were
marked as invisible. However, we didn't account for the case of an
instancer using the "inherits" visibility but one of its ancestors in
the hierarchy being invisible.
Now these instancers will also be excluded. This is done by checking for
purpose and visibility earlier and halting the recursive traversal as
soon as we find a prim which doesn't meet the criteria.
Pull Request: https://projects.blender.org/blender/blender/pulls/139241
Videos that are higher bit depth than 8 bit are decoded into floating
point formats (so anything that uses 10/12 bits or HDR). Speedup:
- Multi-thread GBRA planar -> RGBA interleaved conversion.
- If video is rotated, do the rotation step while doing the above
conversion directly, instead of a separate rotation afterwards. Cuts
down on memory bandwidth usage.
Playing back two 1920x1080 video tracks, where both are rotated and
H.265 10 bit HDR, on my PC (Ryzen 5950X), average playback frame time
goes 47ms -> 32ms (so 21FPS -> 31FPS)
Pull Request: https://projects.blender.org/blender/blender/pulls/139439
Previously, columns were removed from a table in the spreadsheet if they are not
available anymore. This also meant that their position and width was lost. When
the same column became available again, it was inserted at the end.
This patch makes it so that each table also remembers the columns that are not
available currently (and flags them accordingly). This way, the position and
width can be restored once the data becomes available again.
Pull Request: https://projects.blender.org/blender/blender/pulls/139440
On selected platforms there were some validation errors. It was caused by
platforms that returned a different number of swapchain images then were
requested. In that case the semaphores can get out of sync.
Current mechanism isn't future proof as the max number of images are
statically defined.
For this change the present semaphores is also separated from the frames
to better support out of order swapchain images.
Pull Request: https://projects.blender.org/blender/blender/pulls/139446
This patch turns the Blur node options to inputs.
Size is now a 2D vector and replaces the Size X and Y option. Bokeh was
renamed to Separable to reflect its actual function. Relative was
removed in favor of the newly added Relative To Pixel node workflow.
There is a slight difference in variable size blurring due to float vs
integer computations, so two tests were updated.
Reference #137223.
Pull Request: https://projects.blender.org/blender/blender/pulls/139329
This removes redundant labels from various input nodes like the Value, Integer
and Object node.
Design wise, this is mostly straight forward except for two aspects:
* Some input nodes some have a gizmo icon. In this case I just added the gizmo
icon on the same row.
* The checkbox in the Boolean input node should probably still have a label, so
I kept that.
Implementation wise this adds a new function to socket declarations that allows
us to override the draw behavior of individual sockets per node.
Pull Request: https://projects.blender.org/blender/blender/pulls/139432
GHOST backend didn't use logging. This PR adds an initial ghost.vulkan
logging and improves the reporting of logging in vulkan.
logging can be enabled by `blender --log "gpu.vulkan,ghost.vulkan" --log-level 2`
it shows the optional extensions that are enabled and information about swap chain
events.
Pull Request: https://projects.blender.org/blender/blender/pulls/139437
Looks like newer versions of c++ doesn't want to implicitely do type
promotions from int to float. The patch fixes them.
Also fixed a typo `outter` -> `outer`.
Pull Request: https://projects.blender.org/blender/blender/pulls/139435
This patch adds support for 2D and 4D vector sockets. The default value
structure for vectors was extended to include a new dimensions input,
which can be 2, 3, or 4. The default value was also extended to be a
float4, but only some of its components might be used depending on the
dimensions members.
Each vector subtype now has three variants ending with 2D or 4D as a
prefix depending on its dimensions, and the 2D/4D prefix was taken into
account for the socket type RNA enum functions.
All node systems currently always treat the vectors as 3D, but support
for it in the compositor will shortly follow in another patch.
Depends on #138805.
Pull Request: https://projects.blender.org/blender/blender/pulls/138824
This is adding a hard error for backends do that do not supports it.
Even without this, the backend would return a nullptr. But the error
message in this case was just "see console for more details" without
any additional detail. Which was confusing.