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

Various Metal performance optimizations #2185

Merged
merged 4 commits into from
Jun 28, 2018
Merged

Various Metal performance optimizations #2185

merged 4 commits into from
Jun 28, 2018

Conversation

kvark
Copy link
Member

@kvark kvark commented Jun 28, 2018

Helps #2161 . I'm now getting 80-85 fps on the test run.
Aside from Metal, also changes HAL to avoid heap allocation for vertex buffer binding.
PR checklist:

  • make succeeds (on *nix)
  • make reftests succeeds
  • tested examples with the following backends: metal

@kvark kvark requested a review from grovesNL June 28, 2018 03:56
let index = first_binding as usize + i;
let value = Some((buffer_ptr, b.range.start + offset));
if index >= self.state.vertex_buffers.len() {
debug_assert_eq!(index, self.state.vertex_buffers.len());
Copy link
Contributor

Choose a reason for hiding this comment

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

How could this assertion fail?

Copy link
Member Author

Choose a reason for hiding this comment

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

it shouldn't I'm just being overly careful here (hence, it's a debug assert and not a usual one)

@@ -821,11 +821,11 @@ impl CommandSink {
) where
I: Iterator<Item = soft::RenderCommand<&'a soft::Own>>,
{
//assert!(AutoReleasePool::is_active());
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove this?

Copy link
Member Author

Choose a reason for hiding this comment

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

this is intentional - we need to make sure there is an active autorelease pool set up by the caller here, but I don't know how to code it yet

@@ -1653,6 +1653,8 @@ impl com::RawCommandBuffer<Backend> for CommandBuffer {
T: IntoIterator,
T::Item: Borrow<SubresourceRange>,
{
let _ap = AutoreleasePool::new();
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this fix the leak?

Copy link
Member Author

Choose a reason for hiding this comment

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

possible! my motivation was to avoid 2 autorelease pools during a regular begin_render_pass, so now I removed the inner one and made sure all the callers set up one.

@kvark
Copy link
Member Author

kvark commented Jun 28, 2018

CI looks green
bors r=grovesNL

bors bot added a commit that referenced this pull request Jun 28, 2018
2185: Various Metal performance optimizations r=grovesNL a=kvark

Helps #2161 . I'm now getting 80-85 fps on the test run.
Aside from Metal, also changes HAL to avoid heap allocation for vertex buffer binding.
PR checklist:
- [x] `make` succeeds (on *nix)
- [x] `make reftests` succeeds
- [x] tested examples with the following backends: metal


Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
@kvark kvark mentioned this pull request Jun 28, 2018
22 tasks
@bors
Copy link
Contributor

bors bot commented Jun 28, 2018

@bors bors bot merged commit 96871af into gfx-rs:master Jun 28, 2018
@kvark kvark deleted the perf branch June 28, 2018 14:31
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.

2 participants