Skip to content

Named bindgroups - #90

Draft
antonWetzel wants to merge 10 commits into
ScanMountGoat:mainfrom
antonWetzel:named-bindgroups
Draft

Named bindgroups#90
antonWetzel wants to merge 10 commits into
ScanMountGoat:mainfrom
antonWetzel:named-bindgroups

Conversation

@antonWetzel

Copy link
Copy Markdown
Contributor

Closes #88

This MR adds 2 flags to the WriteOptions.
This is just an experiment, how the generated bindings for bind groups could look like.
The code generation with the flags disabled is unchanged.

named_bind_groups

Name the bind groups not (BindGroup0, BindGroup1, ...), but (BindGroupCamera, BindGroupTextureSampler, ...).

Example

@group(0) @binding(0)
var<uniform> camera: Camera;
@group(0) @binding(1)
var<uniform> settings: GlobalSettings;

@group(1) @binding(0)
var texture: texture_2d<f32>;
@group(1) @binding(1)
var sampler: sampler;
struct BindGroupCameraSettings { /*...*/ }
struct BindGroupTextureSampler { /*...*/ }

shared_bind_groups

Place bind groups in a common module where possible.

Example

@group(0) @binding(0)
var<uniform> shared_camera: Camera;
@group(0) @binding(1)
var<uniform> shared_settings: Settings;
mod shared {
    struct BindGroupCameraSettings { /*...*/ }
}

Other changes

  • Use iterators in the quote!-macro without collecting into a Vec
  • Remove pathdiff dependency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bind group names and module based on the content

1 participant