Commit: 1e6e3dcbd7cd4bc0148062e15229cd284cb30f7d
Author: Sergey Sharybin
Date:   Tue Jul 28 17:54:21 2015 +0200
Branches: master
https://developer.blender.org/rB1e6e3dcbd7cd4bc0148062e15229cd284cb30f7d

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.

===================================================================

M       source/blender/compositor/operations/COM_TextureOperation.cpp

===================================================================

diff --git a/source/blender/compositor/operations/COM_TextureOperation.cpp 
b/source/blender/compositor/operations/COM_TextureOperation.cpp
index 2ff6cc0..c75c404 100644
--- a/source/blender/compositor/operations/COM_TextureOperation.cpp
+++ b/source/blender/compositor/operations/COM_TextureOperation.cpp
@@ -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;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to