Commit Graph

103554 Commits

Author SHA1 Message Date
Brecht Van Lommel
03b2523df8 Merge branch 'blender-v4.0-release' into main 2023-10-09 16:14:39 +02:00
Germano Cavalcante
ffaf3e30ef DRW: Simplify Selection Engine
The selection engine has some complex tricks that improve performance.
These are:
- Only draws objects whose bounding box intersects the selection
threshold;
- If the viewport or objects are not "dirty", it does not clean the
texture IDs and only adds objects that have not yet been drawn;
- Only updates the depth buffer if a new object is drawn;
- Skip drawing if no object is found;

These tricks were initially implemented so that this engine could be
used for snapping.

But this initial idea has changed and now the engine is only used to
select Vertices, Edges or Faces.

Due to this limited use, these tricks bring no real benefit.
In fact, it's even worse with the Retopology Overlay, as it forces the
Depth buffer to be redrawn.

This commit removes these tricks and only keeps those that indicate
whether the drawing needs to be updated.

Pull Request: https://projects.blender.org/blender/blender/pulls/113308
2023-10-09 11:06:53 -03:00
Bogdan Nagirniak
7d7e3d0986 Fix Hydra Storm border rendering being wrong in the viewport
Pull Request: https://projects.blender.org/blender/blender/pulls/113376
2023-10-09 16:01:58 +02:00
Jeroen Bakker
701c14acea EEVEE-Next: Support for Intel ARC GPUs
This PR adds support for Intel ARC GPUs. Due barriers inside a non
uniform control flow the Intel ARC can stall the whole system.

The cause is that a barrier is used, but some threads in the shader
have completed. The barriers might wait until it gets the signal from
the exited threads and stalls the system.

Although some implementations support it it is safer to limit the
number of HiZ levels.

Pull Request: https://projects.blender.org/blender/blender/pulls/113447
2023-10-09 15:29:26 +02:00
Hans Goudey
f27ac434f6 Fix: Incorrect early return in recent cleanup 2023-10-09 15:27:04 +02:00
Hans Goudey
7507251071 Cleanup: Extract attribute function to copy values from group to group
Use the typical combination of an "array utils" function used by an
attribute interpolation function. This helps moves us towards having
a more centralized implementaiton of attribute propagation that can
be changed and optimized more easily.
2023-10-09 15:23:48 +02:00
Jeroen Bakker
f6df5d3514 Fix: EEVEE-Next: Planar Probes First Sample
When the first planar probe is added to the scene, or the last probe
is removed from the scene the samples needs to be reset. This removes
artifacts when only a single sample is used.

Pull Request: https://projects.blender.org/blender/blender/pulls/113440
2023-10-09 14:49:49 +02:00
Peng Yan
ed3eaff968 Cleanup: Remove a redundant increment operator
Ref !113394.
2023-10-09 22:55:07 +11:00
Falk David
d0ee4f2283 BLI: Support negative steps in findlinkfrom
The function `BLI_findlinkfrom` returns the link that is n-steps
after the given start link. This did not work for negative steps.

This change makes it so that both positive and negative step
values work.
2023-10-09 13:40:01 +02:00
Miguel Pozo
2bafffd9f0 EEVEE Next: Expose Thickness output 2023-10-09 13:30:21 +02:00
Miguel Pozo
25160def62 Fix: EEVEE-Next: Nvidia compilation error
Workaround Error: C1317: qualified actual parameter #1 cannot be converted to less qualified parameter
2023-10-09 13:17:19 +02:00
Pratik Borhade
f37a8cda30 GPv3: Insert keyframe when drawing if no key exists at current frame
Code to insert new keyframe when drawing is included in
7e87435cf4 . But current condition fails
to add new frame. In `frame_key_at()`, last drawing or the next drawing is
returned (instead of -1). Hence, no new drawing/frame was added in draw-invoke
function.
So add keyframe if no keyframe exists already at `current_number`

Pull Request: https://projects.blender.org/blender/blender/pulls/113408
2023-10-09 12:54:42 +02:00
Jeroen Bakker
03040f3b7f Cleanup: Make format 2023-10-09 12:49:02 +02:00
Falk David
e7e1ec55d2 GPv3: Add DrawingTransforms
This makes sure that when the object is transformed, the painting code will take that
transformation into account.

