VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes
makVrv::DtIndirectGlTextureObjectManager Class Reference

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.

Inheritance diagram for makVrv::DtIndirectGlTextureObjectManager:
Inheritance graph
[legend]

Public Member Functions

virtual ~DtIndirectGlTextureObjectManager ()
 
 DtIndirectGlTextureObjectManager ()=delete
 
DtIndirectGlTextureObjectManageroperator= (const DtIndirectGlTextureObjectManager &rhs)=delete
 
 DtIndirectGlTextureObjectManager (const DtIndirectGlTextureObjectManager &rhs)=delete
 
virtual DtIndirectGlTextureObjectgetOrCreate (osg::ref_ptr< osg::Texture > osgTexture, bool &imageBeingProcessed, const DtIndirectLimitTextureStrategy &indirectLimitTextureStrategy, int flags)
 
virtual DtIndirectGlTextureObjectget (osg::ref_ptr< osg::Texture > osgTexture)
 
virtual bool removeEntry (unsigned int textureId)
 
virtual unsigned int outOfMemoryTextureId (void) const
 
virtual DtVector2< intseenImageSize (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 DtIndirectGlTextureObjectfindMatchingTextureAndUpdateReference (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

DtDemyDe
 
DtSignalConnectionManager myConnections
 
std::map< osg::ref_ptr< const
osg::Texture >
, DtIndirectGlTextureObject * > 
myOsgTextureToIndirectGlTexture
 
std::map< unsigned int,
DtIndirectGlTextureObject * > 
myIdToGlTextures
 
boost::mutex myMutex
 
DtMeifConvertermyImageCompressor
 
int myOutOfMemoryTextureId
 
DtIndirectDefaultTexturesContainermyDefaultTexturesContainer
 
std::unordered_map
< std::string, DtVector2< int > > 
mySeenImages
 
DtIndirectLimitTextureStrategymyNoLimitStrategy
 

Static Protected Attributes

static const std::string theClassName
 

Constructor & Destructor Documentation

virtual makVrv::DtIndirectGlTextureObjectManager::~DtIndirectGlTextureObjectManager ( )
virtual

destructor

makVrv::DtIndirectGlTextureObjectManager::DtIndirectGlTextureObjectManager ( )
delete

not allowed

makVrv::DtIndirectGlTextureObjectManager::DtIndirectGlTextureObjectManager ( const DtIndirectGlTextureObjectManager rhs)
delete

not allowed

makVrv::DtIndirectGlTextureObjectManager::DtIndirectGlTextureObjectManager ( DtDe de)
protected

cannot create directly

Member Function Documentation

static DtIndirectGlTextureObjectManager& makVrv::DtIndirectGlTextureObjectManager::instance ( DtDe de)
static

Access the singleton instance.

DtIndirectGlTextureObjectManager& makVrv::DtIndirectGlTextureObjectManager::operator= ( const DtIndirectGlTextureObjectManager rhs)
delete

not allowed

virtual DtIndirectGlTextureObject* makVrv::DtIndirectGlTextureObjectManager::getOrCreate ( osg::ref_ptr< osg::Texture >  osgTexture,
bool imageBeingProcessed,
const DtIndirectLimitTextureStrategy indirectLimitTextureStrategy,
int  flags 
)
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

Parameters
imageBeingProcessedindicates whether image is being processed (hence will return a null ptr)
textureResolutionLimitonly mip maps at or below this res will be loaded if (-1,-1), there will be no-limits imposed
virtual DtIndirectGlTextureObject* makVrv::DtIndirectGlTextureObjectManager::get ( osg::ref_ptr< osg::Texture >  osgTexture)
virtual

same as above, but will not create, if not present. will return 0 in this case

virtual bool makVrv::DtIndirectGlTextureObjectManager::removeEntry ( unsigned int  textureId)
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 unsigned int makVrv::DtIndirectGlTextureObjectManager::outOfMemoryTextureId ( void  ) const
virtual

texture id of the texture used when we are out of memory

virtual DtVector2<int> makVrv::DtIndirectGlTextureObjectManager::seenImageSize ( const std::string &  imageFileAbsolutePath) const
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 void makVrv::DtIndirectGlTextureObjectManager::addImguiTextureUI ( unsigned int  contextID)
virtual

adds imgui to current stat UI

static void makVrv::DtIndirectGlTextureObjectManager::registerInstance ( DtIndirectGlTextureObjectManager manager,
DtDe de 
)
staticprotected

register the manager

static DtIndirectGlTextureObjectManager* makVrv::DtIndirectGlTextureObjectManager::findInstance ( DtDe de)
staticprotected

register if the manager is registered

virtual unsigned int makVrv::DtIndirectGlTextureObjectManager::createCompressedGlTexture2d ( osg::ref_ptr< osg::Texture >  osgTexture,
osg::ref_ptr< osg::Image >  osgImage,
const DtIndirectLimitTextureStrategy indirectLimitTextureStrategy,
bool  regularPath,
bool aboveCutoff 
) const
protectedvirtual

create compressed 2d image. this is the path used majority of the time

virtual unsigned int makVrv::DtIndirectGlTextureObjectManager::createUnCompressedGlTexture2d ( osg::ref_ptr< osg::Texture >  osgTexture,
osg::ref_ptr< osg::Image >  osgImage,
const DtIndirectLimitTextureStrategy indirectLimitTextureStrategy 
) const
protectedvirtual

create compressed 2d image. (e.g. sfx pods)

virtual unsigned int makVrv::DtIndirectGlTextureObjectManager::createGlTexture2dArray ( osg::ref_ptr< osg::Texture >  osgTexture) const
protectedvirtual

create compressed 2d image. (sfx textures are sometimes 2d arrays)

virtual void makVrv::DtIndirectGlTextureObjectManager::setupWrapFilteringAndAniso ( unsigned int  textureId,
osg::ref_ptr< osg::Texture >  osgTexture 
) const
protectedvirtual

set up texture parameters into texture id from the osg texture

virtual bool makVrv::DtIndirectGlTextureObjectManager::textureWillPutMemoryAboveCutoff ( int  sizeOfTextureInBytes) const
protectedvirtual

whether making this texture will put the used memory above cutoff

virtual bool makVrv::DtIndirectGlTextureObjectManager::textureMatches ( unsigned int  textureId,
const osg::ref_ptr< osg::Texture > &  osgTexture 
) const
protectedvirtual

if the texture id has the same parameters, etc as what the osg texture wants

virtual DtIndirectGlTextureObject* makVrv::DtIndirectGlTextureObjectManager::findMatchingTextureAndUpdateReference ( const osg::ref_ptr< osg::Texture > &  osgTexture)
protectedvirtual

attempts to find a matching texture id for osg texture and update references for that DtIndirectGlTextureObject which contains that gl texture

Member Data Documentation

DtDe& makVrv::DtIndirectGlTextureObjectManager::myDe
protected
DtSignalConnectionManager makVrv::DtIndirectGlTextureObjectManager::myConnections
protected
std::map<osg::ref_ptr<const osg::Texture>, DtIndirectGlTextureObject*> makVrv::DtIndirectGlTextureObjectManager::myOsgTextureToIndirectGlTexture
protected

of osg texture to the indirect gl texture object

std::map<unsigned int, DtIndirectGlTextureObject*> makVrv::DtIndirectGlTextureObjectManager::myIdToGlTextures
protected

another map for fast look up

boost::mutex makVrv::DtIndirectGlTextureObjectManager::myMutex
protected
DtMeifConverter* makVrv::DtIndirectGlTextureObjectManager::myImageCompressor
protected
int makVrv::DtIndirectGlTextureObjectManager::myOutOfMemoryTextureId
protected
DtIndirectDefaultTexturesContainer& makVrv::DtIndirectGlTextureObjectManager::myDefaultTexturesContainer
protected

cache to avoid repeated look ups via DtIndirectDefaultTexturesContainer::instance(myDe)

const std::string makVrv::DtIndirectGlTextureObjectManager::theClassName
staticprotected
std::unordered_map<std::string, DtVector2<int> > makVrv::DtIndirectGlTextureObjectManager::mySeenImages
protected
DtIndirectLimitTextureStrategy* makVrv::DtIndirectGlTextureObjectManager::myNoLimitStrategy
protected

The documentation for this class was generated from the following file:

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)