Revision: 42626
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42626
Author:   jbakker
Date:     2011-12-14 08:51:50 +0000 (Wed, 14 Dec 2011)
Log Message:
-----------
Tile branch

some changes to clean up memory in order to continue tracking the 
threading/memory issue

Modified Paths:
--------------
    branches/tile/source/blender/compositor/COM_defines.h
    branches/tile/source/blender/compositor/intern/COM_InputSocket.cpp
    branches/tile/source/blender/compositor/intern/COM_InputSocket.h
    branches/tile/source/blender/compositor/intern/COM_Node.cpp
    branches/tile/source/blender/compositor/intern/COM_NodeBase.cpp
    branches/tile/source/blender/compositor/intern/COM_OutputSocket.cpp
    branches/tile/source/blender/compositor/intern/COM_OutputSocket.h
    branches/tile/source/blender/compositor/intern/COM_WorkPackage.cpp
    branches/tile/source/blender/compositor/intern/COM_WorkScheduler.cpp
    branches/tile/source/blender/compositor/intern/COM_compositor.cpp
    
branches/tile/source/blender/compositor/operations/COM_CompositorOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_CompositorOperation.h
    
branches/tile/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp

Modified: branches/tile/source/blender/compositor/COM_defines.h
===================================================================
--- branches/tile/source/blender/compositor/COM_defines.h       2011-12-14 
08:38:21 UTC (rev 42625)
+++ branches/tile/source/blender/compositor/COM_defines.h       2011-12-14 
08:51:50 UTC (rev 42626)
@@ -56,7 +56,8 @@
 
 // chunk size determination
 #define COM_PREVIEW_SIZE 140.0f
