Agent skill

Agfx Presentation And Swapchain

by AmelieHeinrich in AmelieHeinrich/agfx

ALWAYS use when creating, resizing, or presenting through an agfxSwapChain in AGFX — window/layer handle setup, HDR toggling, vsync, resize handling, or back buffer acquire/present.

MITAuto-check passedGame Development

Install Agfx Presentation And Swapchain

skills CLI
$ npx skills add AmelieHeinrich/agfx --skill agfx-presentation-and-swapchain -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install AmelieHeinrich/agfx agfx-presentation-and-swapchain --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/AmelieHeinrich/agfx.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/agfx-presentation-and-swapchain .claude/skills/agfx-presentation-and-swapchain && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
agfx-presentation-and-swapchain
GitHub stars
146
Token cost
~2k tokens
SKILL.md length
612 words
Files
1
Skills in repo
8
Repo updated
First seen
Licence
MIT

At a glance

ALWAYS use when creating, resizing, or presenting through an agfxSwapChain in AGFX — window/layer handle setup, HDR toggling, vsync, resize handling, or back buffer acquire/present.

  • Presenting through an agfxSwapChain in AGFX — window/layer handle setup
  • SKILL.md covers Overview, Ownership, References and Design Patterns
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Resize handling

What it does

Agfx Presentation And Swapchain is an agent skill from AmelieHeinrich/agfx. ALWAYS use when creating, resizing, or presenting through an agfxSwapChain in AGFX — window/layer handle setup, HDR toggling, vsync, resize handling, or back buffer acquire/present. Trigger for agfxSwapChainCreate/Destroy/Resize/Present, agfxSwapChainAcquireNextTexture, agfxSwapChainGetFormat, AGFXRESOURCESTATEPRESENT, CAMetalLayer/HWND handle, agfxLinuxWindowHandle, agfxDisplayServerProtocol, X11/XCB/Wayland surface setup, "blank window", "swap chain out of date", HDR toggle, resize crash. Do NOT trigger for…

Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Game Development. It works with macOS and Linux. The licence is MIT.

When your agent uses it

  • Presenting through an agfxSwapChain in AGFX — window/layer handle setup
  • Resize handling
  • Back buffer acquire/present
  • AgfxSwapChainCreate/Destroy/Resize/Present

Example prompts

  • “blank window”
  • “swap chain out of date”
  • “Use the agfx-presentation-and-swapchain skill to alway use when creating, resizing, or presenting through an agfxSwapChain in AGFX — window/layer…”
  • “/agfx-presentation-and-swapchain”

What it can do on your machine

Read from SKILL.md and the folder at commit d8ad38b. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are cpp).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Agfx Presentation And Swapchain loads about 2k tokens when it runs. Until then it costs about 189 tokens; SKILL.md has 612 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~189
When it runs · the whole SKILL.md, loaded when a task matches
~2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from AmelieHeinrich/agfx at commit d8ad38b, republished under its MIT licence (© AmelieHeinrich). 612 words, ~1,999 tokens.

