You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
handle ‘interface’ declarations with mismatched types?
for now just warning/error if a shader is ambiguous (uses a field
with different types in different stages, and isn’t declared for
a specific stage)
eventually may want to try type inference on all stages that have
matching interface bindings?
handle ARRAY-ACCESS
fix type inference for (setf a (1+ (vec4 1 2 3 4)))
infers a as ivec4, should be vec4
(probably bad cast on write-variable)
decide if RETURN should be required for return values from functions?
– requiring it for now…
not sure if that is better or requiring (values) or declaration for
void return?
rewrite finalization stuff to do full inference pass
clean up debug noise/commented junk, reformat code
make sure var initialization uses correct bindings whem vars are shadowed
internally they refer to correct bindings, but if they have same name they
might be wrong when printed
ex:
(let ((a 1))
(let ((a 2)
(b a))
b ;; should be 1
))
make sure type declarations are used correctly
particularly function return
handle (values) as ‘void’
figure out why inference work grows with repeated C-c C-c
track function dependencies with glsl:defun macro
hook to call with list of modified functions when function is recompiled
pass list of function name + names of all functions that depend on it?
only on successful compile
(if possible, figure out how to avoid multiple calls from C-c C-k?)
program using shaders could check for names of any active shaders,
and try to finalize them for upload to card
track dependencies on types/constants/uniforms/varyings, call modified hook
pass to recompile dependents as needed
update constants when redefined
? figure out how to avoid errors when reloading shaders with C-c C-l or C-c C-k
‘next frame’ isn’t enough delay, since compiling whole file might
take more than a frame
lock might be enough to avoid errors, but still get some redundant compiles
handle dependencies between initialization of globals
ex (defconstant foo (* bar 2))
split out into separate repo
rename ‘glsl’ package to longer name
name stages :VERTEX-SHADER etc instead of :VERTEX, to match gl:create-shader?
documentation
usage (host)
updating programs/modified hook
usage (glsl)
defining package using glsl
input/uniform/interface/output
optional type declarations
stuff that might change
type names :vec3 etc to glsl:vec3?
status/notes/warnings
branches of IF have to unify?
bad errors
fix names of glsl functions with 1D, 2D, 3D
proofread names in general, emit-stream-vertex etc
check exports
handle return type of IF better
don’t try to unify types if return type isn’t used
probably add an ‘:ignored’ or ‘:unused-return’ keyword to WALK and
pass it as needed (all but last form in progn, all forms in global
function, all forms in progn with that flag set)
if return value is used, return a type with casts from both branches
instead of unifying branches directly
cleanup/remove/update examples, add new examples
not getting dependencies right inside swizzle, possibly other places?
ex uniform named UV, only accessed as (.xy uv)
handle dependencies between types better
ex SSBO using a struct type
handle dependencies between types and constants
ex constant used as length of array in a struct
document struct stuff
recompile functions when a type changes?
use reinitialize-instance when redefining structs
clear bindings-used-by of interface-binding on redefinition
fix type inference of optional args?
ex (return)
fix type inference of uninitialized LET bindings
ex
(let ((translation))
(setf translation 1.0))
also
(let ((a)) (incf a (vec3 1 2 3))) with original INCF definition
allow (let (foo) …) syntax for uninitialized binding
‘beta’
assign priorities to constraints, process worklist in priority order?
priority of type = 1+ highest priority of constraint with that type as ‘output’ or 0
priority of constraint = 1+ highest priority of ‘input’ types?
api for getting info about uniforms/attributes/outputs of a shader
better errors/warnings
should be able to resolve a static type for 0-arity functions?
error/warning for any constraints that can’t be met
track variable names etc in constraints for useful errors?
misc specific errors
VALUES declaration other than on a function/lambda
add compiler macros for more complicated binops like =, <, etc
= : (and (= a b) (= b c) …)
< : (and (< a b) (< b c) …)
/= : (and (/= a b) (/= a c) (/= b c) …)
add += etc operators?
track types/changes/dependencies etc for global variables
store cached static type assignments/overloads with function
so we don’t need to recalculate it every time
(and clear when redefined/modified)
fix package/namespace/environment stuff
split out cl:foo and glsl:foo definitions (or combine them?
split out definitions of glsl macros from host utils for defining them
reorganize code
add somewhere to mark functions as vertex/fragment/etc only
(declare (glsl:stage :vertex …))?
better handling for qualifiers for images (readonly, writeonly, etc)
need to include in type so they can propagate from uniforms
to function arguments, probably should veryify read/writeability
in load/store
add qualifiers to function arglists (declarations?)
ex readonly/writeonly/etc for images
figure out if optional arguments are working properly
particularly during recompilation of existing shaders
handle unused arguments better during type inference
make sure -1 derives type int instead of uint?
support some subset of CL array/vector types for declarations
currently expects something like (:float 32)
figure out better way to handle package <-> environment association
possibly should define things in an environment corresponding to
symbol-package, or else require specifying an environment?
? alternately, require some explicit list of environments current
package imports from, either from :use list in associated package,
or explicit function linking them?
specific use case = defining things like (input color …) and
(input position …) once and reusing it (where POSITION is
probably CL:POSITION)
POSITION in particular will pretty commonly conflict, since it is in CL
but not sure how often different things will want different definitions?
(possibly a 2d lib would want vec2 or something would want ivec?)
figure out multidimensional array syntax?
((:foo dim) dim)?
(:foo (dim dim))?
(:foo dim dim)?
add more concrete types (int8, float16 etc) and aliases
:int -> :int32 -> “int” instead of separate :int->”int”/:int32->”int”
:mat2x2 -> :mat2 -> “mat2” instead of :mat2->”mat2”,:mat2x2->”mat2x2”?
need to see how it goes through type inference, might need extra
work to get correct type, and may end up extra instructions in
spirv (for example if it loads constant integer, then casts to
float instead of using a constant float)
fix vector/mat constructors to allow extra elements in last argument
ex: vec2(mat4) is allowed, but not vec2(mat4,scalar) etc
check for conflicts between in/out and uniforms used in same shader stage
probably needs to be after type inference
‘done’
cache glsl from compiled shaders, add option to remove intermediate data
for use in final release, don’t need to retain all the type
inference data if we don’t plan to make any changes to shader, and
don’t want to waste time recompiling it every load
decide how to represent struct accessors (just using @/slot-value for now)
possibly .foo like swizzles?
if so, possibly add some ability to merge struct accessors with swizzles
so structs could have a RGB member, and type of .rgb would get extended
to (or :vec34 :ivec34 … that-struct-type)
probably better to skip the .
track glsl versions, add 4.1, maybe 3.x?
in/out parameters?
allow initialization of uniforms
make sure we don’t print different symbols with same glsl name?
(at least for uniforms,functions and such with ‘global’ scope)
can’t really rename them during printing though, since we need to
know the name of uniforms to set them from caller (and might have
already generated programs with default name)
probably error if detected, and add an option to prefix glsl names with
package name and _ ?
alternately, track name mapping along with shader compilation?
might be OK, since we probably want to query locations for any
that weren’t statically allocated, and can just use static location
instead of name for ones that were
figure out/add rules for SETF stuff
(setf (.rgb foo) …) is ok, (setf (.rrr foo) …) is bad, etc
clean up/remove duplication between cl-walker and glsl-walker
decide how to handle ‘free’ declarations
(let ((a))
(let ((b))
(declare (:float a))
..
))
not sure if that should:
a. be an error
b. force A to be a float
c. add a constraint that a can implicit-cast to float
don’t use reserved words as identifiers
at a minimum, error, preferably rename
would be nice
add better ways to distinguish mat/vec/scalar types and mat dimensions
and refactor code to use them (spirv backend in particular)
remove unused variables
detect/remove dead code (after RETURN, etc)
figure out if vec/mat constructors need a specific constraint type?
mat4 with 10 args has to search through 5k or so types, though probabl
pretty uncommon to pass 10 args to mat4 (usually 1,4,15,maybe 2 or 3)
handle subroutine uniforms/subroutines in general?
not sure how much change is needed
need to figure out if subroutine uniforms have different namespace
from normal ones?
check for more places where :cast nil can be set for built-in functions
also make sure the existing ones are right
(either no cast allowed, or all types fully specified already)
CSE/common subexpression optimizations?
spirv
names of globals in output spv?
add single-op /
make a temp 1 of appropriate type and use normal / ?
add single-op versions of +,*,AND,OR,etc
see if (- 1) does right thing?
not sure if it should return a signed int, or unsigned #xff..ff?
also check negation of larger unsigned values
check edge cases of constructor rules
bool in int/float vec/mat should work
construct vec from mat
optimize mat/vec constructors that can use argument directly
ex. vec4 from mat4, use component 0 directly
or mat4 from vec4, store vec4 directly
extra values passed to vec/mat constructors
(last argument can have extras, but can’t have extra arguments)
ex: vec2(mat4) is allowed, but not vec2(mat4,scalar) etc
spirv optimizers?
add a composite-construct -> composite-extract optimizer?
probably not common enough in real code to care, but things like
(mat4 (mat3 x)) and similar construct the mat3 then extract the
components to build the mat4. So could detect a
composite-construct that is only used by composite-extract and
use the original elements directly.
possibly also composite-construct -> composite-construct for vec?
ex (vec4 (vec2 a) (vec2 b)) -> (vec4 a a b b)
CSE/redundant loads/stores etc
need to figure out which loads can be dropped, probably at least
locals and inputs? not worgroup shared mem, maybe not SSBO?