OgreHighLevelGpuProgram.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2013 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef __HighLevelGpuProgram_H__
29 #define __HighLevelGpuProgram_H__
30 
31 #include "OgrePrerequisites.h"
32 #include "OgreGpuProgram.h"
33 
34 namespace Ogre {
35 
64  {
65  protected:
71  mutable bool mConstantDefsBuilt;
72 
74  virtual void loadHighLevel(void);
76  virtual void unloadHighLevel(void);
80  virtual void loadHighLevelImpl(void);
83  virtual void createLowLevelImpl(void) = 0;
85  virtual void unloadHighLevelImpl(void) = 0;
94  virtual void buildConstantDefinitions() const = 0;
95 
97  void loadImpl();
99  void unloadImpl();
100  public:
103  const String& group, bool isManual = false, ManualResourceLoader* loader = 0);
105 
106 
116  GpuProgram* _getBindingDelegate(void) { return mAssemblerProgram.getPointer(); }
117 
123 
125  const GpuNamedConstants& getNamedConstants() const { return getConstantDefinitions(); }
126 
127  virtual size_t calculateSize(void) const;
128 
129 
130 
131 
132  };
136 }
137 #endif
Ogre::ResourceHandle
unsigned long long int ResourceHandle
Definition: OgreResource.h:41
Ogre::HighLevelGpuProgram::getConstantDefinitions
const GpuNamedConstants & getConstantDefinitions() const
Get the full list of GpuConstantDefinition instances.
Ogre::HighLevelGpuProgram::buildConstantDefinitions
virtual void buildConstantDefinitions() const =0
Build the constant definition map, must be overridden.
Ogre
Definition: OgreAndroidLogListener.h:35
Ogre::GpuNamedConstants
Struct collecting together the information for named constants.
Definition: OgreGpuProgramParams.h:356
Ogre::HighLevelGpuProgram::loadHighLevelImpl
virtual void loadHighLevelImpl(void)
Internal load implementation, loads just the high-level portion, enough to get parameters.
Ogre::HighLevelGpuProgram::createParameters
GpuProgramParametersSharedPtr createParameters(void)
Creates a new parameters object compatible with this program definition.
Ogre::HighLevelGpuProgram::createLowLevelImpl
virtual void createLowLevelImpl(void)=0
Internal method for creating an appropriate low-level program from this high-level program,...
Ogre::HighLevelGpuProgram::populateParameterNames
virtual void populateParameterNames(GpuProgramParametersSharedPtr params)
Populate the passed parameters with name->index map.
Ogre::GpuProgram
Defines a program which runs on the GPU such as a vertex or fragment program.
Definition: OgreGpuProgram.h:70
Ogre::HighLevelGpuProgram::loadImpl
void loadImpl()
Internal implementation of the meat of the 'load' action, only called if this resource is not being l...
Ogre::HighLevelGpuProgram::getNamedConstants
const GpuNamedConstants & getNamedConstants() const
Override GpuProgram::getNamedConstants to ensure built.
Definition: OgreHighLevelGpuProgram.h:125
Ogre::HighLevelGpuProgram::unloadImpl
void unloadImpl()
Internal implementation of the 'unload' action; called regardless of whether this resource is being l...
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::HighLevelGpuProgram::mHighLevelLoaded
bool mHighLevelLoaded
Whether the high-level program (and it's parameter defs) is loaded.
Definition: OgreHighLevelGpuProgram.h:67
Ogre::HighLevelGpuProgram::loadHighLevel
virtual void loadHighLevel(void)
Internal load high-level portion if not loaded.
Ogre::HighLevelGpuProgram::mAssemblerProgram
GpuProgramPtr mAssemblerProgram
The underlying assembler program.
Definition: OgreHighLevelGpuProgram.h:69
OgrePrerequisites.h
Ogre::HighLevelGpuProgram::calculateSize
virtual size_t calculateSize(void) const
Calculate the size of a resource; this will only be called after 'load'.
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::ResourceManager
Defines a generic resource handler.
Definition: OgreResourceManager.h:123
Ogre::SharedPtr< GpuProgram >
Ogre::HighLevelGpuProgram::unloadHighLevelImpl
virtual void unloadHighLevelImpl(void)=0
Internal unload implementation, must be implemented by subclasses.
OgreGpuProgram.h
Ogre::HighLevelGpuProgram::~HighLevelGpuProgram
~HighLevelGpuProgram()
Ogre::HighLevelGpuProgram::_getBindingDelegate
GpuProgram * _getBindingDelegate(void)
Returns the GpuProgram which should be bound to the pipeline.
Definition: OgreHighLevelGpuProgram.h:116
Ogre::ManualResourceLoader
Interface describing a manual resource loader.
Definition: OgreResource.h:515
Ogre::HighLevelGpuProgram
Abstract base class representing a high-level program (a vertex or fragment program).
Definition: OgreHighLevelGpuProgram.h:64
Ogre::SharedPtr::getPointer
T * getPointer() const
Definition: OgreSharedPtr.h:273
Ogre::HighLevelGpuProgram::mConstantDefsBuilt
bool mConstantDefsBuilt
Have we built the name->index parameter map yet?
Definition: OgreHighLevelGpuProgram.h:71
Ogre::HighLevelGpuProgram::unloadHighLevel
virtual void unloadHighLevel(void)
Internal unload high-level portion if loaded.
Ogre::HighLevelGpuProgram::HighLevelGpuProgram
HighLevelGpuProgram(ResourceManager *creator, const String &name, ResourceHandle handle, const String &group, bool isManual=false, ManualResourceLoader *loader=0)
Constructor, should be used only by factory classes.

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