Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the varjo Reference Manual, generated automatically by Declt version 3.0 "Montgomery Scott" on Sun May 15 06:24:40 2022 GMT+0.
• Introduction | What varjo is all about | |
• Systems | The systems documentation | |
• Files | The files documentation | |
• Packages | The packages documentation | |
• Definitions | The symbols documentation | |
• Indexes | Concepts, functions, variables and data types |
Varjo is a Lisp to GLSL compiler.
Varjo has no OpenGL dependency as is designed to be integrated into other projects, see CEPL for an example.
Vari is the dialect of lisp Varjo compiles. It aims to be as close to Common Lisp as possible, but naturally it is statically typed so there are differences.
Subset of common lisp. Including:
defmacro
, define-compiler-macro
, macrolet
, symbol-macrolet
all supported&environment
supported (currently custom API for introspection but cltl2 API planned)values
& multiple-value-bind
labels
defstruct
which can be used across multiple shaders (Less repeated code)declare
and extensible declaration identifiersThe user guide can be found in docs/user-guide.md
The reference documentation for the compiler can be found here
The reference documentation for the Vari language can be found here
Run (ql:quickload :varjo)
at your REPL.
Whist it is recommended to get Varjo from quicklisp, if you clone please note that master
is not the stable branch. Please use release-quicklisp
for the stable code that will be in the next Varjo release.
vari-describe
, which is function that given a symbol that names a gpu func/var gives you documentation (check out vari-describe.el for emacs integration):use
the :glsl-symbols.operators
package in your project.Lots landing this month, whilst my current test suite passes I'm still expecting some issues or regressions, if these hit you PLEASE let me know so I can avoid merging this to quicklisp before the regressions have been handled. Quick summary of changes are:
CL functions added listed below. Some of the predicates are basically pointless, but for completeness it's nice to have them
Also added the complex & ratio types. Complex support is limited right now and ratio basically useless. But we have a place to work from. Complex numbers are always single-float in vari.
PACKAGES
There has been a huge refactoring of packages.
This is annoying but a neccessary step before I could start documenting the project. The original structure just appeared out of neccessity so I'm hoping this will last a little longer. The most important changes are:
Our lisp dialect has a name. The naming around Varjo and it's lisp dialect were confusing people so I have named the dialect Vari
, Varjo
remains as the name of the compiler.
varjo-lang
renamed to vari
. You will need to update your package :use
ings to pull in vari
and not varjo-lang
.
No more dependency on rtg-math! If you want to use rtg-math's functions in your shaders please quickload rtg-math.vari
The varjo
package now only exports symbols for interacting with the compiler.
There are places where GLSL & Common Lisp's function names overlap. This is fine when the behaviour is also the same but this is not always the case. For this reason we have a vari.cl
package and a vari.glsl
package. When there are conflicts (that people care about) we will put the different versions in the respective packages and vari
will use the most common case.
Bugfixes & Enhancements
if
will now generate a ternary expression (e.g. x<0 ? -1 : 1
) if the followiung is true
if
block. This is just to keep code readable.If you use ->
in a symbol it will become _to_
in glsl. So int->float
becomes int_to_float
Fix bug where, if the 'then' clause of an if
contained a progn, that code would be missing from the glsl.
Redamentary checks for purity of an expression (whether it has side effects). This feature is currently young and over conservative
Better error messages when assigning the wrong type to a place
Better error message for invalid argument format in function definition
Add the dynamic
draw mode. Used when you dont know (or don't want to specify) the primitive for the compile. This will only work for vertex & fragment stages but will throw a sensible error if passed to anything else.
vec2
, vec3
, vec4
, mat3
& mat4
constructors
Fix bug where #'
would get confused in the presence of local & external functions
Tesselation & Geometry stages are now fully supported (for real this time :D)
Very basic mutual recursion checks.
Fix bug where inlining and indirect recursion could cause compiler to infinite loop
Make use of {}
braces consistent in emitted glsl
Add continue
Add /=
Add with-slots
& with-accessors
Add multiple-value-call
strings containing floats will be spliced into the emitted glsl unchanged (very useful when float used for bits & you dont want the risk of lisp rounding something)
strings containing integers will be turned integer literals (only here for completeness with above code) doesnt not yet detect signed'ness of int.
make the value argument to incf
, decf
etc optional (defaulting to 1)
Better errors when can't find function match
Don't allow funcall
on special operators. Give better error message
Fix bad glsl emitted for tail-calls to functions returning multiple values
Fix funcall
so it handles multiple values correctly (dumb mistake :p)
Add the stage name (as a comment) to the generated glsl.
Large amount of refactoring how types are stored/propegated
v-defun
renamed to v-def-glsl-template-fun
, v-defun
will be used for functions with lisp code.
Next: Files, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The varjo system |
Chris Bagley (Baggers) <techsnuffle@gmail.com>
BSD 2 Clause
Common Lisp -> GLSL Compiler
varjo.asd (file)
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files |
Next: The varjo/package․lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
varjo.asd
varjo (system)
Next: The varjo/src/utils-v․lisp file, Previous: The varjo․asd file, Up: Lisp files [Contents][Index]
varjo (system)
package.lisp
Next: The varjo/src/defcondition․lisp file, Previous: The varjo/package․lisp file, Up: Lisp files [Contents][Index]
package.lisp (file)
varjo (system)
src/utils-v.lisp
Next: The varjo/src/varjo․internals/generics․lisp file, Previous: The varjo/src/utils-v․lisp file, Up: Lisp files [Contents][Index]
src/utils-v.lisp (file)
varjo (system)
src/defcondition.lisp
Next: The varjo/src/varjo․internals/globals․lisp file, Previous: The varjo/src/defcondition․lisp file, Up: Lisp files [Contents][Index]
src/defcondition.lisp (file)
varjo (system)
src/varjo.internals/generics.lisp
Next: The varjo/src/varjo․internals/names․lisp file, Previous: The varjo/src/varjo․internals/generics․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/globals.lisp
Next: The varjo/src/varjo․internals/internal-types․lisp file, Previous: The varjo/src/varjo․internals/globals․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/names.lisp
Next: The varjo/src/varjo․internals/glsl-generation/line-and-chunk․lisp file, Previous: The varjo/src/varjo․internals/names․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/internal-types.lisp
Next: The varjo/src/varjo․internals/qualifiers․lisp file, Previous: The varjo/src/varjo․internals/internal-types․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/glsl-generation/line-and-chunk.lisp
Next: The varjo/src/varjo․internals/types/def-v-core-type․lisp file, Previous: The varjo/src/varjo․internals/glsl-generation/line-and-chunk․lisp file, Up: Lisp files [Contents][Index]
src/varjo.internals/glsl-generation/line-and-chunk.lisp (file)
varjo (system)
src/varjo.internals/qualifiers.lisp
Next: The varjo/src/varjo․internals/types/type-spec․lisp file, Previous: The varjo/src/varjo․internals/qualifiers․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/types/def-v-core-type.lisp
define-v-type-class (macro)
Next: The varjo/src/varjo․internals/types/early-types․lisp file, Previous: The varjo/src/varjo․internals/types/def-v-core-type․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/types/type-spec.lisp
Next: The varjo/src/varjo․internals/flow․lisp file, Previous: The varjo/src/varjo․internals/types/type-spec․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/types/early-types.lisp
Next: The varjo/src/varjo․internals/types/types․lisp file, Previous: The varjo/src/varjo․internals/types/early-types․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/flow.lisp
Next: The varjo/src/varjo․internals/return-set․lisp file, Previous: The varjo/src/varjo․internals/flow․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/types/types.lisp
Next: The varjo/src/varjo․internals/emit-set․lisp file, Previous: The varjo/src/varjo․internals/types/types․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/return-set.lisp
merge-return-sets (function)
Next: The varjo/src/varjo․internals/value-metadata․lisp file, Previous: The varjo/src/varjo․internals/return-set․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/emit-set.lisp
Next: The varjo/src/varjo․internals/errors․lisp file, Previous: The varjo/src/varjo․internals/emit-set․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/value-metadata.lisp
Next: The varjo/src/varjo․internals/function-obj․lisp file, Previous: The varjo/src/varjo․internals/value-metadata․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/errors.lisp
Next: The varjo/src/varjo․internals/deftype․lisp file, Previous: The varjo/src/varjo․internals/errors․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/function-obj.lisp
Next: The varjo/src/varjo․internals/variables․lisp file, Previous: The varjo/src/varjo․internals/function-obj․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/deftype.lisp
define-shadow-type-functions (macro)
Next: The varjo/src/varjo․internals/code-object․lisp file, Previous: The varjo/src/varjo․internals/deftype․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/variables.lisp
Next: The varjo/src/varjo․internals/stemcells․lisp file, Previous: The varjo/src/varjo․internals/variables․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/code-object.lisp
Next: The varjo/src/vari․types/types․lisp file, Previous: The varjo/src/varjo․internals/code-object․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/stemcells.lisp
Next: The varjo/src/vari․types/other-types․lisp file, Previous: The varjo/src/varjo․internals/stemcells․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.types/types.lisp
Next: The varjo/src/varjo․internals/environment․lisp file, Previous: The varjo/src/vari․types/types․lisp file, Up: Lisp files [Contents][Index]
src/vari.types/types.lisp (file)
varjo (system)
src/vari.types/other-types.lisp
Next: The varjo/src/varjo․internals/external-functions․lisp file, Previous: The varjo/src/vari․types/other-types․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/environment.lisp
Next: The varjo/src/varjo․internals/structs․lisp file, Previous: The varjo/src/varjo․internals/environment․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/external-functions.lisp
Next: The varjo/src/varjo․internals/glsl-generation/string-generation․lisp file, Previous: The varjo/src/varjo․internals/external-functions․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/structs.lisp
Next: The varjo/src/varjo․internals/casting․lisp file, Previous: The varjo/src/varjo․internals/structs․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/glsl-generation/string-generation.lisp
Next: The varjo/src/varjo․internals/stages․lisp file, Previous: The varjo/src/varjo․internals/glsl-generation/string-generation․lisp file, Up: Lisp files [Contents][Index]
src/varjo.internals/glsl-generation/string-generation.lisp (file)
varjo (system)
src/varjo.internals/casting.lisp
cast-for-array-literal (function)
Next: The varjo/src/varjo․internals/compile-result․lisp file, Previous: The varjo/src/varjo․internals/casting․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/stages.lisp
Next: The varjo/src/varjo․internals/compile-literal․lisp file, Previous: The varjo/src/varjo․internals/stages․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/compile-result.lisp
glsl-code (method)
clone-compile-result (function)
Next: The varjo/src/varjo․internals/compile-vars․lisp file, Previous: The varjo/src/varjo․internals/compile-result․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/compile-literal.lisp
Next: The varjo/src/varjo․internals/compile-special․lisp file, Previous: The varjo/src/varjo․internals/compile-literal․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/compile-vars.lisp
with-constant-inject-hook (macro)
Next: The varjo/src/varjo․internals/make-function․lisp file, Previous: The varjo/src/varjo․internals/compile-vars․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/compile-special.lisp
Next: The varjo/src/varjo․internals/functions․lisp file, Previous: The varjo/src/varjo․internals/compile-special․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/make-function.lisp
build-function (function)
Next: The varjo/src/varjo․internals/traits․lisp file, Previous: The varjo/src/varjo․internals/make-function․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/functions.lisp
Next: The varjo/src/varjo․internals/macros․lisp file, Previous: The varjo/src/varjo․internals/functions․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/traits.lisp
Next: The varjo/src/varjo․internals/compile-funcall․lisp file, Previous: The varjo/src/varjo․internals/traits․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/macros.lisp
Next: The varjo/src/varjo․internals/compile-form․lisp file, Previous: The varjo/src/varjo․internals/macros․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/compile-funcall.lisp
Next: The varjo/src/varjo․internals/declaim․lisp file, Previous: The varjo/src/varjo․internals/compile-funcall․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/compile-form.lisp
Next: The varjo/src/vari․glsl/equality․lisp file, Previous: The varjo/src/varjo․internals/compile-form․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/declaim.lisp
v-declaim (macro)
Next: The varjo/src/vari․glsl/matrix-constructors․lisp file, Previous: The varjo/src/varjo․internals/declaim․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.glsl/equality.lisp
Next: The varjo/src/vari․glsl/scalar-constructors․lisp file, Previous: The varjo/src/vari․glsl/equality․lisp file, Up: Lisp files [Contents][Index]
src/vari.glsl/equality.lisp (file)
varjo (system)
src/vari.glsl/matrix-constructors.lisp
Next: The varjo/src/vari․glsl/vector-constructors․lisp file, Previous: The varjo/src/vari․glsl/matrix-constructors․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.glsl/scalar-constructors.lisp
Next: The varjo/src/vari․glsl/parse-from-spec․lisp file, Previous: The varjo/src/vari․glsl/scalar-constructors․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.glsl/vector-constructors.lisp
Next: The varjo/src/vari․glsl/variables-from-spec․lisp file, Previous: The varjo/src/vari․glsl/vector-constructors․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.glsl/parse-from-spec.lisp
Next: The varjo/src/vari․glsl/functions-from-spec․lisp file, Previous: The varjo/src/vari․glsl/parse-from-spec․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.glsl/variables-from-spec.lisp
Next: The varjo/src/vari․glsl/built-in-types․lisp file, Previous: The varjo/src/vari․glsl/variables-from-spec․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.glsl/functions-from-spec.lisp
populate-functions (function)
Next: The varjo/src/vari․glsl/special-operators/iteration․lisp file, Previous: The varjo/src/vari․glsl/functions-from-spec․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.glsl/built-in-types.lisp
Next: The varjo/src/vari․glsl/special-operators/switch․lisp file, Previous: The varjo/src/vari․glsl/built-in-types․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.glsl/special-operators/iteration.lisp
Next: The varjo/src/vari․glsl/special-operators/discard․lisp file, Previous: The varjo/src/vari․glsl/special-operators/iteration․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.glsl/special-operators/switch.lisp
valid-for-switch-statementp (function)
Next: The varjo/src/vari․cl/docs․lisp file, Previous: The varjo/src/vari․glsl/special-operators/switch․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.glsl/special-operators/discard.lisp
vs-discard (function)
Next: The varjo/src/vari․cl/macros․lisp file, Previous: The varjo/src/vari․glsl/special-operators/discard․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/docs.lisp
vari-describe (function)
Next: The varjo/src/vari․cl/functions․lisp file, Previous: The varjo/src/vari․cl/docs․lisp file, Up: Lisp files [Contents][Index]
src/vari.cl/docs.lisp (file)
varjo (system)
src/vari.cl/macros.lisp
Next: The varjo/src/vari․cl/nary-operators․lisp file, Previous: The varjo/src/vari․cl/macros․lisp file, Up: Lisp files [Contents][Index]
src/vari.cl/macros.lisp (file)
varjo (system)
src/vari.cl/functions.lisp
Next: The varjo/src/vari․cl/bitwise-operators․lisp file, Previous: The varjo/src/vari․cl/functions․lisp file, Up: Lisp files [Contents][Index]
src/vari.cl/functions.lisp (file)
varjo (system)
src/vari.cl/nary-operators.lisp
Next: The varjo/src/vari․cl/special-operators/uint․lisp file, Previous: The varjo/src/vari․cl/nary-operators․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/bitwise-operators.lisp
Next: The varjo/src/vari․cl/special-operators/progn․lisp file, Previous: The varjo/src/vari․cl/bitwise-operators․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/special-operators/uint.lisp
vs-uint (function)
Next: The varjo/src/vari․cl/special-operators/let․lisp file, Previous: The varjo/src/vari․cl/special-operators/uint․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/special-operators/progn.lisp
vs-progn (function)
Next: The varjo/src/vari․cl/special-operators/assignment․lisp file, Previous: The varjo/src/vari․cl/special-operators/progn․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/special-operators/let.lisp
vs-let (function)
Next: The varjo/src/vari․cl/special-operators/conditionals․lisp file, Previous: The varjo/src/vari․cl/special-operators/let․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/special-operators/assignment.lisp
Next: The varjo/src/vari․cl/special-operators/case․lisp file, Previous: The varjo/src/vari․cl/special-operators/assignment․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/special-operators/conditionals.lisp
Next: The varjo/src/vari․cl/special-operators/and-or․lisp file, Previous: The varjo/src/vari․cl/special-operators/conditionals․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/special-operators/case.lisp
Next: The varjo/src/vari․cl/special-operators/declarations․lisp file, Previous: The varjo/src/vari․cl/special-operators/case․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/special-operators/and-or.lisp
Next: The varjo/src/vari․cl/special-operators/values․lisp file, Previous: The varjo/src/vari․cl/special-operators/and-or․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/special-operators/declarations.lisp
Next: The varjo/src/vari․cl/special-operators/return․lisp file, Previous: The varjo/src/vari․cl/special-operators/declarations․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/special-operators/values.lisp
Next: The varjo/src/vari․cl/special-operators/multiple-value-x․lisp file, Previous: The varjo/src/vari․cl/special-operators/values․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/special-operators/return.lisp
vs-return (function)
Next: The varjo/src/vari․cl/special-operators/local-functions․lisp file, Previous: The varjo/src/vari․cl/special-operators/return․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/special-operators/multiple-value-x.lisp
Next: The varjo/src/vari․cl/special-operators/function․lisp file, Previous: The varjo/src/vari․cl/special-operators/multiple-value-x․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/special-operators/local-functions.lisp
Next: The varjo/src/vari․cl/special-operators/macros․lisp file, Previous: The varjo/src/vari․cl/special-operators/local-functions․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/special-operators/function.lisp
Next: The varjo/src/vari․cl/special-operators/swizzle․lisp file, Previous: The varjo/src/vari․cl/special-operators/function․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/special-operators/macros.lisp
Next: The varjo/src/vari․cl/special-operators/inline-code․lisp file, Previous: The varjo/src/vari․cl/special-operators/macros․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/special-operators/swizzle.lisp
Next: The varjo/src/vari․cl/special-operators/compiler-debugging․lisp file, Previous: The varjo/src/vari․cl/special-operators/swizzle․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/special-operators/inline-code.lisp
Next: The varjo/src/vari․cl/special-operators/make-array․lisp file, Previous: The varjo/src/vari․cl/special-operators/inline-code․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/special-operators/compiler-debugging.lisp
Next: The varjo/src/vari․cl/special-operators/aref․lisp file, Previous: The varjo/src/vari․cl/special-operators/compiler-debugging․lisp file, Up: Lisp files [Contents][Index]
src/vari.cl/special-operators/compiler-debugging.lisp (file)
varjo (system)
src/vari.cl/special-operators/make-array.lisp
Next: The varjo/src/vari․cl/special-operators/emit․lisp file, Previous: The varjo/src/vari․cl/special-operators/make-array․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/special-operators/aref.lisp
vs-aref (function)
Next: The varjo/src/vari․cl/special-operators/slots․lisp file, Previous: The varjo/src/vari․cl/special-operators/aref․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/special-operators/emit.lisp
Next: The varjo/src/vari․cl/special-operators/typecase․lisp file, Previous: The varjo/src/vari․cl/special-operators/emit․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/special-operators/slots.lisp
Next: The varjo/src/vari․cl/special-operators/coerce․lisp file, Previous: The varjo/src/vari․cl/special-operators/slots․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/special-operators/typecase.lisp
vs-typecase (function)
Next: The varjo/src/vari․cl/complex․lisp file, Previous: The varjo/src/vari․cl/special-operators/typecase․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/special-operators/coerce.lisp
Next: The varjo/src/vari․cl/ratio․lisp file, Previous: The varjo/src/vari․cl/special-operators/coerce․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/vari.cl/complex.lisp
Next: The varjo/src/vari․cl/misc․lisp file, Previous: The varjo/src/vari․cl/complex․lisp file, Up: Lisp files [Contents][Index]
src/vari.cl/complex.lisp (file)
varjo (system)
src/vari.cl/ratio.lisp
Next: The varjo/src/varjo․internals/translate․lisp file, Previous: The varjo/src/vari․cl/ratio․lisp file, Up: Lisp files [Contents][Index]
src/vari.cl/ratio.lisp (file)
varjo (system)
src/vari.cl/misc.lisp
Next: The varjo/src/varjo․internals/glsl-stage․lisp file, Previous: The varjo/src/vari․cl/misc․lisp file, Up: Lisp files [Contents][Index]
src/vari.cl/misc.lisp (file)
varjo (system)
src/varjo.internals/translate.lisp
Next: The varjo/src/varjo․internals/rolling-translate․lisp file, Previous: The varjo/src/varjo․internals/translate․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/glsl-stage.lisp
glsl-to-compile-result (function)
Next: The varjo/src/varjo․internals/test-compile․lisp file, Previous: The varjo/src/varjo․internals/glsl-stage․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/rolling-translate.lisp
Next: The varjo/src/varjo․internals/front-end․lisp file, Previous: The varjo/src/varjo․internals/rolling-translate․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/test-compile.lisp
test-translate-function-split-details (function)
Next: The varjo/src/varjo․api/environment․lisp file, Previous: The varjo/src/varjo․internals/test-compile․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.internals/front-end.lisp
v-compile (function)
Next: The varjo/src/varjo․api/docs․lisp file, Previous: The varjo/src/varjo․internals/front-end․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.api/environment.lisp
Next: The varjo/src/docs․lisp file, Previous: The varjo/src/varjo․api/environment․lisp file, Up: Lisp files [Contents][Index]
varjo (system)
src/varjo.api/docs.lisp
Previous: The varjo/src/varjo․api/docs․lisp file, Up: Lisp files [Contents][Index]
src/varjo.api/docs.lisp (file)
varjo (system)
src/docs.lisp
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
Next: The varjo-conditions package, Previous: Packages, Up: Packages [Contents][Index]
package.lisp (file)
Next: The vari package, Previous: The varjo package, Up: Packages [Contents][Index]
package.lisp (file)
Next: The vari․glsl package, Previous: The varjo-conditions package, Up: Packages [Contents][Index]
package.lisp (file)
Next: The vari․cl package, Previous: The vari package, Up: Packages [Contents][Index]
package.lisp (file)
Next: The varjo․utils package, Previous: The vari․glsl package, Up: Packages [Contents][Index]
package.lisp (file)
Next: The varjo․api package, Previous: The vari․cl package, Up: Packages [Contents][Index]
package.lisp (file)
Next: The %varjo․usings package, Previous: The varjo․utils package, Up: Packages [Contents][Index]
package.lisp (file)
Next: The varjo․internals package, Previous: The varjo․api package, Up: Packages [Contents][Index]
package.lisp (file)
Next: The vari․types package, Previous: The %varjo․usings package, Up: Packages [Contents][Index]
package.lisp (file)
Previous: The varjo․internals package, Up: Packages [Contents][Index]
package.lisp (file)
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions | ||
• Internal definitions |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported special variables | ||
• Exported macros | ||
• Exported compiler macros | ||
• Exported functions | ||
• Exported generic functions | ||
• Exported conditions | ||
• Exported structures | ||
• Exported classes |
Next: Exported macros, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
‘*default-version*‘ is a variable that holds the version of GLSL that will be used for a compile task if a version is not specified in the context
‘*stage-names*‘ is a variable that holds the list of keyword stage names that Varjo recognises
‘*stage-type-names*‘ is a variable that holds a list of type-names that map to the stages named in ‘*stage-names*‘
‘*supported-versions*‘ is a variable that holds the list of GLSL version Varjo
ostensibly supports.
Note: That ’ostensibly’ is there as I’m very sure that the lower levels of GLSL varjo is currently doing a very poor job. If you have the time please file issues that you find at https://github.com/cbaggers/varjo/issues
Next: Exported compiler macros, Previous: Exported special variables, Up: Exported definitions [Contents][Index]
src/utils-v.lisp (file)
src/utils-v.lisp (file)
src/utils-v.lisp (file)
src/utils-v.lisp (file)
src/utils-v.lisp (file)
src/utils-v.lisp (file)
src/utils-v.lisp (file)
‘def-metadata-infer‘ is the older syntax for ‘define-metadata-infer‘.
This macro is still exported in order to maintain compatibility with existing code.
‘def-metadata-kind‘ is the older syntax for ‘define-metadata-kind‘.
This macro is still exported in order to maintain compatibility with existing code.
‘def-shadow-type-constructor‘ is the older syntax for
‘define-shadow-type-constructor‘.
This macro is still exported in order to maintain compatibility with existing code.
‘define-alternate-type-name‘ lets you define
‘define-glsl-template-function‘ which lets you define a snippet of
glsl code as a function in Vari. Here is an example definition:
[0]
↓
(define-glsl-template-function my-func ((x :float)) ←[1]
:float ←[2]
"(1.0f / ~a)" ←[3]
:pure t) ←[4]
‘[0]‘ Here we are defining a function called ’my-func’
‘[1]‘ It takes 1 argument, called ’x’ which has the type ‘:float‘
‘[2]‘ It returns a single ‘:float‘ value
‘[3]‘ The string pattern is what will be injected into the final glsl. It
behaves as though this pattern and the glsl for the arguments were
passed to ‘format‘, e.g. ‘(format nil "(1.0f / ~a)" "2.3f") assuming
the glsl of the argument passed to ‘x‘ was "2.3f".
The glsl for the arguments is passed to format in the order specified
in ‘[1]‘
As it currently uses ‘format‘ it is legal to use other ‘directives‘ such as ‘~s‘ but it is not advisable as this will result in invalid glsl.
‘define-metadata-infer‘ lets you define
‘define-metadata-kind‘ lets you define
‘define-shadow-type-constructor‘ lets you define
‘define-vari-compiler-macro‘ lets you define a compiler-macro that works in
Vari.
The parameters in the lambda-list must be defined in form ‘(,name ,type-spec)‘
The compiler macro will only expand for functions with an exactly matching name
and lambda-list.
Vari’s compiler macros behave the same as regular Common Lisp compiler-macros
with the exception that you can make queries against the environment to find
data (such as type) from the arguments (See [here]() for details).
Due to having to compile the argument forms before being able to identify the compiler macro, any form returned from the compiler-macro (other than the value from ‘&whole‘ is going to result in recompilation. This make Vari’s compiler macros more ’expensive’ than Common Lisps in the general sense.
‘define-vari-function‘ lets you define a function that can be used in
any Vari code compiled in the future.
that takes the following:
- a name as a symbol
- a ’vari function lambda-list’ (see [here]() for details)
- a body made of Vari code
Please note that, other than performing some basic validation on the arguments,
this function does not attempt any validation on the body of the function.
Doing so would require knowledge of the context in which it is used.
If you need to test that the function could be valid, refer to the ‘test-translate-function-split-details‘ & ‘add-external-function‘ functions.
‘define-vari-macro‘ lets you define a macro that can be used in any Vari code
compiled in the future.
Vari’s macros behave the same as regular Common Lisp macros with the
exception that you can make queries against the environment to find
data (such as type) from the arguments (See [here]() for details).
‘define-vari-struct‘ lets you define
‘define-vari-type‘ lets you define
Kinda like varjo progn in that it accumulates the env and
returns the results of all the forms and the final env.
However it DOES NOT make a fresh environment to compile the forms in.
It expects that each form returns a result and optionally an env
src/varjo.internals/glsl-generation/line-and-chunk.lisp (file)
(pipe-> (1 2 3) #’a #’b #’c #’d)
Calls first function with args provided and uses result as
arguments for next function. Uses multiple-value-call so you
can use (values) to specify complex lambda-args.
src/utils-v.lisp (file)
‘v-def-glsl-template-fun‘ is the older syntax for ‘define-glsl-template-function‘.
This macro is still exported in order to maintain compatibility with existing code.
‘v-define-compiler-macro‘ is the older syntax for ‘define-vari-compiler-macro‘.
This macro is still exported in order to maintain compatibility with existing code.
‘v-defmacro‘ is the older syntax for ‘define-vari-macro‘.
This macro is still exported in order to maintain compatibility with existing code.
‘v-defstruct‘ is the older syntax for ‘define-vari-struct‘.
This macro is still exported in order to maintain compatibility with existing code.
‘v-deftype‘ is the older syntax for ‘define-vari-type‘.
This macro is still exported in order to maintain compatibility with existing code.
‘v-defun‘ is the older syntax for ‘define-vari-function‘.
This macro is still exported in order to maintain compatibility with existing code.
src/utils-v.lisp (file)
src/utils-v.lisp (file)
When ‘translate‘ is called within the dynamic extern of the body of this form,
if there is a use of a variable which is not in scope in the Vari code, but
is ‘boundp‘ & constant in the Common Lisp environment then the user
provided function will be called with the symbol naming the variable.
The user provided function must return a Vari type-spec or throw an error to
inform the user of the issue.
When ‘translate‘ is called within the dynamic extern of the body of this form,
if there is a use of a variable which is not in scope in the Vari code, but
is not constant in the Common Lisp environment then the user provided function
will be called with the symbol naming the variable.
The user provided function can:
- Return a Vari type-spec. This will become the type of the form.
- Return nil to have Varjo tell the user that the symbol is unbound.
- Throw an error. If you wish to inform the user that something else is awry.
When ‘translate‘ is called within the dynamic extern of the body of this form,
it will not throw an error if there is a use of ‘function‘ with an unknown
function name/signature. In the event of such a use the compiler will generate
a dummy function to satify the typechecker.
This is only useful for testing and the resulting GLSL will (most likely) not be legal
Next: Exported functions, Previous: Exported macros, Up: Exported definitions [Contents][Index]
src/utils-v.lisp (file)
Next: Exported generic functions, Previous: Exported compiler macros, Up: Exported definitions [Contents][Index]
src/varjo.internals/glsl-generation/string-generation.lisp (file)
src/utils-v.lisp (file)
src/utils-v.lisp (file)
‘add-alternate-type-name‘
src/utils-v.lisp (file)
This compiles each form one after the other (just like progn) however,
unlike progn, each form is evaluated with the original environment this
means that bindings in one won’t be visable in another.
Finally the resulting environement is merged.
This gives us the behaviour from the binding expressions portion of let forms
Compile each form passing the env from the previous into the next. return the compiled code objects as a list along with the final env
src/utils-v.lisp (file)
src/utils-v.lisp (file)
Remove the first ’to-depth’ ancestors counting from the base-environment.
For example calling env-prune on this environment..
base-env -> env0 -> env1 -> env2 -> env3 -> env4 -> env5
.. with a to-depth of 3 will return:
env2 -> env3 -> env4 -> env5
‘ephemeral-p‘ returns T is the Varjo type object represents an ‘ephemeral‘ type