OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreGLSLProgramManager.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 __GLSLProgramManager_H__
29 #define __GLSLProgramManager_H__
30 
32 #include "OgreSingleton.h"
33 #include "OgreGLSLShader.h"
34 #include "OgreGLSLProgram.h"
35 #include "OgreGLSLExtSupport.h"
36 
37 namespace Ogre {
38 
53  {
54  protected:
62 
66 
69  void convertGLUniformtoOgreType(GLenum gltype,
70  GpuConstantDefinition& defToUpdate);
74  bool findUniformDataSource(
75  const String& paramName,
76  const GpuConstantDefinitionMap* vertexConstantDefs,
77  const GpuConstantDefinitionMap* hullConstantDefs,
78  const GpuConstantDefinitionMap* domainConstantDefs,
79  const GpuConstantDefinitionMap* geometryConstantDefs,
80  const GpuConstantDefinitionMap* fragmentConstantDefs,
81  const GpuConstantDefinitionMap* computeConstantDefs,
82  GLUniformReference& refToUpdate);
86  bool findAtomicCounterDataSource(
87  const String& paramName,
88  const GpuConstantDefinitionMap* vertexConstantDefs,
89  const GpuConstantDefinitionMap* hullConstantDefs,
90  const GpuConstantDefinitionMap* domainConstantDefs,
91  const GpuConstantDefinitionMap* geometryConstantDefs,
92  const GpuConstantDefinitionMap* fragmentConstantDefs,
93  const GpuConstantDefinitionMap* computeConstantDefs,
94  GLAtomicCounterReference& refToUpdate);
97  void parseGLSLUniform(
98  const String& src, GpuNamedConstants& defs,
99  String::size_type currPos,
100  const String& filename, GpuSharedParametersPtr sharedParams);
101 
102  public:
103 
104  GLSLProgramManager(void);
105  ~GLSLProgramManager(void);
106 
118  void extractUniformsFromProgram(
119  GLuint programObject,
120  const GpuConstantDefinitionMap* vertexConstantDefs,
121  const GpuConstantDefinitionMap* hullConstantDefs,
122  const GpuConstantDefinitionMap* domainConstantDefs,
123  const GpuConstantDefinitionMap* geometryConstantDefs,
124  const GpuConstantDefinitionMap* fragmentConstantDefs,
125  const GpuConstantDefinitionMap* computeConstantDefs,
126  GLUniformReferenceList& uniformList,
127  GLAtomicCounterReferenceList& counterList,
128  GLUniformBufferList& uniformBufferList,
129  SharedParamsBufferMap& sharedParamsBufferMap,
130  //GLShaderStorageBufferList& shaderStorageBufferList,
131  GLCounterBufferList& counterBufferList);
140  void extractUniformsFromGLSL(
141  const String& src, GpuNamedConstants& constantDefs, const String& filename);
142  };
143 
144 }
145 
146 #endif // __GLSLProgramManager_H__
map< String, GLenum >::type StringToEnumMap
vector< GLAtomicCounterReference >::type GLAtomicCounterReferenceList
Structure used to keep track of named uniforms in the linked program object.
Structure used to keep track of named atomic counter uniforms in the linked program object...
vector< HardwareUniformBufferSharedPtr >::type GLUniformBufferList
Struct collecting together the information for named constants.
Ogre assumes that there are separate programs to deal with but GLSL has one program object that repre...
GLSLShader * mActiveVertexShader
Active shader objects defining the active program object.
#define _OgreGL3PlusExport
map< String, GpuConstantDefinition >::type GpuConstantDefinitionMap
vector< GLUniformReference >::type GLUniformReferenceList
vector< HardwareCounterBufferSharedPtr >::type GLCounterBufferList
Information about predefined program constants.
_StringBase String
Definition: OgreCommon.h:53
map< GpuSharedParametersPtr, HardwareUniformBufferSharedPtr >::type SharedParamsBufferMap
Specialisation of HighLevelGpuProgram to encapsulate shader objects obtained from compiled shaders wr...