Commit Graph

9355 Commits

Author SHA1 Message Date
Clément Foucault
3dfec1ff73 Depth Picking: Do not include non-selectable object in depth picking
This allow to make transparent object not interfere with
navigation.

Rel #134784

Pull Request: https://projects.blender.org/blender/blender/pulls/135109
2025-03-04 18:13:48 +01:00
Miguel Pozo
d3ee449ca0 Fix: EEVEE: Handle multiple specialization constants variants
Correctly handle cases where multiple scenes with different
specialization constants are rendered concurrently.

Pull Request: https://projects.blender.org/blender/blender/pulls/135270
2025-03-04 17:41:26 +01:00
Jeroen Bakker
4a95c0405c Cleanup: Subdiv: Remove wrapper OpenSubdiv_Buffer
`OpenSubdiv_Buffer` is a wrapper that was introduced at the time
that Blender couldn't use CPP directly. It contains a pointer to
a VertBuf and callbacks to use GPU module on that buffer.

This PR replaces OpenSubdiv_Buffer with `blender::gpu::VertBuf` and
removes the wrapper.

NOTE: OpenSubdiv tests are added to blender_test executable to make the
library dependencies not to complicated.

Pull Request: https://projects.blender.org/blender/blender/pulls/135389
2025-03-04 07:51:15 +01:00
Hans Goudey
43be4d2f9e Cleanup: Use StringRef instead of StringRefNull 2025-03-03 22:38:47 -05:00
Hans Goudey
cd0956d72f Cleanup: Simplify check for sculpt BVH normals update in mesh draw code 2025-03-03 18:22:56 -05:00
Clément Foucault
f15e72971a Cleanup: DRW: Avoid warning caused by class/struct mismatching definition
Showed as a compiler warning.
2025-03-03 20:23:15 +01:00
Clément Foucault
3f1289836c Merge branch 'blender-v4.4-release' 2025-03-03 18:58:37 +01:00
Clément Foucault
446ad3ba13 Fix #135246: Overlay: Loose wire disapears when line antialias is off
This was caused by the normals not being available (default to
`vec3(0)`) which produced `NaN`s down the line after the
unsafe normalize. Changing to `safe_normalize` fixes the issue.
2025-03-03 18:58:14 +01:00
Hans Goudey
a58dd0b5c3 Refactor: Curves: Various changes to draw cache extraction
- Avoid redundant computaiton of curve type index masks
- Parallelize index buffer build (always add space for a cyclic segment)
- Avoid overhead of GPU index buffer "add vert" utilities
- Add utility for consistent order of point and handle data
- Make some variable names more consistent
- Avoid mixing multiple abstraction levels in the same function
2025-03-03 12:05:23 -05:00
Aras Pranckevicius
cc2c6692c0 Cleanup: Name more IMB things as "byte" or "float" instead of "rect" and "rectFloat"
- IB_rect -> IB_byte_data
- IB_rectfloat -> IB_float_data
- Rename some functions:
	- IMB_get_rect_len -> IMB_get_pixel_count
	- IMB_rect_from_float -> IMB_byte_from_float
	- IMB_float_from_rect_ex -> IMB_float_from_byte_ex
	- IMB_float_from_rect -> IMB_float_from_byte
	- imb_addrectImBuf -> IMB_alloc_byte_pixels
	- imb_freerectImBuf -> IMB_free_byte_pixels
	- imb_addrectfloatImBuf -> IMB_alloc_float_pixels
	- imb_freerectfloatImBuf -> IMB_free_float_pixels
	- imb_freemipmapImBuf -> IMB_free_mipmaps
	- imb_freerectImbuf_all -> IMB_free_all_data
- Remove IB_multiview (not used at all)
- Remove obsolete "module" comments in public IMB headers

Pull Request: https://projects.blender.org/blender/blender/pulls/135348
2025-03-03 17:11:45 +01:00
Clément Foucault
db9aa0b435 Fix: DRW: Wrong logic for Grease Pencil visibility test
Fixes a warning and a logic error.
2025-03-03 17:11:07 +01:00
Clément Foucault
c2f02448c3 Merge branch 'blender-v4.4-release' 2025-03-03 16:21:37 +01:00
Clément Foucault
3653fe9524 Fix #135191: Overlay: Edit Mesh: Face selection Z-fighting with edit cage
The offset was not applied inside the vertex shader for
the edit Face selection overlay. Making the offset apply
to this shader fixes the issue.
2025-03-03 16:21:00 +01:00
Clément Foucault
c3ad5e3861 Cleanup: DRW: Remove unused function from header and cleanup function names
Pull Request: https://projects.blender.org/blender/blender/pulls/135322
2025-03-03 16:12:16 +01:00
Clément Foucault
56258cee9b Cleanup: DRW: Reduce code duplication and group similar functions 2025-03-03 16:12:16 +01:00
Clément Foucault
7d5ec51d26 Refactor: DRW: Remove access to global context for instance data
Pass the `ObjectRef` in a few more places.
Remove the now unused functions.
2025-03-03 16:12:16 +01:00
Clément Foucault
2038ba699d Refactor: DRW: Make Dupli batch extraction use C++ types
And add documentation about why do we need this.

