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
>(
226 reinterpret_cast<void *>(&ComputeShaderChunk::classDescInserter
)),
228 ComputeProgramFieldMask
,
229 "<?xml version=\"1.0\"?>\n"
232 " name=\"ComputeShaderChunk\"\n"
233 " parent=\"StateChunk\"\n"
234 " library=\"ContribComputeBase\"\n"
235 " pointerfieldtypes=\"both\"\n"
236 " structure=\"concrete\"\n"
237 " systemcomponent=\"true\"\n"
238 " parentsystemcomponent=\"true\"\n"
239 " decoratable=\"false\"\n"
240 " useLocalIncludes=\"false\"\n"
241 " fieldsUnmarkedOnCreate=\"ComputeProgramFieldMask\"\n"
242 " docGroupBase=\"GrpSystemShader\"\n"
245 "\t name=\"computeShader\"\n"
246 "\t type=\"ShaderProgram\"\n"
247 "\t cardinality=\"multi\"\n"
248 "\t visibility=\"external\"\n"
249 "\t access=\"public\"\n"
250 " category=\"pointer\"\n"
252 " pushToFieldAs=\"addComputeShader\"\n"
253 " removeFromMFieldIndexAs=\"subComputeShader\"\n"
254 " clearFieldAs=\"clearComputeShaders\" \n"
256 "\tfragment program object\n"
259 " name=\"computeProgram\"\n"
260 " type=\"std::string\"\n"
261 " cardinality=\"single\"\n"
262 " visibility=\"external\"\n"
263 " access=\"public\"\n"
265 "\tvertex program source\n"
269 " name=\"variables\"\n"
270 " type=\"ShaderProgramVariables\"\n"
271 " cardinality=\"single\"\n"
272 " visibility=\"external\"\n"
273 " access=\"public\"\n"
274 " category=\"childpointer\"\n"
275 " childParentType=\"FieldContainer\"\n"
276 " linkParentField=\"Parents\"\n"
278 "\tfragment program object\n"
281 " name=\"variableLocations\"\n"
283 " cardinality=\"multi\"\n"
284 " visibility=\"internal\"\n"
285 " access=\"protected\"\n"
287 "\tfragment program object\n"
290 " name=\"proceduralVariableLocations\"\n"
292 " cardinality=\"multi\"\n"
293 " visibility=\"internal\"\n"
294 " access=\"protected\"\n"
296 "\tfragment program object\n"
302 " cardinality=\"single\"\n"
303 " visibility=\"internal\"\n"
304 " access=\"public\"\n"
305 " defaultValue=\"0\"\n"
306 " fieldFlags=\"FClusterLocal\"\n"
310 "</FieldContainer>\n",
314 /*------------------------------ get -----------------------------------*/
316 FieldContainerType
&ComputeShaderChunkBase::getType(void)
321 const FieldContainerType
&ComputeShaderChunkBase::getType(void) const
326 UInt32
ComputeShaderChunkBase::getContainerSize(void) const
328 return sizeof(ComputeShaderChunk
);
331 /*------------------------- decorator get ------------------------------*/
334 //! Get the ComputeShaderChunk::_mfComputeShader field.
335 const MFUnrecShaderProgramPtr
*ComputeShaderChunkBase::getMFComputeShader(void) const
337 return &_mfComputeShader
;
340 MFUnrecShaderProgramPtr
*ComputeShaderChunkBase::editMFComputeShader (void)
342 editMField(ComputeShaderFieldMask
, _mfComputeShader
);
344 return &_mfComputeShader
;
346 ShaderProgram
* ComputeShaderChunkBase::getComputeShader(const UInt32 index
) const
348 return _mfComputeShader
[index
];
351 SFString
*ComputeShaderChunkBase::editSFComputeProgram(void)
353 editSField(ComputeProgramFieldMask
);
355 return &_sfComputeProgram
;
358 const SFString
*ComputeShaderChunkBase::getSFComputeProgram(void) const
360 return &_sfComputeProgram
;
364 //! Get the ComputeShaderChunk::_sfVariables field.
365 const SFUnrecChildShaderProgramVariablesPtr
*ComputeShaderChunkBase::getSFVariables(void) const
367 return &_sfVariables
;
370 SFUnrecChildShaderProgramVariablesPtr
*ComputeShaderChunkBase::editSFVariables (void)
372 editSField(VariablesFieldMask
);
374 return &_sfVariables
;
377 //! Get the value of the ComputeShaderChunk::_sfVariables field.
378 ShaderProgramVariables
* ComputeShaderChunkBase::getVariables(void) const
380 return _sfVariables
.getValue();
383 //! Set the value of the ComputeShaderChunk::_sfVariables field.
384 void ComputeShaderChunkBase::setVariables(ShaderProgramVariables
* const value
)
386 editSField(VariablesFieldMask
);
388 _sfVariables
.setValue(value
);
392 MFInt32
*ComputeShaderChunkBase::editMFVariableLocations(void)
394 editMField(VariableLocationsFieldMask
, _mfVariableLocations
);
396 return &_mfVariableLocations
;
399 const MFInt32
*ComputeShaderChunkBase::getMFVariableLocations(void) const
401 return &_mfVariableLocations
;
405 MFInt32
*ComputeShaderChunkBase::editMFProceduralVariableLocations(void)
407 editMField(ProceduralVariableLocationsFieldMask
, _mfProceduralVariableLocations
);
409 return &_mfProceduralVariableLocations
;
412 const MFInt32
*ComputeShaderChunkBase::getMFProceduralVariableLocations(void) const
414 return &_mfProceduralVariableLocations
;
418 SFUInt32
*ComputeShaderChunkBase::editSFGLId(void)
420 editSField(GLIdFieldMask
);
425 const SFUInt32
*ComputeShaderChunkBase::getSFGLId(void) const
433 void ComputeShaderChunkBase::addComputeShader(ShaderProgram
* const value
)
435 editMField(ComputeShaderFieldMask
, _mfComputeShader
);
437 _mfComputeShader
.push_back(value
);
440 void ComputeShaderChunkBase::assignComputeShader(const MFUnrecShaderProgramPtr
&value
)
442 MFUnrecShaderProgramPtr::const_iterator elemIt
=
444 MFUnrecShaderProgramPtr::const_iterator elemEnd
=
447 static_cast<ComputeShaderChunk
*>(this)->clearComputeShaders();
449 while(elemIt
!= elemEnd
)
451 this->addComputeShader(*elemIt
);
457 void ComputeShaderChunkBase::subComputeShader(UInt32 uiIndex
)
459 if(uiIndex
< _mfComputeShader
.size())
461 editMField(ComputeShaderFieldMask
, _mfComputeShader
);
463 _mfComputeShader
.erase(uiIndex
);
467 void ComputeShaderChunkBase::removeObjFromComputeShader(ShaderProgram
* const value
)
469 Int32 iElemIdx
= _mfComputeShader
.findIndex(value
);
473 editMField(ComputeShaderFieldMask
, _mfComputeShader
);
475 _mfComputeShader
.erase(iElemIdx
);
478 void ComputeShaderChunkBase::clearComputeShaders(void)
480 editMField(ComputeShaderFieldMask
, _mfComputeShader
);
483 _mfComputeShader
.clear();
488 /*------------------------------ access -----------------------------------*/
490 SizeT
ComputeShaderChunkBase::getBinSize(ConstFieldMaskArg whichField
)
492 SizeT returnValue
= Inherited::getBinSize(whichField
);
494 if(FieldBits::NoField
!= (ComputeShaderFieldMask
& whichField
))
496 returnValue
+= _mfComputeShader
.getBinSize();
498 if(FieldBits::NoField
!= (ComputeProgramFieldMask
& whichField
))
500 returnValue
+= _sfComputeProgram
.getBinSize();
502 if(FieldBits::NoField
!= (VariablesFieldMask
& whichField
))
504 returnValue
+= _sfVariables
.getBinSize();
506 if(FieldBits::NoField
!= (VariableLocationsFieldMask
& whichField
))
508 returnValue
+= _mfVariableLocations
.getBinSize();
510 if(FieldBits::NoField
!= (ProceduralVariableLocationsFieldMask
& whichField
))
512 returnValue
+= _mfProceduralVariableLocations
.getBinSize();
514 if(FieldBits::NoField
!= (GLIdFieldMask
& whichField
))
516 returnValue
+= _sfGLId
.getBinSize();
522 void ComputeShaderChunkBase::copyToBin(BinaryDataHandler
&pMem
,
523 ConstFieldMaskArg whichField
)
525 Inherited::copyToBin(pMem
, whichField
);
527 if(FieldBits::NoField
!= (ComputeShaderFieldMask
& whichField
))
529 _mfComputeShader
.copyToBin(pMem
);
531 if(FieldBits::NoField
!= (ComputeProgramFieldMask
& whichField
))
533 _sfComputeProgram
.copyToBin(pMem
);
535 if(FieldBits::NoField
!= (VariablesFieldMask
& whichField
))
537 _sfVariables
.copyToBin(pMem
);
539 if(FieldBits::NoField
!= (VariableLocationsFieldMask
& whichField
))
541 _mfVariableLocations
.copyToBin(pMem
);
543 if(FieldBits::NoField
!= (ProceduralVariableLocationsFieldMask
& whichField
))
545 _mfProceduralVariableLocations
.copyToBin(pMem
);
547 if(FieldBits::NoField
!= (GLIdFieldMask
& whichField
))
549 _sfGLId
.copyToBin(pMem
);
553 void ComputeShaderChunkBase::copyFromBin(BinaryDataHandler
&pMem
,
554 ConstFieldMaskArg whichField
)
556 Inherited::copyFromBin(pMem
, whichField
);
558 if(FieldBits::NoField
!= (ComputeShaderFieldMask
& whichField
))
560 editMField(ComputeShaderFieldMask
, _mfComputeShader
);
561 _mfComputeShader
.copyFromBin(pMem
);
563 if(FieldBits::NoField
!= (ComputeProgramFieldMask
& whichField
))
565 editSField(ComputeProgramFieldMask
);
566 _sfComputeProgram
.copyFromBin(pMem
);
568 if(FieldBits::NoField
!= (VariablesFieldMask
& whichField
))
570 editSField(VariablesFieldMask
);
571 _sfVariables
.copyFromBin(pMem
);
573 if(FieldBits::NoField
!= (VariableLocationsFieldMask
& whichField
))
575 editMField(VariableLocationsFieldMask
, _mfVariableLocations
);
576 _mfVariableLocations
.copyFromBin(pMem
);
578 if(FieldBits::NoField
!= (ProceduralVariableLocationsFieldMask
& whichField
))
580 editMField(ProceduralVariableLocationsFieldMask
, _mfProceduralVariableLocations
);
581 _mfProceduralVariableLocations
.copyFromBin(pMem
);
583 if(FieldBits::NoField
!= (GLIdFieldMask
& whichField
))
585 editSField(GLIdFieldMask
);
586 _sfGLId
.copyFromBin(pMem
);
590 //! create a new instance of the class
591 ComputeShaderChunkTransitPtr
ComputeShaderChunkBase::createLocal(BitVector bFlags
)
593 ComputeShaderChunkTransitPtr fc
;
595 if(getClassType().getPrototype() != NULL
)
597 FieldContainerTransitPtr tmpPtr
=
598 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
600 fc
= dynamic_pointer_cast
<ComputeShaderChunk
>(tmpPtr
);
606 //! create a new instance of the class, copy the container flags
607 ComputeShaderChunkTransitPtr
ComputeShaderChunkBase::createDependent(BitVector bFlags
)
609 ComputeShaderChunkTransitPtr fc
;
611 if(getClassType().getPrototype() != NULL
)
613 FieldContainerTransitPtr tmpPtr
=
614 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
616 fc
= dynamic_pointer_cast
<ComputeShaderChunk
>(tmpPtr
);
622 //! create a new instance of the class
623 ComputeShaderChunkTransitPtr
ComputeShaderChunkBase::create(void)
625 ComputeShaderChunkTransitPtr fc
;
627 if(getClassType().getPrototype() != NULL
)
629 FieldContainerTransitPtr tmpPtr
=
630 getClassType().getPrototype()-> shallowCopy();
632 fc
= dynamic_pointer_cast
<ComputeShaderChunk
>(tmpPtr
);
638 ComputeShaderChunk
*ComputeShaderChunkBase::createEmptyLocal(BitVector bFlags
)
640 ComputeShaderChunk
*returnValue
;
642 newPtr
<ComputeShaderChunk
>(returnValue
, bFlags
);
644 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
649 //! create an empty new instance of the class, do not copy the prototype
650 ComputeShaderChunk
*ComputeShaderChunkBase::createEmpty(void)
652 ComputeShaderChunk
*returnValue
;
654 newPtr
<ComputeShaderChunk
>(returnValue
, Thread::getCurrentLocalFlags());
656 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
657 ~Thread::getCurrentLocalFlags();
663 FieldContainerTransitPtr
ComputeShaderChunkBase::shallowCopyLocal(
664 BitVector bFlags
) const
666 ComputeShaderChunk
*tmpPtr
;
668 newPtr(tmpPtr
, dynamic_cast<const ComputeShaderChunk
*>(this), bFlags
);
670 FieldContainerTransitPtr
returnValue(tmpPtr
);
672 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
677 FieldContainerTransitPtr
ComputeShaderChunkBase::shallowCopyDependent(
678 BitVector bFlags
) const
680 ComputeShaderChunk
*tmpPtr
;
682 newPtr(tmpPtr
, dynamic_cast<const ComputeShaderChunk
*>(this), ~bFlags
);
684 FieldContainerTransitPtr
returnValue(tmpPtr
);
686 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
691 FieldContainerTransitPtr
ComputeShaderChunkBase::shallowCopy(void) const
693 ComputeShaderChunk
*tmpPtr
;
696 dynamic_cast<const ComputeShaderChunk
*>(this),
697 Thread::getCurrentLocalFlags());
699 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
701 FieldContainerTransitPtr
returnValue(tmpPtr
);
709 /*------------------------- constructors ----------------------------------*/
711 ComputeShaderChunkBase::ComputeShaderChunkBase(void) :
714 _sfComputeProgram (),
717 ShaderProgramVariables::ParentsFieldId
),
718 _mfVariableLocations (),
719 _mfProceduralVariableLocations(),
724 ComputeShaderChunkBase::ComputeShaderChunkBase(const ComputeShaderChunkBase
&source
) :
727 _sfComputeProgram (source
._sfComputeProgram
),
730 ShaderProgramVariables::ParentsFieldId
),
731 _mfVariableLocations (source
._mfVariableLocations
),
732 _mfProceduralVariableLocations(source
._mfProceduralVariableLocations
),
733 _sfGLId (source
._sfGLId
)
738 /*-------------------------- destructors ----------------------------------*/
740 ComputeShaderChunkBase::~ComputeShaderChunkBase(void)
744 /*-------------------------------------------------------------------------*/
747 bool ComputeShaderChunkBase::unlinkChild(
748 FieldContainer
* const pChild
,
749 UInt16
const childFieldId
)
751 if(childFieldId
== VariablesFieldId
)
753 ShaderProgramVariables
* pTypedChild
=
754 dynamic_cast<ShaderProgramVariables
*>(pChild
);
756 if(pTypedChild
!= NULL
)
758 if(_sfVariables
.getValue() == pTypedChild
)
760 editSField(VariablesFieldMask
);
762 _sfVariables
.setValue(NULL
);
767 SWARNING
<< "Parent ([" << this
768 << "] id [" << this->getId()
769 << "] type [" << this->getType().getCName()
770 << "] childFieldId [" << childFieldId
771 << "]) - Child ([" << pChild
772 << "] id [" << pChild
->getId()
773 << "] type [" << pChild
->getType().getCName()
774 << "]): link inconsistent!"
784 return Inherited::unlinkChild(pChild
, childFieldId
);
787 void ComputeShaderChunkBase::onCreate(const ComputeShaderChunk
*source
)
789 Inherited::onCreate(source
);
793 ComputeShaderChunk
*pThis
= static_cast<ComputeShaderChunk
*>(this);
795 MFUnrecShaderProgramPtr::const_iterator ComputeShaderIt
=
796 source
->_mfComputeShader
.begin();
797 MFUnrecShaderProgramPtr::const_iterator ComputeShaderEnd
=
798 source
->_mfComputeShader
.end ();
800 while(ComputeShaderIt
!= ComputeShaderEnd
)
802 pThis
->addComputeShader(*ComputeShaderIt
);
807 pThis
->setVariables(source
->getVariables());
811 GetFieldHandlePtr
ComputeShaderChunkBase::getHandleComputeShader (void) const
813 MFUnrecShaderProgramPtr::GetHandlePtr
returnValue(
814 new MFUnrecShaderProgramPtr::GetHandle(
816 this->getType().getFieldDesc(ComputeShaderFieldId
),
817 const_cast<ComputeShaderChunkBase
*>(this)));
822 EditFieldHandlePtr
ComputeShaderChunkBase::editHandleComputeShader (void)
824 MFUnrecShaderProgramPtr::EditHandlePtr
returnValue(
825 new MFUnrecShaderProgramPtr::EditHandle(
827 this->getType().getFieldDesc(ComputeShaderFieldId
),
830 returnValue
->setAddMethod(
831 boost::bind(&ComputeShaderChunk::addComputeShader
,
832 static_cast<ComputeShaderChunk
*>(this), _1
));
833 returnValue
->setRemoveMethod(
834 boost::bind(&ComputeShaderChunk::subComputeShader
,
835 static_cast<ComputeShaderChunk
*>(this), _1
));
836 returnValue
->setRemoveObjMethod(
837 boost::bind(&ComputeShaderChunk::removeObjFromComputeShader
,
838 static_cast<ComputeShaderChunk
*>(this), _1
));
839 returnValue
->setClearMethod(
840 boost::bind(&ComputeShaderChunk::clearComputeShaders
,
841 static_cast<ComputeShaderChunk
*>(this)));
843 editMField(ComputeShaderFieldMask
, _mfComputeShader
);
848 GetFieldHandlePtr
ComputeShaderChunkBase::getHandleComputeProgram (void) const
850 SFString::GetHandlePtr
returnValue(
851 new SFString::GetHandle(
853 this->getType().getFieldDesc(ComputeProgramFieldId
),
854 const_cast<ComputeShaderChunkBase
*>(this)));
859 EditFieldHandlePtr
ComputeShaderChunkBase::editHandleComputeProgram (void)
861 SFString::EditHandlePtr
returnValue(
862 new SFString::EditHandle(
864 this->getType().getFieldDesc(ComputeProgramFieldId
),
868 editSField(ComputeProgramFieldMask
);
873 GetFieldHandlePtr
ComputeShaderChunkBase::getHandleVariables (void) const
875 SFUnrecChildShaderProgramVariablesPtr::GetHandlePtr
returnValue(
876 new SFUnrecChildShaderProgramVariablesPtr::GetHandle(
878 this->getType().getFieldDesc(VariablesFieldId
),
879 const_cast<ComputeShaderChunkBase
*>(this)));
884 EditFieldHandlePtr
ComputeShaderChunkBase::editHandleVariables (void)
886 SFUnrecChildShaderProgramVariablesPtr::EditHandlePtr
returnValue(
887 new SFUnrecChildShaderProgramVariablesPtr::EditHandle(
889 this->getType().getFieldDesc(VariablesFieldId
),
892 returnValue
->setSetMethod(
893 boost::bind(&ComputeShaderChunk::setVariables
,
894 static_cast<ComputeShaderChunk
*>(this), _1
));
896 editSField(VariablesFieldMask
);
901 GetFieldHandlePtr
ComputeShaderChunkBase::getHandleVariableLocations (void) const
903 MFInt32::GetHandlePtr
returnValue(
904 new MFInt32::GetHandle(
905 &_mfVariableLocations
,
906 this->getType().getFieldDesc(VariableLocationsFieldId
),
907 const_cast<ComputeShaderChunkBase
*>(this)));
912 EditFieldHandlePtr
ComputeShaderChunkBase::editHandleVariableLocations(void)
914 MFInt32::EditHandlePtr
returnValue(
915 new MFInt32::EditHandle(
916 &_mfVariableLocations
,
917 this->getType().getFieldDesc(VariableLocationsFieldId
),
921 editMField(VariableLocationsFieldMask
, _mfVariableLocations
);
926 GetFieldHandlePtr
ComputeShaderChunkBase::getHandleProceduralVariableLocations (void) const
928 MFInt32::GetHandlePtr
returnValue(
929 new MFInt32::GetHandle(
930 &_mfProceduralVariableLocations
,
931 this->getType().getFieldDesc(ProceduralVariableLocationsFieldId
),
932 const_cast<ComputeShaderChunkBase
*>(this)));
937 EditFieldHandlePtr
ComputeShaderChunkBase::editHandleProceduralVariableLocations(void)
939 MFInt32::EditHandlePtr
returnValue(
940 new MFInt32::EditHandle(
941 &_mfProceduralVariableLocations
,
942 this->getType().getFieldDesc(ProceduralVariableLocationsFieldId
),
946 editMField(ProceduralVariableLocationsFieldMask
, _mfProceduralVariableLocations
);
951 GetFieldHandlePtr
ComputeShaderChunkBase::getHandleGLId (void) const
953 SFUInt32::GetHandlePtr
returnValue(
954 new SFUInt32::GetHandle(
956 this->getType().getFieldDesc(GLIdFieldId
),
957 const_cast<ComputeShaderChunkBase
*>(this)));
962 EditFieldHandlePtr
ComputeShaderChunkBase::editHandleGLId (void)
964 SFUInt32::EditHandlePtr
returnValue(
965 new SFUInt32::EditHandle(
967 this->getType().getFieldDesc(GLIdFieldId
),
971 editSField(GLIdFieldMask
);
977 #ifdef OSG_MT_CPTR_ASPECT
978 void ComputeShaderChunkBase::execSyncV( FieldContainer
&oFrom
,
979 ConstFieldMaskArg whichField
,
980 AspectOffsetStore
&oOffsets
,
981 ConstFieldMaskArg syncMode
,
982 const UInt32 uiSyncInfo
)
984 ComputeShaderChunk
*pThis
= static_cast<ComputeShaderChunk
*>(this);
986 pThis
->execSync(static_cast<ComputeShaderChunk
*>(&oFrom
),
995 #ifdef OSG_MT_CPTR_ASPECT
996 FieldContainer
*ComputeShaderChunkBase::createAspectCopy(
997 const FieldContainer
*pRefAspect
) const
999 ComputeShaderChunk
*returnValue
;
1001 newAspectCopy(returnValue
,
1002 dynamic_cast<const ComputeShaderChunk
*>(pRefAspect
),
1003 dynamic_cast<const ComputeShaderChunk
*>(this));
1009 void ComputeShaderChunkBase::resolveLinks(void)
1011 Inherited::resolveLinks();
1013 static_cast<ComputeShaderChunk
*>(this)->clearComputeShaders();
1015 static_cast<ComputeShaderChunk
*>(this)->setVariables(NULL
);
1017 #ifdef OSG_MT_CPTR_ASPECT
1018 AspectOffsetStore oOffsets
;
1020 _pAspectStore
->fillOffsetArray(oOffsets
, this);
1023 #ifdef OSG_MT_CPTR_ASPECT
1024 _mfVariableLocations
.terminateShare(Thread::getCurrentAspect(),
1027 #ifdef OSG_MT_CPTR_ASPECT
1028 _mfProceduralVariableLocations
.terminateShare(Thread::getCurrentAspect(),