withDxgiSharedTexture<T> method

T withDxgiSharedTexture<T>(
  1. T use(
    1. ScopedDxgiSharedTextureFrame view
    )
)

Gets the DXGI shared texture of an acquired frame.

Wait for AcquiredFrameHandle.withProducerSync() before you read the texture. Once you release or discard the frame, the session may render into the texture again. Open the handle with ID3D11Device1::OpenSharedResource1 or ID3D12Device::OpenSharedHandle. A texture that you open keeps its memory, but not its contents.

The session owns the handle, so don't close it. To keep the handle after you release the frame, duplicate it with DuplicateHandle.

See mln_acquired_frame_get_dxgi_shared_texture in the C API reference.

Errors:

  • Status.targetLost when the session failed, or you detached, abandoned, or disposed it.

Implementation

T withDxgiSharedTexture<T>(
  T Function(ScopedDxgiSharedTextureFrame view) use,
) =>
    _NativeViewScope(
      _state,
      raw.mln_acquired_frame_view_begin,
      raw.mln_acquired_frame_view_end,
    ).use(
      (scope) =>
          use(ScopedDxgiSharedTextureFrame._(scope, _getDxgiSharedTexture())),
    );