• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3    ARB_texture_multisample
4
5Name Strings
6
7    GL_ARB_texture_multisample
8
9Contact
10
11    Jeff Bolz, NVIDIA Corporation (jbolz 'at' nvidia.com)
12
13Notice
14
15    Copyright (c) 2009-2014 The Khronos Group Inc. Copyright terms at
16        http://www.khronos.org/registry/speccopyright.html
17
18Specification Update Policy
19
20    Khronos-approved extension specifications are updated in response to
21    issues and bugs prioritized by the Khronos OpenGL Working Group. For
22    extensions which have been promoted to a core Specification, fixes will
23    first appear in the latest version of that core Specification, and will
24    eventually be backported to the extension document. This policy is
25    described in more detail at
26        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
27
28Status
29
30    Complete. Approved by the ARB on July 3, 2009.
31
32Version
33
34    Last Modified Date:         February 28, 2014
35    Revision:                   12
36
37Number
38
39    ARB Extension #67
40
41Dependencies
42
43    This extension is written against the OpenGL 3.1 specification.
44
45Overview
46
47    This extension provides support for two new types of "multisample
48    textures" - two-dimensional and two-dimensional array - as well as
49    mechanisms to fetch a specific sample from such a texture in a shader,
50    and to attach such textures to FBOs for rendering.
51
52    This extension also includes the following functionality, first described
53    in NV_explicit_multisample:
54
55     * A query in the API to query the location of samples within the pixel
56
57     * An explicit control for the multisample sample mask to augment the
58       control provided by SampleCoverage
59
60New Procedures and Functions
61
62    void TexImage2DMultisample(enum target, sizei samples, enum internalformat,
63                               sizei width, sizei height,
64                               boolean fixedsamplelocations);
65
66    void TexImage3DMultisample(enum target, sizei samples, enum internalformat,
67                               sizei width, sizei height, sizei depth,
68                               boolean fixedsamplelocations);
69
70    void GetMultisamplefv(enum pname, uint index, float *val);
71
72    void SampleMaski(uint index, bitfield mask);
73
74New Tokens
75
76    Accepted by the <pname> parameter of GetMultisamplefv:
77
78        SAMPLE_POSITION                             0x8E50
79
80    Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, and by
81    the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and
82    GetDoublev:
83
84        SAMPLE_MASK                                 0x8E51
85
86    Accepted by the <target> parameter of GetBooleani_v and
87    GetIntegeri_v:
88
89        SAMPLE_MASK_VALUE                           0x8E52
90
91    Accepted by the <target> parameter of BindTexture and
92    TexImage2DMultisample:
93
94        TEXTURE_2D_MULTISAMPLE                      0x9100
95
96    Accepted by the <target> parameter of TexImage2DMultisample:
97
98        PROXY_TEXTURE_2D_MULTISAMPLE                0x9101
99
100    Accepted by the <target> parameter of BindTexture and
101    TexImage3DMultisample:
102
103        TEXTURE_2D_MULTISAMPLE_ARRAY                0x9102
104
105    Accepted by the <target> parameter of TexImage3DMultisample:
106
107        PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY          0x9103
108
109    Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetIntegerv,
110    and GetFloatv:
111
112        MAX_SAMPLE_MASK_WORDS                       0x8E59
113        MAX_COLOR_TEXTURE_SAMPLES                   0x910E
114        MAX_DEPTH_TEXTURE_SAMPLES                   0x910F
115        MAX_INTEGER_SAMPLES                         0x9110
116        TEXTURE_BINDING_2D_MULTISAMPLE              0x9104
117        TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY        0x9105
118
119    Accepted by the <pname> parameter of GetTexLevelParameter
120
121        TEXTURE_SAMPLES                             0x9106
122        TEXTURE_FIXED_SAMPLE_LOCATIONS              0x9107
123
124    Returned by the <type> parameter of GetActiveUniform:
125
126        SAMPLER_2D_MULTISAMPLE                      0x9108
127        INT_SAMPLER_2D_MULTISAMPLE                  0x9109
128        UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE         0x910A
129        SAMPLER_2D_MULTISAMPLE_ARRAY                0x910B
130        INT_SAMPLER_2D_MULTISAMPLE_ARRAY            0x910C
131        UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY   0x910D
132
133Additions to Chapter 2 of the OpenGL 3.1 Specification (OpenGL Operation)
134
135    Add to table 2.9 "OpenGL Shading Language type tokens" page 56:
136
137    Type Name Token                              Keyword
138    -----------------------------------------    ------------
139    SAMPLER_2D_MULTISAMPLE                       sampler2DMS
140    SAMPLER_2D_MULTISAMPLE_ARRAY                 sampler2DMSArray
141    INT_SAMPLER_2D_MULTISAMPLE_ARRAY             isampler2DMSArray
142    UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE          usampler2DMS
143    UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY    usampler2DMSArray
144
145    Add to section 2.11.7, after subsection "Texel Fetches"
146
147    Multisample Texel Fetches
148
149    Multisample texel fetches are similar to standard texel fetches.
150    Since multisample buffers can't have mipmaps, there is no LOD
151    parameter. Instead, there is an integer parameter which selects the
152    sample number to be fetched from the buffer. The number identifying
153    the sample is the same as the value used to query the sample
154    location using GetMultisamplefv. Multisample textures support only
155    NEAREST filtering.
156
157    Additionally, this fetch may only be performed on a multisample
158    texture sampler. No other sample or fetch commands may be performed
159    on a multisample texture sampler.
160
161Additions to Chapter 3 of the OpenGL 3.1 Specification (Rasterization)
162
163    (Insert into section 3.3.1, Multisampling after the discussion of
164    the query for SAMPLES)
165
166    The location of a given sample is queried with the command
167
168        void GetMultisamplefv(enum pname, uint index, float *val);
169
170    <pname> must be SAMPLE_POSITION and <index> corresponds to the
171    sample for which the location should be returned. The sample
172    location is returned as two floating point values in <val[0]> and
173    <val[1]>, each between 0 and 1, corresponding to the <x> and <y>
174    locations respectively in GL pixel space of that sample. (0.5, 0.5)
175    thus corresponds to the pixel center. An INVALID_ENUM error is
176    generated if <pname> is not SAMPLE_POSITION. An INVALID_VALUE error
177    is generated if <index> is greater than or equal to the value of
178    SAMPLES. If the multisample mode does not have fixed sample
179    locations, the returned values may only reflect the locations of
180    samples within some pixels.
181
182    Modify Section 3.8.1, Texture Image Specification (p. 143)
183
184    Add the two new targets to MAX_TEXTURE_SIZE description:
185
186    In a similar fashion, the maximum allowable width of a texel array
187    for a one or two-dimensional, one- or two-dimensional array,
188    two-dimensional multisample, or two-dimensional multisample array
189    texture, and the maximum allowable height of a two-dimensional,
190    two-dimensional array, two- dimensional multisample, or
191    two-dimensional multisample array texture, must be at least
192    2^(k-lod)+2*b_t for image arrays of level 0 through k, where k is
193    the log base 2 of MAX_TEXTURE_SIZE.
194
195    (Insert new Section 3.8.4, Multisample Textures.  Renumber subsequent
196    sections.)
197
198    In addition to the texture types described in previous sections, two
199    additional types of textures are supported. A multisample texture is
200    similar to a two-dimensional or two-dimensional array texture,
201    except it contains multiple samples per texel. Multisample textures
202    do not have multiple image levels.
203
204    The commands
205
206        void TexImage2DMultisample(enum target, sizei samples,
207                                   enum internalformat,
208                                   sizei width, sizei height,
209                                   boolean fixedsamplelocations);
210
211        void TexImage3DMultisample(enum target, sizei samples,
212                                   enum internalformat,
213                                   sizei width, sizei height, sizei depth,
214                                   boolean fixedsamplelocations);
215
216    establish the data storage, format, dimensions, and number of
217    samples of a multisample texture's image. For TexImage2DMultisample,
218    <target> must be TEXTURE_2D_MULTISAMPLE or
219    PROXY_TEXTURE_2D_MULTISAMPLE and for TexImage3DMultisample <target>
220    must be TEXTURE_2D_MULTISAMPLE_ARRAY or
221    PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY. <width> and <height> are the
222    dimensions in texels of the texture.
223
224    <internalformat> must be color-renderable, depth-renderable, or
225    stencil- renderable (as defined in section 4.4.4). The error
226    INVALID_OPERATION may be generated if any of the following are true:
227
228    * <internalformat> is a depth/stencil-renderable format and
229      <samples> is greater than the value of MAX_DEPTH_TEXTURE_SAMPLES
230    * <internalformat> is a color-renderable format and <samples> is
231      greater than the value of MAX_COLOR_TEXTURE_SAMPLES
232    * <internalformat> is a signed or unsigned integer format and
233      <samples> is greater than the value of MAX_INTEGER_SAMPLES.
234
235    If <fixedsamplelocations> is TRUE, the image will use identical
236    sample locations and the same number of samples for all texels in
237    the image, and the sample locations will not depend on the
238    internalformat or size of the image.
239
240    An INVALID_VALUE error is generated by TexImage2DMultisample if <width>
241    or <height> is greater than the value of MAX_TEXTURE_SIZE. An
242    INVALID_VALUE error is generated by TexImage3DMultisample if <width>,
243    <height>, or <depth> is greater than the value of MAX_3DTEXTURE_SIZE; An
244    INVALID_VALUE error is generated if <samples> is greater than the value
245    of MAX_SAMPLES. An OUT_OF_MEMORY error is generated if the GL is unable
246    to create a texture level of the requested size.
247
248    When a multisample texture is accessed in a shader, the access takes
249    one vector of integers describing which texel to fetch and an
250    integer corresponding to the sample numbers described in section
251    3.3.1 describing which sample within the texel to fetch. No standard
252    sampling instructions are allowed on the multisample texture
253    targets.
254
255    Modify Section 3.8.11, Texture Completeness (p. 154)
256
257    (insert after first paragraph of section, p. 154)
258
259    For multisample textures, a texture is complete if each dimension of
260    the texture's level is positive.
261
262    Modify Section 3.8.12, Texture State and Proxy State (p. 155)
263
264    (insert into the first paragraph of the section, p. 155)
265
266    ... the compressed flag set to FALSE, and a zero compressed size).
267    Multisample textures contain an integer identifying the number of
268    samples in each texel. The buffer texture target has associated an
269    integer containing ...
270
271    (add a new paragraph after the paragraph starting with "Proxy Arrays...")
272
273    Proxy array for two-dimensional multisample and two-dimensional
274    multisample array textures are operated on in the same way when
275    TexImage2DMultisample is called with <target> specified as
276    PROXY_TEXTURE_2D_MULTISAMPLE, or TexImage3DMultisample is called
277    with <target> specified as PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY.
278
279    Modify Section 3.8.13, Texture Objects (p. 157)
280
281    (modify first paragraphs of section, p. 157, simply adding
282     references to multisample textures)
283
284    In addition to the default textures TEXTURE_1D, TEXTURE_2D,
285    TEXTURE_3D, TEXTURE_1D_ARRAY, TEXTURE_2D_ARRAY, TEXTURE_RECTANGLE,
286    TEXTURE_BUFFER, TEXTURE_CUBE_MAP, TEXTURE_2D_MULTISAMPLE, and
287    TEXTURE_2D_MULTISAMPLE_ARRAY, named one-, two-, and
288    three-dimensional, one- and two-dimensional array, rectangular,
289    buffer, cube map, two-dimensional multisample, and two- dimensional
290    multisample array texture objects can be created and operated upon.
291    The name space for texture objects is the unsigned integers, with
292    zero reserved by the GL.
293
294    ...
295
296    In the initial state, TEXTURE_1D, TEXTURE_2D, TEXTURE_3D,
297    TEXTURE_1D_ARRAY, TEXTURE_2D_ARRAY, TEXTURE_RECTANGLE,
298    TEXTURE_BUFFER, TEXTURE_CUBE_MAP, TEXTURE_2D_MULTISAMPLE, and
299    TEXTURE_2D_MULTISAMPLE_ARRAY have one-, two-, and three-dimensional,
300    one- and two-dimensional array, rectangular, buffer, cube map,
301    two-dimensional multisample, and two-dimensional multisample array
302    texture state vectors respectively associated with them. In order
303    that access to these initial textures not be lost, they are treated
304    as texture objects all of whose names are 0. The initial one-, two-,
305    three- dimensional, one- and two-dimensional array, rectangular,
306    buffer, cube map, two-dimensional multisample, and two-dimensional
307    multisample array texture is therefore operated upon, queried, and
308    applied as TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_1D_ARRAY,
309    TEXTURE_2D_ARRAY, TEXTURE_RECTANGLE, TEXTURE_BUFFER,
310    TEXTURE_CUBE_MAP, TEXTURE_2D_MULTISAMPLE, and
311    TEXTURE_2D_MULTISAMPLE_ARRAY respectively while 0 is bound to the
312    corresponding targets.
313
314    (modify second paragraph, p. 158)
315
316    The texture object name space, including the initial one-, two-, and
317    three-dimensional, one- and two-dimensional array, rectangular,
318    buffer, cube map, two-dimensional multisample, and two-dimensional
319    multisample array texture objects, is shared among all texture
320    units. A texture object may be bound to more than one texture unit
321    simultaneously. After a texture object is bound, any GL operations
322    on that target object affect any other texture units to which the
323    same texture object is bound.
324
325Additions to Chapter 4 of the OpenGL 3.1 Specification (Per-Fragment
326Operations and the Frame Buffer)
327
328    Modify Section 4.1.3, Multisample Fragment Operations
329
330    Modify the first paragraph to include SAMPLE_MASK and
331    SAMPLE_MASK_VALUE on the list of values the coverage value is
332    modified based on.
333
334    Modify the discussion of SAMPLE_COVERAGE to start with "Next" instead of
335    "Finally"
336
337    Add after the discussion of SAMPLE_COVERAGE:
338
339    Finally, if SAMPLE_MASK is enabled, the fragment coverage is ANDed
340    with the coverage value SAMPLE_MASK_VALUE. The value of
341    SAMPLE_MASK_VALUE is specified using
342
343        void SampleMaski(GLuint index, GLbitfield mask);
344
345    with <mask> set to the desired mask for <maskNumber>.
346    SAMPLE_MASK_VALUE is queried by calling GetIntegeri_v with <pname>
347    set to SAMPLE_MASK_VALUE and the index set to <maskNumber>. Bit B of
348    mask M corresponds to sample 32*M+B as described in Section 3.3.1.
349    The error INVALID_VALUE is generated if the mask word indexed is
350    greater than or equal to MAX_SAMPLE_MASK_WORDS.
351
352    Modify Section 4.4.2, Attaching Images to Framebuffer Objects, p. 203
353
354    (the first paragraph of RenderbufferStorageMultisample p. 205)
355
356    ... If either <width> or <height> is greater than the value of
357    MAX_RENDERBUFFER_SIZE, or if <samples> is greater than the value of
358    MAX_SAMPLES, then the error INVALID_VALUE is generated. If
359    <internalformat> is a signed or unsigned integer format and
360    <samples> is greater than the value of MAX_INTEGER_SAMPLES, then the
361    error INVALID_OPERATION is generated. (see ``Required Renderbuffer
362    Formats'' below). ...
363
364    (The second paragraph of "Required Renderbuffer Formats" p. 206):
365
366    Implementations must support creation of renderbuffers in these
367    required formats with up to the value of MAX_SAMPLES multisamples,
368    with the exception that the signed and unsigned integer formats are
369    required only to support creation of renderbuffers with up to the
370    value of MAX_INTEGER_SAMPLES multisamples, which must be at least
371    one.
372
373    Modify the description of FrameBufferTextureARB in
374    ARB_geometry_shader4, to allow multisample array textures with
375    FramebufferTextureARB:
376
377    If <texture> is the name of a three-dimensional texture, cube map
378    texture, one- or two-dimensional array texture, or two-dimensional
379    multisample array texture, the texture level attached to the
380    framebuffer attachment point is an array of images, and the
381    framebuffer attachment is considered layered.
382
383    (At the end of p. 208, describing FrameBufferTexture*D)
384
385    If <textarget> is TEXTURE_RECTANGLE, TEXTURE_2D_MULTISAMPLE, or
386    TEXTURE_2D_MULTISAMPLE_ARRAY, then <level> must be zero.
387
388    ...
389
390    For FramebufferTexture2D, if <texture> is not zero, then <textarget>
391    must be one of of TEXTURE_2D, TEXTURE_RECTANGLE,
392    TEXTURE_CUBE_MAP_POSITIVE_X, TEXTURE_CUBE_MAP_POSITIVE_Y,
393    TEXTURE_CUBE_MAP_POSITIVE_Z, TEXTURE_CUBE_MAP_NEGATIVE_X,
394    TEXTURE_CUBE_MAP_NEGATIVE_Y, TEXTURE_CUBE_MAP_NEGATIVE_Z, or
395    TEXTURE_2D_MULTISAMPLE.
396
397    ...
398
399    The command
400
401        void FramebufferTextureLayer(enum target, enum attachment,
402                                     uint texture, int level, int layer);
403
404    operates identically to FramebufferTexture3D, except that it
405    attaches a single layer of a three-dimensional, one- or
406    two-dimensional array, or two-dimensional multisample array texture
407    layer is an integer indicating the layer sample number, and is
408    treated identically to the layer parameter in FramebufferTexture3D.
409    The error INVALID_VALUE is generated if texture is non-zero and
410    layer is negative. The error INVALID_OPERATION is generated if
411    texture is non-zero and is not the name of a three dimensional, two-
412    dimensional multisample array, or one-or two-dimensional array
413    texture. Unlike FramebufferTexture3D, no textarget parameter is
414    accepted. ...
415
416
417    Modify Section 4.4.4, Framebuffer Completeness, p. 212
418
419    (Modify the last bullet at the top of p. 215)
420
421    - The value of RENDERBUFFER_SAMPLES is the same for all attached
422      renderbuffers; the value of TEXTURE_SAMPLES is the same for all
423      attached textures; and, if the attached images are a mix of
424      renderbuffers and textures, the value of RENDERBUFFER_SAMPLES
425      matches the value of TEXTURE_SAMPLES.
426
427      { FRAMEBUFFER_INCOMPLETE_MULTISAMPLE }
428
429    - The value of TEXTURE_FIXED_SAMPLE_LOCATIONS is the same for all
430      attached textures; if the attached images are a mix of
431      renderbuffers and textures, the value of
432      TEXTURE_FIXED_SAMPLE_LOCATIONS must be TRUE for all attached
433      textures.
434
435      { FRAMEBUFFER_INCOMPLETE_MULTISAMPLE }
436
437Additions to Chapter 6 of the OpenGL 3.1 Specification (State and
438State Requests)
439
440    Edit Section 6.1.3, p. 223 (Enumerated Queries)
441
442    Add TEXTURE_2D_MULTISAMPLE, PROXY_TEXTURE_2D_MULTISAMPLE,
443    TEXTURE_2D_MULTISAMPLE_ARRAY, and PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY
444    to the list of valid targets for GetTexLevelParameter{if}v.
445
446Additions to the AGL/GLX/WGL Specifications
447
448    None
449
450GLX Protocol
451
452    TBD
453
454Errors
455
456    The error INVALID_VALUE is generated by GetBooleani_v and
457    GetIntegeri_v if <target> is SAMPLE_MASK_VALUE and <index> is greater
458    than or equal to MAX_SAMPLE_MASK_WORDS.
459
460    The error INVALID_VALUE is generated by SampleMaski if <index> is
461    greater than or equal to MAX_SAMPLE_MASK_WORDS.
462
463    The error INVALID_ENUM is generated by GetMultisamplefv if <pname>
464    is not SAMPLE_POSITION.
465
466    The error INVALID_VALUE is generated by GetMultisamplefv if <index> is
467    greater than or equal to the value of SAMPLES.
468
469    The error INVALID_OPERATION is generated by TexImage2DMultisample
470    and TexImage3DMultisample if the number of samples exceeds the
471    implementation dependent maximum for the given internal format.
472
473    The error INVALID_VALUE is generated by TexImage2DMultisample
474    TexImage3DMultisample if either <width> or <height> is greater than the
475    value of MAX_TEXTURE_SIZE, or if <samples> is greater than the value of
476    MAX_SAMPLES.
477
478    The error INVALID_VALUE is generated by TexImage3DMultisample if
479    <width>, <height>, or <depth> is greater than the value of
480    MAX_3D_TEXTURE_SIZE, or if <samples> is greater than the value of
481    MAX_SAMPLES.
482
483    The error OUT_OF_MEMORY is generated by TexImage2DMultisample and
484    TexImage3DMultisample if the GL is unable to create a texture level
485    of the requested size.
486
487    The error INVALID_OPERATION is generated by
488    RenderbufferStorageMultisample if <internalformat> is a signed or
489    unsigned integer format and <samples> is greater than the value of
490    MAX_INTEGER_SAMPLES.
491
492New State
493
494    Get Value                       Get Command    Type    Initial Value
495    ---------                       -----------    ----    -------------
496    SAMPLE_MASK                     IsEnabled      B       FALSE
497    SAMPLE_MASK_VALUE               GetIntegeri_v  nxZ+    ~0
498
499    Where n is the number of sample mask words (the value of
500    MAX_SAMPLE_MASK_WORDS) the implementation supports.
501
502    (add to table 6.12, Texture State Per Texture Unit/Binding Point p. 250)
503
504                                                               Initial
505    Get Value                              Type    Get Command  Value  Description                 Sec.
506    ------------------------------------   ----     ----------- ------- --------------------------- ------
507    TEXTURE_BINDING_2D_MULTISAMPLE        32*xZ+   GetIntegerv    0    Texture object bound to     3.8.13
508                                                                       TEXTURE_2D_MULTISAMPLE
509    TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY  32*xZ+   GetIntegerv    0    Texture object bound to     3.8.13
510                                                                       TEXTURE_2D_MULTISAMPLE_ARRAY
511
512    (add to table 6.14, Textures (state per texture image p. 252)
513
514                                                                Initial
515    Get Value                       Type  Get Command            Value  Description                 Sec.
516    ----------------------          ----  -------------------   ------- --------------------------- ------
517    TEXTURE_SAMPLES                  Z+   GetTexLevelParameter     0    Number of samples per texel 3.8.4
518    TEXTURE_FIXED_SAMPLE_LOCATIONS   B    GetTexLevelParameter   TRUE   Whether the image uses a    3.8.4
519                                                                        fixed sample pattern
520
521    (add to table 6.41, Framebuffer dependent Values, p. 279)
522
523                                                        Initial
524    Get Value           Type        Get Command         Value           Description      Sec.
525    ------------------  ----------  ------------------  --------------  ---------------  ------
526    SAMPLE_POSITION     N*2*R[0,1]  GetMultisamplefv    implementation  Explicit sample  3.2.1
527                                                        dependent       positions
528
529    Where N is the number of samples (the value of SAMPLES) the framebuffer supports.
530
531New Implementation Dependent State
532
533                                                      Minimum
534    Get Value                    Type    Get Command  Value   Description                   Sec.
535    ---------                    ------- -----------  ------- ------------------------      ------
536    MAX_SAMPLE_MASK_WORDS        Z+      GetIntegerv  1       maximum number of sample      4.1.3
537                                                              mask words
538    MAX_COLOR_TEXTURE_SAMPLES    Z+      GetIntegerv  1       maximum number of samples     4.1.3
539                                                              in a color multisample
540                                                              texture
541    MAX_DEPTH_TEXTURE_SAMPLES    Z+      GetIntegerv  1       maximum number of samples     4.1.3
542                                                              in a depth/stencil
543                                                              multisample texture
544    MAX_INTEGER_SAMPLES          Z+      GetIntegerv  1       Maximum number of samples     4.4.2
545                                                              in integer format
546                                                              multisample buffers
547
548Modifications to the OpenGL Shading Language Specification, Version 1.40
549
550    Including the following line in a shader can be used to control the
551    language featured described in this extension:
552
553      #extension GL_ARB_texture_multisample : <behavior>
554
555    where <behavior> is as specified in section 3.3.
556
557    A new preprocessor #define is added to the OpenGL Shading Language:
558
559      #define GL_ARB_texture_multisample 1
560
561    Add to section 3.6 "Keywords"
562
563    The following new sampler types are added:
564
565      sampler2DMS, isampler2DMS, usampler2DMS,
566      sampler2DMSArray, isampler2DMSArray, usampler2DMSArray
567
568    Add to section 4.1 "Basic Types"
569
570    Add the following sampler type to the "Floating Point Sampler Types"
571    table:
572
573      sampler2DMS                handle for accessing a 2D multisample texture
574      sampler2DMSArray           handle for accessing a 2D multisample array texture
575
576    Add the following sampler type to the "Unsigned Integer Sampler
577    Types" table:
578
579      usampler2DMS               handle for accessing an unsigned integer 2D multisample texture
580      usampler2DMSArray          handle for accessing an unsigned integer 2D multisample array texture
581
582    Add the following sampler type to the "Integer Sampler Types" table:
583
584      isampler2DMS               handle for accessing an integer 2D multisample texture
585      isampler2DMSArray          handle for accessing an integer 2D multisample array texture
586
587    Add to section 8.7 "Texture Lookup Functions"
588
589    Add new functions to the set of allowed texture lookup functions:
590
591    Syntax:
592
593      gvec4 texelFetch(gsampler2DMS sampler, ivec2 P, int sample)
594      gvec4 texelFetch(gsampler2DMSArray sampler, ivec3 P, int sample)
595
596    Description:
597
598      Use integer texture coordinate <P> to lookup a single sample
599      <sample> on the texture bound to <sampler> as described in section
600      2.11.7.1 of the OpenGL specification "Multisample Texel Fetches".
601
602    Syntax:
603
604      ivec2 textureSize(gsampler2DMS sampler)
605      ivec3 textureSize(gsampler2DMSArray sampler)
606
607    Description:
608
609      Returns the dimensions, width and height of level 0 for the
610      texture bound to <sampler>, as described in section 2.11.7.1 of
611      the OpenGL specification section "Texture Size Query".
612
613Examples
614
615Issues
616
617    (1) Do we need new "max size" queries for the new targets?
618
619    RESOLVED: No. The existing MAX_TEXTURE_SIZE applies to 2D multisample
620    textures, and MAX_3D_TEXTURE_SIZE to 3D multisample textures.
621
622    (2) What commands may be used on multisample textures?
623
624    RESOLVED: Multisample textures can be bound for rendering and texturing,
625    but they cannot be loaded/read with SubImage commands (TexSubImage,
626    CopyTexSubImage, GetTexImage), they don't support compressed formats,
627    and they don't need TexParameters since they can only be fetched with
628    texelFetchMultisample.
629
630    (3) Should the new TexImage commands take an "int level" argument?
631
632    RESOLVED: No. We can add new commands if/when we ever add mipmapped
633    multisample textures.
634
635    (4) GetMultisamplefv takes an index to support >32 samples, but
636        NV_gpu_shader4_1's gl_SampleMask is only 32 bits. What gives?
637
638    RESOLVED: This is gpu_shader4_1's problem, not ARB_texture_multisample's
639    problem.
640
641    (5) Should GLSL include a query to return the sample count of a
642        texture, either as part of textureSizeMultisample or
643        stand-alone?
644
645    RESOLVED: No, there hasn't been a demand for it.
646
647    (6) How does SAMPLE_POSITION interact with
648        EXT_fragment_coord_conventions?
649
650    RESOLVED: The SAMPLE_POSITION query is not in any way affected by
651    the shader state added in EXT_fragment_coord_conventions. It is
652    expected that the returned values will not actually be used within
653    the shader, but rather to compute filter weights on the CPU, so
654    whether the fragment coord is inverted or translated by 0.5 doesn't
655    matter.
656
657    (7) Should we use "TexImage3DMultisample" to make things look like
658        regular 2D arrays, or just have TexImage2DArrayMultisample?
659
660    RESOLVED: Leave it as is.
661
662    (8) How should we deal with varying sample locations?
663
664    RESOLVED: Allow the application to explicitly request fixed sample
665    locations for when a texture will be used to do custom downsamples.
666    When this is requested, the values returned by GetMultisamplefv will
667    be valid for all texels in the image and can be used to construct
668    elaborate filter kernels that can safely be used across the entire
669    image.
670
671    (9) Are depth multisample textures supported?
672
673    RESOLVED: Some implementations may not support texturing from a
674    multisample depth/stencil texture. In that case, they would export
675    MAX_DEPTH_TEXTURE_SAMPLES = 1.
676
677Revision History
678
679    Rev.    Date    Author    Changes
680    ----  --------  --------  -----------------------------------------------
681    12    2/28/14   Jon Leech Add missing error for invalid <pname> to
682                              GetMultisamplefv, and change texture size
683                              limits for TexImage3DMultisample to the value
684                              of MAX_3D_TEXTURE_SIZE (Bugs 11134, 11135).
685    11    9/23/13   Jon Leech Change type of <internalformat> argument to
686                              enum (Bug 10496).
687    10    8/02/09   Jon Leech Reformat to 80 columns and assign ARB
688                              extension number.
689    9     7/23/09   groth     Update return of textureSize(gsampler2DMSarray)
690    8     7/20/09   Jon Leech Assign enum values.
691    7     6/26/09   groth     Update some language to correspond to gl3.2
692    6     6/11/09   groth     Add new max queries to token section
693    5     5/28/09   groth     Add MAX_INTEGER_SAMPLES query.
694    4     5/22/09   jbolz     Add max sample queries.
695    3     5/14/09   jbolz     Add allowance for not supporting multisample
696                              depth textures.
697    2     5/08/09   jbolz     Add allowance for varying sample locations,
698                              and a mechanism to request fixed locations.
699                              Resolve some issues.
700    1     4/30/09   jbolz     First revision.
701
702