[Bf-blender-cvs] [87842d63883] master: Cleanup: Use blender::Vector in ExecutionGroup.
Jeroen Bakker
noreply at git.blender.org
Fri Mar 5 16:56:19 CET 2021
Commit: 87842d63883664125177e8361b5f06e2e5eba344
Author: Jeroen Bakker
Date: Fri Mar 5 15:58:52 2021 +0100
Branches: master
https://developer.blender.org/rB87842d63883664125177e8361b5f06e2e5eba344
Cleanup: Use blender::Vector in ExecutionGroup.
===================================================================
M source/blender/compositor/intern/COM_ExecutionGroup.cpp
M source/blender/compositor/intern/COM_ExecutionGroup.h
===================================================================
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cpp b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
index 63a278c2ecc..2427d3c4bd5 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
@@ -107,7 +107,7 @@ bool ExecutionGroup::addOperation(NodeOperation *operation)
m_initialized = true;
}
- m_operations.push_back(operation);
+ m_operations.append(operation);
return true;
}
@@ -136,8 +136,8 @@ void ExecutionGroup::initExecution()
for (index = 0; index < this->m_operations.size(); index++) {
NodeOperation *operation = this->m_operations[index];
if (operation->isReadBufferOperation()) {
- ReadBufferOperation *readOperation = (ReadBufferOperation *)operation;
- this->m_cachedReadOperations.push_back(readOperation);
+ ReadBufferOperation *readOperation = static_cast<ReadBufferOperation *>(operation);
+ this->m_read_operations.append(readOperation);
maxNumber = MAX2(maxNumber, readOperation->getOffset());
}
}
@@ -151,7 +151,7 @@ void ExecutionGroup::deinitExecution()
this->m_numberOfChunks = 0;
this->m_numberOfXChunks = 0;
this->m_numberOfYChunks = 0;
- this->m_cachedReadOperations.clear();
+ this->m_read_operations.clear();
this->m_bTree = nullptr;
}
void ExecutionGroup::determineResolution(unsigned int resolution[2])
@@ -372,16 +372,13 @@ MemoryBuffer **ExecutionGroup::getInputBuffersOpenCL(int chunkNumber)
{
rcti rect;
std::vector<MemoryProxy *> memoryproxies;
- unsigned int index;
determineChunkRect(&rect, chunkNumber);
this->determineDependingMemoryProxies(&memoryproxies);
MemoryBuffer **memoryBuffers = (MemoryBuffer **)MEM_callocN(
sizeof(MemoryBuffer *) * this->m_cachedMaxReadBufferOffset, __func__);
rcti output;
- for (index = 0; index < this->m_cachedReadOperations.size(); index++) {
- ReadBufferOperation *readOperation =
- (ReadBufferOperation *)this->m_cachedReadOperations[index];
+ for (ReadBufferOperation *readOperation : m_read_operations) {
MemoryProxy *memoryProxy = readOperation->getMemoryProxy();
this->determineDependingAreaOfInterest(&rect, readOperation, &output);
MemoryBuffer *memoryBuffer = memoryProxy->getExecutor()->constructConsolidatedMemoryBuffer(
@@ -551,9 +548,8 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem *graph, int xChun
bool canBeExecuted = true;
rcti area;
- for (index = 0; index < this->m_cachedReadOperations.size(); index++) {
- ReadBufferOperation *readOperation =
- (ReadBufferOperation *)this->m_cachedReadOperations[index];
+ for (index = 0; index < m_read_operations.size(); index++) {
+ ReadBufferOperation *readOperation = m_read_operations[index];
BLI_rcti_init(&area, 0, 0, 0, 0);
MemoryProxy *memoryProxy = memoryProxies[index];
determineDependingAreaOfInterest(&rect, readOperation, &area);
@@ -585,10 +581,7 @@ void ExecutionGroup::determineDependingAreaOfInterest(rcti *input,
void ExecutionGroup::determineDependingMemoryProxies(std::vector<MemoryProxy *> *memoryProxies)
{
- unsigned int index;
- for (index = 0; index < this->m_cachedReadOperations.size(); index++) {
- ReadBufferOperation *readOperation =
- (ReadBufferOperation *)this->m_cachedReadOperations[index];
+ for (ReadBufferOperation *readOperation : m_read_operations) {
memoryProxies->push_back(readOperation->getMemoryProxy());
}
}
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.h b/source/blender/compositor/intern/COM_ExecutionGroup.h
index 415505616bd..9a749e1a9ed 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.h
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.h
@@ -63,16 +63,13 @@ enum class eChunkExecutionState {
* \ingroup Execution
*/
class ExecutionGroup {
- public:
- typedef std::vector<NodeOperation *> Operations;
-
private:
// fields
/**
* \brief list of operations in this ExecutionGroup
*/
- Operations m_operations;
+ blender::Vector<NodeOperation *> m_operations;
/**
* \brief is this ExecutionGroup an input ExecutionGroup
@@ -134,9 +131,9 @@ class ExecutionGroup {
unsigned int m_cachedMaxReadBufferOffset;
/**
- * \brief a cached vector of all read operations in the execution group.
+ * \brief All read operations of this execution group.
*/
- Operations m_cachedReadOperations;
+ blender::Vector<ReadBufferOperation *> m_read_operations;
/**
* \brief reference to the original bNodeTree,
More information about the Bf-blender-cvs
mailing list