15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci NV_path_rendering_shared_edge 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_NV_path_rendering_shared_edge 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Mark Kilgard, NVIDIA (mjk 'at' nvidia.com) 125bd8deadSopenharmony_ci Jeff Bolz, NVIDIA (jbolz 'at' nvidia.com) 135bd8deadSopenharmony_ci 145bd8deadSopenharmony_ciContributors 155bd8deadSopenharmony_ci 165bd8deadSopenharmony_ci Michael Chock, NVIDIA (mchock 'at' nvidia.com) 175bd8deadSopenharmony_ci 185bd8deadSopenharmony_ciStatus 195bd8deadSopenharmony_ci 205bd8deadSopenharmony_ci Shipping 215bd8deadSopenharmony_ci 225bd8deadSopenharmony_ciVersion 235bd8deadSopenharmony_ci 245bd8deadSopenharmony_ci Last Modified Date: March 27, 2015 255bd8deadSopenharmony_ci Version: 2 265bd8deadSopenharmony_ci 275bd8deadSopenharmony_ciNumber 285bd8deadSopenharmony_ci 295bd8deadSopenharmony_ci OpenGL Extension #471 305bd8deadSopenharmony_ci OpenGL ES Extension #234 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ciDependencies 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ci This extension is written against the OpenGL 4.3 (Compatibility) 355bd8deadSopenharmony_ci Specification but can apply to OpenGL 1.1 and OpenGL ES 2.0 and up. 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ci This extension requires NV_path_rendering. 385bd8deadSopenharmony_ci 395bd8deadSopenharmony_ciOverview 405bd8deadSopenharmony_ci 415bd8deadSopenharmony_ci This extension introduces a new path command modifier to the 425bd8deadSopenharmony_ci NV_path_rendering extension to indicate that a path command represents an 435bd8deadSopenharmony_ci edge (either straight or curved) that is shared with another path. 445bd8deadSopenharmony_ci 455bd8deadSopenharmony_ci When used in conjunction with NV_framebuffer_mixed_samples, a shared edge 465bd8deadSopenharmony_ci (or a whole path including shared edges) will use modified rasterization 475bd8deadSopenharmony_ci rules in order to ensure that groups of raster samples associated with a 485bd8deadSopenharmony_ci given coverage sample will all produce consistent coverage results, in 495bd8deadSopenharmony_ci order to avoid artifacts described further in the issues section at the 505bd8deadSopenharmony_ci end of this document. 515bd8deadSopenharmony_ci 525bd8deadSopenharmony_ciNew Procedures and Functions 535bd8deadSopenharmony_ci 545bd8deadSopenharmony_ci None. 555bd8deadSopenharmony_ci 565bd8deadSopenharmony_ciNew Tokens 575bd8deadSopenharmony_ci 585bd8deadSopenharmony_ci Allowed to be added to command tokens in elements of the <commands> 595bd8deadSopenharmony_ci array parameter of PathCommandsNV and PathSubCommandsNV: 605bd8deadSopenharmony_ci 615bd8deadSopenharmony_ci SHARED_EDGE_NV 0xC0 625bd8deadSopenharmony_ci 635bd8deadSopenharmony_ci 645bd8deadSopenharmony_ciModify Section 5.X "Path Rendering" from the NV_path_rendering extension: 655bd8deadSopenharmony_ci 665bd8deadSopenharmony_ci Add to the end of Section 5.X.1 (Path Specification) 675bd8deadSopenharmony_ci 685bd8deadSopenharmony_ci When the value of SHARED_EDGE_NV is bitwise exclusive-ORed with any of the 695bd8deadSopenharmony_ci path command tokens in Table 5.pathCommands (but not the character 705bd8deadSopenharmony_ci aliases), the path outline generated by this path command is considered a 715bd8deadSopenharmony_ci "shared" version of the original command. When such paths are stenciled 725bd8deadSopenharmony_ci (see section 5.X.2.1), coverage for groups of raster samples corresponding 735bd8deadSopenharmony_ci to the same color sample must be produce the same result (i.e. must all be 745bd8deadSopenharmony_ci covered or all be uncovered) with respect to this particular path command's 755bd8deadSopenharmony_ci contour edge. Depending on the implementation, this modified coverage 765bd8deadSopenharmony_ci determination may be applied to all edges in a path if that path contains 775bd8deadSopenharmony_ci any shared edges. When such paths are covered, groups of raster samples 785bd8deadSopenharmony_ci may also be treated the same way (i.e. altering properties of some samples 795bd8deadSopenharmony_ci in order to produce the same coverage for all samples in the group). 805bd8deadSopenharmony_ci 815bd8deadSopenharmony_ci 825bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications 835bd8deadSopenharmony_ci 845bd8deadSopenharmony_ci None 855bd8deadSopenharmony_ci 865bd8deadSopenharmony_ciAdditions to the OpenGL Shading Language 875bd8deadSopenharmony_ci 885bd8deadSopenharmony_ci None 895bd8deadSopenharmony_ci 905bd8deadSopenharmony_ciGLX Protocol 915bd8deadSopenharmony_ci 925bd8deadSopenharmony_ci None 935bd8deadSopenharmony_ci 945bd8deadSopenharmony_ciErrors 955bd8deadSopenharmony_ci 965bd8deadSopenharmony_ci None 975bd8deadSopenharmony_ci 985bd8deadSopenharmony_ciIssues 995bd8deadSopenharmony_ci 1005bd8deadSopenharmony_ci 1. What is the GL_SHARED_EDGE_NV value for? 1015bd8deadSopenharmony_ci 1025bd8deadSopenharmony_ci RESOLVED: Path rendering sometimes requires subregions of two 1035bd8deadSopenharmony_ci paths to be drawn such that they are "watertight". This means 1045bd8deadSopenharmony_ci that the color samples along this shared contour should not have 1055bd8deadSopenharmony_ci any coverage gaps or double hits. 1065bd8deadSopenharmony_ci 1075bd8deadSopenharmony_ci The problem with mixed sample frequencies is that fractional 1085bd8deadSopenharmony_ci coverage is computed as a result of the stencil test. A color 1095bd8deadSopenharmony_ci sample might be 25% covered by one path command edge of path X 1105bd8deadSopenharmony_ci and then 75% covered by the identical path command edge of path 1115bd8deadSopenharmony_ci Y such that path X covers the "righthand" side of the color 1125bd8deadSopenharmony_ci sample and path Y covers the "lefthand" side of the color sample. 1135bd8deadSopenharmony_ci Such situations can cause an artifact known as "conflation" 1145bd8deadSopenharmony_ci that allows a background color to "leak through" the edge when 1155bd8deadSopenharmony_ci the edge is intended by the content creator (often an artist or 1165bd8deadSopenharmony_ci perhaps a path preprocessing tools) to allow no such leakage. 1175bd8deadSopenharmony_ci 1185bd8deadSopenharmony_ci Consider the watertight edge when the background color is RED 1195bd8deadSopenharmony_ci (1,0,0,1), path X's color is GREEN (0,1,0,1), and path Y's 1205bd8deadSopenharmony_ci color is BLUE (0,0,1,1). If we draw path X first, we get 25% 1215bd8deadSopenharmony_ci GREEN and 75% RED (the background color) composited into the 1225bd8deadSopenharmony_ci framebuffer assuming a GL_ONE,GL_ONE_MINUS_SRC_ALPHA blend mode 1235bd8deadSopenharmony_ci with the GL_RGBA coverage modulation mode. The result is 1245bd8deadSopenharmony_ci (0.75,0.25,0.0,1.0). Now if we draw path Y first, we get 1255bd8deadSopenharmony_ci 75% BLUE and 25% of (0.75,0.25,0.0,1.0). This result is 1265bd8deadSopenharmony_ci (0.1875,0.0625,0.75,1). 1275bd8deadSopenharmony_ci 1285bd8deadSopenharmony_ci However the arguably "correct" watertight result is 1295bd8deadSopenharmony_ci (0,0.25,0.75,1). The problem is if we process path X and path Y 1305bd8deadSopenharmony_ci in separate passes, we risk "blending" in some of the background 1315bd8deadSopenharmony_ci color. The source of this artifact is the assumption that we 1325bd8deadSopenharmony_ci can translate boolean per-sample coverage into a "fractional" 1335bd8deadSopenharmony_ci coverage value. 1345bd8deadSopenharmony_ci 1355bd8deadSopenharmony_ci Note that this situation occurs even when the paths being rendered 1365bd8deadSopenharmony_ci (X and Y in this example) are 100% opaque. 1375bd8deadSopenharmony_ci 1385bd8deadSopenharmony_ci At the cost of losing some sub-color sample coverage determination 1395bd8deadSopenharmony_ci accuracy, we can avoid this artifact by marking as a "shared 1405bd8deadSopenharmony_ci edge" path commands that are intended to be watertight with 1415bd8deadSopenharmony_ci edges of the identical path command in another path object. 1425bd8deadSopenharmony_ci When such commands are encountered, coverage computations done 1435bd8deadSopenharmony_ci by NV_path_rendering can be careful to decide the coverage of 1445bd8deadSopenharmony_ci secondary samples with respect to this path edge identically to 1455bd8deadSopenharmony_ci their respective primary sample. This ensures the coverage (at 1465bd8deadSopenharmony_ci least with respect to this particular edge) is either 0% or 100%. 1475bd8deadSopenharmony_ci 1485bd8deadSopenharmony_ci Note that unshared edges from path commands not marked as shared 1495bd8deadSopenharmony_ci by the addition of the GL_SHARED_EDGE_NV value are processed 1505bd8deadSopenharmony_ci at the effective raster sample rate. This ensures that edges of 1515bd8deadSopenharmony_ci the path retain a high level of antialiasing quality. 1525bd8deadSopenharmony_ci 1535bd8deadSopenharmony_ci This capability is most interesting to path rendering standards 1545bd8deadSopenharmony_ci such as Flash. 1555bd8deadSopenharmony_ci 1565bd8deadSopenharmony_ci 2. Should the GL_SHARED_EDGE_NV value be bit that can be bitwise 1575bd8deadSopenharmony_ci ORed into a path command? 1585bd8deadSopenharmony_ci 1595bd8deadSopenharmony_ci RESOLVED: No. Instead the GL_SHADED_EDGE_NV value of 0xC0 1605bd8deadSopenharmony_ci (192) should be exclusive-ORed (^) to construct path commands 1615bd8deadSopenharmony_ci with a shared edge. 1625bd8deadSopenharmony_ci 1635bd8deadSopenharmony_ci Rationale: The NV_path_rendering assignment of 8-bit token 1645bd8deadSopenharmony_ci values is arranged to match OpenVG for commands OpenVG supports 1655bd8deadSopenharmony_ci and numbers the non-OpenVG commands downward from 255 so there is 1665bd8deadSopenharmony_ci not a bit value to bitwise OR (or even add) that guarantees 1675bd8deadSopenharmony_ci unique values, particularly considering the character alias values 1685bd8deadSopenharmony_ci (such as 'C' for GL_CUBIC_CURVE_TO_NV). 1695bd8deadSopenharmony_ci 1705bd8deadSopenharmony_ci Bitwise exclusive-ORing with 0xC0 does provide unique values 1715bd8deadSopenharmony_ci for all current (and expected future) path command tokens. 1725bd8deadSopenharmony_ci 1735bd8deadSopenharmony_ci 1745bd8deadSopenharmony_ci 3. The SVG and PostScript path string grammars don't have a way to 1755bd8deadSopenharmony_ci express shared edges. Is this a problem? 1765bd8deadSopenharmony_ci 1775bd8deadSopenharmony_ci RESOLVED: No. We support these grammars "as is" from SVG and 1785bd8deadSopenharmony_ci PostScript. These standards don't really have a way to convey 1795bd8deadSopenharmony_ci shared edges in paths as Flash shapes allow. 1805bd8deadSopenharmony_ci 1815bd8deadSopenharmony_ci 4. What does GL_MOVE_TO_NV^GL_SHARED_EDGE_NV mean? 1825bd8deadSopenharmony_ci 1835bd8deadSopenharmony_ci RESOLVED: Bitwise exclusive-ORing GL_SHARED_EDGE_NV works for 1845bd8deadSopenharmony_ci any legal path token. 1855bd8deadSopenharmony_ci 1865bd8deadSopenharmony_ci GL_MOVE_TO_NV+GL_SHARED_EDGE_NV means the same as GL_MOVE_TO_NV 1875bd8deadSopenharmony_ci because the GL_MOVE_TO_NV don't really generate an edge (and 1885bd8deadSopenharmony_ci likewise for its variant GL_RELATIVE_MOVE_TO_NV). 1895bd8deadSopenharmony_ci 1905bd8deadSopenharmony_ci Yes, it is legal. 1915bd8deadSopenharmony_ci 1925bd8deadSopenharmony_ci 5. What about 'C'+GL_SHARED_EDGE_NV? Are these allowed? 1935bd8deadSopenharmony_ci 1945bd8deadSopenharmony_ci RESOLVED: No. 1955bd8deadSopenharmony_ci 1965bd8deadSopenharmony_ci Character aliases don't support the bitwise exclusive-ORing of 1975bd8deadSopenharmony_ci GL_SHARED_EDGE_NV. This is to reduce the risk of collisions 1985bd8deadSopenharmony_ci with character aliases and future path commands. 1995bd8deadSopenharmony_ci 2005bd8deadSopenharmony_ci 2015bd8deadSopenharmony_ciRevision History 2025bd8deadSopenharmony_ci 2035bd8deadSopenharmony_ci Revision 2, 2015/03/27 2045bd8deadSopenharmony_ci - Add ES interactions 2055bd8deadSopenharmony_ci 2065bd8deadSopenharmony_ci Revision 1 2075bd8deadSopenharmony_ci - Internal revisions. 208