VR-Forces 5.0.1 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 
81  virtual void flush(const osg::GraphicsContext* gc);
82 
84  virtual void flushInvalidGcs(void);
85 
86  virtual void slot_displayToBeDestroyed(const std::string& displayName, DtDe *de);
87 
89  virtual void clearData();
90 
92  virtual void windowDestroyAddTextureIdToDelete(unsigned int textureObject);
93 
95  virtual void windowDestroyAddTextureIdToKeep(unsigned int textureObject);
96 
101  virtual void windowDestroyFlushTextureIdsToDelete(const osg::GraphicsContext* gContext);
102 
103  protected:
104 
107 
109  static void registerInstance(DtGlDeleteObjectManager* mgr, DtDe& de);
110 
112  static DtGlDeleteObjectManager* findInstance(DtDe& de);
113 
114  virtual void flushTexturesArray(std::vector< unsigned int >* texArr, const osg::GraphicsContext* gc);
115 
116  virtual void deleteBuffers(void);
117  virtual void deleteTextures(const osg::GraphicsContext* gc);
118  virtual void deleteVAOs(const osg::GraphicsContext* gc);
119  virtual void deleteFBOs(const osg::GraphicsContext* gc);
120 
121  virtual void flushVAOsForInvalidGcs(void);
122  virtual void flushFBOsForInvalidGcs(void);
123 
126 
129 
132 
135 
138 
140 
142 
143  std::set<unsigned int> myWindowDestroyTextures;
144  std::set<unsigned int> myWindowKeepTextures;
145  };
146 
149  class DT_DLL_VRVOSG DtGlDeleteObjectJob : public osg::Operation
150  {
151  public:
154 
156  virtual void operator () (osg::Object * sv);
157 
158  protected:
159 
162  };
163 
164 
165 } // 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:161
DtDe & myDe
Definition: DtGlDeleteObjectManager.h:139
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:143
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:128
std::set< unsigned int > myWindowKeepTextures
Definition: DtGlDeleteObjectManager.h:144
DtSignalConnectionManager myConnections
Any signals to process.
Definition: DtGlDeleteObjectManager.h:137
DtLockedBufferedQueue< unsigned int > myGlBufferToDeleteList
list of handle to delete
Definition: DtGlDeleteObjectManager.h:125
MapContextsToFBOArray myGraphicsContextToFBOArray
For keeping vertex array object id&#39;s per context.
Definition: DtGlDeleteObjectManager.h:134
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:141
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:131
Job to delete the queued GLBuffer on each frame.
Definition: DtGlDeleteObjectManager.h:149

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)