这是indexloc提供的服务,不要输入任何密码
Skip to content

var declaration without storage class: spell out rules, infer Function storage class inside a function #654

@dneto0

Description

@dneto0

We need spec text for the rules about when a variable is declared without an explicit storage class.

There are two cases. At module scope, the current draft alludes to a proposal that this case be invalid. From the example in 3.15 "Initializers":

var bar : f32     # Error. Must have storage class. E.g. private

Inside a function, we should infer Function storage class. This is covered in several examples, e.g. also in 2.15. (It's also the rule from SPIR-V. https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#_a_id_logicallayout_a_logical_layout_of_a_module)

WGSL should have explicit rules for this. A candidate for the rules would be 2.11 "Variables".

Metadata

Metadata

Assignees

No one assigned

    Labels

    wgslWebGPU Shading Language Issueswgsl resolvedResolved - waiting for a change to the WGSL specification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions