• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3    EXT_shader_samples_identical
4
5Name Strings
6
7    GL_EXT_shader_samples_identical
8
9Contact
10
11    Ian Romanick, Intel (ian.d.romanick 'at' intel.com)
12
13Contributors
14
15    Chris Forbes, Mesa
16    Magnus Wendt, Intel
17    Neil S. Roberts, Intel
18    Graham Sellers, AMD
19
20Status
21
22    XXX - Not complete yet.
23
24Version
25
26    Last Modified Date: November 19, 2015
27    Revision: 6
28
29Number
30
31    TBD
32
33Dependencies
34
35    OpenGL 3.2, or OpenGL ES 3.1, or ARB_texture_multisample is required.
36
37    This extension is written against the OpenGL 4.5 (Core Profile)
38    Specification
39
40Overview
41
42    Multisampled antialiasing has become a common method for improving the
43    quality of rendered images.  Multisampling differs from supersampling in
44    that the color of a primitive that covers all or part of a pixel is
45    resolved once, regardless of the number of samples covered.  If a large
46    polygon is rendered, the colors of all samples in each interior pixel will
47    be the same.  This suggests a simple compression scheme that can reduce
48    the necessary memory bandwidth requirements.  In one such scheme, each
49    sample is stored in a separate slice of the multisample surface.  An
50    additional multisample control surface (MCS) contains a mapping from pixel
51    samples to slices.
52
53    If all the values stored in the MCS for a particular pixel are the same,
54    then all the samples have the same value.  Applications can take advantage
55    of this information to reduce the bandwidth of reading multisample
56    textures.  A custom multisample resolve filter could optimize resolving
57    pixels where every sample is identical by reading the color once.
58
59    color = texelFetch(sampler, coordinate, 0);
60    if (!textureSamplesIdenticalEXT(sampler, coordinate)) {
61        for (int i = 1; i < MAX_SAMPLES; i++) {
62            vec4 c = texelFetch(sampler, coordinate, i);
63
64            //... accumulate c into color
65
66        }
67    }
68
69New Procedures and Functions
70
71    None.
72
73New Tokens
74
75    None.
76
77Additions to the OpenGL 4.5 (Core Profile) Specification
78
79    None.
80
81Modifications to The OpenGL Shading Language Specification, Version 4.50.5
82
83    Including the following line in a shader can be used to control the
84    language features described in this extension:
85
86        #extension GL_EXT_shader_samples_identical
87
88    A new preprocessor #define is added to the OpenGL Shading Language:
89
90        #define GL_EXT_shader_samples_identical
91
92    Add to the table in section 8.7 "Texture Lookup Functions"
93
94    Syntax:
95
96        bool textureSamplesIdenticalEXT(gsampler2DMS sampler, ivec2 coord)
97
98        bool textureSamplesIdenticalEXT(gsampler2DMSArray sampler,
99                                        ivec3 coord)
100
101    Description:
102
103        Returns true if it can be determined that all samples within the texel
104        of the multisample texture bound to <sampler> at <coord> contain the
105        same values or false if this cannot be determined."
106
107Additions to the AGL/EGL/GLX/WGL Specifications
108
109    None
110
111Errors
112
113    None
114
115New State
116
117    None
118
119New Implementation Dependent State
120
121    None
122
123Issues
124
125    1) What should the new functions be called?
126
127    RESOLVED: textureSamplesIdenticalEXT.  Initially
128    textureAllSamplesIdenticalEXT was considered, but
129    textureSamplesIdenticalEXT is more similar to the existing textureSamples
130    function.
131
132    2) It seems like applications could implement additional optimization if
133       they were provided with raw MCS data.  Should this extension also
134       provide that data?
135
136    There are a number of challenges in providing raw MCS data.  The biggest
137    problem being that the amount of MCS data depends on the number of
138    samples, and that is not known at compile time.  Additionally, without new
139    texelFetch functions, applications would have difficulty utilizing the
140    information.
141
142    Another option is to have a function that returns an array of tuples of
143    sample number and count.  This also has difficulties with the maximum
144    array size not being known at compile time.
145
146    RESOLVED: Do not expose raw MCS data in this extension.
147
148    3) Should this extension also extend SPIR-V?
149
150    RESOLVED: Yes, but this has not yet been written.
151
152    4) Is it possible for textureSamplesIdenticalEXT to report false negatives?
153
154    RESOLVED: Yes.  It is possible that the underlying hardware may not detect
155    that separate writes of the same color to different samples of a pixel are
156    the same.  The shader function is at the whim of the underlying hardware
157    implementation.  It is also possible that a compressed multisample surface
158    is not used.  In that case the function will likely always return false.
159
160Revision History
161
162    Rev  Date        Author    Changes
163    ---  ----------  --------  ---------------------------------------------
164      1  2014/08/20  cforbes   Initial version
165      2  2015/10/23  idr       Change from MESA to EXT.  Rebase on OpenGL 4.5,
166                               and add dependency on OpenGL ES 3.1.  Initial
167                               draft of overview section and issues 1 through
168                               3.
169      3  2015/10/27  idr       Typo fixes.
170      4  2015/11/10  idr       Rename extension from EXT_shader_multisample_compression
171                               to EXT_shader_samples_identical.
172                               Add issue #4.
173      5  2015/11/18  idr       Fix some typos spotted by gsellers.  Change the
174                               name of the name of the function to
175                               textureSamplesIdenticalEXT.
176      6  2015/11/19  idr       Fix more typos spotted by Nicolai Hähnle.
177