15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    NV_internalformat_sample_query
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_NV_internalformat_sample_query
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Daniel Koch, NVIDIA (dkoch 'at' nvidia.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciContributors
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Piers Daniell, NVIDIA
165bd8deadSopenharmony_ci    Weiwan Liu, NVIDIA
175bd8deadSopenharmony_ci
185bd8deadSopenharmony_ciStatus
195bd8deadSopenharmony_ci
205bd8deadSopenharmony_ci    Complete
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ciVersion
235bd8deadSopenharmony_ci
245bd8deadSopenharmony_ci    Last Modified Date: October 10, 2014
255bd8deadSopenharmony_ci    Revision: 2
265bd8deadSopenharmony_ci
275bd8deadSopenharmony_ciNumber
285bd8deadSopenharmony_ci
295bd8deadSopenharmony_ci    OpenGL Extension #475
305bd8deadSopenharmony_ci    OpenGL ES Extension #196
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ciDependencies
335bd8deadSopenharmony_ci
345bd8deadSopenharmony_ci    This specification is written against the OpenGL 4.5 (Core Profile)
355bd8deadSopenharmony_ci    Specification (September 19, 2014).
365bd8deadSopenharmony_ci
375bd8deadSopenharmony_ci    OpenGL 4.2 or ARB_internalformat_query are required for an OpenGL
385bd8deadSopenharmony_ci    implementation.
395bd8deadSopenharmony_ci
405bd8deadSopenharmony_ci    OpenGL ES 3.0 is required for an OpenGL ES implementation.
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ci    This extension interacts with OpenGL ES 3.1.
435bd8deadSopenharmony_ci
445bd8deadSopenharmony_ci    This extension interacts with KHR_debug and OpenGL 4.3.
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ci    This extension interacts with OES_texture_storage_multisample_2d_array.
475bd8deadSopenharmony_ci
485bd8deadSopenharmony_ciOverview
495bd8deadSopenharmony_ci
505bd8deadSopenharmony_ci    Some OpenGL implementations support modes of multisampling which have
515bd8deadSopenharmony_ci    properties which are non-obvious to applications and/or which may not be
525bd8deadSopenharmony_ci    standards conformant. The idea of non-conformant AA modes is not new,
535bd8deadSopenharmony_ci    and is exposed in both GLX and EGL with config caveats and the
545bd8deadSopenharmony_ci    GLX_NON_CONFORMANT_CONFIG for GLX and EGL_NON_CONFORMANT_CONFIG for EGL,
555bd8deadSopenharmony_ci    or by querying the EGL_CONFORMANT attribute in newer versions of EGL.
565bd8deadSopenharmony_ci
575bd8deadSopenharmony_ci    Both of these mechanisms operate on a per-config basis, which works as
585bd8deadSopenharmony_ci    intended for window-based configs. However, with the advent of
595bd8deadSopenharmony_ci    application-created FBOs, it is now possible to do all the multisample
605bd8deadSopenharmony_ci    operations in an application-created FBO and never use a multisample
615bd8deadSopenharmony_ci    window.
625bd8deadSopenharmony_ci
635bd8deadSopenharmony_ci    This extension further extends the internalformat query mechanism
645bd8deadSopenharmony_ci    (first introduced by ARB_internalformat_query and extended in
655bd8deadSopenharmony_ci    ARB_internalformat_query2) and introduces a mechanism for a
665bd8deadSopenharmony_ci    implementation to report properties of formats that may also be
675bd8deadSopenharmony_ci    dependent on the number of samples.  This includes information
685bd8deadSopenharmony_ci    such as whether the combination of format and samples should be
695bd8deadSopenharmony_ci    considered conformant. This enables an implementation to report
705bd8deadSopenharmony_ci    caveats which might apply to both window and FBO-based rendering
715bd8deadSopenharmony_ci    configurations.
725bd8deadSopenharmony_ci
735bd8deadSopenharmony_ci    Some NVIDIA drivers support multisample modes which are internally
745bd8deadSopenharmony_ci    implemented as a combination of multisampling and automatic
755bd8deadSopenharmony_ci    supersampling in order to obtain a higher level of anti-aliasing than
765bd8deadSopenharmony_ci    can be directly supported by hardware. This extension allows those
775bd8deadSopenharmony_ci    properties to be queried by an application with the MULTISAMPLES_NV,
785bd8deadSopenharmony_ci    SUPERSAMPLE_SCALE_X_NV and SUPERSAMPLE_SCALE_Y_NV properties. For
795bd8deadSopenharmony_ci    example, a 16xAA mode might be implemented by using 4 samples and
805bd8deadSopenharmony_ci    up-scaling by a factor of 2 in each of the x- and y-dimensions.
815bd8deadSopenharmony_ci    In this example, the driver might report MULTSAMPLES_NV of 4,
825bd8deadSopenharmony_ci    SUPERSAMPLE_SCALE_X_NV of 2, SUPERSAMPLE_SCALE_Y_NV of 2 and
835bd8deadSopenharmony_ci    CONFORMANT_NV of FALSE.
845bd8deadSopenharmony_ci
855bd8deadSopenharmony_ci
865bd8deadSopenharmony_ciNew Procedures and Functions
875bd8deadSopenharmony_ci
885bd8deadSopenharmony_ci    void GetInternalformatSampleivNV(enum target, enum internalformat,
895bd8deadSopenharmony_ci                                     sizei samples, enum pname,
905bd8deadSopenharmony_ci                                     sizei bufSize, int *params);
915bd8deadSopenharmony_ci
925bd8deadSopenharmony_ciNew Types
935bd8deadSopenharmony_ci
945bd8deadSopenharmony_ci    None.
955bd8deadSopenharmony_ci
965bd8deadSopenharmony_ciNew Tokens
975bd8deadSopenharmony_ci
985bd8deadSopenharmony_ci    Accepted by the <target> parameter of GetInternalformatSampleivNV:
995bd8deadSopenharmony_ci
1005bd8deadSopenharmony_ci        RENDERBUFFER
1015bd8deadSopenharmony_ci        TEXTURE_2D_MULTISAMPLE
1025bd8deadSopenharmony_ci        TEXTURE_2D_MULTISAMPLE_ARRAY
1035bd8deadSopenharmony_ci
1045bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetInternalformatSampleivNV:
1055bd8deadSopenharmony_ci
1065bd8deadSopenharmony_ci        MULTISAMPLES_NV                         0x9371
1075bd8deadSopenharmony_ci        SUPERSAMPLE_SCALE_X_NV                  0x9372
1085bd8deadSopenharmony_ci        SUPERSAMPLE_SCALE_Y_NV                  0x9373
1095bd8deadSopenharmony_ci        CONFORMANT_NV                           0x9374
1105bd8deadSopenharmony_ci
1115bd8deadSopenharmony_ci
1125bd8deadSopenharmony_ciAdditions to Chapter 22 of the OpenGL 4.5 (Core Profile) Specification
1135bd8deadSopenharmony_ci(Context State Queries)
1145bd8deadSopenharmony_ci
1155bd8deadSopenharmony_ci    Add a new section 22.3.ifsq "Internal Format Sample Queries":
1165bd8deadSopenharmony_ci
1175bd8deadSopenharmony_ci    Information about implementation-dependent support for sample related
1185bd8deadSopenharmony_ci    properties of internal formats can be queried with the command
1195bd8deadSopenharmony_ci
1205bd8deadSopenharmony_ci        void GetInternalformatSampleivNV(enum target, enum internalformat,
1215bd8deadSopenharmony_ci                                         sizei samples, enum pname,
1225bd8deadSopenharmony_ci                                         sizei bufSize, int *params);
1235bd8deadSopenharmony_ci
1245bd8deadSopenharmony_ci    <internalformat> must be color-renderable, depth-renderable, or
1255bd8deadSopenharmony_ci    stencil-renderable (as defined in section 9.4).
1265bd8deadSopenharmony_ci
1275bd8deadSopenharmony_ci    <target> indicates the usage of the <internalformat>, and must be one of
1285bd8deadSopenharmony_ci    the targets that can be used for multisample resources, that is one of
1295bd8deadSopenharmony_ci    RENDERBUFFER, TEXTURE_2D_MULTISAMPLE, or TEXTURE_2D_MULTISAMPLE_ARRAY.
1305bd8deadSopenharmony_ci
1315bd8deadSopenharmony_ci    <samples> indicates the number of samples of the <internalformat> for
1325bd8deadSopenharmony_ci    which properties are being queried. It is an error if the requested
1335bd8deadSopenharmony_ci    <samples> are not supported for requested <internalformat> and <target>.
1345bd8deadSopenharmony_ci    GetInternalformativ with the SAMPLES property can be used to determine
1355bd8deadSopenharmony_ci    if <samples> is supported.
1365bd8deadSopenharmony_ci
1375bd8deadSopenharmony_ci    No more than <bufSize> integers will be written into <params>. If
1385bd8deadSopenharmony_ci    more data are available, they will be ignored and no error will be
1395bd8deadSopenharmony_ci    generated.
1405bd8deadSopenharmony_ci
1415bd8deadSopenharmony_ci    <pname> indicates the information to query, and it is one of the
1425bd8deadSopenharmony_ci    following values. When a known property is queried, the associated
1435bd8deadSopenharmony_ci    value is written into <params>, otherwise <params> is unmodified.
1445bd8deadSopenharmony_ci
1455bd8deadSopenharmony_ci    - MULTISAMPLES_NV: returns the number of multisamples used when a
1465bd8deadSopenharmony_ci      resource of the requested type and the specified <samples> is created.
1475bd8deadSopenharmony_ci
1485bd8deadSopenharmony_ci    - SUPERSAMPLE_SCALE_X_NV: returns the super-sample scaling factor that
1495bd8deadSopenharmony_ci      is used in the X-dimension when a resource of the requested type and
1505bd8deadSopenharmony_ci      the specified <samples> is created.
1515bd8deadSopenharmony_ci
1525bd8deadSopenharmony_ci    - SUPERSAMPLE_SCALE_Y_NV: returns the super-sample scaling factor that
1535bd8deadSopenharmony_ci      is used in the Y-dimension when a resource of the requested type and
1545bd8deadSopenharmony_ci      the specified <samples> is created.
1555bd8deadSopenharmony_ci
1565bd8deadSopenharmony_ci    - CONFORMANT_NV: returns the conformance-compliance of a resource
1575bd8deadSopenharmony_ci      created with the requested type and the specified <samples>.
1585bd8deadSopenharmony_ci      TRUE is returned if the format/sample combination is supported in a
1595bd8deadSopenharmony_ci      compliant manner. FALSE is returned if the requested format/sample
1605bd8deadSopenharmony_ci      combination is not conformant. If this query reports
1615bd8deadSopenharmony_ci      non-conformant status and the debug output functionality is enabled,
1625bd8deadSopenharmony_ci      the GL will generate a debug output message describing the caveats.
1635bd8deadSopenharmony_ci      The message has the source DEBUG_SOURCE_API, the type
1645bd8deadSopenharmony_ci      DEBUG_TYPE_UNDEFINED_BEHAVIOR, and an implementation-dependent ID.
1655bd8deadSopenharmony_ci
1665bd8deadSopenharmony_ci    Errors:
1675bd8deadSopenharmony_ci    The INVALID_ENUM error is generated if <target> is not one of
1685bd8deadSopenharmony_ci    RENDERBUFFER, TEXTURE_2D_MULTISAMPLE, or TEXTURE_2D_MULTISAMPLE_ARRAY.
1695bd8deadSopenharmony_ci
1705bd8deadSopenharmony_ci    The INVALID_ENUM error is generated if <internalformat> is not
1715bd8deadSopenharmony_ci    color-, depth-, or stencil-renderable.
1725bd8deadSopenharmony_ci
1735bd8deadSopenharmony_ci    The INVALID_ENUM error is generated if <pname> is not one of
1745bd8deadSopenharmony_ci    MULTISAMPLES_NV, SUPERSAMPLE_SCALE_X_NV, SUPERSAMPLE_SCALE_Y_NV, or
1755bd8deadSopenharmony_ci    CONFORMANT_NV.
1765bd8deadSopenharmony_ci
1775bd8deadSopenharmony_ci    The INVALID_VALUE error is generated if <bufSize> is negative.
1785bd8deadSopenharmony_ci
1795bd8deadSopenharmony_ci    The INVALID_OPERATION error is generated if a resource of the requested
1805bd8deadSopenharmony_ci    type and samples is not supported by the implementation.
1815bd8deadSopenharmony_ci
1825bd8deadSopenharmony_ciAdditions to the WGL/GLX/EGL Specification
1835bd8deadSopenharmony_ci
1845bd8deadSopenharmony_ci    None.
1855bd8deadSopenharmony_ci
1865bd8deadSopenharmony_ciDependencies on OpenGL ES 3.1
1875bd8deadSopenharmony_ci
1885bd8deadSopenharmony_ci    If OpenGL ES 3.1 is not supported in an OpenGL ES implementation,
1895bd8deadSopenharmony_ci    ignore references to TEXTURE_2D_MULTISAMPLE <target> and resources.
1905bd8deadSopenharmony_ci
1915bd8deadSopenharmony_ciDependencies on OES_texture_storage_multisample_2d_array.
1925bd8deadSopenharmony_ci
1935bd8deadSopenharmony_ci    If OES_texture_storage_multisample_2d_array is not supported in an
1945bd8deadSopenharmony_ci    OpenGL ES implementation, ignore references to
1955bd8deadSopenharmony_ci    TEXTURE_2D_MULTISAMPLE_ARRAY. If the extension is supported, replace
1965bd8deadSopenharmony_ci    references to TEXTURE_2D_MULTISAMPLE_ARRAY with references to
1975bd8deadSopenharmony_ci    TEXTURE_2D_MULTISAMPLE_ARRAY_OES.
1985bd8deadSopenharmony_ci
1995bd8deadSopenharmony_ciDependencies on KHR_debug
2005bd8deadSopenharmony_ci
2015bd8deadSopenharmony_ci    If KHR_debug or OpenGL 4.3 are not supported, ignore references to
2025bd8deadSopenharmony_ci    debug output functionality.  If KHR_debug is supported in an OpenGL ES
2035bd8deadSopenharmony_ci    context, append the _KHR suffix onto associated types.
2045bd8deadSopenharmony_ci
2055bd8deadSopenharmony_ciNew State
2065bd8deadSopenharmony_ci
2075bd8deadSopenharmony_ci    None.
2085bd8deadSopenharmony_ci
2095bd8deadSopenharmony_ciSample Code
2105bd8deadSopenharmony_ci
2115bd8deadSopenharmony_ci    // Obtain supported sample count for a format:
2125bd8deadSopenharmony_ci    GLint num_sample_counts = 0;
2135bd8deadSopenharmony_ci    GLenum ifmt = GL_RGBA8;
2145bd8deadSopenharmony_ci    GLenum target = GL_TEXTURE_2D_MULTISAMPLE;
2155bd8deadSopenharmony_ci    glGetInternalformativ(target, ifmt, NUM_SAMPLE_COUNTS, 1,
2165bd8deadSopenharmony_ci                          &num_sample_counts);
2175bd8deadSopenharmony_ci
2185bd8deadSopenharmony_ci    // get the list of supported samples for this format
2195bd8deadSopenharmony_ci    GLint samples[num_sample_counts];
2205bd8deadSopenharmony_ci    glGetInternalformativ(target, ifmt, SAMPLES, num_sample_counts, samples);
2215bd8deadSopenharmony_ci
2225bd8deadSopenharmony_ci    // loop over the supported formats and get per-sample properties
2235bd8deadSopenharmony_ci    for (int i=0; i<num_sample_counts; i++)
2245bd8deadSopenharmony_ci    {
2255bd8deadSopenharmony_ci        GLint multisample;
2265bd8deadSopenharmony_ci        GLint ss_scale_x, ss_scale_y;
2275bd8deadSopenharmony_ci        GLint conformant;
2285bd8deadSopenharmony_ci        glGetInternalformatSampleivNV(target, ifmt, samples[i],
2295bd8deadSopenharmony_ci                                      GL_MULTISAMPLES_NV,
2305bd8deadSopenharmony_ci                                      1, &multisample);
2315bd8deadSopenharmony_ci        glGetInternalformatSampleivNV(target, ifmt, samples[i],
2325bd8deadSopenharmony_ci                                      GL_SUPERSAMPLE_SCALE_X_NV,
2335bd8deadSopenharmony_ci                                      1, &ss_scale_x);
2345bd8deadSopenharmony_ci        glGetInternalformatSampleivNV(target, ifmt, samples[i],
2355bd8deadSopenharmony_ci                                      GL_SUPERSAMPLE_SCALE_Y_NV,
2365bd8deadSopenharmony_ci                                      1, &ss_scale_y);
2375bd8deadSopenharmony_ci        glGetInternalformatSampleivNV(target, ifmt, samples[i],
2385bd8deadSopenharmony_ci                                      GL_CONFORMANT_NV, 1, &conformant);
2395bd8deadSopenharmony_ci        // do something with this information :-)
2405bd8deadSopenharmony_ci    }
2415bd8deadSopenharmony_ci
2425bd8deadSopenharmony_ci
2435bd8deadSopenharmony_ciConformance Tests
2445bd8deadSopenharmony_ci
2455bd8deadSopenharmony_ci    TBD
2465bd8deadSopenharmony_ci
2475bd8deadSopenharmony_ciIssues
2485bd8deadSopenharmony_ci
2495bd8deadSopenharmony_ci    None yet!
2505bd8deadSopenharmony_ci
2515bd8deadSopenharmony_ci
2525bd8deadSopenharmony_ciRevision History
2535bd8deadSopenharmony_ci
2545bd8deadSopenharmony_ci    Rev.    Date    Author    Changes
2555bd8deadSopenharmony_ci    ----  --------  --------  -----------------------------------------
2565bd8deadSopenharmony_ci     1    09/24/14  dkoch     Initial version
2575bd8deadSopenharmony_ci     2    10/10/14  weiwliu   Assign value to new tokens
258