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 ComputeShaderChunk!
50 *****************************************************************************
51 \*****************************************************************************/
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
61 #include "OSGConfig.h"
65 #include "OSGShaderProgram.h" // ComputeShader Class
66 #include "OSGShaderProgramVariables.h" // Variables Class
68 #include "OSGComputeShaderChunkBase.h"
69 #include "OSGComputeShaderChunk.h"
71 #include <boost/bind.hpp>
75 /***************************************************************************\
77 \***************************************************************************/
79 /*! \class OSG::ComputeShaderChunk
83 /***************************************************************************\
84 * Field Documentation *
85 \***************************************************************************/
87 /*! \var ShaderProgram * ComputeShaderChunkBase::_mfComputeShader
88 fragment program object
91 /*! \var std::string ComputeShaderChunkBase::_sfComputeProgram
95 /*! \var ShaderProgramVariables * ComputeShaderChunkBase::_sfVariables
96 fragment program object
99 /*! \var Int32 ComputeShaderChunkBase::_mfVariableLocations
100 fragment program object
103 /*! \var Int32 ComputeShaderChunkBase::_mfProceduralVariableLocations
104 fragment program object
107 /*! \var UInt32 ComputeShaderChunkBase::_sfGLId
112 /***************************************************************************\
113 * FieldType/FieldTrait Instantiation *
114 \***************************************************************************/
116 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
117 PointerType FieldTraits
<ComputeShaderChunk
*, nsOSG
>::_type(
118 "ComputeShaderChunkPtr",
120 ComputeShaderChunk::getClassType(),
124 OSG_FIELDTRAITS_GETTYPE_NS(ComputeShaderChunk
*, nsOSG
)
126 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
127 ComputeShaderChunk
*,
130 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
131 ComputeShaderChunk
*,
134 /***************************************************************************\
135 * Field Description *
136 \***************************************************************************/
138 void ComputeShaderChunkBase::classDescInserter(TypeObject
&oType
)
140 FieldDescriptionBase
*pDesc
= NULL
;
143 pDesc
= new MFUnrecShaderProgramPtr::Description(
144 MFUnrecShaderProgramPtr::getClassType(),
146 "fragment program object\n",
147 ComputeShaderFieldId
, ComputeShaderFieldMask
,
149 (Field::MFDefaultFlags
| Field::FStdAccess
),
150 static_cast<FieldEditMethodSig
>(&ComputeShaderChunk::editHandleComputeShader
),
151 static_cast<FieldGetMethodSig
>(&ComputeShaderChunk::getHandleComputeShader
));
153 oType
.addInitialDesc(pDesc
);
155 pDesc
= new SFString::Description(
156 SFString::getClassType(),
158 "vertex program source\n",
159 ComputeProgramFieldId
, ComputeProgramFieldMask
,
161 (Field::SFDefaultFlags
| Field::FStdAccess
),
162 static_cast<FieldEditMethodSig
>(&ComputeShaderChunk::editHandleComputeProgram
),
163 static_cast<FieldGetMethodSig
>(&ComputeShaderChunk::getHandleComputeProgram
));
165 oType
.addInitialDesc(pDesc
);
167 pDesc
= new SFUnrecChildShaderProgramVariablesPtr::Description(
168 SFUnrecChildShaderProgramVariablesPtr::getClassType(),
170 "fragment program object\n",
171 VariablesFieldId
, VariablesFieldMask
,
173 (Field::SFDefaultFlags
| Field::FStdAccess
),
174 static_cast<FieldEditMethodSig
>(&ComputeShaderChunk::editHandleVariables
),
175 static_cast<FieldGetMethodSig
>(&ComputeShaderChunk::getHandleVariables
));
177 oType
.addInitialDesc(pDesc
);
179 pDesc
= new MFInt32::Description(
180 MFInt32::getClassType(),
182 "fragment program object\n",
183 VariableLocationsFieldId
, VariableLocationsFieldMask
,
185 (Field::MFDefaultFlags
| Field::FStdAccess
),
186 static_cast<FieldEditMethodSig
>(&ComputeShaderChunk::editHandleVariableLocations
),
187 static_cast<FieldGetMethodSig
>(&ComputeShaderChunk::getHandleVariableLocations
));
189 oType
.addInitialDesc(pDesc
);
191 pDesc
= new MFInt32::Description(
192 MFInt32::getClassType(),
193 "proceduralVariableLocations",
194 "fragment program object\n",
195 ProceduralVariableLocationsFieldId
, ProceduralVariableLocationsFieldMask
,
197 (Field::MFDefaultFlags
| Field::FStdAccess
),
198 static_cast<FieldEditMethodSig
>(&ComputeShaderChunk::editHandleProceduralVariableLocations
),
199 static_cast<FieldGetMethodSig
>(&ComputeShaderChunk::getHandleProceduralVariableLocations
));
201 oType
.addInitialDesc(pDesc
);
203 pDesc
= new SFUInt32::Description(
204 SFUInt32::getClassType(),
207 GLIdFieldId
, GLIdFieldMask
,
209 (Field::FClusterLocal
),
210 static_cast<FieldEditMethodSig
>(&ComputeShaderChunk::editHandleGLId
),
211 static_cast<FieldGetMethodSig
>(&ComputeShaderChunk::getHandleGLId
));
213 oType
.addInitialDesc(pDesc
);
217 ComputeShaderChunkBase::TypeObject
ComputeShaderChunkBase::_type(
218 ComputeShaderChunkBase::getClassname(),
219 Inherited::getClassname(),
222 reinterpret_cast<PrototypeCreateF
>(&ComputeShaderChunkBase::createEmptyLocal
),
223 reinterpret_cast<InitContainerF
>(&ComputeShaderChunk::initMethod
),
224 reinterpret_cast<ExitContainerF
>(&ComputeShaderChunk::exitMethod
),
225 reinterpret_cast<InitalInsertDescFunc
>(&ComputeShaderChunk::classDescInserter
),
227 ComputeProgramFieldMask
,
228 "<?xml version=\"1.0\"?>\n"
231 " name=\"ComputeShaderChunk\"\n"
232 " parent=\"StateChunk\"\n"
233 " library=\"ContribComputeBase\"\n"
234 " pointerfieldtypes=\"both\"\n"
235 " structure=\"concrete\"\n"
236 " systemcomponent=\"true\"\n"
237 " parentsystemcomponent=\"true\"\n"
238 " decoratable=\"false\"\n"
239 " useLocalIncludes=\"false\"\n"
240 " fieldsUnmarkedOnCreate=\"ComputeProgramFieldMask\"\n"
241 " docGroupBase=\"GrpSystemShader\"\n"
244 "\t name=\"computeShader\"\n"
245 "\t type=\"ShaderProgram\"\n"
246 "\t cardinality=\"multi\"\n"
247 "\t visibility=\"external\"\n"
248 "\t access=\"public\"\n"
249 " category=\"pointer\"\n"
251 " pushToFieldAs=\"addComputeShader\"\n"
252 " removeFromMFieldIndexAs=\"subComputeShader\"\n"
253 " clearFieldAs=\"clearComputeShaders\" \n"
255 "\tfragment program object\n"
258 " name=\"computeProgram\"\n"
259 " type=\"std::string\"\n"
260 " cardinality=\"single\"\n"
261 " visibility=\"external\"\n"
262 " access=\"public\"\n"
264 "\tvertex program source\n"
268 " name=\"variables\"\n"
269 " type=\"ShaderProgramVariables\"\n"
270 " cardinality=\"single\"\n"
271 " visibility=\"external\"\n"
272 " access=\"public\"\n"
273 " category=\"childpointer\"\n"
274 " childParentType=\"FieldContainer\"\n"
275 " linkParentField=\"Parents\"\n"
277 "\tfragment program object\n"
280 " name=\"variableLocations\"\n"
282 " cardinality=\"multi\"\n"
283 " visibility=\"internal\"\n"
284 " access=\"protected\"\n"
286 "\tfragment program object\n"
289 " name=\"proceduralVariableLocations\"\n"
291 " cardinality=\"multi\"\n"
292 " visibility=\"internal\"\n"
293 " access=\"protected\"\n"
295 "\tfragment program object\n"
301 " cardinality=\"single\"\n"
302 " visibility=\"internal\"\n"
303 " access=\"public\"\n"
304 " defaultValue=\"0\"\n"
305 " fieldFlags=\"FClusterLocal\"\n"
309 "</FieldContainer>\n",
313 /*------------------------------ get -----------------------------------*/
315 FieldContainerType
&ComputeShaderChunkBase::getType(void)
320 const FieldContainerType
&ComputeShaderChunkBase::getType(void) const
325 UInt32
ComputeShaderChunkBase::getContainerSize(void) const
327 return sizeof(ComputeShaderChunk
);
330 /*------------------------- decorator get ------------------------------*/
333 //! Get the ComputeShaderChunk::_mfComputeShader field.
334 const MFUnrecShaderProgramPtr
*ComputeShaderChunkBase::getMFComputeShader(void) const
336 return &_mfComputeShader
;
339 MFUnrecShaderProgramPtr
*ComputeShaderChunkBase::editMFComputeShader (void)
341 editMField(ComputeShaderFieldMask
, _mfComputeShader
);
343 return &_mfComputeShader
;
345 ShaderProgram
* ComputeShaderChunkBase::getComputeShader(const UInt32 index
) const
347 return _mfComputeShader
[index
];
350 SFString
*ComputeShaderChunkBase::editSFComputeProgram(void)
352 editSField(ComputeProgramFieldMask
);
354 return &_sfComputeProgram
;
357 const SFString
*ComputeShaderChunkBase::getSFComputeProgram(void) const
359 return &_sfComputeProgram
;
363 //! Get the ComputeShaderChunk::_sfVariables field.
364 const SFUnrecChildShaderProgramVariablesPtr
*ComputeShaderChunkBase::getSFVariables(void) const
366 return &_sfVariables
;
369 SFUnrecChildShaderProgramVariablesPtr
*ComputeShaderChunkBase::editSFVariables (void)
371 editSField(VariablesFieldMask
);
373 return &_sfVariables
;
376 //! Get the value of the ComputeShaderChunk::_sfVariables field.
377 ShaderProgramVariables
* ComputeShaderChunkBase::getVariables(void) const
379 return _sfVariables
.getValue();
382 //! Set the value of the ComputeShaderChunk::_sfVariables field.
383 void ComputeShaderChunkBase::setVariables(ShaderProgramVariables
* const value
)
385 editSField(VariablesFieldMask
);
387 _sfVariables
.setValue(value
);
391 MFInt32
*ComputeShaderChunkBase::editMFVariableLocations(void)
393 editMField(VariableLocationsFieldMask
, _mfVariableLocations
);
395 return &_mfVariableLocations
;
398 const MFInt32
*ComputeShaderChunkBase::getMFVariableLocations(void) const
400 return &_mfVariableLocations
;
404 MFInt32
*ComputeShaderChunkBase::editMFProceduralVariableLocations(void)
406 editMField(ProceduralVariableLocationsFieldMask
, _mfProceduralVariableLocations
);
408 return &_mfProceduralVariableLocations
;
411 const MFInt32
*ComputeShaderChunkBase::getMFProceduralVariableLocations(void) const
413 return &_mfProceduralVariableLocations
;
417 SFUInt32
*ComputeShaderChunkBase::editSFGLId(void)
419 editSField(GLIdFieldMask
);
424 const SFUInt32
*ComputeShaderChunkBase::getSFGLId(void) const
432 void ComputeShaderChunkBase::addComputeShader(ShaderProgram
* const value
)
434 editMField(ComputeShaderFieldMask
, _mfComputeShader
);
436 _mfComputeShader
.push_back(value
);
439 void ComputeShaderChunkBase::assignComputeShader(const MFUnrecShaderProgramPtr
&value
)
441 MFUnrecShaderProgramPtr::const_iterator elemIt
=
443 MFUnrecShaderProgramPtr::const_iterator elemEnd
=
446 static_cast<ComputeShaderChunk
*>(this)->clearComputeShaders();
448 while(elemIt
!= elemEnd
)
450 this->addComputeShader(*elemIt
);
456 void ComputeShaderChunkBase::subComputeShader(UInt32 uiIndex
)
458 if(uiIndex
< _mfComputeShader
.size())
460 editMField(ComputeShaderFieldMask
, _mfComputeShader
);
462 _mfComputeShader
.erase(uiIndex
);
466 void ComputeShaderChunkBase::removeObjFromComputeShader(ShaderProgram
* const value
)
468 Int32 iElemIdx
= _mfComputeShader
.findIndex(value
);
472 editMField(ComputeShaderFieldMask
, _mfComputeShader
);
474 _mfComputeShader
.erase(iElemIdx
);
477 void ComputeShaderChunkBase::clearComputeShaders(void)
479 editMField(ComputeShaderFieldMask
, _mfComputeShader
);
482 _mfComputeShader
.clear();
487 /*------------------------------ access -----------------------------------*/
489 SizeT
ComputeShaderChunkBase::getBinSize(ConstFieldMaskArg whichField
)
491 SizeT returnValue
= Inherited::getBinSize(whichField
);
493 if(FieldBits::NoField
!= (ComputeShaderFieldMask
& whichField
))
495 returnValue
+= _mfComputeShader
.getBinSize();
497 if(FieldBits::NoField
!= (ComputeProgramFieldMask
& whichField
))
499 returnValue
+= _sfComputeProgram
.getBinSize();
501 if(FieldBits::NoField
!= (VariablesFieldMask
& whichField
))
503 returnValue
+= _sfVariables
.getBinSize();
505 if(FieldBits::NoField
!= (VariableLocationsFieldMask
& whichField
))
507 returnValue
+= _mfVariableLocations
.getBinSize();
509 if(FieldBits::NoField
!= (ProceduralVariableLocationsFieldMask
& whichField
))
511 returnValue
+= _mfProceduralVariableLocations
.getBinSize();
513 if(FieldBits::NoField
!= (GLIdFieldMask
& whichField
))
515 returnValue
+= _sfGLId
.getBinSize();
521 void ComputeShaderChunkBase::copyToBin(BinaryDataHandler
&pMem
,
522 ConstFieldMaskArg whichField
)
524 Inherited::copyToBin(pMem
, whichField
);
526 if(FieldBits::NoField
!= (ComputeShaderFieldMask
& whichField
))
528 _mfComputeShader
.copyToBin(pMem
);
530 if(FieldBits::NoField
!= (ComputeProgramFieldMask
& whichField
))
532 _sfComputeProgram
.copyToBin(pMem
);
534 if(FieldBits::NoField
!= (VariablesFieldMask
& whichField
))
536 _sfVariables
.copyToBin(pMem
);
538 if(FieldBits::NoField
!= (VariableLocationsFieldMask
& whichField
))
540 _mfVariableLocations
.copyToBin(pMem
);
542 if(FieldBits::NoField
!= (ProceduralVariableLocationsFieldMask
& whichField
))
544 _mfProceduralVariableLocations
.copyToBin(pMem
);
546 if(FieldBits::NoField
!= (GLIdFieldMask
& whichField
))
548 _sfGLId
.copyToBin(pMem
);
552 void ComputeShaderChunkBase::copyFromBin(BinaryDataHandler
&pMem
,
553 ConstFieldMaskArg whichField
)
555 Inherited::copyFromBin(pMem
, whichField
);
557 if(FieldBits::NoField
!= (ComputeShaderFieldMask
& whichField
))
559 editMField(ComputeShaderFieldMask
, _mfComputeShader
);
560 _mfComputeShader
.copyFromBin(pMem
);
562 if(FieldBits::NoField
!= (ComputeProgramFieldMask
& whichField
))
564 editSField(ComputeProgramFieldMask
);
565 _sfComputeProgram
.copyFromBin(pMem
);
567 if(FieldBits::NoField
!= (VariablesFieldMask
& whichField
))
569 editSField(VariablesFieldMask
);
570 _sfVariables
.copyFromBin(pMem
);
572 if(FieldBits::NoField
!= (VariableLocationsFieldMask
& whichField
))
574 editMField(VariableLocationsFieldMask
, _mfVariableLocations
);
575 _mfVariableLocations
.copyFromBin(pMem
);
577 if(FieldBits::NoField
!= (ProceduralVariableLocationsFieldMask
& whichField
))
579 editMField(ProceduralVariableLocationsFieldMask
, _mfProceduralVariableLocations
);
580 _mfProceduralVariableLocations
.copyFromBin(pMem
);
582 if(FieldBits::NoField
!= (GLIdFieldMask
& whichField
))
584 editSField(GLIdFieldMask
);
585 _sfGLId
.copyFromBin(pMem
);
589 //! create a new instance of the class
590 ComputeShaderChunkTransitPtr
ComputeShaderChunkBase::createLocal(BitVector bFlags
)
592 ComputeShaderChunkTransitPtr fc
;
594 if(getClassType().getPrototype() != NULL
)
596 FieldContainerTransitPtr tmpPtr
=
597 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
599 fc
= dynamic_pointer_cast
<ComputeShaderChunk
>(tmpPtr
);
605 //! create a new instance of the class, copy the container flags
606 ComputeShaderChunkTransitPtr
ComputeShaderChunkBase::createDependent(BitVector bFlags
)
608 ComputeShaderChunkTransitPtr fc
;
610 if(getClassType().getPrototype() != NULL
)
612 FieldContainerTransitPtr tmpPtr
=
613 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
615 fc
= dynamic_pointer_cast
<ComputeShaderChunk
>(tmpPtr
);
621 //! create a new instance of the class
622 ComputeShaderChunkTransitPtr
ComputeShaderChunkBase::create(void)
624 ComputeShaderChunkTransitPtr fc
;
626 if(getClassType().getPrototype() != NULL
)
628 FieldContainerTransitPtr tmpPtr
=
629 getClassType().getPrototype()-> shallowCopy();
631 fc
= dynamic_pointer_cast
<ComputeShaderChunk
>(tmpPtr
);
637 ComputeShaderChunk
*ComputeShaderChunkBase::createEmptyLocal(BitVector bFlags
)
639 ComputeShaderChunk
*returnValue
;
641 newPtr
<ComputeShaderChunk
>(returnValue
, bFlags
);
643 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
648 //! create an empty new instance of the class, do not copy the prototype
649 ComputeShaderChunk
*ComputeShaderChunkBase::createEmpty(void)
651 ComputeShaderChunk
*returnValue
;
653 newPtr
<ComputeShaderChunk
>(returnValue
, Thread::getCurrentLocalFlags());
655 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
656 ~Thread::getCurrentLocalFlags();
662 FieldContainerTransitPtr
ComputeShaderChunkBase::shallowCopyLocal(
663 BitVector bFlags
) const
665 ComputeShaderChunk
*tmpPtr
;
667 newPtr(tmpPtr
, dynamic_cast<const ComputeShaderChunk
*>(this), bFlags
);
669 FieldContainerTransitPtr
returnValue(tmpPtr
);
671 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
676 FieldContainerTransitPtr
ComputeShaderChunkBase::shallowCopyDependent(
677 BitVector bFlags
) const
679 ComputeShaderChunk
*tmpPtr
;
681 newPtr(tmpPtr
, dynamic_cast<const ComputeShaderChunk
*>(this), ~bFlags
);
683 FieldContainerTransitPtr
returnValue(tmpPtr
);
685 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
690 FieldContainerTransitPtr
ComputeShaderChunkBase::shallowCopy(void) const
692 ComputeShaderChunk
*tmpPtr
;
695 dynamic_cast<const ComputeShaderChunk
*>(this),
696 Thread::getCurrentLocalFlags());
698 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
700 FieldContainerTransitPtr
returnValue(tmpPtr
);
708 /*------------------------- constructors ----------------------------------*/
710 ComputeShaderChunkBase::ComputeShaderChunkBase(void) :
713 _sfComputeProgram (),
716 ShaderProgramVariables::ParentsFieldId
),
717 _mfVariableLocations (),
718 _mfProceduralVariableLocations(),
723 ComputeShaderChunkBase::ComputeShaderChunkBase(const ComputeShaderChunkBase
&source
) :
726 _sfComputeProgram (source
._sfComputeProgram
),
729 ShaderProgramVariables::ParentsFieldId
),
730 _mfVariableLocations (source
._mfVariableLocations
),
731 _mfProceduralVariableLocations(source
._mfProceduralVariableLocations
),
732 _sfGLId (source
._sfGLId
)
737 /*-------------------------- destructors ----------------------------------*/
739 ComputeShaderChunkBase::~ComputeShaderChunkBase(void)
743 /*-------------------------------------------------------------------------*/
746 bool ComputeShaderChunkBase::unlinkChild(
747 FieldContainer
* const pChild
,
748 UInt16
const childFieldId
)
750 if(childFieldId
== VariablesFieldId
)
752 ShaderProgramVariables
* pTypedChild
=
753 dynamic_cast<ShaderProgramVariables
*>(pChild
);
755 if(pTypedChild
!= NULL
)
757 if(_sfVariables
.getValue() == pTypedChild
)
759 editSField(VariablesFieldMask
);
761 _sfVariables
.setValue(NULL
);
766 SWARNING
<< "Parent ([" << this
767 << "] id [" << this->getId()
768 << "] type [" << this->getType().getCName()
769 << "] childFieldId [" << childFieldId
770 << "]) - Child ([" << pChild
771 << "] id [" << pChild
->getId()
772 << "] type [" << pChild
->getType().getCName()
773 << "]): link inconsistent!"
783 return Inherited::unlinkChild(pChild
, childFieldId
);
786 void ComputeShaderChunkBase::onCreate(const ComputeShaderChunk
*source
)
788 Inherited::onCreate(source
);
792 ComputeShaderChunk
*pThis
= static_cast<ComputeShaderChunk
*>(this);
794 MFUnrecShaderProgramPtr::const_iterator ComputeShaderIt
=
795 source
->_mfComputeShader
.begin();
796 MFUnrecShaderProgramPtr::const_iterator ComputeShaderEnd
=
797 source
->_mfComputeShader
.end ();
799 while(ComputeShaderIt
!= ComputeShaderEnd
)
801 pThis
->addComputeShader(*ComputeShaderIt
);
806 pThis
->setVariables(source
->getVariables());
810 GetFieldHandlePtr
ComputeShaderChunkBase::getHandleComputeShader (void) const
812 MFUnrecShaderProgramPtr::GetHandlePtr
returnValue(
813 new MFUnrecShaderProgramPtr::GetHandle(
815 this->getType().getFieldDesc(ComputeShaderFieldId
),
816 const_cast<ComputeShaderChunkBase
*>(this)));
821 EditFieldHandlePtr
ComputeShaderChunkBase::editHandleComputeShader (void)
823 MFUnrecShaderProgramPtr::EditHandlePtr
returnValue(
824 new MFUnrecShaderProgramPtr::EditHandle(
826 this->getType().getFieldDesc(ComputeShaderFieldId
),
829 returnValue
->setAddMethod(
830 boost::bind(&ComputeShaderChunk::addComputeShader
,
831 static_cast<ComputeShaderChunk
*>(this), _1
));
832 returnValue
->setRemoveMethod(
833 boost::bind(&ComputeShaderChunk::subComputeShader
,
834 static_cast<ComputeShaderChunk
*>(this), _1
));
835 returnValue
->setRemoveObjMethod(
836 boost::bind(&ComputeShaderChunk::removeObjFromComputeShader
,
837 static_cast<ComputeShaderChunk
*>(this), _1
));
838 returnValue
->setClearMethod(
839 boost::bind(&ComputeShaderChunk::clearComputeShaders
,
840 static_cast<ComputeShaderChunk
*>(this)));
842 editMField(ComputeShaderFieldMask
, _mfComputeShader
);
847 GetFieldHandlePtr
ComputeShaderChunkBase::getHandleComputeProgram (void) const
849 SFString::GetHandlePtr
returnValue(
850 new SFString::GetHandle(
852 this->getType().getFieldDesc(ComputeProgramFieldId
),
853 const_cast<ComputeShaderChunkBase
*>(this)));
858 EditFieldHandlePtr
ComputeShaderChunkBase::editHandleComputeProgram (void)
860 SFString::EditHandlePtr
returnValue(
861 new SFString::EditHandle(
863 this->getType().getFieldDesc(ComputeProgramFieldId
),
867 editSField(ComputeProgramFieldMask
);
872 GetFieldHandlePtr
ComputeShaderChunkBase::getHandleVariables (void) const
874 SFUnrecChildShaderProgramVariablesPtr::GetHandlePtr
returnValue(
875 new SFUnrecChildShaderProgramVariablesPtr::GetHandle(
877 this->getType().getFieldDesc(VariablesFieldId
),
878 const_cast<ComputeShaderChunkBase
*>(this)));
883 EditFieldHandlePtr
ComputeShaderChunkBase::editHandleVariables (void)
885 SFUnrecChildShaderProgramVariablesPtr::EditHandlePtr
returnValue(
886 new SFUnrecChildShaderProgramVariablesPtr::EditHandle(
888 this->getType().getFieldDesc(VariablesFieldId
),
891 returnValue
->setSetMethod(
892 boost::bind(&ComputeShaderChunk::setVariables
,
893 static_cast<ComputeShaderChunk
*>(this), _1
));
895 editSField(VariablesFieldMask
);
900 GetFieldHandlePtr
ComputeShaderChunkBase::getHandleVariableLocations (void) const
902 MFInt32::GetHandlePtr
returnValue(
903 new MFInt32::GetHandle(
904 &_mfVariableLocations
,
905 this->getType().getFieldDesc(VariableLocationsFieldId
),
906 const_cast<ComputeShaderChunkBase
*>(this)));
911 EditFieldHandlePtr
ComputeShaderChunkBase::editHandleVariableLocations(void)
913 MFInt32::EditHandlePtr
returnValue(
914 new MFInt32::EditHandle(
915 &_mfVariableLocations
,
916 this->getType().getFieldDesc(VariableLocationsFieldId
),
920 editMField(VariableLocationsFieldMask
, _mfVariableLocations
);
925 GetFieldHandlePtr
ComputeShaderChunkBase::getHandleProceduralVariableLocations (void) const
927 MFInt32::GetHandlePtr
returnValue(
928 new MFInt32::GetHandle(
929 &_mfProceduralVariableLocations
,
930 this->getType().getFieldDesc(ProceduralVariableLocationsFieldId
),
931 const_cast<ComputeShaderChunkBase
*>(this)));
936 EditFieldHandlePtr
ComputeShaderChunkBase::editHandleProceduralVariableLocations(void)
938 MFInt32::EditHandlePtr
returnValue(
939 new MFInt32::EditHandle(
940 &_mfProceduralVariableLocations
,
941 this->getType().getFieldDesc(ProceduralVariableLocationsFieldId
),
945 editMField(ProceduralVariableLocationsFieldMask
, _mfProceduralVariableLocations
);
950 GetFieldHandlePtr
ComputeShaderChunkBase::getHandleGLId (void) const
952 SFUInt32::GetHandlePtr
returnValue(
953 new SFUInt32::GetHandle(
955 this->getType().getFieldDesc(GLIdFieldId
),
956 const_cast<ComputeShaderChunkBase
*>(this)));
961 EditFieldHandlePtr
ComputeShaderChunkBase::editHandleGLId (void)
963 SFUInt32::EditHandlePtr
returnValue(
964 new SFUInt32::EditHandle(
966 this->getType().getFieldDesc(GLIdFieldId
),
970 editSField(GLIdFieldMask
);
976 #ifdef OSG_MT_CPTR_ASPECT
977 void ComputeShaderChunkBase::execSyncV( FieldContainer
&oFrom
,
978 ConstFieldMaskArg whichField
,
979 AspectOffsetStore
&oOffsets
,
980 ConstFieldMaskArg syncMode
,
981 const UInt32 uiSyncInfo
)
983 ComputeShaderChunk
*pThis
= static_cast<ComputeShaderChunk
*>(this);
985 pThis
->execSync(static_cast<ComputeShaderChunk
*>(&oFrom
),
994 #ifdef OSG_MT_CPTR_ASPECT
995 FieldContainer
*ComputeShaderChunkBase::createAspectCopy(
996 const FieldContainer
*pRefAspect
) const
998 ComputeShaderChunk
*returnValue
;
1000 newAspectCopy(returnValue
,
1001 dynamic_cast<const ComputeShaderChunk
*>(pRefAspect
),
1002 dynamic_cast<const ComputeShaderChunk
*>(this));
1008 void ComputeShaderChunkBase::resolveLinks(void)
1010 Inherited::resolveLinks();
1012 static_cast<ComputeShaderChunk
*>(this)->clearComputeShaders();
1014 static_cast<ComputeShaderChunk
*>(this)->setVariables(NULL
);
1016 #ifdef OSG_MT_CPTR_ASPECT
1017 AspectOffsetStore oOffsets
;
1019 _pAspectStore
->fillOffsetArray(oOffsets
, this);
1022 #ifdef OSG_MT_CPTR_ASPECT
1023 _mfVariableLocations
.terminateShare(Thread::getCurrentAspect(),
1026 #ifdef OSG_MT_CPTR_ASPECT
1027 _mfProceduralVariableLocations
.terminateShare(Thread::getCurrentAspect(),