xref: /aosp_15_r20/external/angle/src/libANGLE/renderer/metal/DeviceMtl.mm (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1//
2// Copyright 2021 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// DeviceMtl: Metal implementation of egl::Device
8
9#include "libANGLE/renderer/metal/DeviceMtl.h"
10
11#include "libANGLE/Device.h"
12#include "libANGLE/Display.h"
13#include "libANGLE/renderer/metal/DisplayMtl.h"
14
15#include <EGL/eglext.h>
16namespace rx
17{
18
19// DeviceMtl implementation, implements DeviceImpl
20DeviceMtl::DeviceMtl() {}
21DeviceMtl::~DeviceMtl() {}
22
23egl::Error DeviceMtl::initialize()
24{
25    return egl::NoError();
26}
27
28egl::Error DeviceMtl::getAttribute(const egl::Display *display, EGLint attribute, void **outValue)
29{
30    DisplayMtl *displayImpl = mtl::GetImpl(display);
31
32    switch (attribute)
33    {
34        case EGL_METAL_DEVICE_ANGLE:
35            *outValue = displayImpl->getMetalDevice();
36            break;
37        default:
38            return egl::EglBadAttribute();
39    }
40
41    return egl::NoError();
42}
43
44void DeviceMtl::generateExtensions(egl::DeviceExtensions *outExtensions) const
45{
46    outExtensions->deviceMetal = true;
47}
48
49}  // namespace rx
50