Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 Name | 1 Name |
| 2 | 2 |
| 3 CHROMIUM_path_rendering | 3 CHROMIUM_path_rendering |
| 4 | 4 |
| 5 Name Strings | 5 Name Strings |
| 6 | 6 |
| 7 GL_CHROMIUM_path_rendering | 7 GL_CHROMIUM_path_rendering |
| 8 | 8 |
| 9 Version | 9 Version |
| 10 | 10 |
| 11 Last Modifed Date: August 14, 2014 | 11 Last Modifed Date: August 14, 2014 |
| 12 | 12 |
| 13 Dependencies | 13 Dependencies |
| 14 | 14 |
| 15 OpenGL ES 3.0 is required. | 15 OpenGL ES 3.0 is required. |
| 16 | 16 |
| 17 Overview | 17 Overview |
| 18 | 18 |
| 19 This extensions implements path rendering using | 19 This extensions implements path rendering using |
| 20 OpenGL API. | 20 OpenGL API. |
| 21 | 21 |
| 22 New Tokens | 22 New Tokens |
| 23 | 23 |
| 24 Accepted by the <matrixMode> parameter of MatrixLoadfCHROMIUM and | 24 Accepted by the <matrixMode> parameter of MatrixLoadfCHROMIUM and |
| 25 MatrixLoadIdentityCHROMIUM: | 25 MatrixLoadIdentityCHROMIUM: |
| 26 PATH_MODELVIEW_CHROMIUM 0x1700 | 26 PATH_MODELVIEW_CHROMIUM 0x1700 |
| 27 PATH_PROJECTION_CHROMIUM 0x1701 | 27 PATH_PROJECTION_CHROMIUM 0x1701 |
| 28 | 28 |
| 29 Accepted in elements of the <commands> array parameter of | |
| 30 PathCommandsCHROMIUM: | |
| 31 CLOSE_PATH_CHROMIUM 0x00 | |
| 32 MOVE_TO_CHROMIUM 0x02 | |
| 33 LINE_TO_CHROMIUM 0x04 | |
| 34 QUADRATIC_CURVE_TO_CHROMIUM 0x0A | |
| 35 CUBIC_CURVE_TO_CHROMIUM 0x0C | |
| 36 CONIC_CURVE_TO_CHROMIUM 0x1A | |
| 37 | |
| 29 Accepted by the <pname> parameter of GetIntegerv, | 38 Accepted by the <pname> parameter of GetIntegerv, |
| 30 GetFloatv: | 39 GetFloatv: |
| 31 PATH_MODELVIEW_MATRIX_CHROMIUM 0x0BA6 | 40 PATH_MODELVIEW_MATRIX_CHROMIUM 0x0BA6 |
| 32 PATH_PROJECTION_MATRIX_CHROMIUM 0x0BA7 | 41 PATH_PROJECTION_MATRIX_CHROMIUM 0x0BA7 |
| 33 | 42 |
| 43 Accepted by the <pname> parameter of PathParameter{if}CHROMIUM: | |
| 44 PATH_STROKE_WIDTH_CHROMIUM 0x9075 | |
| 45 PATH_END_CAPS_CHROMIUM 0x9076 | |
| 46 PATH_JOIN_STYLE_CHROMIUM 0x9079 | |
| 47 PATH_MITER_LIMIT_CHROMIUM 0x907a | |
| 48 PATH_STROKE_BOUND_CHROMIUM 0x9086 | |
| 49 | |
| 50 Accepted by the <value> parameter of PathParameter{if}CHROMIUM: | |
| 51 FLAT_CHROMIUM 0x1D00 | |
| 52 SQUARE_CHROMIUM 0x90a3 | |
| 53 ROUND_CHROMIUM 0x90a4 | |
| 54 BEVEL_CHROMIUM 0x90A6 | |
| 55 MITER_REVERT_CHROMIUM 0x90A7 | |
| 56 | |
| 57 Accepted by the <fillMode> parameter of StencilFillPathCHROMIUM: | |
| 58 COUNT_UP_CHROMIUM 0x9088 | |
| 59 COUNT_DOWN_CHROMIUM 0x9089 | |
| 60 | |
| 61 Accepted by the <coverMode> parameter of CoverFillPathCHROMIUM, | |
| 62 CoverStrokePath, StencilThenCoverFillPathCHROMIUM and | |
| 63 StencilThenCoverStrokePathCHROMIUM: | |
| 64 CONVEX_HULL_CHROMIUM 0x908B | |
| 65 BOUNDING_BOX_CHROMIUM 0x908D | |
| 66 | |
| 34 | 67 |
| 35 New Procedures and Functions | 68 New Procedures and Functions |
| 36 | 69 |
| 37 void MatrixLoadfCHROMIUM(enum matrixMode, float* matrix) | 70 void MatrixLoadfCHROMIUM(enum matrixMode, float* matrix) |
| 38 | 71 |
| 39 Takes a pointer to a 4x4 matrix stored in column-major order as 16 | 72 Takes a pointer to a 4x4 matrix stored in column-major order as 16 |
| 40 consecutive floating-point values. The matrixMode specifies which | 73 consecutive floating-point values. The matrixMode specifies which |
| 41 matrix, PATH_MODELVIEW_CHROMIUM or PATH_PROJECTION_CHROMIUM is used. | 74 matrix, PATH_MODELVIEW_CHROMIUM or PATH_PROJECTION_CHROMIUM is used. |
| 42 | 75 |
| 43 The funcition specifies either modelview or projection matrix | 76 The funcition specifies either modelview or projection matrix |
| 44 to be used with path rendering API calls. | 77 to be used with path rendering API calls. |
| 45 | 78 |
| 46 void MatrixLoadIdentityCHROMIUM(enum matrixMode) | 79 void MatrixLoadIdentityCHROMIUM(enum matrixMode) |
| 47 | 80 |
| 48 Effectively calls MatrixLoadf with the identity matrix. | 81 Effectively calls MatrixLoadf with the identity matrix. |
| 49 | 82 |
| 83 uint GenPathsCHROMIUM(sizei range) | |
| 84 | |
| 85 Returns an integer /n/ such that names /n/, ..., /n+range-1/ are | |
| 86 previously unused (i.e. there are /range/ previously unused path object | |
| 87 names starting at /n/). These names are marked as used, for the | |
| 88 purposes of subsequent GenPathsCHROMIUM only, but they do not acquire | |
| 89 path object state until each particular name is used to specify | |
| 90 a path object. | |
| 91 | |
| 92 Returns 0 if no new path name was marked as used. Reasons for this | |
| 93 include lack of free path names or range being 0 or a GL error | |
| 94 was generated. | |
| 95 | |
| 96 INVALID_VALUE error is generated if range is negative or does not | |
| 97 fit in 32-bits. | |
| 98 | |
| 99 void DeletePathsCHROMIUM(uint path, sizei range) | |
| 100 | |
| 101 Deletes a path object where /path/ contains /range/ names of path objects to | |
| 102 be delete. After a path object is deleted, its name is again unused. | |
| 103 Unused names in /paths/ are silently ignored. | |
| 104 | |
| 105 INVALID_VALUE error is generated if range is negative or does not | |
| 106 fit in 32-bits. | |
| 107 | |
| 108 INVALID_VALUE error is generated if the path range would overflow, eg. if | |
| 109 path + uint(range) - 1u < path. | |
| 110 | |
| 111 boolean IsPathCHROMIUM(uint path); | |
| 112 | |
| 113 The query returns TRUE if /path/ is the name of a path object. If path is | |
| 114 not the name of a path object, or if an error condition occurs, | |
| 115 IsPathCHROMIUM returns FALSE. A name retuned by GenPathsCHROMIUM, but | |
| 116 without a path specified for it yet, is not the name of a path object. | |
| 117 | |
| 118 void PathCommandsCHROMIUM(uint path, sizei numCommands, | |
| 119 const ubyte* commands, sizei numCoords, | |
| 120 enum coordType, const GLvoid* coords) | |
| 121 | |
| 122 Specifies a path object commands for /path/ where /numCommands/ | |
| 123 indicates the number of path commands, read from the array | |
| 124 /commands/, with which to initialize that path's command sequence. | |
| 125 The type of the coordinates read from the /coords/ array is | |
| 126 determined by the /coordType/ parameter which must be one of BYTE, | |
| 127 UNSIGNED_BYTE, SHORT, UNSIGNED_SHORT, or FLOAT, otherwise the | |
| 128 INVALID_ENUM error is generated. These path commands reference | |
| 129 coordinates read sequentially from the /coords/ array. | |
| 130 | |
| 131 The /numCommands/ elements of the /commands/ array must be tokens | |
| 132 in Table 5.pathCommands. The command sequence matches | |
| 133 the element order of the /commands/ array. Each command references | |
| 134 a number of coordinates specified by "Coordinate count" column of | |
| 135 Table 5.pathCommands, starting with the first (zero) element of | |
| 136 the /coords/ array and advancing by the coordinate count for each | |
| 137 command. If any of these /numCommands/ command values are not | |
| 138 listed in the "Token" column of Table | |
| 139 5.pathCommands, the INVALID_ENUM error is generated. | |
| 140 | |
| 141 The INVALID_OPERATION error is generated if /numCoords/ does not | |
| 142 equal the number of coordinates referenced by the command sequence | |
| 143 specified by /numCommands/ and /commands/ (so /numCoords/ provides a | |
| 144 sanity check that the /coords/ array is being interpreted properly). | |
| 145 The error INVALID_VALUE is generated if either /numCommands/ or | |
| 146 /numCoords/ is negative. | |
| 147 | |
| 148 The error INVALID_OPERATION is generated if /path/ is | |
| 149 not an existing path object. | |
| 150 | |
| 151 The error INVALID_VALUE is generated if /numCoords/ or /numCommands/ | |
|
piman
2015/06/24 03:27:44
nit: that'd typically be an INVALID_OPERATION erro
Kimmo Kinnunen
2015/06/24 12:49:01
Done.
Though, _typically_, the command buffer uses
| |
| 152 are too big for the implementation. This can happen, for example, | |
| 153 if some intermedate buffer is created for holding the values, but | |
| 154 the buffer length would exceed the maximum the implementation would | |
| 155 allow. | |
|
piman
2015/06/24 03:27:44
Is there any way to query such limit, or ensure a
Kimmo Kinnunen
2015/06/24 12:49:01
Just so that I understand: the problem is that cor
piman
2015/06/24 22:50:18
Yes, please. If that's the limitation, then it is
Kimmo Kinnunen
2015/06/25 12:13:35
Actually, I meant the GL_INVALID_OPERATION generat
| |
| 156 | |
| 157 If the PathCommandsCHROMIUM command results in an error, the path object | |
| 158 named /path/ is not changed; if there is no error, the prior contents | |
| 159 of /path/, if /path/ was an existent path object, are lost and the | |
| 160 path object name /path/ becomes used. | |
| 161 | |
| 162 void PathParameterfCHROMIUM(uint path, enum pname, float value) | |
| 163 void PathParameteriCHROMIUM(uint path, enum pname, int value) | |
| 164 | |
| 165 The commands specify the value of path parameters for the specified path | |
| 166 object named /path/. The error INVALID_OPERATION is generated if /path/ is | |
| 167 not an existing path object. | |
| 168 | |
| 169 Each parameter has a single (scalar) value. | |
| 170 | |
| 171 /pname/ must be one of the tokens in the "Name" column of | |
| 172 Table 5.pathParameters. | |
| 173 The required values or range of each allowed parameter name token | |
| 174 is listed in Table 5.pathParameter's "Required Values/Range" column. | |
| 175 | |
| 176 For values of /pname/ listed in Table 5.pathsParameters, the specified | |
| 177 parameter is specified by /value/ when /value/ is a float or int, | |
| 178 or if /value/ is a pointer to a float or int, accessed through that | |
| 179 pointer. The error INVALID_VALUE is generated if the specified | |
| 180 value is negative for parameters required to be non-negative in | |
| 181 Table 5.pathParameters. | |
| 182 | |
| 183 The error INVALID_VALUE is generated if the specified parameter value | |
| 184 is not within the require range for parameters typed float or integer. | |
| 185 The error INVALID_ENUM is generated if the specified parameter value | |
| 186 is not one of the listed tokens for parameters typed enum. | |
| 187 | |
| 188 void PathStencilFuncCHROMIUM(enum func, int ref, uint mask) | |
| 189 | |
| 190 Configures the stencil function, stencil reference value, and stencil read | |
| 191 mask to be used by the StencilFillPathCHROMIUM and StencilStrokePathCHROMIUM | |
| 192 commands described subsequently. The parameters accept the same values | |
| 193 allowed by the StencilFunc command. | |
| 194 | |
| 195 void StencilFillPathCHROMIUM(uint path, enum fillMode, uint mask) | |
| 196 | |
| 197 The function transforms into window space the outline of the path object | |
| 198 named /path/ based on the current modelview, projection and viewport, | |
| 199 transforms (ignoring any vertex and/or geometry shader or program that might | |
| 200 be active/enabled) and then updates the stencil values of all /accessible | |
| 201 samples/ (explained below) in the framebuffer. Each sample's stencil buffer | |
| 202 value is updated based on the winding number of that sample with respect to | |
| 203 the transformed outline of the path object with any non-closed subpath | |
| 204 forced closed and the specified /fillMode/. | |
| 205 | |
| 206 If /path/ does not name an existing path object, the command does | |
| 207 nothing (and no error is generated). | |
| 208 | |
| 209 If the path's command sequence specifies unclosed subpaths (so not | |
| 210 contours) due to MOVE_TO_CHROMIUM commands, such subpaths are trivially | |
| 211 closed by connecting with a line segment the initial and terminal | |
| 212 control points of each such path command subsequence. | |
| 213 | |
| 214 Transformation of a path's outline works by taking all positions on the | |
| 215 path's outline in 2D path space (x,y) and constructing an object space | |
| 216 position (x,y,0,1) that is then used similar to as with the (xo,yo,zo,wo) | |
| 217 position in section 2.12 ("Fixed-Function Vertex Transformation") of OpenGL | |
| 218 3.2 (unabridged) Specification (Special Functions) to compute corresponding | |
| 219 eye-space coordinates (xe,ye,ze,we) and clip-space coordinates | |
| 220 (xc,yc,zc,wc). A path outline's clip-space coordinates are further | |
| 221 transformed into window space similar to as described in section 2.16 | |
| 222 ("Coordinate Transformations"). This process provides a mapping 2D path | |
| 223 coordinates to 2D window coordinates. The resulting 2D window coordinates | |
| 224 are undefined if any of the transformations involved are singular or may be | |
| 225 inaccurate if any of the transformations (or their combination) are | |
| 226 ill-conditioned. | |
| 227 | |
| 228 The winding number for a sample with respect to the path outline, | |
| 229 transformed into window space, is computed by counting the (signed) | |
| 230 number of revolutions around the sample point when traversing each | |
| 231 (trivially closed if necessary) contour once in the transformed path. | |
| 232 This traversal is performed in the order of the path's command | |
| 233 sequence. Starting from an initially zero winding count, each | |
| 234 counterclockwise revolution when the front face mode is CCW (or | |
| 235 clockwise revolution when the front face mode is CW) around the sample | |
| 236 point increments the winding count by one; while each clockwise | |
| 237 revolution when the front face mode is CCW (or counterclockwise | |
| 238 revolution when the front face mode is CW) around the sample point | |
| 239 decrements the winding count by one. | |
| 240 | |
| 241 The /mask/ parameter controls what subset of stencil bits are affected | |
| 242 by the command. | |
| 243 | |
| 244 The /fillMode/ parameter must be one of INVERT, COUNT_UP_CHROMIUM | |
| 245 or COUNT_DOWN_CHROMIUM; otherwise the INVALID_ENUM error | |
| 246 is generated. INVERT inverts the bits set in the effective /mask/ | |
| 247 value for each sample's stencil value if the winding number for the | |
| 248 given sample is odd. COUNT_UP_CHROMIUM adds with modulo n arithmetic the | |
| 249 winding number of each sample with the sample's prior stencil buffer | |
| 250 value; the result of this addition is written into the sample's | |
| 251 stencil value but the bits of the stencil value not set in the | |
| 252 effective /mask/ value are left unchanged. COUNT_DOWN_CHROMIUM subtracts | |
| 253 with modulo /n/ arithmetic the winding number of each sample with the | |
| 254 sample's prior stencil buffer value; the result of this subtraction is | |
| 255 written into the sample's stencil value but the bits of the stencil | |
| 256 value not set in the effective /mask/ value are left unchanged. | |
| 257 | |
| 258 The value of /n/ for the modulo /n/ arithmetic used by COUNT_UP_CHROMIUM | |
| 259 and COUNT_DOWN_CHROMIUM is the effective /mask/+1. The error INVALID_VALUE | |
| 260 is generated if /fillMode/ is COUNT_UP_CHROMIUM or COUNT_DOWN_CHROMIUM and | |
| 261 the effective /mask/+1 is not an integer power of two. | |
| 262 | |
| 263 ACCESSIBLE SAMPLES WITH RESPECT TO A TRANSFORMED PATH | |
| 264 | |
| 265 The accessible samples of a transformed path that are updated are | |
| 266 the samples that remain after discarding the following samples: | |
| 267 | |
| 268 * Any sample that would be clipped similar to as specified in section | |
| 269 2.22 ("Primitive Clipping") of OpenGL 3.2 (unabridged) Specification | |
| 270 (Special Functions) because its corresponding position in clip space | |
| 271 (xc,yc,zc,wc) or (xe,ye,ze,we) would be clipped by the clip volume | |
| 272 or enabled client-defined clip planes. | |
| 273 | |
| 274 * Any sample that would fail the pixel ownership test (section | |
| 275 4.1.1) if rasterized. | |
| 276 | |
| 277 * Any sample that would fail the scissor test (section 4.1.2) | |
| 278 if SCISSOR_TEST is enabled. | |
| 279 | |
| 280 And for the StencilFillPathCHROMIUM and StencilStrokePathCHROMIUM commands | |
| 281 (so not applicable to the CoverFillPathCHROMIUM and CoverStrokePathCHROMIUM | |
| 282 commands): | |
| 283 * Any sample that would fail the (implicitly enabled) stencil test | |
| 284 with the stencil function configured based on the path stencil | |
| 285 function state configured by PathStencilFuncCHROMIUM. In the case | |
| 286 of the StencilFillPathCHROMIUM and StencilStrokePathCHROMIUM | |
| 287 commands, the effective stencil read | |
| 288 mask for the stencil mask is treated as the value of | |
| 289 PATH_STENCIL_VALUE_MASK bit-wise ANDed with the bit-invert of the | |
| 290 effective /mask/ parameter value; otherwise, for the cover commands, | |
| 291 the stencil test operates normally. In the case the stencil test | |
| 292 fails during a path stencil operation, the stencil fail operation is | |
| 293 ignored and the pixel's stencil value is left undisturbed (as if the | |
| 294 stencil operation was KEEP). | |
| 295 | |
| 296 * The state of the face culling (CULL_FACE) enable is ignored. | |
| 297 | |
| 298 void StencilStrokePathCHROMIUM(uint path, int reference, uint mask) | |
| 299 | |
| 300 Transforms into window space the stroked region of the path object named | |
| 301 /path/ based on the current modelview, projection and viewport transforms | |
| 302 (ignoring any vertex and/or geometry shader or program that might be | |
| 303 active/enabled) and then updates the stencil values of a subset of the | |
| 304 accessible samples (see above) in the framebuffer. | |
| 305 | |
| 306 If /path/ does not name an existing path object, the command does | |
| 307 nothing (and no error is generated). | |
| 308 | |
| 309 The path object's specified stroke width (in path space) determines | |
| 310 the width of the path's stroked region. | |
| 311 | |
| 312 The stroke of a transformed path's outline | |
| 313 is the region of window space defined by the union of: | |
| 314 | |
| 315 * Sweeping an orthogonal centered line segment of the (above | |
| 316 determined) effective stroke width along each path segment | |
| 317 in the path's transformed outline. | |
| 318 | |
| 319 * End cap regions (explained below) appended to the initial | |
| 320 and terminal control points of non-closed command sequences | |
| 321 in the path. For a sequence of commands that form a closed | |
| 322 contour, the end cap regions are ignored. | |
| 323 | |
| 324 * Join style regions (explained below) between connected path | |
| 325 segments meet. | |
| 326 | |
| 327 Any accessible samples within the union of these three regions are | |
| 328 considered within the path object's stroke. | |
| 329 | |
| 330 If the stroke width is zero, each of the regions in the union will | |
| 331 be empty and there are no accessible samples within the stroke. | |
| 332 | |
| 333 The /mask/ parameter controls what subset of stencil bits are affected | |
| 334 by the command. | |
| 335 | |
| 336 A sample's stencil bits that are set in the effective /mask/ value | |
| 337 are updated with the specified stencil /reference/ value if the | |
| 338 sample is accessible (as specified above) and within the stroke of | |
| 339 the transformed path's outline. | |
| 340 | |
| 341 Every path object has an end caps parameter | |
| 342 PATH_END_CAPS_CHROMIUM) that is one of FLAT_CHROMIUM, | |
| 343 SQUARE_CHROMIUM or ROUND_CHROMIUM. This parameter defines the | |
| 344 initial and terminal caps type. There are no samples within a | |
| 345 FLAT_CHROMIUM cap. The SQUARE_CHROMIUM cap extends centered and | |
| 346 tangent to the given end (initial or terminal) of the subpath for | |
| 347 half the effective stroke width; in other words, a square cap is a | |
| 348 half-square that kisses watertightly the end of a subpath. The | |
| 349 ROUND_CHROMIUM cap appends a semi-circle, centered and tangent, | |
| 350 with the diameter of the effective stroke width to the given end | |
| 351 (initial or terminal) of the subpath; in other words, a round cap | |
| 352 is a semi-circle that kisses watertightly the end of a subpath. | |
| 353 | |
| 354 Every path object has a join style that is one of BEVEL_CHROMIUM, | |
| 355 ROUND_CHROMIUM or MITER_REVERT_CHROMIUM. Each path object also has a miter | |
| 356 limit value. The BEVEL_CHROMIUM join style inserts a triangle with two | |
| 357 vertices at the outside corners where two connected path segments join and a | |
| 358 third vertex at the common end point shared by the two path segments. The | |
| 359 ROUND_CHROMIUM join style inserts a wedge-shaped portion of a circle | |
| 360 centered at the common end point shared by the two path segments; the radius | |
| 361 of the circle is half the effective stroke width. The MITER_REVERT_CHROMIUM | |
| 362 join style inserts a quadrilateral with two opposite vertices at the outside | |
| 363 corners where the two connected path segments join and two opposite vertices | |
| 364 with one on the path's junction between the two joining path segments and | |
| 365 the other at the common end point shared by the two path segments. However, | |
| 366 the MITER_REVERT_CHROMIUM join style behaves as the BEVEL_CHROMIUM style if | |
| 367 the sine of half the angle between the two joined segments is less than the | |
| 368 path object's PATH_STROKE_WIDTH value divided by the path's | |
| 369 PATH_MITER_LIMIT_CHROMIUM value. | |
| 370 | |
| 371 Every path object has a stroke approximation bound parameter | |
| 372 (PATH_STROKE_BOUND_CHROMIUM) that is a floating-point value /sab/ clamped | |
| 373 between 0.0 and 1.0 and set and queried with the PATH_STROKE_BOUND_CHROMIUM | |
| 374 path parameter. Exact determination of samples swept an orthogonal | |
| 375 centered line segment along cubic Bezier segments and rational | |
| 376 quadratic Bezier curves (so non-circular partial elliptical arcs) is | |
| 377 intractable for real-time rendering so an approximation is required; | |
| 378 /sab/ intuitively bounds the approximation error as a percentage of | |
| 379 the path object's stroke width. Specifically, this path parameter | |
| 380 requests the implementation to stencil any samples within /sweep/ | |
| 381 object space units of the exact sweep of the path's cubic Bezier | |
| 382 segments or partial elliptical arcs to be sampled by the stroke where | |
| 383 | |
| 384 sweep = ((1-sab)*sw)/2 | |
| 385 | |
| 386 where /sw/ is the path object's stroke width. The initial value | |
| 387 of /sab/ when a path is created is 0.2. In practical terms, this | |
| 388 initial value means the stencil sample positions coverage within 80% | |
| 389 (100%-20%) of the stroke width of cubic and rational quadratic stroke | |
| 390 segments should be sampled. | |
| 391 | |
| 392 | |
| 393 void CoverFillPathCHROMIUM(uint path, enum coverMode) | |
| 394 | |
| 395 The command transforms into window space the outline of the path object | |
| 396 named /path/ based on the current modelview, projection and viewport | |
| 397 transforms (ignoring any vertex and/or geometry shader or program that might | |
| 398 be active/enabled) and rasterizes a subset of the accessible samples in the | |
| 399 framebuffer guaranteed to include all samples that would have a net | |
| 400 stencil value change if StencilFillPathCHROMIUM were issued with the same | |
| 401 modelview, projection, and viewport state. During this rasterization, the | |
| 402 stencil test operates normally and as configured; the expectation is the | |
| 403 stencil test will be used to discard samples not determined "covered" by a | |
| 404 prior StencilFillPathCHROMIUM command. | |
| 405 | |
| 406 If /path/ does not name an existing path object, the command does | |
| 407 nothing (and no error is generated). | |
| 408 | |
| 409 /coverMode/ must be one of CONVEX_HULL_CHROMIUM or BOUNDING_BOX_CHROMIUM. | |
| 410 Otherwise, INVALID_ENUM error is generated. | |
| 411 | |
| 412 The subset of accessible pixels that are rasterized are within a bounding | |
| 413 box (expected to be reasonably tight) surrounding all the samples guaranteed | |
| 414 to be rasterized by CoverFillPathCHROMIUM. The bounding box must be | |
| 415 orthogonally aligned to the path space coordinate system. (The area of the | |
| 416 bounding box in path space is guaranteed to be greater than or equal the | |
| 417 area of the convex hull in path space.) Each rasterized sample will be | |
| 418 rasterized once and exactly once. | |
| 419 | |
| 420 While samples with a net stencil change /must/ be rasterized, | |
| 421 implementations are explicitly allowed to vary in the rasterization | |
| 422 of samples for which StencilFillPathCHROMIUM would /not/ change sample's | |
| 423 net stencil value. This means implementations are allowed to (and, | |
| 424 in fact, are expected to) conservatively "exceed" the region strictly | |
| 425 stenciled by the path object. | |
| 426 | |
| 427 CoverFillPathCHROMIUM /requires/ the following rasterization invariance: | |
| 428 calling CoverFillPathCHROMIUM for the same (unchanged) path object with | |
| 429 fixed (unchanged) modelview, projection, and viewport transform state | |
| 430 with the same (unchanged) set of accessible samples will rasterize | |
| 431 the exact same set of samples with identical interpolated values | |
| 432 for respective fragment/sample locations. | |
| 433 | |
| 434 void CoverStrokePathCHROMIUM(uint path, enum coverMode) | |
| 435 | |
| 436 The command operates in the same manner as CoverFillPathCHROMIUM except the | |
| 437 region guaranteed to be rasterized is, rather than the region within | |
| 438 /path/'s filled outline, instead the region within the /path/'s stroked | |
| 439 region as determined by StencilStrokePathCHROMIUM. During this | |
| 440 rasterization, the stencil test operates normally and as configured; the | |
| 441 expectation is the stencil test will be used to discard samples not | |
| 442 determined "covered" by a prior StencilStrokePathCHROMIUM command. | |
| 443 | |
| 444 If /path/ does not name an existing path object, the command does | |
| 445 nothing (and no error is generated). | |
| 446 | |
| 447 /coverMode/ must be one of CONVEX_HULL_CHROMIUM or BOUNDING_BOX_CHROMIUM. | |
| 448 Otherwise, INVALID_ENUM error is generated. | |
| 449 | |
| 450 Analogous to the rasterization guarantee of CoverFillPathCHROMIUM with | |
| 451 respect to StencilFillPathCHROMIUM, CoverStrokePathCHROMIUM guarantees that | |
| 452 all samples rasterized by StencilStrokePathCHROMIUM, given the same | |
| 453 transforms and accessible pixels and stroke width, will also be rasterized | |
| 454 by the corresponding CoverStrokePathCHROMIUM. | |
| 455 | |
| 456 CoverStrokePathCHROMIUM /requires/ the following rasterization invariance: | |
| 457 calling CoverStrokePathCHROMIUM for the same (unchanged) path object with | |
| 458 fixed (unchanged) modelview, projection, and viewport transform state and | |
| 459 with the same (unchanged) set of accessible samples will rasterize the exact | |
| 460 same set of samples with identical interpolated values for respective | |
| 461 fragment/sample locations. | |
| 462 | |
| 463 void StencilThenCoverFillPathCHROMIUM(uint path, enum fillMode, uint mask, e num coverMode) | |
| 464 | |
| 465 The command is equivalent to the two commands | |
| 466 | |
| 467 StencilFillPathCHROMIUM(path, fillMode, mask); | |
| 468 CoverFillPathCHROMIUM(path, coverMode); | |
| 469 | |
| 470 unless either command would generate an error; for any such error | |
| 471 other than OUT_OF_MEMORY, only that error is generated. | |
| 472 | |
| 473 void StencilThenCoverStrokePathCHROMIUM(uint path, int reference, uint mask, enum coverMode) | |
| 474 | |
| 475 The command is equivalent to the two commands | |
| 476 | |
| 477 StencilStrokePathCHROMIUM(path, reference, mask); | |
| 478 CoverStrokePathCHROMIUM(path, coverMode); | |
| 479 | |
| 480 unless either command would generate an error; for any such error | |
| 481 other than OUT_OF_MEMORY, only that error is generated. | |
| 482 | |
| 483 | |
| 50 Errors | 484 Errors |
| 51 | 485 |
| 52 None. | 486 None. |
| 53 | 487 |
| 54 New State | 488 New State |
| 55 | 489 |
| 56 Get Value Type Get Command Initial Description | 490 Get Value Type Get Command Initial Description |
| 57 ----------------------------- ----- ------------ -------- ---------------- --- | 491 ----------------------------- ----- ------------ -------- ---------------- --- |
| 58 PATH_MODELVIEW_MATRIX_CHROMIUM 16xR GetFloatv all 0's Current modelvi ew | 492 PATH_MODELVIEW_MATRIX_CHROMIUM 16xR GetFloatv all 0's Current modelvi ew |
| 59 matrix for path rendering | 493 matrix for path rendering |
| 60 PATH_PROJECTION_MATRIX_CHROMIUM 16xR GetFloatv all 0's Current project ion | 494 PATH_PROJECTION_MATRIX_CHROMIUM 16xR GetFloatv all 0's Current project ion |
| 61 matrix for path rendering | 495 matrix for path rendering |
| 496 PATH_STENCIL_FUNC_CHROMIUM Z8 GetIntegerv ALWAYS path stenciling function | |
| 497 PATH_STENCIL_REF_CHROMIUM Z+ GetIntegerv 0 path stenciling | |
| 498 reference value | |
| 499 PATH_STENCIL_VALUE_MASK_CHROMIUM path stencil re ad | |
| 500 Z+ GetIntegerv 1's mask | |
| 501 | |
| 502 Tables | |
| 503 Table 5.pathCommands: Path Commands | |
| 504 | |
| 505 Coordinate | |
| 506 Token Description count | |
| 507 ========================== ===================== ========== | |
| 508 MOVE_TO_CHROMIUM Absolute move 2 | |
| 509 current point | |
| 510 -------------------------- --------------------- ---------- | |
| 511 CLOSE_PATH_CHROMIUM Close path 0 | |
| 512 -------------------------- --------------------- ---------- | |
| 513 LINE_TO_CHROMIUM Absolute line 2 | |
| 514 -------------------------- --------------------- ---------- | |
| 515 QUADRATIC_CURVE_TO_CHROMIUM Absolute quadratic 4 | |
| 516 -------------------------- --------------------- ---------- | |
| 517 CUBIC_CURVE_TO_CHROMIUM Absolute cubic 6 | |
| 518 Bezier segment | |
| 519 -------------------------- --------------------- ---------- | |
| 520 CONIC_CURVE_TO_CHROMIUM Absolute conic 5 | |
| 521 (rational Bezier) | |
| 522 segment | |
| 523 | |
| 524 | |
| 525 Table 5.pathParameters | |
| 526 Name Type Required Values or Range | |
| 527 ------------------------------- ------- ---------------------------------- ------------- | |
| 528 PATH_STROKE_WIDTH_CHROMIUM float non-negative | |
| 529 PATH_END_CAPS_CHROMIUM enum FLAT, SQUARE_CHROMIUM, ROUND_CHROM IUM | |
| 530 PATH_JOIN_STYLE_CHROMIUM enum MITER_REVERT_CHROMIUM, BEVEL_CHROM IUM, ROUND_CHROMIUM | |
| 531 PATH_MITER_LIMIT_CHROMIUM float non-negative | |
| 532 PATH_STROKE_BOUND_CHROMIUM float will be clamped to [0, 1.0], initi ally 0.2 (20%) | |
| 533 | |
| 534 | |
| 535 Issues | |
| 536 | |
| 537 1. Should there be a distinct stencil function state for path | |
| 538 stenciling? | |
| 539 | |
| 540 RESOLVED: YES. glPathStencilFunc sets the state. How the | |
| 541 stencil state needs to be configured for path covering is | |
| 542 different than how the stencil function is configured typically | |
| 543 for path stenciling. | |
| 544 | |
| 545 For example, stencil covering might use | |
| 546 StencilFunc(NOT_EQUAL,0,~0) while path stenciling would | |
| 547 use ALWAYS for the path stenciling stencil test. | |
| 548 | |
| 549 However there are other situations such as path clipping where it | |
| 550 is useful to have the path stencil function configured differently | |
| 551 such as PathStencilFunc(NOT_EQUAL, 0x00, 0x80) or other | |
| 552 similar path clipping test. | |
| 553 | |
| 554 2. Since my Cover*Path* skips the vertex shader, what does it mean exactly | |
| 555 wrt a fully linked program? What happens to the fragment shader's input | |
| 556 varyings that are not filled by the vertex shader + rasterizer? | |
| 557 | |
| 558 It is possible that input varyings from a shader may not be written | |
| 559 as output varyings of a preceding shader. In this case, the unwritten | |
| 560 input varying values are undefined. Implementations are encouraged to | |
| 561 zero these undefined input varying values. | |
|
piman
2015/06/24 03:27:44
I'm not sure what that means... a program fails to
Kimmo Kinnunen
2015/06/24 12:49:01
I think the spec is written in the way that it doe
piman
2015/06/24 22:50:18
Well... there's a lot more than the vertex shader
Kimmo Kinnunen
2015/06/25 12:13:35
I tried to address these in the .txt by adding a h
| |
| 562 | |
| 563 3. What is the defined behavior when stroking if PATH_STROKE_WIDTH is | |
| 564 zero? | |
| 565 | |
| 566 There will not be any samples within the stroke. I.e. the stroke does | |
| 567 not produce any visible results. | |
| 62 | 568 |
| 63 Revision History | 569 Revision History |
| 64 | 570 |
| 65 14/8/2014 Documented the extension | 571 14/8/2014 Documented the extension |
| OLD | NEW |