style cleanup: compositor, pointer syntax, function brace placement, line length
This commit is contained in:
@@ -26,7 +26,6 @@
|
||||
|
||||
#include "DNA_node_types.h"
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup Model The data model of the compositor
|
||||
* @defgroup Memory The memory management stuff
|
||||
@@ -38,7 +37,8 @@
|
||||
* @mainpage Introduction of the Blender Compositor
|
||||
*
|
||||
* @section bcomp Blender compositor
|
||||
* This project redesigns the interals of Blender's compositor. The project has been executed in 2011 by At Mind. At Mind is a technology company located in Amsterdam, The Netherlands.
|
||||
* This project redesigns the interals of Blender's compositor. The project has been executed in 2011 by At Mind.
|
||||
* At Mind is a technology company located in Amsterdam, The Netherlands.
|
||||
* The project has been crowdfunded. This code has been released under GPL2 to be used in Blender.
|
||||
*
|
||||
* @section goals The goals of the project
|
||||
@@ -47,32 +47,41 @@
|
||||
* - Make the compositor work faster for you (workflow)
|
||||
*
|
||||
* @section speed Faster compositor
|
||||
* The speedup has been done by making better use of the hardware Blenders is working on. The previous compositor only used a single threaded model to calculate a node. The only exception to this is the Defocus node.
|
||||
* Only when it is possible to calculate two full nodes in parallel a second thread was used. Current workstations have 8-16 threads available, and most of the time these are idle.
|
||||
* The speedup has been done by making better use of the hardware Blenders is working on. The previous compositor only
|
||||
* used a single threaded model to calculate a node. The only exception to this is the Defocus node.
|
||||
* Only when it is possible to calculate two full nodes in parallel a second thread was used.
|
||||
* Current workstations have 8-16 threads available, and most of the time these are idle.
|
||||
*
|
||||
* In the new compositor we want to use as much of threads as possible. Even new OpenCL capable GPU-hardware can be used for calculation.
|
||||
* In the new compositor we want to use as much of threads as possible. Even new OpenCL capable GPU-hardware can be
|
||||
* used for calculation.
|
||||
*
|
||||
* @section workflow Work faster
|
||||
* The previous compositor only showed the final image. The compositor could wait a long time before seeing the result of his work. The new compositor will work in a way that it will focus on getting information back to the user.
|
||||
* The previous compositor only showed the final image. The compositor could wait a long time before seeing the result
|
||||
* of his work. The new compositor will work in a way that it will focus on getting information back to the user.
|
||||
* It will prioritise its work to get earlier user feedback.
|
||||
*
|
||||
* @page memory Memory model
|
||||
* The main issue is the type of memory model to use. Blender is used by consumers and professionals. Ranging from low-end machines to very high-end machines. The system should work on high-end machines and on low-end machines.
|
||||
* The main issue is the type of memory model to use. Blender is used by consumers and professionals.
|
||||
* Ranging from low-end machines to very high-end machines.
|
||||
* The system should work on high-end machines and on low-end machines.
|
||||
*
|
||||
*
|
||||
* @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
|
||||
* 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.initExecution
|
||||
* Next all ExecutionGroup's will be initialized for execution @see ExecutionGroup.initExecution
|
||||
* this all is controlled from @see ExecutionSystem.execute
|
||||
*
|
||||
* @section priority Render priority
|
||||
* Render priority is an priority of an output node. A user has a different need of Render priorities of output nodes than during editing.
|
||||
* Render priority is an priority of an output node. A user has a different need of Render priorities of output nodes
|
||||
* than during editing.
|
||||
* for example. the Active ViewerNode has top priority during editing, but during rendering a CompositeNode has.
|
||||
* All NodeOperation has a setting for their renderpriority, but only for output NodeOperation these have effect.
|
||||
* In ExecutionSystem.execute all priorities are checked. For every priority the ExecutionGroup's are check if the priority do match.
|
||||
* In ExecutionSystem.execute all priorities are checked. For every priority the ExecutionGroup's are check if the
|
||||
* priority do match.
|
||||
* When match the ExecutionGroup will be executed (this happens in serial)
|
||||
*
|
||||
* @see ExecutionSystem.execute control of the Render priority
|
||||
@@ -82,7 +91,8 @@
|
||||
* @section order Chunk order
|
||||
*
|
||||
* When a ExecutionGroup is executed, first the order of chunks are determined.
|
||||
* The settings are stored in the ViewerNode inside the ExecutionGroup. ExecutionGroups that have no viewernode, will use a default one.
|
||||
* The settings are stored in the ViewerNode inside the ExecutionGroup. ExecutionGroups that have no viewernode,
|
||||
* will use a default one.
|
||||
* There are several possible chunk orders
|
||||
* - [@ref OrderOfChunks.COM_TO_CENTER_OUT]: Start calculating from a configurable point and order by nearest chunk
|
||||
* - [@ref OrderOfChunks.COM_TO_RANDOM]: Randomize all chunks.
|
||||
@@ -100,7 +110,8 @@
|
||||
* @see OrderOfChunks
|
||||
*
|
||||
* @section interest Area of interest
|
||||
* An ExecutionGroup can have dependancies to other ExecutionGroup's. Data passing from one ExecutionGroup to another one are stored in 'chunks'.
|
||||
* An ExecutionGroup can have dependancies to other ExecutionGroup's. Data passing from one ExecutionGroup to another
|
||||
* one are stored in 'chunks'.
|
||||
* If not all input chunks are available the chunk execution will not be scheduled.
|
||||
* <pre>
|
||||
* +-------------------------------------+ +--------------------------------------+
|
||||
@@ -125,9 +136,12 @@
|
||||
* </pre>
|
||||
*
|
||||
* In the above example ExecutionGroup B has an outputoperation (ViewerOperation) and is being executed.
|
||||
* The first chunk is evaluated [@ref ExecutionGroup.scheduleChunkWhenPossible], but not all input chunks are available. The relevant ExecutionGroup (that can calculate the missing chunks; ExecutionGroup A) is
|
||||
* Asked to calculate the area ExecutionGroup B is missing. [@ref ExecutionGroup.scheduleAreaWhenPossible]
|
||||
* ExecutionGroup B checks what chunks the area spans, and tries to schedule these chunks. If all input data is available these chunks are scheduled [@ref ExecutionGroup.scheduleChunk]
|
||||
* The first chunk is evaluated [@ref ExecutionGroup.scheduleChunkWhenPossible],
|
||||
* but not all input chunks are available. The relevant ExecutionGroup (that can calculate the missing chunks;
|
||||
* ExecutionGroup A) is asked to calculate the area ExecutionGroup B is missing.
|
||||
* [@ref ExecutionGroup.scheduleAreaWhenPossible]
|
||||
* ExecutionGroup B checks what chunks the area spans, and tries to schedule these chunks.
|
||||
* If all input data is available these chunks are scheduled [@ref ExecutionGroup.scheduleChunk]
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
@@ -166,7 +180,8 @@
|
||||
*
|
||||
* This happens until all chunks of (ExecutionGroup B) are finished executing or the user break's the process.
|
||||
*
|
||||
* NodeOperation like the ScaleOperation can influence the area of interest by reimplementing the [@ref NodeOperation.determineAreaOfInterest] method
|
||||
* NodeOperation like the ScaleOperation can influence the area of interest by reimplementing the
|
||||
* [@ref NodeOperation.determineAreaOfInterest] method
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
@@ -188,8 +203,10 @@
|
||||
* </pre>
|
||||
*
|
||||
* @see ExecutionGroup.execute Execute a complete ExecutionGroup. Halts until finished or breaked by user
|
||||
* @see ExecutionGroup.scheduleChunkWhenPossible Tries to schedule a single chunk, checks if all input data is available. Can trigger dependant chunks to be calculated
|
||||
* @see ExecutionGroup.scheduleAreaWhenPossible Tries to schedule an area. This can be multiple chunks (is called from [@ref ExecutionGroup.scheduleChunkWhenPossible])
|
||||
* @see ExecutionGroup.scheduleChunkWhenPossible Tries to schedule a single chunk,
|
||||
* checks if all input data is available. Can trigger dependant chunks to be calculated
|
||||
* @see ExecutionGroup.scheduleAreaWhenPossible Tries to schedule an area. This can be multiple chunks
|
||||
* (is called from [@ref ExecutionGroup.scheduleChunkWhenPossible])
|
||||
* @see ExecutionGroup.scheduleChunk Schedule a chunk on the WorkScheduler
|
||||
* @see NodeOperation.determineDependingAreaOfInterest Influence the area of interest of a chunk.
|
||||
* @see WriteBufferOperation NodeOperation to write to a MemoryProxy/MemoryBuffer
|
||||
@@ -198,27 +215,34 @@
|
||||
* @see MemoryBuffer Allocated memory for a single chunk
|
||||
*
|
||||
* @section workscheduler WorkScheduler
|
||||
* the WorkScheduler is implemented as a static class. the responsibility of the WorkScheduler is to balance WorkPackages to the available and free devices.
|
||||
* the WorkScheduler is implemented as a static class. the responsibility of the WorkScheduler is to balance
|
||||
* WorkPackages to the available and free devices.
|
||||
* the workscheduler can work in 2 states. For witching these between the state you need to recompile blender
|
||||
*
|
||||
* @subsection multithread Multi threaded
|
||||
* Default the workscheduler will place all work as WorkPackage in a queue.
|
||||
* For every CPUcore a working thread is created. These working threads will ask the WorkScheduler if there is work for a specific Device.
|
||||
* For every CPUcore a working thread is created. These working threads will ask the WorkScheduler if there is work
|
||||
* for a specific Device.
|
||||
* the workscheduler will find work for the device and the device will be asked to execute the WorkPackage
|
||||
|
||||
* @subsection singlethread Single threaded
|
||||
* For debugging reasons the multi-threading can be disabled. This is done by changing the COM_CURRENT_THREADING_MODEL to COM_TM_NOTHREAD. When compiling the workscheduler
|
||||
* For debugging reasons the multi-threading can be disabled. This is done by changing the COM_CURRENT_THREADING_MODEL
|
||||
* to COM_TM_NOTHREAD. When compiling the workscheduler
|
||||
* will be changes to support no threading and run everything on the CPU.
|
||||
*
|
||||
* @section devices Devices
|
||||
* A Device within the compositor context is a Hardware component that can used to calculate chunks. This chunk is encapseled in a WorkPackage.
|
||||
* A Device within the compositor context is a Hardware component that can used to calculate chunks.
|
||||
* This chunk is encapseled in a WorkPackage.
|
||||
* the WorkScheduler controls the devices and selects the device where a WorkPackage will be calculated.
|
||||
*
|
||||
* @subsection WS_Devices Workscheduler
|
||||
* The WorkScheduler controls all Devices. When initializing the compositor the WorkScheduler selects all devices that will be used during compositor.
|
||||
* The WorkScheduler controls all Devices. When initializing the compositor the WorkScheduler selects
|
||||
* all devices that will be used during compositor.
|
||||
* There are two types of Devices, CPUDevice and OpenCLDevice.
|
||||
* When an ExecutionGroup schedules a Chunk the schedule method of the WorkScheduler
|
||||
* The Workscheduler determines if the chunk can be run on an OpenCLDevice (and that there are available OpenCLDevice). If this is the case the chunk will be added to the worklist for OpenCLDevice's
|
||||
* The Workscheduler determines if the chunk can be run on an OpenCLDevice
|
||||
* (and that there are available OpenCLDevice). If this is the case the chunk will be added to the worklist for
|
||||
* OpenCLDevice's
|
||||
* otherwise the chunk will be added to the worklist of CPUDevices.
|
||||
*
|
||||
* A thread will read the work-list and sends a workpackage to its device.
|
||||
@@ -227,7 +251,8 @@
|
||||
* @see Device.execute method called to execute a chunk
|
||||
*
|
||||
* @subsection CPUDevice CPUDevice
|
||||
* When a CPUDevice gets a WorkPackage the Device will get the inputbuffer that is needed to calculate the chunk. Allocation is already done by the ExecutionGroup.
|
||||
* When a CPUDevice gets a WorkPackage the Device will get the inputbuffer that is needed to calculate the chunk.
|
||||
* Allocation is already done by the ExecutionGroup.
|
||||
* The outputbuffer of the chunk is being created.
|
||||
* The OutputOperation of the ExecutionGroup is called to execute the area of the outputbuffer.
|
||||
*
|
||||
@@ -269,7 +294,8 @@
|
||||
* @see bNodeTree.edit_quality
|
||||
* @see bNodeTree.render_quality
|
||||
*
|
||||
* - output nodes can have different priorities in the WorkScheduler. This is implemented in the COM_execute function.
|
||||
* - output nodes can have different priorities in the WorkScheduler.
|
||||
* This is implemented in the COM_execute function.
|
||||
*/
|
||||
void COM_execute(bNodeTree *editingtree, int rendering);
|
||||
|
||||
|
@@ -22,7 +22,8 @@
|
||||
|
||||
#include "COM_CPUDevice.h"
|
||||
|
||||
void CPUDevice::execute(WorkPackage *work) {
|
||||
void CPUDevice::execute(WorkPackage *work)
|
||||
{
|
||||
const unsigned int chunkNumber = work->getChunkNumber();
|
||||
ExecutionGroup * executionGroup = work->getExecutionGroup();
|
||||
rcti rect;
|
||||
|
@@ -27,7 +27,8 @@
|
||||
/**
|
||||
* @brief create new ChannelInfo instance and sets the defaults.
|
||||
*/
|
||||
ChannelInfo::ChannelInfo() {
|
||||
ChannelInfo::ChannelInfo()
|
||||
{
|
||||
this->number = 0;
|
||||
this->premultiplied = true;
|
||||
this->type = COM_CT_UNUSED;
|
||||
|
@@ -23,18 +23,20 @@
|
||||
#include "COM_ChunkOrder.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
ChunkOrder::ChunkOrder() {
|
||||
ChunkOrder::ChunkOrder()
|
||||
{
|
||||
this->distance = 0.0;
|
||||
this->number = 0;
|
||||
this->x = 0;
|
||||
this->y = 0;
|
||||
}
|
||||
|
||||
void ChunkOrder::determineDistance(ChunkOrderHotspot **hotspots, unsigned int numberOfHotspots) {
|
||||
void ChunkOrder::determineDistance(ChunkOrderHotspot **hotspots, unsigned int numberOfHotspots)
|
||||
{
|
||||
unsigned int index;
|
||||
double distance = MAXFLOAT;
|
||||
for (index = 0 ; index < numberOfHotspots ; index ++) {
|
||||
ChunkOrderHotspot* hotspot = hotspots[index];
|
||||
ChunkOrderHotspot *hotspot = hotspots[index];
|
||||
double ndistance = hotspot->determineDistance(this->x, this->y);
|
||||
if (ndistance < distance) {
|
||||
distance = ndistance;
|
||||
@@ -43,6 +45,7 @@ void ChunkOrder::determineDistance(ChunkOrderHotspot **hotspots, unsigned int nu
|
||||
this->distance = distance;
|
||||
}
|
||||
|
||||
bool operator<(const ChunkOrder& a, const ChunkOrder& b) {
|
||||
bool operator<(const ChunkOrder& a, const ChunkOrder& b)
|
||||
{
|
||||
return a.distance < b.distance;
|
||||
}
|
||||
|
@@ -23,13 +23,15 @@
|
||||
#include "COM_ChunkOrderHotspot.h"
|
||||
#include <math.h>
|
||||
|
||||
ChunkOrderHotspot::ChunkOrderHotspot(int x, int y, float addition) {
|
||||
ChunkOrderHotspot::ChunkOrderHotspot(int x, int y, float addition)
|
||||
{
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->addition = addition;
|
||||
}
|
||||
|
||||
double ChunkOrderHotspot::determineDistance(int x, int y) {
|
||||
double ChunkOrderHotspot::determineDistance(int x, int y)
|
||||
{
|
||||
int dx = x-this->x;
|
||||
int dy = y-this->y;
|
||||
double result = sqrt((double)(dx*dx+dy*dy));
|
||||
|
@@ -24,13 +24,15 @@
|
||||
#include "COM_defines.h"
|
||||
#include <stdio.h>
|
||||
|
||||
CompositorContext::CompositorContext() {
|
||||
CompositorContext::CompositorContext()
|
||||
{
|
||||
this->scene = NULL;
|
||||
this->quality = COM_QUALITY_HIGH;
|
||||
this->hasActiveOpenCLDevices = false;
|
||||
}
|
||||
|
||||
const int CompositorContext::getFramenumber() const {
|
||||
const int CompositorContext::getFramenumber() const
|
||||
{
|
||||
if (this->scene) {
|
||||
return this->scene->r.cfra;
|
||||
}
|
||||
@@ -39,7 +41,8 @@ const int CompositorContext::getFramenumber() const {
|
||||
}
|
||||
}
|
||||
|
||||
const int CompositorContext::isColorManaged() const {
|
||||
const int CompositorContext::isColorManaged() const
|
||||
{
|
||||
if (this->scene) {
|
||||
return this->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT;
|
||||
}
|
||||
|
@@ -55,14 +55,14 @@ private:
|
||||
* This field is initialized in ExecutionSystem and must only be read from that point on.
|
||||
* @see ExecutionSystem
|
||||
*/
|
||||
Scene* scene;
|
||||
Scene *scene;
|
||||
|
||||
/**
|
||||
* @brief reference to the bNodeTree
|
||||
* This field is initialized in ExecutionSystem and must only be read from that point on.
|
||||
* @see ExecutionSystem
|
||||
*/
|
||||
bNodeTree* bnodetree;
|
||||
bNodeTree *bnodetree;
|
||||
|
||||
/**
|
||||
* @brief does this system have active opencl devices?
|
||||
@@ -88,12 +88,12 @@ public:
|
||||
/**
|
||||
* @brief set the scene of the context
|
||||
*/
|
||||
void setScene(Scene* scene) {this->scene = scene;}
|
||||
void setScene(Scene *scene) {this->scene = scene;}
|
||||
|
||||
/**
|
||||
* @brief set the bnodetree of the context
|
||||
*/
|
||||
void setbNodeTree(bNodeTree* bnodetree) {this->bnodetree = bnodetree;}
|
||||
void setbNodeTree(bNodeTree *bnodetree) {this->bnodetree = bnodetree;}
|
||||
|
||||
/**
|
||||
* @brief get the bnodetree of the context
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
/**
|
||||
* @brief get the scene of the context
|
||||
*/
|
||||
const Scene* getScene() const {return this->scene;}
|
||||
const Scene *getScene() const {return this->scene;}
|
||||
|
||||
/**
|
||||
* @brief set the quality
|
||||
|
@@ -112,7 +112,8 @@
|
||||
#include "COM_DoubleEdgeMaskNode.h"
|
||||
#include "COM_CropNode.h"
|
||||
|
||||
Node* Converter::convert(bNode *bNode) {
|
||||
Node *Converter::convert(bNode *bNode)
|
||||
{
|
||||
Node * node;
|
||||
|
||||
if (bNode->flag & NODE_MUTED) {
|
||||
@@ -353,9 +354,10 @@ case CMP_NODE_OUTPUT_FILE:
|
||||
}
|
||||
return node;
|
||||
}
|
||||
void Converter::convertDataType(SocketConnection* connection, ExecutionSystem *system) {
|
||||
OutputSocket* outputSocket = connection->getFromSocket();
|
||||
InputSocket* inputSocket = connection->getToSocket();
|
||||
void Converter::convertDataType(SocketConnection *connection, ExecutionSystem *system)
|
||||
{
|
||||
OutputSocket *outputSocket = connection->getFromSocket();
|
||||
InputSocket *inputSocket = connection->getToSocket();
|
||||
DataType fromDatatype = outputSocket->getActualDataType();
|
||||
DataType toDatatype = inputSocket->getActualDataType();
|
||||
NodeOperation * converter = NULL;
|
||||
@@ -384,7 +386,8 @@ void Converter::convertDataType(SocketConnection* connection, ExecutionSystem *s
|
||||
}
|
||||
}
|
||||
|
||||
void Converter::convertResolution(SocketConnection *connection, ExecutionSystem *system) {
|
||||
void Converter::convertResolution(SocketConnection *connection, ExecutionSystem *system)
|
||||
{
|
||||
InputSocketResizeMode mode = connection->getToSocket()->getResizeMode();
|
||||
|
||||
NodeOperation * toOperation = (NodeOperation*)connection->getToNode();
|
||||
|
@@ -42,7 +42,7 @@ public:
|
||||
* @see Node
|
||||
* @see MuteNode
|
||||
*/
|
||||
static Node* convert(bNode* bNode);
|
||||
static Node *convert(bNode *bNode);
|
||||
|
||||
/**
|
||||
* @brief This method will add a datetype conversion rule when the to-socket does not support the from-socket actual data type.
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
* @param system the ExecutionSystem to add the conversion to.
|
||||
* @see SocketConnection - a link between two sockets
|
||||
*/
|
||||
static void convertDataType(SocketConnection* connection, ExecutionSystem *system);
|
||||
static void convertDataType(SocketConnection *connection, ExecutionSystem *system);
|
||||
|
||||
/**
|
||||
* @brief This method will add a resolution rule based on the settings of the InputSocket.
|
||||
@@ -65,6 +65,6 @@ public:
|
||||
* @param system the ExecutionSystem to add the conversion to.
|
||||
* @see SocketConnection - a link between two sockets
|
||||
*/
|
||||
static void convertResolution(SocketConnection* connection, ExecutionSystem *system);
|
||||
static void convertResolution(SocketConnection *connection, ExecutionSystem *system);
|
||||
};
|
||||
#endif
|
||||
|
@@ -41,7 +41,8 @@
|
||||
#include "BLI_math.h"
|
||||
#include "COM_ExecutionSystemHelper.h"
|
||||
|
||||
ExecutionGroup::ExecutionGroup() {
|
||||
ExecutionGroup::ExecutionGroup()
|
||||
{
|
||||
this->isOutput = false;
|
||||
this->complex = false;
|
||||
this->chunkExecutionStates = NULL;
|
||||
@@ -57,13 +58,15 @@ ExecutionGroup::ExecutionGroup() {
|
||||
this->chunksFinished = 0;
|
||||
}
|
||||
|
||||
int ExecutionGroup::getRenderPriotrity() {
|
||||
int ExecutionGroup::getRenderPriotrity()
|
||||
{
|
||||
return this->getOutputNodeOperation()->getRenderPriority();
|
||||
}
|
||||
|
||||
bool ExecutionGroup::containsOperation(NodeOperation* operation) {
|
||||
bool ExecutionGroup::containsOperation(NodeOperation *operation)
|
||||
{
|
||||
for (vector<NodeOperation*>::const_iterator iterator = this->operations.begin() ; iterator != this->operations.end() ; ++iterator) {
|
||||
NodeOperation* inListOperation = *iterator;
|
||||
NodeOperation *inListOperation = *iterator;
|
||||
if (inListOperation == operation) {
|
||||
return true;
|
||||
}
|
||||
@@ -71,11 +74,13 @@ bool ExecutionGroup::containsOperation(NodeOperation* operation) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const bool ExecutionGroup::isComplex() const {
|
||||
const bool ExecutionGroup::isComplex() const
|
||||
{
|
||||
return this->complex;
|
||||
}
|
||||
|
||||
bool ExecutionGroup::canContainOperation(NodeOperation* operation) {
|
||||
bool ExecutionGroup::canContainOperation(NodeOperation *operation)
|
||||
{
|
||||
if (!this->initialized) {return true;}
|
||||
if (operation->isReadBufferOperation()) {return true;}
|
||||
if (operation->isWriteBufferOperation()) {return false;}
|
||||
@@ -89,7 +94,8 @@ bool ExecutionGroup::canContainOperation(NodeOperation* operation) {
|
||||
}
|
||||
}
|
||||
|
||||
void ExecutionGroup::addOperation(ExecutionSystem *system, NodeOperation *operation) {
|
||||
void ExecutionGroup::addOperation(ExecutionSystem *system, NodeOperation *operation)
|
||||
{
|
||||
if (containsOperation(operation)) return;
|
||||
if (canContainOperation(operation)) {
|
||||
if (!operation->isBufferOperation()) {
|
||||
@@ -99,8 +105,8 @@ void ExecutionGroup::addOperation(ExecutionSystem *system, NodeOperation *operat
|
||||
}
|
||||
this->operations.push_back(operation);
|
||||
if (operation->isReadBufferOperation()) {
|
||||
ReadBufferOperation* readOperation = (ReadBufferOperation*)operation;
|
||||
WriteBufferOperation* writeOperation = readOperation->getMemoryProxy()->getWriteBufferOperation();
|
||||
ReadBufferOperation *readOperation = (ReadBufferOperation*)operation;
|
||||
WriteBufferOperation *writeOperation = readOperation->getMemoryProxy()->getWriteBufferOperation();
|
||||
this->addOperation(system, writeOperation);
|
||||
}
|
||||
else {
|
||||
@@ -108,7 +114,7 @@ void ExecutionGroup::addOperation(ExecutionSystem *system, NodeOperation *operat
|
||||
for (index = 0 ; index < operation->getNumberOfInputSockets(); index ++) {
|
||||
InputSocket * inputSocket = operation->getInputSocket(index);
|
||||
if (inputSocket->isConnected()) {
|
||||
NodeOperation* node = (NodeOperation*)inputSocket->getConnection()->getFromNode();
|
||||
NodeOperation *node = (NodeOperation*)inputSocket->getConnection()->getFromNode();
|
||||
this->addOperation(system, node);
|
||||
}
|
||||
}
|
||||
@@ -118,7 +124,7 @@ void ExecutionGroup::addOperation(ExecutionSystem *system, NodeOperation *operat
|
||||
if (operation->isWriteBufferOperation()) {
|
||||
WriteBufferOperation * writeoperation = (WriteBufferOperation*)operation;
|
||||
if (writeoperation->getMemoryProxy()->getExecutor() == NULL) {
|
||||
ExecutionGroup* newGroup = new ExecutionGroup();
|
||||
ExecutionGroup *newGroup = new ExecutionGroup();
|
||||
writeoperation->getMemoryProxy()->setExecutor(newGroup);
|
||||
newGroup->addOperation(system, operation);
|
||||
ExecutionSystemHelper::addExecutionGroup(system->getExecutionGroups(), newGroup);
|
||||
@@ -127,7 +133,8 @@ void ExecutionGroup::addOperation(ExecutionSystem *system, NodeOperation *operat
|
||||
}
|
||||
}
|
||||
|
||||
NodeOperation* ExecutionGroup::getOutputNodeOperation() const {
|
||||
NodeOperation *ExecutionGroup::getOutputNodeOperation() const
|
||||
{
|
||||
return this->operations[0]; // the first operation of the group is always the output operation.
|
||||
}
|
||||
|
||||
@@ -151,7 +158,7 @@ void ExecutionGroup::initExecution()
|
||||
unsigned int maxNumber = 0;
|
||||
|
||||
for (index = 0 ; index < this->operations.size(); index ++) {
|
||||
NodeOperation* operation = this->operations[index];
|
||||
NodeOperation *operation = this->operations[index];
|
||||
if (operation->isReadBufferOperation()) {
|
||||
ReadBufferOperation *readOperation = (ReadBufferOperation*)operation;
|
||||
this->cachedReadOperations.push_back(readOperation);
|
||||
@@ -163,7 +170,8 @@ void ExecutionGroup::initExecution()
|
||||
|
||||
}
|
||||
|
||||
void ExecutionGroup::deinitExecution() {
|
||||
void ExecutionGroup::deinitExecution()
|
||||
{
|
||||
if (this->chunkExecutionStates != NULL) {
|
||||
delete[] this->chunkExecutionStates;
|
||||
this->chunkExecutionStates = NULL;
|
||||
@@ -174,8 +182,9 @@ void ExecutionGroup::deinitExecution() {
|
||||
this->cachedReadOperations.clear();
|
||||
this->bTree = NULL;
|
||||
}
|
||||
void ExecutionGroup::determineResolution(unsigned int resolution[]) {
|
||||
NodeOperation* operation = this->getOutputNodeOperation();
|
||||
void ExecutionGroup::determineResolution(unsigned int resolution[])
|
||||
{
|
||||
NodeOperation *operation = this->getOutputNodeOperation();
|
||||
unsigned int preferredResolution[2];
|
||||
preferredResolution[0] = 0;
|
||||
preferredResolution[1] = 0;
|
||||
@@ -184,7 +193,8 @@ void ExecutionGroup::determineResolution(unsigned int resolution[]) {
|
||||
this->setResolution(resolution);
|
||||
}
|
||||
|
||||
void ExecutionGroup::determineNumberOfChunks() {
|
||||
void ExecutionGroup::determineNumberOfChunks()
|
||||
{
|
||||
const float chunkSizef = this->chunkSize;
|
||||
this->numberOfXChunks = ceil(this->width / chunkSizef);
|
||||
this->numberOfYChunks = ceil(this->height / chunkSizef);
|
||||
@@ -194,9 +204,10 @@ void ExecutionGroup::determineNumberOfChunks() {
|
||||
/**
|
||||
* this method is called for the top execution groups. containing the compositor node or the preview node or the viewer node)
|
||||
*/
|
||||
void ExecutionGroup::execute(ExecutionSystem* graph) {
|
||||
void ExecutionGroup::execute(ExecutionSystem *graph)
|
||||
{
|
||||
CompositorContext& context = graph->getContext();
|
||||
const bNodeTree* bTree = context.getbNodeTree();
|
||||
const bNodeTree *bTree = context.getbNodeTree();
|
||||
if (this->width == 0 || this->height == 0) {return;} /// @note: break out... no pixels to calculate.
|
||||
if (bTree->test_break && bTree->test_break(bTree->tbh)) {return;} /// @note: early break out for blur and preview nodes
|
||||
if (this->numberOfChunks == 0) {return;} /// @note: early break out
|
||||
@@ -216,7 +227,7 @@ void ExecutionGroup::execute(ExecutionSystem* graph) {
|
||||
int chunkorder = COM_TO_CENTER_OUT;
|
||||
|
||||
if (operation->isViewerOperation()) {
|
||||
ViewerBaseOperation* viewer = (ViewerBaseOperation*)operation;
|
||||
ViewerBaseOperation *viewer = (ViewerBaseOperation*)operation;
|
||||
centerX = viewer->getCenterX();
|
||||
centerY = viewer->getCenterY();
|
||||
chunkorder = viewer->getChunkOrder();
|
||||
@@ -224,7 +235,7 @@ void ExecutionGroup::execute(ExecutionSystem* graph) {
|
||||
|
||||
switch (chunkorder) {
|
||||
case COM_TO_RANDOM:
|
||||
for (index = 0 ; index < 2* numberOfChunks ; index ++) {
|
||||
for (index = 0 ; index < 2 * numberOfChunks ; index ++) {
|
||||
int index1 = rand()%numberOfChunks;
|
||||
int index2 = rand()%numberOfChunks;
|
||||
int s = chunkOrder[index1];
|
||||
@@ -351,7 +362,8 @@ void ExecutionGroup::execute(ExecutionSystem* graph) {
|
||||
delete[] chunkOrder;
|
||||
}
|
||||
|
||||
MemoryBuffer** ExecutionGroup::getInputBuffers(int chunkNumber) {
|
||||
MemoryBuffer** ExecutionGroup::getInputBuffers(int chunkNumber)
|
||||
{
|
||||
rcti rect;
|
||||
vector<MemoryProxy*> memoryproxies;
|
||||
unsigned int index;
|
||||
@@ -359,7 +371,7 @@ MemoryBuffer** ExecutionGroup::getInputBuffers(int chunkNumber) {
|
||||
|
||||
this->determineDependingMemoryProxies(&memoryproxies);
|
||||
MemoryBuffer **memoryBuffers = new MemoryBuffer*[this->cachedMaxReadBufferOffset];
|
||||
for (index= 0 ; index < this->cachedMaxReadBufferOffset ; index ++) {
|
||||
for (index = 0 ; index < this->cachedMaxReadBufferOffset ; index ++) {
|
||||
memoryBuffers[index] = NULL;
|
||||
}
|
||||
rcti output;
|
||||
@@ -367,13 +379,14 @@ MemoryBuffer** ExecutionGroup::getInputBuffers(int chunkNumber) {
|
||||
ReadBufferOperation *readOperation = (ReadBufferOperation*)this->cachedReadOperations[index];
|
||||
MemoryProxy * memoryProxy = readOperation->getMemoryProxy();
|
||||
this->determineDependingAreaOfInterest(&rect, readOperation, &output);
|
||||
MemoryBuffer* memoryBuffer = memoryProxy->getExecutor()->constructConsolidatedMemoryBuffer(memoryProxy, &output);
|
||||
MemoryBuffer *memoryBuffer = memoryProxy->getExecutor()->constructConsolidatedMemoryBuffer(memoryProxy, &output);
|
||||
memoryBuffers[readOperation->getOffset()] = memoryBuffer;
|
||||
}
|
||||
return memoryBuffers;
|
||||
}
|
||||
|
||||
MemoryBuffer* ExecutionGroup::constructConsolidatedMemoryBuffer(MemoryProxy *memoryProxy, rcti *rect) {
|
||||
MemoryBuffer *ExecutionGroup::constructConsolidatedMemoryBuffer(MemoryProxy *memoryProxy, rcti *rect)
|
||||
{
|
||||
// find all chunks inside the rect
|
||||
// determine minxchunk, minychunk, maxxchunk, maxychunk where x and y are chunknumbers
|
||||
float chunkSizef = this->chunkSize;
|
||||
@@ -415,7 +428,8 @@ MemoryBuffer* ExecutionGroup::constructConsolidatedMemoryBuffer(MemoryProxy *mem
|
||||
return result;
|
||||
}
|
||||
|
||||
void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer** memoryBuffers) {
|
||||
void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer** memoryBuffers)
|
||||
{
|
||||
if (this->chunkExecutionStates[chunkNumber] == COM_ES_SCHEDULED)
|
||||
this->chunkExecutionStates[chunkNumber] = COM_ES_EXECUTED;
|
||||
else
|
||||
@@ -442,31 +456,35 @@ void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer** memo
|
||||
}
|
||||
}
|
||||
|
||||
inline void ExecutionGroup::determineChunkRect(rcti* rect, const unsigned int xChunk, const unsigned int yChunk ) const {
|
||||
inline void ExecutionGroup::determineChunkRect(rcti *rect, const unsigned int xChunk, const unsigned int yChunk ) const
|
||||
{
|
||||
const unsigned int minx = xChunk * chunkSize;
|
||||
const unsigned int miny = yChunk * chunkSize;
|
||||
BLI_init_rcti(rect, minx, min(minx + this->chunkSize, this->width), miny, min(miny + this->chunkSize, this->height));
|
||||
}
|
||||
|
||||
void ExecutionGroup::determineChunkRect(rcti* rect, const unsigned int chunkNumber) const {
|
||||
void ExecutionGroup::determineChunkRect(rcti *rect, const unsigned int chunkNumber) const
|
||||
{
|
||||
const unsigned int yChunk = chunkNumber / numberOfXChunks;
|
||||
const unsigned int xChunk = chunkNumber - (yChunk * numberOfXChunks);
|
||||
determineChunkRect(rect, xChunk, yChunk);
|
||||
}
|
||||
|
||||
MemoryBuffer* ExecutionGroup::allocateOutputBuffer(int chunkNumber, rcti* rect) {
|
||||
MemoryBuffer* outputBuffer = NULL;
|
||||
MemoryBuffer *ExecutionGroup::allocateOutputBuffer(int chunkNumber, rcti *rect)
|
||||
{
|
||||
MemoryBuffer *outputBuffer = NULL;
|
||||
// output allocation is only valid when our outputoperation is a memorywriter
|
||||
NodeOperation * operation = this->getOutputNodeOperation();
|
||||
if (operation->isWriteBufferOperation()) {
|
||||
WriteBufferOperation* writeOperation = (WriteBufferOperation*)operation;
|
||||
WriteBufferOperation *writeOperation = (WriteBufferOperation*)operation;
|
||||
outputBuffer = MemoryManager::allocateMemoryBuffer(writeOperation->getMemoryProxy(), chunkNumber, rect);
|
||||
}
|
||||
return outputBuffer;
|
||||
}
|
||||
|
||||
|
||||
bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem * graph, rcti *area) {
|
||||
bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem * graph, rcti *area)
|
||||
{
|
||||
// find all chunks inside the rect
|
||||
// determine minxchunk, minychunk, maxxchunk, maxychunk where x and y are chunknumbers
|
||||
|
||||
@@ -490,7 +508,8 @@ bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem * graph, rcti *are
|
||||
return result;
|
||||
}
|
||||
|
||||
bool ExecutionGroup::scheduleChunk(unsigned int chunkNumber) {
|
||||
bool ExecutionGroup::scheduleChunk(unsigned int chunkNumber)
|
||||
{
|
||||
if (this->chunkExecutionStates[chunkNumber] == COM_ES_NOT_SCHEDULED) {
|
||||
this->chunkExecutionStates[chunkNumber] = COM_ES_SCHEDULED;
|
||||
WorkScheduler::schedule(this, chunkNumber);
|
||||
@@ -499,7 +518,8 @@ bool ExecutionGroup::scheduleChunk(unsigned int chunkNumber) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem * graph, int xChunk, int yChunk) {
|
||||
bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem * graph, int xChunk, int yChunk)
|
||||
{
|
||||
if (xChunk < 0 || xChunk >= (int)this->numberOfXChunks) {
|
||||
return true;
|
||||
}
|
||||
@@ -551,11 +571,13 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem * graph, int xChu
|
||||
return false;
|
||||
}
|
||||
|
||||
void ExecutionGroup::determineDependingAreaOfInterest(rcti * input, ReadBufferOperation* readOperation, rcti* output) {
|
||||
void ExecutionGroup::determineDependingAreaOfInterest(rcti * input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
this->getOutputNodeOperation()->determineDependingAreaOfInterest(input, readOperation, output);
|
||||
}
|
||||
|
||||
void ExecutionGroup::determineDependingMemoryProxies(vector<MemoryProxy*> *memoryProxies) {
|
||||
void ExecutionGroup::determineDependingMemoryProxies(vector<MemoryProxy*> *memoryProxies)
|
||||
{
|
||||
unsigned int index;
|
||||
for (index = 0 ; index < this->cachedReadOperations.size() ; index ++) {
|
||||
ReadBufferOperation * readOperation = (ReadBufferOperation*) this->cachedReadOperations[index];
|
||||
@@ -563,10 +585,12 @@ void ExecutionGroup::determineDependingMemoryProxies(vector<MemoryProxy*> *memor
|
||||
}
|
||||
}
|
||||
|
||||
bool ExecutionGroup::operator ==(const ExecutionGroup & executionGroup) const {
|
||||
bool ExecutionGroup::operator ==(const ExecutionGroup & executionGroup) const
|
||||
{
|
||||
return this->getOutputNodeOperation() == executionGroup.getOutputNodeOperation();
|
||||
}
|
||||
|
||||
bool ExecutionGroup::isOpenCL() {
|
||||
bool ExecutionGroup::isOpenCL()
|
||||
{
|
||||
return this->openCL;
|
||||
}
|
||||
|
@@ -166,7 +166,7 @@ private:
|
||||
* @brief check whether parameter operation can be added to the execution group
|
||||
* @param operation the operation to be added
|
||||
*/
|
||||
bool canContainOperation(NodeOperation* operation);
|
||||
bool canContainOperation(NodeOperation *operation);
|
||||
|
||||
/**
|
||||
* @brief get the Render priority of this ExecutionGroup
|
||||
@@ -188,7 +188,7 @@ private:
|
||||
* @note Only gives usefull results ater the determination of the chunksize
|
||||
* @see determineChunkSize()
|
||||
*/
|
||||
void determineChunkRect(rcti* rect, const unsigned int xChunk, const unsigned int yChunk) const;
|
||||
void determineChunkRect(rcti *rect, const unsigned int xChunk, const unsigned int yChunk) const;
|
||||
|
||||
/**
|
||||
* @brief determine the number of chunks, based on the chunkSize, width and height.
|
||||
@@ -233,7 +233,7 @@ private:
|
||||
* @param readOperation The ReadBufferOperation where the area needs to be evaluated
|
||||
* @param output the area needed of the ReadBufferOperation. Result
|
||||
*/
|
||||
void determineDependingAreaOfInterest(rcti * input, ReadBufferOperation* readOperation, rcti* output);
|
||||
void determineDependingAreaOfInterest(rcti * input, ReadBufferOperation *readOperation, rcti *output);
|
||||
|
||||
|
||||
public:
|
||||
@@ -257,7 +257,7 @@ public:
|
||||
* @param operation the NodeOperation to check
|
||||
* @return [true,false]
|
||||
*/
|
||||
bool containsOperation(NodeOperation* operation);
|
||||
bool containsOperation(NodeOperation *operation);
|
||||
|
||||
/**
|
||||
* @brief add an operation to this ExecutionGroup
|
||||
@@ -266,7 +266,7 @@ public:
|
||||
* @param system
|
||||
* @param operation
|
||||
*/
|
||||
void addOperation(ExecutionSystem* system, NodeOperation *operation);
|
||||
void addOperation(ExecutionSystem *system, NodeOperation *operation);
|
||||
|
||||
/**
|
||||
* @brief is this ExecutionGroup an output ExecutionGroup
|
||||
@@ -312,15 +312,15 @@ public:
|
||||
|
||||
/**
|
||||
* @brief get the output operation of this ExecutionGroup
|
||||
* @return NodeOperation* output operation
|
||||
* @return NodeOperation *output operation
|
||||
*/
|
||||
NodeOperation* getOutputNodeOperation() const;
|
||||
NodeOperation *getOutputNodeOperation() const;
|
||||
|
||||
/**
|
||||
* @brief compose multiple chunks into a single chunk
|
||||
* @return Memorybuffer* consolidated chunk
|
||||
* @return Memorybuffer *consolidated chunk
|
||||
*/
|
||||
MemoryBuffer* constructConsolidatedMemoryBuffer(MemoryProxy *memoryProxy, rcti *output);
|
||||
MemoryBuffer *constructConsolidatedMemoryBuffer(MemoryProxy *memoryProxy, rcti *output);
|
||||
|
||||
/**
|
||||
* @brief initExecution is called just before the execution of the whole graph will be done.
|
||||
@@ -342,7 +342,7 @@ public:
|
||||
* @param rect the rect of that chunk
|
||||
* @see determineChunkRect
|
||||
*/
|
||||
MemoryBuffer* allocateOutputBuffer(int chunkNumber, rcti *rect);
|
||||
MemoryBuffer *allocateOutputBuffer(int chunkNumber, rcti *rect);
|
||||
|
||||
/**
|
||||
* @brief after a chunk is executed the needed resources can be freed or unlocked.
|
||||
@@ -372,7 +372,7 @@ public:
|
||||
* @see ViewerOperation
|
||||
* @param system
|
||||
*/
|
||||
void execute(ExecutionSystem* system);
|
||||
void execute(ExecutionSystem *system);
|
||||
|
||||
/**
|
||||
* @brief this method determines the MemoryProxy's where this execution group depends on.
|
||||
@@ -387,7 +387,7 @@ public:
|
||||
* @note Only gives usefull results ater the determination of the chunksize
|
||||
* @see determineChunkSize()
|
||||
*/
|
||||
void determineChunkRect(rcti* rect, const unsigned int chunkNumber) const;
|
||||
void determineChunkRect(rcti *rect, const unsigned int chunkNumber) const;
|
||||
|
||||
|
||||
bool operator ==(const ExecutionGroup &executionGroup) const;
|
||||
|
@@ -40,7 +40,8 @@
|
||||
|
||||
#include "BKE_global.h"
|
||||
|
||||
ExecutionSystem::ExecutionSystem(bNodeTree* editingtree, bool rendering) {
|
||||
ExecutionSystem::ExecutionSystem(bNodeTree *editingtree, bool rendering)
|
||||
{
|
||||
this->context.setbNodeTree(editingtree);
|
||||
|
||||
/* initialize the CompositorContext */
|
||||
@@ -53,7 +54,7 @@ ExecutionSystem::ExecutionSystem(bNodeTree* editingtree, bool rendering) {
|
||||
context.setRendering(rendering);
|
||||
context.setHasActiveOpenCLDevices(WorkScheduler::hasGPUDevices() && (editingtree->flag & NTREE_COM_OPENCL));
|
||||
|
||||
Node* mainOutputNode=NULL;
|
||||
Node *mainOutputNode=NULL;
|
||||
|
||||
mainOutputNode = ExecutionSystemHelper::addbNodeTree(*this, 0, editingtree);
|
||||
|
||||
@@ -68,7 +69,7 @@ ExecutionSystem::ExecutionSystem(bNodeTree* editingtree, bool rendering) {
|
||||
for (index = 0 ; index < executionGroups.size(); index ++) {
|
||||
resolution[0]=0;
|
||||
resolution[1]=0;
|
||||
ExecutionGroup* executionGroup = executionGroups[index];
|
||||
ExecutionGroup *executionGroup = executionGroups[index];
|
||||
executionGroup->determineResolution(resolution);
|
||||
}
|
||||
}
|
||||
@@ -76,34 +77,36 @@ ExecutionSystem::ExecutionSystem(bNodeTree* editingtree, bool rendering) {
|
||||
if (G.f & G_DEBUG) ExecutionSystemHelper::debugDump(this);
|
||||
}
|
||||
|
||||
ExecutionSystem::~ExecutionSystem() {
|
||||
ExecutionSystem::~ExecutionSystem()
|
||||
{
|
||||
unsigned int index;
|
||||
for (index = 0; index < this->connections.size(); index++) {
|
||||
SocketConnection* connection = this->connections[index];
|
||||
SocketConnection *connection = this->connections[index];
|
||||
delete connection;
|
||||
}
|
||||
this->connections.clear();
|
||||
for (index = 0; index < this->nodes.size(); index++) {
|
||||
Node* node = this->nodes[index];
|
||||
Node *node = this->nodes[index];
|
||||
delete node;
|
||||
}
|
||||
this->nodes.clear();
|
||||
for (index = 0; index < this->operations.size(); index++) {
|
||||
NodeOperation* operation = this->operations[index];
|
||||
NodeOperation *operation = this->operations[index];
|
||||
delete operation;
|
||||
}
|
||||
this->operations.clear();
|
||||
for (index = 0; index < this->groups.size(); index++) {
|
||||
ExecutionGroup* group = this->groups[index];
|
||||
ExecutionGroup *group = this->groups[index];
|
||||
delete group;
|
||||
}
|
||||
this->groups.clear();
|
||||
}
|
||||
|
||||
void ExecutionSystem::execute() {
|
||||
void ExecutionSystem::execute()
|
||||
{
|
||||
unsigned int order = 0;
|
||||
for ( vector<NodeOperation*>::iterator iter = this->operations.begin(); iter != operations.end(); ++iter ) {
|
||||
NodeBase* node = *iter;
|
||||
NodeBase *node = *iter;
|
||||
NodeOperation *operation = (NodeOperation*) node;
|
||||
if (operation->isReadBufferOperation()) {
|
||||
ReadBufferOperation * readOperation = (ReadBufferOperation*)operation;
|
||||
@@ -134,8 +137,8 @@ void ExecutionSystem::execute() {
|
||||
/* start execution of the ExecutionGroups based on priority of their output node */
|
||||
for (int priority = 9 ; priority>=0 ; priority--) {
|
||||
for (index = 0 ; index < executionGroups.size(); index ++) {
|
||||
ExecutionGroup* group = executionGroups[index];
|
||||
NodeOperation* output = group->getOutputNodeOperation();
|
||||
ExecutionGroup *group = executionGroups[index];
|
||||
NodeOperation *output = group->getOutputNodeOperation();
|
||||
if (output->getRenderPriority() == priority) {
|
||||
group->execute(this);
|
||||
}
|
||||
@@ -156,19 +159,21 @@ void ExecutionSystem::execute() {
|
||||
MemoryManager::clear();
|
||||
}
|
||||
|
||||
void ExecutionSystem::addOperation(NodeOperation *operation) {
|
||||
void ExecutionSystem::addOperation(NodeOperation *operation)
|
||||
{
|
||||
ExecutionSystemHelper::addOperation(this->operations, operation);
|
||||
}
|
||||
|
||||
void ExecutionSystem::addReadWriteBufferOperations(NodeOperation *operation) {
|
||||
void ExecutionSystem::addReadWriteBufferOperations(NodeOperation *operation)
|
||||
{
|
||||
// for every input add write and read operation if input is not a read operation
|
||||
// only add read operation to other links when they are attached to buffered operations.
|
||||
unsigned int index;
|
||||
for (index = 0 ; index < operation->getNumberOfInputSockets();index++) {
|
||||
InputSocket* inputsocket = operation->getInputSocket(index);
|
||||
InputSocket *inputsocket = operation->getInputSocket(index);
|
||||
if (inputsocket->isConnected()) {
|
||||
SocketConnection *connection = inputsocket->getConnection();
|
||||
NodeOperation* otherEnd = (NodeOperation*)connection->getFromNode();
|
||||
NodeOperation *otherEnd = (NodeOperation*)connection->getFromNode();
|
||||
if (!otherEnd->isReadBufferOperation()) {
|
||||
// check of other end already has write operation
|
||||
OutputSocket *fromsocket = connection->getFromSocket();
|
||||
@@ -201,7 +206,7 @@ void ExecutionSystem::addReadWriteBufferOperations(NodeOperation *operation) {
|
||||
this->addOperation(writeOperation);
|
||||
for (index = 0 ; index < outputsocket->getNumberOfConnections();index ++) {
|
||||
SocketConnection * connection = outputsocket->getConnection(index);
|
||||
ReadBufferOperation* readoperation = new ReadBufferOperation();
|
||||
ReadBufferOperation *readoperation = new ReadBufferOperation();
|
||||
readoperation->setMemoryProxy(writeOperation->getMemoryProxy());
|
||||
connection->setFromSocket(readoperation->getOutputSocket());
|
||||
readoperation->getOutputSocket()->addConnection(connection);
|
||||
@@ -211,12 +216,13 @@ void ExecutionSystem::addReadWriteBufferOperations(NodeOperation *operation) {
|
||||
}
|
||||
}
|
||||
|
||||
void ExecutionSystem::convertToOperations() {
|
||||
void ExecutionSystem::convertToOperations()
|
||||
{
|
||||
unsigned int index;
|
||||
// first determine data types of the nodes, this can be used by the node to convert to a different operation system
|
||||
this->determineActualSocketDataTypes((vector<NodeBase*>&)this->nodes);
|
||||
for (index = 0; index < this->nodes.size(); index++) {
|
||||
Node* node = (Node*)this->nodes[index];
|
||||
Node *node = (Node*)this->nodes[index];
|
||||
node->convertToOperations(this, &this->context);
|
||||
}
|
||||
|
||||
@@ -233,7 +239,7 @@ void ExecutionSystem::convertToOperations() {
|
||||
|
||||
// determine all resolutions of the operations (Width/Height)
|
||||
for (index = 0 ; index < this->operations.size(); index ++) {
|
||||
NodeOperation* operation= this->operations[index];
|
||||
NodeOperation *operation = this->operations[index];
|
||||
if (operation->isOutputOperation(context.isRendering())) {
|
||||
unsigned int resolution[2] = {0,0};
|
||||
unsigned int preferredResolution[2] = {0,0};
|
||||
@@ -254,7 +260,8 @@ void ExecutionSystem::convertToOperations() {
|
||||
|
||||
}
|
||||
|
||||
void ExecutionSystem::groupOperations() {
|
||||
void ExecutionSystem::groupOperations()
|
||||
{
|
||||
vector<NodeOperation*> outputOperations;
|
||||
NodeOperation * operation;
|
||||
unsigned int index;
|
||||
@@ -281,11 +288,12 @@ void ExecutionSystem::addSocketConnection(SocketConnection *connection)
|
||||
}
|
||||
|
||||
|
||||
void ExecutionSystem::determineActualSocketDataTypes(vector<NodeBase*> &nodes) {
|
||||
void ExecutionSystem::determineActualSocketDataTypes(vector<NodeBase*> &nodes)
|
||||
{
|
||||
unsigned int index;
|
||||
/* first do all input nodes */
|
||||
for (index = 0; index < nodes.size(); index++) {
|
||||
NodeBase* node = nodes[index];
|
||||
NodeBase *node = nodes[index];
|
||||
if (node->isInputNode()) {
|
||||
node->determineActualSocketDataTypes();
|
||||
}
|
||||
@@ -293,17 +301,18 @@ void ExecutionSystem::determineActualSocketDataTypes(vector<NodeBase*> &nodes) {
|
||||
|
||||
/* then all other nodes */
|
||||
for (index = 0; index < nodes.size(); index++) {
|
||||
NodeBase* node = nodes[index];
|
||||
NodeBase *node = nodes[index];
|
||||
if (!node->isInputNode()) {
|
||||
node->determineActualSocketDataTypes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ExecutionSystem::findOutputExecutionGroup(vector<ExecutionGroup*> *result) const {
|
||||
void ExecutionSystem::findOutputExecutionGroup(vector<ExecutionGroup*> *result) const
|
||||
{
|
||||
unsigned int index;
|
||||
for (index = 0 ; index < this->groups.size() ; index ++) {
|
||||
ExecutionGroup* group = this->groups[index];
|
||||
ExecutionGroup *group = this->groups[index];
|
||||
if (group->isOutputExecutionGroup()) {
|
||||
result->push_back(group);
|
||||
}
|
||||
|
@@ -135,7 +135,7 @@ private: //methods
|
||||
* @brief add ReadBufferOperation and WriteBufferOperation around an operation
|
||||
* @param operation the operation to add the bufferoperations around.
|
||||
*/
|
||||
void addReadWriteBufferOperations(NodeOperation* operation);
|
||||
void addReadWriteBufferOperations(NodeOperation *operation);
|
||||
|
||||
|
||||
/**
|
||||
@@ -151,7 +151,7 @@ public:
|
||||
* @param editingtree [bNodeTree*]
|
||||
* @param rendering [true false]
|
||||
*/
|
||||
ExecutionSystem(bNodeTree* editingtree, bool rendering);
|
||||
ExecutionSystem(bNodeTree *editingtree, bool rendering);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
@@ -172,14 +172,14 @@ public:
|
||||
*
|
||||
* @param operation the operation to add
|
||||
*/
|
||||
void addOperation(NodeOperation* operation);
|
||||
void addOperation(NodeOperation *operation);
|
||||
|
||||
/**
|
||||
* Add an editor link to the system. convert it to an socketconnection (CPP-representative)
|
||||
* this converted socket is returned.
|
||||
*/
|
||||
SocketConnection* addNodeLink(bNodeLink* bNodeLink);
|
||||
void addSocketConnection(SocketConnection* connection);
|
||||
SocketConnection *addNodeLink(bNodeLink *bNodeLink);
|
||||
void addSocketConnection(SocketConnection *connection);
|
||||
|
||||
/**
|
||||
* @brief Convert all nodes to operations
|
||||
|
@@ -37,14 +37,15 @@
|
||||
#include "COM_WriteBufferOperation.h"
|
||||
#include "COM_ReadBufferOperation.h"
|
||||
|
||||
Node* ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree *tree) {
|
||||
Node *ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree *tree)
|
||||
{
|
||||
vector<Node*>& nodes = system.getNodes();
|
||||
vector<SocketConnection*>& links = system.getConnections();
|
||||
Node* mainnode = NULL;
|
||||
Node *mainnode = NULL;
|
||||
/* add all nodes of the tree to the node list */
|
||||
bNode* node = (bNode*)tree->nodes.first;
|
||||
bNode *node = (bNode*)tree->nodes.first;
|
||||
while (node != NULL) {
|
||||
Node* execnode = addNode(nodes, node);
|
||||
Node *execnode = addNode(nodes, node);
|
||||
if (node->type == CMP_NODE_COMPOSITE) {
|
||||
mainnode = execnode;
|
||||
}
|
||||
@@ -54,7 +55,7 @@ Node* ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_sta
|
||||
NodeRange node_range(nodes.begin()+nodes_start, nodes.end());
|
||||
|
||||
/* add all nodelinks of the tree to the link list */
|
||||
bNodeLink* nodelink = (bNodeLink*)tree->links.first;
|
||||
bNodeLink *nodelink = (bNodeLink*)tree->links.first;
|
||||
while (nodelink != NULL) {
|
||||
addNodeLink(node_range, links, nodelink);
|
||||
nodelink = (bNodeLink*)nodelink->next;
|
||||
@@ -72,11 +73,13 @@ Node* ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_sta
|
||||
return mainnode;
|
||||
}
|
||||
|
||||
void ExecutionSystemHelper::addNode(vector<Node*>& nodes, Node *node) {
|
||||
void ExecutionSystemHelper::addNode(vector<Node*>& nodes, Node *node)
|
||||
{
|
||||
nodes.push_back(node);
|
||||
}
|
||||
|
||||
Node* ExecutionSystemHelper::addNode(vector<Node*>& nodes, bNode *bNode) {
|
||||
Node *ExecutionSystemHelper::addNode(vector<Node*>& nodes, bNode *bNode)
|
||||
{
|
||||
Converter converter;
|
||||
Node * node;
|
||||
node = converter.convert(bNode);
|
||||
@@ -86,36 +89,40 @@ Node* ExecutionSystemHelper::addNode(vector<Node*>& nodes, bNode *bNode) {
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
void ExecutionSystemHelper::addOperation(vector<NodeOperation*>& operations, NodeOperation *operation) {
|
||||
void ExecutionSystemHelper::addOperation(vector<NodeOperation*>& operations, NodeOperation *operation)
|
||||
{
|
||||
operations.push_back(operation);
|
||||
}
|
||||
|
||||
void ExecutionSystemHelper::addExecutionGroup(vector<ExecutionGroup*>& executionGroups, ExecutionGroup *executionGroup) {
|
||||
void ExecutionSystemHelper::addExecutionGroup(vector<ExecutionGroup*>& executionGroups, ExecutionGroup *executionGroup)
|
||||
{
|
||||
executionGroups.push_back(executionGroup);
|
||||
}
|
||||
|
||||
void ExecutionSystemHelper::findOutputNodeOperations(vector<NodeOperation*>* result, vector<NodeOperation*>& operations, bool rendering) {
|
||||
void ExecutionSystemHelper::findOutputNodeOperations(vector<NodeOperation*>* result, vector<NodeOperation*>& operations, bool rendering)
|
||||
{
|
||||
unsigned int index;
|
||||
|
||||
for (index = 0 ; index < operations.size() ; index ++) {
|
||||
NodeOperation* operation = operations[index];
|
||||
NodeOperation *operation = operations[index];
|
||||
if (operation->isOutputOperation(rendering)) {
|
||||
result->push_back(operation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static InputSocket* find_input(NodeRange &node_range, bNode *bnode, bNodeSocket* bsocket) {
|
||||
static InputSocket *find_input(NodeRange &node_range, bNode *bnode, bNodeSocket *bsocket)
|
||||
{
|
||||
if (bnode != NULL) {
|
||||
for (NodeIterator it=node_range.first; it!=node_range.second; ++it) {
|
||||
Node* node = *it;
|
||||
Node *node = *it;
|
||||
if (node->getbNode() == bnode)
|
||||
return node->findInputSocketBybNodeSocket(bsocket);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (NodeIterator it=node_range.first; it!=node_range.second; ++it) {
|
||||
Node* node = *it;
|
||||
Node *node = *it;
|
||||
if (node->isProxyNode()) {
|
||||
InputSocket *proxySocket = node->getInputSocket(0);
|
||||
if (proxySocket->getbNodeSocket()==bsocket)
|
||||
@@ -125,17 +132,18 @@ static InputSocket* find_input(NodeRange &node_range, bNode *bnode, bNodeSocket*
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
static OutputSocket* find_output(NodeRange &node_range, bNode *bnode, bNodeSocket* bsocket) {
|
||||
static OutputSocket *find_output(NodeRange &node_range, bNode *bnode, bNodeSocket *bsocket)
|
||||
{
|
||||
if (bnode != NULL) {
|
||||
for (NodeIterator it=node_range.first; it!=node_range.second; ++it) {
|
||||
Node* node = *it;
|
||||
Node *node = *it;
|
||||
if (node->getbNode() == bnode)
|
||||
return node->findOutputSocketBybNodeSocket(bsocket);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (NodeIterator it=node_range.first; it!=node_range.second; ++it) {
|
||||
Node* node = *it;
|
||||
Node *node = *it;
|
||||
if (node->isProxyNode()) {
|
||||
OutputSocket *proxySocket = node->getOutputSocket(0);
|
||||
if (proxySocket->getbNodeSocket()==bsocket)
|
||||
@@ -145,7 +153,8 @@ static OutputSocket* find_output(NodeRange &node_range, bNode *bnode, bNodeSocke
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
SocketConnection* ExecutionSystemHelper::addNodeLink(NodeRange &node_range, vector<SocketConnection*>& links, bNodeLink *bNodeLink) {
|
||||
SocketConnection *ExecutionSystemHelper::addNodeLink(NodeRange &node_range, vector<SocketConnection*>& links, bNodeLink *bNodeLink)
|
||||
{
|
||||
/// @note: cyclic lines will be ignored. This has been copied from node.c
|
||||
if (bNodeLink->tonode != 0 && bNodeLink->fromnode != 0) {
|
||||
if (!(bNodeLink->fromnode->level >= bNodeLink->tonode->level && bNodeLink->tonode->level!=0xFFF)) { // only add non cyclic lines! so execution will procede
|
||||
@@ -161,11 +170,12 @@ SocketConnection* ExecutionSystemHelper::addNodeLink(NodeRange &node_range, vect
|
||||
if (inputSocket->isConnected()) {
|
||||
return NULL;
|
||||
}
|
||||
SocketConnection* connection = addLink(links, outputSocket, inputSocket);
|
||||
SocketConnection *connection = addLink(links, outputSocket, inputSocket);
|
||||
return connection;
|
||||
}
|
||||
|
||||
SocketConnection* ExecutionSystemHelper::addLink(vector<SocketConnection*>& links, OutputSocket* fromSocket, InputSocket* toSocket) {
|
||||
SocketConnection *ExecutionSystemHelper::addLink(vector<SocketConnection*>& links, OutputSocket *fromSocket, InputSocket *toSocket)
|
||||
{
|
||||
SocketConnection * newconnection = new SocketConnection();
|
||||
newconnection->setFromSocket(fromSocket);
|
||||
newconnection->setToSocket(toSocket);
|
||||
@@ -175,11 +185,12 @@ SocketConnection* ExecutionSystemHelper::addLink(vector<SocketConnection*>& link
|
||||
return newconnection;
|
||||
}
|
||||
|
||||
void ExecutionSystemHelper::debugDump(ExecutionSystem* system) {
|
||||
Node* node;
|
||||
NodeOperation* operation;
|
||||
ExecutionGroup* group;
|
||||
SocketConnection* connection;
|
||||
void ExecutionSystemHelper::debugDump(ExecutionSystem *system)
|
||||
{
|
||||
Node *node;
|
||||
NodeOperation *operation;
|
||||
ExecutionGroup *group;
|
||||
SocketConnection *connection;
|
||||
int tot, tot2;
|
||||
printf("-- BEGIN COMPOSITOR DUMP --\r\n");
|
||||
printf("digraph compositorexecution {\r\n");
|
||||
@@ -283,7 +294,7 @@ void ExecutionSystemHelper::debugDump(ExecutionSystem* system) {
|
||||
operation = system->getOperations()[i];
|
||||
if (operation->isReadBufferOperation()) {
|
||||
ReadBufferOperation * read = (ReadBufferOperation*)operation;
|
||||
WriteBufferOperation * write= read->getMemoryProxy()->getWriteBufferOperation();
|
||||
WriteBufferOperation * write = read->getMemoryProxy()->getWriteBufferOperation();
|
||||
printf("\t\"O_%p\" -> \"O_%p\" [style=dotted]\r\n", write, read);
|
||||
}
|
||||
}
|
||||
|
@@ -48,7 +48,7 @@ public:
|
||||
* @param tree bNodeTree to add
|
||||
* @return Node representing the "Compositor node" of the maintree. or NULL when a subtree is added
|
||||
*/
|
||||
static Node* addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree * tree);
|
||||
static Node *addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree * tree);
|
||||
|
||||
/**
|
||||
* @brief add an editor node to the system.
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
* @param bNode node to add
|
||||
* @return Node that represents the bNode or null when not able to convert.
|
||||
*/
|
||||
static Node* addNode(vector<Node*>& nodes, bNode* bNode);
|
||||
static Node *addNode(vector<Node*>& nodes, bNode *bNode);
|
||||
|
||||
/**
|
||||
* @brief Add a Node to a list
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
* @param nodes the list where the node needs to be added to
|
||||
* @param node the node to be added
|
||||
*/
|
||||
static void addNode(vector<Node*>& nodes, Node* node);
|
||||
static void addNode(vector<Node*>& nodes, Node *node);
|
||||
|
||||
/**
|
||||
* @brief Add an operation to the operation list
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
* @param operations the list where the operation need to be added to
|
||||
* @param operation the operation to add
|
||||
*/
|
||||
static void addOperation(vector<NodeOperation*> &operations, NodeOperation* operation);
|
||||
static void addOperation(vector<NodeOperation*> &operations, NodeOperation *operation);
|
||||
|
||||
/**
|
||||
* @brief Add an ExecutionGroup to a list
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
* @param bNodeLink the link to be added
|
||||
* @return the created SocketConnection or NULL
|
||||
*/
|
||||
static SocketConnection* addNodeLink(NodeRange &node_range, vector<SocketConnection*>& links, bNodeLink *bNodeLink);
|
||||
static SocketConnection *addNodeLink(NodeRange &node_range, vector<SocketConnection*>& links, bNodeLink *bNodeLink);
|
||||
|
||||
/**
|
||||
* @brief create a new SocketConnection and add to a vector of links
|
||||
@@ -116,12 +116,12 @@ public:
|
||||
* @param toSocket the endpoint of the connection
|
||||
* @return the new created SocketConnection
|
||||
*/
|
||||
static SocketConnection* addLink(vector<SocketConnection*>& links, OutputSocket* fromSocket, InputSocket* toSocket);
|
||||
static SocketConnection *addLink(vector<SocketConnection*>& links, OutputSocket *fromSocket, InputSocket *toSocket);
|
||||
|
||||
/**
|
||||
* @brief dumps the content of the execution system to standard out
|
||||
* @param system the execution system to dump
|
||||
*/
|
||||
static void debugDump(ExecutionSystem* system);
|
||||
static void debugDump(ExecutionSystem *system);
|
||||
};
|
||||
#endif
|
||||
|
@@ -25,16 +25,19 @@
|
||||
#include "COM_SocketConnection.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
InputSocket::InputSocket(DataType datatype) :Socket(datatype) {
|
||||
InputSocket::InputSocket(DataType datatype) :Socket(datatype)
|
||||
{
|
||||
this->connection = NULL;
|
||||
this->resizeMode = COM_SC_CENTER;
|
||||
}
|
||||
InputSocket::InputSocket(DataType datatype, InputSocketResizeMode resizeMode) :Socket(datatype) {
|
||||
InputSocket::InputSocket(DataType datatype, InputSocketResizeMode resizeMode) :Socket(datatype)
|
||||
{
|
||||
this->connection = NULL;
|
||||
this->resizeMode = resizeMode;
|
||||
}
|
||||
|
||||
InputSocket::InputSocket(InputSocket* from) :Socket(from->getDataType()) {
|
||||
InputSocket::InputSocket(InputSocket *from) :Socket(from->getDataType())
|
||||
{
|
||||
this->connection = NULL;
|
||||
this->resizeMode = from->getResizeMode();
|
||||
}
|
||||
@@ -42,12 +45,17 @@ InputSocket::InputSocket(InputSocket* from) :Socket(from->getDataType()) {
|
||||
int InputSocket::isInputSocket() const { return true; }
|
||||
const int InputSocket::isConnected() const { return this->connection != NULL; }
|
||||
|
||||
void InputSocket::setConnection(SocketConnection *connection) {
|
||||
void InputSocket::setConnection(SocketConnection *connection)
|
||||
{
|
||||
this->connection = connection;
|
||||
}
|
||||
SocketConnection* InputSocket::getConnection() {return this->connection;}
|
||||
SocketConnection *InputSocket::getConnection()
|
||||
{
|
||||
return this->connection;
|
||||
}
|
||||
|
||||
void InputSocket::determineResolution(unsigned int resolution[],unsigned int preferredResolution[]) {
|
||||
void InputSocket::determineResolution(unsigned int resolution[],unsigned int preferredResolution[])
|
||||
{
|
||||
if (this->isConnected()) {
|
||||
this->connection->getFromSocket()->determineResolution(resolution, preferredResolution);
|
||||
}
|
||||
@@ -56,7 +64,8 @@ void InputSocket::determineResolution(unsigned int resolution[],unsigned int pre
|
||||
}
|
||||
}
|
||||
|
||||
DataType InputSocket::convertToSupportedDataType(DataType datatype) {
|
||||
DataType InputSocket::convertToSupportedDataType(DataType datatype)
|
||||
{
|
||||
int supportedDataTypes = getDataType();
|
||||
if (supportedDataTypes&datatype) {
|
||||
return datatype;
|
||||
@@ -92,7 +101,8 @@ DataType InputSocket::convertToSupportedDataType(DataType datatype) {
|
||||
return this->getDataType();
|
||||
}
|
||||
|
||||
void InputSocket::determineActualDataType() {
|
||||
void InputSocket::determineActualDataType()
|
||||
{
|
||||
/// @note: this method is only called for inputsocket that are not connected.
|
||||
/// @note: passes COM_DT_COLOR, the convertToSupportedDataType converts this to a capable DataType
|
||||
this->setActualDataType(this->convertToSupportedDataType(COM_DT_COLOR));
|
||||
@@ -105,26 +115,30 @@ void InputSocket::determineActualDataType() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void InputSocket::notifyActualInputType(DataType datatype) {
|
||||
void InputSocket::notifyActualInputType(DataType datatype)
|
||||
{
|
||||
DataType supportedDataType = convertToSupportedDataType(datatype);
|
||||
this->setActualDataType(supportedDataType);
|
||||
this->fireActualDataTypeSet();
|
||||
}
|
||||
|
||||
void InputSocket::fireActualDataTypeSet() {
|
||||
void InputSocket::fireActualDataTypeSet()
|
||||
{
|
||||
this->getNode()->notifyActualDataTypeSet(this, this->getActualDataType());
|
||||
}
|
||||
void InputSocket::relinkConnections(InputSocket *relinkToSocket) {
|
||||
void InputSocket::relinkConnections(InputSocket *relinkToSocket)
|
||||
{
|
||||
this->relinkConnections(relinkToSocket, false, -1, NULL);
|
||||
}
|
||||
|
||||
void InputSocket::relinkConnections(InputSocket *relinkToSocket, bool autoconnect, int editorNodeInputSocketIndex, bool duplicate, ExecutionSystem* graph) {
|
||||
void InputSocket::relinkConnections(InputSocket *relinkToSocket, bool autoconnect, int editorNodeInputSocketIndex, bool duplicate, ExecutionSystem *graph)
|
||||
{
|
||||
if (!duplicate) {
|
||||
this->relinkConnections(relinkToSocket, autoconnect, editorNodeInputSocketIndex, graph);
|
||||
}
|
||||
else {
|
||||
if (!this->isConnected() && autoconnect) {
|
||||
Node* node = (Node*)this->getNode();
|
||||
Node *node = (Node*)this->getNode();
|
||||
switch (this->getActualDataType()) {
|
||||
case COM_DT_UNKNOWN:
|
||||
case COM_DT_COLOR:
|
||||
@@ -149,10 +163,11 @@ void InputSocket::relinkConnections(InputSocket *relinkToSocket, bool autoconnec
|
||||
}
|
||||
}
|
||||
|
||||
void InputSocket::relinkConnections(InputSocket *relinkToSocket, bool autoconnect, int editorNodeInputSocketIndex, ExecutionSystem* graph) {
|
||||
void InputSocket::relinkConnections(InputSocket *relinkToSocket, bool autoconnect, int editorNodeInputSocketIndex, ExecutionSystem *graph)
|
||||
{
|
||||
if (!isConnected()) {
|
||||
if (autoconnect) {
|
||||
Node* node = (Node*)this->getNode();
|
||||
Node *node = (Node*)this->getNode();
|
||||
switch (this->getActualDataType()) {
|
||||
case COM_DT_UNKNOWN:
|
||||
case COM_DT_COLOR:
|
||||
@@ -174,7 +189,8 @@ void InputSocket::relinkConnections(InputSocket *relinkToSocket, bool autoconnec
|
||||
this->setConnection(NULL);
|
||||
}
|
||||
|
||||
const ChannelInfo* InputSocket::getChannelInfo(const int channelnumber) {
|
||||
const ChannelInfo *InputSocket::getChannelInfo(const int channelnumber)
|
||||
{
|
||||
if (this->isConnected() && this->connection->getFromSocket()) {
|
||||
return this->connection->getFromSocket()->getChannelInfo(channelnumber);
|
||||
}
|
||||
@@ -183,20 +199,23 @@ const ChannelInfo* InputSocket::getChannelInfo(const int channelnumber) {
|
||||
}
|
||||
}
|
||||
|
||||
bool InputSocket::isStatic() {
|
||||
bool InputSocket::isStatic()
|
||||
{
|
||||
if (isConnected()) {
|
||||
NodeBase* node = this->getConnection()->getFromNode();
|
||||
NodeBase *node = this->getConnection()->getFromNode();
|
||||
if (node) {
|
||||
return node->isStatic();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
SocketReader* InputSocket::getReader() {
|
||||
SocketReader *InputSocket::getReader()
|
||||
{
|
||||
return this->getOperation();
|
||||
}
|
||||
|
||||
NodeOperation* InputSocket::getOperation() const {
|
||||
NodeOperation *InputSocket::getOperation() const
|
||||
{
|
||||
if (isConnected()) {
|
||||
return (NodeOperation*)this->connection->getFromSocket()->getNode();
|
||||
}
|
||||
@@ -205,7 +224,8 @@ NodeOperation* InputSocket::getOperation() const {
|
||||
}
|
||||
}
|
||||
|
||||
float* InputSocket::getStaticValues() {
|
||||
float *InputSocket::getStaticValues()
|
||||
{
|
||||
/* XXX only works for socket types with actual float input values.
|
||||
* currently all compositor socket types (value, rgba, vector) support this.
|
||||
*/
|
||||
|
@@ -65,7 +65,7 @@ private:
|
||||
* @brief connection connected to this InputSocket.
|
||||
* An input socket can only have a single connection
|
||||
*/
|
||||
SocketConnection* connection;
|
||||
SocketConnection *connection;
|
||||
|
||||
/**
|
||||
* @brief resize mode of this socket
|
||||
@@ -89,10 +89,10 @@ private:
|
||||
public:
|
||||
InputSocket(DataType datatype);
|
||||
InputSocket(DataType datatype, InputSocketResizeMode resizeMode);
|
||||
InputSocket(InputSocket* from);
|
||||
InputSocket(InputSocket *from);
|
||||
|
||||
void setConnection(SocketConnection* connection);
|
||||
SocketConnection* getConnection();
|
||||
void setConnection(SocketConnection *connection);
|
||||
SocketConnection *getConnection();
|
||||
|
||||
const int isConnected() const;
|
||||
int isInputSocket() const;
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
* @param editorNodeInputSocketIndex index of the socket number of the bNode (used to retrieve the value for autoconnection)
|
||||
* @param system ExecutionSystem to update to
|
||||
*/
|
||||
void relinkConnections(InputSocket *relinkToSocket, bool autoconnect, int editorNodeInputSocketIndex, ExecutionSystem* system);
|
||||
void relinkConnections(InputSocket *relinkToSocket, bool autoconnect, int editorNodeInputSocketIndex, ExecutionSystem *system);
|
||||
|
||||
/**
|
||||
* @brief move all connections of this input socket to another socket
|
||||
@@ -136,7 +136,7 @@ public:
|
||||
* @param duplicate instead of move do a copy of the connection.
|
||||
* @param system ExecutionSystem to update to
|
||||
*/
|
||||
void relinkConnections(InputSocket *relinkToSocket, bool autoconnect, int editorNodeInputSocketIndex, bool duplicate, ExecutionSystem* system);
|
||||
void relinkConnections(InputSocket *relinkToSocket, bool autoconnect, int editorNodeInputSocketIndex, bool duplicate, ExecutionSystem *system);
|
||||
|
||||
/**
|
||||
* @brief set the resize mode
|
||||
@@ -150,13 +150,13 @@ public:
|
||||
*/
|
||||
InputSocketResizeMode getResizeMode() const {return this->resizeMode;}
|
||||
|
||||
const ChannelInfo* getChannelInfo(const int channelnumber);
|
||||
const ChannelInfo *getChannelInfo(const int channelnumber);
|
||||
|
||||
bool isStatic();
|
||||
|
||||
float* getStaticValues();
|
||||
SocketReader* getReader();
|
||||
NodeOperation* getOperation() const;
|
||||
float *getStaticValues();
|
||||
SocketReader *getReader();
|
||||
NodeOperation *getOperation() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -25,18 +25,22 @@
|
||||
#include "BLI_math.h"
|
||||
#include "BKE_global.h"
|
||||
|
||||
unsigned int MemoryBuffer::determineBufferSize() {
|
||||
unsigned int MemoryBuffer::determineBufferSize()
|
||||
{
|
||||
return getWidth() * getHeight();
|
||||
}
|
||||
|
||||
int MemoryBuffer::getWidth() const {
|
||||
int MemoryBuffer::getWidth() const
|
||||
{
|
||||
return this->rect.xmax-this->rect.xmin;
|
||||
}
|
||||
int MemoryBuffer::getHeight() const {
|
||||
int MemoryBuffer::getHeight() const
|
||||
{
|
||||
return this->rect.ymax-this->rect.ymin;
|
||||
}
|
||||
|
||||
MemoryBuffer::MemoryBuffer(MemoryProxy * memoryProxy, unsigned int chunkNumber, rcti* rect) {
|
||||
MemoryBuffer::MemoryBuffer(MemoryProxy * memoryProxy, unsigned int chunkNumber, rcti *rect)
|
||||
{
|
||||
BLI_init_rcti(&this->rect, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
|
||||
this->memoryProxy = memoryProxy;
|
||||
this->chunkNumber = chunkNumber;
|
||||
@@ -46,7 +50,8 @@ MemoryBuffer::MemoryBuffer(MemoryProxy * memoryProxy, unsigned int chunkNumber,
|
||||
this->chunkWidth = this->rect.xmax - this->rect.xmin;
|
||||
}
|
||||
|
||||
MemoryBuffer::MemoryBuffer(MemoryProxy * memoryProxy, rcti* rect) {
|
||||
MemoryBuffer::MemoryBuffer(MemoryProxy * memoryProxy, rcti *rect)
|
||||
{
|
||||
BLI_init_rcti(&this->rect, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
|
||||
this->memoryProxy = memoryProxy;
|
||||
this->chunkNumber = -1;
|
||||
@@ -55,20 +60,23 @@ MemoryBuffer::MemoryBuffer(MemoryProxy * memoryProxy, rcti* rect) {
|
||||
this->datatype = COM_DT_COLOR;
|
||||
this->chunkWidth = this->rect.xmax - this->rect.xmin;
|
||||
}
|
||||
MemoryBuffer* MemoryBuffer::duplicate() {
|
||||
MemoryBuffer *MemoryBuffer::duplicate()
|
||||
{
|
||||
MemoryBuffer *result = new MemoryBuffer(this->memoryProxy, &this->rect);
|
||||
memcpy(result->buffer, this->buffer, this->determineBufferSize()*4*sizeof(float));
|
||||
return result;
|
||||
}
|
||||
void MemoryBuffer::clear() {
|
||||
void MemoryBuffer::clear()
|
||||
{
|
||||
memset(this->buffer, 0, this->determineBufferSize()*4*sizeof(float));
|
||||
}
|
||||
|
||||
float* MemoryBuffer::convertToValueBuffer() {
|
||||
float *MemoryBuffer::convertToValueBuffer()
|
||||
{
|
||||
int size = this->determineBufferSize();
|
||||
int i;
|
||||
int offset4;
|
||||
float* result = new float[size];
|
||||
float *result = new float[size];
|
||||
for (i = 0, offset4 = 0 ; i < size ; i ++, offset4 +=4) {
|
||||
result[i] = this->buffer[offset4];
|
||||
}
|
||||
@@ -76,14 +84,16 @@ float* MemoryBuffer::convertToValueBuffer() {
|
||||
return result;
|
||||
}
|
||||
|
||||
MemoryBuffer::~MemoryBuffer() {
|
||||
MemoryBuffer::~MemoryBuffer()
|
||||
{
|
||||
if (this->buffer) {
|
||||
MEM_freeN(this->buffer);
|
||||
this->buffer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryBuffer::copyContentFrom(MemoryBuffer *otherBuffer) {
|
||||
void MemoryBuffer::copyContentFrom(MemoryBuffer *otherBuffer)
|
||||
{
|
||||
if (!otherBuffer) {
|
||||
return;
|
||||
}
|
||||
@@ -103,7 +113,8 @@ void MemoryBuffer::copyContentFrom(MemoryBuffer *otherBuffer) {
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryBuffer::read(float* result, int x, int y) {
|
||||
void MemoryBuffer::read(float *result, int x, int y)
|
||||
{
|
||||
if (x>=this->rect.xmin && x < this->rect.xmax &&
|
||||
y>=this->rect.ymin && y < this->rect.ymax) {
|
||||
int dx = x-this->rect.xmin;
|
||||
@@ -121,7 +132,8 @@ void MemoryBuffer::read(float* result, int x, int y) {
|
||||
result[3] = 0.0f;
|
||||
}
|
||||
}
|
||||
void MemoryBuffer::writePixel(int x, int y, float color[4]) {
|
||||
void MemoryBuffer::writePixel(int x, int y, float color[4])
|
||||
{
|
||||
if (x>=this->rect.xmin && x < this->rect.xmax &&
|
||||
y>=this->rect.ymin && y < this->rect.ymax) {
|
||||
int offset = (this->chunkWidth*y+x)*4;
|
||||
@@ -132,7 +144,8 @@ void MemoryBuffer::writePixel(int x, int y, float color[4]) {
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryBuffer::readCubic(float* result, float x, float y) {
|
||||
void MemoryBuffer::readCubic(float *result, float x, float y)
|
||||
{
|
||||
int x1 = floor(x);
|
||||
int x2 = x1 + 1;
|
||||
int y1 = floor(y);
|
||||
@@ -208,7 +221,7 @@ static float EWA_WTS[EWA_MAXIDX + 1] =
|
||||
0.00754159f, 0.00625989f, 0.00498819f, 0.00372644f, 0.00247454f, 0.00123242f, 0.f
|
||||
};
|
||||
|
||||
static void radangle2imp(float a2, float b2, float th, float* A, float* B, float* C, float* F)
|
||||
static void radangle2imp(float a2, float b2, float th, float *A, float *B, float *C, float *F)
|
||||
{
|
||||
float ct2 = cosf(th);
|
||||
const float st2 = 1.f - ct2*ct2; // <- sin(th)^2
|
||||
@@ -220,7 +233,7 @@ static void radangle2imp(float a2, float b2, float th, float* A, float* B, float
|
||||
}
|
||||
|
||||
// all tests here are done to make sure possible overflows are hopefully minimized
|
||||
static void imp2radangle(float A, float B, float C, float F, float* a, float* b, float* th, float* ecc)
|
||||
static void imp2radangle(float A, float B, float C, float F, float *a, float *b, float *th, float *ecc)
|
||||
{
|
||||
if (F <= 1e-5f) { // use arbitrary major radius, zero minor, infinite eccentricity
|
||||
*a = sqrtf(A > C ? A : C);
|
||||
@@ -247,12 +260,14 @@ static void imp2radangle(float A, float B, float C, float F, float* a, float* b,
|
||||
}
|
||||
}
|
||||
|
||||
float clipuv(float x, float limit) {
|
||||
float clipuv(float x, float limit)
|
||||
{
|
||||
x = (x < 0) ? 0 : ((x >= limit) ? (limit - 1) : x);
|
||||
return x;
|
||||
}
|
||||
|
||||
void MemoryBuffer::readEWA(float* result, float fx, float fy, float dx, float dy) {
|
||||
void MemoryBuffer::readEWA(float *result, float fx, float fy, float dx, float dy)
|
||||
{
|
||||
int width = this->getWidth(), height = this->getHeight();
|
||||
|
||||
// scaling dxt/dyt by full resolution can cause overflow because of huge A/B/C and esp. F values,
|
||||
|
@@ -88,18 +88,18 @@ private:
|
||||
/**
|
||||
* @brief the actual float buffer/data
|
||||
*/
|
||||
float* buffer;
|
||||
float *buffer;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief construct new MemoryBuffer for a chunk
|
||||
*/
|
||||
MemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber, rcti* rect);
|
||||
MemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber, rcti *rect);
|
||||
|
||||
/**
|
||||
* @brief construct new temporarily MemoryBuffer for an area
|
||||
*/
|
||||
MemoryBuffer(MemoryProxy *memoryProxy, rcti* rect);
|
||||
MemoryBuffer(MemoryProxy *memoryProxy, rcti *rect);
|
||||
|
||||
/**
|
||||
* @brief destructor
|
||||
@@ -115,7 +115,7 @@ public:
|
||||
* @brief get the data of this MemoryBuffer
|
||||
* @note buffer should already be available in memory
|
||||
*/
|
||||
float* getBuffer() {return this->buffer;}
|
||||
float *getBuffer() {return this->buffer;}
|
||||
|
||||
/**
|
||||
* @brief after execution the state will be set to available by calling this method
|
||||
@@ -124,9 +124,9 @@ public:
|
||||
this->state = COM_MB_AVAILABLE;
|
||||
}
|
||||
|
||||
void read(float* result, int x, int y);
|
||||
void read(float *result, int x, int y);
|
||||
void writePixel(int x, int y, float color[4]);
|
||||
void readCubic(float* result, float x, float y);
|
||||
void readCubic(float *result, float x, float y);
|
||||
void readEWA(float *result, float fx, float fy, float dx, float dy);
|
||||
|
||||
/**
|
||||
@@ -138,12 +138,12 @@ public:
|
||||
* @brief add the content from otherBuffer to this MemoryBuffer
|
||||
* @param otherBuffer source buffer
|
||||
*/
|
||||
void copyContentFrom(MemoryBuffer* otherBuffer);
|
||||
void copyContentFrom(MemoryBuffer *otherBuffer);
|
||||
|
||||
/**
|
||||
* @brief get the rect of this MemoryBuffer
|
||||
*/
|
||||
rcti* getRect() {return &this->rect;}
|
||||
rcti *getRect() {return &this->rect;}
|
||||
|
||||
/**
|
||||
* @brief get the width of this MemoryBuffer
|
||||
@@ -160,9 +160,9 @@ public:
|
||||
*/
|
||||
void clear();
|
||||
|
||||
MemoryBuffer* duplicate();
|
||||
MemoryBuffer *duplicate();
|
||||
|
||||
float* convertToValueBuffer();
|
||||
float *convertToValueBuffer();
|
||||
private:
|
||||
unsigned int determineBufferSize();
|
||||
};
|
||||
|
@@ -29,7 +29,8 @@ vector<MemoryBuffer*> buffers;
|
||||
|
||||
ThreadMutex mutex;
|
||||
|
||||
MemoryBuffer* MemoryManager::allocateMemoryBuffer(MemoryProxy *id, unsigned int chunkNumber, rcti *rect) {
|
||||
MemoryBuffer *MemoryManager::allocateMemoryBuffer(MemoryProxy *id, unsigned int chunkNumber, rcti *rect)
|
||||
{
|
||||
MemoryBuffer *result = new MemoryBuffer(id, chunkNumber, rect);
|
||||
MemoryManagerState * state = MemoryManager::getState(id);
|
||||
state->addMemoryBuffer(result);
|
||||
@@ -39,30 +40,35 @@ MemoryBuffer* MemoryManager::allocateMemoryBuffer(MemoryProxy *id, unsigned int
|
||||
return result;
|
||||
}
|
||||
|
||||
void MemoryManager::addMemoryProxy(MemoryProxy *memoryProxy) {
|
||||
void MemoryManager::addMemoryProxy(MemoryProxy *memoryProxy)
|
||||
{
|
||||
MemoryManagerState * state = MemoryManager::getState(memoryProxy);
|
||||
if (!state) {
|
||||
state = new MemoryManagerState(memoryProxy);
|
||||
memoryProxy->setState(state);
|
||||
}
|
||||
}
|
||||
MemoryBuffer* MemoryManager::getMemoryBuffer(MemoryProxy *id, unsigned int chunkNumber) {
|
||||
MemoryBuffer *MemoryManager::getMemoryBuffer(MemoryProxy *id, unsigned int chunkNumber)
|
||||
{
|
||||
MemoryManagerState * state = MemoryManager::getState(id);
|
||||
if (!state) {
|
||||
return NULL;
|
||||
}
|
||||
MemoryBuffer* buffer = state->getMemoryBuffer(chunkNumber);
|
||||
MemoryBuffer *buffer = state->getMemoryBuffer(chunkNumber);
|
||||
if (!buffer) return NULL;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
MemoryManagerState* MemoryManager::getState(MemoryProxy* memoryProxy) {
|
||||
MemoryManagerState *MemoryManager::getState(MemoryProxy *memoryProxy)
|
||||
{
|
||||
return memoryProxy->getState();
|
||||
}
|
||||
void MemoryManager::initialize() {
|
||||
void MemoryManager::initialize()
|
||||
{
|
||||
BLI_mutex_init(&mutex);
|
||||
}
|
||||
void MemoryManager::clear() {
|
||||
void MemoryManager::clear()
|
||||
{
|
||||
buffers.clear();
|
||||
BLI_mutex_end(&mutex);
|
||||
}
|
||||
|
@@ -109,7 +109,7 @@ private:
|
||||
* @brief retrieve the state of a certain MemoryProxy;
|
||||
* @param memoryProxy the MemoryProxy to retrieve the state from
|
||||
*/
|
||||
static MemoryManagerState* getState(MemoryProxy* memoryProxy);
|
||||
static MemoryManagerState *getState(MemoryProxy *memoryProxy);
|
||||
public:
|
||||
/**
|
||||
* @brief allocate a memory buffer
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
* @param chunkNumber number of the chunk to receive
|
||||
* @param rect size + position of the chunk
|
||||
*/
|
||||
static MemoryBuffer* allocateMemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber, rcti* rect);
|
||||
static MemoryBuffer *allocateMemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber, rcti *rect);
|
||||
|
||||
/**
|
||||
* @brief get a memory buffer
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
* @param chunkNumber number of the chunk to receive
|
||||
* @param addUser must we add a user to the chunk.
|
||||
*/
|
||||
static MemoryBuffer* getMemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber);
|
||||
static MemoryBuffer *getMemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber);
|
||||
|
||||
/**
|
||||
* @brief add a MemoryProxy to the scope of the memory manager
|
||||
|
@@ -22,22 +22,25 @@
|
||||
|
||||
#include "COM_MemoryManagerState.h"
|
||||
|
||||
MemoryManagerState::MemoryManagerState(MemoryProxy *memoryProxy) {
|
||||
MemoryManagerState::MemoryManagerState(MemoryProxy *memoryProxy)
|
||||
{
|
||||
this->memoryProxy = memoryProxy;
|
||||
this->currentSize = 0;
|
||||
this->chunkBuffers = NULL;
|
||||
BLI_mutex_init(&this->mutex);
|
||||
}
|
||||
|
||||
MemoryProxy * MemoryManagerState::getMemoryProxy() {
|
||||
MemoryProxy * MemoryManagerState::getMemoryProxy()
|
||||
{
|
||||
return this->memoryProxy;
|
||||
}
|
||||
|
||||
MemoryManagerState::~MemoryManagerState() {
|
||||
MemoryManagerState::~MemoryManagerState()
|
||||
{
|
||||
this->memoryProxy = NULL;
|
||||
unsigned int index;
|
||||
for (index = 0 ; index < this->currentSize; index ++) {
|
||||
MemoryBuffer* buffer = this->chunkBuffers[index];
|
||||
MemoryBuffer *buffer = this->chunkBuffers[index];
|
||||
if (buffer) {
|
||||
delete buffer;
|
||||
}
|
||||
@@ -46,7 +49,8 @@ MemoryManagerState::~MemoryManagerState() {
|
||||
BLI_mutex_end(&this->mutex);
|
||||
}
|
||||
|
||||
void MemoryManagerState::addMemoryBuffer(MemoryBuffer *buffer) {
|
||||
void MemoryManagerState::addMemoryBuffer(MemoryBuffer *buffer)
|
||||
{
|
||||
BLI_mutex_lock(&this->mutex);
|
||||
unsigned int chunkNumber = buffer->getChunkNumber();
|
||||
unsigned int index;
|
||||
@@ -76,8 +80,9 @@ void MemoryManagerState::addMemoryBuffer(MemoryBuffer *buffer) {
|
||||
BLI_mutex_unlock(&this->mutex);
|
||||
}
|
||||
|
||||
MemoryBuffer* MemoryManagerState::getMemoryBuffer(unsigned int chunkNumber) {
|
||||
MemoryBuffer* result = NULL;
|
||||
MemoryBuffer *MemoryManagerState::getMemoryBuffer(unsigned int chunkNumber)
|
||||
{
|
||||
MemoryBuffer *result = NULL;
|
||||
if (chunkNumber< this->currentSize) {
|
||||
result = this->chunkBuffers[chunkNumber];
|
||||
if (result) {
|
||||
|
@@ -75,13 +75,13 @@ public:
|
||||
/**
|
||||
* @brief add a new memorybuffer to the state
|
||||
*/
|
||||
void addMemoryBuffer(MemoryBuffer* buffer);
|
||||
void addMemoryBuffer(MemoryBuffer *buffer);
|
||||
|
||||
/**
|
||||
* @brief get the MemoryBuffer assiciated to a chunk.
|
||||
* @param chunkNumber the chunknumber
|
||||
*/
|
||||
MemoryBuffer* getMemoryBuffer(unsigned int chunkNumber);
|
||||
MemoryBuffer *getMemoryBuffer(unsigned int chunkNumber);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -23,13 +23,15 @@
|
||||
#include "COM_MemoryProxy.h"
|
||||
|
||||
|
||||
MemoryProxy::MemoryProxy() {
|
||||
MemoryProxy::MemoryProxy()
|
||||
{
|
||||
this->state = NULL;
|
||||
this->writeBufferOperation = NULL;
|
||||
this->executor = NULL;
|
||||
}
|
||||
|
||||
MemoryProxy::~MemoryProxy() {
|
||||
MemoryProxy::~MemoryProxy()
|
||||
{
|
||||
if (this->state) {
|
||||
delete this->state;
|
||||
this->state = NULL;
|
||||
|
@@ -76,19 +76,19 @@ public:
|
||||
/**
|
||||
* @brief get the ExecutionGroup that can be scheduled to calculate a certain chunk.
|
||||
*/
|
||||
ExecutionGroup* getExecutor() {return this->executor;}
|
||||
ExecutionGroup *getExecutor() {return this->executor;}
|
||||
|
||||
/**
|
||||
* @brief set the WriteBufferOperation that is responsible for writing to this MemoryProxy
|
||||
* @param operation
|
||||
*/
|
||||
void setWriteBufferOperation(WriteBufferOperation* operation) {this->writeBufferOperation = operation;}
|
||||
void setWriteBufferOperation(WriteBufferOperation *operation) {this->writeBufferOperation = operation;}
|
||||
|
||||
/**
|
||||
* @brief get the WriteBufferOperation that is responsible for writing to this MemoryProxy
|
||||
* @return WriteBufferOperation
|
||||
*/
|
||||
WriteBufferOperation* getWriteBufferOperation() {return this->writeBufferOperation;}
|
||||
WriteBufferOperation *getWriteBufferOperation() {return this->writeBufferOperation;}
|
||||
|
||||
/**
|
||||
* @brief set the memorymanager state of this MemoryProxy, this is set from the MemoryManager
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
* @brief get the state of this MemoryProxy
|
||||
* @return MemoryManagerState reference to the state of this MemoryProxy.
|
||||
*/
|
||||
MemoryManagerState* getState() {return this->state;}
|
||||
MemoryManagerState *getState() {return this->state;}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -38,7 +38,8 @@
|
||||
//#include "stdio.h"
|
||||
#include "COM_defines.h"
|
||||
|
||||
Node::Node(bNode* editorNode, bool create_sockets) {
|
||||
Node::Node(bNode *editorNode, bool create_sockets)
|
||||
{
|
||||
this->editorNode = editorNode;
|
||||
|
||||
if (create_sockets) {
|
||||
@@ -62,13 +63,18 @@ Node::Node(bNode* editorNode, bool create_sockets) {
|
||||
}
|
||||
}
|
||||
}
|
||||
Node::Node() {
|
||||
Node::Node()
|
||||
{
|
||||
this->editorNode = NULL;
|
||||
}
|
||||
|
||||
bNode* Node::getbNode() {return this->editorNode;}
|
||||
bNode *Node::getbNode()
|
||||
{
|
||||
return this->editorNode;
|
||||
}
|
||||
|
||||
void Node::addSetValueOperation(ExecutionSystem *graph, InputSocket* inputsocket, int editorNodeInputSocketIndex) {
|
||||
void Node::addSetValueOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex)
|
||||
{
|
||||
bNodeSocket *bSock = (bNodeSocket*)this->getEditorInputSocket(editorNodeInputSocketIndex);
|
||||
SetValueOperation *operation = new SetValueOperation();
|
||||
bNodeSocketValueFloat *val = (bNodeSocketValueFloat*)bSock->default_value;
|
||||
@@ -77,7 +83,8 @@ void Node::addSetValueOperation(ExecutionSystem *graph, InputSocket* inputsocket
|
||||
graph->addOperation(operation);
|
||||
}
|
||||
|
||||
void Node::addPreviewOperation(ExecutionSystem *system, OutputSocket *outputSocket, int priority) {
|
||||
void Node::addPreviewOperation(ExecutionSystem *system, OutputSocket *outputSocket, int priority)
|
||||
{
|
||||
#ifdef COM_PREVIEW_ENABLED
|
||||
PreviewOperation *operation = new PreviewOperation();
|
||||
system->addOperation(operation);
|
||||
@@ -88,14 +95,16 @@ void Node::addPreviewOperation(ExecutionSystem *system, OutputSocket *outputSock
|
||||
#endif
|
||||
}
|
||||
|
||||
void Node::addPreviewOperation(ExecutionSystem *system, InputSocket *inputSocket, int priority) {
|
||||
void Node::addPreviewOperation(ExecutionSystem *system, InputSocket *inputSocket, int priority)
|
||||
{
|
||||
if (inputSocket->isConnected()) {
|
||||
OutputSocket *outputsocket = inputSocket->getConnection()->getFromSocket();
|
||||
this->addPreviewOperation(system, outputsocket, priority);
|
||||
}
|
||||
}
|
||||
|
||||
SocketConnection* Node::addLink(ExecutionSystem *graph, OutputSocket* outputSocket, InputSocket* inputsocket) {
|
||||
SocketConnection *Node::addLink(ExecutionSystem *graph, OutputSocket *outputSocket, InputSocket *inputsocket)
|
||||
{
|
||||
if (inputsocket->isConnected()) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -108,7 +117,8 @@ SocketConnection* Node::addLink(ExecutionSystem *graph, OutputSocket* outputSock
|
||||
return connection;
|
||||
}
|
||||
|
||||
void Node::addSetColorOperation(ExecutionSystem *graph, InputSocket* inputsocket, int editorNodeInputSocketIndex) {
|
||||
void Node::addSetColorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex)
|
||||
{
|
||||
bNodeSocket *bSock = (bNodeSocket*)this->getEditorInputSocket(editorNodeInputSocketIndex);
|
||||
SetColorOperation *operation = new SetColorOperation();
|
||||
bNodeSocketValueRGBA *val = (bNodeSocketValueRGBA*)bSock->default_value;
|
||||
@@ -120,7 +130,8 @@ void Node::addSetColorOperation(ExecutionSystem *graph, InputSocket* inputsocket
|
||||
graph->addOperation(operation);
|
||||
}
|
||||
|
||||
void Node::addSetVectorOperation(ExecutionSystem *graph, InputSocket* inputsocket, int editorNodeInputSocketIndex) {
|
||||
void Node::addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex)
|
||||
{
|
||||
bNodeSocket *bSock = (bNodeSocket*)this->getEditorInputSocket(editorNodeInputSocketIndex);
|
||||
bNodeSocketValueVector *val = (bNodeSocketValueVector*)bSock->default_value;
|
||||
SetVectorOperation *operation = new SetVectorOperation();
|
||||
@@ -132,7 +143,8 @@ void Node::addSetVectorOperation(ExecutionSystem *graph, InputSocket* inputsocke
|
||||
graph->addOperation(operation);
|
||||
}
|
||||
|
||||
bNodeSocket* Node::getEditorInputSocket(int editorNodeInputSocketIndex) {
|
||||
bNodeSocket *Node::getEditorInputSocket(int editorNodeInputSocketIndex)
|
||||
{
|
||||
bNodeSocket *bSock = (bNodeSocket*)this->getbNode()->inputs.first;
|
||||
int index = 0;
|
||||
while (bSock != NULL) {
|
||||
@@ -144,7 +156,8 @@ bNodeSocket* Node::getEditorInputSocket(int editorNodeInputSocketIndex) {
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
bNodeSocket* Node::getEditorOutputSocket(int editorNodeInputSocketIndex) {
|
||||
bNodeSocket *Node::getEditorOutputSocket(int editorNodeInputSocketIndex)
|
||||
{
|
||||
bNodeSocket *bSock = (bNodeSocket*)this->getbNode()->outputs.first;
|
||||
int index = 0;
|
||||
while (bSock != NULL) {
|
||||
@@ -157,11 +170,12 @@ bNodeSocket* Node::getEditorOutputSocket(int editorNodeInputSocketIndex) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
InputSocket* Node::findInputSocketBybNodeSocket(bNodeSocket* socket) {
|
||||
InputSocket *Node::findInputSocketBybNodeSocket(bNodeSocket *socket)
|
||||
{
|
||||
vector<InputSocket*> &inputsockets = this->getInputSockets();
|
||||
unsigned int index;
|
||||
for (index = 0 ; index < inputsockets.size(); index ++) {
|
||||
InputSocket* input = inputsockets[index];
|
||||
InputSocket *input = inputsockets[index];
|
||||
if (input->getbNodeSocket() == socket) {
|
||||
return input;
|
||||
}
|
||||
@@ -169,11 +183,12 @@ InputSocket* Node::findInputSocketBybNodeSocket(bNodeSocket* socket) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OutputSocket* Node::findOutputSocketBybNodeSocket(bNodeSocket* socket) {
|
||||
OutputSocket *Node::findOutputSocketBybNodeSocket(bNodeSocket *socket)
|
||||
{
|
||||
vector<OutputSocket*> &outputsockets = this->getOutputSockets();
|
||||
unsigned int index;
|
||||
for (index = 0 ; index < outputsockets.size(); index ++) {
|
||||
OutputSocket* output = outputsockets[index];
|
||||
OutputSocket *output = outputsockets[index];
|
||||
if (output->getbNodeSocket() == socket) {
|
||||
return output;
|
||||
}
|
||||
|
@@ -50,15 +50,15 @@ private:
|
||||
/**
|
||||
* @brief stores the reference to the SDNA bNode struct
|
||||
*/
|
||||
bNode* editorNode;
|
||||
bNode *editorNode;
|
||||
|
||||
public:
|
||||
Node(bNode* editorNode, bool create_sockets=true);
|
||||
Node(bNode *editorNode, bool create_sockets=true);
|
||||
|
||||
/**
|
||||
* @brief get the reference to the SDNA bNode struct
|
||||
*/
|
||||
bNode* getbNode();
|
||||
bNode *getbNode();
|
||||
|
||||
/**
|
||||
* @brief convert node to operation
|
||||
@@ -68,31 +68,31 @@ public:
|
||||
* @param system the ExecutionSystem where the operations need to be added
|
||||
* @param context reference to the CompositorContext
|
||||
*/
|
||||
virtual void convertToOperations(ExecutionSystem* system, CompositorContext * context) =0;
|
||||
virtual void convertToOperations(ExecutionSystem *system, CompositorContext * context) =0;
|
||||
|
||||
/**
|
||||
* this method adds a SetValueOperation as input of the input socket.
|
||||
* This can only be used from the convertToOperation method. all other usages are not allowed
|
||||
*/
|
||||
void addSetValueOperation(ExecutionSystem *graph, InputSocket* inputsocket, int editorNodeInputSocketIndex);
|
||||
void addSetValueOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex);
|
||||
|
||||
/**
|
||||
* this method adds a SetColorOperation as input of the input socket.
|
||||
* This can only be used from the convertToOperation method. all other usages are not allowed
|
||||
*/
|
||||
void addSetColorOperation(ExecutionSystem *graph, InputSocket* inputsocket, int editorNodeInputSocketIndex);
|
||||
void addSetColorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex);
|
||||
|
||||
/**
|
||||
* this method adds a SetVectorOperation as input of the input socket.
|
||||
* This can only be used from the convertToOperation method. all other usages are not allowed
|
||||
*/
|
||||
void addSetVectorOperation(ExecutionSystem *graph, InputSocket* inputsocket, int editorNodeInputSocketIndex);
|
||||
void addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex);
|
||||
|
||||
/**
|
||||
* Creates a new link between an outputSocket and inputSocket and registrates the link to the graph
|
||||
* @return the new created link
|
||||
*/
|
||||
SocketConnection* addLink(ExecutionSystem *graph, OutputSocket* outputSocket, InputSocket* inputsocket);
|
||||
SocketConnection *addLink(ExecutionSystem *graph, OutputSocket *outputSocket, InputSocket *inputsocket);
|
||||
|
||||
/**
|
||||
* is this node a group node.
|
||||
@@ -108,23 +108,23 @@ public:
|
||||
*
|
||||
* @param socket
|
||||
*/
|
||||
InputSocket* findInputSocketBybNodeSocket(bNodeSocket* socket);
|
||||
InputSocket *findInputSocketBybNodeSocket(bNodeSocket *socket);
|
||||
|
||||
/**
|
||||
* @brief find the OutputSocket by bNodeSocket
|
||||
*
|
||||
* @param socket
|
||||
*/
|
||||
OutputSocket* findOutputSocketBybNodeSocket(bNodeSocket* socket);
|
||||
OutputSocket *findOutputSocketBybNodeSocket(bNodeSocket *socket);
|
||||
protected:
|
||||
|
||||
Node();
|
||||
|
||||
void addPreviewOperation(ExecutionSystem *system, InputSocket* inputSocket, int priority);
|
||||
void addPreviewOperation(ExecutionSystem *system, OutputSocket* inputSocket, int priority);
|
||||
void addPreviewOperation(ExecutionSystem *system, InputSocket *inputSocket, int priority);
|
||||
void addPreviewOperation(ExecutionSystem *system, OutputSocket *inputSocket, int priority);
|
||||
|
||||
bNodeSocket* getEditorInputSocket(int editorNodeInputSocketIndex);
|
||||
bNodeSocket* getEditorOutputSocket(int editorNodeOutputSocketIndex);
|
||||
bNodeSocket *getEditorInputSocket(int editorNodeInputSocketIndex);
|
||||
bNodeSocket *getEditorOutputSocket(int editorNodeOutputSocketIndex);
|
||||
private:
|
||||
};
|
||||
|
||||
|
@@ -29,11 +29,13 @@
|
||||
#include "COM_SocketConnection.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
NodeBase::NodeBase() {
|
||||
NodeBase::NodeBase()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NodeBase::~NodeBase() {
|
||||
NodeBase::~NodeBase()
|
||||
{
|
||||
while (!this->outputsockets.empty()) {
|
||||
delete (this->outputsockets.back());
|
||||
this->outputsockets.pop_back();
|
||||
@@ -44,60 +46,70 @@ NodeBase::~NodeBase() {
|
||||
}
|
||||
}
|
||||
|
||||
void NodeBase::addInputSocket(DataType datatype) {
|
||||
void NodeBase::addInputSocket(DataType datatype)
|
||||
{
|
||||
this->addInputSocket(datatype, COM_SC_CENTER, NULL);
|
||||
}
|
||||
|
||||
void NodeBase::addInputSocket(DataType datatype, InputSocketResizeMode resizeMode) {
|
||||
void NodeBase::addInputSocket(DataType datatype, InputSocketResizeMode resizeMode)
|
||||
{
|
||||
this->addInputSocket(datatype, resizeMode, NULL);
|
||||
}
|
||||
void NodeBase::addInputSocket(DataType datatype, InputSocketResizeMode resizeMode, bNodeSocket* bSocket) {
|
||||
void NodeBase::addInputSocket(DataType datatype, InputSocketResizeMode resizeMode, bNodeSocket *bSocket)
|
||||
{
|
||||
InputSocket *socket = new InputSocket(datatype, resizeMode);
|
||||
socket->setEditorSocket(bSocket);
|
||||
socket->setNode(this);
|
||||
this->inputsockets.push_back(socket);
|
||||
}
|
||||
|
||||
void NodeBase::addOutputSocket(DataType datatype) {
|
||||
void NodeBase::addOutputSocket(DataType datatype)
|
||||
{
|
||||
this->addOutputSocket(datatype, NULL);
|
||||
|
||||
}
|
||||
void NodeBase::addOutputSocket(DataType datatype, bNodeSocket* bSocket) {
|
||||
void NodeBase::addOutputSocket(DataType datatype, bNodeSocket *bSocket)
|
||||
{
|
||||
OutputSocket *socket = new OutputSocket(datatype);
|
||||
socket->setEditorSocket(bSocket);
|
||||
socket->setNode(this);
|
||||
this->outputsockets.push_back(socket);
|
||||
}
|
||||
const bool NodeBase::isInputNode() const {
|
||||
const bool NodeBase::isInputNode() const
|
||||
{
|
||||
return this->inputsockets.size() == 0;
|
||||
}
|
||||
|
||||
OutputSocket* NodeBase::getOutputSocket(int index) {
|
||||
OutputSocket *NodeBase::getOutputSocket(int index)
|
||||
{
|
||||
return this->outputsockets[index];
|
||||
}
|
||||
|
||||
InputSocket* NodeBase::getInputSocket(int index) {
|
||||
InputSocket *NodeBase::getInputSocket(int index)
|
||||
{
|
||||
return this->inputsockets[index];
|
||||
}
|
||||
|
||||
|
||||
void NodeBase::determineActualSocketDataTypes() {
|
||||
void NodeBase::determineActualSocketDataTypes()
|
||||
{
|
||||
unsigned int index;
|
||||
for (index = 0 ; index < this->outputsockets.size() ; index ++) {
|
||||
OutputSocket* socket = this->outputsockets[index];
|
||||
OutputSocket *socket = this->outputsockets[index];
|
||||
if (socket->getActualDataType() ==COM_DT_UNKNOWN && socket->isConnected()) {
|
||||
socket->determineActualDataType();
|
||||
}
|
||||
}
|
||||
for (index = 0 ; index < this->inputsockets.size() ; index ++) {
|
||||
InputSocket* socket = this->inputsockets[index];
|
||||
InputSocket *socket = this->inputsockets[index];
|
||||
if (socket->getActualDataType() ==COM_DT_UNKNOWN) {
|
||||
socket->determineActualDataType();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DataType NodeBase::determineActualDataType(OutputSocket *outputsocket) {
|
||||
DataType NodeBase::determineActualDataType(OutputSocket *outputsocket)
|
||||
{
|
||||
const int inputIndex = outputsocket->getInputSocketDataTypeDeterminatorIndex();
|
||||
if (inputIndex != -1) {
|
||||
return this->getInputSocket(inputIndex)->getActualDataType();
|
||||
@@ -107,7 +119,8 @@ DataType NodeBase::determineActualDataType(OutputSocket *outputsocket) {
|
||||
}
|
||||
}
|
||||
|
||||
void NodeBase::notifyActualDataTypeSet(InputSocket *socket, DataType actualType) {
|
||||
void NodeBase::notifyActualDataTypeSet(InputSocket *socket, DataType actualType)
|
||||
{
|
||||
unsigned int index;
|
||||
int socketIndex = -1;
|
||||
for (index = 0 ; index < this->inputsockets.size() ; index ++) {
|
||||
@@ -119,9 +132,10 @@ void NodeBase::notifyActualDataTypeSet(InputSocket *socket, DataType actualType)
|
||||
if (socketIndex == -1) return;
|
||||
|
||||
for (index = 0 ; index < this->outputsockets.size() ; index ++) {
|
||||
OutputSocket* socket = this->outputsockets[index];
|
||||
OutputSocket *socket = this->outputsockets[index];
|
||||
if (socket->isActualDataTypeDeterminedByInputSocket() &&
|
||||
socket->getInputSocketDataTypeDeterminatorIndex() == socketIndex) {
|
||||
socket->getInputSocketDataTypeDeterminatorIndex() == socketIndex)
|
||||
{
|
||||
socket->setActualDataType(actualType);
|
||||
socket->fireActualDataType();
|
||||
}
|
||||
|
@@ -124,32 +124,32 @@ public:
|
||||
* @param actualType [COM_DT_VALUE, COM_DT_VECTOR, COM_DT_COLOR]
|
||||
* the actual data type that is coming from the connected output socket
|
||||
*/
|
||||
virtual void notifyActualDataTypeSet(InputSocket* socket, const DataType actualType);
|
||||
virtual void notifyActualDataTypeSet(InputSocket *socket, const DataType actualType);
|
||||
|
||||
/**
|
||||
* get the reference to a certain outputsocket
|
||||
* @param index
|
||||
* the index of the needed outputsocket
|
||||
*/
|
||||
OutputSocket* getOutputSocket(const int index);
|
||||
OutputSocket *getOutputSocket(const int index);
|
||||
|
||||
/**
|
||||
* get the reference to the first outputsocket
|
||||
* @param index
|
||||
* the index of the needed outputsocket
|
||||
*/
|
||||
inline OutputSocket* getOutputSocket() {return getOutputSocket(0);}
|
||||
inline OutputSocket *getOutputSocket() {return getOutputSocket(0);}
|
||||
|
||||
/**
|
||||
* get the reference to a certain inputsocket
|
||||
* @param index
|
||||
* the index of the needed inputsocket
|
||||
*/
|
||||
InputSocket* getInputSocket(const int index);
|
||||
InputSocket *getInputSocket(const int index);
|
||||
|
||||
|
||||
virtual bool isStatic() const {return false;}
|
||||
void getStaticValues(float* result) const {}
|
||||
void getStaticValues(float *result) const {}
|
||||
protected:
|
||||
NodeBase();
|
||||
|
||||
@@ -160,7 +160,7 @@ protected:
|
||||
*/
|
||||
void addInputSocket(DataType datatype);
|
||||
void addInputSocket(DataType datatype, InputSocketResizeMode resizeMode);
|
||||
void addInputSocket(DataType datatype, InputSocketResizeMode resizeMode, bNodeSocket* socket);
|
||||
void addInputSocket(DataType datatype, InputSocketResizeMode resizeMode, bNodeSocket *socket);
|
||||
|
||||
/**
|
||||
* @brief add an OutputSocket to the collection of outputsockets
|
||||
@@ -168,7 +168,7 @@ protected:
|
||||
* @param socket the OutputSocket to add
|
||||
*/
|
||||
void addOutputSocket(DataType datatype);
|
||||
void addOutputSocket(DataType datatype, bNodeSocket* socket);
|
||||
void addOutputSocket(DataType datatype, bNodeSocket *socket);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -27,7 +27,8 @@
|
||||
#include "COM_defines.h"
|
||||
#include "stdio.h"
|
||||
|
||||
NodeOperation::NodeOperation() {
|
||||
NodeOperation::NodeOperation()
|
||||
{
|
||||
this->resolutionInputSocketIndex = 0;
|
||||
this->complex = false;
|
||||
this->width = 0;
|
||||
@@ -35,13 +36,14 @@ NodeOperation::NodeOperation() {
|
||||
this->openCL = false;
|
||||
}
|
||||
|
||||
void NodeOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) {
|
||||
void NodeOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
|
||||
{
|
||||
unsigned int temp[2];
|
||||
unsigned int temp2[2];
|
||||
vector<InputSocket*> &inputsockets = this->getInputSockets();
|
||||
|
||||
for (unsigned int index = 0 ; index < inputsockets.size();index++) {
|
||||
InputSocket* inputSocket = inputsockets[index];
|
||||
InputSocket *inputSocket = inputsockets[index];
|
||||
if (inputSocket->isConnected()) {
|
||||
if (index == this->resolutionInputSocketIndex) {
|
||||
inputSocket->determineResolution(resolution, preferredResolution);
|
||||
@@ -52,7 +54,7 @@ void NodeOperation::determineResolution(unsigned int resolution[], unsigned int
|
||||
}
|
||||
}
|
||||
for (unsigned int index = 0 ; index < inputsockets.size();index++) {
|
||||
InputSocket* inputSocket = inputsockets[index];
|
||||
InputSocket *inputSocket = inputsockets[index];
|
||||
if (inputSocket->isConnected()) {
|
||||
if (index != resolutionInputSocketIndex) {
|
||||
inputSocket->determineResolution(temp, temp2);
|
||||
@@ -60,28 +62,36 @@ void NodeOperation::determineResolution(unsigned int resolution[], unsigned int
|
||||
}
|
||||
}
|
||||
}
|
||||
void NodeOperation::setResolutionInputSocketIndex(unsigned int index) {
|
||||
void NodeOperation::setResolutionInputSocketIndex(unsigned int index)
|
||||
{
|
||||
this->resolutionInputSocketIndex = index;
|
||||
}
|
||||
void NodeOperation::initExecution() {
|
||||
void NodeOperation::initExecution()
|
||||
{
|
||||
}
|
||||
|
||||
void NodeOperation::initMutex() {
|
||||
void NodeOperation::initMutex()
|
||||
{
|
||||
BLI_mutex_init(&mutex);
|
||||
}
|
||||
void NodeOperation::deinitMutex() {
|
||||
void NodeOperation::deinitMutex()
|
||||
{
|
||||
BLI_mutex_end(&mutex);
|
||||
}
|
||||
void NodeOperation::deinitExecution() {
|
||||
void NodeOperation::deinitExecution()
|
||||
{
|
||||
}
|
||||
SocketReader* NodeOperation::getInputSocketReader(unsigned int inputSocketIndex) {
|
||||
SocketReader *NodeOperation::getInputSocketReader(unsigned int inputSocketIndex)
|
||||
{
|
||||
return this->getInputSocket(inputSocketIndex)->getReader();
|
||||
}
|
||||
NodeOperation* NodeOperation::getInputOperation(unsigned int inputSocketIndex) {
|
||||
NodeOperation *NodeOperation::getInputOperation(unsigned int inputSocketIndex)
|
||||
{
|
||||
return this->getInputSocket(inputSocketIndex)->getOperation();
|
||||
}
|
||||
|
||||
void NodeOperation::getConnectedInputSockets(vector<InputSocket*> *sockets) {
|
||||
void NodeOperation::getConnectedInputSockets(vector<InputSocket*> *sockets)
|
||||
{
|
||||
vector<InputSocket*> &inputsockets = this->getInputSockets();
|
||||
for (vector<InputSocket*>::iterator iterator = inputsockets.begin() ; iterator!= inputsockets.end() ; iterator++) {
|
||||
InputSocket *socket = *iterator;
|
||||
@@ -91,7 +101,8 @@ void NodeOperation::getConnectedInputSockets(vector<InputSocket*> *sockets) {
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeOperation::determineDependingAreaOfInterest(rcti * input, ReadBufferOperation *readOperation, rcti* output) {
|
||||
bool NodeOperation::determineDependingAreaOfInterest(rcti * input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
if (this->isInputNode()) {
|
||||
BLI_init_rcti(output, input->xmin, input->xmax, input->ymin, input->ymax);
|
||||
return false;
|
||||
@@ -101,9 +112,9 @@ bool NodeOperation::determineDependingAreaOfInterest(rcti * input, ReadBufferOpe
|
||||
vector<InputSocket*> &inputsockets = this->getInputSockets();
|
||||
|
||||
for (index = 0 ; index < inputsockets.size() ; index++) {
|
||||
InputSocket* inputsocket = inputsockets[index];
|
||||
InputSocket *inputsocket = inputsockets[index];
|
||||
if (inputsocket->isConnected()) {
|
||||
NodeOperation* inputoperation = (NodeOperation*)inputsocket->getConnection()->getFromNode();
|
||||
NodeOperation *inputoperation = (NodeOperation*)inputsocket->getConnection()->getFromNode();
|
||||
bool result = inputoperation->determineDependingAreaOfInterest(input, readOperation, output);
|
||||
if (result) {
|
||||
return true;
|
||||
|
@@ -153,7 +153,7 @@ public:
|
||||
* @param clMemToCleanUp all created cl_mem references must be added to this list. Framework will clean this after execution
|
||||
* @param clKernelsToCleanUp all created cl_kernel references must be added to this list. Framework will clean this after execution
|
||||
*/
|
||||
virtual void executeOpenCL(cl_context context,cl_program program, cl_command_queue queue, MemoryBuffer* outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer** inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> *clKernelsToCleanUp) {}
|
||||
virtual void executeOpenCL(cl_context context,cl_program program, cl_command_queue queue, MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer** inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> *clKernelsToCleanUp) {}
|
||||
virtual void deinitExecution();
|
||||
void deinitMutex();
|
||||
|
||||
@@ -195,7 +195,7 @@ public:
|
||||
*/
|
||||
virtual const bool isActiveViewerOutput() const {return false;}
|
||||
|
||||
virtual bool determineDependingAreaOfInterest(rcti * input, ReadBufferOperation* readOperation, rcti* output);
|
||||
virtual bool determineDependingAreaOfInterest(rcti * input, ReadBufferOperation *readOperation, rcti *output);
|
||||
|
||||
/**
|
||||
* @brief set the index of the input socket that will determine the resolution of this operation
|
||||
@@ -222,11 +222,11 @@ protected:
|
||||
NodeOperation();
|
||||
|
||||
void setWidth(unsigned int width) {this->width = width;}
|
||||
void setHeight(unsigned int height) {this->height= height;}
|
||||
SocketReader* getInputSocketReader(unsigned int inputSocketindex);
|
||||
NodeOperation* getInputOperation(unsigned int inputSocketindex);
|
||||
void setHeight(unsigned int height) {this->height = height;}
|
||||
SocketReader *getInputSocketReader(unsigned int inputSocketindex);
|
||||
NodeOperation *getInputOperation(unsigned int inputSocketindex);
|
||||
|
||||
inline ThreadMutex* getMutex() {return &this->mutex;}
|
||||
inline ThreadMutex *getMutex() {return &this->mutex;}
|
||||
|
||||
/**
|
||||
* @brief set whether this operation is complex
|
||||
|
@@ -24,26 +24,30 @@
|
||||
#include "COM_WorkScheduler.h"
|
||||
|
||||
|
||||
OpenCLDevice::OpenCLDevice(cl_context context, cl_device_id device, cl_program program) {
|
||||
OpenCLDevice::OpenCLDevice(cl_context context, cl_device_id device, cl_program program)
|
||||
{
|
||||
this->device = device;
|
||||
this->context = context;
|
||||
this->program = program;
|
||||
this->queue = NULL;
|
||||
}
|
||||
|
||||
bool OpenCLDevice::initialize() {
|
||||
bool OpenCLDevice::initialize()
|
||||
{
|
||||
cl_int error;
|
||||
queue = clCreateCommandQueue(context, device, 0, &error);
|
||||
return false;
|
||||
}
|
||||
|
||||
void OpenCLDevice::deinitialize() {
|
||||
void OpenCLDevice::deinitialize()
|
||||
{
|
||||
if (queue) {
|
||||
clReleaseCommandQueue(queue);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenCLDevice::execute(WorkPackage *work) {
|
||||
void OpenCLDevice::execute(WorkPackage *work)
|
||||
{
|
||||
const unsigned int chunkNumber = work->getChunkNumber();
|
||||
ExecutionGroup * executionGroup = work->getExecutionGroup();
|
||||
rcti rect;
|
||||
|
@@ -25,30 +25,35 @@
|
||||
#include "COM_SocketConnection.h"
|
||||
#include "COM_NodeOperation.h"
|
||||
|
||||
OutputSocket::OutputSocket(DataType datatype) :Socket(datatype) {
|
||||
OutputSocket::OutputSocket(DataType datatype) :Socket(datatype)
|
||||
{
|
||||
this->inputSocketDataTypeDeterminatorIndex = -1;
|
||||
}
|
||||
OutputSocket::OutputSocket(DataType datatype, int inputSocketDataTypeDeterminatorIndex) :Socket(datatype) {
|
||||
OutputSocket::OutputSocket(DataType datatype, int inputSocketDataTypeDeterminatorIndex) :Socket(datatype)
|
||||
{
|
||||
this->inputSocketDataTypeDeterminatorIndex = inputSocketDataTypeDeterminatorIndex;
|
||||
}
|
||||
|
||||
OutputSocket::OutputSocket(OutputSocket *from): Socket(from->getDataType()) {
|
||||
OutputSocket::OutputSocket(OutputSocket *from): Socket(from->getDataType())
|
||||
{
|
||||
this->inputSocketDataTypeDeterminatorIndex = from->getInputSocketDataTypeDeterminatorIndex();
|
||||
}
|
||||
|
||||
int OutputSocket::isOutputSocket() const { return true; }
|
||||
const int OutputSocket::isConnected() const { return this->connections.size()!=0; }
|
||||
|
||||
void OutputSocket::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) {
|
||||
NodeBase* node = this->getNode();
|
||||
void OutputSocket::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
|
||||
{
|
||||
NodeBase *node = this->getNode();
|
||||
if (node->isOperation()) {
|
||||
NodeOperation* operation = (NodeOperation*)node;
|
||||
NodeOperation *operation = (NodeOperation*)node;
|
||||
operation->determineResolution(resolution, preferredResolution);
|
||||
operation->setResolution(resolution);
|
||||
}
|
||||
}
|
||||
|
||||
void OutputSocket::determineActualDataType() {
|
||||
void OutputSocket::determineActualDataType()
|
||||
{
|
||||
DataType actualDatatype = this->getNode()->determineActualDataType(this);
|
||||
|
||||
/** @todo: set the channel info needs to be moved after integration with OCIO */
|
||||
@@ -79,18 +84,21 @@ void OutputSocket::determineActualDataType() {
|
||||
this->fireActualDataType();
|
||||
}
|
||||
|
||||
void OutputSocket::addConnection(SocketConnection *connection) {
|
||||
void OutputSocket::addConnection(SocketConnection *connection)
|
||||
{
|
||||
this->connections.push_back(connection);
|
||||
}
|
||||
|
||||
void OutputSocket::fireActualDataType() {
|
||||
void OutputSocket::fireActualDataType()
|
||||
{
|
||||
unsigned int index;
|
||||
for (index = 0 ; index < this->connections.size();index ++) {
|
||||
SocketConnection *connection = this->connections[index];
|
||||
connection->getToSocket()->notifyActualInputType(this->getActualDataType());
|
||||
}
|
||||
}
|
||||
void OutputSocket::relinkConnections(OutputSocket *relinkToSocket, bool single) {
|
||||
void OutputSocket::relinkConnections(OutputSocket *relinkToSocket, bool single)
|
||||
{
|
||||
if (isConnected()) {
|
||||
if (single) {
|
||||
SocketConnection *connection = this->connections[0];
|
||||
@@ -111,28 +119,31 @@ void OutputSocket::relinkConnections(OutputSocket *relinkToSocket, bool single)
|
||||
}
|
||||
}
|
||||
}
|
||||
void OutputSocket::removeFirstConnection() {
|
||||
void OutputSocket::removeFirstConnection()
|
||||
{
|
||||
SocketConnection *connection = this->connections[0];
|
||||
InputSocket* inputSocket = connection->getToSocket();
|
||||
InputSocket *inputSocket = connection->getToSocket();
|
||||
if (inputSocket != NULL) {
|
||||
inputSocket->setConnection(NULL);
|
||||
}
|
||||
this->connections.erase(this->connections.begin());
|
||||
}
|
||||
|
||||
void OutputSocket::clearConnections() {
|
||||
void OutputSocket::clearConnections()
|
||||
{
|
||||
while (this->isConnected()) {
|
||||
removeFirstConnection();
|
||||
}
|
||||
}
|
||||
|
||||
WriteBufferOperation* OutputSocket::findAttachedWriteBufferOperation() const {
|
||||
WriteBufferOperation *OutputSocket::findAttachedWriteBufferOperation() const
|
||||
{
|
||||
unsigned int index;
|
||||
for (index = 0 ; index < this->connections.size();index++) {
|
||||
SocketConnection* connection = this->connections[index];
|
||||
NodeBase* node = connection->getToNode();
|
||||
SocketConnection *connection = this->connections[index];
|
||||
NodeBase *node = connection->getToNode();
|
||||
if (node->isOperation()) {
|
||||
NodeOperation* operation = (NodeOperation*)node;
|
||||
NodeOperation *operation = (NodeOperation*)node;
|
||||
if (operation->isWriteBufferOperation()) {
|
||||
return (WriteBufferOperation*)operation;
|
||||
}
|
||||
@@ -141,7 +152,8 @@ WriteBufferOperation* OutputSocket::findAttachedWriteBufferOperation() const {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ChannelInfo* OutputSocket::getChannelInfo(const int channelnumber) {
|
||||
ChannelInfo *OutputSocket::getChannelInfo(const int channelnumber)
|
||||
{
|
||||
return &this->channelinfo[channelnumber];
|
||||
}
|
||||
|
||||
|
@@ -58,7 +58,7 @@ public:
|
||||
OutputSocket(DataType datatype, int inputSocketDataTypeDeterminatorIndex);
|
||||
OutputSocket(OutputSocket * from);
|
||||
void addConnection(SocketConnection *connection);
|
||||
SocketConnection* getConnection(unsigned int index) {return this->connections[index];}
|
||||
SocketConnection *getConnection(unsigned int index) {return this->connections[index];}
|
||||
const int isConnected() const;
|
||||
int isOutputSocket() const;
|
||||
|
||||
@@ -90,8 +90,8 @@ public:
|
||||
* @brief find a connected write buffer operation to this OutputSocket
|
||||
* @return WriteBufferOperation or NULL
|
||||
*/
|
||||
WriteBufferOperation* findAttachedWriteBufferOperation() const;
|
||||
ChannelInfo* getChannelInfo(const int channelnumber);
|
||||
WriteBufferOperation *findAttachedWriteBufferOperation() const;
|
||||
ChannelInfo *getChannelInfo(const int channelnumber);
|
||||
|
||||
/**
|
||||
* @brief trigger determine actual data type to all connected sockets
|
||||
|
@@ -24,14 +24,16 @@
|
||||
#include "COM_Node.h"
|
||||
#include "COM_SocketConnection.h"
|
||||
|
||||
Socket::Socket(DataType datatype) {
|
||||
Socket::Socket(DataType datatype)
|
||||
{
|
||||
this->datatype = datatype;
|
||||
this->actualType = COM_DT_UNKNOWN;
|
||||
this->editorSocket = NULL;
|
||||
this->node = NULL;
|
||||
}
|
||||
|
||||
DataType Socket::getDataType() const {
|
||||
DataType Socket::getDataType() const
|
||||
{
|
||||
return this->datatype;
|
||||
}
|
||||
|
||||
@@ -39,9 +41,10 @@ int Socket::isInputSocket() const { return false; }
|
||||
int Socket::isOutputSocket() const { return false; }
|
||||
const int Socket::isConnected() const {return false;}
|
||||
void Socket::setNode(NodeBase *node) {this->node = node;}
|
||||
NodeBase* Socket::getNode() const {return this->node;}
|
||||
NodeBase *Socket::getNode() const {return this->node;}
|
||||
|
||||
DataType Socket::getActualDataType() const {return this->actualType;}
|
||||
void Socket::setActualDataType(DataType actualType) {
|
||||
void Socket::setActualDataType(DataType actualType)
|
||||
{
|
||||
this->actualType = actualType;
|
||||
}
|
||||
|
@@ -49,7 +49,7 @@ private:
|
||||
/**
|
||||
* Reference to the node where this Socket belongs to
|
||||
*/
|
||||
NodeBase* node;
|
||||
NodeBase *node;
|
||||
|
||||
/**
|
||||
* the datatype of this socket. Is used for automatically data transformation.
|
||||
@@ -63,13 +63,13 @@ private:
|
||||
*/
|
||||
DataType actualType;
|
||||
|
||||
bNodeSocket* editorSocket;
|
||||
bNodeSocket *editorSocket;
|
||||
public:
|
||||
Socket(DataType datatype);
|
||||
|
||||
DataType getDataType() const;
|
||||
void setNode(NodeBase* node);
|
||||
NodeBase* getNode() const;
|
||||
void setNode(NodeBase *node);
|
||||
NodeBase *getNode() const;
|
||||
|
||||
/**
|
||||
* @brief get the actual data type
|
||||
@@ -91,8 +91,8 @@ public:
|
||||
virtual void determineResolution(int resolution[], unsigned int preferredResolution[]) {}
|
||||
virtual void determineActualDataType() {}
|
||||
|
||||
void setEditorSocket(bNodeSocket* editorSocket) {this->editorSocket = editorSocket;}
|
||||
bNodeSocket* getbNodeSocket() const {return this->editorSocket;}
|
||||
void setEditorSocket(bNodeSocket *editorSocket) {this->editorSocket = editorSocket;}
|
||||
bNodeSocket *getbNodeSocket() const {return this->editorSocket;}
|
||||
|
||||
};
|
||||
|
||||
|
@@ -23,30 +23,34 @@
|
||||
#include "COM_SocketConnection.h"
|
||||
#include "COM_NodeOperation.h"
|
||||
|
||||
SocketConnection::SocketConnection() {
|
||||
SocketConnection::SocketConnection()
|
||||
{
|
||||
this->fromSocket = NULL;
|
||||
this->toSocket = NULL;
|
||||
this->setIgnoreResizeCheck(false);
|
||||
}
|
||||
|
||||
void SocketConnection::setFromSocket(OutputSocket* fromsocket) {
|
||||
void SocketConnection::setFromSocket(OutputSocket *fromsocket)
|
||||
{
|
||||
if (fromsocket == NULL) {
|
||||
throw "ERROR";
|
||||
}
|
||||
this->fromSocket = fromsocket;
|
||||
}
|
||||
|
||||
OutputSocket* SocketConnection::getFromSocket() const {return this->fromSocket;}
|
||||
void SocketConnection::setToSocket(InputSocket* tosocket) {
|
||||
OutputSocket *SocketConnection::getFromSocket() const {return this->fromSocket;}
|
||||
void SocketConnection::setToSocket(InputSocket *tosocket)
|
||||
{
|
||||
if (tosocket == NULL) {
|
||||
throw "ERROR";
|
||||
}
|
||||
this->toSocket = tosocket;
|
||||
}
|
||||
|
||||
InputSocket* SocketConnection::getToSocket() const {return this->toSocket;}
|
||||
InputSocket *SocketConnection::getToSocket() const {return this->toSocket;}
|
||||
|
||||
NodeBase* SocketConnection::getFromNode() const {
|
||||
NodeBase *SocketConnection::getFromNode() const
|
||||
{
|
||||
if (this->getFromSocket() == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -54,7 +58,8 @@ NodeBase* SocketConnection::getFromNode() const {
|
||||
return this->getFromSocket()->getNode();
|
||||
}
|
||||
}
|
||||
NodeBase* SocketConnection::getToNode() const {
|
||||
NodeBase *SocketConnection::getToNode() const
|
||||
{
|
||||
if (this->getToSocket() == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -62,7 +67,8 @@ NodeBase* SocketConnection::getToNode() const {
|
||||
return this->getToSocket()->getNode();
|
||||
}
|
||||
}
|
||||
bool SocketConnection::isValid() const {
|
||||
bool SocketConnection::isValid() const
|
||||
{
|
||||
if ((this->getToSocket() != NULL && this->getFromSocket() != NULL)) {
|
||||
if (this->getFromNode()->isOperation() && this->getToNode()->isOperation()) {
|
||||
return true;
|
||||
@@ -71,10 +77,11 @@ bool SocketConnection::isValid() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SocketConnection::needsResolutionConversion() const {
|
||||
bool SocketConnection::needsResolutionConversion() const
|
||||
{
|
||||
if (this->ignoreResizeCheck) {return false;}
|
||||
NodeOperation* fromOperation = (NodeOperation*)this->getFromNode();
|
||||
NodeOperation* toOperation = (NodeOperation*)this->getToNode();
|
||||
NodeOperation *fromOperation = (NodeOperation*)this->getFromNode();
|
||||
NodeOperation *toOperation = (NodeOperation*)this->getToNode();
|
||||
if (this->toSocket->getResizeMode() == COM_SC_NO_RESIZE) {return false;}
|
||||
const unsigned int fromWidth = fromOperation->getWidth();
|
||||
const unsigned int fromHeight = fromOperation->getHeight();
|
||||
|
@@ -66,25 +66,25 @@ public:
|
||||
* @brief set the startpoint of the connection
|
||||
* @param fromsocket
|
||||
*/
|
||||
void setFromSocket(OutputSocket* fromsocket);
|
||||
void setFromSocket(OutputSocket *fromsocket);
|
||||
|
||||
/**
|
||||
* @brief get the startpoint of the connection
|
||||
* @return from OutputSocket
|
||||
*/
|
||||
OutputSocket* getFromSocket() const;
|
||||
OutputSocket *getFromSocket() const;
|
||||
|
||||
/**
|
||||
* @brief set the endpoint of the connection
|
||||
* @param tosocket
|
||||
*/
|
||||
void setToSocket(InputSocket* tosocket);
|
||||
void setToSocket(InputSocket *tosocket);
|
||||
|
||||
/**
|
||||
* @brief get the endpoint of the connection
|
||||
* @return to InputSocket
|
||||
*/
|
||||
InputSocket* getToSocket() const;
|
||||
InputSocket *getToSocket() const;
|
||||
|
||||
/**
|
||||
* @brief check if this connection is valid
|
||||
|
@@ -59,7 +59,7 @@ protected:
|
||||
* @param y the y-coordinate of the pixel to calculate in image space
|
||||
* @param inputBuffers chunks that can be read by their ReadBufferOperation.
|
||||
*/
|
||||
virtual void executePixel(float* result, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {}
|
||||
virtual void executePixel(float *result, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {}
|
||||
|
||||
/**
|
||||
* @brief calculate a single pixel
|
||||
@@ -70,7 +70,7 @@ protected:
|
||||
* @param inputBuffers chunks that can be read by their ReadBufferOperation.
|
||||
* @param chunkData chunk specific data a during execution time.
|
||||
*/
|
||||
virtual void executePixel(float* result, int x, int y, MemoryBuffer *inputBuffers[], void* chunkData) {
|
||||
virtual void executePixel(float *result, int x, int y, MemoryBuffer *inputBuffers[], void *chunkData) {
|
||||
executePixel(result, x, y, COM_PS_NEAREST, inputBuffers);
|
||||
}
|
||||
|
||||
@@ -84,26 +84,26 @@ protected:
|
||||
* @param dy
|
||||
* @param inputBuffers chunks that can be read by their ReadBufferOperation.
|
||||
*/
|
||||
virtual void executePixel(float* result, float x, float y, float dx, float dy, MemoryBuffer *inputBuffers[]) {}
|
||||
virtual void executePixel(float *result, float x, float y, float dx, float dy, MemoryBuffer *inputBuffers[]) {}
|
||||
|
||||
public:
|
||||
inline void read(float* result, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
inline void read(float *result, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
|
||||
executePixel(result, x, y, sampler, inputBuffers);
|
||||
}
|
||||
inline void read(float* result, int x, int y, MemoryBuffer *inputBuffers[], void* chunkData) {
|
||||
inline void read(float *result, int x, int y, MemoryBuffer *inputBuffers[], void *chunkData) {
|
||||
executePixel(result, x, y, inputBuffers, chunkData);
|
||||
}
|
||||
inline void read(float* result, float x, float y, float dx, float dy, MemoryBuffer *inputBuffers[]) {
|
||||
inline void read(float *result, float x, float y, float dx, float dy, MemoryBuffer *inputBuffers[]) {
|
||||
executePixel(result, x, y, dx, dy, inputBuffers);
|
||||
}
|
||||
|
||||
virtual void* initializeTileData(rcti *rect, MemoryBuffer** memoryBuffers) {
|
||||
virtual void *initializeTileData(rcti *rect, MemoryBuffer** memoryBuffers) {
|
||||
return 0;
|
||||
}
|
||||
virtual void deinitializeTileData(rcti *rect, MemoryBuffer** memoryBuffers, void* data) {
|
||||
virtual void deinitializeTileData(rcti *rect, MemoryBuffer** memoryBuffers, void *data) {
|
||||
}
|
||||
|
||||
virtual MemoryBuffer* getInputMemoryBuffer(MemoryBuffer** memoryBuffers) {return 0;}
|
||||
virtual MemoryBuffer *getInputMemoryBuffer(MemoryBuffer** memoryBuffers) {return 0;}
|
||||
|
||||
|
||||
inline const unsigned int getWidth() const {return this->width;}
|
||||
|
@@ -22,7 +22,8 @@
|
||||
|
||||
#include "COM_WorkPackage.h"
|
||||
|
||||
WorkPackage::WorkPackage(ExecutionGroup *group, unsigned int chunkNumber) {
|
||||
WorkPackage::WorkPackage(ExecutionGroup *group, unsigned int chunkNumber)
|
||||
{
|
||||
this->executionGroup = group;
|
||||
this->chunkNumber = chunkNumber;
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@ private:
|
||||
/**
|
||||
* @brief executionGroup with the operations-setup to be evaluated
|
||||
*/
|
||||
ExecutionGroup* executionGroup;
|
||||
ExecutionGroup *executionGroup;
|
||||
|
||||
/**
|
||||
* @brief number of the chunk to be executed
|
||||
@@ -48,12 +48,12 @@ public:
|
||||
* @param group the ExecutionGroup
|
||||
* @param chunkNumber the number of the chunk
|
||||
*/
|
||||
WorkPackage(ExecutionGroup* group, unsigned int chunkNumber);
|
||||
WorkPackage(ExecutionGroup *group, unsigned int chunkNumber);
|
||||
|
||||
/**
|
||||
* @brief get the ExecutionGroup
|
||||
*/
|
||||
ExecutionGroup* getExecutionGroup() const {return this->executionGroup;}
|
||||
ExecutionGroup *getExecutionGroup() const {return this->executionGroup;}
|
||||
|
||||
/**
|
||||
* @brief get the number of the chunk
|
||||
|
@@ -65,14 +65,15 @@ static bool openclActive = false;
|
||||
|
||||
|
||||
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
|
||||
void* WorkScheduler::thread_execute_cpu(void* data) {
|
||||
void *WorkScheduler::thread_execute_cpu(void *data)
|
||||
{
|
||||
bool continueLoop = true;
|
||||
Device* device = (Device*)data;
|
||||
Device *device = (Device*)data;
|
||||
while (continueLoop) {
|
||||
WorkPackage* work = (WorkPackage*)BLI_thread_queue_pop(cpuqueue);
|
||||
WorkPackage *work = (WorkPackage*)BLI_thread_queue_pop(cpuqueue);
|
||||
if (work) {
|
||||
device->execute(work);
|
||||
delete work;
|
||||
device->execute(work);
|
||||
delete work;
|
||||
}
|
||||
PIL_sleep_ms(10);
|
||||
|
||||
@@ -83,11 +84,12 @@ void* WorkScheduler::thread_execute_cpu(void* data) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* WorkScheduler::thread_execute_gpu(void* data) {
|
||||
void *WorkScheduler::thread_execute_gpu(void *data)
|
||||
{
|
||||
bool continueLoop = true;
|
||||
Device* device = (Device*)data;
|
||||
Device *device = (Device*)data;
|
||||
while (continueLoop) {
|
||||
WorkPackage* work = (WorkPackage*)BLI_thread_queue_pop(gpuqueue);
|
||||
WorkPackage *work = (WorkPackage*)BLI_thread_queue_pop(gpuqueue);
|
||||
if (work) {
|
||||
device->execute(work);
|
||||
delete work;
|
||||
@@ -106,8 +108,9 @@ bool WorkScheduler::isStopping() {return state == COM_WSS_STOPPING;}
|
||||
|
||||
|
||||
|
||||
void WorkScheduler::schedule(ExecutionGroup *group, int chunkNumber) {
|
||||
WorkPackage* package = new WorkPackage(group, chunkNumber);
|
||||
void WorkScheduler::schedule(ExecutionGroup *group, int chunkNumber)
|
||||
{
|
||||
WorkPackage *package = new WorkPackage(group, chunkNumber);
|
||||
#if COM_CURRENT_THREADING_MODEL == COM_TM_NOTHREAD
|
||||
CPUDevice device;
|
||||
device.execute(package);
|
||||
@@ -126,14 +129,15 @@ void WorkScheduler::schedule(ExecutionGroup *group, int chunkNumber) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void WorkScheduler::start(CompositorContext &context) {
|
||||
void WorkScheduler::start(CompositorContext &context)
|
||||
{
|
||||
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
|
||||
unsigned int index;
|
||||
cpuqueue = BLI_thread_queue_init();
|
||||
BLI_thread_queue_nowait(cpuqueue);
|
||||
BLI_init_threads(&cputhreads, thread_execute_cpu, cpudevices.size());
|
||||
for (index = 0 ; index < cpudevices.size() ; index ++) {
|
||||
Device* device = cpudevices[index];
|
||||
Device *device = cpudevices[index];
|
||||
BLI_insert_thread(&cputhreads, device);
|
||||
}
|
||||
#ifdef COM_OPENCL_ENABLED
|
||||
@@ -142,7 +146,7 @@ void WorkScheduler::start(CompositorContext &context) {
|
||||
BLI_thread_queue_nowait(gpuqueue);
|
||||
BLI_init_threads(&gputhreads, thread_execute_gpu, gpudevices.size());
|
||||
for (index = 0 ; index < gpudevices.size() ; index ++) {
|
||||
Device* device = gpudevices[index];
|
||||
Device *device = gpudevices[index];
|
||||
BLI_insert_thread(&gputhreads, device);
|
||||
}
|
||||
openclActive = true;
|
||||
@@ -154,7 +158,8 @@ void WorkScheduler::start(CompositorContext &context) {
|
||||
#endif
|
||||
state = COM_WSS_STARTED;
|
||||
}
|
||||
void WorkScheduler::finish() {
|
||||
void WorkScheduler::finish()
|
||||
{
|
||||
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
|
||||
#ifdef COM_OPENCL_ENABLED
|
||||
if (openclActive) {
|
||||
@@ -174,7 +179,8 @@ void WorkScheduler::finish() {
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
void WorkScheduler::stop() {
|
||||
void WorkScheduler::stop()
|
||||
{
|
||||
state = COM_WSS_STOPPING;
|
||||
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
|
||||
BLI_end_threads(&cputhreads);
|
||||
@@ -191,7 +197,8 @@ void WorkScheduler::stop() {
|
||||
state = COM_WSS_STOPPED;
|
||||
}
|
||||
|
||||
bool WorkScheduler::hasGPUDevices() {
|
||||
bool WorkScheduler::hasGPUDevices()
|
||||
{
|
||||
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
|
||||
#ifdef COM_OPENCL_ENABLED
|
||||
return gpudevices.size()>0;
|
||||
@@ -203,11 +210,13 @@ bool WorkScheduler::hasGPUDevices() {
|
||||
#endif
|
||||
}
|
||||
|
||||
extern void clContextError(const char *errinfo, const void *private_info, size_t cb, void *user_data) {
|
||||
extern void clContextError(const char *errinfo, const void *private_info, size_t cb, void *user_data)
|
||||
{
|
||||
printf("OPENCL error: %s\n", errinfo);
|
||||
}
|
||||
|
||||
void WorkScheduler::initialize() {
|
||||
void WorkScheduler::initialize()
|
||||
{
|
||||
state = COM_WSS_UNKNOWN;
|
||||
|
||||
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
|
||||
@@ -257,7 +266,7 @@ void WorkScheduler::initialize() {
|
||||
printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
|
||||
error2 = clGetProgramBuildInfo(program, cldevices[0], CL_PROGRAM_BUILD_LOG, 0, NULL, &ret_val_size);
|
||||
if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
|
||||
char* build_log = new char[ret_val_size+1];
|
||||
char *build_log = new char[ret_val_size+1];
|
||||
error2 = clGetProgramBuildInfo(program, cldevices[0], CL_PROGRAM_BUILD_LOG, ret_val_size, build_log, NULL);
|
||||
if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
|
||||
build_log[ret_val_size] = '\0';
|
||||
@@ -268,7 +277,7 @@ void WorkScheduler::initialize() {
|
||||
unsigned int indexDevices;
|
||||
for (indexDevices = 0 ; indexDevices < totalNumberOfDevices ; indexDevices ++) {
|
||||
cl_device_id device = cldevices[indexDevices];
|
||||
OpenCLDevice* clDevice = new OpenCLDevice(context, device, program);
|
||||
OpenCLDevice *clDevice = new OpenCLDevice(context, device, program);
|
||||
clDevice->initialize(),
|
||||
gpudevices.push_back(clDevice);
|
||||
char resultString[32];
|
||||
@@ -286,9 +295,10 @@ void WorkScheduler::initialize() {
|
||||
state = COM_WSS_INITIALIZED;
|
||||
}
|
||||
|
||||
void WorkScheduler::deinitialize() {
|
||||
void WorkScheduler::deinitialize()
|
||||
{
|
||||
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
|
||||
Device* device;
|
||||
Device *device;
|
||||
while (cpudevices.size()>0) {
|
||||
device = cpudevices.back();
|
||||
cpudevices.pop_back();
|
||||
|
@@ -59,13 +59,13 @@ class WorkScheduler {
|
||||
* @brief main thread loop for cpudevices
|
||||
* inside this loop new work is queried and being executed
|
||||
*/
|
||||
static void* thread_execute_cpu(void* data);
|
||||
static void *thread_execute_cpu(void *data);
|
||||
|
||||
/**
|
||||
* @brief main thread loop for gpudevices
|
||||
* inside this loop new work is queried and being executed
|
||||
*/
|
||||
static void* thread_execute_gpu(void* data);
|
||||
static void *thread_execute_gpu(void *data);
|
||||
#endif
|
||||
public:
|
||||
/**
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
* @param group the execution group
|
||||
* @param chunkNumber the number of the chunk in the group to be executed
|
||||
*/
|
||||
static void schedule(ExecutionGroup* group, int chunkNumber);
|
||||
static void schedule(ExecutionGroup *group, int chunkNumber);
|
||||
|
||||
/**
|
||||
* @brief initialize the WorkScheduler
|
||||
|
@@ -31,7 +31,8 @@ extern "C" {
|
||||
#include "COM_WorkScheduler.h"
|
||||
|
||||
static ThreadMutex *compositorMutex;
|
||||
void COM_execute(bNodeTree *editingtree, int rendering) {
|
||||
void COM_execute(bNodeTree *editingtree, int rendering)
|
||||
{
|
||||
if (compositorMutex == NULL) { /// TODO: move to blender startup phase
|
||||
compositorMutex = new ThreadMutex();
|
||||
BLI_mutex_init(compositorMutex);
|
||||
@@ -51,7 +52,7 @@ void COM_execute(bNodeTree *editingtree, int rendering) {
|
||||
editingtree->stats_draw(editingtree->sdh, (char*)"Compositing");
|
||||
|
||||
/* initialize execution system */
|
||||
ExecutionSystem* system = new ExecutionSystem(editingtree, rendering);
|
||||
ExecutionSystem *system = new ExecutionSystem(editingtree, rendering);
|
||||
system->execute();
|
||||
delete system;
|
||||
|
||||
|
@@ -31,15 +31,16 @@
|
||||
#include "COM_SetValueOperation.h"
|
||||
#include "DNA_material_types.h" // the ramp types
|
||||
|
||||
void AlphaOverNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void AlphaOverNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *valueSocket = this->getInputSocket(0);
|
||||
InputSocket *color1Socket = this->getInputSocket(1);
|
||||
InputSocket *color2Socket = this->getInputSocket(2);
|
||||
OutputSocket *outputSocket = this->getOutputSocket(0);
|
||||
bNode* editorNode = this->getbNode();
|
||||
bNode *editorNode = this->getbNode();
|
||||
|
||||
MixBaseOperation *convertProg;
|
||||
NodeTwoFloats *ntf= (NodeTwoFloats*)editorNode->storage;
|
||||
NodeTwoFloats *ntf = (NodeTwoFloats*)editorNode->storage;
|
||||
if (ntf->x!= 0.0f) {
|
||||
AlphaOverMixedOperation *mixOperation = new AlphaOverMixedOperation();
|
||||
mixOperation->setX(ntf->x);
|
||||
|
@@ -31,7 +31,7 @@
|
||||
*/
|
||||
class AlphaOverNode: public Node {
|
||||
public:
|
||||
AlphaOverNode(bNode* editorNode) :Node(editorNode) {}
|
||||
AlphaOverNode(bNode *editorNode) :Node(editorNode) {}
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
|
@@ -26,10 +26,12 @@
|
||||
#include "COM_ExecutionSystem.h"
|
||||
#include "COM_BilateralBlurOperation.h"
|
||||
|
||||
BilateralBlurNode::BilateralBlurNode(bNode *editorNode): Node(editorNode) {
|
||||
BilateralBlurNode::BilateralBlurNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void BilateralBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void BilateralBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
NodeBilateralBlurData *data = (NodeBilateralBlurData*)this->getbNode()->storage;
|
||||
BilateralBlurOperation *operation = new BilateralBlurOperation();
|
||||
operation->setQuality(context->getQuality());
|
||||
|
@@ -32,7 +32,7 @@
|
||||
class BilateralBlurNode: public Node {
|
||||
public:
|
||||
BilateralBlurNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -29,11 +29,13 @@
|
||||
#include "COM_GaussianBokehBlurOperation.h"
|
||||
#include "COM_FastGaussianBlurOperation.h"
|
||||
|
||||
BlurNode::BlurNode(bNode *editorNode): Node(editorNode) {
|
||||
BlurNode::BlurNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
bNode* editorNode = this->getbNode();
|
||||
void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
bNode *editorNode = this->getbNode();
|
||||
NodeBlurData * data = (NodeBlurData*)editorNode->storage;
|
||||
#if 0
|
||||
const bNodeSocket *sock = this->getInputSocket(1)->getbNodeSocket();
|
||||
|
@@ -33,7 +33,7 @@
|
||||
class BlurNode: public Node {
|
||||
public:
|
||||
BlurNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -30,11 +30,13 @@
|
||||
#include "COM_VariableSizeBokehBlurOperation.h"
|
||||
#include "COM_ConvertDepthToRadiusOperation.h"
|
||||
|
||||
BokehBlurNode::BokehBlurNode(bNode *editorNode): Node(editorNode) {
|
||||
BokehBlurNode::BokehBlurNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
Object* camob = context->getScene()->camera;
|
||||
void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
Object *camob = context->getScene()->camera;
|
||||
|
||||
if (this->getInputSocket(2)->isConnected()) {
|
||||
VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation();
|
||||
|
@@ -33,7 +33,7 @@
|
||||
class BokehBlurNode: public Node {
|
||||
public:
|
||||
BokehBlurNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -25,10 +25,12 @@
|
||||
#include "COM_BokehImageOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
BokehImageNode::BokehImageNode(bNode *editorNode): Node(editorNode) {
|
||||
BokehImageNode::BokehImageNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void BokehImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void BokehImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
BokehImageOperation *operation = new BokehImageOperation();
|
||||
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
|
||||
graph->addOperation(operation);
|
||||
|
@@ -32,7 +32,7 @@
|
||||
class BokehImageNode: public Node {
|
||||
public:
|
||||
BokehImageNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -25,10 +25,12 @@
|
||||
#include "COM_BoxMaskOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
BoxMaskNode::BoxMaskNode(bNode *editorNode): Node(editorNode) {
|
||||
BoxMaskNode::BoxMaskNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void BoxMaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void BoxMaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
BoxMaskOperation *operation;
|
||||
operation = new BoxMaskOperation();
|
||||
operation->setData((NodeBoxMask*)this->getbNode()->storage);
|
||||
|
@@ -32,7 +32,7 @@
|
||||
class BoxMaskNode: public Node {
|
||||
public:
|
||||
BoxMaskNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -25,10 +25,12 @@
|
||||
#include "COM_BrightnessOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
BrightnessNode::BrightnessNode(bNode *editorNode): Node(editorNode) {
|
||||
BrightnessNode::BrightnessNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
/// @todo: add anti alias when not FSA
|
||||
void BrightnessNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void BrightnessNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
BrightnessOperation *operation = new BrightnessOperation();
|
||||
|
||||
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0));
|
||||
|
@@ -32,7 +32,7 @@
|
||||
class BrightnessNode: public Node {
|
||||
public:
|
||||
BrightnessNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -30,13 +30,14 @@
|
||||
ChannelMatteNode::ChannelMatteNode(bNode *editorNode): Node(editorNode)
|
||||
{}
|
||||
|
||||
void ChannelMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) {
|
||||
void ChannelMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
|
||||
{
|
||||
InputSocket *inputSocketImage = this->getInputSocket(0);
|
||||
OutputSocket *outputSocketImage = this->getOutputSocket(0);
|
||||
OutputSocket *outputSocketMatte = this->getOutputSocket(1);
|
||||
|
||||
NodeOperation *convert=NULL;
|
||||
bNode* node = this->getbNode();
|
||||
bNode *node = this->getbNode();
|
||||
|
||||
/* colorspace */
|
||||
switch (node->custom1) {
|
||||
|
@@ -28,7 +28,8 @@
|
||||
ChromaMatteNode::ChromaMatteNode(bNode *editorNode): Node(editorNode)
|
||||
{}
|
||||
|
||||
void ChromaMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) {
|
||||
void ChromaMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
|
||||
{
|
||||
InputSocket *inputSocketImage = this->getInputSocket(0);
|
||||
InputSocket *inputSocketKey = this->getInputSocket(1);
|
||||
OutputSocket *outputSocketImage = this->getOutputSocket(0);
|
||||
@@ -40,7 +41,7 @@ void ChromaMatteNode::convertToOperations(ExecutionSystem *graph, CompositorCont
|
||||
operationRGBToYCC_Key->setMode(0); /* BLI_YCC_ITU_BT601 */
|
||||
|
||||
ChromaMatteOperation *operation = new ChromaMatteOperation();
|
||||
bNode* editorsnode = getbNode();
|
||||
bNode *editorsnode = getbNode();
|
||||
operation->setSettings((NodeChroma*)editorsnode->storage);
|
||||
|
||||
inputSocketImage->relinkConnections(operationRGBToYCC_Image->getInputSocket(0), true, 0, graph);
|
||||
|
@@ -27,19 +27,20 @@
|
||||
#include "BKE_node.h"
|
||||
#include "COM_MixBlendOperation.h"
|
||||
|
||||
ColorBalanceNode::ColorBalanceNode(bNode* editorNode): Node(editorNode)
|
||||
ColorBalanceNode::ColorBalanceNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
void ColorBalanceNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void ColorBalanceNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *inputSocket = this->getInputSocket(0);
|
||||
InputSocket *inputImageSocket = this->getInputSocket(1);
|
||||
OutputSocket *outputSocket = this->getOutputSocket(0);
|
||||
|
||||
bNode* node = this->getbNode();
|
||||
NodeColorBalance *n= (NodeColorBalance *)node->storage;
|
||||
bNode *node = this->getbNode();
|
||||
NodeColorBalance *n = (NodeColorBalance *)node->storage;
|
||||
NodeOperation*operation;
|
||||
if (node->custom1 == 0) {
|
||||
ColorBalanceLGGOperation* operationLGG = new ColorBalanceLGGOperation();
|
||||
ColorBalanceLGGOperation *operationLGG = new ColorBalanceLGGOperation();
|
||||
{
|
||||
int c;
|
||||
|
||||
|
@@ -32,8 +32,8 @@
|
||||
class ColorBalanceNode : public Node
|
||||
{
|
||||
public:
|
||||
ColorBalanceNode(bNode* editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
ColorBalanceNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
|
||||
};
|
||||
|
||||
#endif // COM_ColorBalanceNODE_H
|
||||
|
@@ -25,12 +25,14 @@
|
||||
#include "COM_ColorCorrectionOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
ColorCorrectionNode::ColorCorrectionNode(bNode *editorNode): Node(editorNode) {
|
||||
ColorCorrectionNode::ColorCorrectionNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void ColorCorrectionNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void ColorCorrectionNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
ColorCorrectionOperation *operation = new ColorCorrectionOperation();
|
||||
bNode* editorNode = getbNode();
|
||||
bNode *editorNode = getbNode();
|
||||
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0),true, 0, graph);
|
||||
this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1),true, 1, graph);
|
||||
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
|
||||
|
@@ -32,7 +32,7 @@
|
||||
class ColorCorrectionNode: public Node {
|
||||
public:
|
||||
ColorCorrectionNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -25,10 +25,12 @@
|
||||
#include "COM_ColorCurveOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
ColorCurveNode::ColorCurveNode(bNode *editorNode): Node(editorNode) {
|
||||
ColorCurveNode::ColorCurveNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void ColorCurveNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void ColorCurveNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
ColorCurveOperation *operation = new ColorCurveOperation();
|
||||
|
||||
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), true, 0, graph);
|
||||
|
@@ -32,7 +32,7 @@
|
||||
class ColorCurveNode: public Node {
|
||||
public:
|
||||
ColorCurveNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -28,7 +28,8 @@
|
||||
ColorMatteNode::ColorMatteNode(bNode *editorNode): Node(editorNode)
|
||||
{}
|
||||
|
||||
void ColorMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) {
|
||||
void ColorMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
|
||||
{
|
||||
InputSocket *inputSocketImage = this->getInputSocket(0);
|
||||
InputSocket *inputSocketKey = this->getInputSocket(1);
|
||||
OutputSocket *outputSocketImage = this->getOutputSocket(0);
|
||||
@@ -38,7 +39,7 @@ void ColorMatteNode::convertToOperations(ExecutionSystem *graph, CompositorConte
|
||||
ConvertRGBToHSVOperation *operationRGBToHSV_Key = new ConvertRGBToHSVOperation();
|
||||
|
||||
ColorMatteOperation *operation = new ColorMatteOperation();
|
||||
bNode* editorsnode = getbNode();
|
||||
bNode *editorsnode = getbNode();
|
||||
operation->setSettings((NodeChroma*)editorsnode->storage);
|
||||
|
||||
inputSocketImage->relinkConnections(operationRGBToHSV_Image->getInputSocket(0), true, 0, graph);
|
||||
|
@@ -25,12 +25,14 @@
|
||||
#include "COM_SetColorOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
ColorNode::ColorNode(bNode *editorNode): Node(editorNode) {
|
||||
ColorNode::ColorNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void ColorNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void ColorNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
SetColorOperation *operation = new SetColorOperation();
|
||||
bNodeSocket* socket = this->getEditorOutputSocket(0);
|
||||
bNodeSocket *socket = this->getEditorOutputSocket(0);
|
||||
bNodeSocketValueRGBA *dval = (bNodeSocketValueRGBA*)socket->default_value;
|
||||
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
|
||||
operation->setChannels(dval->value);
|
||||
|
@@ -32,7 +32,7 @@
|
||||
class ColorNode: public Node {
|
||||
public:
|
||||
ColorNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -27,16 +27,17 @@
|
||||
#include "COM_SeparateChannelOperation.h"
|
||||
#include "DNA_texture_types.h"
|
||||
|
||||
ColorRampNode::ColorRampNode(bNode* editorNode): Node(editorNode)
|
||||
ColorRampNode::ColorRampNode(bNode *editorNode): Node(editorNode)
|
||||
{}
|
||||
|
||||
void ColorRampNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void ColorRampNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *inputSocket = this->getInputSocket(0);
|
||||
OutputSocket *outputSocket = this->getOutputSocket(0);
|
||||
OutputSocket *outputSocketAlpha = this->getOutputSocket(1);
|
||||
bNode* editorNode = this->getbNode();
|
||||
bNode *editorNode = this->getbNode();
|
||||
|
||||
ColorRampOperation * operation = new ColorRampOperation();
|
||||
ColorRampOperation *operation = new ColorRampOperation();
|
||||
outputSocket->relinkConnections(operation->getOutputSocket(0));
|
||||
if (outputSocketAlpha->isConnected()) {
|
||||
SeparateChannelOperation *operation2 = new SeparateChannelOperation();
|
||||
|
@@ -32,8 +32,8 @@
|
||||
class ColorRampNode : public Node
|
||||
{
|
||||
public:
|
||||
ColorRampNode(bNode* editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
ColorRampNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif // COM_ColorRampNODE_H
|
||||
|
@@ -27,12 +27,13 @@
|
||||
ColorSpillNode::ColorSpillNode(bNode *editorNode): Node(editorNode)
|
||||
{}
|
||||
|
||||
void ColorSpillNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) {
|
||||
void ColorSpillNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
|
||||
{
|
||||
InputSocket *inputSocketImage = this->getInputSocket(0);
|
||||
InputSocket *inputSocketFac = this->getInputSocket(1);
|
||||
OutputSocket *outputSocketImage = this->getOutputSocket(0);
|
||||
|
||||
bNode* editorsnode = getbNode();
|
||||
bNode *editorsnode = getbNode();
|
||||
|
||||
|
||||
ColorSpillOperation *operation;
|
||||
|
@@ -25,10 +25,12 @@
|
||||
#include "COM_ConvertColorToBWOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
ColourToBWNode::ColourToBWNode(bNode *editorNode): Node(editorNode) {
|
||||
ColourToBWNode::ColourToBWNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void ColourToBWNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void ColourToBWNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *colourSocket = this->getInputSocket(0);
|
||||
OutputSocket *valueSocket = this->getOutputSocket(0);
|
||||
|
||||
|
@@ -28,10 +28,12 @@
|
||||
#include "COM_SetValueOperation.h"
|
||||
#include "COM_ConvertHSVToRGBOperation.h"
|
||||
|
||||
CombineHSVANode::CombineHSVANode(bNode *editorNode): CombineRGBANode(editorNode) {
|
||||
CombineHSVANode::CombineHSVANode(bNode *editorNode): CombineRGBANode(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void CombineHSVANode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void CombineHSVANode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
ConvertHSVToRGBOperation *operation = new ConvertHSVToRGBOperation();
|
||||
OutputSocket *outputSocket = this->getOutputSocket(0);
|
||||
if (outputSocket->isConnected()) {
|
||||
|
@@ -29,11 +29,13 @@
|
||||
#include "DNA_material_types.h" // the ramp types
|
||||
|
||||
|
||||
CombineRGBANode::CombineRGBANode(bNode *editorNode): Node(editorNode) {
|
||||
CombineRGBANode::CombineRGBANode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void CombineRGBANode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void CombineRGBANode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *inputRSocket = this->getInputSocket(0);
|
||||
InputSocket *inputGSocket = this->getInputSocket(1);
|
||||
InputSocket *inputBSocket = this->getInputSocket(2);
|
||||
|
@@ -22,10 +22,12 @@
|
||||
#include "COM_CombineYCCANode.h"
|
||||
#include "COM_ConvertYCCToRGBOperation.h"
|
||||
|
||||
CombineYCCANode::CombineYCCANode(bNode *editorNode): CombineRGBANode(editorNode) {
|
||||
CombineYCCANode::CombineYCCANode(bNode *editorNode): CombineRGBANode(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void CombineYCCANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) {
|
||||
void CombineYCCANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
|
||||
{
|
||||
ConvertYCCToRGBOperation *operation = new ConvertYCCToRGBOperation();
|
||||
OutputSocket *outputSocket = this->getOutputSocket(0);
|
||||
|
||||
|
@@ -22,10 +22,12 @@
|
||||
#include "COM_CombineYUVANode.h"
|
||||
#include "COM_ConvertYUVToRGBOperation.h"
|
||||
|
||||
CombineYUVANode::CombineYUVANode(bNode *editorNode): CombineRGBANode(editorNode) {
|
||||
CombineYUVANode::CombineYUVANode(bNode *editorNode): CombineRGBANode(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void CombineYUVANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) {
|
||||
void CombineYUVANode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
|
||||
{
|
||||
ConvertYUVToRGBOperation *operation = new ConvertYUVToRGBOperation();
|
||||
OutputSocket *outputSocket = this->getOutputSocket(0);
|
||||
if (outputSocket->isConnected()) {
|
||||
|
@@ -24,10 +24,12 @@
|
||||
#include "COM_CompositorOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
CompositorNode::CompositorNode(bNode *editorNode): Node(editorNode) {
|
||||
CompositorNode::CompositorNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void CompositorNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void CompositorNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *imageSocket = this->getInputSocket(0);
|
||||
InputSocket *alphaSocket = this->getInputSocket(1);
|
||||
if (imageSocket->isConnected()) {
|
||||
|
@@ -24,9 +24,10 @@
|
||||
#include "COM_ConvertKeyToPremulOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
void ConvertAlphaNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
NodeOperation* operation = NULL;
|
||||
bNode* node = this->getbNode();
|
||||
void ConvertAlphaNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
NodeOperation *operation = NULL;
|
||||
bNode *node = this->getbNode();
|
||||
|
||||
/* value hardcoded in rna_nodetree.c */
|
||||
if (node->custom1 == 1) {
|
||||
|
@@ -30,7 +30,7 @@
|
||||
*/
|
||||
class ConvertAlphaNode: public Node {
|
||||
public:
|
||||
ConvertAlphaNode(bNode* editorNode) :Node(editorNode) {}
|
||||
ConvertAlphaNode(bNode *editorNode) :Node(editorNode) {}
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
|
@@ -24,11 +24,13 @@
|
||||
#include "COM_CropOperation.h"
|
||||
|
||||
|
||||
CropNode::CropNode(bNode *editorNode) : Node(editorNode) {
|
||||
CropNode::CropNode(bNode *editorNode) : Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void CropNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
bNode* node = getbNode();
|
||||
void CropNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
bNode *node = getbNode();
|
||||
NodeTwoXYs *cropSettings = (NodeTwoXYs*)node->storage;
|
||||
bool relative = (bool)node->custom2;
|
||||
bool cropImage = (bool)node->custom1;
|
||||
|
@@ -28,7 +28,7 @@
|
||||
class CropNode: public Node {
|
||||
public:
|
||||
CropNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -33,16 +33,18 @@
|
||||
#include "COM_SetValueOperation.h"
|
||||
#include "COM_GammaCorrectOperation.h"
|
||||
|
||||
DefocusNode::DefocusNode(bNode *editorNode): Node(editorNode) {
|
||||
DefocusNode::DefocusNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
bNode *node = this->getbNode();
|
||||
Scene *scene= (Scene*)node->id;
|
||||
Object* camob = (scene)? scene->camera: NULL;
|
||||
Scene *scene = (Scene*)node->id;
|
||||
Object *camob = (scene)? scene->camera: NULL;
|
||||
NodeDefocus *data = (NodeDefocus*)node->storage;
|
||||
|
||||
NodeOperation* radiusOperation;
|
||||
NodeOperation *radiusOperation;
|
||||
if (data->no_zbuf) {
|
||||
MathMultiplyOperation *multiply = new MathMultiplyOperation();
|
||||
SetValueOperation *multiplier = new SetValueOperation();
|
||||
|
@@ -33,7 +33,7 @@
|
||||
class DefocusNode: public Node {
|
||||
public:
|
||||
DefocusNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -25,15 +25,16 @@
|
||||
#include "COM_DifferenceMatteOperation.h"
|
||||
#include "COM_SetAlphaOperation.h"
|
||||
|
||||
DifferenceMatteNode::DifferenceMatteNode(bNode* editorNode): Node(editorNode)
|
||||
DifferenceMatteNode::DifferenceMatteNode(bNode *editorNode): Node(editorNode)
|
||||
{}
|
||||
|
||||
void DifferenceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void DifferenceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *inputSocket = this->getInputSocket(0);
|
||||
InputSocket *inputSocket2 = this->getInputSocket(1);
|
||||
OutputSocket *outputSocketImage = this->getOutputSocket(0);
|
||||
OutputSocket *outputSocketMatte = this->getOutputSocket(1);
|
||||
bNode* editorNode = this->getbNode();
|
||||
bNode *editorNode = this->getbNode();
|
||||
|
||||
DifferenceMatteOperation * operationSet = new DifferenceMatteOperation();
|
||||
operationSet->setSettings((NodeChroma*)editorNode->storage);
|
||||
|
@@ -32,8 +32,8 @@
|
||||
class DifferenceMatteNode : public Node
|
||||
{
|
||||
public:
|
||||
DifferenceMatteNode(bNode* editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
DifferenceMatteNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif // COM_DifferenceMatteNODE_H
|
||||
|
@@ -27,11 +27,13 @@
|
||||
#include "COM_AntiAliasOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
DilateErodeNode::DilateErodeNode(bNode *editorNode): Node(editorNode) {
|
||||
DilateErodeNode::DilateErodeNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
bNode* editorNode = this->getbNode();
|
||||
void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
bNode *editorNode = this->getbNode();
|
||||
DilateErodeOperation *operation = new DilateErodeOperation();
|
||||
operation->setDistance(editorNode->custom2);
|
||||
operation->setInset(2.0f);
|
||||
|
@@ -32,7 +32,7 @@
|
||||
class DilateErodeNode: public Node {
|
||||
public:
|
||||
DilateErodeNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -26,10 +26,12 @@
|
||||
#include "COM_ExecutionSystem.h"
|
||||
#include "COM_DirectionalBlurOperation.h"
|
||||
|
||||
DirectionalBlurNode::DirectionalBlurNode(bNode *editorNode): Node(editorNode) {
|
||||
DirectionalBlurNode::DirectionalBlurNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void DirectionalBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void DirectionalBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
NodeDBlurData *data = (NodeDBlurData*)this->getbNode()->storage;
|
||||
DirectionalBlurOperation *operation = new DirectionalBlurOperation();
|
||||
operation->setQuality(context->getQuality());
|
||||
|
@@ -32,7 +32,7 @@
|
||||
class DirectionalBlurNode: public Node {
|
||||
public:
|
||||
DirectionalBlurNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -24,7 +24,8 @@
|
||||
#include "COM_DisplaceSimpleOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
DisplaceNode::DisplaceNode(bNode *editorNode): Node(editorNode) {
|
||||
DisplaceNode::DisplaceNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void DisplaceNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
|
@@ -27,14 +27,15 @@
|
||||
DistanceMatteNode::DistanceMatteNode(bNode *editorNode): Node(editorNode)
|
||||
{}
|
||||
|
||||
void DistanceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) {
|
||||
void DistanceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
|
||||
{
|
||||
InputSocket *inputSocketImage = this->getInputSocket(0);
|
||||
InputSocket *inputSocketKey = this->getInputSocket(1);
|
||||
OutputSocket *outputSocketImage = this->getOutputSocket(0);
|
||||
OutputSocket *outputSocketMatte = this->getOutputSocket(1);
|
||||
|
||||
DistanceMatteOperation *operation = new DistanceMatteOperation();
|
||||
bNode* editorsnode = getbNode();
|
||||
bNode *editorsnode = getbNode();
|
||||
operation->setSettings((NodeChroma*)editorsnode->storage);
|
||||
|
||||
inputSocketImage->relinkConnections(operation->getInputSocket(0), true, 0, graph);
|
||||
|
@@ -25,12 +25,14 @@
|
||||
#include "DNA_scene_types.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
DoubleEdgeMaskNode::DoubleEdgeMaskNode(bNode *editorNode): Node(editorNode) {
|
||||
DoubleEdgeMaskNode::DoubleEdgeMaskNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void DoubleEdgeMaskNode::convertToOperations(ExecutionSystem *system, CompositorContext * context) {
|
||||
void DoubleEdgeMaskNode::convertToOperations(ExecutionSystem *system, CompositorContext * context)
|
||||
{
|
||||
DoubleEdgeMaskOperation *operation;
|
||||
bNode* bnode = this->getbNode();
|
||||
bNode *bnode = this->getbNode();
|
||||
|
||||
operation = new DoubleEdgeMaskOperation();
|
||||
operation->setAdjecentOnly(bnode->custom1);
|
||||
|
@@ -32,7 +32,7 @@
|
||||
class DoubleEdgeMaskNode: public Node {
|
||||
public:
|
||||
DoubleEdgeMaskNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -25,10 +25,12 @@
|
||||
#include "COM_EllipseMaskOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
EllipseMaskNode::EllipseMaskNode(bNode *editorNode): Node(editorNode) {
|
||||
EllipseMaskNode::EllipseMaskNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void EllipseMaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void EllipseMaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
EllipseMaskOperation *operation;
|
||||
operation = new EllipseMaskOperation();
|
||||
operation->setData((NodeEllipseMask*)this->getbNode()->storage);
|
||||
|
@@ -32,7 +32,7 @@
|
||||
class EllipseMaskNode: public Node {
|
||||
public:
|
||||
EllipseMaskNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -27,11 +27,12 @@
|
||||
#include "BKE_node.h"
|
||||
#include "COM_MixBlendOperation.h"
|
||||
|
||||
FilterNode::FilterNode(bNode* editorNode): Node(editorNode)
|
||||
FilterNode::FilterNode(bNode *editorNode): Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void FilterNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void FilterNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *inputSocket = this->getInputSocket(0);
|
||||
InputSocket *inputImageSocket = this->getInputSocket(1);
|
||||
OutputSocket *outputSocket = this->getOutputSocket(0);
|
||||
|
@@ -32,8 +32,8 @@
|
||||
class FilterNode : public Node
|
||||
{
|
||||
public:
|
||||
FilterNode(bNode* editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
FilterNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif // COM_FILTERNODE_H
|
||||
|
@@ -25,10 +25,12 @@
|
||||
#include "COM_FlipOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
FlipNode::FlipNode(bNode *editorNode) : Node(editorNode) {
|
||||
FlipNode::FlipNode(bNode *editorNode) : Node(editorNode)
|
||||
{
|
||||
}
|
||||
|
||||
void FlipNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) {
|
||||
void FlipNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
|
||||
{
|
||||
InputSocket *inputSocket = this->getInputSocket(0);
|
||||
OutputSocket *outputSocket = this->getOutputSocket(0);
|
||||
FlipOperation *operation = new FlipOperation();
|
||||
|
@@ -32,7 +32,7 @@
|
||||
class FlipNode: public Node {
|
||||
public:
|
||||
FlipNode(bNode *editorNode);
|
||||
void convertToOperations(ExecutionSystem* graph, CompositorContext * context);
|
||||
void convertToOperations(ExecutionSystem *graph, CompositorContext * context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user