This is the glsl-toolkit Reference Manual, version 1.0.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 06:18:49 2024 GMT+0.
glsl-toolkit/glsl-toolkit.asd
glsl-toolkit/package.lisp
glsl-toolkit/toolkit.lisp
glsl-toolkit/parser.lisp
glsl-toolkit/grammar.lisp
glsl-toolkit/printer.lisp
glsl-toolkit/walker.lisp
glsl-toolkit/merge.lisp
glsl-toolkit/sexpr.lisp
glsl-toolkit/transform.lisp
glsl-toolkit/method-combination.lisp
glsl-toolkit/documentation.lisp
The main system appears first, followed by any subsystem dependency.
glsl-toolkit
A library to parse and modify OpenGL Shader Language (GLSL) source code
Yukari Hafner <shinmera@tymoon.eu>
Yukari Hafner <shinmera@tymoon.eu>
(GIT https://github.com/Shirakumo/glsl-toolkit.git)
zlib
1.0.0
documentation-utils
(system).
parse-float
(system).
trivial-indent
(system).
cl-ppcre
(system).
package.lisp
(file).
toolkit.lisp
(file).
parser.lisp
(file).
grammar.lisp
(file).
printer.lisp
(file).
walker.lisp
(file).
merge.lisp
(file).
sexpr.lisp
(file).
transform.lisp
(file).
method-combination.lisp
(file).
documentation.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
glsl-toolkit/glsl-toolkit.asd
glsl-toolkit/package.lisp
glsl-toolkit/toolkit.lisp
glsl-toolkit/parser.lisp
glsl-toolkit/grammar.lisp
glsl-toolkit/printer.lisp
glsl-toolkit/walker.lisp
glsl-toolkit/merge.lisp
glsl-toolkit/sexpr.lisp
glsl-toolkit/transform.lisp
glsl-toolkit/method-combination.lisp
glsl-toolkit/documentation.lisp
glsl-toolkit/toolkit.lisp
package.lisp
(file).
glsl-toolkit
(system).
*glsl-keyword-symbols*
(special variable).
*glsl-keywords*
(special variable).
ends-with
(function).
enlist
(function).
find-any
(function).
mapcar*
(function).
merge-plists
(function).
starts-with
(function).
unlist
(function).
glsl-toolkit/parser.lisp
toolkit.lisp
(file).
glsl-toolkit
(system).
advance
(compiler macro).
advance
(function).
backtrack
(compiler macro).
backtrack
(function).
compile-rule
(function).
consume
(compiler macro).
consume
(function).
consume-any
(function).
consume-notany
(function).
consume-string
(function).
consume-whitespace
(function).
define-object
(macro).
define-reference
(macro).
define-rule
(macro).
end-of-tokens-p
(compiler macro).
end-of-tokens-p
(function).
lex
(function).
no-value
(symbol macro).
normalize-shader-source
(function).
parse
(function).
peek
(compiler macro).
peek
(function).
remove-rule
(function).
rule
(function).
(setf rule)
(function).
trace-parse
(function).
untrace-parse
(function).
with-token-input
(macro).
*max-index*
(special variable).
*token-array*
(special variable).
*token-index*
(special variable).
*trace-level*
(special variable).
*traced*
(special variable).
call-traced-function
(function).
check-parse-complete
(function).
discover-expr-around
(function).
ensure-shader
(function).
index
(type).
newline-p
(function).
trace-parse-func
(function).
untrace-parse-func
(function).
glsl-toolkit/grammar.lisp
parser.lisp
(file).
glsl-toolkit
(system).
!
(function).
!=
(function).
%
(function).
%=
(function).
&
(function).
&&
(function).
&=
(function).
(
(function).
)
(function).
*
(function).
*=
(function).
+
(function).
++
(function).
+=
(function).
,
(function).
-
(function).
--
(function).
-=
(function).
.
(function).
/
(function).
/=
(function).
∶
(function).
;
(function).
<
(function).
<<
(function).
<<=
(function).
<=
(function).
=
(function).
==
(function).
>
(function).
>=
(function).
>>
(function).
>>=
(function).
?
(function).
[
(function).
]
(function).
^
(function).
^=
(function).
^^
(function).
addition
(function).
array-initializer
(function).
array-modifier
(function).
array-specifier
(function).
assignment
(function).
assignment-expression
(function).
basic-type
(function).
bit-inversion
(function).
bitwise-and
(function).
boolean-constant
(function).
break
(function).
call-modifier
(function).
case-label
(function).
compound-statement
(function).
condition
(function).
condition-declarator
(function).
conditional
(function).
conditional-expression
(function).
constant-expression
(function).
continue
(function).
decimal-token
(function).
declaration
(function).
decrement-modifier
(function).
discard
(function).
division
(function).
do-statement
(function).
equal
(function).
exclusive-or
(function).
expression
(function).
expression-statement
(function).
field-modifier
(function).
float-constant
(function).
float-token
(function).
for-statement
(function).
function-declaration
(function).
function-definition
(function).
function-prototype
(function).
greater-equal-than
(function).
greater-than
(function).
hexadecimal-token
(function).
identifier
(function).
identifier-token
(function).
inclusive-or
(function).
increment-modifier
(function).
initializer
(function).
instance-name
(function).
integer-constant
(function).
integer-token
(function).
interface-declaration
(function).
interpolation-qualifier
(function).
invariant-qualifier
(function).
inversion
(function).
iteration-statement
(function).
jump-statement
(function).
keyword-token
(function).
layout-qualifier
(function).
layout-qualifier-id
(function).
left-shift
(function).
less-equal-than
(function).
less-than
(function).
logical-and
(function).
logical-or
(function).
logical-xor
(function).
modified-reference
(function).
modulus
(function).
multiple-expressions
(function).
multiplication
(function).
negation
(function).
not-equal
(function).
octal-token
(function).
operator
(function).
parameter-declaration
(function).
postfix-expression
(function).
precise-qualifier
(function).
precision-declaration
(function).
precision-qualifier
(function).
prefix-decrement
(function).
prefix-increment
(function).
preprocessor-directive
(function).
preprocessor-token
(function).
primary-expression
(function).
reference-modifier
(function).
return
(function).
right-shift
(function).
same-+
(function).
selection-statement
(function).
shader
(function).
simple-statement
(function).
statement
(function).
storage-qualifier
(function).
struct-declaration
(function).
struct-declarator
(function).
struct-field-declarator
(function).
struct-specifier
(function).
subroutine-qualifier
(function).
subtraction
(function).
switch-statement
(function).
token
(function).
tokenize
(function).
type-name
(function).
type-qualifier
(function).
type-specifier
(function).
type-specifier-nonarray
(function).
unary-expression
(function).
variable-declaration
(function).
variable-initializer
(function).
while-statement
(function).
whitespace
(function).
{
(function).
|
(function).
|=
(function).
||
(function).
}
(function).
define-binary-op
(macro).
define-operator-objects
(macro).
glsl-toolkit/printer.lisp
grammar.lisp
(file).
glsl-toolkit
(system).
define-serialization
(macro).
define-serializer
(macro).
indent
(function).
remove-serializer
(function).
serialize
(function).
serialize-part
(function).
serializer
(function).
(setf serializer)
(function).
sformat
(compiler macro).
sformat
(function).
with-indentation
(macro).
%format-object
(function).
*indent*
(special variable).
*serialize-stream*
(special variable).
*serializers*
(special variable).
compile-format-string
(function).
glsl-toolkit/walker.lisp
printer.lisp
(file).
glsl-toolkit
(system).
binding
(function).
(setf binding)
(function).
constant-p
(function).
control-flow-p
(function).
declaration-p
(function).
define-binary-op-walker
(macro).
define-empty-op-walker
(macro).
define-unary-op-walker
(macro).
define-walker
(macro).
define-walking-body
(macro).
environment
(class).
expression-p
(function).
function-identifier-p
(function).
global-identifier-p
(function).
identifier-p
(function).
keyword-p
(function).
local-identifier-p
(function).
make-environment
(function).
preprocessor-p
(function).
remove-walker
(function).
root-environment-p
(function).
statement-p
(function).
variable-identifier-p
(function).
walk
(function).
walk-part
(function).
walker
(function).
(setf walker)
(function).
glsl-toolkit/merge.lisp
walker.lisp
(file).
glsl-toolkit
(system).
matching-declarators-p
(function).
matching-qualifiers-p
(function).
matching-specifiers-p
(function).
merge-shader-sources
(function).
merge-shaders
(function).
uniquify
(function).
*unique-counter*
(special variable).
find-direction-qualifier
(function).
find-layout-qualifier
(function).
find-matching-layout-declaration
(function).
handle-declaration
(function).
handle-identifier
(function).
split-shader-into-groups
(function).
glsl-toolkit/sexpr.lisp
merge.lisp
(file).
glsl-toolkit
(system).
*sexpr-transforms*
(special variable).
define-expr-binary
(macro).
define-sexpr-comparator
(macro).
define-sexpr-transform
(macro).
remove-sexpr-transform
(function).
separate-qualifier-specifier
(function).
sexpr->glsl-ast
(function).
sexpr-transform
(function).
(setf sexpr-transform)
(function).
symbol->identifier
(function).
with-glsl-syntax
(macro).
glsl-toolkit/transform.lisp
sexpr.lisp
(file).
glsl-toolkit
(system).
preprocess
(function).
transform
(function).
transform-to-core
(function).
transform-to-gles
(function).
glsl-toolkit/method-combination.lisp
transform.lisp
(file).
glsl-toolkit
(system).
combine-methods
(function).
definition-argvars
(function).
definition-identifier
(function).
(setf definition-identifier)
(function).
definition-signature
(function).
handle-function-definition
(function).
resolve-method-definitions
(function).
glsl-toolkit/documentation.lisp
method-combination.lisp
(file).
glsl-toolkit
(system).
Packages are listed by definition order.
glsl-parser-rules
org.shirakumo.trial.glsl.parser.rules
!
(function).
!=
(function).
%
(function).
%=
(function).
&
(function).
&&
(function).
&=
(function).
(
(function).
)
(function).
*
(function).
*=
(function).
+
(function).
++
(function).
+=
(function).
,
(function).
-
(function).
--
(function).
-=
(function).
.
(function).
/
(function).
/=
(function).
∶
(function).
;
(function).
<
(function).
<<
(function).
<<=
(function).
<=
(function).
=
(function).
==
(function).
>
(function).
>=
(function).
>>
(function).
>>=
(function).
?
(function).
[
(function).
]
(function).
^
(function).
^=
(function).
^^
(function).
addition
(function).
array-initializer
(function).
array-modifier
(function).
array-specifier
(function).
assignment
(function).
assignment-expression
(function).
basic-type
(function).
bit-inversion
(function).
bitwise-and
(function).
boolean-constant
(function).
break
(function).
call-modifier
(function).
case-label
(function).
compound-statement
(function).
condition
(function).
condition-declarator
(function).
conditional
(function).
conditional-expression
(function).
constant-expression
(function).
continue
(function).
decimal-token
(function).
declaration
(function).
decrement-modifier
(function).
discard
(function).
division
(function).
do-statement
(function).
equal
(function).
exclusive-or
(function).
expression
(function).
expression-statement
(function).
field-modifier
(function).
float-constant
(function).
float-token
(function).
for-statement
(function).
function-declaration
(function).
function-definition
(function).
function-prototype
(function).
greater-equal-than
(function).
greater-than
(function).
hexadecimal-token
(function).
identifier
(function).
identifier-token
(function).
inclusive-or
(function).
increment-modifier
(function).
initializer
(function).
instance-name
(function).
integer-constant
(function).
integer-token
(function).
interface-declaration
(function).
interpolation-qualifier
(function).
invariant-qualifier
(function).
inversion
(function).
iteration-statement
(function).
jump-statement
(function).
keyword-token
(function).
layout-qualifier
(function).
layout-qualifier-id
(function).
left-shift
(function).
less-equal-than
(function).
less-than
(function).
logical-and
(function).
logical-or
(function).
logical-xor
(function).
modified-reference
(function).
modulus
(function).
multiple-expressions
(function).
multiplication
(function).
negation
(function).
not-equal
(function).
octal-token
(function).
operator
(function).
parameter-declaration
(function).
postfix-expression
(function).
precise-qualifier
(function).
precision-declaration
(function).
precision-qualifier
(function).
prefix-decrement
(function).
prefix-increment
(function).
preprocessor-directive
(function).
preprocessor-token
(function).
primary-expression
(function).
reference-modifier
(function).
return
(function).
right-shift
(function).
same-+
(function).
selection-statement
(function).
shader
(function).
simple-statement
(function).
statement
(function).
storage-qualifier
(function).
struct-declaration
(function).
struct-declarator
(function).
struct-field-declarator
(function).
struct-specifier
(function).
subroutine-qualifier
(function).
subtraction
(function).
switch-statement
(function).
token
(function).
tokenize
(function).
type-name
(function).
type-qualifier
(function).
type-specifier
(function).
type-specifier-nonarray
(function).
unary-expression
(function).
variable-declaration
(function).
variable-initializer
(function).
while-statement
(function).
whitespace
(function).
{
(function).
|
(function).
|=
(function).
||
(function).
}
(function).
glsl-toolkit
org.shirakumo.trial.glsl
common-lisp
.
*glsl-keyword-symbols*
(special variable).
*glsl-keywords*
(special variable).
advance
(compiler macro).
advance
(function).
backtrack
(compiler macro).
backtrack
(function).
binding
(function).
(setf binding)
(function).
combine-methods
(function).
compile-rule
(function).
constant-p
(function).
consume
(compiler macro).
consume
(function).
consume-any
(function).
consume-notany
(function).
consume-string
(function).
consume-whitespace
(function).
control-flow-p
(function).
declaration-p
(function).
define-binary-op-walker
(macro).
define-empty-op-walker
(macro).
define-object
(macro).
define-reference
(macro).
define-rule
(macro).
define-serialization
(macro).
define-serializer
(macro).
define-unary-op-walker
(macro).
define-walker
(macro).
define-walking-body
(macro).
end-of-tokens-p
(compiler macro).
end-of-tokens-p
(function).
environment
(class).
expression-p
(function).
function-identifier-p
(function).
global-identifier-p
(function).
identifier-p
(function).
indent
(function).
keyword-p
(function).
lex
(function).
local-identifier-p
(function).
make-environment
(function).
matching-declarators-p
(function).
matching-qualifiers-p
(function).
matching-specifiers-p
(function).
merge-shader-sources
(function).
merge-shaders
(function).
no-value
(symbol macro).
normalize-shader-source
(function).
parse
(function).
peek
(compiler macro).
peek
(function).
preprocess
(function).
preprocessor-p
(function).
remove-rule
(function).
remove-serializer
(function).
remove-walker
(function).
root-environment-p
(function).
rule
(function).
(setf rule)
(function).
serialize
(function).
serialize-part
(function).
serializer
(function).
(setf serializer)
(function).
sformat
(compiler macro).
sformat
(function).
statement-p
(function).
trace-parse
(function).
transform
(function).
uniquify
(function).
untrace-parse
(function).
variable-identifier-p
(function).
walk
(function).
walk-part
(function).
walker
(function).
(setf walker)
(function).
with-indentation
(macro).
with-token-input
(macro).
%format-object
(function).
*indent*
(special variable).
*max-index*
(special variable).
*serialize-stream*
(special variable).
*serializers*
(special variable).
*sexpr-transforms*
(special variable).
*token-array*
(special variable).
*token-index*
(special variable).
*trace-level*
(special variable).
*traced*
(special variable).
*unique-counter*
(special variable).
*walkers*
(special variable).
bindings
(generic reader).
call-traced-function
(function).
check-parse-complete
(function).
compile-format-string
(function).
define-binary-op
(macro).
define-expr-binary
(macro).
define-operator-objects
(macro).
define-sexpr-comparator
(macro).
define-sexpr-transform
(macro).
definition-argvars
(function).
definition-identifier
(function).
(setf definition-identifier)
(function).
definition-signature
(function).
discover-expr-around
(function).
ends-with
(function).
enlist
(function).
ensure-shader
(function).
find-any
(function).
find-direction-qualifier
(function).
find-layout-qualifier
(function).
find-matching-layout-declaration
(function).
handle-declaration
(function).
handle-function-definition
(function).
handle-identifier
(function).
index
(type).
mapcar*
(function).
merge-plists
(function).
newline-p
(function).
remove-sexpr-transform
(function).
resolve-method-definitions
(function).
root
(generic reader).
separate-qualifier-specifier
(function).
sexpr->glsl-ast
(function).
sexpr-transform
(function).
(setf sexpr-transform)
(function).
split-shader-into-groups
(function).
starts-with
(function).
symbol->identifier
(function).
trace-parse-func
(function).
transform-to-core
(function).
transform-to-gles
(function).
unlist
(function).
untrace-parse-func
(function).
with-glsl-syntax
(macro).
Definitions are sorted by export status, category, package, and then by lexicographic order.
List to all the keywords in GLSL shader files but as interned and upcased keyword symbols.
See *GLSL-KEYWORDS*
List to all the keywords in GLSL shader files.
This does not include terminals and other keywords such as {}/*+ etc.
Define a walker for a binary AST object.
This walker recurses over the left and right nodes in the object and returns a fresh value constructed from them.
Define a walker for an empty AST object.
This walker function does nothing but construct a fresh return value.
Defines a parsing object.
The RULE should be a parsing rule to match against. It should
probably contain calls to the V rule in order to populate the
V values list. This list is used to store the return values
of the object.
TRANSFORM is an optional list of forms to be evaluated to
transform the values list on a successful match. It acts as
an implicit PROGN and the last value is returned as the value
of the rule.
If no TRANSFORM is given, the return value is the V values
list prepended with the name of the rule.
See DEFINE-RULE
Defines a reference parsing rule.
The body should be a number of sub-rules that may be matched
in order to match this rule. Either the value stored in V
by the V function, or the return value of the first matching
sub-rule is returned.
See DEFINE-RULE
Defines a new parsing rule of the given name.
This will create a function definition in the
ORG.SHIRAKUMO.TRIAL.GLSL.RULES package by
re-interning the symbol in that package.
A default lexical binding named V is provided.
See DEFINE-REFERENCE
See DEFINE-OBJECT
Convenience function to define the serialization of AST objects of the given type.
ARGS must be a lambda-list to destructure the contents of the
AST object.
See SERIALIZER
Convenience function to define a serializer function for AST objects of the given type.
See SERIALIZER
Define a walker for a unary AST object.
This walker recurses over the single node in the object and returns a fresh value constructed from it.
Define a new walker function that is responsible for walking over a particular type of AST object node.
See *WALKERS*
See WALKER
See DEFINE-WALKING-BODY
Convenience definition macro.
The ARGS should be a destructuring-bind lambda-list to
destructure the contents of the object.
The body should be forms that provide the values to use in the
resulting AST object. The last value should be the tail of the
object’s list. Thus this is about equivalent to
(define-walker type (o)
(destructuring-bind .. (o)
(list* ’type body)))
Within the body the WALK function is rebound to one that can
be conveniently used to recursively walk the AST. It only needs
the new node to walk over. It optionally takes a new environment
to supply.
You can reach the other function values like the full AST, the
walk function, and the environment by changing the type to a
list and providing the binding symbols as keyword arguments in
it with :KEY :FUNC and :ENV.
See DEFINE-WALKER
Makes sure the body is evaluated with an increased indentation level.
See *INDENT*
See INDENT
Readies the environment for token parsing.
This binds *TOKEN-ARRAY* to the given vector and binds *TOKEN-INDEX* to 0.
See *TOKEN-ARRAY*
See *TOKEN-INDEX*
Advances the current token index.
See *TOKEN-INDEX*
See BACKTRACK
Reduces the current token index.
See *TOKEN-INDEX*
See ADVANCE
Accessor to the binding in the environment for the given name.
See BINDINGS
See ENVIRONMENT
Performs method combination on the listed shader parts.
Each shader in SHADERS may be a string, pathname, stream, or shader AST.
The method combination replicates the CLOS standard method
combination, including before/after/around, call-next-method, and
next-method-p.
Any standard function definition is assumed to be a primary
method. Before, after, and around methods can be defined by suffixing
the name with @before/@after/@around, respectively. Note that aside
from the suffix the function signatures (including qualifiers, return
type, and argument types, but not argument names) have to match
exactly, as otherwise the functions are considered separate units.
Within any primary or around method body, the variable next_method_p
is statically replaced with 1 or 0 depending on whether a next method
is available or not, and a call to call_next_method is replaced with a
call to the next method function. If no arguments are passed to
call_next_method, the arguments are copied automatically. You can also
make use of maybe_call_next_method, which is semantically the same as
if(next_method_p) call_next_method(...);
If methods are defined without a single corresponding primary method,
an error is signalled.
The order of method definitions is relevant in the following way:
- For @before, the later methods are called *first*
- For @after, the later methods are called *last*
- For @around, the later methods are called *first*
- For @primary, the later methods are called *first*
Example:
void foo@after(int x){ 1; }
int foo(int y){ return 2; }
int foo(int z){
if(next_method_p) return call_next_method();
return -1;
}
void foo@before(int w){ 0; }
See PARSE
Compile the rule s-expression.
The following types are handled specially:
- NULL NIL is returned
- KEYWORD Attempts to match a token that is EQ to this
keyword. On success returns the keyword.
- SYMBOL Attempts to match the rule given named by the
symbol. Returns whatever the rule returns.
- CHARACTER Attempts to match a token that is EQL to this
character. Returns the character on match.
- STRING Attempts to match the string against the tokens.
Returns the string on successful match.
- CONS One of the following compound, identified by the
first symbol.
- AND Matches if all of the sub-rules match. Returns
the last rule’s return value on successful match.
- OR Matches if any of the sub-rules match.
Returns the first successful rule’s return value.
- NOTANY Matches if none of the choices match.
Returns the token that did not match.
- ANY Matches if any of the choices match.
Returns the token that did match.
- WHEN Performs all the other sub-rules only if the
first sub-rule matches. Returns the last sub-rule’s
return value.
- V Makes sure the result of the sub-rule is added to
the values list if the sub-rule matches. Returns
what the sub-rule returned.
- * Repeatedly matches the sub-rule as many times as
possible. Returns T.
- + Attempts to match the sub-rule at least once.
Returns T on success.
- ? Attempts to match the sub-rule. If it does not
match the secondary form is returned, or NO-VALUE.
- ! Evaluates the sub-rule and returns its result, but
always resets the token index to its initial value.
- Otherwise the rule is returned unchanged.
See CONSUME-STRING
See CONSUME-ANY
See CONSUME-NOTANY
See DEFINE-RULE
Returns T if the given AST node is a constant value.
Returns the token at the current index and advances the index by one.
See PEEK
See ADVANCE
Consume any of the tokens in the choices sequence, if possible.
If a token matches, it is returned. Otherwise NIL is returned instead. The index is only modified if a match occurs.
Consume any token that is not one of the tokens in the choices sequence.
If a token matches, it is returned. Otherwise NIL is
returned instead. The index is only modified if a match
occurs.
Attempts to consume the given string from the token array.
If the string matches, it is returned. Otherwise, NIL is returned instead. If the match succeeds, the token index is modified. Otherwise it is reset to the point where it was before the match was attempted.
Consumes all spaces and newlines in the token array from the current position on.
Returns T if the given AST node is a control-flow instruction.
Returns T if the given AST node is a declaration statement.
Returns true if the end of the token array has been reached.
See *TOKEN-ARRAY*
See *TOKEN-INDEX*
Returns T if the given AST node is an expression.
Returns T if the given AST node is an identifier for a function.
Returns T if the given AST node is an identifier that refers to a global definition.
Returns T if the given AST node might be an identifier.
This is not always accurate, as some identifiers can also be types at the same time. It thus depends on the context.
Starts a fresh line and emits as many spaces as the *INDENT* variable dictates.
Returns T if the given AST node is a GLSL keyword.
See *GLSL-KEYWORD-SYMBOLS*
Lex the input string into a token array for use in parsing.
See NORMALIZE-SHADER-SOURCE
See RULE
See PARSE
Returns T if the given AST node is an identifier that refers to a local definition.
Create a new environment object.
If not parent environment is passed in, the environment is
assumed to be a top-level root environment.
See ENVIRONMENT
Returns true if the two variable declarations are considered to match.
This is true if:
- The first of both lists (qualifiers) match by MATCHING-QUALIFIERS-P
- The second of both lists (specifiers) match by MATCHING-SPECIFIERS-P
- The fourth of both lists (array-identifiers) match by EQUAL
The third of both lists (identifiers) must not match.
The fifth of both lists (initializers) must not match.
Returns true if the two given qualifier lists are considered to match.
The following qualifier parts are not considered:
:HIGHP :MEDIUMP :LOWP :INVARIANT :PRECISE :SMOOTH :FLAT :NOPERSPECTIVE
All other qualifiers must match by EQUAL, but don’t have to be
in the same order.
See https://www.khronos.org/opengl/wiki/Shader_Compilation#Qualifier_matching
Returns true if the two given specifier lists are considered to match.
In order to match, the two lists have to be EQUAL.
Convenience function to merge the sources of multiple shaders into a single one.
Each source may be a string, pathname, or shader AST.
See PARSE
See MERGE-SHADERS
See SERIALIZE
Merge the given shader ASTs into a single AST.
The top-level AST nodes must be AST objects of type SHADER.
The merging will attempt to conflate declarations where
possible and rename variables where necessary, in order to
create a single shader that is internally consistent.
It also emits a single main function at the end, which does nothing but call the main function of each sub-shader in the sequence that the shaders were passed.
See HANDLE-DECLARATION
See HANDLE-IDENTIFIER
See WALK
See MERGE-SHADER-SOURCES
Attempts to normalise the shader source code.
This does the following:
- Removes any and all comments from the code
- Handles the backslash-before-newline trick to get multiple
lines to act as one.
- Converts CRLF/LFCR/LFLF/CRCR into NEWLINE
- Converts TAB to SPACE
- Converts consecutive whitespace into singular whitespace
while preserving newlines.
The input may be one of the following types:
- PATHNAME
- STRING
- STREAM
See NEWLINE-P
Parses the given GLSL shader source input into an AST.
The input may be of the following types:
- STRING STREAM PATHNAME
The input is lexed before parsing as by LEX
- LIST
The input is converted into a vector
- VECTOR
The input is parsed by the given toplevel parsing rule.
See LEX
See RULE
Returns the token at the index relative to the current position.
See *TOKEN-ARRAY*
See *TOKEN-INDEX*
Returns T if the given AST node is a preprocessor instruction.
Removes the parsing rule of the given name.
Removes the serializer function for AST objects of the given type.
See *SERIALIZERS*
See SERIALIZER
Removes the walker function for AST objects of the given type.
See WALKER
See *WALKERS*
Returns T if the environment is a top-level root environment.
See ENVIRONMENT
See ROOT
Returns the symbol that identifies the parsing rule of the given name.
This is a place that can be set with the function object
that should be used to parse the rule of the given name.
If no such rule exists, an error is signalled.
Serializes the AST part to shader source.
TO may be one of the following:
- NULL
The output is gathered into a string and returned.
- T
The output is sent to *STANDARD-OUTPUT*.
- STREAM
The output is sent to this stream.
- PATHNAME
The output is written to the file. If the file already
exists, an error is signalled.
See *SERIALIZE-STREAM*
See SERIALIZE-PART
Serializes the AST part.
This appropriately handles all values that can be contained in the AST.
For AST objects, an appropriate serializer function is called if possible.
Should an unknown AST object occur, an error is signalled.
See SERIALIZER
Accessor to the serializing function for AST objects of the given type.
See *SERIALIZERS*
See DEFINE-SERIALIZER
See REMOVE-SERIALIZER
Convenience function used to format to the serializing stream.
A special format directive ~O is provided as well, which causes SERIALIZE-PART to be called on the respective object.
Returns T if the given AST node is a statement.
See DECLARATION-P
See EXPRESSION-P
See CONTROL-FLOW-P
Cause all parse rule functions to emit tracing information.
See UNTRACE-PARSE
See TRACE-PARSE-FUNC
Create a (hopefully) unique identifier for the given name.
The returned name is prefixed by two underscores. Identifiers like that are reserved for use by the underlying library or framework (us), so there should not be any clash with user identifiers unless the shader is not conforming to begin with.
See *UNIQUE-COUNTER*
Make all parse rule functions cease to emit tracing information.
See TRACE-PARSE
See UNTRACE-PARSE-FUNC
Returns T if the given AST node is an identifier for a variable.
Walk over the AST, calling FUNCTION on each interesting node.
Returns a fresh AST that was constructed by the function.
The function will be called with three arguments:
- The AST node at the current point
- The surrounding context in which the AST node is
- The environment object that maintains lexical information
The function should return a single value, which is the
value that should be put into a fresh AST in place of the
original node.
Note that calling any of the environment inspection functions
on an identifier in a lower level than the current AST node
that the function received is not going to work. The lexical
information is only guaranteed to be ready by the time the
function is called with the identifier itself.
See ROOT-ENVIRONMENT-P
See PREPROCESSOR-P
See CONSTANT-P
See DECLARATION-P
See EXPRESSION-P
See CONTROL-FLOW-P
See KEYWORD-P
See STATEMENT-P
See IDENTIFIER-P
See GLOBAL-IDENTIFIER-P
See LOCAL-IDENTIFIER-P
See VARIABLE-IDENTIFIER-P
See FUNCTION-IDENTIFIER-P
See ENVIRONMENT
See WALK-PART
Walk over the given AST node.
On AST objects, this will call out to the respective
walker function.
See WALKER
Accessor to the walker function for AST objects of the given type.
See *WALKERS*
See REMOVE-WALKER
See DEFINE-WALKER
Struct to hold information about the lexical environment during code walking.
See MAKE-ENVIRONMENT
See ROOT
See BINDINGS
Variable to represent the current indenting level.
See WITH-INDENTATION
See INDENT
The stream to which the serializing output is sent to.
This has to be bound when SERIALIZE-PART is called.
Hash table associating AST object types to serializer functions.
The function must accept a single argument, which is the
AST object itself.
See SERIALIZER
See REMOVE-SERIALIZER
Holds a vector of tokens to be processed by the parser.
See PEEK
See CONSUME
See *TOKEN-INDEX*
See WITH-TOKEN-INPUT
Holds the index into the token array that represents the current parser position.
See ADVANCE
See BACKTRACK
See *TOKEN-ARRAY*
See WITH-TOKEN-INPUT
Integer to represent the current stack level during tracing.
Hash table to hold associate names with the original function definitions.
Counter to hold the current index used to compute names for unique identifiers.
See UNIQUIFY
Hash table associating AST object types to walker functions.
A walker function must accept three arguments:
- The AST object to process
- The function that should walk over the AST
- The current lexical environment
It must return an AST object to use in place of the
current one in the resulting AST.
See WALKER
See REMOVE-WALKER
See DEFINE-WALKER
Shorthand to define a binary operator object.
This takes care to avoid duplicate parsing of the same sequence
if the subsequence should succeed. Meaning that if the left
expression matches, but the operator or the right one does not
it simply returns the left expression, instead of failing to
match and causing a re-matching lower down in the tree.
Without this optimisation, performance would suffer greatly.
See DEFINE-OBJECT
Shorthand to define an object that parses a string and returns the keyword version of that string.
Used to define the various token objects.
See DEFINE-OBJECT
Helper function to call SERIALIZE-PART in a format string.
Wrapper to output trace information around the call to the given function.
See *TRACE-LEVEL*
See *TRACED*
Rewrite the format string so that the ~O directive is acceptable.
Ensures that LIST is a list.
If it is not, it is combined with ITEMS to form a list.
Like CL:FIND, but the item to find is a sequence of things that can be found.
Find the direction qualifier keyword in the qualifiers list.
Find the layout qualifier object in the qualifiers list.
Handles a declaration during a shader merging operation.
This will take care of registering the identifier with the global
environment, substituting the name if necessary, merging the
declarations if possible, and erroring if there is a severe
mismatch that cannot be resolved.
The merging of variable declarations is in part according to the
OpenGL specification on interface matching between shader stages.
More specifically, the following strategy is employed here:
- If the declaration is a pipeline declaration (in/out/inout)
- If it has a layout qualifier
- If there is no known matching layout qualifier, register it
- If there is one and the declarations match, map the name to
that of the previous declaration and remove the current one
- Otherwise error as there are conflicting declarations that
cannot be rectified
- If the identifier is already known
- If the declarations of this one and the previous declaration
of the same identifier match, map the name to that of the
previous declaration and remove the current one
- Otherwise warn about the possible mismatch and remap the
current identifier to a new one
- Store the identifier directly and return the AST as-is
- If the identifier is already known
- Remap the identifier to a new one
- Otherwise store the identifier directly and return the AST as-is
See https://www.khronos.org/opengl/wiki/Shader_Compilation#Interface_matching
See FIND-DIRECTION-QUALIFIER
See FIND-LAYOUT-QUALIFIER
See MATCHING-DECLARATORS-P
See MERGE-SHADERS
Handles an identifier during a shader merging operation.
This will take care of substituting the identifier if it has
been remapped globally.
See GLOBAL-IDENTIFIER-P
See MERGE-SHADERS
Like CL:MAPCAR, but only gathers non-NIL results.
Merges the two plists together by appending their values for the same keys.
Returns a fresh plist.
Returns true if the input is a newline character and thus either CR or LF.
Ensures the given function is being traced for parsing, if it isn’t already.
This replaces the global function definition.
See CALL-TRACED-FUNCTION
See *TRACED*
See UNTRACE-PARSE-FUNC
Ensures the given functions restored to its original definition, if it isn’t already.
This replaces the global function definition.
See *TRACED*
See TRACE-PARSE-FUNC
Accessor to the table associating identifiers to bindings.
The values must be lists where the first item is a keyword
that identifies the type of binding as either a :FUNCTION
or :VARIABLE binding.
See ENVIRONMENT
See BINDING
environment
)) ¶automatically generated reader method
Accessor to the root environment.
The root environment is the top-level lexical environment that
holds all global definitions. On root environments, this must
resolve to the environment instance itself.
See ENVIRONMENT
environment
)) ¶automatically generated reader method
root
.
Jump to: | !
%
&
(
)
*
+
,
-
.
/
:
;
<
=
>
?
[
]
^
{
|
}
A B C D E F G H I J K L M N O P R S T U V W |
---|
Jump to: | !
%
&
(
)
*
+
,
-
.
/
:
;
<
=
>
?
[
]
^
{
|
}
A B C D E F G H I J K L M N O P R S T U V W |
---|
Jump to: | *
B N R S |
---|
Jump to: | *
B N R S |
---|
Jump to: | C D E F G I M P S T W |
---|
Jump to: | C D E F G I M P S T W |
---|