diff options
author | Manuel Castilla <manzanillawork@gmail.com> | 2021-09-04 17:59:02 +0300 |
---|---|---|
committer | Manuel Castilla <manzanillawork@gmail.com> | 2021-09-04 18:09:59 +0300 |
commit | b225a7c4705104245c2267101adec2f2ee2fe20a (patch) | |
tree | a147d04b821a23e143dd63abc42b1eb514592aed /source/blender/compositor/operations/COM_ConvertOperation.cc | |
parent | d84c79a218e63d0d752d918e2c1cbcc2f90fd35e (diff) |
Compositor: Merge equal operations
Some operations can take a lot of time to execute and
any duplication should be avoided.
This patch implements a compile step that detects
operations with the same type, inputs and parameters that
produce the same result and merge them. Now operations
can generate a hash that represents their output result. They only
need to implement `hash_output_params` and hash any parameter
that affects the output result.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D12341
Diffstat (limited to 'source/blender/compositor/operations/COM_ConvertOperation.cc')
-rw-r--r-- | source/blender/compositor/operations/COM_ConvertOperation.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_ConvertOperation.cc b/source/blender/compositor/operations/COM_ConvertOperation.cc index d377903efea..9a3733dda5b 100644 --- a/source/blender/compositor/operations/COM_ConvertOperation.cc +++ b/source/blender/compositor/operations/COM_ConvertOperation.cc @@ -40,6 +40,10 @@ void ConvertBaseOperation::deinitExecution() this->m_inputOperation = nullptr; } +void ConvertBaseOperation::hash_output_params() +{ +} + void ConvertBaseOperation::update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> inputs) @@ -269,6 +273,12 @@ void ConvertRGBToYCCOperation::executePixelSampled(float output[4], output[3] = inputColor[3]; } +void ConvertRGBToYCCOperation::hash_output_params() +{ + ConvertBaseOperation::hash_output_params(); + hash_param(m_mode); +} + void ConvertRGBToYCCOperation::update_memory_buffer_partial(BuffersIterator<float> &it) { for (; !it.is_end(); ++it) { @@ -327,6 +337,12 @@ void ConvertYCCToRGBOperation::executePixelSampled(float output[4], output[3] = inputColor[3]; } +void ConvertYCCToRGBOperation::hash_output_params() +{ + ConvertBaseOperation::hash_output_params(); + hash_param(m_mode); +} + void ConvertYCCToRGBOperation::update_memory_buffer_partial(BuffersIterator<float> &it) { for (; !it.is_end(); ++it) { |