VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtGpuArena.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2025 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
15 #include <vrvOsg/DtGpuOperation.h>
16 
17 #include <vrvCore/DtKeyedData.h>
18 
21 
22 #include <osg/StateAttribute>
23 #include <osg/OperationThread>
24 
25 #include <atomic>
26 #include <deque>
27 #include <vector>
28 
29 namespace osg
30 {
31  class StateSet;
32  class Camera;
33  class RenderInfo;
34  class NodeVisitor;
35 }
36 
37 namespace makVrv
38 {
40  class DtGpuArena;
41 
42  class DtGpuArenaUserData;
43  class DtThreadCameraStreamDataManager;
44  class DtIndirectGeometry;
45 
46  class DtOsgToGlContextTracker;
47  class DtIndirectGlTextureObjectManager;
48  class DtGlDeleteObjectManager;
49  class DtSkyObjectManager;
50 
51  class DtDe;
52 
55 
57  template <>
58  inline const char* creatorTypeName<DtGpuArena>(void) { return "DtGpuArenaCreator"; }
59 
60  // This is a top level PreDraw operation set up on the osgViewer.
61  // It allows you to setup/run operations that require a context (e.g. compute, transfer, drawing, etc)
62  class DT_DLL_VRVOSG DtGpuArena : public osg::Operation
63  {
64  public:
66 
68  virtual ~DtGpuArena();
69  protected:
71  DtGpuArena(DtDe& de);
72 
73  private:
75  DtGpuArena() = delete;
77  DtGpuArena& operator=(const DtGpuArena& rhs) = delete;
78 
80  DtGpuArena(const DtGpuArena& rhs) = delete;
81 
82  public:
86  virtual void operator () (osg::Object* obj) override;
87  public:
89  virtual void addOneTimeInitOp(DtIndirectGeometry* indirectGeometry);
90  virtual void addOneTimeInitOpForNextFrame(DtIndirectGeometry* indirectGeometry);
91 
94  virtual void addPersistentOp(DtGpuOperation* op);
95 
98  virtual void removePersistentOp(DtGpuOperation* op);
99 
101  virtual size_t statsBufferUpdatesRemaining() const;
102 
104  virtual size_t statsOneTimeOpsRemaining() const;
105 
106  protected:
108  virtual void update();
109 
113  virtual void slot_timeBudgetUpdated( int milliseconds );
114 
116  virtual void processOneTimeInitOperations();
117 
119  virtual void waitForGpu();
120 
121  protected:
123 
125 
126  const std::string myName;
127 
128  std::vector< osg::observer_ptr<DtIndirectGeometry> > myNextFrameOneTimeInitOps;
129 
131  std::deque< osg::observer_ptr<DtIndirectGeometry> > myOneTimeInitOps;
132 
133  std::list<DtGpuOperation*> myPersistentOperations;
134 
136 
138 
140 
142 
144 
146  double myTimeBudget;
147 
150  std::atomic<size_t> myStatsOneTimeOpsRemaining;
151  };
152 }
std::atomic< size_t > myStatsOneTimeOpsRemaining
Definition: DtGpuArena.h:150
Manager for DtThreadCameraStreamData Holds them as cameras come in. Deletes them as cameras go out (v...
Definition: DtThreadCameraStreamDataManager.h:86
This class tracks gl contexts as they are created/destroyed per window creation/destruction. It is also what clients should hook to via signal_contextAboutToBeDestroyed for context destruction cleanup.
Definition: DtOsgToGlContextTracker.h:28
std::mutex myOneTimeInitOpsMutex
Definition: DtGpuArena.h:130
Encapsulate an operation that needs to happen on the gpu This can be anything (transfer, compute, drawing, etc) It is called from DtGpuArena/DtGpuArenaUserData.
Definition: DtGpuOperation.h:20
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
This manager manages the lifetime of the actual gl texture objects (gl unsigned ints) in the indirect...
Definition: DtIndirectGlTextureObjectManager.h:60
DtThreadCameraStreamDataManager & myTcsDataManager
Definition: DtGpuArena.h:124
Contains the DtGpuArenaUserData class declaration.
DtGpuArenaUserDataCreator & myGpuArenaUserDataCreator
Definition: DtGpuArena.h:143
Contains the DtGpuOperation class declaration.
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:23
size_t myStatsBufferUpdatesRemaining
Definition: DtGpuArena.h:149
std::vector< osg::observer_ptr< DtIndirectGeometry > > myNextFrameOneTimeInitOps
Definition: DtGpuArena.h:128
DtDe & myDe
Definition: DtGpuArena.h:122
\ ::, which allows us to hook into our indirect engine to render using indirect rendering...
Definition: DtIndirectGeometry.h:120
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
DtGlDeleteObjectManager & myGlDeleteObjectManager
Definition: DtGpuArena.h:141
std::deque< osg::observer_ptr< DtIndirectGeometry > > myOneTimeInitOps
Definition: DtGpuArena.h:131
Definition: DtGpuArena.h:62
std::list< DtGpuOperation * > myPersistentOperations
Definition: DtGpuArena.h:133
DtIndirectGlTextureObjectManager & myIndirectGlTextureObjectManager
Definition: DtGpuArena.h:139
Base class to provide boost signal/slot management.
Vaos are OpenGL context specific. They need to be deleted in the context they are created in...
Definition: DtGlDeleteObjectManager.h:58
const char * creatorTypeName< DtGpuArena >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtGpuArena.h:58
DtSignalConnectionManager myConnections
Definition: DtGpuArena.h:135
Contains DLL export macros.
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:76
double myTimeBudget
Default 1ms.
Definition: DtGpuArena.h:146
friend DtGpuArenaCreator
Definition: DtGpuArena.h:65
DtVirtualBaseClassCreator< DtGpuArena > DtGpuArenaCreator
creator
Definition: DtGpuArena.h:51
const std::string myName
Definition: DtGpuArena.h:126
unsigned int myLastUpdateFrameNumber
Definition: DtGpuArena.h:148
DtOsgToGlContextTracker & myOsgToGlContextTracker
Definition: DtGpuArena.h:137
Contains the DtKeyedData class declaration.

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)