Skip to content

IImage.TrySetPostReleaseCallback method

Asks the image to invoke callback once its backend GPU references have actually been released, not just when Dispose returns; returns true when the backend accepted the callback and false when the caller must run the equivalent cleanup itself after Dispose.

public bool TrySetPostReleaseCallback(Action callback)

DefaultFilterContext.AcquireScratch uses this to delay returning a scratch IRenderSurface to its pool until any queued zero-copy draw that references the underlying texture has flushed; otherwise the next acquire in the same filter evaluation could recycle the surface and overwrite the texture mid-flight. The default returns false for backends whose images are not shared zero-copy with a deferred draw queue.