forked from google/angle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EGL_ANGLE_d3d_texture_client_buffer.txt
265 lines (189 loc) · 10.8 KB
/
EGL_ANGLE_d3d_texture_client_buffer.txt
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
Name
ANGLE_d3d_texture_client_buffer
Name Strings
EGL_ANGLE_d3d_texture_client_buffer
Contributors
Geoff Lang
Olli Etuaho
Sunny Sachanandani
Contacts
Geoff Lang, Google Inc. (geofflang 'at' google.com)
Status
Draft
Version
Version 11, August 23, 2022
Number
EGL Extension #??
Dependencies
This extension is written against the wording of the EGL 1.2
Specification.
References the EGL_ANGLE_device_d3d 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_D3D_TEXTURE_ANGLE 0x33A3
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_D3D_TEXTURE_ANGLE | Used for Direct3D11 texture objects |
+----------------------------+-----------------------------------------+
Table aaa. Legal values for eglCreateImageKHR <target> parameter
...
If <target> is EGL_D3D_TEXTURE_ANGLE, <dpy> must be a valid display, <ctx>
must be EGL_NO_CONTEXT, <buffer> must be a pointer to a valid D3D11 texture
object (cast into the type EGLClientBuffer), and attributes other than
EGL_TEXTURE_INTERNAL_FORMAT_ANGLE, EGL_TEXTURE_OFFSET_X_ANGLE, or
EGL_TEXTURE_OFFSET_Y_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 is specified, it is used to interpret
<buffer> according to the provided internal format. See table
egl.restrictions for acceptable texture object types and formats.
If EGL_D3D11_TEXTURE_PLANE_ANGLE is specified, it is used to access the
specified plane of <buffer>. See table egl.restrictions for acceptable
values.
If EGL_D3D11_TEXTURE_ARRAY_SLICE_ANGLE is specified, it is used to access
the specified array slice of the texture array <buffer>.
If EGL_TEXTURE_OFFSET_X_ANGLE or EGL_TEXTURE_OFFSET_Y_ANGLE are specified,
they are used to offset all rendering into the surface including blits,
clears and draws.
If the EGL_ANGLE_device_d3d extension is present, the provided D3D11 texture
object must have been created by the same D3D11 device queried from the
display. If these requirements are not met, an EGL_BAD_PARAMETER error is
generated.
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_D3D_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_D3D_TEXTURE_ANGLE".
Append the following text to the fourth paragraph of Section 3.5.3.
"When <buftype> is EGL_D3D_TEXTURE_ANGLE, <buffer> must be
a valid D3D texture object, cast into the type EGLClientBuffer. See table
egl.restrictions for acceptable texture object types and formats. If the
EGL_ANGLE_device_d3d extension is present, the provided D3D texture object
must have been created by the same D3D device queried from the display.
If these requirements are not met, an EGL_BAD_PARAMETER error is
generated."
---------------------------------------------------------------------------
Resource Type Resource Restrictions
---------------------------------------------------------------------------
IDirect3DTexture9 Memory pool must be D3DPOOL_DEFAULT.
Format must be D3DFMT_R8G8B8, D3DFMT_A8R8G8B8,
D3DFMT_A16B16G16R16F or D3DFMT_A32B32G32R32F.
EGL_TEXTURE_INTERNAL_FORMAT_ANGLE is not supported.
EGL_TEXTURE_OFFSET_X_ANGLE and EGL_TEXTURE_OFFSET_Y_ANGLE
are not supported.
ID3D11Texture2D Usage flags must be D3D11_USAGE_DEFAULT.
Format must be
DXGI_FORMAT_R8G8B8A8_UNORM,
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
DXGI_FORMAT_B8G8R8A8_UNORM,
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB (support is optional),
DXGI_FORMAT_R8G8B8A8_TYPELESS (support is optional),
DXGI_FORMAT_B8G8R8A8_TYPELESS (support is optional),
DXGI_FORMAT_R16G16B16A16_FLOAT,
DXGI_FORMAT_R32G32B32A32_FLOAT,
DXGI_FORMAT_R10G10B10A2_UNORM,
DXGI_FORMAT_R8_UNORM,
DXGI_FORMAT_R16_UNORM,
DXGI_FORMAT_R8G8_UNORM,
DXGI_FORMAT_R16G16_UNORM,
DXGI_FORMAT_NV12,
DXGI_FORMAT_P010, or
DXGI_FORMAT_P016.
EGL_D3D11_TEXTURE_PLANE_ANGLE must be specified for YUV
formats DXGI_FORMAT_NV12, DXGI_FORMAT_P010, or
DXGI_FORMAT_P016, and must be 0 or 1. It is ignored for
all non-YUV formats.
EGL_TEXTURE_INTERNAL_FORMAT_ANGLE (if specified) must be
GL_RGBA (supported for all RGBA and BGRA formats),
GL_RGB (supported for all RGBA and BGRA formats except
DXGI_FORMAT_R10G10B10A2_UNORM),
GL_BGRA_EXT (supported only for
DXGI_FORMAT_B8G8R8A8_UNORM,
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, and
DXGI_FORMAT_B8G8R8A8_TYPELESS),
GL_RGB10_A2_EXT (supported for
DXGI_FORMAT_R10G10B10A2_UNORM),
GL_RED_EXT (supported for DXGI_FORMAT_R8_UNORM
and DXGI_FORMAT_R16_UNORM),
GL_RG_EXT (supported for DXGI_FORMAT_R8G8_UNORM
and DXGI_FORMAT_R16G16_UNORM),
GL_R16_EXT (supported for DXGI_FORMAT_R16_UNORM), or
GL_RG16_EXT (supported for DXGI_FORMAT_R16G16_UNORM).
It is ignored for all YUV formats.
--------------------------------------------------------------------------
Table egl.restrictions - Restrictions on D3D resources that can be used
as a <buffer>.
--------------------------------------------------------------------------
Append to the fifth paragraph of Section 3.5.3.
"In addition, in case buftype is EGL_D3D_TEXTURE_ANGLE and the D3D resource
has a typeless DXGI format, attrib_list may contain the attribute
EGL_GL_COLORSPACE."
Append to the end of Section 3.5.3.
"When a pbuffer is created with type EGL_D3D_TEXTURE_ANGLE, the contents
of the associcated D3D texture object are undefined while the pbuffer is
the current read surface, draw surface or bound to a client texture."
Append to the end of Section 3.5.3.
"When a pbuffer is created with type EGL_D3D_TEXTURE_ANGLE, and the
EGL_GL_COLORSPACE attribute is not specified in attrib_list, the
EGL_GL_COLORSPACE attribute of the surface is determined by the DXGI format
of the Direct3D texture. For *_SRGB DXGI formats, the value of
EGL_GL_COLORSPACE is EGL_GL_COLORSPACE_SRGB. For other formats including
*_TYPELESS DXGI formats, the value of EGL_GL_COLORSPACE defaults to
EGL_GL_COLORSPACE_LINEAR."
Issues
1. What renderers allow the use of a multi-sampled texture?
PROPOSED: Multi-sampled texture support is currently limited to D3D11.
Additionally, the client is responsible for resolving the texture.
2. How does this extension interact with EXT_sRGB_write_control?
If GL_FRAMEBUFFER_SRGB_EXT is disabled and a pbuffer created from a D3D
texture with an *_SRGB format is being rendered to, it is undefined whether
SRGB conversion will be performed.
3. What renderers allow the use of typeless textures?
PROPOSED: Support for typeless textures is currently limited to D3D11.
4. Can RGB formats be supported?
RESOLVED: RGB internal formats are supported for creating images from D3D11
textures in version 5 by setting EGL_TEXTURE_INTERNAL_FORMAT_ANGLE attribute
to GL_RGB. Images with an RGB format will ensure that the alpha channel of
the texture is reset to 1.0 when it is used.
5. What operations do the texture offsets affect?
RESOLVED: The texture offsets specified by EGL_TEXTURE_OFFSET_X_ANGLE and
EGL_TEXTURE_OFFSET_Y_ANGLE affect only rendering into the surface.
Specifically these affect the internal D3D viewport and scissor rect states
for draws, clears, and blits. This is needed to apply the update offset
returned by calling BeginDraw() on IDCompositionSurface, and is needed for
correct rendering in that case.
Revision History
Version 11, 2022/08/23 - clarify that GL_TEXTURE_2D is also allowed.
Version 10, 2022/06/15 - removed non-negative offsets restriction.
Version 9, 2021/09/07 - added support for R/RG formats and GL_RGB10_A2_EXT.
Version 8, 2021/01/13 - added support for texture array.
Version 7, 2021/01/12 - added support for NV12/P010/P016 planar formats.
Version 6, 2020/05/12 - added support for specifying texture offsets.
Version 5, 2019/09/06 - added support for creating EGLImage.
Version 4, 2019/04/15 - added support for DXGI_FORMAT_R10G10B10A2_UNORM.
Version 3, 2018/01/23 - added support for typeless textures.
Version 2, 2018/01/15 - clarified SRGB conversion handling.
Version 1, 2016/10/05 - first draft.