Hash :
4ac6ea2a
Author :
Date :
2020-07-18T21:05:37
Metal: implement ANGLE_device_metal extension. Allow user to query internal MTLDevice used by Metal back-end. Bug: angleproject:2634 Change-Id: I9b0a6eaad8c634069f43e47d5f4f88f61da35f74 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2757810 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
//
// Copyright 2021 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// DeviceMtl: Metal implementation of egl::Device
#include "libANGLE/renderer/metal/DeviceMtl.h"
#include "libANGLE/Device.h"
#include "libANGLE/Display.h"
#include "libANGLE/renderer/metal/DisplayMtl.h"
#include <EGL/eglext.h>
namespace rx
{
// DeviceMtl implementation, implements DeviceImpl
DeviceMtl::DeviceMtl() {}
DeviceMtl::~DeviceMtl() {}
egl::Error DeviceMtl::initialize()
{
return egl::NoError();
}
egl::Error DeviceMtl::getAttribute(const egl::Display *display, EGLint attribute, void **outValue)
{
DisplayMtl *displayImpl = mtl::GetImpl(display);
switch (attribute)
{
case EGL_METAL_DEVICE_ANGLE:
*outValue = displayImpl->getMetalDevice();
break;
default:
return egl::EglBadAttribute();
}
return egl::NoError();
}
EGLint DeviceMtl::getType()
{
return 0;
}
void DeviceMtl::generateExtensions(egl::DeviceExtensions *outExtensions) const
{
outExtensions->deviceMetal = true;
}
}