这是indexloc提供的服务,不要输入任何密码
Skip to content

WGSL should have a shuffle builtin function #748

@dneto0

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

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