Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(366)

Side by Side Diff: gpu/GLES2/extensions/CHROMIUM/CHROMIUM_path_rendering.txt

Issue 169403005: command_buffer: Implement path rendering functions for CHROMIUM_path_rendering (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nv-pr-02-texgen
Patch Set: improve parameter validation and write up the extension .txt file Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | gpu/GLES2/gl2chromium.h » ('j') | gpu/command_buffer/build_gles2_cmd_buffer.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 13 matching lines...) Expand all
24 Accepted by the <matrixMode> parameter of MatrixLoadfCHROMIUM and 24 Accepted by the <matrixMode> parameter of MatrixLoadfCHROMIUM and
25 MatrixLoadIdentityCHROMIUM: 25 MatrixLoadIdentityCHROMIUM:
26 MODELVIEW_CHROMIUM 0x1700 26 MODELVIEW_CHROMIUM 0x1700
27 PROJECTION_CHROMIUM 0x1701 27 PROJECTION_CHROMIUM 0x1701
28 28
29 Accepted by the <pname> parameter of GetIntegerv, 29 Accepted by the <pname> parameter of GetIntegerv,
30 GetFloatv: 30 GetFloatv:
31 MODELVIEW_MATRIX_CHROMIUM 0x0BA6 31 MODELVIEW_MATRIX_CHROMIUM 0x0BA6
32 PROJECTION_MATRIX_CHROMIUM 0x0BA7 32 PROJECTION_MATRIX_CHROMIUM 0x0BA7
33 33
34 Accepted by the <pname> parameter of GetIntegerv:
35 MAX_TEXTURE_COORDS_CHROMIUM 0x8871
36
37 Accepted by the <pname> parameter of PathParameter{if}CHROMIUM:
38 PATH_STROKE_WIDTH_CHROMIUM 0x9075
39 PATH_INITIAL_END_CAP_CHROMIUM 0x9077
40 PATH_TERMINAL_END_CAP_CHROMIUM 0x9078
41 PATH_JOIN_STYLE_CHROMIUM 0x9079
42 PATH_MITER_LIMIT_CHROMIUM 0x907a
43
44 Accepted by the <value> parameter of PathParameter{if}CHROMIUM:
45 FLAT_CHROMIUM 0x1D00
46 SQUARE_CHROMIUM 0x90a3
47 ROUND_CHROMIUM 0x90a4
48 BEVEL_CHROMIUM 0x90A6
49 MITER_REVERT_CHROMIUM 0x90A7
50
51 Accepted by the <fillMode> parameter of StencilFillPathCHROMIUM and
52 StencilFillPathInstancedCHROMIUM:
53 COUNT_UP_CHROMIUM 0x9088
54 COUNT_DOWN_CHROMIUM 0x9089
55
56 Accepted by the <genMode> parameter of PathTexGenCHROMIUM:
57 OBJECT_LINEAR_CHROMIUM 0x2401
58 EYE_LINEAR_CHROMIUM 0x2400
59
60 Accepted by the <coverMode> parameter of CoverFillPathCHROMIUM,
61 CoverFillPathInstancedCHROMIUM, CoverStrokePathCHROMIUM and
62 CoverStrokePathInstancedCHROMIUM:
63 BOUNDING_BOX_CHROMIUM 0x908d
64
65 Accepted by the <transformType> parameter of
66 StencilFillPathInstancedCHROMIUM, StencilStrokePathInstancedCHROMIUM,
67 CoverFillPathInstancedCHROMIUM, and CoverStrokePathInstancedCHROMIUM:
68 TRANSLATE_X_CHROMIUM 0x908E
69 TRANSLATE_Y_CHROMIUM 0x908F
70 TRANSLATE_2D_CHROMIUM 0x9090
71 TRANSLATE_3D_CHROMIUM 0x9091
72 AFFINE_2D_CHROMIUM 0x9092
73 AFFINE_3D_CHROMIUM 0x9094
74 TRANSPOSE_AFFINE_2D_CHROMIUM 0x9096
75 TRANSPOSE_AFFINE_3D_CHROMIUM 0x9098
76
77 Accepted by the <coverMode> parameter of CoverFillPathInstancedCHROMIUM,
78 CoverStrokePathInstancedCHROMIUM:
79 BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM 0x909C
80
81
34 82
35 New Procedures and Functions 83 New Procedures and Functions
36 84
37 void MatrixLoadfCHROMIUM(enum matrixMode, float* matrix); 85 void MatrixLoadfCHROMIUM(enum matrixMode, float* matrix);
38 86
39 Takes a pointer to a 4x4 matrix stored in column-major order as 16 87 Takes a pointer to a 4x4 matrix stored in column-major order as 16
40 consecutive floating-point values. The matrixMode specifies which 88 consecutive floating-point values. The matrixMode specifies which
41 matrix, MODELVIEW_CHROMIUM or PROJECTION_CHROMIUM is used. 89 matrix, MODELVIEW_CHROMIUM or PROJECTION_CHROMIUM is used.
42 90
43 The funcition specifies either modelview or projection matrix 91 The funcition specifies either modelview or projection matrix
44 to be used with path rendering API calls. 92 to be used with path rendering API calls.
45 93
46 void MatrixLoadIdentityCHROMIUM(enum matrixMode); 94 void MatrixLoadIdentityCHROMIUM(enum matrixMode);
47 95
48 Effectively calls MatrixLoadf with the identity matrix. 96 Effectively calls MatrixLoadf with the identity matrix.
49 97
98 uint GenPathsCHROMIUM(sizei range)
99
100 Returns an integer /n/ such that names /n/, ..., /n+range-1/ are
101 previously unused (i.e. there are /range/ previously unused path object
102 names starting at /n/). These names are marked as used, for the
103 purposes of subsequent GenPathsCHROMIUM only, but they do not acquire
104 path object state until each particular name is used to specify
105 a path object.
106
107 void DeletePathsCHROMIUM(uint path, sizei range)
108
109 Deletes a path object where /path/ contains /range/ names of path objects to
110 be delete. After a path object is deleted, its name is again unused.
111 Unused names in /paths/ are silently ignored.
112
113 void PathCommandsCHROMIUM(uint path, sizei numCommands,
114 const ubyte* commands, sizei numCoords,
115 enum coordType, const void* coords)
116
117 Specifies a path object commands for /path/ where /numCommands/
118 indicates the number of path commands, read from the array
119 /commands/, with which to initialize that path's command sequence.
120 These path commands reference coordinates read sequentially from the
121 /coords/ array. The type of the coordinates read from the /coords/
122 array is determined by the /coordType/ parameter must be
123 FLOAT, otherwise INVALID_ENUM is generated.
124
125 The /numCommands/ elements of the /commands/ array must be tokens
126 or character in Table 5.pathCommands. The command sequence matches
127 the element order of the /commands/ array. Each command references
128 a number of coordinates specified by "Coordinate count" column of
129 Table 5.pathCommands, starting with the first (zero) element of
130 the /coords/ array and advancing by the coordinate count for each
131 command. If any of these /numCommands/ command values are not
132 listed in the "Token" or "Character aliases" columns of Table
133 5.pathCommands, the INVALID_ENUM error is generated.
134
135 The INVALID_OPERATION error is generated if /numCoords/ does not
136 equal the number of coordinates referenced by the command sequence
137 specified by /numCommands/ and /commands/ (so /numCoords/ provides a
138 sanity check that the /coords/ array is being interpreted properly).
139 The error INVALID_VALUE is generated if either /numCommands/ or
140 /numCoords/ is negative.
141
142 The error INVALID_OPERATION is generated if /path/ is
143 not an existing path object.
144
145 If the PathCommandsCHROMIUM command results in an error, the path object
146 named /path/ is not changed; if there is no error, the prior contents
147 of /path/, if /path/ was an existent path object, are lost and the
148 path object name /path/ becomes used.
149
150 void PathParameterfCHROMIUM(uint path, enum pname, float value)
151 void PathParameteriCHROMIUM(uint path, enum pname, int value)
152
153 The commands specify the value of path parameters for the specified path
154 object named /path/. The error INVALID_OPERATION is generated if /path/ is
155 not an existing path object.
156
157 Each parameter has a single (scalar) value.
158
159 /pname/ must be one of the tokens in the "Name" column of
160 Table 5.pathParameters.
161 The required values or range of each allowed parameter name token
162 is listed in Table 5.pathParameter's "Required Values/Range" column.
163
164 For values of /pname/ listed in Table 5.pathsParameters, the specified
165 parameter is specified by /value/ when /value/ is a float or int,
166 or if /value/ is a pointer to a float or int, accessed through that
167 pointer. The error INVALID_VALUE is generated if the specified
168 value is negative for parameters required to be non-negative in
169 Table 5.pathParameters. Values specified to be clamped to the [0,1] range
170 in Table 5.pathParameters are so clamped prior to setting the
171 specified path parameter to that clamped value.
172
173 The error INVALID_VALUE is generated if the specified parameter value
174 is not within the require range for parameters typed float or integer.
175 The error INVALID_ENUM is generated if the specified parameter value
176 is not one of the listed tokens for parameters typed enum.
177
178 void PathStencilFuncCHROMIUM(enum func, int ref, uint mask)
179
180 Configures the stencil function, stencil reference value, and stencil read
181 mask to be used by the StencilFillPathCHROMIUM and StencilStrokePathCHROMIUM
182 commands described subsequently. The parameters accept the same values
183 allowed by the StencilFunc command.
piman 2014/04/24 22:26:36 Why do we need a separate state from the regular G
Kimmo Kinnunen 2014/04/25 12:46:30 Tried to answer this in the added "Issues" section
184
185 void StencilFillPathCHROMIUM(uint path, enum fillMode, uint mask)
186
187 The function transforms into window space the outline of the path object
188 named /path/ based on the current modelview, projection and viewport,
189 transforms (ignoring any vertex and/or geometry shader or program that might
190 be active/enabled) and then updates the stencil values of all /accessible
191 samples/ (explained below) in the framebuffer. Each sample's stencil buffer
192 value is updated based on the winding number of that sample with respect to
193 the transformed outline of the path object with any non-closed subpath
194 forced closed and the specified /fillMode/.
195
196 If /path/ does not name an existing path object, the command does
197 nothing (and no error is generated).
198
199 If the path's command sequence specifies unclosed subpaths (so not
200 contours) due to MOVE_TO_CHROMIUM commands, such subpaths are trivially
201 closed by connecting with a line segment the initial and terminal
202 control points of each such path command subsequence.
203
204 Transformation of a path's outline works by taking all positions on the
205 path's outline in 2D path space (x,y) and constructing an object space
206 position (x,y,0,1) that is then used similar to as with the (xo,yo,zo,wo)
207 position in section 2.12 ("Fixed-Function Vertex Transformation") of OpenGL
208 3.2 (unabridged) Specification (Special Functions) to compute corresponding
209 eye-space coordinates (xe,ye,ze,we) and clip-space coordinates
210 (xc,yc,zc,wc). A path outline's clip-space coordinates are further
211 transformed into window space similar to as described in section 2.16
212 ("Coordinate Transformations"). This process provides a mapping 2D path
213 coordinates to 2D window coordinates. The resulting 2D window coordinates
214 are undefined if any of the transformations involved are singular or may be
215 inaccurate if any of the transformations (or their combination) are
216 ill-conditioned.
217
218 The winding number for a sample with respect to the path outline,
219 transformed into window space, is computed by counting the (signed)
220 number of revolutions around the sample point when traversing each
221 (trivially closed if necessary) contour once in the transformed path.
222 This traversal is performed in the order of the path's command
223 sequence. Starting from an initially zero winding count, each
224 counterclockwise revolution when the front face mode is CCW (or
225 clockwise revolution when the front face mode is CW) around the sample
226 point increments the winding count by one; while each clockwise
227 revolution when the front face mode is CCW (or counterclockwise
228 revolution when the front face mode is CW) around the sample point
229 decrements the winding count by one.
230
231 The /mask/ parameter controls what subset of stencil bits are affected
232 by the command.
233
234 The /fillMode/ parameter must be one of INVERT, COUNT_UP_CHROMIUM
235 or COUNT_DOWN_CHROMIUM; otherwise the INVALID_ENUM error
236 is generated. INVERT inverts the bits set in the effective /mask/
237 value for each sample's stencil value if the winding number for the
238 given sample is odd. COUNT_UP_CHROMIUM adds with modulo n arithmetic the
239 winding number of each sample with the sample's prior stencil buffer
240 value; the result of this addition is written into the sample's
241 stencil value but the bits of the stencil value not set in the
242 effective /mask/ value are left unchanged. COUNT_DOWN_CHROMIUM subtracts
243 with modulo /n/ arithmetic the winding number of each sample with the
244 sample's prior stencil buffer value; the result of this subtraction is
245 written into the sample's stencil value but the bits of the stencil
246 value not set in the effective /mask/ value are left unchanged.
247
248 The value of /n/ for the modulo /n/ arithmetic used by COUNT_UP_CHROMIUM
249 and COUNT_DOWN_CHROMIUM is the effective /mask/+1. The error INVALID_VALUE
250 is generated if /fillMode/ is COUNT_UP_CHROMIUM or COUNT_DOWN_CHROMIUM and
251 the effective /mask/+1 is not an integer power of two.
252
253 ACCESSIBLE SAMPLES WITH RESPECT TO A TRANSFORMED PATH
254
255 The accessible samples of a transformed path that are updated are
256 the samples that remain after discarding the following samples:
257
258 * Any sample that would be clipped similar to as specified in section
259 2.22 ("Primitive Clipping") of OpenGL 3.2 (unabridged) Specification
260 (Special Functions) because its corresponding position in clip space
261 (xc,yc,zc,wc) or (xe,ye,ze,we) would be clipped by the clip volume
262 or enabled client-defined clip planes.
263
264 * Any sample that would fail the pixel ownership test (section
265 4.1.1) if rasterized.
266
267 * Any sample that would fail the scissor test (section 4.1.2)
268 if SCISSOR_TEST is enabled.
269
270 And for the StencilFillPathCHROMIUM and StencilStrokePathCHROMIUM commands
271 (so not applicable to the CoverFillPathCHROMIUM and CoverStrokePathCHROMIUM
272 commands):
273 * Any sample that would fail the (implicitly enabled) stencil test
274 with the stencil function configured based on the path stencil
275 function state configured by PathStencilFuncCHROMIUM. In the case
276 of the StencilFillPathCHROMIUM and StencilStrokePathCHROMIUM
277 commands and their instanced versions, the effective stencil read
278 mask for the stencil mask is treated as the value of
279 PATH_STENCIL_VALUE_MASK bit-wise ANDed with the bit-invert of the
280 effective /mask/ parameter value; otherwise, for the cover commands,
281 the stencil test operates normally. In the case the stencil test
282 fails during a path stencil operation, the stencil fail operation is
283 ignored and the pixel's stencil value is left undisturbed (as if the
284 stencil operation was KEEP).
285
286 * The state of the face culling (CULL_FACE) enable is ignored.
287
288 void StencilStrokePathCHROMIUM(uint path, int reference, uint mask)
289
290 Transforms into window space the stroked region of the path object named
291 /path/ based on the current modelview, projection and viewport transforms
292 (ignoring any vertex and/or geometry shader or program that might be
293 active/enabled) and then updates the stencil values of a subset of the
294 accessible samples (see above) in the framebuffer.
295
296 If /path/ does not name an existing path object, the command does
297 nothing (and no error is generated).
298
299 The path object's specified stroke width (in path space) determines
300 the width of the path's stroked region.
301
302 The stroke of a transformed path's outline
303 is the region of window space defined by the union of:
304
305 * Sweeping an orthogonal centered line segment of the (above
306 determined) effective stroke width along each path segment
307 in the path's transformed outline.
308
309 * End cap regions (explained below) appended to the initial
310 and terminal control points of non-closed command sequences
311 in the path. For a sequence of commands that form a closed
312 contour, the end cap regions are ignored.
313
314 * Join style regions (explained below) between connected path
315 segments meet.
316
317 Any accessible samples within the union of these three regions are
318 considered within the path object's stroke.
319
320 The /mask/ parameter controls what subset of stencil bits are affected
321 by the command.
322
323 A sample's stencil bits that are set in the effective /mask/ value
324 are updated with the specified stencil /reference/ value if the
325 sample is accessible (as specified above) and within the stroke of
326 the transformed path's outline.
327
328 Every path object has an initial and terminal end cap parameter
329 that is one of FLAT_CHROMIUM, SQUARE_CHROMIUM or
330 ROUND_CHROMIUM. There are no samples within a FLAT_CHROMIUM end cap.
331 The SQUARE_CHROMIUM cap extends centered and tangent to the given end
332 (initial or terminal) of the subpath for half the effective stroke
333 width; in other words, a square cap is a half-square that kisses
334 watertightly the end of a subpath. The ROUND_CHROMIUM cap appends
335 a semi-circle, centered and tangent, with the diameter of the
336 effective stroke width to the given end (initial or terminal) of the
337 subpath; in other words, a round cap is a semi-circle that kisses
338 watertightly the end of a subpath.
339
340 Every path object has a join style that is one of BEVEL_CHROMIUM,
341 ROUND_CHROMIUM or MITER_REVERT_CHROMIUM. Each path object also has a miter
342 limit value. The BEVEL_CHROMIUM join style inserts a triangle with two
343 vertices at the outside corners where two connected path segments join and a
344 third vertex at the common end point shared by the two path segments. The
345 ROUND_CHROMIUM join style inserts a wedge-shaped portion of a circle
346 centered at the common end point shared by the two path segments; the radius
347 of the circle is half the effective stroke width. The MITER_REVERT_CHROMIUM
348 join style inserts a quadrilateral with two opposite vertices at the outside
349 corners where the two connected path segments join and two opposite vertices
350 with one on the path's junction between the two joining path segments and
351 the other at the common end point shared by the two path segments. However,
352 the MITER_REVERT_CHROMIUM join style behaves as the BEVEL_CHROMIUM style if
353 the sine of half the angle between the two joined segments is less than the
354 path object's PATH_STROKE_WIDTH value divided by the path's
355 PATH_MITER_LIMIT_CHROMIUM value.
356
357 void PathTexGenCHROMIUM(enum texCoordSet, enum genMode, int components,
358 const float* coeffs)
359
360 The function controls how texture coordinate sets are computed for fragment
361 shading operations that occur as a result of CoverFillPathCHROMIUM or
362 CoverStrokePathCHROMIUM.
piman 2014/04/24 22:26:36 Can you describe how these texture coordinates int
Kimmo Kinnunen 2014/04/25 12:46:30 Good point, forgot these. Added explanation that
363
364 /texCoordSet/ must be one of TEXTURE0 through
365 TEXTUREn where /n/ is one less than the implementation-dependent
366 value of MAX_TEXTURE_COORDS_CHROMIUM; otherwise INVALID_ENUM is generated.
367
368 /genMode/ must be one of NONE, OBJECT_LINEAR_CHROMIUM, or
369 EYE_LINEAR_CHROMIUM; otherwise INVALID_ENUM is generated.
370
371 /components/ must be 0 if /genMode/ is NONE or for other allowed
372 /genMode/ values must be one of 1, 2, 3, or 4; otherwise INVALID_VALUE
373 is generated. /components/ determines how many texture coordinate
374 components of the texture coordinate set, how many coefficients read
375 from the /coeffs/ array, and the linear equations used to generate the
376 s, t, r, and q texture coordinates of the varying texture coordinate
377 set specified by /texCoordSet/.
378
379 In the following equations, coeffs[i] is the /i/th element (base
380 zero) of the /coeffs/ array; sc, tc, rc, and qa are the s, t, r,
381 and q texture coordinates of the texture coordinate set indicated
382 by /texCoordSet/ when the path is covered; and x, y, z, and w are
383 determined by the /genMode/ in the same manner as PathColorGenCHROMIUM's
piman 2014/04/24 22:26:36 PathColorGenCHROMIUM isn't in this extension.
Kimmo Kinnunen 2014/04/25 12:46:30 Removed. Added some explanation above.
384 /genMode/.
385
386 If the /components/ is 0, no values from the /coeffs/ array are
387 accessed and the s, t, r, and q coordinates of a covered fragment's
388 varying texture coordinate set for /texCoordSet/ are computed:
389
390 s = sc
391 t = tc
392 r = rc
393 q = qc
394
395 If the /components/ is 1 and /genMode/ is OBJECT_LINEAR_CHROMIUM, 3 values
396 from the /coeffs/ array are accessed and the s, t, r, and q coordinates of a
397 covered fragment's varying texture coordinate set for /texCoordSet/ are
398 computed:
399
400 s = coeffs[0] * x + coeffs[1] * y + coeffs[2]
401 t = tc
402 r = rc
403 q = qc
404
405 Alternatively if the /genMode/ is EYE_LINEAR_CHROMIUM, then 4 values are
406 accessed and the varying texture coordinate set for /texunit/ are
407 computed:
408
409 s = coeffs[0] * xe + coeffs[1] * ye + coeffs[2] * ze + coeffs[3] * we
410 t = tc
411 r = rc
412 q = qc
413
414 If the /components/ is 2 and /genMode/ is OBJECT_LINEAR_CHROMIUM, 6 values
415 from the /coeffs/ array are accessed and the s, t, r, and q coordinates of a
416 covered fragment's varying texture coordinate set for /texCoordSet/ are
417 computed:
418
419 s = coeffs[0] * x + coeffs[1] * y + coeffs[2]
420 t = coeffs[3] * x + coeffs[4] * y + coeffs[5]
421 r = rc
422 q = qc
423
424 Alternatively if the /genMode/ is EYE_LINEAR_CHROMIUM, then 8 values are
425 accessed and the varying texture coordinate set for /texunit/ are
426 computed:
427
428 s = coeffs[0] * xe + coeffs[1] * ye + coeffs[2] * ze + coeffs[3] * we
429 t = coeffs[4] * xe + coeffs[5] * ye + coeffs[6] * ze + coeffs[7] * we
430 r = rc
431 q = qc
432
433 If the /components/ is 3 and /genMode/ is OBJECT_LINEAR_CHROMIUM or 9 values
434 from the /coeffs/ array are accessed and the s, t, r, and q coordinates of a
435 covered fragment's varying texture coordinate set for /texCoordSet/ are
436 computed:
437
438 s = coeffs[0] * x + coeffs[1] * y + coeffs[2]
439 t = coeffs[3] * x + coeffs[4] * y + coeffs[5]
440 r = coeffs[6] * x + coeffs[7] * y + coeffs[8]
441 q = qc
442
443 Alternatively if the /genMode/ is EYE_LINEAR_CHROMIUM, then 12 values are
444 accessed and the varying texture coordinate set for /texunit/ are
445 computed:
446
447 s = coeffs[0] * xe + coeffs[1] * ye + coeffs[2] * ze + coeffs[3] * we
448 t = coeffs[4] * xe + coeffs[5] * ye + coeffs[6] * ze + coeffs[7] * we
449 r = coeffs[8] * xe + coeffs[9] * ye + coeffs[10] * ze + coeffs[11] * we
450 q = qc
451
452 If the /components/ is 4 and /genMode/ is OBJECT_LINEAR_CHROMIUM, 12
453 values from the /coeffs/ array are accessed and the s, t, r, and q
454 coordinates of a covered fragment's varying texture coordinate set for
455 /texCoordSet/ are computed:
456
457 s = coeffs[0] * x + coeffs[1] * y + coeffs[2]
458 t = coeffs[3] * x + coeffs[4] * y + coeffs[5]
459 r = coeffs[6] * x + coeffs[7] * y + coeffs[8]
460 q = coeffs[9] * x + coeffs[10] * y + coeffs[11]
461
462 Alternatively if the /genMode/ is EYE_LINEAR_CHROMIUM, then 16 values are
463 accessed and the varying texture coordinate set for /texunit/ are
464 computed:
465
466 s = coeffs[0] * xe + coeffs[1] * ye + coeffs[2] * ze + coeffs[3] * w e
467 t = coeffs[4] * xe + coeffs[5] * ye + coeffs[6] * ze + coeffs[7] * w e
468 r = coeffs[8] * xe + coeffs[9] * ye + coeffs[10] * ze + coeffs[11] * w e
469 q = coeffs[12] * xe + coeffs[13] * ye + coeffs[14] * ze + coeffs[15] * w e
470
471 The state required for path color generation for each texture
472 coordinate set is a four-valued integer for the path texture
473 coordinate set generation mode and 16 floating-point coefficients.
474 The initial mode is NONE and the coefficients are all initially zero.
475
476 void CoverFillPathCHROMIUM(uint path, enum coverMode)
piman 2014/04/24 22:26:36 Do we need coverMode if there can only be BOUNDING
Kimmo Kinnunen 2014/04/25 12:46:30 This is the "API discussion", see below.
477
478 The command transforms into window space the outline of the path object
479 named /path/ based on the current modelview, projection and viewport
480 transforms (ignoring any vertex and/or geometry shader or program that might
481 be active/enabled) and rasterizes a subset of the accessible samples in the
482 framebuffer guaranteed to include all samples that would be have a net
piman 2014/04/24 22:26:36 typo: "would be have" -> "would have"
Kimmo Kinnunen 2014/04/25 12:46:30 Done.
483 stencil value change if StencilFillPathCHROMIUM were issued with the same
484 modelview, projection, and viewport state. During this rasterization, the
485 stencil test operates normally and as configured; the expectation is the
486 stencil test will be used to discard samples not determined "covered" by a
487 prior StencilFillPathCHROMIUM command.
488
489 If /path/ does not name an existing path object, the command does
490 nothing (and no error is generated).
491
492 /coverMode/ must be BOUNDING_BOX_CHROMIUM.
493
494 When /coverMode/ is BOUNDING_BOX_CHROMIUM, the subset of accessible pixels
495 that are rasterized are within a bounding box (expected to be reasonably
496 tight) surrounding all the samples guaranteed to be rasterized by
497 CoverFillPathCHROMIUM. The bounding box must be orthogonally aligned to the
498 path space coordinate system. (The area of the bounding box in path space
499 is guaranteed to be greater than or equal the area of the convex hull in
500 path space.) Each rasterized sample will be rasterized once and exactly once
501 when BOUNDING_BOX_CHROMIUM is specified.
502
503 While samples with a net stencil change /must/ be rasterized,
504 implementations are explicitly allowed to vary in the rasterization
505 of samples for which StencilFillPathCHROMIUM would /not/ change sample's
506 net stencil value. This means implementations are allowed to (and,
507 in fact, are expected to) conservatively "exceed" the region strictly
508 stenciled by the path object.
509
510 CoverFillPathCHROMIUM /requires/ the following rasterization invariance:
511 calling CoverFillPathCHROMIUM for the same (unchanged) path object with
512 fixed (unchanged) modelview, projection, and viewport transform state
513 with the same (unchanged) set of accessible samples will rasterize
514 the exact same set of samples with identical interpolated values
515 for respective fragment/sample locations.
516
517 void CoverStrokePathCHROMIUM(uint path, enum coverMode)
518
519 The command operates in the same manner as CoverFillPathCHROMIUM except the
520 region guaranteed to be rasterized is, rather than the region within
521 /path/'s filled outline, instead the region within the /path/'s stroked
522 region as determined by StencilStrokePathCHROMIUM. During this
523 rasterization, the stencil test operates normally and as configured; the
524 expectation is the stencil test will be used to discard samples not
525 determined "covered" by a prior StencilStrokePathCHROMIUM command.
526
527 /coverMode/ must be BOUNDING_BOX_CHROMIUM.
528
529 If /path/ does not name an existing path object, the command does
530 nothing (and no error is generated).
531
532 Analogous to the rasterization guarantee of CoverFillPathCHROMIUM with
533 respect to StencilFillPathCHROMIUM, CoverStrokePathCHROMIUM guarantees that
534 all samples rasterized by StencilStrokePathCHROMIUM, given the same
535 transforms and accessible pixels and stroke width, will also be rasterized
536 by the corresponding CoverStrokePathCHROMIUM.
537
538 CoverStrokePathCHROMIUM /requires/ the following rasterization invariance:
539 calling CoverStrokePathCHROMIUM for the same (unchanged) path object with
540 fixed (unchanged) modelview, projection, and viewport transform state and
541 with the same (unchanged) set of accessible samples will rasterize the exact
542 same set of samples with identical interpolated values for respective
543 fragment/sample locations.
544
545 void StencilFillPathInstancedCHROMIUM(sizei numPaths,
546 enum pathNameType, const void *paths,
piman 2014/04/24 22:26:36 since pathNameType is always UNSIGNED_INT, why not
Kimmo Kinnunen 2014/04/25 12:46:30 "API discussion"
547 uint pathBase,
548 enum fillMode, uint mask,
549 enum transformType,
550 const float *transformValues);
551
552 The command stencils a sequence of filled paths.
553
554 The /pathBase/ is an offset added to the /numPaths/ path names read
555 from the /paths/ array (interpreted based on /pathNameType/).
556
557 The /pathNameType/ determines the type of elements of the /paths/
558 array and must be UNSIGNED_INT, otherwise INVALID_ENUM is generated.
559
560 The /transformType/ must be one of NONE, TRANSLATE_X_CHROMIUM,
561 TRANSLATE_Y_CHROMIUM, TRANSLATE_2D_CHROMIUM, TRANSLATE_3D_CHROMIUM,
562 AFFINE_2D_CHROMIUM, AFFINE_3D_CHROMIUM, TRANSPOSE_AFFINE_2D_CHROMIUM, or
563 TRANSPOSE_AFFINE_3D_CHROMIUM.
564
565 The /fillMode/ and /mask/ are validated identically to the same-named
566 parameters of StencilFillPathCHROMIUM.
567
568 The StencilFillPathInstancedCHROMIUM command is equivalent to:
569
570 const float *v = transformValues;
571 for (int i = 0; i<numPaths; i++) {
572 float m[16];
573
574 GetFloatv(MODELVIEW_MATRIX, m); // save matrix
575 v = applyTransformType(transformType, v);
576 uint pathName;
577 bool stopEarly = getPathName(pathNameType, paths, pathBase, pathName);
piman 2014/04/24 22:26:36 getPathName returns an int instead of a bool... ma
Kimmo Kinnunen 2014/04/25 12:46:30 Done. (Made getPathName to return (GL)bool).
578 if (stopEarly)
579 return;
580 StencilFillPathCHROMIUM(pathName, fillMode, mask);
581 MatrixLoadfCHROMIUM(MODELVIEW, m); // restore matrix
582 }
583
584 assuming these helper functions for applyTransformType and
585 getPathName:
586
587 const float *applyTransformType(enum transformType, const float *v)
588 {
589 float m[16];
590 switch (transformType) {
591 case NONE:
592 break;
593 case TRANSLATE_X_CHROMIUM:
594 // translate the MODELVIEW matrix with value v[0]
595 v++;
596 break;
597 case TRANSLATE_Y_CHROMIUM:
598 // translate the MODELVIEW matrix with value v[0]
599 v++;
600 break;
601 case TRANSLATE_2D_CHROMIUM:
602 // translate the MODELVIEW matrix with values v[0] and v[1]
603 v+=2;
604 break;
605 case TRANSLATE_3D_CHROMIUM:
606 // translate the MODELVIEW matrix with values v[0], v[1] and v[2]
607 v+=3;
608 break;
609 case AFFINE_2D_CHROMIUM:
610 m[0] =v[0]; m[4] =v[2]; m[8] =0; m[12]=v[4];
611 m[1] =v[1]; m[5] =v[3]; m[9] =0; m[13]=v[5];
612 m[2] =0; m[6] =0; m[10]=1; m[14]=0;
613 m[3] =0; m[7] =0; m[11]=0; m[15]=1;
614 v += 6;
615 // multiply the MODELVIEW matrix with m
616 break;
617 case TRANSPOSE_AFFINE_2D_CHROMIUM:
618 m[0] =v[0]; m[4] =v[1]; m[8] =0; m[12]=v[2];
619 m[1] =v[3]; m[5] =v[4]; m[9] =0; m[13]=v[5];
620 m[2] =0; m[6] =0; m[10]=1; m[14]=0;
621 m[3] =0; m[7] =0; m[11]=0; m[15]=1;
622 v += 6;
623 // multiply the MODELVIEW matrix with m
624 break;
625 case AFFINE_3D_CHROMIUM:
626 m[0] =v[0]; m[4] =v[3]; m[8] =v[6]; m[12]=v[9];
627 m[1] =v[1]; m[5] =v[4]; m[9] =v[7]; m[13]=v[10];
628 m[2] =v[2]; m[6] =v[5]; m[10]=v[8]; m[14]=v[11];
629 m[3] =0; m[7] =0; m[11]=1; m[15]=0;
630 v += 12;
631 // multiply the MODELVIEW matrix with m
632 break;
633 case TRANSPOSE_AFFINE_3D_CHROMIUM:
634 m[0] =v[0]; m[4] =v[1]; m[8] =v[2]; m[12]=v[3];
635 m[1] =v[4]; m[5] =v[5]; m[9] =v[6]; m[13]=v[7];
636 m[2] =v[8]; m[6] =v[9]; m[10]=v[10]; m[14]=v[11];
637 m[3] =0; m[7] =0; m[11]=1; m[15]=0;
638 v += 12;
639 // multiply the MODELVIEW matrix with m
640 break;
641 default: // generate INVALID_ENUM
642 }
643 return v;
644 }
645
646 int getPathName(enum pathNameType, const void *&paths,
647 uint pathBase, uint &pathName)
648 {
649 switch (pathNameType) {
650 case UNSIGNED_INT:
651 {
652 const uint *p = (const uint*)paths;
653 pathName = pathBase + p[0];
654 paths = p+1;
655 return 1;
656 }
657 default: // generate INVALID_ENUM
658 }
659 }
660
661
662 void StencilStrokePathInstancedCHROMIUM(sizei numPaths,
663 enum pathNameType, const void *paths,
664 uint pathBase,
665 int reference, uint mask,
666 enum transformType,
667 const float *transformValues);
668
669 The command stencils a sequence of stroked paths and is equivalent to:
670
671 const float *v = transformValues;
672 for (int i = 0; i<numPaths; i++) {
673 float m[16];
674 GetFloatv(MODELVIEW_MATRIX, m); // save matrix
675 v = applyTransformType(transformType, v);
676 uint pathName;
677 bool stopEarly = getPathName(pathNameType, paths, pathBase, pathName);
678 if (stopEarly)
679 return;
680 StencilStrokePathCHROMIUM(pathName, reference, mask);
681 MatrixLoadfCHROMIUM(MODELVIEW, m); // restore matrix
682 }
683
684 assume the helper functions for applyTransformType and
685 getPathName defined above.
686
687 void CoverFillPathInstancedCHROMIUM(sizei numPaths,
688 enum pathNameType, const void *paths,
689 uint pathBase,
690 enum coverMode,
691 enum transformType,
692 const float *transformValues);
693
694 /coverMode/ must be BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM.
695
696 The command covers a sequence of filled paths and is equivalent to:
697
698 renderBoundingBox(FALSE,
699 numPaths,
700 pathNameType, paths,
701 pathBase,
702 transformType, transformValues);
703
704 assuming these helper functions for applyTransformType and
705 getPathName defined above as well as:
706
707 void renderBoundingBox(bool shouldRenderStroke,
708 sizei numPaths,
709 enum pathNameType,
710 const void *paths,
711 uint pathBase,
712 enum transformType,
713 const float *transformValues)
714 {
715 boolean hasBounds = FALSE;
716 float boundsUnion[4], bounds[4];
717
718 const float *v = transformValues;
719 for (int i = 0; i<numPaths; i++) {
720 uint pathName;
721 bool stopEarly = getPathName(pathNameType, paths, pathBase, pathName );
722 if (stopEarly)
723 return;
724 if (IsPath(pathName)) {
725 GetPathBoundingBox(pathName, shouldRenderStroke, bounds);
726 switch (transformType) {
727 case NONE:
728 break;
729 case TRANSLATE_X_CHROMIUM:
730 bounds[0] += v[0];
731 bounds[2] += v[0];
732 v += 1;
733 break;
734 case TRANSLATE_Y_CHROMIUM:
735 bounds[1] += v[0];
736 bounds[3] += v[0];
737 v += 1;
738 break;
739 case TRANSLATE_2D_CHROMIUM:
740 bounds[0] += v[0];
741 bounds[1] += v[1];
742 bounds[2] += v[0];
743 bounds[3] += v[1];
744 v += 2;
745 break;
746 case TRANSLATE_3D_CHROMIUM: // ignores v[2]
747 bounds[0] += v[0];
748 bounds[1] += v[1];
749 bounds[2] += v[0];
750 bounds[3] += v[1];
751 v += 3;
752 break;
753 case AFFINE_2D_CHROMIUM:
754 bounds[0] = bounds[0]*v[0] + bounds[0]*v[2] + v[4];
755 bounds[1] = bounds[1]*v[1] + bounds[1]*v[3] + v[5];
756 bounds[2] = bounds[2]*v[0] + bounds[2]*v[2] + v[4];
757 bounds[3] = bounds[3]*v[1] + bounds[3]*v[3] + v[5];
758 v += 6;
759 break;
760 case TRANSPOSE_AFFINE_2D_CHROMIUM:
761 bounds[0] = bounds[0]*v[0] + bounds[0]*v[1] + v[2];
762 bounds[1] = bounds[1]*v[3] + bounds[1]*v[4] + v[5];
763 bounds[2] = bounds[2]*v[0] + bounds[2]*v[1] + v[2];
764 bounds[3] = bounds[3]*v[3] + bounds[3]*v[4] + v[5];
765 v += 6;
766 break;
767 case AFFINE_3D_CHROMIUM: // ignores v[2], v[5], v[6..8], v[11]
768 bounds[0] = bounds[0]*v[0] + bounds[0]*v[3] + v[9];
769 bounds[1] = bounds[1]*v[1] + bounds[1]*v[4] + v[10];
770 bounds[2] = bounds[2]*v[0] + bounds[2]*v[3] + v[9];
771 bounds[3] = bounds[3]*v[1] + bounds[3]*v[4] + v[10];
772 v += 12;
773 break;
774 case TRANSPOSE_AFFINE_3D_CHROMIUM: // ignores v[2], v[6], v[8..11 ]
775 bounds[0] = bounds[0]*v[0] + bounds[0]*v[1] + v[3];
776 bounds[1] = bounds[1]*v[4] + bounds[1]*v[5] + v[7];
777 bounds[2] = bounds[2]*v[0] + bounds[2]*v[1] + v[3];
778 bounds[3] = bounds[3]*v[4] + bounds[3]*v[5] + v[7];
779 v += 12;
780 break;
781 default: // generate INVALID_ENUM
782 }
783 if (bounds[0] > bounds[2]) {
784 float t = bounds[2];
785 bounds[2] = bounds[0];
786 bounds[0] = t;
787 }
788 if (bounds[1] > bounds[3]) {
789 float t = bounds[3];
790 bounds[3] = bounds[1];
791 bounds[1] = t;
792 }
793 if (hasBounds) {
794 if (bounds[0] < boundsUnion[0]) {
795 boundsUnion[0] = bounds[0];
796 }
797 if (bounds[1] < boundsUnion[1]) {
798 boundsUnion[1] = bounds[1];
799 }
800 if (bounds[2] > boundsUnion[2]) {
801 boundsUnion[2] = bounds[2];
802 }
803 if (bounds[3] > boundsUnion[3]) {
804 boundsUnion[3] = bounds[3];
805 }
806 } else {
807 for (int i=0; i<4; i++) {
808 boundsUnion[i] = bounds[i];
809 }
810 hasBounds = TRUE;
811 }
812 }
813 }
814 if (hasBounds) {
815 Rectf(bounds[0], bounds[1], bounds[2], bounds[3]);
816 }
817 }
818
819 Where helper IsPath checks if the path is a defined,
820 GetPathBoundingBox returns bounding box for the path with or without
821 stroking, and Rectf renders a rectangle.
822
823 void CoverStrokePathInstancedCHROMIUM(sizei numPaths,
piman 2014/04/24 22:26:36 Would it make sense to combine this with CoverFill
Kimmo Kinnunen 2014/04/25 12:46:30 This is the "API discussion".
824 enum pathNameType, const void *paths,
825 uint pathBase,
826 enum coverMode,
827 enum transformType,
828 const float *transformValues);
829
830 /coverMode/ must be BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM.
831
832 The command covers a sequence of stroked paths and is equivalent to:
833
834 renderBoundingBox(TRUE,
835 numPaths,
836 pathNameType, paths,
837 pathBase,
838 transformType, transformValues);
839
840 assuming these helper functions defined above.
841
842
843
50 Errors 844 Errors
51 845
52 None. 846 None.
53 847
54 New State 848 New State
55 849
56 Get Value Type Get Command Initial Description 850 Get Value Type Get Command Initial Description
57 ------------------------- ----- ------------ -------- ------------------- 851 ------------------------- ----- ------------ -------- -------------------
58 MODELVIEW_MATRIX_CHROMIUM 16xR GetFloatv all 0's Current modelview 852 MODELVIEW_MATRIX_CHROMIUM 16xR GetFloatv all 0's Current modelview
59 matrix for path rend ering 853 matrix for path rend ering
60 PROJECTION_MATRIX_CHROMIUM 16xR GetFloatv all 0's Current projection 854 PROJECTION_MATRIX_CHROMIUM 16xR GetFloatv all 0's Current projection
61 matrix for path rend ering 855 matrix for path rend ering
856 PATH_STENCIL_FUNC_CHROMIUM Z8 GetIntegerv ALWAYS path stenciling func tion
857 PATH_STENCIL_REF_CHROMIUM Z+ GetIntegerv 0 path stenciling
858 reference value
859 PATH_STENCIL_VALUE_MASK_CHROMIUM path stencil read
860 Z+ GetIntegerv 1's mask
861
862 Tables
863 Table 5.pathCommands: Path Commands
864
865 Character Coordinate
866 Token Description alias count
867 ========================== ===================== ========== ==========
868 MOVE_TO_NV Absolute move 'M' 2
piman 2014/04/24 22:26:36 nit: _CHROMIUM (here and below)
Kimmo Kinnunen 2014/04/25 12:46:30 Done.
869 current point
870 -------------------------- --------------------- ---------- ----------
871 CLOSE_PATH_NV Close path 'Z' or 'z' 0
872 -------------------------- --------------------- ---------- ----------
873 LINE_TO_NV Absolute line 'L' 2
874 -------------------------- --------------------- ---------- ----------
875 QUADRATIC_CURVE_TO_NV Absolute quadratic 'Q' 4
876 CUBIC_CURVE_TO_NV Absolute cubic 'C' 6
877 Bezier segment
878 -------------------------- --------------------- ---------- ----------
879
880 Table 5.pathParameters
881 Name Type Required Values or Range
882 ------------------------------- ------- ---------------------------------- -------------
883 PATH_STROKE_WIDTH_CHROMIUM float non-negative
884 PATH_INITIAL_END_CAP_CHROMIUM enum FLAT, SQUARE_CHROMIUM, ROUND_CHROM IUM
885 PATH_TERMINAL_END_CAP_CHROMIUM enum FLAT, SQUARE_CHROMIUM, ROUND_CHROM IUM
886 PATH_JOIN_STYLE_CHROMIUM enum MITER_REVERT_CHROMIUM, BEVEL_CHROM IUM, ROUND_CHROMIUM
887 PATH_MITER_LIMIT_CHROMIUM float non-negative
62 888
63 Revision History 889 Revision History
64 890
65 23/4/2014 Documented the extension 891 23/4/2014 Documented the extension
OLDNEW
« no previous file with comments | « no previous file | gpu/GLES2/gl2chromium.h » ('j') | gpu/command_buffer/build_gles2_cmd_buffer.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698