![]() |
VR-Forces Developer's Guide
|
Top-level pre-draw osg::Operation registered on the OSG viewer that coordinates all GPU work requiring an active GL context.
DtGpuArena manages three categories of GPU work:
The same DtGpuArenaUploadState budget context flows through all categories so that byte-upload accounting and budget enforcement are consistent.

Public Member Functions | |
| virtual | ~DtGpuArena () |
| virtual void | operator() (osg::Object *obj) override |
| virtual void | addOneTimeInitOp (DtIndirectGeometry *indirectGeometry) |
| virtual void | addOneTimeInitOpForNextFrame (DtIndirectGeometry *indirectGeometry) |
| virtual void | addPersistentOp (DtGpuOperation *op) |
| virtual void | removePersistentOp (DtGpuOperation *op) |
| virtual unsigned int | uploadMemoryBudget () const |
| virtual unsigned int | statsUploadedBufferMemory () const |
| virtual unsigned int | statsUploadedTextureMemory () const |
| virtual size_t | statsBufferUpdatesRemaining () const |
| virtual size_t | statsOneTimeOpsRemaining () const |
| virtual void | addOneTimeGpuOp (std::unique_ptr< DtGpuOperation > op) |
| virtual size_t | statsGpuOpsRemaining () const |
Public Attributes | |
| friend | DtGpuArenaCreator |
Protected Member Functions | |
| DtGpuArena (DtDe &de) | |
| virtual void | update () |
| virtual void | slot_gpuArenaUploadMemoryBudgetChanged (int megabytes) |
| virtual void | processOneTimeInitOperations () |
| virtual void | transferNextFrameOneTimeInitOps () |
| virtual void | processOneTimeGpuOps () |
Private Member Functions | |
| DtGpuArena ()=delete | |
| DtGpuArena & | operator= (const DtGpuArena &rhs)=delete |
| DtGpuArena (const DtGpuArena &rhs)=delete | |
|
virtual |
destructor
|
protected |
constructor
|
privatedelete |
not allowed
|
privatedelete |
not allowed
|
privatedelete |
not allowed
|
overridevirtual |
OSG pre-draw callback; executed once per OpenGL context per frame.
May be called from multiple threads simultaneously when OSG is in ThreadPerContext mode. All GL work dispatched here is context-bound.
| obj | The OSG graphics context object passed by the operation thread. |
|
virtual |
Queue a one-time geometry-buffer init operation (legacy indirect-geometry path).
Thread-safe; may be called from any thread. The operation is executed on the render thread during the next pre-draw pass via processOneTimeInitOperations().
| indirectGeometry | The indirect-geometry object whose buffers need initializing on the GPU. Must not be null. |
|
virtual |
Queue a one-time geometry-buffer init operation for the next frame rather than the current one.
Use this when geometry is not yet ready for the current pre-draw pass. Ops are transferred into the active queue by transferNextFrameOneTimeInitOps().
| indirectGeometry | The indirect-geometry object to initialize next frame. |
|
virtual |
Register a persistent GPU operation to run once per GL context per frame.
| op | Non-owning pointer to the operation. The caller retains ownership and must ensure the operation outlives its registration. |
|
virtual |
Unregister a persistent GPU operation previously added with addPersistentOp().
| op | The operation to remove. Has no effect if the operation is not registered. |
Returns the per-frame upload memory budget for this arena.
Returns the bytes of buffer data uploaded to the GPU this frame.
Returns the bytes of texture data uploaded to the GPU this frame.
|
virtual |
Returns the number of indirect-geometry buffer operations still pending.
|
virtual |
Returns the number of DtIndirectGeometry one-time init ops pending.
|
virtual |
Queue a one-time GPU operation to be executed on the render thread during the next pre-draw pass. Thread-safe.
All ops in this queue receive the per-frame DtGpuArenaUploadState via DtGpuOperation::execute(state&), so they can read the budget and credit their byte usage to statsUploadedTextureMemory / statsUploadedBufferMemory.
| op | Heap-allocated op; ownership transfers to the arena. |
|
virtual |
Returns the number of one-time GPU ops currently pending in the queue.
|
protectedvirtual |
Pre-tick update hook; called each simulation tick before the frame renders. Resets per-frame stats and prepares the arena for the next pre-draw pass.
|
protectedvirtual |
Update the per-frame upload memory budget.
Controls the total bytes of indirect-geometry and texture data that may be uploaded per frame. Used by DtGpuArena::operator()() during the pre-draw pass.
| megabytes | New budget in megabytes. Default is 32. |
|
protectedvirtual |
Drain and execute all pending one-time indirect-geometry init operations. Called once per frame from operator()().
|
protectedvirtual |
Move next-frame indirect-geometry init ops into the active queue. Called at the start of each pre-draw pass before processOneTimeInitOperations().
|
protectedvirtual |
Drain and execute all pending one-time GPU ops. Uses swap-then-release locking so producers do not block on GL execution. Each op receives the per-frame upload state.
| friend makVrv::DtGpuArena::DtGpuArenaCreator |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Bytes of buffer data uploaded to GPU this frame; reset each frame.
Bytes of texture data uploaded to GPU this frame; reset each frame.
|
protected |
Number of indirect-geometry buffer operations still pending.
|
protected |
Number of DtIndirectGeometry one-time init ops pending in the queue.
|
protected |
Guards myOneTimeGpuOps against concurrent enqueue and drain.
|
protected |
Thread-safe queue of one-time GPU ops; drained each pre-draw pass.
|
protected |
Number of one-time GPU ops pending in myOneTimeGpuOps.
|
protected |
Per-frame upload budget and stats; owned by this arena.