102f4aeb0Sopenharmony_ciName
202f4aeb0Sopenharmony_ci
302f4aeb0Sopenharmony_ci    KHR_image_base
402f4aeb0Sopenharmony_ci
502f4aeb0Sopenharmony_ciName Strings
602f4aeb0Sopenharmony_ci
702f4aeb0Sopenharmony_ci    EGL_KHR_image_base
802f4aeb0Sopenharmony_ci
902f4aeb0Sopenharmony_ciContributors
1002f4aeb0Sopenharmony_ci
1102f4aeb0Sopenharmony_ci    Jeff Juliano
1202f4aeb0Sopenharmony_ci    Gary King
1302f4aeb0Sopenharmony_ci    Jon Leech
1402f4aeb0Sopenharmony_ci    Jonathan Grant
1502f4aeb0Sopenharmony_ci    Barthold Lichtenbelt
1602f4aeb0Sopenharmony_ci    Aaftab Munshi
1702f4aeb0Sopenharmony_ci    Acorn Pooley
1802f4aeb0Sopenharmony_ci    Chris Wynn
1902f4aeb0Sopenharmony_ci
2002f4aeb0Sopenharmony_ciContacts
2102f4aeb0Sopenharmony_ci
2202f4aeb0Sopenharmony_ci    Jon Leech (jon 'at' alumni.caltech.edu)
2302f4aeb0Sopenharmony_ci    Gary King, NVIDIA Corporation (gking 'at' nvidia.com)
2402f4aeb0Sopenharmony_ci
2502f4aeb0Sopenharmony_ciNotice
2602f4aeb0Sopenharmony_ci
2702f4aeb0Sopenharmony_ci    Copyright (c) 2008-2013 The Khronos Group Inc. Copyright terms at
2802f4aeb0Sopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
2902f4aeb0Sopenharmony_ci
3002f4aeb0Sopenharmony_ciStatus
3102f4aeb0Sopenharmony_ci
3202f4aeb0Sopenharmony_ci    Complete. Functionality approved (as part of KHR_image) by the
3302f4aeb0Sopenharmony_ci    Khronos Board of Promoters on February 11, 2008.
3402f4aeb0Sopenharmony_ci
3502f4aeb0Sopenharmony_ci    Split into KHR_image_base and KHR_image_pixmap approved by the
3602f4aeb0Sopenharmony_ci    Khronos Technical Working Group on November 19, 2008. Update to
3702f4aeb0Sopenharmony_ci    version 5 approved on December 10, 2008.
3802f4aeb0Sopenharmony_ci
3902f4aeb0Sopenharmony_ciVersion
4002f4aeb0Sopenharmony_ci
4102f4aeb0Sopenharmony_ci    Version 8, August 27, 2014
4202f4aeb0Sopenharmony_ci
4302f4aeb0Sopenharmony_ciNumber
4402f4aeb0Sopenharmony_ci
4502f4aeb0Sopenharmony_ci    EGL Extension #8
4602f4aeb0Sopenharmony_ci
4702f4aeb0Sopenharmony_ciDependencies
4802f4aeb0Sopenharmony_ci
4902f4aeb0Sopenharmony_ci    EGL 1.2 is required.
5002f4aeb0Sopenharmony_ci
5102f4aeb0Sopenharmony_ci    An EGL client API, such as OpenGL ES or OpenVG, is required.
5202f4aeb0Sopenharmony_ci
5302f4aeb0Sopenharmony_ci    This extension is written against the wording of the EGL 1.2
5402f4aeb0Sopenharmony_ci    Specification.
5502f4aeb0Sopenharmony_ci
5602f4aeb0Sopenharmony_ciOverview
5702f4aeb0Sopenharmony_ci
5802f4aeb0Sopenharmony_ci    This extension defines a new EGL resource type that is suitable for
5902f4aeb0Sopenharmony_ci    sharing 2D arrays of image data between client APIs, the EGLImage.
6002f4aeb0Sopenharmony_ci    Although the intended purpose is sharing 2D image data, the
6102f4aeb0Sopenharmony_ci    underlying interface makes no assumptions about the format or
6202f4aeb0Sopenharmony_ci    purpose of the resource being shared, leaving those decisions to
6302f4aeb0Sopenharmony_ci    the application and associated client APIs.
6402f4aeb0Sopenharmony_ci
6502f4aeb0Sopenharmony_ciGlossary
6602f4aeb0Sopenharmony_ci
6702f4aeb0Sopenharmony_ci    EGLImage:  An opaque handle to a shared resource created by EGL
6802f4aeb0Sopenharmony_ci               client APIs, presumably a 2D array of image data
6902f4aeb0Sopenharmony_ci
7002f4aeb0Sopenharmony_ci    EGLImage source:  An object or sub-object originally created in
7102f4aeb0Sopenharmony_ci               a client API (such as a mipmap level of a texture object
7202f4aeb0Sopenharmony_ci               in OpenGL-ES, or a VGImage in OpenVG) which is used as
7302f4aeb0Sopenharmony_ci               the <buffer> parameter in a call to eglCreateImageKHR.
7402f4aeb0Sopenharmony_ci
7502f4aeb0Sopenharmony_ci    EGLImage target:  An object created in a client API (such as a
7602f4aeb0Sopenharmony_ci               texture object in OpenGL-ES or a VGImage in OpenVG)
7702f4aeb0Sopenharmony_ci               from a previously-created EGLImage
7802f4aeb0Sopenharmony_ci
7902f4aeb0Sopenharmony_ci    EGLImage sibling: The set of all EGLImage targets (in all
8002f4aeb0Sopenharmony_ci               client API contexts) which are created from the
8102f4aeb0Sopenharmony_ci               same EGLImage object, and the EGLImage source resouce
8202f4aeb0Sopenharmony_ci               which was used to create that EGLImage.
8302f4aeb0Sopenharmony_ci
8402f4aeb0Sopenharmony_ci    Orphaning:  The process of respecifying and/or deleting an EGLImage
8502f4aeb0Sopenharmony_ci               sibling resource (inside a client API context) which
8602f4aeb0Sopenharmony_ci               does not result in deallocation of the memory associated
8702f4aeb0Sopenharmony_ci               with the EGLImage or affect rendering results using other
8802f4aeb0Sopenharmony_ci               EGLImage siblings.
8902f4aeb0Sopenharmony_ci
9002f4aeb0Sopenharmony_ci    Referencing:  The process of creating an EGLImage target resource
9102f4aeb0Sopenharmony_ci               (inside a client API context) from an EGLImage.
9202f4aeb0Sopenharmony_ci
9302f4aeb0Sopenharmony_ci    Respecification: When the size, format, or other attributes of an
9402f4aeb0Sopenharmony_ci               EGLImage sibling are changed via client API calls such as
9502f4aeb0Sopenharmony_ci               gl*TexImage*. Respecification usually will result in
9602f4aeb0Sopenharmony_ci               orphaning the sibling. Note that changing the pixel values of
9702f4aeb0Sopenharmony_ci               the sibling (e.g. by rendering to it or by calling
9802f4aeb0Sopenharmony_ci               gl*TexSubImage*) does not constitute respecification.
9902f4aeb0Sopenharmony_ci
10002f4aeb0Sopenharmony_ciNew Types
10102f4aeb0Sopenharmony_ci
10202f4aeb0Sopenharmony_ci    /*
10302f4aeb0Sopenharmony_ci     * EGLImageKHR is an object which can be used to create EGLImage
10402f4aeb0Sopenharmony_ci     * target resources (inside client APIs).
10502f4aeb0Sopenharmony_ci     */
10602f4aeb0Sopenharmony_ci    typedef void* EGLImageKHR;
10702f4aeb0Sopenharmony_ci
10802f4aeb0Sopenharmony_ciNew Procedures and Functions
10902f4aeb0Sopenharmony_ci
11002f4aeb0Sopenharmony_ci    EGLImageKHR eglCreateImageKHR(
11102f4aeb0Sopenharmony_ci                            EGLDisplay dpy,
11202f4aeb0Sopenharmony_ci                            EGLContext ctx,
11302f4aeb0Sopenharmony_ci                            EGLenum target,
11402f4aeb0Sopenharmony_ci                            EGLClientBuffer buffer,
11502f4aeb0Sopenharmony_ci                            const EGLint *attrib_list)
11602f4aeb0Sopenharmony_ci
11702f4aeb0Sopenharmony_ci    EGLBoolean eglDestroyImageKHR(
11802f4aeb0Sopenharmony_ci                            EGLDisplay dpy,
11902f4aeb0Sopenharmony_ci                            EGLImageKHR image)
12002f4aeb0Sopenharmony_ci
12102f4aeb0Sopenharmony_ciNew Tokens
12202f4aeb0Sopenharmony_ci
12302f4aeb0Sopenharmony_ci    Returned by eglCreateImageKHR:
12402f4aeb0Sopenharmony_ci
12502f4aeb0Sopenharmony_ci        EGL_NO_IMAGE_KHR                                     ((EGLImageKHR)0)
12602f4aeb0Sopenharmony_ci
12702f4aeb0Sopenharmony_ci    Accepted as an attribute in the <attrib_list> parameter of
12802f4aeb0Sopenharmony_ci    eglCreateImageKHR:
12902f4aeb0Sopenharmony_ci
13002f4aeb0Sopenharmony_ci        EGL_IMAGE_PRESERVED_KHR                              0x30D2
13102f4aeb0Sopenharmony_ci
13202f4aeb0Sopenharmony_ciAdditions to Chapter 2 of the EGL 1.2 Specification (EGL Operation)
13302f4aeb0Sopenharmony_ci
13402f4aeb0Sopenharmony_ci    Add a new section "EGLImages" after section 2.4:
13502f4aeb0Sopenharmony_ci
13602f4aeb0Sopenharmony_ci    "2.5 EGLImages
13702f4aeb0Sopenharmony_ci
13802f4aeb0Sopenharmony_ci    As described in section 2.4, EGL allows contexts of the same client
13902f4aeb0Sopenharmony_ci    API type to share significant amounts of state (such as OpenGL-ES
14002f4aeb0Sopenharmony_ci    texture objects and OpenVG paths); however, in some cases it may
14102f4aeb0Sopenharmony_ci    be desirable to share state between client APIs - an example would be
14202f4aeb0Sopenharmony_ci    using a previously-rendered OpenVG image as an OpenGL-ES texture
14302f4aeb0Sopenharmony_ci    object.
14402f4aeb0Sopenharmony_ci
14502f4aeb0Sopenharmony_ci    In order to facilitate these more complicated use-cases, EGL is capable
14602f4aeb0Sopenharmony_ci    of creating EGL resources that can be shared between contexts of
14702f4aeb0Sopenharmony_ci    different client APIs (called "EGLImages") from client API resources
14802f4aeb0Sopenharmony_ci    such as texel arrays in OpenGL-ES texture objects or OpenVG VGImages
14902f4aeb0Sopenharmony_ci    (collectively, the resources that are used to create EGLImages are
15002f4aeb0Sopenharmony_ci    referred to as "EGLImage sources").
15102f4aeb0Sopenharmony_ci
15202f4aeb0Sopenharmony_ci    The EGL client APIs each provide mechanisms for creating appropriate
15302f4aeb0Sopenharmony_ci    resource types (such as complete texture arrays or OpenVG VGImages) from
15402f4aeb0Sopenharmony_ci    EGLImages through a API-specific mechanisms.  Collectively, resources
15502f4aeb0Sopenharmony_ci    which are created from EGLImages within client APIs are referred to as
15602f4aeb0Sopenharmony_ci    "EGLImage targets."  Each EGLImage may have multiple associated EGLImage
15702f4aeb0Sopenharmony_ci    targets.  Collectively, the EGLImage source and EGLImage targets
15802f4aeb0Sopenharmony_ci    associated with an EGLImage object are referred to as "EGLImage
15902f4aeb0Sopenharmony_ci    siblings."
16002f4aeb0Sopenharmony_ci
16102f4aeb0Sopenharmony_ci    2.5.1  EGLImage Specification
16202f4aeb0Sopenharmony_ci
16302f4aeb0Sopenharmony_ci    The command
16402f4aeb0Sopenharmony_ci
16502f4aeb0Sopenharmony_ci        EGLImageKHR eglCreateImageKHR(
16602f4aeb0Sopenharmony_ci                                EGLDisplay dpy,
16702f4aeb0Sopenharmony_ci                                EGLContext ctx,
16802f4aeb0Sopenharmony_ci                                EGLenum target,
16902f4aeb0Sopenharmony_ci                                EGLClientBuffer buffer,
17002f4aeb0Sopenharmony_ci                                const EGLint *attrib_list)
17102f4aeb0Sopenharmony_ci
17202f4aeb0Sopenharmony_ci    is used to create an EGLImage from an existing image resource <buffer>.
17302f4aeb0Sopenharmony_ci    <dpy> specifies the EGL display used for this operation.
17402f4aeb0Sopenharmony_ci    <ctx> specifies the EGL client API context
17502f4aeb0Sopenharmony_ci    used for this operation, or EGL_NO_CONTEXT if a client API context is not
17602f4aeb0Sopenharmony_ci    required.  <target> specifies the type of resource being used as the
17702f4aeb0Sopenharmony_ci    EGLImage source (examples include two-dimensional textures in OpenGL ES
17802f4aeb0Sopenharmony_ci    contexts and VGImage objects in OpenVG contexts).  <buffer> is the name
17902f4aeb0Sopenharmony_ci    (or handle) of a resource to be used as the EGLImage source, cast into the
18002f4aeb0Sopenharmony_ci    type EGLClientBuffer.  <attrib_list> is an list of attribute-value pairs
18102f4aeb0Sopenharmony_ci    which is used to select sub-sections of <buffer> for use as the EGLImage
18202f4aeb0Sopenharmony_ci    source, such as mipmap levels for OpenGL ES texture map resources, as well as
18302f4aeb0Sopenharmony_ci    behavioral options, such as whether to preserve pixel data during creation. If
18402f4aeb0Sopenharmony_ci    <attrib_list> is non-NULL, the last attribute specified in the list must
18502f4aeb0Sopenharmony_ci    be EGL_NONE.
18602f4aeb0Sopenharmony_ci
18702f4aeb0Sopenharmony_ci    The resource specified by <dpy>, <ctx>, <target>, <buffer>, and
18802f4aeb0Sopenharmony_ci    <attrib_list> must not itself be an EGLImage sibling, or bound to an EGL
18902f4aeb0Sopenharmony_ci    PBuffer resource (eglBindTexImage, eglCreatePbufferFromClientBuffer).
19002f4aeb0Sopenharmony_ci
19102f4aeb0Sopenharmony_ci    Values accepted for <target> are listed in Table aaa, below(fn1).
19202f4aeb0Sopenharmony_ci        (fn1) No values are defined by this extension. All functionality
19302f4aeb0Sopenharmony_ci        to create EGLImages from other types of resources, such as
19402f4aeb0Sopenharmony_ci        native pixmaps, GL textures, and VGImages, is layered in other
19502f4aeb0Sopenharmony_ci        extensions.
19602f4aeb0Sopenharmony_ci
19702f4aeb0Sopenharmony_ci      +-------------------------+--------------------------------------------+
19802f4aeb0Sopenharmony_ci      |  <target>               |  Notes                                     |
19902f4aeb0Sopenharmony_ci      +-------------------------+--------------------------------------------+
20002f4aeb0Sopenharmony_ci      +-------------------------+--------------------------------------------+
20102f4aeb0Sopenharmony_ci       Table aaa.  Legal values for eglCreateImageKHR <target> parameter
20202f4aeb0Sopenharmony_ci
20302f4aeb0Sopenharmony_ci    Attribute names accepted in <attrib_list> are shown in Table bbb,
20402f4aeb0Sopenharmony_ci    together with the <target> for which each attribute name is valid, and
20502f4aeb0Sopenharmony_ci    the default value used for each attribute if it is not included in
20602f4aeb0Sopenharmony_ci    <attrib_list>.
20702f4aeb0Sopenharmony_ci
20802f4aeb0Sopenharmony_ci      +-------------------------+----------------------+-----------+---------------+
20902f4aeb0Sopenharmony_ci      | Attribute               | Description          | Valid     | Default Value |
21002f4aeb0Sopenharmony_ci      |                         |                      | <target>s |               |
21102f4aeb0Sopenharmony_ci      +-------------------------+----------------------+-----------+---------------+
21202f4aeb0Sopenharmony_ci      | EGL_NONE                | Marks the end of the | All       | N/A           |
21302f4aeb0Sopenharmony_ci      |                         | attribute-value list |           |               |
21402f4aeb0Sopenharmony_ci      | EGL_IMAGE_PRESERVED_KHR | Whether to preserve  | All       | EGL_FALSE     |
21502f4aeb0Sopenharmony_ci      |                         | pixel data           |           |               |
21602f4aeb0Sopenharmony_ci      +-------------------------+----------------------+-----------+---------------+
21702f4aeb0Sopenharmony_ci       Table bbb.  Legal attributes for eglCreateImageKHR <attrib_list> parameter
21802f4aeb0Sopenharmony_ci
21902f4aeb0Sopenharmony_ci    This command returns an EGLImageKHR object corresponding to the image
22002f4aeb0Sopenharmony_ci    data specified by <dpy>, <ctx>, <target>, <buffer> and <attrib_list> which
22102f4aeb0Sopenharmony_ci    may be referenced by client API operations, or EGL_NO_IMAGE_KHR in the
22202f4aeb0Sopenharmony_ci    event of an error.
22302f4aeb0Sopenharmony_ci
22402f4aeb0Sopenharmony_ci    If the value of attribute EGL_IMAGE_PRESERVED_KHR is EGL_FALSE (the
22502f4aeb0Sopenharmony_ci    default), then all pixel data values associated with <buffer> will be
22602f4aeb0Sopenharmony_ci    undefined after eglCreateImageKHR returns.
22702f4aeb0Sopenharmony_ci
22802f4aeb0Sopenharmony_ci    If the value of attribute EGL_IMAGE_PRESERVED_KHR is EGL_TRUE, then all
22902f4aeb0Sopenharmony_ci    pixel data values associated with <buffer> are preserved.
23002f4aeb0Sopenharmony_ci
23102f4aeb0Sopenharmony_ci    Errors
23202f4aeb0Sopenharmony_ci
23302f4aeb0Sopenharmony_ci        If eglCreateImageKHR fails, EGL_NO_IMAGE_KHR will be returned, the
23402f4aeb0Sopenharmony_ci        contents of <buffer> will be unaffected, and one of the following
23502f4aeb0Sopenharmony_ci        errors will be generated:
23602f4aeb0Sopenharmony_ci
23702f4aeb0Sopenharmony_ci       * If <dpy> is not the handle of a valid EGLDisplay object, the error
23802f4aeb0Sopenharmony_ci         EGL_BAD_DISPLAY is generated.
23902f4aeb0Sopenharmony_ci
24002f4aeb0Sopenharmony_ci       * If <ctx> is neither the handle of a valid EGLContext object on
24102f4aeb0Sopenharmony_ci         <dpy> nor EGL_NO_CONTEXT, the error EGL_BAD_CONTEXT is
24202f4aeb0Sopenharmony_ci         generated.
24302f4aeb0Sopenharmony_ci
24402f4aeb0Sopenharmony_ci       * If <target> is not one of the values in Table aaa, the error
24502f4aeb0Sopenharmony_ci         EGL_BAD_PARAMETER is generated.
24602f4aeb0Sopenharmony_ci
24702f4aeb0Sopenharmony_ci       * If an attribute specified in <attrib_list> is not one of the
24802f4aeb0Sopenharmony_ci         attributes listed in Table bbb, the error EGL_BAD_PARAMETER is
24902f4aeb0Sopenharmony_ci         generated.
25002f4aeb0Sopenharmony_ci
25102f4aeb0Sopenharmony_ci       * If an attribute specified in <attrib_list> is not a valid attribute
25202f4aeb0Sopenharmony_ci         for <target>, as shown in Table bbb, the error EGL_BAD_MATCH is
25302f4aeb0Sopenharmony_ci         generated.
25402f4aeb0Sopenharmony_ci
25502f4aeb0Sopenharmony_ci       * If the resource specified by <dpy>, <ctx>, <target>, <buffer> and
25602f4aeb0Sopenharmony_ci         <attrib_list> has an off-screen buffer bound to it (e.g., by a
25702f4aeb0Sopenharmony_ci         previous call to eglBindTexImage), the error EGL_BAD_ACCESS is
25802f4aeb0Sopenharmony_ci         generated.
25902f4aeb0Sopenharmony_ci
26002f4aeb0Sopenharmony_ci       * If the resource specified by <dpy>, <ctx>, <target>, <buffer> and
26102f4aeb0Sopenharmony_ci         <attrib_list> is bound to an off-screen buffer (e.g., by a previous
26202f4aeb0Sopenharmony_ci         call to eglCreatePbufferFromClientBuffer), the error
26302f4aeb0Sopenharmony_ci         EGL_BAD_ACCESS is generated.
26402f4aeb0Sopenharmony_ci
26502f4aeb0Sopenharmony_ci       * If the resource specified by <dpy>, <ctx>, <target>, <buffer> and
26602f4aeb0Sopenharmony_ci         <attrib_list> is itself an EGLImage sibling, the error
26702f4aeb0Sopenharmony_ci         EGL_BAD_ACCESS is generated.
26802f4aeb0Sopenharmony_ci
26902f4aeb0Sopenharmony_ci       * If insufficient memory is available to complete the specified
27002f4aeb0Sopenharmony_ci         operation, the error EGL_BAD_ALLOC is generated.
27102f4aeb0Sopenharmony_ci
27202f4aeb0Sopenharmony_ci       * If the call to eglCreateImageKHR fails for multiple reasons, the
27302f4aeb0Sopenharmony_ci         generated error must be appropriate for one of the reasons,
27402f4aeb0Sopenharmony_ci         although the specific error returned is undefined.
27502f4aeb0Sopenharmony_ci
27602f4aeb0Sopenharmony_ci       * If the value specified in <attrib_list> for EGL_IMAGE_PRESERVED_KHR
27702f4aeb0Sopenharmony_ci         is EGL_TRUE, and an EGLImageKHR handle cannot be created from the
27802f4aeb0Sopenharmony_ci         specified resource such that the pixel data values in <buffer> are
27902f4aeb0Sopenharmony_ci         preserved, the error EGL_BAD_ACCESS is generated.
28002f4aeb0Sopenharmony_ci
28102f4aeb0Sopenharmony_ci    Note that the success or failure of eglCreateImageKHR should not affect
28202f4aeb0Sopenharmony_ci    the ability to use <buffer> in its original API context (or context
28302f4aeb0Sopenharmony_ci    share group) (although the pixel data values will be undefined if
28402f4aeb0Sopenharmony_ci    EGL_IMAGE_PRESERVED_KHR is not EGL_TRUE).
28502f4aeb0Sopenharmony_ci
28602f4aeb0Sopenharmony_ci    2.5.2  Lifetime and Usage of EGLImages
28702f4aeb0Sopenharmony_ci
28802f4aeb0Sopenharmony_ci    Once an EGLImage is created from an EGLImage source, the memory associated
28902f4aeb0Sopenharmony_ci    with the EGLImage source will remain allocated (and all EGLImage siblings
29002f4aeb0Sopenharmony_ci    in all client API contexts will be useable) as long as either of the
29102f4aeb0Sopenharmony_ci    following conditions is true:
29202f4aeb0Sopenharmony_ci      A)  Any EGLImage siblings exist in any client API context
29302f4aeb0Sopenharmony_ci      B)  The EGLImage object exists inside EGL
29402f4aeb0Sopenharmony_ci
29502f4aeb0Sopenharmony_ci    The semantics for specifying, deleting and using EGLImage siblings are
29602f4aeb0Sopenharmony_ci    client API-specific, and are described in the appropriate API
29702f4aeb0Sopenharmony_ci    specifications.
29802f4aeb0Sopenharmony_ci
29902f4aeb0Sopenharmony_ci    If an application specifies an EGLImage sibling as the destination for
30002f4aeb0Sopenharmony_ci    rendering and/or pixel download operations (e.g., as an OpenGL-ES
30102f4aeb0Sopenharmony_ci    framebuffer object, glTexSubImage2D, etc.), the modified image results
30202f4aeb0Sopenharmony_ci    will be observed by all EGLImage siblings in all client API contexts.
30302f4aeb0Sopenharmony_ci    If multiple client API contexts access EGLImage sibling resources
30402f4aeb0Sopenharmony_ci    simultaneously, with one or more context modifying the image data,
30502f4aeb0Sopenharmony_ci    rendering results in all contexts accessing EGLImage siblings are
30602f4aeb0Sopenharmony_ci    undefined.
30702f4aeb0Sopenharmony_ci
30802f4aeb0Sopenharmony_ci    Respecification and/or deletion of any EGLImage sibling (i.e., both
30902f4aeb0Sopenharmony_ci    EGLImage source and EGLImage target resources) inside a client API
31002f4aeb0Sopenharmony_ci    context (e.g., by issuing a subsequent call to
31102f4aeb0Sopenharmony_ci    gl{Copy,Compressed}TexImage, glDeleteTextures, with the EGLImage
31202f4aeb0Sopenharmony_ci    sibling resource as the target of the operation) affects only that
31302f4aeb0Sopenharmony_ci    client API context and other contexts within its share group.  The
31402f4aeb0Sopenharmony_ci    specific semantics for this behavior are defined by each client API,
31502f4aeb0Sopenharmony_ci    and generally results in orphaning of the EGLImage, and may also
31602f4aeb0Sopenharmony_ci    include allocation of additional memory for the respecified resource
31702f4aeb0Sopenharmony_ci    and/or copying of the EGLImage pixel data.
31802f4aeb0Sopenharmony_ci
31902f4aeb0Sopenharmony_ci    Operations inside EGL or any client API context which may affect the
32002f4aeb0Sopenharmony_ci    lifetime of an EGLImage (or the memory allocated for the EGLImage),
32102f4aeb0Sopenharmony_ci    such as respecifying and/or deleting an EGLImage sibling inside a
32202f4aeb0Sopenharmony_ci    client API context, must be atomic.
32302f4aeb0Sopenharmony_ci
32402f4aeb0Sopenharmony_ci    Applications may create client API resources from an EGLImageKHR using
32502f4aeb0Sopenharmony_ci    client API extensions outside the scope of this document (such as
32602f4aeb0Sopenharmony_ci    GL_OES_EGL_image, which creates OpenGL ES texture and renderbuffer
32702f4aeb0Sopenharmony_ci    objects). If the EGLImageKHR used to create the client resource was
32802f4aeb0Sopenharmony_ci    created with the EGL_IMAGE_PRESERVED_KHR attribute set to EGL_TRUE, then
32902f4aeb0Sopenharmony_ci    the pixel data values associated with the image will be preserved after
33002f4aeb0Sopenharmony_ci    creating the client resource; otherwise, the pixel data values will be
33102f4aeb0Sopenharmony_ci    undefined. If the EGLImageKHR was created with the
33202f4aeb0Sopenharmony_ci    EGL_IMAGE_PRESERVED_KHR attribute set to EGL_TRUE, and EGL is unable to
33302f4aeb0Sopenharmony_ci    create the client resource without modifying the pixel values, then
33402f4aeb0Sopenharmony_ci    creation will fail and the pixel data values will be preserved.
33502f4aeb0Sopenharmony_ci
33602f4aeb0Sopenharmony_ci    The command
33702f4aeb0Sopenharmony_ci
33802f4aeb0Sopenharmony_ci        EGLBoolean eglDestroyImageKHR(
33902f4aeb0Sopenharmony_ci                            EGLDisplay dpy,
34002f4aeb0Sopenharmony_ci                            EGLImageKHR image)
34102f4aeb0Sopenharmony_ci
34202f4aeb0Sopenharmony_ci    is used to destroy the specified EGLImageKHR object <image>.  Once
34302f4aeb0Sopenharmony_ci    destroyed, <image> may not be used to create any additional EGLImage
34402f4aeb0Sopenharmony_ci    target resources within any client API contexts, although existing
34502f4aeb0Sopenharmony_ci    EGLImage siblings may continue to be used.  EGL_TRUE is returned
34602f4aeb0Sopenharmony_ci    if DestroyImageKHR succeeds, EGL_FALSE indicates failure.
34702f4aeb0Sopenharmony_ci
34802f4aeb0Sopenharmony_ci       * If <dpy> is not the handle of a valid EGLDisplay object, the error
34902f4aeb0Sopenharmony_ci         EGL_BAD_DISPLAY is generated.
35002f4aeb0Sopenharmony_ci
35102f4aeb0Sopenharmony_ci       * If <image> is not a valid EGLImageKHR object created with respect
35202f4aeb0Sopenharmony_ci         to <dpy>, the error EGL_BAD_PARAMETER is generated."
35302f4aeb0Sopenharmony_ci
35402f4aeb0Sopenharmony_ci    Add a new error to the list at the bottom of Section 3.5.3 (Binding
35502f4aeb0Sopenharmony_ci    Off-Screen Rendering Surfaces to Client Buffers):
35602f4aeb0Sopenharmony_ci
35702f4aeb0Sopenharmony_ci       "* If the buffers contained in <buffer> consist of any EGLImage
35802f4aeb0Sopenharmony_ci          siblings, an EGL_BAD_ACCESS error is generated."
35902f4aeb0Sopenharmony_ci
36002f4aeb0Sopenharmony_ciIssues
36102f4aeb0Sopenharmony_ci
36202f4aeb0Sopenharmony_ci    1.  What resource types should be supported by this extension?
36302f4aeb0Sopenharmony_ci
36402f4aeb0Sopenharmony_ci        RESOLVED:  This specification is designed to support the
36502f4aeb0Sopenharmony_ci        sharing of two-dimensional image resources between client APIs,
36602f4aeb0Sopenharmony_ci        as these resources are a fundamental component of all modern
36702f4aeb0Sopenharmony_ci        graphics APIs.
36802f4aeb0Sopenharmony_ci
36902f4aeb0Sopenharmony_ci        Other resources types (e.g., buffer objects) will not be directly
37002f4aeb0Sopenharmony_ci        supported by this specification, due to a variety of reasons:
37102f4aeb0Sopenharmony_ci
37202f4aeb0Sopenharmony_ci            a.  An absense of use cases for this functionality
37302f4aeb0Sopenharmony_ci            b.  Handling the semantics for some of these resources
37402f4aeb0Sopenharmony_ci                (e.g., glMapBuffer) would significantly complicate
37502f4aeb0Sopenharmony_ci                and delay this specification.
37602f4aeb0Sopenharmony_ci            c.  A desire to address the image-sharing use cases
37702f4aeb0Sopenharmony_ci                as quickly as possible.
37802f4aeb0Sopenharmony_ci
37902f4aeb0Sopenharmony_ci        Should additional resource-sharing functionality be desired
38002f4aeb0Sopenharmony_ci        in the future, the framework provided by this specification
38102f4aeb0Sopenharmony_ci        should be extendable to handle more general resource
38202f4aeb0Sopenharmony_ci        sharing.
38302f4aeb0Sopenharmony_ci
38402f4aeb0Sopenharmony_ci    2.  Should this specification address client API-specific resources
38502f4aeb0Sopenharmony_ci        (OpenGL texture maps, OpenVG VGImages), or should that
38602f4aeb0Sopenharmony_ci        functionality be provided by layered extensions?
38702f4aeb0Sopenharmony_ci
38802f4aeb0Sopenharmony_ci        SUGGESTION: Use layered extensions, even for for sharing image
38902f4aeb0Sopenharmony_ci        data with native rendering APIs (the EGL_KHR_image_pixmap
39002f4aeb0Sopenharmony_ci        extension).
39102f4aeb0Sopenharmony_ci
39202f4aeb0Sopenharmony_ci        There are two major arguments for using layered extensions:
39302f4aeb0Sopenharmony_ci
39402f4aeb0Sopenharmony_ci          1.  The two client APIs which are defined at the time of this
39502f4aeb0Sopenharmony_ci              specification (OpenVG, OpenGL ES) may not always be
39602f4aeb0Sopenharmony_ci              deployed on a device; many devices may choose to implement
39702f4aeb0Sopenharmony_ci              just one of these two APIs.  However, even single-API
39802f4aeb0Sopenharmony_ci              devices may benefit from the ability to share image data
39902f4aeb0Sopenharmony_ci              with native rendering APIs (provided in this specification)
40002f4aeb0Sopenharmony_ci              or with the OpenMAX API.
40102f4aeb0Sopenharmony_ci
40202f4aeb0Sopenharmony_ci          2.  OpenGL ES defines a number of optional resource types
40302f4aeb0Sopenharmony_ci              (cubemaps, renderbuffers, volumetric textures) which this
40402f4aeb0Sopenharmony_ci              framework should support; however, implementations may not.
40502f4aeb0Sopenharmony_ci              By layering each of these resource types in individual
40602f4aeb0Sopenharmony_ci              extensions, implementations which are limited to just the
40702f4aeb0Sopenharmony_ci              core OpenGL ES 1.1 (or OpenGL ES 2.0) features will not
40802f4aeb0Sopenharmony_ci              need to add EGLImage enumerant support for unsupported
40902f4aeb0Sopenharmony_ci              resource types.
41002f4aeb0Sopenharmony_ci
41102f4aeb0Sopenharmony_ci        The original EGL_KHR_image extension included native pixmap
41202f4aeb0Sopenharmony_ci        functionality. We have now split the abstract base functionality
41302f4aeb0Sopenharmony_ci        (the egl{Create,Destroy}ImageKHR APIs) from the native pixmap
41402f4aeb0Sopenharmony_ci        functionality, and redefined EGL_KHR_image as the combination of
41502f4aeb0Sopenharmony_ci        EGL_KHR_image_base and EGL_KHR_image_pixmap.
41602f4aeb0Sopenharmony_ci
41702f4aeb0Sopenharmony_ci    3.  Should attributes (width, height, format, etc.) for EGLImages
41802f4aeb0Sopenharmony_ci        be queriable?
41902f4aeb0Sopenharmony_ci
42002f4aeb0Sopenharmony_ci        SUGGESTION:  No.  Given the wealth of attributes that we would
42102f4aeb0Sopenharmony_ci        need to specify all possible EGLImages (and possible
42202f4aeb0Sopenharmony_ci        memory layout optimizations performed by implementations), we
42302f4aeb0Sopenharmony_ci        can dramatically simplify the API without loss of key
42402f4aeb0Sopenharmony_ci        functionality by making EGLImages opaque and allowing
42502f4aeb0Sopenharmony_ci        implementations to make the correct decisions internally.
42602f4aeb0Sopenharmony_ci
42702f4aeb0Sopenharmony_ci    4.  Should this specification allow the creation of EGLImages from
42802f4aeb0Sopenharmony_ci        client API resources which are themselves EGLImage targets?
42902f4aeb0Sopenharmony_ci
43002f4aeb0Sopenharmony_ci        RESOLVED:  No.  This can make memory garbage collection and
43102f4aeb0Sopenharmony_ci        reference counting more difficult, with no practical benefit.
43202f4aeb0Sopenharmony_ci        Instead, generate an error if an application attempts to
43302f4aeb0Sopenharmony_ci        create an EGLImage from an EGLImage target resource.
43402f4aeb0Sopenharmony_ci
43502f4aeb0Sopenharmony_ci    5.  Should this specification allow multiple EGLImages to be created
43602f4aeb0Sopenharmony_ci        from the same EGLImage source resource?
43702f4aeb0Sopenharmony_ci
43802f4aeb0Sopenharmony_ci        RESOLVED:  No.  The resource <buffer> specified to
43902f4aeb0Sopenharmony_ci        eglCreateImageKHR may include multiple sub-objects; examples are
44002f4aeb0Sopenharmony_ci        mipmapped images and cubemaps in the OpenGL-ES API.  However, the
44102f4aeb0Sopenharmony_ci        EGLImage source is defined as the specific sub-object that is defined
44202f4aeb0Sopenharmony_ci        by: <ctx>, <target>, <buffer>, and <attrib_list>.  This sub-object must
44302f4aeb0Sopenharmony_ci        not be an EGLImage sibling (either EGLImage source or EGLImage target)
44402f4aeb0Sopenharmony_ci        when eglCreateImageKHR is called; however, other sub-objects in
44502f4aeb0Sopenharmony_ci        <buffer> may be EGLImage siblings.  This allows applications to share
44602f4aeb0Sopenharmony_ci        individual cubemap faces, or individual mipmap levels of detail across
44702f4aeb0Sopenharmony_ci        all of the supported APIs.
44802f4aeb0Sopenharmony_ci
44902f4aeb0Sopenharmony_ci        Note that the EGLImage source and any EGLImage target resources
45002f4aeb0Sopenharmony_ci        will still be EGLImage siblings, even if the EGLImage object
45102f4aeb0Sopenharmony_ci        is destroyed by a call to DestroyImageKHR.
45202f4aeb0Sopenharmony_ci
45302f4aeb0Sopenharmony_ci    6.  If an EGLImage sibling is respecified (or deleted), what
45402f4aeb0Sopenharmony_ci        should happen to the EGLImage and any other EGLImage
45502f4aeb0Sopenharmony_ci        siblings?
45602f4aeb0Sopenharmony_ci
45702f4aeb0Sopenharmony_ci        RESOLVED:  The principle of least surprise would dictate that
45802f4aeb0Sopenharmony_ci        respecification and/or deletion of a resource in one client API
45902f4aeb0Sopenharmony_ci        should not adversely affect operation in other client APIs
46002f4aeb0Sopenharmony_ci        (such as introducing errors).
46102f4aeb0Sopenharmony_ci
46202f4aeb0Sopenharmony_ci        Applying this to EGLImages, respecification and/or deletion
46302f4aeb0Sopenharmony_ci        of one EGLImage sibling should not respecify/delete other
46402f4aeb0Sopenharmony_ci        EGLImage siblings.  Each client API will be responsible for
46502f4aeb0Sopenharmony_ci        defining appropriate semantics to meet this restriction;
46602f4aeb0Sopenharmony_ci        however, example behaviors may include one or more of:
46702f4aeb0Sopenharmony_ci        allocating additional memory for the respecified resource,
46802f4aeb0Sopenharmony_ci        deleting the EGLImage sibling resource without deallocating
46902f4aeb0Sopenharmony_ci        the associated memory ("orphaning") and/or copying the
47002f4aeb0Sopenharmony_ci        existing EGLImage pixel data to an alternate memory location.
47102f4aeb0Sopenharmony_ci
47202f4aeb0Sopenharmony_ci        The memory associated with EGLImage objects should remain
47302f4aeb0Sopenharmony_ci        allocated as long as any EGLImage sibling resources exist
47402f4aeb0Sopenharmony_ci        in any client API context.
47502f4aeb0Sopenharmony_ci
47602f4aeb0Sopenharmony_ci    7.  Should this specification address synchronization issues
47702f4aeb0Sopenharmony_ci        when multiple client API contexts simultaneously access EGLImage
47802f4aeb0Sopenharmony_ci        sibling resources?
47902f4aeb0Sopenharmony_ci
48002f4aeb0Sopenharmony_ci        RESOLVED:  No.  Including error-producing lock and synchronization
48102f4aeb0Sopenharmony_ci        semantics would introduce additional (undesirable) validation
48202f4aeb0Sopenharmony_ci        overhead in numerous common operations (e.g., glBindTexture,
48302f4aeb0Sopenharmony_ci        glDrawArrays, etc.).  Rather than burdening implementations (and
48402f4aeb0Sopenharmony_ci        applications) with this overhead, a separate synchronization
48502f4aeb0Sopenharmony_ci        mechanism should be exposed to applications.
48602f4aeb0Sopenharmony_ci
48702f4aeb0Sopenharmony_ci    8.  Should eglCreatePbufferFromClientBuffer accept buffer parameters
48802f4aeb0Sopenharmony_ci        which are EGLImage siblings?
48902f4aeb0Sopenharmony_ci
49002f4aeb0Sopenharmony_ci        RESOLVED:  No.  Allowing this behavior creates very complex
49102f4aeb0Sopenharmony_ci        circular dependency possibilities (CreateImage / DeriveImage /
49202f4aeb0Sopenharmony_ci        CreatePbufferFromClientBuffer / BindTexImage /
49302f4aeb0Sopenharmony_ci        CreateImage / ...) with no practical benefit.  Therefore,
49402f4aeb0Sopenharmony_ci        attempting to create a Pbuffer from a client buffer which
49502f4aeb0Sopenharmony_ci        is an EGLImage sibling should generate an error.
49602f4aeb0Sopenharmony_ci
49702f4aeb0Sopenharmony_ci    9.  Should CreateImage accept client buffers which are bound to
49802f4aeb0Sopenharmony_ci        Pbuffers (through eglBindTexImage)?
49902f4aeb0Sopenharmony_ci
50002f4aeb0Sopenharmony_ci        RESOLVED:  No, for the same reasons listed in Issue 8.
50102f4aeb0Sopenharmony_ci
50202f4aeb0Sopenharmony_ci    10. Should implementations be allowed to modify the pixel data in the
50302f4aeb0Sopenharmony_ci        EGLImage source buffers specified to eglCreateImageKHR?
50402f4aeb0Sopenharmony_ci
50502f4aeb0Sopenharmony_ci        SUGGESTION:  By allowing previously-existing image data to become
50602f4aeb0Sopenharmony_ci        undefined after calls to eglCreateImageKHR, implementations are able
50702f4aeb0Sopenharmony_ci        to perform any necessary reallocations required for cross-API
50802f4aeb0Sopenharmony_ci        buffer compatibility (and/or performance), without requiring
50902f4aeb0Sopenharmony_ci        copy-aside functionality.  Because applications are able to
51002f4aeb0Sopenharmony_ci        respecify the pixel data through mechanisms such as vgSubImage
51102f4aeb0Sopenharmony_ci        and glTexSubImage, no use-cases are restricted by this.
51202f4aeb0Sopenharmony_ci
51302f4aeb0Sopenharmony_ci        Therefore, the current suggestion is to allow implementations
51402f4aeb0Sopenharmony_ci        to leave pixel data undefined after calls to eglCreateImageKHR
51502f4aeb0Sopenharmony_ci        functions.  The current spec revision has been written in
51602f4aeb0Sopenharmony_ci        this way.
51702f4aeb0Sopenharmony_ci
51802f4aeb0Sopenharmony_ci    11. What is the correct mechanism for specifying the EGLImage source
51902f4aeb0Sopenharmony_ci        resources used to create an EGLImage object?
52002f4aeb0Sopenharmony_ci
52102f4aeb0Sopenharmony_ci        RESOLVED:  Three different mechanisms were discussed while
52202f4aeb0Sopenharmony_ci        defining this extension:
52302f4aeb0Sopenharmony_ci
52402f4aeb0Sopenharmony_ci            A)  Providing resource-specific creation functions, such as
52502f4aeb0Sopenharmony_ci                eglCreateImage2DKHR, eglCreateImage3DKHR, etc.
52602f4aeb0Sopenharmony_ci
52702f4aeb0Sopenharmony_ci            B)  Providing a single creation function which returns a
52802f4aeb0Sopenharmony_ci                "NULL" EGLImage object, and requiring client APIs to
52902f4aeb0Sopenharmony_ci                define additional functions which would allow client API
53002f4aeb0Sopenharmony_ci                resources to be "bound" to the EGLImage object.
53102f4aeb0Sopenharmony_ci
53202f4aeb0Sopenharmony_ci            C)  Provide a single resource creation function, and use
53302f4aeb0Sopenharmony_ci                an attribute-value list with attributes specific to the
53402f4aeb0Sopenharmony_ci                "target" image resource.
53502f4aeb0Sopenharmony_ci
53602f4aeb0Sopenharmony_ci        Initial specifications were written using Option (A); however,
53702f4aeb0Sopenharmony_ci        it was believed that this structure would result in an increase
53802f4aeb0Sopenharmony_ci        in the number of entry points over time as additional client APIs
53902f4aeb0Sopenharmony_ci        and client API resource targets were added.  Furthermore, reuse
54002f4aeb0Sopenharmony_ci        of these functions was resulting in cases where parameters were
54102f4aeb0Sopenharmony_ci        required to have modal behavior: a 2D image creation function
54202f4aeb0Sopenharmony_ci        was required to have a mipmap level of detail parameter for
54302f4aeb0Sopenharmony_ci        OpenGL ES texture maps, but this same parameter would need to be
54402f4aeb0Sopenharmony_ci        0 for OpenVG.
54502f4aeb0Sopenharmony_ci
54602f4aeb0Sopenharmony_ci        Option (B) provided some nice characteristics: as client APIs
54702f4aeb0Sopenharmony_ci        continue to evolve, any extensions needed to allow EGLImage
54802f4aeb0Sopenharmony_ci        creation could be isolated in the individual client API, rather
54902f4aeb0Sopenharmony_ci        than necessitating an EGL extension.  However, the creation of
55002f4aeb0Sopenharmony_ci        "NULL" images created additional semantic complexity and error
55102f4aeb0Sopenharmony_ci        conditions (e.g., attempting to derive an EGLImage target from a
55202f4aeb0Sopenharmony_ci        "NULL" image), and every client API would need to provide a
55302f4aeb0Sopenharmony_ci        function for every unique resource type; instead of one common
55402f4aeb0Sopenharmony_ci        API function for pixmap, OpenGL 2D textures, and OpenVG VGImages,
55502f4aeb0Sopenharmony_ci        three would be required.
55602f4aeb0Sopenharmony_ci
55702f4aeb0Sopenharmony_ci        This specification is written using Option (C).  There is a
55802f4aeb0Sopenharmony_ci        single CreateImage function, with a <target> parameter defining
55902f4aeb0Sopenharmony_ci        the EGLImage source type, and an attribute-value list allowing
56002f4aeb0Sopenharmony_ci        for additional selection of resource sub-sections.  This
56102f4aeb0Sopenharmony_ci        maximizes entry-point reuse, and minimizes the number of
56202f4aeb0Sopenharmony_ci        redundant parameters an application may be required to send.
56302f4aeb0Sopenharmony_ci        This framework allows for layered extensions to be easily
56402f4aeb0Sopenharmony_ci        written, so little churn is expected as client APIs evolve.
56502f4aeb0Sopenharmony_ci
56602f4aeb0Sopenharmony_ci    12. Should a context be explicitly provided to eglCreateImageKHR,
56702f4aeb0Sopenharmony_ci        or should the context be deduced from the current thread's
56802f4aeb0Sopenharmony_ci        bound API?
56902f4aeb0Sopenharmony_ci
57002f4aeb0Sopenharmony_ci        SUGGESTION:  For clarity (both in usage and spec language), the
57102f4aeb0Sopenharmony_ci        context containing the EGLImage source should be provided by the
57202f4aeb0Sopenharmony_ci        application, rather than inferring the context from EGL state.
57302f4aeb0Sopenharmony_ci
57402f4aeb0Sopenharmony_ci    13. Why does this extension define a new EGL object type, rather
57502f4aeb0Sopenharmony_ci        than using the existing EGLSurface objects?
57602f4aeb0Sopenharmony_ci
57702f4aeb0Sopenharmony_ci        RESOLVED:  Although controversial, the creation of a new,
57802f4aeb0Sopenharmony_ci        opaque image object type removes several fundamental problems
57902f4aeb0Sopenharmony_ci        with the EGLSurface (and Pbuffer) API:
58002f4aeb0Sopenharmony_ci
58102f4aeb0Sopenharmony_ci            1)  The tight compatibility requirements of EGLSurfaces
58202f4aeb0Sopenharmony_ci                and EGLConfigs necessitated applications creating
58302f4aeb0Sopenharmony_ci                (and calling MakeCurrent) for every unique pixel
58402f4aeb0Sopenharmony_ci                format used during rendering.  This has already caused
58502f4aeb0Sopenharmony_ci                noticeable performance problems in OpenGL-ES (and
58602f4aeb0Sopenharmony_ci                desktop OpenGL), and is the primary reason that
58702f4aeb0Sopenharmony_ci                framebuffer objects were created.
58802f4aeb0Sopenharmony_ci
58902f4aeb0Sopenharmony_ci            2)  Application use-cases are centered around sharing of
59002f4aeb0Sopenharmony_ci                color image data, although unique "sundry" buffers
59102f4aeb0Sopenharmony_ci                (such as depth, stencil and alpha mask) may be used
59202f4aeb0Sopenharmony_ci                in each client API.
59302f4aeb0Sopenharmony_ci
59402f4aeb0Sopenharmony_ci            3)  Extending the CreatePbuffer interface to support fully-
59502f4aeb0Sopenharmony_ci                specifying all possible buffer attributes in all client
59602f4aeb0Sopenharmony_ci                APIs will become unwieldy, particularly as new EGL
59702f4aeb0Sopenharmony_ci                client APIs and pixel formats are introduced.
59802f4aeb0Sopenharmony_ci
59902f4aeb0Sopenharmony_ci        The EGLImage proposal addresses all three of these restrictions:
60002f4aeb0Sopenharmony_ci
60102f4aeb0Sopenharmony_ci        1) is addressed by placing the burden of framebuffer management
60202f4aeb0Sopenharmony_ci        inside the client API, and allowing EGLImages to be accessed
60302f4aeb0Sopenharmony_ci        inside client APIs using an appropriate resource type (such
60402f4aeb0Sopenharmony_ci        as OpenGL-ES renderbuffers).  This follows the example provided
60502f4aeb0Sopenharmony_ci        by the GL_OES_framebuffer_object specification.
60602f4aeb0Sopenharmony_ci
60702f4aeb0Sopenharmony_ci        2) is addressed by defining EGLImages to be "trivial" two-
60802f4aeb0Sopenharmony_ci        dimensional arrays of pixel data.  Implementations may choose
60902f4aeb0Sopenharmony_ci        to support creation of EGLImages from any type of pixel data,
61002f4aeb0Sopenharmony_ci        and the association of multiple EGLImages and/or sundry
61102f4aeb0Sopenharmony_ci        buffers into a single framebuffer is the responsibility of the
61202f4aeb0Sopenharmony_ci        application and client API, using a mechanism such as
61302f4aeb0Sopenharmony_ci        GL_OES_framebuffer_object.
61402f4aeb0Sopenharmony_ci
61502f4aeb0Sopenharmony_ci        3) is addressed by defining EGLImages as opaque and
61602f4aeb0Sopenharmony_ci        non-queriable.  Although this introduces potential portability
61702f4aeb0Sopenharmony_ci        problems (addressed separately in issue 15), it avoids the
61802f4aeb0Sopenharmony_ci        ever-expanding problem of defining buffer compatibility as the
61902f4aeb0Sopenharmony_ci        cartesian product of all possible buffer attributes.
62002f4aeb0Sopenharmony_ci
62102f4aeb0Sopenharmony_ci    14. Since referencing EGLImages is the responsibility of the client
62202f4aeb0Sopenharmony_ci        API, and may fail for implementation-dependent reasons,
62302f4aeb0Sopenharmony_ci        doesn't this result in a potential portability problem?
62402f4aeb0Sopenharmony_ci
62502f4aeb0Sopenharmony_ci        UNRESOLVED:  Yes, this portability problem (where referencing
62602f4aeb0Sopenharmony_ci        succeeds on one platform but generates errors on a different
62702f4aeb0Sopenharmony_ci        one) is very similar to the implementation-dependent
62802f4aeb0Sopenharmony_ci        failure introduced in the EXT_framebuffer_object specification,
62902f4aeb0Sopenharmony_ci        discussed (at length) in Issues (12), (37), (46), (48) and (61)
63002f4aeb0Sopenharmony_ci        of that specification.  Similar to that specification, this
63102f4aeb0Sopenharmony_ci        specification should include some "minimum requirements"
63202f4aeb0Sopenharmony_ci        language for EGLImage creation and referencing.
63302f4aeb0Sopenharmony_ci
63402f4aeb0Sopenharmony_ci        Since there are numerous references to an upcoming
63502f4aeb0Sopenharmony_ci        "format restriction" API in the EXT_framebuffer_object
63602f4aeb0Sopenharmony_ci        specification, it may be valuable to wait until that API is
63702f4aeb0Sopenharmony_ci        defined before attempting to define a similar API for
63802f4aeb0Sopenharmony_ci        EGLImages.
63902f4aeb0Sopenharmony_ci
64002f4aeb0Sopenharmony_ci    15. Should creation of an EGLImage from an EGLImage source
64102f4aeb0Sopenharmony_ci        introduce the possibility for errors in the EGLImage source's
64202f4aeb0Sopenharmony_ci        owning context?
64302f4aeb0Sopenharmony_ci
64402f4aeb0Sopenharmony_ci        RESOLVED:  No; although image data may be undefined (issue 11),
64502f4aeb0Sopenharmony_ci        the (successful or unsuccessful) creation of an EGLImage should
64602f4aeb0Sopenharmony_ci        not introduce additional error conditions in the EGLImage
64702f4aeb0Sopenharmony_ci        source's owning context.  Text added to the end of section
64802f4aeb0Sopenharmony_ci        2.5.1 describing this.
64902f4aeb0Sopenharmony_ci
65002f4aeb0Sopenharmony_ci    16. Is it reasonable to require that when a preserved EGLImage is
65102f4aeb0Sopenharmony_ci        used by layered extensions to create client API siblings of that
65202f4aeb0Sopenharmony_ci        image, pixel data values are preserved?
65302f4aeb0Sopenharmony_ci
65402f4aeb0Sopenharmony_ci        UNRESOLVED: There are at least two extensions that reference
65502f4aeb0Sopenharmony_ci        EGLImages to create EGLImage targets, VG_KHR_EGL_image and
65602f4aeb0Sopenharmony_ci        GL_OES_EGL_image.
65702f4aeb0Sopenharmony_ci
65802f4aeb0Sopenharmony_ci        Each of these extensions makes provision for failing the creation of
65902f4aeb0Sopenharmony_ci        the EGLImage target due to "an implementation-dependent reason".
66002f4aeb0Sopenharmony_ci        This could include that the pixel data has been marked as preserved,
66102f4aeb0Sopenharmony_ci        and that the implementation is not able to create the EGLImage
66202f4aeb0Sopenharmony_ci        target without causing the pixel data of the original EGLImage
66302f4aeb0Sopenharmony_ci        source <buffer> to become undefined.
66402f4aeb0Sopenharmony_ci
66502f4aeb0Sopenharmony_ci        Issue 14 of EGL_KHR_image also discusses the consequences of failure
66602f4aeb0Sopenharmony_ci        for implementation-dependent reasons. This implies that all
66702f4aeb0Sopenharmony_ci        extensions for referencing an EGLImage need to make provision for
66802f4aeb0Sopenharmony_ci        implementation-dependent failure.
66902f4aeb0Sopenharmony_ci
67002f4aeb0Sopenharmony_ci        PROPOSED: Yes, this is reasonable. We should add "EGL_KHR_image_base
67102f4aeb0Sopenharmony_ci        affects the behavior of this extension" sections to the ES and VG
67202f4aeb0Sopenharmony_ci        extensions. Implementations can continue to export EGL_KHR_image if
67302f4aeb0Sopenharmony_ci        they are unable to support preserved image functionality.
67402f4aeb0Sopenharmony_ci
67502f4aeb0Sopenharmony_ci    17. Do EGLImage Target creation extensions such as VG_KHR_EGL_image and
67602f4aeb0Sopenharmony_ci        GL_OES_EGL_image also need to be extended?
67702f4aeb0Sopenharmony_ci
67802f4aeb0Sopenharmony_ci        UNRESOLVED: The problem here is that both these extensions
67902f4aeb0Sopenharmony_ci        explicitly state that pixel data becomes undefined when they
68002f4aeb0Sopenharmony_ci        reference an EGLImage to create an EGLImage target.
68102f4aeb0Sopenharmony_ci
68202f4aeb0Sopenharmony_ci        One solution would be to allow this extension to do the defining on
68302f4aeb0Sopenharmony_ci        behalf of these extensions. For example, the VG_KHR_EGL_image
68402f4aeb0Sopenharmony_ci        extension on its own leaves the status of the pixel data undefined,
68502f4aeb0Sopenharmony_ci        but when VG_KHR_EGL_image is combined with this extension, then the
68602f4aeb0Sopenharmony_ci        status becomes defined (by this extension).
68702f4aeb0Sopenharmony_ci
68802f4aeb0Sopenharmony_ci        When combined with the reasons given in Issue 1, this means it is
68902f4aeb0Sopenharmony_ci        possible to leave EGLImage Target creation extensions unchanged.
69002f4aeb0Sopenharmony_ci
69102f4aeb0Sopenharmony_ci        PROPOSED: Yes, augment these extensions as described in issue 16.
69202f4aeb0Sopenharmony_ci
69302f4aeb0Sopenharmony_ci    18. Is it reasonable for developers to want to preserve pixel data upon
69402f4aeb0Sopenharmony_ci        creation of EGLImage and EGLImage targets?
69502f4aeb0Sopenharmony_ci
69602f4aeb0Sopenharmony_ci        RESOLVED: Yes. This is necessary for composition implementations
69702f4aeb0Sopenharmony_ci        using EGLImages as an encapsulation mechanism for moving data
69802f4aeb0Sopenharmony_ci        between producer application, composition API, and composition
69902f4aeb0Sopenharmony_ci        implementation(s).
70002f4aeb0Sopenharmony_ci
70102f4aeb0Sopenharmony_ci    19. Should we really change the default value of EGL_IMAGE_PRESERVED_KHR
70202f4aeb0Sopenharmony_ci        when EGL_KHR_image is supported?
70302f4aeb0Sopenharmony_ci
70402f4aeb0Sopenharmony_ci        RESOLVED: No. This is a subtle and hard to diagnose source of
70502f4aeb0Sopenharmony_ci        errors, and the only way to write a portable app would still be
70602f4aeb0Sopenharmony_ci        to explicitly specify the attribute value. By making the default
70702f4aeb0Sopenharmony_ci        value FALSE no matter which of the two extension(s) are
70802f4aeb0Sopenharmony_ci        supported, compatibility with EGL_KHR_image is preserved, and
70902f4aeb0Sopenharmony_ci        apps must explicitly ask for preservation if they need it.
71002f4aeb0Sopenharmony_ci
71102f4aeb0Sopenharmony_ci    20. Why is EGL_NO_DISPLAY not supported as the <dpy> argument for
71202f4aeb0Sopenharmony_ci        creating and destroying images, unlike the original version of the
71302f4aeb0Sopenharmony_ci        EGL_KHR_image specification?
71402f4aeb0Sopenharmony_ci
71502f4aeb0Sopenharmony_ci        RESOLVED: There are no defined use cases for this at present, so
71602f4aeb0Sopenharmony_ci        there is no way to legally pass in EGL_NO_DISPLAY. If in the future,
71702f4aeb0Sopenharmony_ci        a layered extension allows creation of images not associated with
71802f4aeb0Sopenharmony_ci        any display, this behavior can be reintroduced.
71902f4aeb0Sopenharmony_ci
72002f4aeb0Sopenharmony_ci
72102f4aeb0Sopenharmony_ciRevision History
72202f4aeb0Sopenharmony_ci
72302f4aeb0Sopenharmony_ci#8  (Jon Leech, August 27, 2014)
72402f4aeb0Sopenharmony_ci    - Remove leftover comment saying that inapplicable attributes are
72502f4aeb0Sopenharmony_ci      ignored (Bug 12585).
72602f4aeb0Sopenharmony_ci
72702f4aeb0Sopenharmony_ci#7  (Jon Leech, June 12, 2013)
72802f4aeb0Sopenharmony_ci    - Add a column to table bbb specifying which <target>s attributes are
72902f4aeb0Sopenharmony_ci      valid for, and a generic error if an attribute doesn't match <target>
73002f4aeb0Sopenharmony_ci      (Bug 10151).
73102f4aeb0Sopenharmony_ci
73202f4aeb0Sopenharmony_ci#6  (Jon Leech, December 1, 2010)
73302f4aeb0Sopenharmony_ci    - Clarify wording of EGL_BAD_CONTEXT error.
73402f4aeb0Sopenharmony_ci
73502f4aeb0Sopenharmony_ci#5  (Jon Leech, December 10, 2008)
73602f4aeb0Sopenharmony_ci    - Change definition of EGL_NO_IMAGE_KHR to 0 (appropriately cast)
73702f4aeb0Sopenharmony_ci      instead of a reference to an extern implementation-defined
73802f4aeb0Sopenharmony_ci      variable.
73902f4aeb0Sopenharmony_ci
74002f4aeb0Sopenharmony_ci#4  (Jon Leech, November 25, 2008)
74102f4aeb0Sopenharmony_ci    - Simplify error conditions for eglDestroyImage.
74202f4aeb0Sopenharmony_ci
74302f4aeb0Sopenharmony_ci#3  (Jon Leech, November 12, 2008)
74402f4aeb0Sopenharmony_ci    - Added glossary entry for Respecification, updated description of
74502f4aeb0Sopenharmony_ci      behavior with preserved images per suggestions from Acorn, and added
74602f4aeb0Sopenharmony_ci      issue 20 regarding removal of EGL_NO_DISPLAY as a valid <dpy>.
74702f4aeb0Sopenharmony_ci
74802f4aeb0Sopenharmony_ci#2  (Jon Leech, October 22, 2008)
74902f4aeb0Sopenharmony_ci    - Change default value of EGL_IMAGE_PRESERVED_KHR to EGL_FALSE.
75002f4aeb0Sopenharmony_ci      Update issue 19.
75102f4aeb0Sopenharmony_ci
75202f4aeb0Sopenharmony_ci#1  (Jon Leech, October 21, 2008)
75302f4aeb0Sopenharmony_ci    - Split abstract functionality from EGL_KHR_image into this extension,
75402f4aeb0Sopenharmony_ci      and merged preserved image functionality from
75502f4aeb0Sopenharmony_ci      EGL_SYMBIAN_image_preserved.
756