BLI code for enums that are meant to be used as "bit flags" defined
an ENUM_OPERATORS macro in BLI_utildefines.h. This cleans up things
related to said macro:
- Move it out into a separate BLI_enum_flags.hh header, instead of
"random bag of things" that is the current place,
- Update it to no longer need manual indication of highest individual
bit value. This originally was added in a31a87f89 (2020 Oct), in
order to silence some UBSan warnings that were coming
from GPU related structures (looking at current GPU code, I don't
think this is happening anymore). However, that caused actual
user-visible bugs due to incorrectly specified max. enum bit value,
and today 14% of all usages have incorrect highest individual
bit value spelled out.
- I have reviewed all usages of operator ~ and none of them are
used for directly producing a DNA-serialized value; all the
usages are for masking out other bits for which the new ~
behavior that just flips all bits is fine.
- Make the macro define flag_is_set() function to ease check of bits
that are set in C++ enum class cases; update existing cases to use
that instead of three other ways that were used.
Pull Request: https://projects.blender.org/blender/blender/pulls/148230
This patch adds proper internal support for 2D vectors in GPU materials,
while previously it used a 3D vector with the Z component ignored as a
workaround. This has no user-facing consequences.
The type conversion file was split into an additional code generation
file for easier refactoring.
Pull Request: https://projects.blender.org/blender/blender/pulls/147983
Scaling images in the compositor sometimes causes images to shift, this
is because the realization domain was computed using the center of the
original image before scaling. To fix this, we make sure the
transformation is actually centered.
This is rarely apparent and thus no tests need to be updated and this
should not be backported for safety.
Pull Request: https://projects.blender.org/blender/blender/pulls/147805
Compositor crashes when connecting a menu output to a float input, this
is because no implicit conversion is supported between the two, and no
handling was done in this case. To fix this, we fallback to a default
value for unsupported implicit conversions.
Pull Request: https://projects.blender.org/blender/blender/pulls/147801
This patch makes a distinction between passes accessed through nodes
like the Render Layers node, and inputs accessed through nodes like the
Group Input node. Previously, the Group Input node returned the passes
of the active scene and view layer accordingly to the name, while now,
it only returns the Image (Combined) pass and the result will be zeros.
Pull Request: https://projects.blender.org/blender/blender/pulls/146831
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
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
Blender compositor ignores nearest interpolation in Vulkan backend.
That's because anisotropic interpolation is used based on same left over
sampler state. To fix this, we clear anisotropic sampling in the
realization shader.
Pull Request: https://projects.blender.org/blender/blender/pulls/145905
This applies an OpenColorIO display, view and look transform on a color
in the scene_linear colorspace.
In general, OpenColorIO configurations do not contain a colorspace for
every view + display, especially if they are modern configs using the
display colorspace and shared view mechanisms. Nor do they include looks.
So the Convert Colorspace node is not sufficient.
Additionally, we would like to avoid making the colorspace list too long
in the default config, as we are adding many new views and transforms.
Exposure, gamma curves and white point functionality are not included
in this node, as there are native ways of doing that in the compositor.
These settings are marked non-editable in the Python API.
Pull Request: https://projects.blender.org/blender/blender/pulls/145069
This patch optimizes nodes with Boolean and Menu inputs for GPU
execution. This is done by using constant links instead of uniforms for
those inputs. This will cause shader recompilation, but is okay since
those inputs rarely change.
Pull Request: https://projects.blender.org/blender/blender/pulls/145329
Previously, we always just used `int` when dealing with menu values on the C++
side. It's currently the only type where we have the same base type (`int`) for
two different socket types (integer and menu sockets). This has some downsides:
* It requires special cases in some places.
* There is no function from static base type to socket type (which is useful for
some utilities like `SocketValueVariant`).
* It implicitly allows operations on menu values that shouldn't be allowed such
as arithmetic operations and conversions to and from other types.
This patch adds a new `MenuValue` type that is used for menu sockets in Geometry
Nodes and the (CPU) Compositor, clarifying the distinction between integer and
menu values.
Pull Request: https://projects.blender.org/blender/blender/pulls/144476
This patch extends the support for menu sockets in the compositor to
also include pixel nodes. Menu sockets are not yet used in any node, so
this has no apparent effect.
Pull Request: https://projects.blender.org/blender/blender/pulls/144436
The compositor ignores translation in certain nodes like Corner Pin.
Users find this unexpected as adjusting the translation of the input has
no effect on the output. The only alternative logical thing to do if
translation exists is to clip the image, which this patch do.
This affects the following nodes:
- File Output.
- Map UV (Image input).
- Corner Pin.
- Plane Track Deform.
- Bokeh Blur (Bokeh Kernel input).
Pull Request: https://projects.blender.org/blender/blender/pulls/144049
The viewport compositor crashes if the user enters a group node if no
viewer node exists. This is because the code still allowed group output
nodes to be added as compositor outputs in none root contexts, which is
forbidden since e34e6373b6. To fix this, we refactor the code to
disallow such cases.
Pull Request: https://projects.blender.org/blender/blender/pulls/143933
The compositor context has a number of pure virtual methods that could
be optional or removed altogether, so this patch refactors that by
reducing unnecessary pure virtual methods.
Pull Request: https://projects.blender.org/blender/blender/pulls/143091
This patch replaces the Composite node with the Group Output node as the
primary compositor output. The old node was removed and versioned. This
was done for consistency with Geometry Nodes and in preparation for more
generic use of the compositor in VSE modifiers, layered compositing, NPR
multi-stage compositing, and more.
The Group Output node relies on the node tree interface, so we now have
a default interface of a single input and a single output. For now, only
the first input is considered while the rest are ignored, just like the
Geometry Nodes design. Furthermore, the input is required to be of type
color. Warnings and errors are issues if any of those are not met, also
similar to Geometry Nodes.
This introduces a new limitation: Composite outputs can no longer exist
in node groups, since they obviously then act as their respective group
outputs.
A refactor for the compositor scheduler is needed to simplify the logic
after this change, but this will be done in a separate patch.
Pull Request: https://projects.blender.org/blender/blender/pulls/142232
The compositor crashes when a group node has an output that is connected
to the compositor output, but the group internally has no Group Output
node. That's because the derived node tree structure would return a null
origin socket for this case, but the null socket is not handled by the
code. To fix this, we assume the input socket in such cases.
Pull Request: https://projects.blender.org/blender/blender/pulls/142944
This patch allows allocating results on the host even if the context
uses GPU. It also adds support for uploading the host result into a GPU
allocated result. This is done to allow using results for storing data
that gets computed on the CPU be end up on the GPU, like some of the
cached resources used by the compositor. Those resources are refactored
accordingly in this patch as well.
Pull Request: https://projects.blender.org/blender/blender/pulls/141745
Implicit conversion for single values always return zero in GPU device.
That's because the conversion data was only stored on the CPU and not
uploaded to the GPU, so we ensure it gets uploaded to GPU.
Pull Request: https://projects.blender.org/blender/blender/pulls/141658
This patch introduces a new Extension Mode option to the Translate node,
replacing the current repeat option and adding an extra Extend mode when
the nearest boundary pixel is sampled. The option allows choosing from
Zero, Repeat, and Extend for each of the axis independently.
A new generic sample method was added to the Result class for sampling
with arbitrary interpolation and extension modes.
Pull Request: https://projects.blender.org/blender/blender/pulls/140607
This patch adds support for the experimental structure types currently
used bu Geometry Nodes. Pixel nodes were declared as function nodes,
which gives dynamic structures for all their sockets. Other nodes now
explicitly declared their inputs as dynamic if not single value, while
the compositor_expects_single_value marker was removed in favor of the
StructureType::Single type.
Pull Request: https://projects.blender.org/blender/blender/pulls/140910
The compositor crashes when using any image coordinates in GPU mode.
That's because the realization operation didn't support Float2 images so
far. To fix this, we handle Float2 images for realization.
This patch removes the Texture node from the compositor, which was based
on the legacy Internal Textures system in Blender. The main motivation
for removing this node is as follows:
- Procedural texturing nodes that previously existed in shading and
geometry nodes are now supported in the compositor, which cover 95% of
what is previously possible using and even adds new possibilities like
Gabor, Bricks, and various improvements to existing texture types.
- The old texture system did not support GPU evaluation, so it was
always computed and cached on the CPU, which causes bad performance
especially for interactive use in the viewport compositor. While the
new nodes are fully GPU accelerated and do not require any caching.
- The Texture node didn't support Texture nodes, so it was not fully
supported and we so far had a warning about that.
- The general direction in Blender is to remove the old texture system,
and the compositor was one of the last main users of it. 5.0 is thus
the ideal time to remove such use.
- The Texture node was always and still is a source of bugs, since it
relies on proper tagging for cache invalidation and updates, which is
so far not perfect. It also suffers from UI/UX issues, since it needs
to be adjusted from the properties panel, which can break if there are
other texture nodes in the context.
This is a breaking change and no versioning was attempted since:
1. It is impossible to get the same results as before due to the use of
different random number generators, so any versioning would just give us
the general look.
2. The Texture node supports a lot of possible configurations. For
instance, each general texture can have many options for the basis type,
and each basis type might have multiple options. So versioning all of
that will take a lot of time, code, and effort.
Pull Request: https://projects.blender.org/blender/blender/pulls/140545
Previously, Float2 images were internally stored as either Float3 or
Float4 images due to limitations in the implementation, which no longer
exists. So this patch refactors the compositor code to store Float2
images in actual Float2 containers, which gives better performance and
memory savings.
Some algorithms were adjusted to operate on Float2 instead of Float3 as
was previously the case.
Pull Request: https://projects.blender.org/blender/blender/pulls/140855
- Adds Anisotropic (EWA) sampling to the compositor's interpolation
enum.
- Any compositor nodes using EWA sampling are refactored and depend
now on the interpolation enum.
- More refactoring in the RNA properties and DNA nodes to unify usage.
Pull Request: https://projects.blender.org/blender/blender/pulls/139833
This patch takes virtual sockets into consideration in the compositor
code base. This mostly involves ignoring them as if they were
unavailable.
This is needed for use with nodes that use Extend sockets.
Pull Request: https://projects.blender.org/blender/blender/pulls/139582
This patch adds a new Image Coordinates node for the compositor. The
Texture Coordinates and Pixel Coordinates outputs were removed from the
Image Info node and were added to the new node instead. Additionally, a
new Normalized Coordinates output was added.
The Pixel Coordinates output now no longer includes half pixel offsets.
Pull Request: https://projects.blender.org/blender/blender/pulls/138935
Cleanup and simplification of GPUMaterial and GPUPass compilation.
See #133674 for details/goals.
- Remove the `draw_manage_shader` thread.
Deferred compilation is now handled by the gpu::ShaderCompiler
through the batch compilation API.
Batch management is handled by the `GPUPassCache`.
- Simplify `GPUMaterial` status tracking so it just queries the
`GPUPass` status.
- Split the `GPUPass` and the `GPUCodegen` code.
- Replaced the (broken) `GPU_material_recalc_flag_get` with the new
`GPU_pass_compilation_timestamp`.
- Add the `GPU_pass_cache_wait_for_all` and
`GPU_shader_batch_wait_for_all`, and remove the busy waits from
EEVEE.
- Remove many unused functions, properties, includes...
Pull Request: https://projects.blender.org/blender/blender/pulls/135637
The Relative To Pixel node considers the original resolution of the
image with no transformation, while it is more useful for it to consider
the realized size instead, because that's what later processing nodes
will be using.