Resolves #113424.

Pull Request: https://projects.blender.org/blender/blender/pulls/113442
2023-10-09 12:42:01 +02:00
Miguel Pozo
744bdb84f7 Merge branch 'blender-v4.0-release' 2023-10-09 12:13:18 +02:00
Bastien Montagne
df0d7c9c3d WM Jobs: Refactor all worker status variables into a single shared struct.
Move the three current 'status variables' (stop, update and progress)
into a single 'WorkerStatus' struct. This is cleaner and will allow for
future workin this area without having to edit tens of 'startjob'
callbacks signatures all the time.

No functional change expected here.

Note: jobs' specific internal code has been modified as little as
possible, in many cases the job's own data still just store pointers to
these three values. Ideally in the future more refactor will be using a
single pointer to the shared `wmJobWorkerStatus` data instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/113343
2023-10-09 12:12:22 +02:00
Miguel Pozo
2b805e777a Fix: Workbench: resolve_shader_cache initialization 2023-10-09 12:10:56 +02:00
Jacques Lucke
63b39c5aeb Merge branch 'blender-v4.0-release' 2023-10-09 11:46:45 +02:00
Jacques Lucke
fbfeb24588 Fix #113416: never show inspection index warning when set to zero 2023-10-09 11:45:25 +02:00
Jeroen Bakker
79c0cd0646 Fix: EEVEE-Next: Planar Reflection During Sculpting
This PR fixes an issue that the shading pass isn't filled when
sculpting. Was detected when querying code that landed
in main.

Pull Request: https://projects.blender.org/blender/blender/pulls/113439
2023-10-09 11:03:20 +02:00
Iliya Katueshenock
26346464e0 Fix #110666: Copy built-in attributes for masked curves type conversion
Curve type conversion can cause changing of some curves size.
Also, changing of curve type can cause deletion of unnecessary
built-in attributes and creating new ones. All of this make sense
only for converted curves. Others, unselected, should simply make
copy all old attributes, both built-in and not. This fix simply replaces
the last copy from incorrect only non-built-in, to a correct one,
for all attributes.

Pull Request: https://projects.blender.org/blender/blender/pulls/110683
2023-10-09 10:44:35 +02:00
Jeroen Bakker
5f49efc084 Fix: EEVEE-Next: Crash Removing Last Planar Probe
When deleting the last planar probe in the scene the color and
depth textures are resized with 0 layers. This isn't allowed.

This is fixed by adding an early exit and creating dummy textures.

Pull Request: https://projects.blender.org/blender/blender/pulls/113437
2023-10-09 09:35:02 +02:00
Harley Acheson
e246c111fb Merge branch 'blender-v4.0-release' 2023-10-08 13:20:04 -07:00
Harley Acheson
49c62e8e16 Fix #111666: Hide Mouse in Redo Panel Inputs
When grabbing cursor with "hide" option then also hide the mouse
cursor, and show again when done.

Pull Request: https://projects.blender.org/blender/blender/pulls/113428
2023-10-08 22:18:53 +02:00
Jeroen Bakker
61b463d5e4 EEVEE-Next: Planar Probe Pipeline
This PR is contains the initial capture pipeline for planar probes.

It requires work to generate the correct view to capture and to include
the result during ray tracing. These will be developed in a separate PR.

This PR detects if a planar probe is active in the scene. If this is
the case the planar probe pipeline will be activated. During rendering
this is done by querying the depsgraph, during viewport drawing this
is done during sync. If an planar probe is detected and the pipeline
wasn't activated. The pipeline will be activated and the sampling
will be reset to ensure the pipeline is filled with all objects.

Per object the user can set the visibility of the object in planar
reflections.
![image](/attachments/fcfb40f9-f174-491c-bfba-e7f00f49aa1c)

For a reflection plane the resolution and clipping offset can be set.
EDIT: Resolution option was removed because too complex to
implement with the little time we have at the moment.
![image](/attachments/e42ad9ce-8af8-45d1-aa3a-630db1901ad3)

Related to #112966

