Skip to content

Connect AppScene to the exact Dawn Vulkan device #646

Closed

Description

@wieslawsoltes

Active implementation checkpoint — 19 September 2026

Exact base 0d3d2eb55d36302aa4c9c822cba58a721e16e9dd; branch issue-646-dawn-native-device-hook; worktree /Users/wieslawsoltes/GitHub/.worktrees/WebScene-646-dawn-native-device-hook. No overlapping open PR exists.

Pinned Dawn has internal Vulkan device/physical-device/queue/family getters but exposes only VkInstance publicly. This slice adds a versioned WebScene-owned C query compiled into the pinned Dawn monolith plus a live-device registry hook, so stale and foreign WGPUDevice pointers are rejected before dereference. The merged #647 factory will consume the exact opaque identities, UUIDs and queue family without exposing Dawn private headers to AppScene. Only this subagent is active.

Parent: WebScene #28.

Problem

WebScene now accepts an atomic dawn_linux_external_device_factory result and
owns external Vulkan allocations through
owned_dawn_linux_external_allocation. The pinned public Dawn revision still
does not expose its VkDevice, VkPhysicalDevice, VkQueue or queue family,
and it cannot wrap a host-created VkDevice. AppScene cannot implement the
factory correctly by matching only the adapter UUID or Vulkan instance.

Focused implementation

  • Add one supported, pinned Dawn SDK hook that returns the exact Vulkan
    device/physical-device/queue tuple and queue family for a created
    WGPUDevice, with lifetime and device-loss rules. Do not include Dawn private
    headers in AppScene.
  • Create the Dawn instance, adapter and device plus the AppScene allocator as
    one factory result. Publish one shared lifetime object containing the public
    adapter/device tokens, Vulkan device/driver UUIDs, Dawn queue family and the
    native tuple's opaque identities and owner.
  • Allocate one single-sample BGRA/RGBA Vulkan image with a negotiated external
    opaque-FD or single-FD DMA-BUF route on that exact device. Own the
    VkImage/VkDeviceMemory, exported memory FD and retained create-info chain,
    then adopt them through owned_dawn_linux_external_allocation.
  • Feed the returned WebScene texture through the existing BeginAccess,
    rendering and EndAccess path. Preserve initialized contents, layouts, queue
    ownership and exported fence ordering domains.
  • Return an explicit unsupported/error status for every missing capability or
    identity mismatch. Do not create an ordinary Dawn texture, CPU bitmap upload
    or readback fallback.

Acceptance

  • The allocator's WGPUDevice, native lifetime, UUIDs and Dawn queue family
    match the factory device exactly; copied/foreign identities are rejected.
  • Vulkan external-image format and handle queries admit the selected format,
    usage, tiling/modifier, dedicated-allocation and synchronization combination.
  • A rendered hardware pixel pattern survives Dawn EndAccess and AppScene GPU
    import with the recorded layout and queue-family transition.
  • Invalid UUID, queue family, modifier and fence imports fail without publishing
    a frame or leaking Vulkan objects/FDs.
  • Resize, device loss and teardown keep FD and GPU residency bounded; ordinary
    frames show no CPU readback/upload.

Evidence required before closing

Record exact WebScene/AppScene/Dawn revisions, physical adapter and driver,
device/driver UUIDs, queue families, Vulkan external-memory/semaphore capability
queries, rendered pixels, negative cases, a 30-minute FD/residency plateau and
an installed-SDK consumer run. Software Vulkan coverage is separate and does
not satisfy the physical-hardware gate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    vscode-oss/planned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions