LocalVariable::init
is barely used
#4488
Labels
area: naga front-end
area: naga middle-end
Intermediate representation
kind: refactor
Making existing function faster or nicer
lang: GLSL
OpenGL Shading Language
naga
Shader Translator
The
init
field ofnaga::LocalVariable
is barely used by any front ends. It would be nice to delete it.Initializers for local variables in GLSL and WGSL can be arbitrary expressions. Since Naga IR effectively hoists all function-local variables up to the top of the function, front ends turn those initializers into
Store
statements executed at the point at which the variable gets declared in the original source. This means thatLocalVariable
's owninit
field isn't good for much.In fact, the only front end that puts anything other than
None
inLocalVariable::init
is GLSL, which uses it for some indexing hack that I don't understand. Surely that could be rewritten, isolating that complexity to the front end that needs it.The text was updated successfully, but these errors were encountered: