GithubHelp home page GithubHelp logo

Stronger typed resource tracker about wgpu HOT 2 CLOSED

gfx-rs avatar gfx-rs commented on July 20, 2024
Stronger typed resource tracker

from wgpu.

Comments (2)

kvark avatar kvark commented on July 20, 2024

Experimented with this quite a bit in kvark@d46b0dd , and it's hell of a complex thing to lift to a type level. Basically, there are many use cases, and we are still in heavy development phase. It appears to me that we should let it crystallize a bit more before trying to typify it.

The basic idea was to introduce a trait State that would differentiate between the trackers that only care about the current state versus ones that care both about the initialization and the current state:

#[derive(Clone)]
struct Track<S> {
    ref_count: RefCount,
    state: S,
    epoch: Epoch,
}

trait State<U> {
    fn new(usage: U) -> Self;
    fn init(&self) -> U;
    fn last(&self) -> U;
    fn set(&mut self, usage: U) -> U;
}

impl<U: Copy> State<U> for U {} // current-state tracking
impl<U: Copy> State<U> for Range<U> {} // init + current state tracking

The difficulties I faced is - implementing the consume* logic for various combinations of source/destination, then insert_barriers needing to be generic somehow.

from wgpu.

kvark avatar kvark commented on July 20, 2024

There's been a ton of work and rework done for the resource tracker. I don't think the issue is actual any more.

from wgpu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.