VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtIndirectTextureResidencyManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2022 VT-MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 #include <vrvOsg/vrvOsg.h>
12 
14 
16 
18 
19 #include <osg/Texture>
20 
21 #include <set>
22 #include <unordered_map>
23 
24 namespace osg
25 {
26  class GraphicsContext;
27  class State;
28  class RenderInfo;
29 }
30 
31 namespace makVrv
32 {
33  class DtWindow;
34 
35  class DtIndirectGlTextureResidencyManager;
36 
37  // forward declare for the creator below
38  class DtIndirectTextureResidencyManager;
39 
41 
43 
44  template <>
45  inline const char* creatorTypeName<DtIndirectTextureResidencyManager>(void) { return "DtIndirectTextureResidencyManagerCreator"; }
46 
51  {
52  public:
55 
57  protected:
58  // only creator cdan create
60  private:
67  public:
68 
71  virtual bool inTextureToGCMap(const osg::GraphicsContext* graphicsContext, unsigned int textureObject) const;
72 
74  virtual bool addTextureToGCMapIfNecessary(const osg::GraphicsContext* graphicsContext, unsigned int textureObject) const;
75 
77  virtual void makeTexturesResidentIfNeeded(const osg::GraphicsContext* graphicsContext) const;
78 
80  virtual void releaseGLObjects(osg::State* state) const;
81 
86  virtual void releaseGLObjects(const std::set< unsigned int>& textureObjectSetToUnload) const;
87 
89  virtual void slot_windowToBeDestroyed(DtWindow* window);
90 
92  virtual bool isInAnotherContext(unsigned int textureId, const osg::GraphicsContext* graphicsContext) const;
93 
94  protected:
96  virtual void addTextureToGCMap(const osg::GraphicsContext* graphicsContext, unsigned int textureObject) const;
97 
99  virtual void collectNewTexturesAcrosssNonSharedContextIds(const osg::GraphicsContext* graphicsContext, unsigned int textureObject) const;
100 
102  virtual void makeNewTexturesAcrosssNonSharedContextIdsResident(const osg::GraphicsContext* graphicsContext) const;
103 
104  protected:
105 
106  typedef std::set<unsigned int> SetNonSharedContextIds;
107  typedef std::map<unsigned int, SetNonSharedContextIds> MapContextIdsToNonSharedContextIds;
110 
111  // Set since each object should have 1 copy of each texture
112  typedef std::set<unsigned int> TexturesSet;
113 
114  typedef std::unordered_map<const osg::GraphicsContext*, TexturesSet> MapContextIdsToTexturesSet;
117 
120 
123 
126 
129 
131 
133  };
134 }
TexturesSet myMutableAllSeenTextures
Texture ids for all textures that we have seen so far in all contexts.
Definition: DtIndirectTextureResidencyManager.h:122
Abstract Base class.
Definition: DtWindow.h:25
DtSignalConnectionManager myConnections
for handling window destroyed event
Definition: DtIndirectTextureResidencyManager.h:128
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Manager class that handles texture objects and texture residency, as contexts get created and destroy...
Definition: DtIndirectTextureResidencyManager.h:50
OpenThreads::Mutex myMutableTextureResidencyMutex
Definition: DtIndirectTextureResidencyManager.h:109
DtDe & myDe
Definition: DtIndirectTextureResidencyManager.h:132
DtGlDeleteObjectManager & myGlDeleteObjectManager
hold an instance to the delete manager
Definition: DtIndirectTextureResidencyManager.h:125
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
DtVirtualBaseClassCreator< DtIndirectTextureResidencyManager > DtIndirectTextureResidencyManagerCreator
Definition: DtIndirectTextureResidencyManager.h:40
std::map< unsigned int, SetNonSharedContextIds > MapContextIdsToNonSharedContextIds
Definition: DtIndirectTextureResidencyManager.h:107
MapContextIdsToTexturesSet myMutableMapGraphicsContextToTexturesSet
Which textures have we seen in what contexts.
Definition: DtIndirectTextureResidencyManager.h:119
MapContextIdsToTexturesSet myMutableMapNonSharedContextIdsToNewTexturesSet
The next textures that have been seen in this context.
Definition: DtIndirectTextureResidencyManager.h:116
std::set< unsigned int > TexturesSet
Definition: DtIndirectTextureResidencyManager.h:112
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
std::unordered_map< const osg::GraphicsContext *, TexturesSet > MapContextIdsToTexturesSet
Definition: DtIndirectTextureResidencyManager.h:114
OpenThreads::Mutex Mutex
Definition: DtOsgThreadingUtils.h:12
const char * creatorTypeName< DtIndirectTextureResidencyManager >(void)
Definition: DtIndirectTextureResidencyManager.h:45
std::set< unsigned int > SetNonSharedContextIds
Definition: DtIndirectTextureResidencyManager.h:106
Base class to provide boost signal/slot management.
Manager to delete GLBuffer in the main thread.
Definition: DtGlDeleteObjectManager.h:44
Contains DLL export macros.
friend DtIndirectTextureResidencyManagerCreator
only creator can create
Definition: DtIndirectTextureResidencyManager.h:54
Enforces a single DtGlTextureResidencyManager across the whole indirect system/vrv (since the DtGlTex...
Definition: DtIndirectGlTextureResidencyManager.h:24
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:70
MapContextIdsToNonSharedContextIds myMutableMapContextIdsToNonSharedContextIds
Definition: DtIndirectTextureResidencyManager.h:108
DtIndirectGlTextureResidencyManager & myGlTextureResidencyManager
Definition: DtIndirectTextureResidencyManager.h:130

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)