ScratchSurfacePool class
이 콘텐츠는 아직 번역되지 않았습니다.
Device-backed scratch IRenderSurface pool view. Filter graphs allocate intermediate surfaces per node (Blur, ColorMatrix, etc.); without pooling, a 5-node DAG on a 1024px source allocates 20 MB just for scratches every frame. The pool keeps a small set of recently-used surfaces per (width, height, dpi) bucket and hands them back on rent.
public sealed class ScratchSurfacePool : IDisposablePublic Members
Section titled “Public Members”| name | description |
|---|---|
| ScratchSurfacePool(…) | Creates a pool over factory that rents surfaces at dpiScale. (2 constructors) |
| MaxPerBucket { get; set; } | Retained for source compatibility. Device-level byte/count budgets now control retention. |
| Dispose() | Stops tracking leases; a surface still rented is disposed when its lease is. |
| RentLease(…) | Rents a scratch surface lease with the exact requested pixel dimensions. Same-size requests reuse the same bucket; differently-sized requests miss the cache and allocate fresh. |
| Return(…) | Returns surface to the pool; a surface not rented from this pool is disposed instead. (2 methods) |
Remarks
Section titled “Remarks”Sizing policy: filter intermediates require exact dimensions because their CPU spans expose allocation stride. Other resource classes may opt into bounded oversize reuse through the same device cache without exposing allocation dimensions to consumers.
Lifetime: this wrapper is owned by an IImageFilterContext instance, while idle surfaces are owned by the device cache and can be reused by another compatible context.
See Also
Section titled “See Also”- namespace Aprillz.MewUI.Rendering.Filters