realize-depth #5

Merged
Arye Ramaty merged 43 commits from David-Haver/blender:realize-depth into WIP-realize-depth 2024-03-31 17:22:49 +02:00
Showing only changes of commit 565dc1f22b - Show all commits

View File

@ -7,6 +7,8 @@
#include "COM_ConstantOperation.h" #include "COM_ConstantOperation.h"
#include "COM_MultiThreadedOperation.h" #include "COM_MultiThreadedOperation.h"
#include <mutex>
namespace blender::compositor { namespace blender::compositor {
class TranslateOperation : public MultiThreadedOperation { class TranslateOperation : public MultiThreadedOperation {
@ -21,6 +23,8 @@ class TranslateOperation : public MultiThreadedOperation {
bool is_delta_set_; bool is_delta_set_;
bool is_relative_; bool is_relative_;
std::mutex mutex_;
protected: protected:
MemoryBufferExtend x_extend_mode_; MemoryBufferExtend x_extend_mode_;
MemoryBufferExtend y_extend_mode_; MemoryBufferExtend y_extend_mode_;
@ -50,6 +54,11 @@ class TranslateOperation : public MultiThreadedOperation {
inline void ensure_delta() inline void ensure_delta()
{ {
if (!is_delta_set_) { if (!is_delta_set_) {
std::unique_lock lock(mutex_);
if (is_delta_set_) {
return;
}
delta_x_ = get_input_operation(X_INPUT_INDEX)->get_constant_value_default(0.0f); delta_x_ = get_input_operation(X_INPUT_INDEX)->get_constant_value_default(0.0f);
delta_y_ = get_input_operation(Y_INPUT_INDEX)->get_constant_value_default(0.0f); delta_y_ = get_input_operation(Y_INPUT_INDEX)->get_constant_value_default(0.0f);
if (get_is_relative()) { if (get_is_relative()) {