|
1 /* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
2 * |
|
3 * Permission is hereby granted, free of charge, to any person obtaining a |
|
4 * copy of this software and /or associated documentation files |
|
5 * (the "Materials "), to deal in the Materials without restriction, |
|
6 * including without limitation the rights to use, copy, modify, merge, |
|
7 * publish, distribute, sublicense, and/or sell copies of the Materials, |
|
8 * and to permit persons to whom the Materials are furnished to do so, |
|
9 * subject to the following conditions: |
|
10 * |
|
11 * The above copyright notice and this permission notice shall be included |
|
12 * in all copies or substantial portions of the Materials. |
|
13 * |
|
14 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|
15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|
17 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
|
18 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
|
19 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR |
|
20 * THE USE OR OTHER DEALINGS IN THE MATERIALS. |
|
21 * |
|
22 * Initial Contributors: |
|
23 * Nokia Corporation - initial contribution. |
|
24 * |
|
25 * Contributors: |
|
26 * |
|
27 * Description: |
|
28 * |
|
29 */ |
|
30 |
|
31 #ifndef _EGLTHREAD_H_ |
|
32 #define _EGLTHREAD_H_ |
|
33 |
|
34 #include <EGL/egl.h> |
|
35 #include "eglInternal.h" |
|
36 |
|
37 class CEGLSurface; |
|
38 class CEGLContext; |
|
39 |
|
40 class CEGLThread |
|
41 { |
|
42 public: |
|
43 CEGLThread( EGLI_THREAD_ID threadId, EGLint supportedApis ); |
|
44 ~CEGLThread(void); |
|
45 |
|
46 public: |
|
47 inline EGLI_THREAD_ID Id() const { return m_id; } |
|
48 void SetError( EGLint error ) { m_lastError = error; } |
|
49 inline EGLint Error() const { return m_lastError; } |
|
50 |
|
51 inline void SetApi( EGLint api ) { m_currentApi = api; } |
|
52 inline EGLenum CurrentApi() const { return m_currentApi; } |
|
53 bool IsSupportedApi( EGLenum api ) const; |
|
54 |
|
55 CEGLContext* SwitchVGContext( CEGLContext* vgContext ); |
|
56 inline CEGLContext* CurrentVGContext() const { return m_currentVGContext; } |
|
57 CEGLSurface* SwitchVGSurface( CEGLSurface* vgSurface ); |
|
58 inline CEGLSurface* CurrentVGSurface() const { return m_currentVGSurface; } |
|
59 |
|
60 CEGLContext* SwitchGLESContext( CEGLContext* glesContext ); |
|
61 inline CEGLContext* CurrentGLESContext() const { return m_currentGLESContext; } |
|
62 void SwitchGLESSurfaces( CEGLSurface* read, CEGLSurface* draw, CEGLSurface*& previousRead, CEGLSurface*& previousDraw ); |
|
63 void CurrentGLESSurfaces( CEGLSurface** read, CEGLSurface** draw ) const; |
|
64 |
|
65 private: |
|
66 EGLI_THREAD_ID m_id; |
|
67 CEGLContext* m_currentVGContext; |
|
68 CEGLSurface* m_currentVGSurface; |
|
69 CEGLContext* m_currentGLESContext; |
|
70 CEGLSurface* m_currentGLESReadSurface; |
|
71 CEGLSurface* m_currentGLESDrawSurface; |
|
72 EGLenum m_currentApi; |
|
73 EGLint m_lastError; |
|
74 // Copy of CEGLState::m_supportedApis so we don't need to access state |
|
75 // on thread specific API calls. |
|
76 EGLint m_supportedApis; |
|
77 }; |
|
78 #endif //_EGLTHREAD_H_ |