Compositor: Remove now-unused "tiled" implementation #118819

Merged
Aras Pranckevicius merged 20 commits from aras_p/blender:com_remove_tiled into main 2024-02-28 16:59:26 +01:00
22 changed files with 5 additions and 438 deletions
Showing only changes of commit f75f92b528 - Show all commits

View File

@ -459,16 +459,12 @@ if(WITH_COMPOSITOR_CPU)
operations/COM_GammaOperation.h
operations/COM_MixOperation.cc
operations/COM_MixOperation.h
operations/COM_ReadBufferOperation.cc
operations/COM_ReadBufferOperation.h
operations/COM_SetColorOperation.cc
operations/COM_SetColorOperation.h
operations/COM_SetValueOperation.cc
operations/COM_SetValueOperation.h
operations/COM_SetVectorOperation.cc
operations/COM_SetVectorOperation.h
operations/COM_WriteBufferOperation.cc
operations/COM_WriteBufferOperation.h
operations/COM_MathBaseOperation.cc
operations/COM_MathBaseOperation.h
@ -522,8 +518,6 @@ if(WITH_COMPOSITOR_CPU)
operations/COM_TransformOperation.h
operations/COM_TranslateOperation.cc
operations/COM_TranslateOperation.h
operations/COM_WrapOperation.cc
operations/COM_WrapOperation.h
# Filter operations
operations/COM_ConvolutionEdgeFilterOperation.cc

View File

@ -70,8 +70,6 @@ struct Render;
* \page executing Executing
* \section prepare Prepare execution
*
* during the preparation of the execution All ReadBufferOperation will receive an offset.
* This offset is used during execution as an optimization trick
* Next all operations will be initialized for execution \see NodeOperation.init_execution
* Next all ExecutionGroup's will be initialized for execution \see ExecutionGroup.init_execution
* this all is controlled from \see ExecutionSystem.execute

View File

