TYPE3
[iec.git] / src / type3_AndroidCloud / anbox-master / src / anbox / graphics / emugl / RenderThreadInfo.h
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
17 #ifndef _LIB_OPENGL_RENDER_THREAD_INFO_H
18 #define _LIB_OPENGL_RENDER_THREAD_INFO_H
19
20 #include "anbox/graphics/emugl/RenderContext.h"
21 #include "anbox/graphics/emugl/WindowSurface.h"
22
23 #include "external/android-emugl/host/libs/GLESv1_dec/GLESv1Decoder.h"
24 #include "external/android-emugl/host/libs/GLESv2_dec/GLESv2Decoder.h"
25
26 // Generated with emugl at build time
27 #include "renderControl_dec.h"
28
29 #include <set>
30
31 typedef uint32_t HandleType;
32 typedef std::set<HandleType> ThreadContextSet;
33 typedef std::set<HandleType> WindowSurfaceSet;
34
35 // A class used to model the state of each RenderThread related
36 struct RenderThreadInfo {
37   // Create new instance. Only call this once per thread.
38   // Future callls to get() will return this instance until
39   // it is destroyed.
40   RenderThreadInfo();
41
42   // Destructor.
43   ~RenderThreadInfo();
44
45   // Return the current thread's instance, if any, or NULL.
46   static RenderThreadInfo* get();
47
48   // Current EGL context, draw surface and read surface.
49   RenderContextPtr currContext;
50   WindowSurfacePtr currDrawSurf;
51   WindowSurfacePtr currReadSurf;
52
53   // Decoder states.
54   GLESv1Decoder m_glDec;
55   GLESv2Decoder m_gl2Dec;
56   renderControl_decoder_context_t m_rcDec;
57
58   // all the contexts that are created by this render thread
59   ThreadContextSet m_contextSet;
60   // all the window surfaces that are created by this render thread
61   WindowSurfaceSet m_windowSet;
62 };
63
64 #endif