Branch
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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
Name
ANGLE_webgpu_texture_client_buffer
Name Strings
EGL_ANGLE_webgpu_texture_client_buffer
Contributors
Geoff Lang
Contacts
Geoff Lang, Google Inc. (geofflang 'at' google.com)
Status
Draft
Version
Version 1, May 15, 2025
Number
EGL Extension #??
Dependencies
This extension is written against the wording of the EGL 1.2
Specification.
References the EGL_ANGLE_device_webgpu and EGL_KHR_image_base extensions.
Overview
This extension allows creating EGL surfaces and EGL images from D3D texture
objects.
New Types
None
New Procedures and Functions
None
New Tokens
Accepted by the <target> parameter of eglCreateImageKHR and <buftype>
parameter of eglCreatePbufferFromClientBuffer:
EGL_WEBGPU_TEXTURE_ANGLE 0x34F5
Accepted in the <attribute> parameter of eglCreateImageKHR and
eglCreatePbufferFromClientBuffer:
EGL_TEXTURE_TYPE_ANGLE 0x345C
EGL_TEXTURE_INTERNAL_FORMAT_ANGLE 0x345D
Additions to Chapter 2 of the EGL 1.2 Specification (EGL Operation)
Add to section 2.5.1 "EGLImage Specification" (as defined by the
EGL_KHR_image_base specification), in the description of
eglCreateImageKHR:
"Values accepted for <target> are listed in Table aaa, below.
+----------------------------+-----------------------------------------+
| <target> | Notes |
+----------------------------+-----------------------------------------+
| EGL_WEBGPU_TEXTURE_ANGLE | Used for WebGPU texture objects |
+----------------------------+-----------------------------------------+
Table aaa. Legal values for eglCreateImageKHR <target> parameter
...
If <target> is EGL_WEBGPU_TEXTURE_ANGLE, <dpy> must be a valid display, <ctx>
must be EGL_NO_CONTEXT, <buffer> must be a pointer to a valid WGPUTexture
handle (cast into the type EGLClientBuffer), and attributes other than
EGL_TEXTURE_INTERNAL_FORMAT_ANGLE or EGL_TEXTURE_TYPE_ANGLE are ignored.
The width and height of the pbuffer are determined by the width and height of
<buffer>.
If EGL_TEXTURE_INTERNAL_FORMAT_ANGLE and EGL_TEXTURE_TYPE_ANGLE is specified,
they are used to interpret <buffer> according to the provided internal format.
If EGL_TEXTURE_INTERNAL_FORMAT_ANGLE is a sized internal format,
EGL_TEXTURE_TYPE_ANGLE is not required. If either EGL_TEXTURE_INTERNAL_FORMAT_ANGLE
or EGL_TEXTURE_TYPE_ANGLE is provided and they are not a valid texture format
or the texture format is not a valid reinterpretation of the provided texture,
EGL_BAD_PARAMETER is generated.
If the EGL_ANGLE_device_webgpu extension is present, the provided WGPUTexture
handle must have been created by the same WGPUDevice queried from the
display. It is undefined behaviour to import a WGPUTexture created on a
different WGPUDevice.
The image may later be used as a GL_TEXTURE_2D or GL_TEXTURE_EXTERNAL_OES
target sibling based on the availability of GL_OES_EGL_image and/or
GL_OES_EGL_image_external extensions."
Additions to Chapter 3 of the EGL 1.2 Specification (EGL Functions and Errors)
Replace the last sentence of paragraph 1 of Section 3.5.3 with the
following text.
"Currently, the only client API resources which may be bound in this
fashion are OpenVG VGImage objects and Direct3D texture objects."
Replace the last sentence of paragraph 2 ("To bind a client API...") of
Section 3.5.3 with the following text.
"When <buftype> is EGL_OPENVG_IMAGE or EGL_WEBGPU_TEXTURE_ANGLE, the width and
height of the pbuffer are determined by the width and height of <buffer>."
Replace the third paragraph of Section 3.5.3 with the following text.
"<buftype> specifies the type of buffer to be bound. The only allowed values
of <buftype> are EGL_OPENVG_IMAGE and EGL_WEBGPU_TEXTURE_ANGLE".
Append the following text to the fourth paragraph of Section 3.5.3.
"When <buftype> is EGL_WEBGPU_TEXTURE_ANGLE, <buffer> must be
a valid D3D texture object, cast into the type EGLClientBuffer. If the
EGL_ANGLE_device_webgpu extension is present, the provided WGPUTexture handle
must have been created by the same WGPUDevice queried from the display.
It is undefined behaviour to import a WGPUTexture created on a
different WGPUDevice."
Append to the end of Section 3.5.3.
"When a pbuffer is created with type EGL_WEBGPU_TEXTURE_ANGLE, the contents
of the associated WGPUTexture are undefined while the pbuffer is
the current read surface, draw surface or bound to a client texture."
Issues
None
Revision History
Version 1, May 15, 2025 (Geoff Lang)
- Initial Draft