Hash :
3cf7a604
Author :
Date :
2025-05-17T19:39:08
WebGPU: Add extensions for importing external textures Add EGL_ANGLE_device_webgpu which exposes the adapter and device used by ANGLE internally. Add EGL_ANGLE_webgpu_texture_client_buffer which allows importing external WGPUTexture handles if they share the same device as ANGLE (queried from EGL_ANGLE_device_webgpu). Bug: angleproject:418022112 Change-Id: I0683d36b84a0f8e0e9b68a5ec0d3aa8b7a95152c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6553063 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Geoff Lang <geofflang@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 52 53 54 55 56 57 58 59 60 61
//
// Copyright 2024 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.
//
// DeviceWgpu.cpp:
// Implements the class methods for DeviceWgpu.
//
#include "libANGLE/renderer/wgpu/DeviceWgpu.h"
#include "common/debug.h"
#include "libANGLE/Display.h"
#include "libANGLE/renderer/wgpu/DisplayWgpu.h"
namespace rx
{
DeviceWgpu::DeviceWgpu() : DeviceImpl() {}
DeviceWgpu::~DeviceWgpu() {}
egl::Error DeviceWgpu::initialize()
{
return egl::NoError();
}
egl::Error DeviceWgpu::getAttribute(const egl::Display *display, EGLint attribute, void **outValue)
{
DisplayWgpu *displayWgpu = webgpu::GetImpl(display);
const DawnProcTable *wgpu = displayWgpu->getProcs();
switch (attribute)
{
case EGL_WEBGPU_DEVICE_ANGLE:
{
webgpu::DeviceHandle device = displayWgpu->getDevice();
wgpu->deviceAddRef(device.get());
*outValue = device.get();
break;
}
case EGL_WEBGPU_ADAPTER_ANGLE:
{
webgpu::AdapterHandle adapater = displayWgpu->getAdapter();
wgpu->adapterAddRef(adapater.get());
*outValue = adapater.get();
break;
}
default:
return egl::Error(EGL_BAD_ATTRIBUTE);
}
return egl::NoError();
}
void DeviceWgpu::generateExtensions(egl::DeviceExtensions *outExtensions) const
{
outExtensions->deviceWebGPU = true;
}
} // namespace rx