• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3    AMD_framebuffer_multisample_advanced
4
5Name Strings
6
7    GL_AMD_framebuffer_multisample_advanced
8
9Contact
10
11    Marek Olsak, AMD (marek.olsak 'at' amd.com)
12
13Status
14
15    Complete.
16
17Version
18
19    Last Modified Date:  June 28, 2018
20    Revision #1
21
22Number
23
24    OpenGL Extension #523
25    OpenGL ES Extension #303
26
27Dependencies
28
29    OpenGL dependencies:
30
31        Requires GL_ARB_framebuffer_object.
32
33    OpenGL ES dependencies:
34
35        Requires OpenGL ES 3.0.
36
37    This extension is written against the OpenGL 4.5 (Core Profile)
38    specification.
39
40Overview
41
42    This extension extends ARB_framebuffer_object by allowing compromises
43    between image quality and memory footprint of multisample
44    antialiasing.
45
46    ARB_framebuffer_object introduced RenderbufferStorageMultisample
47    as a method of defining the parameters for a multisample render
48    buffer. This function takes a <samples> parameter that has strict
49    requirements on behavior such that no compromises in the final image
50    quality are allowed. Additionally, ARB_framebuffer_object requires
51    that all framebuffer attachments have the same number of samples.
52
53    This extension extends ARB_framebuffer_object by providing a new
54    function, RenderbufferStorageMultisampleAdvancedAMD, that
55    distinguishes between samples and storage samples for color
56    renderbuffers where the number of storage samples can be less than
57    the number of samples. This extension also allows non-matching sample
58    counts between color and depth/stencil renderbuffers.
59
60    This extension does not require any specific combination of sample
61    counts to be supported.
62
63IP Status
64
65    No known IP issues.
66
67New Procedures and Functions
68
69    void RenderbufferStorageMultisampleAdvancedAMD(
70             enum target, sizei samples, sizei storageSamples,
71             enum internalformat, sizei width, sizei height );
72
73    void NamedRenderbufferStorageMultisampleAdvancedAMD(
74             uint renderbuffer, sizei samples, sizei storageSamples,
75             enum internalformat, sizei width, sizei height );
76
77New Tokens
78
79    Accepted by the <pname> parameter of GetRenderbufferParameteriv:
80
81        RENDERBUFFER_STORAGE_SAMPLES_AMD            0x91B2
82
83    Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
84    GetInteger64v, GetFloatv, GetDoublev:
85
86        MAX_COLOR_FRAMEBUFFER_SAMPLES_AMD           0x91B3
87        MAX_COLOR_FRAMEBUFFER_STORAGE_SAMPLES_AMD   0x91B4
88        MAX_DEPTH_STENCIL_FRAMEBUFFER_SAMPLES_AMD   0x91B5
89        NUM_SUPPORTED_MULTISAMPLE_MODES_AMD         0x91B6
90        SUPPORTED_MULTISAMPLE_MODES_AMD             0x91B7
91
92Additions to Chapter 9 of the OpenGL 4.5 (Core Profile) Specification
93(Framebuffers and Framebuffer Objects)
94
95    In section 9.2.3.1, "Multisample Queries", remove the last paragraph
96    beginning with "Otherwise" and add:
97
98    Otherwise, the value of SAMPLES is equal to the value of
99    RENDERBUFFER_SAMPLES or TEXTURE_SAMPLES (depending on the type of
100    attachments) of color attachments if any is present. If there is no
101    color attachment, SAMPLES is equal to the same value from the depth or
102    stencil attachment, whichever is present.
103
104    An implementation may only support a subset of the possible
105    combinations of sample counts of textures and renderbuffers attached
106    to a framebuffer object. The number of supported combinations is
107    NUM_SUPPORTED_MULTISAMPLE_MODES_AMD. SUPPORTED_MULTISAMPLE_MODES_AMD
108    is an array of NUM_SUPPORTED_MULTISAMPLE_MODES_AMD triples of integers
109    where each triple contains a valid combination of sample counts in
110    the form {color samples, color storage samples, depth and stencil
111    samples}. The first element in each triple is at least 2. The second
112    and third element in each triple are at least 1 and are not greater
113    than the first element.
114
115    In section 9.2.4, "Renderbuffer Objects", replace the description of
116    (Named)RenderbufferStorageMultisample:
117
118    The data storage, format, dimensions, number of samples, and number of
119    storage samples of a renderbuffer object’s image are established with
120    the commands
121
122      void RenderbufferStorageMultisampleAdvancedAMD( enum target,
123          sizei samples, sizei storageSamples, enum internalformat,
124          sizei width, sizei height );
125
126      void NamedRenderbufferStorageMultisampleAdvancedAMD(
127          uint renderbuffer, sizei samples, sizei storageSamples,
128          enum internalformat, sizei width, sizei height );
129
130    For RenderbufferStorageMultisampleAdvancedAMD, the renderbuffer object
131    is that bound to <target>, which must be RENDERBUFFER.
132    For NamedRenderbufferStorageMultisampleAdvancedAMD, <renderbuffer> is
133    the name of the renderbuffer object.
134
135    <internalformat> must be color-renderable, depth-renderable, or
136    stencil-renderable (as defined in section 9.4). <width> and <height>
137    are the dimensions in pixels of the renderbuffer.
138
139    Upon success, *RenderbufferStorageMultisampleAdvancedAMD deletes any
140    existing data store for the renderbuffer image, and the contents of
141    the data store are undefined. RENDERBUFFER_WIDTH is set to <width>,
142    RENDERBUFFER_HEIGHT is set to <height>, and RENDERBUFFER_INTERNAL_-
143    FORMAT is set to <internalformat>.
144
145    If <samples> is zero, then <storageSamples> must be zero, and
146    RENDERBUFFER_SAMPLES and RENDERBUFFER_STORAGE_SAMPLES_AMD are set to
147    zero. Otherwise <samples> represents a request for a desired minimum
148    number of samples and <storageSamples> represents a request for
149    a desired minimum number of storage samples, where <storageSamples>
150    must not be greater than <samples>. Since different implementations
151    may support different sample counts for multisampled rendering,
152    the actual number of samples and the actual number of storage samples
153    allocated for the renderbuffer image are implementation-dependent.
154    However, the resulting value for RENDERBUFFER_SAMPLES is guaranteed
155    to be greater than or equal to <samples> and no more than the next
156    larger sample count supported by the implementation, and the resulting
157    value for RENDERBUFFER_STORAGE_SAMPLES_AMD is guaranteed to be greater
158    than or equal to <storageSamples>, no more than the next larger
159    storage sample count supported by the implementation, and no more than
160    RENDERBUFFER_SAMPLES.
161
162    A GL implementation may vary its allocation of internal component
163    resolution based on any *RenderbufferStorageMultisampleAdvancedAMD
164    parameter (except <target> and <renderbuffer>), but the allocation and
165    chosen internal format must not be a function of any other state and
166    cannot be changed once they are established.
167
168    Remove the first 4 errors and add these errors:
169
170    An INVALID_ENUM error is generated by RenderbufferStorageMultisample-
171    AdvancedAMD if <target> is not RENDERBUFFER.
172
173    An INVALID_OPERATION error is generated by NamedRenderbufferStorage-
174    MultisampleAdvancedAMD if <renderbuffer> is not the name of
175    an existing renderbuffer object.
176
177    An INVALID_VALUE error is generated if <samples>, <storageSamples>,
178    <width>, or <height> is negative.
179
180    An INVALID_OPERATION error is generated if <internalformat> is a color
181    format and <samples> is greater than the implementation-dependent
182    limit MAX_COLOR_FRAMEBUFFER_SAMPLES_AMD.
183
184    An INVALID_OPERATION error is generated if <internalformat> is a color
185    format and <storageSamples> is greater than the implementation-
186    dependent limit MAX_COLOR_FRAMEBUFFER_STORAGE_SAMPLES_AMD.
187
188    An INVALID_OPERATION error is generated if <storageSamples> is greater
189    than <samples>.
190
191    An INVALID_OPERATION error is generated if <internalformat> is a depth
192    or stencil format and <samples> is greater than the maximum number of
193    samples supported for <internalformat> (see GetInternalformativ
194    in section 22.3).
195
196    An INVALID_OPERATION error is generated if <internalformat> is a depth
197    or stencil format and <storageSamples> is not equal to <samples>.
198
199    Finish the section as follows:
200
201    The commands
202
203        void RenderbufferStorageMultisample( enum target,
204            sizei samples, enum internalformat, sizei width,
205            sizei height );
206        void RenderbufferStorage( enum target, enum internalformat,
207            sizei width, sizei height );
208
209    are equivalent to
210
211        RenderbufferStorageMultisampleAdvancedAMD(target, samples,
212            samples, internalformat, width, height);
213
214    and
215
216        RenderbufferStorageMultisampleAdvancedAMD(target, 0, 0,
217            internalformat, width, height);
218
219    respectively.
220
221    The commands
222
223        void NamedRenderbufferStorageMultisample( uint renderbuffer,
224            sizei samples, enum internalformat, sizei width,
225            sizei height );
226        void NamedRenderbufferStorage( uint renderbuffer,
227            enum internalformat, sizei width, sizei height );
228
229    are equivalent to
230
231        NamedRenderbufferStorageMultisampleAdvancedAMD(renderbuffer,
232            samples, samples, internalformat, width, height);
233
234    and
235
236        NamedRenderbufferStorageMultisampleAdvancedAMD(renderbuffer,
237            0, 0, internalformat, width, height);
238
239    respectively.
240
241    In section 9.2.5, "Required Renderbuffer Formats", replace the last
242    paragraph with:
243
244    Implementations must support creation of renderbuffers in these
245    required formats with sample counts up to and including:
246    * MAX_COLOR_FRAMEBUFFER_SAMPLES_AMD as color renderbuffer samples
247    * MAX_COLOR_FRAMEBUFFER_STORAGE_SAMPLES_AMD as color renderbuffer
248      storage samples
249    * MAX_DEPTH_STENCIL_FRAMEBUFFER_SAMPLES_AMD as depth and stencil
250      samples
251
252    with the exception that the signed and unsigned integer formats are
253    required only to support creation of renderbuffers with up to
254    the value of MAX_INTEGER_SAMPLES samples and storage samples, which
255    must be at least one.
256
257    In section 9.2.6, "Renderbuffer Object Queries", replace the paragraph
258    mentioning RENDERBUFFER_SAMPLES with:
259
260    If <pname> is RENDERBUFFER_WIDTH, RENDERBUFFER_HEIGHT,
261    RENDERBUFFER_INTERNAL_FORMAT, RENDERBUFFER_SAMPLES, or
262    RENDERBUFFER_STORAGE_SAMPLES_AMD then <params> will contain the width
263    in pixels, height in pixels, internal format, number of samples, or
264    number of storage samples, respectively, of the image of
265    the renderbuffer object.
266
267    In section 9.4.1, "Framebuffer Attachment Completeness", remove
268    the bullet beginning with "If <image> has multisample samples" and
269    replace the last 3 bullets about <attachment> with:
270
271    If <attachment> is COLOR_ATTACHMENTi, then <image> must have a color-
272    renderable internal format, the sample count must be less than or
273    equal to the value of the implementation-dependent limit
274    MAX_COLOR_FRAMEBUFFER_SAMPLES_AMD, and the storage sample count must
275    be less than or equal to the value of the implementation-dependent
276    limit MAX_COLOR_FRAMEBUFFER_STORAGE_SAMPLES_AMD.
277
278    If <attachment> is DEPTH_ATTACHMENT, then <image> must have a depth-
279    renderable internal format, and its sample count must be less than or
280    equal to the value of the implementation-dependent limit
281    MAX_DEPTH_STENCIL_FRAMEBUFFER_SAMPLES_AMD.
282
283    If <attachment> is STENCIL_ATTACHMENT, then <image> must have
284    a stencil-renderable internal format, and its sample count must be
285    less than or equal to the value of the implementation-dependent limit
286    MAX_DEPTH_STENCIL_FRAMEBUFFER_SAMPLES_AMD.
287
288    In section 9.4.2, replace the bullet mentioning RENDERBUFFER_SAMPLES
289    with:
290
291    * The value of RENDERBUFFER_SAMPLES of a color attachment defines its
292    <number of color samples>; the value of RENDERBUFFER_STORAGE_SAMPLES
293    of a color attachment defines its <number of color storage samples>;
294    the value of RENDERBUFFER_SAMPLES of a depth or stencil attachment
295    defines its <number of depth-stencil samples> for each separately;
296    the value of TEXTURE_SAMPLES of a color attachment defines both its
297    <number of color samples> and its <number of color storage samples>;
298    the value of TEXTURE_SAMPLES of a depth or stencil attachment defines
299    its <number of depth-stencil samples> for each separately. If any of
300    the defined values is 0, it is treated as 1. Any undefined value is
301    treated as equal to any number. For all attachment values that are
302    defined, all values of <number of color samples> must be equal, all
303    values of <number of color storage samples> must be equal, all values
304    of <number of depth-stencil samples> must be equal, and the triple
305    {<number of color samples>, <number of color storage samples>, <number
306    of depth-stencil samples>} must be in SUPPORTED_MULTISAMPLE_MODES_AMD
307    or must be equal to {1, 1, 1}.
308
309    { FRAMEBUFFER_INCOMPLETE_MULTISAMPLE }
310
311Additions to Chapter 17 of the OpenGL 4.5 (Core Profile) Specification
312(Writing Fragments and Samples to the Framebuffer)
313
314    In section 17.3.10, "Additional Multisample Fragment Operations", add
315    this paragraph after the "If MULTISAMPLE is enabled" paragraph:
316
317    If there are fewer color storage samples (see section 9.2.4) than
318    the value of SAMPLES, the number of color storage samples determines
319    the number of unique color values that can be stored per pixel.
320    The implementation must determine which samples within a pixel share
321    the same color value, write that value into 1 color storage sample,
322    and remember a mapping between color samples and color storage
323    samples to be able to map color storage samples back to color samples.
324    The color value equality determination is done in an implementation-
325    specific manner, but the implementation must at least recognize a set
326    of color samples coming from the same primitive as 1 storage sample if
327    sample shading (see section 14.3.1.1) is disabled. If there are not
328    enough color storage samples per pixel to store all incoming color
329    values, the excessive color values are not stored and the color samples
330    with unstored values are marked as having an unknown value. Color
331    samples with an unknown value will not contribute to the final color
332    value of the pixel when all color samples are resolved by
333    BlitFramebuffer (see section 18.3.1).
334
335    If there are fewer depth and stencil samples than the value of SAMPLES
336    and implementation-specific optimizations are unable to represent more
337    depth and stencil samples within the given storage, the missing depth
338    and stencil values should be pulled from or derived from the nearest
339    existing depth and stencil samples within the same pixel. The mapping
340    from missing to existing depth and stencil samples is implementation-
341    specific, but the mapping must be at least:
342    * injective if missing samples < existing samples
343    * bijective if missing samples = existing samples
344    * surjective if missing samples > existing samples
345    Depth and stencil tests operate as if the number of depth and stencil
346    samples was equal to the value of SAMPLES.
347
348Errors
349
350    An INVALID_ENUM error is generated by RenderbufferStorageMultisample-
351    AdvancedAMD if <target> is not RENDERBUFFER.
352
353    An INVALID_OPERATION error is generated by NamedRenderbufferStorage-
354    MultisampleAdvancedAMD if <renderbuffer> is not the name of
355    an existing renderbuffer object.
356
357    An INVALID_VALUE error is generated if <samples>, <storageSamples>,
358    <width>, or <height> is negative.
359
360    An INVALID_OPERATION error is generated if <internalformat> is a color
361    format and <samples> is greater than the implementation-dependent
362    limit MAX_COLOR_FRAMEBUFFER_SAMPLES_AMD.
363
364    An INVALID_OPERATION error is generated if <internalformat> is a color
365    format and <storageSamples> is greater than the implementation-
366    dependent limit MAX_COLOR_FRAMEBUFFER_STORAGE_SAMPLES_AMD.
367
368    An INVALID_OPERATION error is generated if <storageSamples> is greater
369    than <samples>.
370
371    An INVALID_OPERATION error is generated if <internalformat> is a depth
372    or stencil format and <samples> is greater than the maximum number of
373    samples supported for <internalformat> (see GetInternalformativ
374    in section 22.3).
375
376    An INVALID_OPERATION error is generated if <internalformat> is a depth
377    or stencil format and <storageSamples> is not equal to <samples>.
378
379New State
380
381    Add to Table 23.27, "Renderbuffer (state per renderbuffer object)"
382                                                                        Initial
383    Get Value                         Type  Get Command                 Value    Description             Section
384    --------------------------------  ----  --------------------------  -------  ----------------------  -------
385    RENDERBUFFER_STORAGE_SAMPLES_AMD   Z+   GetRenderbufferParameteriv  0        No. of storage samples  9.2.4
386
387New Implementation Dependent Values
388                                                                       Minimum
389    Get Value                                 Type        Get Command  Value    Description                             Section
390    ----------------------------------------  ----------  -----------  -------  ---------------------------------------  -------
391    MAX_COLOR_FRAMEBUFFER_SAMPLES_AMD             Z+      GetIntegerv  4        Max. no. of color samples supported by   9.2.4
392                                                                                framebuffer objects.
393    MAX_COLOR_FRAMEBUFFER_STORAGE_SAMPLES_AMD     Z+      GetIntegerv  4        Max. no. of color storage samples        9.2.4
394                                                                                supported by framebuffer objects.
395    MAX_DEPTH_STENCIL_FRAMEBUFFER_SAMPLES_AMD     Z+      GetIntegerv  4        Max. no. of depth and stencil samples    9.2.4
396                                                                                supported by framebuffer objects.
397    NUM_SUPPORTED_MULTISAMPLE_MODES_AMD           Z+      GetIntegerv  1        No. of supported combinations of color   9.2.4
398                                                                                samples, color storage samples, and
399                                                                                depth-stencil samples by framebuffer
400                                                                                objects.
401    SUPPORTED_MULTISAMPLE_MODES_AMD           n * 3 x Z+  GetIntegerv  -        NUM_SUPPORTED_MULTISAMPLE_MODES_AMD (n)  9.2.4
402                                                                                triples of integers. Each triple is
403                                                                                a unique combination of color samples,
404                                                                                color storage samples, and depth-stencil
405                                                                                samples supported by framebuffer objects.
406
407AMD Implementation Details
408
409    The following multisample modes are supported by AMD's open source
410    OpenGL driver:
411
412                 Color    Depth &
413        Color    storage  stencil
414        samples  samples  samples
415        =======  =======  =======
416        16       8        8
417        16       4        8
418        16       2        8
419        16       4        4
420        16       2        4
421        16       2        2
422        -------  -------  -------
423        8        8        8
424        8        4        8
425        8        2        8
426        8        4        4
427        8        2        4
428        8        2        2
429        -------  -------  -------
430        4        4        4
431        4        2        4
432        4        2        2
433        -------  -------  -------
434        2        2        2
435
436Issues
437
438    None.
439
440Revision History
441
442    Rev.    Date    Author    Changes
443    ----  --------  --------  --------------------------------------------
444     1    06/28/18  mareko    Initial version
445