Skip to content

Windows x64: @perryts/webgpu builds & presents frames but window stays gray (+ link/manifest/arg-passing fixes) #5812

Description

@proggeramlug

Summary

A community user (@nikolas_beckel) got a Perry @perryts/webgpu program building and running on Windows x64 (with AI assistance, zero Rust experience). It opens a window and wgpu presents ~15 frames successfully, but the rendered frames never show up in the window — it stays gray. Several patches were needed along the way to get that far. This issue tracks debugging the Windows path so it works out of the box.

Environment

  • Platform: Windows x64
  • Package: @perryts/webgpu (unless noted)
  • Backends in play: wgpu d3d12 / vulkan / gl

Findings / patches the user had to apply

  1. Manifest lib name mismatch. The manifest "windows" lib is declared as libperry_ext_webgpu.a, but on Windows it actually builds as perry_ext_webgpu.lib. The manifest/link logic should resolve the platform-correct name.

  2. Missing Windows link libs. Windows link needs d3dcompiler + opengl32, otherwise LNK2019 unresolved externals on wgl* / D3DCompile (pulled in by wgpu's d3d12/gl backends).

  3. request_adapter ignores the surface. request_adapter uses compatible_surface: None, which makes surfaceConfigure fail on d3d12/vulkan ("queue family" error). Picking the adapter against the surface fixed it.

  4. textureCreateView(tex) without a descriptor crashes in read_string. Passing all args explicitly worked around it — suggests Perry may be passing garbage for omitted/optional args on win64 (calling-convention / default-arg lowering bug?).

  5. Frames present but never display (main wall). After the above, wgpu presents 15 frames fine, but they never appear in the window — it stays gray. Likely a surface present / swapchain / window-compositing issue on Windows.

Suspected Perry-side bugs (vs. just wgpu usage)

  • Item 4 strongly smells like a Perry codegen/ABI issue: omitted optional args producing garbage on win64. Worth reproducing in isolation (a function with a trailing optional/object param called with the arg omitted).
  • Item 1 is a manifest/link-name resolution bug specific to Windows.

Tasks

  • Reproduce on a Windows x64 box.
  • Fix manifest lib-name resolution (lib*.a vs *.lib) for Windows.
  • Add d3dcompiler + opengl32 to the Windows link line for the webgpu ext (and audit other exts that pull wgpu backends).
  • Make request_adapter pass compatible_surface so d3d12/vulkan surfaceConfigure succeeds.
  • Root-cause the textureCreateView omitted-arg crash — minimal repro of omitted optional args on win64; fix in codegen if confirmed.
  • Investigate the gray-window / frames-never-presented issue (surface present / swapchain / compositing on Windows).

Credit

Reported by @nikolas_beckel on X. Thanks for the detailed write-up and patches!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions