gfx/angle/extensions/ANGLE_framebuffer_multisample.txt

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 Name
michael@0 2
michael@0 3 ANGLE_framebuffer_multisample
michael@0 4
michael@0 5 Name Strings
michael@0 6
michael@0 7 GL_ANGLE_framebuffer_multisample
michael@0 8
michael@0 9 Contributors
michael@0 10
michael@0 11 Contributors to EXT_framebuffer_multisample
michael@0 12 Daniel Koch, TransGaming Inc.
michael@0 13 Shannon Woods, TransGaming Inc.
michael@0 14 Kenneth Russell, Google Inc.
michael@0 15 Vangelis Kokkevis, Google Inc.
michael@0 16
michael@0 17 Contacts
michael@0 18
michael@0 19 Daniel Koch, TransGaming Inc. (daniel 'at' transgaming 'dot' com)
michael@0 20
michael@0 21 Status
michael@0 22
michael@0 23 Implemented in ANGLE ES2
michael@0 24
michael@0 25 Version
michael@0 26
michael@0 27 Last Modified Date: Aug 6, 2010
michael@0 28 Author Revision: #3
michael@0 29
michael@0 30 Number
michael@0 31
michael@0 32 OpenGL ES Extension #84
michael@0 33
michael@0 34 Dependencies
michael@0 35
michael@0 36 Requires OpenGL ES 2.0.
michael@0 37
michael@0 38 Requires GL_ANGLE_framebuffer_blit (or equivalent functionality).
michael@0 39
michael@0 40 The extension is written against the OpenGL ES 2.0 specification.
michael@0 41
michael@0 42 OES_texture_3D affects the definition of this extension.
michael@0 43
michael@0 44 Overview
michael@0 45
michael@0 46 This extension extends the framebuffer object framework to
michael@0 47 enable multisample rendering.
michael@0 48
michael@0 49 The new operation RenderbufferStorageMultisampleANGLE() allocates
michael@0 50 storage for a renderbuffer object that can be used as a multisample
michael@0 51 buffer. A multisample render buffer image differs from a
michael@0 52 single-sample render buffer image in that a multisample image has a
michael@0 53 number of SAMPLES that is greater than zero. No method is provided
michael@0 54 for creating multisample texture images.
michael@0 55
michael@0 56 All of the framebuffer-attachable images attached to a framebuffer
michael@0 57 object must have the same number of SAMPLES or else the framebuffer
michael@0 58 object is not "framebuffer complete". If a framebuffer object with
michael@0 59 multisample attachments is "framebuffer complete", then the
michael@0 60 framebuffer object behaves as if SAMPLE_BUFFERS is one.
michael@0 61
michael@0 62 The resolve operation is affected by calling
michael@0 63 BlitFramebufferANGLE (provided by the ANGLE_framebuffer_blit
michael@0 64 extension) where the source is a multisample application-created
michael@0 65 framebuffer object and the destination is a single-sample
michael@0 66 framebuffer object (either application-created or window-system
michael@0 67 provided).
michael@0 68
michael@0 69 New Procedures and Functions
michael@0 70
michael@0 71 void RenderbufferStorageMultisampleANGLE(
michael@0 72 enum target, sizei samples,
michael@0 73 enum internalformat,
michael@0 74 sizei width, sizei height);
michael@0 75
michael@0 76 New Types
michael@0 77
michael@0 78 None.
michael@0 79
michael@0 80 New Tokens
michael@0 81
michael@0 82 Accepted by the <pname> parameter of GetRenderbufferParameteriv:
michael@0 83
michael@0 84 RENDERBUFFER_SAMPLES_ANGLE 0x8CAB
michael@0 85
michael@0 86 Returned by CheckFramebufferStatus:
michael@0 87
michael@0 88 FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56
michael@0 89
michael@0 90 Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
michael@0 91 and GetFloatv:
michael@0 92
michael@0 93 MAX_SAMPLES_ANGLE 0x8D57
michael@0 94
michael@0 95 Additions to Chapter 2 of the OpenGL ES 2.0 Specification (OpenGL Operation)
michael@0 96
michael@0 97 Additions to Chapter 3 of the OpenGL ES 2.0 Specification (Rasterization)
michael@0 98
michael@0 99 Add to the last paragraph of 3.7.2 (Alternate Texture Image Specification)
michael@0 100 (as modified by ANGLE_framebuffer_blit) the following:
michael@0 101
michael@0 102 "Calling CopyTexSubImage3DOES, CopyTexImage2D or CopyTexSubImage2D will
michael@0 103 result in INVALID_OPERATION being generated if the object bound to
michael@0 104 READ_FRAMEBUFFER_BINDING_ANGLE is "framebuffer complete" and the value
michael@0 105 of SAMPLE_BUFFERS is greater than zero."
michael@0 106
michael@0 107 Additions to Chapter 4 of the OpenGL ES 2.0 Specification (Per-Fragment
michael@0 108 Operations and the Framebuffer)
michael@0 109
michael@0 110 Add to 4.3.1 (Reading Pixels), right before the subsection titled
michael@0 111 "Obtaining Pixels from the Framebuffer":
michael@0 112
michael@0 113 "ReadPixels generates INVALID_OPERATION if READ_FRAMEBUFFER_BINDING_ANGLE
michael@0 114 (section 4.4) is non-zero, the read framebuffer is framebuffer
michael@0 115 complete, and the value of SAMPLE_BUFFERS for the read framebuffer
michael@0 116 is greater than zero."
michael@0 117
michael@0 118 In 4.3.2 (Copying Pixels), add to the section describing BlitFramebuffer
michael@0 119 that was added by ANGLE_framebuffer_blit.
michael@0 120
michael@0 121 "If SAMPLE_BUFFERS for the read framebuffer is greater than zero and
michael@0 122 SAMPLE_BUFFERS for the draw framebuffer is zero, the samples
michael@0 123 corresponding to each pixel location in the source are converted to
michael@0 124 a single sample before being written to the destination.
michael@0 125
michael@0 126 If SAMPLE_BUFFERS for the draw framebuffer is greater than zero,
michael@0 127 no copy is performed and an INVALID_OPERATION error is generated.
michael@0 128
michael@0 129 If SAMPLE_BUFFERS for the read framebuffer is greater than zero and
michael@0 130 <mask> includes DEPTH_BUFFER_BIT or STENCIL_BUFFER_BIT, no copy is
michael@0 131 performed and an INVALID_OPERATION error is generated.
michael@0 132
michael@0 133 If SAMPLE_BUFFERS for the read framebuffer is greater than zero and
michael@0 134 the format of the read and draw framebuffers are not identical, no
michael@0 135 copy is performed and an INVALID_OPERATION error is generated.
michael@0 136
michael@0 137 If SAMPLE_BUFFERS for the read framebuffer is greater than zero, the
michael@0 138 dimensions of the source and destination rectangles provided to
michael@0 139 BlitFramebufferANGLE must be identical and must specify the complete
michael@0 140 source and destination buffers, otherwise no copy is performed and
michael@0 141 an INVALID_OPERATION error is generated."
michael@0 142
michael@0 143 Modification to 4.4.3 (Renderbuffer Objects)
michael@0 144
michael@0 145 Add, just above the definition of RenderbufferStorage:
michael@0 146
michael@0 147 "The command
michael@0 148
michael@0 149 void RenderbufferStorageMultisampleANGLE(
michael@0 150 enum target, sizei samples,
michael@0 151 enum internalformat,
michael@0 152 sizei width, sizei height);
michael@0 153
michael@0 154 establishes the data storage, format, dimensions, and number of
michael@0 155 samples of a renderbuffer object's image. <target> must be
michael@0 156 RENDERBUFFER. <internalformat> must be one of the color-renderable,
michael@0 157 depth-renderable, or stencil-renderable formats described in table 4.5.
michael@0 158 <width> and <height> are the dimensions in pixels of the renderbuffer. If
michael@0 159 either <width> or <height> is greater than the value of
michael@0 160 MAX_RENDERBUFFER_SIZE, or if <samples> is greater than MAX_SAMPLES_ANGLE,
michael@0 161 then the error INVALID_VALUE is generated. If OpenGL ES is unable to
michael@0 162 create a data store of the requested size, the error OUT_OF_MEMORY
michael@0 163 is generated.
michael@0 164
michael@0 165 Upon success, RenderbufferStorageMultisampleANGLE deletes any existing
michael@0 166 data store for the renderbuffer image and the contents of the data
michael@0 167 store after calling RenderbufferStorageMultisampleANGLE are undefined.
michael@0 168 RENDERBUFFER_WIDTH is set to <width>, RENDERBUFFER_HEIGHT is
michael@0 169 set to <height>, and RENDERBUFFER_INTERNAL_FORMAT is set to
michael@0 170 <internalformat>.
michael@0 171
michael@0 172 If <samples> is zero, then RENDERBUFFER_SAMPLES_ANGLE is set to zero.
michael@0 173 Otherwise <samples> represents a request for a desired minimum
michael@0 174 number of samples. Since different implementations may support
michael@0 175 different sample counts for multisampled rendering, the actual
michael@0 176 number of samples allocated for the renderbuffer image is
michael@0 177 implementation dependent. However, the resulting value for
michael@0 178 RENDERBUFFER_SAMPLES_ANGLE is guaranteed to be greater than or equal
michael@0 179 to <samples> and no more than the next larger sample count supported
michael@0 180 by the implementation.
michael@0 181
michael@0 182 An OpenGL ES implementation may vary its allocation of internal component
michael@0 183 resolution based on any RenderbufferStorageMultisampleANGLE parameter (except
michael@0 184 target), but the allocation and chosen internal format must not be a
michael@0 185 function of any other state and cannot be changed once they are
michael@0 186 established. The actual resolution in bits of each component of the
michael@0 187 allocated image can be queried with GetRenderbufferParameteriv."
michael@0 188
michael@0 189 Modify the definiton of RenderbufferStorage as follows:
michael@0 190
michael@0 191 "The command
michael@0 192
michael@0 193 void RenderbufferStorage(enum target, enum internalformat,
michael@0 194 sizei width, sizei height);
michael@0 195
michael@0 196 is equivalent to calling RenderbufferStorageMultisampleANGLE with
michael@0 197 <samples> equal to zero."
michael@0 198
michael@0 199 In section 4.4.5 (Framebuffer Completeness) in the subsection
michael@0 200 titled "Framebuffer Completeness" add an entry to the bullet list:
michael@0 201
michael@0 202 * The value of RENDERBUFFER_SAMPLES_ANGLE is the same for all attached
michael@0 203 images.
michael@0 204 { FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE }
michael@0 205
michael@0 206 Also add a paragraph to the end of the section after the definition
michael@0 207 of CheckFramebufferStatus:
michael@0 208
michael@0 209 "The values of SAMPLE_BUFFERS and SAMPLES are derived from the
michael@0 210 attachments of the currently bound framebuffer object. If the
michael@0 211 current DRAW_FRAMEBUFFER_BINDING_ANGLE is not "framebuffer complete",
michael@0 212 then both SAMPLE_BUFFERS and SAMPLES are undefined. Otherwise,
michael@0 213 SAMPLES is equal to the value of RENDERBUFFER_SAMPLES_ANGLE for the
michael@0 214 attached images (which all must have the same value for
michael@0 215 RENDERBUFFER_SAMPLES_ANGLE). Further, SAMPLE_BUFFERS is one if
michael@0 216 SAMPLES is non-zero. Otherwise, SAMPLE_BUFFERS is zero.
michael@0 217
michael@0 218 Additions to Chapter 5 of the OpenGL ES 2.0 Specification (Special Functions)
michael@0 219
michael@0 220
michael@0 221 Additions to Chapter 6 of the OpenGL ES 2.0 Specification (State and State
michael@0 222 Requests)
michael@0 223
michael@0 224 In section 6.1.3 (Enumeraged Queries), modify the third paragraph
michael@0 225 of the description of GetRenderbufferParameteriv as follows:
michael@0 226
michael@0 227 "Upon successful return from GetRenderbufferParameteriv, if
michael@0 228 <pname> is RENDERBUFFER_WIDTH, RENDERBUFFER_HEIGHT,
michael@0 229 RENDERBUFFER_INTERNAL_FORMAT, or RENDERBUFFER_SAMPLES_ANGLE, then <params>
michael@0 230 will contain the width in pixels, height in pixels, internal format, or
michael@0 231 number of samples, respectively, of the image of the renderbuffer
michael@0 232 currently bound to <target>."
michael@0 233
michael@0 234
michael@0 235 Dependencies on ANGLE_framebuffer_blit
michael@0 236
michael@0 237 ANGLE_framebuffer_blit is required. Technically, ANGLE_framebuffer_blit
michael@0 238 would not be required to support multisampled rendering, except for
michael@0 239 the fact that it provides the only method of doing a multisample
michael@0 240 resovle from a multisample renderbuffer.
michael@0 241
michael@0 242 Dependencies on OES_texture_3D
michael@0 243
michael@0 244 On an OpenGL ES implementation, in the absense of OES_texture_3D,
michael@0 245 omit references to CopyTexSubImage3DOES.
michael@0 246
michael@0 247 Errors
michael@0 248
michael@0 249 The error INVALID_OPERATION is generated if ReadPixels or
michael@0 250 CopyTex{Sub}Image* is called while READ_FRAMEBUFFER_BINDING_ANGLE
michael@0 251 is non-zero, the read framebuffer is framebuffer complete, and the
michael@0 252 value of SAMPLE_BUFFERS for the read framebuffer is greater than
michael@0 253 zero.
michael@0 254
michael@0 255 If both the draw and read framebuffers are framebuffer complete and
michael@0 256 the draw framebuffer has a value of SAMPLE_BUFFERS that is greater
michael@0 257 than zero, then the error INVALID_OPERATION is generated if
michael@0 258 BlitFramebufferANGLE is called.
michael@0 259
michael@0 260 If both the draw and read framebuffers are framebuffer complete and
michael@0 261 the read framebuffer has a value of SAMPLE_BUFFERS that is greater
michael@0 262 than zero, the error INVALID_OPERATION is generated if
michael@0 263 BlitFramebufferANGLE is called and any of the following conditions
michael@0 264 are true:
michael@0 265 - <mask> includes DEPTH_BUFFER_BIT or STENCIL_BUFFER_BIT.
michael@0 266 - the source or destination rectangles do not specify the entire
michael@0 267 source or destination buffer.
michael@0 268
michael@0 269 If both the draw and read framebuffers are framebuffer complete and
michael@0 270 either has a value of SAMPLE_BUFFERS that is greater than zero, then
michael@0 271 the error INVALID_OPERATION is generated if BlitFramebufferANGLE is
michael@0 272 called and the formats of the draw and read framebuffers are not
michael@0 273 identical.
michael@0 274
michael@0 275 If either the draw or read framebuffer is framebuffer complete and
michael@0 276 has a value of SAMPLE_BUFFERS that is greater than zero, then the
michael@0 277 error INVALID_OPERATION is generated if BlitFramebufferANGLE is called
michael@0 278 and the specified source and destination dimensions are not
michael@0 279 identical.
michael@0 280
michael@0 281 If RenderbufferStorageMultisampleANGLE is called with <target> not
michael@0 282 equal to RENDERBUFFER, the error INVALID_ENUM is generated.
michael@0 283
michael@0 284 If RenderbufferStorageMultisampleANGLE is called with an
michael@0 285 <internalformat> that is not listed as one of the color-, depth-
michael@0 286 or stencil-renderable formats in Table 4.5, then the error
michael@0 287 INVALID_ENUM is generated.
michael@0 288
michael@0 289 If RenderbufferStorageMultisampleANGLE is called with <width> or
michael@0 290 <height> greater than MAX_RENDERBUFFER_SIZE, then the error
michael@0 291 INVALID_VALUE is generated.
michael@0 292
michael@0 293 If RenderbufferStorageMultisampleANGLE is called with a value of
michael@0 294 <samples> that is greater than MAX_SAMPLES_ANGLE or less than zero,
michael@0 295 then the error INVALID_VALUE is generated.
michael@0 296
michael@0 297 The error OUT_OF_MEMORY is generated when
michael@0 298 RenderbufferStorageMultisampleANGLE cannot create storage of the
michael@0 299 specified size.
michael@0 300
michael@0 301 New State
michael@0 302
michael@0 303 Add to table 6.22 (Renderbuffer State)
michael@0 304
michael@0 305 Get Value Type Get Command Initial Value Description Section
michael@0 306 ------------------------------- ------ -------------------------- ------------- -------------------- -------
michael@0 307 RENDERBUFFER_SAMPLES_ANGLE Z+ GetRenderbufferParameteriv 0 number of samples 4.4.3
michael@0 308
michael@0 309
michael@0 310 Add to table 6.yy (Framebuffer Dependent Vaues) (added by
michael@0 311 ANGLE_framebuffer_blit), the following new framebuffer dependent state.
michael@0 312
michael@0 313 Get Value Type Get Command Minimum Value Description Section
michael@0 314 ----------------- ---- ----------- ------------- ------------------- -------
michael@0 315 MAX_SAMPLES_ANGLE Z+ GetIntegerv 1 Maximum number of 4.4.3
michael@0 316 samples supported
michael@0 317 for multisampling
michael@0 318
michael@0 319
michael@0 320
michael@0 321 Issues
michael@0 322
michael@0 323 Issues from EXT_framebuffer_multisample have been removed.
michael@0 324
michael@0 325 1) What should we call this extension?
michael@0 326
michael@0 327 Resolved: ANGLE_framebuffer_blit.
michael@0 328
michael@0 329 This extension is a result of a collaboration between Google and
michael@0 330 TransGaming for the open-source ANGLE project. Typically one would
michael@0 331 label a multi-vendor extension as EXT, but EXT_framebuffer_mulitsample
michael@0 332 is already the name for this on Desktop GL. Additionally this
michael@0 333 isn't truely a multi-vendor extension because there is only one
michael@0 334 implementation of this. We'll follow the example of the open-source
michael@0 335 MESA project which uses the project name for the vendor suffix.
michael@0 336
michael@0 337 2) How does this extension differ from EXT_framebuffer_multisample?
michael@0 338
michael@0 339 This is designed to be a proper subset of EXT_framebuffer_multisample
michael@0 340 functionality as applicable to OpenGL ES 2.0.
michael@0 341
michael@0 342 Functionality that is unchanged:
michael@0 343 - creation of multisample renderbuffers.
michael@0 344 - whole buffer multi-sample->single-sample resolve.
michael@0 345 - no format conversions, stretching or flipping supported on multisample blits.
michael@0 346
michael@0 347 Additional restrictions on BlitFramebufferANGLE:
michael@0 348 - multisample resolve is only supported on color buffers.
michael@0 349 - no blits to multisample destinations (no single->multi or multi-multi).
michael@0 350 - only entire buffers can be resolved.
michael@0 351
michael@0 352 Revision History
michael@0 353
michael@0 354 Revision 1, 2010/07/08
michael@0 355 - copied from revision 7 of EXT_framebuffer_multisample
michael@0 356 - removed language that was not relevant to ES2
michael@0 357 - rebase changes against the Open GL ES 2.0 specification
michael@0 358 - added ANGLE-specific restrictions
michael@0 359 Revision 2, 2010/07/19
michael@0 360 - fix missing error code
michael@0 361 Revision 3, 2010/08/06
michael@0 362 - add additional contributors, update implementation status
michael@0 363 - disallow negative samples

mercurial