Skip to content

wgsl: validate assignment #1644

@dj2

Description

@dj2

Simple assignment

  • vec.{x,y,z,w,r,g,b,a} = 1
  • vec.xy = vec2(1) fails (no multi-swizzle on lhs)
  • vec[0] = 1
  • vec[-1] = 1 is not a validation error
  • vec[99] = 1 is not a validation error
  • ary[1] = 1
  • ary[-1] = 1 is not a validation error
  • ary[99] = 1 is not a validation error
  • vec[min(max(1, 2), 1)] = 1
  • struct.a = 1
  • struct.a.b.c.d.e.r = 1
  • *ptr = 1, write to a de-ref'd pointer
  • structA = structB succeeds
  • structA = structB validation error when structB has {runtime array, atomic, sampler?} (not constructable things)
  • func().r = 1 where func returns a vec ... ?
  • Assign where RHS type != LHS type is validation error
  • Write to LHS where access mode is write fails
  • Write to LHS in uniform address space fails
  • Write to LHS in storage, read address space fails
  • Write to {texture, sampler, pointer} fails
  • RHS of {texture, sampler, pointer} fails validation (maybe the same as the above?)

Phony assignment

  • RHS of {texture, sampler, pointer} succeed
  • RHS of constructable passes
  • RHS of non-constructable fails (struct with runtime array)
  • RHS of function call

Compound assignment

  • Compound assignment with space between the <char> and = fails parse
  • Same set of tests as simple assignment
  • Validate that e1 is only evaluated once (function call returning vec that increments global?)
  • _ += 1 fails (for all compound types)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Open (no TODO)

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions