Branch
Hash :
0cc9b7be
Author :
Date :
2025-09-03T11:33:37
Support more YUV formats in CopyTextureCHROMIUM Add support for formats in GL_ANGLE_yuv_internal_format as source textures to glCopyTextureCHROMIUM. These formats are common AHardwareBuffer formats and Chrome uses them as copy texture sources when decoding video. Bug: chromium:405308165 Change-Id: Ic817cce83b676ee9a517bee4fac6ef94a174961f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6908295 Reviewed-by: Shahbaz Youssefi <syoussefi@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 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 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300
Name
CHROMIUM_copy_texture
Name Strings
GL_CHROMIUM_copy_texture
Version
Last Modified Date: September 3, 2025
Dependencies
OpenGL ES 2.0 or OpenGL ES 3.0 is required.
EXT_texture_format_BGRA8888 affects the definition of this extension.
ARB_texture_rg affects the definition of this extension.
CHROMIUM_ycbcr_422_image affects the definition of this extension.
ANGLE_yuv_internal_format affects the definition of this extension.
Overview
This extension expands on the functionality provided by the
glCopyTexImage2D command. A new function is exported,
glCopyTextureCHROMIUM, that performs the same copy operation as
glCopyTexImage2D.
The extension also supports copying BGRA textures and copying
EXTERNAL_OES texture to BGRA texture, which is not explicitly
granted by EXT_texture_format_BGRA8888.
New Procedures and Functions
void CopyTextureCHROMIUM(uint sourceId,
int sourceLevel,
enum destTarget,
uint destId,
int destLevel,
int internalFormat,
enum destType,
boolean unpackFlipY,
boolean unpackPremultiplyAlpha,
boolean unpackUnmultiplyAlpha)
void CopySubTextureCHROMIUM(uint sourceId,
int sourceLevel,
enum destTarget,
uint destId,
int destLevel,
int xoffset,
int yoffset,
int x,
int y,
sizei width,
sizei height,
boolean unpackFlipY,
boolean unpackPremultiplyAlpha,
boolean unpackUnmultiplyAlpha)
Additions to the OpenGL ES 2.0 Specification
The command
CopyTextureCHROMIUM
Copies the contents of <sourceLevel> level of <sourceId> texture to
<destLevel> level and <destTarget> target of <destId> texture.
<destTarget> must be TEXTURE_2D,
TEXTURE_CUBE_MAP_POSITIVE_X, TEXTURE_CUBE_MAP_NEGATIVE_X,
TEXTURE_CUBE_MAP_POSITIVE_Y, TEXTURE_CUBE_MAP_NEGATIVE_Y,
TEXTURE_CUBE_MAP_POSITIVE_Z, TEXTURE_CUBE_MAP_NEGATIVE_Z,
TEXTURE_RECTANGLE_ARB.
The internal format of the destination texture is converted to that
specified by <internalFormat>.
When source texture doens't contain a superset of the component
required by <internalFormat>, fill the components by following rules.
source format color components
----------------------------------------
ALPHA (0, 0, 0, A)
RED (R, 0, 0, 1)
LUMINANCE (L, L, L, 1)
LUMINANCE_ALPHA (L, L, L, A)
RGB (R, G, B, 1)
RGB8 (R, G, B, 1)
RGBA (R, G, B, A)
RGBA8 (R, G, B, A)
BGRA_EXT (R, G, B, A)
BGRA8_EXT (R, G, B, A)
RGB_YCBCR_420V_CHROMIUM (R, G, B, 1)
RGB_YCBCR_422_CHROMIUM (R, G, B, 1)
G8_B8R8_2PLANE_420_UNORM_ANGLE (R, G, B, 1)
G8_B8_R8_3PLANE_420_UNORM_ANGLE (R, G, B, 1)
G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_ANGLE (R, G, B, 1)
G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_ANGLE (R, G, B, 1)
G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_ANGLE (R, G, B, 1)
G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_ANGLE (R, G, B, 1)
G16_B16R16_2PLANE_420_UNORM_ANGLE (R, G, B, 1)
G16_B16_R16_3PLANE_420_UNORM_ANGLE (R, G, B, 1)
The format type of the destination texture is converted to that specified
by <destType>.
If <flipY> is true, vertically flip texture image data.
If <unpackPremultiplyAlpha> and <unpackUnmultiplyAlpha> are true,
no alpha processing occurs. This is the equivalent of having neither flag
set.
When <sourceId> refers to a stream texture, the texture matrix will be
applied as part of the copy operation.
INVALID_OPERATION is generated if <internalFormat> is not one of the
formats in Table 1.0.
INVALID_OPERATION is generated if the internal format of <sourceId> is not
one of formats in Table 1.1.
INVALID_VALUE is generated if <sourceId> or <destId> are not valid texture
objects.
INVALID_ENUM is generated if <destTarget> is not one of the valid targets
described above.
INVALID_OPERATION is generated if the bound target of destination texture
does not match <target>.
INVALID_VALUE is generated if textures corresponding to <destId> have not
been bound as TEXTURE_2D, TEXTURE_CUBE_MAP, or
TEXTURE_RECTANGLE_ARB objects.
INVALID_VALUE is generated if textures corresponding to <sourceId> have not
been bound as TEXTURE_2D, TEXTURE_RECTANGLE_ARB or
TEXTURE_EXTERNAL_OES objects.
INVALID_VALUE is generated if <sourceLevel> is not 0 for ES 2.0, or if
<sourceLevel> or <destLevel> is less than 0 for ES 3.0.
INVALID_VALUE is generated if <sourceLevel> of the source texture is not
defined.
The command
CopySubTextureCHROMIUM
Copies the sub contents of texture referred to by <sourceId> to <destId>
texture without redefining <destId> texture.
See CopyTextureCHROMIUM for the interpretation of the <destTarget>,
<sourceLevel>, <destLevel>, <flipY>, <premultiplyAlpha>, and
<unmultiplyAlpha> arguments.
<xoffset> and <yoffset> specify a texel offset in the x and y direction
respectively within the destination texture.
<x> and <y> specify specify a texel offset in the x and y direction
respectively within the source texture.
<width> specifies the width of the texture subimage.
<height> specifies the width of the texture subimage.
INVALID_VALUE is generated if either <sourceId> texture or <destId>
texture is not defined.
INVALID_OPERATION is generated if the internal format of <sourceId> or
<destId> is not one of formats in Table 1.1.
INVALID_OPERATION is generated if the destination texture array has not
been defined.
INVALID_VALUE is generated if <destId> texture is not bound as
TEXTURE_2D or TEXTURE_RECTANGLE_ARB.
INVALID_VALUE is generated if level 0 of the source texture or
the destination texture is not defined.
INVALID_VALUE is generated if (<xoffset> + <width>) > destWidth,
or (<yoffset> + <height>) > destHeight.
Table 1.0 Valid internal formats for CopyTextureCHROMIUM:
<internalFormat>
---------------
ALPHA
BGRA8_EXT
BGRA_EXT
LUMINANCE
LUMINANCE_ALPHA
R11F_G11F_B10F
R16F
R32F
R8
R8UI
RG16F
RG32F
RG8
RG8UI
RGB
RGB10_A2
RGB16F
RGB32F
RGB565
RGB5_A1
RGB8
RGB8UI
RGB9_E5
RGBA
RGBA16F
RGBA32F
RGBA4
RGBA8
RGBA8UI
RGBX8_ANGLE
SRGB8
SRGB8_ALPHA8
SRGB_ALPHA_EXT
SRGB_EXT
Table 1.1 Valid source texture internal formats for CopyTextureCHROMIUM and
source and destination formats for CopySubTextureCHROMIUM:
internal format
---------------
RED
ALPHA
LUMINANCE
LUMINANCE_ALPHA
RGB
RGBA
RGB8
RGBA8
BGRA_EXT
BGRA8_EXT
RGB_YCBCR_420V_CHROMIUM
RGB_YCBCR_422_CHROMIUM
G8_B8R8_2PLANE_420_UNORM_ANGLE
G8_B8_R8_3PLANE_420_UNORM_ANGLE
G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_ANGLE
G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_ANGLE
G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_ANGLE
G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_ANGLE
G16_B16R16_2PLANE_420_UNORM_ANGLE
G16_B16_R16_3PLANE_420_UNORM_ANGLE
Dependencies on ARB_texture_rg
If ARB_texture_rg is not supported:
* delete any reference to the R8 format.
Dependencies on CHROMIUM_ycbcr_422_image
If CHROMIUM_ycbcr_422_image is not supported:
* delete any reference to the RGB_YCBCR_422_CHROMIUM format.
Dependencies on ANGLE_yuv_internal_format
If ANGLE_yuv_internal_format is not supported:
* Delete references to the G8_B8R8_2PLANE_420_UNORM_ANGLE,
G8_B8_R8_3PLANE_420_UNORM_ANGLE,
G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_ANGLE,
G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_ANGLE,
G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_ANGLE,
G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_ANGLE,
G16_B16R16_2PLANE_420_UNORM_ANGLE, and
G16_B16_R16_3PLANE_420_UNORM_ANGLE formats.
Errors
None.
New Tokens
None.
New State
None.
Revision History
8/1/2011 Documented the extension
7/4/2013 Add a new parameter dest_type to glCopyTextureCHROMIUM()
16/7/2014 Add TEXTURE_RECTANGLE_ARB as valid source_id target
19/6/2015 Add arguments unpack_flip_y, unpack_premultiply_alpha, and
unpack_unmultiply_alpha to both commands.
4/1/2016 Removed the argument target.
4/1/2016 Added TEXTURE_RECTANGLE_ARB as valid dest_id target.
19/12/2016 Supported more ES 3.0 formats.
18/1/2017 Supported source_level and dest_level.
19/1/2017 Added TEXTURE_CUBE_MAP as valid dest_id target.
24/3/2017 Clean up naming and move formats into tables.
3/9/2025 Add source copy formats from ANGLE_yuv_internal_format