Skip to content

Apply --screenshot to all Vulkan projects#152

Open
loosche wants to merge 1 commit intomainfrom
feature/screenshot-vulkan
Open

Apply --screenshot to all Vulkan projects#152
loosche wants to merge 1 commit intomainfrom
feature/screenshot-vulkan

Conversation

@loosche
Copy link
Copy Markdown
Collaborator

@loosche loosche commented Apr 15, 2026

Summary

  • Adds SaveVulkanImageAsPNG() to vk_renderer.h/cpp, mirroring the existing SaveMetalTextureAsPNG. It creates a CPU-readable staging buffer, transitions the swapchain image to TRANSFER_SRC, copies via vkCmdCopyImageToBuffer, transitions back to PRESENT, swaps BGRA→RGBA channels, forces alpha to 255, and saves with BitmapRGBA8u::Save()
  • Wires --screenshot <path> [frame] and the updated --auto-exit guard into every Vulkan project's main loop (43 projects across geometry, pbr, texture, raytracing, and io categories)
  • Adds bitmap.h/bitmap.cpp to each project's CMakeLists, and the stb include path to the early raytracing projects (000–006) that were missing it

Test plan

  • Build all Vulkan targets and confirm no new errors
  • ./101_color_cube_vulkan --screenshot /tmp/out.png 0 — captures frame 0, exits immediately, produces a valid 1280×720 RGBA PNG
  • ./030_raytracing_path_trace_vulkan --screenshot /tmp/out.png 100 — runs to frame 100, captures, exits
  • ./031_raytracing_path_trace_pbr_vulkan --screenshot /tmp/out.png 100 — same
  • --auto-exit without a frame target still exits after N seconds as before

🤖 Generated with Claude Code

Adds SaveVulkanImageAsPNG to the shared vk_renderer, mirroring
SaveMetalTextureAsPNG. Wires --screenshot / --auto-exit into the main
loop of every Vulkan project: frameIndex tracking, auto-exit guard
updated to respect screenshotFrame, and screenshot block inserted
between WaitForGpu and SwapchainPresent.

Also adds bitmap.h/bitmap.cpp to each project's CMakeLists (and the
stb include path to early raytracing projects that were missing it).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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