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-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 __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__
Ogre::GLSL::GLSLLinkProgram::mUniformCache
GLUniformCache * mUniformCache
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:69
Ogre::GLSL::GLSLLinkProgram::mLinked
GLint mLinked
Flag indicating that the program object has been successfully linked.
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:76
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::set
Definition: OgrePrerequisites.h:519
Ogre::GLSL::GLSLLinkProgram::mVertexProgram
GLSLGpuProgram * mVertexProgram
Linked vertex program.
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:64
Ogre::uint16
unsigned short uint16
Definition: OgrePlatform.h:360
Ogre::GLSL::GLSLLinkProgram::mGeometryProgram
GLSLGpuProgram * mGeometryProgram
Linked geometry program.
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:66
Ogre::GLSL::GLSLGpuProgram
GLSL low level compiled shader object - this class is used to get at the linked program object and pr...
Definition: src/GLSL/include/OgreGLSLGpuProgram.h:47
Ogre::GLSL::GLSLLinkProgram::setSkeletalAnimationIncluded
void setSkeletalAnimationIncluded(bool included)
Sets whether the linked program includes the required instructions to perform skeletal animation.
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:133
Ogre::GLSL::GLSLLinkProgram::mSkeletalAnimation
bool mSkeletalAnimation
Flag indicating skeletal animation is being performed.
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:80
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::GLSL::GLUniformReferenceList
vector< GLUniformReference >::type GLUniformReferenceList
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:50
Ogre::GLSL::GLSLLinkProgram::mUniformRefsBuilt
bool mUniformRefsBuilt
Flag to indicate that uniform references have already been built.
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:72
Ogre::GLSL::GLSLLinkProgram::CustomAttribute::name
String name
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:94
Ogre::GpuProgramType
GpuProgramType
Enumerates the types of programs which can run on the GPU.
Definition: OgreGpuProgram.h:50
Ogre::VertexElementSemantic
VertexElementSemantic
Vertex element semantics, used to identify the meaning of vertex buffer contents.
Definition: OgreHardwareVertexBuffer.h:99
Ogre::GLSL::GLUniformReference::mSourceProgType
GpuProgramType mSourceProgType
Which type of program params will this value come from?
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:45
Ogre::GLSL::GLSLLinkProgram::CustomAttribute::attrib
GLuint attrib
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:95
Ogre::GLSL::GLSLLinkProgram::mFragmentProgram
GLSLGpuProgram * mFragmentProgram
Linked fragment program.
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:68
Ogre::GLSL::GLSLLinkProgram::mGLHandle
GLhandleARB mGLHandle
GL handle for the program object.
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:74
_OgreGLExport
#define _OgreGLExport
Definition: OgreGLPrerequisites.h:99
Ogre::GLSL::GLSLLinkProgram::isSkeletalAnimationIncluded
bool isSkeletalAnimationIncluded(void) const
Returns whether the linked program includes the required instructions to perform skeletal animation.
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:142
Ogre::GLSL::GLSLLinkProgram::mGLUniformReferences
GLUniformReferenceList mGLUniformReferences
Container of uniform references that are active in the program object.
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:61
OgreGLPrerequisites.h
Ogre::GLSL::GLSLLinkProgram::mTriedToLinkAndFailed
bool mTriedToLinkAndFailed
Flag indicating that the program object has tried to link and failed.
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:78
Ogre::GLSL::GLUniformReferenceIterator
GLUniformReferenceList::iterator GLUniformReferenceIterator
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:51
Ogre::GLSL::GLSLLinkProgram::getGLHandle
GLhandleARB getGLHandle(void) const
Get the GL Handle for the program object.
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:126
Ogre::SharedPtr< GpuProgramParameters >
OgreHardwareVertexBuffer.h
Ogre::uint
unsigned int uint
Definition: OgrePrerequisites.h:114
Ogre::GpuConstantDefinition
Information about predefined program constants.
Definition: OgreGpuProgramParams.h:122
Ogre::GLSL::GLSLLinkProgram::CustomAttribute::CustomAttribute
CustomAttribute(const String &_name, GLuint _attrib)
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:96
OgreGpuProgram.h
Ogre::GLSL::GLUniformReference::mLocation
GLint mLocation
GL location handle.
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:43
Ogre::GLSL::GLUniformReference
Structure used to keep track of named uniforms in the linked program object.
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:40
Ogre::GLSL::GLSLLinkProgram
C++ encapsulation of GLSL Program Object.
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:57
Ogre::GLSL::GLSLLinkProgram::mValidAttributes
AttributeSet mValidAttributes
Custom attribute bindings.
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:89
Ogre::GLSL::GLSLLinkProgram::CustomAttribute
Name / attribute list.
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:92
Ogre::vector
Definition: OgrePrerequisites.h:491
OgreGLUniformCache.h
Ogre::GLSL::GLUniformReference::mConstantDef
const GpuConstantDefinition * mConstantDef
The constant definition it relates to.
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:47
Ogre::GLUniformCache
An in memory cache of the OpenGL uniforms.
Definition: OgreGLUniformCache.h:41
Ogre::GLSL::GLSLLinkProgram::AttributeSet
set< GLuint >::type AttributeSet
Definition: src/GLSL/include/OgreGLSLLinkProgram.h:87

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Tue Apr 13 2021 08:53:15