changed: gcc8 base update
[opensg.git] / Source / System / State / Shader / Chunks / OSGShaderExecutableChunk.h
blobdb3d91ecdca9dbc32d278460ba3bfe444363a65e
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2006 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
18 * *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGSHADEREXECUTABLECHUNK_H_
40 #define _OSGSHADEREXECUTABLECHUNK_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGShaderProgram.h"
46 #include "OSGShaderExecutableChunkBase.h"
48 OSG_BEGIN_NAMESPACE
50 class ShaderProgramChunk;
51 class ShaderCache;
52 class SimpleSHLChunk;
54 /*! \brief ShaderExecutableChunk class. See \ref
55 PageSystemShaderExecutableChunk for a description.
56 \ingroup GrpSystemShaderChunks
57 \ingroup GrpLibOSGSystem
58 \includebasedoc
61 class OSG_SYSTEM_DLLMAPPING ShaderExecutableChunk :
62 public ShaderExecutableChunkBase
64 protected:
66 /*========================== PUBLIC =================================*/
68 public:
70 typedef ShaderExecutableChunkBase Inherited;
71 typedef ShaderExecutableChunk Self;
73 static const UInt32 KeepProgActive = ShaderProgram::KeepProgActive;
75 static const UInt32 ProgActive = ShaderProgram::ProgActive;
77 /*---------------------------------------------------------------------*/
78 /*! \name Chunk Class Access */
79 /*! \{ */
81 virtual const StateChunkClass *getClass(void) const;
83 /*! \} */
84 /*---------------------------------------------------------------------*/
85 /*! \name Static Chunk Class Access */
86 /*! \{ */
88 static UInt32 getStaticClassId(void);
89 static const StateChunkClass *getStaticClass (void);
91 /*! \} */
92 /*---------------------------------------------------------------------*/
93 /*! \name Chunk Id */
94 /*! \{ */
96 virtual UInt16 getChunkId(void);
98 /*! \} */
99 /*---------------------------------------------------------------------*/
100 /*! \name Sync */
101 /*! \{ */
103 virtual void changed(ConstFieldMaskArg whichField,
104 UInt32 origin,
105 BitVector details );
107 /*! \} */
108 /*---------------------------------------------------------------------*/
109 /*! \name Output */
110 /*! \{ */
112 virtual void activate (DrawEnv *pEnv,
113 UInt32 uiIdx = 0);
115 virtual void changeFrom (DrawEnv *pEnv,
116 StateChunk *pOld,
117 UInt32 uiIdx = 0);
119 virtual void deactivate (DrawEnv *pEnv,
120 UInt32 uiIdx = 0);
122 virtual void updateObjectDependencies(DrawEnv *pEnv,
123 UInt32 index = 0);
125 /*! \} */
126 /*---------------------------------------------------------------------*/
127 /*! \name Output */
128 /*! \{ */
130 void merge(const ShaderProgramChunk *pChunk);
132 /*! \} */
133 /*---------------------------------------------------------------------*/
134 /*! \name Output */
135 /*! \{ */
137 virtual void dump( UInt32 uiIndent = 0,
138 const BitVector bvFlags = 0) const;
140 /*! \} */
141 /*========================= PROTECTED ===============================*/
143 protected:
145 static UInt32 _extSHL;
147 static const UInt32 UsesAttribs = 0x0001;
149 /*---------------------------------------------------------------------*/
151 static volatile UInt16 _uiChunkCounter;
153 UInt16 _uiChunkId;
155 typedef MFFragmentShaderType ::const_iterator FragmentShaderIt;
156 typedef MFGeometryShaderType ::const_iterator GeometryShaderIt;
157 typedef MFTessEvaluationShaderType::const_iterator TessEvalShaderIt;
158 typedef MFTessControlShaderType ::const_iterator TessControlShaderIt;
159 typedef MFVertexShaderType ::const_iterator VertexShaderIt;
161 /*---------------------------------------------------------------------*/
162 /*! \name Constructors */
163 /*! \{ */
165 ShaderExecutableChunk(void);
166 ShaderExecutableChunk(const ShaderExecutableChunk &source);
168 /*! \} */
169 /*---------------------------------------------------------------------*/
170 /*! \name Destructors */
171 /*! \{ */
173 virtual ~ShaderExecutableChunk(void);
175 /*! \} */
176 /*---------------------------------------------------------------------*/
177 /*! \name Init */
178 /*! \{ */
180 static void initMethod(InitPhase ePhase);
182 /*! \} */
183 /*---------------------------------------------------------------------*/
184 /*! \name Sync */
185 /*! \{ */
187 virtual void resolveLinks(void);
189 /*! \} */
190 /*---------------------------------------------------------------------*/
191 /*! \name Init */
192 /*! \{ */
194 UInt32 handleGL (DrawEnv *pEnv,
195 UInt32 id,
196 Window::GLObjectStatusE mode,
197 UInt64 uiOptions);
198 static void handleDestroyGL(DrawEnv *pEnv,
199 UInt32 id,
200 Window::GLObjectStatusE mode );
202 /*! \} */
203 /*---------------------------------------------------------------------*/
204 /*! \name Init */
205 /*! \{ */
207 void onCreate (const ShaderExecutableChunk *source = NULL);
208 void onCreateAspect(const ShaderExecutableChunk *createAspect,
209 const ShaderExecutableChunk *source = NULL);
210 void onDestroy( UInt32 uiId );
212 /*! \} */
213 /*---------------------------------------------------------------------*/
214 /*! \name Init */
215 /*! \{ */
217 void updateVariableLocations (DrawEnv *pEnv,
218 UInt32 uiProgram);
219 void updateVariables (DrawEnv *pEnv,
220 UInt32 uiProgram);
221 void updateParameters (DrawEnv *pEnv,
222 UInt32 uiProgram);
223 void updateAttribBindings (DrawEnv *pEnv,
224 UInt32 uiProgram);
226 void updateProceduralVariables(DrawEnv *pEnv,
227 UInt32 uiUpdateDependents);
229 void remergeVariables (void );
231 /*! \} */
232 /*---------------------------------------------------------------------*/
233 /*! \name Init */
234 /*! \{ */
236 const MFFragmentShaderType *getMFFragmentShader (void);
237 const MFGeometryShaderType *getMFGeometryShader (void);
238 const MFTessEvaluationShaderType *getMFTessEvaluationShader(void);
239 const MFTessControlShaderType *getMFTessControlShader (void);
240 const MFVertexShaderType *getMFVertexShader (void);
242 /*! \} */
243 /*========================== PRIVATE ================================*/
245 private:
247 // class. Used for indexing in State
248 static StateChunkClass _class;
250 friend class FieldContainer;
251 friend class ShaderExecutableChunkBase;
252 friend class ShaderCache;
253 friend class SimpleSHLChunk;
255 // prohibit default functions (move to 'public' if you need one)
256 void operator =(const ShaderExecutableChunk &source);
259 typedef ShaderExecutableChunk *ShaderExecutableChunkP;
261 OSG_END_NAMESPACE
263 #include "OSGShaderExecutableChunkBase.inl"
264 #include "OSGShaderExecutableChunk.inl"
266 #endif /* _OSGSHADEREXECUTABLECHUNK_H_ */