]> gitweb.factorcode.org Git - factor.git/blob - extra/gpu/state/state-docs.factor
Update some copyright headers to follow the current convention
[factor.git] / extra / gpu / state / state-docs.factor
1 ! Copyright (C) 2009 Joe Groff.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: help.markup help.syntax kernel math math.rectangles
4 sequences ;
5 IN: gpu.state
6
7 HELP: <blend-mode>
8 { $values
9     { "equation" blend-equation } { "source-function" blend-function } { "dest-function" blend-function }
10     { "blend-mode" blend-mode }
11 }
12 { $description "Constructs a " { $link blend-mode } " tuple." } ;
13
14 { blend-mode <blend-mode> } related-words
15
16 HELP: <blend-state>
17 { $values
18     { "constant-color" sequence } { "rgb-mode" { $maybe blend-mode } } { "alpha-mode" { $maybe blend-mode } }
19     { "blend-state" blend-state }
20 }
21 { $description "Constructs a " { $link blend-state } " tuple." } ;
22
23 { blend-state <blend-state> get-blend-state } related-words
24
25 HELP: <depth-range-state>
26 { $values
27     { "near" float } { "far" float }
28     { "depth-range-state" depth-range-state }
29 }
30 { $description "Constructs a " { $link depth-range-state } " tuple." } ;
31
32 { depth-range-state <depth-range-state> get-depth-range-state } related-words
33
34 HELP: <depth-state>
35 { $values
36     { "comparison" comparison }
37     { "depth-state" depth-state }
38 }
39 { $description "Constructs a " { $link depth-state } " tuple." } ;
40
41 { depth-state <depth-state> get-depth-state } related-words
42
43 HELP: <line-state>
44 { $values
45     { "width" float } { "antialias?" boolean }
46     { "line-state" line-state }
47 }
48 { $description "Constructs a " { $link line-state } " tuple." } ;
49
50 { line-state <line-state> get-line-state } related-words
51
52 HELP: <mask-state>
53 { $values
54     { "color" sequence } { "depth" boolean } { "stencil-front" boolean } { "stencil-back" boolean }
55     { "mask-state" mask-state }
56 }
57 { $description "Constructs a " { $link mask-state } " tuple." } ;
58
59 { mask-state <mask-state> get-mask-state } related-words
60
61 HELP: <multisample-state>
62 { $values
63     { "multisample?" boolean } { "sample-alpha-to-coverage?" boolean } { "sample-alpha-to-one?" boolean } { "sample-coverage" { $maybe float } } { "invert-sample-coverage?" boolean }
64     { "multisample-state" multisample-state }
65 }
66 { $description "Constructs a " { $link multisample-state } " tuple." } ;
67
68 { multisample-state <multisample-state> get-multisample-state } related-words
69
70 HELP: <point-state>
71 { $values
72     { "size" { $maybe float } } { "sprite-origin" point-sprite-origin } { "fade-threshold" float }
73     { "point-state" point-state }
74 }
75 { $description "Constructs a " { $link point-state } " tuple." } ;
76
77 { point-state <point-state> get-point-state } related-words
78
79 HELP: <scissor-state>
80 { $values
81     { "rect" { $maybe rect } }
82     { "scissor-state" scissor-state }
83 }
84 { $description "Constructs a " { $link scissor-state } " tuple." } ;
85
86 { scissor-state <scissor-state> get-scissor-state } related-words
87
88 HELP: <stencil-mode>
89 { $values
90     { "value" integer } { "mask" integer } { "comparison" comparison } { "stencil-fail-op" stencil-op } { "depth-fail-op" stencil-op } { "depth-pass-op" stencil-op }
91     { "stencil-mode" stencil-mode }
92 }
93 { $description "Constructs a " { $link stencil-mode } " tuple." } ;
94
95 { stencil-mode <stencil-mode> } related-words
96
97 HELP: <stencil-state>
98 { $values
99     { "front-mode" { $maybe stencil-mode } } { "back-mode" { $maybe stencil-mode } }
100     { "stencil-state" stencil-state }
101 }
102 { $description "Constructs a " { $link stencil-state } " tuple." } ;
103
104 { stencil-state <stencil-state> get-stencil-state } related-words
105
106 HELP: <triangle-cull-state>
107 { $values
108     { "front-face" triangle-face } { "cull" { $maybe triangle-cull } }
109     { "triangle-cull-state" triangle-cull-state }
110 }
111 { $description "Constructs a " { $link triangle-cull-state } " tuple." } ;
112
113 { triangle-cull-state <triangle-cull-state> get-triangle-cull-state } related-words
114
115 HELP: <triangle-state>
116 { $values
117     { "front-mode" triangle-mode } { "back-mode" triangle-mode } { "antialias?" boolean }
118     { "triangle-state" triangle-state }
119 }
120 { $description "Constructs a " { $link triangle-state } " tuple." } ;
121
122 { triangle-state <triangle-state> get-triangle-state } related-words
123
124 HELP: <viewport-state>
125 { $values
126     { "rect" rect }
127     { "viewport-state" viewport-state }
128 }
129 { $description "Constructs a " { $link viewport-state } " tuple." } ;
130
131 { viewport-state <viewport-state> get-viewport-state } related-words
132
133 HELP: blend-equation
134 { $class-description "The " { $snippet "blend-equation" } " of a " { $link blend-mode } " determines how the source and destination color values are combined after they have been multiplied by the result of their respective " { $link blend-function } "s."
135 { $list
136 { { $link eq-add } " indicates that the source and destination results are added." }
137 { { $link eq-subtract } " indicates that the destination result is subtracted from the source." }
138 { { $link eq-reverse-subtract } " indicates that the source result is subtracted from the destination." }
139 { { $link eq-min } " indicates that the componentwise minimum of the source and destination results is taken." }
140 { { $link eq-max } " indicates that the componentwise maximum of the source and destination results is taken." }
141 } } ;
142
143 HELP: blend-function
144 { $class-description "The " { $snippet "blend-function" } "s of a " { $link blend-mode } " multiply the source and destination colors being blended by a function of their values before they are combined by the " { $link blend-equation } "."
145 { $list
146     { { $link func-zero } " returns a constant factor of zero." }
147     { { $link func-one } " returns a constant factor of one." }
148     { { $link func-source } " returns the corresponding source color component for every result component." }
149     { { $link func-one-minus-source } " returns one minus the corresponding source color component for every result component." }
150     { { $link func-dest } " returns the corresponding destination color component for every result component." }
151     { { $link func-one-minus-dest } " returns one minus the corresponding destination color component for every result component." }
152     { { $link func-constant } " returns the corresponding component of the current " { $link blend-state } "'s " { $snippet "constant-color" } " for every result component." }
153     { { $link func-one-minus-constant } " returns one minus the corresponding component of the current " { $link blend-state } "'s " { $snippet "constant-color" } " for every result component." }
154     { { $link func-source-alpha } " returns the source alpha component for every result component." }
155     { { $link func-one-minus-source-alpha } " returns one minus the source alpha component for every result component." }
156     { { $link func-dest-alpha } " returns the destination alpha component for every result component." }
157     { { $link func-one-minus-dest-alpha } " returns one minus the destination alpha component for every result component." }
158     { { $link func-constant-alpha } " returns the alpha component of the current " { $link blend-state } "'s " { $snippet "constant-color" } " for every result component." }
159     { { $link func-one-minus-constant-alpha } " returns one minus the alpha component of the current " { $link blend-state } "'s " { $snippet "constant-color" } " for every result component." }
160 } } ;
161
162 HELP: blend-mode
163 { $class-description "A " { $link blend-mode } " is specified as part of the " { $link blend-state } " to determine the blending equation used between the source (incoming fragment) and destination (existing framebuffer value) colors of blended pixels."
164 { $list
165 { "The " { $snippet "equation" } " slot determines how the source and destination colors are combined after the " { $snippet "source-function" } " and " { $snippet "dest-function" } " have been applied."
166     { $list
167     { { $link eq-add } " indicates that the source and destination results are added." }
168     { { $link eq-subtract } " indicates that the destination result is subtracted from the source." }
169     { { $link eq-reverse-subtract } " indicates that the source result is subtracted from the destination." }
170     { { $link eq-min } " indicates that the componentwise minimum of the source and destination results is taken." }
171     { { $link eq-max } " indicates that the componentwise maximum of the source and destination results is taken." }
172     }
173 }
174 { "The " { $snippet "source-function" } " and " { $snippet "dest-function" } " slots each specify a function to apply to the source, destination, or constant color values to generate a blending factor that is multiplied respectively against the source or destination value before feeding the results to the " { $snippet "equation" } "."
175 }
176     { $list
177     { { $link func-zero } " returns a constant factor of zero." }
178     { { $link func-one } " returns a constant factor of one." }
179     { { $link func-source } " returns the corresponding source color component for every result component." }
180     { { $link func-one-minus-source } " returns one minus the corresponding source color component for every result component." }
181     { { $link func-dest } " returns the corresponding destination color component for every result component." }
182     { { $link func-one-minus-dest } " returns one minus the corresponding destination color component for every result component." }
183     { { $link func-constant } " returns the corresponding component of the current " { $link blend-state } "'s " { $snippet "constant-color" } " for every result component." }
184     { { $link func-one-minus-constant } " returns one minus the corresponding component of the current " { $link blend-state } "'s " { $snippet "constant-color" } " for every result component." }
185     { { $link func-source-alpha } " returns the source alpha component for every result component." }
186     { { $link func-one-minus-source-alpha } " returns one minus the source alpha component for every result component." }
187     { { $link func-dest-alpha } " returns the destination alpha component for every result component." }
188     { { $link func-one-minus-dest-alpha } " returns one minus the destination alpha component for every result component." }
189     { { $link func-constant-alpha } " returns the alpha component of the current " { $link blend-state } "'s " { $snippet "constant-color" } " for every result component." }
190     { { $link func-one-minus-constant-alpha } " returns one minus the alpha component of the current " { $link blend-state } "'s " { $snippet "constant-color" } " for every result component." }
191 }
192 "A typical transparency effect will use the values:"
193 { $code "T{ blend-mode
194     { equation eq-add }
195     { source-function func-source-alpha }
196     { dest-function func-one-minus-source-alpha }
197 }" }
198 } } ;
199
200 HELP: blend-state
201 { $class-description "The " { $snippet "blend-state" } " controls how alpha blending between the current framebuffer contents and newly drawn pixels."
202 { $list
203 { "The " { $snippet "constant-color" } " slot contains an optional four-" { $link float } " sequence that specifies a constant parameter to the " { $snippet "func-*constant*" } " " { $link blend-function } "s. If constant blend functions are not used, the slot can be " { $link f } "." }
204 { "The " { $snippet "rgb-mode" } " and " { $snippet "alpha-mode" } " slots both contain " { $link blend-mode } " values that determine the blending equation used between RGB and alpha channel values, respectively. If both slots are " { $link f } ", blending is disabled." }
205 } } ;
206
207 HELP: cmp-always
208 { $class-description "This " { $link comparison } " test always succeeds." } ;
209
210 HELP: cmp-equal
211 { $class-description "This " { $link comparison } " test succeeds if the compared values are equal." } ;
212
213 HELP: cmp-greater
214 { $class-description "This " { $link comparison } " test succeeds if the incoming value is greater than the buffer value." } ;
215
216 HELP: cmp-greater-equal
217 { $class-description "This " { $link comparison } " test succeeds if the incoming value is greater than or equal to the buffer value." } ;
218
219 HELP: cmp-less
220 { $class-description "This " { $link comparison } " test succeeds if the incoming value is less than the buffer value." } ;
221
222 HELP: cmp-less-equal
223 { $class-description "This " { $link comparison } " test succeeds if the incoming value is less than or equal to the buffer value." } ;
224
225 HELP: cmp-never
226 { $class-description "This " { $link comparison } " test always fails." } ;
227
228 HELP: cmp-not-equal
229 { $class-description "This " { $link comparison } " test succeeds if the compared values are not equal." } ;
230
231 HELP: comparison
232 { $class-description { $snippet "comparison" } " values are used in the " { $link stencil-state } " and " { $link depth-state } " and control how the fragment stencil and depth tests are performed. For the stencil test, a reference value (the " { $snippet "value" } " slot of the active " { $link stencil-mode } ") is compared to the stencil buffer value using the comparison operator. For the depth test, the incoming fragment depth is compared to the depth buffer value."
233 { $list
234 { { $link cmp-always } " always succeeds." }
235 { { $link cmp-never } " always fails." }
236 { { $link cmp-equal } " succeeds if the compared values are equal." }
237 { { $link cmp-not-equal } " succeeds if the compared values are not equal." }
238 { { $link cmp-less } " succeeds if the incoming value is less than the buffer value." }
239 { { $link cmp-less-equal } " succeeds if the incoming value is less than or equal to the buffer value." }
240 { { $link cmp-greater } " succeeds if the incoming value is greater than the buffer value." }
241 { { $link cmp-greater-equal } " succeeds if the incoming value is greater than or equal to the buffer value." }
242 } } ;
243
244 HELP: cull-all
245 { $class-description "This " { $link triangle-cull } " value culls all triangles." } ;
246
247 HELP: cull-back
248 { $class-description "This " { $link triangle-cull } " value culls back-facing triangles." } ;
249
250 HELP: cull-front
251 { $class-description "This " { $link triangle-cull } " value culls front-facing triangles." } ;
252
253 HELP: depth-range-state
254 { $class-description "The " { $snippet "depth-range-state" } " controls the range of depth values that are generated for fragments and used for depth testing and writing to the depth buffer."
255 { $list
256 { "The " { $snippet "near" } " slot contains a " { $link float } " value that will be assigned to fragments on the near plane. The default value is " { $snippet "0.0" } "." }
257 { "The " { $snippet "far" } " slot contains a " { $link float } " value that will be assigned to fragments on the far plane. The default value is " { $snippet "1.0" } "." }
258 } } ;
259
260 HELP: depth-state
261 { $class-description "The " { $snippet "depth-state" } " controls how incoming fragments' depth values are tested against the depth buffer. The " { $link comparison } " slot, if not " { $link f } ", determines the condition that must be true between the incoming fragment depth and depth buffer depth to pass a fragment. If the " { $snippet "comparison" } " is " { $link f } ", depth testing is disabled and all fragments pass. " { $link cmp-less } " is typically used for depth culling." } ;
262
263 HELP: eq-add
264 { $var-description "This " { $link blend-equation } " adds the source and destination colors together." } ;
265
266 HELP: eq-max
267 { $var-description "This " { $link blend-equation } " takes the componentwise maximum of the source and destination colors." } ;
268
269 HELP: eq-min
270 { $var-description "This " { $link blend-equation } " takes the componentwise minimum of the source and destination colors." } ;
271
272 HELP: eq-reverse-subtract
273 { $var-description "This " { $link blend-equation } " subtracts the source color from the destination color." } ;
274
275 HELP: eq-subtract
276 { $var-description "This " { $link blend-equation } " subtracts the destination color from the source color." } ;
277
278 HELP: face-ccw
279 { $class-description "This " { $link triangle-face } " value refers to the face with counterclockwise-wound vertices." } ;
280
281 HELP: face-cw
282 { $class-description "This " { $link triangle-face } " value refers to the face with clockwise-wound vertices." } ;
283
284 HELP: func-constant
285 { $class-description "This " { $link blend-function } " componentwise multiplies the input color by the current " { $link blend-state } "'s " { "constant-color" } " slot value." } ;
286
287 HELP: func-constant-alpha
288 { $class-description "This " { $link blend-function } " multiplies the input color by the alpha component of the current " { $link blend-state } "'s " { "constant-color" } " slot value." } ;
289
290 HELP: func-dest
291 { $class-description "This " { $link blend-function } " componentwise multiplies the input color by the destination color value." } ;
292
293 HELP: func-dest-alpha
294 { $class-description "This " { $link blend-function } " componentwise multiplies the input color by the alpha component of the destination color value." } ;
295
296 HELP: func-one
297 { $class-description "This " { $link blend-function } " multiplies the input color by one; that is, the input color is unchanged." } ;
298
299 HELP: func-one-minus-constant
300 { $class-description "This " { $link blend-function } " componentwise multiplies the input color by one minus the current " { $link blend-state } "'s " { "constant-color" } " slot value." } ;
301
302 HELP: func-one-minus-constant-alpha
303 { $class-description "This " { $link blend-function } " multiplies the input color by one minus the alpha component of the current " { $link blend-state } "'s " { "constant-color" } " slot value." } ;
304
305 HELP: func-one-minus-dest
306 { $class-description "This " { $link blend-function } " componentwise multiplies the input color by one minus the destination color value." } ;
307
308 HELP: func-one-minus-dest-alpha
309 { $class-description "This " { $link blend-function } " multiplies the input color by one minus the alpha component of the destination color value." } ;
310
311 HELP: func-one-minus-source
312 { $class-description "This " { $link blend-function } " componentwise multiplies the input color by one minus the source color value." } ;
313
314 HELP: func-one-minus-source-alpha
315 { $class-description "This " { $link blend-function } " multiplies the input color by one minus the alpha component source color value." } ;
316
317 HELP: func-source
318 { $class-description "This " { $link blend-function } " componentwise multiplies the input color by the source color value." } ;
319
320 HELP: func-source-alpha
321 { $class-description "This " { $link blend-function } " multiplies the input color by the alpha component of the source color value." } ;
322
323 HELP: func-source-alpha-saturate
324 { $class-description "This " { $link blend-function } " multiplies the input color by the minimum of the alpha component of the source color value and one minus the alpha component of the destination color value. It is only valid as the " { $snippet "source-function" } " of a " { $link blend-mode } "." } ;
325
326 HELP: func-zero
327 { $class-description "This " { $link blend-function } " multiplies the input color by zero." } ;
328
329 HELP: get-blend-state
330 { $values
331
332     { "blend-state" blend-state }
333 }
334 { $description "Retrieves the current GPU " { $link blend-state } "." } ;
335
336 HELP: get-depth-range-state
337 { $values
338
339     { "depth-range-state" depth-range-state }
340 }
341 { $description "Retrieves the current GPU " { $link depth-range-state } "." } ;
342
343 HELP: get-depth-state
344 { $values
345
346     { "depth-state" depth-state }
347 }
348 { $description "Retrieves the current GPU " { $link depth-state } "." } ;
349
350 HELP: get-line-state
351 { $values
352
353     { "line-state" line-state }
354 }
355 { $description "Retrieves the current GPU " { $link line-state } "." } ;
356
357 HELP: get-mask-state
358 { $values
359
360     { "mask-state" mask-state }
361 }
362 { $description "Retrieves the current GPU " { $link mask-state } "." } ;
363
364 HELP: get-multisample-state
365 { $values
366
367     { "multisample-state" multisample-state }
368 }
369 { $description "Retrieves the current GPU " { $link multisample-state } "." } ;
370
371 HELP: get-point-state
372 { $values
373
374     { "point-state" point-state }
375 }
376 { $description "Retrieves the current GPU " { $link point-state } "." } ;
377
378 HELP: get-scissor-state
379 { $values
380
381     { "scissor-state" scissor-state }
382 }
383 { $description "Retrieves the current GPU " { $link scissor-state } "." } ;
384
385 HELP: get-stencil-state
386 { $values
387
388     { "stencil-state" stencil-state }
389 }
390 { $description "Retrieves the current GPU " { $link stencil-state } "." } ;
391
392 HELP: get-triangle-cull-state
393 { $values
394
395     { "triangle-cull-state" triangle-cull-state }
396 }
397 { $description "Retrieves the current GPU " { $link triangle-cull-state } "." } ;
398
399 HELP: get-triangle-state
400 { $values
401
402     { "triangle-state" triangle-state }
403 }
404 { $description "Retrieves the current GPU " { $link triangle-state } "." } ;
405
406 HELP: get-viewport-state
407 { $values
408
409     { "viewport-state" viewport-state }
410 }
411 { $description "Retrieves the current GPU " { $link viewport-state } "." } ;
412
413 HELP: gpu-state
414 { $class-description "This class is a union of all the GPU state tuple classes that can be passed to " { $link set-gpu-state } ":"
415 { $list
416 { { $link viewport-state } }
417 { { $link scissor-state } }
418 { { $link multisample-state } }
419 { { $link stencil-state } }
420 { { $link depth-range-state } }
421 { { $link depth-state } }
422 { { $link blend-state } }
423 { { $link mask-state } }
424 { { $link triangle-cull-state } }
425 { { $link triangle-state } }
426 { { $link point-state } }
427 { { $link line-state } }
428 } } ;
429
430 HELP: line-state
431 { $class-description "The " { $snippet "line-state" } " controls how lines are rendered."
432 { $list
433 { "The " { $snippet "width" } " slot is a " { $link float } " value specifying the line width in pixels." }
434 { "The " { $snippet "antialias?" } " slot is a " { $link boolean } " value specifying whether line edges should be smoothed." }
435 }
436 } ;
437
438 HELP: mask-state
439 { $class-description "The " { $snippet "mask-state" } " controls what parts of the framebuffer are written to."
440 { $list
441 { "The " { $snippet "color" } " slot is a sequence of four " { $link boolean } " values specifying whether the red, green, blue, and alpha channels of the color buffer will be written to." }
442 { "The " { $snippet "depth" } " slot is a " { $link boolean } " value specifying whether the depth buffer will be written to." }
443 { "The " { $snippet "stencil-front" } " and " { $snippet "stencil-back" } " slots are " { $link integer } " values that indicate which bits of the stencil buffer will be written to for front- and back-facing triangles, respectively." }
444 } } ;
445
446 HELP: multisample-state
447 { $class-description "The " { $snippet "multisample-state" } " controls whether and how multisampling occurs."
448 { $list
449 { "The " { $snippet "multisample?" } " slot is a " { $link boolean } " value that determines whether multisampling is enabled." }
450 { "The " { $snippet "sample-alpha-to-coverage?" } " slot is a " { $link boolean } " value that determines whether sample coverage values are determined from their alpha components." }
451 { "The " { $snippet "sample-alpha-to-one?" } " slot is a " { $link boolean } " value that determines whether a sample's alpha value is replaced with one after its alpha-based coverage is calculated." }
452 { "The " { $snippet "sample-coverage" } " slot is an optional " { $link float } " value that is used to calculate another coverage value that is then combined with the alpha-based coverage. If " { $link f } ", the alpha-based coverage is untouched." }
453 { "The " { $snippet "invert-sample-coverage?" } " slot is a " { $link boolean } " value that, if true, indicates that the coverage value derived from " { $snippet "sample-coverage" } " should be inverted before being combined." }
454 } } ;
455
456 HELP: op-dec-sat
457 { $class-description "This " { $link stencil-op } " subtracts one from the stencil buffer value, leaving it unchanged if it is already zero." } ;
458
459 HELP: op-dec-wrap
460 { $class-description "This " { $link stencil-op } " subtracts one from the stencil buffer value, wrapping the value to the maximum storable value if it was zero." } ;
461
462 HELP: op-inc-sat
463 { $class-description "This " { $link stencil-op } " adds one to the stencil buffer value, leaving it unchanged if it is already the maximum storable value." } ;
464
465 HELP: op-inc-wrap
466 { $class-description "This " { $link stencil-op } " adds one to the stencil buffer value, wrapping the value to zero if it was the maximum storable value." } ;
467
468 HELP: op-invert
469 { $class-description "This " { $link stencil-op } " bitwise NOTs the stencil buffer value." } ;
470
471 HELP: op-keep
472 { $class-description "This " { $link stencil-op } " leaves the stencil buffer value unchanged." } ;
473
474 HELP: op-replace
475 { $class-description "This " { $link stencil-op } " sets the stencil buffer value to the reference " { $snippet "value" } "." } ;
476
477 HELP: op-zero
478 { $class-description "This " { $link stencil-op } " sets the stencil buffer value to zero." } ;
479
480 HELP: origin-lower-left
481 { "This " { $link point-sprite-origin } " value sets the point sprite coordinate origin to the lower left corner of the point and increases the Y coordinate upward." } ;
482
483 HELP: origin-upper-left
484 { "This " { $link point-sprite-origin } " value sets the point sprite coordinate origin to the upper left corner of the point and increases the Y coordinate downward." } ;
485
486 HELP: point-sprite-origin
487 { $class-description "The " { $snippet "point-sprite-origin" } " is set as part of the " { $link point-state } " and determines how point sprite coordinates are generated over the rendered area of a point."
488 { $list
489 { { $link origin-lower-left } " sets the coordinate origin to the lower left corner of the point and increases the Y coordinate upward." }
490 { { $link origin-upper-left } " sets the coordinate origin to the upper left corner of the point and increases the Y coordinate downward." }
491 } } ;
492
493 HELP: point-state
494 { $class-description "The " { $snippet "point-state" } " controls how points are drawn."
495 { $list
496 { "The " { $snippet "size" } " slot contains either a " { $link float } " value specifying a constant pixel radius for all points drawn, or " { $link f } ", in which case the vertex shader determines the size of each point independently." }
497 { "The " { $snippet "sprite-origin" } " slot contains either " { $link origin-lower-left } " or " { $link origin-upper-left } ", and determines whether the vertical point sprite coordinates fed to the fragment shader start at zero in the bottom corner and increase upward or start at zero in the upper corner and increase downward." }
498 { "If multisampling is enabled in the " { $link multisample-state } ", the " { $snippet "fade-threshold" } " slot specifies a pixel width at which the multisampling implementation may fade the alpha component of point fragments." }
499 } } ;
500
501 HELP: scissor-state
502 { $class-description "The " { $snippet "scissor-state" } " allows rendering output to be clipped to a rectangular region of the framebuffer. If the " { $snippet "rect" } " slot is set to a " { $link rect } " value, fragments outside that rectangle will be discarded. If it is " { $link f } ", fragments are allowed anywhere on the framebuffer." } ;
503
504 HELP: set-gpu-state
505 { $values
506     { "states" "a " { $link sequence } " or " { $link gpu-state } }
507 }
508 { $description "Changes the GPU state using the values passed in " { $snippet "states" } "." } ;
509
510 HELP: set-gpu-state*
511 { $values
512     { "state" gpu-state }
513 }
514 { $description "Changes the GPU state using a single " { $link gpu-state } " value." } ;
515
516 HELP: stencil-mode
517 { $class-description "A " { $snippet "stencil-mode" } " is specified as part of the " { $link stencil-state } " to define the interaction between an incoming fragment and the stencil buffer."
518 { $list
519 { "The " { $snippet "value" } " slot contains an " { $link integer } " value that is used as the reference value for the " { $snippet "comparison" } " of the stencil test." }
520 { "The " { $snippet "mask" } " slot contains an " { $link integer } " mask value that indicates which bits are relevant to the stencil test." }
521 { "The " { $snippet "comparison" } " slot contains a " { $link comparison } " value that indicates the comparison taken between the masked reference value and stored stencil buffer value to determine whether the fragment is allowed to pass." }
522 { "The " { $snippet "stencil-fail-op" } ", " { $snippet "depth-fail-op" } ", and " { $snippet "depth-pass-op" } " slots all contain " { $link stencil-op } " values that determine how the value in the stencil buffer is affected when the stencil test fails, the stencil test succeeds but depth test fails, and both stencil and depth tests succeed, respectively."
523     { $list
524     { { $link op-keep } " leaves the stencil buffer value unchanged." }
525     { { $link op-zero } " sets the stencil buffer value to zero." }
526     { { $link op-replace } " sets the stencil buffer value to the reference " { $snippet "value" } "." }
527     { { $link op-invert } " bitwise NOTs the stencil buffer value." }
528     { { $link op-inc-sat } " adds one to the stencil buffer value, leaving it unchanged if it is already the maximum storable value." }
529     { { $link op-dec-sat } " subtracts one from the stencil buffer value, leaving it unchanged if it is already zero." }
530     { { $link op-inc-wrap } " adds one to the stencil buffer value, wrapping the value to zero if it was the maximum storable value." }
531     { { $link op-dec-wrap } " subtracts one from the stencil buffer value, wrapping the value to the maximum storable value if it was zero." }
532     }
533 }
534 } } ;
535
536 HELP: stencil-op
537 { $class-description { $snippet "stencil-op" } "s are set as part of a " { $link stencil-mode } " and determine how the stencil buffer is modified by incoming fragments."
538 { $list
539 { { $link op-keep } " leaves the stencil buffer value unchanged." }
540 { { $link op-zero } " sets the stencil buffer value to zero." }
541 { { $link op-replace } " sets the stencil buffer value to the reference " { $snippet "value" } "." }
542 { { $link op-invert } " bitwise NOTs the stencil buffer value." }
543 { { $link op-inc-sat } " adds one to the stencil buffer value, leaving it unchanged if it is already the maximum storable value." }
544 { { $link op-dec-sat } " subtracts one from the stencil buffer value, leaving it unchanged if it is already zero." }
545 { { $link op-inc-wrap } " adds one to the stencil buffer value, wrapping the value to zero if it was the maximum storable value." }
546 { { $link op-dec-wrap } " subtracts one from the stencil buffer value, wrapping the value to the maximum storable value if it was zero." }
547 } } ;
548
549 HELP: stencil-state
550 { $class-description "The " { $snippet "stencil-state" } " controls how incoming fragments interact with the stencil buffer. The " { $snippet "front-mode" } " and " { $snippet "back-mode" } " slots are both " { $link stencil-mode } " tuples that define the stencil buffer interaction for front- and back-facing triangle fragments, respectively. If both slots are " { $link f } ", stencil testing is disabled." } ;
551
552 HELP: triangle-cull
553 { $class-description "The " { $snippet "cull" } " slot of the " { $link triangle-cull-state } " determines which triangle faces are culled, if any."
554 { $list
555 { { $link cull-all } " culls all triangles." }
556 { { $link cull-front } " culls front-facing triangles." }
557 { { $link cull-back } " culls back-facing triangles." }
558 } } ;
559
560 HELP: triangle-cull-state
561 { $class-description "The " { $snippet "triangle-cull-state" } " controls what faces of triangles are rasterized."
562 { $list
563 { "The " { $snippet "front-face" } " slot determines which vertex winding order is considered the front face of a triangle: " { $link face-ccw } " or " { $link face-cw } "." }
564 { "The " { $snippet "cull" } " slot determines which triangle faces are discarded: " { $link cull-front } ", " { $link cull-back } ", " { $link cull-all } ", or " { $link f } " to disable triangle culling." }
565 } } ;
566
567 HELP: triangle-face
568 { $class-description "A " { $snippet "triangle-face" } " value names a vertex winding order for triangles."
569 { $list
570 { { $link face-ccw } " indicates counterclockwise winding." }
571 { { $link face-cw } " indicates clockwise winding." }
572 } } ;
573
574 HELP: triangle-fill
575 { $class-description "This " { $link triangle-mode } " fills the entire surface of triangles." } ;
576
577 HELP: triangle-lines
578 { $class-description "This " { $link triangle-mode } " renders lines across the edges of triangles." } ;
579
580 HELP: triangle-mode
581 { $class-description "The " { $snippet "triangle-mode" } " is set as part of the " { $link triangle-state } " to determine how triangles are rendered."
582 { $list
583 { { $link triangle-points } " renders the vertices of triangles as if they were points." }
584 { { $link triangle-lines } " renders lines across the edges of triangles." }
585 { { $link triangle-fill } ", the default, fills the entire surface of triangles." }
586 } } ;
587
588 HELP: triangle-points
589 { $class-description "This " { $link triangle-mode } " renders the vertices of triangles as if they were points." } ;
590
591 HELP: triangle-state
592 { $class-description "The " { $snippet "triangle-state" } " controls how triangles are rasterized."
593 { $list
594 { "The " { $snippet "front-mode" } " and " { $snippet "back-mode" } " slots determine how a front- or back-facing triangle is rendered."
595     { $list
596     { { $link triangle-points } " renders the vertices of triangles as if they were points." }
597     { { $link triangle-lines } " renders lines across the edges of triangles." }
598     { { $link triangle-fill } ", the default, fills the entire surface of triangles." }
599     }
600 }
601 { "The " { $snippet "antialias?" } " slot contains a " { $link boolean } " value that decides whether the edges of triangles should be smoothed." }
602 } } ;
603
604 HELP: viewport-state
605 { $class-description "The " { $snippet "viewport-state" } " controls the rectangular region of the framebuffer to which window-space coordinates are mapped. Window-space vertices are mapped from the rectangle <-1.0, -1.0>­<1.0, 1.0> to the rectangular region specified by the " { $snippet "rect" } " slot." } ;
606
607 ARTICLE: "gpu.state" "GPU state"
608 "The " { $vocab-link "gpu.state" } " vocabulary provides words for querying and setting GPU state."
609 { $subsections set-gpu-state }
610 "The following state tuples are available:"
611 { $subsections
612     viewport-state
613     scissor-state
614     multisample-state
615     stencil-state
616     depth-range-state
617     depth-state
618     blend-state
619     mask-state
620     triangle-cull-state
621     triangle-state
622     point-state
623     line-state
624 } ;
625
626 ABOUT: "gpu.state"