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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
//
// 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.
//
// ImageWgpu.h:
// Defines the class interface for ImageWgpu, implementing ImageImpl.
//
#ifndef LIBANGLE_RENDERER_WGPU_IMAGEWGPU_H_
#define LIBANGLE_RENDERER_WGPU_IMAGEWGPU_H_
#include "libANGLE/AttributeMap.h"
#include "libANGLE/renderer/ImageImpl.h"
#include "libANGLE/renderer/wgpu/wgpu_helpers.h"
namespace rx
{
class ExternalImageSiblingWgpu : public ExternalImageSiblingImpl
{
public:
ExternalImageSiblingWgpu() {}
~ExternalImageSiblingWgpu() override {}
virtual webgpu::ImageHelper *getImage() const = 0;
};
class WebGPUTextureImageSiblingWgpu : public ExternalImageSiblingWgpu
{
public:
WebGPUTextureImageSiblingWgpu(EGLClientBuffer buffer, const egl::AttributeMap &attribs);
~WebGPUTextureImageSiblingWgpu() override;
egl::Error initialize(const egl::Display *display) override;
void onDestroy(const egl::Display *display) override;
// ExternalImageSiblingImpl interface
gl::Format getFormat() const override;
bool isRenderable(const gl::Context *context) const override;
bool isTexturable(const gl::Context *context) const override;
bool isYUV() const override;
bool hasFrontBufferUsage() const override;
bool isCubeMap() const override;
bool hasProtectedContent() const override;
gl::Extents getSize() const override;
size_t getSamples() const override;
uint32_t getLevelCount() const override;
webgpu::ImageHelper *getImage() const override;
private:
angle::Result initializeImpl(const egl::Display *display);
EGLClientBuffer mBuffer = nullptr;
egl::AttributeMap mAttribs;
webgpu::ImageHelper mImage;
};
class ImageWgpu : public ImageImpl
{
public:
ImageWgpu(const egl::ImageState &state, const gl::Context *context);
~ImageWgpu() override;
egl::Error initialize(const egl::Display *display) override;
angle::Result orphan(const gl::Context *context, egl::ImageSibling *sibling) override;
webgpu::ImageHelper *getImage() const { return mImage; }
private:
bool mOwnsImage = false;
webgpu::ImageHelper *mImage = nullptr;
const gl::Context *mContext = nullptr;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_WGPU_IMAGEWGPU_H_