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

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