15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    EXT_shader_samples_identical
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_EXT_shader_samples_identical
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Ian Romanick, Intel (ian.d.romanick 'at' intel.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciContributors
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Chris Forbes, Mesa
165bd8deadSopenharmony_ci    Magnus Wendt, Intel
175bd8deadSopenharmony_ci    Neil S. Roberts, Intel
185bd8deadSopenharmony_ci    Graham Sellers, AMD
195bd8deadSopenharmony_ci    Nicolai Hähnle, AMD
205bd8deadSopenharmony_ci
215bd8deadSopenharmony_ciStatus
225bd8deadSopenharmony_ci
235bd8deadSopenharmony_ci    Complete.
245bd8deadSopenharmony_ci
255bd8deadSopenharmony_ciVersion
265bd8deadSopenharmony_ci
275bd8deadSopenharmony_ci    Last Modified Date: November 19, 2015
285bd8deadSopenharmony_ci    Revision: 6
295bd8deadSopenharmony_ci
305bd8deadSopenharmony_ciNumber
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ci    OpenGL Extension #557
335bd8deadSopenharmony_ci    OpenGL ES Extension #339
345bd8deadSopenharmony_ci
355bd8deadSopenharmony_ciDependencies
365bd8deadSopenharmony_ci
375bd8deadSopenharmony_ci    OpenGL 3.2, or OpenGL ES 3.1, or ARB_texture_multisample is required.
385bd8deadSopenharmony_ci
395bd8deadSopenharmony_ci    This extension is written against the OpenGL 4.5 (Core Profile)
405bd8deadSopenharmony_ci    Specification
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ciOverview
435bd8deadSopenharmony_ci
445bd8deadSopenharmony_ci    Multisampled antialiasing has become a common method for improving the
455bd8deadSopenharmony_ci    quality of rendered images.  Multisampling differs from supersampling in
465bd8deadSopenharmony_ci    that the color of a primitive that covers all or part of a pixel is
475bd8deadSopenharmony_ci    resolved once, regardless of the number of samples covered.  If a large
485bd8deadSopenharmony_ci    polygon is rendered, the colors of all samples in each interior pixel will
495bd8deadSopenharmony_ci    be the same.  This suggests a simple compression scheme that can reduce
505bd8deadSopenharmony_ci    the necessary memory bandwidth requirements.  In one such scheme, each
515bd8deadSopenharmony_ci    sample is stored in a separate slice of the multisample surface.  An
525bd8deadSopenharmony_ci    additional multisample control surface (MCS) contains a mapping from pixel
535bd8deadSopenharmony_ci    samples to slices.
545bd8deadSopenharmony_ci
555bd8deadSopenharmony_ci    If all the values stored in the MCS for a particular pixel are the same,
565bd8deadSopenharmony_ci    then all the samples have the same value.  Applications can take advantage
575bd8deadSopenharmony_ci    of this information to reduce the bandwidth of reading multisample
585bd8deadSopenharmony_ci    textures.  A custom multisample resolve filter could optimize resolving
595bd8deadSopenharmony_ci    pixels where every sample is identical by reading the color once.
605bd8deadSopenharmony_ci
615bd8deadSopenharmony_ci    color = texelFetch(sampler, coordinate, 0);
625bd8deadSopenharmony_ci    if (!textureSamplesIdenticalEXT(sampler, coordinate)) {
635bd8deadSopenharmony_ci        for (int i = 1; i < MAX_SAMPLES; i++) {
645bd8deadSopenharmony_ci            vec4 c = texelFetch(sampler, coordinate, i);
655bd8deadSopenharmony_ci
665bd8deadSopenharmony_ci            //... accumulate c into color
675bd8deadSopenharmony_ci
685bd8deadSopenharmony_ci        }
695bd8deadSopenharmony_ci    }
705bd8deadSopenharmony_ci
715bd8deadSopenharmony_ciNew Procedures and Functions
725bd8deadSopenharmony_ci
735bd8deadSopenharmony_ci    None.
745bd8deadSopenharmony_ci
755bd8deadSopenharmony_ciNew Tokens
765bd8deadSopenharmony_ci
775bd8deadSopenharmony_ci    None.
785bd8deadSopenharmony_ci
795bd8deadSopenharmony_ciAdditions to the OpenGL 4.5 (Core Profile) Specification
805bd8deadSopenharmony_ci
815bd8deadSopenharmony_ci    None.
825bd8deadSopenharmony_ci
835bd8deadSopenharmony_ciModifications to The OpenGL Shading Language Specification, Version 4.50.5
845bd8deadSopenharmony_ci
855bd8deadSopenharmony_ci    Including the following line in a shader can be used to control the
865bd8deadSopenharmony_ci    language features described in this extension:
875bd8deadSopenharmony_ci
885bd8deadSopenharmony_ci        #extension GL_EXT_shader_samples_identical
895bd8deadSopenharmony_ci
905bd8deadSopenharmony_ci    A new preprocessor #define is added to the OpenGL Shading Language:
915bd8deadSopenharmony_ci
925bd8deadSopenharmony_ci        #define GL_EXT_shader_samples_identical
935bd8deadSopenharmony_ci
945bd8deadSopenharmony_ci    Add to the table in section 8.7 "Texture Lookup Functions"
955bd8deadSopenharmony_ci
965bd8deadSopenharmony_ci    Syntax:
975bd8deadSopenharmony_ci
985bd8deadSopenharmony_ci        bool textureSamplesIdenticalEXT(gsampler2DMS sampler, ivec2 coord)
995bd8deadSopenharmony_ci
1005bd8deadSopenharmony_ci        bool textureSamplesIdenticalEXT(gsampler2DMSArray sampler,
1015bd8deadSopenharmony_ci                                        ivec3 coord)
1025bd8deadSopenharmony_ci
1035bd8deadSopenharmony_ci    Description:
1045bd8deadSopenharmony_ci
1055bd8deadSopenharmony_ci        Returns true if it can be determined that all samples within the texel
1065bd8deadSopenharmony_ci        of the multisample texture bound to <sampler> at <coord> contain the
1075bd8deadSopenharmony_ci        same values or false if this cannot be determined."
1085bd8deadSopenharmony_ci
1095bd8deadSopenharmony_ciAdditions to the AGL/EGL/GLX/WGL Specifications
1105bd8deadSopenharmony_ci
1115bd8deadSopenharmony_ci    None
1125bd8deadSopenharmony_ci
1135bd8deadSopenharmony_ciErrors
1145bd8deadSopenharmony_ci
1155bd8deadSopenharmony_ci    None
1165bd8deadSopenharmony_ci
1175bd8deadSopenharmony_ciNew State
1185bd8deadSopenharmony_ci
1195bd8deadSopenharmony_ci    None
1205bd8deadSopenharmony_ci
1215bd8deadSopenharmony_ciNew Implementation Dependent State
1225bd8deadSopenharmony_ci
1235bd8deadSopenharmony_ci    None
1245bd8deadSopenharmony_ci
1255bd8deadSopenharmony_ciIssues
1265bd8deadSopenharmony_ci
1275bd8deadSopenharmony_ci    1) What should the new functions be called?
1285bd8deadSopenharmony_ci
1295bd8deadSopenharmony_ci    RESOLVED: textureSamplesIdenticalEXT.  Initially
1305bd8deadSopenharmony_ci    textureAllSamplesIdenticalEXT was considered, but
1315bd8deadSopenharmony_ci    textureSamplesIdenticalEXT is more similar to the existing textureSamples
1325bd8deadSopenharmony_ci    function.
1335bd8deadSopenharmony_ci
1345bd8deadSopenharmony_ci    2) It seems like applications could implement additional optimization if
1355bd8deadSopenharmony_ci       they were provided with raw MCS data.  Should this extension also
1365bd8deadSopenharmony_ci       provide that data?
1375bd8deadSopenharmony_ci
1385bd8deadSopenharmony_ci    There are a number of challenges in providing raw MCS data.  The biggest
1395bd8deadSopenharmony_ci    problem being that the amount of MCS data depends on the number of
1405bd8deadSopenharmony_ci    samples, and that is not known at compile time.  Additionally, without new
1415bd8deadSopenharmony_ci    texelFetch functions, applications would have difficulty utilizing the
1425bd8deadSopenharmony_ci    information.
1435bd8deadSopenharmony_ci
1445bd8deadSopenharmony_ci    Another option is to have a function that returns an array of tuples of
1455bd8deadSopenharmony_ci    sample number and count.  This also has difficulties with the maximum
1465bd8deadSopenharmony_ci    array size not being known at compile time.
1475bd8deadSopenharmony_ci
1485bd8deadSopenharmony_ci    RESOLVED: Do not expose raw MCS data in this extension.
1495bd8deadSopenharmony_ci
1505bd8deadSopenharmony_ci    3) Should this extension also extend SPIR-V?
1515bd8deadSopenharmony_ci
1525bd8deadSopenharmony_ci    RESOLVED: Yes, but this has not yet been written.
1535bd8deadSopenharmony_ci
1545bd8deadSopenharmony_ci    4) Is it possible for textureSamplesIdenticalEXT to report false negatives?
1555bd8deadSopenharmony_ci
1565bd8deadSopenharmony_ci    RESOLVED: Yes.  It is possible that the underlying hardware may not detect
1575bd8deadSopenharmony_ci    that separate writes of the same color to different samples of a pixel are
1585bd8deadSopenharmony_ci    the same.  The shader function is at the whim of the underlying hardware
1595bd8deadSopenharmony_ci    implementation.  It is also possible that a compressed multisample surface
1605bd8deadSopenharmony_ci    is not used.  In that case the function will likely always return false.
1615bd8deadSopenharmony_ci
1625bd8deadSopenharmony_ciRevision History
1635bd8deadSopenharmony_ci
1645bd8deadSopenharmony_ci    Rev  Date        Author    Changes
1655bd8deadSopenharmony_ci    ---  ----------  --------  ---------------------------------------------
1665bd8deadSopenharmony_ci      1  2014/08/20  cforbes   Initial version
1675bd8deadSopenharmony_ci      2  2015/10/23  idr       Change from MESA to EXT.  Rebase on OpenGL 4.5,
1685bd8deadSopenharmony_ci                               and add dependency on OpenGL ES 3.1.  Initial
1695bd8deadSopenharmony_ci                               draft of overview section and issues 1 through
1705bd8deadSopenharmony_ci                               3.
1715bd8deadSopenharmony_ci      3  2015/10/27  idr       Typo fixes.
1725bd8deadSopenharmony_ci      4  2015/11/10  idr       Rename extension from EXT_shader_multisample_compression
1735bd8deadSopenharmony_ci                               to EXT_shader_samples_identical.
1745bd8deadSopenharmony_ci                               Add issue #4.
1755bd8deadSopenharmony_ci      5  2015/11/18  idr       Fix some typos spotted by gsellers.  Change the
1765bd8deadSopenharmony_ci                               name of the name of the function to
1775bd8deadSopenharmony_ci                               textureSamplesIdenticalEXT.
1785bd8deadSopenharmony_ci      6  2015/11/19  idr       Fix more typos spotted by Nicolai Hähnle.
179