attachWin32Window method
- Win32WindowDescriptor descriptor,
- RenderSessionAttachOptions options, {
- VulkanDeviceHandle? device,
Creates a session that presents the map to a Win32 window, with a graphics context that the library creates.
A Vulkan build presents with device, or, when device is null, with a
device that the library creates. An OpenGL build uses a WGL context, and
device must be null. Attach with RenderDriverKind.coreWorker.
An OpenGL build sets the window's pixel format, so don't set one yourself.
The session presents without waiting for the display, so demand at most
one frame per display refresh. While the window is minimized, frame
demands finish with RenderResult.targetNotReady.
Keep the window until a release or replacement of the target, or a detach of the session, completes.
See mln_map_attach_win32_window in the
C API reference.
Errors:
Status.invalidArgumentwhenwindowisn't a window, or, in an OpenGL build, already has another pixel format.Status.invalidStatewhenwindowis minimized or has no client area.Status.unsupportedwhen you createddevicewithoutVulkanDeviceOptions.presentation.Status.invalidStatewhenwindowwas minimized before the attach ran.Status.unsupportedwhen the GPU or the Vulkan loader can't present.Status.nativeErrorwhen the library can't create the graphics context or present to the window.
Implementation
RenderSessionHandle attachWin32Window(
Win32WindowDescriptor descriptor,
RenderSessionAttachOptions options, {
VulkanDeviceHandle? device,
}) {
final registrations = _NativeRegistrations(_CallbackRoots());
return _attach(
(arena, completion, outSession) => registrations.run(
() => raw.mln_map_attach_win32_window(
_handle.raw,
_writeWin32WindowDescriptor(descriptor, arena),
(device?._handle.raw ?? 0),
_writeRenderSessionAttachOptions(options, arena, registrations),
outSession,
completion,
nativeDiagnostic,
),
),
(handle, ready) => _adoptOwned(
handle,
() =>
(RenderSessionHandle._(this, _NativeRenderSession(handle), ready)
.._state.retain(registrations)),
(handle) {
_check(raw.mln_render_session_dispose(handle, nativeDiagnostic));
},
),
);
}