simple_task.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2008 by Kutumov Alexey                                  *
00003  *   ru.pixel@gmail.com                                                    *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00033 #ifndef __simple_task__header__
00034 #define __simple_task__header__
00035 
00036 
00037 #include "gpucalc/task.h"
00038 
00039 namespace gpucalc
00040 {
00041 
00042  const char _SimpleTaskClassName [] = "SimpleTask";
00043 
00044 
00050  class _GpuCalcExport SimpleTask: public Task
00051  {
00052 
00053 
00054   OBJ_DISABLE_COPY(SimpleTask)
00055   
00056   
00057 
00058   friend class SimpleTaskManager;
00059 
00060   public:
00061 
00062    ~SimpleTask();
00063 
00064 
00065    void compile();
00066 
00067 
00068    void addDataToActiveKernel(const Data & data);
00069 
00070 
00071    void addCompilerParamsToActiveKernel(const std::string & Parameters);
00072 
00073 
00074    void removeDataFromActiveKernel(const Data & /*data*/)
00075    {
00076     // does nothing
00077    }
00078 
00079 
00080    void addResultToActiveKernel(Data & result);
00081 
00082 
00083    void removeResultFromActiveKernel(const Data & result);
00084 
00085 
00086    Data & getResultData() const
00087    {
00088     return * mResultData;
00089    }
00090 
00091 
00092    void addActiveKernel(Kernel * /*ActiveKernel*/)
00093    {
00094     // does nothing
00095    }
00096 
00097 
00098    Kernel * getActiveKernel() const;
00099 
00100 
00101    void removeKernel(Kernel * kernel);
00102 
00103 
00104    void compute();
00105 
00106 
00107   protected:
00108    Kernel * mActiveKernel;
00109 
00110 
00111    FrameBuffer * mActiveFrameBuffer;
00112 
00113 
00114    Data * mResultData;
00115 
00116 
00117    Texture * mRenderTarget;
00118 
00119 
00120    typedef std::list<const Data *> DataVector;
00121    DataVector mDataVector;
00122 
00123 
00124    GraphicCore * mDefaultGraphicCore;
00125 
00126 
00127    ShaderSystem * mDefaultShaderSystem;
00128 
00129 
00130    std::string mCompilerParams;
00131 
00132 
00133    void computeOneKernel(Texture * RenderTarget);
00134 
00135 
00136    SimpleTask(const std::string & TaskName);
00137 
00138  };
00139 }
00140 
00141 #endif

Generated on Thu Mar 5 22:36:42 2009 for gpucalc by  doxygen 1.5.6