Anonymous
08/19/24(Mon)19:51:51 No.101983298 Is there a name for this garbage collection method and is it any good?
What I thought of is sort of a hybrid of a sweep GC and reference counting. Every resource object stores a uint32 bitmask where each bit represents something referencing it with its own lifetime. One bit is a global lifetime, one is a level lifetime, and the rest are streamable sublevel lifetimes.
Referencing a resource requires marking all subresources as being referenced on the same lifetime bit. Freeing a level/sublevel is just unsetting a bit on all resources and checking if the mask is 0.
The one advantage I like is that lifetimes are clearly defined as being attached to levels/sublevels instead of being ambiguous with reference counts. And using a resource doesnt cause any atomic adds or whatever like with a reference count, you just use the pointer again.
>>101982049
init();
while(1)
{
update();
render();
}
>>101981192
>>101982687
Animations (usually) have a fixed framerate but you interpolate the keyframes based on time. So the animation could be at 20fps but its still smooth at any arbitrary fps. Storing keyframes at a variable framerate is totally valid too, however it becomes a tradeoff as now you need to store another float with each keyframe and you cant just index the keyframes as if they were fixed. You still have to interpolate keyframes if you are using a variable framerate if you want it to be smooth. Fixed vs variable is more about compression.
Blending of animation clips is always done on the CPU in every game anyways (because blend trees and state machines get complex). The part thats sometimes done on the GPU is computing the verticies from the skinning matricies once and resuing those instead of doing that every vertex shader (but this is not necessary at all).