OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
src/GLSL/include/OgreGLSLLinkProgram.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-2014 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 __GLSLLinkProgram_H__
29 #define __GLSLLinkProgram_H__
30 
31 #include "OgreGLPrerequisites.h"
32 #include "OgreGpuProgram.h"
34 #include "OgreGLUniformCache.h"
35 
36 namespace Ogre {
37  namespace GLSL {
38 
41  {
43  GLint mLocation;
48  };
49 
51  typedef GLUniformReferenceList::iterator GLUniformReferenceIterator;
52 
58  {
59  private:
62 
70 
74  GLhandleARB mGLHandle;
76  GLint mLinked;
81 
83  void buildGLUniformReferences(void);
85  void extractAttributes(void);
86 
90 
93  {
95  GLuint attrib;
96  CustomAttribute(const String& _name, GLuint _attrib)
97  :name(_name), attrib(_attrib) {}
98  };
99 
100  static CustomAttribute msCustomAttributes[];
101 
102  String getCombinedName();
104  void compileAndLink();
106  void getMicrocodeFromCache();
107  public:
109  GLSLLinkProgram(GLSLGpuProgram* vertexProgram, GLSLGpuProgram* geometryProgram, GLSLGpuProgram* fragmentProgram);
110  ~GLSLLinkProgram(void);
111 
115  void activate(void);
116 
120  void updateUniforms(GpuProgramParametersSharedPtr params, uint16 mask, GpuProgramType fromProgType);
124  void updatePassIterationUniforms(GpuProgramParametersSharedPtr params);
126  GLhandleARB getGLHandle(void) const { return mGLHandle; }
133  void setSkeletalAnimationIncluded(bool included)
134  { mSkeletalAnimation = included; }
135 
142  bool isSkeletalAnimationIncluded(void) const { return mSkeletalAnimation; }
143 
145  GLuint getAttributeIndex(VertexElementSemantic semantic, uint index);
147  bool isAttributeValid(VertexElementSemantic semantic, uint index);
148 
149  };
150 
151  }
152 }
153 
154 #endif // __GLSLLinkProgram_H__
GLUniformReferenceList::iterator GLUniformReferenceIterator
GpuProgramType mSourceProgType
Which type of program params will this value come from?
GpuProgramType
Enumerates the types of programs which can run on the GPU.
VertexElementSemantic
Vertex element semantics, used to identify the meaning of vertex buffer contents. ...
#define _OgreGLExport
const GpuConstantDefinition * mConstantDef
The constant definition it relates to.
vector< GLUniformReference >::type GLUniformReferenceList
Structure used to keep track of named uniforms in the linked program object.
Information about predefined program constants.
_StringBase String
Definition: OgreCommon.h:53
unsigned short uint16
Definition: OgrePlatform.h:421
An in memory cache of the OpenGL uniforms.
GLSL low level compiled shader object - this class is used to get at the linked program object and pr...
unsigned int uint