Compositor: Debug stream operator.
Stream operators for NodeOperator and ExecutionGroup to help during debugging.
This commit is contained in:
parent
fa9b05149c
commit
a0f705f18c
|
@ -48,8 +48,29 @@
|
|||
|
||||
namespace blender::compositor {
|
||||
|
||||
ExecutionGroup::ExecutionGroup()
|
||||
std::ostream &operator<<(std::ostream &os, const ExecutionGroupFlags &flags)
|
||||
{
|
||||
if (flags.initialized) {
|
||||
os << "init,";
|
||||
}
|
||||
if (flags.is_output) {
|
||||
os << "output,";
|
||||
}
|
||||
if (flags.complex) {
|
||||
os << "complex,";
|
||||
}
|
||||
if (flags.open_cl) {
|
||||
os << "open_cl,";
|
||||
}
|
||||
if (flags.single_threaded) {
|
||||
os << "single_threaded,";
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
ExecutionGroup::ExecutionGroup(int id)
|
||||
{
|
||||
m_id = id;
|
||||
this->m_bTree = nullptr;
|
||||
this->m_height = 0;
|
||||
this->m_width = 0;
|
||||
|
@ -62,6 +83,15 @@ ExecutionGroup::ExecutionGroup()
|
|||
this->m_executionStartTime = 0;
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const ExecutionGroup &execution_group)
|
||||
{
|
||||
os << "ExecutionGroup(id=" << execution_group.get_id();
|
||||
os << ",flags={" << execution_group.get_flags() << "}";
|
||||
os << ",operation=" << *execution_group.getOutputOperation() << "";
|
||||
os << ")";
|
||||
return os;
|
||||
}
|
||||
|
||||
CompositorPriority ExecutionGroup::getRenderPriority()
|
||||
{
|
||||
return this->getOutputOperation()->getRenderPriority();
|
||||
|
|
|
@ -73,6 +73,8 @@ struct ExecutionGroupFlags {
|
|||
}
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const ExecutionGroupFlags &flags);
|
||||
|
||||
/**
|
||||
* \brief Class ExecutionGroup is a group of Operations that are executed as one.
|
||||
* This grouping is used to combine Operations that can be executed as one whole when
|
||||
|
@ -82,6 +84,10 @@ struct ExecutionGroupFlags {
|
|||
class ExecutionGroup {
|
||||
private:
|
||||
// fields
|
||||
/**
|
||||
* Id of the execution group. For debugging purposes.
|
||||
*/
|
||||
int m_id;
|
||||
|
||||
/**
|
||||
* \brief list of operations in this ExecutionGroup
|
||||
|
@ -232,7 +238,12 @@ class ExecutionGroup {
|
|||
|
||||
public:
|
||||
// constructors
|
||||
ExecutionGroup();
|
||||
ExecutionGroup(int id);
|
||||
|
||||
int get_id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
const ExecutionGroupFlags get_flags() const
|
||||
{
|
||||
|
@ -396,4 +407,6 @@ class ExecutionGroup {
|
|||
#endif
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const ExecutionGroup &execution_group);
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
|
|
@ -70,7 +70,7 @@ class MemoryProxy {
|
|||
/**
|
||||
* \brief get the ExecutionGroup that can be scheduled to calculate a certain chunk.
|
||||
*/
|
||||
ExecutionGroup *getExecutor()
|
||||
ExecutionGroup *getExecutor() const
|
||||
{
|
||||
return this->m_executor;
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ class MemoryProxy {
|
|||
* \brief get the WriteBufferOperation that is responsible for writing to this MemoryProxy
|
||||
* \return WriteBufferOperation
|
||||
*/
|
||||
WriteBufferOperation *getWriteBufferOperation()
|
||||
WriteBufferOperation *getWriteBufferOperation() const
|
||||
{
|
||||
return this->m_writeBufferOperation;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <typeinfo>
|
||||
|
||||
#include "COM_ExecutionSystem.h"
|
||||
#include "COM_ReadBufferOperation.h"
|
||||
#include "COM_defines.h"
|
||||
|
||||
#include "COM_NodeOperation.h" /* own include */
|
||||
|
@ -209,4 +210,72 @@ void NodeOperationOutput::determineResolution(unsigned int resolution[2],
|
|||
}
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const NodeOperationFlags &node_operation_flags)
|
||||
{
|
||||
if (node_operation_flags.complex) {
|
||||
os << "complex,";
|
||||
}
|
||||
if (node_operation_flags.open_cl) {
|
||||
os << "open_cl,";
|
||||
}
|
||||
if (node_operation_flags.single_threaded) {
|
||||
os << "single_threaded,";
|
||||
}
|
||||
if (node_operation_flags.use_render_border) {
|
||||
os << "render_border,";
|
||||
}
|
||||
if (node_operation_flags.use_viewer_border) {
|
||||
os << "view_border,";
|
||||
}
|
||||
if (node_operation_flags.is_resolution_set) {
|
||||
os << "resolution_set,";
|
||||
}
|
||||
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,";
|
||||
}
|
||||
if (node_operation_flags.is_viewer_operation) {
|
||||
os << "viewer,";
|
||||
}
|
||||
if (node_operation_flags.is_preview_operation) {
|
||||
os << "preview,";
|
||||
}
|
||||
if (!node_operation_flags.use_datatype_conversion) {
|
||||
os << "no_conversion,";
|
||||
}
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const NodeOperation &node_operation)
|
||||
{
|
||||
NodeOperationFlags flags = node_operation.get_flags();
|
||||
os << "NodeOperation(";
|
||||
if (!node_operation.get_name().empty()) {
|
||||
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->getMemoryProxy();
|
||||
if (proxy) {
|
||||
const WriteBufferOperation *write_operation = proxy->getWriteBufferOperation();
|
||||
if (write_operation) {
|
||||
os << "write=" << (NodeOperation &)*write_operation << ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
os << ")";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
|
|
@ -250,6 +250,7 @@ struct NodeOperationFlags {
|
|||
*/
|
||||
class NodeOperation {
|
||||
private:
|
||||
std::string m_name;
|
||||
blender::Vector<NodeOperationInput> m_inputs;
|
||||
blender::Vector<NodeOperationOutput> m_outputs;
|
||||
|
||||
|
@ -295,6 +296,16 @@ class NodeOperation {
|
|||
{
|
||||
}
|
||||
|
||||
void set_name(const std::string name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
const std::string get_name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
const NodeOperationFlags get_flags() const
|
||||
{
|
||||
return flags;
|
||||
|
@ -594,4 +605,7 @@ class NodeOperation {
|
|||
#endif
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const NodeOperationFlags &node_operation_flags);
|
||||
std::ostream &operator<<(std::ostream &os, const NodeOperation &node_operation);
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
|
|
@ -125,6 +125,9 @@ void NodeOperationBuilder::convertToOperations(ExecutionSystem *system)
|
|||
void NodeOperationBuilder::addOperation(NodeOperation *operation)
|
||||
{
|
||||
m_operations.append(operation);
|
||||
if (m_current_node) {
|
||||
operation->set_name(m_current_node->getbNode()->name);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeOperationBuilder::mapInputSocket(NodeInput *node_socket,
|
||||
|
@ -658,7 +661,7 @@ static void add_group_operations_recursive(Tags &visited, NodeOperation *op, Exe
|
|||
|
||||
ExecutionGroup *NodeOperationBuilder::make_group(NodeOperation *op)
|
||||
{
|
||||
ExecutionGroup *group = new ExecutionGroup();
|
||||
ExecutionGroup *group = new ExecutionGroup(this->m_groups.size());
|
||||
m_groups.append(group);
|
||||
|
||||
Tags visited;
|
||||
|
|
|
@ -37,10 +37,12 @@ class ReadBufferOperation : public NodeOperation {
|
|||
{
|
||||
this->m_memoryProxy = memoryProxy;
|
||||
}
|
||||
MemoryProxy *getMemoryProxy()
|
||||
|
||||
MemoryProxy *getMemoryProxy() const
|
||||
{
|
||||
return this->m_memoryProxy;
|
||||
}
|
||||
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
|
||||
|
|
Loading…
Reference in New Issue