xref: /aosp_15_r20/external/angle/extensions/ANGLE_get_image.txt (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1*8975f5c5SAndroid Build Coastguard WorkerName
2*8975f5c5SAndroid Build Coastguard Worker
3*8975f5c5SAndroid Build Coastguard Worker    ANGLE_get_image
4*8975f5c5SAndroid Build Coastguard Worker
5*8975f5c5SAndroid Build Coastguard WorkerName Strings
6*8975f5c5SAndroid Build Coastguard Worker
7*8975f5c5SAndroid Build Coastguard Worker    GL_ANGLE_get_image
8*8975f5c5SAndroid Build Coastguard Worker
9*8975f5c5SAndroid Build Coastguard WorkerContributors
10*8975f5c5SAndroid Build Coastguard Worker
11*8975f5c5SAndroid Build Coastguard Worker    Jamie Madill
12*8975f5c5SAndroid Build Coastguard Worker
13*8975f5c5SAndroid Build Coastguard WorkerContact
14*8975f5c5SAndroid Build Coastguard Worker
15*8975f5c5SAndroid Build Coastguard Worker    Jamie Madill (jmadill 'at' google.com)
16*8975f5c5SAndroid Build Coastguard Worker
17*8975f5c5SAndroid Build Coastguard WorkerNotice
18*8975f5c5SAndroid Build Coastguard Worker
19*8975f5c5SAndroid Build Coastguard Worker    Copyright (c) 2019 The Khronos Group Inc. Copyright terms at
20*8975f5c5SAndroid Build Coastguard Worker        http://www.khronos.org/registry/speccopyright.html
21*8975f5c5SAndroid Build Coastguard Worker
22*8975f5c5SAndroid Build Coastguard WorkerStatus
23*8975f5c5SAndroid Build Coastguard Worker
24*8975f5c5SAndroid Build Coastguard Worker    Draft
25*8975f5c5SAndroid Build Coastguard Worker
26*8975f5c5SAndroid Build Coastguard WorkerVersion
27*8975f5c5SAndroid Build Coastguard Worker
28*8975f5c5SAndroid Build Coastguard Worker    Version 2, Sept 15, 2021
29*8975f5c5SAndroid Build Coastguard Worker
30*8975f5c5SAndroid Build Coastguard WorkerNumber
31*8975f5c5SAndroid Build Coastguard Worker
32*8975f5c5SAndroid Build Coastguard Worker    OpenGL ES Extension #??
33*8975f5c5SAndroid Build Coastguard Worker
34*8975f5c5SAndroid Build Coastguard WorkerDependencies
35*8975f5c5SAndroid Build Coastguard Worker
36*8975f5c5SAndroid Build Coastguard Worker    Requires OpenGL ES 2.0
37*8975f5c5SAndroid Build Coastguard Worker
38*8975f5c5SAndroid Build Coastguard Worker    Written against the OpenGL ES 3.2 specification.
39*8975f5c5SAndroid Build Coastguard Worker
40*8975f5c5SAndroid Build Coastguard WorkerOverview
41*8975f5c5SAndroid Build Coastguard Worker
42*8975f5c5SAndroid Build Coastguard Worker    This extension allows the OpenGL application to query and read back Texture
43*8975f5c5SAndroid Build Coastguard Worker    and Renderbuffer pixel data. The OpenGL context exposes new queries for the
44*8975f5c5SAndroid Build Coastguard Worker    implementation pixel format and type similar to glReadPixels. The context
45*8975f5c5SAndroid Build Coastguard Worker    also exposes new commands to read back pixel data with these parameters.
46*8975f5c5SAndroid Build Coastguard Worker
47*8975f5c5SAndroid Build Coastguard WorkerNew Procedures and Functions
48*8975f5c5SAndroid Build Coastguard Worker
49*8975f5c5SAndroid Build Coastguard Worker    void GetTexImageANGLE(GLenum target, GLint level, GLenum format, GLenum type,
50*8975f5c5SAndroid Build Coastguard Worker                          void *pixels);
51*8975f5c5SAndroid Build Coastguard Worker
52*8975f5c5SAndroid Build Coastguard Worker    void GetCompressedTexImageANGLE(enum target, int level, void *pixels);
53*8975f5c5SAndroid Build Coastguard Worker
54*8975f5c5SAndroid Build Coastguard Worker    void GetRenderbufferImageANGLE(GLenum target, GLint level, GLenum format,
55*8975f5c5SAndroid Build Coastguard Worker                                   GLenum type, void *pixels);
56*8975f5c5SAndroid Build Coastguard Worker
57*8975f5c5SAndroid Build Coastguard WorkerNew Tokens
58*8975f5c5SAndroid Build Coastguard Worker
59*8975f5c5SAndroid Build Coastguard Worker    None
60*8975f5c5SAndroid Build Coastguard Worker
61*8975f5c5SAndroid Build Coastguard WorkerAdditions to the OpenGL ES Specification
62*8975f5c5SAndroid Build Coastguard Worker
63*8975f5c5SAndroid Build Coastguard Worker    Update section 8.11.2 "Texture Parameter Queries":
64*8975f5c5SAndroid Build Coastguard Worker
65*8975f5c5SAndroid Build Coastguard Worker    Change "<pname> must be one of IMAGE_FORMAT_COMPATIBILITY_TYPE, TEXTURE_-
66*8975f5c5SAndroid Build Coastguard Worker    IMMUTABLE_FORMAT, TEXTURE_IMMUTABLE_LEVELS, or one of the symbolic
67*8975f5c5SAndroid Build Coastguard Worker    values in table 8.19." to "<pname> must be one of IMAGE_FORMAT_COMPATIBILITY_-
68*8975f5c5SAndroid Build Coastguard Worker    TYPE, TEXTURE_IMMUTABLE_FORMAT, TEXTURE_IMMUTABLE_LEVELS, IMPLEMENTATION_-
69*8975f5c5SAndroid Build Coastguard Worker    COLOR_READ_TYPE, IMPLEMENTATION_COLOR_READ_FORMAT or one of the symbolic
70*8975f5c5SAndroid Build Coastguard Worker    values in table 8.19.".
71*8975f5c5SAndroid Build Coastguard Worker
72*8975f5c5SAndroid Build Coastguard Worker    Add a paragrah: "Querying <pname> with IMPLEMENTATION_COLOR_READ_TYPE or
73*8975f5c5SAndroid Build Coastguard Worker    IMPLEMENTATION_COLOR_READ_FORMAT returns the implementation-dependent read
74*8975f5c5SAndroid Build Coastguard Worker    format and type for use with GetTexImageANGLE."
75*8975f5c5SAndroid Build Coastguard Worker
76*8975f5c5SAndroid Build Coastguard Worker    Update section 9.2.6 "Renderbuffer Object Queries":
77*8975f5c5SAndroid Build Coastguard Worker
78*8975f5c5SAndroid Build Coastguard Worker    Add a paragraph: "If <pname> is IMPLEMENTATION_COLOR_READ_TYPE or
79*8975f5c5SAndroid Build Coastguard Worker    IMPLEMENTATION_COLOR_READ_FORMAT then <params> will contain the
80*8975f5c5SAndroid Build Coastguard Worker    implementation-dependent read format and type for use with
81*8975f5c5SAndroid Build Coastguard Worker    GetRenderbufferImageANGLE."
82*8975f5c5SAndroid Build Coastguard Worker
83*8975f5c5SAndroid Build Coastguard Worker    Add a section "Texture and Renderbuffer Image Queries":
84*8975f5c5SAndroid Build Coastguard Worker
85*8975f5c5SAndroid Build Coastguard Worker    Texture and Renderbuffer images may be obtained from a Texture or
86*8975f5c5SAndroid Build Coastguard Worker    Renderbuffer with the commands
87*8975f5c5SAndroid Build Coastguard Worker
88*8975f5c5SAndroid Build Coastguard Worker    void GetTexImageANGLE(GLenum target, GLint level, GLenum format, GLenum type,
89*8975f5c5SAndroid Build Coastguard Worker                          void *pixels);
90*8975f5c5SAndroid Build Coastguard Worker
91*8975f5c5SAndroid Build Coastguard Worker    void GetCompressedTexImageANGLE(GLenum target, GLint level, void *pixels);
92*8975f5c5SAndroid Build Coastguard Worker
93*8975f5c5SAndroid Build Coastguard Worker    void GetRenderbufferImageANGLE(GLenum target, GLenum format, GLenum type,
94*8975f5c5SAndroid Build Coastguard Worker                                   void *pixels);
95*8975f5c5SAndroid Build Coastguard Worker
96*8975f5c5SAndroid Build Coastguard Worker    For GetTexImageANGLE and GetCompressedTexImageANGLE, <target> specifies the
97*8975f5c5SAndroid Build Coastguard Worker    target to which the texture object is bound. target must be one of
98*8975f5c5SAndroid Build Coastguard Worker    TEXTURE_2D, TEXTURE_3D, TEXTURE_2D_ARRAY, TEXTURE_CUBE_MAP_ARRAY, indicating
99*8975f5c5SAndroid Build Coastguard Worker    a two- or three-dimensional, two-dimensional array, cube map array
100*8975f5c5SAndroid Build Coastguard Worker    respectively. <target> may also be one of the targets from table 8.20,
101*8975f5c5SAndroid Build Coastguard Worker    indicating the corresponding face of a cube map texture.
102*8975f5c5SAndroid Build Coastguard Worker
103*8975f5c5SAndroid Build Coastguard Worker    For GetRenderbufferImageANGLE, <target> must be RENDERBUFFER.
104*8975f5c5SAndroid Build Coastguard Worker
105*8975f5c5SAndroid Build Coastguard Worker    <level> is a level-of-detail number, <format> is a pixel format from table 8.5,
106*8975f5c5SAndroid Build Coastguard Worker    and <type> is a pixel type from table 8.4.
107*8975f5c5SAndroid Build Coastguard Worker
108*8975f5c5SAndroid Build Coastguard Worker    GetTexImageANGLE and GetRenderbufferImageANGLE obtain component groups
109*8975f5c5SAndroid Build Coastguard Worker    from a texture or renderbuffer image with the indicated level-of-detail.
110*8975f5c5SAndroid Build Coastguard Worker    If <format> is a color format then the components are assigned among R,
111*8975f5c5SAndroid Build Coastguard Worker    G, B, and A, starting with the first group in the first row, and
112*8975f5c5SAndroid Build Coastguard Worker    continuing by obtaining groups in order from each row and proceeding from
113*8975f5c5SAndroid Build Coastguard Worker    the first row to the last, and from the first image to the last for
114*8975f5c5SAndroid Build Coastguard Worker    three-dimensional textures. Two-dimensional array and cube map array
115*8975f5c5SAndroid Build Coastguard Worker    textures are treated as three-dimensional images, where the layers are
116*8975f5c5SAndroid Build Coastguard Worker    treated as rows or images. Cube map textures are treated as
117*8975f5c5SAndroid Build Coastguard Worker    three-dimensional images with a depth of 6, where the cube map faces are
118*8975f5c5SAndroid Build Coastguard Worker    ordered as image layers as shown in table 8.24.
119*8975f5c5SAndroid Build Coastguard Worker
120*8975f5c5SAndroid Build Coastguard Worker    If <format> is DEPTH_COMPONENT, DEPTH_STENCIL, or STENCIL_INDEX, then
121*8975f5c5SAndroid Build Coastguard Worker    each depth component and/or stencil index is assigned with the same ordering of
122*8975f5c5SAndroid Build Coastguard Worker    rows and images.
123*8975f5c5SAndroid Build Coastguard Worker
124*8975f5c5SAndroid Build Coastguard Worker    These groups are then packed and placed in client or pixel buffer object memory.
125*8975f5c5SAndroid Build Coastguard Worker    If a pixel pack buffer is bound (as indicated by a non-zero value of PIXEL_-
126*8975f5c5SAndroid Build Coastguard Worker    PACK_BUFFER_BINDING), <pixels> is an offset into the pixel pack buffer;
127*8975f5c5SAndroid Build Coastguard Worker    otherwise, <pixels> is a pointer to client memory. Pixel storage modes that are
128*8975f5c5SAndroid Build Coastguard Worker    applicable to ReadPixels are applied, as described in table 16.1 and section
129*8975f5c5SAndroid Build Coastguard Worker    16.1.2.
130*8975f5c5SAndroid Build Coastguard Worker
131*8975f5c5SAndroid Build Coastguard Worker    When called, GetCompressedTexImageANGLE writes n ubytes of compressed
132*8975f5c5SAndroid Build Coastguard Worker    image data to the pixel pack buffer or client memory pointed to by pixels.
133*8975f5c5SAndroid Build Coastguard Worker    n is the value of TEXTURE_COMPRESSED_IMAGE_SIZE for the texture image. The
134*8975f5c5SAndroid Build Coastguard Worker    compressed image data is formatted according to the definition of the texture's
135*8975f5c5SAndroid Build Coastguard Worker    internal format.
136*8975f5c5SAndroid Build Coastguard Worker
137*8975f5c5SAndroid Build Coastguard Worker    For three-dimensional, two-dimensional array, cube map array, and cube map
138*8975f5c5SAndroid Build Coastguard Worker    textures pixel storage operations are applied as if the image were two-
139*8975f5c5SAndroid Build Coastguard Worker    dimensional, except that the additional pixel storage state values
140*8975f5c5SAndroid Build Coastguard Worker    PACK_IMAGE_HEIGHT and PACK_SKIP_IMAGES are applied. The correspondence of texels
141*8975f5c5SAndroid Build Coastguard Worker    to memory locations is as defined for TexImage3D in section 8.5.
142*8975f5c5SAndroid Build Coastguard Worker
143*8975f5c5SAndroid Build Coastguard Worker    The row length, number of rows, image depth, and number of images are determined
144*8975f5c5SAndroid Build Coastguard Worker    by the size of the texture or renderbuffer image (including any borders).
145*8975f5c5SAndroid Build Coastguard Worker
146*8975f5c5SAndroid Build Coastguard Worker    Errors:
147*8975f5c5SAndroid Build Coastguard Worker
148*8975f5c5SAndroid Build Coastguard Worker    An INVALID_ENUM error is generated by GetTexImage if <target> is
149*8975f5c5SAndroid Build Coastguard Worker    not one of TEXTURE_2D, TEXTURE_3D, TEXTURE_2D_ARRAY, TEXTURE_CUBE_MAP_ARRAY,
150*8975f5c5SAndroid Build Coastguard Worker    or one of the targets from table 8.20.
151*8975f5c5SAndroid Build Coastguard Worker
152*8975f5c5SAndroid Build Coastguard Worker    An INVALID_ENUM error is generated by GetRenderbufferImage is <target> is not
153*8975f5c5SAndroid Build Coastguard Worker    RENDERBUFFER.
154*8975f5c5SAndroid Build Coastguard Worker
155*8975f5c5SAndroid Build Coastguard Worker    An INVALID_VALUE error is generated if <level> is negative or larger than
156*8975f5c5SAndroid Build Coastguard Worker    the maximum allowable level.
157*8975f5c5SAndroid Build Coastguard Worker
158*8975f5c5SAndroid Build Coastguard Worker    An INVALID_OPERATION error is generated if any of the following mismatches
159*8975f5c5SAndroid Build Coastguard Worker    between <format> and the internal format of the texture or renderbuffer image
160*8975f5c5SAndroid Build Coastguard Worker    exist:
161*8975f5c5SAndroid Build Coastguard Worker
162*8975f5c5SAndroid Build Coastguard Worker      * <format> is a color format (one of the formats in table 8.3 whose target is
163*8975f5c5SAndroid Build Coastguard Worker        the color buffer) and the base internal format of the texture or renderbuffer
164*8975f5c5SAndroid Build Coastguard Worker        image is not a color format.
165*8975f5c5SAndroid Build Coastguard Worker
166*8975f5c5SAndroid Build Coastguard Worker      * <format> is DEPTH_COMPONENT and the base internal format is not
167*8975f5c5SAndroid Build Coastguard Worker        DEPTH_COMPONENT or DEPTH_STENCIL.
168*8975f5c5SAndroid Build Coastguard Worker
169*8975f5c5SAndroid Build Coastguard Worker      * <format> is DEPTH_STENCIL and the base internal format is not DEPTH_-
170*8975f5c5SAndroid Build Coastguard Worker        STENCIL.
171*8975f5c5SAndroid Build Coastguard Worker
172*8975f5c5SAndroid Build Coastguard Worker      * <format> is STENCIL_INDEX and the base internal format is not
173*8975f5c5SAndroid Build Coastguard Worker        STENCIL_INDEX or DEPTH_STENCIL.
174*8975f5c5SAndroid Build Coastguard Worker
175*8975f5c5SAndroid Build Coastguard Worker      * <format> is one of the integer formats in table 8.5 and the internal format
176*8975f5c5SAndroid Build Coastguard Worker        of the texture or renderbuffer image is not integer, or <format> is not one
177*8975f5c5SAndroid Build Coastguard Worker        of the integer formats in table 8.5 and the internal format is integer.
178*8975f5c5SAndroid Build Coastguard Worker
179*8975f5c5SAndroid Build Coastguard Worker    An INVALID_OPERATION error is generated if a pixel pack buffer object
180*8975f5c5SAndroid Build Coastguard Worker    is bound and packing the texture or renderbuffer image into the buffer’s
181*8975f5c5SAndroid Build Coastguard Worker    memory would exceed the size of the buffer.
182*8975f5c5SAndroid Build Coastguard Worker
183*8975f5c5SAndroid Build Coastguard Worker    An INVALID_OPERATION error is generated if a pixel pack buffer object
184*8975f5c5SAndroid Build Coastguard Worker    is bound and <pixels> is not evenly divisible by the number of basic machine
185*8975f5c5SAndroid Build Coastguard Worker    units needed to store in memory the GL data type corresponding to type (see
186*8975f5c5SAndroid Build Coastguard Worker    table 8.4).
187*8975f5c5SAndroid Build Coastguard Worker
188*8975f5c5SAndroid Build Coastguard Worker    An INVALID_OPERATION error is generated by GetCompressedTexImageANGLE if the
189*8975f5c5SAndroid Build Coastguard Worker    texture image is stored with an uncompressed internal format.
190*8975f5c5SAndroid Build Coastguard Worker
191*8975f5c5SAndroid Build Coastguard WorkerDependencies on ARB_texture_rectangle
192*8975f5c5SAndroid Build Coastguard Worker
193*8975f5c5SAndroid Build Coastguard Worker    TEXTURE_RECTANGLE is accepted by GetTexImageANGLE and GetRenderbufferImageANGLE.
194*8975f5c5SAndroid Build Coastguard Worker
195*8975f5c5SAndroid Build Coastguard Worker    An INVALID_VALUE error is generated if <level> is non-zero and the effective
196*8975f5c5SAndroid Build Coastguard Worker    <target> is TEXTURE_RECTANGLE.
197*8975f5c5SAndroid Build Coastguard Worker
198*8975f5c5SAndroid Build Coastguard WorkerNew State
199*8975f5c5SAndroid Build Coastguard Worker
200*8975f5c5SAndroid Build Coastguard Worker    Add to table 21.10 "Textures (state per texture object)":
201*8975f5c5SAndroid Build Coastguard Worker
202*8975f5c5SAndroid Build Coastguard Worker    Get Value                         Type  Get Command            Initial Value   Description                  Section
203*8975f5c5SAndroid Build Coastguard Worker    --------------------------------  ----  -----------            -------------   ---------------------------  -------
204*8975f5c5SAndroid Build Coastguard Worker    IMPLEMENTATION_COLOR_READ_FORMAT  E     GetTextureParameteriv  empty           Implementation pixel format  8.11.2
205*8975f5c5SAndroid Build Coastguard Worker    IMPLEMENTATION_COLOR_READ_TYPE    E     GetTextureParameteriv  empty           Implementation pixel type    8.11.2
206*8975f5c5SAndroid Build Coastguard Worker
207*8975f5c5SAndroid Build Coastguard Worker    Add to table 21.17 "Renderbuffer (state per renderbuffer object)":
208*8975f5c5SAndroid Build Coastguard Worker
209*8975f5c5SAndroid Build Coastguard Worker    Get Value                         Type  Get Command                 Initial Value   Description                  Section
210*8975f5c5SAndroid Build Coastguard Worker    --------------------------------  ----  -----------                 -------------   ---------------------------  -------
211*8975f5c5SAndroid Build Coastguard Worker    IMPLEMENTATION_COLOR_READ_FORMAT  E     GetRenderbufferParameteriv  empty           Implementation pixel format  9.2.6
212*8975f5c5SAndroid Build Coastguard Worker    IMPLEMENTATION_COLOR_READ_TYPE    E     GetRenderbufferParameteriv  empty           Implementation pixel type    9.2.6
213*8975f5c5SAndroid Build Coastguard Worker
214*8975f5c5SAndroid Build Coastguard WorkerIssues
215*8975f5c5SAndroid Build Coastguard Worker
216*8975f5c5SAndroid Build Coastguard Worker    1) Should GetTexImageANGLE/GetRenderbufferImageANGLE only accept IMPLEMENTATION-
217*8975f5c5SAndroid Build Coastguard Worker       _COLOR_READ_FORMAT/TYPE or should they behave the same as GetTexImage in GL?
218*8975f5c5SAndroid Build Coastguard Worker
219*8975f5c5SAndroid Build Coastguard Worker       Resolved: Keep the spec wording closer to the desktop GL version. It should
220*8975f5c5SAndroid Build Coastguard Worker       not involve much additional implementation work except for validation.
221*8975f5c5SAndroid Build Coastguard Worker
222*8975f5c5SAndroid Build Coastguard WorkerRevision History
223*8975f5c5SAndroid Build Coastguard Worker
224*8975f5c5SAndroid Build Coastguard Worker    Rev.    Date         Author                 Changes
225*8975f5c5SAndroid Build Coastguard Worker    ----  -------------  ---------              ----------------------------------------
226*8975f5c5SAndroid Build Coastguard Worker      2   Sept 15, 2021  jmadill                Add GetCompressedTexImageANGLE
227*8975f5c5SAndroid Build Coastguard Worker      1   Oct 24, 2019   jmadill                Initial version
228