| 24 | } |
| 25 | |
| 26 | void RenderTargetPool::Flush(bool force, int32 framesOffset) |
| 27 | { |
| 28 | PROFILE_CPU(); |
| 29 | if (framesOffset < 0) |
| 30 | framesOffset = 3 * 60; // For how many frames RTs should be cached (by default) |
| 31 | const uint64 frameCount = Engine::FrameCount; |
| 32 | const uint64 maxReleaseFrame = frameCount - Math::Min<uint64>(frameCount, framesOffset); |
| 33 | force |= Engine::ShouldExit(); |
| 34 | |
| 35 | for (int32 i = 0; i < TemporaryRTs.Count(); i++) |
| 36 | { |
| 37 | const auto& e = TemporaryRTs[i]; |
| 38 | if (!e.IsOccupied && (force || e.LastFrameReleased < maxReleaseFrame)) |
| 39 | { |
| 40 | e.RT->DeleteObjectNow(); |
| 41 | TemporaryRTs.RemoveAt(i--); |
| 42 | if (TemporaryRTs.IsEmpty()) |
| 43 | break; |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | GPUTexture* RenderTargetPool::Get(const GPUTextureDescription& desc) |
| 49 | { |
nothing calls this directly
no test coverage detected