fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / Base / FieldContainer / Threading / OSGHardwareContext.h
blob8ceade7fb12f3a1d559a8d9be9ea8a1fc33627f7
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 _OSGHARDWARECONTEXT_H_
40 #define _OSGHARDWARECONTEXT_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGHardwareContextBase.h"
46 #include "OSGHardwareContextThread.h"
48 OSG_BEGIN_NAMESPACE
50 class HardwareTask;
51 class BlockingTask;
53 /*! \brief HardwareContext class. See \ref
54 PageBaseHardwareContext for a description.
56 \ingroup GrpBaseHardwareContext
57 \ingroup GrpLibOSGBase
58 \includebasedoc
62 class OSG_BASE_DLLMAPPING HardwareContext : public HardwareContextBase
64 protected:
66 /*========================== PUBLIC =================================*/
68 public:
70 typedef HardwareContextBase Inherited;
71 typedef HardwareContext Self;
73 enum InitState
75 OpenGLInitialized = 0x0001,
76 CudaInitialized = 0x0002,
77 OpenCLInitialized = 0x0004
80 enum OpenGLFeatures
82 HasAttribAliasing = 0x0001,
83 HasVAODListProblems = 0x0002
86 /*---------------------------------------------------------------------*/
87 /*! \name Sync */
88 /*! \{ */
90 virtual void changed(ConstFieldMaskArg whichField,
91 UInt32 origin,
92 BitVector details );
94 /*! \} */
95 /*---------------------------------------------------------------------*/
96 /*! \name Output */
97 /*! \{ */
99 virtual void dump( UInt32 uiIndent = 0,
100 const BitVector bvFlags = 0) const;
102 /*! \} */
103 /*---------------------------------------------------------------------*/
104 /*! \name Output */
105 /*! \{ */
107 virtual void submitTask (HardwareContextTask *pTask) = 0;
108 virtual void submitTaskAndWait(BlockingTask *pTask) = 0;
110 /*! \} */
111 /*---------------------------------------------------------------------*/
112 /*! \name Output */
113 /*! \{ */
115 void setCudaInit(void);
117 /*! \} */
118 /*---------------------------------------------------------------------*/
119 /*! \name Init */
120 /*! \{ */
122 UInt32 getOGLFeatures (void) const;
123 bool hasAttribAliasing (void) const;
124 bool hasVAODListProblems(void) const;
126 /*! \} */
127 /*========================= PROTECTED ===============================*/
129 protected:
131 // Variables should all be in HardwareContextBase.
133 HardwareContextThreadRefPtr _pContextThread;
134 UInt32 _uiInitState;
135 UInt32 _uiOGLFeatures;
137 /*---------------------------------------------------------------------*/
138 /*! \name Constructors */
139 /*! \{ */
141 HardwareContext(void);
142 HardwareContext(const HardwareContext &source);
144 /*! \} */
145 /*---------------------------------------------------------------------*/
146 /*! \name Destructors */
147 /*! \{ */
149 virtual ~HardwareContext(void);
151 /*! \} */
152 /*---------------------------------------------------------------------*/
153 /*! \name MT Construction */
154 /*! \{ */
156 void onCreate (const HardwareContext *source = NULL);
158 void onCreateAspect (const HardwareContext *createAspect,
159 const HardwareContext *source = NULL);
161 void onDestroy ( UInt32 uiContainerId);
163 void onDestroyAspect( UInt32 uiContainerId,
164 UInt32 uiAspect );
166 /*! \} */
167 /*---------------------------------------------------------------------*/
168 /*! \name Init */
169 /*! \{ */
171 void setOpenGLInit(void);
173 UInt32 getInitState (void) const;
175 /*! \} */
176 /*---------------------------------------------------------------------*/
177 /*! \name Init */
178 /*! \{ */
180 virtual void clearData(FieldContainer *pContainer,
181 ConstFieldMaskArg whichField,
182 Int32 iSlotId );
184 /*! \} */
185 /*---------------------------------------------------------------------*/
186 /*! \name Init */
187 /*! \{ */
189 static void initMethod(InitPhase ePhase);
191 /*! \} */
192 /*========================== PRIVATE ================================*/
194 private:
196 friend class FieldContainer;
197 friend class HardwareContextBase;
199 // prohibit default functions (move to 'public' if you need one)
200 void operator =(const HardwareContext &source);
203 typedef HardwareContext *HardwareContextP;
205 OSG_END_NAMESPACE
207 #include "OSGHardwareContextBase.inl"
208 #include "OSGHardwareContext.inl"
210 #endif /* _OSGHARDWARECONTEXT_H_ */