WGSL: const
declarations in function scope cannot be used as const
expressions
#6720
Labels
area: naga front-end
lang: WGSL
WebGPU Shading Language
naga
Shader Translator
type: bug
Something isn't working
Description
const
-declared values in function scope (i.e., "local"const mySize = 2
inside afn
declaration) cannot be used in contexts where values must be constant-evaluatable, likearray
sizes.Repro steps
Observe that while this passes validation in WGSL:
…this does not:
…which returns an error from
naga-cli
:Expected vs observed behavior
I expect that values bound to
const
declarations should be usable as aconst
expression in the same contexts, independent of where they are declared (lexical scoping notwithstanding).The text was updated successfully, but these errors were encountered: