12 #include <osg/FrameStamp>
27 #define CPU_SIDE_COMPILATION 1
28 #include <../data/shaders/indirect/GeometrySpecification.h>
37 #include <unordered_set>
49 class DtIndirectGeometryRegistrar;
50 class DtInstanceContainer;
51 class DtOsgShaderFilesCache;
52 class DtIndirectCullProgram;
53 class DtCpuCullingHelper;
54 class DtOsgLightPointManager;
55 class DtGlDeleteObjectManager;
56 class DtCoreGlBufferCreator;
57 class DtIndirectClearBufferProgram;
58 class DtIndirectModelInfo;
59 class DtIndirectGlTextureObject;
60 class DtIndirectGlTextureObjectManager;
61 class DtGpuCullingTcsUserData;
62 class DtThreadCameraStreamDataManager;
115 typedef std::set<osg::observer_ptr<const osg::Camera> >
CameraSet;
141 virtual void setRegistrarInvalid(
void);
144 virtual void setDebug(
bool debug);
152 virtual bool updateGpuBuffers(
bool amortizeTextures,
size_t& statsObjectsRemaining);
156 virtual void modelIdsToNumInstancesChanged(
void);
159 virtual void updatePerInstancePerGeomBuffers(
const MapIntToInt& modelIdsToNumInstances,
const osg::Camera* camera);
166 ,
const osg::FrameStamp* frameStamp
171 ,
const osg::Camera* camera
172 ,
bool& outputInstanceBufferChanged);
175 static bool setUpOutputFormatAndBindings();
178 static void unsetUpOutputFormatAndBindings();
184 virtual bool bindGpuOutputInstanceBuffersWithAddressRange(
const osg::Camera* camera)
const;
191 virtual bool bindCommandBufferAndSsbos(
const DtGlBuffer* gpuDofTransformBuffer
195 ,
const osg::Camera* camera);
198 virtual void unbindCommandBufferAndSsbos(
const osg::Camera* camera);
204 virtual void bindGpuOutputInstanceBufferDebug(
const osg::Camera* camera)
const;
208 virtual void unbindGpuOutputInstanceBufferDebug(
const osg::Camera* camera)
const;
213 virtual bool bindIndirectThingsDebug(
const DtGlBuffer* gpuDofTransformBuffer,
const osg::Camera* camera);
216 virtual void unbindIndirectThingsDebug(
const osg::Camera* camera);
220 virtual bool useInstanceCount(
void)
const;
224 virtual int numDrawCommands(
const osg::Camera* camera)
const;
227 virtual void releaseGLObjects(
void);
230 virtual void reloadShaders()
const;
233 virtual bool buffersInitializedForCamera(
const osg::Camera* camera)
const;
236 virtual unsigned int maxNumInstances(
void)
const;
242 virtual const std::vector<InstancesOffsetAndNumOfInstances>& instancesOffsetAndNumInstances(
void)
const;
245 virtual bool readyToUpdateAndGpuBuffersNeedUpdate()
const;
248 virtual bool gpuBuffersNeedUpdate()
const;
251 virtual bool textureUpdateDirty()
const;
254 virtual void setTextureUpdateDirty(
bool flag);
257 virtual bool perGeomInstanceDataDirty()
const;
260 virtual void setPerGeomInstanceDataDirty(
bool flag);
263 virtual bool instancesInvalidatedDirty()
const;
266 virtual void invalidateInstance(
int instanceId,
int offset,
int size);
269 virtual const DtGlBuffer* gpuInputPerGeomInstancesBuffer(
void)
const;
272 virtual const DtGlBuffer* gpuMaterialsBuffer()
const;
275 virtual void fillOutputInstances(std::vector<
DtVector4<int> >& outputInstances,
const osg::Camera* camera)
const;
281 virtual void setName(
const std::string& name);
284 virtual const std::string& name(
void)
const;
288 virtual void updateGpuInputPerGeomInstancesBufferByInvalidating();
293 virtual bool updateMaterialsAndGeometrySpecifications(
size_t& statsObjectsRemaining);
294 virtual void transferMaterialsAndGeometrySpecificationsToGpuBuffers(
size_t uniqueModelsSize);
295 virtual void updateGpuInputPerGeomInstancesBuffer();
296 virtual void updateGpuLightPointBuffers();
300 virtual void clearStateIdCommandCountBuffer();
301 virtual void clearLightSourceIndexOutputBuffer(
unsigned int maxNumLightSources,
DtGpuCullingTcsUserData* userData);
311 double timeBudget,
double& currentTimeSpent,
unsigned int& uploadedMemory);
314 virtual void slot_gpuGeometrySpecificationsBufferTimeBudgetUpdated(
int milliseconds );
317 virtual void updateGpuTexturesBuffer(
bool amortizeTextures);
320 virtual void updateInstancesOffsetAndInstances(
const MapIntToInt& modelIdsToNumInstances);
323 virtual void updateInstancesOffsetAndInstancesBuffer(
void);
326 virtual void updateStateIdToMaxNumCommands(
const MapIntToInt& modelIdsToNumInstances);
329 virtual void updateStateIdToMaxNumCommandsBuffer(
void);
332 virtual void deleteBuffers(
void);
335 virtual void flushSingleCameraSet(
CameraSet& cameraSet);
342 virtual void releaseGlObjectsDecrementUsersAndUnLoadIfNecessary();
348 virtual bool debugCullingActive()
const;
unsigned int myMaxNumInstancesPreCulling
Definition: DtGpuCulling.h:389
Contains the DtCullShaderConfig class declaration.
DtCoreGlBufferCreator & myDtCoreGlBufferCreator
Definition: DtGpuCulling.h:423
bool myPerGeomInstanceDataDirty
Definition: DtGpuCulling.h:357
static const int theGpuOutputInstanceOffsetInPerInstanceDataBufferIndex
Definition: DtGpuCulling.h:429
Manager for DtThreadCameraStreamData Holds them as cameras come in. Deletes them as cameras go out (v...
Definition: DtThreadCameraStreamDataManager.h:86
DtIndirectGeometryRegistrar * myRegistrar
Definition: DtGpuCulling.h:351
DtMaterial class declaration.
DtGlBuffer * myGpuInstancesOffsetAndNumInstancesBuffer
Definition: DtGpuCulling.h:387
const DtInstanceContainer & myInstanceContainer
Definition: DtGpuCulling.h:353
Contains makVrv::DtIndirectInstancesInvalidated class.
DtOsgLightPointManager & myLightPointManager
Definition: DtGpuCulling.h:405
std::vector< InstancesOffsetAndNumOfInstances > myInstancesOffsetAndNumInstances
Definition: DtGpuCulling.h:386
DtSignalConnectionManager myConnections
Definition: DtGpuCulling.h:448
static const int theGpuOutputInstanceBufferDebugIndex
Definition: DtGpuCulling.h:430
DtIndirectClearBufferProgram * myClearBufferProgram
Definition: DtGpuCulling.h:432
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
std::vector< DrawElementsIndirectBindlessCommandNV > myBindlessIndexAndVertexBuffers
the bindless vertex and index buffers
Definition: DtGpuCulling.h:368
creator for DtCoreGlBuffer
Definition: DtCoreGlBuffer.h:66
This manager manages the lifetime of the actual gl texture objects (gl unsigned ints) in the indirect...
Definition: DtIndirectGlTextureObjectManager.h:60
This class is a component of the DtIndirectGeometry It inputs are: -> the instances registered with Dt...
Definition: DtGpuCulling.h:88
int myOffset
Definition: DtGpuCulling.h:108
Indirect geometry can have multiple models and their corresponding ids registered in it...
Definition: DtIndirectGeometryRegistrar.h:111
voidpf void uLong size
Definition: ioapi.h:39
Contains makVrv::DtFirstTextureStreamedModelAndIndexTracker class.
int myOffset
Definition: DtGpuCulling.h:95
DtGlBuffer * myGpuStateIdToMaxNumCommandsBuffer
Definition: DtGpuCulling.h:398
DtGlDeleteObjectManager & myGlDeleteObjectManager
Definition: DtGpuCulling.h:436
std::vector< StateIdOffsetAndMaxCommands > VectorStateIdOffsetAndMaxCommands
Definition: DtGpuCulling.h:112
Contains the DtGpuCullingTcsUserData class declaration.
bool operator==(const InstancesOffsetAndNumOfInstances &rhs) const
Definition: DtGpuCulling.h:98
DtGlBuffer * myBindlessIndexAndVertexBuffersBuffer
The gpu buffer holding the same above info.
Definition: DtGpuCulling.h:371
VectorInts myGeomSpecIndexToCommandIndex
Definition: DtGpuCulling.h:402
DtIndirectInstancesInvalidated myInstancesInvalidated
Definition: DtGpuCulling.h:358
shader configuration storage class. Has 3 available options which are described in the constructor's ...
Definition: DtCullShaderConfig.h:21
DtModelIdAndStreamedBytesTracker mySpecBufferTracker
Definition: DtGpuCulling.h:416
DtOsgLightPointManager registers LightPoint nodes so their TBO can be created and updated in a single...
Definition: DtOsgLightPointManager.h:128
std::map< int, int > MapIntToInt
Definition: DtCommonTypes.h:25
DtGlBuffer * myGpuInputPerGeomInstancesBuffer
contains switch states/ lod info
Definition: DtGpuCulling.h:356
DtFirstTextureStreamedModelAndIndexTracker myFirstTextureStreamedModelAndIndexTracker
Keep track of the first model and what index to start using bindless textures.
Definition: DtGpuCulling.h:411
This represents per camera (tcs) specific data for DtGpuCulling.
Definition: DtGpuCullingTcsUserData.h:23
DtThreadCameraStreamDataManager & myTcsDataManager
Definition: DtGpuCulling.h:444
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:23
Contains the DtIndirectEffectTexturesTemplate class declaration.
double myPerGeomTimeBufferUpdaterTimeBudget
Default is 1ms, used in updateGpuGeometrySpecificationsBuffer.
Definition: DtGpuCulling.h:450
DtGlBuffer * myGpuSpecIndexToCommandIndexBuffer
Definition: DtGpuCulling.h:403
DtIndirectEffectTexturesTemplate myCurrentEffectTextureState
Definition: DtGpuCulling.h:424
holds a set of the instances that need to be invalidated in the instance buffers
Definition: DtIndirectInstancesInvalidated.h:20
Definition: DtModelIdAndStreamedBytesTracker.h:18
unsigned int myLastNumUniqueGeometriesForGpuTextures
Definition: DtGpuCulling.h:413
unsigned int myMaxNumInstances
Definition: DtGpuCulling.h:390
unsigned int myLastNumEffectTextures
Definition: DtGpuCulling.h:412
std::vector< int > VectorInts
Definition: DtCommonTypes.h:20
handles the running of the compute shader pass for indirect culling, LODing and switches ...
Definition: DtIndirectCullProgram.h:54
DtGpuCullingTcsUserDataCreator & myUserDataCreator
Definition: DtGpuCulling.h:446
DtGlBuffer * myGpuMaterialsBuffer
The spec buffer containing Materials for all the models/lods of the passed in instances.
Definition: DtGpuCulling.h:375
static std::thread::id theMainThreadId
Definition: DtGpuCulling.h:442
Contains makVrv::DtIndirectModelSubGeometry class.
structure for holding an offset of an instance type (model id), and number of those instances ...
Definition: DtGpuCulling.h:93
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
DtIndirectCullProgram * myCullProgram
Definition: DtGpuCulling.h:382
unsigned int myMaxNumLightSources
Definition: DtGpuCulling.h:392
A generic OpenGL buffer. This can be: -> a vertex buffer -> an index buffer -> a shader storage buffe...
Definition: DtGlBuffer.h:29
int myNumOfInstances
Definition: DtGpuCulling.h:96
DtGlBuffer * myGpuStateIdToCommandCountBuffer
Definition: DtGpuCulling.h:399
const DtCullShaderConfig myCullShaderConfig
Definition: DtGpuCulling.h:384
DtVirtualBaseClassCreator< DtGpuCulling, DtInstanceContainer &, const DtCullShaderConfig & > DtGpuCullingCreator
creator
Definition: DtGpuCulling.h:65
The class that is used to communicate the camera viewing parameters to the DtICullingAndLOD interface...
Definition: DtIndirectViewParameters.h:26
Base class to provide boost signal/slot management.
std::vector< DtGeometrySpecification > myGeometrySpecifications
c++ buffer that holds the same info
Definition: DtGpuCulling.h:361
int myNumGeometries
Definition: DtGpuCulling.h:419
std::string myName
Definition: DtGpuCulling.h:426
DtGlBuffer * myGpuGeometrySpecificationsBuffer
The spec buffer containing GeometrySpecifications for all the models/lods of the passed in instances...
Definition: DtGpuCulling.h:365
DtIndirectMaterialVector myMaterials
c++ buffer that holds the same info
Definition: DtGpuCulling.h:378
Vaos are OpenGL context specific. They need to be deleted in the context they are created in...
Definition: DtGlDeleteObjectManager.h:58
friend DtGpuCullingCreator
Definition: DtGpuCulling.h:119
std::unordered_set< DtIndirectModelInfo * > myModelsBeingUsed
Definition: DtGpuCulling.h:434
This class clears buffers using compute shader Theoretically, there are performance gains to be achie...
Definition: DtIndirectClearBufferProgram.h:33
DtGlBuffer * myGpuTexturesBuffer
Definition: DtGpuCulling.h:380
bool myTextureUpdateDirty
Definition: DtGpuCulling.h:414
Contains DLL export macros.
DtDe & myDe
Definition: DtGpuCulling.h:407
DtIndirectGlTextureObjectManager & myIndirectGlTextureObjectManager
Definition: DtGpuCulling.h:440
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
Helper class to manage instances This class allows you to add a DtInstance_64 Internally, however it stores this as a DtInstance (which the GPU can directly read)
Definition: DtInstanceContainer.h:31
static const int theGpuOutputInstanceBufferIndex
Definition: DtGpuCulling.h:428
int myStreamedGeometryOffsetIdx
Definition: DtGpuCulling.h:418
Definition: DtFirstTextureStreamedModelAndIndexTracker.h:16
CameraSet myModelIdsToNumInstancesChanged
Definition: DtGpuCulling.h:421
std::set< osg::observer_ptr< const osg::Camera > > CameraSet
Definition: DtGpuCulling.h:115
voidpf uLong offset
Definition: ioapi.h:42
std::unordered_set< DtIndirectGlTextureObject * > myIndirectTexturesBeingUsed
Definition: DtGpuCulling.h:438
Contains makVrv::DtIndirectViewParameters class.
bool myRegistrarValid
Definition: DtGpuCulling.h:352
Class that allows you to abstractly register effect texture types the effect texture types are client...
Definition: DtIndirectEffectTexturesTemplate.h:40
VectorStateIdOffsetAndMaxCommands myStateIdToMaxNumCommands
Definition: DtGpuCulling.h:395
Contains the per Model info which the indirect module needs These objects are owned by the Indirect g...
Definition: DtIndirectModelInfo.h:67
std::vector< Material > DtIndirectMaterialVector
Each model type can have a number of geometries, each with an own material.
Definition: DtMaterial.h:46
int myMaxCommands
Definition: DtGpuCulling.h:109
Contains makVrv::DtModelIdAndStreamedBytesTracker class.
const char * creatorTypeName< DtGpuCulling >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtGpuCulling.h:72
structure for holding an offset of a command of a given type (state id) and the number of commands of...
Definition: DtGpuCulling.h:106