-
Notifications
You must be signed in to change notification settings - Fork 34
Description
PR #369 introduced internal reference count to RefObject, to allow Texture objects to hold on to a cached TextureView. The TextureView object needs a strong reference to it's originating Texture when handed to a client and when stored on a command list to keep textures alive. However, this introduces a reference cycle between Texture and TextureView which needs to be broken up if no extra reference is active. To achieve this, RefObject now has an internal reference count allowing to detect if the object is only internally referenced (i.e. just the m_defaultView reference), in which case we can break up the strong reference from TextureView to Texture.
There exists a similar concept for ComObject, where ComObject has it's own reference count and only increments the RefObjects reference by one when created. Once the ComObject goes out of scope, it calls a virtual comFree before decrementing RefObjects refcount. This allows do break up a strong reference once the object goes out of scope from the client API side, but it doesn't allow us to deal with internal references such as the cached texture view.
We should unify the two concepts:
- Remove
ComObject::comFree - Remove
ComObjects separate reference counter and just delegate toRefObject - Improve handling of the internal reference count on
RefObjectto automatically call something likeRefObject::makeInternalandRefObject::makeExternal - Update existing code that makes use of
comFree(CommandQueueas well as cached pipelines/programs)