Skip to content

win32: Config.GPU on Windows, a flip-model swap chain on the HWND (D4) - #161

Merged
tannevaled merged 2 commits into
mainfrom
d4-win32-gpu
Nov 10, 2026
Merged

tannevaled merged 2 commits into
mainfrom
d4-win32-gpu

Conversation

@tannevaled

@tannevaled tannevaled commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Config.GPU on Windows (D4 of go-gfx/gpu2d docs/NATIVE.md), opt-in, mirroring the Cocoa and Linux paths: gpu2d v0.11.0's Direct3D 11 renderer draws the frame and a flip-model swap chain on the window's HWND presents it; any failure falls back to GDI (GPU and GPUError say which happened).

Live proof on windows-latest (WARP, no GPU): a real window; the back buffer, read through staging just before the swap chain presents it, equals the CPU path's frame byte for byte at 320 x 200 and after a resize to 504 x 381. A device that will not start and a refused frame both fall back to GDI (tested). Not observed: what a screen showed (no one looks at a hosted runner), any real GPU, native child controls over a swap chain. Recorded in go-gfx/gpu2d#37.

🤖 Generated with Claude Code

tannevaled and others added 2 commits November 10, 2026 21:51
Opt-in, mirroring the Cocoa path (gpuPath, startGPU at Run, presentGPU,
resizeGPU, stopGPU, GPU, GPUError, the CPU from then on): the widgets record
into a gpu2d list through gpupainter, gpu2d v0.11.0's Direct3D 11 renderer
draws it and Present copies it into the back buffer of a flip swap chain on the
window. While the swap chain exists WM_PAINT only validates (flip model: GDI
content is ignored); on any failure the swap chain and device are released and
the frame is drawn by GDI again.

The live test runs on windows-latest with WARP: a real window, the back buffer
read just before the swap chain presents it equals the CPU path's frame, through
a resize; a device that will not start and a refused frame fall back.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit af700d6 into main Nov 10, 2026
29 checks passed
@tannevaled
tannevaled deleted the d4-win32-gpu branch November 10, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant