OgreGpuProgramManager.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 __GpuProgramManager_H_
#define __GpuProgramManager_H_
// Precompiler options
#include "OgrePrerequisites.h"
#include "OgreResourceManager.h"
#include "OgreException.h"
#include "OgreGpuProgram.h"
#include "OgreSingleton.h"
#include "OgreHeaderPrefix.h"
namespace Ogre {
class _OgreExport GpuProgramManager : public ResourceManager, public Singleton<GpuProgramManager>
{
public:
typedef set<String>::type SyntaxCodes;
typedef map<String, GpuSharedParametersPtr>::type SharedParametersMap;
typedef MemoryDataStreamPtr Microcode;
typedef map<String, Microcode>::type MicrocodeMap;
protected:
SharedParametersMap mSharedParametersMap;
MicrocodeMap mMicrocodeCache;
bool mSaveMicrocodesToCache;
bool mCacheDirty; // When this is true the cache is 'dirty' and should be resaved to disk.
static String addRenderSystemToName( const String & name );
virtual Resource* createImpl(const String& name, ResourceHandle handle,
const String& group, bool isManual, ManualResourceLoader* loader,
GpuProgramType gptype, const String& syntaxCode) = 0;
public:
GpuProgramManager();
virtual ~GpuProgramManager();
GpuProgramPtr getByName(const String& name, bool preferHighLevelPrograms = true);
virtual GpuProgramPtr load(const String& name, const String& groupName,
const String& filename, GpuProgramType gptype,
const String& syntaxCode);
virtual GpuProgramPtr loadFromString(const String& name, const String& groupName,
const String& code, GpuProgramType gptype,
const String& syntaxCode);
virtual const SyntaxCodes& getSupportedSyntax(void) const;
virtual bool isSyntaxSupported(const String& syntaxCode) const;
virtual GpuProgramParametersSharedPtr createParameters(void);
virtual GpuProgramPtr createProgram(const String& name,
const String& groupName, const String& filename,
GpuProgramType gptype, const String& syntaxCode);
virtual GpuProgramPtr createProgramFromString(const String& name,
const String& groupName, const String& code,
GpuProgramType gptype, const String& syntaxCode);
virtual ResourcePtr create(const String& name, const String& group,
GpuProgramType gptype, const String& syntaxCode, bool isManual = false,
ManualResourceLoader* loader = 0);
ResourcePtr getResourceByName(const String& name, bool preferHighLevelPrograms = true);
virtual GpuSharedParametersPtr createSharedParameters(const String& name);
virtual GpuSharedParametersPtr getSharedParameters(const String& name) const;
virtual const SharedParametersMap& getAvailableSharedParameters() const;
bool getSaveMicrocodesToCache();
void setSaveMicrocodesToCache( const bool val );
bool isCacheDirty(void) const;
bool canGetCompiledShaderBuffer();
virtual bool isMicrocodeAvailableInCache( const String & name ) const;
virtual const Microcode & getMicrocodeFromCache( const String & name ) const;
virtual Microcode createMicrocode( const uint32 size ) const;
virtual void addMicrocodeToCache( const String & name, const Microcode & microcode );
virtual void removeMicrocodeFromCache( const String & name );
virtual void saveMicrocodeCache( DataStreamPtr stream ) const;
virtual void loadMicrocodeCache( DataStreamPtr stream );
static GpuProgramManager& getSingleton(void);
static GpuProgramManager* getSingletonPtr(void);
};
}
#include "OgreHeaderSuffix.h"
#endif
Ogre::GpuProgramManager::mMicrocodeCache
MicrocodeMap mMicrocodeCache
Definition: OgreGpuProgramManager.h:60
Ogre::GpuProgramManager
Definition: OgreGpuProgramManager.h:47
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::GpuProgramManager::MicrocodeMap
map< String, Microcode >::type MicrocodeMap
Definition: OgreGpuProgramManager.h:55
Ogre::GpuProgramManager::SharedParametersMap
map< String, GpuSharedParametersPtr >::type SharedParametersMap
Definition: OgreGpuProgramManager.h:52
Ogre::GpuProgramManager::mSaveMicrocodesToCache
bool mSaveMicrocodesToCache
Definition: OgreGpuProgramManager.h:61
Ogre::Resource
Abstract class representing a loadable resource (e.g.
Definition: OgreResource.h:79
Ogre::ManualResourceLoader
Interface describing a manual resource loader.
Definition: OgreResource.h:514
Ogre::ResourceHandle
unsigned long long int ResourceHandle
Definition: OgreResource.h:41
Ogre::GpuProgramManager::mCacheDirty
bool mCacheDirty
Definition: OgreGpuProgramManager.h:62
Ogre::GpuProgramManager::mSharedParametersMap
SharedParametersMap mSharedParametersMap
Definition: OgreGpuProgramManager.h:59
OgreSingleton.h
OgrePrerequisites.h
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
OgreResourceManager.h
Ogre::set
Definition: OgrePrerequisites.h:519
Ogre::GpuProgramType
GpuProgramType
Enumerates the types of programs which can run on the GPU.
Definition: OgreGpuProgram.h:50
Ogre::GpuProgramManager::SyntaxCodes
set< String >::type SyntaxCodes
Definition: OgreGpuProgramManager.h:51
OgreHeaderSuffix.h
Ogre::ResourceManager
Defines a generic resource handler.
Definition: OgreResourceManager.h:122
Ogre::uint32
unsigned int uint32
Definition: OgrePlatform.h:359
Ogre
Definition: OgreAndroidLogListener.h:34
OgreException.h
Ogre::SharedPtr
Reference-counted shared pointer, used for objects where implicit destruction is required.
Definition: OgrePrerequisites.h:310
Ogre::GpuProgramManager::Microcode
MemoryDataStreamPtr Microcode
Definition: OgreGpuProgramManager.h:54
OgreHeaderPrefix.h
Ogre::Singleton
Template class for creating single-instance global classes.
Definition: OgreSingleton.h:64
Ogre::map
Definition: OgrePrerequisites.h:533
OgreGpuProgram.h

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