Co-authored-by: Clément Foucault <foucault.clem@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/113203
2023-10-08 19:49:58 +02:00
Iliya Katueshenock
ceb8d34319 Cleanup: reduce template usage in join geometries code
Pull Request: https://projects.blender.org/blender/blender/pulls/110436
2023-10-08 19:10:14 +02:00
Jacques Lucke
7bd509f73a Functions: enable multi-threading when many nodes are scheduled at once
Nodes that are scheduled can be executed in any order in theory. So when
there are many scheduled nodes, it can be benefitial to start evaluating
them in parallel.

Note that it is not very common that many nodes are scheduled at the
same time in typical setups because the evaluator uses a depth-first heuristic
to decide in which order to evaluate nodes. It can happen more easily in
generated node trees though.

Also, this change only has an affect in practice if none of the scheduled nodes
uses multi-threading internally, as this would also trigger the user of multiple
threads in the graph executor.
2023-10-08 16:21:23 +02:00
Jacques Lucke
8822e4de73 Functions: add lazy-function graph input/output getter methods 2023-10-08 16:01:56 +02:00
Jacques Lucke
5830316681 Nodes: use better default for color sockets
Using a fully transparent black is default never was an explicit decision.
Now the default is a light grey, that we use in many nodes already.
2023-10-08 15:25:07 +02:00
Jacques Lucke
1ecc315d34 Nodes: pass node declaration builder to dynamic declaration function
Generally, one should use the declaration builder instead of trying to
do it manually which is more error prone and verbose.
2023-10-08 14:38:28 +02:00
Jacques Lucke
0b3daea393 Geometry Nodes: use declaration builder for simulation zone 2023-10-08 14:14:22 +02:00
Jacques Lucke
b6a3ac5a12 Geometry Nodes: use declaration builder for repeat zone 2023-10-08 13:58:22 +02:00
Jacques Lucke
f3a1dd1eb5 Nodes: move socket declaration methods to base declaration builder
The goal here is to make it easier to use the socket declaration builder
for cases where the actual socket type is not known at compile time.
For that purpose, all the methods that are not dependent on the specific
socket type are moved to the base socket declaration builder.

A nice side effect of this is reduced templated boilerplate and that more
code can be moved out of the header.

With this patch, one is now forced to put type specific method calls before
generic method calls in a chain. For example `.default_value(...).supports_field()`
instead of `supports_field().default_value(...)`. In theory, we could keep
support for both orders but that would involve a lot of additional boilerplate
code. Enforcing this order is simple enough. Note that this limitation only
applies when chaining multiple method calls. This is still possible:
```
auto &decl = b.add_input<decl::Vector>("Value");
decl.supports_field();
decl.default_value(...);
```

Pull Request: https://projects.blender.org/blender/blender/pulls/113410
2023-10-08 13:30:31 +02:00
Campbell Barton
5c98d53125 Cleanup: use early return to reduce right-shift in ghost_event_proc 2023-10-08 19:30:52 +11:00
Campbell Barton
0df1a0df3d WM: use time-stamps from events for double-click check
Using the time from events is more accurate under Wayland which
can create events while the main thread is busy.
2023-10-08 19:30:52 +11:00
Campbell Barton
8adc4cf7fa Cleanup: remove redundant window size assignment in playanim_window_zoom 2023-10-08 17:59:38 +11:00
Campbell Barton
c1a01ae7b4 WM: move last press time from the wmEvent into wmWindow
This was only ever used in the wmWindow::eventstate so it doesn't
make sense to store in every event.
2023-10-08 16:16:57 +11:00
Campbell Barton
fc78182cc8 Refactor: use const event data, use static_casts
In some cases processing events was modifying them, as there can be
multiple event consumers, manipulating events isn't correct.
Even though in practice it didn't cause issues, it's straightforward
not to do this and makes logic easier to reason about.
2023-10-08 15:23:39 +11:00
Campbell Barton
8f8a9ef488 Cleanup: remove unused GHOST_kEventTimer
There was a type error assigning customdata, (wmTimer *) was expected
although this data isn't created so it was never hit.
2023-10-08 14:31:15 +11:00
Campbell Barton
0742ef808f Fix writing past struct bounds of GHOST_TEventImeData
IME editing would cast GHOST_TEventImeData to wmIMEData then read/write
an additional member that doesn't exist in GHOST_TEventImeData.

