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

Constant propagation #905

@kvark

Description

@kvark

Do we need any kind of constant propagation in WGSL?
This is one of the examples from Metal Shading Language document:

constexpr constant uint MAX_LIGHTS=4;
struct LightDesc{
  uint num_lights;
  float4 light_position[MAX_LIGHTS];
  float4 light_color[MAX_LIGHTS];
  float4 light_attenuation_factors[MAX_LIGHTS];
};

It relies on the MAX_LIGHTS constant to be propagated to define the array sizes.

Related to #572 : specialization constants aren't going to be "real" constants since in MSL they can't be used for array sizes, if I understand correctly.

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