The goal of this patch is to reduce final shader code footprint to
hopefully reduce shader compile time (see #145347).
This also contains a pass over most shader file to remove unused
include or use more granular ones to reduce final shader code
length.
Testing with the same setup as #145347:
| | main (ms) | PR (ms) | Delta (ms) |
| -------- | ----------- | ------------ |------------ |
| Nvidia | 257 | 207 (1.24x) | 50 |
| Mesa AMD | 323 | 295 (1.09x) | 28 |
In barbershop test scene however the saving are not so noticeable:
| | main (s) | PR (s) | Delta (s) |
| -------- | ----------- | ------------ |------------ |
| Nvidia (OpenGL) | 40 | 39 (1.02x) | 1 |
| Nvidia (Vulkan) | 29 | 29 (1.0x) | 0 |
Pull Request: https://projects.blender.org/blender/blender/pulls/145803
These lines can be removed to avoid parsing them.
This allow to keep the same processing for shared host files.
Also removes a few lines of code to reduce the size of
shader sources.
This also contains a rewrite of the include parsing using
the shader parser.
Pull Request: https://projects.blender.org/blender/blender/pulls/146025
The `eevee_render_to_image` can be called multiple time in the
case of multiview rendering.
To avoid the leak, free the previous instance before allocating
the new one. Reusing the instance doesn't seems to work here.
Another fix will follow this one to fix it more gracefuly.
This fix is kept simple for backporting purpose.
Pull Request: https://projects.blender.org/blender/blender/pulls/146015
This adds a function that can turn an existing `bNodeTree` into an inlined one.
The new node tree has all node groups, repeat zones, closures and bundles
inlined. So it's just a flat tree that ideally can be consumed easily by render
engines. As part of the process, it also does constant folding.
The goal is to support more advanced features from geometry nodes (repeat zones,
etc.) in shader nodes which the evaluator is more limited because it has to be
able to run on the GPU. Creating an inlined `bNodeTree` is likely the most
direct way to get but may also be limiting in the future. Since this is a fairly
local change, it's likely still worth it to support these features in all render
engines without having to make their evaluators significantly more complex.
Some limitations apply here that do not apply in Geometry Nodes. For example,
the iterations count in a repeat zone has to be a constant after constant
folding.
There is also a `Test Inlining Shader Nodes` operator that creates the inlined
tree and creates a group node for it. This is just for testing purposes.
#145811 will make this functionality available to the Python API as well so that
external renderers can use it too.
This reverts commit 8adb3e758f.
This is a partial revert that just always use the fallback
path.
The new optimized path is causing issues with overlays #145446 and
volumes #145420.
The new path will be enabled back when we fix those issues.
Regression [0] from fix for #144035 caused the meaning of sync-select
to be flipped in drawing code, causing UV sync select to display
incorrectly in edit-mode.
Resolve by reversing the value returned by `skip_bm_face` as well as
checks in the drawing code.
Co-authored-by: Eitan Traurig <eitant13@gmail.com>
[0]: e02eb13a59
- Corner Domain Text Overlap: Text is now offset along the angle bisector of
each corner. The offset distance is dynamically adjusted based on the view
zoom and corner angle sharpness.
- Wrap Long Line: Split Vectors, Colors, and Quaternions into labeled line for
each component.
Pull Request: https://projects.blender.org/blender/blender/pulls/145290
These don't really work as scene linear with sRGB transfer function for e.g.
ACEScg, there are not enough bits. If you want wide gamut you need to use
float colors.
Pull Request: https://projects.blender.org/blender/blender/pulls/145763
Functions for convert between the color types and ostream support are
now outside the classes.
Many files were changed to fix cases where direct includes for headers
were missing.
Pull Request: https://projects.blender.org/blender/blender/pulls/145756
This uses a special delayed extraction code path that is not used by
any other drawing code. Ensure we have the subdivided mesh when GPU
subdivision is off similar to the other code paths.
Pull Request: https://projects.blender.org/blender/blender/pulls/145268
Raytracing pipeline in EEVEE interpolates in time for better results.
But depending on the interpolation could try to load a sample that isn't
available.
This PR fixies this for planar probes and screen tracing. In screen
tracing the issue wasn't visible as it the background samples are
always cleared.
This has an expected performance penalty but it could require an
overhaul of EEVEE raytracing for a more efficient solution.
Pull Request: https://projects.blender.org/blender/blender/pulls/145508
Errors produces by the viewport compositor always persists even after
their cause is fixed. That's because the error message is not cleared
before execution, which this patch fixes.
This commit changes the face_ptex_offset from a manually managed int
array to a blender::Array. This required a number of changes:
* The `Subdiv` struct is no longer trivial, so MEM_new and MEM_delete
need to be used
* The Draw module API has an overloaded set of `origindex_buffer`
methods created to take in a Span instead of an int pointer and size
Pull Request: https://projects.blender.org/blender/blender/pulls/141702
The pattern of transforming many position vectors at once is quite
common, both with separate source and result arrays, and when modifying
an array in place. In some cases at least we used a separate function
with a consistent name across files, but there were also many duplicate
parallel transform implementations.
This commit adds these utilities to the BLI_math_matrix.hh API and uses
them where many positions from contiguous arrays are transformed at
once. While there might be a more ideal location for these utilities,
it's consistent with 3936d7a93e, and certainly better
than duplicating them.
This also reduces binary size of my build by 15 KB.
Pull Request: https://projects.blender.org/blender/blender/pulls/145352
Introduced in 24d08e0bae
The above commit introduced a new batch for drawing UVs in the Image
editor that does not consider face selection when drawing the
corresponding UV map. This was done to reuse the IBO used in object
mode.
Unfortunately, this change didn't account for the case of being able to
select faces in the 3D Viewport (i.e. in Edit or Texture Paint mode)
while also viewing the Image Editor in Paint Mode.
To fix this, the following changes have been made:
* Introduce a new case when drawing the `MeshUV` overlay for objects
being edited.
* Add two new IBO types and a new batch type to clearly differentiate
between the above cases when extracting mesh data.
* Fixes some incorrect usage of the `sync_selection` concept
Pull Request: https://projects.blender.org/blender/blender/pulls/144105
Implementation of the design task #142969.
This adds the following:
- Exact GPU interpolation of curves of all types.
- Radius attribute support.
- Cyclic curve support.
- Resolution attribute support.
- New Cylinder hair shape type.

What changed:
- EEVEE doesn't compute random normals for strand hairs anymore. These are considered legacy now.
- EEVEE now have an internal shadow bias to avoid self shadowing on hair.
- Workbench Curves Strip display option is no longer flat and has better shading.
- Legacy Hair particle system evaluates radius at control points before applying additional subdivision. This now matches Cycles.
- Color Attribute Node without a name do not fetch the active color attribute anymore. This now matches Cycles.
Notes:
- This is not 100% matching the CPU implementation for interpolation (see the epsilons in the tests).
- Legacy Hair Particle points is now stored in local space after interpolation.
The new cylinder shape allows for more correct hair shading in workbench and better intersection in EEVEE.
| | Strand | Strip | Cylinder |
| ---- | --- | --- | --- |
| Main |  |  | N/A |
| PR |  |  |  |
| | Strand | Strip | Cylinder |
| ---- | --- | --- | --- |
| Main |  | | N/A |
| PR | ||  |
Cyclic Curve, Mixed curve type, and proper radius support:

Test file for attribute lookup: [test_attribute_lookup.blend](/attachments/1d54dd06-379b-4480-a1c5-96adc1953f77)
Follow Up Tasks:
- Correct full tube segments orientation based on tangent and normal attributes
- Correct V resolution property per object
- More attribute type support (currently only color)
TODO:
- [x] Attribute Loading Changes
- [x] Generic Attributes
- [x] Length Attribute
- [x] Intercept Attribute
- [x] Original Coordinate Attribute
- [x] Cyclic Curves
- [x] Legacy Hair Particle conversion
- [x] Attribute Loading
- [x] Additional Subdivision
- [x] Move some function to generic headers (VertBuf, OffsetIndices)
- [x] Fix default UV/Color attribute assignment
Pull Request: https://projects.blender.org/blender/blender/pulls/143180
Optimize instancing performance by syncing all instances at once.
Part of #130291
At the moment, it only works for certain Object types in Workbench and
Overlay.
Everything else follows a path similar to the previous one.
Performance on instancing heavy scenes can range from 1.5x to 3x faster
depending on hardware and platform.
Pull Request: https://projects.blender.org/blender/blender/pulls/140378
In this instance the texture loading was using another
`threaded_for` loop internally which created conflict with
the top most `threaded_for`.
Using task isolation fixes the issue.
Candidate for backporting to 4.5 LTS.
Pull Request: https://projects.blender.org/blender/blender/pulls/145124
Running valgrind on a render test exhibit a lot of warnings
about `Conditional jump or move depends on uninitialised value(s)`.
This patch makes sure to initialize the memory to avoid
platform dependent bugs.
Pull Request: https://projects.blender.org/blender/blender/pulls/144995
- Return evaluated points as function return value.
Used in cases when only limit or final point is requested, without
partial derivatives.
- Re-order function argument list and use default argument values to
simplify usage in the simple/typical cases.
No functional changes expected.