• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 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/Display.h"
15 #include "libANGLE/Error.h"
16 
17 #include <memory>
18 
19 namespace rx
20 {
21 class DeviceImpl;
22 }  // namespace rx
23 
24 namespace egl
25 {
26 class Device final : public LabeledObject, angle::NonCopyable
27 {
28   public:
29     Device(Display *owningDisplay, rx::DeviceImpl *impl);
30     ~Device() override;
31 
32     void setLabel(EGLLabelKHR label) override;
33     EGLLabelKHR getLabel() const override;
34 
35     Error getAttribute(EGLint attribute, EGLAttrib *value);
getOwningDisplay()36     Display *getOwningDisplay() const { return mOwningDisplay; }
37     EGLint getType() const;
38 
39     const DeviceExtensions &getExtensions() const;
40     const std::string &getExtensionString() const;
41 
getImplementation()42     rx::DeviceImpl *getImplementation() { return mImplementation.get(); }
43 
44     static egl::Error CreateDevice(EGLint deviceType, void *nativeDevice, Device **outDevice);
45     static bool IsValidDevice(const Device *device);
46 
47   private:
48     void initDeviceExtensions();
49 
50     EGLLabelKHR mLabel;
51 
52     Display *mOwningDisplay;
53     std::unique_ptr<rx::DeviceImpl> mImplementation;
54 
55     DeviceExtensions mDeviceExtensions;
56     std::string mDeviceExtensionString;
57 };
58 }  // namespace egl
59 
60 #endif  // LIBANGLE_DEVICE_H_
61