55 m_supportedApis( 0 ), |
55 m_supportedApis( 0 ), |
56 m_defaultDisplay( NULL ), |
56 m_defaultDisplay( NULL ), |
57 m_dummyWindow( NULL ) |
57 m_dummyWindow( NULL ) |
58 { |
58 { |
59 |
59 |
60 #if !defined(EGLI_USE_PLATSIM_EXTENSIONS) |
60 #if !defined(EGLI_USE_SIMULATOR_EXTENSIONS) |
61 CEGLProcess* p = EGLI_NEW CEGLProcess(0); |
61 CEGLProcess* p = EGLI_NEW CEGLProcess(0); |
62 EGLI_ASSERT( p != NULL ); |
62 EGLI_ASSERT( p != NULL ); |
63 AddObject<CEGLProcess>( m_processes, p ); |
63 AddObject<CEGLProcess>( m_processes, p ); |
64 m_currentProcess = p; |
64 m_currentProcess = p; |
65 #endif |
65 #endif |
72 DestroyPointerVector<CEGLConfig>( m_configs ); |
72 DestroyPointerVector<CEGLConfig>( m_configs ); |
73 if( m_VGLib ) EGLI_ASSERT( CEGLOs::FreeClientLibrary(m_VGLib) ); |
73 if( m_VGLib ) EGLI_ASSERT( CEGLOs::FreeClientLibrary(m_VGLib) ); |
74 if( m_GLES1Lib ) EGLI_ASSERT( CEGLOs::FreeClientLibrary(m_GLES1Lib) ); |
74 if( m_GLES1Lib ) EGLI_ASSERT( CEGLOs::FreeClientLibrary(m_GLES1Lib) ); |
75 if( m_GLES2Lib ) EGLI_ASSERT( CEGLOs::FreeClientLibrary(m_GLES2Lib) ); |
75 if( m_GLES2Lib ) EGLI_ASSERT( CEGLOs::FreeClientLibrary(m_GLES2Lib) ); |
76 #if defined(_WIN32) |
76 #if defined(_WIN32) |
77 # if !defined(EGLI_USE_PLATSIM_EXTENSIONS) |
77 # if !defined(EGLI_USE_SIMULATOR_EXTENSIONS) |
78 if( m_defaultDisplay ) |
78 if( m_defaultDisplay ) |
79 { |
79 { |
80 // \todo If at some point EGL_DEFAULT_DISPLAY is created |
80 // \todo If at some point EGL_DEFAULT_DISPLAY is created |
81 // with CreateDC() the DC needs to be released by |
81 // with CreateDC() the DC needs to be released by |
82 // calling DeleteDC(). |
82 // calling DeleteDC(). |
151 return m_initialized; |
151 return m_initialized; |
152 } |
152 } |
153 |
153 |
154 CEGLDisplay* CEGLState::AddDisplay( EGLINativeDisplayType nativeType, EGLint processId ) |
154 CEGLDisplay* CEGLState::AddDisplay( EGLINativeDisplayType nativeType, EGLint processId ) |
155 { |
155 { |
156 #if defined(EGLI_USE_PLATSIM_EXTENSIONS) |
156 #if defined(EGLI_USE_SIMULATOR_EXTENSIONS) |
157 CEGLDisplay* display = EGLI_NEW CEGLDisplay( nativeType, processId ); |
157 CEGLDisplay* display = EGLI_NEW CEGLDisplay( nativeType, processId ); |
158 #else |
158 #else |
159 CEGLDisplay* display = EGLI_NEW CEGLDisplay( nativeType, m_currentProcess->Id() ); |
159 CEGLDisplay* display = EGLI_NEW CEGLDisplay( nativeType, m_currentProcess->Id() ); |
160 #endif |
160 #endif |
161 if( display ) |
161 if( display ) |
175 CEGLDisplay* ret = NULL; |
175 CEGLDisplay* ret = NULL; |
176 for( std::vector<CEGLDisplay*>::const_iterator iter = m_displays.begin(); |
176 for( std::vector<CEGLDisplay*>::const_iterator iter = m_displays.begin(); |
177 iter != m_displays.end(); |
177 iter != m_displays.end(); |
178 iter++) |
178 iter++) |
179 { |
179 { |
180 #if defined(EGLI_USE_PLATSIM_EXTENSIONS) |
180 #if defined(EGLI_USE_SIMULATOR_EXTENSIONS) |
181 if( (*iter)->NativeType() == nativeType && (*iter)->ProcessId() == processId ) |
181 if( (*iter)->NativeType() == nativeType && (*iter)->ProcessId() == processId ) |
182 #else |
182 #else |
183 if( (*iter)->NativeType() == nativeType ) |
183 if( (*iter)->NativeType() == nativeType ) |
184 #endif |
184 #endif |
185 { |
185 { |
195 return FindObjectByPointer<CEGLDisplay>( m_displays, display, NULL); |
195 return FindObjectByPointer<CEGLDisplay>( m_displays, display, NULL); |
196 } |
196 } |
197 |
197 |
198 CEGLProcess* CEGLState::AddProcess( EGLint processId, bool setCurrent ) |
198 CEGLProcess* CEGLState::AddProcess( EGLint processId, bool setCurrent ) |
199 { |
199 { |
200 #if defined(EGLI_USE_PLATSIM_EXTENSIONS) |
200 #if defined(EGLI_USE_SIMULATOR_EXTENSIONS) |
201 CEGLProcess* process = EGLI_NEW CEGLProcess( processId ); |
201 CEGLProcess* process = EGLI_NEW CEGLProcess( processId ); |
202 if( process ) |
202 if( process ) |
203 { |
203 { |
204 AddObject<CEGLProcess>( m_processes, process ); |
204 AddObject<CEGLProcess>( m_processes, process ); |
205 if( setCurrent && process ) |
205 if( setCurrent && process ) |
214 #endif |
214 #endif |
215 } |
215 } |
216 |
216 |
217 void CEGLState::RemoveProcess( EGLint processId ) |
217 void CEGLState::RemoveProcess( EGLint processId ) |
218 { |
218 { |
219 #if defined(EGLI_USE_PLATSIM_EXTENSIONS) |
219 #if defined(EGLI_USE_SIMULATOR_EXTENSIONS) |
220 if( m_currentProcess && m_currentProcess->Id() == processId ) |
220 if( m_currentProcess && m_currentProcess->Id() == processId ) |
221 { |
221 { |
222 m_currentProcess = NULL; |
222 m_currentProcess = NULL; |
223 } |
223 } |
224 DeleteObjectById<CEGLProcess>( m_processes, processId ); |
224 DeleteObjectById<CEGLProcess>( m_processes, processId ); |
227 #endif |
227 #endif |
228 } |
228 } |
229 |
229 |
230 CEGLProcess* CEGLState::GetProcess( EGLint processId ) const |
230 CEGLProcess* CEGLState::GetProcess( EGLint processId ) const |
231 { |
231 { |
232 #if defined(EGLI_USE_PLATSIM_EXTENSIONS) |
232 #if defined(EGLI_USE_SIMULATOR_EXTENSIONS) |
233 return FindObjectById<CEGLProcess>( m_processes, processId, NULL ); |
233 return FindObjectById<CEGLProcess>( m_processes, processId, NULL ); |
234 #else |
234 #else |
235 return m_currentProcess; |
235 return m_currentProcess; |
236 #endif |
236 #endif |
237 } |
237 } |
238 |
238 |
239 void CEGLState::SetCurrentProcessThread( EGLint processId, EGLI_THREAD_ID threadId ) |
239 void CEGLState::SetCurrentProcessThread( EGLint processId, EGLI_THREAD_ID threadId ) |
240 { |
240 { |
241 #if defined(EGLI_USE_PLATSIM_EXTENSIONS) |
241 #if defined(EGLI_USE_SIMULATOR_EXTENSIONS) |
242 if( m_currentProcess && m_currentProcess->Id() == processId ) |
242 if( m_currentProcess && m_currentProcess->Id() == processId ) |
243 { |
243 { |
244 m_currentProcess->SetCurrentThread( threadId ); |
244 m_currentProcess->SetCurrentThread( threadId ); |
245 } |
245 } |
246 else |
246 else |
247 { |
247 { |
248 CEGLProcess* process = FindObjectById<CEGLProcess>( m_processes, processId, NULL); |
248 CEGLProcess* process = FindObjectById<CEGLProcess>( m_processes, processId, NULL); |
249 // processes are created in eglPlatsimSetProcessInformation() |
249 // processes are created in eglSimulatorSetProcessInformation() |
250 EGLI_ASSERT( process != NULL ); |
250 EGLI_ASSERT( process != NULL ); |
251 process->SetCurrentThread( threadId ); |
251 process->SetCurrentThread( threadId ); |
252 m_currentProcess = process; |
252 m_currentProcess = process; |
253 } |
253 } |
254 #else |
254 #else |