Skip to content

Bind group names and module based on the content #88

@antonWetzel

Description

@antonWetzel

At the moment the bind groups are generated for every shader with the index as name (BindGroup0, BindGroup1, ...)

I would like the reuse bind groups if possible

  • Every type must be shared (demangle with module)
  • A bind group can be reused if the binding indices and corresponding types match

Idea

  • Add setting share_bind_groups: bool or similar
    • Only possible with demangle
    • Place the wrapper in the deepest common module
    • For the shader add method fn bind_bind_group_0(bind_group: &BindGroupShared)
      • The shared bind group has no fixed bind group index
  • Add setting bind_group_type_with_names or similar
    • Instead of the index use the binding names for the type name
    • See example below
    • No clue if the member names or types are better suited for the name
    • Always used for shared bind groups, because they have no index

Example for bind_group_type_with_names

@group(0) @binding(0) camera: Camera,

@group(1) @binding(0) settings: Settings,
@group(1) @binding(1) world: World, 
pub struct BindGroupCamera(...);
pub struct BindGroupSettingsWorld(...);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions