Commit Graph

5324 Commits

Author SHA1 Message Date
Jeroen Bakker
0cbc354b54 Fix: Vulkan: Texture Views ignored array length
The array-length of a texture view isn't stored at the same location as
the array-base and was forgotten that it was a feature what had to be
supported.

Detected when testing `monster.blend` where the SSS object id wasn't
set and lead to missing materials.

**Before**
![image](/attachments/e503a48a-d365-459b-901d-7b72f224e163)

**After**
![image](/attachments/a321494b-042a-4534-a4e0-b864babbd5aa)

Pull Request: https://projects.blender.org/blender/blender/pulls/124590
2024-07-12 12:50:50 +02:00
Jeroen Bakker
a730454c8a Vulkan: Add test case for render graph draw
Pull Request: https://projects.blender.org/blender/blender/pulls/124507
2024-07-11 11:38:36 +02:00
Richard Antalik
af1a6d048d VSE: Simplify outline parameters definition and usage
Function `strip_data_outline_params_set()` was simplified, so setting
color and outline parameters are not mixed and overwriting as code flows
and so the function is better readable.

Shader code is changed, so that when strip overlaps other strip, it gets
2 px red outline regardless of whether it is active or selected. This
makes it more consistent when strip is not active or selected.

Pull Request: https://projects.blender.org/blender/blender/pulls/124442
2024-07-11 07:38:02 +02:00
Jesse Yurkovich
57544887d0 CMake: Add WITH_TBB definition to prevent ODR violation for BLI_spin API
The BLI_spin APIs use a `SpinLock` typedef whose underlying type is
contingent on the precense of `WITH_TBB`. Since our projects did not
consistently define the `WITH_TBB` definition, multiple `SpinLock` types
would end up in our final binary creating ODR violations.

Pull Request: https://projects.blender.org/blender/blender/pulls/124285
2024-07-10 23:02:17 +02:00
Jeroen Bakker
615f4a7d4e Cleanup: Vulkan: Remove unused variable
Detected when compiled with clang.

Pull Request: https://projects.blender.org/blender/blender/pulls/124480
2024-07-10 21:44:19 +02:00
Jacques Lucke
24dc9a21b1 Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.

We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.

The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.

The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.

If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.

Backpropagation does not work for all nodes, although more nodes can be
supported over time.

This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
  a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
  rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.

In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.

All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.

The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.

Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.

The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
  clicking the gizmo icon next to the value.

Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
Richard Antalik
20eb70ee18 Merge branch 'blender-v4.2-release' 2024-07-10 02:22:22 +02:00
il4n
e13b2f3774 Fix: VSE: Overlap after moving a retiming key was not handled
Moving a strip retiming key at the end of a strip, so that a strip
overlaps another one would leave them overlapped. The expected
behavior is that it acts according to the Overlap Mode, like it does
when moving a strip.

Co-authored-by: Richard Antalik <richardantalik@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/124424
2024-07-10 02:21:14 +02:00
Clément Foucault
acf7eab3b5 Merge branch 'blender-v4.2-release'
# Conflicts:
#	tests/data
2024-07-09 14:52:34 +02:00
Clément Foucault
7fe7b2eed0 Fix: EEVEE: Hardware discrepancy with math wrap function
The math render tests were not passing on the AMD hardware.
This was due to some compiler behavior not returning 1
on the `floor((a - c) / (b - c))` calculation even if
`a` and `b` were equal.
2024-07-09 14:13:32 +02:00
Jeroen Bakker
6471b715b2 Vulkan: Remove performance warning about depth clearing
When clearing depth attachment the write depth state should be enabled.
When this isn't the case a clear texture is being performed. Before
the render graph this used to be a performance issue as the rendering
would be suspended.

The render graph currently reorders these texture clears before of
the rendering context and therefore isn't seen as a performance issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/124340
2024-07-08 14:00:40 +02:00
Jeroen Bakker
180a257eef Cleanup: Vulkan: Use stamp in stead of version
Pull Request: https://projects.blender.org/blender/blender/pulls/124339
2024-07-08 12:56:21 +02:00
Jeroen Bakker
08d365b810 Vulkan: Cleanup barrier state
Try to reduce the barrier state so we can be more flexible when adding
support for sub resource tracking.

Pull Request: https://projects.blender.org/blender/blender/pulls/124237
2024-07-08 12:28:11 +02:00
Campbell Barton
cd1dbab348 Cleanup: spelling in comments 2024-07-07 00:29:39 +10:00
Campbell Barton
48383cf20e Cleanup: avoid shadowing, redundant assignment & minor changes
Quiet cppecheck warnings, use const pointers, ELEM(..) macro,
replace NULL -> nullptr, unsigned int -> uint.
2024-07-07 00:18:00 +10:00
Sebastian Parborg
75959af2ed Merge branch 'blender-v4.2-release' 2024-07-05 17:25:03 +02:00
Sebastian Parborg
f853d097a5 Fix: GLSL error in the sequencer when running mesa
It would error out with "illegal use of reserved word 'active'"
Rename the boolan value to not use the reserved word.
2024-07-05 17:22:52 +02:00
Aras Pranckevicius
eafcd66c0a Merge branch 'blender-v4.2-release' 2024-07-05 12:35:59 +03:00
Aras Pranckevicius
c4534909b2 Fix #123578: VSE active but unselected strip outline visual tweak
Instead of making the dark outline be bright for active but unselected
strips, make it have dark outline just like all other strips,
and a 1px inner bright line inside of that.

