Skip to content

Commit 35f2348

Browse files
bors[bot]kvark
andcommitted
Merge #2260
2260: Remote command sink in Metal r=grovesNL a=kvark Fixes #2259 The results so far are not super promising - highly unstable (presumably, because of the dispatch), with performance around `Immediate` mark. We are still missing the most important follow-up here - to avoid any heap allocations when recording commands. Currently, it just goes with `Vec::new()` and grows it for each pass, which shows up in the profile quite a bit. The PR also has a bunch of stuff in general optimizations: - HAL change in the descriptor allocation API to avoid the heap - lighten up Metal descriptor binding path (a bit) by making sure there is enough state slots in advance - simplification and refactoring of `CommandSink` implementations PR checklist: - [ ] `make` succeeds (on *nix) - [ ] `make reftests` succeeds - [x] tested examples with the following backends: Metal - [ ] `rustfmt` run on changed code Co-authored-by: Dzmitry Malyshau <[email protected]>
2 parents 4be6417 + b5266e7 commit 35f2348

File tree

8 files changed

+337
-150
lines changed

8 files changed

+337
-150
lines changed

src/backend/gl/src/native.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,11 @@ pub struct DescriptorSet {
174174
pub struct DescriptorPool {}
175175

176176
impl pso::DescriptorPool<Backend> for DescriptorPool {
177-
fn allocate_sets<I>(&mut self, layouts: I) -> Vec<Result<DescriptorSet, pso::AllocationError>>
178-
where
179-
I: IntoIterator,
180-
I::Item: Borrow<DescriptorSetLayout>,
181-
{
182-
layouts.into_iter().map(|layout| Ok(DescriptorSet {
183-
layout: layout.borrow().clone(),
177+
fn allocate_set(&mut self, layout: &DescriptorSetLayout) -> Result<DescriptorSet, pso::AllocationError> {
178+
Ok(DescriptorSet {
179+
layout: layout.clone(),
184180
bindings: Arc::new(Mutex::new(Vec::new())),
185-
})).collect()
181+
})
186182
}
187183

188184
fn free_sets<I>(&mut self, _descriptor_sets: I)

src/backend/metal/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ block = "0.1"
3030
cocoa = "0.15"
3131
core-foundation = "0.6"
3232
core-graphics = "0.14"
33+
dispatch = "0.1"
3334
smallvec = "0.6"
3435
spirv_cross = "0.9"
3536
parking_lot = "0.6.3"

0 commit comments

Comments
 (0)