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 _LIBRENDER_RENDER_CONTEXT_H
18 #define _LIBRENDER_RENDER_CONTEXT_H
20 #include "external/android-emugl/shared/OpenglCodecCommon/GLDecoderContextData.h"
26 // A class used to model a guest EGLContext. This simply wraps a host
27 // EGLContext, associated with an GLDecoderContextData instance that is
28 // used to store copies of guest-side arrays.
31 // Create a new RenderContext instance.
32 // |display| is the host EGLDisplay handle.
33 // |config| is the host EGLConfig to use.
34 // |sharedContext| is either EGL_NO_CONTEXT of a host EGLContext handle.
35 // |isGl2| is true iff the new context will be used with GLESv2, or
37 static RenderContext* create(EGLDisplay display, EGLConfig config,
38 EGLContext sharedContext, bool isGL2 = false);
43 // Retrieve host EGLContext value.
44 EGLContext getEGLContext() const { return mContext; }
46 // Return true iff this is a GLESv2 context.
47 bool isGL2() const { return mIsGl2; }
49 // Retrieve GLDecoderContextData instance reference for this
50 // RenderContext instance.
51 GLDecoderContextData& decoderContextData() { return mContextData; }
56 RenderContext(EGLDisplay display, EGLContext context, bool isGl2);
62 GLDecoderContextData mContextData;
65 typedef std::shared_ptr<RenderContext> RenderContextPtr;
67 #endif // _LIBRENDER_RENDER_CONTEXT_H