1Name 2 3 ANGLE_d3d_texture_client_buffer 4 5Name Strings 6 7 EGL_ANGLE_d3d_texture_client_buffer 8 9Contributors 10 11 Geoff Lang 12 Olli Etuaho 13 Sunny Sachanandani 14 15Contacts 16 17 Geoff Lang, Google Inc. (geofflang 'at' google.com) 18 19Status 20 21 Draft 22 23Version 24 25 Version 11, August 23, 2022 26 27Number 28 29 EGL Extension #?? 30 31Dependencies 32 33 This extension is written against the wording of the EGL 1.2 34 Specification. 35 36 References the EGL_ANGLE_device_d3d and EGL_KHR_image_base extensions. 37 38Overview 39 40 This extension allows creating EGL surfaces and EGL images from D3D texture 41 objects. 42 43New Types 44 45 None 46 47New Procedures and Functions 48 49 None 50 51New Tokens 52 53 Accepted by the <target> parameter of eglCreateImageKHR and <buftype> 54 parameter of eglCreatePbufferFromClientBuffer: 55 56 EGL_D3D_TEXTURE_ANGLE 0x33A3 57 58Additions to Chapter 2 of the EGL 1.2 Specification (EGL Operation) 59 60 Add to section 2.5.1 "EGLImage Specification" (as defined by the 61 EGL_KHR_image_base specification), in the description of 62 eglCreateImageKHR: 63 64 "Values accepted for <target> are listed in Table aaa, below. 65 66 +----------------------------+-----------------------------------------+ 67 | <target> | Notes | 68 +----------------------------+-----------------------------------------+ 69 | EGL_D3D_TEXTURE_ANGLE | Used for Direct3D11 texture objects | 70 +----------------------------+-----------------------------------------+ 71 Table aaa. Legal values for eglCreateImageKHR <target> parameter 72 73 ... 74 75 If <target> is EGL_D3D_TEXTURE_ANGLE, <dpy> must be a valid display, <ctx> 76 must be EGL_NO_CONTEXT, <buffer> must be a pointer to a valid D3D11 texture 77 object (cast into the type EGLClientBuffer), and attributes other than 78 EGL_TEXTURE_INTERNAL_FORMAT_ANGLE, EGL_TEXTURE_OFFSET_X_ANGLE, or 79 EGL_TEXTURE_OFFSET_Y_ANGLE are ignored. The width and height of the pbuffer 80 are determined by the width and height of <buffer>. 81 82 If EGL_TEXTURE_INTERNAL_FORMAT_ANGLE is specified, it is used to interpret 83 <buffer> according to the provided internal format. See table 84 egl.restrictions for acceptable texture object types and formats. 85 86 If EGL_D3D11_TEXTURE_PLANE_ANGLE is specified, it is used to access the 87 specified plane of <buffer>. See table egl.restrictions for acceptable 88 values. 89 90 If EGL_D3D11_TEXTURE_ARRAY_SLICE_ANGLE is specified, it is used to access 91 the specified array slice of the texture array <buffer>. 92 93 If EGL_TEXTURE_OFFSET_X_ANGLE or EGL_TEXTURE_OFFSET_Y_ANGLE are specified, 94 they are used to offset all rendering into the surface including blits, 95 clears and draws. 96 97 If the EGL_ANGLE_device_d3d extension is present, the provided D3D11 texture 98 object must have been created by the same D3D11 device queried from the 99 display. If these requirements are not met, an EGL_BAD_PARAMETER error is 100 generated. 101 102 The image may later be used as a GL_TEXTURE_2D or GL_TEXTURE_EXTERNAL_OES 103 target sibling based on the availability of GL_OES_EGL_image and/or 104 GL_OES_EGL_image_external extensions." 105 106Additions to Chapter 3 of the EGL 1.2 Specification (EGL Functions and Errors) 107 108 Replace the last sentence of paragraph 1 of Section 3.5.3 with the 109 following text. 110 "Currently, the only client API resources which may be bound in this 111 fashion are OpenVG VGImage objects and Direct3D texture objects." 112 113 Replace the last sentence of paragraph 2 ("To bind a client API...") of 114 Section 3.5.3 with the following text. 115 "When <buftype> is EGL_OPENVG_IMAGE or EGL_D3D_TEXTURE_ANGLE, the width and 116 height of the pbuffer are determined by the width and height of <buffer>." 117 118 Replace the third paragraph of Section 3.5.3 with the following text. 119 "<buftype> specifies the type of buffer to be bound. The only allowed values 120 of <buftype> are EGL_OPENVG_IMAGE and EGL_D3D_TEXTURE_ANGLE". 121 122 Append the following text to the fourth paragraph of Section 3.5.3. 123 "When <buftype> is EGL_D3D_TEXTURE_ANGLE, <buffer> must be 124 a valid D3D texture object, cast into the type EGLClientBuffer. See table 125 egl.restrictions for acceptable texture object types and formats. If the 126 EGL_ANGLE_device_d3d extension is present, the provided D3D texture object 127 must have been created by the same D3D device queried from the display. 128 If these requirements are not met, an EGL_BAD_PARAMETER error is 129 generated." 130 131 --------------------------------------------------------------------------- 132 Resource Type Resource Restrictions 133 --------------------------------------------------------------------------- 134 IDirect3DTexture9 Memory pool must be D3DPOOL_DEFAULT. 135 136 Format must be D3DFMT_R8G8B8, D3DFMT_A8R8G8B8, 137 D3DFMT_A16B16G16R16F or D3DFMT_A32B32G32R32F. 138 139 EGL_TEXTURE_INTERNAL_FORMAT_ANGLE is not supported. 140 141 EGL_TEXTURE_OFFSET_X_ANGLE and EGL_TEXTURE_OFFSET_Y_ANGLE 142 are not supported. 143 144 ID3D11Texture2D Usage flags must be D3D11_USAGE_DEFAULT. 145 146 Format must be 147 DXGI_FORMAT_R8G8B8A8_UNORM, 148 DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, 149 DXGI_FORMAT_B8G8R8A8_UNORM, 150 DXGI_FORMAT_B8G8R8A8_UNORM_SRGB (support is optional), 151 DXGI_FORMAT_R8G8B8A8_TYPELESS (support is optional), 152 DXGI_FORMAT_B8G8R8A8_TYPELESS (support is optional), 153 DXGI_FORMAT_R16G16B16A16_FLOAT, 154 DXGI_FORMAT_R32G32B32A32_FLOAT, 155 DXGI_FORMAT_R10G10B10A2_UNORM, 156 DXGI_FORMAT_R8_UNORM, 157 DXGI_FORMAT_R16_UNORM, 158 DXGI_FORMAT_R8G8_UNORM, 159 DXGI_FORMAT_R16G16_UNORM, 160 DXGI_FORMAT_NV12, 161 DXGI_FORMAT_P010, or 162 DXGI_FORMAT_P016. 163 164 EGL_D3D11_TEXTURE_PLANE_ANGLE must be specified for YUV 165 formats DXGI_FORMAT_NV12, DXGI_FORMAT_P010, or 166 DXGI_FORMAT_P016, and must be 0 or 1. It is ignored for 167 all non-YUV formats. 168 169 EGL_TEXTURE_INTERNAL_FORMAT_ANGLE (if specified) must be 170 GL_RGBA (supported for all RGBA and BGRA formats), 171 GL_RGB (supported for all RGBA and BGRA formats except 172 DXGI_FORMAT_R10G10B10A2_UNORM), 173 GL_BGRA_EXT (supported only for 174 DXGI_FORMAT_B8G8R8A8_UNORM, 175 DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, and 176 DXGI_FORMAT_B8G8R8A8_TYPELESS), 177 GL_RGB10_A2_EXT (supported for 178 DXGI_FORMAT_R10G10B10A2_UNORM), 179 GL_RED_EXT (supported for DXGI_FORMAT_R8_UNORM 180 and DXGI_FORMAT_R16_UNORM), 181 GL_RG_EXT (supported for DXGI_FORMAT_R8G8_UNORM 182 and DXGI_FORMAT_R16G16_UNORM), 183 GL_R16_EXT (supported for DXGI_FORMAT_R16_UNORM), or 184 GL_RG16_EXT (supported for DXGI_FORMAT_R16G16_UNORM). 185 It is ignored for all YUV formats. 186 -------------------------------------------------------------------------- 187 Table egl.restrictions - Restrictions on D3D resources that can be used 188 as a <buffer>. 189 -------------------------------------------------------------------------- 190 191 Append to the fifth paragraph of Section 3.5.3. 192 "In addition, in case buftype is EGL_D3D_TEXTURE_ANGLE and the D3D resource 193 has a typeless DXGI format, attrib_list may contain the attribute 194 EGL_GL_COLORSPACE." 195 196 Append to the end of Section 3.5.3. 197 "When a pbuffer is created with type EGL_D3D_TEXTURE_ANGLE, the contents 198 of the associcated D3D texture object are undefined while the pbuffer is 199 the current read surface, draw surface or bound to a client texture." 200 201 Append to the end of Section 3.5.3. 202 "When a pbuffer is created with type EGL_D3D_TEXTURE_ANGLE, and the 203 EGL_GL_COLORSPACE attribute is not specified in attrib_list, the 204 EGL_GL_COLORSPACE attribute of the surface is determined by the DXGI format 205 of the Direct3D texture. For *_SRGB DXGI formats, the value of 206 EGL_GL_COLORSPACE is EGL_GL_COLORSPACE_SRGB. For other formats including 207 *_TYPELESS DXGI formats, the value of EGL_GL_COLORSPACE defaults to 208 EGL_GL_COLORSPACE_LINEAR." 209 210Issues 211 212 1. What renderers allow the use of a multi-sampled texture? 213 214 PROPOSED: Multi-sampled texture support is currently limited to D3D11. 215 Additionally, the client is responsible for resolving the texture. 216 217 2. How does this extension interact with EXT_sRGB_write_control? 218 219 If GL_FRAMEBUFFER_SRGB_EXT is disabled and a pbuffer created from a D3D 220 texture with an *_SRGB format is being rendered to, it is undefined whether 221 SRGB conversion will be performed. 222 223 3. What renderers allow the use of typeless textures? 224 225 PROPOSED: Support for typeless textures is currently limited to D3D11. 226 227 4. Can RGB formats be supported? 228 229 RESOLVED: RGB internal formats are supported for creating images from D3D11 230 textures in version 5 by setting EGL_TEXTURE_INTERNAL_FORMAT_ANGLE attribute 231 to GL_RGB. Images with an RGB format will ensure that the alpha channel of 232 the texture is reset to 1.0 when it is used. 233 234 5. What operations do the texture offsets affect? 235 236 RESOLVED: The texture offsets specified by EGL_TEXTURE_OFFSET_X_ANGLE and 237 EGL_TEXTURE_OFFSET_Y_ANGLE affect only rendering into the surface. 238 Specifically these affect the internal D3D viewport and scissor rect states 239 for draws, clears, and blits. This is needed to apply the update offset 240 returned by calling BeginDraw() on IDCompositionSurface, and is needed for 241 correct rendering in that case. 242 243Revision History 244 245 Version 11, 2022/08/23 - clarify that GL_TEXTURE_2D is also allowed. 246 247 Version 10, 2022/06/15 - removed non-negative offsets restriction. 248 249 Version 9, 2021/09/07 - added support for R/RG formats and GL_RGB10_A2_EXT. 250 251 Version 8, 2021/01/13 - added support for texture array. 252 253 Version 7, 2021/01/12 - added support for NV12/P010/P016 planar formats. 254 255 Version 6, 2020/05/12 - added support for specifying texture offsets. 256 257 Version 5, 2019/09/06 - added support for creating EGLImage. 258 259 Version 4, 2019/04/15 - added support for DXGI_FORMAT_R10G10B10A2_UNORM. 260 261 Version 3, 2018/01/23 - added support for typeless textures. 262 263 Version 2, 2018/01/15 - clarified SRGB conversion handling. 264 265 Version 1, 2016/10/05 - first draft. 266