![]() |
VR-Forces 5.0.1 Developer's Guide
|
This manager manages the lifetime of the actual gl texture objects (gl unsigned ints) in the indirect rendering module. The old way managed them via osg::Texture::TextureObject, with different parts of texture loading/streaming/deletion in osg::Texture, osg::Texture2D makVrv::DtLoadImageOnDemandCallback2D, makVrv::DtOsgFileCache, etc. This made it difficult to track down/fix bugs because the texture objects were being modified/re-modified at different places in different classes. Also, osg uses texture name reuse via a needlessly complicated scheme which has no performance benefit at all and adds complication. Furthermore, the set of texture objects that are bindless/indirect on vrv side are mutually exclusive to those made in osg/osgEarth (e.g. tiles). So, there is really know reason to create/hold them on the osg side. Therefore, just create/manage them directly using this manager. This also makes adding more sophisticated texture memory management schemes like lru/sparse textures/virtual texturing/etc in the future much easier. To this end, now, osg::Image is primarily just used for image loading and osg::Texture is basically used as a dummy container for that image and also to retain our existing effect texture installers, etc. It seems conceivable though that this use of osg::Texture can also be removed in future.

Public Member Functions | |
| virtual | ~DtIndirectGlTextureObjectManager () |
| DtIndirectGlTextureObjectManager ()=delete | |
| DtIndirectGlTextureObjectManager & | operator= (const DtIndirectGlTextureObjectManager &rhs)=delete |
| DtIndirectGlTextureObjectManager (const DtIndirectGlTextureObjectManager &rhs)=delete | |
| virtual DtIndirectGlTextureObject * | getOrCreate (osg::ref_ptr< osg::Texture > osgTexture, bool &imageBeingProcessed, const DtIndirectLimitTextureStrategy &indirectLimitTextureStrategy, int flags) |
| virtual DtIndirectGlTextureObject * | get (osg::ref_ptr< osg::Texture > osgTexture) |
| virtual bool | removeEntry (unsigned int textureId) |
| virtual unsigned int | outOfMemoryTextureId (void) const |
| virtual DtVector2< int > | seenImageSize (const std::string &imageFileAbsolutePath) const |
| virtual void | addImguiTextureUI (unsigned int contextID) |
Public Member Functions inherited from makVrv::DtVirtualBaseClass | |
| DtVirtualBaseClass () | |
| virtual | ~DtVirtualBaseClass () |
Static Public Member Functions | |
| static DtIndirectGlTextureObjectManager & | instance (DtDe &de) |
Protected Member Functions | |
| DtIndirectGlTextureObjectManager (DtDe &de) | |
| virtual unsigned int | createCompressedGlTexture2d (osg::ref_ptr< osg::Texture > osgTexture, osg::ref_ptr< osg::Image > osgImage, const DtIndirectLimitTextureStrategy &indirectLimitTextureStrategy, bool regularPath, bool &aboveCutoff) const |
| virtual unsigned int | createUnCompressedGlTexture2d (osg::ref_ptr< osg::Texture > osgTexture, osg::ref_ptr< osg::Image > osgImage, const DtIndirectLimitTextureStrategy &indirectLimitTextureStrategy) const |
| virtual unsigned int | createGlTexture2dArray (osg::ref_ptr< osg::Texture > osgTexture) const |
| virtual void | setupWrapFilteringAndAniso (unsigned int textureId, osg::ref_ptr< osg::Texture > osgTexture) const |
| virtual bool | textureWillPutMemoryAboveCutoff (int sizeOfTextureInBytes) const |
| virtual bool | textureMatches (unsigned int textureId, const osg::ref_ptr< osg::Texture > &osgTexture) const |
| virtual DtIndirectGlTextureObject * | findMatchingTextureAndUpdateReference (const osg::ref_ptr< osg::Texture > &osgTexture) |
Static Protected Member Functions | |
| static void | registerInstance (DtIndirectGlTextureObjectManager *manager, DtDe &de) |
| static DtIndirectGlTextureObjectManager * | findInstance (DtDe &de) |
Protected Attributes | |
| DtDe & | myDe |
| DtSignalConnectionManager | myConnections |
| std::map< osg::ref_ptr< const osg::Texture > , DtIndirectGlTextureObject * > | myOsgTextureToIndirectGlTexture |
| std::map< unsigned int, DtIndirectGlTextureObject * > | myIdToGlTextures |
| boost::mutex | myMutex |
| DtMeifConverter * | myImageCompressor |
| int | myOutOfMemoryTextureId |
| DtIndirectDefaultTexturesContainer & | myDefaultTexturesContainer |
| std::unordered_map < std::string, DtVector2< int > > | mySeenImages |
| DtIndirectLimitTextureStrategy * | myNoLimitStrategy |
Static Protected Attributes | |
| static const std::string | theClassName |
|
virtual |
destructor
|
delete |
not allowed
|
delete |
not allowed
|
protected |
cannot create directly
|
static |
Access the singleton instance.
|
delete |
not allowed
|
virtual |
get or create a texture keyed on the given osg texture If not present, will make a texture. Will use the osg Texture's image to fill its mip maps If present, will return the texture
| imageBeingProcessed | indicates whether image is being processed (hence will return a null ptr) |
| textureResolutionLimit | only mip maps at or below this res will be loaded if (-1,-1), there will be no-limits imposed |
|
virtual |
same as above, but will not create, if not present. will return 0 in this case
|
virtual |
Remove a tracked entry. The texture objects are in the indirect module and made resident/non-resident via the residency managers of the texture processors (of the gt/gs) registrars When, the ref count of these bindless textures goes finally down to zero, The textures are deleted via DtGlDeleteObjectManager. Therefore, the cache must be informed that its entry is invalid.
|
virtual |
texture id of the texture used when we are out of memory
|
virtual |
get the size of the image that's been seen so far useful to track all images seen, because images can be nulled out after processing and deleted by the ref counting of the caching in DtOsgFileCache
|
virtual |
adds imgui to current stat UI
|
staticprotected |
register the manager
|
staticprotected |
register if the manager is registered
|
protectedvirtual |
create compressed 2d image. this is the path used majority of the time
|
protectedvirtual |
create compressed 2d image. (e.g. sfx pods)
|
protectedvirtual |
create compressed 2d image. (sfx textures are sometimes 2d arrays)
|
protectedvirtual |
set up texture parameters into texture id from the osg texture
|
protectedvirtual |
whether making this texture will put the used memory above cutoff
|
protectedvirtual |
if the texture id has the same parameters, etc as what the osg texture wants
|
protectedvirtual |
attempts to find a matching texture id for osg texture and update references for that DtIndirectGlTextureObject which contains that gl texture
|
protected |
|
protected |
|
protected |
of osg texture to the indirect gl texture object
|
protected |
another map for fast look up
|
protected |
|
protected |
|
protected |
|
protected |
cache to avoid repeated look ups via DtIndirectDefaultTexturesContainer::instance(myDe)
|
staticprotected |
|
protected |
|
protected |