![]() |
VR-Forces Developer's Guide
|
This class is used to track buffers' memory as they are created/deleted.
This class is also used to track when buffer handles are made resident/non-resident
The DtGlBuffer takes an abstract DtGlBufferListener that, if set, the buffer, will call DtGlBufferListener::bufferSizeChanged, DtGlBufferListener::bufferResidencyChanging and DtGlBufferListener::bufferDeleted when it resizes/handle residency changes/deleted
This class, since it implements DtGlBufferListener abstract class, will update the memory characteristics (DtBufferTypeProperties) for the buffers it is tracking.
Currently, in vrv, all DtGlBuffers are of type DtCoreGlBuffer (which in turn inherits from DtGlBuffer) DtCoreGlBuffers are created using DtCoreGlBufferCreator. In the DtCoreGlBufferCreator::create, just before it returns the buffer, we set an instance of this class as a listener.
Currently, we want to track all the buffers created on the vrv side, so in the creator we set the same instance of this class as the listener on those buffers. So in this sense this tracker is a singleton for the run of the vrv.
The class, since its updating the buffer numbers/types via the signals called from the buffers can be queried at any time using these functions: DtGlBufferMemoryTracker::properties -> all buffers
Currently, we have hooked up visualizing these properties to Imgui via F4. See DtImGuiLoaderStatsData::updateGpuStats
****Note**** If you wish to track multiple subsets of buffers you can create specific instances of this class for those buffers. Note however though, that a DtGlBuffer (for speed reasons) can have only one listener on it. So this organization into subsets is something that the client must externally do.
Public Member Functions | |
| DtGlBufferMemoryTracker () | |
| virtual | ~DtGlBufferMemoryTracker () |
| DtGlBufferMemoryTracker (const DtGlBufferMemoryTracker &)=delete | |
| DtGlBufferMemoryTracker & | operator= (const DtGlBufferMemoryTracker &)=delete |
| virtual void | bufferSizeChanged (unsigned int bufferId) override |
| virtual void | bufferDeleted (unsigned int bufferId) override |
| virtual const DtBufferTypeProperties & | properties (void) const |
| virtual const std::unordered_map< unsigned int, int > & | buffers (void) const |
| virtual std::string | bufferName (unsigned int id) const |
Protected Member Functions | |
| virtual void | printProperties () |
Protected Attributes | |
| DtBufferTypeProperties | myBufferProperties |
| std::unordered_map< unsigned int, int > | myTrackedBuffers |
| makVrv::DtGlBufferMemoryTracker::DtGlBufferMemoryTracker | ( | ) |
constructor
|
virtual |
destructor
|
delete |
not allowed
|
delete |
not allowed
|
overridevirtual |
signaled when buffer size changed
Implements makVrv::DtGlBufferListener.
|
overridevirtual |
buffer being deleted
Implements makVrv::DtGlBufferListener.
|
virtual |
accessor for all buffers
|
virtual |
access
get the name of the buffer
|
protectedvirtual |
internal
|
protected |
properties of the buffers being tracked