VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtGlDeleteObjectManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright(c) 2022 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 #pragma once
10 #include <vrvOsg/vrvOsg.h>
11 
12 #include <vrvOsg/DtGlVaoManager.h>
13 
17 
18 #include <OpenThreads/Thread>
19 #include <OpenThreads/Block>
20 
21 #include <osg/OperationThread>
22 #include <osg/Texture>
23 #include <osg/observer_ptr>
24 #include <osg/GraphicsContext>
25 
26 #include <tuple>
27 
28 namespace osg
29 {
30  class GraphicsContext;
31 }
32 
33 namespace makVrv
34 {
35  class DtDe;
36 
38 
39  typedef std::tuple<unsigned int, void*> DtGlVaoAndContext;
40  typedef std::tuple<unsigned int, void*> DtGlFboAndContext;
41 
45  {
46  public:
48  // pointer to make VC10 happy
49  typedef std::map< osg::observer_ptr<const osg::GraphicsContext>, TexturesArray* > MapGCToTexArray;
50 
52  // pointer to make VC10 happy
53  typedef std::map< osg::observer_ptr<const osg::GraphicsContext >, VAOArray*> MapContextsToVAOArray;
54 
56  // pointer to make VC10 happy
57  typedef std::map< osg::observer_ptr<const osg::GraphicsContext >, FBOArray*> MapContextsToFBOArray;
58 
59 
61  static DtGlDeleteObjectManager& instance(DtDe& de);
62 
64  virtual ~DtGlDeleteObjectManager();
65 
67  virtual void addHandleToDelete(unsigned int handle);
68 
70  virtual void addTextureIdToDelete(const osg::GraphicsContext* gContext, unsigned int textureObject);
71 
73  virtual void addVertexArrayObjectToDelete(const osg::GraphicsContext* gContext, const DtGlVaoAndContext& vao);
74 
76  virtual void addFrameBufferObjectToDelete(const osg::GraphicsContext* gContext, const DtGlFboAndContext& fbo);
77 
78  virtual void addFrameBufferObjectToDelete(osg::observer_ptr<const osg::GraphicsContext>& gContext, const DtGlFboAndContext& fbo);
79 
84  virtual void flush(const osg::GraphicsContext* gc, bool allowTextureDelete = true);
85 
87  virtual void flushInvalidGcs(void);
88 
89  virtual void slot_displayToBeDestroyed(const std::string& displayName, DtDe *de);
90 
92  virtual void clearData();
93 
95  virtual void windowDestroyAddTextureIdToDelete(unsigned int textureObject);
96 
98  virtual void windowDestroyAddTextureIdToKeep(unsigned int textureObject);
99 
104  virtual void windowDestroyFlushTextureIdsToDelete(const osg::GraphicsContext* gContext);
105 
106  protected:
107 
110 
112  static void registerInstance(DtGlDeleteObjectManager* mgr, DtDe& de);
113 
115  static DtGlDeleteObjectManager* findInstance(DtDe& de);
116 
120  virtual void flushTexturesArray(std::vector< unsigned int >* texArr,
121  const osg::GraphicsContext* gc, bool allowTextureDelete);
122 
123  virtual void deleteBuffers(void);
124 
128  virtual void deleteTextures(const osg::GraphicsContext* gc, bool allowTextureDelete);
129 
130  virtual void deleteVAOs(const osg::GraphicsContext* gc);
131  virtual void deleteFBOs(const osg::GraphicsContext* gc);
132 
133  virtual void flushVAOsForInvalidGcs(void);
134  virtual void flushFBOsForInvalidGcs(void);
135 
138 
141 
144 
147 
150 
152 
154 
155  std::set<unsigned int> myWindowDestroyTextures;
156  std::set<unsigned int> myWindowKeepTextures;
157  };
158 
161  class DT_DLL_VRVOSG DtGlDeleteObjectJob : public osg::Operation
162  {
163  public:
166 
168  virtual void operator () (osg::Object * sv);
169 
170  protected:
171 
174  };
175 
176 
177 } // namespace makVrv
DtLockedBufferedQueue< unsigned int > TexturesArray
Definition: DtGlDeleteObjectManager.h:47
DtLockedBufferedQueue< DtGlVaoAndContext > VAOArray
Definition: DtGlDeleteObjectManager.h:51
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
DtGlDeleteObjectManager & myGlDeleteObjectManager
Reference to the DtGlDeleteObjectManager.
Definition: DtGlDeleteObjectManager.h:173
DtDe & myDe
Definition: DtGlDeleteObjectManager.h:151
std::map< osg::observer_ptr< const osg::GraphicsContext >, VAOArray * > MapContextsToVAOArray
Definition: DtGlDeleteObjectManager.h:53
std::map< osg::observer_ptr< const osg::GraphicsContext >, FBOArray * > MapContextsToFBOArray
Definition: DtGlDeleteObjectManager.h:57
Contains makVrv::DtLockedBufferedQueue class.
std::tuple< unsigned int, void * > DtGlVaoAndContext
Definition: DtGlDeleteObjectManager.h:37
DtLockedBufferedQueue< DtGlFboAndContext > FBOArray
Definition: DtGlDeleteObjectManager.h:55
std::set< unsigned int > myWindowDestroyTextures
Definition: DtGlDeleteObjectManager.h:155
std::map< osg::observer_ptr< const osg::GraphicsContext >, TexturesArray * > MapGCToTexArray
Definition: DtGlDeleteObjectManager.h:49
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
Contains the DtGlBuffer class declaration.
MapGCToTexArray myGraphicsContextToTexturesArray
For keeping texture id&#39;s per context.
Definition: DtGlDeleteObjectManager.h:140
std::set< unsigned int > myWindowKeepTextures
Definition: DtGlDeleteObjectManager.h:156
DtSignalConnectionManager myConnections
Any signals to process.
Definition: DtGlDeleteObjectManager.h:149
DtLockedBufferedQueue< unsigned int > myGlBufferToDeleteList
list of handle to delete
Definition: DtGlDeleteObjectManager.h:137
MapContextsToFBOArray myGraphicsContextToFBOArray
For keeping vertex array object id&#39;s per context.
Definition: DtGlDeleteObjectManager.h:146
std::tuple< unsigned int, void * > DtGlFboAndContext
Definition: DtGlRenderToTexture.h:30
Base class to provide boost signal/slot management.
Manager to delete GLBuffer in the main thread.
Definition: DtGlDeleteObjectManager.h:44
DtIndirectGlTextureResidencyManager & myGlTextureResidencyManager
Definition: DtGlDeleteObjectManager.h:153
Contains DLL export macros.
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
Contains the DtGlVaoManager class declaration.
MapContextsToVAOArray myGraphicsContextToVAOArray
For keeping vertex array object id&#39;s per context.
Definition: DtGlDeleteObjectManager.h:143
Job to delete the queued GLBuffer on each frame.
Definition: DtGlDeleteObjectManager.h:161

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)