102f4aeb0Sopenharmony_ciName 202f4aeb0Sopenharmony_ci 302f4aeb0Sopenharmony_ci NV_coverage_sample 402f4aeb0Sopenharmony_ci 502f4aeb0Sopenharmony_ciName Strings 602f4aeb0Sopenharmony_ci 702f4aeb0Sopenharmony_ci GL_NV_coverage_sample 802f4aeb0Sopenharmony_ci EGL_NV_coverage_sample 902f4aeb0Sopenharmony_ci 1002f4aeb0Sopenharmony_ciContact 1102f4aeb0Sopenharmony_ci 1202f4aeb0Sopenharmony_ci Gary King, NVIDIA Corporation (gking 'at' nvidia.com) 1302f4aeb0Sopenharmony_ci 1402f4aeb0Sopenharmony_ciNotice 1502f4aeb0Sopenharmony_ci 1602f4aeb0Sopenharmony_ci Copyright NVIDIA Corporation, 2005 - 2007 1702f4aeb0Sopenharmony_ci 1802f4aeb0Sopenharmony_ciStatus 1902f4aeb0Sopenharmony_ci 2002f4aeb0Sopenharmony_ci NVIDIA Proprietary 2102f4aeb0Sopenharmony_ci 2202f4aeb0Sopenharmony_ciVersion 2302f4aeb0Sopenharmony_ci 2402f4aeb0Sopenharmony_ci Last Modified Date: 2007/03/20 2502f4aeb0Sopenharmony_ci NVIDIA Revision: 1.0 2602f4aeb0Sopenharmony_ci 2702f4aeb0Sopenharmony_ciNumber 2802f4aeb0Sopenharmony_ci 2902f4aeb0Sopenharmony_ci EGL Extension #17 3002f4aeb0Sopenharmony_ci OpenGL ES Extension #72 3102f4aeb0Sopenharmony_ci 3202f4aeb0Sopenharmony_ciDependencies 3302f4aeb0Sopenharmony_ci 3402f4aeb0Sopenharmony_ci Written based on the wording of the OpenGL 2.0 specification 3502f4aeb0Sopenharmony_ci and the EXT_framebuffer_object specification. 3602f4aeb0Sopenharmony_ci 3702f4aeb0Sopenharmony_ci Written based on the wording of the EGL 1.2 specification. 3802f4aeb0Sopenharmony_ci 3902f4aeb0Sopenharmony_ci Requires OpenGL-ES 2.0 and OES_framebuffer_object. 4002f4aeb0Sopenharmony_ci 4102f4aeb0Sopenharmony_ci Requires EGL 1.1. 4202f4aeb0Sopenharmony_ci 4302f4aeb0Sopenharmony_ciOverview 4402f4aeb0Sopenharmony_ci 4502f4aeb0Sopenharmony_ci Anti-aliasing is a critical component for delivering high-quality 4602f4aeb0Sopenharmony_ci OpenGL rendering. Traditionally, OpenGL implementations have 4702f4aeb0Sopenharmony_ci implemented two anti-aliasing algorithms: edge anti-aliasing 4802f4aeb0Sopenharmony_ci and multisampling. 4902f4aeb0Sopenharmony_ci 5002f4aeb0Sopenharmony_ci Edge anti-aliasing computes fractional fragment coverage for all 5102f4aeb0Sopenharmony_ci primitives in a rendered frame, and blends edges of abutting 5202f4aeb0Sopenharmony_ci and/or overlapping primitives to produce smooth results. The 5302f4aeb0Sopenharmony_ci image quality produced by this approach is exceptionally high; 5402f4aeb0Sopenharmony_ci however, applications are render their geometry perfectly ordered 5502f4aeb0Sopenharmony_ci back-to-front in order to avoid artifacts such as bleed-through. 5602f4aeb0Sopenharmony_ci Given the algorithmic complexity and performance cost of performing 5702f4aeb0Sopenharmony_ci exact geometric sorts, edge anti-aliasing has been used very 5802f4aeb0Sopenharmony_ci sparingly, and almost never in interactive games. 5902f4aeb0Sopenharmony_ci 6002f4aeb0Sopenharmony_ci Multisampling, on the other hand, computes and stores subpixel 6102f4aeb0Sopenharmony_ci (a.k.a. "sample") coverage for rasterized fragments, and replicates 6202f4aeb0Sopenharmony_ci all post-alpha test operations (e.g., depth test, stencil test, 6302f4aeb0Sopenharmony_ci alpha blend) for each sample. After the entire scene is rendered, 6402f4aeb0Sopenharmony_ci the samples are filtered to compute the final anti-aliased image. 6502f4aeb0Sopenharmony_ci Because the post-alpha test operations are replicated for each sample, 6602f4aeb0Sopenharmony_ci all of the bleed-through and ordering artifacts that could occur with 6702f4aeb0Sopenharmony_ci edge anti-aliasing are avoided completely; however, since each sample 6802f4aeb0Sopenharmony_ci must be computed and stored separately, anti-aliasing quality is 6902f4aeb0Sopenharmony_ci limited by framebuffer storage and rendering performance. 7002f4aeb0Sopenharmony_ci 7102f4aeb0Sopenharmony_ci This extension introduces a new anti-aliasing algorithm to OpenGL, 7202f4aeb0Sopenharmony_ci which dramatically improves multisampling quality without 7302f4aeb0Sopenharmony_ci adversely affecting multisampling's robustness or significantly 7402f4aeb0Sopenharmony_ci increasing the storage required, coverage sampling. 7502f4aeb0Sopenharmony_ci 7602f4aeb0Sopenharmony_ci Coverage sampling adds an additional high-precision geometric 7702f4aeb0Sopenharmony_ci coverage buffer to the framebuffer, which is used to produce 7802f4aeb0Sopenharmony_ci high-quality filtered results (with or without the presence of a 7902f4aeb0Sopenharmony_ci multisample buffer). This coverage information is computed and stored 8002f4aeb0Sopenharmony_ci during rasterization; since applications may render objects where the 8102f4aeb0Sopenharmony_ci specified geometry does not correspond to the visual result (examples 8202f4aeb0Sopenharmony_ci include alpha-testing for "imposters," or extruded volume rendering 8302f4aeb0Sopenharmony_ci for stencil shadow volumes), coverage buffer updates may be masked 8402f4aeb0Sopenharmony_ci by the application, analagous to masking the depth buffer. 8502f4aeb0Sopenharmony_ci 8602f4aeb0Sopenharmony_ciIP Status 8702f4aeb0Sopenharmony_ci 8802f4aeb0Sopenharmony_ci NVIDIA Proprietary 8902f4aeb0Sopenharmony_ci 9002f4aeb0Sopenharmony_ciNew Procedures and Functions 9102f4aeb0Sopenharmony_ci 9202f4aeb0Sopenharmony_ci void CoverageMaskNV( boolean mask ) 9302f4aeb0Sopenharmony_ci void CoverageOperationNV( enum operation ) 9402f4aeb0Sopenharmony_ci 9502f4aeb0Sopenharmony_ciNew Tokens 9602f4aeb0Sopenharmony_ci 9702f4aeb0Sopenharmony_ci 9802f4aeb0Sopenharmony_ci Accepted by the <attrib_list> parameter of eglChooseConfig 9902f4aeb0Sopenharmony_ci and eglCreatePbufferSurface, and by the <attribute> 10002f4aeb0Sopenharmony_ci parameter of eglGetConfigAttrib 10102f4aeb0Sopenharmony_ci 10202f4aeb0Sopenharmony_ci EGL_COVERAGE_BUFFERS_NV 0x30E0 10302f4aeb0Sopenharmony_ci EGL_COVERAGE_SAMPLES_NV 0x30E1 10402f4aeb0Sopenharmony_ci 10502f4aeb0Sopenharmony_ci Accepted by the <internalformat> parameter of 10602f4aeb0Sopenharmony_ci RenderbufferStorageEXT and the <format> parameter of ReadPixels 10702f4aeb0Sopenharmony_ci 10802f4aeb0Sopenharmony_ci COVERAGE_COMPONENT_NV 0x8ED0 10902f4aeb0Sopenharmony_ci 11002f4aeb0Sopenharmony_ci Accepted by the <internalformat> parameter of 11102f4aeb0Sopenharmony_ci RenderbufferStorageEXT 11202f4aeb0Sopenharmony_ci 11302f4aeb0Sopenharmony_ci COVERAGE_COMPONENT4_NV 0x8ED1 11402f4aeb0Sopenharmony_ci 11502f4aeb0Sopenharmony_ci Accepted by the <operation> parameter of CoverageOperationNV 11602f4aeb0Sopenharmony_ci 11702f4aeb0Sopenharmony_ci COVERAGE_ALL_FRAGMENTS_NV 0x8ED5 11802f4aeb0Sopenharmony_ci COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6 11902f4aeb0Sopenharmony_ci COVERAGE_AUTOMATIC_NV 0x8ED7 12002f4aeb0Sopenharmony_ci 12102f4aeb0Sopenharmony_ci Accepted by the <attachment> parameter of 12202f4aeb0Sopenharmony_ci FramebufferRenderbuffer, and GetFramebufferAttachmentParameteriv 12302f4aeb0Sopenharmony_ci 12402f4aeb0Sopenharmony_ci COVERAGE_ATTACHMENT_NV 0x8ED2 12502f4aeb0Sopenharmony_ci 12602f4aeb0Sopenharmony_ci Accepted by the <buf> parameter of Clear 12702f4aeb0Sopenharmony_ci 12802f4aeb0Sopenharmony_ci COVERAGE_BUFFER_BIT_NV 0x8000 12902f4aeb0Sopenharmony_ci 13002f4aeb0Sopenharmony_ci Accepted by the <pname> parameter of GetIntegerv 13102f4aeb0Sopenharmony_ci 13202f4aeb0Sopenharmony_ci COVERAGE_BUFFERS_NV 0x8ED3 13302f4aeb0Sopenharmony_ci COVERAGE_SAMPLES_NV 0x8ED4 13402f4aeb0Sopenharmony_ci 13502f4aeb0Sopenharmony_ciChanges to Chapter 4 of the OpenGL 2.0 Specification 13602f4aeb0Sopenharmony_ci 13702f4aeb0Sopenharmony_ci Insert a new section, after Section 3.2.1 (Multisampling) 13802f4aeb0Sopenharmony_ci 13902f4aeb0Sopenharmony_ci "3.2.2 Coverage Sampling 14002f4aeb0Sopenharmony_ci 14102f4aeb0Sopenharmony_ci Coverage sampling is a mechanism to antialias all GL primitives: points, 14202f4aeb0Sopenharmony_ci lines, polygons, bitmaps and images. The technique is similar to 14302f4aeb0Sopenharmony_ci multisampling, with all primitives being sampled multiple times at each 14402f4aeb0Sopenharmony_ci pixel, and a sample resolve applied to compute the color values stored 14502f4aeb0Sopenharmony_ci in the framebuffer's color buffers. As with multisampling, coverage 14602f4aeb0Sopenharmony_ci sampling resolves color sample and coverage values to a single, displayable 14702f4aeb0Sopenharmony_ci color each time a pixel is updated, so antialiasing appears to be automatic 14802f4aeb0Sopenharmony_ci at the application level. Coverage sampling may be used simultaneously 14902f4aeb0Sopenharmony_ci with multisampling; however, this is not required. 15002f4aeb0Sopenharmony_ci 15102f4aeb0Sopenharmony_ci An additional buffer, called the coverage buffer, is added to 15202f4aeb0Sopenharmony_ci the framebuffer. This buffer stores additional coverage information 15302f4aeb0Sopenharmony_ci that may be used to produce higher-quality antialiasing than what is 15402f4aeb0Sopenharmony_ci provided by conventional multisampling. 15502f4aeb0Sopenharmony_ci 15602f4aeb0Sopenharmony_ci When the framebuffer includes a multisample buffer (3.5.6), the 15702f4aeb0Sopenharmony_ci samples contain this coverage information, and the framebuffer 15802f4aeb0Sopenharmony_ci does not include the coverage buffer. 15902f4aeb0Sopenharmony_ci 16002f4aeb0Sopenharmony_ci If the value of COVERAGE_BUFFERS_NV is one, the rasterization of 16102f4aeb0Sopenharmony_ci all primitives is changed, and is referred to as coverage sample 16202f4aeb0Sopenharmony_ci rasterization. Otherwise, primitive rasterization is referred to 16302f4aeb0Sopenharmony_ci as multisample rasterization (if SAMPLE_BUFFERS is one) or 16402f4aeb0Sopenharmony_ci single-sample rasterization (otherwise). The value of 16502f4aeb0Sopenharmony_ci COVERAGE_BUFFERS_NV is queried by calling GetIntegerv with <pname> 16602f4aeb0Sopenharmony_ci set to COVERAGE_BUFFERS_NV. 16702f4aeb0Sopenharmony_ci 16802f4aeb0Sopenharmony_ci During coverage sample rasterization the pixel fragment contents 16902f4aeb0Sopenharmony_ci are modified to include COVERAGE_SAMPLES_NV coverage values. The 17002f4aeb0Sopenharmony_ci value of COVERAGE_SAMPLES_NV is an implementation-dependent 17102f4aeb0Sopenharmony_ci constant, and is queried by calling GetIntegerv with <pname> set 17202f4aeb0Sopenharmony_ci to COVERAGE_SAMPLES_NV. 17302f4aeb0Sopenharmony_ci 17402f4aeb0Sopenharmony_ci The command 17502f4aeb0Sopenharmony_ci 17602f4aeb0Sopenharmony_ci CoverageOperationNV(enum operation) 17702f4aeb0Sopenharmony_ci 17802f4aeb0Sopenharmony_ci may be used to modify the manner in which coverage sampling is 17902f4aeb0Sopenharmony_ci performed for all primitives. If <operation> is 18002f4aeb0Sopenharmony_ci COVERAGE_ALL_FRAGMENTS_NV, coverage sampling will be performed and the 18102f4aeb0Sopenharmony_ci coverage buffer updated for all fragments generated during rasterization. 18202f4aeb0Sopenharmony_ci If <operation> is COVERAGE_EDGE_FRAGMENTS_NV, coverage sampling will 18302f4aeb0Sopenharmony_ci only be performed for fragments generated at the edge of the 18402f4aeb0Sopenharmony_ci primitive (by only updating fragments at the edges of primitives, 18502f4aeb0Sopenharmony_ci applications may get better visual results when rendering partially 18602f4aeb0Sopenharmony_ci transparent objects). If <operation> is COVERAGE_AUTOMATIC_NV, 18702f4aeb0Sopenharmony_ci the GL will automatically select the appropriate coverage operation, 18802f4aeb0Sopenharmony_ci dependent on the GL blend mode and the use of gl_LastFragColor / 18902f4aeb0Sopenharmony_ci gl_LastFragData in the bound fragment program. If blending is enabled, 19002f4aeb0Sopenharmony_ci or gl_LastFragColor / gl_LastFragData appears in the bound fragment 19102f4aeb0Sopenharmony_ci program, COVERAGE_AUTOMATIC_NV will behave identically to 19202f4aeb0Sopenharmony_ci COVERAGE_EDGE_FRAGMENTS_NV; otherwise, COVERAGE_AUTOMATIC_NV will behave 19302f4aeb0Sopenharmony_ci identically to COVERAGE_ALL_FRAGMENTS_NV. The default coverage operation 19402f4aeb0Sopenharmony_ci is COVERAGE_AUTOMATIC_NV." 19502f4aeb0Sopenharmony_ci 19602f4aeb0Sopenharmony_ci Insert a new section, after Section 3.3.3 (Point Multisample 19702f4aeb0Sopenharmony_ci Rasterization) 19802f4aeb0Sopenharmony_ci 19902f4aeb0Sopenharmony_ci "3.3.4 Point Coverage Sample Rasterization 20002f4aeb0Sopenharmony_ci 20102f4aeb0Sopenharmony_ci If the value of COVERAGE_BUFFERS_NV is one, then points are 20202f4aeb0Sopenharmony_ci rasterized using the following algorithm, regardless of whether 20302f4aeb0Sopenharmony_ci point antialiasing (POINT_SMOOTH) is enabled or disabled. Point 20402f4aeb0Sopenharmony_ci rasterization produces fragments using the same algorithm described 20502f4aeb0Sopenharmony_ci in section 3.3.3; however, sample points are divided into SAMPLES 20602f4aeb0Sopenharmony_ci multisample points and COVERAGE_SAMPLES_NV coverage sample points. 20702f4aeb0Sopenharmony_ci 20802f4aeb0Sopenharmony_ci Rasterization for multisample points uses the algorithm described 20902f4aeb0Sopenharmony_ci in section 3.3.3. Rasterization for coverage sample points uses 21002f4aeb0Sopenharmony_ci implementation-dependent algorithms, ultimately storing the results 21102f4aeb0Sopenharmony_ci in the coverage buffer." 21202f4aeb0Sopenharmony_ci 21302f4aeb0Sopenharmony_ci Insert a new section, after Section 3.4.4 (Line Multisample 21402f4aeb0Sopenharmony_ci Rasterization) 21502f4aeb0Sopenharmony_ci 21602f4aeb0Sopenharmony_ci "3.4.5 Line Coverage Sample Rasterization 21702f4aeb0Sopenharmony_ci 21802f4aeb0Sopenharmony_ci If the value of COVERAGE_BUFFERS_NV is one, then lines are 21902f4aeb0Sopenharmony_ci rasterized using the following algorithm, regardless of whether 22002f4aeb0Sopenharmony_ci line antialiasing (LINE_SMOOTH) is enabled or disabled. Line 22102f4aeb0Sopenharmony_ci rasterization produces fragments using the same algorithm described 22202f4aeb0Sopenharmony_ci in section 3.4.4; however, sample points are divided into SAMPLES 22302f4aeb0Sopenharmony_ci multisample points and COVERAGE_SAMPLES_NV coverage sample points. 22402f4aeb0Sopenharmony_ci 22502f4aeb0Sopenharmony_ci Rasterization for multisample points uses the algorithm described in 22602f4aeb0Sopenharmony_ci section 3.4.4. Rasterization for coverage sample points uses 22702f4aeb0Sopenharmony_ci implementation-dependent algorithms, ultimately storing results in 22802f4aeb0Sopenharmony_ci the coverage buffer." 22902f4aeb0Sopenharmony_ci 23002f4aeb0Sopenharmony_ci Insert a new section, after Section 3.5.6 (Polygon Multisample 23102f4aeb0Sopenharmony_ci Rasterization) 23202f4aeb0Sopenharmony_ci 23302f4aeb0Sopenharmony_ci "3.5.7 Polygon Coverage Sample Rasterization 23402f4aeb0Sopenharmony_ci 23502f4aeb0Sopenharmony_ci If the value of COVERAGE_BUFFERS_NV is one, then polygons are 23602f4aeb0Sopenharmony_ci rasterized using the following algorithm, regardless of whether 23702f4aeb0Sopenharmony_ci polygon antialiasing (POLYGON_SMOOTH) is enabled or disabled. Polygon 23802f4aeb0Sopenharmony_ci rasterization produces fragments using the same algorithm described in 23902f4aeb0Sopenharmony_ci section 3.5.6; however, sample points are divided into SAMPLES multisample 24002f4aeb0Sopenharmony_ci points and COVERAGE_SAMPLES_NV coverage sample points. 24102f4aeb0Sopenharmony_ci 24202f4aeb0Sopenharmony_ci Rasterization for multisample points uses the algorithm described in 24302f4aeb0Sopenharmony_ci section 3.5.7. Rasterization for coverage sample points uses 24402f4aeb0Sopenharmony_ci implementation-dependent algorithms, ultimately storing results in the 24502f4aeb0Sopenharmony_ci coverage buffer." 24602f4aeb0Sopenharmony_ci 24702f4aeb0Sopenharmony_ci Insert a new section, after Section 3.6.6 (Pixel Rectangle Multisample 24802f4aeb0Sopenharmony_ci Rasterization) 24902f4aeb0Sopenharmony_ci 25002f4aeb0Sopenharmony_ci "3.6.7 Pixel Rectangle Coverage Sample Rasterization 25102f4aeb0Sopenharmony_ci 25202f4aeb0Sopenharmony_ci If the value of COVERAGE_BUFFERS_NV is one, then pixel rectangles are 25302f4aeb0Sopenharmony_ci rasterized using the algorithm described in section 3.6.6." 25402f4aeb0Sopenharmony_ci 25502f4aeb0Sopenharmony_ci Modify the first sentence of the second-to-last paragraph of section 25602f4aeb0Sopenharmony_ci 3.7 (Bitmaps) to read: 25702f4aeb0Sopenharmony_ci 25802f4aeb0Sopenharmony_ci "Bitmap Multisample and Coverage Sample Rasterization 25902f4aeb0Sopenharmony_ci 26002f4aeb0Sopenharmony_ci If MULTISAMPLE is enabled, and the value of SAMPLE_BUFFERS is one; 26102f4aeb0Sopenharmony_ci or if the value of COVERAGE_BUFFERS_NV is one, then bitmaps are 26202f4aeb0Sopenharmony_ci rasterized using the following algorithm. [...]" 26302f4aeb0Sopenharmony_ci 26402f4aeb0Sopenharmony_ci Insert after the first paragraph of Section 4.2.2 (Fine Control of 26502f4aeb0Sopenharmony_ci Buffer Updates): 26602f4aeb0Sopenharmony_ci 26702f4aeb0Sopenharmony_ci "The coverage buffer can be enabled or disabled for writing coverage 26802f4aeb0Sopenharmony_ci sample values using 26902f4aeb0Sopenharmony_ci 27002f4aeb0Sopenharmony_ci void CoverageMaskNV( boolean mask ); 27102f4aeb0Sopenharmony_ci 27202f4aeb0Sopenharmony_ci If <mask> is non-zero, the coverage buffer is enabled for writing; 27302f4aeb0Sopenharmony_ci otherwise, it is disabled. In the initial state, the coverage 27402f4aeb0Sopenharmony_ci buffer is enabled for writing." 27502f4aeb0Sopenharmony_ci 27602f4aeb0Sopenharmony_ci And change the text of the last 2 paragraphs of Section 4.2.2 to read: 27702f4aeb0Sopenharmony_ci 27802f4aeb0Sopenharmony_ci "The state required for the various masking operations is three 27902f4aeb0Sopenharmony_ci integers and two bits: an integer for color indices, an integer for 28002f4aeb0Sopenharmony_ci the front and back stencil values, a bit for depth values, and a 28102f4aeb0Sopenharmony_ci bit for coverage sample values. A set of four bits is also required 28202f4aeb0Sopenharmony_ci indicating which components of an RGBA value should be written. In the 28302f4aeb0Sopenharmony_ci initial state, the integer masks are all ones, as are the bits 28402f4aeb0Sopenharmony_ci controlling the depth value, coverage sample value and RGBA component 28502f4aeb0Sopenharmony_ci writing. 28602f4aeb0Sopenharmony_ci 28702f4aeb0Sopenharmony_ci Fine Control of Multisample Buffer Updates 28802f4aeb0Sopenharmony_ci 28902f4aeb0Sopenharmony_ci When the value of SAMPLE_BUFFERS is one, ColorMask, DepthMask, 29002f4aeb0Sopenharmony_ci CoverageMask, and StencilMask or StencilMaskSeparate control the 29102f4aeb0Sopenharmony_ci modification of values in the multisample buffer. [...]" 29202f4aeb0Sopenharmony_ci 29302f4aeb0Sopenharmony_ci Change paragraph 2 of Section 4.2.3 (Clearing the Buffers) to read: 29402f4aeb0Sopenharmony_ci 29502f4aeb0Sopenharmony_ci "is the bitwise OR of a number of values indicating which buffers are to 29602f4aeb0Sopenharmony_ci be cleared. The values are COLOR_BUFFER_BIT, DEPTH_BUFFER_BIT, 29702f4aeb0Sopenharmony_ci STENCIL_BUFFER_BIT, ACCUM_BUFFER_BIT and COVERAGE_BUFFER_BIT_NV, indicating 29802f4aeb0Sopenharmony_ci the buffers currently enabled for color writing, the depth buffer, 29902f4aeb0Sopenharmony_ci the stencil buffer, the accumulation buffer and the virtual-coverage 30002f4aeb0Sopenharmony_ci buffer, respectively. [...]" 30102f4aeb0Sopenharmony_ci 30202f4aeb0Sopenharmony_ci Insert a new paragraph after paragraph 4 of Section 4.3.2 (Reading Pixels) 30302f4aeb0Sopenharmony_ci (beginning with "If there is a multisample buffer ..."): 30402f4aeb0Sopenharmony_ci 30502f4aeb0Sopenharmony_ci "If the <format> is COVERAGE_COMPONENT_NV, then values are taken from the 30602f4aeb0Sopenharmony_ci coverage buffer; again, if there is no coverage buffer, the error 30702f4aeb0Sopenharmony_ci INVALID_OPERATION occurs. When <format> is COVERAGE_COMPONENT_NV, 30802f4aeb0Sopenharmony_ci <type> must be GL_UNSIGNED_BYTE. Any other value for <type> will 30902f4aeb0Sopenharmony_ci generate the error INVALID_ENUM. If there is a multisample buffer, the 31002f4aeb0Sopenharmony_ci values are undefined." 31102f4aeb0Sopenharmony_ci 31202f4aeb0Sopenharmony_ci 31302f4aeb0Sopenharmony_ci 31402f4aeb0Sopenharmony_ciModifications to the OES_framebuffer_object specification 31502f4aeb0Sopenharmony_ci 31602f4aeb0Sopenharmony_ci Add a new table at the end of Section 4.4.2.1 (Renderbuffer Objects) 31702f4aeb0Sopenharmony_ci 31802f4aeb0Sopenharmony_ci "+-------------------------+-----------------------+-----------+ 31902f4aeb0Sopenharmony_ci | Sized internal format | Base Internal Format | C Samples | 32002f4aeb0Sopenharmony_ci +-------------------------+-----------------------+-----------+ 32102f4aeb0Sopenharmony_ci | COVERAGE_COMPONENT4_NV | COVERAGE_COMPONENT_NV | 4 | 32202f4aeb0Sopenharmony_ci +-------------------------+-----------------------+-----------+ 32302f4aeb0Sopenharmony_ci Table 1.ooo Desired component resolution for each sized internal 32402f4aeb0Sopenharmony_ci format that can be used only with renderbuffers" 32502f4aeb0Sopenharmony_ci 32602f4aeb0Sopenharmony_ci Add to the bullet list in Section 4.4.4 (Framebuffer Completeness) 32702f4aeb0Sopenharmony_ci 32802f4aeb0Sopenharmony_ci "An internal format is 'coverage-renderable' if it is COVERAGE_COMPONENT_NV 32902f4aeb0Sopenharmony_ci or one of the COVERAGE_COMPONENT_NV formats from table 1.ooo. No other 33002f4aeb0Sopenharmony_ci formats are coverage-renderable" 33102f4aeb0Sopenharmony_ci 33202f4aeb0Sopenharmony_ci Add to the bullet list in Section 4.4.4.1 (Framebuffer Attachment 33302f4aeb0Sopenharmony_ci Completeness) 33402f4aeb0Sopenharmony_ci 33502f4aeb0Sopenharmony_ci "If <attachment> is COVERAGE_ATTACHMENT_NV, then <image> must have a 33602f4aeb0Sopenharmony_ci coverage-renderable internal format." 33702f4aeb0Sopenharmony_ci 33802f4aeb0Sopenharmony_ci Add a paragraph at the end of Section 4.4.4.2 (Framebuffer Completeness) 33902f4aeb0Sopenharmony_ci 34002f4aeb0Sopenharmony_ci "The values of COVERAGE_BUFFERS_NV and COVERAGE_SAMPLES_NV are derived from 34102f4aeb0Sopenharmony_ci the attachments of the currently bound framebuffer object. If the current 34202f4aeb0Sopenharmony_ci FRAMEBUFFER_BINDING_OES is not 'framebuffer-complete', then both 34302f4aeb0Sopenharmony_ci COVERAGE_BUFFERS_NV and COVERAGE_SAMPLES_NV are undefined. Otherwise, 34402f4aeb0Sopenharmony_ci COVERAGE_SAMPLES_NV is equal to the number of coverage samples for the 34502f4aeb0Sopenharmony_ci image attached to COVERAGE_ATTACHMENT_NV, or zero if COVERAGE_ATTACHMENT_NV 34602f4aeb0Sopenharmony_ci is zero." 34702f4aeb0Sopenharmony_ci 34802f4aeb0Sopenharmony_ciAdditions to the EGL 1.2 Specification 34902f4aeb0Sopenharmony_ci 35002f4aeb0Sopenharmony_ci Add to Table 3.1 (EGLConfig attributes) 35102f4aeb0Sopenharmony_ci +---------------------------+---------+-----------------------------------+ 35202f4aeb0Sopenharmony_ci | Attribute | Type | Notes | 35302f4aeb0Sopenharmony_ci +---------------------------+---------+-----------------------------------+ 35402f4aeb0Sopenharmony_ci | EGL_COVERAGE_BUFFERS_NV | integer | number of coverage buffers | 35502f4aeb0Sopenharmony_ci | EGL_COVERAGE_SAMPLES_NV | integer | number of coverage samples per | 35602f4aeb0Sopenharmony_ci | | | pixel | 35702f4aeb0Sopenharmony_ci +---------------------------+---------+-----------------------------------+ 35802f4aeb0Sopenharmony_ci 35902f4aeb0Sopenharmony_ci Modify the first sentence of the last paragraph of the "Buffer 36002f4aeb0Sopenharmony_ci Descriptions and Attributes" subsection of Section 3.4 (Configuration 36102f4aeb0Sopenharmony_ci Management), p. 16 36202f4aeb0Sopenharmony_ci 36302f4aeb0Sopenharmony_ci "There are no single-sample depth, stencil or coverage buffers for a 36402f4aeb0Sopenharmony_ci multisample EGLConfig; the only depth, stencil and coverage buffers are 36502f4aeb0Sopenharmony_ci those in the multisample buffer. [...]" 36602f4aeb0Sopenharmony_ci 36702f4aeb0Sopenharmony_ci And add the following text at the end of that paragraph: 36802f4aeb0Sopenharmony_ci 36902f4aeb0Sopenharmony_ci "The <coverage buffer> is used only by OpenGL ES. It contains primitive 37002f4aeb0Sopenharmony_ci coverage information that is used to produce a high-quality anti-aliased 37102f4aeb0Sopenharmony_ci image. The format of the coverage buffer is not specified, and its 37202f4aeb0Sopenharmony_ci contents are not directly accessible. Only the existence of the coverage 37302f4aeb0Sopenharmony_ci buffer, and the number of coverage samples it contains, are exposed by EGL. 37402f4aeb0Sopenharmony_ci 37502f4aeb0Sopenharmony_ci EGL_COVERAGE_BUFFERS_NV indicates the number of coverage buffers, which 37602f4aeb0Sopenharmony_ci must be zero or one. EGL_COVERAGE_SAMPLES_NV gives the number of coverage 37702f4aeb0Sopenharmony_ci samples per pixel; if EGL_COVERAGE_BUFFERS_NV is zero, then 37802f4aeb0Sopenharmony_ci EGL_COVERAGE_SAMPLES_NV will also be zero." 37902f4aeb0Sopenharmony_ci 38002f4aeb0Sopenharmony_ci Add to Table 3.4 (Default values and match criteria for EGLConfig 38102f4aeb0Sopenharmony_ci attributes) 38202f4aeb0Sopenharmony_ci 38302f4aeb0Sopenharmony_ci +---------------------------+-----------+-------------+---------+---------+ 38402f4aeb0Sopenharmony_ci | Attribute | Default | Selection | Sort | Sort | 38502f4aeb0Sopenharmony_ci | | | Criteria | Order | Priority| 38602f4aeb0Sopenharmony_ci +---------------------------+-----------+-------------+---------+---------+ 38702f4aeb0Sopenharmony_ci | EGL_COVERAGE_BUFFERS_NV | 0 | At Least | Smaller | 7 | 38802f4aeb0Sopenharmony_ci | EGL_COVERAGE_SAMPLES_NV | 0 | At Least | Smaller | 8 | 38902f4aeb0Sopenharmony_ci +---------------------------+-----------+-------------+---------+---------+ 39002f4aeb0Sopenharmony_ci And renumber existing sort priorities 7-11 as 9-13. 39102f4aeb0Sopenharmony_ci 39202f4aeb0Sopenharmony_ci Modify the list in "Sorting of EGLConfigs" (Section 3.4.1, pg 20) 39302f4aeb0Sopenharmony_ci 39402f4aeb0Sopenharmony_ci " [...] 39502f4aeb0Sopenharmony_ci 5. Smaller EGL_SAMPLE_BUFFERS 39602f4aeb0Sopenharmony_ci 6. Smaller EGL_SAMPLES 39702f4aeb0Sopenharmony_ci 7. Smaller EGL_COVERAGE_BUFFERS_NV 39802f4aeb0Sopenharmony_ci 8. Smaller EGL_COVERAGE_SAMPLES_NV 39902f4aeb0Sopenharmony_ci 9. Smaller EGL_DEPTH_SIZE 40002f4aeb0Sopenharmony_ci 10. Smaller EGL_STENCIL_SIZE 40102f4aeb0Sopenharmony_ci 11. Smaller EGL_ALPHA_MASK_SIZE 40202f4aeb0Sopenharmony_ci 12. Special: [...] 40302f4aeb0Sopenharmony_ci 13. Smaller EGL_CONFIG_ID [...]" 40402f4aeb0Sopenharmony_ci 40502f4aeb0Sopenharmony_ciUsage Examples 40602f4aeb0Sopenharmony_ci 40702f4aeb0Sopenharmony_ci (1) Basic Coverage Sample Rasterization 40802f4aeb0Sopenharmony_ci 40902f4aeb0Sopenharmony_ci glCoverageMaskNV(GL_TRUE); 41002f4aeb0Sopenharmony_ci glDepthMask(GL_TRUE); 41102f4aeb0Sopenharmony_ci glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 41202f4aeb0Sopenharmony_ci 41302f4aeb0Sopenharmony_ci while (1) 41402f4aeb0Sopenharmony_ci { 41502f4aeb0Sopenharmony_ci glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | 41602f4aeb0Sopenharmony_ci GL_COVERAGE_BUFFER_BIT_NV); 41702f4aeb0Sopenharmony_ci glDrawElements(...); 41802f4aeb0Sopenharmony_ci eglSwapBuffers(...); 41902f4aeb0Sopenharmony_ci } 42002f4aeb0Sopenharmony_ci 42102f4aeb0Sopenharmony_ci (2) Multi-Pass Rendering Algorithms 42202f4aeb0Sopenharmony_ci 42302f4aeb0Sopenharmony_ci while (1) 42402f4aeb0Sopenharmony_ci { 42502f4aeb0Sopenharmony_ci glDepthMask(GL_TRUE); 42602f4aeb0Sopenharmony_ci glCoverageMaskNV(GL_TRUE); 42702f4aeb0Sopenharmony_ci glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 42802f4aeb0Sopenharmony_ci glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | 42902f4aeb0Sopenharmony_ci GL_COVERAGE_BUFFER_BIT_NV); 43002f4aeb0Sopenharmony_ci 43102f4aeb0Sopenharmony_ci // first render pass: render Z-only (occlusion surface), with 43202f4aeb0Sopenharmony_ci // coverage info. color writes are disabled 43302f4aeb0Sopenharmony_ci 43402f4aeb0Sopenharmony_ci glCoverageMaskNV(GL_TRUE); 43502f4aeb0Sopenharmony_ci glDepthMask(GL_TRUE); 43602f4aeb0Sopenharmony_ci glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); 43702f4aeb0Sopenharmony_ci glDepthFunc(GL_LESS); 43802f4aeb0Sopenharmony_ci glDrawElements(...); 43902f4aeb0Sopenharmony_ci 44002f4aeb0Sopenharmony_ci // second render pass: set Z test to Z-equals, disable Z-writes & 44102f4aeb0Sopenharmony_ci // coverage writes. enable color writes. coverage may be 44202f4aeb0Sopenharmony_ci // disabled, because subsequent rendering passes are rendering 44302f4aeb0Sopenharmony_ci // identical geometry -- since the final coverage buffer will be 44402f4aeb0Sopenharmony_ci // unchanged, we can disable coverage writes as an optimization. 44502f4aeb0Sopenharmony_ci 44602f4aeb0Sopenharmony_ci glCoverageMaskNV(GL_FALSE); 44702f4aeb0Sopenharmony_ci glDepthMask(GL_FALSE); 44802f4aeb0Sopenharmony_ci glDepthFunc(GL_EQUAL); 44902f4aeb0Sopenharmony_ci glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 45002f4aeb0Sopenharmony_ci glDrawElements(...); 45102f4aeb0Sopenharmony_ci 45202f4aeb0Sopenharmony_ci eglSwapBuffers(); 45302f4aeb0Sopenharmony_ci } 45402f4aeb0Sopenharmony_ci 45502f4aeb0Sopenharmony_ci (3) Rendering Translucent Objects on Top of Opaque Objects 45602f4aeb0Sopenharmony_ci 45702f4aeb0Sopenharmony_ci while (1) 45802f4aeb0Sopenharmony_ci { 45902f4aeb0Sopenharmony_ci glDepthMask(GL_TRUE); 46002f4aeb0Sopenharmony_ci glCoverageMaskNV(GL_TRUE); 46102f4aeb0Sopenharmony_ci glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 46202f4aeb0Sopenharmony_ci glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | 46302f4aeb0Sopenharmony_ci GL_COVERAGE_BUFFER_BIT_NV); 46402f4aeb0Sopenharmony_ci 46502f4aeb0Sopenharmony_ci // render opaque, Z-buffered geometry with coverage info for the 46602f4aeb0Sopenharmony_ci // entire primitive. Overwrite coverage data for all fragments, so 46702f4aeb0Sopenharmony_ci // that interior fragments do not get resolved incorrectly. 46802f4aeb0Sopenharmony_ci 46902f4aeb0Sopenharmony_ci glDepthFunc(GL_LESS); 47002f4aeb0Sopenharmony_ci glCoverageOperationNV(GL_COVERAGE_ALL_FRAGMENTS_NV); 47102f4aeb0Sopenharmony_ci glDrawElements(...); 47202f4aeb0Sopenharmony_ci 47302f4aeb0Sopenharmony_ci // render translucent, Z-buffered geometry. to ensure that visible 47402f4aeb0Sopenharmony_ci // edges of opaque geometry remain anti-aliased, change the 47502f4aeb0Sopenharmony_ci // coverage operation to just edge fragments. this will maintain 47602f4aeb0Sopenharmony_ci // the coverage information underneath the translucent geometry, 47702f4aeb0Sopenharmony_ci // except at translucent edges. 47802f4aeb0Sopenharmony_ci 47902f4aeb0Sopenharmony_ci glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 48002f4aeb0Sopenharmony_ci glCoverageOperationNV(GL_COVERAGE_EDGE_FRAGMENTS_NV); 48102f4aeb0Sopenharmony_ci glEnable(GL_BLEND); 48202f4aeb0Sopenharmony_ci glDrawElements(...); 48302f4aeb0Sopenharmony_ci glDisable(GL_BLEND); 48402f4aeb0Sopenharmony_ci 48502f4aeb0Sopenharmony_ci eglSwapBuffers(); 48602f4aeb0Sopenharmony_ci } 48702f4aeb0Sopenharmony_ci 48802f4aeb0Sopenharmony_ci (4) Rendering Opacity-Mapped Particle Systems & HUDs on Top of Opaque 48902f4aeb0Sopenharmony_ci Geometry 49002f4aeb0Sopenharmony_ci 49102f4aeb0Sopenharmony_ci while (1) 49202f4aeb0Sopenharmony_ci { 49302f4aeb0Sopenharmony_ci glDepthMask(GL_TRUE); 49402f4aeb0Sopenharmony_ci glCoverageMaskNV(GL_TRUE); 49502f4aeb0Sopenharmony_ci glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 49602f4aeb0Sopenharmony_ci glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | 49702f4aeb0Sopenharmony_ci GL_COVERAGE_BUFFER_BIT_NV); 49802f4aeb0Sopenharmony_ci 49902f4aeb0Sopenharmony_ci // render opaque, Z-buffered geometry, with coverage info. 50002f4aeb0Sopenharmony_ci glDepthFunc(GL_LESS); 50102f4aeb0Sopenharmony_ci glDrawElements(...); 50202f4aeb0Sopenharmony_ci 50302f4aeb0Sopenharmony_ci // render opacity-mapped geometry. disable Z writes, enable alpha 50402f4aeb0Sopenharmony_ci // blending. also, disable coverage writes -- the edges of the 50502f4aeb0Sopenharmony_ci // geometry used for the HUD/particle system have alpha values 50602f4aeb0Sopenharmony_ci // tapering to zero, so edge coverage is uninteresting, and 50702f4aeb0Sopenharmony_ci // interior coverage should still refer to the underlying opaque 50802f4aeb0Sopenharmony_ci // geometry, so that opaque edges visible through the translucent 50902f4aeb0Sopenharmony_ci // regions remain anti-aliased. 51002f4aeb0Sopenharmony_ci 51102f4aeb0Sopenharmony_ci glCoverageMaskNV(GL_FALSE); 51202f4aeb0Sopenharmony_ci glDepthMask(GL_FALSE); 51302f4aeb0Sopenharmony_ci glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 51402f4aeb0Sopenharmony_ci glEnable(GL_BLEND); 51502f4aeb0Sopenharmony_ci glDrawElements(...); 51602f4aeb0Sopenharmony_ci glDisable(GL_BLEND); 51702f4aeb0Sopenharmony_ci 51802f4aeb0Sopenharmony_ci eglSwapBuffers(); 51902f4aeb0Sopenharmony_ci } 52002f4aeb0Sopenharmony_ci 52102f4aeb0Sopenharmony_ci 52202f4aeb0Sopenharmony_ciIssues 52302f4aeb0Sopenharmony_ci 52402f4aeb0Sopenharmony_ci 1. Is any specific discussion of coverage sampling resolves required, 52502f4aeb0Sopenharmony_ci particularly with respect to application-provided framebuffer objects? 52602f4aeb0Sopenharmony_ci 52702f4aeb0Sopenharmony_ci RESOLVED: No. Because the coverage sampling resolve is an 52802f4aeb0Sopenharmony_ci implementation-dependent algorithm, it is always legal behavior for 52902f4aeb0Sopenharmony_ci framebuffer read / copy functions to return the value in the selected 53002f4aeb0Sopenharmony_ci ReadBuffer as if COVERAGE_BUFFERS_NV was zero. This allows 53102f4aeb0Sopenharmony_ci textures attached to the color attachment points of framebuffer objects 53202f4aeb0Sopenharmony_ci to behave predictably, even when COVERAGE_BUFFERS_NV is one. 53302f4aeb0Sopenharmony_ci 53402f4aeb0Sopenharmony_ci Implementations are encouraged, whenever possible, to use the highest- 53502f4aeb0Sopenharmony_ci quality coverage sample resolve supported for calls to eglSwapBuffers, 53602f4aeb0Sopenharmony_ci eglCopyBuffers, ReadPixels, CopyPixels and CopyTex{Sub}Image. 53702f4aeb0Sopenharmony_ci 53802f4aeb0Sopenharmony_ci 2. Should all render buffer & texture types be legal sources for image 53902f4aeb0Sopenharmony_ci resolves and coverage attachment? 54002f4aeb0Sopenharmony_ci 54102f4aeb0Sopenharmony_ci RESOLVED: This spec should not place any arbitrary limits on usage; 54202f4aeb0Sopenharmony_ci however, there are many reasons why implementers may not wish to 54302f4aeb0Sopenharmony_ci support coverage sampling for all surface types. 54402f4aeb0Sopenharmony_ci 54502f4aeb0Sopenharmony_ci Implementations may return FRAMEBUFFER_UNSUPPORTED_OES from 54602f4aeb0Sopenharmony_ci CheckFramebufferStatusOES if an object bound to COVERAGE_ATTACHMENT_NV 54702f4aeb0Sopenharmony_ci is incompatible with one or more objects bound to DEPTH_ATTACHMENT_OES, 54802f4aeb0Sopenharmony_ci STENCIL_ATTACHMENT_OES, or COLOR_ATTACHMENTi_OES. 54902f4aeb0Sopenharmony_ci 55002f4aeb0Sopenharmony_ciRevision History 55102f4aeb0Sopenharmony_ci 55202f4aeb0Sopenharmony_ci#1.0 - 20.03.2007 55302f4aeb0Sopenharmony_ci 55402f4aeb0Sopenharmony_ci Renumbered enumerants. Reformatted to 80 columns. 555