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

WGSL should have a shuffle builtin function #748

Description

@dneto0

WGSL should have the analog of OpenCL C's "shuffle2" where the selector mask is a compile-time constant (or literal vector).
This has a close analog in LLVM IR in as "shufflevector" and in SPIR-V as OpVectorShuffle.
The operate on vectors as values, not as a vector-valued variable (storage).

Assuming v is a 4-element vector, Glslang implements v.xz = foo in SPIR-V as the following:

%initial = load from v
%newvalue = OpVectorShuffle %v_type %initial %foo 4 1 5 3
OpStore %v %newvalue

Activity

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

    wgslWebGPU Shading Language Issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions