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

Resource tracking and destruction #633

Merged
merged 14 commits into from Mar 8, 2015

Conversation

@kvark
Copy link
Member

commented Mar 7, 2015

Implements automatic management of the resources. Works just like RAII.

Closes #288, #617

User API changes:

  • there is no such thing as factory.delete_something() any more!
  • Renderer and Factory accept all handles by reference to avoid cloning
  • handles are no longer copyable. That added a bit of noise to the deferred example, but I'm sure we can refactor the interface to solve it.
  • Factory works with RawBuffer type natively now instead of Buffer<()>
  • need to call device.after_frame() after glfw.swap_buffers()

TODO:

@bvssvni

This comment has been minimized.

Copy link
Contributor

commented Mar 7, 2015

Nice!

@ghost

This comment has been minimized.

Copy link

commented Mar 7, 2015

Looks good so far.

@kvark kvark force-pushed the kvark:resource branch from 34f88e2 to 736a4c2 Mar 8, 2015

use alloc::arc::{strong_count, weak_count};
use std::ops::Deref;
vector.retain(|v| {
strong_count(v) > 1 || weak_count(v) > 1 || {

This comment has been minimized.

Copy link
@ghost

ghost Mar 8, 2015

can we just use an if? this is a bit to tricky.

let free = !(strong_count(v) > 1 || weak_count(v) > 1);
if free { fun(param, v.deref()); }
!free

This comment has been minimized.

Copy link
@kvark

kvark Mar 8, 2015

Author Member

sure, will fix in a moment

@kvark kvark force-pushed the kvark:resource branch from 736a4c2 to dab5635 Mar 8, 2015

@kvark kvark referenced this pull request Mar 8, 2015

Merged

Managed resources #5

kvark added some commits Mar 8, 2015

@kvark kvark changed the title [WIP] Resource tracking and destruction Resource tracking and destruction Mar 8, 2015

@kvark kvark referenced this pull request Mar 8, 2015

Closed

It is easy to leak mesh data #464

@ghost

This comment has been minimized.

Copy link

commented Mar 8, 2015

LGTM, but I would like @bjz or @bvssvni to take a look too.

@bvssvni

This comment has been minimized.

Copy link
Contributor

commented Mar 8, 2015

Looks good.

@bvssvni

This comment has been minimized.

Copy link
Contributor

commented Mar 8, 2015

Is this still blocked?

@kvark

This comment has been minimized.

Copy link
Member Author

commented Mar 8, 2015

No, I forgot to change the issue status. It's all ready.

Regards,
Dzmitry

On Mar 8, 2015, at 6:23, Sven Nilsen notifications@github.com wrote:

Is this still blocked?


Reply to this email directly or view it on GitHub.

@bvssvni

This comment has been minimized.

Copy link
Contributor

commented Mar 8, 2015

Ok, I'll merge!

bvssvni added a commit that referenced this pull request Mar 8, 2015

Merge pull request #633 from kvark/resource
Resource tracking and destruction

@bvssvni bvssvni merged commit ff213e1 into gfx-rs:master Mar 8, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@bvssvni bvssvni removed the status: blocked label Mar 8, 2015

@kvark kvark deleted the kvark:resource branch Mar 8, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.