Skip to content

Hint about descriptor lifetime earlier #33

@eliemichel

Description

@eliemichel

From peterkennard on Discord:

So, I am taking a sample step054 ( animating pyramid ) and integrating it with a test program.

One thing it does not illustrate is the scope of all the various objects since they are ALL declared inside the big main()

I created a class TestApp() and divided it into

init();
renderFrame(); // called in a loop
releaseResources(); when done

and just for now, I put all the objects that were on the stack and made them members of the class.
This all works fine, but the lifecycle scope of the various objects is not really hinted at in the sample.
I know many of the "initialization structures" can be discarded after the object is created so in my code I often put them in blocks unless one can use the enclosing method as the scope. But when everything is in a giant main it sort of obscures the need to keep some things around or referenced.

main() {
{
InitStruct is{};
...
objectHandle = createObject(is);
}
...
{
// another one
}

Anyway - I have found the the WebGPU guide and the associated code quite well done. Thanks for creating it!
PK

This kind of refactoring happens in step080, but maybe it is a bit too late, or at least I should give hints about it earlier indeed!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions