You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've not really looked into this since the issue was created, but I think it would be quite simple to implement an initial version. Updated thoughts:
The main goal here would be to provide an API allowing the user to avoid the overhead of making lots of Im3d calls. User code would look like this:
if (Im3d::BeginCache("BigScene")) // If false, we skip Im3d calls below and use the cached vertex data directly.
{
// ... lots of Im3d calls here.
Im3d::EndCache(); // Cache the vertex data we just created.
}
Internally, cached vertex data would follow the structure of m_vertexData (= one list per layer, per primitive * 2 for sorted/unsorted). This way, the cache can be copied into m_vertexData such that sorting/layering still works. There would also be an InvalidateCache(id) function.
The approach outlined above has a couple of caveats:
Transform modification:
Could store the top of the transform stack per cache, if it's different when we go to copy the cached data we can re-transform the data there.
That would only support a single global transform modification per cache. Anything more complicated requires invalidating the cached data.
Nested caches:
Nested caches won't invalidate properly, as the nested cache data will effectively be duplicated in the enclosing cache.
Could potentially solve by storing a list of nested caches per cache. Invalidating a cache would also invalidate any referents.
BeginCache(_id);
,EndCache()
,DrawCache(_id)
(but with better names).The text was updated successfully, but these errors were encountered: