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.
This commit is contained in:
@@ -41,6 +41,7 @@ set(INC
|
|||||||
../render/intern/include
|
../render/intern/include
|
||||||
../../../extern/clew/include
|
../../../extern/clew/include
|
||||||
../../../intern/guardedalloc
|
../../../intern/guardedalloc
|
||||||
|
../../../intern/atomic
|
||||||
)
|
)
|
||||||
|
|
||||||
set(INC_SYS
|
set(INC_SYS
|
||||||
|
@@ -50,6 +50,7 @@ incs = [
|
|||||||
'../render/intern/include',
|
'../render/intern/include',
|
||||||
'../windowmanager',
|
'../windowmanager',
|
||||||
'../../../intern/guardedalloc',
|
'../../../intern/guardedalloc',
|
||||||
|
'../../../intern/atomic',
|
||||||
|
|
||||||
# data files
|
# data files
|
||||||
env['DATA_HEADERS'],
|
env['DATA_HEADERS'],
|
||||||
|
@@ -44,6 +44,8 @@
|
|||||||
#include "WM_api.h"
|
#include "WM_api.h"
|
||||||
#include "WM_types.h"
|
#include "WM_types.h"
|
||||||
|
|
||||||
|
#include "atomic_ops.h"
|
||||||
|
|
||||||
ExecutionGroup::ExecutionGroup()
|
ExecutionGroup::ExecutionGroup()
|
||||||
{
|
{
|
||||||
this->m_isOutput = false;
|
this->m_isOutput = false;
|
||||||
@@ -382,7 +384,7 @@ void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memo
|
|||||||
if (this->m_chunkExecutionStates[chunkNumber] == COM_ES_SCHEDULED)
|
if (this->m_chunkExecutionStates[chunkNumber] == COM_ES_SCHEDULED)
|
||||||
this->m_chunkExecutionStates[chunkNumber] = COM_ES_EXECUTED;
|
this->m_chunkExecutionStates[chunkNumber] = COM_ES_EXECUTED;
|
||||||
|
|
||||||
this->m_chunksFinished++;
|
atomic_add_u(&this->m_chunksFinished, 0);
|
||||||
if (memoryBuffers) {
|
if (memoryBuffers) {
|
||||||
for (unsigned int index = 0; index < this->m_cachedMaxReadBufferOffset; index++) {
|
for (unsigned int index = 0; index < this->m_cachedMaxReadBufferOffset; index++) {
|
||||||
MemoryBuffer *buffer = memoryBuffers[index];
|
MemoryBuffer *buffer = memoryBuffers[index];
|
||||||
|
Reference in New Issue
Block a user