Commit Graph

7581 Commits

Author SHA1 Message Date
Clément Foucault
046f2ac206 Cleanup: EEVEE-Next: Shadow: Wrap loop condition in function 2024-02-02 15:38:48 +01:00
Clément Foucault
18a04965fd Fix: EEVEE-Next: Artifacts with volume + motion blur
The root cause is still unknown. But replacing the
use of the depth texture by the hiz buffer fixes the
issue.

The issue was apparent on Linux + Mesa + AMD.
2024-02-02 15:14:41 +01:00
Brecht Van Lommel
abf4c4d9ef Refactor: Change functions to retrieve GPU textures from images
* For materials with UDIM tiles support, get array and mapping in one call
* For viewers that can use render results, add a dedicated function
* Fix potential use of render results in stencil overlay and grease pencil

Pull Request: https://projects.blender.org/blender/blender/pulls/117563
2024-02-01 20:32:24 +01:00
Miguel Pozo
5d132ac0c6 GPU: Optimize OpenGL indirect drawing overhead
`GLBatch::draw_indirect` has additional overhead compared to
`GLBatch::draw`, and can become a bottleneck in scenes that require
many draw calls (ie. with too many unique meshes).

The performance difference is almost exclusively caused by the
`GL_COMMAND_BARRIER_BIT` barrier that happens on every call.

This PR adds a `GPU_storagebuf_sync_as_indirect_buffer` function that
can be used to place the barrier only once after filling the indirect
buffer content.
This function is a no-op in Vulkan and Metal since they don't need the
barrier.

Pull Request: https://projects.blender.org/blender/blender/pulls/117561
2024-02-01 17:26:08 +01:00
Hans Goudey
dccf0e8699 Cleanup: Move GPU_material.h to C++ 2024-02-01 10:40:30 -05:00
Jeroen Bakker
2f30d220fb Draw: Fix 'draw_resource_id_gen' test
The test uses a none points shader to draw points, which is incorrect
and asserts when using Vulkan. It also didn't test the gpu part of the
pipeline (PassMain).

When using PassMain the order of the resources are expected to be
different as the draw calls are ordered based on the primitive type and
handles.

Pull Request: https://projects.blender.org/blender/blender/pulls/117714
2024-02-01 14:10:51 +01:00
Clément Foucault
4ea9d75b45 Fix: EEVEE-Next: Unitialized variable in denoise temporal
The wrong member was initialized.
Also fix the broken center sample initialization which
was in the wrong color-space.
2024-02-01 12:26:29 +01:00
Jeroen Bakker
97852056b2 Cleanup: Incorrect Parameter Order for Expect
The expect and actual parameters were switched in eevee_surfel_list.
2024-02-01 12:05:28 +01:00
Jeroen Bakker
9e0c78e783 Draw: Remove Unused Refine Shaders
When drawing curves or particle hair, the hair is refined using GPU
shaders. See eParticleRefineShaderType. OpenGL since Blender 4.0
always uses compute shaders. Metal since Blender 4.1 always uses
compute shaders. Vulkan will only uses compute shaders.

The transform feedback isn't used and not supported by our vulkan backend.
Transform feedback workaround was a Apple specific solution as they didn't
support transform feedback. Metal didn't use Compute shaders in
EEVEE-Legacy for performance reasons. Since EEVEE-Next/Workbench-Next
Metal uses compute shaders.

Fixes: #117497
Pull Request: https://projects.blender.org/blender/blender/pulls/117507
2024-02-01 07:48:30 +01:00
Hans Goudey
fac27b1b6b Cleanup: Replace most used of SWAP macro with std::swap
Also remove / replace use of the math vector double swapping functions.
2024-01-31 21:12:16 -05:00
Hans Goudey
7fa5fc02b7 Cleanup: Move BLF headers to C++ 2024-01-31 14:04:56 -05:00
Julian Plak
38e7b4e473 Geometry Nodes: Improve attribute text overlay readability
Improve readability for GN Viewer Node attribute text by adding text
shadow. Also adds similar shadow for bone names.

