Skip to content

WGSL says [[block]] structs can't be members of other structs, but shows an example of this #1702

Closed

Description

@jimblandy

§4.3.6.2, "Structure Layout Rules", shows an example in which a [[block]] struct A is used in [[block]] struct B, as the type of member e, and as the element type of an array for member g. But the definition of the block attribute says, "A structure type with the block attribute must not be: • the element type of an array type • the member type in another structure". (If you're gonna break a rule, break 'em all!)

I think the fix is just to remove the [[block]] from A.

The next code example has the same issue.

Activity

  1. added
    wgsl
    on Apr 30, 2021
  2. ben-clayton commented on Apr 30, 2021

    @ben-clayton
    Contributor

    You are correct. This was a silly mistake propagated all the way from my initial proposal. We just need to remove [[block]] from the inner structure, as you suggested.

  3. added a commit that references this issue on Apr 30, 2021
    277caf6
  4. added a commit that references this issue on May 1, 2021
    ed40e00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    wgsl

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions