Skip to content

Metal backend for pl_gpu — interest check + working branch #370

Description

@simonchrz

Hi — I've written a native Metal backend for pl_gpu and wanted to check
interest before filing a formal merge request.

Status: it's working, not a sketch. It mirrors the Vulkan/GL/D3D11 backends
(a pl_gpu_fns vtable + public creation API + CAMetalLayer swapchain), reusing
the in-tree GLSL emitter via GLSL → SPIR-V (pl_spirv) → MSL (SPIRV-Cross) →
MTLLibrary/PSO
. ~2260 LOC over 13 staged commits.

What works:

  • Passes the full gpu_tests suite (buffer/texture/shader incl. film grain, HDR
    peak, all transfer functions, dithering, error diffusion). 25 formats.
  • plplay renders real H.264 through pl_renderer on Metal.
  • pl_timer returns real GPU times (MTLCommandBuffer timestamps).
  • Validated on a physical device (Apple A19 / iPhone 17 Pro), including the
    iOS-only packed format bgr565.

Branch (public, reviewable via the compare view):
master...simonchrz:libplacebo:metal-pr-series

Three questions before I invest more polish:

  1. Do you want a Metal backend in-tree at all, or would you rather it lived
    out-of-tree? I'm happy to maintain the Apple side either way.
  2. CI: the GitLab pipeline has no macOS runner, so the existing CI can't build
    this. How would you like to handle that — a macOS job (I can draft one), or
    merge-with-the-understanding-it's-community-tested?
  3. Anything in the structure you'd want reshaped before a serious review.

I'll file the formal MR on code.videolan.org once my GitLab account is approved
(currently awaiting admin approval); opening here first since GitHub PRs are
restricted to collaborators. Happy to move the discussion to GitLab if you prefer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions