make-stage
is the function that create an object that can be passed to the translate
function. It takes the following arguments:
kind
This must be one of the keywords in stage-names:
- :vertex
- :tessellation-control
- :tessellation-evaluation
- :geometry
- :fragment
- :compute
in-args
Must be a list of input parameters to the stage. These are the values to which change
per element that is being processed, whether that be per vertex, fragment, patch,
instance, etc.
The input variables are defined as lists in the following fashion:
(variable-name
type-spec
&rest optional-qualifier-designators ["explicit-glsl-name"])
Usually this looks like:
(vert :vec4)
(data lighting-data)
(length :int :flat) <- flat is the qualifier in this case
If the last element of the list is a string, then that string is used as the name of the variable in the compiled GLSL. This is very rarely used and should generally be avoided.
uniforms
This is a list of the uniforms to stage. These are the values that stay the same (are
uniform) for the duration of the pipeline.
They are defined in the same way as the above 'in-args' except that, if the type-spec
specified a struct type the following additional qualifiers are allowed:
:ssbo
:ubo
:std-140
:std-430
The result of make-stage
is an instance of one of the subclasses of the stage
type.
context
The context argument must be a list that may contain any number of symbols from supported-versions. Context is used to specify the GLSL version to compile the
stage.
NOTE: The name 'context' is legacy at this point as it is only used to specify
GLSL versions.
code
This must be a list containing the forms that make up the 'body' of the stage.
It is not legal for this argument to be nil.
stemcells-allowed (optional)
If this argument is not NIL then the compiler will allow the capture of globally
scoped variables from Common Lisp and use of add-lisp-form-as-uniform
from
within macros. For details on how to support 'global variable capture' please see
the documentation for with-stemcell-infer-hook
& with-constant-inject-hook
primitive (optional)
This can be nil, a instance of the type 'primitive or a valid 'primitive
designator' as specified by the valid-primitive-name-p
function.
Primitive designators are either one of the following keywords..
:dynamic
:points
:lines
:iso-lines
:line-loop
:line-strip
:lines-adjacency
:line-strip-adjacency
:triangles
:triangle-fan
:triangle-strip
:triangles-adjacency
:triangle-strip-adjacency
:quads
.. or a list whos first element is :patches
and the second (and final) element
is a positive integer that is greater than 1. This specifies the length of
the patch.
Whilst this is optional in make-stage
it must be set before being passed to
translate if the stage kind is one of the following:
- tessellation-control-stage
- tessellation-evaluation-stage
- geometry-stage
Or if it the first stage in the list of stages passed to rolling-translate
and if some of the other stages are of the above kinds.