Skip to content

fix: Stop overloading d.location for vertex shaderLocation #2806

Description

@vende11s

fix: Stop overloading d.location for vertex shaderLocation

In WGSL, decorators like @size or @align can only decorate struct members.

Issue #2754 pointed out that we could pass decorators to arrayOf(), which usually had no effect and was misleading.

PR #2781 partially fixed this by rejecting non-@location decorations on array element types. @location remains allowed as an exception, because it is used with vertexLayout.

Problem

d.location currently means two different things depending on context:

  • On a struct / IO member, it maps to the WGSL @location attribute.
  • In a vertexLayout, decorating an array element with d.location sets the pipeline’s shaderLocation attribute.

Moreover, due to this exception, d.location can always be passed to arrayOf(), which might be misleading.

Proposal

Make decorators single-purpose and find another way to pass shaderLocation to the vertexLayout, so arrayOf() no longer needs a special case for @location.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions