1 //
2 // Copyright 2018 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6
7 #include "libANGLE/renderer/gl/egl/RendererEGL.h"
8
9 #include "libANGLE/renderer/gl/egl/DisplayEGL.h"
10
11 namespace rx
12 {
13
RendererEGL(std::unique_ptr<FunctionsGL> functionsGL,const egl::AttributeMap & attribMap,DisplayEGL * display,EGLContext context,const native_egl::AttributeVector attribs,bool isExternalContext)14 RendererEGL::RendererEGL(std::unique_ptr<FunctionsGL> functionsGL,
15 const egl::AttributeMap &attribMap,
16 DisplayEGL *display,
17 EGLContext context,
18 const native_egl::AttributeVector attribs,
19 bool isExternalContext)
20 : RendererGL(std::move(functionsGL), attribMap, display),
21 mDisplay(display),
22 mContext(context),
23 mAttribs(attribs),
24 mIsExternalContext(isExternalContext)
25 {}
26
~RendererEGL()27 RendererEGL::~RendererEGL()
28 {
29 if (!mIsExternalContext)
30 {
31 mDisplay->destroyNativeContext(mContext);
32 mContext = nullptr;
33 }
34 }
35
getContext() const36 EGLContext RendererEGL::getContext() const
37 {
38 return mContext;
39 }
40
createWorkerContext(std::string * infoLog)41 WorkerContext *RendererEGL::createWorkerContext(std::string *infoLog)
42 {
43 return mDisplay->createWorkerContext(infoLog, mContext, mAttribs);
44 }
45
46 } // namespace rx
47