xref: /aosp_15_r20/external/angle/src/libANGLE/renderer/gl/cgl/DeviceCGL.cpp (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1 //
2 // Copyright 2019 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 // DeviceCGL.cpp: CGL implementation of egl::Device
8 
9 #include "libANGLE/renderer/gl/cgl/DeviceCGL.h"
10 
11 #include <EGL/eglext.h>
12 #include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
13 
14 namespace rx
15 {
16 
DeviceCGL()17 DeviceCGL::DeviceCGL() {}
18 
~DeviceCGL()19 DeviceCGL::~DeviceCGL() {}
20 
initialize()21 egl::Error DeviceCGL::initialize()
22 {
23     return egl::NoError();
24 }
25 
getAttribute(const egl::Display * display,EGLint attribute,void ** outValue)26 egl::Error DeviceCGL::getAttribute(const egl::Display *display, EGLint attribute, void **outValue)
27 {
28     DisplayCGL *displayImpl = GetImplAs<DisplayCGL>(display);
29 
30     switch (attribute)
31     {
32         case EGL_CGL_CONTEXT_ANGLE:
33             *outValue = displayImpl->getCGLContext();
34             break;
35         case EGL_CGL_PIXEL_FORMAT_ANGLE:
36             *outValue = displayImpl->getCGLPixelFormat();
37             break;
38         default:
39             return egl::EglBadAttribute();
40     }
41 
42     return egl::NoError();
43 }
44 
generateExtensions(egl::DeviceExtensions * outExtensions) const45 void DeviceCGL::generateExtensions(egl::DeviceExtensions *outExtensions) const
46 {
47     outExtensions->deviceCGL = true;
48 }
49 
50 }  // namespace rx
51