Pull Request: https://projects.blender.org/blender/blender/pulls/124210
2024-07-05 11:35:18 +02:00
Jeroen Bakker
89daa19f57 Vulkan: Device statistics
This PR adds device statistics which can be printed to the console.
By default nothing is printed, but developer can choose to enable
it during development.

Pull Request: https://projects.blender.org/blender/blender/pulls/124150
2024-07-04 13:47:54 +02:00
Jeroen Bakker
b6c078a28f Vulkan: Fix image bind space collision
EEVEE Eval light shader could still make a collision between
texture and image bind space making rendering glitch
when not using `--debug-gpu`. The problem was that the bind space
wasn't aware of the offset that the shader interface was using.

Pull Request: https://projects.blender.org/blender/blender/pulls/124140
2024-07-04 10:41:43 +02:00
Miguel Pozo
961dcf29ee Merge branch 'blender-v4.2-release' 2024-07-02 17:01:01 +02:00
Miguel Pozo
b0fbd550e0 Fix #124011: GPU: Broken specialization constants
Don't store pointers to `blender::Map` items since, unlike `std::map`,
they're not guaranteed to stay valid.
This resulted in shader binaries being loaded into the wrong
specialization.

Pull Request: https://projects.blender.org/blender/blender/pulls/124051
2024-07-02 16:59:22 +02:00
Jeroen Bakker
4394b87012 Vulkan: Add support for barycentric coordinates
Barycentric coordinates are used for the wireframe shader. It was
already implemented, but was made broken or when we change the depth
range or when we added support for fallback of shader viewport/layer
rendering. The previous implementation didn't use the correct
EmitVertex leading to incorrect depths. Also the shader layouts where
not Vulkan compliant.

![image](/attachments/39fbfd9e-16fd-42d8-9520-3d8fa839e7de)

Pull Request: https://projects.blender.org/blender/blender/pulls/124048
2024-07-02 15:59:16 +02:00
Jeroen Bakker
88f04e95c3 Vulkan: Fix HiZ synchronization
HiZ update performs a read/write on different buffers, this lead
to write-after-write hazards as the resources where added multiple
times in the same pipeline barrier with different access masks.
This is fixed by merging pipeline barriers based on their resource.

Pull Request: https://projects.blender.org/blender/blender/pulls/124036
2024-07-02 14:06:49 +02:00
Jeroen Bakker
bf3c6a3480 Vulkan: Improve debugging render graph
Adds debug print function to output a node with its inputs and outputs.
Also keep track of the name of the resource (only images) what will
be presented. Tracking of the resource name is only done in debug builds.

Pull Request: https://projects.blender.org/blender/blender/pulls/124033
2024-07-02 13:29:34 +02:00
Jeroen Bakker
7fcc4e5374 Vulkan: Add Render graph support to VKDrawList
Resources of the draw list were overwritten, before used. Fixed by
using resource tracking.

Pull Request: https://projects.blender.org/blender/blender/pulls/124024
2024-07-02 09:20:34 +02:00
Campbell Barton
dffc47e6cf Merge branch 'blender-v4.2-release' 2024-07-02 17:06:35 +10:00
Jeroen Bakker
4d0c14bed3 OpenGL: Fix read from uninitialized memory
When performing framebuffer transition on legacy opengl platforms, some
state was uninitialized. Resulting in incorrect behavior and crashes.

Note that this doens't fix the black cube on legacy platforms. With this PR we
might be able to reproduce the issue on modern HW.

Pull Request: https://projects.blender.org/blender/blender/pulls/123989
2024-07-02 08:37:50 +02:00
Miguel Pozo
ed17e7c0c6 Merge branch 'blender-v4.2-release' 2024-07-01 16:40:29 +02:00
Miguel Pozo
4c314f9a78 GPU: Add --gpu-compilation-subprocesses cmd setting
Allow overriding the `max_parallel_compilations` from the command
line.
Disable compilation subprocesses on RenderDoc sessions.

Pull Request: https://projects.blender.org/blender/blender/pulls/123995
2024-07-01 16:36:01 +02:00
Lukas Stockner
87159b2871 Cycles: Add Diffuse Roughness option to Principled BSDF
Setting this option to a value above zero replaces the lambertian Diffuse term
with the modified energy-preserving Oren-Nayar BSDF, which matches the OpenPBR
behavior.

