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