15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    NV_framebuffer_mixed_samples
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_NV_framebuffer_mixed_samples
85bd8deadSopenharmony_ci    GL_EXT_raster_multisample
95bd8deadSopenharmony_ci
105bd8deadSopenharmony_ciContact
115bd8deadSopenharmony_ci
125bd8deadSopenharmony_ci    Jeff Bolz, NVIDIA Corporation (jbolz 'at' nvidia.com)
135bd8deadSopenharmony_ci
145bd8deadSopenharmony_ciContributors
155bd8deadSopenharmony_ci
165bd8deadSopenharmony_ci    Pat Brown, NVIDIA
175bd8deadSopenharmony_ci    Mathias Heyer, NVIDIA
185bd8deadSopenharmony_ci    Mark Kilgard, NVIDIA
195bd8deadSopenharmony_ci    Chris Dalton, NVIDIA
205bd8deadSopenharmony_ci    Rui Bastros, NVIDIA
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ciStatus
235bd8deadSopenharmony_ci
245bd8deadSopenharmony_ci    Shipping
255bd8deadSopenharmony_ci
265bd8deadSopenharmony_ciVersion
275bd8deadSopenharmony_ci
285bd8deadSopenharmony_ci    Last Modified Date:         February 15, 2017
295bd8deadSopenharmony_ci    Revision:                   3
305bd8deadSopenharmony_ci
315bd8deadSopenharmony_ciNumber
325bd8deadSopenharmony_ci
335bd8deadSopenharmony_ci    OpenGL Extension #469
345bd8deadSopenharmony_ci    OpenGL ES Extension #231
355bd8deadSopenharmony_ci
365bd8deadSopenharmony_ciDependencies
375bd8deadSopenharmony_ci
385bd8deadSopenharmony_ci    This extension is written against the OpenGL 4.3
395bd8deadSopenharmony_ci    (Compatibility Profile) and OpenGL ES 3.0.3 (December 18, 2013)
405bd8deadSopenharmony_ci    specification.
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ci    This extension is written as a superset of EXT_raster_multisample, since
435bd8deadSopenharmony_ci    so many of the edits overlap each other and it is not expected for an
445bd8deadSopenharmony_ci    implementation to support NV_framebuffer_mixed_samples but not
455bd8deadSopenharmony_ci    EXT_raster_multisample.
465bd8deadSopenharmony_ci
475bd8deadSopenharmony_ci    This extension interacts with NV_fragment_coverage_to_color.
485bd8deadSopenharmony_ci
495bd8deadSopenharmony_ci    This extension interacts with EXT_depth_bounds_test.
505bd8deadSopenharmony_ci
515bd8deadSopenharmony_ci    This extension interacts with OES_sample_shading
525bd8deadSopenharmony_ci
535bd8deadSopenharmony_ci    This extension interacts with OES_sample_variables
545bd8deadSopenharmony_ci
555bd8deadSopenharmony_ci    This extension interacts with NV_framebuffer_multisample
565bd8deadSopenharmony_ci
575bd8deadSopenharmony_ci    This extension interacts with the OpenGL ES 3.1 specification.
585bd8deadSopenharmony_ci
595bd8deadSopenharmony_ci    This extension interacts with ARB_blend_func_extended
605bd8deadSopenharmony_ci
615bd8deadSopenharmony_ciOverview
625bd8deadSopenharmony_ci
635bd8deadSopenharmony_ci    This extension allows multisample rendering with a raster and
645bd8deadSopenharmony_ci    depth/stencil sample count that is larger than the color sample count.
655bd8deadSopenharmony_ci    Rasterization and the results of the depth and stencil tests together
665bd8deadSopenharmony_ci    determine the portion of a pixel that is "covered".  It can be useful to
675bd8deadSopenharmony_ci    evaluate coverage at a higher frequency than color samples are stored.
685bd8deadSopenharmony_ci    This coverage is then "reduced" to a collection of covered color samples,
695bd8deadSopenharmony_ci    each having an opacity value corresponding to the fraction of the color
705bd8deadSopenharmony_ci    sample covered.  The opacity can optionally be blended into individual
715bd8deadSopenharmony_ci    color samples.
725bd8deadSopenharmony_ci
735bd8deadSopenharmony_ci    In the current hardware incarnation both depth and stencil testing are
745bd8deadSopenharmony_ci    supported with mixed samples, although the API accommodates supporting
755bd8deadSopenharmony_ci    only one or the other.
765bd8deadSopenharmony_ci
775bd8deadSopenharmony_ci    Rendering with fewer color samples than depth/stencil samples can greatly
785bd8deadSopenharmony_ci    reduce the amount of memory and bandwidth consumed by the color buffer.
795bd8deadSopenharmony_ci    However, converting the coverage values into opacity can introduce
805bd8deadSopenharmony_ci    artifacts where triangles share edges and may not be suitable for normal
815bd8deadSopenharmony_ci    triangle mesh rendering.
825bd8deadSopenharmony_ci
835bd8deadSopenharmony_ci    One expected use case for this functionality is Stencil-then-Cover path
845bd8deadSopenharmony_ci    rendering (NV_path_rendering).  The stencil step determines the coverage
855bd8deadSopenharmony_ci    (in the stencil buffer) for an entire path at the higher sample frequency,
865bd8deadSopenharmony_ci    and then the cover step can draw the path into the lower frequency color
875bd8deadSopenharmony_ci    buffer using the coverage information to antialias path edges. With this
885bd8deadSopenharmony_ci    two-step process, internal edges are fully covered when antialiasing is
895bd8deadSopenharmony_ci    applied and there is no corruption on these edges.
905bd8deadSopenharmony_ci
915bd8deadSopenharmony_ci    The key features of this extension are:
925bd8deadSopenharmony_ci
935bd8deadSopenharmony_ci    - It allows a framebuffer object to be considered complete when its depth
945bd8deadSopenharmony_ci      or stencil samples are a multiple of the number of color samples.
955bd8deadSopenharmony_ci
965bd8deadSopenharmony_ci    - It redefines SAMPLES to be the number of depth/stencil samples (if any);
975bd8deadSopenharmony_ci      otherwise, it uses the number of color samples. SAMPLE_BUFFERS is one if
985bd8deadSopenharmony_ci      there are multisample depth/stencil attachments.  Multisample
995bd8deadSopenharmony_ci      rasterization and multisample fragment ops are allowed if SAMPLE_BUFFERS
1005bd8deadSopenharmony_ci      is one.
1015bd8deadSopenharmony_ci
1025bd8deadSopenharmony_ci    - It replaces several error checks involving SAMPLE_BUFFERS by error
1035bd8deadSopenharmony_ci      checks directly referencing the number of samples in the relevant
1045bd8deadSopenharmony_ci      attachments.
1055bd8deadSopenharmony_ci
1065bd8deadSopenharmony_ci    - A coverage reduction step is added to Per-Fragment Operations which
1075bd8deadSopenharmony_ci      converts a set of covered raster/depth/stencil samples to a set of
1085bd8deadSopenharmony_ci      covered color samples.  The coverage reduction step also includes an
1095bd8deadSopenharmony_ci      optional coverage modulation step, multiplying color values by a
1105bd8deadSopenharmony_ci      fractional opacity corresponding to the number of associated
1115bd8deadSopenharmony_ci      raster/depth/stencil samples covered.
1125bd8deadSopenharmony_ci
1135bd8deadSopenharmony_ci
1145bd8deadSopenharmony_ciNew Procedures and Functions
1155bd8deadSopenharmony_ci
1165bd8deadSopenharmony_ci    void RasterSamplesEXT(uint samples, boolean fixedsamplelocations);
1175bd8deadSopenharmony_ci    void CoverageModulationTableNV(sizei n, const float *v);
1185bd8deadSopenharmony_ci    void GetCoverageModulationTableNV(sizei bufsize, float *v);
1195bd8deadSopenharmony_ci    void CoverageModulationNV(enum components);
1205bd8deadSopenharmony_ci
1215bd8deadSopenharmony_ciNew Tokens
1225bd8deadSopenharmony_ci
1235bd8deadSopenharmony_ci    Accepted by the <cap> parameter of Enable, Disable, IsEnabled:
1245bd8deadSopenharmony_ci
1255bd8deadSopenharmony_ci        RASTER_MULTISAMPLE_EXT                          0x9327
1265bd8deadSopenharmony_ci        COVERAGE_MODULATION_TABLE_NV                    0x9331
1275bd8deadSopenharmony_ci
1285bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetBooleanv, GetDoublev,
1295bd8deadSopenharmony_ci    GetIntegerv, and GetFloatv:
1305bd8deadSopenharmony_ci
1315bd8deadSopenharmony_ci        RASTER_SAMPLES_EXT                              0x9328
1325bd8deadSopenharmony_ci        MAX_RASTER_SAMPLES_EXT                          0x9329
1335bd8deadSopenharmony_ci        RASTER_FIXED_SAMPLE_LOCATIONS_EXT               0x932A
1345bd8deadSopenharmony_ci        MULTISAMPLE_RASTERIZATION_ALLOWED_EXT           0x932B
1355bd8deadSopenharmony_ci        EFFECTIVE_RASTER_SAMPLES_EXT                    0x932C
1365bd8deadSopenharmony_ci
1375bd8deadSopenharmony_ci        // COLOR_SAMPLES_NV is shared with NV_multisample_coverage
1385bd8deadSopenharmony_ci        COLOR_SAMPLES_NV                                0x8E20
1395bd8deadSopenharmony_ci        DEPTH_SAMPLES_NV                                0x932D
1405bd8deadSopenharmony_ci        STENCIL_SAMPLES_NV                              0x932E
1415bd8deadSopenharmony_ci        MIXED_DEPTH_SAMPLES_SUPPORTED_NV                0x932F
1425bd8deadSopenharmony_ci        MIXED_STENCIL_SAMPLES_SUPPORTED_NV              0x9330
1435bd8deadSopenharmony_ci        COVERAGE_MODULATION_NV                          0x9332
1445bd8deadSopenharmony_ci        COVERAGE_MODULATION_TABLE_SIZE_NV               0x9333
1455bd8deadSopenharmony_ci
1465bd8deadSopenharmony_ciAdditions to Chapter 8 of the OpenGL 4.3 (Compatibility Profile) Specification
1475bd8deadSopenharmony_ci(Textures and Samplers)
1485bd8deadSopenharmony_ci
1495bd8deadSopenharmony_ci    Modify the error list for CopyTex(Sub)Image in Section 8.6 (Alternate
1505bd8deadSopenharmony_ci    Texture Image Specification Commands), p. 228.  [This language redefines
1515bd8deadSopenharmony_ci    one error condition in terms of the sample count of the targeted color
1525bd8deadSopenharmony_ci    buffer instead of SAMPLE_BUFFERS.]
1535bd8deadSopenharmony_ci
1545bd8deadSopenharmony_ci    An INVALID_OPERATION error is generated by CopyTexSubImage3D,
1555bd8deadSopenharmony_ci    CopyTexImage2D, CopyTexSubImage2D, CopyTexImage1D, or CopyTexSubImage1D
1565bd8deadSopenharmony_ci    if
1575bd8deadSopenharmony_ci
1585bd8deadSopenharmony_ci      * the value of READ_BUFFER is NONE.
1595bd8deadSopenharmony_ci
1605bd8deadSopenharmony_ci      * the value of READ_FRAMEBUFFER_BINDING is non-zero, and
1615bd8deadSopenharmony_ci
1625bd8deadSopenharmony_ci        - the read buffer selects an attachment that has no image attached,
1635bd8deadSopenharmony_ci          or
1645bd8deadSopenharmony_ci
1655bd8deadSopenharmony_ci        - the number of samples in the read buffer is greater than one.
1665bd8deadSopenharmony_ci
1675bd8deadSopenharmony_ci
1685bd8deadSopenharmony_ciAdditions to Chapter 9 of the OpenGL 4.3 (Compatibility Profile) Specification
1695bd8deadSopenharmony_ci(Framebuffers and Framebuffer Objects)
1705bd8deadSopenharmony_ci
1715bd8deadSopenharmony_ci    Edit Section 9.4.2 (Whole Framebuffer Completeness), p. 314
1725bd8deadSopenharmony_ci
1735bd8deadSopenharmony_ci    - The number of samples in an attached image is determined by the value of
1745bd8deadSopenharmony_ci      RENDERBUFFER_SAMPLES for renderbuffer images, and by the value of
1755bd8deadSopenharmony_ci      TEXTURE_SAMPLES for texture images. All attached color images must have
1765bd8deadSopenharmony_ci      the same number of samples. If the depth and stencil attachments are both
1775bd8deadSopenharmony_ci      populated, those two images must have the same number of samples. If any
1785bd8deadSopenharmony_ci      color attachments are populated and either the depth or stencil
1795bd8deadSopenharmony_ci      attachments are populated, the following rules apply. If there is an
1805bd8deadSopenharmony_ci      image attached to the depth (stencil) attachment, it must have the same
1815bd8deadSopenharmony_ci      number of samples as the color attachments if the value of
1825bd8deadSopenharmony_ci      MIXED_DEPTH_SAMPLES_SUPPORTED_NV (MIXED_STENCIL_SAMPLES_SUPPORTED_NV) is
1835bd8deadSopenharmony_ci      FALSE. If the value of MIXED_DEPTH_SAMPLES_SUPPORTED_NV
1845bd8deadSopenharmony_ci      (MIXED_STENCIL_SAMPLES_SUPPORTED_NV) is TRUE, then the number of samples
1855bd8deadSopenharmony_ci      in the depth (stencil) image must be an integer multiple of the number
1865bd8deadSopenharmony_ci      of samples in the color attachments.
1875bd8deadSopenharmony_ci
1885bd8deadSopenharmony_ci        { FRAMEBUFFER_INCOMPLETE_MULTISAMPLE }
1895bd8deadSopenharmony_ci
1905bd8deadSopenharmony_ci    ...
1915bd8deadSopenharmony_ci
1925bd8deadSopenharmony_ci    The values of SAMPLE_BUFFERS, SAMPLES, COLOR_SAMPLES_NV, DEPTH_SAMPLES_NV,
1935bd8deadSopenharmony_ci    and STENCIL_SAMPLES_NV are derived from the attachments of the currently
1945bd8deadSopenharmony_ci    bound draw framebuffer object. If the current DRAW_FRAMEBUFFER_BINDING is
1955bd8deadSopenharmony_ci    not framebuffer complete, then all these values are undefined. Otherwise,
1965bd8deadSopenharmony_ci    COLOR_SAMPLES_NV is equal to the value of RENDERBUFFER_SAMPLES or
1975bd8deadSopenharmony_ci    TEXTURE_SAMPLES (depending on the type of the attached images) of the
1985bd8deadSopenharmony_ci    attached color images, which must all have the same value. DEPTH_SAMPLES_NV
1995bd8deadSopenharmony_ci    and STENCIL_SAMPLES_NV are equal to the number of samples in the
2005bd8deadSopenharmony_ci    corresponding attached images. If there are no corresponding attachments,
2015bd8deadSopenharmony_ci    these values are equal to zero. SAMPLES is equal to the first non-zero
2025bd8deadSopenharmony_ci    value from the list of STENCIL_SAMPLES_NV, DEPTH_SAMPLES_NV, and
2035bd8deadSopenharmony_ci    COLOR_SAMPLES_NV. SAMPLE_BUFFERS is one if any attachment has more than one
2045bd8deadSopenharmony_ci    sample. Otherwise, SAMPLE_BUFFERS is zero.
2055bd8deadSopenharmony_ci
2065bd8deadSopenharmony_ci
2075bd8deadSopenharmony_ciAdditions to Chapter 14 of the OpenGL 4.3 (Compatibility Profile) Specification
2085bd8deadSopenharmony_ci(Rasterization)
2095bd8deadSopenharmony_ci
2105bd8deadSopenharmony_ci    Modify Section 14.3.1 (Multisampling), p. 478
2115bd8deadSopenharmony_ci
2125bd8deadSopenharmony_ci    (replace the introductory language at the beginning of the section to
2135bd8deadSopenharmony_ci     account for the new ability to use multisample rasterization without
2145bd8deadSopenharmony_ci     having multisample storage)
2155bd8deadSopenharmony_ci
2165bd8deadSopenharmony_ci    Multisampling is a mechanism to antialias all GL primitives: points,
2175bd8deadSopenharmony_ci    lines, polygons, bitmaps, and images. The technique is to sample all
2185bd8deadSopenharmony_ci    primitives multiple times at each pixel. The color sample values are
2195bd8deadSopenharmony_ci    resolved to a single, displayable color. For window system-provided
2205bd8deadSopenharmony_ci    framebuffers, this occurs each time a pixel is updated, so the
2215bd8deadSopenharmony_ci    antialiasing appears to be automatic at the application level. For
2225bd8deadSopenharmony_ci    application-created framebuffers, this must be requested by calling
2235bd8deadSopenharmony_ci    the BlitFramebuffer command (see section 18.3.1). Because each sample
2245bd8deadSopenharmony_ci    includes color, depth, and stencil information, the color (including
2255bd8deadSopenharmony_ci    texture operation), depth, and stencil functions perform
2265bd8deadSopenharmony_ci    equivalently to the single-sample mode.
2275bd8deadSopenharmony_ci
2285bd8deadSopenharmony_ci    When the framebuffer includes a multisample buffer, separate color, depth,
2295bd8deadSopenharmony_ci    and stencil values are stored in this buffer for each sample location.
2305bd8deadSopenharmony_ci    Samples contain separate color values for each fragment color.
2315bd8deadSopenharmony_ci    Framebuffers including a multisample buffer do not include non-multisample
2325bd8deadSopenharmony_ci    depth or stencil buffers, even if the multisample buffer does not store
2335bd8deadSopenharmony_ci    depth or stencil values.  Color buffers do coexist with the multisample
2345bd8deadSopenharmony_ci    buffer, however.
2355bd8deadSopenharmony_ci
2365bd8deadSopenharmony_ci    The color sample values are resolved to a single, displayable color each
2375bd8deadSopenharmony_ci    time a pixel is updated, so the antialiasing appears to be automatic at
2385bd8deadSopenharmony_ci    the application level. Because each sample includes color, depth, and
2395bd8deadSopenharmony_ci    stencil information, the color (including texture operation), depth, and
2405bd8deadSopenharmony_ci    stencil functions perform equivalently to the single-sample mode.
2415bd8deadSopenharmony_ci
2425bd8deadSopenharmony_ci    Multisample antialiasing is most valuable for rendering polygons, because
2435bd8deadSopenharmony_ci    it requires no sorting for hidden surface elimination, and it correctly
2445bd8deadSopenharmony_ci    handles adjacent polygons, object silhouettes, and even intersecting
2455bd8deadSopenharmony_ci    polygons. If only points or lines are being rendered, the "smooth"
2465bd8deadSopenharmony_ci    antialiasing mechanism provided by the base GL may result in a higher
2475bd8deadSopenharmony_ci    quality image. This mechanism is designed to allow multisample and smooth
2485bd8deadSopenharmony_ci    antialiasing techniques to be alternated during the rendering of a single
2495bd8deadSopenharmony_ci    scene.
2505bd8deadSopenharmony_ci
2515bd8deadSopenharmony_ci    If the value of MULTISAMPLE_RASTERIZATION_ALLOWED_EXT is TRUE, the
2525bd8deadSopenharmony_ci    rasterization of all primitives is changed, and is referred to as
2535bd8deadSopenharmony_ci    multisample rasterization. Otherwise, primitive rasterization is
2545bd8deadSopenharmony_ci    referred to as single-sample rasterization. The value of MULTISAMPLE-
2555bd8deadSopenharmony_ci    _RASTERIZATION_ALLOWED_EXT is queried by calling GetIntegerv
2565bd8deadSopenharmony_ci    with pname set to MULTISAMPLE_RASTERIZATION_ALLOWED_EXT.
2575bd8deadSopenharmony_ci
2585bd8deadSopenharmony_ci    During multisample rendering the contents of a pixel fragment are changed
2595bd8deadSopenharmony_ci    in two ways. First, each fragment includes a coverage value with
2605bd8deadSopenharmony_ci    EFFECTIVE_RASTER_SAMPLES_EXT bits.  The value of EFFECTIVE_RASTER_-
2615bd8deadSopenharmony_ci    SAMPLES_EXT is an implementation-dependent constant, and
2625bd8deadSopenharmony_ci    is queried by calling GetIntegerv with pname set to EFFECTIVE_RASTER-
2635bd8deadSopenharmony_ci    _SAMPLES_EXT.
2645bd8deadSopenharmony_ci
2655bd8deadSopenharmony_ci
2665bd8deadSopenharmony_ci    Multisample rasterization may also be enabled without introducing
2675bd8deadSopenharmony_ci    additional storage for the multisample buffer, by calling Enable with a
2685bd8deadSopenharmony_ci    <target> of RASTER_MULTISAMPLE_EXT.  The command:
2695bd8deadSopenharmony_ci
2705bd8deadSopenharmony_ci        void RasterSamplesEXT(uint samples, boolean fixedsamplelocations);
2715bd8deadSopenharmony_ci
2725bd8deadSopenharmony_ci    selects the number of samples to be used for rasterization. <samples>
2735bd8deadSopenharmony_ci    represents a request for a desired minimum number of samples. Since
2745bd8deadSopenharmony_ci    different implementations may support different sample counts, the actual
2755bd8deadSopenharmony_ci    sample pattern used is implementation-dependent. However, the resulting
2765bd8deadSopenharmony_ci    value for RASTER_SAMPLES_EXT is guaranteed to be greater than or equal to
2775bd8deadSopenharmony_ci    <samples> and no more than the next larger sample count supported by the
2785bd8deadSopenharmony_ci    implementation. If <fixedsamplelocations> is TRUE, identical sample
2795bd8deadSopenharmony_ci    locations will be used for all pixels. The sample locations chosen are a
2805bd8deadSopenharmony_ci    function of only the parameters to RasterSamplesEXT and not of any other
2815bd8deadSopenharmony_ci    state.
2825bd8deadSopenharmony_ci
2835bd8deadSopenharmony_ci    If RASTER_MULTISAMPLE_EXT is enabled, then the sample pattern chosen by
2845bd8deadSopenharmony_ci    RasterSamplesEXT will be used instead of sampling at the center of the
2855bd8deadSopenharmony_ci    pixel. The sample locations can be queried with GetMultisamplefv with a
2865bd8deadSopenharmony_ci    <pname> of SAMPLE_POSITION, similar to normal multisample sample locations.
2875bd8deadSopenharmony_ci
2885bd8deadSopenharmony_ci    The value MULTISAMPLE_RASTERIZATION_ALLOWED_EXT is TRUE if SAMPLE_BUFFERS
2895bd8deadSopenharmony_ci    is one or if RASTER_MULTISAMPLE_EXT is enabled.  The value
2905bd8deadSopenharmony_ci    EFFECTIVE_RASTER_SAMPLES_EXT is equal to RASTER_SAMPLES_EXT if
2915bd8deadSopenharmony_ci    RASTER_MULTISAMPLE_EXT is enabled, otherwise is equal to SAMPLES.
2925bd8deadSopenharmony_ci
2935bd8deadSopenharmony_ci    Explicit multisample rasterization is not allowed if the raster sample
2945bd8deadSopenharmony_ci    count is less than the color sample count, or if the raster sample count
2955bd8deadSopenharmony_ci    does not match the depth or stencil sample counts when depth or stencil
2965bd8deadSopenharmony_ci    testing is performed.  If RASTER_MULTISAMPLE_EXT is enabled, the error
2975bd8deadSopenharmony_ci    INVALID_OPERATION will be generated by Draw, Bitmap, DrawPixels, and
2985bd8deadSopenharmony_ci    CopyPixels commands if
2995bd8deadSopenharmony_ci
3005bd8deadSopenharmony_ci      - the value of RASTER_SAMPLES_EXT is zero;
3015bd8deadSopenharmony_ci
3025bd8deadSopenharmony_ci      - the value of RASTER_SAMPLES_EXT is less than the value of
3035bd8deadSopenharmony_ci        COLOR_SAMPLES_NV;
3045bd8deadSopenharmony_ci
3055bd8deadSopenharmony_ci      - the depth or depth bounds test is enabled, the draw framebuffer
3065bd8deadSopenharmony_ci        includes a depth buffer, and the value of RASTER_SAMPLES_EXT does not
3075bd8deadSopenharmony_ci        equal the value of DEPTH_SAMPLES_NV; or
3085bd8deadSopenharmony_ci
3095bd8deadSopenharmony_ci      - the stencil test is enabled, the draw framebuffer includes a stencil
3105bd8deadSopenharmony_ci        buffer, and the value of RASTER_SAMPLES_EXT does not equal the value
3115bd8deadSopenharmony_ci        of STENCIL_SAMPLES_NV;
3125bd8deadSopenharmony_ci
3135bd8deadSopenharmony_ci    Errors
3145bd8deadSopenharmony_ci
3155bd8deadSopenharmony_ci    - An INVALID_VALUE error is generated if <samples> is greater than the
3165bd8deadSopenharmony_ci    value of MAX_RASTER_SAMPLES_EXT.
3175bd8deadSopenharmony_ci
3185bd8deadSopenharmony_ci
3195bd8deadSopenharmony_ci    Add to the end of Section 14.3.1.1 (Sample Shading), p. 479
3205bd8deadSopenharmony_ci
3215bd8deadSopenharmony_ci    If RASTER_MULTISAMPLE_EXT is enabled, the number of unique samples to
3225bd8deadSopenharmony_ci    process is implementation-dependent and need not be more than one.
3235bd8deadSopenharmony_ci
3245bd8deadSopenharmony_ci    If RASTER_MULTISAMPLE_EXT is disabled but the value of SAMPLES is
3255bd8deadSopenharmony_ci    greater than the value of COLOR_SAMPLES, the number of unique samples
3265bd8deadSopenharmony_ci    to process is implementation-dependent and need not be more than one.
3275bd8deadSopenharmony_ci
3285bd8deadSopenharmony_ci    Modify Section 14.4.3 (Point Multisample Rasterization)
3295bd8deadSopenharmony_ci
3305bd8deadSopenharmony_ci    If MULTISAMPLE is enabled and MULTISAMPLE_RASTERIZATION_ALLOWED_EXT is
3315bd8deadSopenharmony_ci    TRUE, then points are rasterized using the following algorithm, regardless
3325bd8deadSopenharmony_ci    of whether point antialiasing (POINT_SMOOTH) is enabled or disabled.
3335bd8deadSopenharmony_ci
3345bd8deadSopenharmony_ci    Modify Section 14.5.4 (Line Multisample Rasterization)
3355bd8deadSopenharmony_ci
3365bd8deadSopenharmony_ci    If MULTISAMPLE is enabled and MULTISAMPLE_RASTERIZATION_ALLOWED_EXT is
3375bd8deadSopenharmony_ci    TRUE, then lines are rasterized using the following algorithm, regardless
3385bd8deadSopenharmony_ci    of whether line antialiasing (LINE_SMOOTH) is enabled or disabled.
3395bd8deadSopenharmony_ci
3405bd8deadSopenharmony_ci    Modify Section 14.6.6 (Polygon Multisample Rasterization)
3415bd8deadSopenharmony_ci
3425bd8deadSopenharmony_ci    If MULTISAMPLE is enabled and MULTISAMPLE_RASTERIZATION_ALLOWED_EXT is
3435bd8deadSopenharmony_ci    TRUE, then polygons are rasterized using the following algorithm,
3445bd8deadSopenharmony_ci    regardless of whether polygon antialiasing (POLYGON_SMOOTH) is enabled or
3455bd8deadSopenharmony_ci    disabled.
3465bd8deadSopenharmony_ci
3475bd8deadSopenharmony_ci    Modify Section 14.8.0.1 (Bitmap Multisample Rasterization)
3485bd8deadSopenharmony_ci
3495bd8deadSopenharmony_ci    If MULTISAMPLE is enabled and MULTISAMPLE_RASTERIZATION_ALLOWED_EXT is
3505bd8deadSopenharmony_ci    TRUE, then bitmaps are rasterized using the following algorithm.
3515bd8deadSopenharmony_ci
3525bd8deadSopenharmony_ciAdditions to Chapter 15 of the OpenGL 4.3 (Compatibility Profile) Specification
3535bd8deadSopenharmony_ci(Programmable Fragment Processing)
3545bd8deadSopenharmony_ci
3555bd8deadSopenharmony_ci    Modify Section 15.2.2 (Shader Inputs), p. 512
3565bd8deadSopenharmony_ci
3575bd8deadSopenharmony_ci    The built-in variable gl_SampleMaskIn is an integer array holding bitfields
3585bd8deadSopenharmony_ci    indicating the set of fragment samples covered by the primitive
3595bd8deadSopenharmony_ci    corresponding to the fragment shader invocation. The number of elements in
3605bd8deadSopenharmony_ci    the array is
3615bd8deadSopenharmony_ci
3625bd8deadSopenharmony_ci        ceil(s/32),
3635bd8deadSopenharmony_ci
3645bd8deadSopenharmony_ci    where <s> is the maximum number of color or raster samples supported by the
3655bd8deadSopenharmony_ci    implementation. Bit <n> of element <w> in the array is set if and only if
3665bd8deadSopenharmony_ci    the raster sample numbered 32<w> + <n> is considered covered for this
3675bd8deadSopenharmony_ci    fragment shader invocation.
3685bd8deadSopenharmony_ci
3695bd8deadSopenharmony_ci    Modify Section 15.2.3 (Shader Outputs), p. 513
3705bd8deadSopenharmony_ci
3715bd8deadSopenharmony_ci    The built-in integer array gl_SampleMask can be used to change the sample
3725bd8deadSopenharmony_ci    coverage for a fragment from within the shader. The number of elements in
3735bd8deadSopenharmony_ci    the array is
3745bd8deadSopenharmony_ci
3755bd8deadSopenharmony_ci        ceil(s/32),
3765bd8deadSopenharmony_ci
3775bd8deadSopenharmony_ci    where <s> is the maximum number of color or raster samples supported by the
3785bd8deadSopenharmony_ci    implementation.
3795bd8deadSopenharmony_ci
3805bd8deadSopenharmony_ciAdditions to Chapter 17 of the OpenGL 4.3 (Compatibility Profile) Specification
3815bd8deadSopenharmony_ci(Writing Fragments and Samples to the Framebuffer)
3825bd8deadSopenharmony_ci
3835bd8deadSopenharmony_ci    Modify Figure 17.1 (Per-fragment operations)
3845bd8deadSopenharmony_ci
3855bd8deadSopenharmony_ci    Add a new stage called "Coverage Reduction" between "Occlusion Query" and
3865bd8deadSopenharmony_ci    "Blending".
3875bd8deadSopenharmony_ci
3885bd8deadSopenharmony_ci    (note: If NV_fragment_coverage_to_color is supported, the "Coverage
3895bd8deadSopenharmony_ci    Reduction" stage is after the "Fragment coverage to color" stage.)
3905bd8deadSopenharmony_ci
3915bd8deadSopenharmony_ci
3925bd8deadSopenharmony_ci    Modify Section 17.3.3 (Multisample Fragment Operations)
3935bd8deadSopenharmony_ci
3945bd8deadSopenharmony_ci    First paragraph:
3955bd8deadSopenharmony_ci    ...No changes to the fragment alpha or coverage values are made at this
3965bd8deadSopenharmony_ci    step if MULTISAMPLE is disabled or MULTISAMPLE_RASTERIZATION_ALLOWED_EXT is
3975bd8deadSopenharmony_ci    FALSE.
3985bd8deadSopenharmony_ci
3995bd8deadSopenharmony_ci    ...
4005bd8deadSopenharmony_ci
4015bd8deadSopenharmony_ci    If SAMPLE_ALPHA_TO_COVERAGE is enabled, a temporary coverage value is
4025bd8deadSopenharmony_ci    generated where each bit is determined by the alpha value at the
4035bd8deadSopenharmony_ci    corresponding sample location. The coverage value has
4045bd8deadSopenharmony_ci    EFFECTIVE_RASTER_SAMPLES_EXT bits.
4055bd8deadSopenharmony_ci
4065bd8deadSopenharmony_ci
4075bd8deadSopenharmony_ci    Modify Section 17.3.7 (Occlusion Queries), p.538
4085bd8deadSopenharmony_ci
4095bd8deadSopenharmony_ci    When an occlusion query is started with target SAMPLES_PASSED, the samples-
4105bd8deadSopenharmony_ci    passed count maintained by the GL is set to zero. When an occlusion query
4115bd8deadSopenharmony_ci    is active, the samples-passed count is incremented for each fragment that
4125bd8deadSopenharmony_ci    passes the depth test. If MULTISAMPLE_RASTERIZATION_ALLOWED_EXT is FALSE,
4135bd8deadSopenharmony_ci    then the samples-passed count is incremented by 1 for each fragment. If
4145bd8deadSopenharmony_ci    MULTISAMPLE_RASTERIZATION_ALLOWED_EXT is TRUE, then the samples-passed
4155bd8deadSopenharmony_ci    count is incremented by the number of samples whose coverage bit is set.
4165bd8deadSopenharmony_ci    However, implementations, at their discretion, may instead increase the
4175bd8deadSopenharmony_ci    samples-passed count by the value of EFFECTIVE_RASTER_SAMPLES_EXT if any
4185bd8deadSopenharmony_ci    sample in the fragment is covered.  Additionally, if
4195bd8deadSopenharmony_ci    RASTER_MULTISAMPLE_EXT is enabled, implementations may instead increase
4205bd8deadSopenharmony_ci    the samples-passed count by one for the entire fragment if any sample
4215bd8deadSopenharmony_ci    is covered.
4225bd8deadSopenharmony_ci
4235bd8deadSopenharmony_ci
4245bd8deadSopenharmony_ci    Add a new Section 17.3.Y (Coverage Reduction) after 17.3.7.
4255bd8deadSopenharmony_ci
4265bd8deadSopenharmony_ci    If the value of EFFECTIVE_RASTER_SAMPLES_EXT is greater than the value of
4275bd8deadSopenharmony_ci    COLOR_SAMPLES_NV, a fragment's coverage is reduced from
4285bd8deadSopenharmony_ci    EFFECTIVE_RASTER_SAMPLES_EXT bits to COLOR_SAMPLES_NV bits. There is an
4295bd8deadSopenharmony_ci    implementation-dependent association of raster samples to color samples.
4305bd8deadSopenharmony_ci    The reduced "color coverage" is computed such that the coverage bit for
4315bd8deadSopenharmony_ci    each color sample is 1 if any of the associated bits in the fragment's
4325bd8deadSopenharmony_ci    coverage is on, and 0 otherwise.  Blending and writes to the framebuffer
4335bd8deadSopenharmony_ci    are not performed on samples whose color coverage bit is zero.
4345bd8deadSopenharmony_ci
4355bd8deadSopenharmony_ci    For each color sample, the associated bits of the fragment's coverage are
4365bd8deadSopenharmony_ci    counted and divided by the number of associated bits to produce a
4375bd8deadSopenharmony_ci    modulation factor R in the range (0,1] (a value of zero would have been
4385bd8deadSopenharmony_ci    killed due to a color coverage of 0). Specifically:
4395bd8deadSopenharmony_ci
4405bd8deadSopenharmony_ci        N = value of EFFECTIVE_RASTER_SAMPLES_EXT;
4415bd8deadSopenharmony_ci        M = value of COLOR_SAMPLES_NV;
4425bd8deadSopenharmony_ci        R = popcount(associated coverage bits) / (N / M);
4435bd8deadSopenharmony_ci
4445bd8deadSopenharmony_ci    If COVERAGE_MODULATION_TABLE_NV is enabled, the value R is mapped
4455bd8deadSopenharmony_ci    through a programmable lookup table to produce another value. The lookup
4465bd8deadSopenharmony_ci    table has a fixed, implementation-dependent, size according to the value
4475bd8deadSopenharmony_ci    of COVERAGE_MODULATION_TABLE_SIZE_NV.
4485bd8deadSopenharmony_ci
4495bd8deadSopenharmony_ci        S = value of COVERAGE_MODULATION_TABLE_SIZE_NV
4505bd8deadSopenharmony_ci        I = max(1, int(R*S));
4515bd8deadSopenharmony_ci        R = table[I-1];
4525bd8deadSopenharmony_ci
4535bd8deadSopenharmony_ci    Note that the table does not have an entry for R=0, because such samples
4545bd8deadSopenharmony_ci    would have been killed. The table is controlled by the command:
4555bd8deadSopenharmony_ci
4565bd8deadSopenharmony_ci        CoverageModulationTableNV(sizei n, const float *v);
4575bd8deadSopenharmony_ci
4585bd8deadSopenharmony_ci    where <v> contains S floating point values. The values are rounded on use
4595bd8deadSopenharmony_ci    to an implementation dependent precision, which is at least as fine as
4605bd8deadSopenharmony_ci    1 / N, and clamped to [0,1]. Initially, COVERAGE_MODULATION_TABLE_NV is
4615bd8deadSopenharmony_ci    disabled, and the table is initialized with entry i = ((i+1) / S). An
4625bd8deadSopenharmony_ci    INVALID_VALUE error is generated if <n> is not equal to
4635bd8deadSopenharmony_ci    COVERAGE_MODULATION_TABLE_SIZE_NV. The command
4645bd8deadSopenharmony_ci
4655bd8deadSopenharmony_ci        GetCoverageModulationTableNV(sizei bufsize, float *v);
4665bd8deadSopenharmony_ci
4675bd8deadSopenharmony_ci    obtains the coverage modulation table. min(bufsize/sizeof(float),S)
4685bd8deadSopenharmony_ci    floating point values are written to <v>, in order.
4695bd8deadSopenharmony_ci
4705bd8deadSopenharmony_ci    For each draw buffer with a floating point or normalized color format, the
4715bd8deadSopenharmony_ci    fragment's color value and second source color [for ARB_blend_func_extended]
4725bd8deadSopenharmony_ci    is replicated to M values which may each be modulated (multiplied) by
4735bd8deadSopenharmony_ci    that color sample's associated value of R. This modulation is controlled
4745bd8deadSopenharmony_ci    by the function:
4755bd8deadSopenharmony_ci
4765bd8deadSopenharmony_ci        CoverageModulationNV(enum components);
4775bd8deadSopenharmony_ci
4785bd8deadSopenharmony_ci    <components> may be RGB, RGBA, ALPHA, or NONE. If <components> is RGB or
4795bd8deadSopenharmony_ci    RGBA, the red, green, and blue components are modulated. If components is
4805bd8deadSopenharmony_ci    RGBA or ALPHA, the alpha component is modulated. The initial value of
4815bd8deadSopenharmony_ci    COVERAGE_MODULATION_NV is NONE.
4825bd8deadSopenharmony_ci
4835bd8deadSopenharmony_ci    Each sample's color value is then blended and written to the framebuffer
4845bd8deadSopenharmony_ci    independently.
4855bd8deadSopenharmony_ci
4865bd8deadSopenharmony_ci
4875bd8deadSopenharmony_ciAdditions to Chapter 18 of the OpenGL 4.3 (Compatibility Profile) Specification
4885bd8deadSopenharmony_ci(Drawing, Reading, and Copying Pixels)
4895bd8deadSopenharmony_ci
4905bd8deadSopenharmony_ci    Modify Section 18.1.3 (Pixel Rectangle Multisample Rasterization)
4915bd8deadSopenharmony_ci
4925bd8deadSopenharmony_ci    If MULTISAMPLE is enabled and MULTISAMPLE_RASTERIZATION_ALLOWED_EXT is TRUE,
4935bd8deadSopenharmony_ci    then pixel rectangles are rasterized using the following algorithm.
4945bd8deadSopenharmony_ci
4955bd8deadSopenharmony_ci    Modify Section 18.2 (Reading Pixels)
4965bd8deadSopenharmony_ci
4975bd8deadSopenharmony_ci    Replace the error check for ReadPixels, redefining one error condition in
4985bd8deadSopenharmony_ci    terms of the sample count of the targeted color buffer instead of
4995bd8deadSopenharmony_ci    SAMPLE_BUFFERS:
5005bd8deadSopenharmony_ci
5015bd8deadSopenharmony_ci    An INVALID_OPERATION error is generated if the value of READ_-
5025bd8deadSopenharmony_ci    FRAMEBUFFER_BINDING (see section 9) is non-zero, the read framebuffer is
5035bd8deadSopenharmony_ci    framebuffer complete, and the number of samples in the read buffer is
5045bd8deadSopenharmony_ci    greater than one.
5055bd8deadSopenharmony_ci
5065bd8deadSopenharmony_ci    Modify Section 18.3 (Copying Pixels)
5075bd8deadSopenharmony_ci
5085bd8deadSopenharmony_ci    Replace the second error check for CopyPixels, redefining one error
5095bd8deadSopenharmony_ci    condition in terms of the sample count of the targeted color buffer
5105bd8deadSopenharmony_ci    instead of SAMPLE_BUFFERS:
5115bd8deadSopenharmony_ci
5125bd8deadSopenharmony_ci    An INVALID_OPERATION error is generated if the object bound to
5135bd8deadSopenharmony_ci    READ_FRAMEBUFFER_BINDING is framebuffer complete and the number of samples
5145bd8deadSopenharmony_ci    in the read buffer is greater than one.
5155bd8deadSopenharmony_ci
5165bd8deadSopenharmony_ci    An INVALID_OPERATION error is generated if the value of READ_-
5175bd8deadSopenharmony_ci    FRAMEBUFFER_BINDING (see section 9) is non-zero, the read framebuffer is
5185bd8deadSopenharmony_ci    framebuffer complete, and the number of samples in the read buffer is
5195bd8deadSopenharmony_ci    greater than one.
5205bd8deadSopenharmony_ci
5215bd8deadSopenharmony_ci    Modify Section 18.3.1 (Blitting Pixel Rectangles), p. 580
5225bd8deadSopenharmony_ci
5235bd8deadSopenharmony_ci    (redefine various language in terms of sample counts in individual buffers
5245bd8deadSopenharmony_ci    instead of SAMPLE_BUFFERS)
5255bd8deadSopenharmony_ci
5265bd8deadSopenharmony_ci    If the number of samples in the source buffer is greater than one and the
5275bd8deadSopenharmony_ci    number of samples in the destination buffers is equal to one, the samples
5285bd8deadSopenharmony_ci    corresponding to each pixel location in the source are converted to a
5295bd8deadSopenharmony_ci    single sample before being written to the destination.
5305bd8deadSopenharmony_ci
5315bd8deadSopenharmony_ci    If the number of samples in the source buffer is one and the number of
5325bd8deadSopenharmony_ci    samples in the destination buffers are greater than one, the value of the
5335bd8deadSopenharmony_ci    source sample is replicated in each of the destination samples.
5345bd8deadSopenharmony_ci
5355bd8deadSopenharmony_ci    If the number of samples in the source buffer or in any of the destination
5365bd8deadSopenharmony_ci    buffers is greater than one, no copy is performed and an INVALID_OPERATION
5375bd8deadSopenharmony_ci    error is generated if the dimensions of the source and destination
5385bd8deadSopenharmony_ci    rectangles provided to BlitFramebuffer are not identical, or if the formats
5395bd8deadSopenharmony_ci    of the read and draw framebuffers are not identical.
5405bd8deadSopenharmony_ci
5415bd8deadSopenharmony_ci    If the number of samples in the source and destination buffers are equal
5425bd8deadSopenharmony_ci    and greater than zero, the samples are copied without modification from the
5435bd8deadSopenharmony_ci    read framebuffer to the draw framebuffer. Otherwise, no copy is performed
5445bd8deadSopenharmony_ci    and an INVALID_OPERATION error is generated.
5455bd8deadSopenharmony_ci
5465bd8deadSopenharmony_ci
5475bd8deadSopenharmony_ciNew Implementation Dependent State
5485bd8deadSopenharmony_ci
5495bd8deadSopenharmony_ci                                                      Minimum
5505bd8deadSopenharmony_ci    Get Value                    Type    Get Command  Value   Description                   Sec.
5515bd8deadSopenharmony_ci    ---------                    ------- -----------  ------- ------------------------      ------
5525bd8deadSopenharmony_ci    MAX_RASTER_SAMPLES_EXT       Z+      GetIntegerv  2       Maximum number of raster      14.3.1
5535bd8deadSopenharmony_ci                                                              samples
5545bd8deadSopenharmony_ci    MIXED_DEPTH_SAMPLES_-        B       GetBooleanv  FALSE(*)Support for number of depth   9.4.2
5555bd8deadSopenharmony_ci        SUPPORTED_NV                                          samples not equal to number
5565bd8deadSopenharmony_ci                                                              of color samples
5575bd8deadSopenharmony_ci    MIXED_STENCIL_SAMPLES_-      B       GetBooleanv  FALSE(*)Support for number of depth   9.4.2
5585bd8deadSopenharmony_ci        SUPPORTED_NV                                          samples not equal to number
5595bd8deadSopenharmony_ci                                                              of color samples
5605bd8deadSopenharmony_ci    COVERAGE_MODULATION_TABLE_-  Z+      GetIntegerv  2(**)   Number of entries in the table 17.3.Y
5615bd8deadSopenharmony_ci        SIZE_NV
5625bd8deadSopenharmony_ci
5635bd8deadSopenharmony_ci    (*) footnote: Either MIXED_DEPTH_SAMPLES_SUPPORTED_NV or
5645bd8deadSopenharmony_ci    MIXED_STENCIL_SAMPLES_SUPPORTED_NV must be TRUE for this extension to be
5655bd8deadSopenharmony_ci    useful.
5665bd8deadSopenharmony_ci
5675bd8deadSopenharmony_ci    (**) Must be at least as large as MAX_RASTER_SAMPLES_EXT.
5685bd8deadSopenharmony_ci
5695bd8deadSopenharmony_ciNew State
5705bd8deadSopenharmony_ci
5715bd8deadSopenharmony_ci    Get Value                       Get Command    Type    Initial Value    Description                 Sec.    Attribute
5725bd8deadSopenharmony_ci    ---------                       -----------    ----    -------------    -----------                 ----    ---------
5735bd8deadSopenharmony_ci    RASTER_MULTISAMPLE_EXT          IsEnabled      B       FALSE            Multisample Rasterization   14.3.1  enable/multisample
5745bd8deadSopenharmony_ci                                                                            without multiple color
5755bd8deadSopenharmony_ci                                                                            samples
5765bd8deadSopenharmony_ci    RASTER_SAMPLES_EXT              GetIntegerv    Z+      0                Number of raster samples    14.3.1  multisample
5775bd8deadSopenharmony_ci    RASTER_FIXED_SAMPLE_-           GetBooleanv    B       FALSE            Require same sample         14.3.1  multisample
5785bd8deadSopenharmony_ci        LOCATIONS_EXT                                                       locations
5795bd8deadSopenharmony_ci    MULTISAMPLE_RASTERIZATION_-     GetBooleanv    B       FALSE            Whether MS rasterization    14.3.1  -
5805bd8deadSopenharmony_ci        ALLOWED_EXT                                                         can be used
5815bd8deadSopenharmony_ci    EFFECTIVE_RASTER_SAMPLES_EXT    GetIntegerv    Z+      0                How many samples are used   14.3.1  -
5825bd8deadSopenharmony_ci                                                                            for rasterization and
5835bd8deadSopenharmony_ci                                                                            fragment operations
5845bd8deadSopenharmony_ci    COLOR_SAMPLES_NV                GetIntegerv    Z+      0                Number of color samples     9.4.2   -
5855bd8deadSopenharmony_ci    DEPTH_SAMPLES_NV                GetIntegerv    Z+      0                Number of depth samples     9.4.2   -
5865bd8deadSopenharmony_ci    STENCIL_SAMPLES_NV              GetIntegerv    Z+      0                Number of stencil samples   9.4.2   -
5875bd8deadSopenharmony_ci    <blank>                         GetCoverage-   R^k[0,1] (i+1)/S         Lookup table for coverage   17.3.Y  -
5885bd8deadSopenharmony_ci                                    ModulationTableNV                       values
5895bd8deadSopenharmony_ci    COVERAGE_MODULATION_TABLE_NV    IsEnabled      B       FALSE            Enable lookup table for     17.3.Y  -
5905bd8deadSopenharmony_ci                                                                            coverage values
5915bd8deadSopenharmony_ci    COVERAGE_MODULATION_NV          GetIntegerv    E       NONE             Which components are        17.3.Y  -
5925bd8deadSopenharmony_ci                                                                            multiplied by coverage
5935bd8deadSopenharmony_ci                                                                            fraction
5945bd8deadSopenharmony_ci
5955bd8deadSopenharmony_ci
5965bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications
5975bd8deadSopenharmony_ci
5985bd8deadSopenharmony_ci    None.
5995bd8deadSopenharmony_ci
6005bd8deadSopenharmony_ciGLX Protocol
6015bd8deadSopenharmony_ci
6025bd8deadSopenharmony_ci    None.
6035bd8deadSopenharmony_ci
6045bd8deadSopenharmony_ciModifications to the OpenGL Shading Language Specification, Version 4.30
6055bd8deadSopenharmony_ci
6065bd8deadSopenharmony_ci    Modify Section 7.1 (Built-In Language Variables), p. 118
6075bd8deadSopenharmony_ci
6085bd8deadSopenharmony_ci    For both the input array gl_SampleMaskIn[] and the output array
6095bd8deadSopenharmony_ci    gl_SampleMask[], bit B of mask M (gl_SampleMaskIn[M] or gl_SampleMask[M])
6105bd8deadSopenharmony_ci    corresponds to sample 32*M+B. These arrays have ceil(s/32) elements, where
6115bd8deadSopenharmony_ci    s is the maximum number of color or raster samples supported by the
6125bd8deadSopenharmony_ci    implementation.
6135bd8deadSopenharmony_ci
6145bd8deadSopenharmony_ci
6155bd8deadSopenharmony_ciInteractions with OpenGL ES 3.0
6165bd8deadSopenharmony_ci
6175bd8deadSopenharmony_ci    For OpenGL ES, remove references to images, bitmaps and GetDoublev.
6185bd8deadSopenharmony_ci    Disregard references to POINT_SMOOTH, LINE_SMOOTH and POLYGON_SMOOTH.
6195bd8deadSopenharmony_ci
6205bd8deadSopenharmony_ci    Omit changes to Section 14.8.0.1 (Bitmap Multisample Rasterization).
6215bd8deadSopenharmony_ci    Also, omit changes to Section 18.1.3 (Pixel Rectangle Multisample
6225bd8deadSopenharmony_ci    Rasterization) and Section 18.3 (Copying Pixels).
6235bd8deadSopenharmony_ci
6245bd8deadSopenharmony_ci    Since OpenGL ES does not support enabling/disabling MULTISAMPLE
6255bd8deadSopenharmony_ci    rasterization via MULTISAMPLE, read all occurrences of MULTISAMPLE
6265bd8deadSopenharmony_ci    as if it was enabled.
6275bd8deadSopenharmony_ci
6285bd8deadSopenharmony_ci
6295bd8deadSopenharmony_ciInteractions with OpenGL ES 3.1
6305bd8deadSopenharmony_ci
6315bd8deadSopenharmony_ci    If this extension is implemented on OpenGL ES and OpenGL ES 3.1 is
6325bd8deadSopenharmony_ci    not supported, remove any language referring to TEXTURE_SAMPLES.
6335bd8deadSopenharmony_ci
6345bd8deadSopenharmony_ci
6355bd8deadSopenharmony_ciDependencies on ARB_blend_func_extended
6365bd8deadSopenharmony_ci
6375bd8deadSopenharmony_ci    If this extension is not supported, remove the phrase "and second
6385bd8deadSopenharmony_ci    source color [for ARB_blend_func_extended]" from the new Section 17.3.Y
6395bd8deadSopenharmony_ci    (Coverage Reduction).
6405bd8deadSopenharmony_ci
6415bd8deadSopenharmony_ci
6425bd8deadSopenharmony_ciDependencies on NV_framebuffer_multisample
6435bd8deadSopenharmony_ci
6445bd8deadSopenharmony_ci    If this extension is implemented on OpenGL ES and NV_framebuffer_multisample
6455bd8deadSopenharmony_ci    is not supported, disregard changes to BlitFramebuffer where the
6465bd8deadSopenharmony_ci    number of samples in the draw framebuffer is greater than one.
6475bd8deadSopenharmony_ci
6485bd8deadSopenharmony_ci
6495bd8deadSopenharmony_ciDependencies on OES_sample_shading
6505bd8deadSopenharmony_ci
6515bd8deadSopenharmony_ci    If this extension is implemented on OpenGL ES and  if
6525bd8deadSopenharmony_ci    OES_sample_shading is not supported, omit changes to Section 14.3.3.1
6535bd8deadSopenharmony_ci    (Sample Shading).
6545bd8deadSopenharmony_ci
6555bd8deadSopenharmony_ci
6565bd8deadSopenharmony_ciDependencies on OES_sample_variables
6575bd8deadSopenharmony_ci
6585bd8deadSopenharmony_ci    If this extension is implemented on OpenGL ES and  if
6595bd8deadSopenharmony_ci    OES_sample_variables is not supported, omit changes to Section 3.9.2
6605bd8deadSopenharmony_ci    (Shader Inputs; Shader Outputs).
6615bd8deadSopenharmony_ci
6625bd8deadSopenharmony_ci
6635bd8deadSopenharmony_ciDependencies on EXT_depth_bounds_test
6645bd8deadSopenharmony_ci
6655bd8deadSopenharmony_ci    If EXT_depth_bounds_test is not supported, remove the error check when
6665bd8deadSopenharmony_ci    DBT is enabled.
6675bd8deadSopenharmony_ci
6685bd8deadSopenharmony_ciErrors
6695bd8deadSopenharmony_ci
6705bd8deadSopenharmony_ci    Various errors prohibiting read/copy operations involving multisample
6715bd8deadSopenharmony_ci    color buffers are redefined to refer to the sample count of the targeted
6725bd8deadSopenharmony_ci    color buffer instead of a whole-framebuffer RASTER_SAMPLES.  This
6735bd8deadSopenharmony_ci    extension allows a single-sample color buffer to be combined with a
6745bd8deadSopenharmony_ci    multisample depth/stencil buffer and defines RASTER_SAMPLES to be 1 in
6755bd8deadSopenharmony_ci    that case.
6765bd8deadSopenharmony_ci
6775bd8deadSopenharmony_ci    The error INVALID_OPERATION is be generated by Draw, Bitmap, DrawPixels,
6785bd8deadSopenharmony_ci    and CopyPixels commands if RASTER_MULTISAMPLE_EXT is enabled, and any of
6795bd8deadSopenharmony_ci    the following is true:
6805bd8deadSopenharmony_ci
6815bd8deadSopenharmony_ci      - the value of RASTER_SAMPLES_EXT is zero;
6825bd8deadSopenharmony_ci
6835bd8deadSopenharmony_ci      - the value of RASTER_SAMPLES_EXT is less than the value of
6845bd8deadSopenharmony_ci        COLOR_SAMPLES_NV;
6855bd8deadSopenharmony_ci
6865bd8deadSopenharmony_ci      - the depth or depth bounds test is enabled, the draw framebuffer
6875bd8deadSopenharmony_ci        includes a depth buffer, and the value of RASTER_SAMPLES_EXT does not
6885bd8deadSopenharmony_ci        equal the value of DEPTH_SAMPLES_NV; or
6895bd8deadSopenharmony_ci
6905bd8deadSopenharmony_ci      - the stencil test is enabled, the draw framebuffer includes a stencil
6915bd8deadSopenharmony_ci        buffer, and the value of RASTER_SAMPLES_EXT does not equal the value
6925bd8deadSopenharmony_ci        of STENCIL_SAMPLES_NV.
6935bd8deadSopenharmony_ci
6945bd8deadSopenharmony_ci    The error INVALID_VALUE is generated by RasterSamplesEXT if <samples> is
6955bd8deadSopenharmony_ci    greater than the value of MAX_RASTER_SAMPLES_EXT.
6965bd8deadSopenharmony_ci
6975bd8deadSopenharmony_ci    The error INVALID_VALUE is generated by CoverageModulationTableNV if <n>
6985bd8deadSopenharmony_ci    is not equal to COVERAGE_MODULATION_TABLE_SIZE_NV.
6995bd8deadSopenharmony_ci
7005bd8deadSopenharmony_ciNVIDIA Implementation Details
7015bd8deadSopenharmony_ci
7025bd8deadSopenharmony_ci    NVIDIA GPUs before the Maxwell 2 generation do not support this
7035bd8deadSopenharmony_ci    extension.  This includes GM10x GPUs from the first Maxwell
7045bd8deadSopenharmony_ci    generation.
7055bd8deadSopenharmony_ci
7065bd8deadSopenharmony_ci    GM20x-based GPUs (GeForce 9xx series, Quadro M6000, Tegra X1, etc.)
7075bd8deadSopenharmony_ci    and later GPUs support the following mixtures of samples:
7085bd8deadSopenharmony_ci
7095bd8deadSopenharmony_ci        Color samples  Stencil samples  Depth samples
7105bd8deadSopenharmony_ci        =============  ===============  =============
7115bd8deadSopenharmony_ci        1              1                1
7125bd8deadSopenharmony_ci        1              2                2
7135bd8deadSopenharmony_ci        1              4                4
7145bd8deadSopenharmony_ci        1              8                8
7155bd8deadSopenharmony_ci        1              16               0
7165bd8deadSopenharmony_ci        -------------  ---------------  -------------
7175bd8deadSopenharmony_ci        2              2                2
7185bd8deadSopenharmony_ci        2              4                4
7195bd8deadSopenharmony_ci        2              8                8
7205bd8deadSopenharmony_ci        2              16               0
7215bd8deadSopenharmony_ci        -------------  ---------------  -------------
7225bd8deadSopenharmony_ci        4              4                4
7235bd8deadSopenharmony_ci        4              8                8
7245bd8deadSopenharmony_ci        4              16               0
7255bd8deadSopenharmony_ci        -------------  ---------------  -------------
7265bd8deadSopenharmony_ci        8              8                8
7275bd8deadSopenharmony_ci        8              16               0
7285bd8deadSopenharmony_ci
7295bd8deadSopenharmony_ci    A non-zero stencil or depth sample count can always be made zero.
7305bd8deadSopenharmony_ci    For example, 4 color samples with 8 stencil samples but no depth
7315bd8deadSopenharmony_ci    samples is supported.
7325bd8deadSopenharmony_ci
7335bd8deadSopenharmony_ci    If you have a non-zero number of 24-bit fixed-point depth samples,
7345bd8deadSopenharmony_ci    the corresponding storage for the sample number of stencil samples
7355bd8deadSopenharmony_ci    is allocated even if zero samples are requested.
7365bd8deadSopenharmony_ci
7375bd8deadSopenharmony_ci    When there are zero depth samples but non-zero stencil samples, GM20x
7385bd8deadSopenharmony_ci    benefits from stencil bandwidth mitigation technology.  So rendering
7395bd8deadSopenharmony_ci    performance (e.g. path rendering) is significantly better when an
7405bd8deadSopenharmony_ci    application can use the stencil buffer without allocating a depth
7415bd8deadSopenharmony_ci    buffer.
7425bd8deadSopenharmony_ci
7435bd8deadSopenharmony_ci    As the table indicates, rendering with 16 stencil samples requires
7445bd8deadSopenharmony_ci    no depth samples.
7455bd8deadSopenharmony_ci
7465bd8deadSopenharmony_ci    NVIDIA's implementation-dependent behavior when sample shading enabled
7475bd8deadSopenharmony_ci    when the number of effective raster samples is not equal to the number
7485bd8deadSopenharmony_ci    of color samples shades at the pixel rate, effectively ignoring the
7495bd8deadSopenharmony_ci    per-sample shading (as allowed by the language in section 14.3.3.1).
7505bd8deadSopenharmony_ci
7515bd8deadSopenharmony_ciIssues
7525bd8deadSopenharmony_ci
7535bd8deadSopenharmony_ci    (1) How is coverage modulation intended to be used?
7545bd8deadSopenharmony_ci
7555bd8deadSopenharmony_ci    RESOLVED: Coverage modulation allows the coverage to be converted to
7565bd8deadSopenharmony_ci    "opacity", which can then be blended into the color buffer to accomplish
7575bd8deadSopenharmony_ci    antialiasing. This is similar to the intent of POLYGON_SMOOTH. For example,
7585bd8deadSopenharmony_ci    if non-premultiplied alpha colors are in use (common OpenGL usage):
7595bd8deadSopenharmony_ci
7605bd8deadSopenharmony_ci        glCoverageModulationNV(GL_ALPHA);
7615bd8deadSopenharmony_ci        glEnable(GL_BLEND);
7625bd8deadSopenharmony_ci        glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,
7635bd8deadSopenharmony_ci                            GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
7645bd8deadSopenharmony_ci
7655bd8deadSopenharmony_ci    or if using pre-multiplied alpha colors (common in 2D rendering):
7665bd8deadSopenharmony_ci
7675bd8deadSopenharmony_ci        glCoverageModulationNV(GL_RGBA);
7685bd8deadSopenharmony_ci        glEnable(GL_BLEND);
7695bd8deadSopenharmony_ci        glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
7705bd8deadSopenharmony_ci
7715bd8deadSopenharmony_ci    (2) How is the coverage modulation table intended to be used?
7725bd8deadSopenharmony_ci
7735bd8deadSopenharmony_ci    RESOLVED: It could be used to accomplish the coverage modulation
7745bd8deadSopenharmony_ci    "downsample" in a modified color space (akin to an sRGB downsample). It
7755bd8deadSopenharmony_ci    could also be used (in conjunction with blending) to kill any partially
7765bd8deadSopenharmony_ci    covered color samples.
7775bd8deadSopenharmony_ci
7785bd8deadSopenharmony_ci    Note that for lower ratios of N/M, the table's entries are used sparsely.
7795bd8deadSopenharmony_ci    For example, if N=16, M=4, and S=16, the initial calculation of R would
7805bd8deadSopenharmony_ci    produce values of 0.25, 0.5, 0.75, and 1. Then I = 4, 8, 12, or 16, and
7815bd8deadSopenharmony_ci    entries 3, 7, 11, and 15 would be used. The intent is that the table
7825bd8deadSopenharmony_ci    should be treated like a function from (0,1] to [0,1].
7835bd8deadSopenharmony_ci
7845bd8deadSopenharmony_ci    (3) What combinations of AA modes are supported?
7855bd8deadSopenharmony_ci
7865bd8deadSopenharmony_ci    RESOLVED: Depth/stencil samples being an integer multiple of color samples
7875bd8deadSopenharmony_ci    is a necessary condition, but is not sufficient. There may be other
7885bd8deadSopenharmony_ci    implementation-dependent limitations that cause certain combinations not
7895bd8deadSopenharmony_ci    to be supported and report as an incomplete framebuffer.
7905bd8deadSopenharmony_ci
7915bd8deadSopenharmony_ci    (4) What errors should be generated when RasterSamples and depth/stencil
7925bd8deadSopenharmony_ci    sample counts mismatch?
7935bd8deadSopenharmony_ci
7945bd8deadSopenharmony_ci    RESOLVED: Commands that do any sort of rasterization, including Draw,
7955bd8deadSopenharmony_ci    Bitmap, DrawPixels, and CopyPixels, should have errors if the depth/stencil
7965bd8deadSopenharmony_ci    buffer may be touched (depth test, stencil test, depth bounds test
7975bd8deadSopenharmony_ci    enabled). Clear does not rasterize, so should not have any such errors.
7985bd8deadSopenharmony_ci
7995bd8deadSopenharmony_ci    (5) When using both NV_fragment_coverage_to_color and EXT_raster_multisample
8005bd8deadSopenharmony_ci    or NV_framebuffer_mixed_samples, how do these features interact?
8015bd8deadSopenharmony_ci
8025bd8deadSopenharmony_ci    RESOLVED: Both may be used simultaneously, and the coverage_to_color
8035bd8deadSopenharmony_ci    functionality is applied before coverage reduction in the pipeline. This
8045bd8deadSopenharmony_ci    means the full raster sample mask will be written to the color buffer, not
8055bd8deadSopenharmony_ci    the reduced color sample mask.
8065bd8deadSopenharmony_ci
8075bd8deadSopenharmony_ci    (6) How do EXT_raster_multisample and NV_framebuffer_mixed_samples
8085bd8deadSopenharmony_ci    interact? Why are there two extensions?
8095bd8deadSopenharmony_ci
8105bd8deadSopenharmony_ci    RESOLVED: The functionality in EXT_raster_multisample is equivalent to
8115bd8deadSopenharmony_ci    "Target-Independent Rasterization" in Direct3D 11.1, and is expected to be
8125bd8deadSopenharmony_ci    supportable today by other hardware vendors. It allows using multiple
8135bd8deadSopenharmony_ci    raster samples with a single color sample, as long as depth and stencil
8145bd8deadSopenharmony_ci    tests are disabled, with the number of raster samples controlled by a
8155bd8deadSopenharmony_ci    piece of state.
8165bd8deadSopenharmony_ci
8175bd8deadSopenharmony_ci    NV_framebuffer_mixed_samples is an extension/enhancement of this feature
8185bd8deadSopenharmony_ci    with a few key improvements:
8195bd8deadSopenharmony_ci
8205bd8deadSopenharmony_ci     - Multiple color samples are allowed, with the requirement that the number
8215bd8deadSopenharmony_ci       of raster samples must be a multiple of the number of color samples.
8225bd8deadSopenharmony_ci
8235bd8deadSopenharmony_ci     - Depth and stencil buffers and tests are supported, with the requirement
8245bd8deadSopenharmony_ci       that the number of raster/depth/stencil samples must all be equal for
8255bd8deadSopenharmony_ci       any of the three that are in use.
8265bd8deadSopenharmony_ci
8275bd8deadSopenharmony_ci     - The addition of the coverage modulation feature, which allows the
8285bd8deadSopenharmony_ci       multisample coverage information to accomplish blended antialiasing.
8295bd8deadSopenharmony_ci
8305bd8deadSopenharmony_ci    Using mixed samples does not require enabling RASTER_MULTISAMPLE_EXT; the
8315bd8deadSopenharmony_ci    number of raster samples can be inferred from the depth/stencil
8325bd8deadSopenharmony_ci    attachments. But if it is enabled, RASTER_SAMPLES_EXT must equal the
8335bd8deadSopenharmony_ci    number of depth/stencil samples.
8345bd8deadSopenharmony_ci
8355bd8deadSopenharmony_ci    (7) How do ARB_blend_func_extended (dual-source blending) interact
8365bd8deadSopenharmony_ci    with this extension?
8375bd8deadSopenharmony_ci
8385bd8deadSopenharmony_ci    RESOLVED:  Coverage modulation affects both the source color and the
8395bd8deadSopenharmony_ci    source factor color (GL_SRC1_COLOR, etc.).
8405bd8deadSopenharmony_ci
8415bd8deadSopenharmony_ci    (8) How does ARB_sample_shading (per-sample shading) interact with
8425bd8deadSopenharmony_ci    this extension?
8435bd8deadSopenharmony_ci
8445bd8deadSopenharmony_ci    RESOLVED:  Implementations have the option of shading just a single
8455bd8deadSopenharmony_ci    sample when the number of raster samples doesn't match the number
8465bd8deadSopenharmony_ci    of color samples, be that because RASTER_MULTISAMPLE_EXT is enabled
8475bd8deadSopenharmony_ci    or the number of depth and/or stencil samples is greater than the
8485bd8deadSopenharmony_ci    number of color samples.
8495bd8deadSopenharmony_ci
8505bd8deadSopenharmony_ci    See the language added to the end of Section 14.3.1.1 (Sample
8515bd8deadSopenharmony_ci    Shading).
8525bd8deadSopenharmony_ci
8535bd8deadSopenharmony_ci    (9) Why does the antialiasing quality look "ropey" even with 8 or
8545bd8deadSopenharmony_ci    even 16 raster samples?
8555bd8deadSopenharmony_ci
8565bd8deadSopenharmony_ci    Because of the color values on typical displays (e.g. devices
8575bd8deadSopenharmony_ci    displaying color values encoded in the sRGB color space) do not have
8585bd8deadSopenharmony_ci    a perceptually-linear color response, antialiasing quality based on
8595bd8deadSopenharmony_ci    fractional coverage is best achieved on such sRGB displays by
8605bd8deadSopenharmony_ci    enabling sRGB framebuffer blending (i.e. GL_FRAMEBUFFER_SRGB).
8615bd8deadSopenharmony_ci    Otherwise antialiased edges rendered with coverage modulation may
8625bd8deadSopenharmony_ci    have a "ropey" appearance.
8635bd8deadSopenharmony_ci
8645bd8deadSopenharmony_ci    The benefit of enabling sRGB framebuffer blending is a more noticable
8655bd8deadSopenharmony_ci    improvement in edge antialiasing quality than moving from 4 to 8 or
8665bd8deadSopenharmony_ci    8 to 16 samples.
8675bd8deadSopenharmony_ci
8685bd8deadSopenharmony_ci    If you are going to use 8 or 16 (or even 4) raster samples with
8695bd8deadSopenharmony_ci    blended coverage modulation, you are well-advised to use sRGB
8705bd8deadSopenharmony_ci    framebuffer blending for best quality.
8715bd8deadSopenharmony_ci
8725bd8deadSopenharmony_ciRevision History
8735bd8deadSopenharmony_ci
8745bd8deadSopenharmony_ci    Revision 3, 2017/02/15 (not merged to Khronos earlier)
8755bd8deadSopenharmony_ci    - ARB_blend_func_extended interaction specified
8765bd8deadSopenharmony_ci    - Mixed samples may not work with sample shading, NVIDIA
8775bd8deadSopenharmony_ci    - Added implementation Details, sRGB advice.
8785bd8deadSopenharmony_ci
8795bd8deadSopenharmony_ci    Revision 2, 2015/03/27
8805bd8deadSopenharmony_ci      - Add ES interactions
8815bd8deadSopenharmony_ci
8825bd8deadSopenharmony_ci    Revision 1
8835bd8deadSopenharmony_ci      - Internal revisions.
884