Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[msl-out] Replace per_stage_map with per_entry_point_map #2237

Merged
merged 2 commits into from
Feb 22, 2023

Conversation

armansito
Copy link
Contributor

The existing per_stage_map field of MSL backend options specifies resource binding maps that apply to all entry points of each stage type. It is useful to have the ability to provide a separate binding index map for each entry point, especially when the same shader module defines multiple entry points of the same stage kind.

This patch introduces a new per_entry_point_map option. When fields are missing in the per-entry-point map, the code falls back to the existing per_stage_map option as before.

@teoxoy
Copy link
Member

teoxoy commented Feb 2, 2023

I'm inclined to say that we replace per_stage_map with the new per_entry_point_map. We'll need this for wgpu soon enough too.

@jimblandy @kvark thoughts?

@armansito
Copy link
Contributor Author

I left the per_stage_map in place since I thought that might make it easier to transition the code that depends on it but I'm happy to remove it entirely in favor of per_entry_point_map if folks are supportive.

Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

Let's postpone the removal of per_stage_map.
We should also rename PerStageResources to EntryPointResources when we do that to minimize breaking changes.

src/back/msl/mod.rs Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Merging #2237 (00c648e) into master (a5c2cf9) will increase coverage by 12.89%.
The diff coverage is 90.90%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@             Coverage Diff             @@
##           master    #2237       +/-   ##
===========================================
+ Coverage   69.14%   82.03%   +12.89%     
===========================================
  Files          77       80        +3     
  Lines       28260    43177    +14917     
===========================================
+ Hits        19539    35421    +15882     
+ Misses       8721     7756      -965     
Impacted Files Coverage Δ
src/back/msl/writer.rs 90.93% <76.92%> (+16.45%) ⬆️
src/back/msl/mod.rs 83.75% <100.00%> (+5.97%) ⬆️
src/front/wgsl/parse/ast.rs 22.85% <0.00%> (-77.15%) ⬇️
src/front/glsl/token.rs 70.00% <0.00%> (-30.00%) ⬇️
src/back/hlsl/mod.rs 78.33% <0.00%> (-12.30%) ⬇️
src/proc/layouter.rs 87.70% <0.00%> (-7.04%) ⬇️
src/back/wgsl/mod.rs 95.45% <0.00%> (-4.55%) ⬇️
src/front/glsl/variables.rs 76.70% <0.00%> (-3.83%) ⬇️
src/front/glsl/mod.rs 96.61% <0.00%> (-3.39%) ⬇️
src/block.rs 78.57% <0.00%> (-2.68%) ⬇️
... and 72 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@kvark
Copy link
Member

kvark commented Feb 20, 2023

@teoxoy sounds reasonable!

@teoxoy
Copy link
Member

teoxoy commented Feb 20, 2023

@armansito since we got a +1 on removing per_stage_map let's do it in this PR - sorry for the back and forth

We can keep get_ep_resources if it makes code nicer and let's also rename PerStageResources to EntryPointResources.

Thank you!

The existing `per_stage_map` field of MSL backend options specifies
resource binding maps that apply to all entry points of each stage type.
It is useful to have the ability to provide a separate binding index map
for each entry point, especially when the same shader module defines
multiple entry points of the same stage kind.

This patch replaces `per_stage_map` with a new `per_entry_point_map`
option where resources are keyed by the entry-point function name.
@armansito
Copy link
Contributor Author

@armansito since we got a +1 on removing per_stage_map let's do it in this PR - sorry for the back and forth

We can keep get_ep_resources if it makes code nicer and let's also rename PerStageResources to EntryPointResources.

Thank you!

No problem! I just force pushed a new change (I erased the previous two commits since they didn't no longer made sense). PTAL!

Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks solid! Thanks!

@teoxoy teoxoy changed the title [msl-out] Introduce a per-entry-point resource binding map option [msl-out] Replace per_stage_map with per_entry_point_map Feb 22, 2023
@teoxoy teoxoy merged commit 00be08e into gfx-rs:master Feb 22, 2023
@armansito armansito deleted the pr-binding-map branch February 22, 2023 23:41
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.

4 participants