• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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}
27egl::Error DeviceMtl::getAttribute(const egl::Display *display, EGLint attribute, void **outValue)
28{
29    DisplayMtl *displayImpl = mtl::GetImpl(display);
30
31    switch (attribute)
32    {
33        case EGL_METAL_DEVICE_ANGLE:
34            *outValue = displayImpl->getMetalDevice();
35            break;
36        default:
37            return egl::EglBadAttribute();
38    }
39
40    return egl::NoError();
41}
42EGLint DeviceMtl::getType()
43{
44    return 0;
45}
46void DeviceMtl::generateExtensions(egl::DeviceExtensions *outExtensions) const
47{
48    outExtensions->deviceMetal = true;
49}
50
51}
52