Removes the potential engine data and only keep a `Set`
of instanciated object.
2025-03-03 16:12:16 +01:00
Clément Foucault
d5871be8dd Refactor: DRW: Pass ObjectRef directly to engine object sync
Reduces API bloat.
2025-03-03 16:12:16 +01:00
Miguel Pozo
52079f27e7 Merge branch 'blender-v4.4-release' 2025-03-03 13:47:05 +01:00
Miguel Pozo
f2c7e60a8c Fix #135357: Overlay-Next: Reference images briefly disappear when entering orthographic view
depth_bias_winmat_ is computed after sync.
2025-03-03 13:46:13 +01:00
Clément Foucault
127a5d6d3a Cleanup: GPU: Shader C++: Avoid #pragma once in main file warning
Pull Request: https://projects.blender.org/blender/blender/pulls/135384
2025-03-03 12:50:47 +01:00
Clément Foucault
783472671e Cleanup: GPU: Add macro for default constructor compatibility on MSL 2025-03-03 12:50:45 +01:00
Clément Foucault
2c20c200bf Cleanup: GPU: Remove warning about is_zero redundant declaration 2025-03-03 12:50:45 +01:00
Jeroen Bakker
4bf3c36c6a Cleanup: Subdiv: Missing usage binding defines
Patch evaluation shaders has defines, but they were not used. This PR
cleansup the incremental binding by using these defines.

Pull Request: https://projects.blender.org/blender/blender/pulls/135379
2025-03-03 11:03:12 +01:00
Hans Goudey
76a253a973 Fix: Potential issue in BMesh points index buffer extraction
The same fix as 81d5af15a6.
That commit only applied the change to Mesh, not BMesh.
2025-03-01 17:46:33 -05:00
Hans Goudey
8fe63f0ad8 Cleanup: Remove outdated references to GHash 2025-03-01 12:10:18 -05:00
Clément Foucault
6e5b7f6375 Refactor: DRW: Make DRWManager more C++ oriented
This wrap some functions as class methods
and rename members to reduce confusion with
the old class meaning.

Rename the old DRWManager to DRWContext.

