![]() |
ezEngine Release 26.9
|
#include <RenderGraphResourceAllocator.h>
Public Member Functions | |
| ezRenderGraphResourceAllocator (ezRenderGraphResourcePool *pPool) | |
| ezRenderGraphResourceAllocator (const ezRenderGraphResourceAllocator &)=delete | |
| ezRenderGraphResourceAllocator & | operator= (const ezRenderGraphResourceAllocator &)=delete |
| ezRenderGraphResourceAllocator (ezRenderGraphResourceAllocator &&rhs) noexcept | |
| ezRenderGraphResourceAllocator & | operator= (ezRenderGraphResourceAllocator &&rhs) noexcept |
| ezGALTextureHandle | AcquireTexture (const ezGALTextureCreationDescription &desc) |
| void | ReleaseTexture (ezGALTextureHandle hTexture) |
| ezGALBufferHandle | AcquireBuffer (const ezGALBufferCreationDescription &desc) |
| Acquire a buffer matching the given description. | |
| void | ReleaseBuffer (ezGALBufferHandle hBuffer) |
| Return a buffer for intra-graph recycling. | |
| void | FreeResources () |
| Drop all shared pointers, decrementing ref counts back toward the pool. | |
Per-graph, single-threaded resource allocator that sits in front of the global ezRenderGraphResourcePool.
Each render graph owns one allocator. The allocator provides a simple AcquireTexture / ReleaseTexture API. Internally it tracks how many resources of each description are currently in use so that the same GPU resource is never handed out twice within a graph, while still sharing resources between graphs that happen to need the same description.
Released resources stay alive in the allocator for intra-graph recycling. FreeResources (or the destructor) drops all shared pointers, decrementing the ref counts back toward the pool.
| ezGALTextureHandle ezRenderGraphResourceAllocator::AcquireTexture | ( | const ezGALTextureCreationDescription & | desc | ) |
Acquire a texture matching the given description. If a previously released texture with the same description is available, it is recycled. Otherwise, a new slot is requested from the pool.
| void ezRenderGraphResourceAllocator::ReleaseTexture | ( | ezGALTextureHandle | hTexture | ) |
Return a texture for intra-graph recycling. The underlying pooled resource stays alive in the allocator; a future AcquireTexture with a matching description may return this same resource.