Pull Request: https://projects.blender.org/blender/blender/pulls/116528
2024-01-31 19:21:49 +01:00
Clément Foucault
749a3880de GL: Remove cube map array workaround 2024-01-31 18:12:59 +01:00
Clément Foucault
71904d7fb3 GL: Remove image load/store workaround
# Conflicts:
#	source/blender/gpu/opengl/gl_backend.cc
2024-01-31 18:12:59 +01:00
Miguel Pozo
f9a0e825c6 Fix #114691: EEVEE-Next: Dithered transparency closure weights
Remove transparency weight from other closure weights.
Since closure weights take transparency into account,
scaling closure colors by their weight applies alpha pre-multiplication to them,
causing dithered transparency materials to be darker than they should be.

Pull Request: https://projects.blender.org/blender/blender/pulls/117675
2024-01-31 17:22:36 +01:00
Clément Foucault
8c02b6eb24 EEVEE-Next: Add normal layer reuse
This allows to save some space in the gbuffer
and improve write performance.

Pull Request: https://projects.blender.org/blender/blender/pulls/117131
2024-01-31 15:36:42 +01:00
Miguel Pozo
ebf9572330 Fix: EEVEE-Next: Remove duplicated translucent weight
It was first added in 5a2aceb671
and again on fdcc8dc689
2024-01-31 15:34:39 +01:00
Clément Foucault
1524dfa0ad DRW: Workaround Mesa shader compilation
This avoid the following error
`Unknown NIR alu instr: div 32    %17 = ineg %16`

This is a debug shader so cost isn't important.
A bug report will be done upstream.
2024-01-31 13:05:55 +01:00
Clément Foucault
58ceeee6f4 Fix: EEVEE-Next: Shader compilation of test shader 2024-01-31 10:40:23 +01:00
Clément Foucault
0ddda9f4b1 EEVEE-Next: Move some renderpass to deferred combined pass
This avoids some complexity inside the material shader.
Also fixes broken light pass that were being colored.

