Ahmidou Lyazidi 6555153b21 Backends + Examples: Metal4: robust CAMetalLayer multi-viewport on macOS
Rework the Metal 4 backend and example for correct, glitch-free multi-viewport
rendering on macOS, and convert example_apple_metal4 off MTKView.

Backend (imgui_impl_metal4.mm):
- Per-window argument tables so overlapping per-window GPU work within a frame can't
  corrupt each other's bindings (multi-viewport flicker).
- Hold per-slot vertex/index buffers until their frame completes, so a second viewport
  rendered later in the same frame can't overwrite a buffer still in flight (blink).
- Make hand-built render-pass drawables resident, and evict stale (resized-away)
  drawables from the residency set so it can't grow without bound during a live resize.
- Present secondary viewports in-transaction on the frame they were resized so content
  stays glued to the new size (no stutter).

Example (example_apple_metal4/main.mm):
- Replace MTKView with a custom NSView/UIView + CAMetalLayer driven by a display link.
- Proper frames-in-flight: per-slot command allocators, rotating slots, and a semaphore
  gate released on GPU completion via an MTLSharedEvent listener.
- Glitch-free main-window resize: present in-transaction during a live resize, driven by
  AppKit (the display link steps aside) so the transaction commits and drawables aren't
  starved; async present otherwise (avoids a ~1s nextDrawable stall / freeze).
- Idle CPU throttling: only redraw on input/activity plus a slow heartbeat, so the main
  thread sleeps when nothing changes.
2026-09-18 14:35:49 -07:00
..

New to Dear ImGui?
- Check out the Getting Started guide: https://github.com/ocornut/imgui/wiki/Getting-Started
- About Backends: docs/BACKENDS.md file, or on the web: https://github.com/ocornut/imgui/blob/master/docs/BACKENDS.md
- About Examples: docs/EXAMPLES.md file, or on the web: https://github.com/ocornut/imgui/blob/master/docs/EXAMPLES.md

Backends = Helper code to facilitate integration with platforms/graphics api (used by Examples + should be used by your app).
Examples = Standalone applications showcasing integration with platforms/graphics api.

A few Examples have extra README files in their respective directory, please check them too!

Once Dear ImGui is running (in either examples or your own application/game/engine),
run and refer to ImGui::ShowDemoWindow() in imgui_demo.cpp for the end-user API.