VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Friends
makVrv::DtGpuCullingAndLod Class Reference

This class is a component of the DtIndirectGeometry It inputs are: -> the instances registered with DtIndirectGeometry -> the viewing parameters (view matrix, projection matrix, etc) -> the indirect registrar (so that it can generate gpu data for -> the models of the instances from the interim data accessible -> via the registrar It outputs are: -> Tndirect command buffer -> The count of the indirect commands -> The input instances shuffled around/culled/lod'ed reflecting -> their order within the indirect command buffer generated -> It will also (optionally) do culling and lod. More...

Classes

struct  InstancesOffsetAndNumOfInstances
 
struct  StateIdOffsetAndMaxCommands
 

Public Types

typedef std::vector
< StateIdOffsetAndMaxCommands
VectorStateIdOffsetAndMaxCommands
 

Public Member Functions

virtual ~DtGpuCullingAndLod ()
 destructor More...
 
virtual void setRegistrar (DtIndirectGeometryRegistrar *registrar)
 set the registrar More...
 
virtual void setCullShaderConfig (const DtCullShaderConfig &cullShaderConfig)
 set the compute shader config More...
 
virtual const DtCullShaderConfigcullShaderConfig (void) const
 get the compute shader config More...
 
virtual void updateGpuBuffers (DtIndirectRenderingParameters &irParams, const MapIntToInt &modelIdsToNumInstances, osg::RenderInfo &renderInfo)
 updateGpuBuffers More...
 
virtual void doCullingAndLOD (const DtIndirectViewParameters &viewParameters, DtIndirectRenderingParameters &irParams, osg::RenderInfo &renderInfo, DtGlBuffer *gpuLodVisibleBuffer)
 do the culling and the lod More...
 
virtual void bindGpuOutputInstanceBuffer (void) const
 bind the output instance buffer More...
 
virtual void unbindGpuOutputInstanceBuffer (void) const
 unbind the output instance buffer More...
 
virtual bool bindIndirectThings ()
 bind the indirect command buffer and the count buffer returns false if handle is 0. More...
 
virtual void unbindIndirectThings ()
 unbind the indirect command buffer and the count buffer More...
 
virtual bool useInstanceCount (void) const
 whether we are optimizing for shared models (useInstanceCount()=true) or unique models (useInstanceCount()=false), across instances More...
 
virtual int numDrawCommands (void) const
 The number of draw commands generated. More...
 
virtual void setShadersFolderPath (const std::string &shaderFolderPath)
 set up the shader folder path (to enable us to load shaders, de is not accessible here) More...
 
virtual const std::string & shadersFolderPath (void) const
 get the shader folder path More...
 
virtual void setShadersFileCache (DtOsgShaderFilesCache *shaderFilesCache)
 set up the shader file cache (to enable us to load shaders, de is not accessible here) More...
 
virtual const
DtOsgShaderFilesCache
shadersFileCache (void) const
 gets the shader file cache which contains all the shaders used by the culling comput shader More...
 
virtual void releaseGLObjects (osg::State *state) const
 release the GL objects for the GpuCullingAndLod compute shader More...
 
virtual void reloadShaders () const
 destroy the cull program and shader if they exists so they can be recreated next frame. More...
 
virtual unsigned int maxNumInstances (void) const
 get the max number of instances that can possibly be rendered if none are culled out. More...
 
virtual const
VectorStateIdOffsetAndMaxCommands
stateIdOffsetAndMaxCommands (void) const
 get the map of the state id to their offset/number More...
 
virtual void setInstanceContainer (DtInstanceContainer *instanceContainer)
 
virtual bool readyToUpdateBuffers ()
 helper function to decide if a job should be launched More...
 
virtual bool needTextureUpdate () const
 are there textures that still need updating. More...
 

Protected Member Functions

 DtGpuCullingAndLod (DtDe &de)
 constructor More...
 
virtual bool updateGpuTexturesBuffer (osg::RenderInfo &renderInfo)
 The buffer containing the bindless textures' addresses of the model textures returns true if there still work happening. More...
 
virtual void updateInstancesOffsetAndInstances (const MapIntToInt &modelIdsToNumInstances)
 update the myGpuInstancesOffsetAndNumInstances buffer so it is ready to be used More...
 
virtual void updateStateIdMaxNumCommands (const MapIntToInt &modelIdsToNumInstances)
 update the myGpuStateIdToMaxNumCommandsBuffer buffer with the correct max state instances for each state More...
 
virtual bool checkSpecBuffersOk (void) const
 check a few of the buffers to make sure they are not null More...
 
virtual void updateGpuInputInstancesBuffer ()
 update the various buffers that are fed to the cull shader -> if new models came in -> if textures became available (they can be asynchronously available, e.g. More...
 
virtual void updateGpuInputPerGeomInstancesBuffer ()
 
virtual void updateGpuGeometrySpecificationsBuffer (const int numGeometries)
 
virtual void updateGpuMaterialsBuffer (const int numGeometries)
 
virtual void updateGpuGeometryOffsetAndSizeBuffer (int &numGeometries)
 
virtual void updateGpuIndirectBuffer ()
 
virtual void clearInstanceCountofGpuIndirectBuffer ()
 
virtual void clearStateIdCommandCountBuffer ()
 

Protected Attributes

DtIndirectGeometryRegistrarmyRegistrar
 
DtInstanceContainermyInstanceContainer
 
DtGlBuffermyGpuInputInstancesBuffer
 The input instances for the GPU (generated/updated from the passed in instance container) More...
 
DtGlBuffermyGpuInputPerGeomInstancesBuffer
 contains switch states/ lod info More...
 
DtGlBuffermyGpuGeometrySpecificationsBuffer
 The spec buffer containing GeometrySpecifications for all the models/lods of the passed in instances. More...
 
std::vector
< DtGeometrySpecification
myGeometrySpecifications
 c++ buffer that holds the same info More...
 
std::vector
< DtIndirectOffsetAndSize
myGeometryOffsetAndSizes
 An internal indexing buffer that allows the cull shader to go from and intance to its GeometrySpecification in the Geometry Specification Buffer. More...
 
DtGlBuffermyGpuMaterialsBuffer
 The spec buffer containing Materials for all the models/lods of the passed in instances. More...
 
DtGlBuffermyGpuIndirectBuffer
 The indirect command buffer that will be generated. More...
 
DtGlBuffermyGpuOutputInstancesBuffer
 The re-distributed/culled/lod'ed instances (a subset of the input instances) More...
 
DtIndirectCullPassmyCullPass
 
DtGlBuffermyGpuTexturesBuffer
 
MapIntToInt myModelIdToIndex
 
DtCullShaderConfig myCullShaderConfig
 
std::vector
< InstancesOffsetAndNumOfInstances
myInstancesOffsetAndNumInstances
 
DtGlBuffermyGpuInstancesOffsetAndNumInstances
 
std::string myShaderFolderPath
 
DtOsgShaderFilesCachemyShaderFilesCache
 
unsigned int myMaxNumInstances
 
VectorStateIdOffsetAndMaxCommands myStateIdToMaxNumCommands
 
DtGlBuffermyGpuStateIdToMaxNumCommandsBuffer
 
DtGlBuffermyGpuStateIdToCommandCountBuffer
 
VectorInts myGeomSpecIndexToCommandIndex
 
DtGlBuffermyGpuSpecIndexToCommandIndexBuffer
 
DtDemyDe
 
unsigned int myLastNumEffectTextures
 
int myMutableFirstTextureStreamedModel
 Keep track of the first model using bindless textures. More...
 
int myMutableFirstTextureStreamedIndex
 What index to start using bindless textures for a model. More...
 
bool myNeedTextureUpdate
 
int myStreamedMaterialModelID
 
int myStreamedMaterialBytes
 
int myStreamedSpecModelID
 
int myStreamedSpecBytes
 
int myStreamedSpecModelGeomIndex
 
int myStreamedGeometryOffsetModelID
 
int myNumGeometries
 

Private Member Functions

 DtGpuCullingAndLod ()
 default constructor More...
 
 DtGpuCullingAndLod (const DtGpuCullingAndLod &other)
 Copy Constructor not implemented – Copy Not Allowed. More...
 
DtGpuCullingAndLodoperator= (const DtGpuCullingAndLod &other)
 Assignment Operator Not implemented – Assignment Not Allowed. More...
 

Friends

class DtGpuCullingAndLodCreator
 

Detailed Description

This class is a component of the DtIndirectGeometry It inputs are: -> the instances registered with DtIndirectGeometry -> the viewing parameters (view matrix, projection matrix, etc) -> the indirect registrar (so that it can generate gpu data for -> the models of the instances from the interim data accessible -> via the registrar It outputs are: -> Tndirect command buffer -> The count of the indirect commands -> The input instances shuffled around/culled/lod'ed reflecting -> their order within the indirect command buffer generated -> It will also (optionally) do culling and lod.

Member Typedef Documentation

Constructor & Destructor Documentation

makVrv::DtGpuCullingAndLod::DtGpuCullingAndLod ( DtDe de)
protected

constructor

virtual makVrv::DtGpuCullingAndLod::~DtGpuCullingAndLod ( )
virtual

destructor

makVrv::DtGpuCullingAndLod::DtGpuCullingAndLod ( )
private

default constructor

makVrv::DtGpuCullingAndLod::DtGpuCullingAndLod ( const DtGpuCullingAndLod other)
private

Copy Constructor not implemented – Copy Not Allowed.

Member Function Documentation

DtGpuCullingAndLod& makVrv::DtGpuCullingAndLod::operator= ( const DtGpuCullingAndLod other)
private

Assignment Operator Not implemented – Assignment Not Allowed.

virtual void makVrv::DtGpuCullingAndLod::setRegistrar ( DtIndirectGeometryRegistrar registrar)
virtual

set the registrar

virtual void makVrv::DtGpuCullingAndLod::setCullShaderConfig ( const DtCullShaderConfig cullShaderConfig)
virtual

set the compute shader config

virtual const DtCullShaderConfig& makVrv::DtGpuCullingAndLod::cullShaderConfig ( void  ) const
virtual

get the compute shader config

virtual void makVrv::DtGpuCullingAndLod::updateGpuBuffers ( DtIndirectRenderingParameters irParams,
const MapIntToInt modelIdsToNumInstances,
osg::RenderInfo &  renderInfo 
)
virtual

updateGpuBuffers

virtual void makVrv::DtGpuCullingAndLod::doCullingAndLOD ( const DtIndirectViewParameters viewParameters,
DtIndirectRenderingParameters irParams,
osg::RenderInfo &  renderInfo,
DtGlBuffer gpuLodVisibleBuffer 
)
virtual

do the culling and the lod

virtual void makVrv::DtGpuCullingAndLod::bindGpuOutputInstanceBuffer ( void  ) const
virtual

bind the output instance buffer

virtual void makVrv::DtGpuCullingAndLod::unbindGpuOutputInstanceBuffer ( void  ) const
virtual

unbind the output instance buffer

virtual bool makVrv::DtGpuCullingAndLod::bindIndirectThings ( )
virtual

bind the indirect command buffer and the count buffer returns false if handle is 0.

Can happen if the buffer hasn't been re-created yet (e.g. when the context is deleted and recreated), depending on the job/frame syc this can happen a few frames later

virtual void makVrv::DtGpuCullingAndLod::unbindIndirectThings ( )
virtual

unbind the indirect command buffer and the count buffer

virtual bool makVrv::DtGpuCullingAndLod::useInstanceCount ( void  ) const
virtual

whether we are optimizing for shared models (useInstanceCount()=true) or unique models (useInstanceCount()=false), across instances

virtual int makVrv::DtGpuCullingAndLod::numDrawCommands ( void  ) const
virtual

The number of draw commands generated.

Is a value between [0, DtIndirectGeoUtils::getMaxDrawCountNoCullingNoLod()], inclusive

virtual void makVrv::DtGpuCullingAndLod::setShadersFolderPath ( const std::string &  shaderFolderPath)
virtual

set up the shader folder path (to enable us to load shaders, de is not accessible here)

virtual const std::string& makVrv::DtGpuCullingAndLod::shadersFolderPath ( void  ) const
virtual

get the shader folder path

virtual void makVrv::DtGpuCullingAndLod::setShadersFileCache ( DtOsgShaderFilesCache shaderFilesCache)
virtual

set up the shader file cache (to enable us to load shaders, de is not accessible here)

virtual const DtOsgShaderFilesCache* makVrv::DtGpuCullingAndLod::shadersFileCache ( void  ) const
virtual

gets the shader file cache which contains all the shaders used by the culling comput shader

virtual void makVrv::DtGpuCullingAndLod::releaseGLObjects ( osg::State *  state) const
virtual

release the GL objects for the GpuCullingAndLod compute shader

virtual void makVrv::DtGpuCullingAndLod::reloadShaders ( ) const
virtual

destroy the cull program and shader if they exists so they can be recreated next frame.

virtual unsigned int makVrv::DtGpuCullingAndLod::maxNumInstances ( void  ) const
virtual

get the max number of instances that can possibly be rendered if none are culled out.

virtual const VectorStateIdOffsetAndMaxCommands& makVrv::DtGpuCullingAndLod::stateIdOffsetAndMaxCommands ( void  ) const
virtual

get the map of the state id to their offset/number

virtual void makVrv::DtGpuCullingAndLod::setInstanceContainer ( DtInstanceContainer instanceContainer)
virtual
virtual bool makVrv::DtGpuCullingAndLod::readyToUpdateBuffers ( )
virtual

helper function to decide if a job should be launched

virtual bool makVrv::DtGpuCullingAndLod::needTextureUpdate ( ) const
virtual

are there textures that still need updating.

virtual void makVrv::DtGpuCullingAndLod::updateGpuInputInstancesBuffer ( )
protectedvirtual

update the various buffers that are fed to the cull shader -> if new models came in -> if textures became available (they can be asynchronously available, e.g.

via osg ico) -> if the number of instances changed

virtual void makVrv::DtGpuCullingAndLod::updateGpuInputPerGeomInstancesBuffer ( )
protectedvirtual
virtual void makVrv::DtGpuCullingAndLod::updateGpuGeometrySpecificationsBuffer ( const int  numGeometries)
protectedvirtual
virtual void makVrv::DtGpuCullingAndLod::updateGpuMaterialsBuffer ( const int  numGeometries)
protectedvirtual
virtual void makVrv::DtGpuCullingAndLod::updateGpuGeometryOffsetAndSizeBuffer ( int numGeometries)
protectedvirtual
virtual void makVrv::DtGpuCullingAndLod::updateGpuIndirectBuffer ( )
protectedvirtual
virtual void makVrv::DtGpuCullingAndLod::clearInstanceCountofGpuIndirectBuffer ( )
protectedvirtual
virtual void makVrv::DtGpuCullingAndLod::clearStateIdCommandCountBuffer ( )
protectedvirtual
virtual bool makVrv::DtGpuCullingAndLod::updateGpuTexturesBuffer ( osg::RenderInfo &  renderInfo)
protectedvirtual

The buffer containing the bindless textures' addresses of the model textures returns true if there still work happening.

virtual void makVrv::DtGpuCullingAndLod::updateInstancesOffsetAndInstances ( const MapIntToInt modelIdsToNumInstances)
protectedvirtual

update the myGpuInstancesOffsetAndNumInstances buffer so it is ready to be used

virtual void makVrv::DtGpuCullingAndLod::updateStateIdMaxNumCommands ( const MapIntToInt modelIdsToNumInstances)
protectedvirtual

update the myGpuStateIdToMaxNumCommandsBuffer buffer with the correct max state instances for each state

virtual bool makVrv::DtGpuCullingAndLod::checkSpecBuffersOk ( void  ) const
protectedvirtual

check a few of the buffers to make sure they are not null

Friends And Related Function Documentation

friend class DtGpuCullingAndLodCreator
friend

Member Data Documentation

DtIndirectGeometryRegistrar* makVrv::DtGpuCullingAndLod::myRegistrar
protected
DtInstanceContainer* makVrv::DtGpuCullingAndLod::myInstanceContainer
protected
DtGlBuffer* makVrv::DtGpuCullingAndLod::myGpuInputInstancesBuffer
protected

The input instances for the GPU (generated/updated from the passed in instance container)

DtGlBuffer* makVrv::DtGpuCullingAndLod::myGpuInputPerGeomInstancesBuffer
protected

contains switch states/ lod info

DtGlBuffer* makVrv::DtGpuCullingAndLod::myGpuGeometrySpecificationsBuffer
protected

The spec buffer containing GeometrySpecifications for all the models/lods of the passed in instances.

std::vector<DtGeometrySpecification> makVrv::DtGpuCullingAndLod::myGeometrySpecifications
protected

c++ buffer that holds the same info

std::vector<DtIndirectOffsetAndSize> makVrv::DtGpuCullingAndLod::myGeometryOffsetAndSizes
protected

An internal indexing buffer that allows the cull shader to go from and intance to its GeometrySpecification in the Geometry Specification Buffer.

DtGlBuffer* makVrv::DtGpuCullingAndLod::myGpuMaterialsBuffer
protected

The spec buffer containing Materials for all the models/lods of the passed in instances.

DtGlBuffer* makVrv::DtGpuCullingAndLod::myGpuIndirectBuffer
protected

The indirect command buffer that will be generated.

DtGlBuffer* makVrv::DtGpuCullingAndLod::myGpuOutputInstancesBuffer
protected

The re-distributed/culled/lod'ed instances (a subset of the input instances)

DtIndirectCullPass* makVrv::DtGpuCullingAndLod::myCullPass
protected
DtGlBuffer* makVrv::DtGpuCullingAndLod::myGpuTexturesBuffer
protected
MapIntToInt makVrv::DtGpuCullingAndLod::myModelIdToIndex
protected
DtCullShaderConfig makVrv::DtGpuCullingAndLod::myCullShaderConfig
protected
std::vector<InstancesOffsetAndNumOfInstances> makVrv::DtGpuCullingAndLod::myInstancesOffsetAndNumInstances
protected
DtGlBuffer* makVrv::DtGpuCullingAndLod::myGpuInstancesOffsetAndNumInstances
protected
std::string makVrv::DtGpuCullingAndLod::myShaderFolderPath
protected
DtOsgShaderFilesCache* makVrv::DtGpuCullingAndLod::myShaderFilesCache
protected
unsigned int makVrv::DtGpuCullingAndLod::myMaxNumInstances
protected
VectorStateIdOffsetAndMaxCommands makVrv::DtGpuCullingAndLod::myStateIdToMaxNumCommands
protected
DtGlBuffer* makVrv::DtGpuCullingAndLod::myGpuStateIdToMaxNumCommandsBuffer
protected
DtGlBuffer* makVrv::DtGpuCullingAndLod::myGpuStateIdToCommandCountBuffer
protected
VectorInts makVrv::DtGpuCullingAndLod::myGeomSpecIndexToCommandIndex
protected
DtGlBuffer* makVrv::DtGpuCullingAndLod::myGpuSpecIndexToCommandIndexBuffer
protected
DtDe& makVrv::DtGpuCullingAndLod::myDe
protected
unsigned int makVrv::DtGpuCullingAndLod::myLastNumEffectTextures
protected
int makVrv::DtGpuCullingAndLod::myMutableFirstTextureStreamedModel
mutableprotected

Keep track of the first model using bindless textures.

int makVrv::DtGpuCullingAndLod::myMutableFirstTextureStreamedIndex
mutableprotected

What index to start using bindless textures for a model.

bool makVrv::DtGpuCullingAndLod::myNeedTextureUpdate
protected
int makVrv::DtGpuCullingAndLod::myStreamedMaterialModelID
protected
int makVrv::DtGpuCullingAndLod::myStreamedMaterialBytes
protected
int makVrv::DtGpuCullingAndLod::myStreamedSpecModelID
protected
int makVrv::DtGpuCullingAndLod::myStreamedSpecBytes
protected
int makVrv::DtGpuCullingAndLod::myStreamedSpecModelGeomIndex
protected
int makVrv::DtGpuCullingAndLod::myStreamedGeometryOffsetModelID
protected
int makVrv::DtGpuCullingAndLod::myNumGeometries
protected

The documentation for this class was generated from the following file:

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)