15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    EXT_framebuffer_object
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_EXT_framebuffer_object
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContributors
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Kurt Akeley
125bd8deadSopenharmony_ci    Jason Allen
135bd8deadSopenharmony_ci    Bob Beretta
145bd8deadSopenharmony_ci    Pat Brown
155bd8deadSopenharmony_ci    Matt Craighead
165bd8deadSopenharmony_ci    Alex Eddy
175bd8deadSopenharmony_ci    Cass Everitt
185bd8deadSopenharmony_ci    Mark Galvan
195bd8deadSopenharmony_ci    Michael Gold
205bd8deadSopenharmony_ci    Evan Hart
215bd8deadSopenharmony_ci    Jeff Juliano
225bd8deadSopenharmony_ci    Mark Kilgard
235bd8deadSopenharmony_ci    Dale Kirkland
245bd8deadSopenharmony_ci    Jon Leech
255bd8deadSopenharmony_ci    Bill Licea-Kane
265bd8deadSopenharmony_ci    Barthold Lichtenbelt
275bd8deadSopenharmony_ci    Kent Lin
285bd8deadSopenharmony_ci    Rob Mace
295bd8deadSopenharmony_ci    Teri Morrison
305bd8deadSopenharmony_ci    Chris Niederauer
315bd8deadSopenharmony_ci    Brian Paul
325bd8deadSopenharmony_ci    Paul Puey
335bd8deadSopenharmony_ci    Ian Romanick
345bd8deadSopenharmony_ci    John Rosasco
355bd8deadSopenharmony_ci    R. Jason Sams
365bd8deadSopenharmony_ci    Jeremy Sandmel
375bd8deadSopenharmony_ci    Mark Segal
385bd8deadSopenharmony_ci    Avinash Seetharamaiah
395bd8deadSopenharmony_ci    Folker Schamel
405bd8deadSopenharmony_ci    Daniel Vogel
415bd8deadSopenharmony_ci    Eric Werness
425bd8deadSopenharmony_ci    Cliff Woolley
435bd8deadSopenharmony_ci
445bd8deadSopenharmony_ciContacts
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ci    Jeff Juliano, NVIDIA Corporation (jjuliano 'at' nvidia.com)
475bd8deadSopenharmony_ci    Jeremy Sandmel, Apple Computer (jsandmel 'at' apple.com)
485bd8deadSopenharmony_ci
495bd8deadSopenharmony_ciStatus
505bd8deadSopenharmony_ci
515bd8deadSopenharmony_ci    Complete.
525bd8deadSopenharmony_ci    Approved by the ARB "superbuffers" Working Group on January 31, 2005.
535bd8deadSopenharmony_ci    Despite being controlled by the ARB WG, this is not an officially
545bd8deadSopenharmony_ci    approved ARB extension at this time, thus the "EXT" tag.
555bd8deadSopenharmony_ci
565bd8deadSopenharmony_ciVersion
575bd8deadSopenharmony_ci
585bd8deadSopenharmony_ci    Last Modified Date: October 6, 2016
595bd8deadSopenharmony_ci    Revision: #123
605bd8deadSopenharmony_ci
615bd8deadSopenharmony_ciNumber
625bd8deadSopenharmony_ci
635bd8deadSopenharmony_ci    310
645bd8deadSopenharmony_ci
655bd8deadSopenharmony_ciDependencies
665bd8deadSopenharmony_ci
675bd8deadSopenharmony_ci    OpenGL 1.1 is required.
685bd8deadSopenharmony_ci
695bd8deadSopenharmony_ci    WGL_ARB_make_current_read affects the definition of this extension.
705bd8deadSopenharmony_ci
715bd8deadSopenharmony_ci    GLX 1.3 / GLX_SGI_make_current_read affects the definition of this
725bd8deadSopenharmony_ci    extension.
735bd8deadSopenharmony_ci
745bd8deadSopenharmony_ci    ATI_draw_buffers affects the definition of this extension.
755bd8deadSopenharmony_ci
765bd8deadSopenharmony_ci    ARB_draw_buffers affects the definition of this extension.
775bd8deadSopenharmony_ci
785bd8deadSopenharmony_ci    ARB_fragment_program affects the definition of this extension.
795bd8deadSopenharmony_ci
805bd8deadSopenharmony_ci    ARB_fragment_shader affects the definition of this extension.
815bd8deadSopenharmony_ci
825bd8deadSopenharmony_ci    ARB_framebuffer_object and OpenGL 3.0 core affect the definition of
835bd8deadSopenharmony_ci    this extension.
845bd8deadSopenharmony_ci
855bd8deadSopenharmony_ci    ARB_texture_rectangle affects the definition of this extension.
865bd8deadSopenharmony_ci
875bd8deadSopenharmony_ci    ARB_vertex_shader affects the definition of this extension.
885bd8deadSopenharmony_ci
895bd8deadSopenharmony_ci    EXT_packed_depth_stencil affects the definition of this extension.
905bd8deadSopenharmony_ci
915bd8deadSopenharmony_ci    NV_float_buffer affects the definition of this extension.
925bd8deadSopenharmony_ci
935bd8deadSopenharmony_ci    NV_texture_shader affects the definition of this extension.
945bd8deadSopenharmony_ci
955bd8deadSopenharmony_ci    Written based on the wording of the OpenGL 1.5 specification.
965bd8deadSopenharmony_ci
975bd8deadSopenharmony_ciOverview
985bd8deadSopenharmony_ci
995bd8deadSopenharmony_ci    This extension defines a simple interface for drawing to rendering
1005bd8deadSopenharmony_ci    destinations other than the buffers provided to the GL by the
1015bd8deadSopenharmony_ci    window-system.
1025bd8deadSopenharmony_ci
1035bd8deadSopenharmony_ci    In this extension, these newly defined rendering destinations are
1045bd8deadSopenharmony_ci    known collectively as "framebuffer-attachable images".  This
1055bd8deadSopenharmony_ci    extension provides a mechanism for attaching framebuffer-attachable
1065bd8deadSopenharmony_ci    images to the GL framebuffer as one of the standard GL logical
1075bd8deadSopenharmony_ci    buffers: color, depth, and stencil.  (Attaching a
1085bd8deadSopenharmony_ci    framebuffer-attachable image to the accum logical buffer is left for
1095bd8deadSopenharmony_ci    a future extension to define).  When a framebuffer-attachable image
1105bd8deadSopenharmony_ci    is attached to the framebuffer, it is used as the source and
1115bd8deadSopenharmony_ci    destination of fragment operations as described in Chapter 4.
1125bd8deadSopenharmony_ci
1135bd8deadSopenharmony_ci    By allowing the use of a framebuffer-attachable image as a rendering
1145bd8deadSopenharmony_ci    destination, this extension enables a form of "offscreen" rendering.
1155bd8deadSopenharmony_ci    Furthermore, "render to texture" is supported by allowing the images
1165bd8deadSopenharmony_ci    of a texture to be used as framebuffer-attachable images.  A
1175bd8deadSopenharmony_ci    particular image of a texture object is selected for use as a
1185bd8deadSopenharmony_ci    framebuffer-attachable image by specifying the mipmap level, cube
1195bd8deadSopenharmony_ci    map face (for a cube map texture), and z-offset (for a 3D texture)
1205bd8deadSopenharmony_ci    that identifies the image.  The "render to texture" semantics of
1215bd8deadSopenharmony_ci    this extension are similar to performing traditional rendering to
1225bd8deadSopenharmony_ci    the framebuffer, followed immediately by a call to CopyTexSubImage.
1235bd8deadSopenharmony_ci    However, by using this extension instead, an application can achieve
1245bd8deadSopenharmony_ci    the same effect, but with the advantage that the GL can usually
1255bd8deadSopenharmony_ci    eliminate the data copy that would have been incurred by calling
1265bd8deadSopenharmony_ci    CopyTexSubImage.
1275bd8deadSopenharmony_ci
1285bd8deadSopenharmony_ci    This extension also defines a new GL object type, called a
1295bd8deadSopenharmony_ci    "renderbuffer", which encapsulates a single 2D pixel image.  The
1305bd8deadSopenharmony_ci    image of renderbuffer can be used as a framebuffer-attachable image
1315bd8deadSopenharmony_ci    for generalized offscreen rendering and it also provides a means to
1325bd8deadSopenharmony_ci    support rendering to GL logical buffer types which have no
1335bd8deadSopenharmony_ci    corresponding texture format (stencil, accum, etc).  A renderbuffer
1345bd8deadSopenharmony_ci    is similar to a texture in that both renderbuffers and textures can
1355bd8deadSopenharmony_ci    be independently allocated and shared among multiple contexts.  The
1365bd8deadSopenharmony_ci    framework defined by this extension is general enough that support
1375bd8deadSopenharmony_ci    for attaching images from GL objects other than textures and
1385bd8deadSopenharmony_ci    renderbuffers could be added by layered extensions.
1395bd8deadSopenharmony_ci
1405bd8deadSopenharmony_ci    To facilitate efficient switching between collections of
1415bd8deadSopenharmony_ci    framebuffer-attachable images, this extension introduces another new
1425bd8deadSopenharmony_ci    GL object, called a framebuffer object.  A framebuffer object
1435bd8deadSopenharmony_ci    contains the state that defines the traditional GL framebuffer,
1445bd8deadSopenharmony_ci    including its set of images.  Prior to this extension, it was the
1455bd8deadSopenharmony_ci    window-system which defined and managed this collection of images,
1465bd8deadSopenharmony_ci    traditionally by grouping them into a "drawable".  The window-system
1475bd8deadSopenharmony_ci    API's would also provide a function (i.e., wglMakeCurrent,
1485bd8deadSopenharmony_ci    glXMakeCurrent, aglSetDrawable, etc.) to bind a drawable with a GL
1495bd8deadSopenharmony_ci    context (as is done in the WGL_ARB_pbuffer extension).  In this
1505bd8deadSopenharmony_ci    extension however, this functionality is subsumed by the GL and the
1515bd8deadSopenharmony_ci    GL provides the function BindFramebufferEXT to bind a framebuffer
1525bd8deadSopenharmony_ci    object to the current context.  Later, the context can bind back to
1535bd8deadSopenharmony_ci    the window-system-provided framebuffer in order to display rendered
1545bd8deadSopenharmony_ci    content.
1555bd8deadSopenharmony_ci
1565bd8deadSopenharmony_ci    Previous extensions that enabled rendering to a texture have been
1575bd8deadSopenharmony_ci    much more complicated.  One example is the combination of
1585bd8deadSopenharmony_ci    ARB_pbuffer and ARB_render_texture, both of which are window-system
1595bd8deadSopenharmony_ci    extensions.  This combination requires calling MakeCurrent, an
1605bd8deadSopenharmony_ci    operation that may be expensive, to switch between the window and
1615bd8deadSopenharmony_ci    the pbuffer drawables.  An application must create one pbuffer per
1625bd8deadSopenharmony_ci    renderable texture in order to portably use ARB_render_texture.  An
1635bd8deadSopenharmony_ci    application must maintain at least one GL context per texture
1645bd8deadSopenharmony_ci    format, because each context can only operate on a single
1655bd8deadSopenharmony_ci    pixelformat or FBConfig.  All of these characteristics make
1665bd8deadSopenharmony_ci    ARB_render_texture both inefficient and cumbersome to use.
1675bd8deadSopenharmony_ci
1685bd8deadSopenharmony_ci    EXT_framebuffer_object, on the other hand, is both simpler to use
1695bd8deadSopenharmony_ci    and more efficient than ARB_render_texture.  The
1705bd8deadSopenharmony_ci    EXT_framebuffer_object API is contained wholly within the GL API and
1715bd8deadSopenharmony_ci    has no (non-portable) window-system components.  Under
1725bd8deadSopenharmony_ci    EXT_framebuffer_object, it is not necessary to create a second GL
1735bd8deadSopenharmony_ci    context when rendering to a texture image whose format differs from
1745bd8deadSopenharmony_ci    that of the window.  Finally, unlike the pbuffers of
1755bd8deadSopenharmony_ci    ARB_render_texture, a single framebuffer object can facilitate
1765bd8deadSopenharmony_ci    rendering to an unlimited number of texture objects.
1775bd8deadSopenharmony_ci
1785bd8deadSopenharmony_ciGlossary of Helpful Terms
1795bd8deadSopenharmony_ci
1805bd8deadSopenharmony_ci        logical buffer:
1815bd8deadSopenharmony_ci            One of the color, depth, or stencil buffers of the
1825bd8deadSopenharmony_ci            framebuffer.
1835bd8deadSopenharmony_ci
1845bd8deadSopenharmony_ci        framebuffer:
1855bd8deadSopenharmony_ci            The collection of logical buffers and associated state
1865bd8deadSopenharmony_ci            defining where the output of GL rendering is directed.
1875bd8deadSopenharmony_ci
1885bd8deadSopenharmony_ci        texture:
1895bd8deadSopenharmony_ci            an object which consists of one or more 2D arrays of pixel
1905bd8deadSopenharmony_ci            images and associated state that can be used as a source of
1915bd8deadSopenharmony_ci            data during the texture-mapping process described in section
1925bd8deadSopenharmony_ci            3.8.
1935bd8deadSopenharmony_ci
1945bd8deadSopenharmony_ci        texture image:
1955bd8deadSopenharmony_ci            one of the 2D arrays of pixels that are part of a texture
1965bd8deadSopenharmony_ci            object as defined in section 3.8.  Texture images contain
1975bd8deadSopenharmony_ci            and define the texels of the texture object.
1985bd8deadSopenharmony_ci
1995bd8deadSopenharmony_ci        renderbuffer:
2005bd8deadSopenharmony_ci            A new type of storage object which contains a single 2D
2015bd8deadSopenharmony_ci            array of pixels and associated state that can be used as a
2025bd8deadSopenharmony_ci            destination for pixel data written during the rendering
2035bd8deadSopenharmony_ci            process described in Chapter 4.
2045bd8deadSopenharmony_ci
2055bd8deadSopenharmony_ci        renderbuffer image:
2065bd8deadSopenharmony_ci            The 2D array of pixels that is part of a renderbuffer
2075bd8deadSopenharmony_ci            object.  A renderbuffer image contains and defines the
2085bd8deadSopenharmony_ci            pixels of the renderbuffer object.
2095bd8deadSopenharmony_ci
2105bd8deadSopenharmony_ci        framebuffer-attachable image:
2115bd8deadSopenharmony_ci            A 2D pixel image that can be attached to one of the logical
2125bd8deadSopenharmony_ci            buffer attachment points of a framebuffer object.  Texture
2135bd8deadSopenharmony_ci            images and renderbuffer images are two examples of
2145bd8deadSopenharmony_ci            framebuffer-attachable images.
2155bd8deadSopenharmony_ci
2165bd8deadSopenharmony_ci        attachment point:
2175bd8deadSopenharmony_ci            The set of state which references a specific
2185bd8deadSopenharmony_ci            framebuffer-attachable image, and allows that
2195bd8deadSopenharmony_ci            framebuffer-attachable image to be used to store the
2205bd8deadSopenharmony_ci            contents of a logical buffer of a framebuffer object.  There
2215bd8deadSopenharmony_ci            is an attachment point state vector for each color, depth,
2225bd8deadSopenharmony_ci            and stencil buffer of a framebuffer.
2235bd8deadSopenharmony_ci
2245bd8deadSopenharmony_ci        attach:
2255bd8deadSopenharmony_ci            The act of connecting one object to another object.
2265bd8deadSopenharmony_ci
2275bd8deadSopenharmony_ci            An "attach" operation is similar to a "bind" operation in
2285bd8deadSopenharmony_ci            that both represent a reference to the attached or bound
2295bd8deadSopenharmony_ci            object for the purpose of managing object lifetimes and both
2305bd8deadSopenharmony_ci            enable manipulation of the state of the attached or bound
2315bd8deadSopenharmony_ci            object.
2325bd8deadSopenharmony_ci
2335bd8deadSopenharmony_ci            However, an "attach" is also different from a "bind" in that
2345bd8deadSopenharmony_ci            "binding" an unused object creates a new object, while
2355bd8deadSopenharmony_ci            "attaching" does not.  Additionally, "bind" establishes a
2365bd8deadSopenharmony_ci            connection between a context and an object, while "attach"
2375bd8deadSopenharmony_ci            establishes a connection between two objects.
2385bd8deadSopenharmony_ci
2395bd8deadSopenharmony_ci            Finally, if object "A" is attached to object "B" and object
2405bd8deadSopenharmony_ci            "B" is bound to context "C", then in most respects, we treat
2415bd8deadSopenharmony_ci            "A" as if it is <implicitly> bound to "C".
2425bd8deadSopenharmony_ci
2435bd8deadSopenharmony_ci        framebuffer attachment completeness:
2445bd8deadSopenharmony_ci            Similar to texture "mipmap" or "cube" completeness from
2455bd8deadSopenharmony_ci            section 3.8.10, defines a minimum set of criteria for
2465bd8deadSopenharmony_ci            framebuffer attachment points.  (for complete definition,
2475bd8deadSopenharmony_ci            see section 4.4.4.1)
2485bd8deadSopenharmony_ci
2495bd8deadSopenharmony_ci        framebuffer completeness:
2505bd8deadSopenharmony_ci            Similar to texture "mipmap cube completeness", defines a
2515bd8deadSopenharmony_ci            composite set of "completeness" requirements and
2525bd8deadSopenharmony_ci            relationships among the attached framebuffer-attachable
2535bd8deadSopenharmony_ci            images.  (for complete definition, see section 4.4.4.2)
2545bd8deadSopenharmony_ci
2555bd8deadSopenharmony_ci
2565bd8deadSopenharmony_ciIssues
2575bd8deadSopenharmony_ci
2585bd8deadSopenharmony_ci    Breaking from past convention, the very large issues section has
2595bd8deadSopenharmony_ci    been moved to the end of the document.  It can be found after
2605bd8deadSopenharmony_ci    Examples, before Revision History.
2615bd8deadSopenharmony_ci
2625bd8deadSopenharmony_ci
2635bd8deadSopenharmony_ciNew Procedures and Functions
2645bd8deadSopenharmony_ci
2655bd8deadSopenharmony_ci    boolean IsRenderbufferEXT(uint renderbuffer);
2665bd8deadSopenharmony_ci    void BindRenderbufferEXT(enum target, uint renderbuffer);
2675bd8deadSopenharmony_ci    void DeleteRenderbuffersEXT(sizei n, const uint *renderbuffers);
2685bd8deadSopenharmony_ci    void GenRenderbuffersEXT(sizei n, uint *renderbuffers);
2695bd8deadSopenharmony_ci
2705bd8deadSopenharmony_ci    void RenderbufferStorageEXT(enum target, enum internalformat,
2715bd8deadSopenharmony_ci                                sizei width, sizei height);
2725bd8deadSopenharmony_ci
2735bd8deadSopenharmony_ci    void GetRenderbufferParameterivEXT(enum target, enum pname, int *params);
2745bd8deadSopenharmony_ci
2755bd8deadSopenharmony_ci    boolean IsFramebufferEXT(uint framebuffer);
2765bd8deadSopenharmony_ci    void BindFramebufferEXT(enum target, uint framebuffer);
2775bd8deadSopenharmony_ci    void DeleteFramebuffersEXT(sizei n, const uint *framebuffers);
2785bd8deadSopenharmony_ci    void GenFramebuffersEXT(sizei n, uint *framebuffers);
2795bd8deadSopenharmony_ci
2805bd8deadSopenharmony_ci    enum CheckFramebufferStatusEXT(enum target);
2815bd8deadSopenharmony_ci
2825bd8deadSopenharmony_ci    void FramebufferTexture1DEXT(enum target, enum attachment,
2835bd8deadSopenharmony_ci                                 enum textarget, uint texture,
2845bd8deadSopenharmony_ci                                 int level);
2855bd8deadSopenharmony_ci    void FramebufferTexture2DEXT(enum target, enum attachment,
2865bd8deadSopenharmony_ci                                 enum textarget, uint texture,
2875bd8deadSopenharmony_ci                                 int level);
2885bd8deadSopenharmony_ci    void FramebufferTexture3DEXT(enum target, enum attachment,
2895bd8deadSopenharmony_ci                                 enum textarget, uint texture,
2905bd8deadSopenharmony_ci                                 int level, int zoffset);
2915bd8deadSopenharmony_ci
2925bd8deadSopenharmony_ci    void FramebufferRenderbufferEXT(enum target, enum attachment,
2935bd8deadSopenharmony_ci                                    enum renderbuffertarget, uint renderbuffer);
2945bd8deadSopenharmony_ci
2955bd8deadSopenharmony_ci    void GetFramebufferAttachmentParameterivEXT(enum target, enum attachment,
2965bd8deadSopenharmony_ci                                                enum pname, int *params);
2975bd8deadSopenharmony_ci
2985bd8deadSopenharmony_ci    void GenerateMipmapEXT(enum target);
2995bd8deadSopenharmony_ci
3005bd8deadSopenharmony_ci
3015bd8deadSopenharmony_ciNew Types
3025bd8deadSopenharmony_ci
3035bd8deadSopenharmony_ci    None.
3045bd8deadSopenharmony_ci
3055bd8deadSopenharmony_ci
3065bd8deadSopenharmony_ciNew Tokens
3075bd8deadSopenharmony_ci
3085bd8deadSopenharmony_ci    Accepted by the <target> parameter of BindFramebufferEXT,
3095bd8deadSopenharmony_ci    CheckFramebufferStatusEXT, FramebufferTexture{1D|2D|3D}EXT,
3105bd8deadSopenharmony_ci    FramebufferRenderbufferEXT, and
3115bd8deadSopenharmony_ci    GetFramebufferAttachmentParameterivEXT:
3125bd8deadSopenharmony_ci
3135bd8deadSopenharmony_ci        FRAMEBUFFER_EXT                     0x8D40
3145bd8deadSopenharmony_ci
3155bd8deadSopenharmony_ci    Accepted by the <target> parameter of BindRenderbufferEXT,
3165bd8deadSopenharmony_ci    RenderbufferStorageEXT, and GetRenderbufferParameterivEXT, and
3175bd8deadSopenharmony_ci    returned by GetFramebufferAttachmentParameterivEXT:
3185bd8deadSopenharmony_ci
3195bd8deadSopenharmony_ci        RENDERBUFFER_EXT                    0x8D41
3205bd8deadSopenharmony_ci
3215bd8deadSopenharmony_ci    Accepted by the <internalformat> parameter of
3225bd8deadSopenharmony_ci    RenderbufferStorageEXT:
3235bd8deadSopenharmony_ci
3245bd8deadSopenharmony_ci        STENCIL_INDEX1_EXT                  0x8D46
3255bd8deadSopenharmony_ci        STENCIL_INDEX4_EXT                  0x8D47
3265bd8deadSopenharmony_ci        STENCIL_INDEX8_EXT                  0x8D48
3275bd8deadSopenharmony_ci        STENCIL_INDEX16_EXT                 0x8D49
3285bd8deadSopenharmony_ci
3295bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetRenderbufferParameterivEXT:
3305bd8deadSopenharmony_ci
3315bd8deadSopenharmony_ci        RENDERBUFFER_WIDTH_EXT              0x8D42
3325bd8deadSopenharmony_ci        RENDERBUFFER_HEIGHT_EXT             0x8D43
3335bd8deadSopenharmony_ci        RENDERBUFFER_INTERNAL_FORMAT_EXT    0x8D44
3345bd8deadSopenharmony_ci        RENDERBUFFER_RED_SIZE_EXT           0x8D50
3355bd8deadSopenharmony_ci        RENDERBUFFER_GREEN_SIZE_EXT         0x8D51
3365bd8deadSopenharmony_ci        RENDERBUFFER_BLUE_SIZE_EXT          0x8D52
3375bd8deadSopenharmony_ci        RENDERBUFFER_ALPHA_SIZE_EXT         0x8D53
3385bd8deadSopenharmony_ci        RENDERBUFFER_DEPTH_SIZE_EXT         0x8D54
3395bd8deadSopenharmony_ci        RENDERBUFFER_STENCIL_SIZE_EXT       0x8D55
3405bd8deadSopenharmony_ci
3415bd8deadSopenharmony_ci    Accepted by the <pname> parameter of
3425bd8deadSopenharmony_ci    GetFramebufferAttachmentParameterivEXT:
3435bd8deadSopenharmony_ci
3445bd8deadSopenharmony_ci        FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT            0x8CD0
3455bd8deadSopenharmony_ci        FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT            0x8CD1
3465bd8deadSopenharmony_ci        FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT          0x8CD2
3475bd8deadSopenharmony_ci        FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT  0x8CD3
3485bd8deadSopenharmony_ci        FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT     0x8CD4
3495bd8deadSopenharmony_ci
3505bd8deadSopenharmony_ci    Accepted by the <attachment> parameter of
3515bd8deadSopenharmony_ci    FramebufferTexture{1D|2D|3D}EXT, FramebufferRenderbufferEXT, and
3525bd8deadSopenharmony_ci    GetFramebufferAttachmentParameterivEXT
3535bd8deadSopenharmony_ci
3545bd8deadSopenharmony_ci        COLOR_ATTACHMENT0_EXT                0x8CE0
3555bd8deadSopenharmony_ci        COLOR_ATTACHMENT1_EXT                0x8CE1
3565bd8deadSopenharmony_ci        COLOR_ATTACHMENT2_EXT                0x8CE2
3575bd8deadSopenharmony_ci        COLOR_ATTACHMENT3_EXT                0x8CE3
3585bd8deadSopenharmony_ci        COLOR_ATTACHMENT4_EXT                0x8CE4
3595bd8deadSopenharmony_ci        COLOR_ATTACHMENT5_EXT                0x8CE5
3605bd8deadSopenharmony_ci        COLOR_ATTACHMENT6_EXT                0x8CE6
3615bd8deadSopenharmony_ci        COLOR_ATTACHMENT7_EXT                0x8CE7
3625bd8deadSopenharmony_ci        COLOR_ATTACHMENT8_EXT                0x8CE8
3635bd8deadSopenharmony_ci        COLOR_ATTACHMENT9_EXT                0x8CE9
3645bd8deadSopenharmony_ci        COLOR_ATTACHMENT10_EXT               0x8CEA
3655bd8deadSopenharmony_ci        COLOR_ATTACHMENT11_EXT               0x8CEB
3665bd8deadSopenharmony_ci        COLOR_ATTACHMENT12_EXT               0x8CEC
3675bd8deadSopenharmony_ci        COLOR_ATTACHMENT13_EXT               0x8CED
3685bd8deadSopenharmony_ci        COLOR_ATTACHMENT14_EXT               0x8CEE
3695bd8deadSopenharmony_ci        COLOR_ATTACHMENT15_EXT               0x8CEF
3705bd8deadSopenharmony_ci        DEPTH_ATTACHMENT_EXT                 0x8D00
3715bd8deadSopenharmony_ci        STENCIL_ATTACHMENT_EXT               0x8D20
3725bd8deadSopenharmony_ci
3735bd8deadSopenharmony_ci    Returned by CheckFramebufferStatusEXT():
3745bd8deadSopenharmony_ci
3755bd8deadSopenharmony_ci        FRAMEBUFFER_COMPLETE_EXT                          0x8CD5
3765bd8deadSopenharmony_ci        FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT             0x8CD6
3775bd8deadSopenharmony_ci        FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT     0x8CD7
3785bd8deadSopenharmony_ci        FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT             0x8CD9
3795bd8deadSopenharmony_ci        FRAMEBUFFER_INCOMPLETE_FORMATS_EXT                0x8CDA
3805bd8deadSopenharmony_ci        FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT            0x8CDB
3815bd8deadSopenharmony_ci        FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT            0x8CDC
3825bd8deadSopenharmony_ci        FRAMEBUFFER_UNSUPPORTED_EXT                       0x8CDD
3835bd8deadSopenharmony_ci
3845bd8deadSopenharmony_ci    Accepted by GetIntegerv():
3855bd8deadSopenharmony_ci
3865bd8deadSopenharmony_ci        FRAMEBUFFER_BINDING_EXT             0x8CA6
3875bd8deadSopenharmony_ci        RENDERBUFFER_BINDING_EXT            0x8CA7
3885bd8deadSopenharmony_ci        MAX_COLOR_ATTACHMENTS_EXT           0x8CDF
3895bd8deadSopenharmony_ci        MAX_RENDERBUFFER_SIZE_EXT           0x84E8
3905bd8deadSopenharmony_ci
3915bd8deadSopenharmony_ci    Returned by GetError():
3925bd8deadSopenharmony_ci
3935bd8deadSopenharmony_ci        INVALID_FRAMEBUFFER_OPERATION_EXT   0x0506
3945bd8deadSopenharmony_ci
3955bd8deadSopenharmony_ciAdditions to Chapter 2 of the 1.5 Specification (OpenGL Operation)
3965bd8deadSopenharmony_ci
3975bd8deadSopenharmony_ci    "The GL interacts with two classes of framebuffers:
3985bd8deadSopenharmony_ci    window-system-provided framebuffers and application-created
3995bd8deadSopenharmony_ci    framebuffers.  There is always one window-system-provided
4005bd8deadSopenharmony_ci    framebuffer, while application-created framebuffers can be created
4015bd8deadSopenharmony_ci    as desired.  These two types of framebuffer are distinguished
4025bd8deadSopenharmony_ci    primarily by the interface for configuring and managing their state.
4035bd8deadSopenharmony_ci
4045bd8deadSopenharmony_ci    The effects of GL commands on the window-system-provided framebuffer
4055bd8deadSopenharmony_ci    are ultimately controlled by the window-system that allocates
4065bd8deadSopenharmony_ci    framebuffer resources.  It is the window-system that determines
4075bd8deadSopenharmony_ci    which portions of this framebuffer the GL may access at any given
4085bd8deadSopenharmony_ci    time and that communicates to the GL how those portions are
4095bd8deadSopenharmony_ci    structured.  Therefore, there are no GL commands to configure the
4105bd8deadSopenharmony_ci    window-system-provided framebuffer.  Similarly, display of
4115bd8deadSopenharmony_ci    framebuffer contents on a CRT monitor (including the transformation
4125bd8deadSopenharmony_ci    of individual framebuffer values by such techniques as gamma
4135bd8deadSopenharmony_ci    correction) is not addressed by the GL.  Framebuffer configuration
4145bd8deadSopenharmony_ci    occurs outside of the GL in conjunction with the window-system.
4155bd8deadSopenharmony_ci
4165bd8deadSopenharmony_ci    The initialization of a GL context itself occurs when the
4175bd8deadSopenharmony_ci    window-system allocates a window for GL rendering and is influenced
4185bd8deadSopenharmony_ci    by the state of the window-system-provided framebuffer."
4195bd8deadSopenharmony_ci
4205bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 1.5 Specification (Rasterization)
4215bd8deadSopenharmony_ci
4225bd8deadSopenharmony_ci    In section 3.6.4, page 102, add the following text to the definiton
4235bd8deadSopenharmony_ci    of DrawPixels:
4245bd8deadSopenharmony_ci
4255bd8deadSopenharmony_ci    "If the object bound to FRAMEBUFFER_BINDING_EXT is not "framebuffer
4265bd8deadSopenharmony_ci    complete" (as defined in section 4.4.4.2), then an attempt to call
4275bd8deadSopenharmony_ci    DrawPixels will generate the error
4285bd8deadSopenharmony_ci    INVALID_FRAMEBUFFER_OPERATION_EXT."
4295bd8deadSopenharmony_ci
4305bd8deadSopenharmony_ci    In section 3.8.8, add the following text immediately before the
4315bd8deadSopenharmony_ci    subsection "Mipmapping" on page 151:
4325bd8deadSopenharmony_ci
4335bd8deadSopenharmony_ci    "If all of the following conditions are satisfied, then the value of
4345bd8deadSopenharmony_ci    the selected Tau(ijk), Tau(ij), or Tau(i) in the above equations is
4355bd8deadSopenharmony_ci    undefined instead of referring to the value of the texel at location
4365bd8deadSopenharmony_ci    (i), (i,j), or (i,j,k).  See Chapter 4 for discussion of framebuffer
4375bd8deadSopenharmony_ci    objects and their attachments.
4385bd8deadSopenharmony_ci
4395bd8deadSopenharmony_ci      * The current FRAMEBUFFER_BINDING_EXT names an application-created
4405bd8deadSopenharmony_ci        framebuffer object <F>.
4415bd8deadSopenharmony_ci
4425bd8deadSopenharmony_ci      * The texture is attached to one of the attachment points, <A>, of
4435bd8deadSopenharmony_ci        framebuffer object <F>.
4445bd8deadSopenharmony_ci
4455bd8deadSopenharmony_ci      * TEXTURE_MIN_FILTER is NEAREST or LINEAR, and the value of
4465bd8deadSopenharmony_ci        FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT for attachment point
4475bd8deadSopenharmony_ci        <A> is equal to the value of TEXTURE_BASE_LEVEL
4485bd8deadSopenharmony_ci
4495bd8deadSopenharmony_ci        -or-
4505bd8deadSopenharmony_ci
4515bd8deadSopenharmony_ci        TEXTURE_MIN_FILTER is NEAREST_MIPMAP_NEAREST,
4525bd8deadSopenharmony_ci        NEAREST_MIPMAP_LINEAR, LINEAR_MIPMAP_NEAREST, or
4535bd8deadSopenharmony_ci        LINEAR_MIPMAP_LINEAR, and the value of
4545bd8deadSopenharmony_ci        FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT for attachment point
4555bd8deadSopenharmony_ci        <A> is within the the inclusive range from TEXTURE_BASE_LEVEL to
4565bd8deadSopenharmony_ci        q."
4575bd8deadSopenharmony_ci
4585bd8deadSopenharmony_ci    In subsection "Automatic Mipmap Generation" to section 3.8.8,
4595bd8deadSopenharmony_ci    replace the first paragraph with the following text:
4605bd8deadSopenharmony_ci
4615bd8deadSopenharmony_ci    "If the value of texture parameter GENERATE MIPMAP is TRUE and a
4625bd8deadSopenharmony_ci    change is made to the interior or border texels of the level[base]
4635bd8deadSopenharmony_ci    array of a mipmap by one of the texture image specification
4645bd8deadSopenharmony_ci    operations defined in sections 3.8.1 through 3.8.3, then a complete
4655bd8deadSopenharmony_ci    set of mipmap arrays (as defined in section 3.8.10) will be
4665bd8deadSopenharmony_ci    computed.  Array levels level[base] + 1 through p are replaced with
4675bd8deadSopenharmony_ci    arrays derived from the modified level[base], regardless of their
4685bd8deadSopenharmony_ci    previous contents.  All other mipmap arrays, including the
4695bd8deadSopenharmony_ci    level[base] array, are left unchanged by this computation."
4705bd8deadSopenharmony_ci
4715bd8deadSopenharmony_ci    Add a new subsection "Manual Mipmap Generation" to section 3.8.8,
4725bd8deadSopenharmony_ci    after "Automatic Mipmap Generation":
4735bd8deadSopenharmony_ci
4745bd8deadSopenharmony_ci    "Manual Mipmap Generation
4755bd8deadSopenharmony_ci
4765bd8deadSopenharmony_ci    Mipmaps can be generated manually with the command
4775bd8deadSopenharmony_ci
4785bd8deadSopenharmony_ci      void GenerateMipmapEXT(enum target);
4795bd8deadSopenharmony_ci
4805bd8deadSopenharmony_ci    where <target> is one of TEXTURE_1D, TEXTURE_2D, TEXTURE_CUBE_MAP,
4815bd8deadSopenharmony_ci    or TEXTURE_3D.  Mipmap generation affects the texture image attached
4825bd8deadSopenharmony_ci    to <target>.  For cube map textures, INVALID_OPERATION is generated
4835bd8deadSopenharmony_ci    if the texture bound to <target> is not cube complete, as defined in
4845bd8deadSopenharmony_ci    section 3.8.10.
4855bd8deadSopenharmony_ci
4865bd8deadSopenharmony_ci    Mipmap generation replaces texture array levels level[base] + 1
4875bd8deadSopenharmony_ci    through q with arrays derived from the level[base] array, as
4885bd8deadSopenharmony_ci    described above under Automatic Mipmap Generation.  All other mipmap
4895bd8deadSopenharmony_ci    arrays, including the level[base] array, are left unchanged by this
4905bd8deadSopenharmony_ci    computation.  For arrays in the range level[base] through q,
4915bd8deadSopenharmony_ci    inclusive, automatic and manual mipmap generation generate the same
4925bd8deadSopenharmony_ci    derived arrays, given identical level[base] arrays."
4935bd8deadSopenharmony_ci
4945bd8deadSopenharmony_ci    Modify the third paragraph of section 3.8.12, page 157, to read:
4955bd8deadSopenharmony_ci
4965bd8deadSopenharmony_ci    "Texture objects are deleted by calling
4975bd8deadSopenharmony_ci
4985bd8deadSopenharmony_ci        void DeleteTextures( sizei n, uint *textures );
4995bd8deadSopenharmony_ci
5005bd8deadSopenharmony_ci    textures contains n names of texture objects to be deleted.  After a
5015bd8deadSopenharmony_ci    texture object is deleted, it has no contents or dimensionality, and
5025bd8deadSopenharmony_ci    its name is again unused.  If a texture that is currently bound to
5035bd8deadSopenharmony_ci    one of the targets TEXTURE 1D, TEXTURE 2D, TEXTURE 3D, or TEXTURE
5045bd8deadSopenharmony_ci    CUBE MAP is deleted, it is as though BindTexture had been executed
5055bd8deadSopenharmony_ci    with the same target and texture zero.  Additionally, special care
5065bd8deadSopenharmony_ci    must be taken when deleting a texture if any of the images of the
5075bd8deadSopenharmony_ci    texture are attached to a framebuffer object.  See section 4.4.2.3
5085bd8deadSopenharmony_ci    for details.
5095bd8deadSopenharmony_ci
5105bd8deadSopenharmony_ci    Unused names in textures are silently ignored, as is the value
5115bd8deadSopenharmony_ci    zero."
5125bd8deadSopenharmony_ci
5135bd8deadSopenharmony_ci
5145bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 1.5 Specification (Per-Fragment
5155bd8deadSopenharmony_ciOperations and the Framebuffer)
5165bd8deadSopenharmony_ci
5175bd8deadSopenharmony_ci    On page 170, in the introduction to chapter 4, modify the first
5185bd8deadSopenharmony_ci    three paragraphs to read as follows:
5195bd8deadSopenharmony_ci
5205bd8deadSopenharmony_ci    "The framebuffer consists of a set of pixels arranged as a
5215bd8deadSopenharmony_ci    two-dimensional array.  The height and width of this array may vary
5225bd8deadSopenharmony_ci    from one GL implementation to another.  For purposes of this
5235bd8deadSopenharmony_ci    discussion, each pixel in the framebuffer is simply a set of some
5245bd8deadSopenharmony_ci    number of bits.  The number of bits per pixel may also vary
5255bd8deadSopenharmony_ci    depending on the particular GL implementation or context.
5265bd8deadSopenharmony_ci
5275bd8deadSopenharmony_ci    Further there are two classes of framebuffers: the default
5285bd8deadSopenharmony_ci    framebuffer supplied by the window-system-provided and
5295bd8deadSopenharmony_ci    application-created framebuffer objects.  Every GL context has a
5305bd8deadSopenharmony_ci    single default window-system-provided framebuffer.  Applications can
5315bd8deadSopenharmony_ci    optionally create additional non-displayable framebuffer objects.
5325bd8deadSopenharmony_ci    (For more information on application-created framebuffer objects see
5335bd8deadSopenharmony_ci    section 4.4)
5345bd8deadSopenharmony_ci
5355bd8deadSopenharmony_ci    Corresponding bits from each pixel in the framebuffer are grouped
5365bd8deadSopenharmony_ci    together into a bitplane; each bitplane contains a single bit from
5375bd8deadSopenharmony_ci    each pixel.  These bitplanes are grouped into several logical
5385bd8deadSopenharmony_ci    buffers.  These are the color, depth, stencil, and accumulation
5395bd8deadSopenharmony_ci    buffers.  The color buffer actually consists of a number of buffers,
5405bd8deadSopenharmony_ci    and these color buffers serve related but slightly different
5415bd8deadSopenharmony_ci    purposes depending on whether the GL is bound to the default
5425bd8deadSopenharmony_ci    window-system-provided framebuffer or to an application-created
5435bd8deadSopenharmony_ci    framebuffer object.
5445bd8deadSopenharmony_ci
5455bd8deadSopenharmony_ci    For the default window-system-provided framebuffer, the color
5465bd8deadSopenharmony_ci    buffers are: the front left buffer, the front right buffer, the back
5475bd8deadSopenharmony_ci    left buffer, the back right buffer, and some number of auxiliary
5485bd8deadSopenharmony_ci    buffers.  Typically, the contents of the front buffers are displayed
5495bd8deadSopenharmony_ci    on a color monitor while the contents of the back buffers are
5505bd8deadSopenharmony_ci    invisible.  (Monoscopic contexts display only the front left buffer;
5515bd8deadSopenharmony_ci    stereoscopic contexts display both the front left and the front
5525bd8deadSopenharmony_ci    right buffers.)  The contents of the auxiliary buffers are never
5535bd8deadSopenharmony_ci    visible.  All color buffers must have the same number of bitplanes,
5545bd8deadSopenharmony_ci    although an implementation or context may choose not to provide
5555bd8deadSopenharmony_ci    right buffers, back buffers, or auxiliary buffers at all.  Further,
5565bd8deadSopenharmony_ci    an implementation or context may not provide depth, stencil, or
5575bd8deadSopenharmony_ci    accumulation buffers.
5585bd8deadSopenharmony_ci
5595bd8deadSopenharmony_ci    For application-created framebuffer objects, the color buffers are
5605bd8deadSopenharmony_ci    not visible, and consequently the names of the color buffers are not
5615bd8deadSopenharmony_ci    related to a display device.  The names of the color buffers of an
5625bd8deadSopenharmony_ci    application-created framebuffer object are: COLOR_ATTACHMENT0_EXT
5635bd8deadSopenharmony_ci    through COLOR_ATTACHMENTn_EXT.  The names of the depth and stencil
5645bd8deadSopenharmony_ci    buffers are DEPTH_ATTACHMENT_EXT and STENCIL_ATTACHMENT_EXT.  For
5655bd8deadSopenharmony_ci    more information about the buffers of an application-created
5665bd8deadSopenharmony_ci    framebuffer object, see section 4.4.2.  To be considered framebuffer
5675bd8deadSopenharmony_ci    complete (see section 4.4.4), all color buffers attached to an
5685bd8deadSopenharmony_ci    application-created framebuffer object must have the same number of
5695bd8deadSopenharmony_ci    bitplanes.  Depth and stencil buffers may optionally be attached to
5705bd8deadSopenharmony_ci    application-created framebuffers as well.
5715bd8deadSopenharmony_ci
5725bd8deadSopenharmony_ci    Color buffers consist of either unsigned integer color indices or R,
5735bd8deadSopenharmony_ci    G, B, and, optionally, A unsigned integer values.  The number of
5745bd8deadSopenharmony_ci    bitplanes in each of the color buffers, the depth buffer, the
5755bd8deadSopenharmony_ci    stencil buffer, and the accumulation buffer is dependent on the
5765bd8deadSopenharmony_ci    currently bound framebuffer.  For the default framebuffer, the
5775bd8deadSopenharmony_ci    number of bitplanes is fixed.  For application-created framebuffer
5785bd8deadSopenharmony_ci    objects, however, the number of bitplanes in a given logical buffer
5795bd8deadSopenharmony_ci    may change if the state of the corresponding framebuffer attachment
5805bd8deadSopenharmony_ci    or attached image changes (see sections 4.4.2 and 4.4.5).  If an
5815bd8deadSopenharmony_ci    accumulation buffer is provided, it must have at least as many
5825bd8deadSopenharmony_ci    bitplanes per R, G, and B color component as do the color buffers."
5835bd8deadSopenharmony_ci
5845bd8deadSopenharmony_ci    Add a new paragraph to the end of section 4.1.1, page 171:
5855bd8deadSopenharmony_ci
5865bd8deadSopenharmony_ci    "While an application-created framebuffer object is bound to
5875bd8deadSopenharmony_ci    FRAMEBUFFER_EXT, the pixel ownership test always passes.  The pixels
5885bd8deadSopenharmony_ci    of application-created frambuffer objects are always owned by the
5895bd8deadSopenharmony_ci    GL, not the window system.  Only while the window-system-provided
5905bd8deadSopenharmony_ci    framebuffer named zero is bound to FRAMEBUFFER_EXT does the window
5915bd8deadSopenharmony_ci    system control pixel ownership."
5925bd8deadSopenharmony_ci
5935bd8deadSopenharmony_ci    Change section 4.1.5, page 174, third paragraph, first two sentences
5945bd8deadSopenharmony_ci    to read as follows:
5955bd8deadSopenharmony_ci
5965bd8deadSopenharmony_ci    "<ref> is an integer reference value that is used in the unsigned
5975bd8deadSopenharmony_ci    stencil comparison.  Stencil comparison operations and queries of
5985bd8deadSopenharmony_ci    <ref> use the value of <ref> clamped to the range [0, (2^s) - 1],
5995bd8deadSopenharmony_ci    where s is the current number of bits in the stencil buffer."
6005bd8deadSopenharmony_ci
6015bd8deadSopenharmony_ci    Replace the first three sentences of 4.1.10 "Logical Operation":
6025bd8deadSopenharmony_ci
6035bd8deadSopenharmony_ci    "Finally, a logical operation is applied between the incoming
6045bd8deadSopenharmony_ci    fragment's color or index values and the color or index values
6055bd8deadSopenharmony_ci    stored at the corresponding location in the framebuffer. The result
6065bd8deadSopenharmony_ci    replaces the values in the framebuffer at the fragment's (x[w],
6075bd8deadSopenharmony_ci    y[w]) coordinates.  However, if the DRAW_BUFFERS state selects a
6085bd8deadSopenharmony_ci    single framebuffer-attachable image more than once, then an
6095bd8deadSopenharmony_ci    undefined value is written to those color buffers at the fragment's
6105bd8deadSopenharmony_ci    (x[w], y[x]) coordinates."
6115bd8deadSopenharmony_ci
6125bd8deadSopenharmony_ci    Change section 4.2.1, to read as follows:
6135bd8deadSopenharmony_ci
6145bd8deadSopenharmony_ci    "The first such operation is controlling the buffer into which color
6155bd8deadSopenharmony_ci    values are written.  This is accomplished with
6165bd8deadSopenharmony_ci
6175bd8deadSopenharmony_ci        void DrawBuffer( enum buf );
6185bd8deadSopenharmony_ci
6195bd8deadSopenharmony_ci    <buf> defines a buffer or set of buffers for writing.  <buf> must be
6205bd8deadSopenharmony_ci    one of the values from tables 4.4 or 10.nnn.  Otherwise,
6215bd8deadSopenharmony_ci    INVALID_ENUM is generated.  In addition, acceptable values for <buf>
6225bd8deadSopenharmony_ci    depend on whether the GL is using the default window-system-provided
6235bd8deadSopenharmony_ci    framebuffer (i.e., FRAMEBUFFER_BINDING_EXT is zero), or an
6245bd8deadSopenharmony_ci    application-created framebuffer object (i.e.,
6255bd8deadSopenharmony_ci    FRAMEBUFFER_BINDING_EXT is non-zero).  In the initial state, the GL
6265bd8deadSopenharmony_ci    is bound to the the window-system-provided framebuffer.  For more
6275bd8deadSopenharmony_ci    information about application-created framebuffer objects, see
6285bd8deadSopenharmony_ci    section 4.4.
6295bd8deadSopenharmony_ci
6305bd8deadSopenharmony_ci    If the GL is bound to the window-system-provided framebuffer, then
6315bd8deadSopenharmony_ci    <buf> must be one the values listed in table 4.4, which summarizes
6325bd8deadSopenharmony_ci    the constants and the buffers they indicate.  In this case, <buf> is
6335bd8deadSopenharmony_ci    a symbolic constant specifying zero, one, two, or four buffers for
6345bd8deadSopenharmony_ci    writing. These constants refer to the four potentially visible
6355bd8deadSopenharmony_ci    buffers front left, front right, back left, and back right, and to
6365bd8deadSopenharmony_ci    the auxiliary buffers.  Arguments other than AUXi that omit
6375bd8deadSopenharmony_ci    reference to LEFT or RIGHT refer to both left and right buffers.
6385bd8deadSopenharmony_ci    Arguments other than AUXi that omit reference to FRONT or BACK refer
6395bd8deadSopenharmony_ci    to both front and back buffers.  AUXi enables drawing only to
6405bd8deadSopenharmony_ci    auxiliary buffer i.  Each AUXi adheres to AUXi = AUX0 + i.
6415bd8deadSopenharmony_ci
6425bd8deadSopenharmony_ci    If the GL is bound to an application-created framebuffer object,
6435bd8deadSopenharmony_ci    <buf> must be one of the values listed in table 10.nnn, which
6445bd8deadSopenharmony_ci    summarizes the constants and the buffers they indicate. In this
6455bd8deadSopenharmony_ci    case, <buf> is a symbolic constant specifying a single color buffer
6465bd8deadSopenharmony_ci    for writing.  Specifying COLOR_ATTACHMENTi_EXT enables drawing only
6475bd8deadSopenharmony_ci    to the image attached to the framebuffer at COLOR_ATTACHMENTi_EXT.
6485bd8deadSopenharmony_ci    Each COLOR_ATTACHMENTi_EXT adheres to COLOR_ATTACHMENTi_EXT =
6495bd8deadSopenharmony_ci    COLOR_ATTACHMENT0_EXT + i.  The intial value of DRAW_BUFFER for
6505bd8deadSopenharmony_ci    application-created framebuffer objects is COLOR_ATTACHMENT0_EXT.
6515bd8deadSopenharmony_ci
6525bd8deadSopenharmony_ci
6535bd8deadSopenharmony_ci    Symbolic Constant     Meaning
6545bd8deadSopenharmony_ci    -----------------     -------
6555bd8deadSopenharmony_ci    NONE                  no buffer
6565bd8deadSopenharmony_ci    COLOR_ATTACHMENT0     output fragment color to image attached
6575bd8deadSopenharmony_ci                          at color attachment point 0
6585bd8deadSopenharmony_ci    COLOR_ATTACHMENT1     output fragment color to image attached
6595bd8deadSopenharmony_ci                          at color attachment point 1
6605bd8deadSopenharmony_ci    ...                   ...
6615bd8deadSopenharmony_ci    COLOR_ATTACHMENTn     output fragment color to image attached
6625bd8deadSopenharmony_ci                          at color attachment point n, where
6635bd8deadSopenharmony_ci                          n is MAX_COLOR_ATTACHMENTS - 1
6645bd8deadSopenharmony_ci    -------------------------------------------------------------------
6655bd8deadSopenharmony_ci    Table 10.nnn:  Arguments to DrawBuffer(s) and ReadBuffer when the
6665bd8deadSopenharmony_ci    context is bound to an application-created framebuffer object, and
6675bd8deadSopenharmony_ci    the buffers they indicate
6685bd8deadSopenharmony_ci
6695bd8deadSopenharmony_ci    If the GL is bound to the window-system-provided framebuffer and
6705bd8deadSopenharmony_ci    DrawBuffer is supplied with a constant (other than NONE) that does
6715bd8deadSopenharmony_ci    not indicate any of the color buffers allocated to the GL context by
6725bd8deadSopenharmony_ci    the window-system (including those listed in table 10.nnn), then the
6735bd8deadSopenharmony_ci    error INVALID_OPERATION results.
6745bd8deadSopenharmony_ci
6755bd8deadSopenharmony_ci    If the GL is bound to the application-created framebuffer and
6765bd8deadSopenharmony_ci    DrawBuffer is supplied with a constant from table 4.4, or
6775bd8deadSopenharmony_ci    COLOR_ATTACHMENTm where m is greater than or equal to
6785bd8deadSopenharmony_ci    MAX_COLOR_ATTACHMENTS, then the error INVALID_OPERATION results.
6795bd8deadSopenharmony_ci
6805bd8deadSopenharmony_ci    If DrawBuffer is supplied with a constant that is neither legal for
6815bd8deadSopenharmony_ci    the window-system provided framebuffer nor legal for an
6825bd8deadSopenharmony_ci    application-created framebuffer object, then the error INVALID_ENUM
6835bd8deadSopenharmony_ci    results.
6845bd8deadSopenharmony_ci
6855bd8deadSopenharmony_ci    The command
6865bd8deadSopenharmony_ci
6875bd8deadSopenharmony_ci        void DrawBuffers( sizei n, const enum *bufs );
6885bd8deadSopenharmony_ci
6895bd8deadSopenharmony_ci    defines the draw buffers to which all fragment colors are written.
6905bd8deadSopenharmony_ci    <n> specifies the number of buffers in <bufs>.  <bufs> is a pointer
6915bd8deadSopenharmony_ci    to an array of symbolic constants specifying the buffer to which
6925bd8deadSopenharmony_ci    each fragment color is written.
6935bd8deadSopenharmony_ci
6945bd8deadSopenharmony_ci    Each enumerant listed in <bufs> must be one of the values from
6955bd8deadSopenharmony_ci    tables 10.nnn or 11.nnn.  Otherwise, INVALID_ENUM is generated.
6965bd8deadSopenharmony_ci    Further, acceptable values for the constants in <bufs> depend on
6975bd8deadSopenharmony_ci    whether the GL is using the default window-system-provided
6985bd8deadSopenharmony_ci    framebuffer (i.e., FRAMEBUFFER_BINDING_EXT is zero), or an
6995bd8deadSopenharmony_ci    application-created framebuffer object (i.e.,
7005bd8deadSopenharmony_ci    FRAMEBUFFER_BINDING_EXT is non-zero).  For more information about
7015bd8deadSopenharmony_ci    application-created framebuffer objects, see section 4.4.
7025bd8deadSopenharmony_ci
7035bd8deadSopenharmony_ci
7045bd8deadSopenharmony_ci      symbolic       front  front   back   back   aux
7055bd8deadSopenharmony_ci      constant       left   right   left   right  i
7065bd8deadSopenharmony_ci      --------       -----  -----   ----   -----  ---
7075bd8deadSopenharmony_ci      NONE
7085bd8deadSopenharmony_ci      FRONT LEFT      X
7095bd8deadSopenharmony_ci      FRONT RIGHT             X
7105bd8deadSopenharmony_ci      BACK LEFT                      X
7115bd8deadSopenharmony_ci      BACK RIGHT                            X
7125bd8deadSopenharmony_ci      AUXi                                         X
7135bd8deadSopenharmony_ci      --------------------------------------------------
7145bd8deadSopenharmony_ci      Table 11.nnn: Arguments to DrawBuffers, when the context is bound
7155bd8deadSopenharmony_ci      to the window-system-provided framebuffer, and the buffers that
7165bd8deadSopenharmony_ci      they indicate.
7175bd8deadSopenharmony_ci
7185bd8deadSopenharmony_ci    If the GL is bound to the default window-system-provided
7195bd8deadSopenharmony_ci    framebuffer, then the each of the constants must be one of the
7205bd8deadSopenharmony_ci    values listed in table 11.nnn
7215bd8deadSopenharmony_ci
7225bd8deadSopenharmony_ci    If the GL is bound to an application-created framebuffer object,
7235bd8deadSopenharmony_ci    then each of the constants must be one of the values listed in table
7245bd8deadSopenharmony_ci    10.nnn.
7255bd8deadSopenharmony_ci
7265bd8deadSopenharmony_ci    In both cases, the draw buffers being defined correspond in order to
7275bd8deadSopenharmony_ci    the respective fragment colors.  The draw buffer for fragment colors
7285bd8deadSopenharmony_ci    beyond <n> is set to NONE.
7295bd8deadSopenharmony_ci
7305bd8deadSopenharmony_ci    The maximum number of draw buffers is implementation dependent and
7315bd8deadSopenharmony_ci    must be at least 1.  The number of draw buffers supported can be
7325bd8deadSopenharmony_ci    queried by calling GetIntegerv with the symbolic constant
7335bd8deadSopenharmony_ci    MAX_DRAW_BUFFERS.  INVALID_VALUE is generated if <n> is greater
7345bd8deadSopenharmony_ci    than MAX_DRAW_BUFFERS.
7355bd8deadSopenharmony_ci
7365bd8deadSopenharmony_ci    Except for NONE, a buffer may not appear more then once in the array
7375bd8deadSopenharmony_ci    pointed to by <bufs>.  Specifying a buffer more then once will
7385bd8deadSopenharmony_ci    result in the error INVALID_OPERATION.
7395bd8deadSopenharmony_ci
7405bd8deadSopenharmony_ci    If fixed-function fragment shading is being performed, DrawBuffers
7415bd8deadSopenharmony_ci    specifies a set of draw buffers into which the fragment color is
7425bd8deadSopenharmony_ci    written.
7435bd8deadSopenharmony_ci
7445bd8deadSopenharmony_ci    If a fragment shader writes to "gl_FragColor", DrawBuffers specifies
7455bd8deadSopenharmony_ci    a set of draw buffers into which the single fragment color defined
7465bd8deadSopenharmony_ci    by "gl_FragColor" is written.  If a fragment shader writes to gl
7475bd8deadSopenharmony_ci    FragData, DrawBuffers specifies a set of draw buffers into which
7485bd8deadSopenharmony_ci    each of the multiple fragment colors defined by "gl_FragData" are
7495bd8deadSopenharmony_ci    separately written.  If a fragment shader writes to neither gl
7505bd8deadSopenharmony_ci    FragColor nor "gl_FragData", the values of the fragment colors
7515bd8deadSopenharmony_ci    following shader execution are undefined, and may differ for each
7525bd8deadSopenharmony_ci    fragment color.
7535bd8deadSopenharmony_ci
7545bd8deadSopenharmony_ci    For both window-system-provided and application-created
7555bd8deadSopenharmony_ci    framebuffers, the constants FRONT, BACK, LEFT, RIGHT, and
7565bd8deadSopenharmony_ci    FRONT_AND_BACK are not valid in the <bufs> array passed to
7575bd8deadSopenharmony_ci    DrawBuffers, and will result in the error INVALID_OPERATION.  This
7585bd8deadSopenharmony_ci    restriction is because these constants may themselves refer to
7595bd8deadSopenharmony_ci    multiple buffers, as shown in table 4.4.
7605bd8deadSopenharmony_ci
7615bd8deadSopenharmony_ci    If the GL is bound to the window-system-provided framebuffer and
7625bd8deadSopenharmony_ci    DrawBuffers is supplied with a constant (other than NONE) that does
7635bd8deadSopenharmony_ci    not indicate any of the color buffers allocated to the GL context by
7645bd8deadSopenharmony_ci    the window-system, then the error INVALID_OPERATION results.
7655bd8deadSopenharmony_ci
7665bd8deadSopenharmony_ci    If the GL is bound to the application-created framebuffer and
7675bd8deadSopenharmony_ci    DrawBuffers is supplied with a constant from table 11.nnn, or
7685bd8deadSopenharmony_ci    COLOR_ATTACHMENTm where m is greater than or equal to
7695bd8deadSopenharmony_ci    MAX_COLOR_ATTACHMENTS, then the error INVALID_OPERATION results.
7705bd8deadSopenharmony_ci
7715bd8deadSopenharmony_ci    If DrawBuffers is supplied with a constant that is neither legal for
7725bd8deadSopenharmony_ci    the window-system provided framebuffer nor legal for an
7735bd8deadSopenharmony_ci    application-created framebuffer object, then the error INVALID_ENUM
7745bd8deadSopenharmony_ci    results.
7755bd8deadSopenharmony_ci
7765bd8deadSopenharmony_ci    Indicating a buffer or buffers using DrawBuffer or DrawBuffers
7775bd8deadSopenharmony_ci    causes subsequent pixel color value writes to affect the indicated
7785bd8deadSopenharmony_ci    buffers.
7795bd8deadSopenharmony_ci
7805bd8deadSopenharmony_ci    Specifying NONE as the draw buffer for a fragment color will inhibit
7815bd8deadSopenharmony_ci    that fragment color from being written to any buffer.
7825bd8deadSopenharmony_ci
7835bd8deadSopenharmony_ci    Monoscopic contexts include only left buffers, while stereoscopic
7845bd8deadSopenharmony_ci    contexts include both left and right buffers.  Likewise, single
7855bd8deadSopenharmony_ci    buffered contexts include only front buffers, while double buffered
7865bd8deadSopenharmony_ci    contexts include both front and back buffers.  The type of context
7875bd8deadSopenharmony_ci    is selected at GL initialization.
7885bd8deadSopenharmony_ci
7895bd8deadSopenharmony_ci    The state required to handle color buffer selection is an integer
7905bd8deadSopenharmony_ci    for each supported fragment color.  For the default
7915bd8deadSopenharmony_ci    window-system-provided framebuffer, in the initial state, the draw
7925bd8deadSopenharmony_ci    buffer for fragment color zero is FRONT if there are no back
7935bd8deadSopenharmony_ci    buffers; otherwise it is BACK.  For application-created framebuffer
7945bd8deadSopenharmony_ci    objects, the initial value of draw buffer for fragment color zero is
7955bd8deadSopenharmony_ci    COLOR_ATTACHMENT0_EXT.  For both the window-system-provided
7965bd8deadSopenharmony_ci    framebuffer and application-created framebuffers, the initial state
7975bd8deadSopenharmony_ci    of draw buffers for fragment colors other then zero is NONE."
7985bd8deadSopenharmony_ci
7995bd8deadSopenharmony_ci    Modify section 4.2.2, page 185, third paragraph to read as follows:
8005bd8deadSopenharmony_ci
8015bd8deadSopenharmony_ci    "The command
8025bd8deadSopenharmony_ci
8035bd8deadSopenharmony_ci            void StencilMask( uint mask );
8045bd8deadSopenharmony_ci
8055bd8deadSopenharmony_ci    controls the writing of particular bits into the stencil planes. The
8065bd8deadSopenharmony_ci    least significant s bits of mask comprise an integer mask (s is the
8075bd8deadSopenharmony_ci    number of bits in the stencil buffer), just as for IndexMask. The
8085bd8deadSopenharmony_ci    initial state is for the stencil plane mask to be 32 ones."
8095bd8deadSopenharmony_ci
8105bd8deadSopenharmony_ci    In section 4.3.2, page 190, modify the first two paragraphs of the
8115bd8deadSopenharmony_ci    definition of ReadBuffer to read as follows:
8125bd8deadSopenharmony_ci
8135bd8deadSopenharmony_ci    "The command
8145bd8deadSopenharmony_ci
8155bd8deadSopenharmony_ci         void ReadBuffer( enum src );
8165bd8deadSopenharmony_ci
8175bd8deadSopenharmony_ci    takes a symbolic constant as argument.  <src> must be one of the
8185bd8deadSopenharmony_ci    values from tables 4.4 or 10.nnn.  Otherwise, INVALID_ENUM is
8195bd8deadSopenharmony_ci    generated.  Further, the acceptable values for <src> depend on
8205bd8deadSopenharmony_ci    whether the GL is using the default window-system-provided
8215bd8deadSopenharmony_ci    framebuffer (i.e., FRAMEBUFFER_BINDING_EXT is zero), or an
8225bd8deadSopenharmony_ci    application-created framebuffer object (i.e.,
8235bd8deadSopenharmony_ci    FRAMEBUFFER_BINDING_EXT is non-zero).  For more information about
8245bd8deadSopenharmony_ci    application-created framebuffer objects, see section 4.4.
8255bd8deadSopenharmony_ci
8265bd8deadSopenharmony_ci    If the object bound to FRAMEBUFFER_BINDING_EXT is not "framebuffer
8275bd8deadSopenharmony_ci    complete" (as defined in section 4.4.4.2), then ReadPixels generates
8285bd8deadSopenharmony_ci    the error INVALID_FRAMEBUFFER_OPERATION_EXT.  If ReadBuffer is
8295bd8deadSopenharmony_ci    supplied with a constant that is neither legal for the window-system
8305bd8deadSopenharmony_ci    provided framebuffer, nor legal for an application-created
8315bd8deadSopenharmony_ci    framebuffer object, then the error INVALID_ENUM results.
8325bd8deadSopenharmony_ci
8335bd8deadSopenharmony_ci    When FRAMEBUFFER_BINDING_EXT is zero, i.e. the default
8345bd8deadSopenharmony_ci    window-system-provided framebuffer, <src> must be one of the values
8355bd8deadSopenharmony_ci    listed in table 4.4. FRONT and LEFT refer to the front left buffer,
8365bd8deadSopenharmony_ci    BACK refers to the back left buffer, and RIGHT refers to the front
8375bd8deadSopenharmony_ci    right buffer.  The other constants correspond directly to the
8385bd8deadSopenharmony_ci    buffers that they name. If the requested buffer is missing, then the
8395bd8deadSopenharmony_ci    error INVALID_OPERATION is generated.  For the default
8405bd8deadSopenharmony_ci    window-system-provided framebuffer, the initial setting for
8415bd8deadSopenharmony_ci    ReadBuffer is FRONT if there is no back buffer and BACK otherwise.
8425bd8deadSopenharmony_ci
8435bd8deadSopenharmony_ci    When the GL is using an application-created framebuffer object,
8445bd8deadSopenharmony_ci    <src> must be one of the values listed in table 10.nnn, including
8455bd8deadSopenharmony_ci    NONE.  In a manner analogous to how the DRAW_BUFFERs state is
8465bd8deadSopenharmony_ci    handled, specifying COLOR_ATTACHMENTi_EXT enables reading from the
8475bd8deadSopenharmony_ci    image attached to the framebuffer at COLOR_ATTACHMENTi_EXT.
8485bd8deadSopenharmony_ci    ReadPixels generates INVALID_OPERATION if it attempts to select a
8495bd8deadSopenharmony_ci    color buffer while READ_BUFFER is NONE.  For application-created
8505bd8deadSopenharmony_ci    framebuffer objects, the initial setting for ReadBuffer is
8515bd8deadSopenharmony_ci    COLOR_ATTACHMENT0_EXT.
8525bd8deadSopenharmony_ci
8535bd8deadSopenharmony_ci    ReadPixels obtains values from the selected buffer from each pixel
8545bd8deadSopenharmony_ci    with lower left hand corner at (x+i, y+j) for (0 <= i < width) and
8555bd8deadSopenharmony_ci    (0 <= j < height); this pixel is said to be the ith pixel in the jth
8565bd8deadSopenharmony_ci    row.  If any of these pixels lies outside of the window allocated to
8575bd8deadSopenharmony_ci    the current GL context, or outside of the image attached to the
8585bd8deadSopenharmony_ci    currently bound framebuffer object, then the values obtained for
8595bd8deadSopenharmony_ci    those pixels are undefined.  When FRAMEBUFFER_BINDING_EXT is zero,
8605bd8deadSopenharmony_ci    results are also undefined for individual pixels that are not owned
8615bd8deadSopenharmony_ci    by the current context.  Otherwise, ReadPixels obtains values from
8625bd8deadSopenharmony_ci    the selected buffer, regardless of how those values were placed
8635bd8deadSopenharmony_ci    there."
8645bd8deadSopenharmony_ci
8655bd8deadSopenharmony_ci    In section 4.3.2, "Reading Pixels", add a paragraph before
8665bd8deadSopenharmony_ci    "Conversion of RGBA values" on page 191:
8675bd8deadSopenharmony_ci
8685bd8deadSopenharmony_ci    "When FRAMEBUFFER_BINDING is non-zero, the red, green, blue, and
8695bd8deadSopenharmony_ci    alpha values are obtained by first reading the internal component
8705bd8deadSopenharmony_ci    values of the corresponding value in the image attached to the
8715bd8deadSopenharmony_ci    selected logical buffer.  The internal component values are
8725bd8deadSopenharmony_ci    converted to red, green, blue, and alpha values as specified in the
8735bd8deadSopenharmony_ci    row of table 12.nnn corresponding to the internal format of the
8745bd8deadSopenharmony_ci    image attached to READ_BUFFER."
8755bd8deadSopenharmony_ci
8765bd8deadSopenharmony_ci    Add the following text to section 4.3.3, page 194, inside the
8775bd8deadSopenharmony_ci    definiton of CopyPixels:
8785bd8deadSopenharmony_ci
8795bd8deadSopenharmony_ci    "Furthermore, the behavior of several GL operations is specified "as
8805bd8deadSopenharmony_ci    if the arguments were passed to CopyPixels."  These operations
8815bd8deadSopenharmony_ci    include: CopyTex{Sub}Image*, CopyColor{Sub}Table, and
8825bd8deadSopenharmony_ci    CopyConvolutionFilter*.  INVALID_FRAMEBUFFER_OPERATION_EXT will be
8835bd8deadSopenharmony_ci    generated if an attempt is made to execute one of these operations,
8845bd8deadSopenharmony_ci    or CopyPixels, while the object bound to FRAMEBUFFER_BINDING_EXT is
8855bd8deadSopenharmony_ci    not "framebuffer complete" (as defined in section 4.4.4.2)."
8865bd8deadSopenharmony_ci
8875bd8deadSopenharmony_ci    Add a new section "Framebuffer Objects" after section 4.3:
8885bd8deadSopenharmony_ci
8895bd8deadSopenharmony_ci    "4.4 Framebuffer Objects
8905bd8deadSopenharmony_ci
8915bd8deadSopenharmony_ci    As described in chapters 1 and 2, GL renders into (and reads values
8925bd8deadSopenharmony_ci    from) a framebuffer.  GL defines two classes of framebuffers:
8935bd8deadSopenharmony_ci    window-system-provided framebuffers and application-created
8945bd8deadSopenharmony_ci    framebuffers.  For each GL context, there is a single framebuffer
8955bd8deadSopenharmony_ci    provided by the window-system, and there may also be one or more
8965bd8deadSopenharmony_ci    framebuffer objects created and managed by the application.
8975bd8deadSopenharmony_ci
8985bd8deadSopenharmony_ci    By default, the GL uses the window-system-provided framebuffer.  The
8995bd8deadSopenharmony_ci    storage, dimensions, allocation, and format of the images attached
9005bd8deadSopenharmony_ci    to this framebuffer are managed entirely by the window-system.
9015bd8deadSopenharmony_ci    Consequently, the state of the window-system-provided framebuffer,
9025bd8deadSopenharmony_ci    including its images, can not be changed by the GL, nor can the
9035bd8deadSopenharmony_ci    window-system-provided framebuffer itself, or its images, be deleted
9045bd8deadSopenharmony_ci    by the GL.
9055bd8deadSopenharmony_ci
9065bd8deadSopenharmony_ci    The routines described in the following sections, however, can be
9075bd8deadSopenharmony_ci    used to create, destroy, and modify the state and attachments of
9085bd8deadSopenharmony_ci    application-created framebuffer objects.
9095bd8deadSopenharmony_ci
9105bd8deadSopenharmony_ci    Application-created framebuffer objects encapsulate the state of a
9115bd8deadSopenharmony_ci    framebuffer in a similar manner to the way texture objects
9125bd8deadSopenharmony_ci    encapsulate the state of a texture.  In particular, a framebuffer
9135bd8deadSopenharmony_ci    object encapsulates state necessary to describe a collection of
9145bd8deadSopenharmony_ci    color, depth, stencil, accum, and aux logical buffers.  For each
9155bd8deadSopenharmony_ci    logical buffer, a framebuffer-attachable image can be attached to
9165bd8deadSopenharmony_ci    the framebuffer to store the rendered output for that logical
9175bd8deadSopenharmony_ci    buffer.  Examples of framebuffer-attachable images include texture
9185bd8deadSopenharmony_ci    images and renderbuffer images.  Renderbuffers are described further
9195bd8deadSopenharmony_ci    in section 4.4.2.1
9205bd8deadSopenharmony_ci
9215bd8deadSopenharmony_ci    By allowing the images of a renderbuffer to be attached to a
9225bd8deadSopenharmony_ci    framebuffer, the GL provides a mechanism to support "off-screen"
9235bd8deadSopenharmony_ci    rendering.  Further, by allowing the images of a texture to be
9245bd8deadSopenharmony_ci    attached to a framebuffer, the GL provides a mechanism to support
9255bd8deadSopenharmony_ci    "render to texture".
9265bd8deadSopenharmony_ci
9275bd8deadSopenharmony_ci    4.4.1 Binding and Managing Framebuffer Objects
9285bd8deadSopenharmony_ci
9295bd8deadSopenharmony_ci    The operations described in chapter 4 affect the images attached to
9305bd8deadSopenharmony_ci    the framebuffer object bound to the target FRAMEBUFFER_EXT.  By
9315bd8deadSopenharmony_ci    default, framebuffer bound to the target FRAMEBUFFER_EXT is zero,
9325bd8deadSopenharmony_ci    specifying the default implementation dependent framebuffer provided
9335bd8deadSopenharmony_ci    by the windowing system.  When the framebuffer bound to target
9345bd8deadSopenharmony_ci    FRAMEBUFFER_EXT is not zero, but instead names an
9355bd8deadSopenharmony_ci    application-created framebuffer object, then the operations
9365bd8deadSopenharmony_ci    described in chapter 4 affect the application-created framebuffer
9375bd8deadSopenharmony_ci    object rather than the default framebuffer.
9385bd8deadSopenharmony_ci
9395bd8deadSopenharmony_ci    The namespace for framebuffer objects is the unsigned integers, with
9405bd8deadSopenharmony_ci    zero reserved by the GL to refer to the default framebuffer.  A
9415bd8deadSopenharmony_ci    framebuffer object is created by binding an unused name to the
9425bd8deadSopenharmony_ci    target FRAMEBUFFER_EXT.  The binding is effected by calling
9435bd8deadSopenharmony_ci
9445bd8deadSopenharmony_ci        void BindFramebufferEXT(enum target, uint framebuffer);
9455bd8deadSopenharmony_ci
9465bd8deadSopenharmony_ci    with <target> set to FRAMEBUFFER_EXT and <framebuffer> set to the
9475bd8deadSopenharmony_ci    unused name.  The resulting framebuffer object is a new state
9485bd8deadSopenharmony_ci    vector, comprising all the state values listed in table 4.nnn, as
9495bd8deadSopenharmony_ci    well as one set of the state values listed in table 5.nnn for each
9505bd8deadSopenharmony_ci    attachment point of the framebuffer.  There are
9515bd8deadSopenharmony_ci    MAX_COLOR_ATTACHMENTS_EXT color attachment points, plus one each for
9525bd8deadSopenharmony_ci    the depth and stencil attachment points.
9535bd8deadSopenharmony_ci
9545bd8deadSopenharmony_ci    BindFramebufferEXT may also be used to bind an existing framebuffer
9555bd8deadSopenharmony_ci    object to <target>.  If the bind is successful no change is made to
9565bd8deadSopenharmony_ci    the state of the bound framebuffer object and any previous binding
9575bd8deadSopenharmony_ci    to <target> is broken.  The current FRAMEBUFFER_EXT binding can be
9585bd8deadSopenharmony_ci    queried using GetIntegerv(FRAMEBUFFER_BINDING_EXT).
9595bd8deadSopenharmony_ci
9605bd8deadSopenharmony_ci    While a framebuffer object is bound to the target FRAMEBUFFER_EXT,
9615bd8deadSopenharmony_ci    GL operations on the target to which it is bound affect the images
9625bd8deadSopenharmony_ci    attached to the bound framebuffer object, and queries of the target
9635bd8deadSopenharmony_ci    to which it is bound return state from the bound object.  In
9645bd8deadSopenharmony_ci    particular, queries of the values specified in table 6.31
9655bd8deadSopenharmony_ci    (Implementation Dependent Pixel Depths) and table 8.nnn
9665bd8deadSopenharmony_ci    (Framebuffer-Dependent State Variables) are derived from the
9675bd8deadSopenharmony_ci    currently bound framebuffer object.  The framebuffer object bound to
9685bd8deadSopenharmony_ci    the target FRAMEBUFFER_EXT is used as the destination of fragment
9695bd8deadSopenharmony_ci    operations and as the source of pixel reads such as ReadPixels, as
9705bd8deadSopenharmony_ci    described in chapter 4.
9715bd8deadSopenharmony_ci
9725bd8deadSopenharmony_ci    In the initial state, the reserved name zero is bound to the target
9735bd8deadSopenharmony_ci    FRAMEBUFFER_EXT.  There is no application-created framebuffer object
9745bd8deadSopenharmony_ci    corresponding to the name zero.  Instead, the name zero refers to
9755bd8deadSopenharmony_ci    the window-system-provided framebuffer.  All queries and operations
9765bd8deadSopenharmony_ci    on the framebuffer while the name zero is bound to the target
9775bd8deadSopenharmony_ci    FRAMEBUFFER_EXT operate on this default framebuffer.  On some
9785bd8deadSopenharmony_ci    implementations, the properties of the default
9795bd8deadSopenharmony_ci    window-system-provided framebuffer can change over time (e.g., in
9805bd8deadSopenharmony_ci    response to window-system events such as attaching the context to a
9815bd8deadSopenharmony_ci    new window-system drawable.)
9825bd8deadSopenharmony_ci
9835bd8deadSopenharmony_ci    Application-created framebuffer objects (i.e., those with a non-zero
9845bd8deadSopenharmony_ci    name) differ from the default window-system-provided framebuffer in
9855bd8deadSopenharmony_ci    a few important ways.  First and foremost, unlike the
9865bd8deadSopenharmony_ci    window-system-provided framebuffer, application-created-framebuffers
9875bd8deadSopenharmony_ci    have modifiable attachment points for each logical buffer in the
9885bd8deadSopenharmony_ci    framebuffer.  Framebuffer-attachable images can be attached to and
9895bd8deadSopenharmony_ci    detached from these attachment points, which are described further
9905bd8deadSopenharmony_ci    in section 4.4.2.  Also, the size and format of the images attached
9915bd8deadSopenharmony_ci    to application-created framebuffers are controlled entirely within
9925bd8deadSopenharmony_ci    the GL interface, and are not affected by window-system events, such
9935bd8deadSopenharmony_ci    as pixel format selection, window resizes, and display mode changes.
9945bd8deadSopenharmony_ci
9955bd8deadSopenharmony_ci    Additionally, when rendering to or reading from an application
9965bd8deadSopenharmony_ci    created-framebuffer object,
9975bd8deadSopenharmony_ci
9985bd8deadSopenharmony_ci          - The pixel ownership test always succeeds.  In other words,
9995bd8deadSopenharmony_ci            application-created framebuffer objects own all of their
10005bd8deadSopenharmony_ci            pixels.
10015bd8deadSopenharmony_ci
10025bd8deadSopenharmony_ci          - There are no visible color buffer bitplanes.  This means
10035bd8deadSopenharmony_ci            there is no color buffer corresponding to the back, front,
10045bd8deadSopenharmony_ci            left, or right color bitplanes.
10055bd8deadSopenharmony_ci
10065bd8deadSopenharmony_ci          - The only color buffer bitplanes are the ones defined by the
10075bd8deadSopenharmony_ci            framebuffer attachment points named COLOR_ATTACHMENT0_EXT
10085bd8deadSopenharmony_ci            through COLOR_ATTACHMENTn_EXT.
10095bd8deadSopenharmony_ci
10105bd8deadSopenharmony_ci          - The only depth buffer bitplanes are the ones defined by the
10115bd8deadSopenharmony_ci            framebuffer attachment point DEPTH_ATTACHMENT_EXT.
10125bd8deadSopenharmony_ci
10135bd8deadSopenharmony_ci          - The only stencil buffer bitplanes are the ones defined by
10145bd8deadSopenharmony_ci            the framebuffer attachment point STENCIL_ATTACHMENT_EXT.
10155bd8deadSopenharmony_ci
10165bd8deadSopenharmony_ci          - There is no multisample buffer so the value of the
10175bd8deadSopenharmony_ci            implementation-dependent state variables SAMPLES and
10185bd8deadSopenharmony_ci            SAMPLE_BUFFERS are both 0
10195bd8deadSopenharmony_ci
10205bd8deadSopenharmony_ci          - There are no accum buffer bitplanes, so the value of the
10215bd8deadSopenharmony_ci            implementation-dependent state variables ACCUM_RED_BITS,
10225bd8deadSopenharmony_ci            ACCUM_GREEN_BITS, ACCUM_BLUE_BITS, and ACCUM_ALPHA_BITS, are
10235bd8deadSopenharmony_ci            all zero.
10245bd8deadSopenharmony_ci
10255bd8deadSopenharmony_ci          - There are no AUX buffer bitplanes, so the value of the
10265bd8deadSopenharmony_ci            implementation-dependent state variable AUX_BUFFERS is zero.
10275bd8deadSopenharmony_ci
10285bd8deadSopenharmony_ci    Framebuffer objects are deleted by calling
10295bd8deadSopenharmony_ci
10305bd8deadSopenharmony_ci      void DeleteFramebuffersEXT(sizei n, uint *framebuffers);
10315bd8deadSopenharmony_ci
10325bd8deadSopenharmony_ci    <framebuffers> contains <n> names of framebuffer objects to be
10335bd8deadSopenharmony_ci    deleted.  After a framebuffer object is deleted, it has no
10345bd8deadSopenharmony_ci    attachments, and its name is again unused.  If a framebuffer that is
10355bd8deadSopenharmony_ci    currently bound to the target FRAMEBUFFER_EXT is deleted, it is as
10365bd8deadSopenharmony_ci    though BindFramebufferEXT had been executed with the <target> of
10375bd8deadSopenharmony_ci    FRAMEBUFFER_EXT and <framebuffer> of zero.  Unused names in
10385bd8deadSopenharmony_ci    <framebuffers> are silently ignored, as is the value zero.
10395bd8deadSopenharmony_ci
10405bd8deadSopenharmony_ci    The command
10415bd8deadSopenharmony_ci
10425bd8deadSopenharmony_ci      void GenFramebuffersEXT(sizei n, uint *ids);
10435bd8deadSopenharmony_ci
10445bd8deadSopenharmony_ci    returns <n> previously unused framebuffer object names in <ids>.
10455bd8deadSopenharmony_ci    These names are marked as used, for the purposes of
10465bd8deadSopenharmony_ci    GenFramebuffersEXT only, but they acquire state and type only when
10475bd8deadSopenharmony_ci    they are first bound, just as if they were unused.
10485bd8deadSopenharmony_ci
10495bd8deadSopenharmony_ci    4.4.2 Attaching Images to Framebuffer Objects
10505bd8deadSopenharmony_ci
10515bd8deadSopenharmony_ci    Framebuffer-attachable images may be attached to, and detached from,
10525bd8deadSopenharmony_ci    application-created framebuffer objects.  In contrast, the image
10535bd8deadSopenharmony_ci    attachments of the window-system-provided framebuffer may not be
10545bd8deadSopenharmony_ci    changed by the GL.
10555bd8deadSopenharmony_ci
10565bd8deadSopenharmony_ci    A single framebuffer-attachable image may be attached to multiple
10575bd8deadSopenharmony_ci    application-created framebuffer objects, potentially avoiding some
10585bd8deadSopenharmony_ci    data copies, and possibly decreasing memory consumption.
10595bd8deadSopenharmony_ci
10605bd8deadSopenharmony_ci    For each logical buffer, the framebuffer object stores a set of
10615bd8deadSopenharmony_ci    state which defines the logical buffer's "attachment point".  The
10625bd8deadSopenharmony_ci    "attachment point" state contains enough information to identify the
10635bd8deadSopenharmony_ci    single image attached to the attachment point, or to indicate that
10645bd8deadSopenharmony_ci    no image is attached.  The per-logical buffer "attachment point"
10655bd8deadSopenharmony_ci    state is listed in table 5.nnn
10665bd8deadSopenharmony_ci
10675bd8deadSopenharmony_ci    There are two types of framebuffer-attachable images: the image of a
10685bd8deadSopenharmony_ci    renderbuffer object, and an image of a texture object.
10695bd8deadSopenharmony_ci
10705bd8deadSopenharmony_ci    4.4.2.1 Renderbuffer Objects
10715bd8deadSopenharmony_ci
10725bd8deadSopenharmony_ci    A renderbuffer is a data storage object containing a single image of
10735bd8deadSopenharmony_ci    a renderable internal format.  GL provides the methods described
10745bd8deadSopenharmony_ci    below to allocate and delete a renderbuffer's image, and to attach a
10755bd8deadSopenharmony_ci    renderbuffer's image to a framebuffer object.
10765bd8deadSopenharmony_ci
10775bd8deadSopenharmony_ci    The name space for renderbuffer objects is the unsigned integers,
10785bd8deadSopenharmony_ci    with zero reserved for the GL.  A renderbuffer object is created by
10795bd8deadSopenharmony_ci    binding an unused name to RENDERBUFFER_EXT.  The binding is effected
10805bd8deadSopenharmony_ci    by calling
10815bd8deadSopenharmony_ci
10825bd8deadSopenharmony_ci        void BindRenderbufferEXT( enum target, uint renderbuffer );
10835bd8deadSopenharmony_ci
10845bd8deadSopenharmony_ci    with <target> set to RENDERBUFFER_EXT and <renderbuffer> set to the
10855bd8deadSopenharmony_ci    unused name.  If <renderbuffer> is not zero, then the resulting
10865bd8deadSopenharmony_ci    renderbuffer object is a new state vector, initialized with a
10875bd8deadSopenharmony_ci    zero-sized memory buffer, and comprising the state values listed in
10885bd8deadSopenharmony_ci    Table 8.nnn.  Any previous binding to <target> is broken.
10895bd8deadSopenharmony_ci
10905bd8deadSopenharmony_ci    BindRenderbufferEXT may also be used to bind an existing
10915bd8deadSopenharmony_ci    renderbuffer object.  If the bind is successful, no change is made
10925bd8deadSopenharmony_ci    to the state of the newly bound renderbuffer object, and any
10935bd8deadSopenharmony_ci    previous binding to <target> is broken.
10945bd8deadSopenharmony_ci
10955bd8deadSopenharmony_ci    While a renderbuffer object is bound, GL operations on the target to
10965bd8deadSopenharmony_ci    which it is bound affect the bound renderbuffer object, and queries
10975bd8deadSopenharmony_ci    of the target to which a renderbuffer object is bound return state
10985bd8deadSopenharmony_ci    from the bound object.
10995bd8deadSopenharmony_ci
11005bd8deadSopenharmony_ci    The name zero is reserved.  A renderbuffer object cannot be created
11015bd8deadSopenharmony_ci    with the name zero.  If <renderbuffer> is zero, then any previous
11025bd8deadSopenharmony_ci    binding to <target> is broken and the <target> binding is restored
11035bd8deadSopenharmony_ci    to the initial state.
11045bd8deadSopenharmony_ci
11055bd8deadSopenharmony_ci    In the initial state, the reserved name zero is bound to
11065bd8deadSopenharmony_ci    RENDERBUFFER_EXT.  There is no renderbuffer object corresponding to
11075bd8deadSopenharmony_ci    the name zero, so client attempts to modify or query renderbuffer
11085bd8deadSopenharmony_ci    state for the target RENDERBUFFER_EXT while zero is bound will
11095bd8deadSopenharmony_ci    generate GL errors, as described in section 6.1.3.
11105bd8deadSopenharmony_ci
11115bd8deadSopenharmony_ci    Using GetIntegerv, the current RENDERBUFFER_EXT binding can be
11125bd8deadSopenharmony_ci    queried as RENDERBUFFER_BINDING_EXT.
11135bd8deadSopenharmony_ci
11145bd8deadSopenharmony_ci    Renderbuffer objects are deleted by calling
11155bd8deadSopenharmony_ci
11165bd8deadSopenharmony_ci        void DeleteRenderbuffersEXT( sizei n, const uint *renderbuffers );
11175bd8deadSopenharmony_ci
11185bd8deadSopenharmony_ci    where <renderbuffers> contains n names of renderbuffer objects to be
11195bd8deadSopenharmony_ci    deleted.  After a renderbuffer object is deleted, it has no
11205bd8deadSopenharmony_ci    contents, and its name is again unused.  If a renderbuffer that is
11215bd8deadSopenharmony_ci    currently bound to RENDERBUFFER_EXT is deleted, it is as though
11225bd8deadSopenharmony_ci    BindRenderbufferEXT had been executed with the <target>
11235bd8deadSopenharmony_ci    RENDERBUFFER_EXT and <name> of zero.  Additionally, special care
11245bd8deadSopenharmony_ci    must be taken when deleting a renderbuffer if the image of the
11255bd8deadSopenharmony_ci    renderbuffer is attached to a framebuffer object.  (See section
11265bd8deadSopenharmony_ci    4.4.2.2 for details).  Unused names in <renderbuffers> are silently
11275bd8deadSopenharmony_ci    ignored, as is the value zero.
11285bd8deadSopenharmony_ci
11295bd8deadSopenharmony_ci    The command
11305bd8deadSopenharmony_ci
11315bd8deadSopenharmony_ci        void GenRenderbuffersEXT( sizei n, uint *renderbuffers );
11325bd8deadSopenharmony_ci
11335bd8deadSopenharmony_ci    returns <n> previously unused renderbuffer object names in
11345bd8deadSopenharmony_ci    <renderbuffers>.  These names are marked as used, for the purposes
11355bd8deadSopenharmony_ci    of GenRenderbuffersEXT only, but they acquire renderbuffer state
11365bd8deadSopenharmony_ci    only when they are first bound, just as if they were unused.
11375bd8deadSopenharmony_ci
11385bd8deadSopenharmony_ci    The command
11395bd8deadSopenharmony_ci
11405bd8deadSopenharmony_ci        void RenderbufferStorageEXT(enum target, enum internalformat,
11415bd8deadSopenharmony_ci                                    sizei width, sizei height);
11425bd8deadSopenharmony_ci
11435bd8deadSopenharmony_ci    establishes the data storage, format, and dimensions of a
11445bd8deadSopenharmony_ci    renderbuffer object's image.  <target> must be RENDERBUFFER_EXT.
11455bd8deadSopenharmony_ci    <internalformat> must be color-renderable, depth-renderable, or
11465bd8deadSopenharmony_ci    stencil-renderable (as defined in section 4.4.4).  <width> and
11475bd8deadSopenharmony_ci    <height> are the dimensions in pixels of the renderbuffer.  If
11485bd8deadSopenharmony_ci    either <width> or <height> is greater than
11495bd8deadSopenharmony_ci    MAX_RENDERBUFFER_SIZE_EXT, the the error INVALID_VALUE is generated.
11505bd8deadSopenharmony_ci    If the GL is unable to create a data store of the requested size,
11515bd8deadSopenharmony_ci    the error OUT_OF_MEMORY is generated. RenderbufferStorageEXT deletes
11525bd8deadSopenharmony_ci    any existing data store for the renderbuffer and the contents of the
11535bd8deadSopenharmony_ci    data store after calling RenderbufferStorageEXT are undefined.
11545bd8deadSopenharmony_ci
11555bd8deadSopenharmony_ci    Sized                 Base               S
11565bd8deadSopenharmony_ci    Internal Format       Internal format    Bits
11575bd8deadSopenharmony_ci    ---------------       ---------------    ----
11585bd8deadSopenharmony_ci    STENCIL_INDEX1_EXT    STENCIL_INDEX      1
11595bd8deadSopenharmony_ci    STENCIL_INDEX4_EXT    STENCIL_INDEX      4
11605bd8deadSopenharmony_ci    STENCIL_INDEX8_EXT    STENCIL_INDEX      8
11615bd8deadSopenharmony_ci    STENCIL_INDEX16_EXT   STENCIL_INDEX      16
11625bd8deadSopenharmony_ci    ------------------------------------------------------------------
11635bd8deadSopenharmony_ci    Table 2.nnn Desired component resolution for each sized internal
11645bd8deadSopenharmony_ci    format that can be used only with renderbuffers.
11655bd8deadSopenharmony_ci
11665bd8deadSopenharmony_ci    A GL implementation may vary its allocation of internal component
11675bd8deadSopenharmony_ci    resolution based on any RenderbufferStorage parameter (except
11685bd8deadSopenharmony_ci    target), but the allocation and chosen internal format must not be a
11695bd8deadSopenharmony_ci    function of any other state and cannot be changed once they are
11705bd8deadSopenharmony_ci    established.  The actual resolution in bits of each component of the
11715bd8deadSopenharmony_ci    allocated image can be queried with GetRenderbufferParameteriv as
11725bd8deadSopenharmony_ci    described in section 6.1.3.
11735bd8deadSopenharmony_ci
11745bd8deadSopenharmony_ci    4.4.2.2 Attaching Renderbuffer Images to a Framebuffer
11755bd8deadSopenharmony_ci
11765bd8deadSopenharmony_ci    A renderbuffer can be attached as one of the logical buffers of the
11775bd8deadSopenharmony_ci    currently bound framebuffer object by calling
11785bd8deadSopenharmony_ci
11795bd8deadSopenharmony_ci        void FramebufferRenderbufferEXT(enum target,
11805bd8deadSopenharmony_ci                                        enum attachment,
11815bd8deadSopenharmony_ci                                        enum renderbuffertarget,
11825bd8deadSopenharmony_ci                                        uint renderbuffer);
11835bd8deadSopenharmony_ci
11845bd8deadSopenharmony_ci    <target> must be FRAMEBUFFER_EXT.  INVALID_OPERATION is generated if
11855bd8deadSopenharmony_ci    the current value of FRAMEBUFFER_BINDING_EXT is zero when
11865bd8deadSopenharmony_ci    FramebufferRenderbufferEXT is called.  <attachment> should be set to
11875bd8deadSopenharmony_ci    one of the attachment points of the framebuffer listed in table
11885bd8deadSopenharmony_ci    1.nnn.  <renderbuffertarget> must be RENDERBUFFER_EXT and
11895bd8deadSopenharmony_ci    <renderbuffer> should be set to the name of the renderbuffer object
11905bd8deadSopenharmony_ci    to be attached to the framebuffer.  <renderbuffer> must be either
11915bd8deadSopenharmony_ci    zero or the name of an existing renderbuffer object of type
11925bd8deadSopenharmony_ci    <renderbuffertarget>, otherwise INVALID_OPERATION is generated.  If
11935bd8deadSopenharmony_ci    <renderbuffer> is zero, then the value of <renderbuffertarget> is
11945bd8deadSopenharmony_ci    ignored.
11955bd8deadSopenharmony_ci
11965bd8deadSopenharmony_ci    If <renderbuffer> is not zero and if FramebufferRenderbufferEXT is
11975bd8deadSopenharmony_ci    successful, then the renderbuffer named <renderbuffer> will be used
11985bd8deadSopenharmony_ci    as the logical buffer identified by <attachment> of the framebuffer
11995bd8deadSopenharmony_ci    currently bound to <target>.  The value of
12005bd8deadSopenharmony_ci    FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT for the specified attachment
12015bd8deadSopenharmony_ci    point is set to RENDERBUFFER_EXT and the value of
12025bd8deadSopenharmony_ci    FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT is set to <renderbuffer>. All
12035bd8deadSopenharmony_ci    other state values of the attachment point specified by <attachment>
12045bd8deadSopenharmony_ci    are set to their default values listed in table 5.nnn. No change is
12055bd8deadSopenharmony_ci    made to the state of the renderbuffer object and any previous
12065bd8deadSopenharmony_ci    attachment to the <attachment> logical buffer of the framebuffer
12075bd8deadSopenharmony_ci    object bound to framebuffer <target> is broken.  If, on the other
12085bd8deadSopenharmony_ci    hand, the attachment is not successful, then no change is made to
12095bd8deadSopenharmony_ci    the state of either the renderbuffer object or the framebuffer
12105bd8deadSopenharmony_ci    object.
12115bd8deadSopenharmony_ci
12125bd8deadSopenharmony_ci    Calling FramebufferRenderbufferEXT with the <renderbuffer> name zero
12135bd8deadSopenharmony_ci    will detach the image, if any, identified by <attachment>, in the
12145bd8deadSopenharmony_ci    framebuffer currently bound to <target>.  All state values of the
12155bd8deadSopenharmony_ci    attachment point specified by <attachment> in the object bound to
12165bd8deadSopenharmony_ci    <target> are set to their default values listed in table 5.nnn.
12175bd8deadSopenharmony_ci
12185bd8deadSopenharmony_ci    If a renderbuffer object is deleted while its image is attached to
12195bd8deadSopenharmony_ci    one or more attachment points in the currently bound framebuffer,
12205bd8deadSopenharmony_ci    then it is as if FramebufferRenderbufferEXT() had been called, with
12215bd8deadSopenharmony_ci    a <renderbuffer> of 0, for each attachment point to which this image
12225bd8deadSopenharmony_ci    was attached in the currently bound framebuffer.  In other words,
12235bd8deadSopenharmony_ci    this renderbuffer image is first detached from all attachment points
12245bd8deadSopenharmony_ci    in the currently bound framebuffer.  Note that the renderbuffer
12255bd8deadSopenharmony_ci    image is specifically *not* detached from any non-bound
12265bd8deadSopenharmony_ci    framebuffers.  Detaching the image from any non-bound framebuffers
12275bd8deadSopenharmony_ci    is the responsibility of the application.
12285bd8deadSopenharmony_ci
12295bd8deadSopenharmony_ci        Name of attachment
12305bd8deadSopenharmony_ci        --------------------------------------------------------------------------------------
12315bd8deadSopenharmony_ci        COLOR_ATTACHMENT0_EXT ... COLOR_ATTACHMENTn_EXT (where n is from 0 to MAX_COLOR_ATTACHMENTS_EXT-1)
12325bd8deadSopenharmony_ci        DEPTH_ATTACHMENT_EXT
12335bd8deadSopenharmony_ci        STENCIL_ATTACHMENT_EXT
12345bd8deadSopenharmony_ci        --------------------------------------------------------------------------------------
12355bd8deadSopenharmony_ci        Table 1.nnn:  "List of framebuffer attachment points"
12365bd8deadSopenharmony_ci
12375bd8deadSopenharmony_ci    4.4.2.3 Attaching Texture Images to a Framebuffer
12385bd8deadSopenharmony_ci
12395bd8deadSopenharmony_ci    GL supports copying the rendered contents of the framebuffer into
12405bd8deadSopenharmony_ci    the images of a texture object through the use of the routines
12415bd8deadSopenharmony_ci    CopyTexImage{1D|2D}, and CopyTexSubImage{1D|2D|3D}.  Additionally,
12425bd8deadSopenharmony_ci    GL supports rendering directly into the images of a texture object.
12435bd8deadSopenharmony_ci
12445bd8deadSopenharmony_ci    To render directly into a texture image, a specified image from a
12455bd8deadSopenharmony_ci    texture object can be attached as one of the logical buffers of the
12465bd8deadSopenharmony_ci    currently bound framebuffer object by calling one of the following
12475bd8deadSopenharmony_ci    routines, depending on the type of the texture:
12485bd8deadSopenharmony_ci
12495bd8deadSopenharmony_ci        void FramebufferTexture1DEXT(enum target, enum attachment,
12505bd8deadSopenharmony_ci                                     enum textarget, uint texture,
12515bd8deadSopenharmony_ci                                     int level);
12525bd8deadSopenharmony_ci        void FramebufferTexture2DEXT(enum target, enum attachment,
12535bd8deadSopenharmony_ci                                     enum textarget, uint texture,
12545bd8deadSopenharmony_ci                                     int level);
12555bd8deadSopenharmony_ci        void FramebufferTexture3DEXT(enum target, enum attachment,
12565bd8deadSopenharmony_ci                                     enum textarget, uint texture,
12575bd8deadSopenharmony_ci                                     int level, int zoffset);
12585bd8deadSopenharmony_ci
12595bd8deadSopenharmony_ci    In all three routines, <target> must be FRAMEBUFFER_EXT.
12605bd8deadSopenharmony_ci    INVALID_OPERATION is generated if the current value of
12615bd8deadSopenharmony_ci    FRAMEBUFFER_BINDING_EXT is zero when FramebufferTexture{1D|2D|3D}EXT
12625bd8deadSopenharmony_ci    is called.  <attachment> must be one of the attachment points of the
12635bd8deadSopenharmony_ci    framebuffer listed in table 1.nnn.
12645bd8deadSopenharmony_ci
12655bd8deadSopenharmony_ci    In all three routines, if <texture> is zero, then <textarget>,
12665bd8deadSopenharmony_ci    <level>, and <zoffset> are ignored.  If <texture> is not zero, then
12675bd8deadSopenharmony_ci    <texture> must either name an existing texture object with a target
12685bd8deadSopenharmony_ci    of <textarget>, or <texture> must name an existing cube map texture
12695bd8deadSopenharmony_ci    and <textarget> must be one of: TEXTURE_CUBE_MAP_POSITIVE_X,
12705bd8deadSopenharmony_ci    TEXTURE_CUBE_MAP_POSITIVE_Y, TEXTURE_CUBE_MAP_POSITIVE_Z,
12715bd8deadSopenharmony_ci    TEXTURE_CUBE_MAP_NEGATIVE_X, TEXTURE_CUBE_MAP_NEGATIVE_Y, or
12725bd8deadSopenharmony_ci    TEXTURE_CUBE_MAP_NEGATIVE_Z.  Otherwise, GL_INVALID_OPERATION is
12735bd8deadSopenharmony_ci    generated.
12745bd8deadSopenharmony_ci
12755bd8deadSopenharmony_ci    <level> specifies the mipmap level of the texture image to be
12765bd8deadSopenharmony_ci    attached to the framebuffer.
12775bd8deadSopenharmony_ci
12785bd8deadSopenharmony_ci    If <textarget> is TEXTURE_RECTANGLE_ARB, then <level> must be zero.
12795bd8deadSopenharmony_ci    If <textarget> is TEXTURE_3D, then <level> must be greater than or
12805bd8deadSopenharmony_ci    equal to zero and less than or equal to log base 2 of
12815bd8deadSopenharmony_ci    MAX_3D_TEXTURE_SIZE.  If <textarget> is one of
12825bd8deadSopenharmony_ci    TEXTURE_CUBE_MAP_POSITIVE_X, TEXTURE_CUBE_MAP_POSITIVE_Y,
12835bd8deadSopenharmony_ci    TEXTURE_CUBE_MAP_POSITIVE_Z, TEXTURE_CUBE_MAP_NEGATIVE_X,
12845bd8deadSopenharmony_ci    TEXTURE_CUBE_MAP_NEGATIVE_Y, or TEXTURE_CUBE_MAP_NEGATIVE_Z, then
12855bd8deadSopenharmony_ci    <level> must be greater than or equal to zero and less than or equal
12865bd8deadSopenharmony_ci    to log base 2 of MAX_CUBE_MAP_TEXTURE_SIZE. For all other values of
12875bd8deadSopenharmony_ci    <textarget>, <level> must be greater than or equal to zero and no
12885bd8deadSopenharmony_ci    larger than log base 2 of MAX_TEXTURE_SIZE.  Otherwise,
12895bd8deadSopenharmony_ci    INVALID_VALUE is generated.
12905bd8deadSopenharmony_ci
12915bd8deadSopenharmony_ci    <zoffset> specifies the z-offset of a 2-dimensional image within a
12925bd8deadSopenharmony_ci    3-dimensional texture.  INVALID_VALUE is generated if <zoffset> is
12935bd8deadSopenharmony_ci    larger than MAX_3D_TEXTURE_SIZE-1.
12945bd8deadSopenharmony_ci
12955bd8deadSopenharmony_ci    For FramebufferTexture1DEXT, if <texture> is not zero, then
12965bd8deadSopenharmony_ci    <textarget> must be TEXTURE_1D.
12975bd8deadSopenharmony_ci
12985bd8deadSopenharmony_ci    For FramebufferTexture2DEXT, if <texture> is not zero, then
12995bd8deadSopenharmony_ci    <textarget> must be one of: TEXTURE_2D, TEXTURE_RECTANGLE_ARB,
13005bd8deadSopenharmony_ci    TEXTURE_CUBE_MAP_POSITIVE_X, TEXTURE_CUBE_MAP_POSITIVE_Y,
13015bd8deadSopenharmony_ci    TEXTURE_CUBE_MAP_POSITIVE_Z, TEXTURE_CUBE_MAP_NEGATIVE_X,
13025bd8deadSopenharmony_ci    TEXTURE_CUBE_MAP_NEGATIVE_Y, or TEXTURE_CUBE_MAP_NEGATIVE_Z.
13035bd8deadSopenharmony_ci
13045bd8deadSopenharmony_ci    For FramebufferTexture3DEXT, if <texture> is not zero, then
13055bd8deadSopenharmony_ci    <textarget> must be TEXTURE_3D.
13065bd8deadSopenharmony_ci
13075bd8deadSopenharmony_ci    If <texture> is not zero, and if FramebufferTexture{1D|2D|3D}EXT is
13085bd8deadSopenharmony_ci    successful, then the specified texture image will be used as the
13095bd8deadSopenharmony_ci    logical buffer identified by <attachment> of the framebuffer
13105bd8deadSopenharmony_ci    currently bound to <target>.  The value of
13115bd8deadSopenharmony_ci    FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT for the specified attachment
13125bd8deadSopenharmony_ci    point is set to TEXTURE and the value of
13135bd8deadSopenharmony_ci    FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT is set to <texture>.
13145bd8deadSopenharmony_ci    Additionally, the value of FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL for
13155bd8deadSopenharmony_ci    the named attachment point is set to <level>.  If <texture> is a
13165bd8deadSopenharmony_ci    cubemap texture then, the value of
13175bd8deadSopenharmony_ci    FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE the named attachment
13185bd8deadSopenharmony_ci    point is set to <textarget>.  If <texture> is a 3D texture, then the
13195bd8deadSopenharmony_ci    value of FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET for the named
13205bd8deadSopenharmony_ci    attachment point is set to <zoffset>.  All other state values of the
13215bd8deadSopenharmony_ci    attachment point specified by <attachment> are set to their default
13225bd8deadSopenharmony_ci    values listed in table 5.nnn.  No change is made to the state of the
13235bd8deadSopenharmony_ci    texture object, and any previous attachment to the <attachment>
13245bd8deadSopenharmony_ci    logical buffer of the framebuffer object bound to framebuffer
13255bd8deadSopenharmony_ci    <target> is broken.  If, on the other hand, the attachment is not
13265bd8deadSopenharmony_ci    successful, then no change is made to the state of either the
13275bd8deadSopenharmony_ci    texture object or the framebuffer object.
13285bd8deadSopenharmony_ci
13295bd8deadSopenharmony_ci    Calling FramebufferTexture{1D|2D|3D}EXT with <texture> name zero
13305bd8deadSopenharmony_ci    will detach the image identified by <attachment>, if any, in the
13315bd8deadSopenharmony_ci    framebuffer currently bound to <target>.  All state values of the
13325bd8deadSopenharmony_ci    attachment point specified by <attachment> are set to their default
13335bd8deadSopenharmony_ci    values listed in table 5.nnn.
13345bd8deadSopenharmony_ci
13355bd8deadSopenharmony_ci    If a texture object is deleted while its image is attached to one or
13365bd8deadSopenharmony_ci    more attachment points in the currently bound framebuffer, then it
13375bd8deadSopenharmony_ci    is as if FramebufferTexture{1D|2D|3D}EXT() had been called, with a
13385bd8deadSopenharmony_ci    <texture> of 0, for each attachment point to which this image was
13395bd8deadSopenharmony_ci    attached in the currently bound framebuffer.  In other words, this
13405bd8deadSopenharmony_ci    texture image is first detached from all attachment points in the
13415bd8deadSopenharmony_ci    currently bound framebuffer.  Note that the texture image is
13425bd8deadSopenharmony_ci    specifically *not* detached from any other framebuffer objects.
13435bd8deadSopenharmony_ci    Detaching the texture image from any other framebuffer objects is
13445bd8deadSopenharmony_ci    the responsibility of the application.
13455bd8deadSopenharmony_ci
13465bd8deadSopenharmony_ci    4.4.3  Rendering When an Image of a Bound Texture Object is Also
13475bd8deadSopenharmony_ci    Attached to the Framebuffer
13485bd8deadSopenharmony_ci
13495bd8deadSopenharmony_ci    Special precautions need to be taken to avoid attaching a texture
13505bd8deadSopenharmony_ci    image to the currently bound framebuffer while the texture object is
13515bd8deadSopenharmony_ci    currently bound and enabled for texturing.  Doing so could lead to
13525bd8deadSopenharmony_ci    the creation of a "feedback loop" between the writing of pixels by
13535bd8deadSopenharmony_ci    the GL's rendering operations and the simultaneous reading of those
13545bd8deadSopenharmony_ci    same pixels when used as texels in the currently bound texture.  In
13555bd8deadSopenharmony_ci    this scenario, the framebuffer will be considered framebuffer
13565bd8deadSopenharmony_ci    complete (see section 4.4.4), but the values of fragments rendered
13575bd8deadSopenharmony_ci    while in this state will be undefined.  The values of texture
13585bd8deadSopenharmony_ci    samples may be undefined as well, as described in section 3.8.8.
13595bd8deadSopenharmony_ci
13605bd8deadSopenharmony_ci    Specifically, the values of rendered fragments are undefined if all
13615bd8deadSopenharmony_ci    of the following conditions are true:
13625bd8deadSopenharmony_ci
13635bd8deadSopenharmony_ci        - an image from texture object <T> is attached to the currently
13645bd8deadSopenharmony_ci          bound framebuffer at attachment point <A>, and
13655bd8deadSopenharmony_ci
13665bd8deadSopenharmony_ci        - the texture object <T> is currently bound to a texture unit
13675bd8deadSopenharmony_ci          <U>, and
13685bd8deadSopenharmony_ci
13695bd8deadSopenharmony_ci        - the current fixed-function texture state or programmable
13705bd8deadSopenharmony_ci          vertex and/or fragment processing state makes it possible(*)
13715bd8deadSopenharmony_ci          to sample from the texture object <T> bound to texture unit
13725bd8deadSopenharmony_ci          <U>
13735bd8deadSopenharmony_ci
13745bd8deadSopenharmony_ci    while either of the following conditions are true:
13755bd8deadSopenharmony_ci
13765bd8deadSopenharmony_ci        - the value of TEXTURE MIN FILTER for texture object <T> is
13775bd8deadSopenharmony_ci          NEAREST or LINEAR, and the value of
13785bd8deadSopenharmony_ci          FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT for attachment point
13795bd8deadSopenharmony_ci          <A> is equal to the value of TEXTURE_BASE_LEVEL for the
13805bd8deadSopenharmony_ci          texture object <T>, or
13815bd8deadSopenharmony_ci
13825bd8deadSopenharmony_ci        - the value of TEXTURE_MIN_FILTER for texture object <T> is one
13835bd8deadSopenharmony_ci          of NEAREST_MIPMAP_NEAREST, NEAREST_MIPMAP LINEAR, LINEAR
13845bd8deadSopenharmony_ci          MIPMAP_NEAREST, or LINEAR_MIPMAP_LINEAR, and the value of
13855bd8deadSopenharmony_ci          FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT for attachment point
13865bd8deadSopenharmony_ci          <A> is within the the range specified by the current values of
13875bd8deadSopenharmony_ci          TEXTURE_BASE_LEVEL to q, inclusive, for the texture object
13885bd8deadSopenharmony_ci          <T>.  (q is defined in the Mipmapping discussion of section
13895bd8deadSopenharmony_ci          3.8.8),
13905bd8deadSopenharmony_ci
13915bd8deadSopenharmony_ci    (*) For the purpose of this discussion, we consider it "possible"
13925bd8deadSopenharmony_ci        to sample from the texture object <T>  bound to texture unit <U>"
13935bd8deadSopenharmony_ci        if any of the following are true:
13945bd8deadSopenharmony_ci
13955bd8deadSopenharmony_ci        - programmable vertex and fragment processing is disabled
13965bd8deadSopenharmony_ci          and the target of texture object <T> is enabled according
13975bd8deadSopenharmony_ci          to the texture target precedence rules of section 3.8.15,
13985bd8deadSopenharmony_ci          or
13995bd8deadSopenharmony_ci        - if FRAGMENT_PROGRAM_ARB is enabled and the currently bound
14005bd8deadSopenharmony_ci          fragment program contains any instructions that
14015bd8deadSopenharmony_ci          sample from the texture object <T> bound to <U>,
14025bd8deadSopenharmony_ci          or
14035bd8deadSopenharmony_ci        - if the active fragment or vertex shader contains
14045bd8deadSopenharmony_ci          any instructions that might sample from the texture object <T> bound
14055bd8deadSopenharmony_ci          to <U> if even those instructions might only be executed
14065bd8deadSopenharmony_ci          conditionally.
14075bd8deadSopenharmony_ci
14085bd8deadSopenharmony_ci    Note that if TEXTURE_BASE_LEVEL and TEXTURE_MAX_LEVEL exclude any
14095bd8deadSopenharmony_ci    levels containing image(s) attached to the currently bound
14105bd8deadSopenharmony_ci    framebuffer, then the above conditions will not be met, (i.e., the
14115bd8deadSopenharmony_ci    above rule will not cause the values of rendered fragments to be
14125bd8deadSopenharmony_ci    undefined.)
14135bd8deadSopenharmony_ci
14145bd8deadSopenharmony_ci    4.4.4 Framebuffer Completeness
14155bd8deadSopenharmony_ci
14165bd8deadSopenharmony_ci    A framebuffer object is said to be "framebuffer complete" if all of
14175bd8deadSopenharmony_ci    its attached images, and all framebuffer parameters required to
14185bd8deadSopenharmony_ci    utilize the framebuffer for rendering and reading, are consistently
14195bd8deadSopenharmony_ci    defined and meet the requirements defined below.  The rules of
14205bd8deadSopenharmony_ci    framebuffer completeness are dependent on the properties of the
14215bd8deadSopenharmony_ci    attached images, and on certain implementation dependent
14225bd8deadSopenharmony_ci    restrictions.  A framebuffer must be complete to effectively be used
14235bd8deadSopenharmony_ci    as the destination for GL framebuffer rendering operations and the
14245bd8deadSopenharmony_ci    source for GL framebuffer read operations.
14255bd8deadSopenharmony_ci
14265bd8deadSopenharmony_ci    The internal formats of the attached images can affect the
14275bd8deadSopenharmony_ci    completeness of the framebuffer, so it is useful to first define the
14285bd8deadSopenharmony_ci    relationship between the internal format of an image and the
14295bd8deadSopenharmony_ci    attachment points to which it can be attached.
14305bd8deadSopenharmony_ci
14315bd8deadSopenharmony_ci        * The following base internal formats from table 3.15 are
14325bd8deadSopenharmony_ci          "color-renderable": RGB, RGBA, FLOAT_R_NV, FLOAT_RG_NV,
14335bd8deadSopenharmony_ci          FLOAT_RGB_NV, and FLOAT_RGBA_NV.  The sized internal formats
14345bd8deadSopenharmony_ci          from table 3.16 that have a color-renderable base internal
14355bd8deadSopenharmony_ci          format are also color-renderable.  No other formats, including
14365bd8deadSopenharmony_ci          compressed internal formats, are color-renderable.
14375bd8deadSopenharmony_ci
14385bd8deadSopenharmony_ci        * An internal format is "depth-renderable" if it is
14395bd8deadSopenharmony_ci          DEPTH_COMPONENT, or if it is one of the sized internal formats
14405bd8deadSopenharmony_ci          from table 3.16 that has a depth-renderable base internal
14415bd8deadSopenharmony_ci          format.  No other formats are depth-renderable.
14425bd8deadSopenharmony_ci
14435bd8deadSopenharmony_ci        * An internal format is "stencil-renderable" if it is
14445bd8deadSopenharmony_ci          STENCIL_INDEX, or if it is one of the sized internal formats
14455bd8deadSopenharmony_ci          from table 2.nnn that has a stencil-renderable base internal
14465bd8deadSopenharmony_ci          format.  No other formats are stencil-renderable.
14475bd8deadSopenharmony_ci
14485bd8deadSopenharmony_ci    4.4.4.1 Framebuffer Attachment Completeness
14495bd8deadSopenharmony_ci
14505bd8deadSopenharmony_ci    If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT for the
14515bd8deadSopenharmony_ci    framebuffer attachment point <attachment> is not NONE, then it is
14525bd8deadSopenharmony_ci    said that a framebuffer-attachable image, named <image>, is attached
14535bd8deadSopenharmony_ci    to the framebuffer at the attachment point.  <image> is identified
14545bd8deadSopenharmony_ci    by the state in <attachment> as described in section 4.4.2.
14555bd8deadSopenharmony_ci
14565bd8deadSopenharmony_ci    The framebuffer attachment point <attachment> is said to be
14575bd8deadSopenharmony_ci    "framebuffer attachment complete" if the value of
14585bd8deadSopenharmony_ci    FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT for <attachment> is NONE
14595bd8deadSopenharmony_ci    (i.e., no image is attached), or if all of the following conditions
14605bd8deadSopenharmony_ci    are true:
14615bd8deadSopenharmony_ci
14625bd8deadSopenharmony_ci      * <image> is a component of an existing object with the name
14635bd8deadSopenharmony_ci        specified by FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT, and of the
14645bd8deadSopenharmony_ci        type specified by FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT.
14655bd8deadSopenharmony_ci
14665bd8deadSopenharmony_ci      * The width and height of <image> must be non-zero.
14675bd8deadSopenharmony_ci
14685bd8deadSopenharmony_ci      * If FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT is TEXTURE and
14695bd8deadSopenharmony_ci        FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT names a 3-dimensional
14705bd8deadSopenharmony_ci        texture, then FRAMEBUFFER_ATTACHMENT_TEXTURE_ZOFFSET_EXT must be
14715bd8deadSopenharmony_ci        smaller than the depth of the texture.
14725bd8deadSopenharmony_ci
14735bd8deadSopenharmony_ci      * If <attachment> is one of COLOR_ATTACHMENT0_EXT through
14745bd8deadSopenharmony_ci        COLOR_ATTACHMENTn_EXT, then <image> must have a color-renderable
14755bd8deadSopenharmony_ci        internal format.
14765bd8deadSopenharmony_ci
14775bd8deadSopenharmony_ci      * If <attachment> is DEPTH_ATTACHMENT_EXT, then <image> must have
14785bd8deadSopenharmony_ci        a depth-renderable internal format.
14795bd8deadSopenharmony_ci
14805bd8deadSopenharmony_ci      * If <attachment> is STENCIL_ATTACHMENT_EXT, then <image> must
14815bd8deadSopenharmony_ci        have a stencil-renderable internal format.
14825bd8deadSopenharmony_ci
14835bd8deadSopenharmony_ci    4.4.4.2 Framebuffer Completeness
14845bd8deadSopenharmony_ci
14855bd8deadSopenharmony_ci    In this subsection, each rule is followed by an error enum enclosed
14865bd8deadSopenharmony_ci    in { brackets }.  Sections 4.4.4.2 and 4.4.4.3 explains the
14875bd8deadSopenharmony_ci    relevance of the error enums.
14885bd8deadSopenharmony_ci
14895bd8deadSopenharmony_ci    The framebuffer object <target> is said to be "framebuffer complete"
14905bd8deadSopenharmony_ci    if it is the window-system-provided framebuffer, or if all the
14915bd8deadSopenharmony_ci    following conditons are true:
14925bd8deadSopenharmony_ci
14935bd8deadSopenharmony_ci      * All framebuffer attachment points are "framebuffer attachment
14945bd8deadSopenharmony_ci        complete".
14955bd8deadSopenharmony_ci        { FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT }
14965bd8deadSopenharmony_ci
14975bd8deadSopenharmony_ci      * There is at least one image attached to the framebuffer.
14985bd8deadSopenharmony_ci        { FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT }
14995bd8deadSopenharmony_ci
15005bd8deadSopenharmony_ci      * All attached images have the same width and height.
15015bd8deadSopenharmony_ci        { FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT }
15025bd8deadSopenharmony_ci
15035bd8deadSopenharmony_ci      * All images attached to the attachment points
15045bd8deadSopenharmony_ci        COLOR_ATTACHMENT0_EXT through COLOR_ATTACHMENTn_EXT must have
15055bd8deadSopenharmony_ci        the same internal format.
15065bd8deadSopenharmony_ci        { FRAMEBUFFER_INCOMPLETE_FORMATS_EXT }
15075bd8deadSopenharmony_ci
15085bd8deadSopenharmony_ci      * The value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT must not be
15095bd8deadSopenharmony_ci        NONE for any color attachment point(s) named by DRAW_BUFFERi.
15105bd8deadSopenharmony_ci        { FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT }
15115bd8deadSopenharmony_ci
15125bd8deadSopenharmony_ci      * If READ_BUFFER is not NONE, then the value of
15135bd8deadSopenharmony_ci        FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT must not be NONE for the
15145bd8deadSopenharmony_ci        color attachment point named by READ_BUFFER.
15155bd8deadSopenharmony_ci        { FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT }
15165bd8deadSopenharmony_ci
15175bd8deadSopenharmony_ci      * The combination of internal formats of the attached
15185bd8deadSopenharmony_ci        images does not violate an implementation-dependent set of
15195bd8deadSopenharmony_ci        restrictions.
15205bd8deadSopenharmony_ci        { FRAMEBUFFER_UNSUPPORTED_EXT }
15215bd8deadSopenharmony_ci
15225bd8deadSopenharmony_ci    The enum in { brackets } after each clause of the framebuffer
15235bd8deadSopenharmony_ci    completeness rules specifies the return value of
15245bd8deadSopenharmony_ci    CheckFramebufferStatusEXT (see below) that is generated when that
15255bd8deadSopenharmony_ci    clause is violated.  If more than one clause is violated, it is
15265bd8deadSopenharmony_ci    implementation-dependent exactly which enum will be returned by
15275bd8deadSopenharmony_ci    CheckFramebufferStatusEXT.
15285bd8deadSopenharmony_ci
15295bd8deadSopenharmony_ci    Performing any of the following actions may change whether the
15305bd8deadSopenharmony_ci    framebuffer is considered complete or incomplete.
15315bd8deadSopenharmony_ci
15325bd8deadSopenharmony_ci      - Binding to a different framebuffer with BindFramebufferEXT.
15335bd8deadSopenharmony_ci
15345bd8deadSopenharmony_ci      - Attaching an image to the framebuffer with
15355bd8deadSopenharmony_ci        FramebufferTexture{1D|2D|3D}EXT or FramebufferRenderbufferEXT.
15365bd8deadSopenharmony_ci
15375bd8deadSopenharmony_ci      - Detaching an image from the framebuffer with
15385bd8deadSopenharmony_ci        FramebufferTexture{1D|2D|3D}EXT or FramebufferRenderbufferEXT.
15395bd8deadSopenharmony_ci
15405bd8deadSopenharmony_ci      - Changing the width, height, or internal format of a texture
15415bd8deadSopenharmony_ci        image that is attached to the framebuffer by calling
15425bd8deadSopenharmony_ci        {Copy|Compressed}TexImage{1D|2D|3D}.
15435bd8deadSopenharmony_ci
15445bd8deadSopenharmony_ci      - Changing the width, height, or internal format of a renderbuffer
15455bd8deadSopenharmony_ci        that is attached to the framebuffer by calling
15465bd8deadSopenharmony_ci        RenderbufferStorageEXT.
15475bd8deadSopenharmony_ci
15485bd8deadSopenharmony_ci      - Deleting, with DeleteTextures or DeleteRenderbuffers, an object
15495bd8deadSopenharmony_ci        containing an image that is attached to a framebuffer object
15505bd8deadSopenharmony_ci        that is bound to the framebuffer.
15515bd8deadSopenharmony_ci
15525bd8deadSopenharmony_ci      - Changing READ_BUFFER or one of the DRAW_BUFFERS.
15535bd8deadSopenharmony_ci
15545bd8deadSopenharmony_ci    Although GL defines a wide variety of internal formats for
15555bd8deadSopenharmony_ci    framebuffer-attachable images, such as texture images and
15565bd8deadSopenharmony_ci    renderbuffer images, some implementations may not support rendering
15575bd8deadSopenharmony_ci    to particular combinations of internal formats.  If the combination
15585bd8deadSopenharmony_ci    of formats of the images attached to a framebuffer object are not
15595bd8deadSopenharmony_ci    supported by the implementation, then the framebuffer is not
15605bd8deadSopenharmony_ci    complete under the clause labeled FRAMEBUFFER_UNSUPPORTED_EXT. There
15615bd8deadSopenharmony_ci    must exist, however, at least one combination of internal formats
15625bd8deadSopenharmony_ci    for which the framebuffer cannot be FRAMEBUFFER_UNSUPPORTED_EXT.
15635bd8deadSopenharmony_ci
15645bd8deadSopenharmony_ci    Because of the "implementation-dependent" clause of the framebuffer
15655bd8deadSopenharmony_ci    completeness test in particular, and because framebuffer
15665bd8deadSopenharmony_ci    completeness can change when the set of attached images is modified,
15675bd8deadSopenharmony_ci    it is strongly advised, though is not required, that an application
15685bd8deadSopenharmony_ci    check to see if the framebuffer is complete prior to rendering.  The
15695bd8deadSopenharmony_ci    status of the framebuffer object currently bound to <target> can be
15705bd8deadSopenharmony_ci    queried by calling
15715bd8deadSopenharmony_ci
15725bd8deadSopenharmony_ci        enum CheckFramebufferStatusEXT(enum target);
15735bd8deadSopenharmony_ci
15745bd8deadSopenharmony_ci    If <target> is not FRAMEBUFFER_EXT, INVALID_ENUM is generated. If
15755bd8deadSopenharmony_ci    CheckFramebufferStatusEXT is called within a Begin/End pair,
15765bd8deadSopenharmony_ci    INVALID_OPERATION is generated.  If CheckFramebufferStatusEXT
15775bd8deadSopenharmony_ci    generates an error, 0 is returned.
15785bd8deadSopenharmony_ci
15795bd8deadSopenharmony_ci    Otherwise, an enum is returned that identifies whether
15805bd8deadSopenharmony_ci    or not the framebuffer bound to <target> is complete, and if not
15815bd8deadSopenharmony_ci    complete the enum identifies one of the rules of framebuffer
15825bd8deadSopenharmony_ci    completeness that is violated.  If the framebuffer is complete, then
15835bd8deadSopenharmony_ci    FRAMEBUFFER_COMPLETE_EXT is returned.
15845bd8deadSopenharmony_ci
15855bd8deadSopenharmony_ci    4.4.4.3 Effects of Framebuffer Completeness on Framebuffer Operations
15865bd8deadSopenharmony_ci
15875bd8deadSopenharmony_ci    If the currently bound framebuffer is not framebuffer complete, then
15885bd8deadSopenharmony_ci    it is an error to attempt to use the framebuffer for writing or
15895bd8deadSopenharmony_ci    reading.  This means that rendering commands such as Begin,
15905bd8deadSopenharmony_ci    RasterPos, any command that performs an implicit Begin, as well as
15915bd8deadSopenharmony_ci    commands that read the framebuffer such as ReadPixels and
15925bd8deadSopenharmony_ci    CopyTex{Sub}Image will generate the error
15935bd8deadSopenharmony_ci    INVALID_FRAMEBUFFER_OPERATION_EXT if called while the framebuffer is
15945bd8deadSopenharmony_ci    not framebuffer complete.
15955bd8deadSopenharmony_ci
15965bd8deadSopenharmony_ci    4.4.5 Effects of Framebuffer State on Framebuffer Dependent Values
15975bd8deadSopenharmony_ci
15985bd8deadSopenharmony_ci    The values of the state variables listed in table 9.nnn (Framebuffer
15995bd8deadSopenharmony_ci    Dependent Values) may change when a change is made to
16005bd8deadSopenharmony_ci    FRAMEBUFFER_BINDING_EXT, to the state of the currently bound
16015bd8deadSopenharmony_ci    framebuffer object, or to an image attached to the currently bound
16025bd8deadSopenharmony_ci    framebuffer object.
16035bd8deadSopenharmony_ci
16045bd8deadSopenharmony_ci    When FRAMEBUFFER_BINDING_EXT is zero, the values of the state
16055bd8deadSopenharmony_ci    variables listed in table 9.nnn are implementation defined.
16065bd8deadSopenharmony_ci
16075bd8deadSopenharmony_ci    When FRAMEBUFFER_BINDING_EXT is non-zero, if the currently bound
16085bd8deadSopenharmony_ci    framebuffer object is not framebuffer complete, then the values of
16095bd8deadSopenharmony_ci    the state variables listed in table 9.nnn are undefined.
16105bd8deadSopenharmony_ci
16115bd8deadSopenharmony_ci    When FRAMEBUFFER_BINDING_EXT is non-zero and the currently bound
16125bd8deadSopenharmony_ci    framebuffer object is framebuffer complete, then the values of the
16135bd8deadSopenharmony_ci    state variables listed in table 9.nnn are completely determined by
16145bd8deadSopenharmony_ci    FRAMEBUFFER_BINDING_EXT, the state of the currently bound
16155bd8deadSopenharmony_ci    framebuffer object, and the state of the images attached to the
16165bd8deadSopenharmony_ci    currently bound framebuffer object.
16175bd8deadSopenharmony_ci
16185bd8deadSopenharmony_ciXXX [from jon leech] describe derivation of red green and blue size
16195bd8deadSopenharmony_ci
16205bd8deadSopenharmony_ci
16215bd8deadSopenharmony_ci    4.4.6 Mapping between Pixel and Element in Attached Image
16225bd8deadSopenharmony_ci
16235bd8deadSopenharmony_ci    When FRAMEBUFFER_BINDING_EXT is non-zero, an operation that writes
16245bd8deadSopenharmony_ci    to the framebuffer modifies the image attached to the selected
16255bd8deadSopenharmony_ci    logical buffer, and an operation that reads from the framebuffer
16265bd8deadSopenharmony_ci    reads from the image attached to the selected logical buffer.
16275bd8deadSopenharmony_ci
16285bd8deadSopenharmony_ci    If the attached image is a renderbuffer image, then the window
16295bd8deadSopenharmony_ci    coordinates (x[w], y[w]) corresponds to the value in the
16305bd8deadSopenharmony_ci    renderbuffer image at the same coordinates.
16315bd8deadSopenharmony_ci
16325bd8deadSopenharmony_ci    If the attached image is a texture image, then the window
16335bd8deadSopenharmony_ci    coordinates (x[w], y[w]) correspond to the texel (i, j, k), from
16345bd8deadSopenharmony_ci    figure 3.10, as follows:
16355bd8deadSopenharmony_ci
16365bd8deadSopenharmony_ci                             i = (x[w] - b)
16375bd8deadSopenharmony_ci
16385bd8deadSopenharmony_ci                             j = (y[w] - b)
16395bd8deadSopenharmony_ci
16405bd8deadSopenharmony_ci                           k = (zoffset - b)
16415bd8deadSopenharmony_ci
16425bd8deadSopenharmony_ci    where b is the texture image's border width, and zoffset is the
16435bd8deadSopenharmony_ci    value of FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET for the selected
16445bd8deadSopenharmony_ci    logical buffer.  For a two-dimensional texture, k and zoffset are
16455bd8deadSopenharmony_ci    irrelevant; for a one-dimensional texture, j, k, and zoffset are
16465bd8deadSopenharmony_ci    both irrelevant.
16475bd8deadSopenharmony_ci
16485bd8deadSopenharmony_ci    (x[w], y[w]) corresponds to a border texel if x[w] or y[w] or
16495bd8deadSopenharmony_ci    zoffset is less than the border size, or if x[w] or y[w] or zoffset
16505bd8deadSopenharmony_ci    is greater than the border size plus the width or height or depth,
16515bd8deadSopenharmony_ci    resp., of the texture image.
16525bd8deadSopenharmony_ci
16535bd8deadSopenharmony_ci    Conversion to Framebuffer-Attachable Image Components
16545bd8deadSopenharmony_ci
16555bd8deadSopenharmony_ci    When an enabled color value is written to the framebuffer while
16565bd8deadSopenharmony_ci    FRAMEBUFFER_BINDING is non-zero, for each draw buffer the R, G, B,
16575bd8deadSopenharmony_ci    and A values are converted to internal components as described in
16585bd8deadSopenharmony_ci    table 3.15, according to the table row corresponding to the internal
16595bd8deadSopenharmony_ci    format of the framebuffer-attachable image attached to the selected
16605bd8deadSopenharmony_ci    logical buffer, and the resulting internal components are written to
16615bd8deadSopenharmony_ci    the image attached to logical buffer.  The masking operations
16625bd8deadSopenharmony_ci    described in section 4.2.2 are also effective.
16635bd8deadSopenharmony_ci
16645bd8deadSopenharmony_ci    Conversion to RGBA Values
16655bd8deadSopenharmony_ci
16665bd8deadSopenharmony_ci    When a color value is read or is used as the source of a logical
16675bd8deadSopenharmony_ci    operation or blending, while FRAMEBUFFER_BINDING is non-zero, the
16685bd8deadSopenharmony_ci    components of the framebuffer-attachable image that is attached to
16695bd8deadSopenharmony_ci    the logical buffer selected by READ_BUFFER are first converted to R,
16705bd8deadSopenharmony_ci    G, B, and A values according to table 3.21 and the internal format
16715bd8deadSopenharmony_ci    of the attached image."
16725bd8deadSopenharmony_ci
16735bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 1.5 Specification (Special Functions)
16745bd8deadSopenharmony_ci
16755bd8deadSopenharmony_ci    Added to section 5.4, as part of the discussion of which commands
16765bd8deadSopenharmony_ci    are not compiled into display lists:
16775bd8deadSopenharmony_ci
16785bd8deadSopenharmony_ci    "Certain commands, when called while compiling a display list, are
16795bd8deadSopenharmony_ci    not compiled into the display list but are executed immediately.
16805bd8deadSopenharmony_ci    These are: ..., GenFramebuffersEXT, BindFramebufferEXT,
16815bd8deadSopenharmony_ci    DeleteFramebuffersEXT, CheckFramebufferStatusEXT,
16825bd8deadSopenharmony_ci    GenRenderbuffersEXT, BindRenderbufferEXT, DeleteRenderbuffersEXT,
16835bd8deadSopenharmony_ci    RenderbufferStorageEXT, FramebufferTexture1DEXT,
16845bd8deadSopenharmony_ci    FramebufferTexture2DEXT, FramebufferTexture3DEXT,
16855bd8deadSopenharmony_ci    FramebufferRenderbufferEXT, GenerateMipmapEXT..."
16865bd8deadSopenharmony_ci
16875bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 1.5 Specification (State and State
16885bd8deadSopenharmony_ciRequests)
16895bd8deadSopenharmony_ci
16905bd8deadSopenharmony_ci    Add to section 6.1.3, Enumerated Queries:
16915bd8deadSopenharmony_ci
16925bd8deadSopenharmony_ci        In the list of state query functions, add:
16935bd8deadSopenharmony_ci
16945bd8deadSopenharmony_ci        "void GetFramebufferAttachmentParameterivEXT(enum target,
16955bd8deadSopenharmony_ci                                                     enum attachment,
16965bd8deadSopenharmony_ci                                                     enum pname,
16975bd8deadSopenharmony_ci                                                     int *params);
16985bd8deadSopenharmony_ci
16995bd8deadSopenharmony_ci            <target> must be FRAMEBUFFER_EXT.  <attachment> must be one
17005bd8deadSopenharmony_ci            of the attachment points of the framebuffer listed in table
17015bd8deadSopenharmony_ci            1.nnn.  <pname> must be one of the following:
17025bd8deadSopenharmony_ci            FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT,
17035bd8deadSopenharmony_ci            FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT,
17045bd8deadSopenharmony_ci            FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT,
17055bd8deadSopenharmony_ci            FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT,
17065bd8deadSopenharmony_ci            FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT.
17075bd8deadSopenharmony_ci
17085bd8deadSopenharmony_ci            If the framebuffer currently bound to <target> is zero, then
17095bd8deadSopenharmony_ci            INVALID_OPERATION is generated.
17105bd8deadSopenharmony_ci
17115bd8deadSopenharmony_ci            Upon successful return from
17125bd8deadSopenharmony_ci            GetFramebufferAttachmentParameterivEXT, if <pname> is
17135bd8deadSopenharmony_ci            FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT, then param will
17145bd8deadSopenharmony_ci            contain one of NONE, TEXTURE, or RENDERBUFFER_EXT,
17155bd8deadSopenharmony_ci            identifying the type of object which contains the attached
17165bd8deadSopenharmony_ci            image.
17175bd8deadSopenharmony_ci
17185bd8deadSopenharmony_ci            If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT is
17195bd8deadSopenharmony_ci            RENDERBUFFER_EXT, then
17205bd8deadSopenharmony_ci
17215bd8deadSopenharmony_ci                If <pname> is FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT,
17225bd8deadSopenharmony_ci                <params> will contain the name of the renderbuffer
17235bd8deadSopenharmony_ci                object which contains the attached image.
17245bd8deadSopenharmony_ci
17255bd8deadSopenharmony_ci                Otherwise, INVALID_ENUM is generated.
17265bd8deadSopenharmony_ci
17275bd8deadSopenharmony_ci            If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT is
17285bd8deadSopenharmony_ci            TEXTURE, then
17295bd8deadSopenharmony_ci
17305bd8deadSopenharmony_ci                If <pname> is FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT,
17315bd8deadSopenharmony_ci                then <params> will contain the name of the texture
17325bd8deadSopenharmony_ci                object which contains the attached image.
17335bd8deadSopenharmony_ci
17345bd8deadSopenharmony_ci                If <pname> is FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT,
17355bd8deadSopenharmony_ci                then <params> will contain the mipmap level of the
17365bd8deadSopenharmony_ci                texture object which contains the attached image.
17375bd8deadSopenharmony_ci
17385bd8deadSopenharmony_ci                If <pname> is
17395bd8deadSopenharmony_ci                FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT and the
17405bd8deadSopenharmony_ci                texture object named
17415bd8deadSopenharmony_ci                FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT is a cube map
17425bd8deadSopenharmony_ci                texture, then <params> will contain the cube map face of
17435bd8deadSopenharmony_ci                the cubemap texture object which contains the attached
17445bd8deadSopenharmony_ci                image.  Otherwise <params> will contain the value zero.
17455bd8deadSopenharmony_ci
17465bd8deadSopenharmony_ci                If <pname> is
17475bd8deadSopenharmony_ci                FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT and the
17485bd8deadSopenharmony_ci                texture object named
17495bd8deadSopenharmony_ci                FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT is a
17505bd8deadSopenharmony_ci                3-dimensional texture, then <params> will contain the
17515bd8deadSopenharmony_ci                zoffset of the 2D image of the 3D texture object which
17525bd8deadSopenharmony_ci                contains the attached image.  Otherwise <params> will
17535bd8deadSopenharmony_ci                contain the value zero.
17545bd8deadSopenharmony_ci
17555bd8deadSopenharmony_ci                Otherwise, INVALID_ENUM is generated.
17565bd8deadSopenharmony_ci
17575bd8deadSopenharmony_ci        void GetRenderbufferParameterivEXT(enum target, enum pname,
17585bd8deadSopenharmony_ci                                           int* params);
17595bd8deadSopenharmony_ci
17605bd8deadSopenharmony_ci            <target> must be RENDERBUFFER_EXT.  <pname> must be one of
17615bd8deadSopenharmony_ci            the symbolic values in table 8.nnn.
17625bd8deadSopenharmony_ci
17635bd8deadSopenharmony_ci            If the renderbuffer currently bound to <target> is zero,
17645bd8deadSopenharmony_ci            then INVALID_OPERATION is generated.
17655bd8deadSopenharmony_ci
17665bd8deadSopenharmony_ci            Upon successful return from GetRenderbufferParameterivEXT,
17675bd8deadSopenharmony_ci            if <pname> is RENDERBUFFER_WIDTH_EXT,
17685bd8deadSopenharmony_ci            RENDERBUFFER_HEIGHT_EXT, or
17695bd8deadSopenharmony_ci            RENDERBUFFER_INTERNAL_FORMAT_EXT, then <params> will contain
17705bd8deadSopenharmony_ci            the width in pixels, height in pixels, or internal format,
17715bd8deadSopenharmony_ci            respectively, of the image of the renderbuffer currently
17725bd8deadSopenharmony_ci            bound to <target>.
17735bd8deadSopenharmony_ci
17745bd8deadSopenharmony_ci            Upon successful return from GetRenderbufferParameterivEXT,
17755bd8deadSopenharmony_ci            if <pname> is RENDERBUFFER_RED_SIZE_EXT,
17765bd8deadSopenharmony_ci            RENDERBUFFER_GREEN_SIZE_EXT, RENDERBUFFER_BLUE_SIZE_EXT,
17775bd8deadSopenharmony_ci            RENDERBUFFER_ALPHA_SIZE_EXT, RENDERBUFFER_DEPTH_SIZE_EXT, or
17785bd8deadSopenharmony_ci            RENDERBUFFER_STENCIL_SIZE_EXT, then <params> will contain
17795bd8deadSopenharmony_ci            the actual resolutions, (not the resolutions specified when
17805bd8deadSopenharmony_ci            the image array was defined), for the red, green, blue,
17815bd8deadSopenharmony_ci            alpha depth, or stencil components, respectively, of the
17825bd8deadSopenharmony_ci            image of the renderbuffer currently bound to <target>.
17835bd8deadSopenharmony_ci
17845bd8deadSopenharmony_ci            Otherwise, INVALID_ENUM is generated."
17855bd8deadSopenharmony_ci
17865bd8deadSopenharmony_ci    After section 6.1.13 and before section 6.1.14 (which should be
17875bd8deadSopenharmony_ci    renumbered 6.1.16), add two new sections:
17885bd8deadSopenharmony_ci
17895bd8deadSopenharmony_ci    6.1.14 Framebuffer Object Queries
17905bd8deadSopenharmony_ci
17915bd8deadSopenharmony_ci        The command
17925bd8deadSopenharmony_ci
17935bd8deadSopenharmony_ci            boolean IsFramebufferEXT( uint framebuffer );
17945bd8deadSopenharmony_ci
17955bd8deadSopenharmony_ci        returns TRUE if <framebuffer> is the name of a framebuffer
17965bd8deadSopenharmony_ci        object.  If <framebuffer> is zero, or if <framebuffer> is a
17975bd8deadSopenharmony_ci        non-zero value that is not the name of a framebuffer object,
17985bd8deadSopenharmony_ci        IsFramebufferEXT return FALSE.
17995bd8deadSopenharmony_ci
18005bd8deadSopenharmony_ci    6.1.15 Renderbuffer Object Queries
18015bd8deadSopenharmony_ci
18025bd8deadSopenharmony_ci        The command
18035bd8deadSopenharmony_ci
18045bd8deadSopenharmony_ci            boolean IsRenderbufferEXT( uint renderbuffer );
18055bd8deadSopenharmony_ci
18065bd8deadSopenharmony_ci        returns TRUE if <renderbuffer> is the name of a renderbuffer
18075bd8deadSopenharmony_ci        object.  If <renderbuffer> is zero, or if <renderbuffer> is a
18085bd8deadSopenharmony_ci        non-zero value that is not the name of a renderbuffer object,
18095bd8deadSopenharmony_ci        IsRenderbufferEXT return FALSE.
18105bd8deadSopenharmony_ci
18115bd8deadSopenharmony_ci
18125bd8deadSopenharmony_ciErrors
18135bd8deadSopenharmony_ci
18145bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if FRAMEBUFFER_BINDING_EXT
18155bd8deadSopenharmony_ci    is zero and DrawBuffer or DrawBuffers is called with a <buf>
18165bd8deadSopenharmony_ci    constant (other than NONE) that does not correspond to a buffer
18175bd8deadSopenharmony_ci    allocated to the GL by the window-system, including the constants
18185bd8deadSopenharmony_ci    COLOR_ATTACHMENT0_EXT through COLOR_ATTACHMENTn_EXT, where n is
18195bd8deadSopenharmony_ci    MAX_COLOR_ATTACHMENTS_EXT - 1.
18205bd8deadSopenharmony_ci
18215bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if FRAMEBUFFER_BINDING_EXT
18225bd8deadSopenharmony_ci    is non-zero and DrawBuffer, DrawBuffers, or ReadBuffer is called
18235bd8deadSopenharmony_ci    with a <buf> constant (other than NONE) that is not in the range
18245bd8deadSopenharmony_ci    COLOR_ATTACHMENT0_EXT through COLOR_ATTACHMENTn_EXT, where n is
18255bd8deadSopenharmony_ci    MAX_COLOR_ATTACHMENTS_EXT - 1.
18265bd8deadSopenharmony_ci
18275bd8deadSopenharmony_ci    The error INVALID_ENUM is generated if DrawBuffer or ReadBuffer is
18285bd8deadSopenharmony_ci    called with a <buf> constant that is not listed in table 4.4 or
18295bd8deadSopenharmony_ci    10.nnn.
18305bd8deadSopenharmony_ci
18315bd8deadSopenharmony_ci    The error INVALID_ENUM is generated if DrawBuffers is called with a
18325bd8deadSopenharmony_ci    <buf> constant that is not listed in table 10.nnn or 11.nnn.
18335bd8deadSopenharmony_ci
18345bd8deadSopenharmony_ci    The error INVALID_FRAMEBUFFER_OPERATION_EXT is generated if the
18355bd8deadSopenharmony_ci    value of FRAMEBUFFER_STATUS_EXT is not FRAMEBUFFER_COMPLETE_EXT when
18365bd8deadSopenharmony_ci    any attempts to render to or read from the framebuffer are made.
18375bd8deadSopenharmony_ci
18385bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if
18395bd8deadSopenharmony_ci    GetFramebufferAttachmentParameterivEXT is called while the value of
18405bd8deadSopenharmony_ci    FRAMEBUFFER_BINDING_EXT is zero.
18415bd8deadSopenharmony_ci
18425bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if
18435bd8deadSopenharmony_ci    FramebufferRenderbufferEXT or FramebufferTexture{1D|2D|3D}EXT is
18445bd8deadSopenharmony_ci    called  while the value of FRAMEBUFFER_BINDING_EXT is zero.
18455bd8deadSopenharmony_ci
18465bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if RenderbufferStorageEXT
18475bd8deadSopenharmony_ci    or GetRenderbufferParameterivEXT is called while the value of
18485bd8deadSopenharmony_ci    RENDERBUFFER_BINDING_EXT is zero.
18495bd8deadSopenharmony_ci
18505bd8deadSopenharmony_ci    The error INVALID_ENUM is generated if
18515bd8deadSopenharmony_ci    GetFramebufferAttachmentParameterivEXT is called with an
18525bd8deadSopenharmony_ci    <attachment> other than COLOR_ATTACHMENT0_EXT through
18535bd8deadSopenharmony_ci    COLOR_ATTACHMENTn_EXT, where n is MAX_COLOR_ATTACHMENTS_EXT - 1.
18545bd8deadSopenharmony_ci
18555bd8deadSopenharmony_ci    The error INVALID_ENUM is generated if
18565bd8deadSopenharmony_ci    GetFramebufferAttachmentParameterivEXT is called with a <pname>
18575bd8deadSopenharmony_ci    other than FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT when the type of
18585bd8deadSopenharmony_ci    the attached object at the named attachment point is
18595bd8deadSopenharmony_ci    RENDERBUFFER_EXT.
18605bd8deadSopenharmony_ci
18615bd8deadSopenharmony_ci    The error INVALID_ENUM is generated if
18625bd8deadSopenharmony_ci    GetFramebufferAttachmentParameterivEXT is called with a <pname>
18635bd8deadSopenharmony_ci    other than FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT,
18645bd8deadSopenharmony_ci    FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT,
18655bd8deadSopenharmony_ci    FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT, or
18665bd8deadSopenharmony_ci    FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT when the type of the
18675bd8deadSopenharmony_ci    attached object at the named attachment point is TEXTURE.
18685bd8deadSopenharmony_ci
18695bd8deadSopenharmony_ci    The error INVALID_ENUM is generated if GetRenderbufferParameterivEXT
18705bd8deadSopenharmony_ci    is called with a <pname> other than RENDERBUFFER_WIDTH_EXT,
18715bd8deadSopenharmony_ci    RENDERBUFFER_HEIGHT_EXT, or RENDERBUFFER_INTERNAL_FORMAT_EXT,
18725bd8deadSopenharmony_ci    GL_RENDERBUFFER_RED_SIZE, GL_RENDERBUFFER_GREEN_SIZE,
18735bd8deadSopenharmony_ci    GL_RENDERBUFFER_BLUE_SIZE, GL_RENDERBUFFER_ALPHA_SIZE,
18745bd8deadSopenharmony_ci    GL_RENDERBUFFER_DEPTH_SIZE, or GL_RENDERBUFFER_STENCIL_SIZE.
18755bd8deadSopenharmony_ci
18765bd8deadSopenharmony_ci    The error INVALID_VALUE is generated if RenderbufferStorageEXT is
18775bd8deadSopenharmony_ci    called with a <width> or <height> that is greater than
18785bd8deadSopenharmony_ci    MAX_RENDERBUFFER_SIZE_EXT.
18795bd8deadSopenharmony_ci
18805bd8deadSopenharmony_ci    The error INVALID_ENUM is generated if RenderbufferStorageEXT is
18815bd8deadSopenharmony_ci    called with an <internalformat> that is not RGB, RGBA,
18825bd8deadSopenharmony_ci    DEPTH_COMPONENT, STENCIL_INDEX, or one of the internal formats from
18835bd8deadSopenharmony_ci    table 3.16 or table 2.nnn that has a base internal format of RGB,
18845bd8deadSopenharmony_ci    RGBA, DEPTH_COMPONENT, or STENCIL_INDEX.
18855bd8deadSopenharmony_ci
18865bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if
18875bd8deadSopenharmony_ci    FramebufferRenderbufferEXT is called and <renderbuffer> is not the
18885bd8deadSopenharmony_ci    name of a renderbuffer object or zero.
18895bd8deadSopenharmony_ci
18905bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if
18915bd8deadSopenharmony_ci    FramebufferTexture{1D|2D|3D}EXT is called and <texture> is not the
18925bd8deadSopenharmony_ci    name of a texture object or zero.
18935bd8deadSopenharmony_ci
18945bd8deadSopenharmony_ci    The error INVALID_VALUE is generated if
18955bd8deadSopenharmony_ci    FramebufferTexture{1D|2D|3D}EXT is called with a <level> that is
18965bd8deadSopenharmony_ci    less than zero and <texture> is not zero.
18975bd8deadSopenharmony_ci
18985bd8deadSopenharmony_ci    The error INVALID_VALUE is generated if FramebufferTexture2DEXT is
18995bd8deadSopenharmony_ci    called with a <level> that is not zero and <textarget> is
19005bd8deadSopenharmony_ci    TEXTURE_RECTANGLE_ARB and <texture> is not zero.
19015bd8deadSopenharmony_ci
19025bd8deadSopenharmony_ci    The error INVALID_VALUE is generated if FramebufferTexture{1D|2D}EXT
19035bd8deadSopenharmony_ci    is called with a <level> that is greater than the log base 2 of
19045bd8deadSopenharmony_ci    MAX_TEXTURE_SIZE and <texture> is respectively a non-zero 1D or 2D
19055bd8deadSopenharmony_ci    texture object name.
19065bd8deadSopenharmony_ci
19075bd8deadSopenharmony_ci    The error INVALID_VALUE is generated if FramebufferTexture2DEXT
19085bd8deadSopenharmony_ci    is called with a <level> that is greater than the log base 2 of
19095bd8deadSopenharmony_ci    MAX_CUBE_MAP_TEXTURE_SIZE and <texture> is a non-zero cubemap
19105bd8deadSopenharmony_ci    texture object name.
19115bd8deadSopenharmony_ci
19125bd8deadSopenharmony_ci    The error INVALID_VALUE is generated if FramebufferTexture3DEXT is
19135bd8deadSopenharmony_ci    called with a <level> greater than the log base 2 of the
19145bd8deadSopenharmony_ci    MAX_3D_TEXTURE_SIZE and <texture> is not zero.
19155bd8deadSopenharmony_ci
19165bd8deadSopenharmony_ci    The error INVALID_VALUE is generated if FramebufferTexture3DEXT is
19175bd8deadSopenharmony_ci    called with a <zoffset> that is larger than MAX_3D_TEXTURE_SIZE-1
19185bd8deadSopenharmony_ci    and <texture> is not zero.
19195bd8deadSopenharmony_ci
19205bd8deadSopenharmony_ci    The error INVALID_ENUM is generated if CheckFramebufferStatusEXT is
19215bd8deadSopenharmony_ci    called and <target> is not FRAMEBUFFER_EXT.
19225bd8deadSopenharmony_ci
19235bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if
19245bd8deadSopenharmony_ci    CheckFramebufferStatusEXT is called within a Begin/End pair.
19255bd8deadSopenharmony_ci
19265bd8deadSopenharmony_ci    The error OUT_OF_MEMORY is generated if the GL is unable to create a
19275bd8deadSopenharmony_ci    data store of the required size when calling RenderbufferStorageEXT.
19285bd8deadSopenharmony_ci
19295bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if GenerateMipmapEXT is
19305bd8deadSopenharmony_ci    called with a <target> of TEXTURE_CUBE_MAP and the texture object
19315bd8deadSopenharmony_ci    currently bound to TEXTURE_CUBE_MAP is not "cube complete" as
19325bd8deadSopenharmony_ci    defined in section 3.8.10
19335bd8deadSopenharmony_ci
19345bd8deadSopenharmony_ciNew State
19355bd8deadSopenharmony_ci
19365bd8deadSopenharmony_ci    (add new table 3.nnn, "Framebuffer (state per framebuffer target binding point)")
19375bd8deadSopenharmony_ci
19385bd8deadSopenharmony_ci    Get Value                          Type    Get Command                Initial Value           Description             Section       Attribute
19395bd8deadSopenharmony_ci    -------------------------------    ------  -------------              --------------          --------------------    ------------  ---------
19405bd8deadSopenharmony_ci    FRAMEBUFFER_BINDING_EXT            Z       GetIntegerv                0                       name of framebuffer     4.4.1         -
19415bd8deadSopenharmony_ci                                                                                                  object bound to
19425bd8deadSopenharmony_ci                                                                                                  FRAMEBUFFER_EXT
19435bd8deadSopenharmony_ci                                                                                                  target
19445bd8deadSopenharmony_ci
19455bd8deadSopenharmony_ci    (insert new table 4.nnn, "Framebuffer (state per framebuffer object)")
19465bd8deadSopenharmony_ci
19475bd8deadSopenharmony_ci    Get Value            Type         Get Command        Initial Value  Description             Section       Attribute
19485bd8deadSopenharmony_ci    ----------------     ------       -------------      -------------  --------------------    ------------  ---------
19495bd8deadSopenharmony_ci    DRAW_BUFFERi [1]     1 + xZ(10*)  GetIntegerv        see 4.2.1      draw buffer selected    4.2.1         color-buffer
19505bd8deadSopenharmony_ci                                                                        for color output i
19515bd8deadSopenharmony_ci    READ_BUFFER  [2]     Z(3)         GetIntegerv        see 4.3.2      read source             4.3.2         pixel
19525bd8deadSopenharmony_ci
19535bd8deadSopenharmony_ci        [1] prior to this extension, the DRAW_BUFFERi state was described in table 6.21 "Framebuffer Control" (of OpenGL 2.0 spec)
19545bd8deadSopenharmony_ci        [2] prior to this extension, the READ_BUFFER state was described in table 6.26 "Pixel" (of OpenGL 2.0 spec)
19555bd8deadSopenharmony_ci
19565bd8deadSopenharmony_ci
19575bd8deadSopenharmony_ci
19585bd8deadSopenharmony_ci    (insert new table 5.nnn, "Framebuffer (state per framebuffer object attachment point)")
19595bd8deadSopenharmony_ci
19605bd8deadSopenharmony_ci    Get Value                                         Type    Get Command                               Initial Value  Description             Section       Attribute
19615bd8deadSopenharmony_ci    -------------------------------                   ------  -------------                             -------------  --------------------    ------------  ---------
19625bd8deadSopenharmony_ci    FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT            Z       GetFramebufferAttachmentParameterivEXT    NONE           type of                 4.4.2.2 and   -
19635bd8deadSopenharmony_ci                                                                                                                       image attached to       4.4.2.3
19645bd8deadSopenharmony_ci                                                                                                                       framebuffer attachment
19655bd8deadSopenharmony_ci                                                                                                                       point
19665bd8deadSopenharmony_ci
19675bd8deadSopenharmony_ci    FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT            Z       GetFramebufferAttachmentParameterivEXT    0              name of object          4.4.2.2 and   -
19685bd8deadSopenharmony_ci                                                                                                                       attached to             4.4.2.3
19695bd8deadSopenharmony_ci                                                                                                                       framebuffer attachment
19705bd8deadSopenharmony_ci                                                                                                                       point
19715bd8deadSopenharmony_ci
19725bd8deadSopenharmony_ci    FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT          Z       GetFramebufferAttachmentParameterivEXT    0              mipmap level of         4.4.2.2 and   -
19735bd8deadSopenharmony_ci                                                                                                                       texture image           4.4.2.3
19745bd8deadSopenharmony_ci                                                                                                                       attached, if object
19755bd8deadSopenharmony_ci                                                                                                                       attached is texture.
19765bd8deadSopenharmony_ci
19775bd8deadSopenharmony_ci    FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT  Z+      GetFramebufferAttachmentParameterivEXT    TEXTURE_       cubemap face of         4.4.2.2 and   -
19785bd8deadSopenharmony_ci                                                                                                        CUBE_MAP_      texture image           4.4.2.3
19795bd8deadSopenharmony_ci                                                                                                        POSITIVE_X     attached, if object
19805bd8deadSopenharmony_ci                                                                                                                       attached is cubemap
19815bd8deadSopenharmony_ci                                                                                                                       texture.
19825bd8deadSopenharmony_ci
19835bd8deadSopenharmony_ci    FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT     Z       GetFramebufferAttachmentParameterivEXT    0              zoffset of              4.4.2.2 and   -
19845bd8deadSopenharmony_ci                                                                                                                       texture image           4.4.2.3
19855bd8deadSopenharmony_ci                                                                                                                       attached, if object
19865bd8deadSopenharmony_ci                                                                                                                       attached is 3D
19875bd8deadSopenharmony_ci                                                                                                                       texture.
19885bd8deadSopenharmony_ci
19895bd8deadSopenharmony_ci
19905bd8deadSopenharmony_ci
19915bd8deadSopenharmony_ci    (insert new table 7.nnn, "Renderbuffers (state per renderbuffer target and binding point)")
19925bd8deadSopenharmony_ci
19935bd8deadSopenharmony_ci    Get Value                          Type    Get Command     Initial Value  Description             Section       Attribute
19945bd8deadSopenharmony_ci    -------------------------------    ------  -------------   -------------  --------------------    ------------  ---------
19955bd8deadSopenharmony_ci    RENDERBUFFER_BINDING_EXT           Z       GetIntegerv     0              renderbuffer object     4.4.2.1       -
19965bd8deadSopenharmony_ci                                                                              bound to
19975bd8deadSopenharmony_ci                                                                              RENDERBUFFER_EXT
19985bd8deadSopenharmony_ci
19995bd8deadSopenharmony_ci
20005bd8deadSopenharmony_ci    (insert new table 8.nnn, "Renderbuffers (state per renderbuffer object)")
20015bd8deadSopenharmony_ci
20025bd8deadSopenharmony_ci    Get Value                          Type    Get Command                    Initial Value  Description             Section       Attribute
20035bd8deadSopenharmony_ci    -------------------------------    ------  -------------                  -------------  --------------------    ------------  ---------
20045bd8deadSopenharmony_ci    RENDERBUFFER_WIDTH_EXT             Z       GetRenderbufferParameterivEXT  0              width of renderbuffer   4.4.2.1       -
20055bd8deadSopenharmony_ci
20065bd8deadSopenharmony_ci    RENDERBUFFER_HEIGHT_EXT            Z       GetRenderbufferParameterivEXT  0              height of renderbuffer  4.4.2.1       -
20075bd8deadSopenharmony_ci
20085bd8deadSopenharmony_ci    RENDERBUFFER_INTERNAL_FORMAT_EXT   Z+      GetRenderbufferParameterivEXT  RGBA           internal format         4.4.2.1       -
20095bd8deadSopenharmony_ci                                                                                             of renderbuffer
20105bd8deadSopenharmony_ci
20115bd8deadSopenharmony_ci    RENDERBUFFER_RED_SIZE_EXT          Z       GetRenderbufferParameterivEXT  0              size in bits of         4.4.2.1       -
20125bd8deadSopenharmony_ci                                                                                             renderbuffer image's
20135bd8deadSopenharmony_ci                                                                                             red component
20145bd8deadSopenharmony_ci
20155bd8deadSopenharmony_ci    RENDERBUFFER_GREEN_SIZE_EXT        Z       GetRenderbufferParameterivEXT  0              size in bits of         4.4.2.1       -
20165bd8deadSopenharmony_ci                                                                                             renderbuffer image's
20175bd8deadSopenharmony_ci                                                                                             green component
20185bd8deadSopenharmony_ci
20195bd8deadSopenharmony_ci    RENDERBUFFER_BLUE_SIZE_EXT         Z       GetRenderbufferParameterivEXT  0              size in bits of         4.4.2.1       -
20205bd8deadSopenharmony_ci                                                                                             renderbuffer image's
20215bd8deadSopenharmony_ci                                                                                             blue component
20225bd8deadSopenharmony_ci
20235bd8deadSopenharmony_ci    RENDERBUFFER_ALPHA_SIZE_EXT        Z       GetRenderbufferParameterivEXT  0              size in bits of         4.4.2.1       -
20245bd8deadSopenharmony_ci                                                                                             renderbuffer image's
20255bd8deadSopenharmony_ci                                                                                             alpha component
20265bd8deadSopenharmony_ci
20275bd8deadSopenharmony_ci    RENDERBUFFER_DEPTH_SIZE_EXT        Z       GetRenderbufferParameterivEXT  0              size in bits of         4.4.2.1       -
20285bd8deadSopenharmony_ci                                                                                             renderbuffer image's
20295bd8deadSopenharmony_ci                                                                                             depth component
20305bd8deadSopenharmony_ci
20315bd8deadSopenharmony_ci    RENDERBUFFER_STENCIL_SIZE_EXT      Z       GetRenderbufferParameterivEXT  0              size in bits of         4.4.2.1       -
20325bd8deadSopenharmony_ci                                                                                             renderbuffer image's
20335bd8deadSopenharmony_ci                                                                                             stencil component
20345bd8deadSopenharmony_ci
20355bd8deadSopenharmony_ciMove the following existing state from "Implementation Dependent
20365bd8deadSopenharmony_ciValues", tables 6.31-6.36 to into a new table called "Framebuffer
20375bd8deadSopenharmony_ciDependent Values", table 9.nnn.
20385bd8deadSopenharmony_ci
20395bd8deadSopenharmony_ci    Get Value
20405bd8deadSopenharmony_ci    ---------
20415bd8deadSopenharmony_ci    AUX_BUFFERS
20425bd8deadSopenharmony_ci    MAX_DRAW_BUFFERS
20435bd8deadSopenharmony_ci    RGBA_MODE
20445bd8deadSopenharmony_ci    INDEX_MODE
20455bd8deadSopenharmony_ci    DOUBLEBUFFER
20465bd8deadSopenharmony_ci    STEREO
20475bd8deadSopenharmony_ci    SAMPLE_BUFFERS
20485bd8deadSopenharmony_ci    SAMPLES
20495bd8deadSopenharmony_ci    RED_BITS
20505bd8deadSopenharmony_ci    GREEN_BITS
20515bd8deadSopenharmony_ci    BLUE_BITS
20525bd8deadSopenharmony_ci    ALPHA_BITS
20535bd8deadSopenharmony_ci    DEPTH_BITS
20545bd8deadSopenharmony_ci    STENCIL_BITS
20555bd8deadSopenharmony_ci    ACCUM_RED_BITS
20565bd8deadSopenharmony_ci    ACCUM_GREEN_BITS
20575bd8deadSopenharmony_ci    ACCUM_BLUE_BITS
20585bd8deadSopenharmony_ci    ACCUM_ALPHA_BITS
20595bd8deadSopenharmony_ci
20605bd8deadSopenharmony_ciTo the same table called "Framebuffer Dependent Values", table 9.nnn
20615bd8deadSopenharmony_ciadd the following new framebuffer dependent state.
20625bd8deadSopenharmony_ci
20635bd8deadSopenharmony_ci    Get Value                   Type  Get Command     Minimum Value    Description             Section  Attribute
20645bd8deadSopenharmony_ci    ---------                   ----  -----------     -------------    -------------------     -------  ---------
20655bd8deadSopenharmony_ci    MAX_COLOR_ATTACHMENTS_EXT   Z+    GetIntegerv     1                Maximum number of       4.4.2.2  -
20665bd8deadSopenharmony_ci                                                                       attachment points
20675bd8deadSopenharmony_ci                                                                       for color buffers
20685bd8deadSopenharmony_ci                                                                       when using framebuffer
20695bd8deadSopenharmony_ci                                                                       objects
20705bd8deadSopenharmony_ci
20715bd8deadSopenharmony_ciNew Implementation Dependent State
20725bd8deadSopenharmony_ci
20735bd8deadSopenharmony_ci    Get Value                   Type  Get Command     Minimum Value    Description             Section  Attribute
20745bd8deadSopenharmony_ci    ---------                   ----  -----------     -------------    -------------------     -------  ---------
20755bd8deadSopenharmony_ci    MAX_RENDERBUFFER_SIZE_EXT   Z+    GetIntegerv     1                Maximum width and       4.4.2.1  -
20765bd8deadSopenharmony_ci                                                                       height of
20775bd8deadSopenharmony_ci                                                                       renderbuffers
20785bd8deadSopenharmony_ci                                                                       supported by
20795bd8deadSopenharmony_ci                                                                       the implementation
20805bd8deadSopenharmony_ci
20815bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications and dependencies on
20825bd8deadSopenharmony_ciWGL_ARB_make_current_read, GLX_SGI_make_current_read, and GLX 1.3
20835bd8deadSopenharmony_ci
20845bd8deadSopenharmony_ci    The color, depth, stencil, aux, and accum logical buffers defined by
20855bd8deadSopenharmony_ci    the <draw> and <read> drawables passed to glXMakeContextCurrent,
20865bd8deadSopenharmony_ci    glXMakeCurrent, and glXMakeCurrentRead are ignored while the value
20875bd8deadSopenharmony_ci    of FRAMEBUFFER_BINDING_EXT is non-zero.
20885bd8deadSopenharmony_ci
20895bd8deadSopenharmony_ciDependencies on ATI_draw_buffers and ARB_draw_buffers
20905bd8deadSopenharmony_ci
20915bd8deadSopenharmony_ci    If neither ATI_draw_buffers nor ARB_draw_buffers are supported, then
20925bd8deadSopenharmony_ci    all discussions of DrawBuffers should be ignored.
20935bd8deadSopenharmony_ci
20945bd8deadSopenharmony_ci    In addition, the language describing DrawBuffers are derived from a
20955bd8deadSopenharmony_ci    combination of the ARB_draw_buffers specification and section 4.2.1
20965bd8deadSopenharmony_ci    of the OpenGL 2.0 specification.
20975bd8deadSopenharmony_ci
20985bd8deadSopenharmony_ciDependencies on ARB_fragment_program, ARB_fragment_shader, and
20995bd8deadSopenharmony_ciARB_vertex_shader
21005bd8deadSopenharmony_ci
21015bd8deadSopenharmony_ci    If ARB_fragment_program, ARB_fragment_shader, and ARB_vertex_shader
21025bd8deadSopenharmony_ci    are all not supported, then all references to the currently bound
21035bd8deadSopenharmony_ci    program or shader should be ignored.
21045bd8deadSopenharmony_ci
21055bd8deadSopenharmony_ciDependencies on ARB_framebuffer_object and OpenGL 3.0
21065bd8deadSopenharmony_ci
21075bd8deadSopenharmony_ci    Framebuffer objects created with the commands defined by the
21085bd8deadSopenharmony_ci    GL_EXT_framebuffer_object extension are defined to be shared, while
21095bd8deadSopenharmony_ci    FBOs created with commands defined by the OpenGL core or
21105bd8deadSopenharmony_ci    GL_ARB_framebuffer_object extension are defined *not* to be shared.
21115bd8deadSopenharmony_ci    However, the following functions are viewed as aliases (in particular
21125bd8deadSopenharmony_ci    the opcodes for X are also the same) between the functions of
21135bd8deadSopenharmony_ci    GL_EXT_framebuffer_object and GL_ARB_framebuffer_object:
21145bd8deadSopenharmony_ci
21155bd8deadSopenharmony_ci      IsRenderbufferEXT             / IsRenderbuffer
21165bd8deadSopenharmony_ci      DeleteRenderbuffersEXT        / DeleteRenderbuffers
21175bd8deadSopenharmony_ci      GenRenderbuffersEXT           / GenRenderbuffers
21185bd8deadSopenharmony_ci      RenderbufferStorageEXT        / RenderbufferStorage
21195bd8deadSopenharmony_ci      GetRenderbufferParameterivEXT / GetRenderbufferParameteriv
21205bd8deadSopenharmony_ci      IsFramebufferEXT              / IsFramebuffer
21215bd8deadSopenharmony_ci      DeleteFramebuffersEXT         / DeleteFramebuffers
21225bd8deadSopenharmony_ci      GenFramebuffersEXT            / GenFramebuffers
21235bd8deadSopenharmony_ci      CheckFramebufferStatusEXT     / CheckFramebufferStatus
21245bd8deadSopenharmony_ci      FramebufferTexture1DEXT       / FramebufferTexture1D
21255bd8deadSopenharmony_ci      FramebufferTexture2DEXT       / FramebufferTexture2D
21265bd8deadSopenharmony_ci      FramebufferRenderbufferEXT    / FramebufferRenderbuffer
21275bd8deadSopenharmony_ci      GenerateMipmapEXT             / GenerateMipmap
21285bd8deadSopenharmony_ci      GetFramebufferAttachmentParameterivEXT / GetFramebufferAttachmentParameteriv
21295bd8deadSopenharmony_ci
21305bd8deadSopenharmony_ci   Since the above pairs are aliases, the functions of a pair are
21315bd8deadSopenharmony_ci   equivalent.  Note that the functions BindFramebuffer and
21325bd8deadSopenharmony_ci   BindFramebufferEXT are not aliases and neither are the functions
21335bd8deadSopenharmony_ci   BindRenderbuffer and BindRenderbufferEXT.  Because object creation
21345bd8deadSopenharmony_ci   occurs when the framebuffer object is bound for the first time, a
21355bd8deadSopenharmony_ci   framebuffer object can be shared across contexts only if it was first
21365bd8deadSopenharmony_ci   bound with BindFramebufferEXT.  Framebuffers first bound with
21375bd8deadSopenharmony_ci   BindFramebuffer may not be shared across contexts.  Framebuffer
21385bd8deadSopenharmony_ci   objects created with BindFramebufferEXT may subsequently be bound
21395bd8deadSopenharmony_ci   using BindFramebuffer.  Framebuffer objects created with
21405bd8deadSopenharmony_ci   BindFramebuffer may be bound with BindFramebufferEXT provided they are
21415bd8deadSopenharmony_ci   bound to the same context they were created on.
21425bd8deadSopenharmony_ci
21435bd8deadSopenharmony_ciDependencies on ARB_texture_rectangle
21445bd8deadSopenharmony_ci
21455bd8deadSopenharmony_ci    If ARB_texture_rectangle is not supported, then all references to
21465bd8deadSopenharmony_ci    TEXTURE_RECTANGLE_ARB should be ignored.
21475bd8deadSopenharmony_ci
21485bd8deadSopenharmony_ciDependencies on EXT_packed_depth_stencil
21495bd8deadSopenharmony_ci
21505bd8deadSopenharmony_ci    If EXT_packed_depth_stencil is not supported, then all references to
21515bd8deadSopenharmony_ci    DEPTH_STENCIL internal formats should be ignored.
21525bd8deadSopenharmony_ci
21535bd8deadSopenharmony_ciDependencies on NV_float_buffer
21545bd8deadSopenharmony_ci
21555bd8deadSopenharmony_ci    If NV_float_buffer is not supported, then all references to the
21565bd8deadSopenharmony_ci    following internal formats should be ignored: FLOAT_R_NV,
21575bd8deadSopenharmony_ci    FLOAT_RG_NV, FLOAT_RGB_NV, and FLOAT_RGBA_NV.
21585bd8deadSopenharmony_ci
21595bd8deadSopenharmony_ciDependencies on NV_texture_shader
21605bd8deadSopenharmony_ci
21615bd8deadSopenharmony_ci    The following base internal formats are not color-renderable,
21625bd8deadSopenharmony_ci    depth-renderable, or stencil-renderable: HILO_NV, DSDT_NV,
21635bd8deadSopenharmony_ci    DSDT_MAG_NV, and DSDT_MAG_INTENSITY_NV.
21645bd8deadSopenharmony_ci
21655bd8deadSopenharmony_ciGLX Protocol
21665bd8deadSopenharmony_ci
21675bd8deadSopenharmony_ci        Seventeen new GL commands are added.
21685bd8deadSopenharmony_ci
21695bd8deadSopenharmony_ci        The following ten rendering commands are sent to the sever as part
21705bd8deadSopenharmony_ci        of a glXRender request:
21715bd8deadSopenharmony_ci
21725bd8deadSopenharmony_ci        BindRenderbufferEXT
21735bd8deadSopenharmony_ci            2        12              rendering command length
21745bd8deadSopenharmony_ci            2        4316            rendering command opcode
21755bd8deadSopenharmony_ci            4        ENUM            target
21765bd8deadSopenharmony_ci            4        CARD32          renderbuffer
21775bd8deadSopenharmony_ci
21785bd8deadSopenharmony_ci        DeleteRenderbufferEXT
21795bd8deadSopenharmony_ci            2        8+n*4           rendering command length
21805bd8deadSopenharmony_ci            2        4317            rendering command opcode
21815bd8deadSopenharmony_ci            4        CARD32          n
21825bd8deadSopenharmony_ci            n*4      LISTofCARD32    renderbuffers
21835bd8deadSopenharmony_ci
21845bd8deadSopenharmony_ci        RenderbufferStorageEXT
21855bd8deadSopenharmony_ci            2        20              rendering command length
21865bd8deadSopenharmony_ci            2        4318            rendering command opcode
21875bd8deadSopenharmony_ci            4        ENUM            target
21885bd8deadSopenharmony_ci            4        ENUM            internalFormat
21895bd8deadSopenharmony_ci            4        CARD32          width
21905bd8deadSopenharmony_ci            4        CARD32          height
21915bd8deadSopenharmony_ci
21925bd8deadSopenharmony_ci        BindFramebufferEXT
21935bd8deadSopenharmony_ci            2        12              rendering command length
21945bd8deadSopenharmony_ci            2        4319            rendering command opcode
21955bd8deadSopenharmony_ci            4        ENUM            target
21965bd8deadSopenharmony_ci            4        CARD32          framebuffer
21975bd8deadSopenharmony_ci
21985bd8deadSopenharmony_ci        DeleteFramebufferEXT
21995bd8deadSopenharmony_ci            2        8+n*4           rendering command length
22005bd8deadSopenharmony_ci            2        4320            rendering command opcode
22015bd8deadSopenharmony_ci            4        CARD32          n
22025bd8deadSopenharmony_ci            n*4      LISTofCARD32    framebuffers
22035bd8deadSopenharmony_ci
22045bd8deadSopenharmony_ci        FramebufferTexture1DEXT
22055bd8deadSopenharmony_ci            2        24              rendering command length
22065bd8deadSopenharmony_ci            2        4321            rendering command opcode
22075bd8deadSopenharmony_ci            4        ENUM            target
22085bd8deadSopenharmony_ci            4        ENUM            attachement
22095bd8deadSopenharmony_ci            4        ENUM            textarget
22105bd8deadSopenharmony_ci            4        CARD32          texture
22115bd8deadSopenharmony_ci            4        CARD32          level
22125bd8deadSopenharmony_ci
22135bd8deadSopenharmony_ci        FramebufferTexture2DEXT
22145bd8deadSopenharmony_ci            2        24              rendering command length
22155bd8deadSopenharmony_ci            2        4322            rendering command opcode
22165bd8deadSopenharmony_ci            4        ENUM            target
22175bd8deadSopenharmony_ci            4        ENUM            attachement
22185bd8deadSopenharmony_ci            4        ENUM            textarget
22195bd8deadSopenharmony_ci            4        CARD32          texture
22205bd8deadSopenharmony_ci            4        CARD32          level
22215bd8deadSopenharmony_ci
22225bd8deadSopenharmony_ci        FramebufferTexture3DEXT
22235bd8deadSopenharmony_ci            2        28              rendering command length
22245bd8deadSopenharmony_ci            2        4323            rendering command opcode
22255bd8deadSopenharmony_ci            4        ENUM            target
22265bd8deadSopenharmony_ci            4        ENUM            attachement
22275bd8deadSopenharmony_ci            4        ENUM            textarget
22285bd8deadSopenharmony_ci            4        CARD32          texture
22295bd8deadSopenharmony_ci            4        CARD32          level
22305bd8deadSopenharmony_ci            4        CARD32          zoffset
22315bd8deadSopenharmony_ci
22325bd8deadSopenharmony_ci        FramebufferRenderbufferEXT
22335bd8deadSopenharmony_ci            2        20              rendering command length
22345bd8deadSopenharmony_ci            2        4324            rendering command opcode
22355bd8deadSopenharmony_ci            4        ENUM            target
22365bd8deadSopenharmony_ci            4        ENUM            attachment
22375bd8deadSopenharmony_ci            4        ENUM            renderbuffertarget
22385bd8deadSopenharmony_ci            4        CARD32          renderbuffer
22395bd8deadSopenharmony_ci
22405bd8deadSopenharmony_ci        GenerateMipmapEXT
22415bd8deadSopenharmony_ci            2        8               rendering command length
22425bd8deadSopenharmony_ci            2        4325            rendering command opcode
22435bd8deadSopenharmony_ci            4        ENUM            target
22445bd8deadSopenharmony_ci
22455bd8deadSopenharmony_ci        The remaining seven commands are non-rendering commands.  These
22465bd8deadSopenharmony_ci        commands are sent separately (i.e., not as part of a glXRender or
22475bd8deadSopenharmony_ci        glXRenderLarge request), using the glXVendorPrivateWithReply
22485bd8deadSopenharmony_ci        request:
22495bd8deadSopenharmony_ci
22505bd8deadSopenharmony_ci        IsRenderbufferEXT
22515bd8deadSopenharmony_ci            1        CARD8           opcode (X assigned)
22525bd8deadSopenharmony_ci            1        17              GLX opcode (X_GLXVendorPrivateWithReply)
22535bd8deadSopenharmony_ci            2        4               request length
22545bd8deadSopenharmony_ci            4        1422            vendor specific opcode
22555bd8deadSopenharmony_ci            4        GLX_CONTEXT_TAG context tag
22565bd8deadSopenharmony_ci            4        CARD32          renderbuffer
22575bd8deadSopenharmony_ci          =>
22585bd8deadSopenharmony_ci            1        1               reply
22595bd8deadSopenharmony_ci            1                        unused
22605bd8deadSopenharmony_ci            2        CARD16          sequence number
22615bd8deadSopenharmony_ci            4        0               reply length
22625bd8deadSopenharmony_ci            4        BOOL32          return value
22635bd8deadSopenharmony_ci            20                       unused
22645bd8deadSopenharmony_ci
22655bd8deadSopenharmony_ci        GenRenderbuffersEXT
22665bd8deadSopenharmony_ci            1        CARD8           opcode (X assigned)
22675bd8deadSopenharmony_ci            1        17              GLX opcode (X_GLXVendorPrivateWithReply)
22685bd8deadSopenharmony_ci            2        4               request length
22695bd8deadSopenharmony_ci            4        1423            vendor specific opcode
22705bd8deadSopenharmony_ci            4        GLX_CONTEXT_TAG context tag
22715bd8deadSopenharmony_ci            4        CARD32          n
22725bd8deadSopenharmony_ci          =>
22735bd8deadSopenharmony_ci            1        1               reply
22745bd8deadSopenharmony_ci            1                        unused
22755bd8deadSopenharmony_ci            2        CARD16          sequence number
22765bd8deadSopenharmony_ci            4        m               reply length
22775bd8deadSopenharmony_ci            4                        unused
22785bd8deadSopenharmony_ci            4        CARD32          n
22795bd8deadSopenharmony_ci            16                       unused
22805bd8deadSopenharmony_ci            n*4      LISTofCARD32    renderbuffers
22815bd8deadSopenharmony_ci
22825bd8deadSopenharmony_ci        GetRenderbufferParameterivEXT
22835bd8deadSopenharmony_ci            1        CARD8           opcode (X assigned)
22845bd8deadSopenharmony_ci            1        17              GLX opcode (X_GLXVendorPrivateWithReply)
22855bd8deadSopenharmony_ci            2        5               request length
22865bd8deadSopenharmony_ci            4        1424            vendor specific opcode
22875bd8deadSopenharmony_ci            4        GLX_CONTEXT_TAG context tag
22885bd8deadSopenharmony_ci            4        ENUM            target
22895bd8deadSopenharmony_ci            4        ENUM            pname
22905bd8deadSopenharmony_ci          =>
22915bd8deadSopenharmony_ci            1        1               reply
22925bd8deadSopenharmony_ci            1                        unused
22935bd8deadSopenharmony_ci            2        CARD16          sequence number
22945bd8deadSopenharmony_ci            4        m               reply length, m = (n == 1 ? 0 : n)
22955bd8deadSopenharmony_ci            4                        unused
22965bd8deadSopenharmony_ci            4        CARD32          n
22975bd8deadSopenharmony_ci
22985bd8deadSopenharmony_ci            if (n = 1) this follows:
22995bd8deadSopenharmony_ci
23005bd8deadSopenharmony_ci            4        CARD32          params
23015bd8deadSopenharmony_ci            12                       unused
23025bd8deadSopenharmony_ci
23035bd8deadSopenharmony_ci            otherwise this follows:
23045bd8deadSopenharmony_ci
23055bd8deadSopenharmony_ci            16                       unused
23065bd8deadSopenharmony_ci            n*4      LISTofCARD32    params
23075bd8deadSopenharmony_ci
23085bd8deadSopenharmony_ci        IsFramebufferEXT
23095bd8deadSopenharmony_ci            1        CARD8           opcode (X assigned)
23105bd8deadSopenharmony_ci            1        17              GLX opcode (X_GLXVendorPrivateWithReply)
23115bd8deadSopenharmony_ci            2        4               request length
23125bd8deadSopenharmony_ci            4        1425            vendor specific opcode
23135bd8deadSopenharmony_ci            4        GLX_CONTEXT_TAG context tag
23145bd8deadSopenharmony_ci            4        CARD32          framebuffer
23155bd8deadSopenharmony_ci          =>
23165bd8deadSopenharmony_ci            1        1               reply
23175bd8deadSopenharmony_ci            1                        unused
23185bd8deadSopenharmony_ci            2        CARD16          sequence number
23195bd8deadSopenharmony_ci            4        0               reply length
23205bd8deadSopenharmony_ci            4        BOOL32          return value
23215bd8deadSopenharmony_ci            20                       unused
23225bd8deadSopenharmony_ci
23235bd8deadSopenharmony_ci        GenFramebuffersEXT
23245bd8deadSopenharmony_ci            1        CARD8           opcode (X assigned)
23255bd8deadSopenharmony_ci            1        17              GLX opcode (X_GLXVendorPrivateWithReply)
23265bd8deadSopenharmony_ci            2        4               request length
23275bd8deadSopenharmony_ci            4        1426            vendor specific opcode
23285bd8deadSopenharmony_ci            4        GLX_CONTEXT_TAG context tag
23295bd8deadSopenharmony_ci            4        CARD32          n
23305bd8deadSopenharmony_ci          =>
23315bd8deadSopenharmony_ci            1        1               reply
23325bd8deadSopenharmony_ci            1                        unused
23335bd8deadSopenharmony_ci            2        CARD16          sequence number
23345bd8deadSopenharmony_ci            4        n               reply length
23355bd8deadSopenharmony_ci            4                        unused
23365bd8deadSopenharmony_ci            4        CARD32          n
23375bd8deadSopenharmony_ci            16                       unused
23385bd8deadSopenharmony_ci            n*4      LISTofCARD32    framebuffers
23395bd8deadSopenharmony_ci
23405bd8deadSopenharmony_ci        CheckFramebufferStatusEXT
23415bd8deadSopenharmony_ci            1        CARD8           opcode (X assigned)
23425bd8deadSopenharmony_ci            1        17              GLX opcode (X_GLXVendorPrivateWithReply)
23435bd8deadSopenharmony_ci            2        4               request length
23445bd8deadSopenharmony_ci            4        1427            vendor specific opcode
23455bd8deadSopenharmony_ci            4        GLX_CONTEXT_TAG context tag
23465bd8deadSopenharmony_ci            4        ENUM            target
23475bd8deadSopenharmony_ci          =>
23485bd8deadSopenharmony_ci            1        1               reply
23495bd8deadSopenharmony_ci            1                        unused
23505bd8deadSopenharmony_ci            2        CARD16          sequence number
23515bd8deadSopenharmony_ci            4        0               reply length
23525bd8deadSopenharmony_ci            4        ENUM            return value
23535bd8deadSopenharmony_ci            20                       unused
23545bd8deadSopenharmony_ci
23555bd8deadSopenharmony_ci        GetFramebufferAttachementParameterivEXT
23565bd8deadSopenharmony_ci            1        CARD8           opcode (X assigned)
23575bd8deadSopenharmony_ci            1        17              GLX opcode (X_GLXVendorPrivateWithReply)
23585bd8deadSopenharmony_ci            2        6               request length
23595bd8deadSopenharmony_ci            4        1428            vendor specific opcode
23605bd8deadSopenharmony_ci            4        GLX_CONTEXT_TAG context tag
23615bd8deadSopenharmony_ci            4        ENUM            target
23625bd8deadSopenharmony_ci            4        ENUM            attachment
23635bd8deadSopenharmony_ci            4        ENUM            pname
23645bd8deadSopenharmony_ci          =>
23655bd8deadSopenharmony_ci            1        1               reply
23665bd8deadSopenharmony_ci            1                        unused
23675bd8deadSopenharmony_ci            2        CARD16          sequence number
23685bd8deadSopenharmony_ci            4        m               reply length, m = (n == 1 ? 0 : n)
23695bd8deadSopenharmony_ci            4                        unused
23705bd8deadSopenharmony_ci            4        CARD32          n
23715bd8deadSopenharmony_ci
23725bd8deadSopenharmony_ci            if (n = 1) this follows:
23735bd8deadSopenharmony_ci
23745bd8deadSopenharmony_ci            4        CARD32          params
23755bd8deadSopenharmony_ci            12                       unused
23765bd8deadSopenharmony_ci
23775bd8deadSopenharmony_ci            otherwise this follows:
23785bd8deadSopenharmony_ci
23795bd8deadSopenharmony_ci            16                       unused
23805bd8deadSopenharmony_ci            n*4      LISTofCARD32    params
23815bd8deadSopenharmony_ci
23825bd8deadSopenharmony_ci
23835bd8deadSopenharmony_ci
23845bd8deadSopenharmony_ciUsage Examples
23855bd8deadSopenharmony_ci
23865bd8deadSopenharmony_ci    The following examples use a helper macro for
23875bd8deadSopenharmony_ci    CHECK_FRAMEBUFFER_STATUS, defined below.
23885bd8deadSopenharmony_ci
23895bd8deadSopenharmony_ci    Example (6) gives a (very slightly) more robust example of handling
23905bd8deadSopenharmony_ci    the possible return values for glCheckFramebufferStatusEXT.
23915bd8deadSopenharmony_ci
23925bd8deadSopenharmony_ci    #define CHECK_FRAMEBUFFER_STATUS()                            \
23935bd8deadSopenharmony_ci      {                                                           \
23945bd8deadSopenharmony_ci        GLenum status;                                            \
23955bd8deadSopenharmony_ci        status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); \
23965bd8deadSopenharmony_ci        switch(status) {                                          \
23975bd8deadSopenharmony_ci          case GL_FRAMEBUFFER_COMPLETE_EXT:                       \
23985bd8deadSopenharmony_ci            break;                                                \
23995bd8deadSopenharmony_ci          case GL_FRAMEBUFFER_UNSUPPORTED_EXT:                    \
24005bd8deadSopenharmony_ci            /* choose different formats */                        \
24015bd8deadSopenharmony_ci            break;                                                \
24025bd8deadSopenharmony_ci          default:                                                \
24035bd8deadSopenharmony_ci            /* programming error; will fail on all hardware */    \
24045bd8deadSopenharmony_ci            assert(0);                                            \
24055bd8deadSopenharmony_ci        }
24065bd8deadSopenharmony_ci      }
24075bd8deadSopenharmony_ci
24085bd8deadSopenharmony_ci    (1) Render to 2D texture with a depth buffer
24095bd8deadSopenharmony_ci
24105bd8deadSopenharmony_ci        // Given:  color_tex - TEXTURE_2D color texture object
24115bd8deadSopenharmony_ci        //         depth_rb  - GL_DEPTH renderbuffer object
24125bd8deadSopenharmony_ci        //         fb        - framebuffer object
24135bd8deadSopenharmony_ci
24145bd8deadSopenharmony_ci        // Enable render-to-texture
24155bd8deadSopenharmony_ci        glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
24165bd8deadSopenharmony_ci
24175bd8deadSopenharmony_ci        // Set up color_tex and depth_rb for render-to-texture
24185bd8deadSopenharmony_ci        glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
24195bd8deadSopenharmony_ci                                  GL_COLOR_ATTACHMENT0_EXT,
24205bd8deadSopenharmony_ci                                  GL_TEXTURE_2D, color_tex, 0);
24215bd8deadSopenharmony_ci        glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
24225bd8deadSopenharmony_ci                                     GL_DEPTH_ATTACHMENT_EXT,
24235bd8deadSopenharmony_ci                                     GL_RENDERBUFFER_EXT, depth_rb);
24245bd8deadSopenharmony_ci
24255bd8deadSopenharmony_ci        // Check framebuffer completeness at the end of initialization.
24265bd8deadSopenharmony_ci        CHECK_FRAMEBUFFER_STATUS();
24275bd8deadSopenharmony_ci
24285bd8deadSopenharmony_ci        <draw to the texture and renderbuffer>
24295bd8deadSopenharmony_ci
24305bd8deadSopenharmony_ci        // Re-enable rendering to the window
24315bd8deadSopenharmony_ci        glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
24325bd8deadSopenharmony_ci
24335bd8deadSopenharmony_ci        glBindTexture(GL_TEXTURE_2D, color_tex);
24345bd8deadSopenharmony_ci        <draw to the window, reading from the color_tex>
24355bd8deadSopenharmony_ci
24365bd8deadSopenharmony_ci
24375bd8deadSopenharmony_ci    (2) Application that supports both RBBCTT (render back buffer, copy to
24385bd8deadSopenharmony_ci    texture) and RTT (render to texture).  The migration path from RBBCTT
24395bd8deadSopenharmony_ci    to RTT is easy.
24405bd8deadSopenharmony_ci
24415bd8deadSopenharmony_ci        if (useFramebuffer) {
24425bd8deadSopenharmony_ci            glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
24435bd8deadSopenharmony_ci            glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
24445bd8deadSopenharmony_ci                                      GL_COLOR_ATTACHMENT0_EXT,
24455bd8deadSopenharmony_ci                                      GL_TEXTURE_2D, color_tex, 0);
24465bd8deadSopenharmony_ci            CHECK_FRAMEBUFFER_STATUS();
24475bd8deadSopenharmony_ci        }
24485bd8deadSopenharmony_ci
24495bd8deadSopenharmony_ci        draw_to_texture();
24505bd8deadSopenharmony_ci
24515bd8deadSopenharmony_ci        glBindTexture (GL_TEXTURE_2D, color_tex);
24525bd8deadSopenharmony_ci        if (useFramebuffer) {
24535bd8deadSopenharmony_ci            glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
24545bd8deadSopenharmony_ci        } else { // copy tex path
24555bd8deadSopenharmony_ci            glCopyTexSubImage(...);
24565bd8deadSopenharmony_ci        }
24575bd8deadSopenharmony_ci
24585bd8deadSopenharmony_ci
24595bd8deadSopenharmony_ci    (3) Simple render-to-texture loop with initialization.  Create an
24605bd8deadSopenharmony_ci    RGB8 texture, a 24-bit depth renderbuffer, and a stencil
24615bd8deadSopenharmony_ci    renderbuffer.  In a loop, alternate between rendering to, and
24625bd8deadSopenharmony_ci    texturing out of, the color texture.
24635bd8deadSopenharmony_ci
24645bd8deadSopenharmony_ci        glGenFramebuffersEXT(1, &fb);
24655bd8deadSopenharmony_ci        glGenTextures(1, &color_tex);
24665bd8deadSopenharmony_ci        glGenRenderbuffersEXT(1, &depth_rb);
24675bd8deadSopenharmony_ci        glGenRenderbuffersEXT(1, &stencil_rb);
24685bd8deadSopenharmony_ci
24695bd8deadSopenharmony_ci        glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
24705bd8deadSopenharmony_ci
24715bd8deadSopenharmony_ci        // initialize color texture
24725bd8deadSopenharmony_ci        glBindTexture(GL_TEXTURE_2D, color_tex);
24735bd8deadSopenharmony_ci        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
24745bd8deadSopenharmony_ci        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, 512, 512, 0,
24755bd8deadSopenharmony_ci                     GL_RGB, GL_INT, NULL);
24765bd8deadSopenharmony_ci        glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
24775bd8deadSopenharmony_ci                                  GL_COLOR_ATTACHMENT0_EXT,
24785bd8deadSopenharmony_ci                                  GL_TEXTURE_2D, color_tex, 0);
24795bd8deadSopenharmony_ci
24805bd8deadSopenharmony_ci        // initialize depth renderbuffer
24815bd8deadSopenharmony_ci        glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depth_rb);
24825bd8deadSopenharmony_ci        glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,
24835bd8deadSopenharmony_ci                                 GL_DEPTH_COMPONENT24, 512, 512);
24845bd8deadSopenharmony_ci        glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
24855bd8deadSopenharmony_ci                                     GL_DEPTH_ATTACHMENT_EXT,
24865bd8deadSopenharmony_ci                                     GL_RENDERBUFFER_EXT, depth_rb);
24875bd8deadSopenharmony_ci
24885bd8deadSopenharmony_ci        // initialize stencil renderbuffer
24895bd8deadSopenharmony_ci        glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, stencil_rb);
24905bd8deadSopenharmony_ci        glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,
24915bd8deadSopenharmony_ci                                 GL_STENCIL_INDEX, 512, 512);
24925bd8deadSopenharmony_ci        glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
24935bd8deadSopenharmony_ci                                     GL_STENCIL_ATTACHMENT_EXT,
24945bd8deadSopenharmony_ci                                     GL_RENDERBUFFER_EXT, stencil_rb);
24955bd8deadSopenharmony_ci
24965bd8deadSopenharmony_ci        // Check framebuffer completeness at the end of initialization.
24975bd8deadSopenharmony_ci        CHECK_FRAMEBUFFER_STATUS();
24985bd8deadSopenharmony_ci
24995bd8deadSopenharmony_ci        loop {
25005bd8deadSopenharmony_ci            glBindTexture(GL_TEXTURE_2D, 0);
25015bd8deadSopenharmony_ci            glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
25025bd8deadSopenharmony_ci
25035bd8deadSopenharmony_ci            <draw to the texture>
25045bd8deadSopenharmony_ci
25055bd8deadSopenharmony_ci            glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
25065bd8deadSopenharmony_ci            glBindTexture(GL_TEXTURE_2D, color_tex);
25075bd8deadSopenharmony_ci
25085bd8deadSopenharmony_ci            <draw to the window, reading from the color texture>
25095bd8deadSopenharmony_ci        }
25105bd8deadSopenharmony_ci
25115bd8deadSopenharmony_ci
25125bd8deadSopenharmony_ci    (4) Render-to-texture loop with automatic mipmap generation.  There
25135bd8deadSopenharmony_ci    are N framebuffers, N mipmap color textures, and a single shared
25145bd8deadSopenharmony_ci    depth renderbuffer.  The depth renderbuffer is not a mipmap.
25155bd8deadSopenharmony_ci
25165bd8deadSopenharmony_ci        GLuint fb_array[N];
25175bd8deadSopenharmony_ci        GLuint color_tex_array[N];
25185bd8deadSopenharmony_ci        GLuint depth_rb;
25195bd8deadSopenharmony_ci
25205bd8deadSopenharmony_ci        glGenFramebuffersEXT(N, fb_array);
25215bd8deadSopenharmony_ci        glGenTextures(N, color_tex_array);
25225bd8deadSopenharmony_ci        glGenRenderbuffersEXT(1, &depth_rb);
25235bd8deadSopenharmony_ci
25245bd8deadSopenharmony_ci        // initialize color textures
25255bd8deadSopenharmony_ci        for (int i=0; i<N; i++) {
25265bd8deadSopenharmony_ci          glBindTexture(GL_TEXTURE_2D, color_tex_array[N]);
25275bd8deadSopenharmony_ci          glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, 512, 512, 0,
25285bd8deadSopenharmony_ci                       GL_RGB, GL_INT, NULL);
25295bd8deadSopenharmony_ci
25305bd8deadSopenharmony_ci          // establish a mipmap chain for the texture
25315bd8deadSopenharmony_ci          glGenerateMipmapEXT(GL_TEXTURE_2D);
25325bd8deadSopenharmony_ci        }
25335bd8deadSopenharmony_ci
25345bd8deadSopenharmony_ci        // initialize depth renderbuffer
25355bd8deadSopenharmony_ci        glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depth_rb);
25365bd8deadSopenharmony_ci        glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,
25375bd8deadSopenharmony_ci                                 GL_DEPTH_COMPONENT24, 512, 512);
25385bd8deadSopenharmony_ci
25395bd8deadSopenharmony_ci        // setup framebuffers, sharing depth
25405bd8deadSopenharmony_ci        for (int i=0; i<N; i++) {
25415bd8deadSopenharmony_ci          glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb_array[i]);
25425bd8deadSopenharmony_ci          glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
25435bd8deadSopenharmony_ci                                    GL_COLOR_ATTACHMENT0_EXT,
25445bd8deadSopenharmony_ci                                    GL_TEXTURE_2D, color_tex_array[i], 0);
25455bd8deadSopenharmony_ci          glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
25465bd8deadSopenharmony_ci                                       GL_DEPTH_ATTACHMENT_EXT,
25475bd8deadSopenharmony_ci                                       GL_RENDERBUFFER_EXT, depth_rb);
25485bd8deadSopenharmony_ci        }
25495bd8deadSopenharmony_ci
25505bd8deadSopenharmony_ci        // Check framebuffer completeness at the end of initialization.
25515bd8deadSopenharmony_ci        CHECK_FRAMEBUFFER_STATUS();
25525bd8deadSopenharmony_ci
25535bd8deadSopenharmony_ci        loop {
25545bd8deadSopenharmony_ci            glBindTexture(GL_TEXTURE_2D, 0);
25555bd8deadSopenharmony_ci
25565bd8deadSopenharmony_ci            for (int i=0; i<N; i++) {
25575bd8deadSopenharmony_ci              glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb_array[i]);
25585bd8deadSopenharmony_ci              <draw to texture i>
25595bd8deadSopenharmony_ci            }
25605bd8deadSopenharmony_ci
25615bd8deadSopenharmony_ci            glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
25625bd8deadSopenharmony_ci
25635bd8deadSopenharmony_ci            // automatically generate mipmaps
25645bd8deadSopenharmony_ci            for (int i=0; i<N; i++) {
25655bd8deadSopenharmony_ci              glBindTexture(GL_TEXTURE_2D, color_tex_array[i]);
25665bd8deadSopenharmony_ci              glGenerateMipmapEXT(GL_TEXTURE_2D);
25675bd8deadSopenharmony_ci            }
25685bd8deadSopenharmony_ci
25695bd8deadSopenharmony_ci            <draw to the window, reading from the color textures>
25705bd8deadSopenharmony_ci        }
25715bd8deadSopenharmony_ci
25725bd8deadSopenharmony_ci
25735bd8deadSopenharmony_ci    (5) Render-to-texture loop with custom mipmap generation.
25745bd8deadSopenharmony_ci        The depth renderbuffer is not a mipmap.
25755bd8deadSopenharmony_ci
25765bd8deadSopenharmony_ci        glGenFramebuffersEXT(1, &fb);
25775bd8deadSopenharmony_ci        glGenTextures(1, &color_tex);
25785bd8deadSopenharmony_ci        glGenRenderbuffersEXT(1, &depth_rb);
25795bd8deadSopenharmony_ci
25805bd8deadSopenharmony_ci        glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
25815bd8deadSopenharmony_ci
25825bd8deadSopenharmony_ci        // initialize color texture and establish mipmap chain
25835bd8deadSopenharmony_ci        glBindTexture(GL_TEXTURE_2D, color_tex);
25845bd8deadSopenharmony_ci        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, 512, 512, 0,
25855bd8deadSopenharmony_ci                     GL_RGB, GL_INT, NULL);
25865bd8deadSopenharmony_ci        glGenerateMipmapEXT(GL_TEXTURE_2D);
25875bd8deadSopenharmony_ci        glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
25885bd8deadSopenharmony_ci                                  GL_COLOR_ATTACHMENT0_EXT,
25895bd8deadSopenharmony_ci                                  GL_TEXTURE_2D, color_tex, 0);
25905bd8deadSopenharmony_ci
25915bd8deadSopenharmony_ci        // initialize depth renderbuffer
25925bd8deadSopenharmony_ci        glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depth_rb);
25935bd8deadSopenharmony_ci        glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,
25945bd8deadSopenharmony_ci                                 GL_DEPTH_COMPONENT24, 512, 512);
25955bd8deadSopenharmony_ci        glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
25965bd8deadSopenharmony_ci                                     GL_DEPTH_ATTACHMENT_EXT,
25975bd8deadSopenharmony_ci                                     GL_RENDERBUFFER_EXT, depth_rb);
25985bd8deadSopenharmony_ci
25995bd8deadSopenharmony_ci        // Check framebuffer completeness at the end of initialization.
26005bd8deadSopenharmony_ci        CHECK_FRAMEBUFFER_STATUS();
26015bd8deadSopenharmony_ci
26025bd8deadSopenharmony_ci        loop {
26035bd8deadSopenharmony_ci            glBindTexture(GL_TEXTURE_2D, 0);
26045bd8deadSopenharmony_ci
26055bd8deadSopenharmony_ci            glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
26065bd8deadSopenharmony_ci            glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
26075bd8deadSopenharmony_ci                                      GL_COLOR_ATTACHMENT0_EXT,
26085bd8deadSopenharmony_ci                                      GL_TEXTURE_2D, color_tex, 0);
26095bd8deadSopenharmony_ci            glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
26105bd8deadSopenharmony_ci                                         GL_DEPTH_ATTACHMENT_EXT,
26115bd8deadSopenharmony_ci                                         GL_RENDERBUFFER_EXT, depth_rb);
26125bd8deadSopenharmony_ci
26135bd8deadSopenharmony_ci            <draw to the base level of the color texture>
26145bd8deadSopenharmony_ci
26155bd8deadSopenharmony_ci            // custom-generate successive mipmap levels
26165bd8deadSopenharmony_ci            glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
26175bd8deadSopenharmony_ci                                         GL_DEPTH_ATTACHMENT_EXT,
26185bd8deadSopenharmony_ci                                         GL_RENDERBUFFER_EXT, 0);
26195bd8deadSopenharmony_ci            glBindTexture(GL_TEXTURE_2D, color_tex);
26205bd8deadSopenharmony_ci            foreach (level > 0, in order of increasing values of level) {
26215bd8deadSopenharmony_ci                glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
26225bd8deadSopenharmony_ci                                          GL_COLOR_ATTACHMENT0_EXT,
26235bd8deadSopenharmony_ci                                          GL_TEXTURE_2D, color_tex, level);
26245bd8deadSopenharmony_ci                glTexParameteri(TEXTURE_2D, TEXTURE_BASE_LEVEL, level-1);
26255bd8deadSopenharmony_ci                glTexParameteri(TEXTURE_2D, TEXTURE_MAX_LEVEL, level-1);
26265bd8deadSopenharmony_ci
26275bd8deadSopenharmony_ci                <draw to level>
26285bd8deadSopenharmony_ci            }
26295bd8deadSopenharmony_ci            glTexParameteri(TEXTURE_2D, TEXTURE_BASE_LEVEL, 0);
26305bd8deadSopenharmony_ci            glTexParameteri(TEXTURE_2D, TEXTURE_MAX_LEVEL, max);
26315bd8deadSopenharmony_ci
26325bd8deadSopenharmony_ci            glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
26335bd8deadSopenharmony_ci            <draw to the window, reading from the color texture>
26345bd8deadSopenharmony_ci        }
26355bd8deadSopenharmony_ci
26365bd8deadSopenharmony_ci
26375bd8deadSopenharmony_ci    (6) Pseudo-code example of one method of responding to
26385bd8deadSopenharmony_ci        FRAMEBUFFER_UNSUPPORTED_EXT
26395bd8deadSopenharmony_ci
26405bd8deadSopenharmony_ci        bool done = false;
26415bd8deadSopenharmony_ci        bool success = false;
26425bd8deadSopenharmony_ci        int  configurationNumber = 0;
26435bd8deadSopenharmony_ci        GLenum status;
26445bd8deadSopenharmony_ci
26455bd8deadSopenharmony_ci        while (!done)
26465bd8deadSopenharmony_ci        {
26475bd8deadSopenharmony_ci            for (each framebuffer-attachable image)
26485bd8deadSopenharmony_ci            {
26495bd8deadSopenharmony_ci                ChooseInternalFormatForFramebufferAttachableImage(configurationNumber);
26505bd8deadSopenharmony_ci
26515bd8deadSopenharmony_ci                CreateFramebufferAttachableImage();
26525bd8deadSopenharmony_ci
26535bd8deadSopenharmony_ci                AttachFramebufferAttachableImageToFramebuffer();
26545bd8deadSopenharmony_ci            }
26555bd8deadSopenharmony_ci
26565bd8deadSopenharmony_ci            status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
26575bd8deadSopenharmony_ci            switch(status)
26585bd8deadSopenharmony_ci            {
26595bd8deadSopenharmony_ci                case GL_FRAMEBUFFER_COMPLETE_EXT:
26605bd8deadSopenharmony_ci                    success = true;
26615bd8deadSopenharmony_ci                    done = true;
26625bd8deadSopenharmony_ci                    break;
26635bd8deadSopenharmony_ci
26645bd8deadSopenharmony_ci                case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
26655bd8deadSopenharmony_ci                    if (configCount < MAX_NUM_CONFIGS_I_WANT_TO_TRY)
26665bd8deadSopenharmony_ci                    {
26675bd8deadSopenharmony_ci                        printf("current config not supported, trying again);
26685bd8deadSopenharmony_ci                        configurationNumber++;
26695bd8deadSopenharmony_ci                    }
26705bd8deadSopenharmony_ci                    else
26715bd8deadSopenharmony_ci                    {
26725bd8deadSopenharmony_ci                        printf("couldn't find a supported config\n");
26735bd8deadSopenharmony_ci                        success = false;
26745bd8deadSopenharmony_ci                        done = true;
26755bd8deadSopenharmony_ci                    }
26765bd8deadSopenharmony_ci                    break;
26775bd8deadSopenharmony_ci
26785bd8deadSopenharmony_ci                default:
26795bd8deadSopenharmony_ci                    // programming error; will fail on all hardware
26805bd8deadSopenharmony_ci                    FatalError();
26815bd8deadSopenharmony_ci                    exit(1);
26825bd8deadSopenharmony_ci            }
26835bd8deadSopenharmony_ci        }
26845bd8deadSopenharmony_ci
26855bd8deadSopenharmony_ci        if (!success)
26865bd8deadSopenharmony_ci        {
26875bd8deadSopenharmony_ci            printf("couldn't find a supported config\n");
26885bd8deadSopenharmony_ci            FatalError();
26895bd8deadSopenharmony_ci            exit(1);
26905bd8deadSopenharmony_ci        }
26915bd8deadSopenharmony_ci
26925bd8deadSopenharmony_ci        // Current framebuffer is supported and complete!!
26935bd8deadSopenharmony_ci        Draw();
26945bd8deadSopenharmony_ci
26955bd8deadSopenharmony_ci
26965bd8deadSopenharmony_ci    (7) Render to depth texture with no color attachments
26975bd8deadSopenharmony_ci
26985bd8deadSopenharmony_ci        // Given:  depth_tex - TEXTURE_2D depth texture object
26995bd8deadSopenharmony_ci        //         fb        - framebuffer object
27005bd8deadSopenharmony_ci
27015bd8deadSopenharmony_ci        // Enable render-to-texture
27025bd8deadSopenharmony_ci        glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
27035bd8deadSopenharmony_ci
27045bd8deadSopenharmony_ci        // Set up depth_tex for render-to-texture
27055bd8deadSopenharmony_ci        glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
27065bd8deadSopenharmony_ci                                  GL_DEPTH_ATTACHMENT_EXT,
27075bd8deadSopenharmony_ci                                  GL_TEXTURE_2D, depth_tex, 0);
27085bd8deadSopenharmony_ci
27095bd8deadSopenharmony_ci        // No color buffer to draw to or read from
27105bd8deadSopenharmony_ci        glDrawBuffer(GL_NONE);
27115bd8deadSopenharmony_ci        glReadBuffer(GL_NONE);
27125bd8deadSopenharmony_ci
27135bd8deadSopenharmony_ci        // Check framebuffer completeness at the end of initialization.
27145bd8deadSopenharmony_ci        CHECK_FRAMEBUFFER_STATUS();
27155bd8deadSopenharmony_ci
27165bd8deadSopenharmony_ci        <draw something>
27175bd8deadSopenharmony_ci
27185bd8deadSopenharmony_ci        // Re-enable rendering to the window
27195bd8deadSopenharmony_ci        glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
27205bd8deadSopenharmony_ci
27215bd8deadSopenharmony_ci        glBindTexture(GL_TEXTURE_2D, depth_tex);
27225bd8deadSopenharmony_ci        <draw to the window, reading from the depth_tex>
27235bd8deadSopenharmony_ci
27245bd8deadSopenharmony_ci    (8) FBO and ARB_draw_buffers
27255bd8deadSopenharmony_ci
27265bd8deadSopenharmony_ci        // Given: color_texA - TEXTURE_2D color texture object
27275bd8deadSopenharmony_ci        // Given: color_texB - TEXTURE_2D color texture object
27285bd8deadSopenharmony_ci        //        depth_rb   - GL_DEPTH renderbuffer object
27295bd8deadSopenharmony_ci        //        fb         - framebuffer object
27305bd8deadSopenharmony_ci
27315bd8deadSopenharmony_ci        // Set up the framebuffer object
27325bd8deadSopenharmony_ci        glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
27335bd8deadSopenharmony_ci        glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
27345bd8deadSopenharmony_ci                                  GL_COLOR_ATTACHMENT0_EXT,
27355bd8deadSopenharmony_ci                                  GL_TEXTURE_2D, color_texA, 0);
27365bd8deadSopenharmony_ci        glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
27375bd8deadSopenharmony_ci                                  GL_COLOR_ATTACHMENT1_EXT,
27385bd8deadSopenharmony_ci                                  GL_TEXTURE_2D, color_texB, 0);
27395bd8deadSopenharmony_ci        glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
27405bd8deadSopenharmony_ci                                     GL_DEPTH_ATTACHMENT_EXT,
27415bd8deadSopenharmony_ci                                     GL_RENDERBUFFER_EXT, depth_rb);
27425bd8deadSopenharmony_ci
27435bd8deadSopenharmony_ci        // Enable both attachments as draw buffers
27445bd8deadSopenharmony_ci        GLenum drawbuffers = {GL_COLOR_ATTACHMENT0_EXT,
27455bd8deadSopenharmony_ci                              GL_COLOR_ATTACHMENT1_EXT};
27465bd8deadSopenharmony_ci        glDrawBuffers(2, drawbuffers);
27475bd8deadSopenharmony_ci
27485bd8deadSopenharmony_ci        // Check framebuffer completeness at the end of initialization.
27495bd8deadSopenharmony_ci        CHECK_FRAMEBUFFER_STATUS();
27505bd8deadSopenharmony_ci
27515bd8deadSopenharmony_ci        // Enable fragment program that writes to both gl_FragData[0]
27525bd8deadSopenharmony_ci        // and gl_FragData[1]
27535bd8deadSopenharmony_ci
27545bd8deadSopenharmony_ci        <draw something>
27555bd8deadSopenharmony_ci
27565bd8deadSopenharmony_ci        // Disable fragment program
27575bd8deadSopenharmony_ci
27585bd8deadSopenharmony_ci        // Re-enable rendering to the window
27595bd8deadSopenharmony_ci        glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
27605bd8deadSopenharmony_ci
27615bd8deadSopenharmony_ci        // Bind both textures, each to a different texture unit
27625bd8deadSopenharmony_ci        glActiveTexture(GL_TEXTURE0);
27635bd8deadSopenharmony_ci        glBindTexture(GL_TEXTURE_2D, color_texA);
27645bd8deadSopenharmony_ci        glActiveTexture(GL_TEXTURE1);
27655bd8deadSopenharmony_ci        glBindTexture(GL_TEXTURE_2D, color_texB);
27665bd8deadSopenharmony_ci
27675bd8deadSopenharmony_ci        <draw to the window>
27685bd8deadSopenharmony_ci
27695bd8deadSopenharmony_ciIssues
27705bd8deadSopenharmony_ci
27715bd8deadSopenharmony_ci    (1)  We obviously won't call this "ARB_compromise_buffers", so
27725bd8deadSopenharmony_ci         what name should we use?
27735bd8deadSopenharmony_ci
27745bd8deadSopenharmony_ci            RESOLUTION: resolved, EXT_framebuffer_object
27755bd8deadSopenharmony_ci
27765bd8deadSopenharmony_ci            Possibilities considered include:
27775bd8deadSopenharmony_ci                EXT_framebuffer
27785bd8deadSopenharmony_ci                EXT_framebuffer_object
27795bd8deadSopenharmony_ci                EXT_renderable_buffers
27805bd8deadSopenharmony_ci                EXT_renderbuffer
27815bd8deadSopenharmony_ci                EXT_superbuffers (hah!)
27825bd8deadSopenharmony_ci                EXT_renderable_image
27835bd8deadSopenharmony_ci                EXT_render_image
27845bd8deadSopenharmony_ci
27855bd8deadSopenharmony_ci            The lead candidates were EXT_renderable_image and
27865bd8deadSopenharmony_ci            EXT_framebuffer_object Since this extension introduced both
27875bd8deadSopenharmony_ci            new concepts into OpenGL, this was a bit of a toss up.
27885bd8deadSopenharmony_ci            EXT_framebuffer_object was chosen based on a weak precedent
27895bd8deadSopenharmony_ci            given by EXT_texture_object and ARB_vertex_buffer_object
27905bd8deadSopenharmony_ci
27915bd8deadSopenharmony_ci    (2)  Many developers complain about the OpenGL/glX/WGL/agl pbuffer
27925bd8deadSopenharmony_ci         API, which they use both to do "render to texture" and to do
27935bd8deadSopenharmony_ci         general offscreen (non-windowed) accelerated rendering.  This
27945bd8deadSopenharmony_ci         extension is intended to subsume, some and perhaps all of, the
27955bd8deadSopenharmony_ci         functionality currently handled by pbuffers.  Should this
27965bd8deadSopenharmony_ci         extension (initially?) support only render-to-texture or should
27975bd8deadSopenharmony_ci         it try to provide an OpenGL API to fully replace the pbuffer
27985bd8deadSopenharmony_ci         API?
27995bd8deadSopenharmony_ci
28005bd8deadSopenharmony_ci            RESOLUTION:  This extension should fully replace the pbuffer API.
28015bd8deadSopenharmony_ci
28025bd8deadSopenharmony_ci            The implication of this decision is that this API should provide
28035bd8deadSopenharmony_ci            a way to support rendering to offscreen buffers that are not
28045bd8deadSopenharmony_ci            textures.
28055bd8deadSopenharmony_ci
28065bd8deadSopenharmony_ci    (3)  As a consequence of issue (2), this extension adds the concept of
28075bd8deadSopenharmony_ci         share-able, non-texturable renderable entitites that can be
28085bd8deadSopenharmony_ci         used as color buffers, depth buffers, stencil buffers, etc.
28095bd8deadSopenharmony_ci         The OpenGL spec refers to these entities as "logical buffers".
28105bd8deadSopenharmony_ci         What should this spec call them?
28115bd8deadSopenharmony_ci
28125bd8deadSopenharmony_ci            RESOLUTION: "renderbuffer", (one word)
28135bd8deadSopenharmony_ci
28145bd8deadSopenharmony_ci            We could just call them "logical buffers", but is there a
28155bd8deadSopenharmony_ci            better name?
28165bd8deadSopenharmony_ci
28175bd8deadSopenharmony_ci            The group considered:
28185bd8deadSopenharmony_ci            logical buffer  - possible, kind of general
28195bd8deadSopenharmony_ci            render buffer   - clear, (one word or two?)
28205bd8deadSopenharmony_ci            renderable      - clear, but may conflict with glx "drawable"
28215bd8deadSopenharmony_ci            drawable        - confusing: glx "drawable" == gl "framebuffer"
28225bd8deadSopenharmony_ci            render surface  - possible
28235bd8deadSopenharmony_ci            render target   - possible
28245bd8deadSopenharmony_ci            image buffer    - may get confused with Tex"Image"
28255bd8deadSopenharmony_ci            image           - may get confused with Tex"Image"
28265bd8deadSopenharmony_ci            surface buffer  - too verbose?
28275bd8deadSopenharmony_ci            surface         - too general
28285bd8deadSopenharmony_ci            others???
28295bd8deadSopenharmony_ci
28305bd8deadSopenharmony_ci            The group felt "render buffer " (or possibly "renderbuffer")
28315bd8deadSopenharmony_ci            provides for the clearest expression of the purpose for
28325bd8deadSopenharmony_ci            these buffers.
28335bd8deadSopenharmony_ci
28345bd8deadSopenharmony_ci            We finally decided on "renderbuffer" because we didn't want
28355bd8deadSopenharmony_ci            to use "render" as an adjective to describe a generic
28365bd8deadSopenharmony_ci            buffer, but rather decided to coin a new compound word to
28375bd8deadSopenharmony_ci            describe this concept.
28385bd8deadSopenharmony_ci
28395bd8deadSopenharmony_ci    (4)  How should the specification refer to the group of
28405bd8deadSopenharmony_ci         various types of objects that can be attached to the framebuffer
28415bd8deadSopenharmony_ci         attachment points?
28425bd8deadSopenharmony_ci
28435bd8deadSopenharmony_ci            RESOLUTION:  The specification will use the phrase
28445bd8deadSopenharmony_ci            "framebuffer-attachable images" to mean the 2D array of
28455bd8deadSopenharmony_ci            pixels (image) of a "renderbuffer", a "texture", or any
28465bd8deadSopenharmony_ci            other items that could be attached to a framebuffer.
28475bd8deadSopenharmony_ci
28485bd8deadSopenharmony_ci                Options considered include:
28495bd8deadSopenharmony_ci                  "render target"
28505bd8deadSopenharmony_ci                  "renderable image"
28515bd8deadSopenharmony_ci                  "framebuffer-attachable
28525bd8deadSopenharmony_ci
28535bd8deadSopenharmony_ci            Initially, we chose the phrase "render target" for this but
28545bd8deadSopenharmony_ci            felt it didn't accurately capture the concept of a 2D array
28555bd8deadSopenharmony_ci            of pixels that was simultaneously useable as the storage of
28565bd8deadSopenharmony_ci            a texture object and the destination of rendering.
28575bd8deadSopenharmony_ci
28585bd8deadSopenharmony_ci            We then tried to borrow the "image" language of OpenGL which
28595bd8deadSopenharmony_ci            describes texture's pixel arrays as "images" and we chose
28605bd8deadSopenharmony_ci            the term "renderable image".
28615bd8deadSopenharmony_ci
28625bd8deadSopenharmony_ci            However, in the end, we felt that the salient characteristic
28635bd8deadSopenharmony_ci            of these images was that we could attach them to a
28645bd8deadSopenharmony_ci            framebuffer and settled on the term "framebuffer-attachable
28655bd8deadSopenharmony_ci            image".
28665bd8deadSopenharmony_ci
28675bd8deadSopenharmony_ci    (5)  How should the specification refer to the places in a framebuffer
28685bd8deadSopenharmony_ci         that can hold a framebuffer-attachable image?
28695bd8deadSopenharmony_ci
28705bd8deadSopenharmony_ci            RESOLUTION: This state is called an "attachment point" of
28715bd8deadSopenharmony_ci            the framebuffer.
28725bd8deadSopenharmony_ci
28735bd8deadSopenharmony_ci            "attachment points" will be be used to describe the
28745bd8deadSopenharmony_ci            framebuffer state that holds a connection to a given
28755bd8deadSopenharmony_ci            framebuffer-attachable image (a renderbuffer image or a
28765bd8deadSopenharmony_ci            texture image). The framebuffer attachment points include
28775bd8deadSopenharmony_ci            the framebuffer's color buffers, stencil buffer, depth
28785bd8deadSopenharmony_ci            buffer, and aux buffer.
28795bd8deadSopenharmony_ci
28805bd8deadSopenharmony_ci            The word "attach" is being used to refer to connecting one
28815bd8deadSopenharmony_ci            object to another.  "bind" refers to connecting an object to
28825bd8deadSopenharmony_ci            the context state.  A texture image can be attached to a
28835bd8deadSopenharmony_ci            framebuffer object, but a framebuffer object is bound into
28845bd8deadSopenharmony_ci            the context state vector.
28855bd8deadSopenharmony_ci
28865bd8deadSopenharmony_ci    (6)  This extension adds the concept of collections of "logical
28875bd8deadSopenharmony_ci         buffers", to replace the window-system provided collection
28885bd8deadSopenharmony_ci         (drawable, or window) of logical buffers.  What should we call
28895bd8deadSopenharmony_ci         these?
28905bd8deadSopenharmony_ci
28915bd8deadSopenharmony_ci            RESOLUTION:  "framebuffer"
28925bd8deadSopenharmony_ci
28935bd8deadSopenharmony_ci            For the "collection of logical buffers" object, the group
28945bd8deadSopenharmony_ci            considered the names: "framebuffer", "renderTarget",
28955bd8deadSopenharmony_ci            "drawable".  We chose "framebuffer" since this is consistent
28965bd8deadSopenharmony_ci            with how the OpenGL specification already uses the word
28975bd8deadSopenharmony_ci            framebuffer.
28985bd8deadSopenharmony_ci
28995bd8deadSopenharmony_ci    (7)  This extension introduces two new object types into the OpenGL:
29005bd8deadSopenharmony_ci         renderbuffer objects and framebuffer objects.  For handling
29015bd8deadSopenharmony_ci         these objects, there are two main object manipulation
29025bd8deadSopenharmony_ci         methodology precedents to choose from:
29035bd8deadSopenharmony_ci
29045bd8deadSopenharmony_ci             1) "texture/program/vbo" object model:
29055bd8deadSopenharmony_ci                     app-supplied int handles,
29065bd8deadSopenharmony_ci                     Gen/is/Bind/Delete functions
29075bd8deadSopenharmony_ci
29085bd8deadSopenharmony_ci             2) "GLSL" object model:
29095bd8deadSopenharmony_ci                     driver-supplied GLhandle handles,
29105bd8deadSopenharmony_ci                     Create/Delete/Attach, etc
29115bd8deadSopenharmony_ci
29125bd8deadSopenharmony_ci         Which methodology should this extension use for each new object?
29135bd8deadSopenharmony_ci
29145bd8deadSopenharmony_ci             RESOLUTION: Use Option (1), "texture" object methodology,
29155bd8deadSopenharmony_ci             for both "renderbuffer" objects and framebuffer objects.
29165bd8deadSopenharmony_ci
29175bd8deadSopenharmony_ci             This is consistent with the June, 2004 ARB meeting vote to
29185bd8deadSopenharmony_ci             use the "texture" object methodlogy as the default object
29195bd8deadSopenharmony_ci             methodology.
29205bd8deadSopenharmony_ci
29215bd8deadSopenharmony_ci    (8)  Do we need separate framebuffer objects?
29225bd8deadSopenharmony_ci
29235bd8deadSopenharmony_ci            RESOLUTION: yes.
29245bd8deadSopenharmony_ci
29255bd8deadSopenharmony_ci            The framebuffer object is an object to encapsulate the state
29265bd8deadSopenharmony_ci            of the framebuffer and the collection of
29275bd8deadSopenharmony_ci            framebuffer-attachable images attached to the logical buffer
29285bd8deadSopenharmony_ci            attachment points.  A question was raised early on about
29295bd8deadSopenharmony_ci            whether we should have separate, shareable framebuffer
29305bd8deadSopenharmony_ci            objects or we should fold a single framebuffer "object"
29315bd8deadSopenharmony_ci            state vector into the context.
29325bd8deadSopenharmony_ci
29335bd8deadSopenharmony_ci            We decided to leave framebuffer objects in the API, with the
29345bd8deadSopenharmony_ci            understanding that we could easily remove them from the API
29355bd8deadSopenharmony_ci            and the spec later if a convincing case was argued for
29365bd8deadSopenharmony_ci            removing it.
29375bd8deadSopenharmony_ci
29385bd8deadSopenharmony_ci            There are several reasons why framebuffer objects were
29395bd8deadSopenharmony_ci            introduced:
29405bd8deadSopenharmony_ci
29415bd8deadSopenharmony_ci              FB1. It can be "expensive" (for some definition of
29425bd8deadSopenharmony_ci                   expensive) to validate the framebuffer and all its
29435bd8deadSopenharmony_ci                   attached objects.  There is a desire to be able to
29445bd8deadSopenharmony_ci                   easily recognize that a particular state. combination
29455bd8deadSopenharmony_ci                   has been seen and validated previously.
29465bd8deadSopenharmony_ci
29475bd8deadSopenharmony_ci              FB2. There is some subset of GL context state which only
29485bd8deadSopenharmony_ci                   makes sense in its relationship to the current
29495bd8deadSopenharmony_ci                   framebuffer and attached images (red bits, green
29505bd8deadSopenharmony_ci                   bits, blue bits, etc, presence or absence of aux
29515bd8deadSopenharmony_ci                   buffers or depth buffers, current value of draw
29525bd8deadSopenharmony_ci                   buffer(s), read buffer, etc. etc).  It would be nice
29535bd8deadSopenharmony_ci                   if this state "tracked" changes to the current
29545bd8deadSopenharmony_ci                   framebuffer configuration by being part of the
29555bd8deadSopenharmony_ci                   framebuffer object state.
29565bd8deadSopenharmony_ci
29575bd8deadSopenharmony_ci              FB3. For a while, we considered adding "intrinsic" or
29585bd8deadSopenharmony_ci                   "implicit" buffer storage to the framebuffer.  This
29595bd8deadSopenharmony_ci                   would be used for buffers that were either hidden
29605bd8deadSopenharmony_ci                   from the user, like the multisample buffer, or
29615bd8deadSopenharmony_ci                   perhaps needed to be explicitly formatted by the
29625bd8deadSopenharmony_ci                   driver.  If we did have this kind of "intrinsic"
29635bd8deadSopenharmony_ci                   storage, then framebuffers would be a lot like
29645bd8deadSopenharmony_ci                   textures and would have the same kinds of pressures
29655bd8deadSopenharmony_ci                   to minimize vram, sharing storage across objects and
29665bd8deadSopenharmony_ci                   contexts as textures did.  In fact, they would be
29675bd8deadSopenharmony_ci                   similar to cube map texture objects which had 6
29685bd8deadSopenharmony_ci                   attached face images, or mipmaped textures which had
29695bd8deadSopenharmony_ci                   a set of mipmap level images.  In the end we decided
29705bd8deadSopenharmony_ci                   not to use intrinsic buffers, - see issue (13) - but
29715bd8deadSopenharmony_ci                   we might decide to add them back in the future.  For
29725bd8deadSopenharmony_ci                   instance, one option for supporting multisampling is
29735bd8deadSopenharmony_ci                   to use an implicit multisample buffer.
29745bd8deadSopenharmony_ci
29755bd8deadSopenharmony_ci              FB4. We realized that most of the "hard" issues introduced
29765bd8deadSopenharmony_ci                   by this extension were completely orthogonal to the
29775bd8deadSopenharmony_ci                   presence or absence of framebuffer objects.  All of
29785bd8deadSopenharmony_ci                   the same issues apply regardless of whether there is
29795bd8deadSopenharmony_ci                   a single non-default framebuffer as part of the
29805bd8deadSopenharmony_ci                   context or multiple framebuffer objects.  These
29815bd8deadSopenharmony_ci                   issues about attaching, (binding) objects,
29825bd8deadSopenharmony_ci                   reformatting attached (or bound) images via
29835bd8deadSopenharmony_ci                   TexImage/RenderbufferStorage, pixel format
29845bd8deadSopenharmony_ci                   combinations, framebuffer completeness, and the
29855bd8deadSopenharmony_ci                   relationship between a non-"default" framebuffer and
29865bd8deadSopenharmony_ci                   the legacy window sytem framebuffer and pixel format
29875bd8deadSopenharmony_ci                   all come in to play either way.  So there is actually
29885bd8deadSopenharmony_ci                   little implementation or conceptual cost incurred by
29895bd8deadSopenharmony_ci                   the introduction of these framebuffer objects.
29905bd8deadSopenharmony_ci
29915bd8deadSopenharmony_ci            There were also a few reasons why we considered *not* adding
29925bd8deadSopenharmony_ci            framebuffer objects:
29935bd8deadSopenharmony_ci
29945bd8deadSopenharmony_ci              NoFB1. In the absence of "intrinsic" buffers, framebuffer
29955bd8deadSopenharmony_ci                     objects only really consist of the attachment
29965bd8deadSopenharmony_ci                     state.  It is convenient to encapsulate this state
29975bd8deadSopenharmony_ci                     into an object, but one could ask if it's any more
29985bd8deadSopenharmony_ci                     convenient than say a "blend state" object or a
29995bd8deadSopenharmony_ci                     "texture unit attachment state" object, which to
30005bd8deadSopenharmony_ci                     date, we have chosen not to add into OpenGL.
30015bd8deadSopenharmony_ci
30025bd8deadSopenharmony_ci              NoFB2. As a "state-only" object, there's a question about
30035bd8deadSopenharmony_ci                     how much state should be included - at least the
30045bd8deadSopenharmony_ci                     attachment state should be included, but what about
30055bd8deadSopenharmony_ci                     draw buffers state, what about the viewport state,
30065bd8deadSopenharmony_ci                     what about other state?  Since drawing the line is
30075bd8deadSopenharmony_ci                     hard, we questioned whether we needed these
30085bd8deadSopenharmony_ci                     objects.
30095bd8deadSopenharmony_ci
30105bd8deadSopenharmony_ci              NoFB3. Some amount of the functionality of the framebuffer
30115bd8deadSopenharmony_ci                     objects could be implemented by the application
30125bd8deadSopenharmony_ci                     with the appropriate use of display lists.
30135bd8deadSopenharmony_ci
30145bd8deadSopenharmony_ci            In weighing (FB1), expense of validating framebuffer state,
30155bd8deadSopenharmony_ci            versus (NoFB1), not wanting to introduce "state only"
30165bd8deadSopenharmony_ci            objects, we realized that framebuffer validation is more
30175bd8deadSopenharmony_ci            expensive than the blend state (for which there is no object
30185bd8deadSopenharmony_ci            in GL) and less expensive than a fragment program (for which
30195bd8deadSopenharmony_ci            there is an object in GL).  While it's not exactly clear
30205bd8deadSopenharmony_ci            precisely where on the spectrum of "expense" the framebuffer
30215bd8deadSopenharmony_ci            validation lies, we decided that it may be expensive enough
30225bd8deadSopenharmony_ci            to justify creating a new object type.  So we retained
30235bd8deadSopenharmony_ci            framebuffer objects in the API now, with the understanding
30245bd8deadSopenharmony_ci            that if we change our minds it's easier to rip them out
30255bd8deadSopenharmony_ci            later than it is to add them back in later.
30265bd8deadSopenharmony_ci
30275bd8deadSopenharmony_ci    (9)  Should the routine which allocates a renderbuffer accept an
30285bd8deadSopenharmony_ci         image to initialize the buffer, analogous to how TexImage
30295bd8deadSopenharmony_ci         works?
30305bd8deadSopenharmony_ci
30315bd8deadSopenharmony_ci            RESOLUTION: no, it should allocate uninitialized storage
30325bd8deadSopenharmony_ci
30335bd8deadSopenharmony_ci            We could have allowed a renderbuffer "image" specification
30345bd8deadSopenharmony_ci            routine, but this would essentially serve the same purpose
30355bd8deadSopenharmony_ci            as a combined "allocate renderbuffer followed by DrawPixels"
30365bd8deadSopenharmony_ci            routine so we decided it was extraneous.  The primary
30375bd8deadSopenharmony_ci            purpose of these buffers is to store rendered output anyway,
30385bd8deadSopenharmony_ci            so there was not sufficient demand to support an optimized
30395bd8deadSopenharmony_ci            path for data initialization. See related issue (10).
30405bd8deadSopenharmony_ci
30415bd8deadSopenharmony_ci    (10) What should we call the routine that allocates storage for the
30425bd8deadSopenharmony_ci         renderbuffer?  This routine would be the moral equivalent of
30435bd8deadSopenharmony_ci         glTexImage.
30445bd8deadSopenharmony_ci
30455bd8deadSopenharmony_ci            RESOLUTION: RenderbufferStorage()
30465bd8deadSopenharmony_ci
30475bd8deadSopenharmony_ci            Options included:
30485bd8deadSopenharmony_ci                RenderbufferStorage()
30495bd8deadSopenharmony_ci                RenderbufferImage()
30505bd8deadSopenharmony_ci                others???
30515bd8deadSopenharmony_ci
30525bd8deadSopenharmony_ci            This is really a function of how we resolve issue (9).
30535bd8deadSopenharmony_ci
30545bd8deadSopenharmony_ci            RenderbufferImage would be appropriate if the allocation
30555bd8deadSopenharmony_ci            routine could take an image to initialize the renderbuffer.
30565bd8deadSopenharmony_ci
30575bd8deadSopenharmony_ci            RenderbufferStorage would be more appropriate if the
30585bd8deadSopenharmony_ci            allocation routine does not take an image.
30595bd8deadSopenharmony_ci
30605bd8deadSopenharmony_ci            Since the group decided supporting an "initialization" image
30615bd8deadSopenharmony_ci            for a "renderbuffer" was too much overlapping functionality
30625bd8deadSopenharmony_ci            with DrawPixels, RenderbufferStorage was chosen.
30635bd8deadSopenharmony_ci
30645bd8deadSopenharmony_ci    (11) The routine(s) which attach a texture to a framebuffer
30655bd8deadSopenharmony_ci         attachment point need to describe which image in the texture
30665bd8deadSopenharmony_ci         they are using, i.e., which cube map face, mipmap level, or 3D
30675bd8deadSopenharmony_ci         texture z-slice/depthoffset/image.  Should we have one routine
30685bd8deadSopenharmony_ci         that handles all of these with some arguments ignored for
30695bd8deadSopenharmony_ci         specific texture types/targets?  Or should we have a parallel
30705bd8deadSopenharmony_ci         set of routines for 1D/2D/3D, like TexImage does?
30715bd8deadSopenharmony_ci
30725bd8deadSopenharmony_ci             RESOLUTION: Option (b) 3 routines for texture, 1 for
30735bd8deadSopenharmony_ci             renderbuffer
30745bd8deadSopenharmony_ci
30755bd8deadSopenharmony_ci                Originally, we chose option (b) for reasons of
30765bd8deadSopenharmony_ci                similarity to glTexImage1D/2D/3D.  For TexImage2D and
30775bd8deadSopenharmony_ci                FramebufferTexture2D, the texture target was used to
30785bd8deadSopenharmony_ci                select a face on a cube map texture object.  Since
30795bd8deadSopenharmony_ci                glTexImage1D/3D used TEXTURE_1D/TEXTURE_3D texture
30805bd8deadSopenharmony_ci                targets, we did the same for FramebufferTexture1D/3D. We
30815bd8deadSopenharmony_ci                also included the texture target in case it was needed
30825bd8deadSopenharmony_ci                for future expandability.
30835bd8deadSopenharmony_ci
30845bd8deadSopenharmony_ci                However, some felt uncomfortable with this resolution
30855bd8deadSopenharmony_ci                since it adds 3 framebuffer attachment calls for
30865bd8deadSopenharmony_ci                textures, so we reopened the issue.
30875bd8deadSopenharmony_ci
30885bd8deadSopenharmony_ci                Originally we just considered options (a) and (b).  We
30895bd8deadSopenharmony_ci                then reconsidered a few additional flavors: (c), (d),
30905bd8deadSopenharmony_ci                and (e)
30915bd8deadSopenharmony_ci
30925bd8deadSopenharmony_ci             Options include:
30935bd8deadSopenharmony_ci
30945bd8deadSopenharmony_ci             a) one routine with arguments that are sometimes "ignored"
30955bd8deadSopenharmony_ci
30965bd8deadSopenharmony_ci                For instance <image> is ignored for non-3D textures
30975bd8deadSopenharmony_ci                and <face> is ignored for non-cube maps, etc.
30985bd8deadSopenharmony_ci
30995bd8deadSopenharmony_ci                This gives us:
31005bd8deadSopenharmony_ci
31015bd8deadSopenharmony_ci                void FramebufferTexture(enum target, enum attachment,
31025bd8deadSopenharmony_ci                                        uint texture,
31035bd8deadSopenharmony_ci                                        uint level, enum face, uint image);
31045bd8deadSopenharmony_ci
31055bd8deadSopenharmony_ci             b) routines for 1D/2D/3D, use FramebufferTexture2D for 2D,
31065bd8deadSopenharmony_ci                Cube, Rectangle
31075bd8deadSopenharmony_ci
31085bd8deadSopenharmony_ci                Requires use of a texture target to distinguish cube map
31095bd8deadSopenharmony_ci                faces on FramebufferTexture2D
31105bd8deadSopenharmony_ci
31115bd8deadSopenharmony_ci                Includes "redundant" texture target for 1D/3D variants
31125bd8deadSopenharmony_ci                for consistency and precedent with TexImage1D/3D.
31135bd8deadSopenharmony_ci
31145bd8deadSopenharmony_ci                This gives us:
31155bd8deadSopenharmony_ci
31165bd8deadSopenharmony_ci                void FramebufferTexture1D(enum target, enum attachment,
31175bd8deadSopenharmony_ci                                          enum textarget, uint texture, uint level);
31185bd8deadSopenharmony_ci                void FramebufferTexture2D(enum target, enum attachment,
31195bd8deadSopenharmony_ci                                          enum textarget, uint texture, uint level);
31205bd8deadSopenharmony_ci                void FramebufferTexture3D(enum target, enum attachment,
31215bd8deadSopenharmony_ci                                          enum textarget, uint texture, uint level, uint image);
31225bd8deadSopenharmony_ci
31235bd8deadSopenharmony_ci            c) same as (b) but add a dedicated routine for Cubemaps
31245bd8deadSopenharmony_ci
31255bd8deadSopenharmony_ci               Question: since we added a Cubemap version, do we need a
31265bd8deadSopenharmony_ci               Rectangle variant as well?
31275bd8deadSopenharmony_ci
31285bd8deadSopenharmony_ci                This gives us:
31295bd8deadSopenharmony_ci
31305bd8deadSopenharmony_ci                void FramebufferTexture1D(enum target, enum attachment,
31315bd8deadSopenharmony_ci                                          enum textarget, uint texture, uint level);
31325bd8deadSopenharmony_ci                void FramebufferTexture2D(enum target, enum attachment,
31335bd8deadSopenharmony_ci                                          enum textarget, uint texture, uint level);
31345bd8deadSopenharmony_ci                void FramebufferTextureCubemap(enum target, enum attachment,
31355bd8deadSopenharmony_ci                                          enum textarget, uint texture, uint level);
31365bd8deadSopenharmony_ci                void FramebufferTexture3D(enum target, enum attachment,
31375bd8deadSopenharmony_ci                                          enum textarget, uint texture, uint level, uint image);
31385bd8deadSopenharmony_ci
31395bd8deadSopenharmony_ci
31405bd8deadSopenharmony_ci            d) same as (c) but with no texture target parameter
31415bd8deadSopenharmony_ci
31425bd8deadSopenharmony_ci               Question: since we added a Cubemap version, do we need a
31435bd8deadSopenharmony_ci               Rectangle variant as well?
31445bd8deadSopenharmony_ci
31455bd8deadSopenharmony_ci                This gives us:
31465bd8deadSopenharmony_ci
31475bd8deadSopenharmony_ci                void FramebufferTexture1D(enum target, enum attachment,
31485bd8deadSopenharmony_ci                                          uint texture, uint level);
31495bd8deadSopenharmony_ci                void FramebufferTexture2D(enum target, enum attachment,
31505bd8deadSopenharmony_ci                                          uint texture, uint level);
31515bd8deadSopenharmony_ci                void FramebufferTextureCubemap(enum target, enum attachment,
31525bd8deadSopenharmony_ci                                               uint texture, enum face, uint level);
31535bd8deadSopenharmony_ci                void FramebufferTexture3D(enum target, enum attachment,
31545bd8deadSopenharmony_ci                                          uint texture, uint level, uint image);
31555bd8deadSopenharmony_ci
31565bd8deadSopenharmony_ci
31575bd8deadSopenharmony_ci             e) one FramebufferTexture routine with additional arguments
31585bd8deadSopenharmony_ci                passed in via another routine.
31595bd8deadSopenharmony_ci
31605bd8deadSopenharmony_ci                There are no "ignored" arguments in this routine.
31615bd8deadSopenharmony_ci
31625bd8deadSopenharmony_ci                The arguments which would be "ignored" by this function
31635bd8deadSopenharmony_ci                are passed in as selector state by a separate function.
31645bd8deadSopenharmony_ci                These could be specified as a FramebufferParameter
31655bd8deadSopenharmony_ci                (implying that they are stored as framebuffer state), or
31665bd8deadSopenharmony_ci                as a piece of context state that is copied into the
31675bd8deadSopenharmony_ci                framebuffer attachment point at FramebufferTexture time.
31685bd8deadSopenharmony_ci                Of the two, context state is much more desirable since
31695bd8deadSopenharmony_ci                ARB_render_texture made the mistake of putting the
31705bd8deadSopenharmony_ci                selection state in the pbuffer, and this has real
31715bd8deadSopenharmony_ci                usability issues for multicontext applications.
31725bd8deadSopenharmony_ci
31735bd8deadSopenharmony_ci                This gives us (two routines)
31745bd8deadSopenharmony_ci
31755bd8deadSopenharmony_ci                void FramebufferTexture(enum target, enum attachment,
31765bd8deadSopenharmony_ci                                        uint texture, uint level);
31775bd8deadSopenharmony_ci                and
31785bd8deadSopenharmony_ci
31795bd8deadSopenharmony_ci                void FramebufferParameter(enum target, enum pname, uint param);
31805bd8deadSopenharmony_ci                    where pname can be one of
31815bd8deadSopenharmony_ci                        GL_{attachment}_TEXTURE_CUBEMAP_FACE
31825bd8deadSopenharmony_ci                        GL_{attachment}_TEXTURE_3D_IMAGE
31835bd8deadSopenharmony_ci                    and param represents the cube map face or z-slice image.
31845bd8deadSopenharmony_ci
31855bd8deadSopenharmony_ci                Also, option (e) raises 2 questions:
31865bd8deadSopenharmony_ci
31875bd8deadSopenharmony_ci                1. Since the rest of the selection state would come in
31885bd8deadSopenharmony_ci                   through another function, we have to ask when can
31895bd8deadSopenharmony_ci                   these selector state variables be changed?
31905bd8deadSopenharmony_ci
31915bd8deadSopenharmony_ci                   We had previously decided that we want to pass
31925bd8deadSopenharmony_ci                   selection state in atomically with the attachment
31935bd8deadSopenharmony_ci                   request.  To be consistent with this earlier
31945bd8deadSopenharmony_ci                   decision, this would imply that these variables could
31955bd8deadSopenharmony_ci                   not be changed dynamically but would be "snapshotted"
31965bd8deadSopenharmony_ci                   into the framebuffer attachment point at at
31975bd8deadSopenharmony_ci                   FramebufferTexture time.  This snapshot could be
31985bd8deadSopenharmony_ci                   thought of as similar to the way ActiveTexture works.
31995bd8deadSopenharmony_ci                   This is also similar to the snapshot of the
32005bd8deadSopenharmony_ci                   transformed raster pos vertex that occurs at
32015bd8deadSopenharmony_ci                   glRasterPos time.  It is a copy of one piece of state
32025bd8deadSopenharmony_ci                   into another piece of state, not just a "switch" than
32035bd8deadSopenharmony_ci                   can be updated later that indicates where other state
32045bd8deadSopenharmony_ci                   should be stored.
32055bd8deadSopenharmony_ci
32065bd8deadSopenharmony_ci                2. Is the rationale to consolidate FramebufferTexture
32075bd8deadSopenharmony_ci                   from 3 routines to 1 also a reason to consolidate
32085bd8deadSopenharmony_ci                   FramebufferTexture and FramebufferRenderbuffer into a
32095bd8deadSopenharmony_ci                   single attachment routine?  I.e., should there just
32105bd8deadSopenharmony_ci                   be one routine called FramebufferAttachableImage()?
32115bd8deadSopenharmony_ci
32125bd8deadSopenharmony_ci                   If we did this, then we could also move <level> out
32135bd8deadSopenharmony_ci                   of the argument list and rename the function to,
32145bd8deadSopenharmony_ci                   perhaps, FramebufferAttach.
32155bd8deadSopenharmony_ci
32165bd8deadSopenharmony_ci                       void FramebufferAttach(enum target, enum attachment,
32175bd8deadSopenharmony_ci                                              enum objectType, uint name);
32185bd8deadSopenharmony_ci                       and we'd need to create another enum for
32195bd8deadSopenharmony_ci                       FramebufferParameter
32205bd8deadSopenharmony_ci                           GL_{attachment}_TEXTURE_LEVEL
32215bd8deadSopenharmony_ci
32225bd8deadSopenharmony_ci                       or, avoiding the use of verbs in the function
32235bd8deadSopenharmony_ci                       name, perhaps:
32245bd8deadSopenharmony_ci
32255bd8deadSopenharmony_ci                       void FramebufferAttachableImage(enum target, enum attachment,
32265bd8deadSopenharmony_ci                                                       enum objectType, uint name);
32275bd8deadSopenharmony_ci
32285bd8deadSopenharmony_ci
32295bd8deadSopenharmony_ci            Rationale:
32305bd8deadSopenharmony_ci
32315bd8deadSopenharmony_ci            (a) was discarded because it was not very extensible in the
32325bd8deadSopenharmony_ci            event we need to add additional texture selection state in
32335bd8deadSopenharmony_ci            the future (for instance, what if we add TEXTURE_4D
32345bd8deadSopenharmony_ci            targets?)
32355bd8deadSopenharmony_ci
32365bd8deadSopenharmony_ci            (c) and (d) were discarded because the introduction of a
32375bd8deadSopenharmony_ci            special cubemap routine was undesirable since we were
32385bd8deadSopenharmony_ci            considering issue in an attempt to *reduce* the number of
32395bd8deadSopenharmony_ci            entry points.  Additionally, (d) was discarded because it
32405bd8deadSopenharmony_ci            was felt the texture targets were still required.
32415bd8deadSopenharmony_ci
32425bd8deadSopenharmony_ci            (e) was discarded because the intent was that attachment
32435bd8deadSopenharmony_ci            (and the consequent framebuffer validation) was a
32445bd8deadSopenharmony_ci            "heavy-weight" operation.  By using a separate routine to
32455bd8deadSopenharmony_ci            set part of the attachment state, developers may be
32465bd8deadSopenharmony_ci            incorrectly encouraged to assume some attachment state could
32475bd8deadSopenharmony_ci            be changed more easily than others.  It was felt it wasn't
32485bd8deadSopenharmony_ci            worth this possible misunderstanding just to save some
32495bd8deadSopenharmony_ci            function entry points.
32505bd8deadSopenharmony_ci
32515bd8deadSopenharmony_ci            In the end, it was determined that (b) was the lesser of two
32525bd8deadSopenharmony_ci            (five?) evils.  (b) also has precedent in the specification
32535bd8deadSopenharmony_ci            of texture images via gl{Copy}TexImage.  Finally, (b) is
32545bd8deadSopenharmony_ci            pretty clearly extensible to new attachment routines for
32555bd8deadSopenharmony_ci            future object types.
32565bd8deadSopenharmony_ci
32575bd8deadSopenharmony_ci
32585bd8deadSopenharmony_ci    (12) Do we need a "format group" or "format restriction" API?
32595bd8deadSopenharmony_ci
32605bd8deadSopenharmony_ci            RESOLUTION: Yes, but put it in a separate extension for
32615bd8deadSopenharmony_ci                        reasons of schedule.
32625bd8deadSopenharmony_ci
32635bd8deadSopenharmony_ci            This extension introduces the ability to construct a
32645bd8deadSopenharmony_ci            collection of logical buffers using images of various
32655bd8deadSopenharmony_ci            formats into a framebuffer in a very flexible manner.  It is
32665bd8deadSopenharmony_ci            by design more flexible than used to be possible to do by
32675bd8deadSopenharmony_ci            querying for available pixel formats in the window-system
32685bd8deadSopenharmony_ci            glX/WGL/agl API's.  As a result, it is possible to construct
32695bd8deadSopenharmony_ci            a framebuffer that is actually not supportable by the
32705bd8deadSopenharmony_ci            implementation and the reasons for the configuration being
32715bd8deadSopenharmony_ci            unsupportable are entirely implementation dependent.
32725bd8deadSopenharmony_ci
32735bd8deadSopenharmony_ci            This is why we originally added the CheckFramebufferStatus
32745bd8deadSopenharmony_ci            API.  So that the application at least has the ability to
32755bd8deadSopenharmony_ci            determine that a particular, otherwise legal, configuration
32765bd8deadSopenharmony_ci            of framebuffer attachments actually will not work on this
32775bd8deadSopenharmony_ci            implementation.
32785bd8deadSopenharmony_ci
32795bd8deadSopenharmony_ci            However, this extension does not provide any very helpful
32805bd8deadSopenharmony_ci            mechanism to find out why things are not supported or what
32815bd8deadSopenharmony_ci            to do to reconfigure the attachments into a supported
32825bd8deadSopenharmony_ci            configuration.
32835bd8deadSopenharmony_ci
32845bd8deadSopenharmony_ci            This is a very difficult problem to solve.  glX/WGL/agl
32855bd8deadSopenharmony_ci            solved this problem by allowing the application to specify a
32865bd8deadSopenharmony_ci            request for a configuration and letting implementation
32875bd8deadSopenharmony_ci            provide a "best match".  Additionally, glX and WGL also
32885bd8deadSopenharmony_ci            allow for the enumeration of all possible supported
32895bd8deadSopenharmony_ci            configurations.
32905bd8deadSopenharmony_ci
32915bd8deadSopenharmony_ci            Various schemes like these were considered but they were all
32925bd8deadSopenharmony_ci            quite complicated (possibly as complicated as the windowing
32935bd8deadSopenharmony_ci            system API's we are trying to replace).  Consequently, we
32945bd8deadSopenharmony_ci            decided to investigate some additional approaches.
32955bd8deadSopenharmony_ci
32965bd8deadSopenharmony_ci            One of these approaches is to specify "allocation and usage"
32975bd8deadSopenharmony_ci            hints prior to the routines which allocate buffers
32985bd8deadSopenharmony_ci            (TexImage/RenderbufferStorage) that will somehow indicate an
32995bd8deadSopenharmony_ci            intended configuration and then let the implementation use
33005bd8deadSopenharmony_ci            this additional information when selecting internal formats
33015bd8deadSopenharmony_ci            for textures and renderbuffers.  The GL already has the
33025bd8deadSopenharmony_ci            freedom to pick any internal format it wants for textures
33035bd8deadSopenharmony_ci            and renderbuffers (subject to invariance requirements), and
33045bd8deadSopenharmony_ci            so we would like to leverage this freedom and influence the
33055bd8deadSopenharmony_ci            choice with an additional channel of information.
33065bd8deadSopenharmony_ci
33075bd8deadSopenharmony_ci            One example, though not the only one, is some API to let the
33085bd8deadSopenharmony_ci            application specify it would like to be able to use a color
33095bd8deadSopenharmony_ci            buffer, depth, and stencil buffer.  The implementation would
33105bd8deadSopenharmony_ci            take advantage of this information when allocating textures
33115bd8deadSopenharmony_ci            and renderbuffers and only choose internal formats for
33125bd8deadSopenharmony_ci            color, depth, and stencil textures and renderbuffers that
33135bd8deadSopenharmony_ci            could be guaranteed to be used together.  For instance, the
33145bd8deadSopenharmony_ci            user could call:
33155bd8deadSopenharmony_ci
33165bd8deadSopenharmony_ci                FormatRestriction(GL_COLOR | GL_DEPTH | STENCIL);
33175bd8deadSopenharmony_ci
33185bd8deadSopenharmony_ci            or perhaps
33195bd8deadSopenharmony_ci
33205bd8deadSopenharmony_ci                FormatRestriction(GL_32_BITS_COLOR_DEPTH_STENCIL);
33215bd8deadSopenharmony_ci
33225bd8deadSopenharmony_ci            and then when the user called TexImage with a color buffer,
33235bd8deadSopenharmony_ci            the GL would only pick color formats that could definitely
33245bd8deadSopenharmony_ci            be used with depth and stencil buffers.  The effect of this
33255bd8deadSopenharmony_ci            API would be to "restrict" the avaible choices to the GL to
33265bd8deadSopenharmony_ci            the subset of compatible formats.  In this way, the
33275bd8deadSopenharmony_ci            possibility of encountering an implementation-dependent
33285bd8deadSopenharmony_ci            reason for failing "framebuffer completeness" would be
33295bd8deadSopenharmony_ci            greatly reduced or perhaps entirely eliminated.
33305bd8deadSopenharmony_ci
33315bd8deadSopenharmony_ci            In any event, specifying this "FormatRestriction" API was
33325bd8deadSopenharmony_ci            going to take additional time and we wished to get this base
33335bd8deadSopenharmony_ci            EXT_framebuffer_object specification done and shipping as
33345bd8deadSopenharmony_ci            soon as possible.  So we agreed to defer this "format
33355bd8deadSopenharmony_ci            restriction" API specification to a later extension, with
33365bd8deadSopenharmony_ci            the intent to develop this API or some other solution to
33375bd8deadSopenharmony_ci            this problem as soon as possible.
33385bd8deadSopenharmony_ci
33395bd8deadSopenharmony_ci    (13) Do we need intrinsic buffers in addition to renderbuffers?
33405bd8deadSopenharmony_ci
33415bd8deadSopenharmony_ci            RESOLUTION: no
33425bd8deadSopenharmony_ci
33435bd8deadSopenharmony_ci            When intrinsic buffers were initially proposed, the format
33445bd8deadSopenharmony_ci            and dimensions of an intrinsic buffer could mutate in order
33455bd8deadSopenharmony_ci            to provide compatibility with the other images attached to a
33465bd8deadSopenharmony_ci            framebuffer object.  After much debate and a series of
33475bd8deadSopenharmony_ci            votes, intrinsic buffers had lost both of those properties.
33485bd8deadSopenharmony_ci            (See issue 36.)  In the end the working group decided that
33495bd8deadSopenharmony_ci            the crippled form of intrinsic buffers do not provide enough
33505bd8deadSopenharmony_ci            added value to justify their existence.
33515bd8deadSopenharmony_ci
33525bd8deadSopenharmony_ci    (14) Is it necessary to require that all the logical buffers of a
33535bd8deadSopenharmony_ci         framebuffer object have the same dimensions?
33545bd8deadSopenharmony_ci
33555bd8deadSopenharmony_ci            RESOLUTION: Yes.  Matching dimensions are required for
33565bd8deadSopenharmony_ci            simplicity.  If the dimensions do not match, the framebuffer
33575bd8deadSopenharmony_ci            object will not be "framebuffer complete".
33585bd8deadSopenharmony_ci
33595bd8deadSopenharmony_ci            It could be useful to use a single large depth buffer when
33605bd8deadSopenharmony_ci            rendering to many textures of several different sizes.  This
33615bd8deadSopenharmony_ci            is something that could be added later by a layered
33625bd8deadSopenharmony_ci            extension that relaxes the matching dimension restriction.
33635bd8deadSopenharmony_ci            Supporting heterogeneous sized logical buffers requires
33645bd8deadSopenharmony_ci            defining where in a larger buffer the smaller results are
33655bd8deadSopenharmony_ci            written, and deciding what guarantees can be made and what
33665bd8deadSopenharmony_ci            should be left undefined.
33675bd8deadSopenharmony_ci
33685bd8deadSopenharmony_ci    (15) What happens when TexImage or CopyTexImage is called on a
33695bd8deadSopenharmony_ci         texture image that is attached as an image of the
33705bd8deadSopenharmony_ci         currently bound framebuffer object?
33715bd8deadSopenharmony_ci
33725bd8deadSopenharmony_ci            RESOLUTION: resolved, {Copy}TexImage will redefine the
33735bd8deadSopenharmony_ci            texture image, which can affect the completeness of the
33745bd8deadSopenharmony_ci            framebuffer to which it is attached, and possibly cause the
33755bd8deadSopenharmony_ci            currently bound framebuffer to start failing the framebuffer
33765bd8deadSopenharmony_ci            completeness test.
33775bd8deadSopenharmony_ci
33785bd8deadSopenharmony_ci            As far as {Copy}TexImage (or RenderbufferStorage) are
33795bd8deadSopenharmony_ci            concerned, there is nothing "special" about a texture image
33805bd8deadSopenharmony_ci            (or renderbuffer) attached to a framebuffer object. Attempts
33815bd8deadSopenharmony_ci            to redefine attached images in this manner should succeed.
33825bd8deadSopenharmony_ci            However, if the redefined image is no longer appropriate for
33835bd8deadSopenharmony_ci            the relevant attachment point in the framebuffer it is
33845bd8deadSopenharmony_ci            attached to, then it's possible the framebuffer may start
33855bd8deadSopenharmony_ci            failing the framebuffer completeness test.
33865bd8deadSopenharmony_ci
33875bd8deadSopenharmony_ci            Another option that was considered involved having TexImage
33885bd8deadSopenharmony_ci            and CopyTexImage result in INVALID_OPERATION and do nothing
33895bd8deadSopenharmony_ci            when the target texture is bound for render-to-texture. This
33905bd8deadSopenharmony_ci            idea was rejected because, in the multicontext case, one
33915bd8deadSopenharmony_ci            context could change the attachments of a shared framebuffer
33925bd8deadSopenharmony_ci            and cause another context to suddenly start generating
33935bd8deadSopenharmony_ci            errors on {Copy}TexImage calls.  This extension has tried to
33945bd8deadSopenharmony_ci            avoid introducing asynchronous generation of gl errors.
33955bd8deadSopenharmony_ci
33965bd8deadSopenharmony_ci            Still another option that was considered was "orphaning" the
33975bd8deadSopenharmony_ci            old texture memory such that it could still be used as a
33985bd8deadSopenharmony_ci            framebuffer attachment but the texture would get newly
33995bd8deadSopenharmony_ci            allocated storage.  However, this implied a side-ways copy
34005bd8deadSopenharmony_ci            of the texture object memory or the image for its continued
34015bd8deadSopenharmony_ci            use as a framebuffer-attachable image, and was therefore
34025bd8deadSopenharmony_ci            rejected.
34035bd8deadSopenharmony_ci
34045bd8deadSopenharmony_ci            For the purposes of comparison, consider that
34055bd8deadSopenharmony_ci            ARB_render_texture faced a similar question and resolved it
34065bd8deadSopenharmony_ci            by implicitly unbinding the texture from the pbuffer when
34075bd8deadSopenharmony_ci            TexImage is called.
34085bd8deadSopenharmony_ci
34095bd8deadSopenharmony_ci    (16) What happens when TexImage or CopyTexImage is called on a
34105bd8deadSopenharmony_ci         texture object that is attached as an image of a
34115bd8deadSopenharmony_ci         framebuffer object that is not bound to the current context?
34125bd8deadSopenharmony_ci
34135bd8deadSopenharmony_ci            RESOLUTION: resolved, {Copy}TexImage will redefine the
34145bd8deadSopenharmony_ci            texture image, which can affect the completeness of the
34155bd8deadSopenharmony_ci            framebuffer object to which it is attached.  When the
34165bd8deadSopenharmony_ci            framebuffer object is bound to the context, it may start
34175bd8deadSopenharmony_ci            failing the framebuffer completeness test.  If the
34185bd8deadSopenharmony_ci            framebuffer object is bound in another context at the time
34195bd8deadSopenharmony_ci            {Copy}TexImage is called, then the framebuffer object may
34205bd8deadSopenharmony_ci            start failing the framebuffer completeness test in the other
34215bd8deadSopenharmony_ci            context.
34225bd8deadSopenharmony_ci
34235bd8deadSopenharmony_ci            The rationale for this decision is the same as for issue
34245bd8deadSopenharmony_ci            (15).
34255bd8deadSopenharmony_ci
34265bd8deadSopenharmony_ci            However, since in this case the relevant framebuffer is not
34275bd8deadSopenharmony_ci            current, there is no guarantee that this framebuffer
34285bd8deadSopenharmony_ci            revalidation or invalidation will happen until the next time
34295bd8deadSopenharmony_ci            the framebuffer is bound to a context.
34305bd8deadSopenharmony_ci
34315bd8deadSopenharmony_ci            The texture (or renderbuffer) state is changed immediately,
34325bd8deadSopenharmony_ci            regardless of whether the texture image (or renderbuffer) is
34335bd8deadSopenharmony_ci            attached to a framebuffer object.  However, a context other
34345bd8deadSopenharmony_ci            than the one issuing the {Copy}TexImage operation might not
34355bd8deadSopenharmony_ci            notice the state change until after it has (re)bound the
34365bd8deadSopenharmony_ci            framebuffer object or reattached the texture image.
34375bd8deadSopenharmony_ci
34385bd8deadSopenharmony_ci            This is intended to be similar to what happens in the
34395bd8deadSopenharmony_ci            multicontext case when the state of a shared texture object
34405bd8deadSopenharmony_ci            is changed by another context.  There is no guarantee that
34415bd8deadSopenharmony_ci            texture state change will be visible in the current context
34425bd8deadSopenharmony_ci            until the current context binds the texture object again.
34435bd8deadSopenharmony_ci
34445bd8deadSopenharmony_ci    (17) Why is render to vertex array missing?
34455bd8deadSopenharmony_ci
34465bd8deadSopenharmony_ci            RESOLUTION: Render to vertex array is separate functionality
34475bd8deadSopenharmony_ci            from render to logical buffer or render to texture.  RTVA
34485bd8deadSopenharmony_ci            can be added as a separate extension.  The framework is
34495bd8deadSopenharmony_ci            general enough to support more than one way of adding RTVA,
34505bd8deadSopenharmony_ci            without deciding today on the details of a particular RTVA
34515bd8deadSopenharmony_ci            implementation.
34525bd8deadSopenharmony_ci
34535bd8deadSopenharmony_ci            One idea is to define a way to interpret a vertex array or
34545bd8deadSopenharmony_ci            buffer object, which is inherently byte-oriented linear, as
34555bd8deadSopenharmony_ci            a framebuffer, which is inherently component-oriented and
34565bd8deadSopenharmony_ci            dimensioned, and then call FramebufferArrayEXT like this:
34575bd8deadSopenharmony_ci
34585bd8deadSopenharmony_ci            FramebufferArrayEXT(FRAMEBUFFER_EXT, COLOR, buffer_obj);
34595bd8deadSopenharmony_ci
34605bd8deadSopenharmony_ci            Another idea is to define a general way to interpret a
34615bd8deadSopenharmony_ci            component-oriented dimensioned image, such as a texture or a
34625bd8deadSopenharmony_ci            color buffer, as a byte-oriented vertex stream.  Using this
34635bd8deadSopenharmony_ci            approach one would render vertex attributes to a
34645bd8deadSopenharmony_ci            renderbuffer, to a texture image, or to an AUX buffer, and
34655bd8deadSopenharmony_ci            then use the image data directly as a vertex array.
34665bd8deadSopenharmony_ci
34675bd8deadSopenharmony_ci            There is controversy over which RTVA method(s) should be
34685bd8deadSopenharmony_ci            supported.  One goal of EXT_framebuffer_object is to ship
34695bd8deadSopenharmony_ci            render-to-texture and render-to-logical-buffer functionality
34705bd8deadSopenharmony_ci            today while leaving the door open to add one or more RTVA
34715bd8deadSopenharmony_ci            solutions in the future.
34725bd8deadSopenharmony_ci
34735bd8deadSopenharmony_ci    (18) What function should perform the action of attaching a texture
34745bd8deadSopenharmony_ci         image to a framebuffer for rendering purposes?
34755bd8deadSopenharmony_ci
34765bd8deadSopenharmony_ci            RESOLUTION: The new FramebufferTexture*EXT functions perform
34775bd8deadSopenharmony_ci            this action.
34785bd8deadSopenharmony_ci
34795bd8deadSopenharmony_ci            Options that were considered include overloading
34805bd8deadSopenharmony_ci            BindTexture, using a FramebufferParameter function, and
34815bd8deadSopenharmony_ci            adding a new function.
34825bd8deadSopenharmony_ci
34835bd8deadSopenharmony_ci            BindTexture is problematic because it creates a new texture
34845bd8deadSopenharmony_ci            object with default state if the name is previously unused,
34855bd8deadSopenharmony_ci            but the default state has no dimensions, dimensionality, or
34865bd8deadSopenharmony_ci            format.
34875bd8deadSopenharmony_ci
34885bd8deadSopenharmony_ci            One reason that FramebufferTexture*EXT was well-received is
34895bd8deadSopenharmony_ci            because it sets, in one atomic operation, all framebuffer
34905bd8deadSopenharmony_ci            attachment state for both texture image and renderbuffer
34915bd8deadSopenharmony_ci            type of attachments.  Given the polymorphic nature of
34925bd8deadSopenharmony_ci            framebuffer-attachable images, this guarantees that all
34935bd8deadSopenharmony_ci            framebuffer attachment state is in a consistent
34945bd8deadSopenharmony_ci            configuration, without having to define confusing precedent
34955bd8deadSopenharmony_ci            rules between competing (texture image and renderbuffer)
34965bd8deadSopenharmony_ci            pieces of framebuffer attachment state, or having to create
34975bd8deadSopenharmony_ci            enables (either a tri-state enable or separate enables again
34985bd8deadSopenharmony_ci            with precedence) to select texture image or renderbuffer
34995bd8deadSopenharmony_ci            attachment state as the "active" set of state.
35005bd8deadSopenharmony_ci
35015bd8deadSopenharmony_ci            This decision also makes it simpler to specify how a
35025bd8deadSopenharmony_ci            framebuffer-attachable image is detached from a
35035bd8deadSopenharmony_ci            framebuffer--it would be confusing if detaching a texture
35045bd8deadSopenharmony_ci            image resulted in *attaching* a renderbuffer simply because
35055bd8deadSopenharmony_ci            texture image attachment state takes precedence over
35065bd8deadSopenharmony_ci            renderbuffer image attachment state.
35075bd8deadSopenharmony_ci
35085bd8deadSopenharmony_ci    (19) What should happen if the texture argument given to
35095bd8deadSopenharmony_ci         FramebufferTextureEXT is an unused texture name?  And
35105bd8deadSopenharmony_ci         similarly, what should happen if the renderbuffer argument
35115bd8deadSopenharmony_ci         given to FramebufferRenderbufferEXT is an unused renderbuffer
35125bd8deadSopenharmony_ci         name?
35135bd8deadSopenharmony_ci
35145bd8deadSopenharmony_ci            RESOLUTION:  resolved, (a) this is an error.
35155bd8deadSopenharmony_ci
35165bd8deadSopenharmony_ci            Options included:
35175bd8deadSopenharmony_ci
35185bd8deadSopenharmony_ci                a) throw an error at Framebuffer{Texture|Renderbuffer}
35195bd8deadSopenharmony_ci
35205bd8deadSopenharmony_ci                b) texture/renderbuffer is created just like
35215bd8deadSopenharmony_ci                   Bind{Texture|Renderbuffer}
35225bd8deadSopenharmony_ci
35235bd8deadSopenharmony_ci                c) no error, but the framebuffer cannot be "framebuffer
35245bd8deadSopenharmony_ci                   complete" until a texture/renderbuffer by that name
35255bd8deadSopenharmony_ci                   has been created and satisfies the rules of
35265bd8deadSopenharmony_ci                   framebuffer completeness.
35275bd8deadSopenharmony_ci
35285bd8deadSopenharmony_ci            This is interesting because on the one hand we might like to
35295bd8deadSopenharmony_ci            adopt the model that we simply catch all the invalid state
35305bd8deadSopenharmony_ci            combinations when determining framebuffer completeness,
35315bd8deadSopenharmony_ci            i.e., option (c).  This has a certain consistency but then
35325bd8deadSopenharmony_ci            what does it mean to call FramebufferTexture{1D|2D|3D} when
35335bd8deadSopenharmony_ci            the target of the texture name is not yet known?  How should
35345bd8deadSopenharmony_ci            the other arguments to those calls be validated?
35355bd8deadSopenharmony_ci
35365bd8deadSopenharmony_ci            Option (b) was rejected as it would introduce a second way
35375bd8deadSopenharmony_ci            to create a texture/renderbuffer object.  I.e., both
35385bd8deadSopenharmony_ci            BindTexture and FramebufferTexture would create the texture
35395bd8deadSopenharmony_ci            object.
35405bd8deadSopenharmony_ci
35415bd8deadSopenharmony_ci            Since there are "target aware" FramebufferTexture{1D|2D|3D}
35425bd8deadSopenharmony_ci            calls, the app already has to know the target prior to
35435bd8deadSopenharmony_ci            calling FramebufferTexture.  Also, the texture target of a
35445bd8deadSopenharmony_ci            given object is immutable once set.  An app can not set it
35455bd8deadSopenharmony_ci            and then change it later so this is really just an issue
35465bd8deadSopenharmony_ci            with the order in which they call the relevant functions.
35475bd8deadSopenharmony_ci            Consequently, requiring that the user call BindTexture prior
35485bd8deadSopenharmony_ci            to calling  FramebufferTexture does not seem to be a burden.
35495bd8deadSopenharmony_ci            So this should be an error, since it's probably a mistake on
35505bd8deadSopenharmony_ci            the user's part in the first place.
35515bd8deadSopenharmony_ci
35525bd8deadSopenharmony_ci    (20) What should happen if the texture argument given to
35535bd8deadSopenharmony_ci         FramebufferTextureEXT is the name of an existing texture
35545bd8deadSopenharmony_ci         object, but the texture has no texture image (i.e., TexImage
35555bd8deadSopenharmony_ci         has never been called)?  Similarly what should happen if the
35565bd8deadSopenharmony_ci         renderbuffer argument given to FramebufferRenderbufferEXT is
35575bd8deadSopenharmony_ci         the name of an existing renderbuffer, but the named
35585bd8deadSopenharmony_ci         renderbuffer has no storage (i.e., RenderbufferStorage has
35595bd8deadSopenharmony_ci         never been called?)
35605bd8deadSopenharmony_ci
35615bd8deadSopenharmony_ci            RESOLUTION: resolved, option (c) - no error, but the
35625bd8deadSopenharmony_ci            framebuffer object cannot be "framebuffer complete" until
35635bd8deadSopenharmony_ci            the state of the texture image satisfies the rules of
35645bd8deadSopenharmony_ci            framebuffer completeness.
35655bd8deadSopenharmony_ci
35665bd8deadSopenharmony_ci            Same options as issue (19), these include:
35675bd8deadSopenharmony_ci
35685bd8deadSopenharmony_ci                a) throw an error at Framebuffer{Texture|Renderbuffer}
35695bd8deadSopenharmony_ci
35705bd8deadSopenharmony_ci                b) texture/renderbuffer is created just like
35715bd8deadSopenharmony_ci                   Bind{Texture|Renderbuffer}
35725bd8deadSopenharmony_ci
35735bd8deadSopenharmony_ci                c) no error, but the framebuffer cannot be "framebuffer
35745bd8deadSopenharmony_ci                   complete" until the texture image or renderbuffer
35755bd8deadSopenharmony_ci                   satisfies the rules of framebuffer completeness.
35765bd8deadSopenharmony_ci
35775bd8deadSopenharmony_ci            This is an issue because you could be attempting to attach a
35785bd8deadSopenharmony_ci            texture (or renderbuffer) to a framebuffer attachment point
35795bd8deadSopenharmony_ci            prior to the application having called TexImage (or
35805bd8deadSopenharmony_ci            RenderbufferStorage) to define the width/height/format of
35815bd8deadSopenharmony_ci            the framebuffer-attachable image.
35825bd8deadSopenharmony_ci
35835bd8deadSopenharmony_ci            At first, this seems similar to issue (19), so we could
35845bd8deadSopenharmony_ci            throw an error in this case too.  It is different for two
35855bd8deadSopenharmony_ci            reasons however.  First, there are default values for the
35865bd8deadSopenharmony_ci            texture object and renderbuffer object state.  Second, the
35875bd8deadSopenharmony_ci            values of the width/height/format/etc for the texture object
35885bd8deadSopenharmony_ci            are mutable, unlike the texture target of the texture
35895bd8deadSopenharmony_ci            object.  There is really no difference between the case
35905bd8deadSopenharmony_ci            where GL uses the default values for an object, and the case
35915bd8deadSopenharmony_ci            where the user explictly set the state equivalent to the
35925bd8deadSopenharmony_ci            default values using TexImage (or RenderbufferStorage).
35935bd8deadSopenharmony_ci            Because this state is mutable, it must be tested anyway when
35945bd8deadSopenharmony_ci            framebuffer completeness is determined.
35955bd8deadSopenharmony_ci
35965bd8deadSopenharmony_ci            Therefore, we simply defer the check for whether the
35975bd8deadSopenharmony_ci            texture/renderbuffer state is appropriate for the
35985bd8deadSopenharmony_ci            framebuffer attachment point until determination of
35995bd8deadSopenharmony_ci            framebuffer completeness.  If the state is not valid, then
36005bd8deadSopenharmony_ci            the framebuffer will not be complete, regardless of whether
36015bd8deadSopenharmony_ci            or not TexImage/RenderbufferStorage has been used to create
36025bd8deadSopenharmony_ci            storage for the texture level (renderbuffer).
36035bd8deadSopenharmony_ci
36045bd8deadSopenharmony_ci    (21) What happens when DeleteTextures is called on a texture that is
36055bd8deadSopenharmony_ci         attached to a framebuffer object?  Similarly, what happens when
36065bd8deadSopenharmony_ci         DeleteRenderbuffers is called on a renderbuffer that is
36075bd8deadSopenharmony_ci         attached to a framebuffer object?
36085bd8deadSopenharmony_ci
36095bd8deadSopenharmony_ci            RESOLUTION: resolved, see issue (77)
36105bd8deadSopenharmony_ci
36115bd8deadSopenharmony_ci    (22) How do you detach a texture or renderbuffer from a framebuffer
36125bd8deadSopenharmony_ci         object?  Should we use two routines or create a detach routine?
36135bd8deadSopenharmony_ci
36145bd8deadSopenharmony_ci            RESOLUTION: resolved, 2 routines
36155bd8deadSopenharmony_ci
36165bd8deadSopenharmony_ci            If the user calls either FramebufferTexture with a zero
36175bd8deadSopenharmony_ci            texture name, or FramebufferRenderbuffer with a zero
36185bd8deadSopenharmony_ci            renderbuffer name, then the it as if nothing is attached to
36195bd8deadSopenharmony_ci            the specified attachment point.
36205bd8deadSopenharmony_ci
36215bd8deadSopenharmony_ci            There was a concern that having two routines be able to set
36225bd8deadSopenharmony_ci            the framebuffer attachment state to "none" was confusing.
36235bd8deadSopenharmony_ci            However, the idea is simply that for any object that can be
36245bd8deadSopenharmony_ci            attached to a framebuffer, there should be a routine that
36255bd8deadSopenharmony_ci            can set up the attachment and return the framebuffer to the
36265bd8deadSopenharmony_ci            default "nothing attached" state.
36275bd8deadSopenharmony_ci
36285bd8deadSopenharmony_ci            The implication here is that the default state for
36295bd8deadSopenharmony_ci            framebuffer attachments is:
36305bd8deadSopenharmony_ci                attachment object type = GL_NONE, and
36315bd8deadSopenharmony_ci                attached object name   = 0
36325bd8deadSopenharmony_ci
36335bd8deadSopenharmony_ci    (23) Should it be legal for the framebuffer state to pass through
36345bd8deadSopenharmony_ci         invalid configurations?  (I.e., depth and color buffer sizes
36355bd8deadSopenharmony_ci         don't match, etc)
36365bd8deadSopenharmony_ci
36375bd8deadSopenharmony_ci            RESOLUTION: resolved, "yes"
36385bd8deadSopenharmony_ci
36395bd8deadSopenharmony_ci            It's easier for the application if the render target state
36405bd8deadSopenharmony_ci            is allowed to pass through invalid configurations when
36415bd8deadSopenharmony_ci            transitioning between two valid configurations.  A
36425bd8deadSopenharmony_ci            consistency check is defined to determine if a configuration
36435bd8deadSopenharmony_ci            is valid.
36445bd8deadSopenharmony_ci
36455bd8deadSopenharmony_ci            As long as everything is valid at render time, transient
36465bd8deadSopenharmony_ci            invalid states are allowed.
36475bd8deadSopenharmony_ci
36485bd8deadSopenharmony_ci    (24) What happens when you try to draw to a framebuffer that
36495bd8deadSopenharmony_ci         is not "framebuffer complete"?
36505bd8deadSopenharmony_ci
36515bd8deadSopenharmony_ci            RESOLUTION: resolved, rendering is disabled, and an error is
36525bd8deadSopenharmony_ci            generated.  See issue (64) as this issue is essentially a
36535bd8deadSopenharmony_ci            duplicate of that one.
36545bd8deadSopenharmony_ci
36555bd8deadSopenharmony_ci    (25) What should happen on a query of framebuffer state while the
36565bd8deadSopenharmony_ci         framebuffer is invalid?  For instance, what does a query of
36575bd8deadSopenharmony_ci         RED_BITS return if the currently bound framebuffer is not
36585bd8deadSopenharmony_ci         "framebuffer complete"?
36595bd8deadSopenharmony_ci
36605bd8deadSopenharmony_ci            RESOLUTION: resolved, there's no issue here.  Attempts to
36615bd8deadSopenharmony_ci            query bit depths should return the "real" answers.
36625bd8deadSopenharmony_ci
36635bd8deadSopenharmony_ci            For instance, if there's no color buffer attached to the
36645bd8deadSopenharmony_ci            framebuffer attachment point, then attempts to return
36655bd8deadSopenharmony_ci            RED_BITS could return zero.  If there is a color-renderable
36665bd8deadSopenharmony_ci            image attached, then RED_BITS would return whatever the
36675bd8deadSopenharmony_ci            RED_BITS are, regardless of the valid/invalid state of the
36685bd8deadSopenharmony_ci            framebuffer.
36695bd8deadSopenharmony_ci
36705bd8deadSopenharmony_ci            Other options include returning some kind of magic value or
36715bd8deadSopenharmony_ci            generating an error if the framebuffer is invalid.  However,
36725bd8deadSopenharmony_ci            any "magic value" would simply be a duplicated query for the
36735bd8deadSopenharmony_ci            framebuffer completeness status.  Also, returning an error
36745bd8deadSopenharmony_ci            would be problematic because another context can make a
36755bd8deadSopenharmony_ci            framebuffer invalid and we have been trying to avoid any API
36765bd8deadSopenharmony_ci            in which one context can cause another context to start
36775bd8deadSopenharmony_ci            generating errors asynchronously.
36785bd8deadSopenharmony_ci
36795bd8deadSopenharmony_ci    (26) What happens when you try to read (e.g. ReadPixels) from a
36805bd8deadSopenharmony_ci         framebuffer that is not "framebuffer complete"?  Reads cannot
36815bd8deadSopenharmony_ci         be "disabled" or "ignored" in the same way that rendering can.
36825bd8deadSopenharmony_ci
36835bd8deadSopenharmony_ci            RESOLUTION: resolved, generate a GL error.  See issue (65).
36845bd8deadSopenharmony_ci
36855bd8deadSopenharmony_ci            Originally this was resolved as "undefined pixels are
36865bd8deadSopenharmony_ci            generated, but no error"
36875bd8deadSopenharmony_ci
36885bd8deadSopenharmony_ci            Initially, generating an error was rejected for a few
36895bd8deadSopenharmony_ci            reasons.  First, it is asymmetric with the behavior for
36905bd8deadSopenharmony_ci            drawing - when the framebuffer is not complete, drawing is
36915bd8deadSopenharmony_ci            disabled.  We would like to be consistent here.  Second,
36925bd8deadSopenharmony_ci            there are no other cases where ReadPixels or
36935bd8deadSopenharmony_ci            CopyTex{Sub}Image will generate an error based on the state
36945bd8deadSopenharmony_ci            of the framebuffer and we didn't want to introduce one.
36955bd8deadSopenharmony_ci            Third, there is already a pixel ownership requirement in
36965bd8deadSopenharmony_ci            order to get defined results back from reading the
36975bd8deadSopenharmony_ci            framebuffer, so if we simply behave as if incomplete
36985bd8deadSopenharmony_ci            framebuffer fails ths pixel ownership test, then we can
36995bd8deadSopenharmony_ci            leverage that already specified behavior for reading the
37005bd8deadSopenharmony_ci            framebuffer.
37015bd8deadSopenharmony_ci
37025bd8deadSopenharmony_ci            For these reasons, we initially choose to have reads from an
37035bd8deadSopenharmony_ci            incomplete framebuffer return undefined pixel values and not
37045bd8deadSopenharmony_ci            generate a GL error.
37055bd8deadSopenharmony_ci
37065bd8deadSopenharmony_ci            However, once we subsequntly resolved issue (64) to say that
37075bd8deadSopenharmony_ci            rendering with an incomplete framebuffer generates an error,
37085bd8deadSopenharmony_ci            we decided again for reasons of symmetry that reading from
37095bd8deadSopenharmony_ci            an incomplete framebuffer should also generate an error.
37105bd8deadSopenharmony_ci            (And most likely the same error.)
37115bd8deadSopenharmony_ci
37125bd8deadSopenharmony_ci            So in the end, we decided that reads (e.g., ReadPixels and
37135bd8deadSopenharmony_ci            CopyTex{Sub}Image) in this case would result in an error to
37145bd8deadSopenharmony_ci            be named in issue (65).
37155bd8deadSopenharmony_ci
37165bd8deadSopenharmony_ci            See also related issue (73), describing ReadPixels of color
37175bd8deadSopenharmony_ci            data from a complete framebuffer while READ_BUFFER is NONE.
37185bd8deadSopenharmony_ci
37195bd8deadSopenharmony_ci    (27) What happens when you query the number of bits per channel
37205bd8deadSopenharmony_ci         (e.g., DEPTH_BITS) prior to the consistency check being run
37215bd8deadSopenharmony_ci         when intrinsic buffers are in use, since implementations are
37225bd8deadSopenharmony_ci         allowed to select a number of bits for an intrinsic buffer at
37235bd8deadSopenharmony_ci         consistency check time to give a better chance of a consistent
37245bd8deadSopenharmony_ci         state being reached?
37255bd8deadSopenharmony_ci
37265bd8deadSopenharmony_ci            RESOLUTION: This is not an issue since we don't have
37275bd8deadSopenharmony_ci            intrinsic buffers, see issue (13).  We are keeping this
37285bd8deadSopenharmony_ci            issue in the issues list just in case we ever go back and
37295bd8deadSopenharmony_ci            add something like this to a future API.
37305bd8deadSopenharmony_ci
37315bd8deadSopenharmony_ci            If we would have retained the intrinsic buffer api (i.e.,
37325bd8deadSopenharmony_ci            glFramebufferStorage) or if some future API adds it back in,
37335bd8deadSopenharmony_ci            then one possible resolution of this problem would have been
37345bd8deadSopenharmony_ci            to simply say that a query of the number of bits prior to
37355bd8deadSopenharmony_ci            the consistency check being run will produce an answer that
37365bd8deadSopenharmony_ci            is subject to change.
37375bd8deadSopenharmony_ci
37385bd8deadSopenharmony_ci            This is preferable to some other possible resolutions that
37395bd8deadSopenharmony_ci            have been discussed (e.g., having the query cause a
37405bd8deadSopenharmony_ci            validation to occur implicitly, thereby "baking" in the
37415bd8deadSopenharmony_ci            answer) because it is the one least likely to introduce
37425bd8deadSopenharmony_ci            unexpected side-effects to an operation as seemingly
37435bd8deadSopenharmony_ci            innocuous as a query.
37445bd8deadSopenharmony_ci
37455bd8deadSopenharmony_ci            A possible variant of this proposed resolution would have
37465bd8deadSopenharmony_ci            been to have the query return a number of bits that is
37475bd8deadSopenharmony_ci            guaranteed to be less than or equal to the actual number of
37485bd8deadSopenharmony_ci            bits that will eventually be used.  This may or may not be a
37495bd8deadSopenharmony_ci            useful guarantee.  We could have also had the query return 0
37505bd8deadSopenharmony_ci            or -1 as a signal that the framebuffer is incomplete.
37515bd8deadSopenharmony_ci
37525bd8deadSopenharmony_ci            Again, this is all moot since we decided against this style
37535bd8deadSopenharmony_ci            of intrinsic buffers in this extension.
37545bd8deadSopenharmony_ci
37555bd8deadSopenharmony_ci    (28) What should the <image> parameter to FramebufferTexture3DEXT
37565bd8deadSopenharmony_ci         actually be called?
37575bd8deadSopenharmony_ci
37585bd8deadSopenharmony_ci            RESOLUTION: resolved, "zoffset"
37595bd8deadSopenharmony_ci
37605bd8deadSopenharmony_ci           This parameter could have been called <image> or <slice>.
37615bd8deadSopenharmony_ci           <depth> or <zoffset> might also be appropriate.  The reason
37625bd8deadSopenharmony_ci           the answer here is non-obvious is that normally 3D textures
37635bd8deadSopenharmony_ci           are specified all at once, not one 2D "slice" at a time
37645bd8deadSopenharmony_ci           (TexImage3D takes one big array that represents all three
37655bd8deadSopenharmony_ci           dimensions at once, for example), and because texture
37665bd8deadSopenharmony_ci           coordinates for TEXTURE_3D targets are normalized
37675bd8deadSopenharmony_ci           floating-point numbers, just as they are with TEXTURE_2D
37685bd8deadSopenharmony_ci           targets, not integer indices.
37695bd8deadSopenharmony_ci
37705bd8deadSopenharmony_ci           The GL uses the term "image" to mean "slice" in a few
37715bd8deadSopenharmony_ci           instances.  For example, pixel unpack parameters
37725bd8deadSopenharmony_ci           UNPACK_SKIP_IMAGE and UNPACK_IMAGE_HEIGHT describe state
37735bd8deadSopenharmony_ci           related to the "slices" a 3d texture.
37745bd8deadSopenharmony_ci
37755bd8deadSopenharmony_ci           However, in some ways the act of rendering into a texture is
37765bd8deadSopenharmony_ci           most similar to CopyTexSubImage3D, which also redefines a
37775bd8deadSopenharmony_ci           texture's contents (but never its format or dimensions) based
37785bd8deadSopenharmony_ci           on the contents of the framebuffer.  The "zoffset" parameter
37795bd8deadSopenharmony_ci           to CopyTexSubImage selects a particular 2D image (depth
37805bd8deadSopenharmony_ci           "slice") of a 3-dimensional texture.  "zoffset" is a
37815bd8deadSopenharmony_ci           coordinate, and the parameter to FramebufferTexture3DEXT is
37825bd8deadSopenharmony_ci           also a coordinate.  "Image" typically refers to an array of
37835bd8deadSopenharmony_ci           pixels.
37845bd8deadSopenharmony_ci
37855bd8deadSopenharmony_ci           We already use the term "image" throughout this extension to
37865bd8deadSopenharmony_ci           talk about 2d arrays of pixels beyond their use in 3D
37875bd8deadSopenharmony_ci           textures.  It is a little confusing to overload "image" to
37885bd8deadSopenharmony_ci           also mean Z coordinate in FramebufferTexture3DEXT.
37895bd8deadSopenharmony_ci
37905bd8deadSopenharmony_ci           For the sum of these reasons, we decided "zoffset" is a
37915bd8deadSopenharmony_ci           better name than "image", for the parameter to
37925bd8deadSopenharmony_ci           FramebufferTexture3DEXT.
37935bd8deadSopenharmony_ci
37945bd8deadSopenharmony_ci    (29) Should GenerateMipmap functionality be included in this
37955bd8deadSopenharmony_ci         extension or put in it's own extension?
37965bd8deadSopenharmony_ci
37975bd8deadSopenharmony_ci            RESOLUTION: resolved, yes, include this functionality
37985bd8deadSopenharmony_ci
37995bd8deadSopenharmony_ci            It is arguably useful separately, i.e., without all this
38005bd8deadSopenharmony_ci            machinery.  However, it's also kind of required here to have
38015bd8deadSopenharmony_ci            some kind of way to deal with the interaction with
38025bd8deadSopenharmony_ci            SGIS_generate_mipmap.  Probably we should just include it
38035bd8deadSopenharmony_ci            here.  (maybe also a separate extension?)
38045bd8deadSopenharmony_ci
38055bd8deadSopenharmony_ci            It's easier to define when automatic mipmap generation
38065bd8deadSopenharmony_ci            happens for a traditional non-rendered texture than it is
38075bd8deadSopenharmony_ci            for a texture that is modified by rendering-to-texture.  If
38085bd8deadSopenharmony_ci            GENERATE_MIPMAP were to cause a rendered-texture's mipmaps
38095bd8deadSopenharmony_ci            to be automatically generated, presumably generation would
38105bd8deadSopenharmony_ci            occur when either the texture is detached from the
38115bd8deadSopenharmony_ci            framebuffer or when the framebuffer is unbound.  If neither
38125bd8deadSopenharmony_ci            of these events occur, should automatic mipmap generation
38135bd8deadSopenharmony_ci            also occur when the texture is bound to a texture unit (of
38145bd8deadSopenharmony_ci            same or different context?)
38155bd8deadSopenharmony_ci
38165bd8deadSopenharmony_ci            It's believed the recommended way of achieving maximum
38175bd8deadSopenharmony_ci            performance using this extension is to make all attachments
38185bd8deadSopenharmony_ci            during initialization, and then not change attachments in
38195bd8deadSopenharmony_ci            the steady state.  This reasoning is, after all, a major
38205bd8deadSopenharmony_ci            reason for introducing framebuffer objects.  If an
38215bd8deadSopenharmony_ci            application does not detach textures from framebuffers, then
38225bd8deadSopenharmony_ci            what event triggers mipmap generation?  An explicit
38235bd8deadSopenharmony_ci            GenerateMipmap works well here.
38245bd8deadSopenharmony_ci
38255bd8deadSopenharmony_ci            Would the base level have to actually be modified in order
38265bd8deadSopenharmony_ci            for mipmap generation to occur?  How should "modified" be
38275bd8deadSopenharmony_ci            defined?
38285bd8deadSopenharmony_ci
38295bd8deadSopenharmony_ci            If the application rendered to each level of the texture
38305bd8deadSopenharmony_ci            before detaching the texture or unbinding the framebuffer,
38315bd8deadSopenharmony_ci            would automatic mipmap generation happen anyway?  (This
38325bd8deadSopenharmony_ci            implies the application needs to set GENERATE_MIPMAP to
38335bd8deadSopenharmony_ci            FALSE before rendering to the texture, but maybe that's OK.)
38345bd8deadSopenharmony_ci
38355bd8deadSopenharmony_ci            Historical background: One reason for introducing
38365bd8deadSopenharmony_ci            GenerateMipmap in the context of the original uber_buffers
38375bd8deadSopenharmony_ci            proposal was that uber_buffers lacked a Begin-time
38385bd8deadSopenharmony_ci            consistency check, but instead prevented the framebuffer
38395bd8deadSopenharmony_ci            from ever getting into an inconsistent state (once
38405bd8deadSopenharmony_ci            validated).  Operations such as TexImage that can change the
38415bd8deadSopenharmony_ci            dimensions and format of a tetxture's levels were disallowed
38425bd8deadSopenharmony_ci            when the texture was attached to a framebuffer.  Since
38435bd8deadSopenharmony_ci            automatic mipmap generation can change the dimensions and
38445bd8deadSopenharmony_ci            format of a texture's levels, that meant that automatic
38455bd8deadSopenharmony_ci            mipmap generation could not be performed in some cases, but
38465bd8deadSopenharmony_ci            there was no good way to communicate this error to the
38475bd8deadSopenharmony_ci            application.  Hence there really was a need for a separate
38485bd8deadSopenharmony_ci            GenerateMipmap function.  This restriction does not apply
38495bd8deadSopenharmony_ci            to the current API because the semantics of an incomplete
38505bd8deadSopenharmony_ci            framebuffer are different now.  Nevertheless, we decided to
38515bd8deadSopenharmony_ci            retain this manual mipmap generation as part of this
38525bd8deadSopenharmony_ci            extension.
38535bd8deadSopenharmony_ci
38545bd8deadSopenharmony_ci    (30) Do the calls to deal with renderbuffers need a target
38555bd8deadSopenharmony_ci         parameter?  It seems unlikely this will be used for anything.
38565bd8deadSopenharmony_ci
38575bd8deadSopenharmony_ci            RESOLUTION: resolved, yes
38585bd8deadSopenharmony_ci
38595bd8deadSopenharmony_ci            Whether we call it a "target" or not, there is *some* piece
38605bd8deadSopenharmony_ci            of state in the context to hold the current renderbuffer
38615bd8deadSopenharmony_ci            binding.  This is required so that we can call routines like
38625bd8deadSopenharmony_ci            RenderbufferStorage and {Get}RenderbufferParameter() without
38635bd8deadSopenharmony_ci            passing in an object name.  It is also possible we may
38645bd8deadSopenharmony_ci            decide to use the renderbuffer target parameter to
38655bd8deadSopenharmony_ci            distinguish between multisample and non multisample buffers.
38665bd8deadSopenharmony_ci            Given those reasons, the precedent of texture objects, and
38675bd8deadSopenharmony_ci            the possibility we may come up with some other renderbuffer
38685bd8deadSopenharmony_ci            target types in the future, it seems prudent and not all
38695bd8deadSopenharmony_ci            that costly to just include the target type now.
38705bd8deadSopenharmony_ci
38715bd8deadSopenharmony_ci    (31) What should happen if you call FramebufferTexture{1D|2D|3D}
38725bd8deadSopenharmony_ci         with a texture name of zero?
38735bd8deadSopenharmony_ci
38745bd8deadSopenharmony_ci            RESOLUTION:  This will detach the image from the specified
38755bd8deadSopenharmony_ci            attachment point in the currently bound framebuffer object.
38765bd8deadSopenharmony_ci
38775bd8deadSopenharmony_ci            For reference, this reason this is problematic because there
38785bd8deadSopenharmony_ci            is not really a "texture object zero"
38795bd8deadSopenharmony_ci
38805bd8deadSopenharmony_ci            Texture name zero does not define an object but defines
38815bd8deadSopenharmony_ci            context state (one texture named zero, per target, per
38825bd8deadSopenharmony_ci            context).  The textures referred to by the name zero are
38835bd8deadSopenharmony_ci            never shared across contexts.  So the behavior of
38845bd8deadSopenharmony_ci            framebuffer objects shared by multiple contexts where each
38855bd8deadSopenharmony_ci            is attached to the context's texture named zero seems odd at
38865bd8deadSopenharmony_ci            best, and confusing at worst.  As such, it was decided to
38875bd8deadSopenharmony_ci            not allow a framebuffer to attach to texture named zero.
38885bd8deadSopenharmony_ci
38895bd8deadSopenharmony_ci            Another option would have been to make this an error.  If we
38905bd8deadSopenharmony_ci            had done this, then we would need a specific function to
38915bd8deadSopenharmony_ci            detach a texture from an attachment point.  That is, we
38925bd8deadSopenharmony_ci            would have needed to create something like a dedicated
38935bd8deadSopenharmony_ci            DetachFramebufferAttachableImage() entry point.
38945bd8deadSopenharmony_ci
38955bd8deadSopenharmony_ci    (32) Should there be a renderbuffer object with the name of zero?
38965bd8deadSopenharmony_ci
38975bd8deadSopenharmony_ci            RESOLUTION:  NO.
38985bd8deadSopenharmony_ci
38995bd8deadSopenharmony_ci            By way of symmetry with textures, renderbuffer zero, if it
39005bd8deadSopenharmony_ci            existed, would not be an object.  It would be a
39015bd8deadSopenharmony_ci            non-shareable piece of the context state.  There would be
39025bd8deadSopenharmony_ci            one renderbuffer named zero per target per context.
39035bd8deadSopenharmony_ci
39045bd8deadSopenharmony_ci            If we can't share renderbuffer name zero, then also by way
39055bd8deadSopenharmony_ci            of symmetry with textures, we would not want to support
39065bd8deadSopenharmony_ci            attaching renderbuffer name zero to a framebuffer.
39075bd8deadSopenharmony_ci
39085bd8deadSopenharmony_ci            So, if it can't be used as a rendering destination, then a
39095bd8deadSopenharmony_ci            renderbuffer name zero would seem to serve no purpose as a
39105bd8deadSopenharmony_ci            state container.
39115bd8deadSopenharmony_ci
39125bd8deadSopenharmony_ci            However, we'd like to retain the use of name zero in certain
39135bd8deadSopenharmony_ci            routines with special semantics, particularly for detaching
39145bd8deadSopenharmony_ci            non-zero renderbuffer objects from the framebuffer and
39155bd8deadSopenharmony_ci            context.  See issue (33).
39165bd8deadSopenharmony_ci
39175bd8deadSopenharmony_ci            On implication of this decision is that state
39185bd8deadSopenharmony_ci            setting/getting routines that operate on the currently bound
39195bd8deadSopenharmony_ci            renderbuffer should throw a GL error if no renderbuffer is
39205bd8deadSopenharmony_ci            bound/attached.  A similar choice was made in the
39215bd8deadSopenharmony_ci            ARB_vertex_buffer_objects specification which also had
39225bd8deadSopenharmony_ci            special semantics for object zero.
39235bd8deadSopenharmony_ci
39245bd8deadSopenharmony_ci            Also note, another option considered was making object zero
39255bd8deadSopenharmony_ci            a full fledged, shareable object just like the non-zero
39265bd8deadSopenharmony_ci            object names.  This was rejected as being too different from
39275bd8deadSopenharmony_ci            texture/program vbo's/etc., possibly leading to confusion.
39285bd8deadSopenharmony_ci
39295bd8deadSopenharmony_ci    (33) What should happen if you call FramebufferRenderbuffer or
39305bd8deadSopenharmony_ci         BindRenderbuffer with a renderbuffer name of zero?
39315bd8deadSopenharmony_ci
39325bd8deadSopenharmony_ci            RESOLUTION:   This will detach the image from the
39335bd8deadSopenharmony_ci            specified attachment point in the currently bound
39345bd8deadSopenharmony_ci            framebuffer object.
39355bd8deadSopenharmony_ci
39365bd8deadSopenharmony_ci            This is resolved exactly the same way as issue (31) was
39375bd8deadSopenharmony_ci            resolved for textures, and for the same reasons.
39385bd8deadSopenharmony_ci
39395bd8deadSopenharmony_ci            Similarly, calling BindRenderbuffer with a name of zero will
39405bd8deadSopenharmony_ci            unbind the currently bound renderbuffer from the context.
39415bd8deadSopenharmony_ci
39425bd8deadSopenharmony_ci    (34) Should there be a way to query a framebuffer object for its
39435bd8deadSopenharmony_ci         attached texture and/or renderbuffers?  If so, how, and
39445bd8deadSopenharmony_ci         what should be the query result when attached textures or
39455bd8deadSopenharmony_ci         renderbuffers have been deleted?
39465bd8deadSopenharmony_ci
39475bd8deadSopenharmony_ci            RESOLUTION: resolved, yes
39485bd8deadSopenharmony_ci
39495bd8deadSopenharmony_ci            In general, OpenGL lets you query settable state, so
39505bd8deadSopenharmony_ci            we allow this.
39515bd8deadSopenharmony_ci            To see what this query should look like, see related
39525bd8deadSopenharmony_ci            issue (51)
39535bd8deadSopenharmony_ci
39545bd8deadSopenharmony_ci            This issue also raises the question about what values should
39555bd8deadSopenharmony_ci            be returned for attached objects if the named objects have
39565bd8deadSopenharmony_ci            since been deleted.  This can happen if the textures were
39575bd8deadSopenharmony_ci            attached to non-currently bound framebuffers or attached to
39585bd8deadSopenharmony_ci            framebuffers in other contexts.  Three possible solutions
39595bd8deadSopenharmony_ci            include:
39605bd8deadSopenharmony_ci
39615bd8deadSopenharmony_ci                a) Don't support this query.
39625bd8deadSopenharmony_ci
39635bd8deadSopenharmony_ci                b) Return zero if no texture has ever been attached.
39645bd8deadSopenharmony_ci                   Return zero if the attached texture has been deleted.
39655bd8deadSopenharmony_ci
39665bd8deadSopenharmony_ci                c) Return zero if no texture has ever been attached.
39675bd8deadSopenharmony_ci                   Return the name of the texture that was attached even
39685bd8deadSopenharmony_ci                   though it has been deleted.
39695bd8deadSopenharmony_ci
39705bd8deadSopenharmony_ci                Option (a) was rejected as we would like settable state
39715bd8deadSopenharmony_ci                to be queriable.
39725bd8deadSopenharmony_ci
39735bd8deadSopenharmony_ci                So, for this extension originally we choose option (c).
39745bd8deadSopenharmony_ci                However, we have since decided, in issue (21), that
39755bd8deadSopenharmony_ci                DeleteTexture and DeleteRenderbuffer will first detach
39765bd8deadSopenharmony_ci                the texture/renderbuffer from any attached framebuffer
39775bd8deadSopenharmony_ci                objects *in this context*.  In principle, the
39785bd8deadSopenharmony_ci                application can't tell the difference between the
39795bd8deadSopenharmony_ci                texture getting deleted now or later, so whether the
39805bd8deadSopenharmony_ci                texture is actually detached from the current
39815bd8deadSopenharmony_ci                framebuffer now and other framebuffers when they are
39825bd8deadSopenharmony_ci                bound, or the texture is actually detached from all
39835bd8deadSopenharmony_ci                framebuffers at once is moot.  In practice, this means
39845bd8deadSopenharmony_ci                that options (b) and (c) are essentially
39855bd8deadSopenharmony_ci                indistinguishable for a single context case.
39865bd8deadSopenharmony_ci
39875bd8deadSopenharmony_ci                However, it's worth noting that if the texture is
39885bd8deadSopenharmony_ci                deleted and attached to a framebuffer which is current
39895bd8deadSopenharmony_ci                in another context, the standard rules about undefined
39905bd8deadSopenharmony_ci                behavior of state modifcations of shared objects in
39915bd8deadSopenharmony_ci                other contexts will still applye.
39925bd8deadSopenharmony_ci
39935bd8deadSopenharmony_ci                This means that the texture may or may not be detached
39945bd8deadSopenharmony_ci                (and thus deleted) from that other context's current
39955bd8deadSopenharmony_ci                framebuffer until the next BindFramebuffer (or
39965bd8deadSopenharmony_ci                FramebufferTexture/FramebufferRenderbuffer?) in the
39975bd8deadSopenharmony_ci                other context.
39985bd8deadSopenharmony_ci
39995bd8deadSopenharmony_ci    (35) Earlier proposals included a way to create some memory and then
40005bd8deadSopenharmony_ci         attach it to a texture object.  Should this extension include
40015bd8deadSopenharmony_ci         this feature?
40025bd8deadSopenharmony_ci
40035bd8deadSopenharmony_ci            RESOLUTION:  no.
40045bd8deadSopenharmony_ci
40055bd8deadSopenharmony_ci            This was considered when this extension was intended
40065bd8deadSopenharmony_ci            to be a more general purpose memory manager.  Since this
40075bd8deadSopenharmony_ci            extension has been retasked to focus in on render-to-X
40085bd8deadSopenharmony_ci            functionality, this feature was not necessary.
40095bd8deadSopenharmony_ci
40105bd8deadSopenharmony_ci    (36) Earlier proposals had renderable memory constructs which could
40115bd8deadSopenharmony_ci         change internal format or dimensions to meet intra-framebuffer
40125bd8deadSopenharmony_ci         compatibiltiy requirements of individual vendors' hardware
40135bd8deadSopenharmony_ci         platforms.  Should this extension have these kind of malleable
40145bd8deadSopenharmony_ci         format objects?
40155bd8deadSopenharmony_ci
40165bd8deadSopenharmony_ci            RESOLUTION: no.
40175bd8deadSopenharmony_ci
40185bd8deadSopenharmony_ci            Such malleability leads to invariance problems when formats
40195bd8deadSopenharmony_ci            change.  For example, if bits per pixel is decreased then
40205bd8deadSopenharmony_ci            increased back to the original value, some precision is
40215bd8deadSopenharmony_ci            lost.
40225bd8deadSopenharmony_ci
40235bd8deadSopenharmony_ci            Some IHVs wanted to require format conversion of existing
40245bd8deadSopenharmony_ci            contents in all cases where the format changes.  This sort
40255bd8deadSopenharmony_ci            of invariance would be an acceptable side-effect.  The
40265bd8deadSopenharmony_ci            suggestion was to think of the action of rendering to a
40275bd8deadSopenharmony_ci            texture as an extended non-atomic TexImage call.  TexImage
40285bd8deadSopenharmony_ci            is allowed to change the format of an existing texture
40295bd8deadSopenharmony_ci            image.  It was claimed that such intrinsic buffers are more
40305bd8deadSopenharmony_ci            convenient in many applicaitons than are the explicitly
40315bd8deadSopenharmony_ci            managed renderbuffers.
40325bd8deadSopenharmony_ci
40335bd8deadSopenharmony_ci            Other IHVs expressed a strong opinion against implicit
40345bd8deadSopenharmony_ci            format conversions, but instead wanted to invalidate the
40355bd8deadSopenharmony_ci            buffer's contents whenever the format changed.  It was
40365bd8deadSopenharmony_ci            difficult to define the set of operations that might cause
40375bd8deadSopenharmony_ci            the format to change, so it was difficult to define when the
40385bd8deadSopenharmony_ci            contents could become invalidated.  If the contents were
40395bd8deadSopenharmony_ci            invalidated by a format change, the API under consideration
40405bd8deadSopenharmony_ci            made it cumbersome for the application to detect and handle
40415bd8deadSopenharmony_ci            this condition.  In the end, under the buffer content
40425bd8deadSopenharmony_ci            invalidation approach, application code would not be any
40435bd8deadSopenharmony_ci            better off than if the appliation instead used the explicit
40445bd8deadSopenharmony_ci            renderbuffers.  For the type of intrinsic buffers that could
40455bd8deadSopenharmony_ci            not change format and dimensions dynamically, the claim that
40465bd8deadSopenharmony_ci            intrinsic buffers were more convenient than renderbuffers
40475bd8deadSopenharmony_ci            was no longer true.
40485bd8deadSopenharmony_ci
40495bd8deadSopenharmony_ci            The working group voted for the latter: no implicit format
40505bd8deadSopenharmony_ci            changes.  Instead the format would be immutable once it is
40515bd8deadSopenharmony_ci            known.
40525bd8deadSopenharmony_ci
40535bd8deadSopenharmony_ci            A secondary issue is the question: are the buffer contents
40545bd8deadSopenharmony_ci            invalidated when the dimensions change, are the contents
40555bd8deadSopenharmony_ci            scaled, or are the contents are clipped/padded (with some
40565bd8deadSopenharmony_ci            sort of gravity).  This issue could be avoided by requiring
40575bd8deadSopenharmony_ci            explicit, rather than implicit, resize of intrinsic buffers.
40585bd8deadSopenharmony_ci
40595bd8deadSopenharmony_ci            The working group voted for no implicit change in the
40605bd8deadSopenharmony_ci            dimensions of intrinsic buffers, and finally for the removal
40615bd8deadSopenharmony_ci            of intrinsic buffers altogether.
40625bd8deadSopenharmony_ci
40635bd8deadSopenharmony_ci    (37) In order to abstract hardware dependent compatibility
40645bd8deadSopenharmony_ci         requirements, this API introduces a function called
40655bd8deadSopenharmony_ci         CheckFramebufferStatus to check for compatibility prior to
40665bd8deadSopenharmony_ci         rendering.  CheckFramebufferStatus returns a value which
40675bd8deadSopenharmony_ci         indicates whether or not the framebuffer object is "framebuffer
40685bd8deadSopenharmony_ci         complete", and framebuffer completeness depends in part on
40695bd8deadSopenharmony_ci         hardware dependent constraints.  The hardware dependent aspect
40705bd8deadSopenharmony_ci         represents a new concept in OpenGL.  Therefore, should an app
40715bd8deadSopenharmony_ci         be required to call this function to help "enforce" the notion
40725bd8deadSopenharmony_ci         that apps should be on the lookout for failure?
40735bd8deadSopenharmony_ci
40745bd8deadSopenharmony_ci            RESOLUTION: no.  Calling CheckFramebufferStatus is not
40755bd8deadSopenharmony_ci            required.
40765bd8deadSopenharmony_ci
40775bd8deadSopenharmony_ci            The group considered requiring a call to
40785bd8deadSopenharmony_ci            CheckFramebufferStatus after changing framebuffer state or
40795bd8deadSopenharmony_ci            attachment points in order to "enable" rendering.  It was
40805bd8deadSopenharmony_ci            hoped that requiring a call to CheckFramebufferStatus would
40815bd8deadSopenharmony_ci            push developers to write code which is more platform
40825bd8deadSopenharmony_ci            independent.  Ultimately though, since the API can't require
40835bd8deadSopenharmony_ci            applications to actually observe and deal with a validation
40845bd8deadSopenharmony_ci            failure, that it was not worth it to make this function call
40855bd8deadSopenharmony_ci            required.  There was also feedback from some developers that
40865bd8deadSopenharmony_ci            requiring this call would be cumbersome and undesirable.
40875bd8deadSopenharmony_ci
40885bd8deadSopenharmony_ci            Note, however, that the framebuffer is effectively validated
40895bd8deadSopenharmony_ci            implicitly at every rendering (and reading) entry point.
40905bd8deadSopenharmony_ci            These include glBegin, gl{Multi}Draw{Arrays|Elements},
40915bd8deadSopenharmony_ci            gl{Draw|Copy|Read}Pixels, glCopyPixels, glReadPixels,
40925bd8deadSopenharmony_ci            glCopyTex{Sub}Image, etc.
40935bd8deadSopenharmony_ci
40945bd8deadSopenharmony_ci            Applications are strongly advised to test framebuffer
40955bd8deadSopenharmony_ci            completeness with CheckFramebufferStatus after setting up or
40965bd8deadSopenharmony_ci            changing the configuration of a framebuffer object, and to
40975bd8deadSopenharmony_ci            handle the possible failure cases with a fallback plan that
40985bd8deadSopenharmony_ci            selects a different set of internal formats of attached
40995bd8deadSopenharmony_ci            images.  See usage example 6.  Section 4.4.4.2 lists the
41005bd8deadSopenharmony_ci            operations that can cause the framebuffer's status to
41015bd8deadSopenharmony_ci            change.
41025bd8deadSopenharmony_ci
41035bd8deadSopenharmony_ci            In addition, a "format group" API, has been proposed as a
41045bd8deadSopenharmony_ci            means of programmatically determining a set of internal
41055bd8deadSopenharmony_ci            formats that are guaranteed to be compatible with respect to
41065bd8deadSopenharmony_ci            framebuffer completeness.  This API would be specified in a
41075bd8deadSopenharmony_ci            layered extension as suggested in issue (12)
41085bd8deadSopenharmony_ci
41095bd8deadSopenharmony_ci    (38) Do we need to support multiple render targets, i.e.,
41105bd8deadSopenharmony_ci         ARB_draw_buffers?
41115bd8deadSopenharmony_ci
41125bd8deadSopenharmony_ci            RESOLUTION: Yes.
41135bd8deadSopenharmony_ci
41145bd8deadSopenharmony_ci            ARB_draw_buffers is going to be part of OpenGL 2.0 so we'd
41155bd8deadSopenharmony_ci            better support it.
41165bd8deadSopenharmony_ci
41175bd8deadSopenharmony_ci    (39) How should we support ARB_draw_buffers?
41185bd8deadSopenharmony_ci
41195bd8deadSopenharmony_ci            RESOLUTION: refactored into the following issues:
41205bd8deadSopenharmony_ci                        (53), (54), (55), (56), and (57)
41215bd8deadSopenharmony_ci
41225bd8deadSopenharmony_ci    (40) (How) should we support accum buffers?
41235bd8deadSopenharmony_ci
41245bd8deadSopenharmony_ci            RESOLUTION: defer this until (shortly) after this extension.
41255bd8deadSopenharmony_ci
41265bd8deadSopenharmony_ci            Accum buffers appears to be very simple to specify and
41275bd8deadSopenharmony_ci            implement.  Basically, we would need to add a new internal
41285bd8deadSopenharmony_ci            ACCUM format that can be passed to RenderbufferStorage.  We
41295bd8deadSopenharmony_ci            would also need to add an ACCUM attachment point in the
41305bd8deadSopenharmony_ci            framebuffer that could be used to point to one of these
41315bd8deadSopenharmony_ci            ACCUM format renderbuffers.  A new ACCUM format is needed
41325bd8deadSopenharmony_ci            because the ACCUM buffer is defined by GL to be signed
41335bd8deadSopenharmony_ci            floating point value, unlike other internal formats.
41345bd8deadSopenharmony_ci
41355bd8deadSopenharmony_ci            Also note, the above solution is the exact same one we are
41365bd8deadSopenharmony_ci            using for STENCIL buffers as well (i.e., an internal format
41375bd8deadSopenharmony_ci            enum and an attachment point).
41385bd8deadSopenharmony_ci
41395bd8deadSopenharmony_ci            We could also decide if this new ACCUM internal format can
41405bd8deadSopenharmony_ci            be used with textures in addition to renderbuffers, for
41415bd8deadSopenharmony_ci            creating images that can be attached to the accum buffer
41425bd8deadSopenharmony_ci            attachment point.
41435bd8deadSopenharmony_ci
41445bd8deadSopenharmony_ci            Supporting accum was deferred for this extension, primarily
41455bd8deadSopenharmony_ci            for time-to-market reasons, and as it was not critical for
41465bd8deadSopenharmony_ci            most render-to-texture applications.  However, we intend to
41475bd8deadSopenharmony_ci            work on some kind of "EXT_accum_renderbuffer" extension
41485bd8deadSopenharmony_ci            shortly.
41495bd8deadSopenharmony_ci
41505bd8deadSopenharmony_ci            Since this was deferred, we need to define what happens when
41515bd8deadSopenharmony_ci            you call the various Accum operations on a non-default
41525bd8deadSopenharmony_ci            framebuffer object.  We considered adding spec language that
41535bd8deadSopenharmony_ci            would generate an error on Accum operations.  However, it
41545bd8deadSopenharmony_ci            seems like we can simply leverage whatever legacy behavior
41555bd8deadSopenharmony_ci            is currently defined for when the pixel format has no accum
41565bd8deadSopenharmony_ci            buffer.  This is the case in this extension as we have
41575bd8deadSopenharmony_ci            defined no way to attach or enable an accum buffer.  Chapter
41585bd8deadSopenharmony_ci            4 on page 188 already says that "If there is no accumulation
41595bd8deadSopenharmony_ci            buffer, or if the GL is in color index mode, Accum generates
41605bd8deadSopenharmony_ci            the error INVALID OPERATION", so we don't actually need any
41615bd8deadSopenharmony_ci            additional language of our own.
41625bd8deadSopenharmony_ci
41635bd8deadSopenharmony_ci    (41) (How) should we support multisample buffers?
41645bd8deadSopenharmony_ci
41655bd8deadSopenharmony_ci            RESOLUTION: defer this until (shortly) after this extension.
41665bd8deadSopenharmony_ci
41675bd8deadSopenharmony_ci            Supporting multisample was deferred for this extension,
41685bd8deadSopenharmony_ci            primarily for time-to-market reasons and because it's not
41695bd8deadSopenharmony_ci            entirely clear what is the "best" API for exposing
41705bd8deadSopenharmony_ci            multisample.  However, we intend to work on some kind of
41715bd8deadSopenharmony_ci            "EXT_multisample_renderbuffer" extension shortly.
41725bd8deadSopenharmony_ci
41735bd8deadSopenharmony_ci            Since this feature was deferred, we need to define what
41745bd8deadSopenharmony_ci            happens when you try to enable multisample on a non-default
41755bd8deadSopenharmony_ci            framebuffer object.  For now we need some way to *not* do
41765bd8deadSopenharmony_ci            multisampling.  This can either be that we set SAMPLES 1 and
41775bd8deadSopenharmony_ci            SAMPLE_BUFFERS to 0, or we say that
41785bd8deadSopenharmony_ci            Enable/Disable(MULTISAMPLE) is ignored.  This is actually
41795bd8deadSopenharmony_ci            related to issue (62) - should SAMPLE_BUFFERS change when
41805bd8deadSopenharmony_ci            using a non-default framebuffer or when attachments change?
41815bd8deadSopenharmony_ci            When/if we define and export "EXT_multisample_renderbuffer"
41825bd8deadSopenharmony_ci            extension, this state will again have significance.
41835bd8deadSopenharmony_ci
41845bd8deadSopenharmony_ci            A discussion of how we might support this feature follows:
41855bd8deadSopenharmony_ci
41865bd8deadSopenharmony_ci            There are several considerations here: First, we'd like
41875bd8deadSopenharmony_ci            something simple to specify, implement, and use.  Second,
41885bd8deadSopenharmony_ci            we'd like to not delay this extension's approval,
41895bd8deadSopenharmony_ci            implementation or adoption for this particular feature.
41905bd8deadSopenharmony_ci            Third, we are trying to replace pbuffer functionality, which
41915bd8deadSopenharmony_ci            does support multisampling (at least in principle), so we'd
41925bd8deadSopenharmony_ci            like to not take a step backward in functionality if
41935bd8deadSopenharmony_ci            possible.
41945bd8deadSopenharmony_ci
41955bd8deadSopenharmony_ci            However, this extension is *not* trying to "improve" the
41965bd8deadSopenharmony_ci            traditional multisample support.  If we do anything, we will
41975bd8deadSopenharmony_ci            simply expose the existing multisample buffer semantics
41985bd8deadSopenharmony_ci            without causing undue implementation burden.
41995bd8deadSopenharmony_ci
42005bd8deadSopenharmony_ci            Finally, if an implementation is currently taking short-cuts
42015bd8deadSopenharmony_ci            to GL's traditional "per-pixel-resolve" multisample
42025bd8deadSopenharmony_ci            semantics, we'd like for this extension to continue to allow
42035bd8deadSopenharmony_ci            the exact same short-cuts (to whatever extent the core GL
42045bd8deadSopenharmony_ci            spec does or does not allow those short-cuts).  If someone
42055bd8deadSopenharmony_ci            later decides to go an revamp multisampling support in
42065bd8deadSopenharmony_ci            general, they can update this extension at the same time.
42075bd8deadSopenharmony_ci
42085bd8deadSopenharmony_ci            Given the above, it appears that the options include:
42095bd8deadSopenharmony_ci
42105bd8deadSopenharmony_ci              A) Don't support it.  In other words, you can't use
42115bd8deadSopenharmony_ci                 mulitsampling and EXT_framebuffer_object.  The
42125bd8deadSopenharmony_ci                 multisample state is either ignored, or causes the
42135bd8deadSopenharmony_ci                 framebuffer to not be complete, or generates some kind
42145bd8deadSopenharmony_ci                 of error.
42155bd8deadSopenharmony_ci
42165bd8deadSopenharmony_ci              B) Create a separate multisample renderbuffer that can be
42175bd8deadSopenharmony_ci                 attached to a new framebuffer attachment point.
42185bd8deadSopenharmony_ci
42195bd8deadSopenharmony_ci                 The reason that we might need a separate
42205bd8deadSopenharmony_ci                 RESOLUTION_BUFFER is that all renderable color buffer
42215bd8deadSopenharmony_ci                 formats might not be usable for multisampling on all
42225bd8deadSopenharmony_ci                 implementations.
42235bd8deadSopenharmony_ci
42245bd8deadSopenharmony_ci                 Also, this option would allow multiple framebuffers to
42255bd8deadSopenharmony_ci                 share the storage for multisample buffers under the
42265bd8deadSopenharmony_ci                 control of the application.
42275bd8deadSopenharmony_ci
42285bd8deadSopenharmony_ci                 Depth sample buffers and stencil sample buffers
42295bd8deadSopenharmony_ci                 wouldn't necessarily need resolution buffers, but that
42305bd8deadSopenharmony_ci                 could be added by some future extension.
42315bd8deadSopenharmony_ci
42325bd8deadSopenharmony_ci                 This option has several variants:
42335bd8deadSopenharmony_ci
42345bd8deadSopenharmony_ci                   B1) Create MULTISAMPLE and/or RESOLUTION_BUFFER
42355bd8deadSopenharmony_ci                       internal formats for renderbuffer objects that
42365bd8deadSopenharmony_ci                       can be used with RenderbufferStorage.  The
42375bd8deadSopenharmony_ci                       samples buffer and the resolution buffer would be
42385bd8deadSopenharmony_ci                       allocated and attached to the framebuffer
42395bd8deadSopenharmony_ci                       separately.  Having them be separate allows the
42405bd8deadSopenharmony_ci                       samples to be deleted after rendering if desired.
42415bd8deadSopenharmony_ci
42425bd8deadSopenharmony_ci                       One issue with this option is that somehow you'd
42435bd8deadSopenharmony_ci                       need to specify the number of samples maybe using
42445bd8deadSopenharmony_ci                       glFramebufferParameter or
42455bd8deadSopenharmony_ci                       glRenderbufferParameter.
42465bd8deadSopenharmony_ci
42475bd8deadSopenharmony_ci                   B2) Perhaps, instead of using a single internal
42485bd8deadSopenharmony_ci                       format called MULTISAMPLE, use a set of internal
42495bd8deadSopenharmony_ci                       formats like MULTISAMPLE_1_SAMPLE,
42505bd8deadSopenharmony_ci                       MULTISAMPLE_2_SAMPLE, MULTISAMPLE_4_SAMPLE, etc.
42515bd8deadSopenharmony_ci                       This is problematic for supporting depth/stencil
42525bd8deadSopenharmony_ci                       multisampling unless we want an explosion of
42535bd8deadSopenharmony_ci                       color/depth/stencil multisample internal formats.
42545bd8deadSopenharmony_ci                       It's also problematic if MRT draw buffers need to
42555bd8deadSopenharmony_ci                       be multisampled because we'd need a number of
42565bd8deadSopenharmony_ci                       enums able to support 1 to N draw buffers times
42575bd8deadSopenharmony_ci                       the number of sample patterns we support.
42585bd8deadSopenharmony_ci
42595bd8deadSopenharmony_ci                   B3) Have RenderbufferStorage always take a number of
42605bd8deadSopenharmony_ci                       samples.  We could do this if option (B2) is
42615bd8deadSopenharmony_ci                       insufficient due to the need to support DEPTH or
42625bd8deadSopenharmony_ci                       STENCIL multisampling, which we probably will.
42635bd8deadSopenharmony_ci                       We would then allow the internal format to choose
42645bd8deadSopenharmony_ci                       DEPTH, STENCIL, or RGBA/etc.  This is clean but
42655bd8deadSopenharmony_ci                       it means that the user would always need to
42665bd8deadSopenharmony_ci                       specify a number of samples even when the value
42675bd8deadSopenharmony_ci                       is "1".
42685bd8deadSopenharmony_ci
42695bd8deadSopenharmony_ci                   B4) Pass in a variable length argument list to the
42705bd8deadSopenharmony_ci                       renderbuffer allocation routine, and some of the
42715bd8deadSopenharmony_ci                       arguments would indicate intended usage
42725bd8deadSopenharmony_ci                       (COLOR/DEPTH/MULTISAMPLE) others would indicate
42735bd8deadSopenharmony_ci                       internal format (RGBA/DEPTH24) and others would
42745bd8deadSopenharmony_ci                       indicate number of samples.  This is how
42755bd8deadSopenharmony_ci                       EXT_compromise_buffers dealt with this problem,
42765bd8deadSopenharmony_ci                       though people didn't seem to like this variable
42775bd8deadSopenharmony_ci                       length argument list.  EXT_render_target didn't
42785bd8deadSopenharmony_ci                       deal with this problem so doesn't offer any
42795bd8deadSopenharmony_ci                       guidance here.
42805bd8deadSopenharmony_ci
42815bd8deadSopenharmony_ci                   B5) Create a new RENDERBUFFER_MULTISAMPLE
42825bd8deadSopenharmony_ci                       renderbuffer target type and a corresponding
42835bd8deadSopenharmony_ci                       allocation routine, perhaps called
42845bd8deadSopenharmony_ci                       RenderbufferMultisampleStorage().  This is
42855bd8deadSopenharmony_ci                       analogous to how textures have their own
42865bd8deadSopenharmony_ci                       allocation routine per target type
42875bd8deadSopenharmony_ci                       (TexImage1D/2D/3D, etc).
42885bd8deadSopenharmony_ci
42895bd8deadSopenharmony_ci                       With this option, we could preclude
42905bd8deadSopenharmony_ci                       non-multisample targets from being attached to
42915bd8deadSopenharmony_ci                       non-multisample attachment points as well.
42925bd8deadSopenharmony_ci
42935bd8deadSopenharmony_ci                   B6-B10) Any of the above options can be implemented
42945bd8deadSopenharmony_ci                           with either a single monolithic mulitsample
42955bd8deadSopenharmony_ci                           buffer that contains the samples for all draw
42965bd8deadSopenharmony_ci                           buffers, depth and stencil and a single
42975bd8deadSopenharmony_ci                           attachment point, *OR* with independent
42985bd8deadSopenharmony_ci                           multisample buffers for each draw buffer and
42995bd8deadSopenharmony_ci                           depth and stencil and independent attachment
43005bd8deadSopenharmony_ci                           points for each.
43015bd8deadSopenharmony_ci
43025bd8deadSopenharmony_ci              C) Use some kind of "behind the scenes" mulitsample buffer.
43035bd8deadSopenharmony_ci
43045bd8deadSopenharmony_ci                 This option also has several variants:
43055bd8deadSopenharmony_ci
43065bd8deadSopenharmony_ci                   C1) An "implicit" multisample buffer that is simply a
43075bd8deadSopenharmony_ci                       property of the framebuffer object.  Each
43085bd8deadSopenharmony_ci                       framebuffer object could have its own multisample
43095bd8deadSopenharmony_ci                       buffer(s).  Multisampling would be enabled with
43105bd8deadSopenharmony_ci                       some kind of FramebufferParameter call.  This
43115bd8deadSopenharmony_ci                       implies that each framebuffer has memory
43125bd8deadSopenharmony_ci                       allocated with it.  It further implies that the
43135bd8deadSopenharmony_ci                       contents of the multisample buffer are
43145bd8deadSopenharmony_ci                       framebuffer state and are thus retained with the
43155bd8deadSopenharmony_ci                       framebuffer object.
43165bd8deadSopenharmony_ci
43175bd8deadSopenharmony_ci                   C2) We don't say anything except that we say the
43185bd8deadSopenharmony_ci                       value of the glEnable(MULTISAMPLE) is still
43195bd8deadSopenharmony_ci                       respected and we render as directed.  This is
43205bd8deadSopenharmony_ci                       similar to (C1) but we don't go so far as to say
43215bd8deadSopenharmony_ci                       that the multisample buffer(s) is/are retained
43225bd8deadSopenharmony_ci                       per framebuffer object.  In other words, a call
43235bd8deadSopenharmony_ci                       to BindFramebuffer() and changes to framebuffer
43245bd8deadSopenharmony_ci                       attachments may or may not retain multisample
43255bd8deadSopenharmony_ci                       buffer contents.  Valid implmentations of this
43265bd8deadSopenharmony_ci                       would include a multisample buffer per
43275bd8deadSopenharmony_ci                       framebuffer or one per context.
43285bd8deadSopenharmony_ci
43295bd8deadSopenharmony_ci              D) something else (hopefully simpler?)
43305bd8deadSopenharmony_ci
43315bd8deadSopenharmony_ci    (42) What set of framebuffer targets should the initial extension
43325bd8deadSopenharmony_ci         support?
43335bd8deadSopenharmony_ci
43345bd8deadSopenharmony_ci            RESOLUTION: resolved, (D) single target
43355bd8deadSopenharmony_ci
43365bd8deadSopenharmony_ci            Basic possibilities include:
43375bd8deadSopenharmony_ci
43385bd8deadSopenharmony_ci            (A) DRAW_AND_READ_FRAMEBUFFER_EXT
43395bd8deadSopenharmony_ci
43405bd8deadSopenharmony_ci            (B) DRAW_FRAMEBUFFER_EXT
43415bd8deadSopenharmony_ci                READ_FRAMEBUFFER_EXT
43425bd8deadSopenharmony_ci
43435bd8deadSopenharmony_ci            (C) DRAW_FRAMEBUFFER_EXT
43445bd8deadSopenharmony_ci                READ_FRAMEBUFFER_EXT
43455bd8deadSopenharmony_ci                DRAW_AND_READ_FRAMEBUFFER_EXT
43465bd8deadSopenharmony_ci
43475bd8deadSopenharmony_ci            (D) FRAMEBUFFER_EXT
43485bd8deadSopenharmony_ci
43495bd8deadSopenharmony_ci            The fundamental question is: must framebuffer binding points
43505bd8deadSopenharmony_ci            mimic the expressiveness of the window-system function
43515bd8deadSopenharmony_ci            MakeContextCurrent, which is described in the glX spec and
43525bd8deadSopenharmony_ci            the ARB_make_current_read extension?
43535bd8deadSopenharmony_ci
43545bd8deadSopenharmony_ci            It was not immediately clear how to specify the distinction
43555bd8deadSopenharmony_ci            between a READ and a DRAW framebuffer in the context of the
43565bd8deadSopenharmony_ci            existing read/draw buffer semantics, given that this
43575bd8deadSopenharmony_ci            extension relaxes the "compatibility" requirement between
43585bd8deadSopenharmony_ci            read and draw drawables.  How would the value of RED_BITS
43595bd8deadSopenharmony_ci            for the read framebuffer be queried if it is different than
43605bd8deadSopenharmony_ci            the value of RED_BITS for the draw framebuffer?  What
43615bd8deadSopenharmony_ci            exactly is the set of implementation dependent state (see
43625bd8deadSopenharmony_ci            the "Implementation Dependent *" state tables in chapter 6)
43635bd8deadSopenharmony_ci            that can differ between read and draw framebuffer objects?
43645bd8deadSopenharmony_ci
43655bd8deadSopenharmony_ci            When using MakeContextCurrent, the context's and drawable's
43665bd8deadSopenharmony_ci            FBconfig (or pixel format) must be "compatible" or else the
43675bd8deadSopenharmony_ci            results are implementation dependent.  But
43685bd8deadSopenharmony_ci            EXT_framebuffer_object cannot afford to swing such a large
43695bd8deadSopenharmony_ci            "undefined" stick, because it is more likely that
43705bd8deadSopenharmony_ci            framebuffer objects are incompatible in this sense, and
43715bd8deadSopenharmony_ci            because the "pixel format compatility" of a framebuffer
43725bd8deadSopenharmony_ci            object is dynamic--by changing attachments or redefining the
43735bd8deadSopenharmony_ci            internal format of an attached texture image.
43745bd8deadSopenharmony_ci
43755bd8deadSopenharmony_ci            The value added by ARB_make_current_read through
43765bd8deadSopenharmony_ci            MakeContextCurrent is less relevant to
43775bd8deadSopenharmony_ci            EXT_framebuffer_object.  EXT_framebuffer_object enables
43785bd8deadSopenharmony_ci            rendering to a texture, and textures are objects with a
43795bd8deadSopenharmony_ci            clearly defined mechanism for use as the source of a pixel
43805bd8deadSopenharmony_ci            copy: rather than using CopyPixels to move pixels from the
43815bd8deadSopenharmony_ci            READ_BUFFER to the DRAW_BUFFER(s), an application can simply
43825bd8deadSopenharmony_ci            use the source data as a texture and then draw a
43835bd8deadSopenharmony_ci            screen-aligned textured quad to the framebuffer.
43845bd8deadSopenharmony_ci
43855bd8deadSopenharmony_ci            Additionally, adding separate DRAW and READ bindings in the
43865bd8deadSopenharmony_ci            future is pretty straightforward.  One solution would be to
43875bd8deadSopenharmony_ci            say that FRAMEBUFFER_EXT is the DRAW framebuffer, and name
43885bd8deadSopenharmony_ci            the new READ framebuffer FRAMEBUFFER_READ_EXT.  Add a new
43895bd8deadSopenharmony_ci            BindFramebuffer-like function which takes two framebuffer
43905bd8deadSopenharmony_ci            names--one for DRAW and one for READ.  The current
43915bd8deadSopenharmony_ci            BindFramebuffer function binds a single object to both
43925bd8deadSopenharmony_ci            FRAMEBUFFER_EXT and FRAMEBUFFER_READ_EXT.
43935bd8deadSopenharmony_ci
43945bd8deadSopenharmony_ci            So, we defer the additional targets until need has been
43955bd8deadSopenharmony_ci            proven, and go with the simpler option (D) for now.
43965bd8deadSopenharmony_ci
43975bd8deadSopenharmony_ci    (43) In order for a framebuffer object to be "framebuffer complete",
43985bd8deadSopenharmony_ci         must all textures attached to the framebuffer be mipmap
43995bd8deadSopenharmony_ci         complete (or mipmap cube complete if cubemap texture)?
44005bd8deadSopenharmony_ci
44015bd8deadSopenharmony_ci            RESOLUTION:  resolved, no
44025bd8deadSopenharmony_ci
44035bd8deadSopenharmony_ci            The reason this is a consideration is that some
44045bd8deadSopenharmony_ci            architectures require framebuffer-attachable images to be
44055bd8deadSopenharmony_ci            located in graphics memory when rendered to, and it may be
44065bd8deadSopenharmony_ci            more convenient to allocate and store a texture in graphics
44075bd8deadSopenharmony_ci            memory only if the texture is mipmap (cube) complete--i.e.,
44085bd8deadSopenharmony_ci            the size and format of all levels are consistent in the
44095bd8deadSopenharmony_ci            normal sense of texture compeleteness.
44105bd8deadSopenharmony_ci
44115bd8deadSopenharmony_ci            However, since framebuffer attachment points only really
44125bd8deadSopenharmony_ci            deal with single images of a texture level, it seems
44135bd8deadSopenharmony_ci            excessive to require the state of the other levels of a
44145bd8deadSopenharmony_ci            texture to affect the validty of the framebuffer object
44155bd8deadSopenharmony_ci            itself.
44165bd8deadSopenharmony_ci
44175bd8deadSopenharmony_ci            Addtionally, the same difficulties around "incomplete"
44185bd8deadSopenharmony_ci            textures already apply to traditional CopyTexSubImage, and
44195bd8deadSopenharmony_ci            we have been trying to make the render-to-texture semantics
44205bd8deadSopenharmony_ci            similar to CopyTexSubImage.
44215bd8deadSopenharmony_ci
44225bd8deadSopenharmony_ci            Therefore, we chose not to treat render to texture any
44235bd8deadSopenharmony_ci            differently than CopyTexSubImage and do not require that the
44245bd8deadSopenharmony_ci            attached texture is mipmap (cube) complete.
44255bd8deadSopenharmony_ci
44265bd8deadSopenharmony_ci    (44) What should happen if a texture that is currently bound to the
44275bd8deadSopenharmony_ci         context is also used as an image attached to the
44285bd8deadSopenharmony_ci         currently bound framebuffer?  In other words, what happens if a
44295bd8deadSopenharmony_ci         texture is used as both a source for texturing and a
44305bd8deadSopenharmony_ci         destination for rendering?
44315bd8deadSopenharmony_ci
44325bd8deadSopenharmony_ci            RESOLUTION: resolved, (b2) - results are undefined because
44335bd8deadSopenharmony_ci            the framebuffer is not "framebuffer complete".
44345bd8deadSopenharmony_ci
44355bd8deadSopenharmony_ci            Originally this was resolved as causing framebuffer to fail
44365bd8deadSopenharmony_ci            the completeness test--i.e., rendering would be disabled (b1)
44375bd8deadSopenharmony_ci
44385bd8deadSopenharmony_ci            As background, the reason this is an issue in the first
44395bd8deadSopenharmony_ci            place is that simultaneously reading from, and writing to,
44405bd8deadSopenharmony_ci            the same texture image is likely to be problematic on
44415bd8deadSopenharmony_ci            multiple vendors' hardware without paying performance
44425bd8deadSopenharmony_ci            penalties for excessive synchronization and/or data copying.
44435bd8deadSopenharmony_ci
44445bd8deadSopenharmony_ci            There are, however, certain cases where this functionality
44455bd8deadSopenharmony_ci            would arguably be useful, supportable, and well-defined.  In
44465bd8deadSopenharmony_ci            particular, we can consider the case of custom mipmap
44475bd8deadSopenharmony_ci            generation using one level's image as source data to render
44485bd8deadSopenharmony_ci            into other levels of the same texture.
44495bd8deadSopenharmony_ci
44505bd8deadSopenharmony_ci            So, at a minimum, we would like to support rendering to a
44515bd8deadSopenharmony_ci            currently bound texture object if the source texture object
44525bd8deadSopenharmony_ci            has the BASE_LEVEL and MAX_LEVEL texture parameters set such
44535bd8deadSopenharmony_ci            that the level being used as a framebuffer-attachable image
44545bd8deadSopenharmony_ci            is excluded from texture fetches.
44555bd8deadSopenharmony_ci
44565bd8deadSopenharmony_ci            This was our original rationale:
44575bd8deadSopenharmony_ci
44585bd8deadSopenharmony_ci             a1) is problematic because one context could modify the
44595bd8deadSopenharmony_ci                 base/max level on a shared texture causing another
44605bd8deadSopenharmony_ci                 context which is using the texture as a destination to
44615bd8deadSopenharmony_ci                 throw an error.  This idea was rejected as it
44625bd8deadSopenharmony_ci                 essentially meant that the error would need to be
44635bd8deadSopenharmony_ci                 thrown at render timer which people found unacceptable.
44645bd8deadSopenharmony_ci
44655bd8deadSopenharmony_ci             b1) has the same kind of multicontext behavior but no
44665bd8deadSopenharmony_ci                 error.  One context can cause a framebuffer shared in
44675bd8deadSopenharmony_ci                 another context to become invalid, but this is already
44685bd8deadSopenharmony_ci                 true and can happen for a variety of reasons if the
44695bd8deadSopenharmony_ci                 participating framebuffer-attachable images and/or
44705bd8deadSopenharmony_ci                 framebuffer attachments are modified by either context.
44715bd8deadSopenharmony_ci
44725bd8deadSopenharmony_ci                 At the time, we also considered the following
44735bd8deadSopenharmony_ci                 questions: should the specification require the
44745bd8deadSopenharmony_ci                 framebuffer to fail the framebuffer completeness test?
44755bd8deadSopenharmony_ci                 Or is the framebuffer simply "allowed" to not be
44765bd8deadSopenharmony_ci                 complete in this case?  The latter choice would imply
44775bd8deadSopenharmony_ci                 that the framebuffer might still be considered
44785bd8deadSopenharmony_ci                 "framebuffer complete" on some implementations.  See
44795bd8deadSopenharmony_ci                 issue (46)
44805bd8deadSopenharmony_ci
44815bd8deadSopenharmony_ci             c1) is the easiest to specify and has an advantage that
44825bd8deadSopenharmony_ci                 some implementations may be relying on this behavior
44835bd8deadSopenharmony_ci                 already.  However, this was rejected as it is the least
44845bd8deadSopenharmony_ci                 portable of the three options.
44855bd8deadSopenharmony_ci
44865bd8deadSopenharmony_ci            We originally chose option (b1), though we considered that
44875bd8deadSopenharmony_ci            later on, individual hardware vendors may offer layered
44885bd8deadSopenharmony_ci            extensions that change this "framebuffer completeness"
44895bd8deadSopenharmony_ci            failure into a success with either defined or undefined
44905bd8deadSopenharmony_ci            rendering behavior.
44915bd8deadSopenharmony_ci
44925bd8deadSopenharmony_ci            However, this issue was re-opened becaues the subsequent
44935bd8deadSopenharmony_ci            resolution of issue (66) was that there should be no
44945bd8deadSopenharmony_ci            "context-dependent" reasons for framebuffer incompleteness.
44955bd8deadSopenharmony_ci            If we had stuck with option (b1), then we would be making
44965bd8deadSopenharmony_ci            the framebuffer completeness predicated on a piece of
44975bd8deadSopenharmony_ci            context state (the current texture binding).  Consider the
44985bd8deadSopenharmony_ci            case where texture T is attached to a framebuffer.  Then
44995bd8deadSopenharmony_ci            this would have meant that a framebuffer could be complete
45005bd8deadSopenharmony_ci            in one context (that didn't have texture T bound as a
45015bd8deadSopenharmony_ci            texture) and incomplete in another context (that did have
45025bd8deadSopenharmony_ci            texture T bound).
45035bd8deadSopenharmony_ci
45045bd8deadSopenharmony_ci            When reconsidering this issue, we realized that we would not
45055bd8deadSopenharmony_ci            throw an error at Begin time without disabling rendering, so
45065bd8deadSopenharmony_ci            we really only considered the following revised set of
45075bd8deadSopenharmony_ci            options:
45085bd8deadSopenharmony_ci
45095bd8deadSopenharmony_ci                 a2) throw an error and disable rendering, but don't
45105bd8deadSopenharmony_ci                     affect framebuffer completeness
45115bd8deadSopenharmony_ci                 b2) the behavior is undefined
45125bd8deadSopenharmony_ci
45135bd8deadSopenharmony_ci            The issue was resolved the second time as:
45145bd8deadSopenharmony_ci                 b2) Undefined behavior
45155bd8deadSopenharmony_ci
45165bd8deadSopenharmony_ci            Another option that was briefly considered was to make this
45175bd8deadSopenharmony_ci            another type of error (unrelated to trying to render with an
45185bd8deadSopenharmony_ci            incomplete framebuffer).  However, part of the rationale for
45195bd8deadSopenharmony_ci            throwing an error at glBegin time when trying to render with
45205bd8deadSopenharmony_ci            an incomplete framebuffer was that if you already have to
45215bd8deadSopenharmony_ci            test for framebuffer completeness, then throwing an error is
45225bd8deadSopenharmony_ci            no additional implementation burden.  Yet, since it was
45235bd8deadSopenharmony_ci            decided that the "texture-from-destination" condition is not
45245bd8deadSopenharmony_ci            part of framebuffer completeness - issue (66) - then it is
45255bd8deadSopenharmony_ci            an additional burden to perform the
45265bd8deadSopenharmony_ci            "texture-from-destination" check just so that an error can
45275bd8deadSopenharmony_ci            be generated.  The concern was some implementations might
45285bd8deadSopenharmony_ci            not need to check for this case at all and we didn't want to
45295bd8deadSopenharmony_ci            burdern those implementations with an additional Begin-time
45305bd8deadSopenharmony_ci            error check.
45315bd8deadSopenharmony_ci
45325bd8deadSopenharmony_ci            Also, for what it's worth, if we had left the
45335bd8deadSopenharmony_ci            "texture-from-destination" case in the framebuffer
45345bd8deadSopenharmony_ci            completeness test then any language describing how
45355bd8deadSopenharmony_ci            framebuffer completeness is affected when a currently bound
45365bd8deadSopenharmony_ci            texture is used as both source and destination needs to be
45375bd8deadSopenharmony_ci            explicit that the texture has to be currently bound *and*
45385bd8deadSopenharmony_ci            enabled.  For instance, consider the case where a user has a
45395bd8deadSopenharmony_ci            cubemap texture object name N bound to unit X and a 2D
45405bd8deadSopenharmony_ci            texture object name M also bound to unit X.  What if the
45415bd8deadSopenharmony_ci            user would like to use the 2D texture M as a source while
45425bd8deadSopenharmony_ci            rendering to the faces of the cubemap texture N?  We would
45435bd8deadSopenharmony_ci            like to support this scenario, so the language about a
45445bd8deadSopenharmony_ci            currently bound texture object would have needed to take the
45455bd8deadSopenharmony_ci            target into account.  And to make matters more interesting,
45465bd8deadSopenharmony_ci            this means we would have needed to take texture enables and
45475bd8deadSopenharmony_ci            fragment shaders into account in this decision.  In the end,
45485bd8deadSopenharmony_ci            we decided that "context-state" would not affect the
45495bd8deadSopenharmony_ci            defintion of framebuffer completeness we avoided this
45505bd8deadSopenharmony_ci            complexity (or at least moved it out of the framebuffer
45515bd8deadSopenharmony_ci            completeness test).
45525bd8deadSopenharmony_ci
45535bd8deadSopenharmony_ci    (45) Are framebuffer configurations with no color attachments allowed?
45545bd8deadSopenharmony_ci
45555bd8deadSopenharmony_ci            RESOLUTION: resolved, yes
45565bd8deadSopenharmony_ci
45575bd8deadSopenharmony_ci            The reason this is an issue is that the GL spec assumes
45585bd8deadSopenharmony_ci            there is always a color buffer.  If a framebuffer with no
45595bd8deadSopenharmony_ci            images attached to any of the color buffer attachment points
45605bd8deadSopenharmony_ci            can be "framebuffer complete", then the core GL spec will
45615bd8deadSopenharmony_ci            need to be modified to relax the assumption that a color
45625bd8deadSopenharmony_ci            buffer always exists.
45635bd8deadSopenharmony_ci
45645bd8deadSopenharmony_ci            However, since one of the possible likely uses of this
45655bd8deadSopenharmony_ci            extnesion is to support depth texture rendering and stencil
45665bd8deadSopenharmony_ci            rendering for shadowing techniques, it seems like requiring
45675bd8deadSopenharmony_ci            an unused "dummy" color buffer in some cases is both
45685bd8deadSopenharmony_ci            inconvenient and a waste of memory.
45695bd8deadSopenharmony_ci
45705bd8deadSopenharmony_ci            Therefore, framebuffers do not require color attachments to
45715bd8deadSopenharmony_ci            be valid.  Perhaps though we should require that a
45725bd8deadSopenharmony_ci            framebuffer with *no* attachments is invalid.
45735bd8deadSopenharmony_ci
45745bd8deadSopenharmony_ci            It also should be stated that attempting to render without
45755bd8deadSopenharmony_ci            the "appropriate" buffers attached needs to be defined.  For
45765bd8deadSopenharmony_ci            instance, presumably, for depth rendering with no depth
45775bd8deadSopenharmony_ci            buffer attached, the depth test is disabled, as it is in
45785bd8deadSopenharmony_ci            traditional GL.
45795bd8deadSopenharmony_ci
45805bd8deadSopenharmony_ci    (46) In the framebuffer completeness criteria, this extension
45815bd8deadSopenharmony_ci         introduces the idea that rendering can fail for implementation
45825bd8deadSopenharmony_ci         dependent reasons.  Framebuffer completeness also considers
45835bd8deadSopenharmony_ci         implementation *independent* reasons for failure.
45845bd8deadSopenharmony_ci
45855bd8deadSopenharmony_ci         Do we need to make special distinction between the cases where
45865bd8deadSopenharmony_ci         a framebuffer is not complete because of implementation
45875bd8deadSopenharmony_ci         dependent or because of implementation indepenent reasons?
45885bd8deadSopenharmony_ci
45895bd8deadSopenharmony_ci            RESOLUTION: resolved, yes, though this is really tied into
45905bd8deadSopenharmony_ci            how we resolve the minimum requirements for supporting this
45915bd8deadSopenharmony_ci            extension.  See issue (61)
45925bd8deadSopenharmony_ci
45935bd8deadSopenharmony_ci            Examples where a framebuffer may be incomplete on some
45945bd8deadSopenharmony_ci            implementations but not others include:
45955bd8deadSopenharmony_ci                - 16 bit z-buffer used with 8 bit stencil buffer
45965bd8deadSopenharmony_ci                - 32 bit color buffer with 16 bit depth buffer
45975bd8deadSopenharmony_ci                - others?
45985bd8deadSopenharmony_ci
45995bd8deadSopenharmony_ci            Examples where framebuffer MUST be incomplete on all
46005bd8deadSopenharmony_ci            implementations include:
46015bd8deadSopenharmony_ci
46025bd8deadSopenharmony_ci                - color-renderable image attached to a non-color
46035bd8deadSopenharmony_ci                  attachment point
46045bd8deadSopenharmony_ci
46055bd8deadSopenharmony_ci                - depth-renderable image attached to a non-depth
46065bd8deadSopenharmony_ci                  attachment point
46075bd8deadSopenharmony_ci
46085bd8deadSopenharmony_ci                - stencil-renderable image attached to a non-stencil
46095bd8deadSopenharmony_ci                  attachment point
46105bd8deadSopenharmony_ci
46115bd8deadSopenharmony_ci                - all images attached to a framebuffer do not have the
46125bd8deadSopenharmony_ci                  same dimensions
46135bd8deadSopenharmony_ci
46145bd8deadSopenharmony_ci                - multiple render targets of different bit depths
46155bd8deadSopenharmony_ci
46165bd8deadSopenharmony_ci                - texture image attached to the framebuffer is part of a
46175bd8deadSopenharmony_ci                  currently bound and enabled texture and the image is
46185bd8deadSopenharmony_ci                  within the range of mipmap levels that can be fetched
46195bd8deadSopenharmony_ci                  by rendering.
46205bd8deadSopenharmony_ci
46215bd8deadSopenharmony_ci           To make this determination we need to describe the criteria
46225bd8deadSopenharmony_ci           we should use to determine whether a framebuffer *can* or
46235bd8deadSopenharmony_ci           *must* be incomplete.
46245bd8deadSopenharmony_ci
46255bd8deadSopenharmony_ci           The arguments for putting state vectors into the "can" fail
46265bd8deadSopenharmony_ci           case is that a later extension can come along and simply
46275bd8deadSopenharmony_ci           relax those portions of the framebuffer completeness
46285bd8deadSopenharmony_ci           definiton with no additional API.  State vectors classified
46295bd8deadSopenharmony_ci           as "must" fail cases would at least require the later
46305bd8deadSopenharmony_ci           extension to add an additional enable to start passing.
46315bd8deadSopenharmony_ci
46325bd8deadSopenharmony_ci    (47) Certain state-modification operations can cause a change to the
46335bd8deadSopenharmony_ci         validated state of a framebufffer.  (I.e., can make a
46345bd8deadSopenharmony_ci         framebuffer that was complete become incomplete, or
46355bd8deadSopenharmony_ci         vice-versa).  Do we want to list exactly which
46365bd8deadSopenharmony_ci         state-modification routines can cause this to happen?  If so
46375bd8deadSopenharmony_ci         what is the list?
46385bd8deadSopenharmony_ci
46395bd8deadSopenharmony_ci            RESOLUTION: resolved, the answer is: yes we want to
46405bd8deadSopenharmony_ci            delineate exactly which routines can cause validation state
46415bd8deadSopenharmony_ci            changes.
46425bd8deadSopenharmony_ci
46435bd8deadSopenharmony_ci            Currently any routine which changes any of the following
46445bd8deadSopenharmony_ci            state can potentially cause framebuffer completness to
46455bd8deadSopenharmony_ci            change:
46465bd8deadSopenharmony_ci
46475bd8deadSopenharmony_ci                framebuffer state
46485bd8deadSopenharmony_ci                state changes to attached objects
46495bd8deadSopenharmony_ci                currently bound fragment program
46505bd8deadSopenharmony_ci                texture enable state
46515bd8deadSopenharmony_ci
46525bd8deadSopenharmony_ci            The list of operations that can cause framebuffer a change
46535bd8deadSopenharmony_ci            to framebuffer completeness are spelled out in section
46545bd8deadSopenharmony_ci            4.4.4.2.
46555bd8deadSopenharmony_ci
46565bd8deadSopenharmony_ci    (48) What information should be returned from
46575bd8deadSopenharmony_ci         CheckFramebufferStatusEXT()?
46585bd8deadSopenharmony_ci
46595bd8deadSopenharmony_ci            New RESOLUTION: resolved: 8 possible enum values, see issue
46605bd8deadSopenharmony_ci            (55)
46615bd8deadSopenharmony_ci
46625bd8deadSopenharmony_ci            Previous RESOLUTION: resolved, return one of three enumerated values:
46635bd8deadSopenharmony_ci                1. GL_FRAMEBUFFER_COMPLETE_EXT
46645bd8deadSopenharmony_ci                2. GL_FRAMEBUFFER_UNSUPPORTED_EXT
46655bd8deadSopenharmony_ci                3. GL_FRAMEBUFFER_INCOMPLETE_EXT
46665bd8deadSopenharmony_ci            where the three values mean the following:
46675bd8deadSopenharmony_ci                1. framebuffer is complete and supported
46685bd8deadSopenharmony_ci                2. framebuffer is not supported for implementation *dependent*   reason
46695bd8deadSopenharmony_ci                3. framebuffer is incomplete for    implementation *independent* reason
46705bd8deadSopenharmony_ci
46715bd8deadSopenharmony_ci            We considered the following two sets of enums:
46725bd8deadSopenharmony_ci                Set 1:
46735bd8deadSopenharmony_ci                    GL_FRAMEBUFFER_COMPLETE_EXT
46745bd8deadSopenharmony_ci                    GL_FRAMEBUFFER_NOT_COMPLETE_EXT
46755bd8deadSopenharmony_ci                    GL_FRAMEBUFFER_NOT_SUPPORTED_EXT
46765bd8deadSopenharmony_ci
46775bd8deadSopenharmony_ci                Set 2:
46785bd8deadSopenharmony_ci                    GL_FRAMEBUFFER_COMPLETE_EXT
46795bd8deadSopenharmony_ci                    GL_FRAMEBUFFER_INCOMPLETE_EXT
46805bd8deadSopenharmony_ci                    GL_FRAMEBUFFER_UNSUPPORTED_EXT
46815bd8deadSopenharmony_ci
46825bd8deadSopenharmony_ci            New resolution is Set 2.
46835bd8deadSopenharmony_ci
46845bd8deadSopenharmony_ci            NOTE: In order to fully resolve issue (55), we expanded this set
46855bd8deadSopenharmony_ci            of enums to identify all of the implementation-independent
46865bd8deadSopenharmony_ci            causes for a failure of the framebuffer completeness test.
46875bd8deadSopenharmony_ci
46885bd8deadSopenharmony_ci            Originally, we had decided to have a query where the
46895bd8deadSopenharmony_ci            query returns one of three possible values
46905bd8deadSopenharmony_ci
46915bd8deadSopenharmony_ci            One possible set of names that could be returned included:
46925bd8deadSopenharmony_ci                FRAMEBUFFER_COMPLETE, and
46935bd8deadSopenharmony_ci                FRAMEBUFFER_HW_DEPENDENT, and
46945bd8deadSopenharmony_ci                FRAMEBUFFER_HW_INDEPENDENT
46955bd8deadSopenharmony_ci
46965bd8deadSopenharmony_ci            How much information we return from CheckFramebufferStatus
46975bd8deadSopenharmony_ci            is a function of how we expect the return value to be used.
46985bd8deadSopenharmony_ci            A framebuffer object that is not complete for implementation
46995bd8deadSopenharmony_ci            *indepednent* reasons is really an indication of a
47005bd8deadSopenharmony_ci            programming error (like mismatched sizes) and should only
47015bd8deadSopenharmony_ci            occur during development phase of an application.  The
47025bd8deadSopenharmony_ci            correct response to this failure is to modify the
47035bd8deadSopenharmony_ci            application to fix the bug.  After application development,
47045bd8deadSopenharmony_ci            a framebuffer object that is not complete for implementation
47055bd8deadSopenharmony_ci            *dependent* reasons is possible.  However, it's not yet
47065bd8deadSopenharmony_ci            clear whether we can easily characterize these reasons for
47075bd8deadSopenharmony_ci            failure in a programmatic fashion that would really offer
47085bd8deadSopenharmony_ci            the application enough information to do something different
47095bd8deadSopenharmony_ci            at runtime.  Perhaps a human readable info log, intended
47105bd8deadSopenharmony_ci            just as an application debugging aid, would be more
47115bd8deadSopenharmony_ci            appropriate.
47125bd8deadSopenharmony_ci
47135bd8deadSopenharmony_ci            We also considered whether we needed two separate queries:
47145bd8deadSopenharmony_ci            One that queried whether the framebuffer was complete
47155bd8deadSopenharmony_ci            according to the spec, and one that queried whether the
47165bd8deadSopenharmony_ci            framebuffer was supported.  This was a little problematic as
47175bd8deadSopenharmony_ci            it might not be possible to answer the
47185bd8deadSopenharmony_ci            "IsFramebufferSupported" query until the framebuffer was
47195bd8deadSopenharmony_ci            complete.  A possible solution would have been to return
47205bd8deadSopenharmony_ci            UNKNOWN from the "IsFramebufferSupported" query until the
47215bd8deadSopenharmony_ci            "IsFramebufferComplete" query returned TRUE.
47225bd8deadSopenharmony_ci
47235bd8deadSopenharmony_ci            In any event, we decided a single query was a simpler
47245bd8deadSopenharmony_ci            solution.
47255bd8deadSopenharmony_ci
47265bd8deadSopenharmony_ci            In addition, the proposed "format group / format
47275bd8deadSopenharmony_ci            restriction" API (see issue 12) should make the
47285bd8deadSopenharmony_ci            implementation-dependent framebuffer incomplete case much
47295bd8deadSopenharmony_ci            less likely (and perhaps impossible) to occur.
47305bd8deadSopenharmony_ci
47315bd8deadSopenharmony_ci            Note that if a framebuffer's state violates more than one of
47325bd8deadSopenharmony_ci            the framebuffer completeness rules described in section
47335bd8deadSopenharmony_ci            4.4.4.2, then it is undefined which of the enumerated value
47345bd8deadSopenharmony_ci            corresponding to one of the violated rules will be returned
47355bd8deadSopenharmony_ci            by CheckFramebufferStatusEXT.  Since the initial state of a
47365bd8deadSopenharmony_ci            framebuffer violates multiple rules from section 4.4.4.2,
47375bd8deadSopenharmony_ci            it is therefore undefined exactly which value is returned if
47385bd8deadSopenharmony_ci            CheckFramebufferStatusEXT is called while bound to a newly
47395bd8deadSopenharmony_ci            created framebuffer object.
47405bd8deadSopenharmony_ci
47415bd8deadSopenharmony_ci    (49) When this extension is used in conjunction with MRT (multiple
47425bd8deadSopenharmony_ci         render targets), it would naively be possible to create a
47435bd8deadSopenharmony_ci         framebuffer that had different color bit depths/formats for
47445bd8deadSopenharmony_ci         various color attachment points.  Should this be allowed?
47455bd8deadSopenharmony_ci
47465bd8deadSopenharmony_ci            RESOLUTION: resolved, no, not in this extension.
47475bd8deadSopenharmony_ci            A soon to follow extension may add this feature.
47485bd8deadSopenharmony_ci
47495bd8deadSopenharmony_ci            This feature could be supported by simply not requiring that
47505bd8deadSopenharmony_ci            all of the FRAMEBUFFER_COLOR_ATTACHMENTn images share the
47515bd8deadSopenharmony_ci            same internal format.  We decided against doing so, however.
47525bd8deadSopenharmony_ci
47535bd8deadSopenharmony_ci            ARB_draw_buffers and OpenGL-2.0 do not provide any mechanism
47545bd8deadSopenharmony_ci            to support rendering to multiple color buffers of different
47555bd8deadSopenharmony_ci            formats.  Consequently, we chose not to extend OpenGL in
47565bd8deadSopenharmony_ci            this manner as part of the EXT_framebuffer_object extension.
47575bd8deadSopenharmony_ci
47585bd8deadSopenharmony_ci            Presumably, a future layered extension could easily add this
47595bd8deadSopenharmony_ci            feature.  There are some open questions about exactly how
47605bd8deadSopenharmony_ci            this might work.  For instance, what should a query of
47615bd8deadSopenharmony_ci            RED_BITS return if the attached color-renderable images have
47625bd8deadSopenharmony_ci            different formats?  In any event, we leave the details of
47635bd8deadSopenharmony_ci            rendering to differently formatted MRT for a future
47645bd8deadSopenharmony_ci            extension to define.
47655bd8deadSopenharmony_ci
47665bd8deadSopenharmony_ci    (50) This extension introduces the concept of attaching one GL
47675bd8deadSopenharmony_ci         object (texture, renderbuffer) to another GL object
47685bd8deadSopenharmony_ci         (framebuffer).  In many ways this situation is analogous to a
47695bd8deadSopenharmony_ci         previously poorly specified situation where a GL object could
47705bd8deadSopenharmony_ci         be attached to multiple contexts and the issues this raises
47715bd8deadSopenharmony_ci         with deletion and state propogation are similar.  Several
47725bd8deadSopenharmony_ci         issues resolutions have been predicated on the assumption that
47735bd8deadSopenharmony_ci         as we specify this container/member relationship, the
47745bd8deadSopenharmony_ci         generation of GL errors should never be triggered in one
47755bd8deadSopenharmony_ci         context based on the asychronous actions of another context.
47765bd8deadSopenharmony_ci         Is this a valid premise?
47775bd8deadSopenharmony_ci
47785bd8deadSopenharmony_ci         In other words, should we be using the prevention of
47795bd8deadSopenharmony_ci         asynchronously generated GL errors as a design constraint?
47805bd8deadSopenharmony_ci
47815bd8deadSopenharmony_ci            RESOLUTION: resolved, no.
47825bd8deadSopenharmony_ci
47835bd8deadSopenharmony_ci            We didn't officially decide on this as a design constraint.
47845bd8deadSopenharmony_ci            However, we essentially decided it by proxy.  We decided in
47855bd8deadSopenharmony_ci            issue (26) and (66) that an incomplete framebuffer can cause
47865bd8deadSopenharmony_ci            GL errors on rendering or reading the framebuffer.
47875bd8deadSopenharmony_ci            Consequently, this means a framebuffer shared by two
47885bd8deadSopenharmony_ci            contexts can be made incomplete by either context, and
47895bd8deadSopenharmony_ci            therefore each context can effectively cause the other
47905bd8deadSopenharmony_ci            context to start generating errors asynchronously.
47915bd8deadSopenharmony_ci
47925bd8deadSopenharmony_ci            We would expect that the state of framebuffer completness,
47935bd8deadSopenharmony_ci            like all the state of all shared objects, is not
47945bd8deadSopenharmony_ci            "guaranteed" to show up in another context until that
47955bd8deadSopenharmony_ci            context makes an "atomic" request to the server (like a
47965bd8deadSopenharmony_ci            BindFramebuffer for instance).  Until that point, it is
47975bd8deadSopenharmony_ci            undefined whether the state change will show up in the other
47985bd8deadSopenharmony_ci            context, just like any state change made on a shared texture
47995bd8deadSopenharmony_ci            object.
48005bd8deadSopenharmony_ci
48015bd8deadSopenharmony_ci    (51) What api should we use to query the attachments of
48025bd8deadSopenharmony_ci         the currently bound framebuffer?
48035bd8deadSopenharmony_ci
48045bd8deadSopenharmony_ci            RESOLUTION: resolved, (b)
48055bd8deadSopenharmony_ci
48065bd8deadSopenharmony_ci            This is an issue because the relevant state
48075bd8deadSopenharmony_ci            for a specific attachment point is a function
48085bd8deadSopenharmony_ci            of the type of object attached to that that attachment point.
48095bd8deadSopenharmony_ci            The attachment point state needs to select a
48105bd8deadSopenharmony_ci            an image from an object which may have
48115bd8deadSopenharmony_ci            a collection of images, for instance
48125bd8deadSopenharmony_ci            the faces of a cube map texture.
48135bd8deadSopenharmony_ci
48145bd8deadSopenharmony_ci            This introduces a kind of "polymorphism" into the
48155bd8deadSopenharmony_ci            framebuffer attachment point that is problematic
48165bd8deadSopenharmony_ci            for queries.
48175bd8deadSopenharmony_ci
48185bd8deadSopenharmony_ci            We have a few options:
48195bd8deadSopenharmony_ci
48205bd8deadSopenharmony_ci            a) Some kind of single atomic query that
48215bd8deadSopenharmony_ci               returns a variable number of values in an array:
48225bd8deadSopenharmony_ci
48235bd8deadSopenharmony_ci               GetFramebufferParameteriv(enum target,
48245bd8deadSopenharmony_ci                                         enum pname,
48255bd8deadSopenharmony_ci                                         int* params);
48265bd8deadSopenharmony_ci                    where
48275bd8deadSopenharmony_ci                    <target> = a framebuffer target
48285bd8deadSopenharmony_ci                    <pname> = {attachment_point}
48295bd8deadSopenharmony_ci
48305bd8deadSopenharmony_ci                    Upon success "params" will contain an array of
48315bd8deadSopenharmony_ci                    values where
48325bd8deadSopenharmony_ci
48335bd8deadSopenharmony_ci                    params[0] = {NONE | TEXTURE | RENDERBUFFER}
48345bd8deadSopenharmony_ci
48355bd8deadSopenharmony_ci                    if params[0] == TEXTURE then
48365bd8deadSopenharmony_ci                        params[1] = texture object name
48375bd8deadSopenharmony_ci                        params[2] = level
48385bd8deadSopenharmony_ci                        params[3] = face
48395bd8deadSopenharmony_ci                        params[4] = image
48405bd8deadSopenharmony_ci                    else if params[0] = RENDERBUFFER then
48415bd8deadSopenharmony_ci                        params[1] = renderbuffer name
48425bd8deadSopenharmony_ci
48435bd8deadSopenharmony_ci                    Elements of the params array not explicitly defined
48445bd8deadSopenharmony_ci                    above will have undefined values.
48455bd8deadSopenharmony_ci
48465bd8deadSopenharmony_ci               One problem with (a) is that we would potentially also
48475bd8deadSopenharmony_ci               need a query to identify how many state variables will
48485bd8deadSopenharmony_ci               come back in this query.  Consider the case where in the
48495bd8deadSopenharmony_ci               future we add a new attachable object type that needs
48505bd8deadSopenharmony_ci               more selections tate or even add new selection state to
48515bd8deadSopenharmony_ci               existing object types.  Applications coded to expect a
48525bd8deadSopenharmony_ci               maximum of n values returned today may break in the
48535bd8deadSopenharmony_ci               future unless they have a way to dynamically learn how
48545bd8deadSopenharmony_ci               many attachment state params will come back from the
48555bd8deadSopenharmony_ci               query.
48565bd8deadSopenharmony_ci
48575bd8deadSopenharmony_ci
48585bd8deadSopenharmony_ci            b) individual queries for all the possible attachment
48595bd8deadSopenharmony_ci               state values.
48605bd8deadSopenharmony_ci
48615bd8deadSopenharmony_ci               We create a new routine to add a new <attachment>
48625bd8deadSopenharmony_ci               argument, otherwise we'd have an explosion of
48635bd8deadSopenharmony_ci               permutations of attachment points and possible attachment
48645bd8deadSopenharmony_ci               selection state values
48655bd8deadSopenharmony_ci
48665bd8deadSopenharmony_ci               This could look like
48675bd8deadSopenharmony_ci
48685bd8deadSopenharmony_ci               void GetFramebufferAttachmentParameteriv(enum target,
48695bd8deadSopenharmony_ci                                                        enum attachment,
48705bd8deadSopenharmony_ci                                                        enum pname,
48715bd8deadSopenharmony_ci                                                        int *param);
48725bd8deadSopenharmony_ci
48735bd8deadSopenharmony_ci                    where
48745bd8deadSopenharmony_ci                    <target> = a framebuffer target
48755bd8deadSopenharmony_ci                    <attachment> = {attachment_point}
48765bd8deadSopenharmony_ci                    <pname> = one of
48775bd8deadSopenharmony_ci                        FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT
48785bd8deadSopenharmony_ci                        FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT
48795bd8deadSopenharmony_ci                        FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT
48805bd8deadSopenharmony_ci                        FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT
48815bd8deadSopenharmony_ci                        FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT
48825bd8deadSopenharmony_ci
48835bd8deadSopenharmony_ci                    Upon success, param will be filled out as follows:
48845bd8deadSopenharmony_ci
48855bd8deadSopenharmony_ci                    if pname is FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT,
48865bd8deadSopenharmony_ci                    then param will contain one of:
48875bd8deadSopenharmony_ci                        { NONE | TEXTURE | RENDERBUFFER },
48885bd8deadSopenharmony_ci
48895bd8deadSopenharmony_ci                    else if pname is
48905bd8deadSopenharmony_ci                    FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT, and
48915bd8deadSopenharmony_ci                    FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT = TEXTURE,
48925bd8deadSopenharmony_ci                    then param will contain:
48935bd8deadSopenharmony_ci                        { name of attached texture }
48945bd8deadSopenharmony_ci
48955bd8deadSopenharmony_ci                    else if pname is
48965bd8deadSopenharmony_ci                    FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT, and
48975bd8deadSopenharmony_ci                    FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT =
48985bd8deadSopenharmony_ci                    RENDERBUFFER, then param will contain:
48995bd8deadSopenharmony_ci                        { renderbuffer object name }
49005bd8deadSopenharmony_ci
49015bd8deadSopenharmony_ci                    else if pname is
49025bd8deadSopenharmony_ci                    FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT, and
49035bd8deadSopenharmony_ci                    FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT = TEXTURE,
49045bd8deadSopenharmony_ci                    then param will contain:
49055bd8deadSopenharmony_ci                        { selected mipmap level of attached texture }
49065bd8deadSopenharmony_ci
49075bd8deadSopenharmony_ci                    else if pname is
49085bd8deadSopenharmony_ci                    FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT,
49095bd8deadSopenharmony_ci                    and FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT =
49105bd8deadSopenharmony_ci                    TEXTURE, then param will contain:
49115bd8deadSopenharmony_ci                        { selected face of attached cube map texture }
49125bd8deadSopenharmony_ci                        { 0 if texture target is not TEXTURE_CUBE_MAP }
49135bd8deadSopenharmony_ci
49145bd8deadSopenharmony_ci                    else if pname is
49155bd8deadSopenharmony_ci                    FRAMEBUFFER_ATTACHMENT_TEXTURE_ZOFFSET_EXT, and
49165bd8deadSopenharmony_ci                    FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT = TEXTURE,
49175bd8deadSopenharmony_ci                    then param will contain:
49185bd8deadSopenharmony_ci                        { selected z-slice/image of attached 3D texture }
49195bd8deadSopenharmony_ci                        { 0 if texture is not 3-dimensional }
49205bd8deadSopenharmony_ci
49215bd8deadSopenharmony_ci                    otherwise, param will contain the value 0.
49225bd8deadSopenharmony_ci
49235bd8deadSopenharmony_ci
49245bd8deadSopenharmony_ci               One problem with option (b) is that it is a little
49255bd8deadSopenharmony_ci               heavy-handed as every piece of state needs its own query
49265bd8deadSopenharmony_ci               and enum
49275bd8deadSopenharmony_ci
49285bd8deadSopenharmony_ci            Given the above choices, and the problems of extending option
49295bd8deadSopenharmony_ci            (a) in the future, (b) is probably the better of the two
49305bd8deadSopenharmony_ci            choices.  It really only adds a few enums, and though it does
49315bd8deadSopenharmony_ci            require an independent function call to obtain each piece of
49325bd8deadSopenharmony_ci            state, this is well-precedented behavior throughout GL.
49335bd8deadSopenharmony_ci
49345bd8deadSopenharmony_ci    (52) Should manual mimpap generation via GenerateMipmap apply to
49355bd8deadSopenharmony_ci         textures regardless of whether they are attached to framebuffer
49365bd8deadSopenharmony_ci         objects?  Should automatic mimpap generation apply to all
49375bd8deadSopenharmony_ci         textures regardless of whether they are attached to framebuffer
49385bd8deadSopenharmony_ci         objects?
49395bd8deadSopenharmony_ci
49405bd8deadSopenharmony_ci            RESOLUTION: resolved, (a) - both apply to both.
49415bd8deadSopenharmony_ci
49425bd8deadSopenharmony_ci         This is an issue because the introduction of GenerateMipmap is
49435bd8deadSopenharmony_ci         intended both to address long standing complaints about the
49445bd8deadSopenharmony_ci         existing "automatic" mipmap generation API and to provide a
49455bd8deadSopenharmony_ci         clear trigger for render to texture API's to know when to do
49465bd8deadSopenharmony_ci         the mipmap generation.
49475bd8deadSopenharmony_ci
49485bd8deadSopenharmony_ci         These API's could be considered completely orthogonally.  It's
49495bd8deadSopenharmony_ci         clear how they could interoperate.  The question is should they
49505bd8deadSopenharmony_ci         interoperate, or should one supercede the other?
49515bd8deadSopenharmony_ci
49525bd8deadSopenharmony_ci         There are a couple of ways to address this issue:
49535bd8deadSopenharmony_ci
49545bd8deadSopenharmony_ci            a) "automatic" mipmap generation applies always and is
49555bd8deadSopenharmony_ci                triggered by any gl{Copy}Tex{Sub}Image call if
49565bd8deadSopenharmony_ci                GENERATE_MIPMAP is set to TRUE.  "Manual" mipmap
49575bd8deadSopenharmony_ci                generation applies always and is triggered by a call to
49585bd8deadSopenharmony_ci                GenerateMipmap
49595bd8deadSopenharmony_ci
49605bd8deadSopenharmony_ci            b) "automatic" mipmap generation applies only
49615bd8deadSopenharmony_ci               to textures which are not attached to framebuffer
49625bd8deadSopenharmony_ci               objects, calls to GenerateMipmap on "unattached" textures
49635bd8deadSopenharmony_ci               are ignored.
49645bd8deadSopenharmony_ci
49655bd8deadSopenharmony_ci               "manual" mipmap generation applies only to textures which
49665bd8deadSopenharmony_ci               are attached to framebuffer objects, the value of
49675bd8deadSopenharmony_ci               GENERATE_MIPMAP for "attached" textures is ignored
49685bd8deadSopenharmony_ci
49695bd8deadSopenharmony_ci           c) Like option (b), but allow GenerateMipmap to
49705bd8deadSopenharmony_ci              apply to all textures and only let automatic mipmap
49715bd8deadSopenharmony_ci              generation apply to "non-attached" textures.
49725bd8deadSopenharmony_ci
49735bd8deadSopenharmony_ci           d) Create an enable or other piece of state
49745bd8deadSopenharmony_ci              to toggle between allowing automatic and allowing manual
49755bd8deadSopenharmony_ci              generation.
49765bd8deadSopenharmony_ci
49775bd8deadSopenharmony_ci        We disregarded (d) because it's not clear why an application
49785bd8deadSopenharmony_ci        that had the freedom to set this new enable bit wouldn't
49795bd8deadSopenharmony_ci        simply just turn off the legacy automatic mimpap generation
49805bd8deadSopenharmony_ci        to start with.
49815bd8deadSopenharmony_ci
49825bd8deadSopenharmony_ci        Of the remaining choices, (a) is the most "orthogonal".  The
49835bd8deadSopenharmony_ci        intent of adding GenerateMipmap is to provide a cleaner and
49845bd8deadSopenharmony_ci        saner interface to mipmap generation that we would encourage
49855bd8deadSopenharmony_ci        developers to use over the automatic method.  Given that, it
49865bd8deadSopenharmony_ci        seems like restricting the "manual" generation to certain
49875bd8deadSopenharmony_ci        cases doesn't serve that goal, so we wish to allow its use
49885bd8deadSopenharmony_ci        on any textures, attached or not.
49895bd8deadSopenharmony_ci
49905bd8deadSopenharmony_ci    (53) When supporting ARB_draw_buffers, do we need the level of
49915bd8deadSopenharmony_ci         indirection between fragment color outputs and attached
49925bd8deadSopenharmony_ci         mages provided in that API?
49935bd8deadSopenharmony_ci
49945bd8deadSopenharmony_ci            RESOLUTION: yes
49955bd8deadSopenharmony_ci
49965bd8deadSopenharmony_ci            ARB_draw_buffers allows the user to set up an "indirection
49975bd8deadSopenharmony_ci            table" between the fragment color outputs ("result.color[n]"
49985bd8deadSopenharmony_ci            in ARB_fragment_program, and "gl_FragData[n]" in GLSL) and
49995bd8deadSopenharmony_ci            the attached draw buffers (FRONT, BACK, LEFT, RIGHT, etc).
50005bd8deadSopenharmony_ci
50015bd8deadSopenharmony_ci            Since EXT_framebuffer_object is creating new non-visible
50025bd8deadSopenharmony_ci            framebuffer objects for which the legacy attachment points
50035bd8deadSopenharmony_ci            may not be appropriate, we could consider naming the
50045bd8deadSopenharmony_ci            attachment points by numerical index (COLOR0 ... COLORn) in
50055bd8deadSopenharmony_ci            which case we could consider dropping this level of
50065bd8deadSopenharmony_ci            indirection and allowing the fragment shader to output
50075bd8deadSopenharmony_ci            directly into the numerically specified COLOR0 attachment
50085bd8deadSopenharmony_ci            point with no indirection.
50095bd8deadSopenharmony_ci
50105bd8deadSopenharmony_ci            However, this indirection is deemed to be useful becaues it
50115bd8deadSopenharmony_ci            allows the application to redirect the fragment color
50125bd8deadSopenharmony_ci            outputs without changing either the fragment shader itself
50135bd8deadSopenharmony_ci            or the current framebuffer attachments, both of which are
50145bd8deadSopenharmony_ci            believed to be heavier-weight state change operations than
50155bd8deadSopenharmony_ci            simply changing the indirection table via glDrawBuffers..
50165bd8deadSopenharmony_ci
50175bd8deadSopenharmony_ci            Therefore, we elect to retain this level of indirection.
50185bd8deadSopenharmony_ci            This leaves open the question of what to call the attachment
50195bd8deadSopenharmony_ci            points.  See issue (54).
50205bd8deadSopenharmony_ci
50215bd8deadSopenharmony_ci    (54) What should we name the logical buffer attachment points,
50225bd8deadSopenharmony_ci         bearing in mind the relationship to ARB_draw_buffers?
50235bd8deadSopenharmony_ci
50245bd8deadSopenharmony_ci            RESOLUTION: resolved, option (E), which is a modified
50255bd8deadSopenharmony_ci            version of (C).  Specifically, we use the names
50265bd8deadSopenharmony_ci            COLOR_ATTACHMENT0_EXT through COLOR_ATTACHMENTn_EXT,
50275bd8deadSopenharmony_ci            DEPTH_ATTACHMENT_EXT, and STENCIL_ATTACHMENT_EXT (and any
50285bd8deadSopenharmony_ci            future attachment points also get the ATTACHMENT suffix).
50295bd8deadSopenharmony_ci
50305bd8deadSopenharmony_ci            The reason this is an issue is that prior to
50315bd8deadSopenharmony_ci            EXT_framebuffer_object, the names of the various color
50325bd8deadSopenharmony_ci            logical buffer "attachment points" were heavily influenced
50335bd8deadSopenharmony_ci            by their intended usage in a graphical window-system.
50345bd8deadSopenharmony_ci            Logical buffers for BACK and FRONT_LEFT make sense in the
50355bd8deadSopenharmony_ci            context of double buffering and stereo presentation, but
50365bd8deadSopenharmony_ci            their use in off-screen rendering situations is
50375bd8deadSopenharmony_ci            anachronistic at best and perhaps even confusing.
50385bd8deadSopenharmony_ci
50395bd8deadSopenharmony_ci            There are several options:
50405bd8deadSopenharmony_ci
50415bd8deadSopenharmony_ci            Option (A): stick with the "legacy" names
50425bd8deadSopenharmony_ci
50435bd8deadSopenharmony_ci                This would have us use all of the legacy names which are
50445bd8deadSopenharmony_ci                used to identify a single buffer: FRONT_LEFT,
50455bd8deadSopenharmony_ci                FRONT_RIGHT, BACK_LEFT, BACK_RIGHT, and AUX0..AUXn.
50465bd8deadSopenharmony_ci
50475bd8deadSopenharmony_ci                This option would require no change to DrawBuffersARB().
50485bd8deadSopenharmony_ci
50495bd8deadSopenharmony_ci            Option (B): AUXn names
50505bd8deadSopenharmony_ci
50515bd8deadSopenharmony_ci                If we wish to avoid using the legacy names, one option
50525bd8deadSopenharmony_ci                is to re-use another numerically named set of color
50535bd8deadSopenharmony_ci                buffers, the AUX buffers, and only allow framebuffer
50545bd8deadSopenharmony_ci                objects to support AUX0..AUXn attachment points.
50555bd8deadSopenharmony_ci
50565bd8deadSopenharmony_ci                This has the advantage of being easy to specify, and
50575bd8deadSopenharmony_ci                numerically delimit, but is a little strange as
50585bd8deadSopenharmony_ci                framebuffer objects could conceivably support the same
50595bd8deadSopenharmony_ci                number of AUX buffers as the implementation supports
50605bd8deadSopenharmony_ci                multiple render targets.  This would have the awkward
50615bd8deadSopenharmony_ci                consequence of allowing framebuffer objects to support
50625bd8deadSopenharmony_ci                more AUX buffers than the default framebuffer could
50635bd8deadSopenharmony_ci                support via the pixel format selection mechanism.
50645bd8deadSopenharmony_ci
50655bd8deadSopenharmony_ci                This option would require no specific change to
50665bd8deadSopenharmony_ci                DrawBuffers but might require non-default framebuffers
50675bd8deadSopenharmony_ci                to support more AUX buffers than the default framebuffer
50685bd8deadSopenharmony_ci                controlled by the window-system pixel format.
50695bd8deadSopenharmony_ci
50705bd8deadSopenharmony_ci            Option (C): COLORn names
50715bd8deadSopenharmony_ci
50725bd8deadSopenharmony_ci                Another option is to rename the color buffer attachment
50735bd8deadSopenharmony_ci                points for application-created framebuffer objects to
50745bd8deadSopenharmony_ci                COLOR0..COLORn.  This has the advantage of avoiding the
50755bd8deadSopenharmony_ci                legacy window-centric names, and avoiding the confusion
50765bd8deadSopenharmony_ci                with AUX buffers.  When considered in conjunction with
50775bd8deadSopenharmony_ci                the decision in issue (53) to support a level of
50785bd8deadSopenharmony_ci                indirection when using ARB_draw_buffers, however, the
50795bd8deadSopenharmony_ci                user of the names COLOR0..COLORn may be confusing.  For
50805bd8deadSopenharmony_ci                instance, if an ARB fragment program contains color
50815bd8deadSopenharmony_ci                output to "result.color[3]", it will not necessarily
50825bd8deadSopenharmony_ci                output to COLOR3.  It will actually write to the buffer
50835bd8deadSopenharmony_ci                specified by DrawBuffersARB for DRAW_BUFFER3 which may
50845bd8deadSopenharmony_ci                or may not be COLOR3.
50855bd8deadSopenharmony_ci
50865bd8deadSopenharmony_ci                This option would require an update to DrawBuffers to
50875bd8deadSopenharmony_ci                accept the new COLOR0..COLORn values as valid draw
50885bd8deadSopenharmony_ci                buffers and would require a change to DrawBuffers to
50895bd8deadSopenharmony_ci                disallow the "legacy" names.  Or at the very least we
50905bd8deadSopenharmony_ci                would need some language to describe what happens if the
50915bd8deadSopenharmony_ci                DrawBuffers are using the legacy names when the
50925bd8deadSopenharmony_ci                currently bound framebuffer is not the default window
50935bd8deadSopenharmony_ci                system framebuffer.
50945bd8deadSopenharmony_ci
50955bd8deadSopenharmony_ci            Option (D): DATAn names
50965bd8deadSopenharmony_ci
50975bd8deadSopenharmony_ci                Yet another option is to call these attachment points
50985bd8deadSopenharmony_ci                DATA0..DATAn.  This is the same as option (C) but uses
50995bd8deadSopenharmony_ci                the word DATA instead of COLOR.  This has the advantage
51005bd8deadSopenharmony_ci                of avoiding the above problems with COLOR0..COLORN, but
51015bd8deadSopenharmony_ci                introduces a similar conflict with GLSL which uses the
51025bd8deadSopenharmony_ci                "gl_FragData[n]" name for its output.  Additionally,
51035bd8deadSopenharmony_ci                since we only support multiple render targets for color
51045bd8deadSopenharmony_ci                logical buffers, it may be that using the word DATA is
51055bd8deadSopenharmony_ci                considered too abstract/general.
51065bd8deadSopenharmony_ci
51075bd8deadSopenharmony_ci            Option (E): add ATTACHMENT to *ALL* names
51085bd8deadSopenharmony_ci
51095bd8deadSopenharmony_ci                In order to avoid the confusion of option (C) and (D),
51105bd8deadSopenharmony_ci                we can choose to be more verbose.  We can add the word
51115bd8deadSopenharmony_ci                _ATTACHMENT to distinguish these enums from the color
51125bd8deadSopenharmony_ci                outputs of a fragment program or fragment shader.  For
51135bd8deadSopenharmony_ci                symmetry we also add _ATTACHMENT to the DEPTH and
51145bd8deadSopenharmony_ci                STENCIL (and any other to-be-added) attachment points.
51155bd8deadSopenharmony_ci
51165bd8deadSopenharmony_ci                Similar to (C) and (D), this option requires an update
51175bd8deadSopenharmony_ci                to DrawBuffers to at least accept the new enum values.
51185bd8deadSopenharmony_ci                We could choose to make it illegal to specify the legacy
51195bd8deadSopenharmony_ci                values for non-default framebuffers as well.  This is
51205bd8deadSopenharmony_ci                essentially covered by issue (55).
51215bd8deadSopenharmony_ci
51225bd8deadSopenharmony_ci            Here is an pseudo-code example using option (E):
51235bd8deadSopenharmony_ci
51245bd8deadSopenharmony_ci                // Assume presence of color renderbuffers
51255bd8deadSopenharmony_ci                // with names 1000, 2000, 3000, 4000
51265bd8deadSopenharmony_ci
51275bd8deadSopenharmony_ci                GLuint db[4] =
51285bd8deadSopenharmony_ci                    { COLOR_ATTACHMENT4, COLOR_ATTACHMENT7,
51295bd8deadSopenharmony_ci                      COLOR_ATTACHMENT1, COLOR_ATTACHMENT2 };
51305bd8deadSopenharmony_ci
51315bd8deadSopenharmony_ci                glDrawBuffers(4, db);
51325bd8deadSopenharmony_ci
51335bd8deadSopenharmony_ci                glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,   COLOR_ATTACHMENT4,
51345bd8deadSopenharmony_ci                                             GL_RENDERBUFFER_EXT, 1000);
51355bd8deadSopenharmony_ci
51365bd8deadSopenharmony_ci                glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,   COLOR_ATTACHMENT7,
51375bd8deadSopenharmony_ci                                             GL_RENDERBUFFER_EXT, 2000);
51385bd8deadSopenharmony_ci
51395bd8deadSopenharmony_ci                glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,   COLOR_ATTACHMENT1,
51405bd8deadSopenharmony_ci                                             GL_RENDERBUFFER_EXT, 3000);
51415bd8deadSopenharmony_ci
51425bd8deadSopenharmony_ci                glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,   COLOR_ATTACHMENT2,
51435bd8deadSopenharmony_ci                                             GL_RENDERBUFFER_EXT, 4000);
51445bd8deadSopenharmony_ci
51455bd8deadSopenharmony_ci                Then in ARB_fragment_program
51465bd8deadSopenharmony_ci                    result.color[0] writes to COLOR_ATTACHMENT4  (i.e., renderbuffer 1000)
51475bd8deadSopenharmony_ci                    result.color[1] writes to COLOR_ATTACHMENT7  (i.e., renderbuffer 2000)
51485bd8deadSopenharmony_ci                    result.color[2] writes to COLOR_ATTACHMENT1  (i.e., renderbuffer 3000)
51495bd8deadSopenharmony_ci                    result.color[3] writes to COLOR_ATTACHMENT2  (i.e., renderbuffer 4000)
51505bd8deadSopenharmony_ci
51515bd8deadSopenharmony_ci                And in ARB_fragment_shader
51525bd8deadSopenharmony_ci                    gl_FragData[0]  writes to COLOR_ATTACHMENT4  (i.e., renderbuffer 1000)
51535bd8deadSopenharmony_ci                    gl_FragData[1]  writes to COLOR_ATTACHMENT7  (i.e., renderbuffer 2000)
51545bd8deadSopenharmony_ci                    gl_FragData[2]  writes to COLOR_ATTACHMENT1  (i.e., renderbuffer 3000)
51555bd8deadSopenharmony_ci                    gl_FragData[3]  writes to COLOR_ATTACHMENT2  (i.e., renderbuffer 4000)
51565bd8deadSopenharmony_ci
51575bd8deadSopenharmony_ci
51585bd8deadSopenharmony_ci            See also issue (57) for discussion on querying the number of
51595bd8deadSopenharmony_ci            available color buffers.
51605bd8deadSopenharmony_ci
51615bd8deadSopenharmony_ci    (55) What should happen if the current DRAW_BUFFER(s) point to a
51625bd8deadSopenharmony_ci         non-existent logical buffer?  Likewise for READ_BUFFER.
51635bd8deadSopenharmony_ci
51645bd8deadSopenharmony_ci            RESOLUTION: resolved
51655bd8deadSopenharmony_ci
51665bd8deadSopenharmony_ci                partial resolution #1: DrawBuffer(s)/ReadBuffer throws
51675bd8deadSopenharmony_ci                an error if the buffer does not "exist" for all
51685bd8deadSopenharmony_ci                framebuffers (default and non-default).
51695bd8deadSopenharmony_ci
51705bd8deadSopenharmony_ci                    Should it be an error to call drawBuffer on a
51715bd8deadSopenharmony_ci                    non-default framebuffer if named buffer does not
51725bd8deadSopenharmony_ci                    exist?
51735bd8deadSopenharmony_ci
51745bd8deadSopenharmony_ci                        Resolved: yes
51755bd8deadSopenharmony_ci
51765bd8deadSopenharmony_ci                partial resolution #2: The test for having a valid draw
51775bd8deadSopenharmony_ci                and read buffer should be part of framebuffer
51785bd8deadSopenharmony_ci                completeness test.
51795bd8deadSopenharmony_ci
51805bd8deadSopenharmony_ci                    Should be part of completeness test and should all 5
51815bd8deadSopenharmony_ci                    indpenent reasons add 5 enums?
51825bd8deadSopenharmony_ci
51835bd8deadSopenharmony_ci                        Resolved: yes
51845bd8deadSopenharmony_ci
51855bd8deadSopenharmony_ci                partial resolution #3: we should create an enum for
51865bd8deadSopenharmony_ci                each implementation independent reason for failing
51875bd8deadSopenharmony_ci                the framebuffer completeness test of section 4.4.4.1
51885bd8deadSopenharmony_ci
51895bd8deadSopenharmony_ci                    Current names (could change...)
51905bd8deadSopenharmony_ci                        FRAMEBUFFER_COMPLETE_EXT
51915bd8deadSopenharmony_ci                        FRAMEBUFFER_INCOMPLETE_ATTACHMENTS_EXT
51925bd8deadSopenharmony_ci                        FRAMEBUFFER_INCOMPLETE_IMAGES_EXT
51935bd8deadSopenharmony_ci                        FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT
51945bd8deadSopenharmony_ci                        FRAMEBUFFER_INCOMPLETE_FORMATS_EXT
51955bd8deadSopenharmony_ci                        FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT
51965bd8deadSopenharmony_ci                        FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT
51975bd8deadSopenharmony_ci                        FRAMEBUFFER_UNSUPPORTED_EXT
51985bd8deadSopenharmony_ci
51995bd8deadSopenharmony_ci                        NOTE: as per resolution of issue (78)
52005bd8deadSopenharmony_ci                        FRAMEBUFFER_INCOMPLETE_ATTACHMENTS_EXT
52015bd8deadSopenharmony_ci                        became
52025bd8deadSopenharmony_ci                        FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT
52035bd8deadSopenharmony_ci                        and
52045bd8deadSopenharmony_ci                        FRAMEBUFFER_INCOMPLETE_IMAGES_EXT
52055bd8deadSopenharmony_ci                        was dropped.
52065bd8deadSopenharmony_ci
52075bd8deadSopenharmony_ci            This issue is intertwined with issue (56), which discusses
52085bd8deadSopenharmony_ci            whether the DRAW_BUFFER and READ_BUFFER are context or
52095bd8deadSopenharmony_ci            framebuffer object state.
52105bd8deadSopenharmony_ci
52115bd8deadSopenharmony_ci            First, some background: If DRAW_BUFFER state is part of the
52125bd8deadSopenharmony_ci            context state vector rather than the framebuffer object
52135bd8deadSopenharmony_ci            state vector (see issue 56), then there are three ways to
52145bd8deadSopenharmony_ci            cause DRAW_BUFFER to reference a color buffer attachment
52155bd8deadSopenharmony_ci            point that "does not exist" in the currently bound
52165bd8deadSopenharmony_ci            framebuffer.  If DRAW_BUFFER is part of the framebuffer
52175bd8deadSopenharmony_ci            object state vector, then (A) still applies but (B) and (C)
52185bd8deadSopenharmony_ci            do not.
52195bd8deadSopenharmony_ci
52205bd8deadSopenharmony_ci              A) The first case is by detaching, from the currently
52215bd8deadSopenharmony_ci                 bound framebuffer object, the image that is attached to
52225bd8deadSopenharmony_ci                 attachment point named by the value of DRAW_BUFFER.  If
52235bd8deadSopenharmony_ci                 an image is attached to COLOR_ATTACHMENTn_EXT in the
52245bd8deadSopenharmony_ci                 current framebuffer object and DRAW_BUFFER is set to
52255bd8deadSopenharmony_ci                 COLOR_ATTACHMENTn_EXT, and then the application
52265bd8deadSopenharmony_ci                 detaches the image from COLOR_ATTACHMENTn_EXT, then
52275bd8deadSopenharmony_ci                 DRAW_BUFFER will end up specifying a buffer that "does
52285bd8deadSopenharmony_ci                 not exist" in the currently bound framebuffer object.
52295bd8deadSopenharmony_ci
52305bd8deadSopenharmony_ci                 There is no analogue to this case in OpenGL prior to
52315bd8deadSopenharmony_ci                 EXT_framebuffer_object.  Before this extension, the
52325bd8deadSopenharmony_ci                 pixel format or fbconfig of a window or pbuffer is
52335bd8deadSopenharmony_ci                 immutable once one of these drawables has been created.
52345bd8deadSopenharmony_ci                 By design, framebuffer objects (which essentially
52355bd8deadSopenharmony_ci                 represent a new type of drawable) have mutable "pixel
52365bd8deadSopenharmony_ci                 formats".
52375bd8deadSopenharmony_ci
52385bd8deadSopenharmony_ci              B) The second case is by binding between two user-created
52395bd8deadSopenharmony_ci                 framebuffer objects, where the two framebuffer objects
52405bd8deadSopenharmony_ci                 do not have images attached to the same set of color
52415bd8deadSopenharmony_ci                 attachment points.  If an image is attached to
52425bd8deadSopenharmony_ci                 COLOR_ATTACHMENTn_EXT in the current framebuffer object
52435bd8deadSopenharmony_ci                 and DRAW_BUFFER is set to COLOR_ATTACHMENTn_EXT, and
52445bd8deadSopenharmony_ci                 then the user binds to a new framebuffer for which
52455bd8deadSopenharmony_ci                 there is no image attached to COLOR_ATTACHMENTn_EXT,
52465bd8deadSopenharmony_ci                 then DRAW_BUFFER will end up specifying a buffer that
52475bd8deadSopenharmony_ci                 "does not exist" in the newly bound framebuffer object.
52485bd8deadSopenharmony_ci
52495bd8deadSopenharmony_ci                 This is morally equivalent to calling MakeCurrent to
52505bd8deadSopenharmony_ci                 bind a context to a different drawable (window or
52515bd8deadSopenharmony_ci                 pbuffer) which does not have bitplanes for the color
52525bd8deadSopenharmony_ci                 buffer named by the context's value of DRAW_BUFFER.
52535bd8deadSopenharmony_ci                 For example, MakeCurrent to a double-buffered window,
52545bd8deadSopenharmony_ci                 set DRAW_BUFFER to BACK, then MakeCurrent to a
52555bd8deadSopenharmony_ci                 single-buffered window.
52565bd8deadSopenharmony_ci
52575bd8deadSopenharmony_ci              C) The third case is by binding between the default
52585bd8deadSopenharmony_ci                 framebuffer and a user-created framebuffer object.  The
52595bd8deadSopenharmony_ci                 attachment points of a user-created framebuffer object
52605bd8deadSopenharmony_ci                 are named COLOR_ATTACHMENTn_EXT, DEPTH_ATTACHMENT_EXT,
52615bd8deadSopenharmony_ci                 STENCIL_ATTACHMENT_EXT, etc.  These are also the legal
52625bd8deadSopenharmony_ci                 values of DRAW_BUFFER when a user-created framebuffer
52635bd8deadSopenharmony_ci                 object is bound.  The default framebuffer, on the other
52645bd8deadSopenharmony_ci                 hand, does not use the _ATTACHMENT names but instead
52655bd8deadSopenharmony_ci                 uses names such as FRONT_LEFT, BACK_RIGHT, and AUXn as
52665bd8deadSopenharmony_ci                 legal DRAW_BUFFER values.  Because the two sets of
52675bd8deadSopenharmony_ci                 names do not overlap, no value of DRAW_BUFFER is valid
52685bd8deadSopenharmony_ci                 for both the default framebuffer and a user-created
52695bd8deadSopenharmony_ci                 framebuffer object.
52705bd8deadSopenharmony_ci
52715bd8deadSopenharmony_ci                 This is somewhat equivalent to case (B), except that in
52725bd8deadSopenharmony_ci                 case (C) there is a guarantee that DRAW_BUFFER will
52735bd8deadSopenharmony_ci                 become invalid, whereas in case (B) it is only
52745bd8deadSopenharmony_ci                 _possible_ that DRAW_BUFFER will become invalid.
52755bd8deadSopenharmony_ci
52765bd8deadSopenharmony_ci            The very problem of invalid DRAW and READ buffers was
52775bd8deadSopenharmony_ci            already a feature of OpenGL (and the window-system APIs)
52785bd8deadSopenharmony_ci            before the introduction of the EXT_framebuffer_object
52795bd8deadSopenharmony_ci            extension.  The GLX specification specifically addresses
52805bd8deadSopenharmony_ci            what happens when MakeCurrent is used to bind a context to a
52815bd8deadSopenharmony_ci            different drawable (window or pbuffer) which does not
52825bd8deadSopenharmony_ci            possess one of the color buffers referenced by the context's
52835bd8deadSopenharmony_ci            current values of DRAW_BUFFER and READ_BUFFER.  GLX
52845bd8deadSopenharmony_ci            addresses this by saying that no GL error is generated, but
52855bd8deadSopenharmony_ci            invalid DRAW_BUFFER behaves as if DRAW_BUFFER were NONE, and
52865bd8deadSopenharmony_ci            reads produce undefined results when READ_BUFFER is invalid.
52875bd8deadSopenharmony_ci
52885bd8deadSopenharmony_ci            Now, back to the question of how EXT_framebuffer_object
52895bd8deadSopenharmony_ci            should handle the situation when a framebuffer object is
52905bd8deadSopenharmony_ci            bound and DRAW_BUFFER or READ_BUFFER is not valid while
52915bd8deadSopenharmony_ci            bound to a user-created framebuffer object.
52925bd8deadSopenharmony_ci
52935bd8deadSopenharmony_ci            Obviously one option is to resolve the issue the same way is
52945bd8deadSopenharmony_ci            handled by MakeCurrent in the GLX spec.  Invalid DRAW_BUFFER
52955bd8deadSopenharmony_ci            acts as if DRAW_BUFFER were NONE, and invalid READ_BUFFER
52965bd8deadSopenharmony_ci            causes read operations to generate undefined results.
52975bd8deadSopenharmony_ci
52985bd8deadSopenharmony_ci            A second option is to modify the framebuffer completeness
52995bd8deadSopenharmony_ci            test to fail if the current DRAW_BUFFER or READ_BUFFER
53005bd8deadSopenharmony_ci            reference an attachment point to which no image is attached.
53015bd8deadSopenharmony_ci            This solution would also result in no rendering being
53025bd8deadSopenharmony_ci            performed, but would also generate a GL error when rendering
53035bd8deadSopenharmony_ci            is attempted while in this state, as determined by issue
53045bd8deadSopenharmony_ci            (64).  When rendering to a framebuffer object, invalid
53055bd8deadSopenharmony_ci            DRAW_BUFFER would cause generation of GL errors; but when
53065bd8deadSopenharmony_ci            rendering to a window, invalid DRAW_BUFFER would not cause
53075bd8deadSopenharmony_ci            generation of GL errors.
53085bd8deadSopenharmony_ci
53095bd8deadSopenharmony_ci            Consider also that, because of the resolution of issue (66),
53105bd8deadSopenharmony_ci            depending on how issue (56) is decided, failing the
53115bd8deadSopenharmony_ci            framebuffer completeness test due to a "non-existent"
53125bd8deadSopenharmony_ci            DRAW_BUFFER or READ_BUFFER may not be a viable option,
53135bd8deadSopenharmony_ci            because the framebuffer completeness test is not allowed to
53145bd8deadSopenharmony_ci            examine context state.
53155bd8deadSopenharmony_ci
53165bd8deadSopenharmony_ci            Additionally, there are two sub-issues that fall out of this
53175bd8deadSopenharmony_ci            issue:
53185bd8deadSopenharmony_ci
53195bd8deadSopenharmony_ci                sub-issue 1: Error at DrawBuffer call time or not?
53205bd8deadSopenharmony_ci                sub-issue 2: DRAW_BUFFER in or out of completeness test?
53215bd8deadSopenharmony_ci
53225bd8deadSopenharmony_ci            [sub-issue 1]:  First, what should be the behavior of
53235bd8deadSopenharmony_ci            DrawBuffer(s) and ReadBuffer if the specified buffer does
53245bd8deadSopenharmony_ci            not exist at the time DrawBuffer(s) or ReadBuffer is called?
53255bd8deadSopenharmony_ci
53265bd8deadSopenharmony_ci            For default framebuffer (window-system drawables), an error
53275bd8deadSopenharmony_ci            is currently thrown.  We can not (or do not wish to) change
53285bd8deadSopenharmony_ci            this legacy behavior of window-system supplied drawables.
53295bd8deadSopenharmony_ci            Consequently, we must resolve several questions here:
53305bd8deadSopenharmony_ci
53315bd8deadSopenharmony_ci            For instance:
53325bd8deadSopenharmony_ci
53335bd8deadSopenharmony_ci                - Should we do the same thing (error at DrawBuffer time)
53345bd8deadSopenharmony_ci                  for user framebuffer objects?
53355bd8deadSopenharmony_ci
53365bd8deadSopenharmony_ci                - Is this decision influenced by the fact that
53375bd8deadSopenharmony_ci                  user-created framebuffer objects can change their
53385bd8deadSopenharmony_ci                  attachments one buffer at a time while window-system
53395bd8deadSopenharmony_ci                  supplied drawables can not (i.e., must change all
53405bd8deadSopenharmony_ci                  attachments atomically)?
53415bd8deadSopenharmony_ci
53425bd8deadSopenharmony_ci                - Also, on other places in this API, such as assembling
53435bd8deadSopenharmony_ci                  a framebuffer from framebuffer-attachable images, we
53445bd8deadSopenharmony_ci                  have allowed the system to move through "invalid"
53455bd8deadSopenharmony_ci                  states without generating an error as long as the
53465bd8deadSopenharmony_ci                  system was back in a "valid" state by rendering time
53475bd8deadSopenharmony_ci                  (or "validation" time).  Should we adhere to that
53485bd8deadSopenharmony_ci                  principle here, or is this case different somehow?
53495bd8deadSopenharmony_ci
53505bd8deadSopenharmony_ci                - Do we wish to retain the legacy window-system
53515bd8deadSopenharmony_ci                  DrawBuffer(s) behavior for application-created
53525bd8deadSopenharmony_ci                  framebuffer objects for the sake of maintaining
53535bd8deadSopenharmony_ci                  consistency?  i.e., Does the benefit of treating
53545bd8deadSopenharmony_ci                  default and non-default framebuffers consistently
53555bd8deadSopenharmony_ci                  outweigh the earlier decision to delay validation of
53565bd8deadSopenharmony_ci                  "invalid" states?
53575bd8deadSopenharmony_ci
53585bd8deadSopenharmony_ci                - Both resolutions are examples of "state combination"
53595bd8deadSopenharmony_ci                  errors where an error may or may not be generated
53605bd8deadSopenharmony_ci                  depending on the order state-changing function calls
53615bd8deadSopenharmony_ci                  are made.  For instance, in the legacy behavior
53625bd8deadSopenharmony_ci                  DrawBuffers does or does not throw an error on user
53635bd8deadSopenharmony_ci                  framebuffer objects depending on when you call
53645bd8deadSopenharmony_ci                  DrawBuffer relative to when you made your image
53655bd8deadSopenharmony_ci                  attachments.  On the other hand, if we decided to not
53665bd8deadSopenharmony_ci                  throw an error at DrawBuffer time for user framebuffer
53675bd8deadSopenharmony_ci                  objects, then DrawBuffer does or does not throw an
53685bd8deadSopenharmony_ci                  error depending on whether one is bound to a default
53695bd8deadSopenharmony_ci                  or non-default framebuffer.  Is one of these "state
53705bd8deadSopenharmony_ci                  combination" errors better or worse than the other?
53715bd8deadSopenharmony_ci
53725bd8deadSopenharmony_ci            [sub-issue 2]: Should having a DRAW_BUFFER that names a
53735bd8deadSopenharmony_ci            non-existent buffer cause the framebuffer completeness test
53745bd8deadSopenharmony_ci            to fail?
53755bd8deadSopenharmony_ci
53765bd8deadSopenharmony_ci            Since image attachments can be changed after
53775bd8deadSopenharmony_ci            DrawBuffer(s) is called, even if we throw an error at
53785bd8deadSopenharmony_ci            Drawbuffer(s) time, we still must decide how to handle
53795bd8deadSopenharmony_ci            having an invalid DRAW_BUFFER at render (or "validation")
53805bd8deadSopenharmony_ci            time.  Our options include failing the completeness test,
53815bd8deadSopenharmony_ci            (thus disabling rendering and generating an error at render
53825bd8deadSopenharmony_ci            time) or just behaving as if DRAW_BUFFER is NONE (thus
53835bd8deadSopenharmony_ci            disabling rendering but generating no error at render time).
53845bd8deadSopenharmony_ci
53855bd8deadSopenharmony_ci            If the answer is "fail completeness test", then since
53865bd8deadSopenharmony_ci            currently framebuffer completeness can only be affected by
53875bd8deadSopenharmony_ci            framebuffer state, then one of two things has to happen:
53885bd8deadSopenharmony_ci            Either the drawbuffer state must be framebuffer object
53895bd8deadSopenharmony_ci            state, or we have to revisit our decision that framebuffer
53905bd8deadSopenharmony_ci            completeness is solely a property of the framebuffer state
53915bd8deadSopenharmony_ci            and can not be affected by "per context" state.
53925bd8deadSopenharmony_ci
53935bd8deadSopenharmony_ci            If the answer is "do not fail completeness test", then the
53945bd8deadSopenharmony_ci            practical consequence of this decision is that having an
53955bd8deadSopenharmony_ci            invalid DRAW_BUFFER behaves as if DRAW_BUFFER is NONE, and
53965bd8deadSopenharmony_ci            no error is generated at render time.  Also, in this case,
53975bd8deadSopenharmony_ci            DRAW-BUFFER state can be either per-context or
53985bd8deadSopenharmony_ci            per-framebuffer object state without violating any
53995bd8deadSopenharmony_ci            previously decided issues.
54005bd8deadSopenharmony_ci
54015bd8deadSopenharmony_ci    (56) Should the value of DRAW_BUFFER, the corresponding draw buffers
54025bd8deadSopenharmony_ci         indirection table for ARB_draw_buffers, and the value of
54035bd8deadSopenharmony_ci         READ_BUFFER, be part of the context state vector or part of the
54045bd8deadSopenharmony_ci         the framebuffer object state vector?
54055bd8deadSopenharmony_ci
54065bd8deadSopenharmony_ci            RESOLUTION: resolved, per-framebuffer object
54075bd8deadSopenharmony_ci
54085bd8deadSopenharmony_ci            This issue is intertwined with issue (55), which discusses
54095bd8deadSopenharmony_ci            what happens when the DRAW_BUFFER or READ_BUFFER references
54105bd8deadSopenharmony_ci            a color buffer that "does not exist" in the current
54115bd8deadSopenharmony_ci            framebuffer.
54125bd8deadSopenharmony_ci
54135bd8deadSopenharmony_ci            Please first read the "First, some background" section of
54145bd8deadSopenharmony_ci            issue (55), which could be, but is not, replicated here.
54155bd8deadSopenharmony_ci            Note that depending on how issue (56) is decided, cases (B)
54165bd8deadSopenharmony_ci            and (C) from issue (55) might become moot.  Specifically, if
54175bd8deadSopenharmony_ci            the DRAW_BUFFER and READ_BUFFER state are added to the
54185bd8deadSopenharmony_ci            framebuffer object state vector, then neither case (B) nor
54195bd8deadSopenharmony_ci            case (C) remains relevant.  Only case (A) would continue to
54205bd8deadSopenharmony_ci            be an issue.
54215bd8deadSopenharmony_ci
54225bd8deadSopenharmony_ci            The discussion over this issue centered around the following
54235bd8deadSopenharmony_ci            areas:
54245bd8deadSopenharmony_ci
54255bd8deadSopenharmony_ci             i) There must be a unique per-context value of DRAW_BUFFER
54265bd8deadSopenharmony_ci                for the default window-system-provided framebuffer.
54275bd8deadSopenharmony_ci
54285bd8deadSopenharmony_ci                In GL, before EXT_framebuffer_object, the DRAW_BUFFER
54295bd8deadSopenharmony_ci                was considered context state because:
54305bd8deadSopenharmony_ci
54315bd8deadSopenharmony_ci                1) When two contexts are rendering to the same drawable,
54325bd8deadSopenharmony_ci                   each context can use a different value of
54335bd8deadSopenharmony_ci                   DRAW_BUFFER.
54345bd8deadSopenharmony_ci
54355bd8deadSopenharmony_ci                2) When MakeCurrent alternately binds a single context
54365bd8deadSopenharmony_ci                   to each of two different drawables, after MakeCurrent
54375bd8deadSopenharmony_ci                   DRAW_BUFFER retains the value it had immediately
54385bd8deadSopenharmony_ci                   before calling MakeCurrent.  This is true even if the
54395bd8deadSopenharmony_ci                   last time the context was bound to a given drawable,
54405bd8deadSopenharmony_ci                   DRAW_BUFFER had a different value than it does when
54415bd8deadSopenharmony_ci                   that drawable is next bound to the context.
54425bd8deadSopenharmony_ci
54435bd8deadSopenharmony_ci                Therefore, a per-context value of DRAW_BUFFER must
54445bd8deadSopenharmony_ci                exist, and must be in effect when the
54455bd8deadSopenharmony_ci                FRAMEBUFFER_BINDING_EXT is zero.
54465bd8deadSopenharmony_ci
54475bd8deadSopenharmony_ci                Two ways of satisfying this requirement that we have
54485bd8deadSopenharmony_ci                considered include:
54495bd8deadSopenharmony_ci
54505bd8deadSopenharmony_ci                A) DRAW_BUFFER is part of the context state vector, but
54515bd8deadSopenharmony_ci                   is not part of the framebuffer object state vector.
54525bd8deadSopenharmony_ci
54535bd8deadSopenharmony_ci                B) Every framebuffer, including the per-context default
54545bd8deadSopenharmony_ci                   window-system-provided framebuffer, has its own value
54555bd8deadSopenharmony_ci                   for DRAW_BUFFER.
54565bd8deadSopenharmony_ci
54575bd8deadSopenharmony_ci            ii) MakeCurrent vs. BindFramebuffer
54585bd8deadSopenharmony_ci
54595bd8deadSopenharmony_ci                As described above, the context state vector must
54605bd8deadSopenharmony_ci                contain a value for DRAW_BUFFER that applies to the
54615bd8deadSopenharmony_ci                default window-system-provided framebuffer, which is
54625bd8deadSopenharmony_ci                used after a call to BindFramebuffer(0).  When
54635bd8deadSopenharmony_ci                MakeCurrent is used to bind the context to a different
54645bd8deadSopenharmony_ci                drawable (window or pbuffer), the context's value of
54655bd8deadSopenharmony_ci                DRAW_BUFFER remains unchanged.  In other words, the
54665bd8deadSopenharmony_ci                choice of drawable does not affect the value of
54675bd8deadSopenharmony_ci                DRAW_BUFFER.
54685bd8deadSopenharmony_ci
54695bd8deadSopenharmony_ci                An application-created framebuffer object is another
54705bd8deadSopenharmony_ci                type of drawable.  When the framebuffer binding is
54715bd8deadSopenharmony_ci                changed via BindFramebuffer, issue (56) speaks to the
54725bd8deadSopenharmony_ci                way in which DRAW_BUFFER is or is not updated.  If
54735bd8deadSopenharmony_ci                DRAW_BUFFER is part of the context state vector, then
54745bd8deadSopenharmony_ci                DRAW_BUFFER remains unchanged after calling
54755bd8deadSopenharmony_ci                BindFramebuffer, just like it remains unchanged after
54765bd8deadSopenharmony_ci                calling MakeCurrent.  On the other hand, if DRAW_BUFFER
54775bd8deadSopenharmony_ci                is part of the framebuffer object state vector, then
54785bd8deadSopenharmony_ci                after calling BindFramebuffer DRAW_BUFFER may change
54795bd8deadSopenharmony_ci                along with the rest of the per-framebuffer state (i.e.,
54805bd8deadSopenharmony_ci                the image attachments).
54815bd8deadSopenharmony_ci
54825bd8deadSopenharmony_ci                By defining DRAW_BUFFER as context state, the behavior
54835bd8deadSopenharmony_ci                of BindFramebuffer and MakeCurrent are similar, with
54845bd8deadSopenharmony_ci                respect to their effect on the value of DRAW_BUFFER.
54855bd8deadSopenharmony_ci
54865bd8deadSopenharmony_ci                On the other hand, by defining DRAW_BUFFER as
54875bd8deadSopenharmony_ci                framebuffer object state, then BindFramebuffer and
54885bd8deadSopenharmony_ci                MakeCurrent differ in their impact on the value of
54895bd8deadSopenharmony_ci                DRAW_BUFFER.
54905bd8deadSopenharmony_ci
54915bd8deadSopenharmony_ci           iii) Multiple contexts and shared framebuffer objects
54925bd8deadSopenharmony_ci
54935bd8deadSopenharmony_ci                If DRAW_BUFFER is part of the framebuffer object state
54945bd8deadSopenharmony_ci                vector, then a single value of DRAW_BUFFER, like all of
54955bd8deadSopenharmony_ci                the framebuffer object state, will be shared by any
54965bd8deadSopenharmony_ci                context bound to a given framebuffer object.  This can
54975bd8deadSopenharmony_ci                be considered either a feature or a restriction
54985bd8deadSopenharmony_ci                depending on whether or not it is desirable for multiple
54995bd8deadSopenharmony_ci                contexts to be able to share a single the value of
55005bd8deadSopenharmony_ci                DRAW_BUFFER.
55015bd8deadSopenharmony_ci
55025bd8deadSopenharmony_ci                Note that WGL_ARB_pbuffer plus WGL_ARB_render_texture
55035bd8deadSopenharmony_ci                API has limitations due to the fact that the texture
55045bd8deadSopenharmony_ci                image selection state is stored in the pbuffer drawable.
55055bd8deadSopenharmony_ci                For example, that API does not support six different
55065bd8deadSopenharmony_ci                contexts (in six different threads) simultaneously
55075bd8deadSopenharmony_ci                rendering to the six faces of a cube map pbuffer.  It
55085bd8deadSopenharmony_ci                offers no way to share the images without also sharing
55095bd8deadSopenharmony_ci                the pbuffer, and the pbuffer contains a single set of
55105bd8deadSopenharmony_ci                texture image selection state.
55115bd8deadSopenharmony_ci
55125bd8deadSopenharmony_ci                EXT_framebuffer_object differs from ARB_render_texture,
55135bd8deadSopenharmony_ci                however, however, in that EXT_framebuffer_object allows
55145bd8deadSopenharmony_ci                the same images of a texture to be attached to multiple
55155bd8deadSopenharmony_ci                framebuffer objects.  Consequently, the above cubemap
55165bd8deadSopenharmony_ci                example can be implemented in EXT_framebuffer_object in
55175bd8deadSopenharmony_ci                one or two ways, depending on the resolution of issue
55185bd8deadSopenharmony_ci                (56):
55195bd8deadSopenharmony_ci
55205bd8deadSopenharmony_ci                1) Create six framebuffer objects.  Attach a different
55215bd8deadSopenharmony_ci                   face of a cubemap texture to each of the six
55225bd8deadSopenharmony_ci                   framebuffer objects.  Each of the six contexts binds
55235bd8deadSopenharmony_ci                   to a unique framebuffer object.  Technically, this
55245bd8deadSopenharmony_ci                   option is available whether DRAW_BUFFER is context or
55255bd8deadSopenharmony_ci                   framebuffer state.  However, if it is context state,
55265bd8deadSopenharmony_ci                   then there is no reason to create six framebuffer
55275bd8deadSopenharmony_ci                   objects since the value of the DRAW_BUFFER will
55285bd8deadSopenharmony_ci                   already be unique per context.
55295bd8deadSopenharmony_ci
55305bd8deadSopenharmony_ci                2) On the other hand, if DRAW_BUFFER is defined as
55315bd8deadSopenharmony_ci                   context state, then a second option is available.
55325bd8deadSopenharmony_ci                   Using a single framebuffer object, attach each face
55335bd8deadSopenharmony_ci                   of the cube map texture to a different attachment
55345bd8deadSopenharmony_ci                   point in the framebuffer object.  Each of the six
55355bd8deadSopenharmony_ci                   contexts binds to the same framebuffer object, but
55365bd8deadSopenharmony_ci                   each context uses a different value of DRAW_BUFFER.
55375bd8deadSopenharmony_ci
55385bd8deadSopenharmony_ci            iv) Frequency of DrawBuffer calls:
55395bd8deadSopenharmony_ci
55405bd8deadSopenharmony_ci                Whether DRAW_BUFFER is part of context or framebuffer
55415bd8deadSopenharmony_ci                state will have an effect on how often one must call
55425bd8deadSopenharmony_ci                DrawBuffer after modifying framebuffer state.
55435bd8deadSopenharmony_ci
55445bd8deadSopenharmony_ci                If DRAW_BUFFER is part of the context state vector, then
55455bd8deadSopenharmony_ci                DRAW_BUFFER is guaranteed to become invalid after
55465bd8deadSopenharmony_ci                calling BindFramebuffer to switch between the default
55475bd8deadSopenharmony_ci                framebuffer and a user-created framebuffer object [i.e.,
55485bd8deadSopenharmony_ci                this is case (C) in issue (55)].  DRAW_BUFFER may become
55495bd8deadSopenharmony_ci                invalid after switching between two user-created
55505bd8deadSopenharmony_ci                framebuffer objects if the framebuffer objects do not
55515bd8deadSopenharmony_ci                have images attached to the same set of color attachment
55525bd8deadSopenharmony_ci                points.  When DRAW_BUFFER is invalid, it is necessary to
55535bd8deadSopenharmony_ci                call DrawBuffer to set DRAW_BUFFER to a valid value or
55545bd8deadSopenharmony_ci                else rendering is disabled.
55555bd8deadSopenharmony_ci
55565bd8deadSopenharmony_ci                If, on the other hand, DRAW_BUFFER is part of the
55575bd8deadSopenharmony_ci                framebuffer object state vector, then it should never be
55585bd8deadSopenharmony_ci                necessary to call DrawBuffer after calling
55595bd8deadSopenharmony_ci                BindFramebuffer.  DRAW_BUFFER would only become invalid
55605bd8deadSopenharmony_ci                if an image was detached from the framebuffer, or if
55615bd8deadSopenharmony_ci                MakeCurrent bound the default framebuffer to a drawable
55625bd8deadSopenharmony_ci                with a different set of color buffers.  (The latter was
55635bd8deadSopenharmony_ci                possible prior to this extension.)
55645bd8deadSopenharmony_ci
55655bd8deadSopenharmony_ci                Note that there are several state-modifying routines
55665bd8deadSopenharmony_ci                that may also need to get called after a framebuffer
55675bd8deadSopenharmony_ci                state change, like Viewport, Scissor, etc.  We are not
55685bd8deadSopenharmony_ci                proposing that these other routines be part of
55695bd8deadSopenharmony_ci                framebuffer state.  One could think of DrawBuffer as
55705bd8deadSopenharmony_ci                being similar to these other routines which you may also
55715bd8deadSopenharmony_ci                need to call when you bind between framebuffer objects.
55725bd8deadSopenharmony_ci                On the other hand, some have questioned whether an
55735bd8deadSopenharmony_ci                invalid DRAW_BUFFER is really in the same class of
55745bd8deadSopenharmony_ci                problems as an out-of-bounds viewport or scissor
55755bd8deadSopenharmony_ci                because: 1) an invalid viewport or scissor never
55765bd8deadSopenharmony_ci                generates a GL error, and 2) prior to the
55775bd8deadSopenharmony_ci                EXT_framebuffer_object extension an invalid DRAW_BUFFER
55785bd8deadSopenharmony_ci                would generate INVALID_ENUM inside DrawBuffer.
55795bd8deadSopenharmony_ci
55805bd8deadSopenharmony_ci             v) Effect on framebuffer completeness test:
55815bd8deadSopenharmony_ci
55825bd8deadSopenharmony_ci                By resolution of issue (66), if the draw buffer is
55835bd8deadSopenharmony_ci                context state, then the fact that the draw buffer names
55845bd8deadSopenharmony_ci                a non-existent buffer can not affect the result of the
55855bd8deadSopenharmony_ci                framebuffer completeness test.  Note that this still
55865bd8deadSopenharmony_ci                could be considered a "do not render" case, but would
55875bd8deadSopenharmony_ci                separate from the framebuffer completeness test.
55885bd8deadSopenharmony_ci
55895bd8deadSopenharmony_ci                If the draw buffer(s) and read buffer are part of the
55905bd8deadSopenharmony_ci                framebuffer object state then having a draw or read
55915bd8deadSopenharmony_ci                buffer name a non-existent buffer can (if we choose) be
55925bd8deadSopenharmony_ci                part of the framebuffer (in)completeness test.
55935bd8deadSopenharmony_ci
55945bd8deadSopenharmony_ci                Note, by resolution of issue (64), failing the
55955bd8deadSopenharmony_ci                framebuffer completeness test causes a GL error to be
55965bd8deadSopenharmony_ci                generated when draw or read operations are attempted.
55975bd8deadSopenharmony_ci                Prior to EXT_framebuffer_object, it was already possible
55985bd8deadSopenharmony_ci                to have an invalid value of DRAW_BUFFER if a call to
55995bd8deadSopenharmony_ci                MakeCurrent bound the context to a drawable that did not
56005bd8deadSopenharmony_ci                contain a color buffer corresponding to the context's
56015bd8deadSopenharmony_ci                value of DRAW_BUFFER.  However, no GL error would be
56025bd8deadSopenharmony_ci                generated if DRAW_BUFFER obtained an invalid value
56035bd8deadSopenharmony_ci                through this method.
56045bd8deadSopenharmony_ci
56055bd8deadSopenharmony_ci            vi) Draw buffer(s) error behavior:
56065bd8deadSopenharmony_ci
56075bd8deadSopenharmony_ci                Prior to the EXT_framebuffer_object extension, it was an
56085bd8deadSopenharmony_ci                error to call DrawBuffer or ReadBuffer with a value that
56095bd8deadSopenharmony_ci                did not correspond to one of the logical color buffers
56105bd8deadSopenharmony_ci                of the currently bound drawable (window or pbuffer).
56115bd8deadSopenharmony_ci                Although it was not possible to set DRAW_BUFFER to an
56125bd8deadSopenharmony_ci                invalid value by calling DrawBuffer, it was actually
56135bd8deadSopenharmony_ci                possible for DRAW_BUFFER to have an invalid value after
56145bd8deadSopenharmony_ci                a call to MakeCurrent, as describe in issue (55).
56155bd8deadSopenharmony_ci
56165bd8deadSopenharmony_ci                It has not been decided yet whether
56175bd8deadSopenharmony_ci                EXT_framebuffer_object will relax the requirement that
56185bd8deadSopenharmony_ci                the argument to DrawBuffer references a color buffer
56195bd8deadSopenharmony_ci                that "exists" in the currently drawable.
56205bd8deadSopenharmony_ci
56215bd8deadSopenharmony_ci                In working group discussions, there was a perception
56225bd8deadSopenharmony_ci                that such an error during DrawBuffer can be generated
56235bd8deadSopenharmony_ci                only if DRAW_BUFFER is part of the framebuffer object
56245bd8deadSopenharmony_ci                state vector.  Then when the default framebuffer (window
56255bd8deadSopenharmony_ci                or pbuffer) is current, the legal values of the argument
56265bd8deadSopenharmony_ci                to DrawBuffer would be determined by the pixel format or
56275bd8deadSopenharmony_ci                fbconfig.  When a user-created framebuffer object is
56285bd8deadSopenharmony_ci                current, the legal values of DrawBuffer would either be
56295bd8deadSopenharmony_ci                any of the COLOR_ATTACHMENTn_EXT names or only the names
56305bd8deadSopenharmony_ci                of attachment points to which an image is presently
56315bd8deadSopenharmony_ci                attached.
56325bd8deadSopenharmony_ci
56335bd8deadSopenharmony_ci                However, given the precedent set by MakeCurrent and
56345bd8deadSopenharmony_ci                DRAW_BUFFER, it seems reasonable to retain the
56355bd8deadSopenharmony_ci                preexisting requirement that the argument to DrawBuffer
56365bd8deadSopenharmony_ci                names a buffer that "exists" in the current drawable.
56375bd8deadSopenharmony_ci                In other words, there already exists precedent that says
56385bd8deadSopenharmony_ci                it is OK for DrawBuffer to generate an error in all the
56395bd8deadSopenharmony_ci                cases described in the preceeding paragraph, even if
56405bd8deadSopenharmony_ci                DRAW_BUFFER is defined as part of the context state
56415bd8deadSopenharmony_ci                vector.
56425bd8deadSopenharmony_ci
56435bd8deadSopenharmony_ci    (57) Should we have a query to define the maximum number of
56445bd8deadSopenharmony_ci         attachable color buffers (to support ARB_draw_buffers)?
56455bd8deadSopenharmony_ci
56465bd8deadSopenharmony_ci            RESOLUTION: yes, MAX_COLOR_ATTACHMENTS.
56475bd8deadSopenharmony_ci
56485bd8deadSopenharmony_ci            Currently an application can query the GL for the maximum
56495bd8deadSopenharmony_ci            number of supported AUX buffers.  An application can also
56505bd8deadSopenharmony_ci            query for MAX_DRAW_BUFFERS_ARB in the ARB_draw_buffers
56515bd8deadSopenharmony_ci            extension.  Given that we have named the color logical
56525bd8deadSopenharmony_ci            buffer attachment points, COLOR_ATTACHMENT0_EXT through
56535bd8deadSopenharmony_ci            COLOR_ATTACHMENTn_EXT, it seems natural that we should have
56545bd8deadSopenharmony_ci            a query to find the maximum value "n".
56555bd8deadSopenharmony_ci
56565bd8deadSopenharmony_ci            One thought was that we might be able to use
56575bd8deadSopenharmony_ci            MAX_DRAW_BUFFERS_ARB to store this value, but that value
56585bd8deadSopenharmony_ci            really describes the maximum number of colors that can be
56595bd8deadSopenharmony_ci            simultaneously output which is not the same thing as the
56605bd8deadSopenharmony_ci            number of buffers which can be attached and then selected
56615bd8deadSopenharmony_ci            among using DrawBuffersARB().
56625bd8deadSopenharmony_ci
56635bd8deadSopenharmony_ci            This question is related to issue (54), which covers the
56645bd8deadSopenharmony_ci            names of the user-created framebuffer object color
56655bd8deadSopenharmony_ci            attachment points.  Using the names COLOR_ATTACHMENT0_EXT
56665bd8deadSopenharmony_ci            through COLOR_ATTACHMENTn_EXT rather than the legacy color
56675bd8deadSopenharmony_ci            buffer attachment names (FRONT_LEFT et. al.) for
56685bd8deadSopenharmony_ci            user-created framebuffer objects has an advantage that the
56695bd8deadSopenharmony_ci            number of color buffer attachment points could be queried
56705bd8deadSopenharmony_ci            independent of the number of AUX buffers and existence of
56715bd8deadSopenharmony_ci            front/back & left/right color buffers as specified in the
56725bd8deadSopenharmony_ci            pixelformat.  The number of available offscreen attachment
56735bd8deadSopenharmony_ci            points really should be independent of the properties of the
56745bd8deadSopenharmony_ci            current drawable's pixelformat, especially since MakeCurrent
56755bd8deadSopenharmony_ci            can bind a context to a drawable with a different
56765bd8deadSopenharmony_ci            pixelformat and thus different set of color buffers.
56775bd8deadSopenharmony_ci
56785bd8deadSopenharmony_ci            One implication of this query is that the value of
56795bd8deadSopenharmony_ci            MAX_COLOR_ATTACHMENTS_EXT is possibly still dependent on the
56805bd8deadSopenharmony_ci            context/pixel format but independent of the currently bound
56815bd8deadSopenharmony_ci            framebuffer.  In other words, MAX_COLOR_ATTACHMENTS_EXT can
56825bd8deadSopenharmony_ci            not change simply because the user called BindFramebuffer().
56835bd8deadSopenharmony_ci            Or can it?  See issue (62)
56845bd8deadSopenharmony_ci
56855bd8deadSopenharmony_ci    (58) What should we do about rendering to textures with borders?
56865bd8deadSopenharmony_ci         (besides attempt to fervently wish them out of existence, I mean)
56875bd8deadSopenharmony_ci
56885bd8deadSopenharmony_ci            RESOLUTION: resolved, borders are fully supported
56895bd8deadSopenharmony_ci
56905bd8deadSopenharmony_ci                Should we allow rendering to textures with borders at
56915bd8deadSopenharmony_ci                all?
56925bd8deadSopenharmony_ci                    Resolved: yes
56935bd8deadSopenharmony_ci
56945bd8deadSopenharmony_ci                If we allow this, can you render to the border pixels?
56955bd8deadSopenharmony_ci                    Resolved: yes
56965bd8deadSopenharmony_ci
56975bd8deadSopenharmony_ci            The reason this is an issue is that (a) everyone hates
56985bd8deadSopenharmony_ci            supporting borders, and (b) it's not clear what it means to
56995bd8deadSopenharmony_ci            render to a texture with borders.
57005bd8deadSopenharmony_ci
57015bd8deadSopenharmony_ci            To disallow rendering to a texture image with non-zero
57025bd8deadSopenharmony_ci            border size, we could add a test for non-zero border size to
57035bd8deadSopenharmony_ci            the definition framebuffer completeness.  This might be
57045bd8deadSopenharmony_ci            preferrable to an error at FramebufferTexture, since the
57055bd8deadSopenharmony_ci            user could always redefine the texture to have borders after
57065bd8deadSopenharmony_ci            attachment, and so the framebuffer completeness test is
57075bd8deadSopenharmony_ci            necessary anyway.
57085bd8deadSopenharmony_ci
57095bd8deadSopenharmony_ci            However, since borders do exist today and we are not
57105bd8deadSopenharmony_ci            planning to rip them out of OpenGL everywhere else, we
57115bd8deadSopenharmony_ci            decided to support them.  It seemed odd that you could still
57125bd8deadSopenharmony_ci            specify borders via TexImage but not render into the same
57135bd8deadSopenharmony_ci            texture so we leave them supported.  Note that it's quite
57145bd8deadSopenharmony_ci            possible that implementations which don't support borders
57155bd8deadSopenharmony_ci            may continue to either not support them or fall to software
57165bd8deadSopenharmony_ci            rasterization.
57175bd8deadSopenharmony_ci
57185bd8deadSopenharmony_ci            If someday we decide to disallow borders in general, they
57195bd8deadSopenharmony_ci            will be disallowed from this extension as well.
57205bd8deadSopenharmony_ci
57215bd8deadSopenharmony_ci            One additional note: section 3.8.2, page 137, of the OpenGL
57225bd8deadSopenharmony_ci            1.5 specification, states that {Copy}TexSubImage uses
57235bd8deadSopenharmony_ci            negative offsets to refer to border texels.  We choose not
57245bd8deadSopenharmony_ci            to do this because negative window-coordinates are
57255bd8deadSopenharmony_ci            undefined.  (NOTE: Are negative window coordinates actually
57265bd8deadSopenharmony_ci            undefined?  Or are they just not commonly used in practice?)
57275bd8deadSopenharmony_ci
57285bd8deadSopenharmony_ci    (59) Should we support named bit depths for stencil renderbuffers?
57295bd8deadSopenharmony_ci
57305bd8deadSopenharmony_ci            RESOLUTION: resolved, yes, choose 4 common formats.
57315bd8deadSopenharmony_ci
57325bd8deadSopenharmony_ci            We intend to support using renderbuffers to store stencil
57335bd8deadSopenharmony_ci            data.  This means we need to consider what kind of "internal
57345bd8deadSopenharmony_ci            format" request we provide for stencil formatted
57355bd8deadSopenharmony_ci            renderbuffers.
57365bd8deadSopenharmony_ci
57375bd8deadSopenharmony_ci            We choose to allow a "named" format request for the internal
57385bd8deadSopenharmony_ci            format.  This is essentially equivalent to the named
57395bd8deadSopenharmony_ci            internal format request of the TexImage calls.  It is merely
57405bd8deadSopenharmony_ci            a request and the driver will attempt to satisfy it as best
57415bd8deadSopenharmony_ci            as possible but may approximate the requested format with
57425bd8deadSopenharmony_ci            another format.  Additionally, this request is subject to
57435bd8deadSopenharmony_ci            the same invariance constraints as the texture internal
57445bd8deadSopenharmony_ci            format requests.
57455bd8deadSopenharmony_ci
57465bd8deadSopenharmony_ci            For the initial extension we choose the following four sized
57475bd8deadSopenharmony_ci            internal formats, as well as the base internal format
57485bd8deadSopenharmony_ci            STENCIL_INDEX:
57495bd8deadSopenharmony_ci
57505bd8deadSopenharmony_ci                STENCIL_INDEX1_EXT
57515bd8deadSopenharmony_ci                STENCIL_INDEX4_EXT
57525bd8deadSopenharmony_ci                STENCIL_INDEX8_EXT
57535bd8deadSopenharmony_ci                STENCIL_INDEX16_EXT
57545bd8deadSopenharmony_ci
57555bd8deadSopenharmony_ci    (60) If depth buffer is disabled when a user-created framebuffer
57565bd8deadSopenharmony_ci         object is bound and an image is attached to GL_DEPTH, does the
57575bd8deadSopenharmony_ci         depth buffer factor into framebuffer validity determination or
57585bd8deadSopenharmony_ci         is the depth buffer ignored?  Similar for other types of
57595bd8deadSopenharmony_ci         logical buffers.
57605bd8deadSopenharmony_ci
57615bd8deadSopenharmony_ci            RESOLUTION: resolved, consider all attached images when
57625bd8deadSopenharmony_ci            determining framebuffer completeness, even if the images are
57635bd8deadSopenharmony_ci            "irrelevant" based on the state of the framebuffer.
57645bd8deadSopenharmony_ci
57655bd8deadSopenharmony_ci            The main reason to consider not paying attention to certain
57665bd8deadSopenharmony_ci            images (i.e., ignoring the image attached to the depth
57675bd8deadSopenharmony_ci            buffer when depth test is disabled) would be developer
57685bd8deadSopenharmony_ci            convenience.  The developer wouldn't need to explicitly
57695bd8deadSopenharmony_ci            detach a buffer, but could set the state to ignore it
57705bd8deadSopenharmony_ci            (disable depth test, or disable color mask, reset draw
57715bd8deadSopenharmony_ci            buffer, etc).
57725bd8deadSopenharmony_ci
57735bd8deadSopenharmony_ci            However, this raises the possibility that by simply changing
57745bd8deadSopenharmony_ci            this other state (depth test, stencil test, color mask, etc)
57755bd8deadSopenharmony_ci            the query for framebuffer completeness could change values.
57765bd8deadSopenharmony_ci            This was deemed undesirable.  We'd like to be able to
57775bd8deadSopenharmony_ci            minimize the amount of state changes that can cause the
57785bd8deadSopenharmony_ci            framebuffer completeness query to change.
57795bd8deadSopenharmony_ci
57805bd8deadSopenharmony_ci            Another strange effect of ignoring "irrelevant" images when
57815bd8deadSopenharmony_ci            considering framebuffer completeness is that we could get an
57825bd8deadSopenharmony_ci            undesirable interaction between draw buffer and the pixel
57835bd8deadSopenharmony_ci            format for the framebuffer.  A framebuffer is considered
57845bd8deadSopenharmony_ci            incomplete if the color buffers do not all have the same
57855bd8deadSopenharmony_ci            internal format.  But, consider the following case:
57865bd8deadSopenharmony_ci
57875bd8deadSopenharmony_ci                - an application attaches a floating point
57885bd8deadSopenharmony_ci                  color-renderable image to COLOR_ATTACHMENT1, and
57895bd8deadSopenharmony_ci
57905bd8deadSopenharmony_ci                - the application attaches a fixed point
57915bd8deadSopenharmony_ci                  color-renderable image to COLOR_ATTACHMENT2 and
57925bd8deadSopenharmony_ci
57935bd8deadSopenharmony_ci                - the application sets the DRAW_BUFFER to
57945bd8deadSopenharmony_ci                  COLOR_ATTACHMENT1, then
57955bd8deadSopenharmony_ci
57965bd8deadSopenharmony_ci            If we ignored the attached images not pointed to by
57975bd8deadSopenharmony_ci            DRAW_BUFFER(s} when evalutating framebuffer completeness, we
57985bd8deadSopenharmony_ci            could consider this framebuffer complete.  This framebuffer
57995bd8deadSopenharmony_ci            would use floating point rendering.  Now, if the application
58005bd8deadSopenharmony_ci            simply changes the DRAW_BUFFER to COLOR-ATTACHMENT2, then we
58015bd8deadSopenharmony_ci            would also say the framebuffer is complete but now the
58025bd8deadSopenharmony_ci            framebuffer would be using fixed point rendering.  We didn't
58035bd8deadSopenharmony_ci            want to allow a change to DRAW_BUFFER to effectively change
58045bd8deadSopenharmony_ci            the pixel format.  On the other hand if we always considered
58055bd8deadSopenharmony_ci            all attached images, then in this case described above, the
58065bd8deadSopenharmony_ci            framebuffer would always be incomplete while the formats of
58075bd8deadSopenharmony_ci            the color-renderable images were inconsistent.
58085bd8deadSopenharmony_ci
58095bd8deadSopenharmony_ci            To avoid the above complications, we choose to have
58105bd8deadSopenharmony_ci            framebuffer completeness queries consider all attached
58115bd8deadSopenharmony_ci            buffers, regardless of whether they would be "used"
58125bd8deadSopenharmony_ci            according to the current state vector or not.
58135bd8deadSopenharmony_ci
58145bd8deadSopenharmony_ci    (61) What are the "minimum requirements" to support this extension?
58155bd8deadSopenharmony_ci
58165bd8deadSopenharmony_ci            RESOLUTION: resolved, language added to end of 4.4.4.2
58175bd8deadSopenharmony_ci
58185bd8deadSopenharmony_ci            For instance, is it a requirement that there must be at
58195bd8deadSopenharmony_ci            least one renderable color, depth, and stencil format that
58205bd8deadSopenharmony_ci            can all work together?  is it a requirement that you must be
58215bd8deadSopenharmony_ci            able to render to *any* "color-renderable" texture format?
58225bd8deadSopenharmony_ci
58235bd8deadSopenharmony_ci            Since this extension specifically pulling in functionality
58245bd8deadSopenharmony_ci            that used to be in the domain of the window sytem, we would
58255bd8deadSopenharmony_ci            like to use as a starting point for our requrirements, the
58265bd8deadSopenharmony_ci            language from the GLX 1.3 spec, page 15, which lists the
58275bd8deadSopenharmony_ci            minimum requirements langauge for a conformant GLX
58285bd8deadSopenharmony_ci            implementation.
58295bd8deadSopenharmony_ci
58305bd8deadSopenharmony_ci            Questions to answer:
58315bd8deadSopenharmony_ci
58325bd8deadSopenharmony_ci                - is the GLX spec a good starting point?
58335bd8deadSopenharmony_ci
58345bd8deadSopenharmony_ci                - do we want the same requirements as the GLX spec?
58355bd8deadSopenharmony_ci
58365bd8deadSopenharmony_ci                - do we want stronger requirements than the GLX spec?
58375bd8deadSopenharmony_ci
58385bd8deadSopenharmony_ci                - do we want some kind of requirement that states that
58395bd8deadSopenharmony_ci                  to support this extension, there must be at least one
58405bd8deadSopenharmony_ci                  "gl conformant" framebuffer configuration that can be
58415bd8deadSopenharmony_ci                  constructed on a given implementation?  If so, how do
58425bd8deadSopenharmony_ci                  we phrase this?
58435bd8deadSopenharmony_ci
58445bd8deadSopenharmony_ci            Anyway, the GLX spec states:
58455bd8deadSopenharmony_ci
58465bd8deadSopenharmony_ci                "Servers are required to export at least one GLXFBConfig
58475bd8deadSopenharmony_ci                that supports RGBA rendering to windows and passes
58485bd8deadSopenharmony_ci                OpenGL conformance (i.e., the GLX RENDER TYPE attribute
58495bd8deadSopenharmony_ci                must have the GLX RGBA BIT set, the GLX DRAWABLE TYPE
58505bd8deadSopenharmony_ci                attribute must have the GLX WINDOW BIT set and the GLX
58515bd8deadSopenharmony_ci                CONFIG CAVEAT attribute must not be set to GLX NON
58525bd8deadSopenharmony_ci                CONFORMANT CONFIG).  This GLXFBConfig must have at least
58535bd8deadSopenharmony_ci                one color buffer, a stencil buffer of at least 1 bit, a
58545bd8deadSopenharmony_ci                depth buffer of at least 12 bits, and an accumulation
58555bd8deadSopenharmony_ci                buffer; auxiliary buffers are optional, and the alpha
58565bd8deadSopenharmony_ci                buffer may have 0 bits.  The color buffer size for this
58575bd8deadSopenharmony_ci                GLXFBConfig must be as large as that of the deepest
58585bd8deadSopenharmony_ci                TrueColor, DirectColor, PseudoColor, or StaticColor
58595bd8deadSopenharmony_ci                visual supported on framebuffer level zero (the main
58605bd8deadSopenharmony_ci                image planes), and this confguration must be available
58615bd8deadSopenharmony_ci                on framebuffer level zero."
58625bd8deadSopenharmony_ci
58635bd8deadSopenharmony_ci            So if we did a direct translation of these requirements into
58645bd8deadSopenharmony_ci            our spec, we'd end up with something approximately like the
58655bd8deadSopenharmony_ci            following:
58665bd8deadSopenharmony_ci
58675bd8deadSopenharmony_ci                Although GL defines a wide variety of internal formats
58685bd8deadSopenharmony_ci                for textures and renderbuffers, some implementations may
58695bd8deadSopenharmony_ci                not support particular combinations of internal formats
58705bd8deadSopenharmony_ci                for the images attached to the framebuffer.  For a
58715bd8deadSopenharmony_ci                framebuffer with these unsupported combinations of
58725bd8deadSopenharmony_ci                internal formats, calls to CheckFramebufferStatusEXT()
58735bd8deadSopenharmony_ci                will return FRAMEBUFFER_UNSUPPORTED_EXT.
58745bd8deadSopenharmony_ci
58755bd8deadSopenharmony_ci                There must exist, however, at least one combinations of
58765bd8deadSopenharmony_ci                internal formats for the images attached to the
58775bd8deadSopenharmony_ci                framebuffer for which CheckFramebufferStatusEXT() will
58785bd8deadSopenharmony_ci                *not* return FRAMEBUFFER_UNSUPPORTED_EXT.
58795bd8deadSopenharmony_ci
58805bd8deadSopenharmony_ci                Specifically, implementations are required to support at
58815bd8deadSopenharmony_ci                least one set of internal formats for the images
58825bd8deadSopenharmony_ci                attached to a framebuffer such that
58835bd8deadSopenharmony_ci
58845bd8deadSopenharmony_ci                    - the image attached to the color buffer supports
58855bd8deadSopenharmony_ci                      RGBA rendering, and
58865bd8deadSopenharmony_ci
58875bd8deadSopenharmony_ci                    - the image attached to the color buffer has at
58885bd8deadSopenharmony_ci                      least as many bits as the deepest visual supported
58895bd8deadSopenharmony_ci                      by the window-system, although the alpha buffer
58905bd8deadSopenharmony_ci                      can have 0 bits, and
58915bd8deadSopenharmony_ci
58925bd8deadSopenharmony_ci                    - the image attached to the depth buffer has at
58935bd8deadSopenharmony_ci                      least 12 bits, and
58945bd8deadSopenharmony_ci
58955bd8deadSopenharmony_ci                    - the image attached to the stencil buffer has at
58965bd8deadSopenharmony_ci                      least 1 bit, and
58975bd8deadSopenharmony_ci
58985bd8deadSopenharmony_ci                    - rendering to this framebuffer passes OpenGL
58995bd8deadSopenharmony_ci                      conformance."
59005bd8deadSopenharmony_ci
59015bd8deadSopenharmony_ci            However, it looks like no one is seriously using the
59025bd8deadSopenharmony_ci            NON_CONFORMANT_CONFIG bit under GLX or AGL, and on WGL,
59035bd8deadSopenharmony_ci            there is no such bit, so we'd like to "assume" conformance
59045bd8deadSopenharmony_ci            and drop the last clause.  Additionally, we'd like to just
59055bd8deadSopenharmony_ci            piggy back on the existing requirements without duplicating
59065bd8deadSopenharmony_ci            them here so we will simplify this language to leave out the
59075bd8deadSopenharmony_ci            last paragraph and list of clauses altogether.
59085bd8deadSopenharmony_ci
59095bd8deadSopenharmony_ci            We do wish to retain the notion that there must be some
59105bd8deadSopenharmony_ci            configuration for which FRAMEBUFFER_UNSUPPORTED_EXT is not
59115bd8deadSopenharmony_ci            returned.
59125bd8deadSopenharmony_ci
59135bd8deadSopenharmony_ci    (62) Exactly which, if any, queriable state can change after a call
59145bd8deadSopenharmony_ci         to BindFramebuffer and/or a change in framebuffer attachments?
59155bd8deadSopenharmony_ci
59165bd8deadSopenharmony_ci            RESOLUTION: resolved, at the Sept. 2004 ARB meeting we
59175bd8deadSopenharmony_ci            resolved in principle that there is a small subset of
59185bd8deadSopenharmony_ci            "framebuffer-related" state that can change.  We just need
59195bd8deadSopenharmony_ci            to define exactly the subset.  The current subset as listed
59205bd8deadSopenharmony_ci            in section 4.4.5 is below:
59215bd8deadSopenharmony_ci
59225bd8deadSopenharmony_ci                AUX_BUFFERS
59235bd8deadSopenharmony_ci                MAX_DRAW_BUFFERS
59245bd8deadSopenharmony_ci                MAX_COLOR_ATTACHMENTS
59255bd8deadSopenharmony_ci                RGBA_MODE
59265bd8deadSopenharmony_ci                INDEX_MODE
59275bd8deadSopenharmony_ci                DOUBLEBUFFER
59285bd8deadSopenharmony_ci                STEREO
59295bd8deadSopenharmony_ci                SAMPLE_BUFFERS
59305bd8deadSopenharmony_ci                SAMPLES
59315bd8deadSopenharmony_ci                {RED|GREEN|BLUE|ALPHA}_BITS
59325bd8deadSopenharmony_ci                DEPTH_BITS
59335bd8deadSopenharmony_ci                STENCIL_BITS
59345bd8deadSopenharmony_ci                ACCUM_{RED|GREEN|BLUE|ALPHA}_BITS
59355bd8deadSopenharmony_ci
59365bd8deadSopenharmony_ci            The reason this is an issue is that traditionally there are
59375bd8deadSopenharmony_ci            some GL context state queries that are dependent on pixel
59385bd8deadSopenharmony_ci            format and window-system state.  For instance, doing a
59395bd8deadSopenharmony_ci            GetIntegerv of DEPTH_BITS returns the bit depth of the
59405bd8deadSopenharmony_ci            window-system allocated depth buffer which is a function of
59415bd8deadSopenharmony_ci            the pixel format.  If DEPTH_BITS is zero, this means that no
59425bd8deadSopenharmony_ci            depth buffer was present in the pixel format.  Other context
59435bd8deadSopenharmony_ci            state queries like MAX_DRAW_BUFFERS, MAX_ACCUM_BUFFERS,
59445bd8deadSopenharmony_ci            SAMPLES, etc are all possibly functions of the current pixel
59455bd8deadSopenharmony_ci            format, and have traditionally been constant over the
59465bd8deadSopenharmony_ci            lifetime of a given context.
59475bd8deadSopenharmony_ci
59485bd8deadSopenharmony_ci            However, this extension specifically subsumes some of the
59495bd8deadSopenharmony_ci            operations and state of the window-system pixel format
59505bd8deadSopenharmony_ci            mechanism.  So an obvious question is: what should these
59515bd8deadSopenharmony_ci            queries return for things like DEPTH_BITS and
59525bd8deadSopenharmony_ci            MAX_DRAW_BUFFERS when using a non-default framebuffer
59535bd8deadSopenharmony_ci            object?
59545bd8deadSopenharmony_ci
59555bd8deadSopenharmony_ci            If we allow these queries to return a value that is a
59565bd8deadSopenharmony_ci            function of the current framebuffer object, then a
59575bd8deadSopenharmony_ci            consequence is that the values returned by these queries can
59585bd8deadSopenharmony_ci            change after a call to BindFramebuffer and/or a change in
59595bd8deadSopenharmony_ci            the attachments of the currently bound framebuffer object.
59605bd8deadSopenharmony_ci
59615bd8deadSopenharmony_ci            This may be desirable: for instance, a user may rightly
59625bd8deadSopenharmony_ci            expect that querying RED_BITS returns the red bits of the
59635bd8deadSopenharmony_ci            currently attached color buffer(s).  But is the user also
59645bd8deadSopenharmony_ci            expecting that MAX_DRAW_BUFFERS might change?  What about
59655bd8deadSopenharmony_ci            SAMPLES or SAMPLE_BUFFERS?  What about
59665bd8deadSopenharmony_ci            MAX_COLOR_ATTACHMENTS?
59675bd8deadSopenharmony_ci
59685bd8deadSopenharmony_ci            Consider that in developing ARB_draw_buffers it was stated
59695bd8deadSopenharmony_ci            that some implementations might want to set MAX_DRAW_BUFFERS
59705bd8deadSopenharmony_ci            to 1 for pixel formats that also supported multisampling.
59715bd8deadSopenharmony_ci            This would allow implementations to control which
59725bd8deadSopenharmony_ci            capabilities they exported.  What facilities do we have for
59735bd8deadSopenharmony_ci            this in this extension - can MAX_DRAW_BUFFERS change if we
59745bd8deadSopenharmony_ci            supported multisampling on a non-default framebuffer object?
59755bd8deadSopenharmony_ci
59765bd8deadSopenharmony_ci            Fundamentally, all of the state in table 6.28-6.31 of the
59775bd8deadSopenharmony_ci            OpenGL 1.5 spec (the MAX_* queries) can in theory change as
59785bd8deadSopenharmony_ci            the result of the pixel format changing.  Since this
59795bd8deadSopenharmony_ci            extension does an effective pixel format change, what if any
59805bd8deadSopenharmony_ci            of this state can/should be allowed to change when
59815bd8deadSopenharmony_ci            framebuffer attachments are changed?
59825bd8deadSopenharmony_ci
59835bd8deadSopenharmony_ci    (63) Should we change ValidateFramebuffer into an explicit
59845bd8deadSopenharmony_ci         enum-based query for framebuffer completeness?
59855bd8deadSopenharmony_ci
59865bd8deadSopenharmony_ci            RESOLUTION: resolved, separate API function rather than a
59875bd8deadSopenharmony_ci            Get query, to emphasize the "on-demand" state examination.
59885bd8deadSopenharmony_ci
59895bd8deadSopenharmony_ci            We did choose a different name for ValidateFramebuffer().
59905bd8deadSopenharmony_ci            In issue (67) we decided to rename this function
59915bd8deadSopenharmony_ci            CheckFramebufferStatus().
59925bd8deadSopenharmony_ci
59935bd8deadSopenharmony_ci            For reference the reason this is an issue is that, as
59945bd8deadSopenharmony_ci            originally described, ValidateFramebuffer (now called
59955bd8deadSopenharmony_ci            CheckFramebufferStatus) served three purposes:
59965bd8deadSopenharmony_ci
59975bd8deadSopenharmony_ci            First, it forced an "on-demand" examination of the current
59985bd8deadSopenharmony_ci            framebuffer state (including framebuffer attachment state)
59995bd8deadSopenharmony_ci            and the state of the attached images.  On some
60005bd8deadSopenharmony_ci            implementations this examination might be expensive, and
60015bd8deadSopenharmony_ci            therefore there was a desire to control exactly when the
60025bd8deadSopenharmony_ci            operation would occur.
60035bd8deadSopenharmony_ci
60045bd8deadSopenharmony_ci            Second, because of the implementation dependent reasons that
60055bd8deadSopenharmony_ci            a framebuffer might be considered not complete,
60065bd8deadSopenharmony_ci            ValidateFramebuffer served as a query for an application to
60075bd8deadSopenharmony_ci            determine at run-time if a seemingly compatible combination
60085bd8deadSopenharmony_ci            of attached images is actually incompatible on the current
60095bd8deadSopenharmony_ci            GL implementation.
60105bd8deadSopenharmony_ci
60115bd8deadSopenharmony_ci            Third, ValidateFramebuffer was more than just a query.  It
60125bd8deadSopenharmony_ci            was a function that would set a piece of framebuffer state
60135bd8deadSopenharmony_ci            that "enabled" rendering if the framebuffer was determined
60145bd8deadSopenharmony_ci            to be complete.  After certain changes to framebuffer state,
60155bd8deadSopenharmony_ci            or in the initial default state, unless ValidateFramebuffer
60165bd8deadSopenharmony_ci            was called prior to rendering, and unless framebuffer
60175bd8deadSopenharmony_ci            validation "passed", rendering would be disabled.
60185bd8deadSopenharmony_ci
60195bd8deadSopenharmony_ci            However, now that it is no longer required to call
60205bd8deadSopenharmony_ci            ValidateFramebuffer prior to rendering, ValidateFramebuffer
60215bd8deadSopenharmony_ci            doesn't really set any state.  The third reason is no longer
60225bd8deadSopenharmony_ci            pertinent.
60235bd8deadSopenharmony_ci
60245bd8deadSopenharmony_ci            This leaves us with the first and second reasons.  The first
60255bd8deadSopenharmony_ci            reason in particular seems to be driven by convenience.  It
60265bd8deadSopenharmony_ci            is convenient to be able to control when this operation
60275bd8deadSopenharmony_ci            happens, but it is arguably also convenient to be able to
60285bd8deadSopenharmony_ci            force the examination/validation of a wide variety of other
60295bd8deadSopenharmony_ci            pieces of GL state, yet we don't have specific on-demand
60305bd8deadSopenharmony_ci            "ValidateTexture" or "ValidateBlendState" routines.  In
60315bd8deadSopenharmony_ci            addition, on some implementations framebuffer validation may
60325bd8deadSopenharmony_ci            be less expensive than originally thought.
60335bd8deadSopenharmony_ci
60345bd8deadSopenharmony_ci            So if we ignore the first reason for a moment, we are left
60355bd8deadSopenharmony_ci            the second reason for ValidateFramebuffer - a query of the
60365bd8deadSopenharmony_ci            framebuffer completeness.  We do wish to retain this query
60375bd8deadSopenharmony_ci            somehow, so we could choose to leave it in its current form,
60385bd8deadSopenharmony_ci            or we could choose to make it look like other more
60395bd8deadSopenharmony_ci            traditional queries, i.e., some kind of GetInteger,
60405bd8deadSopenharmony_ci            GetFramebuffer, or GetFramebufferParameter call.
60415bd8deadSopenharmony_ci
60425bd8deadSopenharmony_ci            If we feel like the first reason is still valid, we could
60435bd8deadSopenharmony_ci            also choose to retain a ValidateFramebuffer call to get the
60445bd8deadSopenharmony_ci            "on-demand" state examination and still choose to make
60455bd8deadSopenharmony_ci            separate query for the framebuffer completeness.
60465bd8deadSopenharmony_ci
60475bd8deadSopenharmony_ci            Either way, if we decide to make an enum-based query we need
60485bd8deadSopenharmony_ci            to choose the form.  We could choose to use GetInteger and
60495bd8deadSopenharmony_ci            query for COMPLETENESS.  (If we do this, we'd need a
60505bd8deadSopenharmony_ci            "per-target" variant of the enum, i.e.,
60515bd8deadSopenharmony_ci            FRAMEBUFFER_COMPLETE, and if a read framebuffer target is
60525bd8deadSopenharmony_ci            added later, READ_FRAMEBUFFER_COMPLETE would need to be
60535bd8deadSopenharmony_ci            added as well.)  This would be similar to how texture
60545bd8deadSopenharmony_ci            bindings are queried on a per target basis as in
60555bd8deadSopenharmony_ci            GetIntegerv(TEXTURE_BINDING_2D, &param).  Another option is
60565bd8deadSopenharmony_ci            to add a target-aware query routine, i.e.,
60575bd8deadSopenharmony_ci            GetFramebufferiv(FRAMEBUFFER, COMPLETE, &param); this is
60585bd8deadSopenharmony_ci            similar to what the ARB vertex/fragment program API's did to
60595bd8deadSopenharmony_ci            query per-target state like PROGRAM_NATIVE_INSTRUCTIONS_ARB.
60605bd8deadSopenharmony_ci
60615bd8deadSopenharmony_ci    (64) Should it be a GL error to attempt to render with an incomplete
60625bd8deadSopenharmony_ci         framebuffer?
60635bd8deadSopenharmony_ci
60645bd8deadSopenharmony_ci            RESOLUTION: resolved, "YES"
60655bd8deadSopenharmony_ci
60665bd8deadSopenharmony_ci            In looking at other GL resources that can be considered
60675bd8deadSopenharmony_ci            "incomplete" for rendering, there were two precedents to
60685bd8deadSopenharmony_ci            draw on here: (a) textures and (b) programs/shaders.
60695bd8deadSopenharmony_ci
60705bd8deadSopenharmony_ci            a) For textures, the GL behaves as if the incomplete
60715bd8deadSopenharmony_ci            resource is simply not available.  That is, if an
60725bd8deadSopenharmony_ci            application attempts to render with an incomplete texture,
60735bd8deadSopenharmony_ci            then the GL behaves as if texturing is simply disabled.  No
60745bd8deadSopenharmony_ci            error is thrown.
60755bd8deadSopenharmony_ci
60765bd8deadSopenharmony_ci            b) For ARB_vertex_program and ARB_fragment_program, and GLSL
60775bd8deadSopenharmony_ci            shaders, if a program or shader is invalid, then the GL
60785bd8deadSopenharmony_ci            throws an error at "Begin" time.
60795bd8deadSopenharmony_ci
60805bd8deadSopenharmony_ci            Originally, we choose style (a): treat an incomplete
60815bd8deadSopenharmony_ci            framebuffer similar to a "pixel ownership test failure".
60825bd8deadSopenharmony_ci            This means that no fragments are generated, reads of the
60835bd8deadSopenharmony_ci            framebuffer generate undefined pixels, and no error is
60845bd8deadSopenharmony_ci            thrown.
60855bd8deadSopenharmony_ci
60865bd8deadSopenharmony_ci            [NOTE: Technically, according to the GL spec, the fate of
60875bd8deadSopenharmony_ci            rendered fragments that fail the pixel ownership test is
60885bd8deadSopenharmony_ci            left up to the window-system and is therefore implementation
60895bd8deadSopenharmony_ci            dependent.  A better way to handle this is to mimic
60905bd8deadSopenharmony_ci            make_current_read's language "as if DRAW_BUFFER is NONE"]
60915bd8deadSopenharmony_ci
60925bd8deadSopenharmony_ci            However, since the a query of framebuffer completeness can
60935bd8deadSopenharmony_ci            only answer the question "is the framebuffer complete right
60945bd8deadSopenharmony_ci            now?", but doesn't indicate whether the application may have
60955bd8deadSopenharmony_ci            attempted to render with an incomplete framebuffer earlier,
60965bd8deadSopenharmony_ci            we decided to throw an error in this case as an aid to the
60975bd8deadSopenharmony_ci            developer.  Throwing an error has an advantage in that the
60985bd8deadSopenharmony_ci            error state is retained, like all GL errors until the user
60995bd8deadSopenharmony_ci            calls GetError().
61005bd8deadSopenharmony_ci
61015bd8deadSopenharmony_ci            Another option that was considered was to extend the
61025bd8deadSopenharmony_ci            framebuffer completeness query to indicate that the
61035bd8deadSopenharmony_ci            framebuffer is complete now, but was incomplete during
61045bd8deadSopenharmony_ci            earlier rendering.  The downside of this option was that
61055bd8deadSopenharmony_ci            then there would then be two return values for the query
61065bd8deadSopenharmony_ci            that would mean "framebuffer complete right now".  So in the
61075bd8deadSopenharmony_ci            end, we simply decided to leverage the existing GetError
61085bd8deadSopenharmony_ci            semantics to capture this "sticky" error behavior.
61095bd8deadSopenharmony_ci
61105bd8deadSopenharmony_ci            One additional concern was that gl errors are traditionally
61115bd8deadSopenharmony_ci            only used to indicate programming errors on the part of the
61125bd8deadSopenharmony_ci            application, but the framebuffer completeness test may have
61135bd8deadSopenharmony_ci            failed simply because of implementation dependencies through
61145bd8deadSopenharmony_ci            no fault of the application.  We decided to adopt the notion
61155bd8deadSopenharmony_ci            is that it is an error to attempt to render with an
61165bd8deadSopenharmony_ci            incomplete framebuffer, on all implementations, and so it
61175bd8deadSopenharmony_ci            actually *is* a programming error if an application does not
61185bd8deadSopenharmony_ci            attempt to deal with an incomplete framebuffer prior to
61195bd8deadSopenharmony_ci            rendering.
61205bd8deadSopenharmony_ci
61215bd8deadSopenharmony_ci    (65) If it is an error to render to or read from an incomplete
61225bd8deadSopenharmony_ci         framebuffer, should we use INVALID_OPERATION or create a new
61235bd8deadSopenharmony_ci         error?
61245bd8deadSopenharmony_ci
61255bd8deadSopenharmony_ci            RESOLUTION: resolved, INVALID_FRAMEBUFFER_OPERATION_EXT
61265bd8deadSopenharmony_ci
61275bd8deadSopenharmony_ci            We resolved to create a new error at the September ARB
61285bd8deadSopenharmony_ci            meeting and then resolved the name of the error within
61295bd8deadSopenharmony_ci            the work group.
61305bd8deadSopenharmony_ci
61315bd8deadSopenharmony_ci                We agreed that if we throw an error here, we'd like a
61325bd8deadSopenharmony_ci                new error enum, particularly because the error may have
61335bd8deadSopenharmony_ci                been triggered by a framebuffer which is incomplete for
61345bd8deadSopenharmony_ci                implementation dependent reasons.
61355bd8deadSopenharmony_ci
61365bd8deadSopenharmony_ci                Some options for the new error name which were discussed:
61375bd8deadSopenharmony_ci
61385bd8deadSopenharmony_ci                    OPERATION_ON_INCOMPLETE_FRAMEBUFFER
61395bd8deadSopenharmony_ci                    INCOMPLETE_FRAMEBUFFER
61405bd8deadSopenharmony_ci                    IMPLEMENTATION_DEPENDENT_FAILURE
61415bd8deadSopenharmony_ci                    INVALID_FRAMEBUFFER
61425bd8deadSopenharmony_ci                    INVALID_FRAMEBUFFER_OPERATION
61435bd8deadSopenharmony_ci
61445bd8deadSopenharmony_ci    (66) There are several issues related to how we treat DrawBuffer(s)
61455bd8deadSopenharmony_ci         and other context state with respect to framebuffer
61465bd8deadSopenharmony_ci         completeness.  We'd like a self-consistent model here and this
61475bd8deadSopenharmony_ci         may affect the resolution of issue (8), (44), (55), and (56).
61485bd8deadSopenharmony_ci
61495bd8deadSopenharmony_ci            RESOLUTION: resolved, (d) - no context state in framebuffer
61505bd8deadSopenharmony_ci            completeness test, but context state can affect whether
61515bd8deadSopenharmony_ci            rendering takes place, does not take place, or is undefined.
61525bd8deadSopenharmony_ci            Note option (d) required us to revisit issue (44).
61535bd8deadSopenharmony_ci
61545bd8deadSopenharmony_ci            The first question we had to answer was:
61555bd8deadSopenharmony_ci
61565bd8deadSopenharmony_ci                Is it desireable that "framebuffer completeness" be
61575bd8deadSopenharmony_ci                purely a property of the set of framebuffer state (which
61585bd8deadSopenharmony_ci                includes the state of the images attached to the
61595bd8deadSopenharmony_ci                framebuffer)?  Or can a framebuffer's completeness
61605bd8deadSopenharmony_ci                depend on "non-framebuffer" context state as well?
61615bd8deadSopenharmony_ci
61625bd8deadSopenharmony_ci            For instance, there are currently two pieces of context
61635bd8deadSopenharmony_ci            state that can affect framebuffer completeness: texture
61645bd8deadSopenharmony_ci            binding state and draw buffer state.
61655bd8deadSopenharmony_ci
61665bd8deadSopenharmony_ci            First, in issue (44), we decided that attaching an image of
61675bd8deadSopenharmony_ci            a currently bound and enabled texture to a framebuffer can
61685bd8deadSopenharmony_ci            cause a framebuffer to be incomplete.  The texture binding
61695bd8deadSopenharmony_ci            is context state and there are pieces of the texture object
61705bd8deadSopenharmony_ci            state (base level, max level) that can also affect the
61715bd8deadSopenharmony_ci            determination of framebuffer completeness.  (Additionally if
61725bd8deadSopenharmony_ci            we add render-to-vertex-array functionality later, we might
61735bd8deadSopenharmony_ci            expect to have a framebuffer completeness requirement that
61745bd8deadSopenharmony_ci            examines the state of the currently bound vertex array.)
61755bd8deadSopenharmony_ci
61765bd8deadSopenharmony_ci            One way to avoid this context dependency is to revisit issue
61775bd8deadSopenharmony_ci            (44) and say that this "texture-from-destination" case
61785bd8deadSopenharmony_ci            simply generates undefined rendering but does not affect
61795bd8deadSopenharmony_ci            framebuffer completeness.  This would replace the "expressly
61805bd8deadSopenharmony_ci            disabled" rendering and framebuffer incompleteness with
61815bd8deadSopenharmony_ci            "undefined rendering", but would also let implementations
61825bd8deadSopenharmony_ci            avoid checking context state during the validation of the
61835bd8deadSopenharmony_ci            framebuffer state.
61845bd8deadSopenharmony_ci
61855bd8deadSopenharmony_ci            The second piece of context state that might cause
61865bd8deadSopenharmony_ci            framebuffer validation failures is the draw buffer(s) and/or
61875bd8deadSopenharmony_ci            read buffer state.  It has been suggested in issue (55) that
61885bd8deadSopenharmony_ci            if the draw buffers specify attachment points with no
61895bd8deadSopenharmony_ci            attached images, then the framebuffer might be considered
61905bd8deadSopenharmony_ci            incomplete.  If we choose to do this, then we would have
61915bd8deadSopenharmony_ci            context state influencing framebuffer completeness state.
61925bd8deadSopenharmony_ci            However, if we resolve issue (56) to say that the draw
61935bd8deadSopenharmony_ci            buffer state is part of the framebuffer object state, then
61945bd8deadSopenharmony_ci            the draw buffer is no longer context state and this
61955bd8deadSopenharmony_ci            particular dependency of framebuffer completeness on context
61965bd8deadSopenharmony_ci            state goes away.
61975bd8deadSopenharmony_ci
61985bd8deadSopenharmony_ci            The above discussion leaves us with several self-consistent,
61995bd8deadSopenharmony_ci            but different sets of decisions:
62005bd8deadSopenharmony_ci
62015bd8deadSopenharmony_ci                (a) Remove context dependencies from framebuffer
62025bd8deadSopenharmony_ci                    completeness.
62035bd8deadSopenharmony_ci
62045bd8deadSopenharmony_ci                    To do this we would:
62055bd8deadSopenharmony_ci
62065bd8deadSopenharmony_ci                    - Move draw buffer state from context into
62075bd8deadSopenharmony_ci                      framebuffer: issue (56)
62085bd8deadSopenharmony_ci
62095bd8deadSopenharmony_ci                    - Make "texture-from-destination" undefined instead
62105bd8deadSopenharmony_ci                      of a reason for framebuffer incompleteness: issue
62115bd8deadSopenharmony_ci                      (44)
62125bd8deadSopenharmony_ci
62135bd8deadSopenharmony_ci                    - Presumably, if we created a render-to-vertex-array
62145bd8deadSopenharmony_ci                      extension layered on this one, we would likely
62155bd8deadSopenharmony_ci                      also make rendering into the currently bound
62165bd8deadSopenharmony_ci                      vertex array undefined as well.
62175bd8deadSopenharmony_ci
62185bd8deadSopenharmony_ci                    With option (a), we can say that having draw buffer
62195bd8deadSopenharmony_ci                    set to an non-existent buffer is a reason for
62205bd8deadSopenharmony_ci                    framebuffer incompleteness and there are no context
62215bd8deadSopenharmony_ci                    dependencies.  This would resolve issue (55).
62225bd8deadSopenharmony_ci
62235bd8deadSopenharmony_ci                (b) Allow context dependencies in framebuffer
62245bd8deadSopenharmony_ci                    completeness.
62255bd8deadSopenharmony_ci
62265bd8deadSopenharmony_ci                    Essentially this means that the result of a query of
62275bd8deadSopenharmony_ci                    framebuffer completeness is dependent on the context
62285bd8deadSopenharmony_ci                    making the query - or put another way, the
62295bd8deadSopenharmony_ci                    framebuffer completeness state is context state not
62305bd8deadSopenharmony_ci                    framebuffer state.
62315bd8deadSopenharmony_ci
62325bd8deadSopenharmony_ci                    If we choose this option (b), then we are esentially
62335bd8deadSopenharmony_ci                    free to resolve issues (44), (55), and (56)
62345bd8deadSopenharmony_ci                    however we want.  In other words:
62355bd8deadSopenharmony_ci
62365bd8deadSopenharmony_ci                        - draw buffer can be either context or
62375bd8deadSopenharmony_ci                          framebuffer state: issue (56)
62385bd8deadSopenharmony_ci
62395bd8deadSopenharmony_ci                        - "texture-from-destination" can be either
62405bd8deadSopenharmony_ci                          undefined or a reason for framebuffer
62415bd8deadSopenharmony_ci                          incompleteness
62425bd8deadSopenharmony_ci
62435bd8deadSopenharmony_ci                        - draw buffer specifying a non-existent buffer
62445bd8deadSopenharmony_ci                          can be a reason for framebuffer incompleteness
62455bd8deadSopenharmony_ci                          or could result in undefined behavior: issue
62465bd8deadSopenharmony_ci                          (55)
62475bd8deadSopenharmony_ci
62485bd8deadSopenharmony_ci                (c) Remove the framebuffer object and make the
62495bd8deadSopenharmony_ci                    framebuffer state part of the context.
62505bd8deadSopenharmony_ci
62515bd8deadSopenharmony_ci                    This option redefines the issue by not making a
62525bd8deadSopenharmony_ci                    distinction between framebuffer "object" state and
62535bd8deadSopenharmony_ci                    "context" state, therefore framebuffer completeness
62545bd8deadSopenharmony_ci                    depends only on "context" state because all of the
62555bd8deadSopenharmony_ci                    "framebuffer" state is now "context" state.
62565bd8deadSopenharmony_ci
62575bd8deadSopenharmony_ci                    This would mean that there is now a subset of state
62585bd8deadSopenharmony_ci                    in the context that can be considered the
62595bd8deadSopenharmony_ci                    "framebuffer state" of the context.  This is the set
62605bd8deadSopenharmony_ci                    of state that would presumably be pushed/popped
62615bd8deadSopenharmony_ci                    under a theoretical FRAMEBUFFER_BIT for
62625bd8deadSopenharmony_ci                    PushAttrib().
62635bd8deadSopenharmony_ci
62645bd8deadSopenharmony_ci                    Regardless of whether there is a framebuffer object,
62655bd8deadSopenharmony_ci                    framebuffer completeness may or may not still depend
62665bd8deadSopenharmony_ci                    on pieces of other "context" state that are not part
62675bd8deadSopenharmony_ci                    of subset of context state related to the
62685bd8deadSopenharmony_ci                    "non-default" framebuffer (for instance, texture
62695bd8deadSopenharmony_ci                    bindings and/or draw buffer state).
62705bd8deadSopenharmony_ci
62715bd8deadSopenharmony_ci                    If we choose this option (c),
62725bd8deadSopenharmony_ci
62735bd8deadSopenharmony_ci                        - we remove the framebuffer object: issue (8)
62745bd8deadSopenharmony_ci                          This means:
62755bd8deadSopenharmony_ci
62765bd8deadSopenharmony_ci                            - removing gen/is/bind/delete framebuffer
62775bd8deadSopenharmony_ci                              object
62785bd8deadSopenharmony_ci
62795bd8deadSopenharmony_ci                            - moving the attachment state into the
62805bd8deadSopenharmony_ci                              context
62815bd8deadSopenharmony_ci
62825bd8deadSopenharmony_ci                            - creating new context bind points for
62835bd8deadSopenharmony_ci                              framebuffer attachments and creating new
62845bd8deadSopenharmony_ci                              BindFramebufferAttachableImage calls or
62855bd8deadSopenharmony_ci                              using the FramebufferTexture() calls to do
62865bd8deadSopenharmony_ci                              context binds of framebuffer-attachable
62875bd8deadSopenharmony_ci                              images
62885bd8deadSopenharmony_ci
62895bd8deadSopenharmony_ci                        - we decide whether there is a single set of
62905bd8deadSopenharmony_ci                          draw/read buffer context state or a 2nd set of
62915bd8deadSopenharmony_ci                          draw/read buffer context state to be used for
62925bd8deadSopenharmony_ci                          "non-default" framebuffer objects.  Either way
62935bd8deadSopenharmony_ci                          it's "context" state but we need to know if we
62945bd8deadSopenharmony_ci                          have one set of state or two.  This is a
62955bd8deadSopenharmony_ci                          variation on issue (56).
62965bd8deadSopenharmony_ci
62975bd8deadSopenharmony_ci                        - as in option (b), "texture-from-destination"
62985bd8deadSopenharmony_ci                          can be either undefined or a reason for
62995bd8deadSopenharmony_ci                          framebuffer incompleteness
63005bd8deadSopenharmony_ci
63015bd8deadSopenharmony_ci                        - as in option (b), a draw buffer specifying a
63025bd8deadSopenharmony_ci                          non-existent buffer can either be a reason for
63035bd8deadSopenharmony_ci                          framebuffer incompleteness or could result in
63045bd8deadSopenharmony_ci                          undefined behavior: issue (55)
63055bd8deadSopenharmony_ci
63065bd8deadSopenharmony_ci                        - all the framebuffer attachments become context
63075bd8deadSopenharmony_ci                          state
63085bd8deadSopenharmony_ci
63095bd8deadSopenharmony_ci                        - we add a framebuffer enable/disable bit to use
63105bd8deadSopenharmony_ci                          to distinguish between the "default" and
63115bd8deadSopenharmony_ci                          "non-default" framebuffer
63125bd8deadSopenharmony_ci
63135bd8deadSopenharmony_ci                (d) Create a new category of reasons that you can't use
63145bd8deadSopenharmony_ci                    a framebuffer for rendering in a specific context,
63155bd8deadSopenharmony_ci                    but that are not part of the test for "framebuffer
63165bd8deadSopenharmony_ci                    completeness"
63175bd8deadSopenharmony_ci
63185bd8deadSopenharmony_ci                    Essentially, this is a kind of hybrid of options (a)
63195bd8deadSopenharmony_ci                    and (b).  There are no context dependent reasons for
63205bd8deadSopenharmony_ci                    framebuffer incompleteness, but at the same time
63215bd8deadSopenharmony_ci                    there are some additional context-dependent
63225bd8deadSopenharmony_ci                    constraints on using a framebuffer.  In other words,
63235bd8deadSopenharmony_ci                    a framebuffer can be complete but still not suitable
63245bd8deadSopenharmony_ci                    for rendering by a given context.
63255bd8deadSopenharmony_ci
63265bd8deadSopenharmony_ci                    This creates two categories of tests that can be
63275bd8deadSopenharmony_ci                    used to disable rendering - the set of
63285bd8deadSopenharmony_ci                    context-independent test that are used to determine
63295bd8deadSopenharmony_ci                    framebuffer completeness, and the set of tests that
63305bd8deadSopenharmony_ci                    are context-dependent and not used to determine
63315bd8deadSopenharmony_ci                    framebuffer completeness.
63325bd8deadSopenharmony_ci
63335bd8deadSopenharmony_ci                    An open question is: should we add a separate query
63345bd8deadSopenharmony_ci                    for this second set of context-dependent tests
63355bd8deadSopenharmony_ci                    and/or a "meta-query" that would cover both sets.
63365bd8deadSopenharmony_ci                    This "meta-query" would return "true" if and only if
63375bd8deadSopenharmony_ci                    the framebuffer is complete *and* it can be used in
63385bd8deadSopenharmony_ci                    this context.
63395bd8deadSopenharmony_ci
63405bd8deadSopenharmony_ci                    Note that while the "is framebuffer complete" query
63415bd8deadSopenharmony_ci                    is required by the fact that a framebuffer can be
63425bd8deadSopenharmony_ci                    incomplete because of implementation dependent
63435bd8deadSopenharmony_ci                    reasons, the second query of the context-dependent
63445bd8deadSopenharmony_ci                    test results and the "meta query" are primarily
63455bd8deadSopenharmony_ci                    debugging aids, though perhaps convenient ones.
63465bd8deadSopenharmony_ci
63475bd8deadSopenharmony_ci                    The framebuffer completeness query is analogous to
63485bd8deadSopenharmony_ci                    asking if a texture is "mipmap complete".  The
63495bd8deadSopenharmony_ci                    question, "can I render into my framebuffer", is
63505bd8deadSopenharmony_ci                    analgous to asking the question, "is texturing
63515bd8deadSopenharmony_ci                    enabled."  A bound texture may be "complete", but
63525bd8deadSopenharmony_ci                    texturing can still be disabled due to an
63535bd8deadSopenharmony_ci                    unfortunate combination of non-texture-object
63545bd8deadSopenharmony_ci                    context state.  Option (d) is basically saying the
63555bd8deadSopenharmony_ci                    same thing of framebuffer objects.
63565bd8deadSopenharmony_ci
63575bd8deadSopenharmony_ci                    To implement option (d), we'd do the following:
63585bd8deadSopenharmony_ci
63595bd8deadSopenharmony_ci                    - If draw buffer is defined as "context state" it
63605bd8deadSopenharmony_ci                      can not affect framebuffer completeness, but if
63615bd8deadSopenharmony_ci                      draw buffer is defined as framebuffer state it
63625bd8deadSopenharmony_ci                      might affect framebuffer completeness.  See issues
63635bd8deadSopenharmony_ci                      (55) and (56).
63645bd8deadSopenharmony_ci
63655bd8deadSopenharmony_ci                    - Make "texture-from-destination" undefined instead
63665bd8deadSopenharmony_ci                      of a reason for framebuffer incompleteness: issue
63675bd8deadSopenharmony_ci                      (44).  Technically, this could still be an error
63685bd8deadSopenharmony_ci                      unrelated to framebuffer completeness, but we are
63695bd8deadSopenharmony_ci                      trying to avoid creating a precedent for arbitrary
63705bd8deadSopenharmony_ci                      "errors at begin time".  When this case was
63715bd8deadSopenharmony_ci                      included in the "framebuffer completeness"
63725bd8deadSopenharmony_ci                      validation, the additional cost of generating the
63735bd8deadSopenharmony_ci                      error was free.  But if this
63745bd8deadSopenharmony_ci                      "texture-from-destination" case is not part of
63755bd8deadSopenharmony_ci                      framebuffer completeness, then it is an additional
63765bd8deadSopenharmony_ci                      cost at begin time to detect this in order to flag
63775bd8deadSopenharmony_ci                      an error (and/or disable rendering).  To avoid
63785bd8deadSopenharmony_ci                      this cost, we would make this undefined.
63795bd8deadSopenharmony_ci
63805bd8deadSopenharmony_ci                    - Presumably, if we later create a
63815bd8deadSopenharmony_ci                      render-to-vertex-array extension layered on this
63825bd8deadSopenharmony_ci                      one, we would likely also choose the same
63835bd8deadSopenharmony_ci                      resolution for rendering into the currently bound
63845bd8deadSopenharmony_ci                      vertex array as we choose for the currently bound
63855bd8deadSopenharmony_ci                      texture.
63865bd8deadSopenharmony_ci
63875bd8deadSopenharmony_ci    (67) In issue (63) we decided we want to use a dedicated API
63885bd8deadSopenharmony_ci         function to test framebuffer completeness.  We might want to
63895bd8deadSopenharmony_ci         change the name of "ValidateFramebuffer" however.  If so, what
63905bd8deadSopenharmony_ci         name should we use?
63915bd8deadSopenharmony_ci
63925bd8deadSopenharmony_ci            RESOLUTION: resolved, CheckFramebufferStatus()
63935bd8deadSopenharmony_ci
63945bd8deadSopenharmony_ci            One reason we decided to retain an explicit API function
63955bd8deadSopenharmony_ci            instead of just using a GetInteger style query is to
63965bd8deadSopenharmony_ci            emphasis the "on-demand" state examination that takes place
63975bd8deadSopenharmony_ci            when making this query.
63985bd8deadSopenharmony_ci
63995bd8deadSopenharmony_ci            However, some were uncomfortable with the name
64005bd8deadSopenharmony_ci            ValidateFramebuffer for this purpose.  Some felt that it
64015bd8deadSopenharmony_ci            implied a requirement to call the function, and others felt
64025bd8deadSopenharmony_ci            it was too similar in name to the GLSL function
64035bd8deadSopenharmony_ci            ValidateProgram which served a related but slightly
64045bd8deadSopenharmony_ci            different purpose.  So we chose a new name.
64055bd8deadSopenharmony_ci
64065bd8deadSopenharmony_ci            Some options we considered:
64075bd8deadSopenharmony_ci                ValidateFramebufferCompleteness()
64085bd8deadSopenharmony_ci                CheckFramebufferCompleteness()
64095bd8deadSopenharmony_ci                CheckFramebufferStatus()
64105bd8deadSopenharmony_ci                IsFramebufferComplete()
64115bd8deadSopenharmony_ci
64125bd8deadSopenharmony_ci    (68) Exactly which levels should by generated by GenerateMipmapEXT?
64135bd8deadSopenharmony_ci
64145bd8deadSopenharmony_ci            RESOLUTION: resolved, from TEXTURE_BASE_LEVEL+1 through q
64155bd8deadSopenharmony_ci
64165bd8deadSopenharmony_ci            Automatic mipmap generation via GENERATE_MIPMAP generates
64175bd8deadSopenharmony_ci            from TEXTURE_BASE_LEVEL+1 through p, which is the 1x1 level.
64185bd8deadSopenharmony_ci            However, applications frequently don't want to waste
64195bd8deadSopenharmony_ci            computation generating past q, which is the min of
64205bd8deadSopenharmony_ci            TEXTURE_MAX_LEVEL and p.  The only recourse is to accept the
64215bd8deadSopenharmony_ci            performance hit or to not use GENERATE_MIPMAP.
64225bd8deadSopenharmony_ci
64235bd8deadSopenharmony_ci            Arguably GENERATE_MIPMAP should have been specified to
64245bd8deadSopenharmony_ci            generate only through q.  We have the opportunity to "fix"
64255bd8deadSopenharmony_ci            this problem by "correctly" specifying the new function
64265bd8deadSopenharmony_ci            GenerateMipmapEXT to generate only from TEXTURE_BASE_LEVEL+1
64275bd8deadSopenharmony_ci            through q.
64285bd8deadSopenharmony_ci
64295bd8deadSopenharmony_ci            As the specification of GenerateMipmapEXT is currently
64305bd8deadSopenharmony_ci            written, GenerateMipmapEXT only generates levels
64315bd8deadSopenharmony_ci            TEXTURE_BASE_LEVEL+1 through q.
64325bd8deadSopenharmony_ci
64335bd8deadSopenharmony_ci    (69) What should we call the framebuffer objects to distinguish
64345bd8deadSopenharmony_ci         them from the default framebuffer?
64355bd8deadSopenharmony_ci
64365bd8deadSopenharmony_ci            RESOLUTION: resolved, "application-created"
64375bd8deadSopenharmony_ci
64385bd8deadSopenharmony_ci            Currently we call these "application-created" framebuffers
64395bd8deadSopenharmony_ci            Some places in the spec have also referred these as
64405bd8deadSopenharmony_ci            "GL-allocated" framebuffers.  Whichever term we use, we
64415bd8deadSopenharmony_ci            should use it consistently.
64425bd8deadSopenharmony_ci
64435bd8deadSopenharmony_ci            Some terms we considered:
64445bd8deadSopenharmony_ci
64455bd8deadSopenharmony_ci                "application-created" framebuffers
64465bd8deadSopenharmony_ci                "application-allocated" framebuffers
64475bd8deadSopenharmony_ci                "non-default" framebuffers
64485bd8deadSopenharmony_ci                "GL-created" framebuffers
64495bd8deadSopenharmony_ci                "GL-allocated" framebuffers
64505bd8deadSopenharmony_ci                "dynamically-created" framebuffers
64515bd8deadSopenharmony_ci                etc.
64525bd8deadSopenharmony_ci
64535bd8deadSopenharmony_ci            The GL spec already talks about "creating" textures, not
64545bd8deadSopenharmony_ci            "allocating" them, so "*-created" seems like a better
64555bd8deadSopenharmony_ci            choice.
64565bd8deadSopenharmony_ci
64575bd8deadSopenharmony_ci            It's a bit of a toss-up between "GL-created" and
64585bd8deadSopenharmony_ci            "application-created".  Technically, the "GL" really creates
64595bd8deadSopenharmony_ci            and manages these objects but it only does so at the request
64605bd8deadSopenharmony_ci            of the application.  Going with "application-created" for
64615bd8deadSopenharmony_ci            now.
64625bd8deadSopenharmony_ci
64635bd8deadSopenharmony_ci    (70) With which, if any, attribute bit does the framebuffer binding
64645bd8deadSopenharmony_ci         push and pop?  The same question applies to the current
64655bd8deadSopenharmony_ci         renderbuffer?
64665bd8deadSopenharmony_ci
64675bd8deadSopenharmony_ci             RESOLUTION: resolved, don't push/pop framebuffer binding
64685bd8deadSopenharmony_ci             bit for now.  If desired, we may add this in the ARB/core
64695bd8deadSopenharmony_ci             update of this spec.
64705bd8deadSopenharmony_ci
64715bd8deadSopenharmony_ci        There are a few precedents to choose from.
64725bd8deadSopenharmony_ci
64735bd8deadSopenharmony_ci        The ARB_vertex/fragment_program extensions chose to *not*
64745bd8deadSopenharmony_ci        push/pop the current program object binding.  It's not clear if
64755bd8deadSopenharmony_ci        this was intentional or which existing attribute bit was
64765bd8deadSopenharmony_ci        appropriate to use or if there was a desire to not create a new
64775bd8deadSopenharmony_ci        attribute bit.
64785bd8deadSopenharmony_ci
64795bd8deadSopenharmony_ci        ARB_vertex_buffer_object buffer objects and GL core texture
64805bd8deadSopenharmony_ci        objects do push/pop the bindings with the existing VERTEX_ARRAY
64815bd8deadSopenharmony_ci        and TEXTURE bits respectively.  In addition, the texture enables
64825bd8deadSopenharmony_ci        are push/pop'ed with the TEXTURE bit.
64835bd8deadSopenharmony_ci
64845bd8deadSopenharmony_ci        If we do wish to push/pop the FRAMEBUFFER_BINDING_EXT state we
64855bd8deadSopenharmony_ci        probably need a new FRAMEBUFFER bit.
64865bd8deadSopenharmony_ci
64875bd8deadSopenharmony_ci        We could also consider adding a RENDERBUFFER_BIT to cover the
64885bd8deadSopenharmony_ci        current renderbuffer binding or allow this renderbuffer binding
64895bd8deadSopenharmony_ci        to push/pop with the FRAMEBUFFER bit.  However, it's less clear
64905bd8deadSopenharmony_ci        that push/pop'ing the renderbuffer binding is useful since the
64915bd8deadSopenharmony_ci        renderbuffer binding is not used for rendering.  The
64925bd8deadSopenharmony_ci        renderbuffer binding is only used to set the current
64935bd8deadSopenharmony_ci        renderbuffer for renderbuffer storage allocation and queries.
64945bd8deadSopenharmony_ci
64955bd8deadSopenharmony_ci        Also, there are a related set of questions about how much state
64965bd8deadSopenharmony_ci        should push/pop with a new FRAMEBUFFER bit.  Should we push/pop
64975bd8deadSopenharmony_ci        all of the framebuffer object state in addition to the current
64985bd8deadSopenharmony_ci        binding?  Similar to the way vertex array's can be attached to
64995bd8deadSopenharmony_ci        VBO's, use of VBO, framebuffers can be attached to other GL
65005bd8deadSopenharmony_ci        objects.  The TEXTURE_BIT covers both per object (min/mag
65015bd8deadSopenharmony_ci        filter) and per context (texture environment and enable) state.
65025bd8deadSopenharmony_ci        It's not clear if this is useful or desirable to have per-object
65035bd8deadSopenharmony_ci        state push/pop.  With the addition of object semantics, it seems
65045bd8deadSopenharmony_ci        like the need for push/pop of object state is reduced.
65055bd8deadSopenharmony_ci
65065bd8deadSopenharmony_ci        In the end, since we'd need to create a new bit anyway, we
65075bd8deadSopenharmony_ci        decided to defer adding push/pop semantics until we understand
65085bd8deadSopenharmony_ci        the implementation ramifications better.  If we decide to create
65095bd8deadSopenharmony_ci        the bit later on in the ARB or Core revision of this extension,
65105bd8deadSopenharmony_ci        we can add it in a backward-compatible fashion.
65115bd8deadSopenharmony_ci
65125bd8deadSopenharmony_ci    (71) Should we spell out precisely which rendering and reading
65135bd8deadSopenharmony_ci         routines can cause us to generate an error at the time the
65145bd8deadSopenharmony_ci         rendering or reading functions are called?
65155bd8deadSopenharmony_ci
65165bd8deadSopenharmony_ci             RESOLUTION: resolved, keep the same language as ARB
65175bd8deadSopenharmony_ci             vertex/fragment program and GLSL for now, with the
65185bd8deadSopenharmony_ci             addtitions relevant for reading the framebuffer, but
65195bd8deadSopenharmony_ci             recommend the ARB look at this when doing the next core GL
65205bd8deadSopenharmony_ci             spec revision.
65215bd8deadSopenharmony_ci
65225bd8deadSopenharmony_ci        Currently GL has a few cases that can cause errors at render
65235bd8deadSopenharmony_ci        time.  Specifically, attempting to render with a mapped vertex
65245bd8deadSopenharmony_ci        buffer object, an invalid low-level vertex or fragment program,
65255bd8deadSopenharmony_ci        or an invalid GLSL program object all generate errors at "Begin"
65265bd8deadSopenharmony_ci        time.
65275bd8deadSopenharmony_ci
65285bd8deadSopenharmony_ci        This extension adds a new error at "begin" time.  Attempting to
65295bd8deadSopenharmony_ci        render with an "incomplete" framebuffer generates
65305bd8deadSopenharmony_ci        INVALID_FRAMEBUFFER_OPERATION_EXT.  In addition, this extension
65315bd8deadSopenharmony_ci        adds the same error at "read" time if the application tries to
65325bd8deadSopenharmony_ci        read from an "incomplete" framebuffer.
65335bd8deadSopenharmony_ci
65345bd8deadSopenharmony_ci        The ARB vertex program, ARB fragment program, and GLSL extension
65355bd8deadSopenharmony_ci        specs state that an app which tries to use an "invalid" object
65365bd8deadSopenharmony_ci        can generate errors when Begin, RasterPos, or any command that
65375bd8deadSopenharmony_ci        performs an explicit Begin is called.
65385bd8deadSopenharmony_ci
65395bd8deadSopenharmony_ci        This extension has adopted similar language.  So the question
65405bd8deadSopenharmony_ci        asked by this issue is: do we need ot be more explicit.
65415bd8deadSopenharmony_ci
65425bd8deadSopenharmony_ci        There are some ambiguities.  For instance, it is an error to
65435bd8deadSopenharmony_ci        write pixels using an "implicit Begin" operation like DrawArrays
65445bd8deadSopenharmony_ci        if the current vertex program is invalid, but it is not an error
65455bd8deadSopenharmony_ci        to do an Accum operation which also writes pixels to the
65465bd8deadSopenharmony_ci        framebuffer.
65475bd8deadSopenharmony_ci
65485bd8deadSopenharmony_ci        This issue applies to all of these extensions.
65495bd8deadSopenharmony_ci
65505bd8deadSopenharmony_ci        Options include:
65515bd8deadSopenharmony_ci
65525bd8deadSopenharmony_ci            - listing all routines which can render or read from the
65535bd8deadSopenharmony_ci              framebuffer and stating that they can cause an error if
65545bd8deadSopenharmony_ci              the framebuffer is incomplete, solving the problem for
65555bd8deadSopenharmony_ci              this extension only.
65565bd8deadSopenharmony_ci
65575bd8deadSopenharmony_ci            - adding to the GL core a table of "routines that read
65585bd8deadSopenharmony_ci              pixels" and "routines that write pixels" and referencing
65595bd8deadSopenharmony_ci              those tables in the language for each of these extensions.
65605bd8deadSopenharmony_ci
65615bd8deadSopenharmony_ci        Because each extension is doing something a little different,
65625bd8deadSopenharmony_ci        it's not even clear if the second option is a viable option.
65635bd8deadSopenharmony_ci        It's possible each extension would need its own list of routines
65645bd8deadSopenharmony_ci        which can generate errors anyway.
65655bd8deadSopenharmony_ci
65665bd8deadSopenharmony_ci        Basically, this is a larger problem than this
65675bd8deadSopenharmony_ci        EXT_framebuffer_object extension.  For now, we choose to use the
65685bd8deadSopenharmony_ci        same (vague-ish) language adopted by the
65695bd8deadSopenharmony_ci        ARB_vertex/fragment_program and GLSL extnesions.
65705bd8deadSopenharmony_ci
65715bd8deadSopenharmony_ci        We do recommend, however, that the ARB address this issue in the
65725bd8deadSopenharmony_ci        next GL core revision.
65735bd8deadSopenharmony_ci
65745bd8deadSopenharmony_ci    (72)  Should the framebuffer completeness test include a clause that
65755bd8deadSopenharmony_ci          says "at least one color attachment" has been made?  Or "at
65765bd8deadSopenharmony_ci          least one attachment of any type"?  Or is the framebuffer
65775bd8deadSopenharmony_ci          still complete when there are no attachments at all?
65785bd8deadSopenharmony_ci
65795bd8deadSopenharmony_ci            RESOLUTION: resolved, a framebuffer must have at least one
65805bd8deadSopenharmony_ci            color-renderable, depth-renderable, or stencil-renderable
65815bd8deadSopenharmony_ci            image attached to be complete.
65825bd8deadSopenharmony_ci
65835bd8deadSopenharmony_ci            While a framebuffer with only depth, or only color
65845bd8deadSopenharmony_ci            attachments seems plausible, we couldn't come up with a
65855bd8deadSopenharmony_ci            sensible use for a framebuffer with no attachments at all,
65865bd8deadSopenharmony_ci            so the assumption is that this is an unintended error on the
65875bd8deadSopenharmony_ci            part of the application.  Therefore, we choose to make it
65885bd8deadSopenharmony_ci            part of the framebuffer completeness test.
65895bd8deadSopenharmony_ci
65905bd8deadSopenharmony_ci            We could make this its own clause in the framebuffer
65915bd8deadSopenharmony_ci            completeness test.  If we choose to do so, we should
65925bd8deadSopenharmony_ci            probably come up with a new FRAMEBUFFER_INCOMPLETE_* to
65935bd8deadSopenharmony_ci            conform to our previous practice of keeping one enum per
65945bd8deadSopenharmony_ci            clause.
65955bd8deadSopenharmony_ci
65965bd8deadSopenharmony_ci            However, since this is really related to the attachment
65975bd8deadSopenharmony_ci            state, we could just piggy back this on the first clause and
65985bd8deadSopenharmony_ci            same all the attachment points must be "attachment complete"
65995bd8deadSopenharmony_ci            and there must be at least one color, depth, or stencil
66005bd8deadSopenharmony_ci            buffer attached.
66015bd8deadSopenharmony_ci
66025bd8deadSopenharmony_ci            If we choose this latter option, we can continue to use the
66035bd8deadSopenharmony_ci            FRAMEBUFFER_INCOMPLETE_ATTACHMENT enum to cover this case.
66045bd8deadSopenharmony_ci
66055bd8deadSopenharmony_ci    (73) This clause from framebuffer completeness (before it was
66065bd8deadSopenharmony_ci         reworded, see below):
66075bd8deadSopenharmony_ci
66085bd8deadSopenharmony_ci           * The value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT must
66095bd8deadSopenharmony_ci             not be NONE for any color attachment point named by
66105bd8deadSopenharmony_ci             READ_BUFFER.
66115bd8deadSopenharmony_ci
66125bd8deadSopenharmony_ci         basically requires at least one color attachment is non-NULL.
66135bd8deadSopenharmony_ci         But this is not what we want.  So what should we do?
66145bd8deadSopenharmony_ci
66155bd8deadSopenharmony_ci            RESOLUTION: resolved, (4a) READ_BUFFER can be NONE
66165bd8deadSopenharmony_ci
66175bd8deadSopenharmony_ci         The reason is: READ_BUFFER is not allowed to be NONE, which in
66185bd8deadSopenharmony_ci         turn means to be framebuffer complete, READ_BUFFER must be
66195bd8deadSopenharmony_ci         COLOR_ATTACHMENTn_EXT for some n which has an image attached.
66205bd8deadSopenharmony_ci         However, we don't wish to preclude a no-color framebuffer.
66215bd8deadSopenharmony_ci         What should we do?
66225bd8deadSopenharmony_ci
66235bd8deadSopenharmony_ci            Options include:
66245bd8deadSopenharmony_ci
66255bd8deadSopenharmony_ci                4a) Allow READ_BUFFER of NONE, reads of color from the
66265bd8deadSopenharmony_ci                    framebuffer when read buffer is none, generate error
66275bd8deadSopenharmony_ci                    INVALID_OPERATION
66285bd8deadSopenharmony_ci
66295bd8deadSopenharmony_ci                4b) Generate an error when a read operation (ReadPixels,
66305bd8deadSopenharmony_ci                    CopyPixels, etc) is attempted while the color
66315bd8deadSopenharmony_ci                    attachment point referenced by the READ_BUFFER does
66325bd8deadSopenharmony_ci                    not have an attached image.
66335bd8deadSopenharmony_ci
66345bd8deadSopenharmony_ci                4c) Reverse earlier decision to allow complete
66355bd8deadSopenharmony_ci                    framebuffer not to have any color attachments.
66365bd8deadSopenharmony_ci                    Instead, require at least one color attachment.
66375bd8deadSopenharmony_ci                    READ_BUFFER must point to a valid color attachment
66385bd8deadSopenharmony_ci                    or else the framebuffer object is incomplete.
66395bd8deadSopenharmony_ci
66405bd8deadSopenharmony_ci        (4c) seems to require the user attach a color buffer just to be
66415bd8deadSopenharmony_ci        able to read the depth buffer of a depth-only framebuffer.
66425bd8deadSopenharmony_ci
66435bd8deadSopenharmony_ci        (4b) seems to suffer from the same problem (unless we move the
66445bd8deadSopenharmony_ci        "valid read buffer" test out of the completeness test).
66455bd8deadSopenharmony_ci
66465bd8deadSopenharmony_ci        Of these choices, (4a) seems to be the most palatable.  We
66475bd8deadSopenharmony_ci        choose the allow the value of READ_BUFFER to be NONE, but reads
66485bd8deadSopenharmony_ci        of color buffers when READ_BUFFER is NONE will generate an
66495bd8deadSopenharmony_ci        error, in order to be consistent with the decision in issues
66505bd8deadSopenharmony_ci        (26) and (65).
66515bd8deadSopenharmony_ci
66525bd8deadSopenharmony_ci        Note: that clause was eventually reworded to say:
66535bd8deadSopenharmony_ci
66545bd8deadSopenharmony_ci           * If READ_BUFFER is not NONE, then the value of
66555bd8deadSopenharmony_ci             FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT must not be NONE for
66565bd8deadSopenharmony_ci             the color attachment point named by READ_BUFFER.
66575bd8deadSopenharmony_ci
66585bd8deadSopenharmony_ci    (74) What should CheckFramebufferStatusEXT return if
66595bd8deadSopenharmony_ci         FRAMEBUFFER_BINDING_EXT is zero?
66605bd8deadSopenharmony_ci
66615bd8deadSopenharmony_ci         Secondary question: what should CheckFramebufferStatusEXT
66625bd8deadSopenharmony_ci         return if there is an error?
66635bd8deadSopenharmony_ci
66645bd8deadSopenharmony_ci             RESOLUTION: resolved, default fb returns COMPLETE always,
66655bd8deadSopenharmony_ci             and CheckFramebufferStatusEXT returns
66665bd8deadSopenharmony_ci             FRAMEBUFFER_STATUS_ERROR if there is an error (bad target)
66675bd8deadSopenharmony_ci
66685bd8deadSopenharmony_ci            This goes to a larger question of whether all framebuffers
66695bd8deadSopenharmony_ci            including the default window-system-provided framebuffer
66705bd8deadSopenharmony_ci            have a "completeness" state, or if "completeness" is only a
66715bd8deadSopenharmony_ci            property which applies to application-created framebuffers.
66725bd8deadSopenharmony_ci
66735bd8deadSopenharmony_ci            For the case where the current FRAMEBUFFER_BINDING_EXT is
66745bd8deadSopenharmony_ci            zero, options include:
66755bd8deadSopenharmony_ci
66765bd8deadSopenharmony_ci                - CheckFramebufferStatusEXT returns an error when
66775bd8deadSopenharmony_ci                  FRAMEBUFFER_BINDING_EXT is zero.
66785bd8deadSopenharmony_ci
66795bd8deadSopenharmony_ci                - CheckFramebufferStatusEXT always returns
66805bd8deadSopenharmony_ci                  FRAMEBUFFER_COMPLETE_EXT when FRAMEBUFFER_BINDING_EXT
66815bd8deadSopenharmony_ci                  is zero.
66825bd8deadSopenharmony_ci
66835bd8deadSopenharmony_ci            For the case CheckFramebufferStatusEXT generates an error,
66845bd8deadSopenharmony_ci            options include:
66855bd8deadSopenharmony_ci
66865bd8deadSopenharmony_ci                - reworking CheckFramebufferStatus into a "get" style
66875bd8deadSopenharmony_ci                  routine that returns a value (or not) in an input
66885bd8deadSopenharmony_ci                  parameter like GetIntegerv
66895bd8deadSopenharmony_ci
66905bd8deadSopenharmony_ci                - returning a known value like NONE or 0
66915bd8deadSopenharmony_ci
66925bd8deadSopenharmony_ci                - returning undefined results
66935bd8deadSopenharmony_ci
66945bd8deadSopenharmony_ci    (75) How are state values for the stencil index write mask and
66955bd8deadSopenharmony_ci         stencil reference value affected by this extension?
66965bd8deadSopenharmony_ci
66975bd8deadSopenharmony_ci            RESOLUTION:
66985bd8deadSopenharmony_ci                a) index write mask is stored as 32 bit value, default
66995bd8deadSopenharmony_ci                   is all 1's, and
67005bd8deadSopenharmony_ci                b) reference value is not clamped on specification but
67015bd8deadSopenharmony_ci                   rather is clamped on use and query, and
67025bd8deadSopenharmony_ci                c) we need to add the stencil reference value
67035bd8deadSopenharmony_ci                   to the state table that lists the state values that
67045bd8deadSopenharmony_ci                   might change after a framebuffer state change
67055bd8deadSopenharmony_ci
67065bd8deadSopenharmony_ci            The reason this is an issue is that the current GL
67075bd8deadSopenharmony_ci            specification indicates that the stencil index write mask
67085bd8deadSopenharmony_ci            and the stencil reference value are masked/clamped according
67095bd8deadSopenharmony_ci            to the number of stencil bitplanes.  However, in this
67105bd8deadSopenharmony_ci            extension the number of stencil bitplanes can now change
67115bd8deadSopenharmony_ci            dynamically as the image attached to the framebuffer is
67125bd8deadSopenharmony_ci            changed.
67135bd8deadSopenharmony_ci
67145bd8deadSopenharmony_ci            For instance, if these values are clamped/masked according
67155bd8deadSopenharmony_ci            to the bitdepth of the currently attached stencil buffer,
67165bd8deadSopenharmony_ci            what should happen if the user later attaches a stencil
67175bd8deadSopenharmony_ci            buffer of a different bit depth?  Must the stencil reference
67185bd8deadSopenharmony_ci            value or index write mask be respecified?
67195bd8deadSopenharmony_ci
67205bd8deadSopenharmony_ci            For the index write mask: we decide to treat this value as
67215bd8deadSopenharmony_ci            "all 1's" as the current specification allows, but further
67225bd8deadSopenharmony_ci            define the number of 1's to be 32 (the minimum width of an
67235bd8deadSopenharmony_ci            integer in GL), and a likely maximum stencil bitdpeth for
67245bd8deadSopenharmony_ci            the forseeable future.  This should retain backward
67255bd8deadSopenharmony_ci            compatbility and still handle the case where the bitdepth of
67265bd8deadSopenharmony_ci            the stencil buffer can change dynamically.
67275bd8deadSopenharmony_ci
67285bd8deadSopenharmony_ci            For the stencil reference value, we decide to treat this
67295bd8deadSopenharmony_ci            state similar to way various clamped colors are treated in
67305bd8deadSopenharmony_ci            the ARB floating point pixel extensions.  Specifically, the
67315bd8deadSopenharmony_ci            state values are clamped against the current logical buffer
67325bd8deadSopenharmony_ci            bitdepths as they are used for rendering and queried, but
67335bd8deadSopenharmony_ci            are not clamped on specification.  This means that these
67345bd8deadSopenharmony_ci            state values do not need to be respecified just because the
67355bd8deadSopenharmony_ci            logical buffer bit depth changes, and retains backward
67365bd8deadSopenharmony_ci            compatibility to the behavior prior to this extension.
67375bd8deadSopenharmony_ci
67385bd8deadSopenharmony_ci            We will update the appropriate sections of the specification
67395bd8deadSopenharmony_ci            to describe this behavior.
67405bd8deadSopenharmony_ci
67415bd8deadSopenharmony_ci    (76) Currently framebuffer objects are shared, should we make them
67425bd8deadSopenharmony_ci         not shared across contexts?
67435bd8deadSopenharmony_ci
67445bd8deadSopenharmony_ci            RESOLUTION: yes, framebuffers are shared like display lists
67455bd8deadSopenharmony_ci            and textures are shared.
67465bd8deadSopenharmony_ci
67475bd8deadSopenharmony_ci            Initially it was suggested that some complicated
67485bd8deadSopenharmony_ci            multi-context semantics might be avoided if if the namespace
67495bd8deadSopenharmony_ci            for framebuffer objects were not shared across contexts.
67505bd8deadSopenharmony_ci            Specifically, some members of the group felt that by not
67515bd8deadSopenharmony_ci            sharing framebuffer objects, we could avoid the situation
67525bd8deadSopenharmony_ci            where:
67535bd8deadSopenharmony_ci
67545bd8deadSopenharmony_ci                a) one context can change the draw buffer of a
67555bd8deadSopenharmony_ci                   framebuffer object in use by another context.
67565bd8deadSopenharmony_ci
67575bd8deadSopenharmony_ci                b) one context can change the attachments of a
67585bd8deadSopenharmony_ci                   framebuffer object which may be in use by another
67595bd8deadSopenharmony_ci                   context.
67605bd8deadSopenharmony_ci
67615bd8deadSopenharmony_ci            However, after some discussion, we realized that even if we
67625bd8deadSopenharmony_ci            didn't share framebuffer objects, there were still
67635bd8deadSopenharmony_ci            interactions similar to those listed above because the
67645bd8deadSopenharmony_ci            underlying images could still be shared.  Consequently, one
67655bd8deadSopenharmony_ci            context could still affect the completeness and attachments
67665bd8deadSopenharmony_ci            of the framebuffers in another context by modifying or
67675bd8deadSopenharmony_ci            deleting the framebuffer-attachable images shared by both
67685bd8deadSopenharmony_ci            contexts.
67695bd8deadSopenharmony_ci
67705bd8deadSopenharmony_ci            So in the end, we decided to retain the share-ability of
67715bd8deadSopenharmony_ci            framebuffer objects rather than introduce an asymmetry with
67725bd8deadSopenharmony_ci            other GL objects like textures.
67735bd8deadSopenharmony_ci
67745bd8deadSopenharmony_ci            ADDITIONAL COMMENTS:
67755bd8deadSopenharmony_ci
67765bd8deadSopenharmony_ci            See the "Dependencies on ARB_framebuffer_object and OpenGL 3.0"
67775bd8deadSopenharmony_ci            section above for the interaction behaviour between EXT and
67785bd8deadSopenharmony_ci            non-EXT FBO interfaces.
67795bd8deadSopenharmony_ci
67805bd8deadSopenharmony_ci    (77) If the application deletes an object and that object contains
67815bd8deadSopenharmony_ci         an image which is attached to a framebuffer object, exactly
67825bd8deadSopenharmony_ci         when and how is the image detached from the framebuffer?
67835bd8deadSopenharmony_ci
67845bd8deadSopenharmony_ci            RESOLUTION: resolved, option (1): images are detached from
67855bd8deadSopenharmony_ci            the currently bound framebuffer on delete, but images remain
67865bd8deadSopenharmony_ci            attached to any non-bound framebuffers.
67875bd8deadSopenharmony_ci
67885bd8deadSopenharmony_ci            This is issue is somewhat related to the multi-context
67895bd8deadSopenharmony_ci            object-sharing discussion currently going on in the ARB.
67905bd8deadSopenharmony_ci
67915bd8deadSopenharmony_ci            This extension presupposes that framebuffer attachments
67925bd8deadSopenharmony_ci            represent a reference to the attached image (or more
67935bd8deadSopenharmony_ci            correctly - a reference to the object containing the
67945bd8deadSopenharmony_ci            attached image).  Since having a reference to an object
67955bd8deadSopenharmony_ci            affects when the object (and/or its name) is deleted, object
67965bd8deadSopenharmony_ci            deletion semantics are tied into the notion when the state
67975bd8deadSopenharmony_ci            describing these references is modified.  In other words,
67985bd8deadSopenharmony_ci            the semantics of when objects are deleted are affected by
67995bd8deadSopenharmony_ci            the details concerning when a change to the framebuffer
68005bd8deadSopenharmony_ci            attachment state takes place.
68015bd8deadSopenharmony_ci
68025bd8deadSopenharmony_ci            Prior to the EXT_framebuffer_object and GLSL extensions, the
68035bd8deadSopenharmony_ci            only way in which an object not currently bound to this GL
68045bd8deadSopenharmony_ci            context could be modified, was when the object was modified
68055bd8deadSopenharmony_ci            by another GL context.
68065bd8deadSopenharmony_ci
68075bd8deadSopenharmony_ci            Both the EXT_framebuffer_object and GLSL extensions allow an
68085bd8deadSopenharmony_ci            object (texture, renderbuffer, shader) to be attached to a
68095bd8deadSopenharmony_ci            "container" object (framebuffer, program).  With the
68105bd8deadSopenharmony_ci            introduction of "attachment", an object could be bound to
68115bd8deadSopenharmony_ci            the context at more than one binding point.  For example, a
68125bd8deadSopenharmony_ci            texture can be bound to TEXTURE_2D_BINDING, and it can also
68135bd8deadSopenharmony_ci            be indirectly bound through the FRAMEBUFFER_BINDING if it is
68145bd8deadSopenharmony_ci            attached to the framebuffer object bound to the
68155bd8deadSopenharmony_ci            FRAMEBUFFER_BINDING.
68165bd8deadSopenharmony_ci
68175bd8deadSopenharmony_ci            Furthermore, a texture can be attached (by reference) to a
68185bd8deadSopenharmony_ci            framebuffer object that is not bound to any context, while
68195bd8deadSopenharmony_ci            at the same time the texture *is* bound to context's
68205bd8deadSopenharmony_ci            TEXTURE_2D_BINDING.  Because the texture state is a part of
68215bd8deadSopenharmony_ci            the framebuffer object's state, it is now possible for
68225bd8deadSopenharmony_ci            modification of a texture through TEXTURE_2D_BINDING to
68235bd8deadSopenharmony_ci            cause modification of a framebuffer object, even though the
68245bd8deadSopenharmony_ci            framebuffer object is not bound to any context at the time
68255bd8deadSopenharmony_ci            it is modified.
68265bd8deadSopenharmony_ci
68275bd8deadSopenharmony_ci            One conceptual model for dealing with this situation is to
68285bd8deadSopenharmony_ci            treat attachment similar to bind, but instead of binding to
68295bd8deadSopenharmony_ci            a context, you are "binding" to another object.  For the
68305bd8deadSopenharmony_ci            purposes of managing object references, object lifetimes,
68315bd8deadSopenharmony_ci            state propogation semantics, etc., these attachments can be
68325bd8deadSopenharmony_ci            considered to be "just like" a bind operation.  [A "bind"
68335bd8deadSopenharmony_ci            and an "attach" are not exactly equivalent, however; see
68345bd8deadSopenharmony_ci            issue (82) for a further discussion on Bind vs. Attach.]
68355bd8deadSopenharmony_ci
68365bd8deadSopenharmony_ci            If we agree on the above conceptual model, then we may wish
68375bd8deadSopenharmony_ci            to look to the multi-context situation for guidance on how
68385bd8deadSopenharmony_ci            to treat state changes to non-currently-bound framebuffer
68395bd8deadSopenharmony_ci            objects.
68405bd8deadSopenharmony_ci
68415bd8deadSopenharmony_ci            Unfortunately, the multi-context semantics are poorly
68425bd8deadSopenharmony_ci            defined by OpenGL.  If we decide to use them as a guide, we
68435bd8deadSopenharmony_ci            should at least define what they are and this is why the
68445bd8deadSopenharmony_ci            larger ARB is looking at this issue now.
68455bd8deadSopenharmony_ci
68465bd8deadSopenharmony_ci            For EXT_framebuffer_object, there are three choices for
68475bd8deadSopenharmony_ci            behavior.  In each case, we defer to the larger ARB the
68485bd8deadSopenharmony_ci            details about when an object name is available for reuse.
68495bd8deadSopenharmony_ci            For the purposes of this discussion, we are looking only at
68505bd8deadSopenharmony_ci            state changes governing the attachments.  The three choices
68515bd8deadSopenharmony_ci            are listed below:
68525bd8deadSopenharmony_ci
68535bd8deadSopenharmony_ci              For the sake of concrete simplicity, this discussion
68545bd8deadSopenharmony_ci              speaks to the images of a texture object; but it applies
68555bd8deadSopenharmony_ci              equally to the image of a renderbuffer object.
68565bd8deadSopenharmony_ci
68575bd8deadSopenharmony_ci              If you delete a texture object while one of the texture's
68585bd8deadSopenharmony_ci              images is attached to a framebuffer object (or multiple
68595bd8deadSopenharmony_ci              framebuffer objects), then:
68605bd8deadSopenharmony_ci
68615bd8deadSopenharmony_ci              (1) The image is automatically detached from the currently
68625bd8deadSopenharmony_ci                  bound framebuffer object only.
68635bd8deadSopenharmony_ci
68645bd8deadSopenharmony_ci                  If the image is also attached to any other framebuffer
68655bd8deadSopenharmony_ci                  objects, then the image is NOT automatically detached
68665bd8deadSopenharmony_ci                  from those.
68675bd8deadSopenharmony_ci
68685bd8deadSopenharmony_ci                  The application is responsible for manually detaching
68695bd8deadSopenharmony_ci                  images from the other framebuffer objects, by
68705bd8deadSopenharmony_ci                  rebinding each framebuffer in turn and performing an
68715bd8deadSopenharmony_ci                  explicit detach operation.
68725bd8deadSopenharmony_ci
68735bd8deadSopenharmony_ci                  Until the application manually detaches the image from
68745bd8deadSopenharmony_ci                  the other framebuffers, those framebuffers continue to
68755bd8deadSopenharmony_ci                  use the image for rendering.  The other framebuffer
68765bd8deadSopenharmony_ci                  objects have a reference to the image until the image
68775bd8deadSopenharmony_ci                  has been detached from them.  In this way, attachment
68785bd8deadSopenharmony_ci                  behaves as if the image was "bound to the framebuffer
68795bd8deadSopenharmony_ci                  object".
68805bd8deadSopenharmony_ci
68815bd8deadSopenharmony_ci              (2) The image is automatically detached from the currently
68825bd8deadSopenharmony_ci                  bound framebuffer object.  Also during DeleteTexture,
68835bd8deadSopenharmony_ci                  the image is automatically detached from any other
68845bd8deadSopenharmony_ci                  framebuffer object to which it is attached; however,
68855bd8deadSopenharmony_ci                  the image is not guaranteed to be detached from the
68865bd8deadSopenharmony_ci                  other framebuffer objects until the next time those
68875bd8deadSopenharmony_ci                  framebuffer objects are bound via BindFramebufferEXT.
68885bd8deadSopenharmony_ci
68895bd8deadSopenharmony_ci                  Similar to option (1), in order to "really" delete the
68905bd8deadSopenharmony_ci                  object, the application is responsible for rebinding
68915bd8deadSopenharmony_ci                  all the framebuffer objects to which the deleted image
68925bd8deadSopenharmony_ci                  was attached.  However, unlike option (1), the
68935bd8deadSopenharmony_ci                  application need not actually perform an explicit
68945bd8deadSopenharmony_ci                  detach operation.  The application can merely bind the
68955bd8deadSopenharmony_ci                  framebuffer.
68965bd8deadSopenharmony_ci
68975bd8deadSopenharmony_ci                  Until the application actually rebinds the framebuffer
68985bd8deadSopenharmony_ci                  the images are not actually detached and deleted.  The
68995bd8deadSopenharmony_ci                  other framebuffer objects continue to hold a reference
69005bd8deadSopenharmony_ci                  (like a binding) to the image until the next time the
69015bd8deadSopenharmony_ci                  framebuffer objects are bound.
69025bd8deadSopenharmony_ci
69035bd8deadSopenharmony_ci              (3) The image is automatically detached from all
69045bd8deadSopenharmony_ci                  framebuffers objects during DeleteTextures, including
69055bd8deadSopenharmony_ci                  the currently bound framebuffer as well as any other
69065bd8deadSopenharmony_ci                  framebuffers to which the image is attached.
69075bd8deadSopenharmony_ci
69085bd8deadSopenharmony_ci                  The application need not explicitly bind to, and
69095bd8deadSopenharmony_ci                  detach the image from, any framebuffer that is not
69105bd8deadSopenharmony_ci                  bound at the time DeleteTextures was called.
69115bd8deadSopenharmony_ci
69125bd8deadSopenharmony_ci                  Because the framebuffer object has a reference to the
69135bd8deadSopenharmony_ci                  texture object, and the texture object's state is
69145bd8deadSopenharmony_ci                  considered part of the framebuffer object's state,
69155bd8deadSopenharmony_ci                  this resolution implies that DeleteTextures may
69165bd8deadSopenharmony_ci                  modifiy the state of a framebuffer object that is not
69175bd8deadSopenharmony_ci                  the currently bound object.
69185bd8deadSopenharmony_ci
69195bd8deadSopenharmony_ci            With reference to the object-sharing discussion that is
69205bd8deadSopenharmony_ci            going on in the ARB right now, for (a)-style
69215bd8deadSopenharmony_ci            implementations, options (2) and (3) are indistinguishable.
69225bd8deadSopenharmony_ci            However, for (b)-style implementations, implementing (3)
69235bd8deadSopenharmony_ci            would require textures to store a list of all attached
69245bd8deadSopenharmony_ci            framebuffers while (2) would not.
69255bd8deadSopenharmony_ci
69265bd8deadSopenharmony_ci            Options (2) and (3) essentially treat the currently-bound
69275bd8deadSopenharmony_ci            and non-currently-bound framebuffers the same--i.e.,
69285bd8deadSopenharmony_ci            deleting the image (ultimately) detaches it from all
69295bd8deadSopenharmony_ci            framebuffer.  This may be desirable as a convenience to the
69305bd8deadSopenharmony_ci            application.
69315bd8deadSopenharmony_ci
69325bd8deadSopenharmony_ci            On the other hand, Option (1) treats the currently bound
69335bd8deadSopenharmony_ci            framebuffer special, in that deletions are performed
69345bd8deadSopenharmony_ci            automatically much like textures are unbound automatically
69355bd8deadSopenharmony_ci            from the current context's binding points, but they are not
69365bd8deadSopenharmony_ci            unbound automatically from other contexts' binding points.
69375bd8deadSopenharmony_ci            Also, Option (1) leaves the application in control of when
69385bd8deadSopenharmony_ci            the images are detached, which also may be desirable.
69395bd8deadSopenharmony_ci
69405bd8deadSopenharmony_ci            We choose option (1) because it is the simplest, and it also
69415bd8deadSopenharmony_ci            does not unduly burden implementations regardless of their
69425bd8deadSopenharmony_ci            choice of (a) versus (b) object-sharing model.
69435bd8deadSopenharmony_ci
69445bd8deadSopenharmony_ci            If an implementation has the (a)-style object sharing model,
69455bd8deadSopenharmony_ci            then the fact that images remain attached to non-bound
69465bd8deadSopenharmony_ci            objects has no affect on when the object name may be
69475bd8deadSopenharmony_ci            re-used.  If the implementation has a (b)-style
69485bd8deadSopenharmony_ci            object-sharing model, then the outstanding attachments will
69495bd8deadSopenharmony_ci            delay re-use of the object name until the image has been
69505bd8deadSopenharmony_ci            detached.  Regardless of whether the ARB chooses (a) or (b)
69515bd8deadSopenharmony_ci            behavior, or even if the ARB chooses to leave this behavior
69525bd8deadSopenharmony_ci            undefined, we can "piggy-back" on the name-reuse semantics
69535bd8deadSopenharmony_ci            they decide.
69545bd8deadSopenharmony_ci
69555bd8deadSopenharmony_ci            Also, option (1) means that if the application deletes a
69565bd8deadSopenharmony_ci            texture while one of the texture's images is attached to a
69575bd8deadSopenharmony_ci            framebuffer object that is not bound, then the application
69585bd8deadSopenharmony_ci            may continue to render into the image after the framebuffer
69595bd8deadSopenharmony_ci            is bound again, regardless of the (a) vs. (b) choice.
69605bd8deadSopenharmony_ci
69615bd8deadSopenharmony_ci            Finally, note that if a context deletes an object containing
69625bd8deadSopenharmony_ci            an image attached to the currently bound framebuffer, then
69635bd8deadSopenharmony_ci            we first detach the image from the bound framebuffer.  This
69645bd8deadSopenharmony_ci            means that the state change to the framebuffer (the detach
69655bd8deadSopenharmony_ci            operation) is guaranteed to be picked up by any other
69665bd8deadSopenharmony_ci            context the next time the framebuffer is bound in one of the
69675bd8deadSopenharmony_ci            other contexts.
69685bd8deadSopenharmony_ci
69695bd8deadSopenharmony_ci    (78) Should we collapse the notions of "framebuffer-attachable image
69705bd8deadSopenharmony_ci         completeness" and "framebuffer attachment completeness" into a
69715bd8deadSopenharmony_ci         single type of completeness (probably retaining the name
69725bd8deadSopenharmony_ci         "framebuffer attachment completeness"
69735bd8deadSopenharmony_ci
69745bd8deadSopenharmony_ci            RESOLUTION: resolved, yes, eliminate "framebuffer-attachable
69755bd8deadSopenharmony_ci            image completeness" and add a "non-zero-area" requirement to
69765bd8deadSopenharmony_ci            the "framebuffer attachement completeness" test.
69775bd8deadSopenharmony_ci
69785bd8deadSopenharmony_ci            Originally this extension had several layers of which
69795bd8deadSopenharmony_ci            affected framebuffer completness.  They were:
69805bd8deadSopenharmony_ci
69815bd8deadSopenharmony_ci                - framebuffer-attachable image completeness
69825bd8deadSopenharmony_ci                    * image has non-zero width/height/depth
69835bd8deadSopenharmony_ci                    * image has color, depth, or stencil format
69845bd8deadSopenharmony_ci                    * image is not from a proxy texture
69855bd8deadSopenharmony_ci
69865bd8deadSopenharmony_ci                - framebuffer attachment completeness
69875bd8deadSopenharmony_ci                    * attached image is textures/renderbuffer
69885bd8deadSopenharmony_ci                    * attached image is from existing object
69895bd8deadSopenharmony_ci                    * attached image has format appropriate
69905bd8deadSopenharmony_ci                      for attachment point (depth buffer
69915bd8deadSopenharmony_ci                      has depth format, etc)
69925bd8deadSopenharmony_ci
69935bd8deadSopenharmony_ci                - framebuffer completeness
69945bd8deadSopenharmony_ci                    * all attachment points are "attachment complete"
69955bd8deadSopenharmony_ci                    * all images are "framebuffer-attachable image complete"
69965bd8deadSopenharmony_ci                    * all color buffers have same format
69975bd8deadSopenharmony_ci                    * draw buffer is attached
69985bd8deadSopenharmony_ci                    * read buffer is attached
69995bd8deadSopenharmony_ci                    * framebuffer format combination is supported
70005bd8deadSopenharmony_ci
70015bd8deadSopenharmony_ci            However, upon further reflection of the
70025bd8deadSopenharmony_ci            "framebuffer-attachable image completeness" tests, we
70035bd8deadSopenharmony_ci            realized that
70045bd8deadSopenharmony_ci
70055bd8deadSopenharmony_ci                a) the requirement that the renderble image is not a
70065bd8deadSopenharmony_ci                   "proxy" texture was already covered by the fact that
70075bd8deadSopenharmony_ci                   it's illegal to attach a proxy texture to a
70085bd8deadSopenharmony_ci                   framebuffer, and
70095bd8deadSopenharmony_ci
70105bd8deadSopenharmony_ci                b) the requirement that the format be color, depth, or
70115bd8deadSopenharmony_ci                   stencil is essentially already covered by the
70125bd8deadSopenharmony_ci                   "framebuffer attachment completeness" test
70135bd8deadSopenharmony_ci                   requirement that the format is appropriate for the
70145bd8deadSopenharmony_ci                   attachment point.
70155bd8deadSopenharmony_ci
70165bd8deadSopenharmony_ci            This left only the "non-zero-area" test, so we decided to
70175bd8deadSopenharmony_ci            fold this requirement into the "framebuffer attachement
70185bd8deadSopenharmony_ci            completeness" test and eliminate the concept of
70195bd8deadSopenharmony_ci            "framebuffer-attachable image completeness".  This decision
70205bd8deadSopenharmony_ci            required the elimination of one of the
70215bd8deadSopenharmony_ci            FRAMEBUFFER_INCOMPLETE_* enums as they correspond to the
70225bd8deadSopenharmony_ci            conditions in the "framebuffer completeness" test of section
70235bd8deadSopenharmony_ci            4.4.4
70245bd8deadSopenharmony_ci
70255bd8deadSopenharmony_ci    (79) Should the internal format chosen by GL for a texture (or
70265bd8deadSopenharmony_ci         renderbuffer) be invariant with respect to the state of the
70275bd8deadSopenharmony_ci         current framebuffer and its attached images?
70285bd8deadSopenharmony_ci
70295bd8deadSopenharmony_ci            RESOLUTION: yes, the choice of internal format must be
70305bd8deadSopenharmony_ci            invariant with respect to framebuffer state changes.
70315bd8deadSopenharmony_ci
70325bd8deadSopenharmony_ci            This means that the GL must choose texture internal format
70335bd8deadSopenharmony_ci            based only on the arguments to TexImage and ignore the
70345bd8deadSopenharmony_ci            current framebuffer state in this selection process.
70355bd8deadSopenharmony_ci
70365bd8deadSopenharmony_ci            Similarly, the GL must choose renderbuffer internal format
70375bd8deadSopenharmony_ci            based only on the arguments to RenderbufferStorage and
70385bd8deadSopenharmony_ci            ignore the current framebuffer state in this selection
70395bd8deadSopenharmony_ci            process.
70405bd8deadSopenharmony_ci
70415bd8deadSopenharmony_ci            This issue is a variant of issue (62).  The OpenGL 2.0
70425bd8deadSopenharmony_ci            specification (p.152, paragraph 4) states that:
70435bd8deadSopenharmony_ci
70445bd8deadSopenharmony_ci                 "A GL implementation may vary its allocation of
70455bd8deadSopenharmony_ci                 internal component resolution or compressed internal
70465bd8deadSopenharmony_ci                 format based on any TexImage3D, TexImage2D (see below),
70475bd8deadSopenharmony_ci                 or TexImage1D (see below) parameter (except target),
70485bd8deadSopenharmony_ci                 but the allocation and chosen compressed image format
70495bd8deadSopenharmony_ci                 must not be a function of any other state and cannot be
70505bd8deadSopenharmony_ci                 changed once they are established."
70515bd8deadSopenharmony_ci
70525bd8deadSopenharmony_ci            Consider that prior to this extension, some implementations
70535bd8deadSopenharmony_ci            may have considered the the bitdepths of the logical buffers
70545bd8deadSopenharmony_ci            of the framebuffer or the bitdepth of the display when
70555bd8deadSopenharmony_ci            choosing an internal format for textures.  Since, in
70565bd8deadSopenharmony_ci            practice, these bitdepths typically were immutable for the
70575bd8deadSopenharmony_ci            lifetime of a GL context, the invariance requirements were
70585bd8deadSopenharmony_ci            met.
70595bd8deadSopenharmony_ci
70605bd8deadSopenharmony_ci            With the introduction of EXT_framebuffer_object, however,
70615bd8deadSopenharmony_ci            the logical buffer bitdepths can change over the lifetime of
70625bd8deadSopenharmony_ci            the context.  So this issue examines whether or not
70635bd8deadSopenharmony_ci            framebuffer state is allowed to affect texture internal
70645bd8deadSopenharmony_ci            format selection.
70655bd8deadSopenharmony_ci
70665bd8deadSopenharmony_ci            After some discussion, we felt it was too problematic to
70675bd8deadSopenharmony_ci            introduce this type of invariance.  So this extension makes
70685bd8deadSopenharmony_ci            no modifications to the invariance language, and adds
70695bd8deadSopenharmony_ci            similar invariance language applicable to renderbuffer
70705bd8deadSopenharmony_ci            objects.  As long as the app provides the same arguments to
70715bd8deadSopenharmony_ci            TexImage{1D|2D|3D} or RenderbufferStorage, then the GL must
70725bd8deadSopenharmony_ci            always choose the same internal format.
70735bd8deadSopenharmony_ci
70745bd8deadSopenharmony_ci            Note, however, that the GL is not required to provide the
70755bd8deadSopenharmony_ci            same internal format resolution for renderbuffers as it does
70765bd8deadSopenharmony_ci            for textures.
70775bd8deadSopenharmony_ci
70785bd8deadSopenharmony_ci    (80) Should attachment routines be display-list'able?
70795bd8deadSopenharmony_ci
70805bd8deadSopenharmony_ci            RESOLUTION: no, in fact none of the routines introduced in
70815bd8deadSopenharmony_ci            this extension are included in display lists.
70825bd8deadSopenharmony_ci
70835bd8deadSopenharmony_ci            Initially, we were just considering whether or not the
70845bd8deadSopenharmony_ci            framebuffer attachement routines should be included in
70855bd8deadSopenharmony_ci            display lists.  The rationale for not including them was
70865bd8deadSopenharmony_ci            that since query routines can not be in display lists, and
70875bd8deadSopenharmony_ci            well-behaved apps should call the query routine
70885bd8deadSopenharmony_ci            CheckFramebufferStatusEXT() after calling making changes to
70895bd8deadSopenharmony_ci            framebuffer attachments, it was not possible to write a
70905bd8deadSopenharmony_ci            well-behaved app that uses display lists to build up and use
70915bd8deadSopenharmony_ci            a framebuffer.  So, one possible solution was to simply
70925bd8deadSopenharmony_ci            disallow from display lists the routines that change change
70935bd8deadSopenharmony_ci            the result of CheckFramebufferStatusEXT().
70945bd8deadSopenharmony_ci
70955bd8deadSopenharmony_ci            However, we realized on further consideration that other
70965bd8deadSopenharmony_ci            routines which can affect the results of
70975bd8deadSopenharmony_ci            CheckFramebufferStatusEXT are already allowed in display
70985bd8deadSopenharmony_ci            lists.  Namely, the routines which affect textures (TexImage
70995bd8deadSopenharmony_ci            and friends).  So, disallowing the attachment routines is a
71005bd8deadSopenharmony_ci            partial solution at best.
71015bd8deadSopenharmony_ci
71025bd8deadSopenharmony_ci            We also looked for various precedents and found some mixed
71035bd8deadSopenharmony_ci            results:
71045bd8deadSopenharmony_ci
71055bd8deadSopenharmony_ci                - VBO bind operations are not display-list'able, but
71065bd8deadSopenharmony_ci                  this is primarily because the VBO bindings are
71075bd8deadSopenharmony_ci                  considered client-state
71085bd8deadSopenharmony_ci
71095bd8deadSopenharmony_ci                - texture bindings are display-list'able
71105bd8deadSopenharmony_ci
71115bd8deadSopenharmony_ci            In the end, though we decided to not include the routines
71125bd8deadSopenharmony_ci            introduced by this extension in display lists for reasons of
71135bd8deadSopenharmony_ci            simplicity more than anything else.
71145bd8deadSopenharmony_ci
71155bd8deadSopenharmony_ci            It's possible we may need to add support for display lists
71165bd8deadSopenharmony_ci            back in during promotion of this extension if we determine
71175bd8deadSopenharmony_ci            that it is needed later, but for now, we leave this out.
71185bd8deadSopenharmony_ci
71195bd8deadSopenharmony_ci    (81) How should PushAttrib and PopAttrib work with this extension?
71205bd8deadSopenharmony_ci
71215bd8deadSopenharmony_ci            RESOLUTION: mostly deferred for now, may revisit later
71225bd8deadSopenharmony_ci
71235bd8deadSopenharmony_ci            This extension introduces no new push/pop attrib bits to
71245bd8deadSopenharmony_ci            cover the state introduced by this extension (for instance
71255bd8deadSopenharmony_ci            there is no FRAMEBUFFER_BIT).  So the only real question to
71265bd8deadSopenharmony_ci            answer is what effect should Push/Pop attrib have on any
71275bd8deadSopenharmony_ci            existing state as it relates to this extension.
71285bd8deadSopenharmony_ci
71295bd8deadSopenharmony_ci            In particular, how should Push/PopAttrib of the
71305bd8deadSopenharmony_ci            COLOR_BUFFER_BIT which covers the DRAW_BUFFER and
71315bd8deadSopenharmony_ci            READ_BUFFER state interact with this extension?  Does the
71325bd8deadSopenharmony_ci            COLOR_BUFFER_BIT affect the per-object DRAW_BUFFER and
71335bd8deadSopenharmony_ci            READ_BUFFER state?
71345bd8deadSopenharmony_ci
71355bd8deadSopenharmony_ci            Currently, the answer is yes.  PushAttrib(COLOR_BUFFER_BIT)
71365bd8deadSopenharmony_ci            saves the DRAW_BUFFER value of the currently bound
71375bd8deadSopenharmony_ci            framebuffer object.  If the app later calls PopAttrib() this
71385bd8deadSopenharmony_ci            saved value will be restored even if the framebuffer bound
71395bd8deadSopenharmony_ci            at the time PopAttrib is called is different from the
71405bd8deadSopenharmony_ci            framebuffer bound at the time PushAttrib was called.
71415bd8deadSopenharmony_ci
71425bd8deadSopenharmony_ci            In other words, one are considering whether or not it is
71435bd8deadSopenharmony_ci            strange that PushAttrib(COLOR_BUFFER_BIT) affects a piece of
71445bd8deadSopenharmony_ci            per-object state.  Note that this is somewhat similar to the
71455bd8deadSopenharmony_ci            way that a PushAttrib(TEXTURE_BIT) can save off
71465bd8deadSopenharmony_ci            per-texture-object state and a later call to PopAttrib can
71475bd8deadSopenharmony_ci            restore that per-object state even if the texture bound at
71485bd8deadSopenharmony_ci            PopAttrib time has since been changed/ deleted/modified in
71495bd8deadSopenharmony_ci            some way.
71505bd8deadSopenharmony_ci
71515bd8deadSopenharmony_ci            There are some differences with the texture analogy though.
71525bd8deadSopenharmony_ci            Namely, the TEXTURE_BIT does include the texture bindings so
71535bd8deadSopenharmony_ci            at least the texture object binding is restored in
71545bd8deadSopenharmony_ci            conjunction with the per-texture-object state.  Also, some
71555bd8deadSopenharmony_ci            may consider the fact that the TEXTURE_BIT affects
71565bd8deadSopenharmony_ci            per-texture-object state more intuitive than the fact that
71575bd8deadSopenharmony_ci            the COLOR_BUFFER_BIT affects per-framebuffer-object state.
71585bd8deadSopenharmony_ci
71595bd8deadSopenharmony_ci            Also, there is a larger discussion going on in the ARB right
71605bd8deadSopenharmony_ci            now about whether PushAttrib/PopAttrib save references to
71615bd8deadSopenharmony_ci            existing bound objects or only the state values which name
71625bd8deadSopenharmony_ci            an existing bound object.
71635bd8deadSopenharmony_ci
71645bd8deadSopenharmony_ci            For now, we have deferred further discussion of the
71655bd8deadSopenharmony_ci            PushAttrib/PopAttrib semantics in this extension until the
71665bd8deadSopenharmony_ci            larger issues are cleared up.
71675bd8deadSopenharmony_ci
71685bd8deadSopenharmony_ci    (82) What is the relationship between a "binding" and an
71695bd8deadSopenharmony_ci         "attachment"?
71705bd8deadSopenharmony_ci
71715bd8deadSopenharmony_ci            RESOLUTION: resolved, the concept of attachment is described
71725bd8deadSopenharmony_ci            below, though final implications will be affected by larger
71735bd8deadSopenharmony_ci            ARB discussions about object sharing and multiple context
71745bd8deadSopenharmony_ci            semantics.
71755bd8deadSopenharmony_ci
71765bd8deadSopenharmony_ci                "Attaching" is the act of connecting one object to
71775bd8deadSopenharmony_ci                another object.
71785bd8deadSopenharmony_ci
71795bd8deadSopenharmony_ci                An "attach" operation is similar to a "bind" operation
71805bd8deadSopenharmony_ci                in that both represent a reference to the attached or
71815bd8deadSopenharmony_ci                bound object for the purpose of managing object
71825bd8deadSopenharmony_ci                lifetimes and both enable manipulation of the state of
71835bd8deadSopenharmony_ci                the attached or bound object.
71845bd8deadSopenharmony_ci
71855bd8deadSopenharmony_ci                However, an "attach" is also different from a "bind" in
71865bd8deadSopenharmony_ci                that "binding" an unused object creates a new object,
71875bd8deadSopenharmony_ci                while "attaching" does not.  Additionally, "bind"
71885bd8deadSopenharmony_ci                establishes a connection between a context and an
71895bd8deadSopenharmony_ci                object, while "attach" establishes a connection between
71905bd8deadSopenharmony_ci                two objects.
71915bd8deadSopenharmony_ci
71925bd8deadSopenharmony_ci                Finally, if object "A" is attached to object "B" and
71935bd8deadSopenharmony_ci                object "B" is bound to context "C", then in principle,
71945bd8deadSopenharmony_ci                we treat "A" as if it is <implicitly> bound to "C".
71955bd8deadSopenharmony_ci
71965bd8deadSopenharmony_ci                The larger ARB is currently attempting to more clearly
71975bd8deadSopenharmony_ci                define the mutliple context semantics as they relate to
71985bd8deadSopenharmony_ci                object sharing and binding.  The final implications for
71995bd8deadSopenharmony_ci                EXT_framebuffer_object may not be clear until those
72005bd8deadSopenharmony_ci                discussions are resolved.  This extension may need an
72015bd8deadSopenharmony_ci                update once those issues are addressed.
72025bd8deadSopenharmony_ci
72035bd8deadSopenharmony_ci    (83) We use a non-zero framebuffer binding to enable the use of this
72045bd8deadSopenharmony_ci         extension.  Should we instead consider using an explicit
72055bd8deadSopenharmony_ci         enable?
72065bd8deadSopenharmony_ci
72075bd8deadSopenharmony_ci            RESOLVED: no, retain the "non-zero-binding means enable"
72085bd8deadSopenharmony_ci            semantics.
72095bd8deadSopenharmony_ci
72105bd8deadSopenharmony_ci            Currently we enable the use of an application-created
72115bd8deadSopenharmony_ci            framebuffer by binding a non-zero framebuffer object to
72125bd8deadSopenharmony_ci            FRAMEBUFFER_EXT binding point.  If the framebuffer binding
72135bd8deadSopenharmony_ci            is zero, then the extension is disabled (i.e., we use the
72145bd8deadSopenharmony_ci            window-system-provided framebuffer).
72155bd8deadSopenharmony_ci
72165bd8deadSopenharmony_ci            It might be cleaner to be able to say things like, "when
72175bd8deadSopenharmony_ci            FRAMEBUFFER_OBJECT is enabled", rather than "when the
72185bd8deadSopenharmony_ci            framebuffer binding is not zero", and add an explicit
72195bd8deadSopenharmony_ci            enable.  Doing so would also allow changing framebuffer
72205bd8deadSopenharmony_ci            object attachments while FBO is disabled, which might result
72215bd8deadSopenharmony_ci            in the driver doing less validation while the application is
72225bd8deadSopenharmony_ci            setting up framebuffer objects.  It would also provide a
72235bd8deadSopenharmony_ci            cleaner way to explain that the permitted DRAW_BUFFER and
72245bd8deadSopenharmony_ci            READ_BUFFER values change when the extension is
72255bd8deadSopenharmony_ci            enabled/disabled.
72265bd8deadSopenharmony_ci
72275bd8deadSopenharmony_ci            There are a few object model precedents to choose from:
72285bd8deadSopenharmony_ci            Textures and ARB Vertex and Framgment Program extensions use
72295bd8deadSopenharmony_ci            the explicit enable state.  However, Vertex Buffer Objects,
72305bd8deadSopenharmony_ci            Pixel Buffer Objects, and GLSL Vertex and Fragment shaders
72315bd8deadSopenharmony_ci            use a non-zero-binding to enable the use of those features.
72325bd8deadSopenharmony_ci
72335bd8deadSopenharmony_ci            If we used an explicit enable, then we could allow creation
72345bd8deadSopenharmony_ci            of an object named zero.  Precedent dictates that an object
72355bd8deadSopenharmony_ci            named zero is never shared in the context share group.  All
72365bd8deadSopenharmony_ci            other framebuffer objects are shared across the share group.
72375bd8deadSopenharmony_ci            It might be cleaner to disallow creation of an object named
72385bd8deadSopenharmony_ci            zero anyway.
72395bd8deadSopenharmony_ci
72405bd8deadSopenharmony_ci            Since binding to zero disables the extension, one way to
72415bd8deadSopenharmony_ci            think about this is that there is an object named zero which
72425bd8deadSopenharmony_ci            is managed through MakeCurrent, MakeContextCurrent, and the
72435bd8deadSopenharmony_ci            window manager.  All other objects are managed through
72445bd8deadSopenharmony_ci            FramebufferTexture, FramebufferRenderbuffer, and the
72455bd8deadSopenharmony_ci            operations that define/modify texture and renderbuffer
72465bd8deadSopenharmony_ci            images.  When looked at in this light, lack of an explicit
72475bd8deadSopenharmony_ci            enable is not as strange.
72485bd8deadSopenharmony_ci
72495bd8deadSopenharmony_ci    (84) Do we need to add any language to describe the y-orientation of
72505bd8deadSopenharmony_ci         framebuffer-attachable images?  Specifically, what coordinate
72515bd8deadSopenharmony_ci         system is used by images attached to the framebuffer?
72525bd8deadSopenharmony_ci
72535bd8deadSopenharmony_ci            Resolution: unresolved
72545bd8deadSopenharmony_ci
72555bd8deadSopenharmony_ci            GL defines the rendering origin at the lower-left corner.
72565bd8deadSopenharmony_ci            Yet, because of the differences between orientation storage
72575bd8deadSopenharmony_ci            of textures and images, pbuffer rendering is often
72585bd8deadSopenharmony_ci            implemented using a "y-inverted" coordinate system.  Is this
72595bd8deadSopenharmony_ci            y-inversion exposed in the API?
72605bd8deadSopenharmony_ci
72615bd8deadSopenharmony_ci            Is the origin in the lower-left?  Upper-left?  Do we need to
72625bd8deadSopenharmony_ci            say anything about this at all, or is it already covered by
72635bd8deadSopenharmony_ci            existing GL language?
72645bd8deadSopenharmony_ci
72655bd8deadSopenharmony_ci            Currently there is place-holder text in section 4.4.2.3
72665bd8deadSopenharmony_ci
72675bd8deadSopenharmony_ci            The intent of this specification is simply to mirror the
72685bd8deadSopenharmony_ci            y-orientation issues of the pbuffer style render to texture
72695bd8deadSopenharmony_ci            API's.  What's unclear is whether this requires any new
72705bd8deadSopenharmony_ci            language in this specification or not.
72715bd8deadSopenharmony_ci
72725bd8deadSopenharmony_ci    (85) Explain what happens when the FBO has a different width/height
72735bd8deadSopenharmony_ci         from the window?
72745bd8deadSopenharmony_ci
72755bd8deadSopenharmony_ci            An FBO takes on the width/height of its attachments.  This
72765bd8deadSopenharmony_ci            width/height can be different than the width/height of the
72775bd8deadSopenharmony_ci            window (of framebuffer "zero").
72785bd8deadSopenharmony_ci
72795bd8deadSopenharmony_ci            In such cases, after calling BindFramebuffer, it is the
72805bd8deadSopenharmony_ci            application's responsibility to set the glViewport and the
72815bd8deadSopenharmony_ci            glScissor (if necessary) to match that of the new
72825bd8deadSopenharmony_ci            framebuffer binding.
72835bd8deadSopenharmony_ci
72845bd8deadSopenharmony_ci            Some background: The default viewport for a context is
72855bd8deadSopenharmony_ci            defined by the dimensions of the window to which the context
72865bd8deadSopenharmony_ci            is first made current.  When the window is resized, or when
72875bd8deadSopenharmony_ci            the context is bound to a different window, the viewport
72885bd8deadSopenharmony_ci            does not change automatically.  It has always been the
72895bd8deadSopenharmony_ci            application's responsibility to set the viewport after one
72905bd8deadSopenharmony_ci            of these events.  FBO is no different; after BindFramebuffer
72915bd8deadSopenharmony_ci            it is the application's responsibility to set the viewport
72925bd8deadSopenharmony_ci            if the new framebuffer binding has a different width/height
72935bd8deadSopenharmony_ci            than the old binding..
72945bd8deadSopenharmony_ci
72955bd8deadSopenharmony_ci    (86) Are any one- or two- component formats color-renderable?
72965bd8deadSopenharmony_ci
72975bd8deadSopenharmony_ci            Presently none of the one- or two- component texture formats
72985bd8deadSopenharmony_ci            defined in unextended OpenGL is color-renderable.  The R
72995bd8deadSopenharmony_ci            and RG float formats defined by the NV_float_buffer
73005bd8deadSopenharmony_ci            extension are color-renderable.
73015bd8deadSopenharmony_ci
73025bd8deadSopenharmony_ci            Although an early draft of the FBO specification permitted
73035bd8deadSopenharmony_ci            rendering into alpha, luminance, and intensity formats, this
73045bd8deadSopenharmony_ci            this capability was pulled when it was realized that it was
73055bd8deadSopenharmony_ci            under-specified exactly how rendering into these formats
73065bd8deadSopenharmony_ci            would work.  (specifically, how R/G/B/A map to I/L/A)
73075bd8deadSopenharmony_ci
73085bd8deadSopenharmony_ci            To resolve this we seem to have two options:
73095bd8deadSopenharmony_ci
73105bd8deadSopenharmony_ci            A) Add new R and RG formats like NV_float_buffer did.
73115bd8deadSopenharmony_ci
73125bd8deadSopenharmony_ci            B) For the existing one- and two- component formats, define
73135bd8deadSopenharmony_ci               the mapping from RGBA components to ILA components.
73145bd8deadSopenharmony_ci
73155bd8deadSopenharmony_ci            The superbuffers group has informally decided that option A
73165bd8deadSopenharmony_ci            is preferable.
73175bd8deadSopenharmony_ci
73185bd8deadSopenharmony_ci    (87) What happens if a single image is attached more than once to a
73195bd8deadSopenharmony_ci         framebuffer object?
73205bd8deadSopenharmony_ci
73215bd8deadSopenharmony_ci         RESOLVED: The value written to the pixel is undefined.
73225bd8deadSopenharmony_ci
73235bd8deadSopenharmony_ci         There used to be a rule in section 4.4.4.2 that resulted in
73245bd8deadSopenharmony_ci         FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT if a single
73255bd8deadSopenharmony_ci         image was attached more than once to a framebuffer object.
73265bd8deadSopenharmony_ci
73275bd8deadSopenharmony_ci             FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT   0x8CD8
73285bd8deadSopenharmony_ci
73295bd8deadSopenharmony_ci             * A single image is not attached more than once to the
73305bd8deadSopenharmony_ci               framebuffer object.
73315bd8deadSopenharmony_ci
73325bd8deadSopenharmony_ci               { FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT }
73335bd8deadSopenharmony_ci
73345bd8deadSopenharmony_ci         This rule was removed in version #117 of the
73355bd8deadSopenharmony_ci         EXT_framebuffer_object specification after discussion at the
73365bd8deadSopenharmony_ci         September 2005 ARB meeting.  The rule essentially required an
73375bd8deadSopenharmony_ci         O(n*lg(n)) search.  Some implementations would not need to do that
73385bd8deadSopenharmony_ci         search if the completeness rules did not require it.  Instead,
73395bd8deadSopenharmony_ci         language was added to section 4.10 which says the values
73405bd8deadSopenharmony_ci         written to the framebuffer are undefined when this rule is
73415bd8deadSopenharmony_ci         violated.
73425bd8deadSopenharmony_ci
73435bd8deadSopenharmony_ciRevision History
73445bd8deadSopenharmony_ci    #123, October 6, 2016: Jon Leech
73455bd8deadSopenharmony_ci        - Remove STENCIL_REF from list of state moved to become framebuffer
73465bd8deadSopenharmony_ci          dependent (Bug 8422).
73475bd8deadSopenharmony_ci    #122, May 3, 2016: Kevin Rogvin, James Jones
73485bd8deadSopenharmony_ci        - Specify behaviour of mixing EXT and ARB_framebuffer_object /
73495bd8deadSopenharmony_ci          OpenGL 3.0 framebuffer objects so that the aliases of the
73505bd8deadSopenharmony_ci          functions are correctly observed (Bug 1485)
73515bd8deadSopenharmony_ci    #121, September 23, 2013: Jon Leech
73525bd8deadSopenharmony_ci        - Specify that undefined behavior results when mixing EXT and
73535bd8deadSopenharmony_ci          ARB_framebuffer_object / OpenGL 3.0 API framebuffer objects
73545bd8deadSopenharmony_ci          (Bug 10738).
73555bd8deadSopenharmony_ci    #120, April 22, 2008: Jeremy Sandmel & Jon Leech
73565bd8deadSopenharmony_ci        - Update errors section so detaching renderbuffers and textures
73575bd8deadSopenharmony_ci          using object name zero is not an error.
73585bd8deadSopenharmony_ci    #119, February 13, 2007: Jon Leech
73595bd8deadSopenharmony_ci        - Corrected typos in 'GenerateMipmap'.
73605bd8deadSopenharmony_ci    #118, April 5, 2006:  jjuliano
73615bd8deadSopenharmony_ci        - Improve language related to which formats are
73625bd8deadSopenharmony_ci          color-renderable, and describe format conversions when reading
73635bd8deadSopenharmony_ci          from and writing to the framebuffer.  Lays groundwork for
73645bd8deadSopenharmony_ci          making additional formats color-renderable.
73655bd8deadSopenharmony_ci        - Add section 4.4.6.
73665bd8deadSopenharmony_ci        - Selecting same attachment multiple times via DRAW_BUFFERs
73675bd8deadSopenharmony_ci          writes undefined value to the buffer.
73685bd8deadSopenharmony_ci        - Clarify effect of framebuffer completeness on values of state
73695bd8deadSopenharmony_ci          table 9.nnn.
73705bd8deadSopenharmony_ci        - Describe interaction with NV_float_buffer and
73715bd8deadSopenharmony_ci          NV_texture_shader.
73725bd8deadSopenharmony_ci    #117, September 26, 2005:  jjuliano
73735bd8deadSopenharmony_ci        - Remove FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT.
73745bd8deadSopenharmony_ci        - Add language to section 4.10 explaining that duplicate
73755bd8deadSopenharmony_ci          attachments result in undefined behavior
73765bd8deadSopenharmony_ci        - Add issue (87) to discuss the change.
73775bd8deadSopenharmony_ci        - List EXT_packed_depth_stencil as affecting this extension.
73785bd8deadSopenharmony_ci
73795bd8deadSopenharmony_ci    #116, September 16, 2005:  jjuliano
73805bd8deadSopenharmony_ci        - Add example (8) demonstrating FBO + ARB_draw_buffers.
73815bd8deadSopenharmony_ci        - Add issue (85) discussing window and FBO of different sizes.
73825bd8deadSopenharmony_ci        - Add issue (86) about one- and two- component texture formats.
73835bd8deadSopenharmony_ci        - State that OpenGL 1.1 is required.
73845bd8deadSopenharmony_ci
73855bd8deadSopenharmony_ci    #115, July 25, 2005:  jjuliano
73865bd8deadSopenharmony_ci        - Improve wording around ReadPixels of color data while
73875bd8deadSopenharmony_ci          READ_BUFFER is NONE. (INVALID_OPERATION).  Clarify that it is
73885bd8deadSopenharmony_ci          legal to read depth/stencil while READ_BUFFER is NONE.
73895bd8deadSopenharmony_ci        - In section 4.4.4.2 (Framebuffer Completeness), clarify that
73905bd8deadSopenharmony_ci          READ_BUFFER can be NONE, and if NONE then framebuffer
73915bd8deadSopenharmony_ci          completeness does not require a color attachment.
73925bd8deadSopenharmony_ci
73935bd8deadSopenharmony_ci    #114, June 16, 2005:  jjuliano
73945bd8deadSopenharmony_ci        - Eliminate the name STENCIL_INDEX_EXT.  The name STENCIL_INDEX
73955bd8deadSopenharmony_ci          is already defined in the core specification.
73965bd8deadSopenharmony_ci        - Add some missing errors to the errors section.
73975bd8deadSopenharmony_ci        - Add _ARB suffix to TEXTURE_RECTANGLE, and describe interactions
73985bd8deadSopenharmony_ci          with ARB_texture_rectangle.
73995bd8deadSopenharmony_ci        - In errors section, say that it is an error if cube map texture
74005bd8deadSopenharmony_ci          passed to GenerateMipmapEXT is not cube complete.
74015bd8deadSopenharmony_ci
74025bd8deadSopenharmony_ci    #113, May 27, 2005:  jsandmel, jjuliano, chris niederauer, alex eddy, barthold lichtenbelt
74035bd8deadSopenharmony_ci        - improved langage and added some tables (10.nnn and 11.nnn) in
74045bd8deadSopenharmony_ci          another attempt to clarify the DrawBuffer(s)/ReadBuffer error
74055bd8deadSopenharmony_ci          semantics
74065bd8deadSopenharmony_ci        - added additional errors to the summary at the end
74075bd8deadSopenharmony_ci        - fixed typo in FramebufferTexture3D where <zoffset> was
74085bd8deadSopenharmony_ci          compared against MAX_3D_TEXTURE_SIZE and should have been
74095bd8deadSopenharmony_ci          compared against (MAX_3D_TEXTURE_SIZE - 1).
74105bd8deadSopenharmony_ci        - note that issue (21) is a duplicate of issue (77) and
74115bd8deadSopenharmony_ci          mark issue (21)'s resolution with a reference to issue (77)
74125bd8deadSopenharmony_ci        - the resolution of issue (75) indicated that STENCIL_REF is now
74135bd8deadSopenharmony_ci          dependent on the current framebuffer state, but STENCIL_REF
74145bd8deadSopenharmony_ci          was inadvertantly left off of table 9.nnn
74155bd8deadSopenharmony_ci        - fixed the bullet item in section 4.4.1 that stated that when bound to
74165bd8deadSopenharmony_ci          an application-created framebufer, the value of SAMPLES is 1.
74175bd8deadSopenharmony_ci          it should have said 0.
74185bd8deadSopenharmony_ci        - added missing queries of renderbuffer bit depths that were
74195bd8deadSopenharmony_ci          inadvertantly left out of the spec.
74205bd8deadSopenharmony_ci
74215bd8deadSopenharmony_ci    #112, April 28, 2005:  jsandmel, jjuliano, chris niederauer
74225bd8deadSopenharmony_ci        - updated contributors list
74235bd8deadSopenharmony_ci        - Improve language pertaining to "render to texture source" loop.
74245bd8deadSopenharmony_ci        - Fixed typo where CheckFramebufferStatusEXT was accidentally
74255bd8deadSopenharmony_ci          listed twice in additions to chapter 5's list of
74265bd8deadSopenharmony_ci          non-display-listed commands
74275bd8deadSopenharmony_ci        - fixed typo in prototype conventions
74285bd8deadSopenharmony_ci        - as per workgroup meeting decision on April 4, 2005,
74295bd8deadSopenharmony_ci          DrawBuffer(s) and ReadBuffer no longer generate an error when
74305bd8deadSopenharmony_ci          specifying an attachment point for which there is no image
74315bd8deadSopenharmony_ci          attached.  The rationale is that the user can always attach
74325bd8deadSopenharmony_ci          (or detach) after DrawBuffer(s)/ReadBuffer is called anyway.
74335bd8deadSopenharmony_ci          We retain the test in CheckFramebufferStatusEXT that makes
74345bd8deadSopenharmony_ci          sure the buffers are attached prior to rendering, however.
74355bd8deadSopenharmony_ci        - as per workgroup email list discussions April 20, 2005, added
74365bd8deadSopenharmony_ci          BindFramebuffer/BindRenderbuffer to the list of
74375bd8deadSopenharmony_ci          display-listable functions.  They were inadvertantly left off
74385bd8deadSopenharmony_ci          the list.  Adding them back to be consistent with resolution
74395bd8deadSopenharmony_ci          of issue (80).
74405bd8deadSopenharmony_ci        - added missing language to FramebufferTexture discussion to
74415bd8deadSopenharmony_ci          correct section where we compared width/height/level values to
74425bd8deadSopenharmony_ci          MAX_TEXTURE_SIZE instead of MAX_CUBE_MAP_TEXTURE_SIZE for cube
74435bd8deadSopenharmony_ci          maps attached to framebuffer.
74445bd8deadSopenharmony_ci        - as per workgroup meeting decision on April 26, 2005,
74455bd8deadSopenharmony_ci          CheckFramebufferStatusEXT will generate an error if called
74465bd8deadSopenharmony_ci          within a Begin/End pair, since it is (intentionally) not
74475bd8deadSopenharmony_ci          listed in the exclusion list for functions that can be called
74485bd8deadSopenharmony_ci          within Begin/End in section 2.6.3
74495bd8deadSopenharmony_ci        - as per workgroup meeting decision on April 26, 2005, since
74505bd8deadSopenharmony_ci          section 2.6.3 states that routines that return a value should
74515bd8deadSopenharmony_ci          return 0 if the routine generates an error,
74525bd8deadSopenharmony_ci          CheckFramebufferStatusEXT should return zero and not
74535bd8deadSopenharmony_ci          FRAMEBUFFER_STATUS_ERROR_EXT.  Since we don't need
74545bd8deadSopenharmony_ci          FRAMEBUFFER_STATUS_ERROR_EXT anymore, we are removing this
74555bd8deadSopenharmony_ci          enum from the spec.
74565bd8deadSopenharmony_ci        - added missing error language to spec body and fixed incorrect
74575bd8deadSopenharmony_ci          language in "Errors" section to clarify that specifying enums
74585bd8deadSopenharmony_ci          to DrawBuffer(s) and ReadBuffer that are NEVER legal is an
74595bd8deadSopenharmony_ci          INVALID_ENUM, while specifying values that only illegal
74605bd8deadSopenharmony_ci          because of the current framebuffer binding are an
74615bd8deadSopenharmony_ci          INVALID_OPERATION.
74625bd8deadSopenharmony_ci        - Fix minor typos in DrawBuffer(s) and ReadBuffer definitions.
74635bd8deadSopenharmony_ci
74645bd8deadSopenharmony_ci    #111, February 28, 2005:  jjuliano, jsandmel
74655bd8deadSopenharmony_ci        - Add example 7 illustrating "depth-only" framebuffer object.
74665bd8deadSopenharmony_ci
74675bd8deadSopenharmony_ci    #110, February 28, 2005:  jsandmel, jjuliano, brian paul
74685bd8deadSopenharmony_ci        - no functional changes
74695bd8deadSopenharmony_ci        - integrated Brian Paul's fixes for typos and noted
74705bd8deadSopenharmony_ci          that invalid operation is generated if the <textarget>
74715bd8deadSopenharmony_ci          and type of texture don't match in FramebufferTexture
74725bd8deadSopenharmony_ci        - default internalformat for renderbuffer is RGBA not "1" since
74735bd8deadSopenharmony_ci          "1" is not a legal internalformat for renderbuffers
74745bd8deadSopenharmony_ci        - note that the unsinged base internal formats of RGB, RGBA,
74755bd8deadSopenharmony_ci          DEPTH_COMPONENT, and STENCIL_INDEX are legal internal formats
74765bd8deadSopenharmony_ci          for renderbuffers.  They were intended to be legal all along
74775bd8deadSopenharmony_ci          but the language indicated otherwise.
74785bd8deadSopenharmony_ci
74795bd8deadSopenharmony_ci    #109, January 31, 2005:  jsandmel, jjuliano
74805bd8deadSopenharmony_ci        - added language to issue (48) to indidcate that
74815bd8deadSopenharmony_ci          CheckFramebufferStatus will return an undefined result for a
74825bd8deadSopenharmony_ci          framebuffer in the intial state since a framebuffer in the
74835bd8deadSopenharmony_ci          initial state violates multiple completeness rules
74845bd8deadSopenharmony_ci
74855bd8deadSopenharmony_ci    #108, January 31, 2005:  jjuliano
74865bd8deadSopenharmony_ci        - fix typos pointed out by various people (thanks)
74875bd8deadSopenharmony_ci
74885bd8deadSopenharmony_ci    #107, January 17, 2005:  jjuliano, jsandmel
74895bd8deadSopenharmony_ci        - fix resolution of issue (28) to say "zoffset", not "image"
74905bd8deadSopenharmony_ci        - more cleanup of issue resolutions
74915bd8deadSopenharmony_ci
74925bd8deadSopenharmony_ci    #106, January 17, 2005:  jjuliano
74935bd8deadSopenharmony_ci        - per working group decision, clean up issue resolutions
74945bd8deadSopenharmony_ci        - minor whitespace and punctuation cleanup
74955bd8deadSopenharmony_ci
74965bd8deadSopenharmony_ci    #105, January 17, 2005:  jjuliano
74975bd8deadSopenharmony_ci        - add XXX documenting "undefined-ness" of rendering
74985bd8deadSopenharmony_ci          vs. texturing
74995bd8deadSopenharmony_ci        - minor language clarification and typo fix
75005bd8deadSopenharmony_ci
75015bd8deadSopenharmony_ci    #104, January 14, 2005:  jjuliano, jsandmel
75025bd8deadSopenharmony_ci        - white space clean up (plus a few capitalizations)
75035bd8deadSopenharmony_ci        - no functional changes in this revision
75045bd8deadSopenharmony_ci
75055bd8deadSopenharmony_ci    #103, January 14, 2005:  jjuliano, jsandmel, barthold lichtenbelt, jon leech
75065bd8deadSopenharmony_ci        - add missing "NONE" case to DrawBuffer language
75075bd8deadSopenharmony_ci        - permit ReadBuffer(NONE) for application-created framebuffers
75085bd8deadSopenharmony_ci        - spec body: actually state that DrawPixels, ReadPixels,
75095bd8deadSopenharmony_ci          CopyPixels, and derivatives of CopyPixels all generate
75105bd8deadSopenharmony_ci          INVALID_FRAMEBUFFER_OPERATION_EXT if called while framebuffer
75115bd8deadSopenharmony_ci          is not complete
75125bd8deadSopenharmony_ci        - clarify error semantics for DrawBuffer(s) when there is no
75135bd8deadSopenharmony_ci          image attached to the framebuffer attachment point named by
75145bd8deadSopenharmony_ci          DrawBuffer(s)
75155bd8deadSopenharmony_ci        - improve error language regarding the <level> parameter of
75165bd8deadSopenharmony_ci          FramebufferTexture
75175bd8deadSopenharmony_ci        - State that table 4.nnn is part of the per-framebuffer-object
75185bd8deadSopenharmony_ci          state vector
75195bd8deadSopenharmony_ci        - Delete dangling references to table 3.nnn
75205bd8deadSopenharmony_ci        - In section 4.4.4.2, adjust wording to understand that
75215bd8deadSopenharmony_ci          DeleteTextures deletes an object, not image
75225bd8deadSopenharmony_ci        - Convert some left-over window-system-* to
75235bd8deadSopenharmony_ci          window-system-provided
75245bd8deadSopenharmony_ci        - Adjust some whitespace and punctuation
75255bd8deadSopenharmony_ci        - renumbered tables to remove the hole now that the old table of
75265bd8deadSopenharmony_ci          CheckFramebufferStatus enums has been deleted.
75275bd8deadSopenharmony_ci        - incorporate remainder of barthold's edits removing more
75285bd8deadSopenharmony_ci          "framebuffer-attachble" references from the issues list
75295bd8deadSopenharmony_ci        - moved comment describing the purpose of the
75305bd8deadSopenharmony_ci          CheckFramebufferStatus enums in the framebuffer completeness
75315bd8deadSopenharmony_ci          test closer to their initial use in the spec.
75325bd8deadSopenharmony_ci        - Eliminate two XXX comments that addressed by this revision
75335bd8deadSopenharmony_ci
75345bd8deadSopenharmony_ci    #102, January 13, 2005:  jjuliano, jsandmel, barthold lichtenbelt, jon leech
75355bd8deadSopenharmony_ci        - replacement of "renderable image" with "framebuffer-attachable
75365bd8deadSopenharmony_ci          image"
75375bd8deadSopenharmony_ci        - removed lots of (now redundant) instances of
75385bd8deadSopenharmony_ci          "framebuffer-attachable"
75395bd8deadSopenharmony_ci        - streamlined the grammar in several places to account for
75405bd8deadSopenharmony_ci          "framebuffer-attachable" change
75415bd8deadSopenharmony_ci        - incorporated outstanding edits from barthold's review of #73
75425bd8deadSopenharmony_ci          and #98
75435bd8deadSopenharmony_ci        - made FramebufferTexture and FramebufferRenderbuffer use "uint"
75445bd8deadSopenharmony_ci          for texture and renderbuffer names for consistency with
75455bd8deadSopenharmony_ci          Gen/Is/Bind/Delete.  For some reason, in revision #77 we
75465bd8deadSopenharmony_ci          had incorrectly changed these from uint to ints.
75475bd8deadSopenharmony_ci        - renamed FRAMEBUFFER_INCOMPLETE_MULTIPLE_ATTACHMENT to
75485bd8deadSopenharmony_ci          FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT
75495bd8deadSopenharmony_ci        - fixed DeleteTextures and DeleteRenderbuffers language to
75505bd8deadSopenharmony_ci          reflect resolution of issue (77), by adding forward reference
75515bd8deadSopenharmony_ci          to the section that describes attachment (that already had
75525bd8deadSopenharmony_ci          that right language).
75535bd8deadSopenharmony_ci        - fixed the different language in FramebufferRenderbuffer and
75545bd8deadSopenharmony_ci          FramebufferTexture that described the state when binding a
75555bd8deadSopenharmony_ci          zero object (dropped the reference to object type of NONE
75565bd8deadSopenharmony_ci          since that *is* the default and it already said the state was
75575bd8deadSopenharmony_ci          set to default values)
75585bd8deadSopenharmony_ci        - reworked section 4.4.2 overview to simplify intro to
75595bd8deadSopenharmony_ci          attaching images to framebuffers
75605bd8deadSopenharmony_ci        - reworded intro to section 4.4.2.1 Renderbuffer Objects
75615bd8deadSopenharmony_ci        - fixed several instances of "render buffer" to "renderbuffer"
75625bd8deadSopenharmony_ci        - replaced language in framebuffer attachment routines that
75635bd8deadSopenharmony_ci          bounded the upper value of <level> to use the parallel
75645bd8deadSopenharmony_ci          language from page 185 of the OpenGL 2.0 spec.
75655bd8deadSopenharmony_ci        - simplified first clause of framebuffer compelteness test to
75665bd8deadSopenharmony_ci          just require at least one image attached to framebuffer
75675bd8deadSopenharmony_ci        - reordered CheckFramebufferStatusEXT section and moved
75685bd8deadSopenharmony_ci          description of FRAMEBUFFER_UNSUPPORTED_EXT to be part of
75695bd8deadSopenharmony_ci          framebuffer completeness section description
75705bd8deadSopenharmony_ci        - deleted table 3.nnn which lsted the return values of
75715bd8deadSopenharmony_ci          CheckFramebufferStatusEXT since this info is already included
75725bd8deadSopenharmony_ci          in the framebuffer completeness test itself and was really
75735bd8deadSopenharmony_ci          just a duplicate copy in table form.
75745bd8deadSopenharmony_ci        - added several errors which were missing from the error summary
75755bd8deadSopenharmony_ci          at the end of the spec
75765bd8deadSopenharmony_ci
75775bd8deadSopenharmony_ci    #101, January 12, 2005:  jjuliano, jsandmel
75785bd8deadSopenharmony_ci        - Clarify language related to BindRenderbuffer(<target>, 0)
75795bd8deadSopenharmony_ci        - Small grammatical change related to object vs. object's image.
75805bd8deadSopenharmony_ci
75815bd8deadSopenharmony_ci    #100, January 11, 2005:  jsandmel, jjuliano
75825bd8deadSopenharmony_ci        - added new enums and clauses to framebuffer completeness test
75835bd8deadSopenharmony_ci          to catch mutliple and missing attachements
75845bd8deadSopenharmony_ci        - reshuffled existing enums to account for new enums
75855bd8deadSopenharmony_ci        - clarified issue (84) it indicate that the intent is to mimic
75865bd8deadSopenharmony_ci          the pbuffer orientation style
75875bd8deadSopenharmony_ci
75885bd8deadSopenharmony_ci    #99, January 11, 2005:  jsandmel, jjuliano
75895bd8deadSopenharmony_ci        - use more expelict language mapping window coordinates to
75905bd8deadSopenharmony_ci          texture image texels at the end of section 4.4.2.3
75915bd8deadSopenharmony_ci        - fixed typos
75925bd8deadSopenharmony_ci        - coalesced interactions with AGL/GLX/WGL with interactions with
75935bd8deadSopenharmony_ci          WGL/GLX_make_current_read extensions
75945bd8deadSopenharmony_ci        - addressed and removed some more remaining XXX comments
75955bd8deadSopenharmony_ci        - added note to issue (58) saying that {Copy}TexSubImage
75965bd8deadSopenharmony_ci          uses negative offsets to address border texels
75975bd8deadSopenharmony_ci        - added issue (84) - do we need any language describing
75985bd8deadSopenharmony_ci          orientation of renderable images?  (I.e., are they y-inverted?)
75995bd8deadSopenharmony_ci
76005bd8deadSopenharmony_ci    #98, January 7, 2005:  jsandmel
76015bd8deadSopenharmony_ci        - remove more outstanding XXX comments
76025bd8deadSopenharmony_ci        - updated section 4.4 to better define applicatino-created and
76035bd8deadSopenharmony_ci          window-system-provided framebuffers in the overview of
76045bd8deadSopenharmony_ci          framebuffer objects
76055bd8deadSopenharmony_ci        - further clarifications to issue (49) concerning MRT support
76065bd8deadSopenharmony_ci        - removed stale XXX comment from issue (75) about stencil mask
76075bd8deadSopenharmony_ci          language
76085bd8deadSopenharmony_ci
76095bd8deadSopenharmony_ci    #97, January 7, 2005:  jjuliano
76105bd8deadSopenharmony_ci        - Resolve some XXX comments, by adding missing spec language and
76115bd8deadSopenharmony_ci          clarifying existing spec language.
76125bd8deadSopenharmony_ci
76135bd8deadSopenharmony_ci    #96, January 6, 2005:  jjuliano, ian romanick
76145bd8deadSopenharmony_ci        - renumbered sections to reflect earlier removal of the section
76155bd8deadSopenharmony_ci          on renderable image completeness.
76165bd8deadSopenharmony_ci        - fixed prototype of CheckFramebufferStatusEXT in spec (bool->enum)
76175bd8deadSopenharmony_ci
76185bd8deadSopenharmony_ci    #95, January 6, 2005:  jsandmel, jjuliano
76195bd8deadSopenharmony_ci        - added missing change notes from #94
76205bd8deadSopenharmony_ci        - fixed more typos
76215bd8deadSopenharmony_ci        - updated issue (48) - it had been resolved already but need
76225bd8deadSopenharmony_ci          some updated some language from the resolution to reflect our
76235bd8deadSopenharmony_ci          final decision
76245bd8deadSopenharmony_ci        - marked issue (55) as resolved (it had been resolved a while
76255bd8deadSopenharmony_ci          ago but was left as unresolved)
76265bd8deadSopenharmony_ci        - resolved issue (82) - bind vs. attach.  final spec
76275bd8deadSopenharmony_ci          implications may get updated when we resolved the larger ARB
76285bd8deadSopenharmony_ci          discussions over multicontext behavior and object sharing
76295bd8deadSopenharmony_ci
76305bd8deadSopenharmony_ci    #94, January 4, 2005:  jjuliano
76315bd8deadSopenharmony_ci        - language clarification and word smithing.
76325bd8deadSopenharmony_ci        - note that rendering to the border of a texture uses
76335bd8deadSopenharmony_ci          an origin within the border texels
76345bd8deadSopenharmony_ci        - updated comments in sample code for clarity
76355bd8deadSopenharmony_ci        - updated issue (16) to clarify how CopyTexImage possibly
76365bd8deadSopenharmony_ci          affects framebuffer completeness, and simplified remaining
76375bd8deadSopenharmony_ci          language
76385bd8deadSopenharmony_ci        - updated issue (77) to better capture the effects of
76395bd8deadSopenharmony_ci          deleting attached renderable images
76405bd8deadSopenharmony_ci        - updated issue (79) to better capture the invariance of
76415bd8deadSopenharmony_ci          renderable image internal format selection
76425bd8deadSopenharmony_ci        - added additional clarifications to issue (83) to describe how
76435bd8deadSopenharmony_ci          an explicit enable/disable API would work
76445bd8deadSopenharmony_ci
76455bd8deadSopenharmony_ci
76465bd8deadSopenharmony_ci    #93, December 23, 2004:  jsandmel
76475bd8deadSopenharmony_ci        - improved stencil ref value clamping language yet again to
76485bd8deadSopenharmony_ci          indicate that queries are clamped
76495bd8deadSopenharmony_ci        - moved old XXX comment about an explicit enable into a new
76505bd8deadSopenharmony_ci          resolved issue (83)
76515bd8deadSopenharmony_ci        - removed a condition of framebuffer attachment completness
76525bd8deadSopenharmony_ci          concerning the legality of the LEVEL param which I
76535bd8deadSopenharmony_ci          overzealously added in revision #92
76545bd8deadSopenharmony_ci        - resolved issue (77) - images are detached from current
76555bd8deadSopenharmony_ci          framebuffer only, user must do manual detachment for
76565bd8deadSopenharmony_ci          non current framebuffers
76575bd8deadSopenharmony_ci        - clarified issue (79) to note that GL need not choose the same
76585bd8deadSopenharmony_ci          format for both renderbuffers and textures as the text seemed
76595bd8deadSopenharmony_ci          to imply before.
76605bd8deadSopenharmony_ci        - clarified issue (16) to note that state changes to non-bound
76615bd8deadSopenharmony_ci          framebuffers are somewhat similar to state changes made by
76625bd8deadSopenharmony_ci          another context to shared objects (possibly) bound by this
76635bd8deadSopenharmony_ci          context.
76645bd8deadSopenharmony_ci        - clarified resolution of issues (15) and (16) which talk about
76655bd8deadSopenharmony_ci          how {Copy}TexImage into textures affect the framebuffers to
76665bd8deadSopenharmony_ci          which textures are attached.
76675bd8deadSopenharmony_ci
76685bd8deadSopenharmony_ci    #92, December 23, 2004:  jsandmel
76695bd8deadSopenharmony_ci        - updated "Dependencies" section to add descriptions for
76705bd8deadSopenharmony_ci          interactions with other extensions
76715bd8deadSopenharmony_ci        - fixed a stale reference to "accum" in overview
76725bd8deadSopenharmony_ci        - improved language in overview that seemed to imply that
76735bd8deadSopenharmony_ci          this extension required a data copy to do render to texture
76745bd8deadSopenharmony_ci        - removed stale XXX comment about framebuffer sharing since
76755bd8deadSopenharmony_ci          issue (76) is resolved
76765bd8deadSopenharmony_ci        - added proposed language for "attach" definition in glossary
76775bd8deadSopenharmony_ci        - removed stale glossary entry for "renderable image completeness"
76785bd8deadSopenharmony_ci          now that issue (78) is resolved
76795bd8deadSopenharmony_ci        - Updated chapter 2 to use proposed language changes describing
76805bd8deadSopenharmony_ci          interactions with the framebuffer in the context of this
76815bd8deadSopenharmony_ci          extension.
76825bd8deadSopenharmony_ci        - clarified that GenerateMipmap only requires cubemap textures
76835bd8deadSopenharmony_ci          to be cubemap complete
76845bd8deadSopenharmony_ci        - removed unnecessary reference to proxy texture in GenerateMipmap
76855bd8deadSopenharmony_ci        - clarified language about stencil ref value clamping
76865bd8deadSopenharmony_ci        - removed various other stale XXX comments
76875bd8deadSopenharmony_ci        - added note that RENDERBUFFER_BINDING_EXT can be queried
76885bd8deadSopenharmony_ci        - included alternate beahviors in language influenced by issue
76895bd8deadSopenharmony_ci          (77)
76905bd8deadSopenharmony_ci        - defined the error that occurs on FramebufferTexture when
76915bd8deadSopenharmony_ci          a level is specified that is too big
76925bd8deadSopenharmony_ci        - added requirement to framebuffer attachment completeness
76935bd8deadSopenharmony_ci          that FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT must be
76945bd8deadSopenharmony_ci          less than q for symmetry with the requirement that the
76955bd8deadSopenharmony_ci          z-offset is smaller than the depth of the texture
76965bd8deadSopenharmony_ci        - added section numbers to state tables
76975bd8deadSopenharmony_ci        - indicated there are no attribute bits for the state tables
76985bd8deadSopenharmony_ci        - added proposed language for issue (82)
76995bd8deadSopenharmony_ci        - added proposed language for issue (77)
77005bd8deadSopenharmony_ci
77015bd8deadSopenharmony_ci    #91, December 22, 2004:  jsandmel
77025bd8deadSopenharmony_ci        - added updated stencil language to reflect resolution of
77035bd8deadSopenharmony_ci          issue (75) - stencil ref value and writemask clamping
77045bd8deadSopenharmony_ci        - added language to section 4.4.2.1 indicating that internal
77055bd8deadSopenharmony_ci          format selection for renderbuffers follows the same invariance
77065bd8deadSopenharmony_ci          rules as textures
77075bd8deadSopenharmony_ci        - updated framebuffer completeness language to reflect resolution
77085bd8deadSopenharmony_ci          of sissue (78)
77095bd8deadSopenharmony_ci        - added test to framebuffer attachment completeness indicating
77105bd8deadSopenharmony_ci          that the z-offset identifying an image within a 3D texture must
77115bd8deadSopenharmony_ci          be less than the texture's depth
77125bd8deadSopenharmony_ci        - added routines to list of non-display-list'able routines
77135bd8deadSopenharmony_ci          as per resolution of issue (80)
77145bd8deadSopenharmony_ci        - deleted note about OpenGL ES in issue (76)
77155bd8deadSopenharmony_ci        - cleaned up the proposed language for issue (77) based on
77165bd8deadSopenharmony_ci          feedback from Jeff Juliano
77175bd8deadSopenharmony_ci
77185bd8deadSopenharmony_ci    #90, December 22, 2004:  jsandmel
77195bd8deadSopenharmony_ci        - removed plural from FRAMEBUFFER_INCOMPLETE_ATTACHMENT[S]
77205bd8deadSopenharmony_ci        - added FRAMEBUFFER_STATUS_ERROR_EXT to enumerants list
77215bd8deadSopenharmony_ci        - resolved issue (78) - collapsing "renderable image
77225bd8deadSopenharmony_ci          completeness" test and removed FRAMEBUFFER_INCOMPLETE_IMAGES
77235bd8deadSopenharmony_ci          enum as per meeting Dec. 21, 2004
77245bd8deadSopenharmony_ci        - fixed up some typos
77255bd8deadSopenharmony_ci        - wrote up and resolved issue (76) - framebuffers are shared
77265bd8deadSopenharmony_ci          like textures as per meeting Dec. 21, 2004
77275bd8deadSopenharmony_ci        - wrote up issue (77) - detachment on deletion
77285bd8deadSopenharmony_ci        - wrote up and resolved issue (79) - textures are invariant
77295bd8deadSopenharmony_ci          with respect to framebuffer state
77305bd8deadSopenharmony_ci        - wrote up and resolved issue (80) - no routines in this
77315bd8deadSopenharmony_ci          extension are display-list'able
77325bd8deadSopenharmony_ci        - wrote up and deferred issue (81) - push/pop attrib
77335bd8deadSopenharmony_ci        - added issue (82) - bind vs. attach defintions
77345bd8deadSopenharmony_ci
77355bd8deadSopenharmony_ci    #89, December 16, 2004:  jjuliano, jsandmel, ian romanick
77365bd8deadSopenharmony_ci        - added glx protocol for this extension
77375bd8deadSopenharmony_ci        - added issue (75) - stencil ref value and write mask state
77385bd8deadSopenharmony_ci        - added issue (76) - sharing framebuffer objects
77395bd8deadSopenharmony_ci        - added issue (77) - deletes affect on detaching images
77405bd8deadSopenharmony_ci        - added issue (78) - collapsing "completeness" tests
77415bd8deadSopenharmony_ci
77425bd8deadSopenharmony_ci    #88, December 06, 2004:  jjuliano, jsandmel
77435bd8deadSopenharmony_ci        - revised examples again for clarity, added example (6) to show
77445bd8deadSopenharmony_ci          one way to handle CheckFramebufferStatusEXT
77455bd8deadSopenharmony_ci
77465bd8deadSopenharmony_ci    #87, December 03, 2004:  jjuliano, jsandmel
77475bd8deadSopenharmony_ci        - incorporated language edit feedback from john rosasco
77485bd8deadSopenharmony_ci        - changed a few instances of "rendering to texture" to "render
77495bd8deadSopenharmony_ci          to texture"
77505bd8deadSopenharmony_ci        - added XXX notes about sections that still need cleanup
77515bd8deadSopenharmony_ci        - clarified definition of renderbuffer and its image in overview
77525bd8deadSopenharmony_ci        - clarified comparison of MakeCurrent and BindFramebuffer in
77535bd8deadSopenharmony_ci          overview
77545bd8deadSopenharmony_ci        - fixed misc typos
77555bd8deadSopenharmony_ci        - renamed TEXTURE_ZOFFSET to TEXTURE_3D_ZOFFSET for consistency
77565bd8deadSopenharmony_ci          with TEXTURE_CUBE_MAP_FACE
77575bd8deadSopenharmony_ci        - added note to update section 2.1 to talk about configuring
77585bd8deadSopenharmony_ci          framebuffer (need forward reference to chapeter 4).
77595bd8deadSopenharmony_ci        - changed several instances "the GL is using ... framebuffer" to
77605bd8deadSopenharmony_ci          "the GL is bound to ... framebuffer"
77615bd8deadSopenharmony_ci        - changed several instances of "When [A], if [B], [C]" into "If
77625bd8deadSopenharmony_ci          [A] and [B], then [C]"
77635bd8deadSopenharmony_ci
77645bd8deadSopenharmony_ci    #86, December 02, 2004:  jon leech
77655bd8deadSopenharmony_ci        - assigned "real" enum values
77665bd8deadSopenharmony_ci        - fixed some minor typos
77675bd8deadSopenharmony_ci
77685bd8deadSopenharmony_ci    #85, December 01, 2004:  jjuliano, jsandmel
77695bd8deadSopenharmony_ci        - Improve error checking in examples
77705bd8deadSopenharmony_ci        - whitespace cleanup
77715bd8deadSopenharmony_ci
77725bd8deadSopenharmony_ci    #84, December 01, 2004:  jjuliano
77735bd8deadSopenharmony_ci        - DrawBuffer(s) while bound to user-created framebuffer object
77745bd8deadSopenharmony_ci          generates an error if the named color attachment does not have
77755bd8deadSopenharmony_ci          have anything attached to it when DrawBuffer is invoked.
77765bd8deadSopenharmony_ci        - Likewise for ReadBuffer.
77775bd8deadSopenharmony_ci
77785bd8deadSopenharmony_ci    #83, November 30, 2004:  jjuliano
77795bd8deadSopenharmony_ci        - improve wording of issue (28) - zoffset vs image of a
77805bd8deadSopenharmony_ci          3-dimensional texture
77815bd8deadSopenharmony_ci        - update examples to use the new attach target enums, and
77825bd8deadSopenharmony_ci          to check framebuffer status
77835bd8deadSopenharmony_ci
77845bd8deadSopenharmony_ci    #82, November 30, 2004:  jsandmel
77855bd8deadSopenharmony_ci        - renumbered tables to start with 1.nnn instead of 2.nnn
77865bd8deadSopenharmony_ci        - resolved issue (74) - return value of CheckFramebufferStatus()
77875bd8deadSopenharmony_ci        - re-opened and re-resolved issue (28) - zoffset vs image of a
77885bd8deadSopenharmony_ci          3d texture
77895bd8deadSopenharmony_ci        - fixed reference of CopyTexImage to CopyTexSubImage in intro
77905bd8deadSopenharmony_ci        - added 16 enums for COLOR_ATTACHMENTn_EXT as per meeting
77915bd8deadSopenharmony_ci          november 29, 2004
77925bd8deadSopenharmony_ci        - clarified language about number of attachment points in
77935bd8deadSopenharmony_ci          description of BindFramebufferEXT().
77945bd8deadSopenharmony_ci
77955bd8deadSopenharmony_ci    #81, November 30, 2004:  jsandmel
77965bd8deadSopenharmony_ci        - re-added *-renderable clause to "renderable image completeness"
77975bd8deadSopenharmony_ci          test.
77985bd8deadSopenharmony_ci        - clarified language in intro that describes selecting an
77995bd8deadSopenharmony_ci          image from a texture
78005bd8deadSopenharmony_ci        - fixed a few more typos
78015bd8deadSopenharmony_ci
78025bd8deadSopenharmony_ci    #80, November 30, 2004:  jjuliano
78035bd8deadSopenharmony_ci        - Improve definition of CheckFramebufferStatusEXT.
78045bd8deadSopenharmony_ci          FRAMEBUFFER_STATUS_ERROR_EXT is returned if <target> is
78055bd8deadSopenharmony_ci          invalid.  Framebuffer zero always produces
78065bd8deadSopenharmony_ci          FRAMEBUFFER_COMPLETE_EXT.
78075bd8deadSopenharmony_ci        - Rename 3D_IMAGE to ZOFFSET.  More consistent with
78085bd8deadSopenharmony_ci          CopyTex(Sub)Image.
78095bd8deadSopenharmony_ci        - In definition of GetFramebufferAttachmentParameterivEXT,
78105bd8deadSopenharmony_ci          explain that zero is returned when face or zoffset is queried,
78115bd8deadSopenharmony_ci          but texture is not cube map or 3-dimensional, resp.  This
78125bd8deadSopenharmony_ci          matches the informal description in issue (51).
78135bd8deadSopenharmony_ci        - Eliminate table 1.nnn, and modify references to instead
78145bd8deadSopenharmony_ci          reference table 6.nnn.  I have not renumbered all the tables
78155bd8deadSopenharmony_ci          yet, so that the diffs are more obvious.  Renumbering can
78165bd8deadSopenharmony_ci          happen in the next change.
78175bd8deadSopenharmony_ci        - Eliminate *-renderable clause from Renderable Image
78185bd8deadSopenharmony_ci          Completeness.  This is already covered under Framebuffer
78195bd8deadSopenharmony_ci          Attachment Completeness.
78205bd8deadSopenharmony_ci        - For each clause in Framebuffer Completeness, add references to
78215bd8deadSopenharmony_ci          specific error generated when that clause is violated.
78225bd8deadSopenharmony_ci
78235bd8deadSopenharmony_ci    #79, November 23, 2004:  jsandmel, jjuliano
78245bd8deadSopenharmony_ci        - more typos fixed
78255bd8deadSopenharmony_ci        - added placeholder enumeration of all tables so that every
78265bd8deadSopenharmony_ci          table was not named XXX.XXX.  They are now named M.nnn where M
78275bd8deadSopenharmony_ci          is incremented sequentially for each table.
78285bd8deadSopenharmony_ci        - stated that order of return of CheckFramebufferStatus enums is
78295bd8deadSopenharmony_ci          "implementatino-dependent" instead of "undefined"
78305bd8deadSopenharmony_ci        - added state table for framebuffer object state (as opposed to
78315bd8deadSopenharmony_ci          table of framebuffer attachment point state), added
78325bd8deadSopenharmony_ci          DRAW_BUFFERi and READ_BUFFER state to this table.
78335bd8deadSopenharmony_ci
78345bd8deadSopenharmony_ci    #78, November 22, 2004:  jsandmel
78355bd8deadSopenharmony_ci        - re-opened and re-resolved issue (4) - renamed
78365bd8deadSopenharmony_ci          "renderable-images" to "framebuffer-attachable images"
78375bd8deadSopenharmony_ci        - resolved issue (70) - defer support of framebuffer binding
78385bd8deadSopenharmony_ci          push/pop semantics
78395bd8deadSopenharmony_ci
78405bd8deadSopenharmony_ci    #77, November 22, 2004:  jsandmel, jjuliano
78415bd8deadSopenharmony_ci        - fixed up typos and address other issues found by Barthold
78425bd8deadSopenharmony_ci        - changed errors of GetFramebufferAttachmentParameterivEXT
78435bd8deadSopenharmony_ci          to be INVALID_ENUM instead of INVALID_VALUE where appropriate
78445bd8deadSopenharmony_ci        - added missing INVALID_ENUM GetRenderbufferParameterivEXT error
78455bd8deadSopenharmony_ci          case to list of errors
78465bd8deadSopenharmony_ci        - dropped framebuffer status state from state table (The reason
78475bd8deadSopenharmony_ci          is: technically this is not state queriable with a standard
78485bd8deadSopenharmony_ci          Get call and doesn't really need to be stored, an
78495bd8deadSopenharmony_ci          implementation could calculate this result on the fly in
78505bd8deadSopenharmony_ci          principle.)
78515bd8deadSopenharmony_ci        - added issue (74) - what does it mean to call
78525bd8deadSopenharmony_ci          CheckFramebufferStatusEXT on framebuffer zero (default
78535bd8deadSopenharmony_ci          framebuffer) and what if CheckFramebufferStatusEXT generates
78545bd8deadSopenharmony_ci          an error?
78555bd8deadSopenharmony_ci        - cleaned up a bunch more "window-system-provided" references
78565bd8deadSopenharmony_ci        - changed a bunch of "bit plane" references --> "bitplane"
78575bd8deadSopenharmony_ci        - more updates to glossary section (not complete yet)
78585bd8deadSopenharmony_ci        - Added boolean return values to IsRenderbuffer and
78595bd8deadSopenharmony_ci          IsFramebuffer prototypes
78605bd8deadSopenharmony_ci        - Changed object id's in FramebufferTexture* and
78615bd8deadSopenharmony_ci          FramebufferRenderbuffer from uint to int to be consistent with
78625bd8deadSopenharmony_ci          texture routines.
78635bd8deadSopenharmony_ci        - changed typo in Get*Parameter routines: "param" --> "params"
78645bd8deadSopenharmony_ci        - added missing COLOR_ATTACHMENTn_EXT enums to new tokens list
78655bd8deadSopenharmony_ci        - clarified difference and similarities between automatic and
78665bd8deadSopenharmony_ci          manual mipmap generation in section 3.8.8
78675bd8deadSopenharmony_ci        - added lots of missing EXT's
78685bd8deadSopenharmony_ci        - clarified use of <textarget> in FramebufferTexture when
78695bd8deadSopenharmony_ci          <texture> is zero and <renderbuffer> target in
78705bd8deadSopenharmony_ci          FramebufferRenderbuffer when <renderbuffer> is zero.
78715bd8deadSopenharmony_ci          (<textarget> and <renderbuffertarget> are ignored in this case>
78725bd8deadSopenharmony_ci        - added a sentence defining that order of return for enums in
78735bd8deadSopenharmony_ci          CheckFramebufferStatusEXT is undefined if multiple clauses of
78745bd8deadSopenharmony_ci          framebuffer completeness test fail
78755bd8deadSopenharmony_ci
78765bd8deadSopenharmony_ci    #76, November 19, 2004:  jsandmel
78775bd8deadSopenharmony_ci        - as per group meeting Nov. 19, 2004, rename "render buffer" to
78785bd8deadSopenharmony_ci          "renderbuffer".  This is the only substantive change in this
78795bd8deadSopenharmony_ci          revision.  Unfortunately, this had a lot of white-space
78805bd8deadSopenharmony_ci          collateral damage.  Also, this reopens and closes issue (3).
78815bd8deadSopenharmony_ci
78825bd8deadSopenharmony_ci    #75, November 18, 2004:  jsandmel
78835bd8deadSopenharmony_ci        - added missing enums to New Tokens section
78845bd8deadSopenharmony_ci        - clarified wgl/agl/glx language additions section to note that
78855bd8deadSopenharmony_ci          the window-system draw/read drawables are ignored when bound
78865bd8deadSopenharmony_ci          to an application-created framebuffer object
78875bd8deadSopenharmony_ci        - resolved issue (69) - "application-create" framebuffers
78885bd8deadSopenharmony_ci        - added more description of issue (70) - push/pop binding bits?
78895bd8deadSopenharmony_ci        - resolved issue (71) - defining which draw/reading routines can
78905bd8deadSopenharmony_ci          throw errors
78915bd8deadSopenharmony_ci        - resolve issue (72) - require at least one color, depth, or
78925bd8deadSopenharmony_ci          stencil attachment
78935bd8deadSopenharmony_ci        - resolved issue (73) - allow READ_BUFFER to be none so
78945bd8deadSopenharmony_ci          user can read from a non-color buffer in a framebuffer
78955bd8deadSopenharmony_ci          with no color attachments
78965bd8deadSopenharmony_ci        - added section on ReadBuffer whose absence had unfortunately
78975bd8deadSopenharmony_ci          gone unnoticed until now.
78985bd8deadSopenharmony_ci        - added missing "initial state" language for draw buffer to
78995bd8deadSopenharmony_ci          section 4.2
79005bd8deadSopenharmony_ci        - cleaned up several references to FRAMEBUFFER_EXT that should
79015bd8deadSopenharmony_ci          have been either "the target FRAMEBUFFER_EXT" or
79025bd8deadSopenharmony_ci          "FRAMEBUFFER_BINDING_EXT"
79035bd8deadSopenharmony_ci
79045bd8deadSopenharmony_ci    #74, November 18, 2004:  jsandmel, jjuliano
79055bd8deadSopenharmony_ci        - fixed up typos found by Ian Romanick
79065bd8deadSopenharmony_ci        - changed several instances of "GL-allocated framebuffer" to
79075bd8deadSopenharmony_ci          "application-created framebuffer" for consistency.
79085bd8deadSopenharmony_ci          NOTE: However, we might want to pick a new term for these
79095bd8deadSopenharmony_ci          everywhere.  Added issue (69) for this.
79105bd8deadSopenharmony_ci        - added a MAX_RENDERBUFFER_SIZE_EXT implementation constant
79115bd8deadSopenharmony_ci          to catch errors to RenderbufferStorageEXT.
79125bd8deadSopenharmony_ci        - added issue (70), (71), (72), (73) for issues found
79135bd8deadSopenharmony_ci          by Jeff
79145bd8deadSopenharmony_ci
79155bd8deadSopenharmony_ci    #73, November 15, 2004:  jsandmel
79165bd8deadSopenharmony_ci        - split out CheckFramebufferStatus enums as per work group
79175bd8deadSopenharmony_ci          meeting November 15, 2004
79185bd8deadSopenharmony_ci        - added note to self to go back and clean up issue (48)
79195bd8deadSopenharmony_ci
79205bd8deadSopenharmony_ci    #72, November 15, 2004:  jsandmel
79215bd8deadSopenharmony_ci        - added "valid draw/read buffer" test to framebuffer
79225bd8deadSopenharmony_ci          completeness test as per resolution of issue (55) as per
79235bd8deadSopenharmony_ci          meeting on November 11, 2004.
79245bd8deadSopenharmony_ci        - added new enums to CheckFramebufferStatus for each of the
79255bd8deadSopenharmony_ci          implementation-independent failure cases as per resolution of
79265bd8deadSopenharmony_ci          issue (55) as per meeting on November 11, 2004.
79275bd8deadSopenharmony_ci          (these may be placeholder names for now)
79285bd8deadSopenharmony_ci        - added additional partial resolutions to issue (55) as
79295bd8deadSopenharmony_ci          per meeting on November 11, 2004
79305bd8deadSopenharmony_ci        - added XXX note to update state tables with whatever the
79315bd8deadSopenharmony_ci          final final resolution of the DRAW_BUFFER location is.
79325bd8deadSopenharmony_ci
79335bd8deadSopenharmony_ci    #71, November 9, 2004:  jsandmel
79345bd8deadSopenharmony_ci        - cleaned up contributors list
79355bd8deadSopenharmony_ci        - resolved issue (61) on minimum requirements as per work group
79365bd8deadSopenharmony_ci          meeting on November 6, 2004
79375bd8deadSopenharmony_ci        - added partial resolution and additional description to
79385bd8deadSopenharmony_ci          issue (55) as per meeting on November 8, 2004
79395bd8deadSopenharmony_ci
79405bd8deadSopenharmony_ci    #70, November 2, 2004:  jsandmel, jjuliano
79415bd8deadSopenharmony_ci        - clarified opening language of chapter 4 to name non-visible
79425bd8deadSopenharmony_ci          buffers
79435bd8deadSopenharmony_ci        - improved language about when the number of bits in a bitplane
79445bd8deadSopenharmony_ci          can change
79455bd8deadSopenharmony_ci        - removed "SUBPIXEL_BITS" from table of state that can change
79465bd8deadSopenharmony_ci          on framebuffer state change as per working group
79475bd8deadSopenharmony_ci          meeting November 1, 2004 and marked issue (62) as resolved
79485bd8deadSopenharmony_ci        - marked issue (56) - draw buffer state location as framebuffer
79495bd8deadSopenharmony_ci          object state as per working group meeting November 1, 2004
79505bd8deadSopenharmony_ci
79515bd8deadSopenharmony_ci    #69, November 1, 2004:  jsandmel
79525bd8deadSopenharmony_ci        - added placeholder "min requirements" text to issue (61)
79535bd8deadSopenharmony_ci        - marked issue (68) as resolved since it was resolved during
79545bd8deadSopenharmony_ci          week of Oct 18, 2004.
79555bd8deadSopenharmony_ci        - incorporated feedback from Brian Paul on various typos,
79565bd8deadSopenharmony_ci          prototype mismatches, missing "EXT"s, and missing
79575bd8deadSopenharmony_ci          IsRenderbuffer language (to chapter 6)
79585bd8deadSopenharmony_ci        - added missing IsFramebufferLanguage to chapter 6
79595bd8deadSopenharmony_ci
79605bd8deadSopenharmony_ci    #68, October 29, 2004:  jjuliano, jsandmel
79615bd8deadSopenharmony_ci        - additional clarifications to opening of chapter 4
79625bd8deadSopenharmony_ci        - various other minor word substitutions
79635bd8deadSopenharmony_ci
79645bd8deadSopenharmony_ci    #67, October 28, 2004:  jjuliano
79655bd8deadSopenharmony_ci        - additional clarifications to issue (56)
79665bd8deadSopenharmony_ci
79675bd8deadSopenharmony_ci    #66, October 27, 2004:  jsandmel
79685bd8deadSopenharmony_ci        - added most (all?) of the necessary state tables to the end of
79695bd8deadSopenharmony_ci          the spec (also removed old state table notation)
79705bd8deadSopenharmony_ci        - made references to the state tables as 6.3XX until we know the
79715bd8deadSopenharmony_ci          final table numbering
79725bd8deadSopenharmony_ci        - fleshed out the language of the intro to chapter 4 describing
79735bd8deadSopenharmony_ci          the color logical buffers and attachable color buffers
79745bd8deadSopenharmony_ci        - at the beginning of chapter 4, modified core spec language to
79755bd8deadSopenharmony_ci          note that the bitplane depths are no longer fixed
79765bd8deadSopenharmony_ci        - moved XXX note about invariance to end of start of chapter 4
79775bd8deadSopenharmony_ci        - slightly reworded description of FRAMEBUFFER_UNSUPPORTED_EXT
79785bd8deadSopenharmony_ci        - moved table of "framebuffer dependent state variables"
79795bd8deadSopenharmony_ci          from spec body into state tables at end of spec
79805bd8deadSopenharmony_ci        - added most (all?) of the known errors to the "Errors"
79815bd8deadSopenharmony_ci          section of the spec.
79825bd8deadSopenharmony_ci
79835bd8deadSopenharmony_ci    #65, October 25, 2004:  jsandmel
79845bd8deadSopenharmony_ci        - changes to resolve issue (67) - ValidateFramebuffer is now
79855bd8deadSopenharmony_ci          called CheckFramebufferStatus().
79865bd8deadSopenharmony_ci        - updated section 4.2.1 to include DrawBuffers (plural) language
79875bd8deadSopenharmony_ci          from OpenGL 2.0 spec.  Note: we either need to update whole
79885bd8deadSopenharmony_ci          spec to be based on OpenGL 2.0 spec, or else revise the
79895bd8deadSopenharmony_ci          DrawBuffer(s) language to refer to the ARB_draw_buffers
79905bd8deadSopenharmony_ci          extension sepc language.
79915bd8deadSopenharmony_ci        - added (possibly temp) reference to errors on ReadPixels when
79925bd8deadSopenharmony_ci          using an incomplete framebuffer
79935bd8deadSopenharmony_ci        - added note to section 4.4.1 that describes pixel ownership
79945bd8deadSopenharmony_ci          test success when using application-created framebuffers
79955bd8deadSopenharmony_ci        - added table of enum values returned from
79965bd8deadSopenharmony_ci          CheckFramebufferStatus() as per resolution of issue (48)
79975bd8deadSopenharmony_ci        - resolved issue (65) - name of error on incomplete framebuffer
79985bd8deadSopenharmony_ci          operations
79995bd8deadSopenharmony_ci        - clarified that issue (24) is really a duplicate of (64).
80005bd8deadSopenharmony_ci        - resolved issue (48)
80015bd8deadSopenharmony_ci        - added note to write up issue (61) language for review
80025bd8deadSopenharmony_ci
80035bd8deadSopenharmony_ci    #64, October 19, 2004:  jsandmel, jjuliano
80045bd8deadSopenharmony_ci        - more rewording and clarifications of issue (56)
80055bd8deadSopenharmony_ci
80065bd8deadSopenharmony_ci    #63, October 15, 2004:  jjuliano
80075bd8deadSopenharmony_ci        - more rewording and clarifications of issue (55) and (56)
80085bd8deadSopenharmony_ci
80095bd8deadSopenharmony_ci    #62, October 14, 2004:  jsandmel
80105bd8deadSopenharmony_ci        - more rewording and clarifications of issue (55) and (56)
80115bd8deadSopenharmony_ci
80125bd8deadSopenharmony_ci    #61, October 13, 2004:  jjuliano
80135bd8deadSopenharmony_ci        - Dramatically reword issues (55) and (56).
80145bd8deadSopenharmony_ci        - Add issue (68) addressing which levels are generated by
80155bd8deadSopenharmony_ci          GenerateMipmapEXT
80165bd8deadSopenharmony_ci
80175bd8deadSopenharmony_ci    #60, October 11, 2004:  jsandmel
80185bd8deadSopenharmony_ci        - revised write up of issue (56) to capture recent work group
80195bd8deadSopenharmony_ci          discussions about draw buffer state location
80205bd8deadSopenharmony_ci        - resolved issue (48) as per work group meeting Oct. 11, 2004
80215bd8deadSopenharmony_ci
80225bd8deadSopenharmony_ci    #59, October 11, 2004:  jjuliano
80235bd8deadSopenharmony_ci        - added note about possibly wanting to have explicit enable for
80245bd8deadSopenharmony_ci          framebuffer objects instead of using zero in section 4.2.1
80255bd8deadSopenharmony_ci        - cleaned up list of differences between framebuffer object and
80265bd8deadSopenharmony_ci          default framebuffer
80275bd8deadSopenharmony_ci        - separated out attach/detach cases in list of diffs between
80285bd8deadSopenharmony_ci          default framebuffer and framebuffer objects
80295bd8deadSopenharmony_ci        - added reminder note about invariance clause modifications
80305bd8deadSopenharmony_ci          for section 4.4.5
80315bd8deadSopenharmony_ci        - added reminder note about modifications for wgl spec
80325bd8deadSopenharmony_ci        - cleaned up language in issue (26) about reading from
80335bd8deadSopenharmony_ci          incomplete framebuffer
80345bd8deadSopenharmony_ci        - clarified resolution of issue (44) - texture from destination
80355bd8deadSopenharmony_ci        - replaced various instances of framebuffer "invalid" with
80365bd8deadSopenharmony_ci          framebuffer "incomplete"
80375bd8deadSopenharmony_ci        - other misc. typos, white space clean up
80385bd8deadSopenharmony_ci
80395bd8deadSopenharmony_ci    #58, October 8, 2004:  jsandmel, jjuliano
80405bd8deadSopenharmony_ci        - reopened and resolved issue (26) - incomplete framebuffer
80415bd8deadSopenharmony_ci          read is an error?
80425bd8deadSopenharmony_ci        - reopened, updated, and resolved issue (44) - "texture from
80435bd8deadSopenharmony_ci          destination" is undefined
80445bd8deadSopenharmony_ci        - marked issue (50) as resolved, since it basically was
80455bd8deadSopenharmony_ci        - updated and resolved issue (64) - incomplete framebuffer
80465bd8deadSopenharmony_ci          rendering is an error?
80475bd8deadSopenharmony_ci        - tentatively resolved issue (65) - name of error when
80485bd8deadSopenharmony_ci          trying to use an incomplete error
80495bd8deadSopenharmony_ci        - resolved issue (66) - clarified what state can
80505bd8deadSopenharmony_ci          cause framebuffer incompleteness
80515bd8deadSopenharmony_ci        - created issue (67) - name of ValidateFramebuffer
80525bd8deadSopenharmony_ci        - implemented preliminary draw buffer language in section 4.2.1
80535bd8deadSopenharmony_ci        - added more language in section 4.4.1 to describe differences
80545bd8deadSopenharmony_ci          between window-system and application-created framebuffers
80555bd8deadSopenharmony_ci        - updated "texture-from-destination" language in section 4.4.3
80565bd8deadSopenharmony_ci          to reflect new resolution of issue (44).
80575bd8deadSopenharmony_ci        - removed clause describing "texture from destination"
80585bd8deadSopenharmony_ci          constraints from framebuffer completeness test in section
80595bd8deadSopenharmony_ci          4.4.4.1 to reflect resolution of issue (44).
80605bd8deadSopenharmony_ci        - added list of operations which can change framebuffer
80615bd8deadSopenharmony_ci          completeness to section 4.4.4.2
80625bd8deadSopenharmony_ci        - Added language to section 4.4.4.3 indicating that rendering to
80635bd8deadSopenharmony_ci          or reading from an incomplete framebuffer is an error, as per
80645bd8deadSopenharmony_ci          resolution of issue (64) and (26)
80655bd8deadSopenharmony_ci        - Added more description of implementation dependent state which
80665bd8deadSopenharmony_ci          can change in section 4.4.5 and refer to framebuffer
80675bd8deadSopenharmony_ci          completeness section in 4.4.4.2 to identify when this state
80685bd8deadSopenharmony_ci          can change
80695bd8deadSopenharmony_ci        - added MAX_COLOR_ATTACHMENTS to list of state variables that
80705bd8deadSopenharmony_ci          might change if framebuffer state changes
80715bd8deadSopenharmony_ci        - added error conditions to queries when framebuffer zero or
80725bd8deadSopenharmony_ci          renderbuffer zero is bound (since there is no framebuffer
80735bd8deadSopenharmony_ci          zero or renderbuffer zero).
80745bd8deadSopenharmony_ci        - added placeholder for Additions to the AGL/GLX/WGL
80755bd8deadSopenharmony_ci          Specifications
80765bd8deadSopenharmony_ci        - fixed up misc. typos and whitespace
80775bd8deadSopenharmony_ci
80785bd8deadSopenharmony_ci    #57, October 1, 2004:  jjuliano
80795bd8deadSopenharmony_ci        - added additional discussion in issue (66)
80805bd8deadSopenharmony_ci        - fixed up misc. typos and whitespace
80815bd8deadSopenharmony_ci
80825bd8deadSopenharmony_ci    #56, September 29, 2004:  jsandmel
80835bd8deadSopenharmony_ci        - added additional option (d) to issue (66) as per our work
80845bd8deadSopenharmony_ci          group discussions on Sept 30, 2004.
80855bd8deadSopenharmony_ci
80865bd8deadSopenharmony_ci    #55, September 29, 2004:  jsandmel
80875bd8deadSopenharmony_ci        - added meta-issue (66) which deals with framebuffer
80885bd8deadSopenharmony_ci          completeness dependencies on the context state.
80895bd8deadSopenharmony_ci        - added section 4.4.5 about state variables which may change if
80905bd8deadSopenharmony_ci          framebuffer state changes.
80915bd8deadSopenharmony_ci        - dropped some redundant exposition in issue (55)
80925bd8deadSopenharmony_ci        - resolved issue (60) and wrote up the description of the issue
80935bd8deadSopenharmony_ci        - removed ACCUM_FORMAT from list of new enums per resolution of
80945bd8deadSopenharmony_ci          issue (40)
80955bd8deadSopenharmony_ci
80965bd8deadSopenharmony_ci    #54, September 27, 2004:  jsandmel
80975bd8deadSopenharmony_ci        - added issue (64) - error to render with incomplete framebuffer?
80985bd8deadSopenharmony_ci        - added issue (65) - what should the error be?
80995bd8deadSopenharmony_ci        - added note to ask if we need to reopen (26) about reading
81005bd8deadSopenharmony_ci          from invalid framebuffer in light of resolution of (64).
81015bd8deadSopenharmony_ci
81025bd8deadSopenharmony_ci    #53, September 17, 2004:  jsandmel
81035bd8deadSopenharmony_ci        - updated "attach" definition in glossary
81045bd8deadSopenharmony_ci        - fixed up some minor typos, whitespace issues
81055bd8deadSopenharmony_ci        - in issue (15)/(16) indicate tex state changes can affect
81065bd8deadSopenharmony_ci          framebuffer completeness, not just cause it to fail (they
81075bd8deadSopenharmony_ci          might cause it to succeed).
81085bd8deadSopenharmony_ci        - add clarification about the type of intrinsic buffers that
81095bd8deadSopenharmony_ci          were removed in issue (36)
81105bd8deadSopenharmony_ci        - updated language describing use of ACCUM format for textures
81115bd8deadSopenharmony_ci          in issue (40)
81125bd8deadSopenharmony_ci        - reworded reference to "billboarding" in issue (42)
81135bd8deadSopenharmony_ci        - clarified the draw buffer(s) issue (55) to indicate
81145bd8deadSopenharmony_ci          possible problems even after DrawBuffer(s) is called.
81155bd8deadSopenharmony_ci        - pacified some of the language surrounding issue (63) and the
81165bd8deadSopenharmony_ci          rationale for using ValidateFramebuffer or a GetInteger style
81175bd8deadSopenharmony_ci          query.
81185bd8deadSopenharmony_ci
81195bd8deadSopenharmony_ci    #52, September 17, 2004:  jjuliano
81205bd8deadSopenharmony_ci        - edits based on review of a subset of the issues section
81215bd8deadSopenharmony_ci        - edits to the diffs from version #51
81225bd8deadSopenharmony_ci        - added note to overview comparing render-to-texture to
81235bd8deadSopenharmony_ci          CopyTexImage
81245bd8deadSopenharmony_ci        - added "attach" term to glossary section
81255bd8deadSopenharmony_ci        - replaced ARB's with EXT's in issue (1)
81265bd8deadSopenharmony_ci        - distinguished between bind and attach in isuse (5)
81275bd8deadSopenharmony_ci        - various replacements of "texture" with "texture image"
81285bd8deadSopenharmony_ci        - various replacements of "framebufer (in)valid" language with
81295bd8deadSopenharmony_ci          framebuffer (in)completeness language
81305bd8deadSopenharmony_ci        - added additional rationale to issue (18) about framebuffer
81315bd8deadSopenharmony_ci          renderable image attachment
81325bd8deadSopenharmony_ci        - clarified issue (27) that the resolution is no error is
81335bd8deadSopenharmony_ci          generated
81345bd8deadSopenharmony_ci        - added note to issue (40) that we might want to use ACCUM
81355bd8deadSopenharmony_ci          format for textures
81365bd8deadSopenharmony_ci        - added description of complications with having draw and read
81375bd8deadSopenharmony_ci          framebuffer targets in issue (42)
81385bd8deadSopenharmony_ci        - added additional language describing issue (63) concerning the
81395bd8deadSopenharmony_ci          reasons for using ValidateFramebuffer versus the reasons for
81405bd8deadSopenharmony_ci          using an explicit query API for framebuffer completeness.
81415bd8deadSopenharmony_ci
81425bd8deadSopenharmony_ci    #51, September 16, 2004:  jsandmel
81435bd8deadSopenharmony_ci        - resolved issue (26) - reading from incomplete framebuffer
81445bd8deadSopenharmony_ci        - clarified issue (55) - draw buffer set to non-existent buffer
81455bd8deadSopenharmony_ci        - added issue (63) - should we make ValidateFramebuffer a query?
81465bd8deadSopenharmony_ci        - marked issue (46) as resolved, since there's not much left to
81475bd8deadSopenharmony_ci          do except resolve the minimum requirements issue (61).
81485bd8deadSopenharmony_ci
81495bd8deadSopenharmony_ci    #50, September 16, 2004:  jjuliano
81505bd8deadSopenharmony_ci        - edits based on version #49 diffs, as well as...
81515bd8deadSopenharmony_ci        - replace uses of "fail ValidateFramebuffer" with references to
81525bd8deadSopenharmony_ci          "framebuffer completeness"
81535bd8deadSopenharmony_ci        - reformat whitespace of some very long and very indented issues
81545bd8deadSopenharmony_ci        - remove "MERGE from some other proposed API" comments
81555bd8deadSopenharmony_ci
81565bd8deadSopenharmony_ci    #49, September 16, 2004:  jsandmel
81575bd8deadSopenharmony_ci        - added DeleteTexture and DeleteRenderbuffers spec language to
81585bd8deadSopenharmony_ci          describe detaching from framebuffers first
81595bd8deadSopenharmony_ci        - added place holders in various places to correspond
81605bd8deadSopenharmony_ci          with lots of resolved issues
81615bd8deadSopenharmony_ci        - added stencil S format table
81625bd8deadSopenharmony_ci        - renamed section 4.4.3
81635bd8deadSopenharmony_ci        - clarified framebuffer attachment and renderable image
81645bd8deadSopenharmony_ci          requirements for completeness
81655bd8deadSopenharmony_ci        - added requirement to completeness to have all
81665bd8deadSopenharmony_ci          color attachments with the same format
81675bd8deadSopenharmony_ci        - added  missing write ups for various issues (8), (9), (12)
81685bd8deadSopenharmony_ci        - in issue (40), clarified that accum language from 1.5 spec
81695bd8deadSopenharmony_ci          already covers the error behavior we need to defer accum support
81705bd8deadSopenharmony_ci        - in issue (41), clarified multisample language from 1.5 could
81715bd8deadSopenharmony_ci          cover the behavior we need to defer multisample support if we
81725bd8deadSopenharmony_ci          set SAMPLE_BUFFERS to 0 for non-default framebuffers
81735bd8deadSopenharmony_ci
81745bd8deadSopenharmony_ci    #48, September 15, 2004:  jjuliano
81755bd8deadSopenharmony_ci        - edits based on review of chapter 4.
81765bd8deadSopenharmony_ci
81775bd8deadSopenharmony_ci    #47, September 15, 2004:  jjuliano
81785bd8deadSopenharmony_ci        - edits based on review of all sections except for chapter 4,
81795bd8deadSopenharmony_ci          Issues.
81805bd8deadSopenharmony_ci        - clarified, reordered overview
81815bd8deadSopenharmony_ci        - added missing enums for framebuffer attachment point state
81825bd8deadSopenharmony_ci          queries to list of new enums
81835bd8deadSopenharmony_ci        - indicated that GenerateMipmap will only generate
81845bd8deadSopenharmony_ci          levels base through q instead of base through p
81855bd8deadSopenharmony_ci
81865bd8deadSopenharmony_ci    #46, September 15, 2004:  jjuliano
81875bd8deadSopenharmony_ci        - move issues section to end of document.
81885bd8deadSopenharmony_ci          (issues section accounts for >50% of the document!)
81895bd8deadSopenharmony_ci
81905bd8deadSopenharmony_ci    #45, September 13, 2004:  jsandmel, jjuliano
81915bd8deadSopenharmony_ci        - typos and white space updates
81925bd8deadSopenharmony_ci        - clarified language about the framebuffer object bound to <target>
81935bd8deadSopenharmony_ci          in section 4.4.4.2
81945bd8deadSopenharmony_ci        - clarified isssue (62) on which state can change and when
81955bd8deadSopenharmony_ci
81965bd8deadSopenharmony_ci    #44, September 13, 2004:  jsandmel
81975bd8deadSopenharmony_ci        - resolved issue (40) accum buffers - deferred per group
81985bd8deadSopenharmony_ci          decision
81995bd8deadSopenharmony_ci        - resolved issue (41) multisample buffers - deferred per group
82005bd8deadSopenharmony_ci          decision
82015bd8deadSopenharmony_ci        - resolved issue (57) maximum attachable color buffers query per
82025bd8deadSopenharmony_ci          group decision
82035bd8deadSopenharmony_ci        - opened issue (62) which queries can change state after
82045bd8deadSopenharmony_ci          BindFramebuffer
82055bd8deadSopenharmony_ci
82065bd8deadSopenharmony_ci    #43, September 13, 2004:  jsandmel, jjuliano
82075bd8deadSopenharmony_ci        - typos, cleanup
82085bd8deadSopenharmony_ci        - fixed up use of COLOR/AUX/DATAN to use lower n as GL spec.
82095bd8deadSopenharmony_ci        - clarified definitions of color/depth renderable
82105bd8deadSopenharmony_ci        - indicate renderable images don't have to be attached to be
82115bd8deadSopenharmony_ci          "renderable image complete"
82125bd8deadSopenharmony_ci        - replaced requirement on texture images that they simply need
82135bd8deadSopenharmony_ci          non-zero dimensions instead of saying they have been "defined"
82145bd8deadSopenharmony_ci          already
82155bd8deadSopenharmony_ci
82165bd8deadSopenharmony_ci    #42, September 13, 2004:  jsandmel
82175bd8deadSopenharmony_ci        - updated Framebuffer validation language
82185bd8deadSopenharmony_ci        - added "complete" terms to glossary in overview
82195bd8deadSopenharmony_ci
82205bd8deadSopenharmony_ci    #41, September 9, 2004:  jjuliano
82215bd8deadSopenharmony_ci        - re-add and rewrite section 4.4.4 on "Framebuffer
82225bd8deadSopenharmony_ci          Validation"
82235bd8deadSopenharmony_ci
82245bd8deadSopenharmony_ci    #40, September 9, 2004:  jsandmel
82255bd8deadSopenharmony_ci        - fixed extra "GL" typos noted by Brian Paul
82265bd8deadSopenharmony_ci        - resolved issue (54) - color attachment names
82275bd8deadSopenharmony_ci        - resolved issue (58) - textures with borders
82285bd8deadSopenharmony_ci        - resolved issue (59) - stencil formats
82295bd8deadSopenharmony_ci        - added issue (61) - minimum requirements
82305bd8deadSopenharmony_ci
82315bd8deadSopenharmony_ci    #39, September 9, 2004:  jsandmel, jjuliano
82325bd8deadSopenharmony_ci        - misc. typos and white space fixed
82335bd8deadSopenharmony_ci
82345bd8deadSopenharmony_ci    #38, September 8, 2004:  jsandmel, jjuliano
82355bd8deadSopenharmony_ci        - clarifed section 4.4.3 to indicate that if mipmapping
82365bd8deadSopenharmony_ci          disabled, the framebuffer texture attachment rules are
82375bd8deadSopenharmony_ci          slightly different.
82385bd8deadSopenharmony_ci        - fleshed out multisample buffer support options for
82395bd8deadSopenharmony_ci          issue (41) after more discussions
82405bd8deadSopenharmony_ci
82415bd8deadSopenharmony_ci    #37, September 8, 2004:  jsandmel
82425bd8deadSopenharmony_ci        - renamed attachment enums again to add FRAMEBUFFER_ on the
82435bd8deadSopenharmony_ci          front to further qualify their namespace.
82445bd8deadSopenharmony_ci        - updated table of attachment point state to include default
82455bd8deadSopenharmony_ci          values
82465bd8deadSopenharmony_ci        - added language to "Texturing From an Attached Renderable
82475bd8deadSopenharmony_ci          Image" (section 4.4.3)
82485bd8deadSopenharmony_ci
82495bd8deadSopenharmony_ci    #36, September 8, 2004:  jjuliano
82505bd8deadSopenharmony_ci        - update chapter 3 language on mipmap generation
82515bd8deadSopenharmony_ci        - modify example 5 to not use depth buffer when
82525bd8deadSopenharmony_ci          custom-generating mipmap
82535bd8deadSopenharmony_ci        - add issue 60 on whether or not disabled depth attachment
82545bd8deadSopenharmony_ci          factors into framebuffer validity determination
82555bd8deadSopenharmony_ci
82565bd8deadSopenharmony_ci    #35, September 7, 2004:  jsandmel
82575bd8deadSopenharmony_ci        - updated chapter 6 language on querying renderbuffer and
82585bd8deadSopenharmony_ci          framebuffer attachment state.
82595bd8deadSopenharmony_ci        - made references to "id 0" into "name zero" for easier
82605bd8deadSopenharmony_ci          searching and consistency with core GL spec
82615bd8deadSopenharmony_ci        - renamed the enums for framebuffer attachment state to add
82625bd8deadSopenharmony_ci          "ATTACHMENT" to each to qualify the name space of the enums.
82635bd8deadSopenharmony_ci          These might not be the final names.
82645bd8deadSopenharmony_ci
82655bd8deadSopenharmony_ci    #34, September 7, 2004:  jsandmel, jjuliano
82665bd8deadSopenharmony_ci        - further clarified framebuffer attachment language
82675bd8deadSopenharmony_ci        - specify that attachment routines set "rest" of
82685bd8deadSopenharmony_ci          attachment state to default values
82695bd8deadSopenharmony_ci
82705bd8deadSopenharmony_ci    #33, September 7, 2004:  jsandmel
82715bd8deadSopenharmony_ci        - added examples to issue (54) about framebuffer attachment names
82725bd8deadSopenharmony_ci
82735bd8deadSopenharmony_ci    #32, September 7, 2004:  jsandmel
82745bd8deadSopenharmony_ci        - further clarified framebuffer attachment language
82755bd8deadSopenharmony_ci
82765bd8deadSopenharmony_ci    #31, September 3, 2004:  jsandmel
82775bd8deadSopenharmony_ci        - added issue (58) about texture borders
82785bd8deadSopenharmony_ci        - added issue (59) about stencil internal formats
82795bd8deadSopenharmony_ci        - updated new tokens section to reflect recent issue resolutions
82805bd8deadSopenharmony_ci        - added attachment state table to section 4.4.2
82815bd8deadSopenharmony_ci        - added langauge describing renderbuffer and texture attachment
82825bd8deadSopenharmony_ci          routines
82835bd8deadSopenharmony_ci
82845bd8deadSopenharmony_ci    #30, September 3, 2004:  jjuliano
82855bd8deadSopenharmony_ci        - more typos and white space cleanup
82865bd8deadSopenharmony_ci        - issue (46): make it clear that validation failure occurs
82875bd8deadSopenharmony_ci          because of a mismatch in dimensions, rather than size
82885bd8deadSopenharmony_ci        - clarified language on draw buffer error semantics in issue
82895bd8deadSopenharmony_ci          (55)
82905bd8deadSopenharmony_ci        - included more language describing issue (57) about querying
82915bd8deadSopenharmony_ci          for max number of attachable drawbuffers.
82925bd8deadSopenharmony_ci
82935bd8deadSopenharmony_ci    #29, September 2, 2004:  jsandmel, jjuliano
82945bd8deadSopenharmony_ci        - typos fixed and whitespace clean up
82955bd8deadSopenharmony_ci        - factored issue (39) on ARB_draw_buffers into separate
82965bd8deadSopenharmony_ci          issues (53), (54), (55), (56), (57)
82975bd8deadSopenharmony_ci        - fleshed out issue (40) - on ACCUM buffers, tentatively
82985bd8deadSopenharmony_ci          we will support this if there is time
82995bd8deadSopenharmony_ci        - made a few ValidationFailures in isseu (46) more
83005bd8deadSopenharmony_ci          explicit
83015bd8deadSopenharmony_ci        - added issue (53) - indirection for ARB_draw_buffers?
83025bd8deadSopenharmony_ci        - added issue (54) - name of color attachment points?
83035bd8deadSopenharmony_ci        - added issue (55) - error behavior for DRAW_BUFFER
83045bd8deadSopenharmony_ci        - added issue (56) - is DRAW_BUFFER context state or framebuffer
83055bd8deadSopenharmony_ci          state?
83065bd8deadSopenharmony_ci
83075bd8deadSopenharmony_ci    #28, September 2, 2004:  jsandmel
83085bd8deadSopenharmony_ci        - Improve language describing framebuffer and renderbuffer
83095bd8deadSopenharmony_ci          objects
83105bd8deadSopenharmony_ci
83115bd8deadSopenharmony_ci    #27, August 26, 2004:  jsandmel, jjuliano
83125bd8deadSopenharmony_ci        - re-resolved issue (11) - we use 3 framebuffer attachment
83135bd8deadSopenharmony_ci          routines for textures, 1 for renderbuffers, also cleaned up
83145bd8deadSopenharmony_ci          the rationale language for this choice
83155bd8deadSopenharmony_ci        - resolved issue (30) - renderbuffer state routines take a target
83165bd8deadSopenharmony_ci        - resolved issue (42) - we use a single framebuffer target enum
83175bd8deadSopenharmony_ci        - resolved issue (43) - incomplete attached textures will
83185bd8deadSopenharmony_ci          not cause ValidateFramebuffer failures
83195bd8deadSopenharmony_ci        - resolved issue (45) - framebuffers with no color buffer attached
83205bd8deadSopenharmony_ci          will be allowed
83215bd8deadSopenharmony_ci        - deferred and expanded issue (48) - what info should
83225bd8deadSopenharmony_ci          ValidateFramebuffer return.
83235bd8deadSopenharmony_ci        - resolved issue (51) - use individual queries for attachment
83245bd8deadSopenharmony_ci          state
83255bd8deadSopenharmony_ci        - resolve issue (52) - auto and manual mipmap generation
83265bd8deadSopenharmony_ci          can peacefully coexist
83275bd8deadSopenharmony_ci        - deleted obsolete mipmap generation language from spec text
83285bd8deadSopenharmony_ci          as this needs to be reworked anyway
83295bd8deadSopenharmony_ci
83305bd8deadSopenharmony_ci    #26, August 26, 2004:  jsandmel
83315bd8deadSopenharmony_ci        - corrected some depth_offset --> image terms, since that
83325bd8deadSopenharmony_ci          is the current resolution of issue (28), unless we reopen it.
83335bd8deadSopenharmony_ci        - clean up issue (11) language
83345bd8deadSopenharmony_ci        - moved query of attachments api sub issue from (34) to
83355bd8deadSopenharmony_ci          its own issue (51)
83365bd8deadSopenharmony_ci        - removed obsolete note on issue (44)
83375bd8deadSopenharmony_ci        - fleshed out another alternative attachment query API in issue
83385bd8deadSopenharmony_ci          (51)
83395bd8deadSopenharmony_ci        - created issue (52) on when auto/manual mip generation applies
83405bd8deadSopenharmony_ci        - began more spec language edits to mip generation and framebuffer
83415bd8deadSopenharmony_ci          object definition (this may be throwaway language depending
83425bd8deadSopenharmony_ci          on the resolution of some outstanding issues)
83435bd8deadSopenharmony_ci
83445bd8deadSopenharmony_ci    #25, August 24, 2004:  jjuliano
83455bd8deadSopenharmony_ci        - Fill in chapter 4.
83465bd8deadSopenharmony_ci        - Replace some references to "logical buffer" with
83475bd8deadSopenharmony_ci          "renderbuffer".
83485bd8deadSopenharmony_ci        - Modification to issue (44).
83495bd8deadSopenharmony_ci        - Incorporate feedback from Eric Werness: improvements to
83505bd8deadSopenharmony_ci          examples.
83515bd8deadSopenharmony_ci        - Incorporate feedback from Jason Allen: issue (42) option D
83525bd8deadSopenharmony_ci          (GL_FRAMEBUFFER_EXT), and removal of FramebufferBuf.
83535bd8deadSopenharmony_ci
83545bd8deadSopenharmony_ci    #24, August 23, 2004:  jjuliano
83555bd8deadSopenharmony_ci        - First stab at text for additions to chapters 2, 3, and 5.
83565bd8deadSopenharmony_ci        - Fill in examples 1-5.
83575bd8deadSopenharmony_ci        - Add description of GetFramebufferBufferParametervEXT to
83585bd8deadSopenharmony_ci          chapter 6.
83595bd8deadSopenharmony_ci        - Add EXT suffix in some places it was missing.
83605bd8deadSopenharmony_ci
83615bd8deadSopenharmony_ci    #23, August 20, 2004:  jjuliano
83625bd8deadSopenharmony_ci        - fix minor typos
83635bd8deadSopenharmony_ci        - added additional comments regarding reopened issue (11)
83645bd8deadSopenharmony_ci        - changed some references from z-slice to depth offset
83655bd8deadSopenharmony_ci
83665bd8deadSopenharmony_ci    #22, August 19, 2004:  jsandmel
83675bd8deadSopenharmony_ci        - reopened and expanded the options for issue (11) about one vs
83685bd8deadSopenharmony_ci          many FramebufferTexture attachment routines
83695bd8deadSopenharmony_ci        - clarified issue (16) does not imply that texture/renderbuffer
83705bd8deadSopenharmony_ci          state updates are delayed on attached renderable images
83715bd8deadSopenharmony_ci        - clarified issue (21) to not specifically imply that a call
83725bd8deadSopenharmony_ci          to BindFramebuffer is required to delete a renderable image
83735bd8deadSopenharmony_ci          attached to a framebuffer.
83745bd8deadSopenharmony_ci        - resolved issue (28) "slices" are now referred to as "images"
83755bd8deadSopenharmony_ci        - resolved issue (29) - GenerateMipmap is included in this
83765bd8deadSopenharmony_ci          extension
83775bd8deadSopenharmony_ci        - added and resolved issue (49) - MRT of different formats are
83785bd8deadSopenharmony_ci          not supported
83795bd8deadSopenharmony_ci        - added issue (50) - meta issue about whether async generation
83805bd8deadSopenharmony_ci          of GL errors should be avoided in this api.
83815bd8deadSopenharmony_ci
83825bd8deadSopenharmony_ci    #21, August 19, 2004:  jsandmel
83835bd8deadSopenharmony_ci        - incorporated feedback from Barthold (typos fixed)
83845bd8deadSopenharmony_ci        - incorporated feedback from Barthold (ARB_compromise_buffers->EXT_framebuffer_object)
83855bd8deadSopenharmony_ci        - incorporated feedback from Barthold (slice->image)
83865bd8deadSopenharmony_ci        - incorporated feedback from Barthold (other ARB->EXT changes)
83875bd8deadSopenharmony_ci
83885bd8deadSopenharmony_ci    #20, August 19, 2004:  jjuliano
83895bd8deadSopenharmony_ci        - fill in issue (13) and (36) - intrinsic buffers
83905bd8deadSopenharmony_ci
83915bd8deadSopenharmony_ci    #19, August 18, 2004:  jjuliano
83925bd8deadSopenharmony_ci        - fixed minor typos in issue (15)
83935bd8deadSopenharmony_ci        - further clarified design rationale in issue (16)
83945bd8deadSopenharmony_ci
83955bd8deadSopenharmony_ci    #18, August 18, 2004:  jjuliano, jsandmel
83965bd8deadSopenharmony_ci        - cleaned up  language for issues (15) and (16)
83975bd8deadSopenharmony_ci
83985bd8deadSopenharmony_ci    #17, August 18, 2004: jsandmel
83995bd8deadSopenharmony_ci        - cleaned up stale references to ARB_compromise_buffers.
84005bd8deadSopenharmony_ci        - resolved issues (1) - extension name
84015bd8deadSopenharmony_ci        - resolved issues (15) - {Copy}TexImage behavior on current framebuffer
84025bd8deadSopenharmony_ci        - resolved issues (16) - {Copy}TexImage behavior on non-current framebuffer
84035bd8deadSopenharmony_ci        - (re)resolved issues (21) - Delete object behavior on attached objects
84045bd8deadSopenharmony_ci        - resolved issues (22) - 1 or 2 detach objects routines
84055bd8deadSopenharmony_ci        - resolved issues (25) - query on invalid framebuffers
84065bd8deadSopenharmony_ci        - cleaned up issue (34) language on attachment query API
84075bd8deadSopenharmony_ci
84085bd8deadSopenharmony_ci    #16, August 18, 2004: jsandmel
84095bd8deadSopenharmony_ci        - renamed EXT_framebuffer_object as per group decision
84105bd8deadSopenharmony_ci
84115bd8deadSopenharmony_ci    #15, August 8, 2004: jsandmel
84125bd8deadSopenharmony_ci        - fixed minor typos found by jeff
84135bd8deadSopenharmony_ci        - expanded discussion on issue (20) to distinguish
84145bd8deadSopenharmony_ci          width/height/format of texture is mutable unlike texture
84155bd8deadSopenharmony_ci          target as suggested by jeff
84165bd8deadSopenharmony_ci
84175bd8deadSopenharmony_ci    #14, August 5, 2004: jsandmel
84185bd8deadSopenharmony_ci        - In several issues, make sure ask the same questions about
84195bd8deadSopenharmony_ci          renderbuffers when we are talking about textures.  We want to
84205bd8deadSopenharmony_ci          resolve these issues symmetrically in almost all cases.
84215bd8deadSopenharmony_ci        - resolved issue (19) about unused texture/renderbuffer names
84225bd8deadSopenharmony_ci        - resolved issue (20) about attaching default state objects to
84235bd8deadSopenharmony_ci          framebuffers
84245bd8deadSopenharmony_ci        - resolved issue (21) about deleting attached texture/renderbuffer
84255bd8deadSopenharmony_ci          objects
84265bd8deadSopenharmony_ci        - fixed typo indicating when issue (33) was resolved
84275bd8deadSopenharmony_ci        - resolved issue (34) about querying framebuffer objects
84285bd8deadSopenharmony_ci          for attachments
84295bd8deadSopenharmony_ci        - resolved issue (44) about using a texture object as a source
84305bd8deadSopenharmony_ci          texture and destination renderable image
84315bd8deadSopenharmony_ci        - resolved issue (47) about delineating exactly which state
84325bd8deadSopenharmony_ci          modifying routines can cause framebuffer revalidation
84335bd8deadSopenharmony_ci        - added issue (48) about the returned information from
84345bd8deadSopenharmony_ci          ValidateFramebuffer().
84355bd8deadSopenharmony_ci
84365bd8deadSopenharmony_ci    #13, August 3, 2004: jsandmel
84375bd8deadSopenharmony_ci        - added related issue in issue (44) - we need to consider
84385bd8deadSopenharmony_ci          texture objects bound to different targets on the same unit
84395bd8deadSopenharmony_ci          not just currently bound texture, when calculating
84405bd8deadSopenharmony_ci          source/destionation circuits.
84415bd8deadSopenharmony_ci        - in issue (44), option (b), indicate a possibly variant is
84425bd8deadSopenharmony_ci          to allow but not require ValidateFramebuffer to fail
84435bd8deadSopenharmony_ci        - cleaned up the "must fail" and "can fail" cases in
84445bd8deadSopenharmony_ci          issue (46).
84455bd8deadSopenharmony_ci        - added issue (47) - do we need to list exactly which
84465bd8deadSopenharmony_ci          state modification routines can cause ValidateFramebuffer
84475bd8deadSopenharmony_ci          to change its answer?
84485bd8deadSopenharmony_ci
84495bd8deadSopenharmony_ci    #12, August 3, 2004: jsandmel
84505bd8deadSopenharmony_ci        - added issue about when validation failures "can" occur vs. "must"
84515bd8deadSopenharmony_ci          occur.
84525bd8deadSopenharmony_ci
84535bd8deadSopenharmony_ci    #11, August 2, 2004: jsandmel
84545bd8deadSopenharmony_ci        - removed non-contact emails from contributor list
84555bd8deadSopenharmony_ci        - "methodology" -> "model" in issue (7)
84565bd8deadSopenharmony_ci        - resolved issues (31,32,33), there is no renderbuffer name zero,
84575bd8deadSopenharmony_ci          and binding/attaching to it simply unbinds/detaches the previously
84585bd8deadSopenharmony_ci          bound/attached object.
84595bd8deadSopenharmony_ci        - added issue (44) about using the same texture object as both
84605bd8deadSopenharmony_ci          a source and destination
84615bd8deadSopenharmony_ci        - added issue (45) about scenarios where having no renderable
84625bd8deadSopenharmony_ci          image attached to the color buffer attachment point might be
84635bd8deadSopenharmony_ci          acceptable
84645bd8deadSopenharmony_ci
84655bd8deadSopenharmony_ci    #10, July 30, 2004: jjuliano
84665bd8deadSopenharmony_ci        - flesh out details of issue (29) about GenerateMipmap
84675bd8deadSopenharmony_ci        - add issue (43) about mipmap cube complete textures and
84685bd8deadSopenharmony_ci          framebuffer consistency check.
84695bd8deadSopenharmony_ci
84705bd8deadSopenharmony_ci    #9, July 30, 2004: jsandmel
84715bd8deadSopenharmony_ci        - renumbered issues to account for remaval and addition of issues
84725bd8deadSopenharmony_ci        - dropped issue [used to be (14)] as it was a duplicate of issue
84735bd8deadSopenharmony_ci          [now (38)] about support for multiple render targets.
84745bd8deadSopenharmony_ci        - added issue (32) about  whether and how to support a
84755bd8deadSopenharmony_ci          renderbuffer with the name zero (is it an object?)
84765bd8deadSopenharmony_ci
84775bd8deadSopenharmony_ci    #8, July 30, 2004: jjuliano
84785bd8deadSopenharmony_ci        - tightened up language in overview regarding use of renderable
84795bd8deadSopenharmony_ci          images
84805bd8deadSopenharmony_ci        - clarified in overview that window and framebuffer can
84815bd8deadSopenharmony_ci          have different formats
84825bd8deadSopenharmony_ci        - fixed various typos, grammar, spelling errors
84835bd8deadSopenharmony_ci        - indicated we should drop issue (14) about MRT, same as issue (37)
84845bd8deadSopenharmony_ci        - indicate -1 is one option for return value on nonsense queries
84855bd8deadSopenharmony_ci          of non-validated framebuffer state
84865bd8deadSopenharmony_ci
84875bd8deadSopenharmony_ci    #7, July 29, 2004: jsandmel
84885bd8deadSopenharmony_ci        - add some more terms to the glossary list
84895bd8deadSopenharmony_ci        - white space and various grammar clean ups (minor)
84905bd8deadSopenharmony_ci        - note that we need resolution on the switch from
84915bd8deadSopenharmony_ci          "render target" to "renderable image"
84925bd8deadSopenharmony_ci        - cleaned up language for issue (31) and (32)
84935bd8deadSopenharmony_ci
84945bd8deadSopenharmony_ci    #6, July 29, 2004: jsandmel
84955bd8deadSopenharmony_ci        - reworked, clarified, streamlined overview section to read better
84965bd8deadSopenharmony_ci        - cleaned up some white space problems
84975bd8deadSopenharmony_ci
84985bd8deadSopenharmony_ci    #5, July 29, 2004: jsandmel
84995bd8deadSopenharmony_ci        - fixed bad numbering in issues list
85005bd8deadSopenharmony_ci
85015bd8deadSopenharmony_ci    #4, July 29, 2004: jsandmel
85025bd8deadSopenharmony_ci        - cleaned up issues after incorporating feedback
85035bd8deadSopenharmony_ci
85045bd8deadSopenharmony_ci    #3, July 28, 2004: jsandmel
85055bd8deadSopenharmony_ci        - began merging render target and compromise buffers issues lists
85065bd8deadSopenharmony_ci        - added contributors from EXT_render_target list
85075bd8deadSopenharmony_ci        - added some extension dependencies
85085bd8deadSopenharmony_ci        - borrowed overview from EXT_render_target, reworded to
85095bd8deadSopenharmony_ci          make more appropriate for differences with this spec
85105bd8deadSopenharmony_ci        - added placeholders for sample code
85115bd8deadSopenharmony_ci        - resolved a few issues here
85125bd8deadSopenharmony_ci        - removed intrinsic buffers per group decision july 26,2004
85135bd8deadSopenharmony_ci        - retained framebuffer objects per group decision july 26,2004
85145bd8deadSopenharmony_ci        - made FramebufferTexture into 3 functions per group decision july 26, 2004
85155bd8deadSopenharmony_ci
85165bd8deadSopenharmony_ci    #2, July 22, 2004: jsandmel
85175bd8deadSopenharmony_ci        - removed all old EXT-compromise_buffer language, but
85185bd8deadSopenharmony_ci          some of this will get reformed and added back in
85195bd8deadSopenharmony_ci        - removed example temporarily, again this will get reformed and
85205bd8deadSopenharmony_ci          added back in.
85215bd8deadSopenharmony_ci        - LogicalBuffer renamed to "Renderbuffer"
85225bd8deadSopenharmony_ci        - began fleshing out issues list
85235bd8deadSopenharmony_ci
85245bd8deadSopenharmony_ci    #1, July 22, 2004: jsandmel
85255bd8deadSopenharmony_ci        - very first revision
85265bd8deadSopenharmony_ci        - derived from EXT_compromise_buffers but really a mishmash of
85275bd8deadSopenharmony_ci          all the proposals under discussion
8528