15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    EXT_framebuffer_multisample
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_EXT_framebuffer_multisample
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContributors
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Pat Brown
125bd8deadSopenharmony_ci    Michael Gold
135bd8deadSopenharmony_ci    Evan Hart
145bd8deadSopenharmony_ci    Jeff Juliano
155bd8deadSopenharmony_ci    Jon Leech
165bd8deadSopenharmony_ci    Bill Licea-Kane
175bd8deadSopenharmony_ci    Barthold Lichtenbelt
185bd8deadSopenharmony_ci    Kent Lin
195bd8deadSopenharmony_ci    Ian Romanick
205bd8deadSopenharmony_ci    John Rosasco
215bd8deadSopenharmony_ci    Jeremy Sandmel
225bd8deadSopenharmony_ci
235bd8deadSopenharmony_ciContacts
245bd8deadSopenharmony_ci
255bd8deadSopenharmony_ci    Jeff Juliano, NVIDIA Corporation (jjuliano 'at' nvidia.com)
265bd8deadSopenharmony_ci    Jeremy Sandmel, Apple Computer (jsandmel 'at' apple.com)
275bd8deadSopenharmony_ci
285bd8deadSopenharmony_ciStatus
295bd8deadSopenharmony_ci
305bd8deadSopenharmony_ci    Complete
315bd8deadSopenharmony_ci    Approved by the ARB "superbuffers" Working Group on November 8, 2005
325bd8deadSopenharmony_ci
335bd8deadSopenharmony_ciVersion
345bd8deadSopenharmony_ci
355bd8deadSopenharmony_ci    Last Modified Date: January 10, 2007
365bd8deadSopenharmony_ci    Revision: #7
375bd8deadSopenharmony_ci
385bd8deadSopenharmony_ciNumber
395bd8deadSopenharmony_ci
405bd8deadSopenharmony_ci    317
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ciDependencies
435bd8deadSopenharmony_ci
445bd8deadSopenharmony_ci    Requires GL_EXT_framebuffer_object.
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ci    Requires GL_EXT_framebuffer_blit.
475bd8deadSopenharmony_ci
485bd8deadSopenharmony_ci    Written based on the wording of the OpenGL 1.5 specification.
495bd8deadSopenharmony_ci
505bd8deadSopenharmony_ciOverview
515bd8deadSopenharmony_ci
525bd8deadSopenharmony_ci    This extension extends the EXT_framebuffer_object framework to
535bd8deadSopenharmony_ci    enable multisample rendering.
545bd8deadSopenharmony_ci
555bd8deadSopenharmony_ci    The new operation RenderbufferStorageMultisampleEXT() allocates
565bd8deadSopenharmony_ci    storage for a renderbuffer object that can be used as a multisample
575bd8deadSopenharmony_ci    buffer.  A multisample render buffer image differs from a
585bd8deadSopenharmony_ci    single-sample render buffer image in that a multisample image has a
595bd8deadSopenharmony_ci    number of SAMPLES that is greater than zero.  No method is provided
605bd8deadSopenharmony_ci    for creating multisample texture images.
615bd8deadSopenharmony_ci
625bd8deadSopenharmony_ci    All of the framebuffer-attachable images attached to a framebuffer
635bd8deadSopenharmony_ci    object must have the same number of SAMPLES or else the framebuffer
645bd8deadSopenharmony_ci    object is not "framebuffer complete".  If a framebuffer object with
655bd8deadSopenharmony_ci    multisample attachments is "framebuffer complete", then the
665bd8deadSopenharmony_ci    framebuffer object behaves as if SAMPLE_BUFFERS is one.
675bd8deadSopenharmony_ci
685bd8deadSopenharmony_ci    In traditional multisample rendering, where
695bd8deadSopenharmony_ci    DRAW_FRAMEBUFFER_BINDING_EXT is zero and SAMPLE_BUFFERS is one, the
705bd8deadSopenharmony_ci    GL spec states that "the color sample values are resolved to a
715bd8deadSopenharmony_ci    single, displayable color each time a pixel is updated."  There are,
725bd8deadSopenharmony_ci    however, several modern hardware implementations that do not
735bd8deadSopenharmony_ci    actually resolve for each sample update, but instead postpones the
745bd8deadSopenharmony_ci    resolve operation to a later time and resolve a batch of sample
755bd8deadSopenharmony_ci    updates at a time.  This is OK as long as the implementation behaves
765bd8deadSopenharmony_ci    "as if" it had resolved a sample-at-a-time. Unfortunately, however,
775bd8deadSopenharmony_ci    honoring the "as if" rule can sometimes degrade performance.
785bd8deadSopenharmony_ci
795bd8deadSopenharmony_ci    In contrast, when DRAW_FRAMEBUFFER_BINDING_EXT is an
805bd8deadSopenharmony_ci    application-created framebuffer object, MULTISAMPLE is enabled, and
815bd8deadSopenharmony_ci    SAMPLE_BUFFERS is one, there is no implicit per-sample-update
825bd8deadSopenharmony_ci    resolve.  Instead, the application explicitly controls when the
835bd8deadSopenharmony_ci    resolve operation is performed.  The resolve operation is affected
845bd8deadSopenharmony_ci    by calling BlitFramebufferEXT (provided by the EXT_framebuffer_blit
855bd8deadSopenharmony_ci    extension) where the source is a multisample application-created
865bd8deadSopenharmony_ci    framebuffer object and the destination is a single-sample
875bd8deadSopenharmony_ci    framebuffer object (either application-created or window-system
885bd8deadSopenharmony_ci    provided).
895bd8deadSopenharmony_ci
905bd8deadSopenharmony_ci    This design for multisample resolve more closely matches current
915bd8deadSopenharmony_ci    hardware, but still permits implementations which choose to resolve
925bd8deadSopenharmony_ci    a single sample at a time.  If hardware that implementes the
935bd8deadSopenharmony_ci    multisample resolution "one sample at a time" exposes
945bd8deadSopenharmony_ci    EXT_framebuffer_multisample, it could perform the implicit resolve
955bd8deadSopenharmony_ci    to a driver-managed hidden surface, then read from that surface when
965bd8deadSopenharmony_ci    the application calls BlitFramebufferEXT.
975bd8deadSopenharmony_ci
985bd8deadSopenharmony_ci    Another motivation for granting the application explicit control
995bd8deadSopenharmony_ci    over the multisample resolve operation has to do with the
1005bd8deadSopenharmony_ci    flexibility afforded by EXT_framebuffer_object.  Previously, a
1015bd8deadSopenharmony_ci    drawable (window or pbuffer) had exclusive access to all of its
1025bd8deadSopenharmony_ci    buffers.  There was no mechanism for sharing a buffer across
1035bd8deadSopenharmony_ci    multiple drawables.  Under EXT_framebuffer_object, however, a
1045bd8deadSopenharmony_ci    mechanism exists for sharing a framebuffer-attachable image across
1055bd8deadSopenharmony_ci    several framebuffer objects, as well as sharing an image between a
1065bd8deadSopenharmony_ci    framebuffer object and a texture.  If we had retained the "implicit"
1075bd8deadSopenharmony_ci    resolve from traditional multisampled rendering, and allowed the
1085bd8deadSopenharmony_ci    creation of "multisample" format renderbuffers, then this type of
1095bd8deadSopenharmony_ci    sharing would have lead to two problematic situations:
1105bd8deadSopenharmony_ci
1115bd8deadSopenharmony_ci      * Two contexts, which shared renderbuffers, might perform
1125bd8deadSopenharmony_ci        competing resolve operations into the same single-sample buffer
1135bd8deadSopenharmony_ci        with ambiguous results.
1145bd8deadSopenharmony_ci
1155bd8deadSopenharmony_ci      * It would have introduced the unfortunate ability to use the
1165bd8deadSopenharmony_ci        single-sample buffer as a texture while MULTISAMPLE is ENABLED.
1175bd8deadSopenharmony_ci
1185bd8deadSopenharmony_ci    By using the BlitFramebufferEXT from EXT_framebuffer_blit as an
1195bd8deadSopenharmony_ci    explicit resolve to serialize access to the multisampled contents
1205bd8deadSopenharmony_ci    and eliminate the implicit per-sample resolve operation, we avoid
1215bd8deadSopenharmony_ci    both of these problems.
1225bd8deadSopenharmony_ci
1235bd8deadSopenharmony_ciIssues
1245bd8deadSopenharmony_ci
1255bd8deadSopenharmony_ci    Breaking from past convention, the issues section has been moved to
1265bd8deadSopenharmony_ci    the end of the document.  It can be found after Examples, before
1275bd8deadSopenharmony_ci    Revision History.
1285bd8deadSopenharmony_ci
1295bd8deadSopenharmony_ciNew Procedures and Functions
1305bd8deadSopenharmony_ci
1315bd8deadSopenharmony_ci    void RenderbufferStorageMultisampleEXT(
1325bd8deadSopenharmony_ci            enum target, sizei samples,
1335bd8deadSopenharmony_ci            enum internalformat,
1345bd8deadSopenharmony_ci            sizei width, sizei height);
1355bd8deadSopenharmony_ci
1365bd8deadSopenharmony_ciNew Types
1375bd8deadSopenharmony_ci
1385bd8deadSopenharmony_ci    None.
1395bd8deadSopenharmony_ci
1405bd8deadSopenharmony_ciNew Tokens
1415bd8deadSopenharmony_ci
1425bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetRenderbufferParameterivEXT:
1435bd8deadSopenharmony_ci
1445bd8deadSopenharmony_ci        RENDERBUFFER_SAMPLES_EXT            0x8CAB
1455bd8deadSopenharmony_ci
1465bd8deadSopenharmony_ci    Returned by CheckFramebufferStatusEXT:
1475bd8deadSopenharmony_ci
1485bd8deadSopenharmony_ci        FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT  0x8D56
1495bd8deadSopenharmony_ci
1505bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
1515bd8deadSopenharmony_ci    GetFloatv, and GetDoublev:
1525bd8deadSopenharmony_ci
1535bd8deadSopenharmony_ci        MAX_SAMPLES_EXT                     0x8D57
1545bd8deadSopenharmony_ci
1555bd8deadSopenharmony_ciAdditions to Chapter 2 of the 1.5 Specification (OpenGL Operation)
1565bd8deadSopenharmony_ci
1575bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 1.5 Specification (Rasterization)
1585bd8deadSopenharmony_ci
1595bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 1.5 Specification (Per-Fragment
1605bd8deadSopenharmony_ciOperations and the Framebuffer)
1615bd8deadSopenharmony_ci
1625bd8deadSopenharmony_ciAdd to 4.3.2 (Reading Pixels), right before the subsection titled
1635bd8deadSopenharmony_ci"Obtaining Pixels form the Framebuffer":
1645bd8deadSopenharmony_ci
1655bd8deadSopenharmony_ci    "ReadPixels generates INVALID_OPERATION if READ_FRAMEBUFFER_BINDING
1665bd8deadSopenharmony_ci    (section 4.4) is non-zero, the read framebuffer is framebuffer
1675bd8deadSopenharmony_ci    complete, and the value of SAMPLE_BUFFERS for the read framebuffer
1685bd8deadSopenharmony_ci    is greater than zero."
1695bd8deadSopenharmony_ci
1705bd8deadSopenharmony_ciModify the following text to section 4.3.3, page 194, that was added to
1715bd8deadSopenharmony_cithe definition of CopyPixels by EXT_framebuffer_blit:
1725bd8deadSopenharmony_ci
1735bd8deadSopenharmony_ci    "Finally, the behavior of several GL operations is specified "as if
1745bd8deadSopenharmony_ci    the arguments were passed to CopyPixels."  These operations include:
1755bd8deadSopenharmony_ci    CopyTex{Sub}Image*, CopyColor{Sub}Table, and CopyConvolutionFilter*.
1765bd8deadSopenharmony_ci    INVALID_FRAMEBUFFER_OPERATION_EXT will be generated if an attempt is
1775bd8deadSopenharmony_ci    made to execute one of these operations, or CopyPixels, while the
1785bd8deadSopenharmony_ci    object bound to READ_FRAMEBUFFER_BINDING_EXT (section 4.4) is not
1795bd8deadSopenharmony_ci    "framebuffer complete" (as defined in section 4.4.4.2).
1805bd8deadSopenharmony_ci    INVALID_OPERATION will be generated if the object bound to
1815bd8deadSopenharmony_ci    READ_FRAMEBUFFER_BINDING_EXT is "framebuffer complete" and the value
1825bd8deadSopenharmony_ci    of SAMPLE_BUFFERS is greater than zero.
1835bd8deadSopenharmony_ci
1845bd8deadSopenharmony_ci    Furthermore, an attempt to execute CopyPixels will generate
1855bd8deadSopenharmony_ci    INVALID_FRAMEBUFFER_OPERATION_EXT while the object bound to
1865bd8deadSopenharmony_ci    DRAW_FRAMEBUFFER_BINDING_EXT (section 4.4) is not "framebuffer
1875bd8deadSopenharmony_ci    complete".
1885bd8deadSopenharmony_ci
1895bd8deadSopenharmony_ciIn 4.3.3 (Copying Pixels), add to the section describing BlitFramebuffer
1905bd8deadSopenharmony_cithat was added by EXT_framebuffer_blit.
1915bd8deadSopenharmony_ci
1925bd8deadSopenharmony_ci    "If SAMPLE_BUFFERS for the read framebuffer is greater than zero and
1935bd8deadSopenharmony_ci    SAMPLE_BUFFERS for the draw framebuffer is zero, the samples
1945bd8deadSopenharmony_ci    corresponding to each pixel location in the source are converted to
1955bd8deadSopenharmony_ci    a single sample before being written to the destination.
1965bd8deadSopenharmony_ci
1975bd8deadSopenharmony_ci    If SAMPLE_BUFFERS for the read framebuffer is zero and
1985bd8deadSopenharmony_ci    SAMPLE_BUFFERS for the draw framebuffer is greater than zero, the
1995bd8deadSopenharmony_ci    value of the source sample is replicated in each of the destination
2005bd8deadSopenharmony_ci    samples.
2015bd8deadSopenharmony_ci
2025bd8deadSopenharmony_ci    If SAMPLE_BUFFERS for both the read and draw framebuffers are
2035bd8deadSopenharmony_ci    greater than zero, and the values of SAMPLES for the read and draw
2045bd8deadSopenharmony_ci    framebuffers are identical, the samples are copied without
2055bd8deadSopenharmony_ci    modification from the read framebuffer to the draw framebuffer.
2065bd8deadSopenharmony_ci    Otherwise, no copy is performed and an INVALID_OPERATION error is
2075bd8deadSopenharmony_ci    generated.
2085bd8deadSopenharmony_ci
2095bd8deadSopenharmony_ci    Furthermore, if SAMPLE_BUFFERS for either the read framebuffer or
2105bd8deadSopenharmony_ci    draw framebuffer is greater than zero, no copy is performed and an
2115bd8deadSopenharmony_ci    INVALID_OPERATION error is generated if the dimensions of the source
2125bd8deadSopenharmony_ci    and destination rectangles provided to BlitFramebuffer are not
2135bd8deadSopenharmony_ci    identical, or if the formats of the read and draw framebuffers are
2145bd8deadSopenharmony_ci    not identical."
2155bd8deadSopenharmony_ci
2165bd8deadSopenharmony_ciModification to 4.4.2.1 (Renderbuffer Objects)
2175bd8deadSopenharmony_ci
2185bd8deadSopenharmony_ci    Add, just above the definition of RenderbufferStorageEXT:
2195bd8deadSopenharmony_ci
2205bd8deadSopenharmony_ci    "The command
2215bd8deadSopenharmony_ci
2225bd8deadSopenharmony_ci        void RenderbufferStorageMultisampleEXT(
2235bd8deadSopenharmony_ci            enum target, sizei samples,
2245bd8deadSopenharmony_ci            enum internalformat,
2255bd8deadSopenharmony_ci            sizei width, sizei height);
2265bd8deadSopenharmony_ci
2275bd8deadSopenharmony_ci    establishes the data storage, format, dimensions, and number of
2285bd8deadSopenharmony_ci    samples of a renderbuffer object's image.  <target> must be
2295bd8deadSopenharmony_ci    RENDERBUFFER_EXT.  <internalformat> must be RGB, RGBA,
2305bd8deadSopenharmony_ci    DEPTH_COMPONENT, STENCIL_INDEX, or one of the internal formats from
2315bd8deadSopenharmony_ci    table 3.16 or table 2.nnn that has a base internal format of RGB,
2325bd8deadSopenharmony_ci    RGBA, DEPTH_COMPONENT, or STENCIL_INDEX.  <width> and <height> are
2335bd8deadSopenharmony_ci    the dimensions in pixels of the renderbuffer.  If either <width> or
2345bd8deadSopenharmony_ci    <height> is greater than MAX_RENDERBUFFER_SIZE_EXT, or if <samples>
2355bd8deadSopenharmony_ci    is greater than MAX_SAMPLES_EXT, then the error INVALID_VALUE is
2365bd8deadSopenharmony_ci    generated. If the GL is unable to create a data store of the
2375bd8deadSopenharmony_ci    requested size, the error OUT_OF_MEMORY is generated.
2385bd8deadSopenharmony_ci
2395bd8deadSopenharmony_ci    Upon success, RenderbufferStorageMultisampleEXT deletes any existing
2405bd8deadSopenharmony_ci    data store for the renderbuffer image and the contents of the data
2415bd8deadSopenharmony_ci    store after calling RenderbufferStorageMultisampleEXT are undefined.
2425bd8deadSopenharmony_ci    RENDERBUFFER_WIDTH_EXT is set to <width>, RENDERBUFFER_HEIGHT_EXT is
2435bd8deadSopenharmony_ci    set to <height>, and RENDERBUFFER_INTERNAL_FORMAT_EXT is set to
2445bd8deadSopenharmony_ci    <internalformat>.
2455bd8deadSopenharmony_ci
2465bd8deadSopenharmony_ci    If <samples> is zero, then RENDERBUFFER_SAMPLES_EXT is set to zero.
2475bd8deadSopenharmony_ci    Otherwise <samples> represents a request for a desired minimum
2485bd8deadSopenharmony_ci    number of samples. Since different implementations may support
2495bd8deadSopenharmony_ci    different sample counts for multisampled rendering, the actual
2505bd8deadSopenharmony_ci    number of samples allocated for the renderbuffer image is
2515bd8deadSopenharmony_ci    implementation dependent.  However, the resulting value for
2525bd8deadSopenharmony_ci    RENDERBUFFER_SAMPLES_EXT is guaranteed to be greater than or equal
2535bd8deadSopenharmony_ci    to <samples> and no more than the next larger sample count supported
2545bd8deadSopenharmony_ci    by the implementation.
2555bd8deadSopenharmony_ci
2565bd8deadSopenharmony_ci    Sized                 Base               S
2575bd8deadSopenharmony_ci    Internal Format       Internal format    Bits
2585bd8deadSopenharmony_ci    ---------------       ---------------    ----
2595bd8deadSopenharmony_ci    STENCIL_INDEX1_EXT    STENCIL_INDEX      1
2605bd8deadSopenharmony_ci    STENCIL_INDEX4_EXT    STENCIL_INDEX      4
2615bd8deadSopenharmony_ci    STENCIL_INDEX8_EXT    STENCIL_INDEX      8
2625bd8deadSopenharmony_ci    STENCIL_INDEX16_EXT   STENCIL_INDEX      16
2635bd8deadSopenharmony_ci    ------------------------------------------------------------------
2645bd8deadSopenharmony_ci    Table 2.nnn Desired component resolution for each sized internal
2655bd8deadSopenharmony_ci    format that can be used only with renderbuffers.
2665bd8deadSopenharmony_ci
2675bd8deadSopenharmony_ci    A GL implementation may vary its allocation of internal component
2685bd8deadSopenharmony_ci    resolution based on any RenderbufferStorage parameter (except
2695bd8deadSopenharmony_ci    target), but the allocation and chosen internal format must not be a
2705bd8deadSopenharmony_ci    function of any other state and cannot be changed once they are
2715bd8deadSopenharmony_ci    established."
2725bd8deadSopenharmony_ci
2735bd8deadSopenharmony_ci    Modify the definiton of RenderbufferStorageEXT as follows:
2745bd8deadSopenharmony_ci
2755bd8deadSopenharmony_ci    "The command
2765bd8deadSopenharmony_ci
2775bd8deadSopenharmony_ci        void RenderbufferStorageEXT(enum target, enum internalformat,
2785bd8deadSopenharmony_ci                                    sizei width, sizei height);
2795bd8deadSopenharmony_ci
2805bd8deadSopenharmony_ci     is equivalent to calling RenderbufferStorageMultisampleEXT with
2815bd8deadSopenharmony_ci     <samples> equal to zero."
2825bd8deadSopenharmony_ci
2835bd8deadSopenharmony_ciModification to 4.4.4.2 (Framebuffer Completeness)
2845bd8deadSopenharmony_ci
2855bd8deadSopenharmony_ci    Add an entry to the bullet list:
2865bd8deadSopenharmony_ci
2875bd8deadSopenharmony_ci    * The value of RENDERBUFFER_SAMPLES_EXT is the same for all attached
2885bd8deadSopenharmony_ci      images.
2895bd8deadSopenharmony_ci      { FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT }
2905bd8deadSopenharmony_ci
2915bd8deadSopenharmony_ci    Also add a paragraph to the end of the section:
2925bd8deadSopenharmony_ci
2935bd8deadSopenharmony_ci    "The values of SAMPLE_BUFFERS and SAMPLES are derived from the
2945bd8deadSopenharmony_ci    attachments of the currently bound framebuffer object.  If the
2955bd8deadSopenharmony_ci    current DRAW_FRAMEBUFFER_BINDING_EXT is not "framebuffer complete",
2965bd8deadSopenharmony_ci    then both SAMPLE_BUFFERS and SAMPLES are undefined.  Otherwise,
2975bd8deadSopenharmony_ci    SAMPLES is equal to the value of RENDERBUFFER_SAMPLES_EXT for the
2985bd8deadSopenharmony_ci    attached images (which all must have the same value for
2995bd8deadSopenharmony_ci    RENDERBUFFER_SAMPLES_EXT).  Further, SAMPLE_BUFFERS is one if
3005bd8deadSopenharmony_ci    SAMPLES is non-zero.  Otherwise, SAMPLE_BUFFERS is zero.
3015bd8deadSopenharmony_ci
3025bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 1.5 Specification (Special Functions)
3035bd8deadSopenharmony_ci
3045bd8deadSopenharmony_ci    Added to section 5.4, as part of the discussion of which commands
3055bd8deadSopenharmony_ci    are not compiled into display lists:
3065bd8deadSopenharmony_ci
3075bd8deadSopenharmony_ci    "Certain commands, when called while compiling a display list, are
3085bd8deadSopenharmony_ci    not compiled into the display list but are executed immediately.
3095bd8deadSopenharmony_ci    These are: ..., RenderbufferStorageMultisampleEXT..."
3105bd8deadSopenharmony_ci
3115bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 1.5 Specification (State and State
3125bd8deadSopenharmony_ciRequests)
3135bd8deadSopenharmony_ci
3145bd8deadSopenharmony_ciModification to 6.1.3 (Enumerated Queries):
3155bd8deadSopenharmony_ci
3165bd8deadSopenharmony_ci    In the list of state query functions, modify the definition of
3175bd8deadSopenharmony_ci    GetRenderbufferParameterivEXT as follows:
3185bd8deadSopenharmony_ci
3195bd8deadSopenharmony_ci    "void GetRenderbufferParameterivEXT(enum target, enum pname,
3205bd8deadSopenharmony_ci                                       int* params);
3215bd8deadSopenharmony_ci
3225bd8deadSopenharmony_ci        <target> must be RENDERBUFFER_EXT.  <pname> must be one of the
3235bd8deadSopenharmony_ci        symbolic values in table 8.nnn.
3245bd8deadSopenharmony_ci
3255bd8deadSopenharmony_ci        If the renderbuffer currently bound to <target> is zero, then
3265bd8deadSopenharmony_ci        INVALID_OPERATION is generated.
3275bd8deadSopenharmony_ci
3285bd8deadSopenharmony_ci        Upon successful return from GetRenderbufferParameterivEXT, if
3295bd8deadSopenharmony_ci        <pname> is RENDERBUFFER_WIDTH_EXT, RENDERBUFFER_HEIGHT_EXT,
3305bd8deadSopenharmony_ci        RENDERBUFFER_INTERNAL_FORMAT_EXT, or RENDERBUFFER_SAMPLES_EXT,
3315bd8deadSopenharmony_ci        then <params> will contain the width in pixels, height in
3325bd8deadSopenharmony_ci        pixels, internal format, or number of samples, respectively, of
3335bd8deadSopenharmony_ci        the renderbuffer currently bound to <target>.
3345bd8deadSopenharmony_ci
3355bd8deadSopenharmony_ci        Otherwise, INVALID_ENUM is generated."
3365bd8deadSopenharmony_ci
3375bd8deadSopenharmony_ciGLX Protocol
3385bd8deadSopenharmony_ci
3395bd8deadSopenharmony_ci    RenderbufferStorageMultisampleEXT
3405bd8deadSopenharmony_ci
3415bd8deadSopenharmony_ci        2       24              rendering command length
3425bd8deadSopenharmony_ci        2       4331            rendering command opcode
3435bd8deadSopenharmony_ci        4       ENUM            target
3445bd8deadSopenharmony_ci        4       CARD32          samples
3455bd8deadSopenharmony_ci        4       ENUM            internalformat
3465bd8deadSopenharmony_ci        4       CARD32          width
3475bd8deadSopenharmony_ci        4       CARD32          height
3485bd8deadSopenharmony_ci
3495bd8deadSopenharmony_ciDependencies on EXT_framebuffer_object
3505bd8deadSopenharmony_ci
3515bd8deadSopenharmony_ci    EXT_framebuffer_object is required.
3525bd8deadSopenharmony_ci    
3535bd8deadSopenharmony_ciDependencies on EXT_framebuffer_blit    
3545bd8deadSopenharmony_ci
3555bd8deadSopenharmony_ci    EXT_framebuffer_blit is required.  Technically, EXT_framebuffer_blit
3565bd8deadSopenharmony_ci    would not be required to support multisampled rendering, except for
3575bd8deadSopenharmony_ci    the fact that it provides the only method of doing a multisample
3585bd8deadSopenharmony_ci    resovle from a multisample renderbuffer.
3595bd8deadSopenharmony_ci
3605bd8deadSopenharmony_ciErrors
3615bd8deadSopenharmony_ci
3625bd8deadSopenharmony_ci    The error INVALID_OPERATION_EXT is generated if ReadPixels,
3635bd8deadSopenharmony_ci    CopyPixels, CopyTex{Sub}Image*, CopyColor{Sub}Table, or
3645bd8deadSopenharmony_ci    CopyConvolutionFilter* is called while READ_FRAMEBUFFER_BINDING_EXT
3655bd8deadSopenharmony_ci    is non-zero, the read framebuffer is framebuffer complete, and the
3665bd8deadSopenharmony_ci    value of SAMPLE_BUFFERS for the read framebuffer is greater than
3675bd8deadSopenharmony_ci    zero.
3685bd8deadSopenharmony_ci
3695bd8deadSopenharmony_ci    The error OUT_OF_MEMORY is generated when
3705bd8deadSopenharmony_ci    RenderbufferStorageMultisampleEXT cannot create storage of the
3715bd8deadSopenharmony_ci    specified size.
3725bd8deadSopenharmony_ci
3735bd8deadSopenharmony_ci    If both the draw and read framebuffers are framebuffer complete and
3745bd8deadSopenharmony_ci    both have a value of SAMPLE_BUFFERS that is greater than zero, then
3755bd8deadSopenharmony_ci    the error INVALID_OPERATION is generated if BlitFramebufferEXT is
3765bd8deadSopenharmony_ci    called and the values of SAMPLES for the draw and read framebuffers
3775bd8deadSopenharmony_ci    do not match.
3785bd8deadSopenharmony_ci
3795bd8deadSopenharmony_ci    If both the draw and read framebuffers are framebuffer complete and
3805bd8deadSopenharmony_ci    either has a value of SAMPLE_BUFFERS that is greater than zero, then
3815bd8deadSopenharmony_ci    the error INVALID_OPERATION is generated if BlitFramebufferEXT is
3825bd8deadSopenharmony_ci    called and the formats of the draw and read framebuffers are not
3835bd8deadSopenharmony_ci    identical.
3845bd8deadSopenharmony_ci
3855bd8deadSopenharmony_ci    If either the draw or read framebuffer is framebuffer complete and
3865bd8deadSopenharmony_ci    has a value of SAMPLE_BUFFERS that is greater than zero, then the
3875bd8deadSopenharmony_ci    error INVALID_OPERATION is generated if BlitFramebufferEXT is called
3885bd8deadSopenharmony_ci    and the specified source and destination dimensions are not
3895bd8deadSopenharmony_ci    identical.
3905bd8deadSopenharmony_ci
3915bd8deadSopenharmony_ci    If RenderbufferStorageMultisampleEXT is called with a value of
3925bd8deadSopenharmony_ci    <samples> that is greater than MAX_SAMPLES_EXT, then the error
3935bd8deadSopenharmony_ci    INVALID_VALUE is generated.
3945bd8deadSopenharmony_ci
3955bd8deadSopenharmony_ciNew State
3965bd8deadSopenharmony_ci
3975bd8deadSopenharmony_ci    (add to table 8.nnn, "Renderbuffers (state per renderbuffer object)")
3985bd8deadSopenharmony_ci
3995bd8deadSopenharmony_ci    Get Value                          Type    Get Command                    Initial Value  Description             Section       Attribute
4005bd8deadSopenharmony_ci    -------------------------------    ------  -------------                  -------------  --------------------    ------------  ---------
4015bd8deadSopenharmony_ci    RENDERBUFFER_SAMPLES_EXT           Z+      GetRenderbufferParameterivEXT  0              number of samples       4.4.2.1       -
4025bd8deadSopenharmony_ci
4035bd8deadSopenharmony_ci
4045bd8deadSopenharmony_ciTo the table added by EXT_framebuffer_object called "Framebuffer
4055bd8deadSopenharmony_ciDependent Values", table 9.nnn, add the following new framebuffer
4065bd8deadSopenharmony_cidependent state.
4075bd8deadSopenharmony_ci
4085bd8deadSopenharmony_ci    Get Value        Type  Get Command     Minimum Value    Description             Section  Attribute
4095bd8deadSopenharmony_ci    ---------        ----  -----------     -------------    -------------------     -------  ---------
4105bd8deadSopenharmony_ci    MAX_SAMPLES_EXT  Z+    GetIntegerv     1                Maximum number of       4.4.2.1  -
4115bd8deadSopenharmony_ci                                                            samples supported
4125bd8deadSopenharmony_ci                                                            for multisampling
4135bd8deadSopenharmony_ci                                                            
4145bd8deadSopenharmony_ci
4155bd8deadSopenharmony_ci
4165bd8deadSopenharmony_ciUsage Examples
4175bd8deadSopenharmony_ci
4185bd8deadSopenharmony_ci    XXX add examples XXX
4195bd8deadSopenharmony_ci
4205bd8deadSopenharmony_ciIssues
4215bd8deadSopenharmony_ci
4225bd8deadSopenharmony_ci    (1)  Should this be a separate extension or should it be included in
4235bd8deadSopenharmony_ci         a revision of EXT_framebuffer_object?
4245bd8deadSopenharmony_ci
4255bd8deadSopenharmony_ci         RESOLVED, separate extension
4265bd8deadSopenharmony_ci         
4275bd8deadSopenharmony_ci            Resolved by consensus, May 9, 2005
4285bd8deadSopenharmony_ci         
4295bd8deadSopenharmony_ci         This extension requires EXT_framebuffer_object but the reverse
4305bd8deadSopenharmony_ci         is not true.  In addition, the cross framebuffer copy operation
4315bd8deadSopenharmony_ci         that will be used to handle the multisample resolution
4325bd8deadSopenharmony_ci         operation may be generally useful for non-multisampled
4335bd8deadSopenharmony_ci         rendering, but is pretty much required for multisampled
4345bd8deadSopenharmony_ci         rendering to be useful.  Since we don't want
4355bd8deadSopenharmony_ci         EXT_framebuffer_object to require that functionality either, we
4365bd8deadSopenharmony_ci         split EXT_framebuffer_multisample into its own extension.
4375bd8deadSopenharmony_ci         EXT_framebuffer_multisample might include the "cross
4385bd8deadSopenharmony_ci         framebuffer copy" operation or might simply require the
4395bd8deadSopenharmony_ci         presence of that third extension.  See issue (8).
4405bd8deadSopenharmony_ci
4415bd8deadSopenharmony_ci    (2)  What happens when <samples> is zero or one?
4425bd8deadSopenharmony_ci
4435bd8deadSopenharmony_ci         RESOLVED, 0 = single sample, 1 = minimum multisample
4445bd8deadSopenharmony_ci
4455bd8deadSopenharmony_ci            Resolved by consensus, May 9, 2005
4465bd8deadSopenharmony_ci
4475bd8deadSopenharmony_ci         Zero means single sample, as if RenderbufferStorageEXT had been
4485bd8deadSopenharmony_ci         called instead of RenderbufferStorageMultisampleEXT.  One means
4495bd8deadSopenharmony_ci         minimum number of samples supported by implementation.
4505bd8deadSopenharmony_ci
4515bd8deadSopenharmony_ci         There was a question if one should mean the same thing as
4525bd8deadSopenharmony_ci         single-sample (one sample), or if it should mean the minimum
4535bd8deadSopenharmony_ci         supported number of samples for multisample rendering.  The
4545bd8deadSopenharmony_ci         rules for rasterizing in "multisample" mode are different than
4555bd8deadSopenharmony_ci         "non-multisample" mode.  In the end, we decided that some
4565bd8deadSopenharmony_ci         implementations may wish to support a "one-sample" multisample
4575bd8deadSopenharmony_ci         buffer to allow for multipass multisampling where the sample
4585bd8deadSopenharmony_ci         location can be varied either by the implementation or perhaps
4595bd8deadSopenharmony_ci         explicitly by a "multisample location" extension.
4605bd8deadSopenharmony_ci
4615bd8deadSopenharmony_ci    (3)  Is ReadPixels (or CopyPixels or CopyTexImage) permitted when
4625bd8deadSopenharmony_ci         bound to a multisample framebuffer object?
4635bd8deadSopenharmony_ci
4645bd8deadSopenharmony_ci         RESOLVED, no
4655bd8deadSopenharmony_ci         
4665bd8deadSopenharmony_ci             Resolved by consensus, prior to May 9, 2005
4675bd8deadSopenharmony_ci
4685bd8deadSopenharmony_ci         No, those operations will produce INVALID_OPERATION.  To read
4695bd8deadSopenharmony_ci         the contents of a multisample framebuffer, it must first be
4705bd8deadSopenharmony_ci         "downsampled" into a non-multisample destination, then read
4715bd8deadSopenharmony_ci         from there.  For downsample, see EXT_framebuffer_blit.
4725bd8deadSopenharmony_ci
4735bd8deadSopenharmony_ci         The concern is fallback due to out of memory conditions.  Even
4745bd8deadSopenharmony_ci         if no memory is available to allocate a temporary buffer at the
4755bd8deadSopenharmony_ci         time ReadPixels is called, an implementation should be able to
4765bd8deadSopenharmony_ci         make this work by pre-allocating a small tile and doing the
4775bd8deadSopenharmony_ci         downsample in tiles, or by falling back to software to copy a
4785bd8deadSopenharmony_ci         pixel at a time.
4795bd8deadSopenharmony_ci
4805bd8deadSopenharmony_ci    (4)  Does the resolution from <samples> to RENDERBUFFER_SAMPLES_EXT
4815bd8deadSopenharmony_ci         depend on any other parameters to
4825bd8deadSopenharmony_ci         RenderbufferStorageMultisampleEXT, or must a given value of
4835bd8deadSopenharmony_ci         <samples> always resolve to the same number of actual samples?
4845bd8deadSopenharmony_ci
4855bd8deadSopenharmony_ci         RESOLVED, no, further, user must get at least what they asked
4865bd8deadSopenharmony_ci         for, or Storage call fails:
4875bd8deadSopenharmony_ci
4885bd8deadSopenharmony_ci            Resolved by consensus, May 23, 2005
4895bd8deadSopenharmony_ci
4905bd8deadSopenharmony_ci         
4915bd8deadSopenharmony_ci         Given the routine,
4925bd8deadSopenharmony_ci        
4935bd8deadSopenharmony_ci            void RenderbufferStorageMultisampleEXT(
4945bd8deadSopenharmony_ci                    enum target, uint samples,
4955bd8deadSopenharmony_ci                    enum internalformat,
4965bd8deadSopenharmony_ci                    uint width, uint height);
4975bd8deadSopenharmony_ci        
4985bd8deadSopenharmony_ci         If an implementation supports several sample counts (say, 2x,
4995bd8deadSopenharmony_ci         4x, 8x multisample), and the user requests a sample count of
5005bd8deadSopenharmony_ci         <samples>, the implementation must do one of the following:
5015bd8deadSopenharmony_ci         
5025bd8deadSopenharmony_ci            - succeed in giving the user exactly <samples>, or
5035bd8deadSopenharmony_ci
5045bd8deadSopenharmony_ci            - succeed in giving the user a number of samples greater
5055bd8deadSopenharmony_ci              than <samples> but no more than the next highest number of
5065bd8deadSopenharmony_ci              samples supported by the implementation, or
5075bd8deadSopenharmony_ci
5085bd8deadSopenharmony_ci            - fail the request to RenderbufferStorageMultisampleEXT with
5095bd8deadSopenharmony_ci              an OUT_OF_MEMORY error
5105bd8deadSopenharmony_ci
5115bd8deadSopenharmony_ci    (5)  Is an implementation allowed to create single-sample storage
5125bd8deadSopenharmony_ci         when RenderbufferStorageMultisampleEXT is called with <samples>
5135bd8deadSopenharmony_ci         larger than one?
5145bd8deadSopenharmony_ci
5155bd8deadSopenharmony_ci         RESOLVED, no
5165bd8deadSopenharmony_ci
5175bd8deadSopenharmony_ci            Resolved by consensus, May 23, 2005
5185bd8deadSopenharmony_ci            
5195bd8deadSopenharmony_ci            No, by resolution of issue (4) above, the user must get at
5205bd8deadSopenharmony_ci            least what they asked for or higher, which precludes getting
5215bd8deadSopenharmony_ci            a single sampled format if they asked for a multisampled
5225bd8deadSopenharmony_ci            format.
5235bd8deadSopenharmony_ci
5245bd8deadSopenharmony_ci    (6)  Should OUT_OF_MEMORY be generated when
5255bd8deadSopenharmony_ci         RenderbufferStorageMultisampleEXT cannot create storage of the
5265bd8deadSopenharmony_ci         requested size?
5275bd8deadSopenharmony_ci
5285bd8deadSopenharmony_ci         RESOLVED, yes
5295bd8deadSopenharmony_ci
5305bd8deadSopenharmony_ci            Resolved by consensus, May 23, 2005
5315bd8deadSopenharmony_ci    
5325bd8deadSopenharmony_ci         Yes.  Success or failure is determined by <width>, <height>,
5335bd8deadSopenharmony_ci         <internalformat>, and <samples>, and the implementation can
5345bd8deadSopenharmony_ci         always return OUT_OF_MEMORY. Note that while an implementation
5355bd8deadSopenharmony_ci         may give a different internal format with either higher or
5365bd8deadSopenharmony_ci         lower resolution per component than the internal requested, by
5375bd8deadSopenharmony_ci         issue of resolution (4), it must give at least the number of
5385bd8deadSopenharmony_ci         samples requested or it must fail the
5395bd8deadSopenharmony_ci         RenderbufferStorageMultisampleEXT call.
5405bd8deadSopenharmony_ci         
5415bd8deadSopenharmony_ci             Update from June 2006 ARB meeting:
5425bd8deadSopenharmony_ci             
5435bd8deadSopenharmony_ci             The appropriate error for the case where the number of
5445bd8deadSopenharmony_ci             samples is larger than the maximum supported by the
5455bd8deadSopenharmony_ci             implementation is INVALID_VALUE.  To allow an application
5465bd8deadSopenharmony_ci             to know the maximum legal value, we add a GetInteger query
5475bd8deadSopenharmony_ci             MAX_SAMPLES.
5485bd8deadSopenharmony_ci
5495bd8deadSopenharmony_ci    (7)  Is there a query for the maximum size of <samples>?
5505bd8deadSopenharmony_ci
5515bd8deadSopenharmony_ci         RESOLVED, Yes
5525bd8deadSopenharmony_ci
5535bd8deadSopenharmony_ci         There was some discussion about whether it was useful to return
5545bd8deadSopenharmony_ci         a maximum sample count supported by the implementation as a
5555bd8deadSopenharmony_ci         convenenience to the developer so that the developer doesn't
5565bd8deadSopenharmony_ci         need to try increasingly smaller counts until it finds one that
5575bd8deadSopenharmony_ci         succeeds.  Originally this query was ommitted, but later it was
5585bd8deadSopenharmony_ci         added (MAX_SAMPLES_EXT).
5595bd8deadSopenharmony_ci
5605bd8deadSopenharmony_ci    (8)  Does this extension require our new framebuffer-to-framebuffer
5615bd8deadSopenharmony_ci         copy extension, EXT_framebuffer_blit, or is it merely affected
5625bd8deadSopenharmony_ci         by the presence of that extension.
5635bd8deadSopenharmony_ci         
5645bd8deadSopenharmony_ci         RESOLVED, EXT_framebuffer_blit is required.
5655bd8deadSopenharmony_ci         
5665bd8deadSopenharmony_ci         EXT_framebuffer_multisample by itself enable the user to
5675bd8deadSopenharmony_ci         perform multisampled rendering.  However, you can't copy or
5685bd8deadSopenharmony_ci         read from a multisampled renderbuffer using {Read|Copy}Pixels
5695bd8deadSopenharmony_ci         or CopyTex{Sub}Image - as per issue (3).  Consequently, there
5705bd8deadSopenharmony_ci         is no way to actually use the results of multisampled rendering
5715bd8deadSopenharmony_ci         without EXT_framebuffer_blit.  That makes the
5725bd8deadSopenharmony_ci         EXT_framebuffer_multisample extension arguably kind of useless
5735bd8deadSopenharmony_ci         without the EXT_framebuffer_blit.
5745bd8deadSopenharmony_ci         
5755bd8deadSopenharmony_ci         However, the reverse is not true.  The EXT_framebuffer_blit is
5765bd8deadSopenharmony_ci         useful on its own, which is why it is a separate extension from
5775bd8deadSopenharmony_ci         this one.
5785bd8deadSopenharmony_ci         
5795bd8deadSopenharmony_ci         So we decided to state that EXT_framebuffer_multisample
5805bd8deadSopenharmony_ci         requires EXT_framebuffer_blit instead of merely stating that
5815bd8deadSopenharmony_ci         that extension affects this one.
5825bd8deadSopenharmony_ci
5835bd8deadSopenharmony_ci    (9)  Is DrawPixels allowed when the draw framebuffer is multisample?
5845bd8deadSopenharmony_ci
5855bd8deadSopenharmony_ci         RESOLVED, yes
5865bd8deadSopenharmony_ci
5875bd8deadSopenharmony_ci         This is no different than DrawPixels to a multisample window
5885bd8deadSopenharmony_ci         (framebuffer zero).  Note that ReadPixels and CopyPixels are
5895bd8deadSopenharmony_ci         disallowed when the read framebuffer is multisample.
5905bd8deadSopenharmony_ci         
5915bd8deadSopenharmony_ciRevision History
5925bd8deadSopenharmony_ci    #7, Jan 10, 2007: jjuliano
5935bd8deadSopenharmony_ci        - add missing constraint that a multisample blit requires
5945bd8deadSopenharmony_ci          identical formats for the read and draw framebuffers
5955bd8deadSopenharmony_ci        - correct the resolution of issue 7 (MAX_SAMPLES_EXT)
5965bd8deadSopenharmony_ci        - fix typos
5975bd8deadSopenharmony_ci
5985bd8deadSopenharmony_ci    #6c, November 6, 2006: jjuliano
5995bd8deadSopenharmony_ci        - changes from June #6 merged back in
6005bd8deadSopenharmony_ci
6015bd8deadSopenharmony_ci    #6b, October 13, 2006: Jon Leech
6025bd8deadSopenharmony_ci        - added token values for MAX_SAMPLES_EXT and
6035bd8deadSopenharmony_ci          FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT.
6045bd8deadSopenharmony_ci
6055bd8deadSopenharmony_ci    #6a, September 6, 2006: jsandmel
6065bd8deadSopenharmony_ci        - added language describing MAX_SAMPLES query
6075bd8deadSopenharmony_ci        - clarified that RenderbufferStorageMultisampleEXT can fail
6085bd8deadSopenharmony_ci          with INVALID_VALUE if <samples> is greater than MAX_SAMPLES
6095bd8deadSopenharmony_ci
6105bd8deadSopenharmony_ci    #6, June 1, 2006: jjuliano
6115bd8deadSopenharmony_ci        - add missing errors to Errors section
6125bd8deadSopenharmony_ci        - clarify the modifications to 4.3.2 and 4.3.3.
6135bd8deadSopenharmony_ci        - add issue 9 to document that multisample DrawPixels is allowed
6145bd8deadSopenharmony_ci
6155bd8deadSopenharmony_ci    #5, December 22, 2005: Jon Leech
6165bd8deadSopenharmony_ci        - added GLX protocol, assigned enumerant values
6175bd8deadSopenharmony_ci
6185bd8deadSopenharmony_ci    #4, September 28, 2005: jsandmel, jjuliano
6195bd8deadSopenharmony_ci        - moved the multisample languge from GL_EXT_framebuffer_blit to 
6205bd8deadSopenharmony_ci          this spec.
6215bd8deadSopenharmony_ci        - added description of using BlitFramebufferEXT for resolving
6225bd8deadSopenharmony_ci          multisample buffer
6235bd8deadSopenharmony_ci        - added language referring to DRAW_/READ_FRAMEBUFFER_BINDING
6245bd8deadSopenharmony_ci          instead of just FRAMEBUFFER_BINDING.
6255bd8deadSopenharmony_ci        - minor updates to reflect new EXT_framebuffer_blit spec
6265bd8deadSopenharmony_ci          that provides the multisample resolve function
6275bd8deadSopenharmony_ci        - resolve issue (8)
6285bd8deadSopenharmony_ci        - rename framebuffer_object_multisample to
6295bd8deadSopenharmony_ci          framebuffer_multisample
6305bd8deadSopenharmony_ci
6315bd8deadSopenharmony_ci    #3, May 26, 2005: jsandmel
6325bd8deadSopenharmony_ci        - added recent workgroup resolutions
6335bd8deadSopenharmony_ci        - resolved issues (4), (5), (6), (7) based on decisions from the
6345bd8deadSopenharmony_ci          work group on May 9 and 23, 2005
6355bd8deadSopenharmony_ci        - added issue (8), does this extension require our new
6365bd8deadSopenharmony_ci          cross-framebuffer copy extension?
6375bd8deadSopenharmony_ci        - removed MAX_RENDERBUFFER_SAMPLES_EXT enum as per work group
6385bd8deadSopenharmony_ci          decision - issue (7)
6395bd8deadSopenharmony_ci        - changed prototype for RenderbufferStorageMultisampleEXT to use
6405bd8deadSopenharmony_ci          sizei for sample count
6415bd8deadSopenharmony_ci
6425bd8deadSopenharmony_ci    #2, May 16, 2005: jsandmel
6435bd8deadSopenharmony_ci        - revised to account for recent work group meeting decisions
6445bd8deadSopenharmony_ci        - removed erroneous inclusion of GenerateMipmaps as a new
6455bd8deadSopenharmony_ci          function
6465bd8deadSopenharmony_ci        - resolved issue (1), this will be a separate extension
6475bd8deadSopenharmony_ci        - resolved issue (2), zero means non-multisample, one means
6485bd8deadSopenharmony_ci          minimum number of samples
6495bd8deadSopenharmony_ci
6505bd8deadSopenharmony_ci    #1, May 9, 2005: jjuliano
6515bd8deadSopenharmony_ci        - first revision
652