OgreShaderProgramManager.h
Go to the documentation of this file.
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef _ShaderProgramManager_
#define _ShaderProgramManager_
#include "OgreShaderPrerequisites.h"
#include "OgreShaderProgram.h"
#include "OgreShaderProgramWriter.h"
namespace Ogre {
namespace RTShader {
class _OgreRTSSExport ProgramManager : public Singleton<ProgramManager>, public RTShaderSystemAlloc
{
// Interface.
public:
ProgramManager();
~ProgramManager();
static ProgramManager& getSingleton();
static ProgramManager* getSingletonPtr();
void acquirePrograms(Pass* pass, TargetRenderState* renderState);
void releasePrograms(Pass* pass, TargetRenderState* renderState);
void flushGpuProgramsCache();
protected:
//-----------------------------------------------------------------------------
typedef map<String, GpuProgramPtr>::type GpuProgramsMap;
typedef GpuProgramsMap::iterator GpuProgramsMapIterator;
typedef GpuProgramsMap::const_iterator GpuProgramsMapConstIterator;
//-----------------------------------------------------------------------------
typedef set<Program*>::type ProgramList;
typedef ProgramList::iterator ProgramListIterator;
typedef map<String, ProgramWriter*>::type ProgramWriterMap;
typedef ProgramWriterMap::iterator ProgramWriterIterator;
typedef vector<ProgramWriterFactory*>::type ProgramWriterFactoryList;
//-----------------------------------------------------------------------------
typedef map<String, ProgramProcessor*>::type ProgramProcessorMap;
typedef ProgramProcessorMap::iterator ProgramProcessorIterator;
typedef ProgramProcessorMap::const_iterator ProgramProcessorConstIterator;
typedef vector<ProgramProcessor*>::type ProgramProcessorList;
protected:
void createDefaultProgramProcessors();
void destroyDefaultProgramProcessors();
void createDefaultProgramWriterFactories();
void destroyDefaultProgramWriterFactories();
void destroyProgramWriters();
Program* createCpuProgram(GpuProgramType type);
void destroyCpuProgram(Program* shaderProgram);
bool createGpuPrograms(ProgramSet* programSet);
String generateGUID(const String& programString);
GpuProgramPtr createGpuProgram(Program* shaderProgram,
ProgramWriter* programWriter,
const String& language,
const String& profiles,
const StringVector& profilesList,
const String& cachePath);
void addProgramProcessor(ProgramProcessor* processor);
void removeProgramProcessor(ProgramProcessor* processor);
void destroyGpuProgram(GpuProgramPtr& gpuProgram);
void flushGpuProgramsCache(GpuProgramsMap& gpuProgramsMap);
size_t getVertexShaderCount() const { return mVertexShaderMap.size(); }
size_t getFragmentShaderCount() const { return mFragmentShaderMap.size(); }
void synchronizePixelnToBeVertexOut(ProgramSet* programSet);
void bindUniformParameters(Program* pCpuProgram, const GpuProgramParametersSharedPtr& passParams);
protected:
protected:
// CPU programs list.
ProgramList mCpuProgramsList;
// Map between target language and shader program writer.
ProgramWriterMap mProgramWritersMap;
// Map between target language and shader program processor.
ProgramProcessorMap mProgramProcessorsMap;
// Holds standard shader writer factories
ProgramWriterFactoryList mProgramWriterFactories;
// The generated vertex shaders.
GpuProgramsMap mVertexShaderMap;
// The generated fragment shaders.
GpuProgramsMap mFragmentShaderMap;
// The default program processors.
ProgramProcessorList mDefaultProgramProcessors;
private:
friend class ProgramSet;
friend class TargetRenderState;
friend class ShaderGenerator;
};
}
}
#endif
OgreShaderProgramWriter.h
Ogre::Pass
Class defining a single pass of a Technique (of a Material), i.e.
Definition: OgrePass.h:80
Ogre::RTShader::ProgramManager::mCpuProgramsList
ProgramList mCpuProgramsList
Definition: OgreShaderProgramManager.h:222
Ogre::RTShader::ProgramManager::mProgramWriterFactories
ProgramWriterFactoryList mProgramWriterFactories
Definition: OgreShaderProgramManager.h:228
Ogre::RTShader::TargetRenderState
This is the target render state.
Definition: OgreShaderRenderState.h:138
Ogre::RTShader::ProgramManager::mDefaultProgramProcessors
ProgramProcessorList mDefaultProgramProcessors
Definition: OgreShaderProgramManager.h:234
Ogre::RTShader::ProgramManager::getVertexShaderCount
size_t getVertexShaderCount() const
Return the number of created vertex shaders.
Definition: OgreShaderProgramManager.h:205
Ogre::RTShader::ProgramManager::ProgramListIterator
ProgramList::iterator ProgramListIterator
Definition: OgreShaderProgramManager.h:117
Ogre::StringVector
vector< String >::type StringVector
Definition: OgreStringVector.h:45
Ogre::RTShader::ShaderGenerator
Shader generator system main interface.
Definition: OgreShaderGenerator.h:53
Ogre::RTShader::ProgramManager::GpuProgramsMap
map< String, GpuProgramPtr >::type GpuProgramsMap
Definition: OgreShaderProgramManager.h:111
OgreShaderPrerequisites.h
Ogre::RTShader::ProgramWriter
Base class interface for shader program writers.
Definition: OgreShaderProgramWriter.h:52
Ogre::RTShader::ProgramManager::ProgramWriterMap
map< String, ProgramWriter * >::type ProgramWriterMap
Definition: OgreShaderProgramManager.h:118
Ogre::RTShader::ProgramSet
Container class for shader based programs.
Definition: OgreShaderProgramSet.h:46
Ogre::RTShader::ProgramManager::ProgramProcessorIterator
ProgramProcessorMap::iterator ProgramProcessorIterator
Definition: OgreShaderProgramManager.h:124
Ogre::RTShader::ProgramManager::ProgramProcessorConstIterator
ProgramProcessorMap::const_iterator ProgramProcessorConstIterator
Definition: OgreShaderProgramManager.h:125
Ogre::RTShader::ProgramManager::ProgramWriterIterator
ProgramWriterMap::iterator ProgramWriterIterator
Definition: OgreShaderProgramManager.h:119
Ogre::RTShader::Program
A class that represents a shader based program.
Definition: OgreShaderProgram.h:50
Ogre::RTShader::ProgramManager
A singleton manager class that manages shader based programs.
Definition: OgreShaderProgramManager.h:46
Ogre::RTShader::ProgramManager::GpuProgramsMapConstIterator
GpuProgramsMap::const_iterator GpuProgramsMapConstIterator
Definition: OgreShaderProgramManager.h:113
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::set
Definition: OgrePrerequisites.h:519
Ogre::GpuProgramType
GpuProgramType
Enumerates the types of programs which can run on the GPU.
Definition: OgreGpuProgram.h:50
_OgreRTSSExport
#define _OgreRTSSExport
Definition: OgreShaderPrerequisites.h:108
Ogre::RTShader::ProgramProcessor
A class that provides extra processing services on CPU based programs.
Definition: OgreShaderProgramProcessor.h:49
Ogre::RTShader::ProgramManager::ProgramWriterFactoryList
vector< ProgramWriterFactory * >::type ProgramWriterFactoryList
Definition: OgreShaderProgramManager.h:120
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::RTShader::ProgramManager::getFragmentShaderCount
size_t getFragmentShaderCount() const
Return the number of created fragment shaders.
Definition: OgreShaderProgramManager.h:208
Ogre::RTShader::ProgramManager::ProgramProcessorMap
map< String, ProgramProcessor * >::type ProgramProcessorMap
Definition: OgreShaderProgramManager.h:123
Ogre::RTShader::ProgramManager::mFragmentShaderMap
GpuProgramsMap mFragmentShaderMap
Definition: OgreShaderProgramManager.h:232
Ogre::SharedPtr< GpuProgram >
Ogre::RTShader::ProgramManager::mProgramProcessorsMap
ProgramProcessorMap mProgramProcessorsMap
Definition: OgreShaderProgramManager.h:226
Ogre::vector
Definition: OgrePrerequisites.h:491
Ogre::Singleton
Template class for creating single-instance global classes.
Definition: OgreSingleton.h:64
Ogre::map
Definition: OgrePrerequisites.h:533
Ogre::RTShader::ProgramManager::mProgramWritersMap
ProgramWriterMap mProgramWritersMap
Definition: OgreShaderProgramManager.h:224
Ogre::RTShader::ProgramManager::ProgramList
set< Program * >::type ProgramList
Definition: OgreShaderProgramManager.h:116
Ogre::RTShader::ProgramManager::mVertexShaderMap
GpuProgramsMap mVertexShaderMap
Definition: OgreShaderProgramManager.h:230
Ogre::RTShader::ProgramManager::GpuProgramsMapIterator
GpuProgramsMap::iterator GpuProgramsMapIterator
Definition: OgreShaderProgramManager.h:112
Ogre::AllocatedObject
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Definition: OgreMemoryAllocatedObject.h:58
Ogre::RTShader::ProgramManager::ProgramProcessorList
vector< ProgramProcessor * >::type ProgramProcessorList
Definition: OgreShaderProgramManager.h:126
OgreShaderProgram.h

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.