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/wgl/RendererWGL.h"
8
9 #include "libANGLE/renderer/gl/wgl/DisplayWGL.h"
10
11 namespace rx
12 {
13
RendererWGL(std::unique_ptr<FunctionsGL> functionsGL,const egl::AttributeMap & attribMap,DisplayWGL * display,HGLRC context,HGLRC sharedContext,const std::vector<int> workerContextAttribs)14 RendererWGL::RendererWGL(std::unique_ptr<FunctionsGL> functionsGL,
15 const egl::AttributeMap &attribMap,
16 DisplayWGL *display,
17 HGLRC context,
18 HGLRC sharedContext,
19 const std::vector<int> workerContextAttribs)
20 : RendererGL(std::move(functionsGL), attribMap, display),
21 mDisplay(display),
22 mContext(context),
23 mSharedContext(sharedContext),
24 mWorkerContextAttribs(workerContextAttribs)
25 {}
26
~RendererWGL()27 RendererWGL::~RendererWGL()
28 {
29 if (mSharedContext != nullptr)
30 {
31 mDisplay->destroyNativeContext(mSharedContext);
32 }
33 mDisplay->destroyNativeContext(mContext);
34 mContext = nullptr;
35 }
36
getContext() const37 HGLRC RendererWGL::getContext() const
38 {
39 return mContext;
40 }
41
createWorkerContext(std::string * infoLog)42 WorkerContext *RendererWGL::createWorkerContext(std::string *infoLog)
43 {
44 return mDisplay->createWorkerContext(infoLog, mSharedContext, mWorkerContextAttribs);
45 }
46
47 } // namespace rx
48