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 "common/platform.h" 10 11 #if defined(ANGLE_PLATFORM_MACOS) || defined(ANGLE_PLATFORM_MACCATALYST) 12 13 # include "libANGLE/renderer/gl/cgl/DeviceCGL.h" 14 15 # include <EGL/eglext.h> 16 # include "libANGLE/renderer/gl/cgl/DisplayCGL.h" 17 18 namespace rx 19 { 20 DeviceCGL()21DeviceCGL::DeviceCGL() {} 22 ~DeviceCGL()23DeviceCGL::~DeviceCGL() {} 24 initialize()25egl::Error DeviceCGL::initialize() 26 { 27 return egl::NoError(); 28 } 29 getAttribute(const egl::Display * display,EGLint attribute,void ** outValue)30egl::Error DeviceCGL::getAttribute(const egl::Display *display, EGLint attribute, void **outValue) 31 { 32 DisplayCGL *displayImpl = GetImplAs<DisplayCGL>(display); 33 34 switch (attribute) 35 { 36 case EGL_CGL_CONTEXT_ANGLE: 37 *outValue = displayImpl->getCGLContext(); 38 break; 39 case EGL_CGL_PIXEL_FORMAT_ANGLE: 40 *outValue = displayImpl->getCGLPixelFormat(); 41 break; 42 default: 43 return egl::EglBadAttribute(); 44 } 45 46 return egl::NoError(); 47 } 48 getType()49EGLint DeviceCGL::getType() 50 { 51 return 0; 52 } 53 generateExtensions(egl::DeviceExtensions * outExtensions) const54void DeviceCGL::generateExtensions(egl::DeviceExtensions *outExtensions) const 55 { 56 outExtensions->deviceCGL = true; 57 } 58 59 } // namespace rx 60 61 #endif // defined(ANGLE_PLATFORM_MACOS) || defined(ANGLE_PLATFORM_MACCATALYST) 62