Pull Request: https://projects.blender.org/blender/blender/pulls/117687
2024-01-31 10:36:25 +01:00
Clément Foucault
fdcc8dc689 EEVEE-Next: Add missing translucent weight in deferred
This makes mixed translucent BSDF behave correctly.
2024-01-30 20:35:55 +01:00
Clément Foucault
95b523f268 Cleanup: EEVEE-Next: Replace unused Gbuffer struct 2024-01-30 20:35:55 +01:00
Miguel Pozo
5a2aceb671 Fix: EEVEE-Next: Add missing translucent weight 2024-01-30 20:15:10 +01:00
Clément Foucault
953774fab5 Fix: EEVEE-Next: Shader compilation warnings in surfel list
False warnings about variable being used before initialization.
2024-01-30 17:27:00 +01:00
Clément Foucault
39397fd73e Cleanup: EEVEE-Next: Fix compilation warnings in shadow tests
Warnings were variable used before initialization.
2024-01-30 17:27:00 +01:00
Hans Goudey
961783c444 Cleanup: Move BKE_deform.h to C++ 2024-01-29 19:04:13 -05:00
Miguel Pozo
39f244a227 Fix: EEVEE-Next: Crash on GP render test
Handle null pos_buf.
Skip GP velocity sync.
2024-01-29 20:11:57 +01:00
Aras Pranckevicius
5bd1e0bb22 VSE: replace Subsampled3x3 filter by a general Box filter
Part of overall "improve filtering situation" (#116980): replace Subsampled3x3
(added for blender 3.5 in f210842a72 et al.) strip scaling filter with a
general Box filter.

Subsampled3x3 is really a Box filter ("average pixel values over NxM region"),
hardcoded to 3x3 size. As such, it works pretty well when downscaling images by
3x on each axis. But starts to break down and introduce aliasing at other
scaling factors. Also when scaling up or scaling down by less than 3x, using
total of 9 samples is a bit of overkill and hurts performance.

So instead, calculate the amount of NxM samples needed by looking at scaling
factors on X/Y axes. Note: use at least 2 samples on each axis, so that when
rotation is present, the result edges will get some anti-aliasing, just like it
was happening in previous filter implementation.

Images in PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/117584
2024-01-29 18:41:31 +01:00
Miguel Pozo
f1c061c97b Fix: EEVEE-Next: Volumes
Regressions from 553b1b6f1f and 545f2c04fa
2024-01-29 13:37:47 +01:00
Casey Bianco-Davis
eb693246b6 Fix #117132: GPv3: Edit mode overlay memory leaks
The problem was that `grease_pencil_edit_batch_ensure` would not return early if the buffers already exist, meaning that multiple buffers could be create but only the last ones would be freed.

Pull Request: https://projects.blender.org/blender/blender/pulls/117580
2024-01-29 11:56:45 +01:00
Campbell Barton
be7f89a9f5 Cleanup: spelling in comments 2024-01-29 11:47:42 +11:00
Brecht Van Lommel
745c30ad08 Cleanup: removed unused argument 2024-01-27 00:22:49 +01:00
Jason Fielder
ac61dad14f EEVEE Next: Resolve motion blur intermittent rendering
Fixes issue where motion blur would not display for
certain objects intermittently due to uninitialized
parameters in the ObjectKey struct causing the
motion object map look-up to fail and for motion
parameters to be reset to default, disabling the
effect for the given objects.

Authored by Apple: Michael Parkin-White

Co-authored-by: Michael Parkin-White <mparkinwhite@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/117560
2024-01-26 20:48:00 +01:00
Jeroen Bakker
dd0798927f EEVEE: HiZ Buffer Allocation
EEVEE uses an HiZ buffer. The size of the HiZ buffer is based on the render extent.
Probes assume that the render extent is always bigger than needed for rendering
probes. This assumption is incorrect.

Although this PR fixes this by allocating the required size, it is still renders with
artifacts. These artifacts originate from the lighting module and also needs to be
fixed.

Pull Request: https://projects.blender.org/blender/blender/pulls/117502
2024-01-26 12:06:42 +01:00
Aras Pranckevicius
5ed2eea0f6 ImBuf: Refactor pixel interpolation functions
There exist a bunch of "give me a (filtered) image pixel at this location"
functions, some with duplicated functionality, some with almost the same but
not quite, some that look similar but behave slightly differently, etc.
Some of them were in BLI, some were in ImBuf.

This commit tries to improve the situation by:
* Adding low level interpolation functions to `BLI_math_interp.hh`
  - With documentation on their behavior,
  - And with more unit tests.
* At `ImBuf` level, there are only convenience inline wrappers to the above BLI
  functions (split off into a separate header `IMB_interp.hh`). However, since
  these wrappers are inline,   some things get a tiny bit faster as a side
  effect. E.g. VSE image strip, scaling to 4K resolution (Windows/Ryzen5950X):
  - Nearest filter: 2.33 -> 1.94ms
  - Bilinear filter: 5.83 -> 5.69ms
  - Subsampled3x3 filter: 28.6 -> 22.4ms

Details on the functions:
- All of them have `_byte` and `_fl` suffixes.
- They exist in 4-channel byte (uchar4) and float (float4), as well as
  explicitly passed amount of channels for other float images.
- New functions in BLI `blender::math` namespace:
  - `interpolate_nearest`
  - `interpolate_bilinear`
  - `interpolate_bilinear_wrap`. Note that unlike previous "wrap" function,
    this one no longer requires the caller to do their own wrapping.
  - `interpolate_cubic_bspline`. Previous similar function was called just
    "bicubic" which could mean many different things.
- Same functions exist in `IMB_interp.hh`, they are just convenience that takes
  ImBuf and uses data pointer, width, height from that.

Other bits:
- Renamed `mod_f_positive` to `floored_fmod` (better matches `safe_floored_modf`
  and `floored_modulo` that exist elsewhere), made it branchless and added more
  unit tests.
- `interpolate_bilinear_wrap_fl` no longer clamps result to 0..1 range. Instead,
  moved the clamp to be outside of the call in `paint_image_proj.cc` and
  `paint_utils.cc`. Though the need for clamping in there is also questionable.

Pull Request: https://projects.blender.org/blender/blender/pulls/117387
2024-01-25 11:45:24 +01:00
Jason Fielder
81c1490877 Fix #117169: Resolve crashing hair and curve tests in Metal
Remove divergent code paths for hair refinement. Metal
previously opted for transform-feedback based hair
refinement due to improved performance, but best
to utilise the same compute path with new engines in
mind.

Separate PRs can be made to optimize the compute
path.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/117477
2024-01-25 05:02:19 +01:00
Hans Goudey
75f06bf92a Fix #117459: Sharp shading from only edges ignored in edit mode
The fix in the logic is similar to 5875349390. It's needed
because we now skip computing face corner (BMLoop) normals when the
BMesh is completely flat shaded. It might be completely flat shaded
just because of edge smoothness though, which wasn't taken into
account before.
2024-01-24 12:59:03 -05:00
Hans Goudey
9ab356fe6e Cleanup: Return Vector for View Layer objects and bases retrieval
This simplifies code using these functions because of RAII,
range based for loops, and the lack of output arguments.
Also pass object pointer array as a span in more cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/117482
2024-01-24 18:18:14 +01:00
Hans Goudey
d02d6ec4e5 Cleanup: Remove unnecessary keywords in C++ headers 2024-01-24 11:46:39 -05:00
Hans Goudey
500f09b88a Cleanup: Move metaball BKE headers to C++ 2024-01-24 11:46:39 -05:00
Hans Goudey
02582213de Cleanup: Move BKE_layer.hh to C++ 2024-01-24 10:55:16 -05:00
Jason Fielder
190567f941 EEVEE Next: Optimize HiZ with fast image load store routines
Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/116953
2024-01-24 09:36:25 +01:00
Jeroen Bakker
30a152216e EEVEE: Change UI Naming
This PR renames the UI names of EEVEE render engines, due to the decision to
postpone EEVEE-Next to Blender 4.2.

* `EEVEE` is now named `EEVEE-Next`.
* `EEVEE (Legacy)` is now named `EEVEE`.

Pull Request: https://projects.blender.org/blender/blender/pulls/117437
2024-01-23 10:06:15 +01:00
Jeroen Bakker
062a9f9540 Fix: Compiling EEVEE test cases
Due to recent changes eevee test cases didn't compile anymore.
The issue was that a header file was migrated from C to CPP.

Pull Request: https://projects.blender.org/blender/blender/pulls/117436
2024-01-23 09:14:10 +01:00
Harley Acheson
a4a8683788 UI: Increased Overlay Text Contrast
Increased contrast of light text on any background by increasing the
effectiveness of the dark shadow.

Pull Request: https://projects.blender.org/blender/blender/pulls/117351
2024-01-22 21:57:55 +01:00
Miguel Pozo
18af495cfc Fix: EEVEE-Next: Alpha Blended material pre-pass
Alpha blended materials were being rendered in the forward opaque
pre-pass, causing them to use dithered transparency as well.
2024-01-22 18:11:49 +01:00
Hans Goudey
0618de49ad Cleanup: Replace MIN/MAX macros with C++ functions
Use `std::min` and `std::max` instead. Though keep MIN2 and MAX2
just for C code that hasn't been moved to C++ yet.

Pull Request: https://projects.blender.org/blender/blender/pulls/117384
2024-01-22 15:58:18 +01:00
Aras Pranckevicius
a705259b4b Cleanup: move imbuf .h files to .hh 2024-01-19 20:29:38 +01:00
Jacques Lucke
4b47b46f9c Cleanup: rename PIL to BLI
The term `PIL` stands for "platform independent library." It exists since the `Initial Revision`
commit from 2002. Nowadays, we generally just use the `BLI` (blenlib) prefix for such code
and the `PIL` prefix feels more confusing then useful. Therefore, this patch renames the
`PIL` to `BLI`.

Pull Request: https://projects.blender.org/blender/blender/pulls/117325
2024-01-19 14:32:28 +01:00
Falk David
d3cd2c5556 Fix: GPv3: Error in shader caused by mixing data types 2024-01-19 12:34:59 +01:00