Commit Graph

12 Commits

Author SHA1 Message Date
Omar Emara
31444fe5b1 Refactor: Compositor: Use generic container for results
This patch refactors the Result class in the compositor to use
GMutableSpan and std::variant to wrap the result's data. This reduces
the complexity of the code and slightly optimizes performance. This will
also make it easier to add new types and interface with other code like
multi-function procedures.

Pull Request: https://projects.blender.org/blender/blender/pulls/134112
2025-02-06 13:49:44 +01:00
Brecht Van Lommel
1eb1755e1f Cleanup: Various clang-tidy warnings in compositor
Pull Request: https://projects.blender.org/blender/blender/pulls/133734
2025-01-31 17:03:17 +01:00
Omar Emara
3fd894a2d9 Fix #133847: Single value node trees fail in GPU
Nodes that process single values can fail to work for GPU compositing.
That's because multi-function procedures writes to the single values but
never uploads them to the GPU, which is what this patch does.

Pull Request: https://projects.blender.org/blender/blender/pulls/133851
2025-01-31 10:10:22 +01:00
Omar Emara
980226662b Compositor: Allow pixel operations to operate on single values
This patch allows the multi-function procedure pixel operation to
operate on single values. While it previously assumes a 1x1 image for
processing which was later reduced to a single value using input
processors. This is more efficient, but will allow us to use
multi-function procedures for single value sub-trees even in GPU
execution.
2025-01-28 13:54:13 +02:00
Omar Emara
503e2c46a5 Fix: Compositor crash with group of different typed socket
The compositor crashes if a node inside a node group is connected to a
group input that have a different type and the node group is used
without a connection to that input. That's because the compositor code
assumes the type of the group input without implicit type conversion to
the expected type of the node. To fix this, handle implicit conversion
for unconnected sockets as well.
2025-01-06 11:14:27 +02:00
Omar Emara
b3623feab2 Compositor: Support node integer sockets
This patch adds support for using integer sockets in compositor nodes.
This involves updating the Result class, node tree compiler, implicit
conversion operation, multi-function procedure operation, shader
operation, and some operations that supports multiple types.

Shader operation internally treats integers as floats, doing conversion
to and from int when reading and writing. That's because the GPUMaterial
compiler doesn't support integers. This is also the same workaround used
by the shader system. Though the GPU module are eyeing adding support
for integers, so we will update the code once they do that.

Domain realization is not yet supported for integer types, but this is
an internal limitation so far, as we do not plan to add nodes that
outputs integers soon. We are not yet sure how realization should happen
with regards to interpolation and we do not have base functions to
sample integer images, that's why I decided to delay its implementation
when it is actually needed.

Pull Request: https://projects.blender.org/blender/blender/pulls/132599
2025-01-06 10:09:26 +01:00
Omar Emara
4ad1537ff7 Fix: Compositor: Conversion code might fall through
The recently added switch statements in conversion code might fall
through due to missing breaks. Fix that by adding needed breaks.
2025-01-02 17:43:09 +02:00
Omar Emara
0ec7edf411 Cleanup: Compositor: Omit default case for ResultType
Explicitly list all result types to make it easier to add new result
types.
2025-01-02 14:42:44 +02:00
Omar Emara
b6be52c2b2 Refactor: Compositor: Reduplicate type conversion code 2025-01-02 14:02:13 +02:00
Omar Emara
f90572c688 Cleanup: Compositor: Remove typed single value getters 2025-01-01 18:20:58 +02:00
Aras Pranckevicius
496a3749d7 Cleanup: rename namespace realtime_compositor->compositor
Pull Request: https://projects.blender.org/blender/blender/pulls/132008
2024-12-17 11:39:04 +01:00
Aras Pranckevicius
a401089a9d Cleanup: move compositor files out of realtime_compositor folder
By now it is just a "compositor", so move the files one folder up.
Things that were under realtime_compositor/intern move into
already existing intern folder.

Pull Request: https://projects.blender.org/blender/blender/pulls/132004
2024-12-17 10:34:24 +01:00