@ -12,10 +12,8 @@
#include "IMB_imbuf.hh"
#include "IMB_imbuf_types.hh"
#include "COM_ReadBufferOperation.h"
#include "COM_SetValueOperation.h"
#include "COM_ViewerOperation.h"
#include "COM_WriteBufferOperation.h"
namespace blender::compositor {
@ -75,12 +73,6 @@ int DebugInfo::graphviz_operation(const ExecutionSystem *system,
else if (operation->get_flags().is_set_operation) {
fillcolor = "khaki1";
}
else if (operation->get_flags().is_read_buffer_operation) {
fillcolor = "darkolivegreen3";
}
else if (operation->get_flags().is_write_buffer_operation) {
fillcolor = "darkorange";
}
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "// OPERATION: %p\r\n", operation);
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "\"O_%p\"", operation);
@ -269,27 +261,6 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma
len += graphviz_operation(system, operation, str + len, maxlen > len ? maxlen - len : 0);
}
for (NodeOperation *operation : system->operations_) {
if (operation->get_flags().is_read_buffer_operation) {
ReadBufferOperation *read = (ReadBufferOperation *)operation;
WriteBufferOperation *write = read->get_memory_proxy()->get_write_buffer_operation();
std::vector<std::string> &read_groups = op_groups[read];
std::vector<std::string> &write_groups = op_groups[write];
for (int k = 0; k < write_groups.size(); k++) {
for (int l = 0; l < read_groups.size(); l++) {
len += snprintf(str + len,
maxlen > len ? maxlen - len : 0,
"\"O_%p%s\" -> \"O_%p%s\" [style=dotted]\r\n",
write,
write_groups[k].c_str(),
read,
read_groups[l].c_str());
}
}
}
}
for (NodeOperation *op : system->operations_) {
for (NodeOperationInput &to : op->inputs_) {
NodeOperationOutput *from = to.get_link();

View File

@ -1,4 +1,4 @@
/* SPDX-FileCopyrightText: 2011 Blender Authors
/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
@ -9,7 +9,6 @@ namespace blender::compositor {
MemoryProxy::MemoryProxy(DataType datatype)
{
write_buffer_operation_ = nullptr;
buffer_ = nullptr;
datatype_ = datatype;
}

View File

@ -13,7 +13,6 @@
namespace blender::compositor {
class MemoryBuffer;
class WriteBufferOperation;
/**
* \brief A MemoryProxy is a unique identifier for a memory buffer.
@ -23,11 +22,6 @@ class WriteBufferOperation;
*/
class MemoryProxy {
private:
/**
* \brief reference to the output operation of the executiongroup
*/
WriteBufferOperation *write_buffer_operation_;
/**
* \brief the allocated memory
*/
@ -41,24 +35,6 @@ class MemoryProxy {
public:
MemoryProxy(DataType type);
/**
* \brief set the WriteBufferOperation that is responsible for writing to this MemoryProxy
* \param operation:
*/
void set_write_buffer_operation(WriteBufferOperation *operation)
{
write_buffer_operation_ = operation;
}
/**
* \brief get the WriteBufferOperation that is responsible for writing to this MemoryProxy
* \return WriteBufferOperation
*/
WriteBufferOperation *get_write_buffer_operation() const
{
return write_buffer_operation_;
}
/**
* \brief allocate memory of size width x height
*/

View File

@ -5,7 +5,6 @@
#include <cstdio>
#include "COM_ExecutionSystem.h"
#include "COM_ReadBufferOperation.h"
#include "COM_NodeOperation.h" /* own include */
@ -325,12 +324,6 @@ std::ostream &operator<<(std::ostream &os, const NodeOperationFlags &node_operat
if (node_operation_flags.is_set_operation) {
os << "set_operation,";
}
if (node_operation_flags.is_write_buffer_operation) {
os << "write_buffer,";
}
if (node_operation_flags.is_read_buffer_operation) {
os << "read_buffer,";
}
if (node_operation_flags.is_proxy_operation) {
os << "proxy,";
}
@ -362,16 +355,6 @@ std::ostream &operator<<(std::ostream &os, const NodeOperation &node_operation)
os << ",name=" << node_operation.get_name();
}
os << ",flags={" << flags << "}";
if (flags.is_read_buffer_operation) {
const ReadBufferOperation *read_operation = (const ReadBufferOperation *)&node_operation;
const MemoryProxy *proxy = read_operation->get_memory_proxy();
if (proxy) {
const WriteBufferOperation *write_operation = proxy->get_write_buffer_operation();
if (write_operation) {
os << ",write=" << (NodeOperation &)*write_operation;
}
}
}
os << ")";
return os;

View File

@ -26,7 +26,6 @@
namespace blender::compositor {
class ReadBufferOperation;
class ExecutionSystem;
class NodeOperation;
class NodeOperationOutput;
@ -195,8 +194,6 @@ struct NodeOperationFlags {
* TODO: To be replaced by is_constant_operation flag once tiled implementation is removed.
*/
bool is_set_operation : 1;
bool is_write_buffer_operation : 1;
bool is_read_buffer_operation : 1;
bool is_proxy_operation : 1;
bool is_viewer_operation : 1;
bool is_preview_operation : 1;
@ -227,8 +224,6 @@ struct NodeOperationFlags {
use_viewer_border = false;
is_canvas_set = false;
is_set_operation = false;
is_read_buffer_operation = false;
is_write_buffer_operation = false;
is_proxy_operation = false;
is_viewer_operation = false;
is_preview_operation = false;

View File

@ -12,12 +12,10 @@
#include "COM_Debug.h"
#include "COM_PreviewOperation.h"
#include "COM_ReadBufferOperation.h"
#include "COM_SetColorOperation.h"
#include "COM_SetValueOperation.h"
#include "COM_SetVectorOperation.h"
#include "COM_ViewerOperation.h"
#include "COM_WriteBufferOperation.h"
#include "COM_ConstantFolder.h"
#include "COM_NodeOperationBuilder.h" /* own include */
@ -518,13 +516,6 @@ static void find_reachable_operations_recursive(Tags &reachable, NodeOperation *
find_reachable_operations_recursive(reachable, &input->get_link()->get_operation());
}
}
/* associated write-buffer operations are executed as well */
if (op->get_flags().is_read_buffer_operation) {
ReadBufferOperation *read_op = (ReadBufferOperation *)op;
MemoryProxy *memproxy = read_op->get_memory_proxy();
find_reachable_operations_recursive(reachable, memproxy->get_write_buffer_operation());
}
}
void NodeOperationBuilder::prune_operations()
@ -607,15 +598,6 @@ std::ostream &operator<<(std::ostream &os, const NodeOperationBuilder &builder)
os << " op" << link.from()->get_operation().get_id() << " -> op"
<< link.to()->get_operation().get_id() << ";\n";
}
for (const NodeOperation *operation : builder.get_operations()) {
if (operation->get_flags().is_read_buffer_operation) {
const ReadBufferOperation &read_operation = static_cast<const ReadBufferOperation &>(
*operation);
const WriteBufferOperation &write_operation =
*read_operation.get_memory_proxy()->get_write_buffer_operation();
os << " op" << write_operation.get_id() << " -> op" << read_operation.get_id() << ";\n";
}
}
os << "}\n";
os << "# Builder end\n";

View File

@ -23,7 +23,6 @@ class NodeOperationInput;
class NodeOperationOutput;
class PreviewOperation;
class WriteBufferOperation;
class ViewerOperation;
class ConstantOperation;

View File

@ -6,7 +6,6 @@
#include "COM_CPUDevice.h"
#include "COM_CompositorContext.h"
#include "COM_WriteBufferOperation.h"
#include "MEM_guardedalloc.h"

View File

@ -1,10 +1,8 @@
/* SPDX-FileCopyrightText: 2011 Blender Authors
/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "COM_SocketProxyNode.h"
#include "COM_ReadBufferOperation.h"
#include "COM_WriteBufferOperation.h"
namespace blender::compositor {
@ -43,47 +41,4 @@ void SocketProxyNode::convert_to_operations(NodeConverter &converter,
converter.map_output_socket(get_output_socket(), proxy_output);
}
SocketBufferNode::SocketBufferNode(bNode *editor_node,
bNodeSocket *editor_input,
bNodeSocket *editor_output)
: Node(editor_node, false)
{
DataType dt;
dt = DataType::Value;
if (editor_input->type == SOCK_RGBA) {
dt = DataType::Color;
}
if (editor_input->type == SOCK_VECTOR) {
dt = DataType::Vector;
}
this->add_input_socket(dt, editor_input);
dt = DataType::Value;
if (editor_output->type == SOCK_RGBA) {
dt = DataType::Color;
}
if (editor_output->type == SOCK_VECTOR) {
dt = DataType::Vector;
}
this->add_output_socket(dt, editor_output);
}
void SocketBufferNode::convert_to_operations(NodeConverter &converter,
const CompositorContext & /*context*/) const
{
NodeOutput *output = this->get_output_socket(0);
NodeInput *input = this->get_input_socket(0);
DataType datatype = output->get_data_type();
WriteBufferOperation *write_operation = new WriteBufferOperation(datatype);
ReadBufferOperation *read_operation = new ReadBufferOperation(datatype);
read_operation->set_memory_proxy(write_operation->get_memory_proxy());
converter.add_operation(write_operation);
converter.add_operation(read_operation);
converter.map_input_socket(input, write_operation->get_input_socket(0));
converter.map_output_socket(output, read_operation->get_output_socket());
}
} // namespace blender::compositor

View File

@ -1,4 +1,4 @@
/* SPDX-FileCopyrightText: 2011 Blender Authors
/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
@ -35,11 +35,4 @@ class SocketProxyNode : public Node {
bool use_conversion_;
};
class SocketBufferNode : public Node {
public:
SocketBufferNode(bNode *editor_node, bNodeSocket *editor_input, bNodeSocket *editor_output);
void convert_to_operations(NodeConverter &converter,
const CompositorContext &context) const override;
};
} // namespace blender::compositor

View File

@ -5,8 +5,6 @@
#include "COM_TranslateNode.h"
#include "COM_TranslateOperation.h"
#include "COM_WrapOperation.h"
#include "COM_WriteBufferOperation.h"
namespace blender::compositor {

View File

@ -91,7 +91,7 @@ static void read_input_corners(NodeOperation *op, const int first_input_idx, flo
/* ******** PlaneCornerPinMaskOperation ******** */
PlaneCornerPinMaskOperation::PlaneCornerPinMaskOperation() : corners_ready_(false)
PlaneCornerPinMaskOperation::PlaneCornerPinMaskOperation()
{
add_input_socket(DataType::Vector);
add_input_socket(DataType::Vector);
@ -139,7 +139,7 @@ void PlaneCornerPinMaskOperation::get_area_of_interest(const int /*input_idx*/,
/* ******** PlaneCornerPinWarpImageOperation ******** */
PlaneCornerPinWarpImageOperation::PlaneCornerPinWarpImageOperation() : corners_ready_(false)
PlaneCornerPinWarpImageOperation::PlaneCornerPinWarpImageOperation()
{
add_input_socket(DataType::Vector);
add_input_socket(DataType::Vector);

View File

@ -17,10 +17,6 @@
namespace blender::compositor {
class PlaneCornerPinMaskOperation : public PlaneDistortMaskOperation {
private:
/* TODO(manzanilla): to be removed with tiled implementation. */
bool corners_ready_;
public:
PlaneCornerPinMaskOperation();
@ -34,9 +30,6 @@ class PlaneCornerPinMaskOperation : public PlaneDistortMaskOperation {
};
class PlaneCornerPinWarpImageOperation : public PlaneDistortWarpImageOperation {
private:
bool corners_ready_;
public:
PlaneCornerPinWarpImageOperation();

View File

@ -1,44 +0,0 @@
/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "COM_ReadBufferOperation.h"
#include "COM_WriteBufferOperation.h"
namespace blender::compositor {
ReadBufferOperation::ReadBufferOperation(DataType datatype)
{
this->add_output_socket(datatype);
single_value_ = false;
offset_ = 0;
buffer_ = nullptr;
flags_.is_read_buffer_operation = true;
}
void ReadBufferOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
{
if (memory_proxy_ != nullptr) {
WriteBufferOperation *operation = memory_proxy_->get_write_buffer_operation();
operation->determine_canvas(preferred_area, r_area);
operation->set_canvas(r_area);
single_value_ = operation->is_single_value();
}
}
void ReadBufferOperation::read_resolution_from_write_buffer()
{
if (memory_proxy_ != nullptr) {
WriteBufferOperation *operation = memory_proxy_->get_write_buffer_operation();
this->set_width(operation->get_width());
this->set_height(operation->get_height());
}
}
void ReadBufferOperation::update_memory_buffer()
{
buffer_ = this->get_memory_proxy()->get_buffer();
}
} // namespace blender::compositor

View File

@ -1,50 +0,0 @@
/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "COM_MemoryBuffer.h"
#include "COM_MemoryProxy.h"
#include "COM_NodeOperation.h"
namespace blender::compositor {
class ReadBufferOperation : public NodeOperation {
private:
MemoryProxy *memory_proxy_;
bool single_value_; /* single value stored in buffer, copied from associated write operation */
unsigned int offset_;
MemoryBuffer *buffer_;
public:
ReadBufferOperation(DataType datatype);
void set_memory_proxy(MemoryProxy *memory_proxy)
{
memory_proxy_ = memory_proxy;
}
MemoryProxy *get_memory_proxy() const
{
return memory_proxy_;
}
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
void set_offset(unsigned int offset)
{
offset_ = offset;
}
unsigned int get_offset() const
{
return offset_;
}
MemoryBuffer *get_input_memory_buffer(MemoryBuffer **memory_buffers) override
{
return memory_buffers[offset_];
}
void read_resolution_from_write_buffer();
void update_memory_buffer();
};
} // namespace blender::compositor

View File

@ -15,9 +15,6 @@ class RotateOperation : public MultiThreadedOperation {
SocketReader *image_socket_;
SocketReader *degree_socket_;
/* TODO(manzanilla): to be removed with tiled implementation. */
float center_x_;
float center_y_;
float cosine_;
float sine_;

View File

@ -1,43 +0,0 @@
/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include <cmath>
#include "COM_WrapOperation.h"
namespace blender::compositor {
WrapOperation::WrapOperation(DataType datatype) : ReadBufferOperation(datatype)
{
wrapping_type_ = CMP_NODE_WRAP_NONE;
}
inline float WrapOperation::get_wrapped_original_xpos(float x)
{
if (this->get_width() == 0) {
return 0;
}
while (x < 0) {
x += this->get_width();
}
return fmodf(x, this->get_width());
}
inline float WrapOperation::get_wrapped_original_ypos(float y)
{
if (this->get_height() == 0) {
return 0;
}
while (y < 0) {
y += this->get_height();
}
return fmodf(y, this->get_height());
}
void WrapOperation::set_wrapping(int wrapping_type)
{
wrapping_type_ = wrapping_type;
}
} // namespace blender::compositor

View File

@ -1,25 +0,0 @@
/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "COM_ReadBufferOperation.h"
namespace blender::compositor {
class WrapOperation : public ReadBufferOperation {
private:
int wrapping_type_;
public:
WrapOperation(DataType datatype);
void set_wrapping(int wrapping_type);
float get_wrapped_original_xpos(float x);
float get_wrapped_original_ypos(float y);
void setFactorXY(float factorX, float factorY);
};
} // namespace blender::compositor

View File

@ -1,58 +0,0 @@
/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "COM_WriteBufferOperation.h"
namespace blender::compositor {
WriteBufferOperation::WriteBufferOperation(DataType datatype)
{
this->add_input_socket(datatype);
memory_proxy_ = new MemoryProxy(datatype);
memory_proxy_->set_write_buffer_operation(this);
flags_.is_write_buffer_operation = true;
}
WriteBufferOperation::~WriteBufferOperation()
{
if (memory_proxy_) {
delete memory_proxy_;
memory_proxy_ = nullptr;
}
}
void WriteBufferOperation::init_execution()
{
input_ = this->get_input_operation(0);
memory_proxy_->allocate(this->get_width(), this->get_height());
}
void WriteBufferOperation::deinit_execution()
{
input_ = nullptr;
memory_proxy_->free();
}
void WriteBufferOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
{
NodeOperation::determine_canvas(preferred_area, r_area);
/* make sure there is at least one pixel stored in case the input is a single value */
single_value_ = false;
if (BLI_rcti_size_x(&r_area) == 0) {
r_area.xmax += 1;
single_value_ = true;
}
if (BLI_rcti_size_y(&r_area) == 0) {
r_area.ymax += 1;
single_value_ = true;
}
}
void WriteBufferOperation::read_resolution_from_input_socket()
{
NodeOperation *input_operation = this->get_input_operation(0);
this->set_width(input_operation->get_width());
this->set_height(input_operation->get_height());
}
} // namespace blender::compositor

View File

@ -1,45 +0,0 @@
/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "COM_MemoryProxy.h"
#include "COM_NodeOperation.h"
namespace blender::compositor {
class MemoryProxy;
/**
* \brief NodeOperation to write to a tile
* \ingroup Operation
*/
class WriteBufferOperation : public NodeOperation {
MemoryProxy *memory_proxy_;
bool single_value_; /* single value stored in buffer */
NodeOperation *input_;
public:
WriteBufferOperation(DataType datatype);
~WriteBufferOperation();
MemoryProxy *get_memory_proxy()
{
return memory_proxy_;
}
bool is_single_value() const
{
return single_value_;
}
void init_execution() override;
void deinit_execution() override;
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
void read_resolution_from_input_socket();
inline NodeOperation *get_input()
{
return input_;
}
};
} // namespace blender::compositor