Pull Request: https://projects.blender.org/blender/blender/pulls/123616
2024-07-01 15:49:09 +02:00
Omar Emara
0e1af55247 Merge branch 'blender-v4.2-release' 2024-07-01 13:30:33 +03:00
Jeroen Bakker
9f53f3b600 OpenGL: Disable Stencil Export when forcing workarounds
When forcing workarounds the stencil export support wasn't disabled.
This PR disables stencil export support when forcing workarounds.

Pull Request: https://projects.blender.org/blender/blender/pulls/123985
2024-07-01 12:19:26 +02:00
Jeroen Bakker
3434260874 Vulkan: Add support for Cycles CPU
Other Cycles backend might also work. Not sure about or Optix/Cuda
as they require GPU synchronization.

Pull Request: https://projects.blender.org/blender/blender/pulls/123895
2024-06-28 13:51:51 +02:00
Jeroen Bakker
da4746fe96 Vulkan: Fix copy depth images with stencil
When copying the depth aspect of a depth+stencil image the incorrect
barriers where created. The barrier needs to have the full aspect, even
when we only copy a single aspect from the image.

Pull Request: https://projects.blender.org/blender/blender/pulls/123890
2024-06-28 13:13:33 +02:00
Jacques Lucke
eb35212f3d Cleanup: make format 2024-06-28 13:09:06 +02:00
Jacques Lucke
3410d0bf3f Nodes: simplify node link drawing shader
* Better separation between drawing backdrop and main line.
* Pass u and v coordinates of line to fragment shader for further processing.
* Remove `colorGradient` which can also be computed from `lineUV`.
* Simplify drawing potentially more than one parallel line as is done in #112677.
2024-06-28 13:08:05 +02:00
Jeroen Bakker
e72e538fdd Vulkan: Fix sequential read hazard
When a buffer resource was read, and after that read from another
shader stage it would not generate the appropriate pipeline barrier.

This is fixed by keeping the last write action around and check
if the shader stage was already included in the previous barriers.

Pull Request: https://projects.blender.org/blender/blender/pulls/123845
2024-06-27 15:53:14 +02:00
Jeroen Bakker
3009c98d5f Vulkan: Fix read-after-write hazard in draw manager visibility
Draw Manager visibility compute shader triggered a read-after-write
hazard. This root cause was that the incorrect access was read from
the shader interface. It was set to none, skipping the needed pipeline
barrier.

Pull Request: https://projects.blender.org/blender/blender/pulls/123839
2024-06-27 14:55:15 +02:00
Miguel Pozo
eb37bace96 Merge branch 'blender-v4.2-release' 2024-06-26 16:45:15 +02:00
Miguel Pozo
2804b000ac Fix: GPU: Fix handling of invalid binary caches 2024-06-26 16:44:46 +02:00
Jeroen Bakker
02a45fb60d Vulkan: Add read dependency for push constants fallback
When a shader uses push constants fallback the push constants are
stored inside a uniform buffer. The uniform buffer needs to be guarded
with a read barrier.

Pull Request: https://projects.blender.org/blender/blender/pulls/123777
2024-06-26 14:38:08 +02:00
Miguel Pozo
840457c45c Merge branch 'blender-v4.2-release' 2024-06-25 19:53:33 +02:00
Miguel Pozo
066619e1a8 Fix: GPU: GLStorageBuf::async_flush_to_host non named path
Fix the read parameter when there's no direct_state_access_support.
2024-06-25 19:52:39 +02:00
Jeroen Bakker
ee0b7b9a95 Vulken: Mix array aspect of image views
The image views type can change depending based on how they are bound
to shaders. When a shader accesses a view without array operations,
the image view should not be an array. This was previously ignored.

Pull Request: https://projects.blender.org/blender/blender/pulls/123726
2024-06-25 15:15:18 +02:00
Jeroen Bakker
78f37fe331 Vulkan: Fix incorrect image aspect
When clearing only the depth of a depth/stencil only the depth
part of the image aspect was stored in the node. This is invalid
when the image needed to be transitioned.

Pull Request: https://projects.blender.org/blender/blender/pulls/123713
2024-06-25 11:05:24 +02:00
Jeroen Bakker
f5b173188e Vulkan: Fix incorrect read image barrier
When having a sequential read image barriers for the same resource
and the second one requires an image layout transition the incorrect
barriers where generated.

This was fixed by aligning the implementation with write image barriers.

Pull Request: https://projects.blender.org/blender/blender/pulls/123712
2024-06-25 11:05:07 +02:00
Miguel Pozo
62293d76bb Merge branch 'blender-v4.2-release' 2024-06-24 18:35:52 +02:00
Miguel Pozo
d88150ce1f Fix: GPU: Skip binaries larger than the shared memory 2024-06-24 18:33:05 +02:00