[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55021] trunk/blender/source/blender/ compositor/operations: Fix #34475: Weird noise bug with Texture nodes
Sergey Sharybin
sergey.vfx at gmail.com
Mon Mar 4 14:14:21 CET 2013
Revision: 55021
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55021
Author: nazgul
Date: 2013-03-04 13:14:21 +0000 (Mon, 04 Mar 2013)
Log Message:
-----------
Fix #34475: Weird noise bug with Texture nodes
Made Texture compositor input node single-threaded since
texture trees are not thread-safe.
Also fixed texture being flipped horizontally and vertically.
Why nobody noticed this for 3 releases already??
Modified Paths:
--------------
trunk/blender/source/blender/compositor/operations/COM_TextureOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_TextureOperation.h
Modified: trunk/blender/source/blender/compositor/operations/COM_TextureOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_TextureOperation.cpp 2013-03-04 13:12:56 UTC (rev 55020)
+++ trunk/blender/source/blender/compositor/operations/COM_TextureOperation.cpp 2013-03-04 13:14:21 UTC (rev 55021)
@@ -25,7 +25,7 @@
#include "BLI_listbase.h"
#include "BKE_image.h"
-TextureBaseOperation::TextureBaseOperation() : NodeOperation()
+TextureBaseOperation::TextureBaseOperation() : SingleThreadedNodeOperation()
{
this->addInputSocket(COM_DT_VECTOR); //offset
this->addInputSocket(COM_DT_VECTOR); //size
@@ -48,6 +48,7 @@
this->m_inputOffset = getInputSocketReader(0);
this->m_inputSize = getInputSocketReader(1);
this->m_pool = BKE_image_pool_new();
+ SingleThreadedNodeOperation::initExecution();
}
void TextureBaseOperation::deinitExecution()
{
@@ -55,6 +56,7 @@
this->m_inputOffset = NULL;
BKE_image_pool_free(this->m_pool);
this->m_pool = NULL;
+ SingleThreadedNodeOperation::deinitExecution();
}
void TextureBaseOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
@@ -89,8 +91,8 @@
int retval;
const float cx = this->getWidth() / 2;
const float cy = this->getHeight() / 2;
- const float u = (cx - x) / this->getWidth() * 2;
- const float v = (cy - y) / this->getHeight() * 2;
+ const float u = (x - cx) / this->getWidth() * 2;
+ const float v = (y - cy) / this->getHeight() * 2;
this->m_inputSize->read(textureSize, x, y, sampler);
this->m_inputOffset->read(textureOffset, x, y, sampler);
@@ -115,3 +117,26 @@
output[0] = output[1] = output[2] = output[3];
}
}
+
+MemoryBuffer *TextureBaseOperation::createMemoryBuffer(rcti *rect2)
+{
+ int height = getHeight();
+ int width = getWidth();
+
+ rcti rect;
+ rect.xmin = 0;
+ rect.ymin = 0;
+ rect.xmax = width;
+ rect.ymax = height;
+ MemoryBuffer *result = new MemoryBuffer(NULL, &rect);
+
+ float *data = result->getBuffer();
+
+ for (int y = 0; y < height; y++) {
+ for (int x = 0; x < width; x++, data += 4) {
+ this->executePixel(data, x, y, COM_PS_NEAREST);
+ }
+ }
+
+ return result;
+}
Modified: trunk/blender/source/blender/compositor/operations/COM_TextureOperation.h
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_TextureOperation.h 2013-03-04 13:12:56 UTC (rev 55020)
+++ trunk/blender/source/blender/compositor/operations/COM_TextureOperation.h 2013-03-04 13:14:21 UTC (rev 55021)
@@ -24,7 +24,7 @@
#ifndef _COM_TextureOperation_h
#define _COM_TextureOperation_h
-#include "COM_NodeOperation.h"
+#include "COM_SingleThreadedNodeOperation.h"
#include "DNA_texture_types.h"
#include "BLI_listbase.h"
extern "C" {
@@ -39,7 +39,7 @@
*
* @todo: rename to operation.
*/
-class TextureBaseOperation : public NodeOperation {
+class TextureBaseOperation : public SingleThreadedNodeOperation {
private:
Tex *m_texture;
const RenderData *m_rd;
@@ -59,6 +59,7 @@
*/
TextureBaseOperation();
+ MemoryBuffer *createMemoryBuffer(rcti *rect2);
public:
void executePixel(float output[4], float x, float y, PixelSampler sampler);
More information about the Bf-blender-cvs
mailing list