Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Naga IR ArraySize::Dynamic should be renamed to Runtime, to match WGSL #6319

Open
jimblandy opened this issue Sep 25, 2024 · 0 comments
Open
Labels
naga Shader Translator

Comments

@jimblandy
Copy link
Member

Naga IR's terminology for global arrays whose length is determined by the size of the buffer binding should be reconciled with WGSL's.

  • WGSL syntax for such array types is array<T>, instead of array<T, N> for an array of N elements. The spec text calls them runtime-sized arrays.

  • SPIR-V's type is OpTypeRuntimeArray, and the spec (somewhat elliptically) calls them "run-time arrays".

  • Naga IR has ArraySize::Dynamic, and the comments talk about "dynamically sized arrays".

  • GLSL talks about "run-time sized arrays" and "compile-time sized arrays".

  • In HLSL we just use the untyped RWByteAddressBuffer for anything variable-sized, so there isn't really a language term for this.

  • In Metal, all arrays have no particular length, and we have to pass their sizes to the shader explicitly.

So Naga IR is the odd man out, using the term "dynamic". Simply renaming it to ArraySize::Runtime and updating all docs would remove a point of confusion.

@jimblandy jimblandy added the naga Shader Translator label Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
naga Shader Translator
Projects
Status: Todo
Development

No branches or pull requests

1 participant