Path: blob/main_old/extensions/ANGLE_framebuffer_multisample.txt
1693 views
Name12ANGLE_framebuffer_multisample34Name Strings56GL_ANGLE_framebuffer_multisample78Contributors910Contributors to EXT_framebuffer_multisample11Daniel Koch, TransGaming Inc.12Shannon Woods, TransGaming Inc.13Kenneth Russell, Google Inc.14Vangelis Kokkevis, Google Inc.1516Contacts1718Daniel Koch, TransGaming Inc. (daniel 'at' transgaming 'dot' com)1920Status2122Implemented in ANGLE ES22324Version2526Last Modified Date: Aug 6, 201027Author Revision: #32829Number3031OpenGL ES Extension #843233Dependencies3435Requires OpenGL ES 2.0.3637Requires GL_ANGLE_framebuffer_blit (or equivalent functionality).3839The extension is written against the OpenGL ES 2.0 specification.4041OES_texture_3D affects the definition of this extension.4243Overview4445This extension extends the framebuffer object framework to46enable multisample rendering.4748The new operation RenderbufferStorageMultisampleANGLE() allocates49storage for a renderbuffer object that can be used as a multisample50buffer. A multisample render buffer image differs from a51single-sample render buffer image in that a multisample image has a52number of SAMPLES that is greater than zero. No method is provided53for creating multisample texture images.5455All of the framebuffer-attachable images attached to a framebuffer56object must have the same number of SAMPLES or else the framebuffer57object is not "framebuffer complete". If a framebuffer object with58multisample attachments is "framebuffer complete", then the59framebuffer object behaves as if SAMPLE_BUFFERS is one.6061The resolve operation is affected by calling62BlitFramebufferANGLE (provided by the ANGLE_framebuffer_blit63extension) where the source is a multisample application-created64framebuffer object and the destination is a single-sample65framebuffer object (either application-created or window-system66provided).6768New Procedures and Functions6970void RenderbufferStorageMultisampleANGLE(71enum target, sizei samples,72enum internalformat,73sizei width, sizei height);7475New Types7677None.7879New Tokens8081Accepted by the <pname> parameter of GetRenderbufferParameteriv:8283RENDERBUFFER_SAMPLES_ANGLE 0x8CAB8485Returned by CheckFramebufferStatus:8687FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D568889Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,90and GetFloatv:9192MAX_SAMPLES_ANGLE 0x8D579394Additions to Chapter 2 of the OpenGL ES 2.0 Specification (OpenGL Operation)9596Additions to Chapter 3 of the OpenGL ES 2.0 Specification (Rasterization)9798Add to the last paragraph of 3.7.2 (Alternate Texture Image Specification)99(as modified by ANGLE_framebuffer_blit) the following:100101"Calling CopyTexSubImage3DOES, CopyTexImage2D or CopyTexSubImage2D will102result in INVALID_OPERATION being generated if the object bound to103READ_FRAMEBUFFER_BINDING_ANGLE is "framebuffer complete" and the value104of SAMPLE_BUFFERS is greater than zero."105106Additions to Chapter 4 of the OpenGL ES 2.0 Specification (Per-Fragment107Operations and the Framebuffer)108109Add to 4.3.1 (Reading Pixels), right before the subsection titled110"Obtaining Pixels from the Framebuffer":111112"ReadPixels generates INVALID_OPERATION if READ_FRAMEBUFFER_BINDING_ANGLE113(section 4.4) is non-zero, the read framebuffer is framebuffer114complete, and the value of SAMPLE_BUFFERS for the read framebuffer115is greater than zero."116117In 4.3.2 (Copying Pixels), add to the section describing BlitFramebuffer118that was added by ANGLE_framebuffer_blit.119120"If SAMPLE_BUFFERS for the read framebuffer is greater than zero and121SAMPLE_BUFFERS for the draw framebuffer is zero, the samples122corresponding to each pixel location in the source are converted to123a single sample before being written to the destination.124125If SAMPLE_BUFFERS for the draw framebuffer is greater than zero,126no copy is performed and an INVALID_OPERATION error is generated.127128If SAMPLE_BUFFERS for the read framebuffer is greater than zero and129<mask> includes DEPTH_BUFFER_BIT or STENCIL_BUFFER_BIT, no copy is130performed and an INVALID_OPERATION error is generated.131132If SAMPLE_BUFFERS for the read framebuffer is greater than zero and133the format of the read and draw framebuffers are not identical, no134copy is performed and an INVALID_OPERATION error is generated.135136If SAMPLE_BUFFERS for the read framebuffer is greater than zero, the137dimensions of the source and destination rectangles provided to138BlitFramebufferANGLE must be identical and must specify the complete139source and destination buffers, otherwise no copy is performed and140an INVALID_OPERATION error is generated."141142Modification to 4.4.3 (Renderbuffer Objects)143144Add, just above the definition of RenderbufferStorage:145146"The command147148void RenderbufferStorageMultisampleANGLE(149enum target, sizei samples,150enum internalformat,151sizei width, sizei height);152153establishes the data storage, format, dimensions, and number of154samples of a renderbuffer object's image. <target> must be155RENDERBUFFER. <internalformat> must be one of the color-renderable,156depth-renderable, or stencil-renderable formats described in table 4.5.157<width> and <height> are the dimensions in pixels of the renderbuffer. If158either <width> or <height> is greater than the value of159MAX_RENDERBUFFER_SIZE, or if <samples> is greater than MAX_SAMPLES_ANGLE,160then the error INVALID_VALUE is generated. If OpenGL ES is unable to161create a data store of the requested size, the error OUT_OF_MEMORY162is generated.163164Upon success, RenderbufferStorageMultisampleANGLE deletes any existing165data store for the renderbuffer image and the contents of the data166store after calling RenderbufferStorageMultisampleANGLE are undefined.167RENDERBUFFER_WIDTH is set to <width>, RENDERBUFFER_HEIGHT is168set to <height>, and RENDERBUFFER_INTERNAL_FORMAT is set to169<internalformat>.170171If <samples> is zero, then RENDERBUFFER_SAMPLES_ANGLE is set to zero.172Otherwise <samples> represents a request for a desired minimum173number of samples. Since different implementations may support174different sample counts for multisampled rendering, the actual175number of samples allocated for the renderbuffer image is176implementation dependent. However, the resulting value for177RENDERBUFFER_SAMPLES_ANGLE is guaranteed to be greater than or equal178to <samples> and no more than the next larger sample count supported179by the implementation.180181An OpenGL ES implementation may vary its allocation of internal component182resolution based on any RenderbufferStorageMultisampleANGLE parameter (except183target), but the allocation and chosen internal format must not be a184function of any other state and cannot be changed once they are185established. The actual resolution in bits of each component of the186allocated image can be queried with GetRenderbufferParameteriv."187188Modify the definiton of RenderbufferStorage as follows:189190"The command191192void RenderbufferStorage(enum target, enum internalformat,193sizei width, sizei height);194195is equivalent to calling RenderbufferStorageMultisampleANGLE with196<samples> equal to zero."197198In section 4.4.5 (Framebuffer Completeness) in the subsection199titled "Framebuffer Completeness" add an entry to the bullet list:200201* The value of RENDERBUFFER_SAMPLES_ANGLE is the same for all attached202images.203{ FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE }204205Also add a paragraph to the end of the section after the definition206of CheckFramebufferStatus:207208"The values of SAMPLE_BUFFERS and SAMPLES are derived from the209attachments of the currently bound framebuffer object. If the210current DRAW_FRAMEBUFFER_BINDING_ANGLE is not "framebuffer complete",211then both SAMPLE_BUFFERS and SAMPLES are undefined. Otherwise,212SAMPLES is equal to the value of RENDERBUFFER_SAMPLES_ANGLE for the213attached images (which all must have the same value for214RENDERBUFFER_SAMPLES_ANGLE). Further, SAMPLE_BUFFERS is one if215SAMPLES is non-zero. Otherwise, SAMPLE_BUFFERS is zero.216217Additions to Chapter 5 of the OpenGL ES 2.0 Specification (Special Functions)218219220Additions to Chapter 6 of the OpenGL ES 2.0 Specification (State and State221Requests)222223In section 6.1.3 (Enumeraged Queries), modify the third paragraph224of the description of GetRenderbufferParameteriv as follows:225226"Upon successful return from GetRenderbufferParameteriv, if227<pname> is RENDERBUFFER_WIDTH, RENDERBUFFER_HEIGHT,228RENDERBUFFER_INTERNAL_FORMAT, or RENDERBUFFER_SAMPLES_ANGLE, then <params>229will contain the width in pixels, height in pixels, internal format, or230number of samples, respectively, of the image of the renderbuffer231currently bound to <target>."232233234Dependencies on ANGLE_framebuffer_blit235236ANGLE_framebuffer_blit is required. Technically, ANGLE_framebuffer_blit237would not be required to support multisampled rendering, except for238the fact that it provides the only method of doing a multisample239resovle from a multisample renderbuffer.240241Dependencies on OES_texture_3D242243On an OpenGL ES implementation, in the absense of OES_texture_3D,244omit references to CopyTexSubImage3DOES.245246Errors247248The error INVALID_OPERATION is generated if ReadPixels or249CopyTex{Sub}Image* is called while READ_FRAMEBUFFER_BINDING_ANGLE250is non-zero, the read framebuffer is framebuffer complete, and the251value of SAMPLE_BUFFERS for the read framebuffer is greater than252zero.253254If both the draw and read framebuffers are framebuffer complete and255the draw framebuffer has a value of SAMPLE_BUFFERS that is greater256than zero, then the error INVALID_OPERATION is generated if257BlitFramebufferANGLE is called.258259If both the draw and read framebuffers are framebuffer complete and260the read framebuffer has a value of SAMPLE_BUFFERS that is greater261than zero, the error INVALID_OPERATION is generated if262BlitFramebufferANGLE is called and any of the following conditions263are true:264- <mask> includes DEPTH_BUFFER_BIT or STENCIL_BUFFER_BIT.265- the source or destination rectangles do not specify the entire266source or destination buffer.267268If both the draw and read framebuffers are framebuffer complete and269either has a value of SAMPLE_BUFFERS that is greater than zero, then270the error INVALID_OPERATION is generated if BlitFramebufferANGLE is271called and the formats of the draw and read framebuffers are not272identical.273274If either the draw or read framebuffer is framebuffer complete and275has a value of SAMPLE_BUFFERS that is greater than zero, then the276error INVALID_OPERATION is generated if BlitFramebufferANGLE is called277and the specified source and destination dimensions are not278identical.279280If RenderbufferStorageMultisampleANGLE is called with <target> not281equal to RENDERBUFFER, the error INVALID_ENUM is generated.282283If RenderbufferStorageMultisampleANGLE is called with an284<internalformat> that is not listed as one of the color-, depth-285or stencil-renderable formats in Table 4.5, then the error286INVALID_ENUM is generated.287288If RenderbufferStorageMultisampleANGLE is called with <width> or289<height> greater than MAX_RENDERBUFFER_SIZE, then the error290INVALID_VALUE is generated.291292If RenderbufferStorageMultisampleANGLE is called with a value of293<samples> that is greater than MAX_SAMPLES_ANGLE or less than zero,294then the error INVALID_VALUE is generated.295296The error OUT_OF_MEMORY is generated when297RenderbufferStorageMultisampleANGLE cannot create storage of the298specified size.299300New State301302Add to table 6.22 (Renderbuffer State)303304Get Value Type Get Command Initial Value Description Section305------------------------------- ------ -------------------------- ------------- -------------------- -------306RENDERBUFFER_SAMPLES_ANGLE Z+ GetRenderbufferParameteriv 0 number of samples 4.4.3307308309Add to table 6.yy (Framebuffer Dependent Vaues) (added by310ANGLE_framebuffer_blit), the following new framebuffer dependent state.311312Get Value Type Get Command Minimum Value Description Section313----------------- ---- ----------- ------------- ------------------- -------314MAX_SAMPLES_ANGLE Z+ GetIntegerv 1 Maximum number of 4.4.3315samples supported316for multisampling317318319320Issues321322Issues from EXT_framebuffer_multisample have been removed.3233241) What should we call this extension?325326Resolved: ANGLE_framebuffer_blit.327328This extension is a result of a collaboration between Google and329TransGaming for the open-source ANGLE project. Typically one would330label a multi-vendor extension as EXT, but EXT_framebuffer_mulitsample331is already the name for this on Desktop GL. Additionally this332isn't truely a multi-vendor extension because there is only one333implementation of this. We'll follow the example of the open-source334MESA project which uses the project name for the vendor suffix.3353362) How does this extension differ from EXT_framebuffer_multisample?337338This is designed to be a proper subset of EXT_framebuffer_multisample339functionality as applicable to OpenGL ES 2.0.340341Functionality that is unchanged:342- creation of multisample renderbuffers.343- whole buffer multi-sample->single-sample resolve.344- no format conversions, stretching or flipping supported on multisample blits.345346Additional restrictions on BlitFramebufferANGLE:347- multisample resolve is only supported on color buffers.348- no blits to multisample destinations (no single->multi or multi-multi).349- only entire buffers can be resolved.350351Revision History352353Revision 1, 2010/07/08354- copied from revision 7 of EXT_framebuffer_multisample355- removed language that was not relevant to ES2356- rebase changes against the Open GL ES 2.0 specification357- added ANGLE-specific restrictions358Revision 2, 2010/07/19359- fix missing error code360Revision 3, 2010/08/06361- add additional contributors, update implementation status362- disallow negative samples363364365