A compiler/driver bug makes so that we can't rely on image atomics.
Adding a write that is never executed after the atomics tricks
the compiler to issue the correct synchronisation instruction.
This fixes a bunch of our render tests differences.
We will keep this workaround until this is fixed upstream.
Pull Request: https://projects.blender.org/blender/blender/pulls/146442
This allows to reduce the number of includes for each
tree graph (surface, volume, displacement) and
reduce the code size significantly for most vertex
shaders, speeding up compile time.
Rel #145347
Pull Request: https://projects.blender.org/blender/blender/pulls/146419
These are causing quite a big difference in existing files, which is not
easy to address in versioning. Since the goal of removing this was to
simplify things for us and that's not the case, just revert this change.
This reverts commit ab21755aaf.
Ref #139923
Pull Request: https://projects.blender.org/blender/blender/pulls/146336
This removes unused closure branches in the principled BSDF
code using the Material flags.
On top of this, use constants for weights to use compiler
dead code eliminitation for unused branches when there
is different variants of the principled BSDF node used.
Finally, remove Gbuffer packing cases that are not present
inside the nodetree.
Testing with the same setup as #145347:
| | main (ms) | PR (ms) | Delta (ms) |
| -------- | ----------- | ------------ |------------ |
| Nvidia | 174 | 132 (1.31x) | 42 |
| Mesa AMD | 191 | 170 (1.12x) | 21 |
Barbershop compilation time is almost equal because it is not using
the principled BSDF.
Rel #145347
Pull Request: https://projects.blender.org/blender/blender/pulls/146324
This mode is based on the same athmospheric model as the previous one, but now
also accounts for multiple scattering and reflections from the ground.
This increases the accuracy, especially at low elevations.
Also renames some options for consistency:
- The previous "Nishita" model is now "Single Scattering"
- "Dust" is now "Aerosols"
- Default altitude is now 100m.
Co-authored-by: Lukas Stockner <lukas@lukasstockner.de>
Pull Request: https://projects.blender.org/blender/blender/pulls/140480
Fixes several validation errors when using VMA.
- Always enable buffer device address in VMA as it is already a Blender
requirement.
- Add host access hints when host access is needed.
Pull Request: https://projects.blender.org/blender/blender/pulls/146312
The referenced commit introduced the use of gamma 2.2 or piecewise sRGB
for the backbuffer blit depending on the operating system. This commit
switches from a push constant for this to a preprocessor define.
Ref 5d72498154
Pull Request: https://projects.blender.org/blender/blender/pulls/146170
Dependencies were previously merged manually
inside the generated_sources by EEVEE.
This caused issues with double includes.
Instead, we now only gather the name of the
nodetree dependencies and add them to the
dependencies of the `GeneratedSource`.
This also make the compositor use the `GeneratedSource`
mechanism.
Pull Request: https://projects.blender.org/blender/blender/pulls/146106
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
Pixel buffers will be imported by Cycles in Cuda/OneAPI/HIP
when supported. However the priority and export field is not filled correctly,
resulting in that the priority is always 1 and the buffer is never exported.
Should be backported to 4.5 as Cycles GPU interop isn't working
when using Vulkan.
Regression introduced by: !144422
Pull Request: https://projects.blender.org/blender/blender/pulls/146090
It is usually nice to unroll loops with a different number of
iteration based on a macro. This commit adds this functionality
to our shader preprocessor so that we don't have to manually unroll
these loops.
Pull Request: https://projects.blender.org/blender/blender/pulls/146043
Although this doesn't lead to any different behaviour or fixes any issue
it was an oversight as this would not wait for empty render graphs to be
finished in the order of submission
Pull Request: https://projects.blender.org/blender/blender/pulls/146066
`GHOST_SwapWindowBuffers` doesn't fit well when using swapchains. In
that case an approach where swap chain images are acquired and released
would map better. This PR introduces `GHOST_SwapWindowBufferAcquire`
and `GHOST_SwapWindowBufferRelease` to be more in line with vulkan swap
chains.
Previous implementation would first record all GPU commands based on
the last used swap chain. In case a swapchain needed to be recreated
(window resize, move to other monitor) the recorded commands would
not match the swap chain and could lead to artifacts.
OpenGL only implements the release functions as they don't
have a mechanism to acquire a swap chain image. (Need to validate with
the Metal API how this is working and adapt is needed).
Currently when starting blender on a HDR capable display the first frame
would be based on an sRGB surface and presented on an extended RGB
(or other) surface. As these don't match the first frame could be incorrect and
also lead to UBs as another surface is expected.
Pull Request: https://projects.blender.org/blender/blender/pulls/145728
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
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 avoid using the workaround on known working drivers.
Detected when investigating shader compilation performance.
These new drivers where forced to not use threaded compilation.
Candidate for backport to 4.5 LTS.
Pull Request: https://projects.blender.org/blender/blender/pulls/145969
The link buffer was not free on exit.
Previous implementation was freing it with the
gpu::Batch which is registered as preset.
This commit introduces buffer registration
to free them on exit.
Pull Request: https://projects.blender.org/blender/blender/pulls/145921
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
Even when a device is capable to allocate a buffer with a certain size
it can still fail the allocation due to driver internals. This could be that
the memory area doesn't support the required flags or fragmentation.
This PR changes downloading GPU textures to CPU to use at max buffer
sizes of 2GB. Larger textures will be split over multiple buffers.
Pull Request: https://projects.blender.org/blender/blender/pulls/145568
Maintenance4 contains the maxBufferSize property that contains the
maximum allowed buffer allocation.
This PR uses this property to precheck if allocations will fail. It
was an attempt to improve the reliability of failing allocations but
currently they fail at the driver side.
Pull Request: https://projects.blender.org/blender/blender/pulls/145555
Multiple previous changes made resource pools obsolete. Resource
pools were used to keep track of resources when the frame is rendered.
Multiple frames can be rendered at the same time and resources could
overlap.
This has been replaced (not this commit) to be part of the render graph
and when an submission has completed the resources are recycled.
Continuation of: https://projects.blender.org/blender/blender/pulls/145408
Pull Request: https://projects.blender.org/blender/blender/pulls/145511