Sitelet https://github.com/gpuweb/gpuweb/issues/2486
Skip to content

in certain contexts, an identifier does not resolve to its declared object #2486

Description

@dneto0

When an identifier is used, it must be in scope for some declaration, or as part of a directive. When an identifier is used in scope of one or more declarations for that name, the identifier will denote the object of the non-module-scope declaration appearing closest to that use, or the module-scope declaration if no other declaration is in scope. We say the identifier use resolves to that declaration.

This is not quite right, unfortunately.

Example 1:

let rgba8unorm: i32 = 12;
[[group(0),binding(0)]] var texture_storage_2d<rgba8unorm,write>; 
// this use of rgba8unorm does not denote the value 12.

Example 2:

let binding: i32 = 1;

[[group(0),binding(0)]] var texture_storage_2d<rgba8unorm,write>; 
// this use of binding does not denote the value 1

Example 3:

enable foobar;      // this use of foobar does not denote the value 1
let foobar: i32 = 1;

In each case the scope of the declaration includes the uses of the identifier, but the identifier does not denote the declared object.
Basically, we need to describe spots in the source text where the normal identifier resolution rules are not active. These would be:

  • in the text of a directive
  • attribute names
  • parameters to certain attributes: interpolate, stage, builtin
  • texel format part of a storage texture type

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugcopyeditingPure editorial stuff (copyediting, *.bs file syntax, etc.)wgslWebGPU Shading Language Issues

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions