Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <jeroen@blender.org>2021-03-19 10:59:43 +0300
committerJeroen Bakker <jeroen@blender.org>2021-03-19 19:11:47 +0300
commit18b87e2e0b9393b9a20733b2396277a48a0b0c5d (patch)
tree4389dbf22436b7387a04565e7c2f63c05c120d63 /source/blender/compositor/intern/COM_ExecutionGroup.cc
parenteb7a601e1b9c2aca90b5abccf118e83f94fd0e17 (diff)
Cleanup: Remove unneeded complexity
`determineDependingMemoryProxies` was mapping a value in a temp vector.
Diffstat (limited to 'source/blender/compositor/intern/COM_ExecutionGroup.cc')
-rw-r--r--source/blender/compositor/intern/COM_ExecutionGroup.cc59
1 files changed, 20 insertions, 39 deletions
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cc b/source/blender/compositor/intern/COM_ExecutionGroup.cc
index 37623228183..86065c18993 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.cc
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.cc
@@ -368,10 +368,8 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
MemoryBuffer **ExecutionGroup::getInputBuffersOpenCL(int chunkNumber)
{
rcti rect;
- std::vector<MemoryProxy *> memoryproxies;
determineChunkRect(&rect, chunkNumber);
- this->determineDependingMemoryProxies(&memoryproxies);
MemoryBuffer **memoryBuffers = (MemoryBuffer **)MEM_callocN(
sizeof(MemoryBuffer *) * this->m_max_read_buffer_offset, __func__);
rcti output;
@@ -516,54 +514,44 @@ bool ExecutionGroup::scheduleChunk(unsigned int chunkNumber)
return false;
}
-bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem *graph, int xChunk, int yChunk)
+bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem *graph,
+ const int chunk_x,
+ const int chunk_y)
{
- if (xChunk < 0 || xChunk >= (int)this->m_x_chunks_len) {
+ if (chunk_x < 0 || chunk_x >= (int)this->m_x_chunks_len) {
return true;
}
- if (yChunk < 0 || yChunk >= (int)this->m_y_chunks_len) {
+ if (chunk_y < 0 || chunk_y >= (int)this->m_y_chunks_len) {
return true;
}
- int chunkNumber = yChunk * this->m_x_chunks_len + xChunk;
- // chunk is already executed
- if (this->m_chunk_execution_states[chunkNumber] == eChunkExecutionState::EXECUTED) {
+
+ // Check if chunk is already executed or scheduled and not yet executed.
+ const int chunk_index = chunk_y * this->m_x_chunks_len + chunk_x;
+ if (this->m_chunk_execution_states[chunk_index] == eChunkExecutionState::EXECUTED) {
return true;
}
-
- // chunk is scheduled, but not executed
- if (this->m_chunk_execution_states[chunkNumber] == eChunkExecutionState::SCHEDULED) {
+ if (this->m_chunk_execution_states[chunk_index] == eChunkExecutionState::SCHEDULED) {
return false;
}
- // chunk is nor executed nor scheduled.
- std::vector<MemoryProxy *> memoryProxies;
- this->determineDependingMemoryProxies(&memoryProxies);
-
rcti rect;
- determineChunkRect(&rect, xChunk, yChunk);
- unsigned int index;
- bool canBeExecuted = true;
+ determineChunkRect(&rect, chunk_x, chunk_y);
+ bool can_be_executed = true;
rcti area;
- for (index = 0; index < m_read_operations.size(); index++) {
- ReadBufferOperation *readOperation = m_read_operations[index];
+ for (ReadBufferOperation *read_operation : m_read_operations) {
BLI_rcti_init(&area, 0, 0, 0, 0);
- MemoryProxy *memoryProxy = memoryProxies[index];
- determineDependingAreaOfInterest(&rect, readOperation, &area);
- ExecutionGroup *group = memoryProxy->getExecutor();
+ MemoryProxy *memory_proxy = read_operation->getMemoryProxy();
+ determineDependingAreaOfInterest(&rect, read_operation, &area);
+ ExecutionGroup *group = memory_proxy->getExecutor();
- if (group != nullptr) {
- if (!group->scheduleAreaWhenPossible(graph, &area)) {
- canBeExecuted = false;
- }
- }
- else {
- throw "ERROR";
+ if (!group->scheduleAreaWhenPossible(graph, &area)) {
+ can_be_executed = false;
}
}
- if (canBeExecuted) {
- scheduleChunk(chunkNumber);
+ if (can_be_executed) {
+ scheduleChunk(chunk_index);
}
return false;
@@ -576,13 +564,6 @@ void ExecutionGroup::determineDependingAreaOfInterest(rcti *input,
this->getOutputOperation()->determineDependingAreaOfInterest(input, readOperation, output);
}
-void ExecutionGroup::determineDependingMemoryProxies(std::vector<MemoryProxy *> *memoryProxies)
-{
- for (ReadBufferOperation *readOperation : m_read_operations) {
- memoryProxies->push_back(readOperation->getMemoryProxy());
- }
-}
-
bool ExecutionGroup::isOpenCL()
{
return this->m_openCL;