2 * Copyright (C) 2011 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef _LIB_OPENGL_RENDER_THREAD_INFO_H
18 #define _LIB_OPENGL_RENDER_THREAD_INFO_H
20 #include "anbox/graphics/emugl/RenderContext.h"
21 #include "anbox/graphics/emugl/WindowSurface.h"
23 #include "external/android-emugl/host/libs/GLESv1_dec/GLESv1Decoder.h"
24 #include "external/android-emugl/host/libs/GLESv2_dec/GLESv2Decoder.h"
26 // Generated with emugl at build time
27 #include "renderControl_dec.h"
31 typedef uint32_t HandleType;
32 typedef std::set<HandleType> ThreadContextSet;
33 typedef std::set<HandleType> WindowSurfaceSet;
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
45 // Return the current thread's instance, if any, or NULL.
46 static RenderThreadInfo* get();
48 // Current EGL context, draw surface and read surface.
49 RenderContextPtr currContext;
50 WindowSurfacePtr currDrawSurf;
51 WindowSurfacePtr currReadSurf;
54 GLESv1Decoder m_glDec;
55 GLESv2Decoder m_gl2Dec;
56 renderControl_decoder_context_t m_rcDec;
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;