1 // 2 // Copyright (c) 2015 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 // Device.h: Implements the egl::Device class, representing the abstract 8 // device. Implements EGLDevice. 9 10 #ifndef LIBANGLE_DEVICE_H_ 11 #define LIBANGLE_DEVICE_H_ 12 13 #include "common/angleutils.h" 14 #include "libANGLE/Error.h" 15 #include "libANGLE/Display.h" 16 17 namespace rx 18 { 19 class DeviceImpl; 20 } 21 22 namespace egl 23 { 24 class Device final : angle::NonCopyable 25 { 26 public: 27 virtual ~Device(); 28 29 Error getDevice(EGLAttrib *value); getOwningDisplay()30 Display *getOwningDisplay() { return mOwningDisplay; }; 31 EGLint getType(); 32 33 const DeviceExtensions &getExtensions() const; 34 const std::string &getExtensionString() const; 35 getImplementation()36 rx::DeviceImpl *getImplementation() { return mImplementation; } 37 38 static egl::Error CreateDevice(void *devicePointer, EGLint deviceType, Device **outDevice); 39 static egl::Error CreateDevice(Display *owningDisplay, 40 rx::DeviceImpl *impl, 41 Device **outDevice); 42 43 static bool IsValidDevice(Device *device); 44 45 private: 46 Device(Display *owningDisplay, rx::DeviceImpl *impl); 47 void initDeviceExtensions(); 48 49 Display *mOwningDisplay; 50 rx::DeviceImpl *mImplementation; 51 52 DeviceExtensions mDeviceExtensions; 53 std::string mDeviceExtensionString; 54 }; 55 56 } 57 58 #endif // LIBANGLE_DEVICE_H_ 59