Repository navigation
Description
Parent epic: #22
Implementation order: 04 of 20.
Depends on: #25.
Outcome
Provide a Windows GPU-resident image bridge from Dawn D3D12 and ANGLE D3D11 into presenter-compatible textures, without a CPU bitmap/readback loop.
Implementation
- Implement Windows native shared-color allocation/import/export through the generic lease contract. Match adapter LUID and negotiate formats, usage, alpha and handle ownership.
- Support Dawn shared texture memory BeginAccess/EndAccess and the appropriate DXGI fence/keyed-mutex protocol for each selected producer/consumer pairing. Do not treat D3D11 and D3D12 synchronization as interchangeable.
- Keep depth/MSAA allocations private; resolve into a shareable single-sample image. Support the preferred canvas format and explicitly account for any required GPU-local conversion.
- Ensure import completion, producer completion and consumer completion have distinct ownership. Close duplicated/non-owned handles according to their documented lifetime.
- Add typed probe-consumer hooks suitable for the later Avalonia/Uno adapters. Do not pass Skia pointers between native library versions.
- Handle failed import, unsupported format/adapter, resize, device removal and teardown. Return a diagnostic unsupported result rather than silently using ReadPixels/WriteableBitmap.
- Trace all copy/readback operations and resource residency so the performance claim can be verified.
Tests
- Hardware Dawn→consumer and ANGLE→consumer patterns with frame serial/color checks.
- Alpha, channel order, MSAA resolve, subrect sampling and nontrivial row/size alignment.
- Delayed consumer, pool reuse, rapid resize, failed imports, device removal and cross-adapter rejection.
- Repeated open/close and handle/resource leak tests.
Verification evidence
Attach Windows GPU/driver/LUID manifest, trace/counter evidence of zero CPU pixel readback/upload in normal presentation, copy classifications and synchronization timeline. Later presenter issues must repeat integration tests against actual frameworks.
Acceptance
- Both native producer paths share correct pixels with the probe consumer.
- Synchronization prevents overwrite/read races without global device-idle waits in the steady path.
- Every native handle has a documented owner and verified release.
- Unsupported pairings fail explicitly.
- Normal bridge operation has zero CPU pixel-copy traffic.
Completion requirements
Link the implementation PR, exact test commands, native/runtime/framework revisions and verification artifacts before closing. Follow the epic's architecture and copy/lifetime invariants. Any unavailable mandatory hardware or missing required functionality remains incomplete, not a pass.
Activity