Also wrap access to DST inside a function
to allow to change it to thread local in a
following PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/135268
2025-02-28 17:26:07 +01:00
Miguel Pozo
028263d9e5 Draw: Use StaticShaders for GPU subdivision
Make subdivision shaders compilation thread-safe.
(Continuation of #134812)

Pull Request: https://projects.blender.org/blender/blender/pulls/135265
2025-02-28 15:27:13 +01:00
Miguel Pozo
f930d71a1e GPU: Threadsafe shader creation and acquisition
Move the `StaticShader` class from Workbench to `GPU_shader` and make
compilation thread-safe (Shader usage is still not thread-safe).
Use `StaticShader`s for all shader caches.

Subdivision shaders are still not ported.

(Part of #134690)

Pull Request: https://projects.blender.org/blender/blender/pulls/134812
2025-02-27 19:20:33 +01:00
Jeroen Bakker
22aad0fde7 SubDiv: Use shader create info for patch evaluation shader
This PR migrates the subdiv_patch_evaluation_comp.glsl to use
shader create info.

The part of OSD that is used is included as a typedef source (osd_patch_basis.glsl).

Pull Request: https://projects.blender.org/blender/blender/pulls/134917
2025-02-27 15:42:08 +01:00
Clément Foucault
583e2b7240 DRW: Move GPU context lock out of the DST variable.
This doesnt remove the locking but isolate the `GPUContext`
lock to oustide the `DrawManager` class.

This has no functional change.

Pull Request: https://projects.blender.org/blender/blender/pulls/135189
2025-02-27 15:39:05 +01:00
Jeroen Bakker
fcc5681624 SubDiv: Use shader create info for custom data
This PR migrates the custom_data_interp_comp.glsl to use
shader create info.

During development tests have been conducted to use specialization constants,
but due to limitations inside Metal we didn't use them.

Number of ShaderCreateInfos have been reduced by using macros. Variadic macros
have not been used as they don't support CPP compilation.

Pull Request: https://projects.blender.org/blender/blender/pulls/134932
2025-02-27 09:50:36 +01:00
Jeroen Bakker
e2793ab3da Fix: SubDiv: CPP Shader compilation
Some shaders were missing and didn't
compile using CPP compilation

Pull Request: https://projects.blender.org/blender/blender/pulls/135090
2025-02-27 08:54:34 +01:00
Clément Foucault
973813f8ba Cleanup: DRW: Remove unused DRWInstanceData
Rel #134690
2025-02-26 19:43:49 +01:00
Clément Foucault
f3736aa7af Fix #135018: EEVEE: Plane lightprobe renders incorrectly in ortho view
Caused by wrong view vector which is used to check which way
to point the clipping plane at.

To be backported to 4.2.

Pull Request: https://projects.blender.org/blender/blender/pulls/135166
2025-02-26 14:13:33 +01:00
Clément Foucault
e9dfe79054 Fix #135018: EEVEE: Plane lightprobe renders incorrectly in ortho view
Caused by wrong view vector which is used to check which way
to point the clipping plane at.

To be backported to 4.2.

Pull Request: https://projects.blender.org/blender/blender/pulls/135166
2025-02-26 14:01:30 +01:00
Clément Foucault
b3e20616d0 Fix #135116: DRW: Leaks while using generated metarig rigs
In this case, the evaluator cache was never referenced and
the subdiv free queue empty. So the freeing of the cache
never happened.

This function is called once per frame and is unlikely
to generate overhead by doing one lock.
2025-02-26 12:11:23 +01:00
Clément Foucault
f47f990594 Cleanup: DRW: Remove uniforms declaration and dangerous defines 2025-02-25 23:46:27 +01:00
Clément Foucault
b2ed7eb45c Cleanup: DRW: Remove unused legacy shader libraries 2025-02-25 23:10:19 +01:00
Clément Foucault
3a7d086200 Cleanup: DRW: Remove legacy create info and rename new ones
This is just mass renaming
2025-02-25 23:05:12 +01:00
Hans Goudey
24e67d9d49 Point Cloud: Remove multiplication in radius extraction and shaders
This multiplication by 100/0.01 was there for historical reasons.
This commit just removes it everywhere.

Pull Request: https://projects.blender.org/blender/blender/pulls/135123
2025-02-25 19:10:45 +01:00
Clément Foucault
e515f16776 Cleanup: DRW: Remove unused legacy object attribute UBO 2025-02-25 18:49:14 +01:00
Clément Foucault
cb7d9222cf Cleanup: DRW: Remove legacy object data create infos
Remove deprecated (and unused) create infos and mass
rename the `*_new` ones.
2025-02-25 18:46:42 +01:00
Clément Foucault
d8387a82ff Cleanup: DRW: Remove legacy common_math_lib 2025-02-25 18:12:33 +01:00
Nathan Vegdahl
f1628c6c03 Fix: missing includes
Building failed with certain build options disabled, such as in my
extra-lean build.

Bisecting indicates that d0a6189b50 was
the cause, although it's not obvious to me why. But likely some
indirect include that was lost in the refactor.
2025-02-25 18:00:26 +01:00
Miguel Pozo
f15a16d1c6 Merge branch 'blender-v4.4-release' 2025-02-25 15:58:16 +01:00
Miguel Pozo
cdf821c978 Fix #134890: Overlay: Missing Weight Paint overlays with Display as Wire
Support both opaque and masked transparency weight overlays at
the same time.

Pull Request: https://projects.blender.org/blender/blender/pulls/134942
2025-02-25 15:55:16 +01:00
Dalai Felinto
f5d929dbb1 Point Cloud: Draw selection overlay
This uses a fixed point size for selection, so that point selection is always visible
regardless of radius size.

The radius size is used to offset the selection point, so it is always visible, even when the radius is too large.

Co-authored by Hans Goudey.

---

Pull Request: https://projects.blender.org/blender/blender/pulls/134908
2025-02-25 15:20:52 +01:00
Clément Foucault
1b902e305c Refactor: Select: Use IndexRange for the element selection
This cleanup naming convention and code clarity. There
is no functional change.

- `elem_ranges` is changed to a `Map` to avoid relying on
`sel_data->drawn_index`.
- `select_draw_utils.cc` is merged with `select_engine.cc`
- `index_drawn_len` is renamed to `max_index_drawn_len`
- Remove the usage of `DrawData`

Rel #134690

Pull Request: https://projects.blender.org/blender/blender/pulls/134940
2025-02-25 14:40:04 +01:00
Pratik Borhade
d961f8f9ec Grease Pencil: Remove legacy object type references
Remove GP legacy obtype and unused functions
Few hidden bugs are fixed with that:
- Outliner drag-drop for GP material/effect elements now works
- Correct stats are shown in status bar.

Pull Request: https://projects.blender.org/blender/blender/pulls/133957
2025-02-25 10:46:27 +01:00