In practice it's likely struct padding prevented this from showing up
as a bug. Nevertheless it's bad practice to rely on this.

- Make GHOST_TEventImeData read-only, move the is_ime_composing boolean
  into the window.
- Add static assert to ensure both structs are the same size.
- Correct code comments.
2023-10-08 14:29:08 +11:00
Clément Foucault
3cca8680e0 EEVEE-Next: Split Thickness Approximation
This moves the thickness from shadow map
approximation out of the lighting and shadowing
loop. Instead of using the thickness from
the shadow tracing from each individual light
before SSS evaluation, we precompute the
average thickness from all shadowed light.
This is then mixed with the nodetree thicknes.

## SSS Translucency
This add back SSS transmission support by using
the mentionned thickness computation, and applying the
transmission profile on it. This is then applied on top of a
flipped normal LTC computation.

Pull Request: https://projects.blender.org/blender/blender/pulls/113401
2023-10-08 00:29:06 +02:00
Jesse Yurkovich
186189c1a6 Merge branch 'blender-v4.0-release' 2023-10-07 15:22:49 -07:00
Jesse Yurkovich
4a57a56f87 Fix #113387: Memory leak with Separate by Loose Parts
Mistake in 118ec54ec7

Free the `groups` array before returning.

Pull Request: https://projects.blender.org/blender/blender/pulls/113402
2023-10-08 00:21:31 +02:00
Clément Foucault
7c694c9d04 EEVEE-Next: Refactor Light evaluation
This allow splitting shadow and light evaluation.
This is the first step to deferred shadowing.

The evaluate closure types can be dynamically
set which mean we can have arbitrary BSDF
evaluation inside the same shader.

This also contain some refactor to `light_lib.glsl`
for more consistency and less clutter.

Note that this breaks the SSS translucency
as the shadow evaluation changes for these.
A new solution for this feature is to be found

Pull Request: https://projects.blender.org/blender/blender/pulls/113257
2023-10-08 00:15:41 +02:00
Jacques Lucke
29d4779bf9 Merge branch 'blender-v4.0-release' 2023-10-07 23:19:41 +02:00
Jacques Lucke
331247fcee Fix: don't set repeat zone output twice 2023-10-07 23:14:04 +02:00
Jacques Lucke
e299c41312 BLI: assert that hash of key is the same after inserting it in hash table
These asserts would have caught the issue fixed in the previous
commit earlier.
2023-10-07 23:14:04 +02:00
Jacques Lucke
262c67d36b Fix: instance reference does not compare equal to copy of itself
A copy has to compare equal to itself and have the same hash
when it is supposed to be used as a reference in a hash table
like `VectorSet`.

Just making the hash not change during a copy by hashing the
geometry component pointers instead of the geometry-set pointer
does not work because of `geometry_set_from_reference` which
assumed that changing the geometry set does not change the
hash of the reference.

For now the solution is to just not use a hash table as this
makes it easier to get corretness right. Instead, just use a
regular `Vector` to store all the references which avoids
the need for a hash function.

This can now lead to some O(n^2) behavior when adding many
references. Fortunately, this is not too common yet, as usually
one has few references but many instances that use those.
It's still something that has to be solved at some point. It's
not clear yet what approach would work best:
* Reintroduce `VectorSet` for the references and properly update
  the reference positions in the hash table after the references
  have changed.
* Add a separate `Map<Object*/Collection*, int>` for the
  deduplication.
* Do deduplication on the call-site of `add_reference` by building
  a temporary map there.
2023-10-07 23:14:04 +02:00
Germano Cavalcante
8c1c782853 Merge branch 'blender-v4.0-release' into main 2023-10-07 12:12:06 -03:00
Germano Cavalcante
4abd59e204 Fix #113320: 'Automatic Constraint' not working in 2D editors
Caused by 586ffcd669

The condition `(t->flag & T_2D_EDIT)` went unnoticed.
2023-10-07 12:08:06 -03:00