Path: blob/main_old/extensions/ANGLE_framebuffer_blit.txt
1693 views
Name12ANGLE_framebuffer_blit34Name Strings56GL_ANGLE_framebuffer_blit78Contributors910Contributors to EXT_framebuffer_blit11Daniel Koch, TransGaming Inc.12Shannon Woods, TransGaming Inc.13Kenneth Russell, Google Inc.14Vangelis Kokkevis, Google Inc.1516Contact1718Daniel Koch, TransGaming Inc. (daniel 'at' transgaming 'dot' com)1920Status2122Implemented in ANGLE ES22324Version2526Last Modified Date: Sept 22, 201227Author Revision: 42829Number3031OpenGL ES Extension #833233Dependencies3435OpenGL ES 2.0 is required.3637The extension is written against the OpenGL ES 2.0 specification.3839OES_texture_3D affects the definition of this extension.4041Overview4243This extension modifies framebuffer objects by splitting the44framebuffer object binding point into separate DRAW and READ45bindings. This allows copying directly from one framebuffer to46another. In addition, a new high performance blit function is47added to facilitate these blits and perform some data conversion48where allowed.4950IP Status5152No known IP claims.5354New Procedures and Functions5556void BlitFramebufferANGLE(int srcX0, int srcY0, int srcX1, int srcY1,57int dstX0, int dstY0, int dstX1, int dstY1,58bitfield mask, enum filter);5960New Tokens6162Accepted by the <target> parameter of BindFramebuffer,63CheckFramebufferStatus, FramebufferTexture2D, FramebufferTexture3DOES,64FramebufferRenderbuffer, and65GetFramebufferAttachmentParameteriv:6667// (reusing the tokens from EXT_framebuffer_blit)68READ_FRAMEBUFFER_ANGLE 0x8CA869DRAW_FRAMEBUFFER_ANGLE 0x8CA97071Accepted by the <pname> parameters of GetIntegerv and GetFloatv:7273// (reusing the tokens from EXT_framebuffer_blit)74DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6 // alias FRAMEBUFFER_BINDING75READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA767778Additions to Chapter 3 of the OpenGL ES 2.0 Specification (Rasterization)7980Change the last paragraph of section 3.7.2 (Alternate Texture Image81Specification Commands) to:8283"Calling CopyTexSubImage3DOES, CopyTexImage2D or CopyTexSubImage2D will84result in an INVALID_FRAMEBUFFER_OPERATION error if the object bound85to READ_FRAMEBUFFER_BINDING_ANGLE is not "framebuffer complete"86(section 4.4.4.2)."8788Additions to Chapter 4 of the OpenGL ES 2.0 Specification (Per-Fragment89Operations and the Framebuffer)9091Change the first word of Chapter 4 from "The" to "A".9293Append to the introduction of Chapter 4:9495"Conceptually, the GL has two active framebuffers; the draw96framebuffer is the destination for rendering operations, and the97read framebuffer is the source for readback operations. The same98framebuffer may be used for both drawing and reading. Section994.4.1 describes the mechanism for controlling framebuffer usage."100101Modify the first sentence of the last paragraph of section 4.1.1 as follows:102103"While an application-created framebuffer object is bound to104DRAW_FRAMEBUFFER_ANGLE, the pixel ownership test always passes."105106Add to 4.3.1 (Reading Pixels), right before the subsection titled107"Obtaining Pixels from the Framebuffer":108109"Calling ReadPixels generates INVALID_FRAMEBUFFER_OPERATION if110the object bound to READ_FRAMEBUFFER_BINDING_ANGLE is not "framebuffer111complete" (section 4.4.4.2). GetIntegerv generates an INVALID_OPERATION112error if the object bound to READ_FRAMEBUFFER_BINDING_ANGLE is not113framebuffer complete, or if the GL is using a framebuffer object114(i.e. READ_FRAMEBUFFER_BINDING_ANGLE is non-zero) and there is no color115attachment."116117Insert a new section 4.3.2 titled "Copying Pixels" and renumber the118subsequent sections. Add the following text:119120"BlitFramebufferANGLE transfers a rectangle of pixel values from one121region of the read framebuffer to another in the draw framebuffer.122123BlitFramebufferANGLE(int srcX0, int srcY0, int srcX1, int srcY1,124int dstX0, int dstY0, int dstX1, int dstY1,125bitfield mask, enum filter);126127<mask> is the bitwise OR of a number of values indicating which128buffers are to be copied. The values are COLOR_BUFFER_BIT,129DEPTH_BUFFER_BIT, and STENCIL_BUFFER_BIT, which are described in130section 4.2.3. The pixels corresponding to these buffers are131copied from the source rectangle, bound by the locations (srcX0,132srcY0) and (srcX1, srcY1), to the destination rectangle, bound by133the locations (dstX0, dstY0) and (dstX1, dstY1). The lower bounds134of the rectangle are inclusive, while the upper bounds are135exclusive.136137The actual region taken from the read framebuffer is limited to the138intersection of the source buffers being transferred, which may include139the color buffer, the depth buffer, and/or the stencil buffer depending on140<mask>. The actual region written to the draw framebuffer is limited to the141intersection of the destination buffers being written, which may include142the color buffer, the depth buffer, and/or the stencil buffer143depending on <mask>. Whether or not the source or destination regions are144altered due to these limits, the offset applied to pixels being transferred145is performed as though no such limits were present.146147Stretching and scaling during a copy are not supported. If the source148and destination rectangle dimensions do not match, no copy is149performed and an INVALID_OPERATION error is generated.150Because stretching is not supported, <filter> must be NEAREST and151no filtering is applied.152153Flipping during a copy is not supported. If either the source or154destination rectangle specifies a negative dimension, the error155INVALID_OPERATION is generated. If both the source and156destination rectangles specify a negative dimension for the same157direction, no reversal is required and the operation is supported.158159If the source and destination buffers are identical, and the160source and destination rectangles overlap, the result of the blit161operation is undefined.162163The pixel copy bypasses the fragment pipeline. The only fragment164operations which affect the blit are the pixel ownership test and165the scissor test.166167If a buffer is specified in <mask> and does not exist in both the168read and draw framebuffers, the corresponding bit is silently169ignored.170171Calling BlitFramebufferANGLE will result in an172INVALID_FRAMEBUFFER_OPERATION error if the objects bound to173DRAW_FRAMEBUFFER_BINDING_ANGLE and READ_FRAMEBUFFER_BINDING_ANGLE are174not "framebuffer complete" (section 4.4.4.2)."175176Calling BlitFramebufferANGLE will result in an INVALID_OPERATION177error if <mask> includes COLOR_BUFFER_BIT and the source and178destination color formats to not match.179180Calling BlitFramebufferANGLE will result in an INVALID_OPERATION181error if <mask> includes DEPTH_BUFFER_BIT or STENCIL_BUFFER_BIT182and the source and destination depth and stencil buffer formats do183not match.184185If <mask> includes DEPTH_BUFFER_BIT or STENCIL_BUFFER_BIT, only186complete buffers can be copied. If the source rectangle does not187specify the complete source buffer or the destination rectangle188(after factoring the scissor region, if applicable) does not specify189the complete destination buffer, an INVALID_OPERATION190error is generated.191192Modify the beginning of section 4.4.1 as follows:193194"The default framebuffer for rendering and readback operations is195provided by the windowing system. In addition, named framebuffer196objects can be created and operated upon. The namespace for197framebuffer objects is the unsigned integers, with zero reserved198by the GL for the default framebuffer.199200A framebuffer object is created by binding an unused name to201DRAW_FRAMEBUFFER_ANGLE or READ_FRAMEBUFFER_ANGLE. The binding is202effected by calling203204void BindFramebuffer(enum target, uint framebuffer);205206with <target> set to the desired framebuffer target and207<framebuffer> set to the unused name. The resulting framebuffer208object is a new state vector, comprising one set of the state values209listed in table 6.23 for each attachment point of the210framebuffer, set to the same initial values. There is one211color attachment point, plus one each212for the depth and stencil attachment points.213214BindFramebuffer may also be used to bind an existing215framebuffer object to DRAW_FRAMEBUFFER_ANGLE or216READ_FRAMEBUFFER_ANGLE. If the bind is successful no change is made217to the state of the bound framebuffer object, and any previous218binding to <target> is broken.219220If a framebuffer object is bound to DRAW_FRAMEBUFFER_ANGLE or221READ_FRAMEBUFFER_ANGLE, it becomes the target for rendering or222readback operations, respectively, until it is deleted or another223framebuffer is bound to the corresponding bind point. Calling224BindFramebuffer with <target> set to FRAMEBUFFER binds the225framebuffer to both DRAW_FRAMEBUFFER_ANGLE and READ_FRAMEBUFFER_ANGLE.226227While a framebuffer object is bound, GL operations on the target228to which it is bound affect the images attached to the bound229framebuffer object, and queries of the target to which it is bound230return state from the bound object. Queries of the values231specified in table 6.20 (Implementation Dependent Pixel Depths)232and table 6.yy (Framebuffer Dependent Values) are233derived from the framebuffer object bound to DRAW_FRAMEBUFFER_ANGLE.234235The initial state of DRAW_FRAMEBUFFER_ANGLE and READ_FRAMEBUFFER_ANGLE236refers to the default framebuffer provided by the windowing237system. In order that access to the default framebuffer is not238lost, it is treated as a framebuffer object with the name of 0.239The default framebuffer is therefore rendered to and read from240while 0 is bound to the corresponding targets. On some241implementations, the properties of the default framebuffer can242change over time (e.g., in response to windowing system events243such as attaching the context to a new windowing system drawable.)"244245Change the description of DeleteFramebuffers as follows:246247"<framebuffers> contains <n> names of framebuffer objects to be248deleted. After a framebuffer object is deleted, it has no249attachments, and its name is again unused. If a framebuffer that250is currently bound to one or more of the targets251DRAW_FRAMEBUFFER_ANGLE or READ_FRAMEBUFFER_ANGLE is deleted, it is as252though BindFramebuffer had been executed with the corresponding253<target> and <framebuffer> zero. Unused names in <framebuffers>254are silently ignored, as is the value zero."255256257In section 4.4.3 (Renderbuffer Objects), modify the first two sentences258of the description of FramebufferRenderbuffer as follows:259260"<target> must be DRAW_FRAMEBUFFER_ANGLE, READ_FRAMEBUFFER_ANGLE, or261FRAMEBUFFER. If <target> is FRAMEBUFFER, it behaves as262though DRAW_FRAMEBUFFER_ANGLE was specified. The INVALID_OPERATION263error is generated if the value of the corresponding binding is zero."264265In section 4.4.3 (Renderbuffer Objects), modify the first two sentences266of the description of FramebufferTexture2D as follows:267268"<target> must be DRAW_FRAMEBUFFER_ANGLE,269READ_FRAMEBUFFER_ANGLE, or FRAMEBUFFER. If <target> is270FRAMEBUFFER, it behaves as though DRAW_FRAMEBUFFER_ANGLE was271specified. The INVALID_OPERATION error is generated if the value of the272corresponding binding is zero."273274In section 4.4.5 (Framebuffer Completeness), modify the first sentence275of the description of CheckFramebufferStatus as follows:276277"If <target> is not DRAW_FRAMEBUFFER_ANGLE, READ_FRAMEBUFFER_ANGLE or278FRAMEBUFFER, the error INVALID_ENUM is generated. If <target> is279FRAMEBUFFER, it behaves as though DRAW_FRAMEBUFFER_ANGLE was280specified."281282Modify the first sentence of the subsection titled "Effects of Framebuffer283Completeness on Framebuffer Operations" to be:284285"Attempting to render to or read from a framebuffer which is not286framebuffer complete will generate an287INVALID_FRAMEBUFFER_OPERATION error."288289290291Additions to Chapter 6 of the OpenGL 1.5 Specification (State and State292Requests)293294In section 6.1.3, modify the first sentence of the description of295GetFramebufferAttachmentParameteriv as follows:296297"<target> must be DRAW_FRAMEBUFFER_ANGLE, READ_FRAMEBUFFER_ANGLE or298FRAMEBUFFER. If <target> is FRAMEBUFFER, it behaves as299though DRAW_FRAMEBUFFER_ANGLE was specified."300301Modify the title of Table 6.23 (Framebuffer State) to be "Framebuffer302(state per attachment point)".303304305Dependencies on OES_texture_3D306307On an OpenGL ES implementation, in the absense of OES_texture_3D,308omit references to FramebufferTexture3DOES and CopyTexSubImage3DOES.309310Errors311312The error INVALID_FRAMEBUFFER_OPERATION is generated if313BlitFramebufferANGLE is called while the314draw framebuffer is not framebuffer complete.315316The error INVALID_FRAMEBUFFER_OPERATION is generated if317BlitFramebufferANGLE, ReadPixels, CopyTex{Sub}Image*, is called while the318read framebuffer is not framebuffer complete.319320The error INVALID_OPERATION is generated if GetIntegerv is called321while the read framebuffer is not framebuffer complete, or if there322is no color attachment present on the read framebuffer object.323324The error INVALID_VALUE is generated by BlitFramebufferANGLE if325<mask> has any bits set other than those named by326COLOR_BUFFER_BIT, DEPTH_BUFFER_BIT or STENCIL_BUFFER_BIT.327328The error INVALID_OPERATION is generated if BlitFramebufferANGLE is329called and <mask> includes DEPTH_BUFFER_BIT or STENCIL_BUFFER_BIT330and the source and destination depth or stencil buffer formats do331not match.332333The error INVALID_OPERATION is generated if BlitFramebufferANGLE is334called and any of the following conditions are true:335- the source and destination rectangle dimensions do not match336(ie scaling or flipping is required).337- <mask> includes COLOR_BUFFER_BIT and the source and destination338buffer formats do not match.339- <mask> includes DEPTH_BUFFER_BIT or STENCIL_BUFFER_BIT and the340source or destination rectangles do not specify the entire source341or destination buffer (after applying any scissor region).342343The error INVALID_ENUM is generated by BlitFramebufferANGLE if344<filter> is not NEAREST.345346The error INVALID_ENUM is generated if BindFramebuffer,347CheckFramebufferStatus, FramebufferTexture{2D|3DOES},348FramebufferRenderbuffer, or349GetFramebufferAttachmentParameteriv is called and <target> is350not DRAW_FRAMEBUFFER_ANGLE, READ_FRAMEBUFFER_ANGLE or FRAMEBUFFER.351352New State353354(Add a new table 6.xx, "Framebuffer (state per framebuffer target binding point)")355356Get Value Type Get Command Initial Value Description Section357------------------------------ ---- ----------- -------------- ------------------- ------------358DRAW_FRAMEBUFFER_BINDING_ANGLE Z+ GetIntegerv 0 framebuffer object bound 4.4.1359to DRAW_FRAMEBUFFER_ANGLE360READ_FRAMEBUFFER_BINDING_ANGLE Z+ GetIntegerv 0 framebuffer object 4.4.1361to READ_FRAMEBUFFER_ANGLE362363Remove reference to FRAMEBUFFER_BINDING from Table 6.23.364365(Add a new table 6.yy, "Framebuffer Dependent Values")366367Get Value Type Get Command Initial Value Description Section368---------------------------- ---- ----------- -------------- ------------------- ------------369SAMPLE_BUFFERS Z+ GetIntegerv 0 Number of multisample 3.2370buffers371SAMPLES Z+ GetIntegerv 0 Coverage mask size 3.2372373Remove the references to SAMPLE_BUFFERS and SAMPLES from Table 6.17.374375376Issues3773781) What should we call this extension?379380Resolved: ANGLE_framebuffer_blit.381382This extension is a result of a collaboration between Google and383TransGaming for the open-source ANGLE project. Typically one would384label a multi-vendor extension as EXT, but EXT_framebuffer_blit385is already the name for this on Desktop GL. Additionally this386isn't truely a multi-vendor extension because there is only one387implementation of this. We'll follow the example of the open-source388MESA project which uses the project name for the vendor suffix.3893902) Why is this done as a separate extension instead of just supporting391EXT_framebuffer_blit?392393To date, EXT_framebuffer_blit has not had interactions with OpenGL ES394specified and, as far as we know, it has not previously been exposed on395an ES 1.1 or ES 2.0 implementation. Because there are enough396differences between Desktop GL and OpenGL ES, and since OpenGL ES 2.0397has already subsumed the EXT_framebuffer_object functionality (with398some changes) it was deemed a worthwhile exercise to fully specify the399interactions. Additionally, some of the choices in exactly which400functionality is supported by BlitFramebufferANGLE is dictated by401what is reasonable to support on a implementation which is402layered on Direct3D9. It is not expected that other implementations403will necessary have the same set of restrictions or requirements.4044053) How does this extension differ from EXT_framebuffer_blit?406407This extension is designed to be a pure subset of the408EXT_framebuffer_blit functionality as applicable to OpenGL ES 2.0.409410Functionality that is unchanged:411- the split DRAW and READ framebuffer attachment points and related sematics.412- the token values for the DRAW/READ_FRAMEBUFFER and DRAW/READ_FRAMBUFFER_BINDING413- the signature of the BlitFramebuffer entry-point.414415Additional restrictions imposed by BlitFramebufferANGLE:416- no color conversions are supported417- no scaling, stretching or flipping are supported418- no filtering is supported (a consequence of no stretching)419- only whole depth and/or stencil buffers can be copied420421Revision History422423Revision 1, 2010/07/06424- copied from revision 15 of EXT_framebuffer_object425- removed language that was clearly not relevant to ES2426- rebased changes against the OpenGL ES 2.0 specification427- added ANGLE-specific restrictions428Revision 2, 2010/07/15429- clarifications of implicit clamping to buffer sizes (from ARB_fbo)430- clarify that D/S restricts apply after the scissor is applied431- improve some error language432Revision 3, 2010/08/06433- add additional contributors, update implementation status434Revision 4, 2012/09/22435- document errors for GetIntegerv.436437438439