[Bf-blender-cvs] [a6803bf] master: Compositor: Use atomics to update finished tiles progress
Sergey Sharybin
noreply at git.blender.org
Thu Jun 11 14:53:27 CEST 2015
Commit: a6803bf56429829e6da5bd9702508190b27df711
Author: Sergey Sharybin
Date: Thu Jun 11 10:23:52 2015 +0200
Branches: master
https://developer.blender.org/rBa6803bf56429829e6da5bd9702508190b27df711
Compositor: Use atomics to update finished tiles progress
Integer is not safe for incremental by multiple threads and if one is unlucky
enough that could cause progress re[reports to go totally nuts.
===================================================================
M source/blender/compositor/CMakeLists.txt
M source/blender/compositor/SConscript
M source/blender/compositor/intern/COM_ExecutionGroup.cpp
===================================================================
diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt
index c23aa4e..0d35d06 100644
--- a/source/blender/compositor/CMakeLists.txt
+++ b/source/blender/compositor/CMakeLists.txt
@@ -41,6 +41,7 @@ set(INC
../render/intern/include
../../../extern/clew/include
../../../intern/guardedalloc
+ ../../../intern/atomic
)
set(INC_SYS
diff --git a/source/blender/compositor/SConscript b/source/blender/compositor/SConscript
index eab4087..370600a 100644
--- a/source/blender/compositor/SConscript
+++ b/source/blender/compositor/SConscript
@@ -50,6 +50,7 @@ incs = [
'../render/intern/include',
'../windowmanager',
'../../../intern/guardedalloc',
+ '../../../intern/atomic',
# data files
env['DATA_HEADERS'],
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cpp b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
index 39ffa42..a7f45ff 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
@@ -44,6 +44,8 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "atomic_ops.h"
+
ExecutionGroup::ExecutionGroup()
{
this->m_isOutput = false;
@@ -382,7 +384,7 @@ void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memo
if (this->m_chunkExecutionStates[chunkNumber] == COM_ES_SCHEDULED)
this->m_chunkExecutionStates[chunkNumber] = COM_ES_EXECUTED;
- this->m_chunksFinished++;
+ atomic_add_u(&this->m_chunksFinished, 0);
if (memoryBuffers) {
for (unsigned int index = 0; index < this->m_cachedMaxReadBufferOffset; index++) {
MemoryBuffer *buffer = memoryBuffers[index];
More information about the Bf-blender-cvs
mailing list