Download SKILL.mdSave it as .claude/skills/agfx-presentation-and-swapchain/SKILL.md (or your agent's skills folder).
name
agfx-presentation-and-swapchain
description
ALWAYS use when creating, resizing, or presenting through an agfxSwapChain in AGFX — window/layer handle setup, HDR toggling, vsync, resize handling, or back buffer acquire/present. Trigger for agfxSwapChainCreate/Destroy/Resize/Present, agfxSwapChainAcquireNextTexture, agfxSwapChainGetFormat, AGFX_RESOURCE_STATE_PRESENT, CAMetalLayer/HWND handle, agfxLinuxWindowHandle, agfxDisplayServerProtocol, X11/XCB/Wayland surface setup, "blank window", "swap chain out of date", HDR toggle, resize crash. Do NOT trigger for render pass/attachment authoring against the acquired back buffer texture — use agfx-render-targets-and-passes. Do NOT trigger for fence/frame-in-flight synchronization details — use agfx-synchronization.

AGFX Presentation & Swap Chain

Overview

agfxSwapChain is AGFX's cross-platform presentation object: on macOS it wraps a CAMetalLayer*, on Windows an HWND, on Linux a pointer to an agfxLinuxWindowHandle (a {display, window} pair whose interpretation — Xlib, XCB, or Wayland — is fixed by the agfxDeviceCreateInfo::displayServerProtocol the device was created with). The contract is deliberately simple — acquire a back buffer texture, render into it via a render pass, barrier it back to AGFX_RESOURCE_STATE_PRESENT, submit, then present. AGFX hides the per-backend present sequences (waitForDrawable/signalDrawable on Metal 4, IDXGISwapChain::Present on D3D12, the binary acquire/present semaphore bookkeeping on Vulkan) behind agfxSwapChainAcquireNextTexture/agfxSwapChainPresent.

Anything that changes the swap chain's underlying resources — resize, or an HDR toggle — requires the GPU to be fully idle first (see agfx-synchronization for drainGPU). AGFX does not do this drain internally; the caller must drain before resizing or recreating.

Ownership

Owns:

  • agfxSwapChainCreateInfo / agfxSwapChainCreate / agfxSwapChainDestroy
  • agfxSwapChainResize
  • agfxSwapChainGetFormat
  • agfxSwapChainAcquireNextTexture / agfxSwapChainPresent
  • HDR (isHDR) and vsync (vsync) swap chain configuration
  • The native handle contract (CAMetalLayer* on macOS, HWND on Windows, agfxLinuxWindowHandle* on Linux) and the Linux-only agfxDeviceCreateInfo::displayServerProtocol field it depends on
  • AGFX_RESOURCE_STATE_PRESENT as the required pre/post state for the acquired texture

Doesn't own:

  • Building the render pass that renders into the acquired back buffer texture → agfx-render-targets-and-passes
  • Draining the GPU / fence semantics that must precede resize or swap chain recreation → agfx-synchronization
  • Window creation, SDL/AppKit event handling, mouse/keyboard input — engine-level, not part of AGFX

References

Read agfx/agfx.h's // Swap chain section for authoritative struct/enum definitions. agfx_demo/agfx_demo_main.cpp is the full reference implementation: swap chain creation from an SDL window, per-frame acquire/present, resize handling, and HDR toggle.

Design Patterns

Creating the swap chain
cpp
agfxSwapChainCreateInfo swapChainCreateInfo = {};
swapChainCreateInfo.queue = graphicsQueue;      // must be a graphics queue
swapChainCreateInfo.imageCount = 2;             // double buffering; 3 for triple buffering
swapChainCreateInfo.width = drawableWidth;
swapChainCreateInfo.height = drawableHeight;
swapChainCreateInfo.isHDR = false;
swapChainCreateInfo.vsync = true;
#if GAME_MAC
swapChainCreateInfo.handle = metalLayer;        // CAMetalLayer* from SDL_Metal_GetLayer or similar
#elif GAME_LINUX
agfxLinuxWindowHandle linuxHandle = {};         // interpreted per the device's displayServerProtocol
linuxHandle.display = x11DisplayOrWlDisplay;    // Display* / xcb_connection_t* / wl_display*
linuxHandle.window  = x11WindowOrWlSurface;     // Window / xcb_window_t / wl_surface* as uint64_t
swapChainCreateInfo.handle = &linuxHandle;      // read during the create call
#else
swapChainCreateInfo.handle = hwnd;
#endif
agfxSwapChain* swapChain = agfxSwapChainCreate(device, &swapChainCreateInfo);

On Linux the device must have been created with the matching agfxDeviceCreateInfo::displayServerProtocol (AGFX_DISPLAY_SERVER_PROTOCOL_X11/XCB/WAYLAND) — the Vulkan backend enables the corresponding surface extension at instance creation, so this is decided before the swap chain exists; a mismatch fails at agfxSwapChainCreate with a "was the device created with the right displayServerProtocol?" log. With SDL, pick it from SDL_GetCurrentVideoDriver() — see agfx_demo_main.cpp. Note agfx::ez differs here: raw agfxSwapChainCreate consumes the handle struct during the call, but agfx::ez::Context stores the pointer (to recreate the swap chain on an HDR toggle), so there it must outlive the Context.

Query the back buffer's actual pixel format with agfxSwapChainGetFormat(swapChain) rather than assuming a fixed format — it changes when isHDR changes, and any render target/pipeline built against the back buffer must use this queried format (AGFX_TEXTURE_FORMAT_UNKNOWN in the render target's format field lets it inherit automatically; see agfx-render-targets-and-passes).

