콘텐츠로 이동

IGraphicsFactory.AcquireBackgroundRenderScope method

이 콘텐츠는 아직 번역되지 않았습니다.

Reserves any per-thread state needed to perform rendering on the calling thread. Required for backends with thread-affine state (context-current style APIs). Backends with thread-safe APIs return a no-op disposable.

Use this from worker threads that call CreateSurface / CreateContext:

await Task.Run(() => {
using var _ = factory.AcquireBackgroundRenderScope();
var surface = factory.CreateSurface(...);
using var ctx = factory.CreateContext(surface);
// draw...
});

Backends with a shared session/context that offscreen and UI-frame rendering would otherwise contend over route background surfaces to a separate per-thread context here.

public IDisposable AcquireBackgroundRenderScope()