-#define COM_OPENCL_ENABLED TRUE
+#define COM_OPENCL_ENABLED true
+#define COM_PREVIEW_ENABLED true
 // workscheduler threading models
 /**
   * COM_TM_PTHREAD is a threading model based on pthread library. where the 
control (picking new work) is done by each thread

Modified: branches/tile/source/blender/compositor/intern/COM_InputSocket.cpp
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_InputSocket.cpp  
2011-12-14 08:38:21 UTC (rev 42625)
+++ branches/tile/source/blender/compositor/intern/COM_InputSocket.cpp  
2011-12-14 08:51:50 UTC (rev 42626)
@@ -40,10 +40,6 @@
        this->resizeMode = from->getResizeMode();
 }
 
-InputSocket::~InputSocket() {
-}
-
-
 int InputSocket::isInputSocket() const { return true; }
 const int InputSocket::isConnected() const { return this->connection != NULL; }
 

Modified: branches/tile/source/blender/compositor/intern/COM_InputSocket.h
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_InputSocket.h    
2011-12-14 08:38:21 UTC (rev 42625)
+++ branches/tile/source/blender/compositor/intern/COM_InputSocket.h    
2011-12-14 08:51:50 UTC (rev 42626)
@@ -90,7 +90,6 @@
        InputSocket(DataType datatype);
        InputSocket(DataType datatype, InputSocketResizeMode resizeMode);
        InputSocket(InputSocket* from);
-       ~InputSocket();
 
     void setConnection(SocketConnection* connection);
     SocketConnection* getConnection();

Modified: branches/tile/source/blender/compositor/intern/COM_Node.cpp
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_Node.cpp 2011-12-14 
08:38:21 UTC (rev 42625)
+++ branches/tile/source/blender/compositor/intern/COM_Node.cpp 2011-12-14 
08:51:50 UTC (rev 42626)
@@ -78,12 +78,14 @@
 }
 
 void Node::addPreviewOperation(ExecutionSystem *system, OutputSocket 
*outputSocket, int priority) {
+#if COM_PREVIEW_ENABLED
        PreviewOperation *operation = new PreviewOperation();
        system->addOperation(operation);
        operation->setbNode(this->getbNode());
        operation->setbNodeTree(system->getContext().getbNodeTree());
        operation->setPriority(priority);
        this->addLink(system, outputSocket, operation->getInputSocket(0));
+#endif
 }
 
 void Node::addPreviewOperation(ExecutionSystem *system, InputSocket 
*inputSocket, int priority) {

Modified: branches/tile/source/blender/compositor/intern/COM_NodeBase.cpp
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_NodeBase.cpp     
2011-12-14 08:38:21 UTC (rev 42625)
+++ branches/tile/source/blender/compositor/intern/COM_NodeBase.cpp     
2011-12-14 08:51:50 UTC (rev 42626)
@@ -34,17 +34,14 @@
 
 
 NodeBase::~NodeBase(){
-       unsigned int index;
-       for (index = 0 ; index < this->outputsockets.size(); index ++) {
-               OutputSocket * socket = this->outputsockets[index];
-               delete socket;
+       while (!this->outputsockets.empty()) {
+               delete (this->outputsockets.back());
+               this->outputsockets.pop_back();
        }
-    this->outputsockets.clear();
-       for (index = 0 ; index < this->inputsockets.size(); index ++) {
-               InputSocket * socket = this->inputsockets[index];
-               delete socket;
+       while (!this->inputsockets.empty()) {
+               delete (this->inputsockets.back());
+               this->inputsockets.pop_back();
        }
-    this->inputsockets.clear();
 }
 
 void NodeBase::addInputSocket(DataType datatype) {

Modified: branches/tile/source/blender/compositor/intern/COM_OutputSocket.cpp
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_OutputSocket.cpp 
2011-12-14 08:38:21 UTC (rev 42625)
+++ branches/tile/source/blender/compositor/intern/COM_OutputSocket.cpp 
2011-12-14 08:51:50 UTC (rev 42626)
@@ -37,9 +37,6 @@
        this->inputSocketDataTypeDeterminatorIndex = 
from->getInputSocketDataTypeDeterminatorIndex();   
 }
 
-OutputSocket::~OutputSocket() {
-}
-
 int OutputSocket::isOutputSocket() const { return true; }
 const int OutputSocket::isConnected() const { return 
this->connections.size()!=0; }
 

Modified: branches/tile/source/blender/compositor/intern/COM_OutputSocket.h
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_OutputSocket.h   
2011-12-14 08:38:21 UTC (rev 42625)
+++ branches/tile/source/blender/compositor/intern/COM_OutputSocket.h   
2011-12-14 08:51:50 UTC (rev 42626)
@@ -57,7 +57,6 @@
        OutputSocket(DataType datatype);
        OutputSocket(DataType datatype, int 
inputSocketDataTypeDeterminatorIndex);
        OutputSocket(OutputSocket * from);
-    ~OutputSocket();
     void addConnection(SocketConnection *connection);
     SocketConnection* getConnection(unsigned int index) {return 
this->connections[index];}
     const int isConnected() const;

Modified: branches/tile/source/blender/compositor/intern/COM_WorkPackage.cpp
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_WorkPackage.cpp  
2011-12-14 08:38:21 UTC (rev 42625)
+++ branches/tile/source/blender/compositor/intern/COM_WorkPackage.cpp  
2011-12-14 08:51:50 UTC (rev 42626)
@@ -21,8 +21,10 @@
  */
 
 #include "COM_WorkPackage.h"
+#include <stdio.h>
 
 WorkPackage::WorkPackage(ExecutionGroup *group, unsigned int chunkNumber) {
+       printf("%d: %d\n", group, chunkNumber);
     this->executionGroup = group;
        this->chunkNumber = chunkNumber;
 }

