Fix T45529: Texture Compositor node composition artifact (random pixels)

The issue was caused by the non-threaded texture API used by the node.
While the node itself is single threaded there might be texture nodes
in different execution groups running in parallel.
This commit is contained in:
Sergey Sharybin 2015-07-28 17:54:21 +02:00
parent 20c5c5e14b
commit 1e6e3dcbd7
Notes: blender-bot 2023-02-14 08:51:04 +01:00
Referenced by issue #45529, Texture Compositor node composition artifact (random pixels)
1 changed files with 8 additions and 0 deletions

View File

@ -23,8 +23,11 @@
#include "COM_TextureOperation.h"
#include "BLI_listbase.h"
#include "BLI_threads.h"
#include "BKE_image.h"
static ThreadMutex mutex_lock = BLI_MUTEX_INITIALIZER;
TextureBaseOperation::TextureBaseOperation() : SingleThreadedOperation()
{
this->addInputSocket(COM_DT_VECTOR); //offset
@ -100,7 +103,12 @@ void TextureBaseOperation::executePixelSampled(float output[4], float x, float y
vec[1] = textureSize[1] * (v + textureOffset[1]);
vec[2] = textureSize[2] * textureOffset[2];
/* TODO(sergey): Need to pass thread ID to the multitex code,
* then we can avoid having mutex here.
*/
BLI_mutex_lock(&mutex_lock);
retval = multitex_ext(this->m_texture, vec, NULL, NULL, 0, &texres, m_pool, m_sceneColorManage, false);
BLI_mutex_unlock(&mutex_lock);
if (texres.talpha)
output[3] = texres.ta;