xref: /aosp_15_r20/external/angle/src/libANGLE/renderer/gl/egl/RendererEGL.cpp (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
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,bool isExternalContext)14 RendererEGL::RendererEGL(std::unique_ptr<FunctionsGL> functionsGL,
15                          const egl::AttributeMap &attribMap,
16                          DisplayEGL *display,
17                          EGLContext context,
18                          bool isExternalContext)
19     : RendererGL(std::move(functionsGL), attribMap, display),
20       mDisplay(display),
21       mContext(context),
22       mIsExternalContext(isExternalContext)
23 {}
24 
~RendererEGL()25 RendererEGL::~RendererEGL()
26 {
27     if (!mIsExternalContext)
28     {
29         mDisplay->destroyNativeContext(mContext);
30         mContext = nullptr;
31     }
32 }
33 
getContext() const34 EGLContext RendererEGL::getContext() const
35 {
36     return mContext;
37 }
38 
39 }  // namespace rx
40