75 ESurfaceTypePbuffer = 1, |
75 ESurfaceTypePbuffer = 1, |
76 ESurfaceTypePixmapFbsBitmap = 2, |
76 ESurfaceTypePixmapFbsBitmap = 2, |
77 ESurfaceTypePixmapSgImage = 3, |
77 ESurfaceTypePixmapSgImage = 3, |
78 } TEglSurfaceType; |
78 } TEglSurfaceType; |
79 |
79 |
80 #define KDefaultScreenNumber 0 |
|
81 |
80 |
82 class CEglContext; |
81 class CEglContext; |
83 |
82 |
84 // client side info about a surface |
83 // client side info about a surface |
85 struct TSurfaceInfo |
84 struct TSurfaceInfo |
124 RHashMap<TInt, TSurfaceInfo*> iSurfaceMap; |
123 RHashMap<TInt, TSurfaceInfo*> iSurfaceMap; |
125 //private: |
124 //private: |
126 // RMutex iContextMapLock; |
125 // RMutex iContextMapLock; |
127 RHashMap<EGLContext, CEglContext*> iContextMap; |
126 RHashMap<EGLContext, CEglContext*> iContextMap; |
128 }; |
127 }; |
|
128 |
|
129 // prototype to help eglGetProcAddress() API |
|
130 typedef void (*ProcPointer)(...); |
129 //============================================================================================== |
131 //============================================================================================== |
130 |
132 |
131 namespace OpenVGRI |
133 namespace OpenVGRI |
132 { |
134 { |
133 |
135 |
274 void* getOSWindowContext() const { return m_OSWindowContext; } |
276 void* getOSWindowContext() const { return m_OSWindowContext; } |
275 EGLConfig getConfig() const { return m_config; } |
277 EGLConfig getConfig() const { return m_config; } |
276 Drawable* getDrawable() const { return m_drawable; } |
278 Drawable* getDrawable() const { return m_drawable; } |
277 bool isLargestPbuffer() const { return m_largestPbuffer; } |
279 bool isLargestPbuffer() const { return m_largestPbuffer; } |
278 int getRenderBuffer() const { return m_renderBuffer; } |
280 int getRenderBuffer() const { return m_renderBuffer; } |
|
281 |
|
282 void Lock() {iSurfaceLock.ReadLock();} |
|
283 void Unlock() {iSurfaceLock.Unlock();} |
279 |
284 |
280 private: |
285 private: |
281 RIEGLSurface(const RIEGLSurface&); |
286 RIEGLSurface(const RIEGLSurface&); |
282 RIEGLSurface& operator=(const RIEGLSurface&); |
287 RIEGLSurface& operator=(const RIEGLSurface&); |
283 void* m_OSWindowContext; |
288 void* m_OSWindowContext; |
284 const EGLConfig m_config; |
289 const EGLConfig m_config; |
285 Drawable* m_drawable; |
290 Drawable* m_drawable; |
286 bool m_largestPbuffer; |
291 bool m_largestPbuffer; |
287 int m_renderBuffer; //EGL_BACK_BUFFER or EGL_SINGLE_BUFFER |
292 int m_renderBuffer; //EGL_BACK_BUFFER or EGL_SINGLE_BUFFER |
288 int m_referenceCount; |
293 int m_referenceCount; |
|
294 |
|
295 RReadWriteLock iSurfaceLock; // protects the surface for multi-threaded clients |
289 }; |
296 }; |
290 |
297 |
291 RIEGLSurface* CastToRIEGLSurface(EGLSurface aSurfaceId); |
298 RIEGLSurface* CastToRIEGLSurface(EGLSurface aSurfaceId); |
292 EGLSurface CastFromRIEGLSurface(RIEGLSurface* aSurface); |
299 EGLSurface CastFromRIEGLSurface(RIEGLSurface* aSurface); |
293 |
300 |
432 TBool EglInternalFunction_CallSetSurfaceParams(EGLDisplay aDisplay, EGLSurface aSurface,TSurfaceInfo& aSurfaceInfo); |
439 TBool EglInternalFunction_CallSetSurfaceParams(EGLDisplay aDisplay, EGLSurface aSurface,TSurfaceInfo& aSurfaceInfo); |
433 TBool EglInternalFunction_SwapBuffers(EGLDisplay aDisplay, EGLSurface aSurface); |
440 TBool EglInternalFunction_SwapBuffers(EGLDisplay aDisplay, EGLSurface aSurface); |
434 TSurfaceInfo* EglInternalFunction_GetPlatformSurface( EGLDisplay display, EGLSurface surface ); |
441 TSurfaceInfo* EglInternalFunction_GetPlatformSurface( EGLDisplay display, EGLSurface surface ); |
435 EGLBoolean EglInternalFunction_SurfaceResized(TSurfaceInfo&, int, int); |
442 EGLBoolean EglInternalFunction_SurfaceResized(TSurfaceInfo&, int, int); |
436 private: |
443 private: |
|
444 friend EGL* getEGL(); |
437 EGL(const EGL&); // Not allowed. |
445 EGL(const EGL&); // Not allowed. |
438 const EGL& operator=(const EGL&); // Not allowed. |
446 const EGL& operator=(const EGL&); // Not allowed. |
439 |
447 void Create(); |
|
448 |
440 Array<RIEGLThread*> m_threads; //threads that have called EGL |
449 Array<RIEGLThread*> m_threads; //threads that have called EGL |
441 Array<RIEGLThread*> m_currentThreads; //threads that have a bound context |
450 Array<RIEGLThread*> m_currentThreads; //threads that have a bound context |
442 Array<RIEGLDisplay*> m_displays; |
451 Array<RIEGLDisplay*> m_displays; |
443 |
452 |
444 int m_referenceCount; |
453 int m_referenceCount; |