Skip to content

feat: add image/texture infrastructure for visualization#4

Open
mtao wants to merge 2 commits intofeature/meshdata-quiver-refactorfrom
feature/image-infrastructure
Open

feat: add image/texture infrastructure for visualization#4
mtao wants to merge 2 commits intofeature/meshdata-quiver-refactorfrom
feature/image-infrastructure

Conversation

@mtao
Copy link
Copy Markdown
Owner

@mtao mtao commented Mar 28, 2026

Summary

  • Add complete image/texture infrastructure to balsa's visualization subsystem, implementing Phase 1 and Phase 2 of the art-viewer plan
  • Introduces VulkanTexture (RAII GPU texture with full and partial upload), ImageData (CPU pixel buffer scene graph feature with version-tracked dirty regions), ImagePipelineManager (Vulkan pipeline with fullscreen triangle, descriptor sets, per-frame UBOs), VulkanImageDrawable (syncs ImageData to GPU texture per frame), and ImageScene (orthographic 2D viewer with pan/zoom/fit)
  • Adds HDR tone mapping shaders (exposure/gamma in fragment shader), ImGui controls panel, PPM I/O (P6 binary), and a standalone image_viewer_glfw tool with scroll-zoom and middle-drag pan

New Files (21 files, ~3000 LOC)

Headers

  • visualization/include/balsa/visualization/vulkan/texture.hpp — VulkanTexture RAII wrapper
  • visualization/include/balsa/scene_graph/ImageData.hpp — CPU pixel buffer feature (RGBA8/RGBAF32, dirty tracking)
  • visualization/include/balsa/visualization/vulkan/image_pipeline.hpp — Pipeline manager + UBO structs
  • visualization/include/balsa/visualization/vulkan/vulkan_image_drawable.hpp — Per-frame GPU sync drawable
  • visualization/include/balsa/visualization/vulkan/image_scene.hpp — Orthographic 2D image scene
  • visualization/include/balsa/visualization/vulkan/imgui/image_controls_panel.hpp — ImGui controls
  • visualization/include/balsa/visualization/image_io.hpp — PPM I/O declarations

Implementations

  • visualization/src/vulkan/texture.cpp — Full VulkanTexture (create, upload, update_region, layout transitions)
  • visualization/src/scene_graph/ImageData.cpp — Pixel buffer management with dirty region merging
  • visualization/src/vulkan/image_pipeline.cpp — Descriptor layout, pool, pipeline creation, shader compilation
  • visualization/src/vulkan/vulkan_image_drawable.cpp — Version-tracked sync, partial texture updates
  • visualization/src/vulkan/image_scene.cpp — Scene lifecycle, orthographic projection, pan/zoom
  • visualization/src/vulkan/imgui/image_controls_panel.cpp — Exposure/gamma/channel/zoom/pan controls
  • visualization/src/image_io.cpp — PPM P6 reader/writer (RGB→RGBA expansion)

Shaders

  • visualization/resources/glsl/image.vert — Fullscreen triangle via gl_VertexIndex
  • visualization/resources/glsl/image.frag — HDR tone mapping + channel isolation

Tools

  • visualization/tools/image_viewer_glfw.cpp — Standalone viewer with CLI11, ImGui overlay

Tests

  • 15 new test cases in test_scene_graph.cpp covering ImageData (creation, RGBA8/RGBAF32 pixels, version tracking, partial updates, dirty region merging, display parameters, error cases) and PPM I/O (round-trip, error handling)

Motivation

This lays the foundation for:

  1. ART ray tracer live preview — progressive rendering with partial texture updates
  2. MultiscreenManga comic reader port — image display with pan/zoom

Testing

All 8 balsa test suites pass (44 scene_graph test cases, 312 assertions total).

mtao added 2 commits March 27, 2026 22:26
Add VulkanTexture (RAII GPU texture with full/partial upload),
ImageData (CPU pixel buffer scene graph feature with dirty tracking),
ImagePipelineManager (descriptor sets, UBOs, fullscreen triangle pipeline),
VulkanImageDrawable (per-frame sync from ImageData to GPU texture),
ImageScene (orthographic 2D viewer with pan/zoom/fit-to-window),
image shaders (fullscreen triangle + HDR tone mapping fragment shader),
ImGui image controls panel (exposure/gamma/channel/zoom/pan),
PPM I/O (P6 binary reader/writer, RGB->RGBA expansion),
image_viewer_glfw standalone tool (CLI11, scroll-zoom, middle-drag pan),
and unit tests for ImageData and PPM I/O (15 new test cases).

This lays the foundation for ART ray tracer live preview and
the MultiscreenManga comic reader port.
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