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 6, May 12, 2020 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 must be non-negative and are used to offset all rendering into the 95 surface including blits, 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 102Additions to Chapter 3 of the EGL 1.2 Specification (EGL Functions and Errors) 103 104 Replace the last sentence of paragraph 1 of Section 3.5.3 with the 105 following text. 106 "Currently, the only client API resources which may be bound in this 107 fashion are OpenVG VGImage objects and Direct3D texture objects." 108 109 Replace the last sentence of paragraph 2 ("To bind a client API...") of 110 Section 3.5.3 with the following text. 111 "When <buftype> is EGL_OPENVG_IMAGE or EGL_D3D_TEXTURE_ANGLE, the width and 112 height of the pbuffer are determined by the width and height of <buffer>." 113 114 Replace the third paragraph of Section 3.5.3 with the following text. 115 "<buftype> specifies the type of buffer to be bound. The only allowed values 116 of <buftype> are EGL_OPENVG_IMAGE and EGL_D3D_TEXTURE_ANGLE". 117 118 Append the following text to the fourth paragraph of Section 3.5.3. 119 "When <buftype> is EGL_D3D_TEXTURE_ANGLE, <buffer> must be 120 a valid D3D texture object, cast into the type EGLClientBuffer. See table 121 egl.restrictions for acceptable texture object types and formats. If the 122 EGL_ANGLE_device_d3d extension is present, the provided D3D texture object 123 must have been created by the same D3D device queried from the display. 124 If these requirements are not met, an EGL_BAD_PARAMETER error is 125 generated." 126 127 --------------------------------------------------------------------------- 128 Resource Type Resource Restrictions 129 --------------------------------------------------------------------------- 130 IDirect3DTexture9 Memory pool must be D3DPOOL_DEFAULT. 131 132 Format must be D3DFMT_R8G8B8, D3DFMT_A8R8G8B8, 133 D3DFMT_A16B16G16R16F or D3DFMT_A32B32G32R32F. 134 135 EGL_TEXTURE_INTERNAL_FORMAT_ANGLE is not supported. 136 137 EGL_TEXTURE_OFFSET_X_ANGLE and EGL_TEXTURE_OFFSET_Y_ANGLE 138 are not supported. 139 140 ID3D11Texture2D Usage flags must be D3D11_USAGE_DEFAULT. 141 142 Format must be 143 DXGI_FORMAT_R8G8B8A8_UNORM, 144 DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, 145 DXGI_FORMAT_B8G8R8A8_UNORM, 146 DXGI_FORMAT_B8G8R8A8_UNORM_SRGB (support is optional), 147 DXGI_FORMAT_R8G8B8A8_TYPELESS (support is optional), 148 DXGI_FORMAT_B8G8R8A8_TYPELESS (support is optional), 149 DXGI_FORMAT_R16G16B16A16_FLOAT, 150 DXGI_FORMAT_R32G32B32A32_FLOAT, 151 DXGI_FORMAT_R10G10B10A2_UNORM, 152 DXGI_FORMAT_R8_UNORM, 153 DXGI_FORMAT_R16_UNORM, 154 DXGI_FORMAT_R8G8_UNORM, 155 DXGI_FORMAT_R16G16_UNORM, 156 DXGI_FORMAT_NV12, 157 DXGI_FORMAT_P010, or 158 DXGI_FORMAT_P016. 159 160 EGL_D3D11_TEXTURE_PLANE_ANGLE must be specified for YUV 161 formats DXGI_FORMAT_NV12, DXGI_FORMAT_P010, or 162 DXGI_FORMAT_P016, and must be 0 or 1. It is ignored for 163 all non-YUV formats. 164 165 EGL_TEXTURE_INTERNAL_FORMAT_ANGLE (if specified) must be 166 GL_RGBA (supported for all RGBA and BGRA formats), 167 GL_RGB (supported for all RGBA and BGRA formats except 168 DXGI_FORMAT_R10G10B10A2_UNORM), 169 GL_BGRA_EXT (supported only for 170 DXGI_FORMAT_B8G8R8A8_UNORM, 171 DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, and 172 DXGI_FORMAT_B8G8R8A8_TYPELESS), 173 GL_RGB10_A2_EXT (supported for 174 DXGI_FORMAT_R10G10B10A2_UNORM), 175 GL_RED_EXT (supported for DXGI_FORMAT_R8_UNORM 176 and DXGI_FORMAT_R16_UNORM), 177 GL_RG_EXT (supported for DXGI_FORMAT_R8G8_UNORM 178 and DXGI_FORMAT_R16G16_UNORM), 179 GL_R16_EXT (supported for DXGI_FORMAT_R16_UNORM), or 180 GL_RG16_EXT (supported for DXGI_FORMAT_R16G16_UNORM). 181 It is ignored for all YUV formats. 182 -------------------------------------------------------------------------- 183 Table egl.restrictions - Restrictions on D3D resources that can be used 184 as a <buffer>. 185 -------------------------------------------------------------------------- 186 187 Append to the fifth paragraph of Section 3.5.3. 188 "In addition, in case buftype is EGL_D3D_TEXTURE_ANGLE and the D3D resource 189 has a typeless DXGI format, attrib_list may contain the attribute 190 EGL_GL_COLORSPACE." 191 192 Append to the end of Section 3.5.3. 193 "When a pbuffer is created with type EGL_D3D_TEXTURE_ANGLE, the contents 194 of the associcated D3D texture object are undefined while the pbuffer is 195 the current read surface, draw surface or bound to a client texture." 196 197 Append to the end of Section 3.5.3. 198 "When a pbuffer is created with type EGL_D3D_TEXTURE_ANGLE, and the 199 EGL_GL_COLORSPACE attribute is not specified in attrib_list, the 200 EGL_GL_COLORSPACE attribute of the surface is determined by the DXGI format 201 of the Direct3D texture. For *_SRGB DXGI formats, the value of 202 EGL_GL_COLORSPACE is EGL_GL_COLORSPACE_SRGB. For other formats including 203 *_TYPELESS DXGI formats, the value of EGL_GL_COLORSPACE defaults to 204 EGL_GL_COLORSPACE_LINEAR." 205 206Issues 207 208 1. What renderers allow the use of a multi-sampled texture? 209 210 PROPOSED: Multi-sampled texture support is currently limited to D3D11. 211 Additionally, the client is responsible for resolving the texture. 212 213 2. How does this extension interact with EXT_sRGB_write_control? 214 215 If GL_FRAMEBUFFER_SRGB_EXT is disabled and a pbuffer created from a D3D 216 texture with an *_SRGB format is being rendered to, it is undefined whether 217 SRGB conversion will be performed. 218 219 3. What renderers allow the use of typeless textures? 220 221 PROPOSED: Support for typeless textures is currently limited to D3D11. 222 223 4. Can RGB formats be supported? 224 225 RESOLVED: RGB internal formats are supported for creating images from D3D11 226 textures in version 5 by setting EGL_TEXTURE_INTERNAL_FORMAT_ANGLE attribute 227 to GL_RGB. Images with an RGB format will ensure that the alpha channel of 228 the texture is reset to 1.0 when it is used. 229 230 5. What operations do the texture offsets affect? 231 232 RESOLVED: The texture offsets specified by EGL_TEXTURE_OFFSET_X_ANGLE and 233 EGL_TEXTURE_OFFSET_Y_ANGLE affect only rendering into the surface. 234 Specifically these affect the internal D3D viewport and scissor rect states 235 for draws, clears, and blits. This is needed to apply the update offset 236 returned by calling BeginDraw() on IDCompositionSurface, and is needed for 237 correct rendering in that case. 238 239Revision History 240 241 Version 9, 2021/09/07 - added support for R/RG formats and GL_RGB10_A2_EXT. 242 243 Version 8, 2021/01/13 - added support for texture array. 244 245 Version 7, 2021/01/12 - added support for NV12/P010/P016 planar formats. 246 247 Version 6, 2020/05/12 - added support for specifying texture offsets. 248 249 Version 5, 2019/09/06 - added support for creating EGLImage. 250 251 Version 4, 2019/04/15 - added support for DXGI_FORMAT_R10G10B10A2_UNORM. 252 253 Version 3, 2018/01/23 - added support for typeless textures. 254 255 Version 2, 2018/01/15 - clarified SRGB conversion handling. 256 257 Version 1, 2016/10/05 - first draft. 258