Modified: branches/tile/source/blender/compositor/intern/COM_WorkScheduler.cpp
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_WorkScheduler.cpp        
2011-12-14 08:38:21 UTC (rev 42625)
+++ branches/tile/source/blender/compositor/intern/COM_WorkScheduler.cpp        
2011-12-14 08:51:50 UTC (rev 42626)
@@ -130,8 +130,8 @@
 
 
 void WorkScheduler::schedule(ExecutionGroup *group, int chunkNumber) {
-#if COM_CURRENT_THREADING_MODEL == COM_TM_PTHREAD
        WorkPackage* package = new WorkPackage(group, chunkNumber);
+#if COM_CURRENT_THREADING_MODEL == COM_TM_PTHREAD
        if (group->isOpenCL() && openclActive){
                BLI_mutex_lock(&gpumutex);
                gpuwork.push_back(package);
@@ -142,7 +142,6 @@
                BLI_mutex_unlock(&cpumutex);
        }
 #elif COM_CURRENT_THREADING_MODEL == COM_TM_NOTHREAD
-       WorkPackage* package = new WorkPackage(group, chunkNumber);
        CPUDevice device;
        device.execute(package);
        delete package;
@@ -278,15 +277,15 @@
        Device* device;
        while(cpudevices.size()>0) {
                device = cpudevices.back();
+               cpudevices.pop_back();
                device->deinitialize();
                delete device;
-               cpudevices.pop_back();
        }
        while(gpudevices.size()>0) {
                device = gpudevices.back();
+               gpudevices.pop_back();
                device->deinitialize();
                delete device;
-               gpudevices.pop_back();
        }
 #if COM_OPENCL_ENABLED
        if (program) {

Modified: branches/tile/source/blender/compositor/intern/COM_compositor.cpp
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_compositor.cpp   
2011-12-14 08:38:21 UTC (rev 42625)
+++ branches/tile/source/blender/compositor/intern/COM_compositor.cpp   
2011-12-14 08:51:50 UTC (rev 42626)
@@ -38,13 +38,13 @@
                WorkScheduler::initialize(); ///TODO: call 
workscheduler.deinitialize somewhere
        }
        BLI_mutex_lock(mutex);
-//     if (editingtree->test_break && 
editingtree->test_break(editingtree->tbh)) {
-//             // during editing multiple calls to this method can be 
triggered.
-//             // make sure one the last one will be doing the work.
-//             BLI_mutex_unlock(mutex);
-//             return;
+       if (editingtree->test_break && 
editingtree->test_break(editingtree->tbh)) {
+               // during editing multiple calls to this method can be 
triggered.
+               // make sure one the last one will be doing the work.
+               BLI_mutex_unlock(mutex);
+               return;
 
-//     }
+       }
 
        /* set progress bar to 0% and status to init compositing*/
        editingtree->progress(editingtree->prh, 0.0);

Modified: 
branches/tile/source/blender/compositor/operations/COM_CompositorOperation.cpp
===================================================================
--- 
branches/tile/source/blender/compositor/operations/COM_CompositorOperation.cpp  
    2011-12-14 08:38:21 UTC (rev 42625)
+++ 
branches/tile/source/blender/compositor/operations/COM_CompositorOperation.cpp  
    2011-12-14 08:51:50 UTC (rev 42626)
@@ -50,27 +50,23 @@
        // When initializing the tree during initial load the width and height 
can be zero.
        this->imageInput = getInputSocketReader(0);
        this->alphaInput = getInputSocketReader(1);
-       initImage();
-}
-
-void CompositorOperation::initImage() {
+       if (this->getWidth() * this->getHeight() != 0) {
+               this->outputBuffer=(float*) 
MEM_mapallocN(this->getWidth()*this->getHeight()*4*sizeof(float), 
"CompositorOperation");
+       }
        const Scene * scene = this->scene;
        Render* re= RE_GetRender(scene->id.name);
        RenderResult *rr= RE_AcquireResultWrite(re);
        if(rr) {
-
                if(rr->rectf  != NULL) {
                        MEM_freeN(rr->rectf);
                }
-               if (this->getWidth() * this->getHeight() != 0) {
-                       this->outputBuffer=(float*) 
MEM_mapallocN(this->getWidth()*this->getHeight()*4*sizeof(float), 
"CompositorOperation");
-               }
                rr->rectf= outputBuffer;
        }
        if (re) {
                RE_ReleaseResult(re);
                re = NULL;
        }
+       
 }
 
 void CompositorOperation::deinitExecution() {

Modified: 
branches/tile/source/blender/compositor/operations/COM_CompositorOperation.h
===================================================================
--- 
branches/tile/source/blender/compositor/operations/COM_CompositorOperation.h    
    2011-12-14 08:38:21 UTC (rev 42625)
+++ 
branches/tile/source/blender/compositor/operations/COM_CompositorOperation.h    
    2011-12-14 08:51:50 UTC (rev 42626)
@@ -42,8 +42,6 @@
        bool isOutputOperation(bool rendering) const {return true;}
     void initExecution();
     void deinitExecution();
-       const int getRenderPriority() const {return 7;};
-private:
-    void initImage();
+       const int getRenderPriority() const {return 7;}
 };
 #endif

Modified: 
branches/tile/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp

@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to