Name

    ANGLE_stream_producer_d3d_texture_nv12

Name Strings

    EGL_ANGLE_stream_producer_d3d_texture_nv12

Contributors

    Ian Ewell
    Geoff Lang
    John Bauman

Contacts

    Geoff Lang, Google (geofflang ‘at’ google.com)

Status

    Draft

Version

    Version 1, April 6, 2016

Number

    EGL Extension #XXX

Dependencies

    Requires EGL 1.5.
    Requires OpenGL ES 2.0.

    Requires the EGL_KHR_stream extension.
    Requires the EGL_NV_stream_consumer_gltexture_yuv extension.
    Requires the EGL_ANGLE_device_d3d extension.

Overview

    This extension allows D3D11 NV12 textures to be inserted into an EGL stream
    with the expectation that the stream consumer will be a YUV GL texture
    consumer using a two plane configuration (i.e. a Y plane and a UV plane).
    This will act as the producer of the stream.

New procedures and functions

    EGLBoolean eglCreateStreamProducerD3DTextureNV12ANGLE
                                                  (EGLDisplay dpy,
                                                   EGLStreamKHR stream,
                                                   const EGLAttrib *attrib_list)
    EGLBoolean eglStreamPostD3DTextureNV12ANGLE(EGLDisplay dpy,
                                                EGLStreamKHR stream,
                                                void *texture,
                                                const EGLAttrib *attrib_list)

New Tokens

    Accepted as an <attribute> in eglStreamPostD3DTextureNV12ANGLE:

        EGL_D3D_TEXTURE_SUBRESOURCE_ID_ANGLE 0x3AAB

Replace section "3.10.3.1 No way to connect producer to EGLStream" in the
EGL_KHR_stream extension with this:

    3.10.3.1 Stream Surface Producer

    Call

        EGLBoolean eglCreateStreamProducerD3DTextureNV12ANGLE(
                    EGLDisplay dpy,
                    EGLStreamKHR stream,
                    const EGLAttrib *attrib_list)

    to create a producer that accepts D3D11 NV12 textures and connect it as the
    producer of <stream>. <attrib_list> is used to specify attributes for the
    stream producer. Currently there are no attributes to specify, and the
    attribute list is used as a placeholder for future additions.

    On failure, eglCreateStreamProducerD3DTextureNV12ANGLE returns EGL_FALSE and
    generates an error.

        - EGL_BAD_STATE_KHR is generated if <stream> is not in the state
          EGL_STREAM_STATE_CONNECTING_KHR.

        - EGL_BAD_MATCH is generated if <stream> does not have a connected GL
          texture YUV consumer that is configured to bind to two OpenGL
          textures: one for the Y plane and one for the UV plane.

        - EGL_BAD_STREAM_KHR is generated if <stream> is not a valid EGLStream
          generated for <dpy>.

        - EGL_BAD_DISPLAY is generated if <dpy> is not a valid, initialized
          display.

Add a section preceding "3.9.3 Posting Semantics" in the EGL specification:

    3.9.x Posting to a Stream

    To post a D3D11 NV12 texture to a stream, call

        EGLBoolean eglStreamPostD3DTextureNV12ANGLE(
                    EGLDisplay dpy,
                    EGLStreamKHR stream,
                    void *texture,
                    const EGLAttrib *attrib_list);

    If <stream> is an appropriately configured stream and <texture> points to a
    valid ID3D11Texture2D object of the format DXGI_FORMAT_NV12 that is owned
    by the same ID3D11Device that is queried with the EGL_ANGLE_device_d3d
    extension, the texture will be posted to the stream and can be bound as one
    or more OpenGL texture objects.

    The parameter <attrib_list> allows for per-frame attributes to be specified
    along with the texture. The only parameter currently available is
    EGL_D3D_TEXTURE_SUBRESOURCE_ID_ANGLE, which allows the subresource id of
    the texture that will be used to be specified. If this attribute is not
    explicitly specified, it will default to the value of 0.

    It is the responsibility of the application to perform any synchronization
    between the insertion of the frame into the stream and the use of the
    consumer textures output by the stream. The EGL_CONSUMER_LATENCY_USEC_KHR
    attribute will have no effect on the function of the implementation of this
    extension, but can still be used for communication between components of
    the application.

    The implementation will hold a reference to the D3D11 texture object if the
    insertion is successful and will release the texture object when a new frame
    is inserted or when the stream is destroyed.

    On failure, eglStreamInsertD3DTextureNV12 returns EGL_FALSE and generates an
    error.

        - EGL_BAD_STATE is generated if <stream> is not in the state
          EGL_STREAM_STATE_EMPTY_KHR, EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR,
          or EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR.

        - EGL_BAD_MATCH is generated if the stream is not associated with a
          D3D11 NV12 texture producer.

        - EGL_BAD_PARAMETER is generated if <texture> is not owned by the
          queried device, is not in the format DXGI_FORMAT_NV12, is not
          compatible with the implementation, or if the specified value for
          EGL_D3D_TEXTURE_SUBRESOURCE_ID_ANGLE is not a valid subresource id for
          the texture.

        - EGL_BAD_STREAM_KHR is generated if <stream> is not a valid EGLStream.

        - EGL_BAD_ATTRIBUTE is generated if an attribute other than
          EGL_D3D_TEXTURE_SUBRESOURCE_ID_ANGLE is specified in <attrib_list>.

Revision History

    #1 (April 6, 2016) Ian Ewell
        - initial draft