Show full SKILL.md (214 more words)Show less
Per-frame acquire → render → present
cpp
agfxTexture* backBuffer = agfxSwapChainAcquireNextTexture(swapChain);
// backBuffer starts in AGFX_RESOURCE_STATE_PRESENT
agfxCommandBufferTextureBarrier(cmd, backBuffer, AGFX_RESOURCE_STATE_PRESENT, AGFX_RESOURCE_STATE_RENDER_TARGET, 0, 0, /*agglomerate=*/false);

// ... wrap backBuffer in an agfxRenderTarget, run a render pass, draw ...

agfxCommandBufferTextureBarrier(cmd, backBuffer, AGFX_RESOURCE_STATE_RENDER_TARGET, AGFX_RESOURCE_STATE_PRESENT, 0, 0, /*agglomerate=*/false);
agfxCommandBufferEnd(cmd);
agfxCommandQueueSubmit(queue, &cmd, 1);
agfxSwapChainPresent(swapChain);

Pass agglomerate = false specifically for these PRESENT↔RENDER_TARGET transitions around acquire/present (see agfx-synchronization for why: presentable drawables need no explicit hazard tracking on Metal, but D3D12 and Vulkan still need the transition emitted unconditionally — on Vulkan it is a real image layout transition to/from PRESENT_SRC_KHR, and the backend internally treats PRESENT-as-old-state as UNDEFINED since a freshly acquired image's contents are discardable). On Vulkan, agfxSwapChainAcquireNextTexture can also return nullptr when the surface is out of date (e.g. mid-resize, logged as a warning) — skip the frame and resize rather than dereferencing the result. agfxSwapChainPresent must be called only after the command buffer that renders to and barriers the back buffer has already been submitted via agfxCommandQueueSubmit — calling it before submit is a synchronization bug.

Resize handling

Resizing is destructive to in-flight GPU work referencing swap chain resources, so always drain first:

cpp
// On a window resize event:
drainGPU(); // see agfx-synchronization — signal + wait until the frame fence catches up
agfxSwapChainResize(device, swapChain, newWidth, newHeight);
renderer.Resize(device, newWidth, newHeight); // resize any render targets sized to match the window
HDR toggle

AGFX has no in-place HDR reconfiguration API — toggling HDR means destroying and recreating the swap chain, then recreating anything downstream whose pipeline format depended on the old back buffer format:

cpp
drainGPU();
agfxSwapChainDestroy(device, swapChain);
swapChainCreateInfo.isHDR = wantHDR;
swapChain = agfxSwapChainCreate(device, &swapChainCreateInfo);
renderer.RecreateTonemapPipeline(device, agfxSwapChainGetFormat(swapChain));
imguiBackend.RecreatePipeline(device, agfxSwapChainGetFormat(swapChain));

Skipping the pipeline recreation step is the most common HDR-toggle bug: the render pass will still bind fine, but color-attachment format mismatch between the pipeline and the actual back buffer produces validation errors on D3D12 and garbage/black output on Metal.

© AmelieHeinrich, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/agfx-presentation-and-swapchain of AmelieHeinrich/agfx.

Open the folder on GitHubat commit d8ad38b

Compare with similar skills

Agfx Presentation And Swapchain next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Agfx Presentation And Swapchain compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Agfx Presentation And Swapchain this skillAmelieHeinrich/agfx146—~2kAutomated safety check: PassMIT
Makepad Platformsickn33/agentic-awesome-skills47k2 repos~1.2kAutomated safety check: PassMIT
Godot Platform Desktopthedivergentai/GD-Agentic-Skills821—~2.8kAutomated safety check: PassLGPL-3.0
Godot Exportgamedev-skills/awesome-gamedev-agent-skills1.4k—~1.4kAutomated safety check: PassApache-2.0
Defold Project Buildselimanac/defold-astar111—~727Automated safety check: PassNone
Godot Export Buildsthedivergentai/GD-Agentic-Skills821—~3kAutomated safety check: PassLGPL-3.0

Similar skills

  • Makepad Platform

    sickn33/agentic-awesome-skills

    CRITICAL: Use for Makepad cross-platform support. An agent skill from sickn33/agentic-awesome-skills.

    47k GitHub starsUsed in 2 repos~1.2k tokens
    Game DevelopmentAuto-check passed
  • Godot Platform Desktop

    thedivergentai/GD-Agentic-Skills

    Expert blueprint for desktop platforms (Windows/Linux/macOS) covering keyboard/mouse controls, settings menus, window management (fullscreen, resolution), keybind remapping, and Steam integration.

    821 GitHub stars~2.8k tokensUpdated 1 mo ago
    Game DevelopmentAuto-check passed
  • Godot Export

    gamedev-skills/awesome-gamedev-agent-skills

    Export and build a Godot 4.7 project for distribution: install export templates, define export presets (Windows/macOS/Linux/Web/Android), run headless command-line exports for CI, and handle web…

    1.4k GitHub stars~1.4k tokensUpdated 2 days ago
    Game DevelopmentAuto-check passed
  • Defold Project Build

    selimanac/defold-astar

    Builds the project using the running Defold editor, returns build errors, and launches the game if build succeeds.

    111 GitHub stars~727 tokensUpdated 5 mo ago
    Game DevelopmentAuto-check passed
  • Godot Export Builds

    thedivergentai/GD-Agentic-Skills

    Expert patterns for multi-platform exports including export templates (Windows/Linux/macOS/Android/iOS/Web), command-line exports (headless mode), platform-specific settings (codesign, notarization…

    821 GitHub stars~3k tokensUpdated 1 mo ago
    DevOps & CloudAuto-check passed
  • Itch Publish

    gamedev-skills/awesome-gamedev-agent-skills

    Publish and update a game on itch.io: create the project page and upload builds with the butler CLI (butler push) to named channels.

    1.4k GitHub stars~1.7k tokensUpdated 2 days ago
    MobileAuto-check passed

More from AmelieHeinrich/agfx

All 8 skills in this repo
  • Agfx Porting From D3d11

    AmelieHeinrich/agfx

    ALWAYS use when porting an existing D3D11 engine or renderer to AGFX — translating ID3D11Device/DeviceContext/InputLayout/state-object code to agfxDevice/agfxCommandBuffer/agfxRenderPipeline calls…

    146 GitHub stars~3.6k tokensUpdated 13 days ago
    Auto-check passed
  • Agfx Porting From D3d12

    AmelieHeinrich/agfx

    ALWAYS use when porting an existing D3D12 engine or renderer to AGFX — translating ID3D12Device/CommandList/PipelineState/RootSignature/DescriptorHeap code to…

    146 GitHub stars~3.4k tokensUpdated 13 days ago
    Auto-check passed
  • Agfx Porting From Opengl

    AmelieHeinrich/agfx

    ALWAYS use when porting an existing OpenGL (or OpenGL ES) engine or renderer to AGFX — translating glGenTextures/glBindTexture/glBufferData/glUseProgram/FBO code to…

    146 GitHub stars~3.8k tokensUpdated 13 days ago
    Auto-check passed
  • Agfx Porting From Vulkan

    AmelieHeinrich/agfx

    ALWAYS use when porting an existing Vulkan engine or renderer to AGFX — translating VkDevice/VkCommandBuffer/VkPipeline/VkDescriptorSet/VkRenderPass code to…

    146 GitHub stars~4.4k tokensUpdated 13 days ago
    Auto-check passed
  • ALWAYS use when creating agfxRenderTarget or agfxRenderPass objects in AGFX, or wiring up color/depth attachments, load/store ops, viewport/scissor, or draw calls within a render pass.

    146 GitHub stars~2.1k tokensUpdated 13 days ago
    Auto-check passed
  • Agfx Synchronization

    AmelieHeinrich/agfx

    ALWAYS use when working with AGFX fences, frames-in-flight pacing, queue signal/wait, resource-state barriers, or the barrier "agglomerate" flag.

    146 GitHub stars~3.6k tokensUpdated 13 days ago
    Auto-check passed

Works with

Questions about Agfx Presentation And Swapchain

What does Agfx Presentation And Swapchain do?

ALWAYS use when creating, resizing, or presenting through an agfxSwapChain in AGFX — window/layer handle setup, HDR toggling, vsync, resize handling, or back buffer acquire/present. Agfx Presentation And Swapchain is an agent skill from AmelieHeinrich/agfx. ALWAYS use when creating, resizing, or presenting through an agfxSwapChain in AGFX — window/layer handle setup, HDR toggling, vsync, resize handling, or back buffer acquire/present.

When should I use Agfx Presentation And Swapchain?

Agfx Presentation And Swapchain fits situations like: presenting through an agfxSwapChain in AGFX — window/layer handle setup; resize handling; back buffer acquire/present; agfxSwapChainCreate/Destroy/Resize/Present.

How do I install Agfx Presentation And Swapchain in Claude Code?

Run `npx skills add AmelieHeinrich/agfx --skill agfx-presentation-and-swapchain -a claude-code`. Or copy the skill folder (.claude/skills/agfx-presentation-and-swapchain in AmelieHeinrich/agfx) into .claude/skills/agfx-presentation-and-swapchain in your project. Claude Code loads it when a task matches its description.

How do I install Agfx Presentation And Swapchain in Codex?

Run `npx skills add AmelieHeinrich/agfx --skill agfx-presentation-and-swapchain -a codex`. Or copy the skill folder (.claude/skills/agfx-presentation-and-swapchain in AmelieHeinrich/agfx) into .agents/skills/agfx-presentation-and-swapchain in your project. Codex loads it when a task matches its description.

Can I use Agfx Presentation And Swapchain in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add AmelieHeinrich/agfx --skill agfx-presentation-and-swapchain -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/agfx-presentation-and-swapchain, .gemini/skills/agfx-presentation-and-swapchain, .github/skills/agfx-presentation-and-swapchain and .opencode/skills/agfx-presentation-and-swapchain in your project.

What does Agfx Presentation And Swapchain need to run?

SKILL.md names no scripts, command-line tools or credentials: Agfx Presentation And Swapchain is instructions for the agent only.

Does Agfx Presentation And Swapchain access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Agfx Presentation And Swapchain safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Agfx Presentation And Swapchain use?

Agfx Presentation And Swapchain is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Agfx Presentation And Swapchain use?

About 2k tokens (SKILL.md is roughly 8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Agfx Presentation And Swapchain?

Skills that share tags, products or a category with Agfx Presentation And Swapchain: Makepad Platform (sickn33/agentic-awesome-skills, 47k stars), Godot Platform Desktop (thedivergentai/GD-Agentic-Skills, 821 stars), Godot Export (gamedev-skills/awesome-gamedev-agent-skills, 1.4k stars) and Defold Project Build (selimanac/defold-astar, 111 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Agfx Presentation And Swapchain?

AmelieHeinrich (a GitHub user) maintains it in AmelieHeinrich/agfx, which has 146 GitHub stars. The repository holds 8 skills in this directory. The repository was last updated on September 27, 2026.

Source: AmelieHeinrich/agfx on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.