15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci NV_coverage_sample 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_NV_coverage_sample 85bd8deadSopenharmony_ci EGL_NV_coverage_sample 95bd8deadSopenharmony_ci 105bd8deadSopenharmony_ciContact 115bd8deadSopenharmony_ci 125bd8deadSopenharmony_ci Gary King, NVIDIA Corporation (gking 'at' nvidia.com) 135bd8deadSopenharmony_ci 145bd8deadSopenharmony_ciNotice 155bd8deadSopenharmony_ci 165bd8deadSopenharmony_ci Copyright NVIDIA Corporation, 2005 - 2007 175bd8deadSopenharmony_ci 185bd8deadSopenharmony_ciStatus 195bd8deadSopenharmony_ci 205bd8deadSopenharmony_ci NVIDIA Proprietary 215bd8deadSopenharmony_ci 225bd8deadSopenharmony_ciVersion 235bd8deadSopenharmony_ci 245bd8deadSopenharmony_ci Last Modified Date: 2007/03/20 255bd8deadSopenharmony_ci NVIDIA Revision: 1.0 265bd8deadSopenharmony_ci 275bd8deadSopenharmony_ciNumber 285bd8deadSopenharmony_ci 295bd8deadSopenharmony_ci EGL Extension #17 305bd8deadSopenharmony_ci OpenGL ES Extension #72 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ciDependencies 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ci Written based on the wording of the OpenGL 2.0 specification 355bd8deadSopenharmony_ci and the EXT_framebuffer_object specification. 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ci Written based on the wording of the EGL 1.2 specification. 385bd8deadSopenharmony_ci 395bd8deadSopenharmony_ci Requires OpenGL-ES 2.0 and OES_framebuffer_object. 405bd8deadSopenharmony_ci 415bd8deadSopenharmony_ci Requires EGL 1.1. 425bd8deadSopenharmony_ci 435bd8deadSopenharmony_ciOverview 445bd8deadSopenharmony_ci 455bd8deadSopenharmony_ci Anti-aliasing is a critical component for delivering high-quality 465bd8deadSopenharmony_ci OpenGL rendering. Traditionally, OpenGL implementations have 475bd8deadSopenharmony_ci implemented two anti-aliasing algorithms: edge anti-aliasing 485bd8deadSopenharmony_ci and multisampling. 495bd8deadSopenharmony_ci 505bd8deadSopenharmony_ci Edge anti-aliasing computes fractional fragment coverage for all 515bd8deadSopenharmony_ci primitives in a rendered frame, and blends edges of abutting 525bd8deadSopenharmony_ci and/or overlapping primitives to produce smooth results. The 535bd8deadSopenharmony_ci image quality produced by this approach is exceptionally high; 545bd8deadSopenharmony_ci however, applications are render their geometry perfectly ordered 555bd8deadSopenharmony_ci back-to-front in order to avoid artifacts such as bleed-through. 565bd8deadSopenharmony_ci Given the algorithmic complexity and performance cost of performing 575bd8deadSopenharmony_ci exact geometric sorts, edge anti-aliasing has been used very 585bd8deadSopenharmony_ci sparingly, and almost never in interactive games. 595bd8deadSopenharmony_ci 605bd8deadSopenharmony_ci Multisampling, on the other hand, computes and stores subpixel 615bd8deadSopenharmony_ci (a.k.a. "sample") coverage for rasterized fragments, and replicates 625bd8deadSopenharmony_ci all post-alpha test operations (e.g., depth test, stencil test, 635bd8deadSopenharmony_ci alpha blend) for each sample. After the entire scene is rendered, 645bd8deadSopenharmony_ci the samples are filtered to compute the final anti-aliased image. 655bd8deadSopenharmony_ci Because the post-alpha test operations are replicated for each sample, 665bd8deadSopenharmony_ci all of the bleed-through and ordering artifacts that could occur with 675bd8deadSopenharmony_ci edge anti-aliasing are avoided completely; however, since each sample 685bd8deadSopenharmony_ci must be computed and stored separately, anti-aliasing quality is 695bd8deadSopenharmony_ci limited by framebuffer storage and rendering performance. 705bd8deadSopenharmony_ci 715bd8deadSopenharmony_ci This extension introduces a new anti-aliasing algorithm to OpenGL, 725bd8deadSopenharmony_ci which dramatically improves multisampling quality without 735bd8deadSopenharmony_ci adversely affecting multisampling's robustness or significantly 745bd8deadSopenharmony_ci increasing the storage required, coverage sampling. 755bd8deadSopenharmony_ci 765bd8deadSopenharmony_ci Coverage sampling adds an additional high-precision geometric 775bd8deadSopenharmony_ci coverage buffer to the framebuffer, which is used to produce 785bd8deadSopenharmony_ci high-quality filtered results (with or without the presence of a 795bd8deadSopenharmony_ci multisample buffer). This coverage information is computed and stored 805bd8deadSopenharmony_ci during rasterization; since applications may render objects where the 815bd8deadSopenharmony_ci specified geometry does not correspond to the visual result (examples 825bd8deadSopenharmony_ci include alpha-testing for "imposters," or extruded volume rendering 835bd8deadSopenharmony_ci for stencil shadow volumes), coverage buffer updates may be masked 845bd8deadSopenharmony_ci by the application, analagous to masking the depth buffer. 855bd8deadSopenharmony_ci 865bd8deadSopenharmony_ciIP Status 875bd8deadSopenharmony_ci 885bd8deadSopenharmony_ci NVIDIA Proprietary 895bd8deadSopenharmony_ci 905bd8deadSopenharmony_ciNew Procedures and Functions 915bd8deadSopenharmony_ci 925bd8deadSopenharmony_ci void CoverageMaskNV( boolean mask ) 935bd8deadSopenharmony_ci void CoverageOperationNV( enum operation ) 945bd8deadSopenharmony_ci 955bd8deadSopenharmony_ciNew Tokens 965bd8deadSopenharmony_ci 975bd8deadSopenharmony_ci 985bd8deadSopenharmony_ci Accepted by the <attrib_list> parameter of eglChooseConfig 995bd8deadSopenharmony_ci and eglCreatePbufferSurface, and by the <attribute> 1005bd8deadSopenharmony_ci parameter of eglGetConfigAttrib 1015bd8deadSopenharmony_ci 1025bd8deadSopenharmony_ci EGL_COVERAGE_BUFFERS_NV 0x30E0 1035bd8deadSopenharmony_ci EGL_COVERAGE_SAMPLES_NV 0x30E1 1045bd8deadSopenharmony_ci 1055bd8deadSopenharmony_ci Accepted by the <internalformat> parameter of 1065bd8deadSopenharmony_ci RenderbufferStorageEXT and the <format> parameter of ReadPixels 1075bd8deadSopenharmony_ci 1085bd8deadSopenharmony_ci COVERAGE_COMPONENT_NV 0x8ED0 1095bd8deadSopenharmony_ci 1105bd8deadSopenharmony_ci Accepted by the <internalformat> parameter of 1115bd8deadSopenharmony_ci RenderbufferStorageEXT 1125bd8deadSopenharmony_ci 1135bd8deadSopenharmony_ci COVERAGE_COMPONENT4_NV 0x8ED1 1145bd8deadSopenharmony_ci 1155bd8deadSopenharmony_ci Accepted by the <operation> parameter of CoverageOperationNV 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ci COVERAGE_ALL_FRAGMENTS_NV 0x8ED5 1185bd8deadSopenharmony_ci COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6 1195bd8deadSopenharmony_ci COVERAGE_AUTOMATIC_NV 0x8ED7 1205bd8deadSopenharmony_ci 1215bd8deadSopenharmony_ci Accepted by the <attachment> parameter of 1225bd8deadSopenharmony_ci FramebufferRenderbuffer, and GetFramebufferAttachmentParameteriv 1235bd8deadSopenharmony_ci 1245bd8deadSopenharmony_ci COVERAGE_ATTACHMENT_NV 0x8ED2 1255bd8deadSopenharmony_ci 1265bd8deadSopenharmony_ci Accepted by the <buf> parameter of Clear 1275bd8deadSopenharmony_ci 1285bd8deadSopenharmony_ci COVERAGE_BUFFER_BIT_NV 0x8000 1295bd8deadSopenharmony_ci 1305bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetIntegerv 1315bd8deadSopenharmony_ci 1325bd8deadSopenharmony_ci COVERAGE_BUFFERS_NV 0x8ED3 1335bd8deadSopenharmony_ci COVERAGE_SAMPLES_NV 0x8ED4 1345bd8deadSopenharmony_ci 1355bd8deadSopenharmony_ciChanges to Chapter 4 of the OpenGL 2.0 Specification 1365bd8deadSopenharmony_ci 1375bd8deadSopenharmony_ci Insert a new section, after Section 3.2.1 (Multisampling) 1385bd8deadSopenharmony_ci 1395bd8deadSopenharmony_ci "3.2.2 Coverage Sampling 1405bd8deadSopenharmony_ci 1415bd8deadSopenharmony_ci Coverage sampling is a mechanism to antialias all GL primitives: points, 1425bd8deadSopenharmony_ci lines, polygons, bitmaps and images. The technique is similar to 1435bd8deadSopenharmony_ci multisampling, with all primitives being sampled multiple times at each 1445bd8deadSopenharmony_ci pixel, and a sample resolve applied to compute the color values stored 1455bd8deadSopenharmony_ci in the framebuffer's color buffers. As with multisampling, coverage 1465bd8deadSopenharmony_ci sampling resolves color sample and coverage values to a single, displayable 1475bd8deadSopenharmony_ci color each time a pixel is updated, so antialiasing appears to be automatic 1485bd8deadSopenharmony_ci at the application level. Coverage sampling may be used simultaneously 1495bd8deadSopenharmony_ci with multisampling; however, this is not required. 1505bd8deadSopenharmony_ci 1515bd8deadSopenharmony_ci An additional buffer, called the coverage buffer, is added to 1525bd8deadSopenharmony_ci the framebuffer. This buffer stores additional coverage information 1535bd8deadSopenharmony_ci that may be used to produce higher-quality antialiasing than what is 1545bd8deadSopenharmony_ci provided by conventional multisampling. 1555bd8deadSopenharmony_ci 1565bd8deadSopenharmony_ci When the framebuffer includes a multisample buffer (3.5.6), the 1575bd8deadSopenharmony_ci samples contain this coverage information, and the framebuffer 1585bd8deadSopenharmony_ci does not include the coverage buffer. 1595bd8deadSopenharmony_ci 1605bd8deadSopenharmony_ci If the value of COVERAGE_BUFFERS_NV is one, the rasterization of 1615bd8deadSopenharmony_ci all primitives is changed, and is referred to as coverage sample 1625bd8deadSopenharmony_ci rasterization. Otherwise, primitive rasterization is referred to 1635bd8deadSopenharmony_ci as multisample rasterization (if SAMPLE_BUFFERS is one) or 1645bd8deadSopenharmony_ci single-sample rasterization (otherwise). The value of 1655bd8deadSopenharmony_ci COVERAGE_BUFFERS_NV is queried by calling GetIntegerv with <pname> 1665bd8deadSopenharmony_ci set to COVERAGE_BUFFERS_NV. 1675bd8deadSopenharmony_ci 1685bd8deadSopenharmony_ci During coverage sample rasterization the pixel fragment contents 1695bd8deadSopenharmony_ci are modified to include COVERAGE_SAMPLES_NV coverage values. The 1705bd8deadSopenharmony_ci value of COVERAGE_SAMPLES_NV is an implementation-dependent 1715bd8deadSopenharmony_ci constant, and is queried by calling GetIntegerv with <pname> set 1725bd8deadSopenharmony_ci to COVERAGE_SAMPLES_NV. 1735bd8deadSopenharmony_ci 1745bd8deadSopenharmony_ci The command 1755bd8deadSopenharmony_ci 1765bd8deadSopenharmony_ci CoverageOperationNV(enum operation) 1775bd8deadSopenharmony_ci 1785bd8deadSopenharmony_ci may be used to modify the manner in which coverage sampling is 1795bd8deadSopenharmony_ci performed for all primitives. If <operation> is 1805bd8deadSopenharmony_ci COVERAGE_ALL_FRAGMENTS_NV, coverage sampling will be performed and the 1815bd8deadSopenharmony_ci coverage buffer updated for all fragments generated during rasterization. 1825bd8deadSopenharmony_ci If <operation> is COVERAGE_EDGE_FRAGMENTS_NV, coverage sampling will 1835bd8deadSopenharmony_ci only be performed for fragments generated at the edge of the 1845bd8deadSopenharmony_ci primitive (by only updating fragments at the edges of primitives, 1855bd8deadSopenharmony_ci applications may get better visual results when rendering partially 1865bd8deadSopenharmony_ci transparent objects). If <operation> is COVERAGE_AUTOMATIC_NV, 1875bd8deadSopenharmony_ci the GL will automatically select the appropriate coverage operation, 1885bd8deadSopenharmony_ci dependent on the GL blend mode and the use of gl_LastFragColor / 1895bd8deadSopenharmony_ci gl_LastFragData in the bound fragment program. If blending is enabled, 1905bd8deadSopenharmony_ci or gl_LastFragColor / gl_LastFragData appears in the bound fragment 1915bd8deadSopenharmony_ci program, COVERAGE_AUTOMATIC_NV will behave identically to 1925bd8deadSopenharmony_ci COVERAGE_EDGE_FRAGMENTS_NV; otherwise, COVERAGE_AUTOMATIC_NV will behave 1935bd8deadSopenharmony_ci identically to COVERAGE_ALL_FRAGMENTS_NV. The default coverage operation 1945bd8deadSopenharmony_ci is COVERAGE_AUTOMATIC_NV." 1955bd8deadSopenharmony_ci 1965bd8deadSopenharmony_ci Insert a new section, after Section 3.3.3 (Point Multisample 1975bd8deadSopenharmony_ci Rasterization) 1985bd8deadSopenharmony_ci 1995bd8deadSopenharmony_ci "3.3.4 Point Coverage Sample Rasterization 2005bd8deadSopenharmony_ci 2015bd8deadSopenharmony_ci If the value of COVERAGE_BUFFERS_NV is one, then points are 2025bd8deadSopenharmony_ci rasterized using the following algorithm, regardless of whether 2035bd8deadSopenharmony_ci point antialiasing (POINT_SMOOTH) is enabled or disabled. Point 2045bd8deadSopenharmony_ci rasterization produces fragments using the same algorithm described 2055bd8deadSopenharmony_ci in section 3.3.3; however, sample points are divided into SAMPLES 2065bd8deadSopenharmony_ci multisample points and COVERAGE_SAMPLES_NV coverage sample points. 2075bd8deadSopenharmony_ci 2085bd8deadSopenharmony_ci Rasterization for multisample points uses the algorithm described 2095bd8deadSopenharmony_ci in section 3.3.3. Rasterization for coverage sample points uses 2105bd8deadSopenharmony_ci implementation-dependent algorithms, ultimately storing the results 2115bd8deadSopenharmony_ci in the coverage buffer." 2125bd8deadSopenharmony_ci 2135bd8deadSopenharmony_ci Insert a new section, after Section 3.4.4 (Line Multisample 2145bd8deadSopenharmony_ci Rasterization) 2155bd8deadSopenharmony_ci 2165bd8deadSopenharmony_ci "3.4.5 Line Coverage Sample Rasterization 2175bd8deadSopenharmony_ci 2185bd8deadSopenharmony_ci If the value of COVERAGE_BUFFERS_NV is one, then lines are 2195bd8deadSopenharmony_ci rasterized using the following algorithm, regardless of whether 2205bd8deadSopenharmony_ci line antialiasing (LINE_SMOOTH) is enabled or disabled. Line 2215bd8deadSopenharmony_ci rasterization produces fragments using the same algorithm described 2225bd8deadSopenharmony_ci in section 3.4.4; however, sample points are divided into SAMPLES 2235bd8deadSopenharmony_ci multisample points and COVERAGE_SAMPLES_NV coverage sample points. 2245bd8deadSopenharmony_ci 2255bd8deadSopenharmony_ci Rasterization for multisample points uses the algorithm described in 2265bd8deadSopenharmony_ci section 3.4.4. Rasterization for coverage sample points uses 2275bd8deadSopenharmony_ci implementation-dependent algorithms, ultimately storing results in 2285bd8deadSopenharmony_ci the coverage buffer." 2295bd8deadSopenharmony_ci 2305bd8deadSopenharmony_ci Insert a new section, after Section 3.5.6 (Polygon Multisample 2315bd8deadSopenharmony_ci Rasterization) 2325bd8deadSopenharmony_ci 2335bd8deadSopenharmony_ci "3.5.7 Polygon Coverage Sample Rasterization 2345bd8deadSopenharmony_ci 2355bd8deadSopenharmony_ci If the value of COVERAGE_BUFFERS_NV is one, then polygons are 2365bd8deadSopenharmony_ci rasterized using the following algorithm, regardless of whether 2375bd8deadSopenharmony_ci polygon antialiasing (POLYGON_SMOOTH) is enabled or disabled. Polygon 2385bd8deadSopenharmony_ci rasterization produces fragments using the same algorithm described in 2395bd8deadSopenharmony_ci section 3.5.6; however, sample points are divided into SAMPLES multisample 2405bd8deadSopenharmony_ci points and COVERAGE_SAMPLES_NV coverage sample points. 2415bd8deadSopenharmony_ci 2425bd8deadSopenharmony_ci Rasterization for multisample points uses the algorithm described in 2435bd8deadSopenharmony_ci section 3.5.7. Rasterization for coverage sample points uses 2445bd8deadSopenharmony_ci implementation-dependent algorithms, ultimately storing results in the 2455bd8deadSopenharmony_ci coverage buffer." 2465bd8deadSopenharmony_ci 2475bd8deadSopenharmony_ci Insert a new section, after Section 3.6.6 (Pixel Rectangle Multisample 2485bd8deadSopenharmony_ci Rasterization) 2495bd8deadSopenharmony_ci 2505bd8deadSopenharmony_ci "3.6.7 Pixel Rectangle Coverage Sample Rasterization 2515bd8deadSopenharmony_ci 2525bd8deadSopenharmony_ci If the value of COVERAGE_BUFFERS_NV is one, then pixel rectangles are 2535bd8deadSopenharmony_ci rasterized using the algorithm described in section 3.6.6." 2545bd8deadSopenharmony_ci 2555bd8deadSopenharmony_ci Modify the first sentence of the second-to-last paragraph of section 2565bd8deadSopenharmony_ci 3.7 (Bitmaps) to read: 2575bd8deadSopenharmony_ci 2585bd8deadSopenharmony_ci "Bitmap Multisample and Coverage Sample Rasterization 2595bd8deadSopenharmony_ci 2605bd8deadSopenharmony_ci If MULTISAMPLE is enabled, and the value of SAMPLE_BUFFERS is one; 2615bd8deadSopenharmony_ci or if the value of COVERAGE_BUFFERS_NV is one, then bitmaps are 2625bd8deadSopenharmony_ci rasterized using the following algorithm. [...]" 2635bd8deadSopenharmony_ci 2645bd8deadSopenharmony_ci Insert after the first paragraph of Section 4.2.2 (Fine Control of 2655bd8deadSopenharmony_ci Buffer Updates): 2665bd8deadSopenharmony_ci 2675bd8deadSopenharmony_ci "The coverage buffer can be enabled or disabled for writing coverage 2685bd8deadSopenharmony_ci sample values using 2695bd8deadSopenharmony_ci 2705bd8deadSopenharmony_ci void CoverageMaskNV( boolean mask ); 2715bd8deadSopenharmony_ci 2725bd8deadSopenharmony_ci If <mask> is non-zero, the coverage buffer is enabled for writing; 2735bd8deadSopenharmony_ci otherwise, it is disabled. In the initial state, the coverage 2745bd8deadSopenharmony_ci buffer is enabled for writing." 2755bd8deadSopenharmony_ci 2765bd8deadSopenharmony_ci And change the text of the last 2 paragraphs of Section 4.2.2 to read: 2775bd8deadSopenharmony_ci 2785bd8deadSopenharmony_ci "The state required for the various masking operations is three 2795bd8deadSopenharmony_ci integers and two bits: an integer for color indices, an integer for 2805bd8deadSopenharmony_ci the front and back stencil values, a bit for depth values, and a 2815bd8deadSopenharmony_ci bit for coverage sample values. A set of four bits is also required 2825bd8deadSopenharmony_ci indicating which components of an RGBA value should be written. In the 2835bd8deadSopenharmony_ci initial state, the integer masks are all ones, as are the bits 2845bd8deadSopenharmony_ci controlling the depth value, coverage sample value and RGBA component 2855bd8deadSopenharmony_ci writing. 2865bd8deadSopenharmony_ci 2875bd8deadSopenharmony_ci Fine Control of Multisample Buffer Updates 2885bd8deadSopenharmony_ci 2895bd8deadSopenharmony_ci When the value of SAMPLE_BUFFERS is one, ColorMask, DepthMask, 2905bd8deadSopenharmony_ci CoverageMask, and StencilMask or StencilMaskSeparate control the 2915bd8deadSopenharmony_ci modification of values in the multisample buffer. [...]" 2925bd8deadSopenharmony_ci 2935bd8deadSopenharmony_ci Change paragraph 2 of Section 4.2.3 (Clearing the Buffers) to read: 2945bd8deadSopenharmony_ci 2955bd8deadSopenharmony_ci "is the bitwise OR of a number of values indicating which buffers are to 2965bd8deadSopenharmony_ci be cleared. The values are COLOR_BUFFER_BIT, DEPTH_BUFFER_BIT, 2975bd8deadSopenharmony_ci STENCIL_BUFFER_BIT, ACCUM_BUFFER_BIT and COVERAGE_BUFFER_BIT_NV, indicating 2985bd8deadSopenharmony_ci the buffers currently enabled for color writing, the depth buffer, 2995bd8deadSopenharmony_ci the stencil buffer, the accumulation buffer and the virtual-coverage 3005bd8deadSopenharmony_ci buffer, respectively. [...]" 3015bd8deadSopenharmony_ci 3025bd8deadSopenharmony_ci Insert a new paragraph after paragraph 4 of Section 4.3.2 (Reading Pixels) 3035bd8deadSopenharmony_ci (beginning with "If there is a multisample buffer ..."): 3045bd8deadSopenharmony_ci 3055bd8deadSopenharmony_ci "If the <format> is COVERAGE_COMPONENT_NV, then values are taken from the 3065bd8deadSopenharmony_ci coverage buffer; again, if there is no coverage buffer, the error 3075bd8deadSopenharmony_ci INVALID_OPERATION occurs. When <format> is COVERAGE_COMPONENT_NV, 3085bd8deadSopenharmony_ci <type> must be GL_UNSIGNED_BYTE. Any other value for <type> will 3095bd8deadSopenharmony_ci generate the error INVALID_ENUM. If there is a multisample buffer, the 3105bd8deadSopenharmony_ci values are undefined." 3115bd8deadSopenharmony_ci 3125bd8deadSopenharmony_ci 3135bd8deadSopenharmony_ci 3145bd8deadSopenharmony_ciModifications to the OES_framebuffer_object specification 3155bd8deadSopenharmony_ci 3165bd8deadSopenharmony_ci Add a new table at the end of Section 4.4.2.1 (Renderbuffer Objects) 3175bd8deadSopenharmony_ci 3185bd8deadSopenharmony_ci "+-------------------------+-----------------------+-----------+ 3195bd8deadSopenharmony_ci | Sized internal format | Base Internal Format | C Samples | 3205bd8deadSopenharmony_ci +-------------------------+-----------------------+-----------+ 3215bd8deadSopenharmony_ci | COVERAGE_COMPONENT4_NV | COVERAGE_COMPONENT_NV | 4 | 3225bd8deadSopenharmony_ci +-------------------------+-----------------------+-----------+ 3235bd8deadSopenharmony_ci Table 1.ooo Desired component resolution for each sized internal 3245bd8deadSopenharmony_ci format that can be used only with renderbuffers" 3255bd8deadSopenharmony_ci 3265bd8deadSopenharmony_ci Add to the bullet list in Section 4.4.4 (Framebuffer Completeness) 3275bd8deadSopenharmony_ci 3285bd8deadSopenharmony_ci "An internal format is 'coverage-renderable' if it is COVERAGE_COMPONENT_NV 3295bd8deadSopenharmony_ci or one of the COVERAGE_COMPONENT_NV formats from table 1.ooo. No other 3305bd8deadSopenharmony_ci formats are coverage-renderable" 3315bd8deadSopenharmony_ci 3325bd8deadSopenharmony_ci Add to the bullet list in Section 4.4.4.1 (Framebuffer Attachment 3335bd8deadSopenharmony_ci Completeness) 3345bd8deadSopenharmony_ci 3355bd8deadSopenharmony_ci "If <attachment> is COVERAGE_ATTACHMENT_NV, then <image> must have a 3365bd8deadSopenharmony_ci coverage-renderable internal format." 3375bd8deadSopenharmony_ci 3385bd8deadSopenharmony_ci Add a paragraph at the end of Section 4.4.4.2 (Framebuffer Completeness) 3395bd8deadSopenharmony_ci 3405bd8deadSopenharmony_ci "The values of COVERAGE_BUFFERS_NV and COVERAGE_SAMPLES_NV are derived from 3415bd8deadSopenharmony_ci the attachments of the currently bound framebuffer object. If the current 3425bd8deadSopenharmony_ci FRAMEBUFFER_BINDING_OES is not 'framebuffer-complete', then both 3435bd8deadSopenharmony_ci COVERAGE_BUFFERS_NV and COVERAGE_SAMPLES_NV are undefined. Otherwise, 3445bd8deadSopenharmony_ci COVERAGE_SAMPLES_NV is equal to the number of coverage samples for the 3455bd8deadSopenharmony_ci image attached to COVERAGE_ATTACHMENT_NV, or zero if COVERAGE_ATTACHMENT_NV 3465bd8deadSopenharmony_ci is zero." 3475bd8deadSopenharmony_ci 3485bd8deadSopenharmony_ciAdditions to the EGL 1.2 Specification 3495bd8deadSopenharmony_ci 3505bd8deadSopenharmony_ci Add to Table 3.1 (EGLConfig attributes) 3515bd8deadSopenharmony_ci +---------------------------+---------+-----------------------------------+ 3525bd8deadSopenharmony_ci | Attribute | Type | Notes | 3535bd8deadSopenharmony_ci +---------------------------+---------+-----------------------------------+ 3545bd8deadSopenharmony_ci | EGL_COVERAGE_BUFFERS_NV | integer | number of coverage buffers | 3555bd8deadSopenharmony_ci | EGL_COVERAGE_SAMPLES_NV | integer | number of coverage samples per | 3565bd8deadSopenharmony_ci | | | pixel | 3575bd8deadSopenharmony_ci +---------------------------+---------+-----------------------------------+ 3585bd8deadSopenharmony_ci 3595bd8deadSopenharmony_ci Modify the first sentence of the last paragraph of the "Buffer 3605bd8deadSopenharmony_ci Descriptions and Attributes" subsection of Section 3.4 (Configuration 3615bd8deadSopenharmony_ci Management), p. 16 3625bd8deadSopenharmony_ci 3635bd8deadSopenharmony_ci "There are no single-sample depth, stencil or coverage buffers for a 3645bd8deadSopenharmony_ci multisample EGLConfig; the only depth, stencil and coverage buffers are 3655bd8deadSopenharmony_ci those in the multisample buffer. [...]" 3665bd8deadSopenharmony_ci 3675bd8deadSopenharmony_ci And add the following text at the end of that paragraph: 3685bd8deadSopenharmony_ci 3695bd8deadSopenharmony_ci "The <coverage buffer> is used only by OpenGL ES. It contains primitive 3705bd8deadSopenharmony_ci coverage information that is used to produce a high-quality anti-aliased 3715bd8deadSopenharmony_ci image. The format of the coverage buffer is not specified, and its 3725bd8deadSopenharmony_ci contents are not directly accessible. Only the existence of the coverage 3735bd8deadSopenharmony_ci buffer, and the number of coverage samples it contains, are exposed by EGL. 3745bd8deadSopenharmony_ci 3755bd8deadSopenharmony_ci EGL_COVERAGE_BUFFERS_NV indicates the number of coverage buffers, which 3765bd8deadSopenharmony_ci must be zero or one. EGL_COVERAGE_SAMPLES_NV gives the number of coverage 3775bd8deadSopenharmony_ci samples per pixel; if EGL_COVERAGE_BUFFERS_NV is zero, then 3785bd8deadSopenharmony_ci EGL_COVERAGE_SAMPLES_NV will also be zero." 3795bd8deadSopenharmony_ci 3805bd8deadSopenharmony_ci Add to Table 3.4 (Default values and match criteria for EGLConfig 3815bd8deadSopenharmony_ci attributes) 3825bd8deadSopenharmony_ci 3835bd8deadSopenharmony_ci +---------------------------+-----------+-------------+---------+---------+ 3845bd8deadSopenharmony_ci | Attribute | Default | Selection | Sort | Sort | 3855bd8deadSopenharmony_ci | | | Criteria | Order | Priority| 3865bd8deadSopenharmony_ci +---------------------------+-----------+-------------+---------+---------+ 3875bd8deadSopenharmony_ci | EGL_COVERAGE_BUFFERS_NV | 0 | At Least | Smaller | 7 | 3885bd8deadSopenharmony_ci | EGL_COVERAGE_SAMPLES_NV | 0 | At Least | Smaller | 8 | 3895bd8deadSopenharmony_ci +---------------------------+-----------+-------------+---------+---------+ 3905bd8deadSopenharmony_ci And renumber existing sort priorities 7-11 as 9-13. 3915bd8deadSopenharmony_ci 3925bd8deadSopenharmony_ci Modify the list in "Sorting of EGLConfigs" (Section 3.4.1, pg 20) 3935bd8deadSopenharmony_ci 3945bd8deadSopenharmony_ci " [...] 3955bd8deadSopenharmony_ci 5. Smaller EGL_SAMPLE_BUFFERS 3965bd8deadSopenharmony_ci 6. Smaller EGL_SAMPLES 3975bd8deadSopenharmony_ci 7. Smaller EGL_COVERAGE_BUFFERS_NV 3985bd8deadSopenharmony_ci 8. Smaller EGL_COVERAGE_SAMPLES_NV 3995bd8deadSopenharmony_ci 9. Smaller EGL_DEPTH_SIZE 4005bd8deadSopenharmony_ci 10. Smaller EGL_STENCIL_SIZE 4015bd8deadSopenharmony_ci 11. Smaller EGL_ALPHA_MASK_SIZE 4025bd8deadSopenharmony_ci 12. Special: [...] 4035bd8deadSopenharmony_ci 13. Smaller EGL_CONFIG_ID [...]" 4045bd8deadSopenharmony_ci 4055bd8deadSopenharmony_ciUsage Examples 4065bd8deadSopenharmony_ci 4075bd8deadSopenharmony_ci (1) Basic Coverage Sample Rasterization 4085bd8deadSopenharmony_ci 4095bd8deadSopenharmony_ci glCoverageMaskNV(GL_TRUE); 4105bd8deadSopenharmony_ci glDepthMask(GL_TRUE); 4115bd8deadSopenharmony_ci glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 4125bd8deadSopenharmony_ci 4135bd8deadSopenharmony_ci while (1) 4145bd8deadSopenharmony_ci { 4155bd8deadSopenharmony_ci glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | 4165bd8deadSopenharmony_ci GL_COVERAGE_BUFFER_BIT_NV); 4175bd8deadSopenharmony_ci glDrawElements(...); 4185bd8deadSopenharmony_ci eglSwapBuffers(...); 4195bd8deadSopenharmony_ci } 4205bd8deadSopenharmony_ci 4215bd8deadSopenharmony_ci (2) Multi-Pass Rendering Algorithms 4225bd8deadSopenharmony_ci 4235bd8deadSopenharmony_ci while (1) 4245bd8deadSopenharmony_ci { 4255bd8deadSopenharmony_ci glDepthMask(GL_TRUE); 4265bd8deadSopenharmony_ci glCoverageMaskNV(GL_TRUE); 4275bd8deadSopenharmony_ci glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 4285bd8deadSopenharmony_ci glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | 4295bd8deadSopenharmony_ci GL_COVERAGE_BUFFER_BIT_NV); 4305bd8deadSopenharmony_ci 4315bd8deadSopenharmony_ci // first render pass: render Z-only (occlusion surface), with 4325bd8deadSopenharmony_ci // coverage info. color writes are disabled 4335bd8deadSopenharmony_ci 4345bd8deadSopenharmony_ci glCoverageMaskNV(GL_TRUE); 4355bd8deadSopenharmony_ci glDepthMask(GL_TRUE); 4365bd8deadSopenharmony_ci glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); 4375bd8deadSopenharmony_ci glDepthFunc(GL_LESS); 4385bd8deadSopenharmony_ci glDrawElements(...); 4395bd8deadSopenharmony_ci 4405bd8deadSopenharmony_ci // second render pass: set Z test to Z-equals, disable Z-writes & 4415bd8deadSopenharmony_ci // coverage writes. enable color writes. coverage may be 4425bd8deadSopenharmony_ci // disabled, because subsequent rendering passes are rendering 4435bd8deadSopenharmony_ci // identical geometry -- since the final coverage buffer will be 4445bd8deadSopenharmony_ci // unchanged, we can disable coverage writes as an optimization. 4455bd8deadSopenharmony_ci 4465bd8deadSopenharmony_ci glCoverageMaskNV(GL_FALSE); 4475bd8deadSopenharmony_ci glDepthMask(GL_FALSE); 4485bd8deadSopenharmony_ci glDepthFunc(GL_EQUAL); 4495bd8deadSopenharmony_ci glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 4505bd8deadSopenharmony_ci glDrawElements(...); 4515bd8deadSopenharmony_ci 4525bd8deadSopenharmony_ci eglSwapBuffers(); 4535bd8deadSopenharmony_ci } 4545bd8deadSopenharmony_ci 4555bd8deadSopenharmony_ci (3) Rendering Translucent Objects on Top of Opaque Objects 4565bd8deadSopenharmony_ci 4575bd8deadSopenharmony_ci while (1) 4585bd8deadSopenharmony_ci { 4595bd8deadSopenharmony_ci glDepthMask(GL_TRUE); 4605bd8deadSopenharmony_ci glCoverageMaskNV(GL_TRUE); 4615bd8deadSopenharmony_ci glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 4625bd8deadSopenharmony_ci glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | 4635bd8deadSopenharmony_ci GL_COVERAGE_BUFFER_BIT_NV); 4645bd8deadSopenharmony_ci 4655bd8deadSopenharmony_ci // render opaque, Z-buffered geometry with coverage info for the 4665bd8deadSopenharmony_ci // entire primitive. Overwrite coverage data for all fragments, so 4675bd8deadSopenharmony_ci // that interior fragments do not get resolved incorrectly. 4685bd8deadSopenharmony_ci 4695bd8deadSopenharmony_ci glDepthFunc(GL_LESS); 4705bd8deadSopenharmony_ci glCoverageOperationNV(GL_COVERAGE_ALL_FRAGMENTS_NV); 4715bd8deadSopenharmony_ci glDrawElements(...); 4725bd8deadSopenharmony_ci 4735bd8deadSopenharmony_ci // render translucent, Z-buffered geometry. to ensure that visible 4745bd8deadSopenharmony_ci // edges of opaque geometry remain anti-aliased, change the 4755bd8deadSopenharmony_ci // coverage operation to just edge fragments. this will maintain 4765bd8deadSopenharmony_ci // the coverage information underneath the translucent geometry, 4775bd8deadSopenharmony_ci // except at translucent edges. 4785bd8deadSopenharmony_ci 4795bd8deadSopenharmony_ci glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 4805bd8deadSopenharmony_ci glCoverageOperationNV(GL_COVERAGE_EDGE_FRAGMENTS_NV); 4815bd8deadSopenharmony_ci glEnable(GL_BLEND); 4825bd8deadSopenharmony_ci glDrawElements(...); 4835bd8deadSopenharmony_ci glDisable(GL_BLEND); 4845bd8deadSopenharmony_ci 4855bd8deadSopenharmony_ci eglSwapBuffers(); 4865bd8deadSopenharmony_ci } 4875bd8deadSopenharmony_ci 4885bd8deadSopenharmony_ci (4) Rendering Opacity-Mapped Particle Systems & HUDs on Top of Opaque 4895bd8deadSopenharmony_ci Geometry 4905bd8deadSopenharmony_ci 4915bd8deadSopenharmony_ci while (1) 4925bd8deadSopenharmony_ci { 4935bd8deadSopenharmony_ci glDepthMask(GL_TRUE); 4945bd8deadSopenharmony_ci glCoverageMaskNV(GL_TRUE); 4955bd8deadSopenharmony_ci glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 4965bd8deadSopenharmony_ci glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | 4975bd8deadSopenharmony_ci GL_COVERAGE_BUFFER_BIT_NV); 4985bd8deadSopenharmony_ci 4995bd8deadSopenharmony_ci // render opaque, Z-buffered geometry, with coverage info. 5005bd8deadSopenharmony_ci glDepthFunc(GL_LESS); 5015bd8deadSopenharmony_ci glDrawElements(...); 5025bd8deadSopenharmony_ci 5035bd8deadSopenharmony_ci // render opacity-mapped geometry. disable Z writes, enable alpha 5045bd8deadSopenharmony_ci // blending. also, disable coverage writes -- the edges of the 5055bd8deadSopenharmony_ci // geometry used for the HUD/particle system have alpha values 5065bd8deadSopenharmony_ci // tapering to zero, so edge coverage is uninteresting, and 5075bd8deadSopenharmony_ci // interior coverage should still refer to the underlying opaque 5085bd8deadSopenharmony_ci // geometry, so that opaque edges visible through the translucent 5095bd8deadSopenharmony_ci // regions remain anti-aliased. 5105bd8deadSopenharmony_ci 5115bd8deadSopenharmony_ci glCoverageMaskNV(GL_FALSE); 5125bd8deadSopenharmony_ci glDepthMask(GL_FALSE); 5135bd8deadSopenharmony_ci glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 5145bd8deadSopenharmony_ci glEnable(GL_BLEND); 5155bd8deadSopenharmony_ci glDrawElements(...); 5165bd8deadSopenharmony_ci glDisable(GL_BLEND); 5175bd8deadSopenharmony_ci 5185bd8deadSopenharmony_ci eglSwapBuffers(); 5195bd8deadSopenharmony_ci } 5205bd8deadSopenharmony_ci 5215bd8deadSopenharmony_ci 5225bd8deadSopenharmony_ciIssues 5235bd8deadSopenharmony_ci 5245bd8deadSopenharmony_ci 1. Is any specific discussion of coverage sampling resolves required, 5255bd8deadSopenharmony_ci particularly with respect to application-provided framebuffer objects? 5265bd8deadSopenharmony_ci 5275bd8deadSopenharmony_ci RESOLVED: No. Because the coverage sampling resolve is an 5285bd8deadSopenharmony_ci implementation-dependent algorithm, it is always legal behavior for 5295bd8deadSopenharmony_ci framebuffer read / copy functions to return the value in the selected 5305bd8deadSopenharmony_ci ReadBuffer as if COVERAGE_BUFFERS_NV was zero. This allows 5315bd8deadSopenharmony_ci textures attached to the color attachment points of framebuffer objects 5325bd8deadSopenharmony_ci to behave predictably, even when COVERAGE_BUFFERS_NV is one. 5335bd8deadSopenharmony_ci 5345bd8deadSopenharmony_ci Implementations are encouraged, whenever possible, to use the highest- 5355bd8deadSopenharmony_ci quality coverage sample resolve supported for calls to eglSwapBuffers, 5365bd8deadSopenharmony_ci eglCopyBuffers, ReadPixels, CopyPixels and CopyTex{Sub}Image. 5375bd8deadSopenharmony_ci 5385bd8deadSopenharmony_ci 2. Should all render buffer & texture types be legal sources for image 5395bd8deadSopenharmony_ci resolves and coverage attachment? 5405bd8deadSopenharmony_ci 5415bd8deadSopenharmony_ci RESOLVED: This spec should not place any arbitrary limits on usage; 5425bd8deadSopenharmony_ci however, there are many reasons why implementers may not wish to 5435bd8deadSopenharmony_ci support coverage sampling for all surface types. 5445bd8deadSopenharmony_ci 5455bd8deadSopenharmony_ci Implementations may return FRAMEBUFFER_UNSUPPORTED_OES from 5465bd8deadSopenharmony_ci CheckFramebufferStatusOES if an object bound to COVERAGE_ATTACHMENT_NV 5475bd8deadSopenharmony_ci is incompatible with one or more objects bound to DEPTH_ATTACHMENT_OES, 5485bd8deadSopenharmony_ci STENCIL_ATTACHMENT_OES, or COLOR_ATTACHMENTi_OES. 5495bd8deadSopenharmony_ci 5505bd8deadSopenharmony_ciRevision History 5515bd8deadSopenharmony_ci 5525bd8deadSopenharmony_ci#1.0 - 20.03.2007 5535bd8deadSopenharmony_ci 5545bd8deadSopenharmony_ci Renumbered enumerants. Reformatted to 80 columns. 555