Path: blob/main_old/extensions/ANGLE_get_image.txt
1693 views
Name12ANGLE_get_image34Name Strings56GL_ANGLE_get_image78Contributors910Jamie Madill1112Contact1314Jamie Madill (jmadill 'at' google.com)1516Notice1718Copyright (c) 2019 The Khronos Group Inc. Copyright terms at19http://www.khronos.org/registry/speccopyright.html2021Status2223Draft2425Version2627Version 1, October 21, 20192829Number3031OpenGL ES Extension #??3233Dependencies3435Requires OpenGL ES 2.03637Written against the OpenGL ES 3.2 specification.3839Overview4041This extension allows the OpenGL application to query and read back Texture42and Renderbuffer pixel data. The OpenGL context exposes new queries for the43implementation pixel format and type similar to glReadPixels. The context44also exposes new commands to read back pixel data with these parameters.4546New Procedures and Functions4748void GetTexImageANGLE(GLenum target, GLint level, GLenum format, GLenum type,49void *pixels);5051void GetRenderbufferImageANGLE(GLenum target, GLint level, GLenum format,52GLenum type, void *pixels);5354New Tokens5556None5758Additions to the OpenGL ES Specification5960Update section 8.11.2 "Texture Parameter Queries":6162Change "<pname> must be one of IMAGE_FORMAT_COMPATIBILITY_TYPE, TEXTURE_-63IMMUTABLE_FORMAT, TEXTURE_IMMUTABLE_LEVELS, or one of the symbolic64values in table 8.19." to "<pname> must be one of IMAGE_FORMAT_COMPATIBILITY_-65TYPE, TEXTURE_IMMUTABLE_FORMAT, TEXTURE_IMMUTABLE_LEVELS, IMPLEMENTATION_-66COLOR_READ_TYPE, IMPLEMENTATION_COLOR_READ_FORMAT or one of the symbolic67values in table 8.19.".6869Add a paragrah: "Querying <pname> with IMPLEMENTATION_COLOR_READ_TYPE or70IMPLEMENTATION_COLOR_READ_FORMAT returns the implementation-dependent read71format and type for use with GetTexImageANGLE."7273Update section 9.2.6 "Renderbuffer Object Queries":7475Add a paragraph: "If <pname> is IMPLEMENTATION_COLOR_READ_TYPE or76IMPLEMENTATION_COLOR_READ_FORMAT then <params> will contain the77implementation-dependent read format and type for use with78GetRenderbufferImageANGLE."7980Add a section "Texture and Renderbuffer Image Queries":8182Texture and Renderbuffer images may be obtained from a Texture or83Renderbuffer with the commands8485void GetTexImageANGLE(GLenum target, GLint level, GLenum format, GLenum type,86void *pixels);8788void GetRenderbufferImageANGLE(GLenum target, GLenum format, GLenum type,89void *pixels);9091For GetTexImageANGLE, <target> specifies the target to which the texture92object is bound. target must be one of TEXTURE_2D, TEXTURE_3D,93TEXTURE_2D_ARRAY, TEXTURE_CUBE_MAP_ARRAY, indicating a two- or three-94dimensional, two-dimensional array, cube map array respectively. <target>95may also be one of the targets from table 8.20, indicating the96corresponding face of a cube map texture.9798For GetRenderbufferImageANGLE, <target> must be RENDERBUFFER.99100<level> is a level-of-detail number, <format> is a pixel format from table 8.5,101and <type> is a pixel type from table 8.4.102103These commands obtain component groups from a texture or renderbuffer image104with the indicated level-of-detail. If <format> is a color format then the105components are assigned among R, G, B, and A, starting with the first group106in the first row, and continuing by obtaining groups in order from each row107and proceeding from the first row to the last, and from the first image to108the last for three-dimensional textures. Two-dimensional array and cube map109array textures are treated as three-dimensional images, where the layers are110treated as rows or images. Cube map textures are treated as three-dimensional111images with a depth of 6, where the cube map faces are ordered as image layers112as shown in table 8.24.113114If <format> is DEPTH_COMPONENT, DEPTH_STENCIL, or STENCIL_INDEX, then115each depth component and/or stencil index is assigned with the same ordering of116rows and images.117118These groups are then packed and placed in client or pixel buffer object memory.119If a pixel pack buffer is bound (as indicated by a non-zero value of PIXEL_-120PACK_BUFFER_BINDING), <pixels> is an offset into the pixel pack buffer;121otherwise, <pixels> is a pointer to client memory. Pixel storage modes that are122applicable to ReadPixels are applied, as described in table 16.1 and section12316.1.2.124125For three-dimensional, two-dimensional array, cube map array, and cube map126textures pixel storage operations are applied as if the image were two-127dimensional, except that the additional pixel storage state values128PACK_IMAGE_HEIGHT and PACK_SKIP_IMAGES are applied. The correspondence of texels129to memory locations is as defined for TexImage3D in section 8.5.130131The row length, number of rows, image depth, and number of images are determined132by the size of the texture or renderbuffer image (including any borders).133134Errors:135136An INVALID_ENUM error is generated by GetTexImage if <target> is137not one of TEXTURE_2D, TEXTURE_3D, TEXTURE_2D_ARRAY, TEXTURE_CUBE_MAP_ARRAY,138or one of the targets from table 8.20.139140An INVALID_ENUM error is generated by GetRenderbufferImage is <target> is not141RENDERBUFFER.142143An INVALID_VALUE error is generated if <level> is negative or larger than144the maximum allowable level.145146An INVALID_OPERATION error is generated if any of the following mismatches147between <format> and the internal format of the texture or renderbuffer image148exist:149150* <format> is a color format (one of the formats in table 8.3 whose target is151the color buffer) and the base internal format of the texture or renderbuffer152image is not a color format.153154* <format> is DEPTH_COMPONENT and the base internal format is not155DEPTH_COMPONENT or DEPTH_STENCIL.156157* <format> is DEPTH_STENCIL and the base internal format is not DEPTH_-158STENCIL.159160* <format> is STENCIL_INDEX and the base internal format is not161STENCIL_INDEX or DEPTH_STENCIL.162163* <format> is one of the integer formats in table 8.5 and the internal format164of the texture or renderbuffer image is not integer, or <format> is not one165of the integer formats in table 8.5 and the internal format is integer.166167An INVALID_OPERATION error is generated if a pixel pack buffer object168is bound and packing the texture or renderbuffer image into the buffer’s169memory would exceed the size of the buffer.170171An INVALID_OPERATION error is generated if a pixel pack buffer object172is bound and <pixels> is not evenly divisible by the number of basic machine173units needed to store in memory the GL data type corresponding to type (see174table 8.4).175176Dependencies on ARB_texture_rectangle177178TEXTURE_RECTANGLE is accepted by GetTexImageANGLE and GetRenderbufferImageANGLE.179180An INVALID_VALUE error is generated if <level> is non-zero and the effective181<target> is TEXTURE_RECTANGLE.182183New State184185Add to table 21.10 "Textures (state per texture object)":186187Get Value Type Get Command Initial Value Description Section188-------------------------------- ---- ----------- ------------- --------------------------- -------189IMPLEMENTATION_COLOR_READ_FORMAT E GetTextureParameteriv empty Implementation pixel format 8.11.2190IMPLEMENTATION_COLOR_READ_TYPE E GetTextureParameteriv empty Implementation pixel type 8.11.2191192Add to table 21.17 "Renderbuffer (state per renderbuffer object)":193194Get Value Type Get Command Initial Value Description Section195-------------------------------- ---- ----------- ------------- --------------------------- -------196IMPLEMENTATION_COLOR_READ_FORMAT E GetRenderbufferParameteriv empty Implementation pixel format 9.2.6197IMPLEMENTATION_COLOR_READ_TYPE E GetRenderbufferParameteriv empty Implementation pixel type 9.2.6198199Issues2002011) Should GetTexImageANGLE/GetRenderbufferImageANGLE only accept IMPLEMENTATION-202_COLOR_READ_FORMAT/TYPE or should they behave the same as GetTexImage in GL?203204Resolved: Keep the spec wording closer to the desktop GL version. It should205not involve much additional implementation work except for validation.206207Revision History208209Rev. Date Author Changes210---- ------------- --------- ----------------------------------------2111 Oct 24, 2019 jmadill Initial version212213214