• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 #ifndef EGL_CONTEXT_H
17 #define EGL_CONTEXT_H
18 
19 #include <map>
20 #include <EGL/egl.h>
21 #include <GLcommon/GLutils.h>
22 #include <GLcommon/SmartPtr.h>
23 #include <GLcommon/TranslatorIfaces.h>
24 #include <GLcommon/objectNameManager.h>
25 
26 
27 #include "EglConfig.h"
28 #include "EglSurface.h"
29 
30 
31 
32 class EglContext;
33 typedef  SmartPtr<EglContext> ContextPtr;
34 
35 class EglDisplay;
36 
37 class EglContext {
38 
39 public:
40 
41     EglContext(EglDisplay *dpy, EGLNativeContextType context,ContextPtr shared_context,EglConfig* config,GLEScontext* glesCtx,GLESVersion ver,ObjectNameManager* mngr);
42     bool usingSurface(SurfacePtr surface);
nativeType()43     EGLNativeContextType nativeType(){return m_native;};
44     bool getAttrib(EGLint attrib,EGLint* value);
read()45     SurfacePtr read(){ return m_read;};
draw()46     SurfacePtr draw(){ return m_draw;};
getShareGroup()47     ShareGroupPtr getShareGroup(){return m_shareGroup;}
getConfig()48     EglConfig* getConfig(){ return m_config;};
version()49     GLESVersion version(){return m_version;};
getGlesContext()50     GLEScontext* getGlesContext(){return m_glesContext;}
51     void setSurfaces(SurfacePtr read,SurfacePtr draw);
getHndl()52     unsigned int getHndl(){return m_hndl;}
53     bool attachImage(unsigned int imageId,ImagePtr img);
54     void detachImage(unsigned int imageId);
55 
56     ~EglContext();
57 
58 private:
59     static unsigned int  s_nextContextHndl;
60     EglDisplay          *m_dpy;
61     EGLNativeContextType m_native;
62     EglConfig*           m_config;
63     GLEScontext*         m_glesContext;
64     ShareGroupPtr        m_shareGroup;
65     SurfacePtr           m_read;
66     SurfacePtr           m_draw;
67     GLESVersion          m_version;
68     ObjectNameManager    *m_mngr;
69     unsigned int         m_hndl;
70     ImagesHndlMap        m_attachedImages;
71 };
72 
73 #endif
74