1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
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. *
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. *
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. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 /*****************************************************************************\
40 *****************************************************************************
42 ** This file is automatically generated. **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
47 ** Do not change this file, changes should be done in the derived **
48 ** class ComputeShaderAlgorithm
50 *****************************************************************************
51 \*****************************************************************************/
54 #ifndef _OSGCOMPUTESHADERALGORITHMBASE_H_
55 #define _OSGCOMPUTESHADERALGORITHMBASE_H_
61 #include "OSGConfig.h"
62 #include "OSGContribComputeBaseDef.h"
64 //#include "OSGBaseTypes.h"
66 #include "OSGComputeAlgorithm.h" // Parent
68 #include "OSGTextureImageChunkFields.h" // TextureImages type
69 #include "OSGChunkMaterialFields.h" // ChunkMaterial type
70 #include "OSGComputeShaderChunkFields.h" // ComputeShader type
71 #include "OSGVecFields.h" // DispatchConfig type
72 #include "OSGSysFields.h" // UseMemoryBarrier type
73 #include "OSGBaseFields.h" // MemoryBarrier type
75 #include "OSGComputeShaderAlgorithmFields.h"
80 class ComputeShaderAlgorithm
;
82 //! \brief ComputeShaderAlgorithm Base Class.
84 class OSG_CONTRIBCOMPUTEBASE_DLLMAPPING ComputeShaderAlgorithmBase
: public ComputeAlgorithm
88 typedef ComputeAlgorithm Inherited
;
89 typedef ComputeAlgorithm ParentContainer
;
91 typedef Inherited::TypeObject TypeObject
;
92 typedef TypeObject::InitPhase InitPhase
;
94 OSG_GEN_INTERNALPTR(ComputeShaderAlgorithm
);
96 /*========================== PUBLIC =================================*/
102 TextureImagesFieldId
= Inherited::NextFieldId
,
103 ChunkMaterialFieldId
= TextureImagesFieldId
+ 1,
104 ComputeShaderFieldId
= ChunkMaterialFieldId
+ 1,
105 DispatchConfigFieldId
= ComputeShaderFieldId
+ 1,
106 WorkGroupSizeFieldId
= DispatchConfigFieldId
+ 1,
107 UseMemoryBarrierFieldId
= WorkGroupSizeFieldId
+ 1,
108 UseVariableWorkGroupSizeFieldId
= UseMemoryBarrierFieldId
+ 1,
109 MemoryBarrierFieldId
= UseVariableWorkGroupSizeFieldId
+ 1,
110 NextFieldId
= MemoryBarrierFieldId
+ 1
113 static const OSG::BitVector TextureImagesFieldMask
=
114 (TypeTraits
<BitVector
>::One
<< TextureImagesFieldId
);
115 static const OSG::BitVector ChunkMaterialFieldMask
=
116 (TypeTraits
<BitVector
>::One
<< ChunkMaterialFieldId
);
117 static const OSG::BitVector ComputeShaderFieldMask
=
118 (TypeTraits
<BitVector
>::One
<< ComputeShaderFieldId
);
119 static const OSG::BitVector DispatchConfigFieldMask
=
120 (TypeTraits
<BitVector
>::One
<< DispatchConfigFieldId
);
121 static const OSG::BitVector WorkGroupSizeFieldMask
=
122 (TypeTraits
<BitVector
>::One
<< WorkGroupSizeFieldId
);
123 static const OSG::BitVector UseMemoryBarrierFieldMask
=
124 (TypeTraits
<BitVector
>::One
<< UseMemoryBarrierFieldId
);
125 static const OSG::BitVector UseVariableWorkGroupSizeFieldMask
=
126 (TypeTraits
<BitVector
>::One
<< UseVariableWorkGroupSizeFieldId
);
127 static const OSG::BitVector MemoryBarrierFieldMask
=
128 (TypeTraits
<BitVector
>::One
<< MemoryBarrierFieldId
);
129 static const OSG::BitVector NextFieldMask
=
130 (TypeTraits
<BitVector
>::One
<< NextFieldId
);
132 typedef MFUnrecTextureImageChunkPtr MFTextureImagesType
;
133 typedef SFUnrecChunkMaterialPtr SFChunkMaterialType
;
134 typedef SFUnrecComputeShaderChunkPtr SFComputeShaderType
;
135 typedef SFVec3i SFDispatchConfigType
;
136 typedef SFVec3i SFWorkGroupSizeType
;
137 typedef SFBool SFUseMemoryBarrierType
;
138 typedef SFBool SFUseVariableWorkGroupSizeType
;
139 typedef SFGLenum SFMemoryBarrierType
;
141 /*---------------------------------------------------------------------*/
142 /*! \name Class Get */
145 static FieldContainerType
&getClassType (void);
146 static UInt32
getClassTypeId (void);
147 static UInt16
getClassGroupId(void);
150 /*---------------------------------------------------------------------*/
151 /*! \name FieldContainer Get */
154 virtual FieldContainerType
&getType (void);
155 virtual const FieldContainerType
&getType (void) const;
157 virtual UInt32
getContainerSize(void) const;
160 /*---------------------------------------------------------------------*/
161 /*! \name Field Get */
164 const MFUnrecTextureImageChunkPtr
*getMFTextureImages (void) const;
165 MFUnrecTextureImageChunkPtr
*editMFTextureImages (void);
166 const SFUnrecChunkMaterialPtr
*getSFChunkMaterial (void) const;
167 SFUnrecChunkMaterialPtr
*editSFChunkMaterial (void);
168 const SFUnrecComputeShaderChunkPtr
*getSFComputeShader (void) const;
169 SFUnrecComputeShaderChunkPtr
*editSFComputeShader (void);
171 SFVec3i
*editSFDispatchConfig (void);
172 const SFVec3i
*getSFDispatchConfig (void) const;
174 SFVec3i
*editSFWorkGroupSize (void);
175 const SFVec3i
*getSFWorkGroupSize (void) const;
177 SFBool
*editSFUseMemoryBarrier(void);
178 const SFBool
*getSFUseMemoryBarrier (void) const;
180 SFBool
*editSFUseVariableWorkGroupSize(void);
181 const SFBool
*getSFUseVariableWorkGroupSize (void) const;
183 SFGLenum
*editSFMemoryBarrier (void);
184 const SFGLenum
*getSFMemoryBarrier (void) const;
187 TextureImageChunk
* getTextureImages (const UInt32 index
) const;
189 ChunkMaterial
* getChunkMaterial (void) const;
191 ComputeShaderChunk
* getComputeShader (void) const;
193 Vec3i
&editDispatchConfig (void);
194 const Vec3i
&getDispatchConfig (void) const;
196 Vec3i
&editWorkGroupSize (void);
197 const Vec3i
&getWorkGroupSize (void) const;
199 bool &editUseMemoryBarrier(void);
200 bool getUseMemoryBarrier (void) const;
202 bool &editUseVariableWorkGroupSize(void);
203 bool getUseVariableWorkGroupSize (void) const;
205 GLenum
&editMemoryBarrier (void);
206 const GLenum
&getMemoryBarrier (void) const;
209 /*---------------------------------------------------------------------*/
210 /*! \name Field Set */
213 void setChunkMaterial (ChunkMaterial
* const value
);
214 void setComputeShader (ComputeShaderChunk
* const value
);
215 void setDispatchConfig (const Vec3i
&value
);
216 void setWorkGroupSize (const Vec3i
&value
);
217 void setUseMemoryBarrier(const bool value
);
218 void setUseVariableWorkGroupSize(const bool value
);
219 void setMemoryBarrier (const GLenum
&value
);
222 /*---------------------------------------------------------------------*/
223 /*! \name Ptr Field Set */
227 /*---------------------------------------------------------------------*/
228 /*! \name Ptr MField Set */
231 void pushToTextureImages (TextureImageChunk
* const value
);
232 void assignTextureImages (const MFUnrecTextureImageChunkPtr
&value
);
233 void removeFromTextureImages (UInt32 uiIndex
);
234 void removeObjFromTextureImages(TextureImageChunk
* const value
);
235 void clearTextureImages (void );
238 /*---------------------------------------------------------------------*/
239 /*! \name Binary Access */
242 virtual SizeT
getBinSize (ConstFieldMaskArg whichField
);
243 virtual void copyToBin (BinaryDataHandler
&pMem
,
244 ConstFieldMaskArg whichField
);
245 virtual void copyFromBin(BinaryDataHandler
&pMem
,
246 ConstFieldMaskArg whichField
);
250 /*---------------------------------------------------------------------*/
251 /*! \name Construction */
254 static ComputeShaderAlgorithmTransitPtr
create (void);
255 static ComputeShaderAlgorithm
*createEmpty (void);
257 static ComputeShaderAlgorithmTransitPtr
createLocal (
258 BitVector bFlags
= FCLocal::All
);
260 static ComputeShaderAlgorithm
*createEmptyLocal(
261 BitVector bFlags
= FCLocal::All
);
263 static ComputeShaderAlgorithmTransitPtr
createDependent (BitVector bFlags
);
266 /*---------------------------------------------------------------------*/
270 virtual FieldContainerTransitPtr
shallowCopy (void) const;
271 virtual FieldContainerTransitPtr
shallowCopyLocal(
272 BitVector bFlags
= FCLocal::All
) const;
273 virtual FieldContainerTransitPtr
shallowCopyDependent(
274 BitVector bFlags
) const;
277 /*========================= PROTECTED ===============================*/
281 static TypeObject _type
;
283 static void classDescInserter(TypeObject
&oType
);
284 static const Char8
*getClassname (void );
286 /*---------------------------------------------------------------------*/
290 MFUnrecTextureImageChunkPtr _mfTextureImages
;
291 SFUnrecChunkMaterialPtr _sfChunkMaterial
;
292 SFUnrecComputeShaderChunkPtr _sfComputeShader
;
293 SFVec3i _sfDispatchConfig
;
294 SFVec3i _sfWorkGroupSize
;
295 SFBool _sfUseMemoryBarrier
;
296 SFBool _sfUseVariableWorkGroupSize
;
297 SFGLenum _sfMemoryBarrier
;
300 /*---------------------------------------------------------------------*/
301 /*! \name Constructors */
304 ComputeShaderAlgorithmBase(void);
305 ComputeShaderAlgorithmBase(const ComputeShaderAlgorithmBase
&source
);
308 /*---------------------------------------------------------------------*/
309 /*! \name Destructors */
312 virtual ~ComputeShaderAlgorithmBase(void);
315 /*---------------------------------------------------------------------*/
316 /*! \name onCreate */
319 void onCreate(const ComputeShaderAlgorithm
*source
= NULL
);
322 /*---------------------------------------------------------------------*/
323 /*! \name Generic Field Access */
326 GetFieldHandlePtr
getHandleTextureImages (void) const;
327 EditFieldHandlePtr
editHandleTextureImages (void);
328 GetFieldHandlePtr
getHandleChunkMaterial (void) const;
329 EditFieldHandlePtr
editHandleChunkMaterial (void);
330 GetFieldHandlePtr
getHandleComputeShader (void) const;
331 EditFieldHandlePtr
editHandleComputeShader (void);
332 GetFieldHandlePtr
getHandleDispatchConfig (void) const;
333 EditFieldHandlePtr
editHandleDispatchConfig (void);
334 GetFieldHandlePtr
getHandleWorkGroupSize (void) const;
335 EditFieldHandlePtr
editHandleWorkGroupSize (void);
336 GetFieldHandlePtr
getHandleUseMemoryBarrier (void) const;
337 EditFieldHandlePtr
editHandleUseMemoryBarrier(void);
338 GetFieldHandlePtr
getHandleUseVariableWorkGroupSize (void) const;
339 EditFieldHandlePtr
editHandleUseVariableWorkGroupSize(void);
340 GetFieldHandlePtr
getHandleMemoryBarrier (void) const;
341 EditFieldHandlePtr
editHandleMemoryBarrier (void);
344 /*---------------------------------------------------------------------*/
348 #ifdef OSG_MT_CPTR_ASPECT
349 virtual void execSyncV( FieldContainer
&oFrom
,
350 ConstFieldMaskArg whichField
,
351 AspectOffsetStore
&oOffsets
,
352 ConstFieldMaskArg syncMode
,
353 const UInt32 uiSyncInfo
);
355 void execSync ( ComputeShaderAlgorithmBase
*pFrom
,
356 ConstFieldMaskArg whichField
,
357 AspectOffsetStore
&oOffsets
,
358 ConstFieldMaskArg syncMode
,
359 const UInt32 uiSyncInfo
);
363 /*---------------------------------------------------------------------*/
368 /*---------------------------------------------------------------------*/
369 /*! \name Aspect Create */
372 #ifdef OSG_MT_CPTR_ASPECT
373 virtual FieldContainer
*createAspectCopy(
374 const FieldContainer
*pRefAspect
) const;
378 /*---------------------------------------------------------------------*/
382 /*---------------------------------------------------------------------*/
386 virtual void resolveLinks(void);
389 /*========================== PRIVATE ================================*/
392 /*---------------------------------------------------------------------*/
394 // prohibit default functions (move to 'public' if you need one)
395 void operator =(const ComputeShaderAlgorithmBase
&source
);
398 typedef ComputeShaderAlgorithmBase
*ComputeShaderAlgorithmBaseP
;
402 #endif /* _OSGCOMPUTESHADERALGORITHMBASE_H_ */