UI pass, offscreen surfaces and readback #37

Open
UnflavoredMeson/Primal_Plus_Plus
opened 2026-11-24 20:15:59 +00:00 by UnflavoredMeson · 0 comments
Owner

Why

The editor (S7) draws its UI through the renderer and shows viewports as textures, and thumbnails need to read pixels back.

Decided

  • A UI pass per surface (SurfaceFrame::ui), drawn after post-processing: textured triangles with clip rectangles (what Dear ImGui produces).
  • Offscreen surfaces (graphics::create_offscreen_surface()), rendered in render_frame(), shown in the UI pass by UiDrawCommand::surface_id.
  • graphics::request_readback() for thumbnails and tests.

Read first

Steps

  • 1. Write the UI pass on both backends with a GraphicsTests case drawing two clipped quads.
  • 2. Add offscreen surfaces and a test that shows one inside another.
  • 3. Add readback and compare a pixel.

Done when

  • The tests pass on both backends with validation clean; 0 warnings; tidy 0.

Claude can help with

  • The vertex layout and the clip rectangle math.

Learn

  • How an immediate-mode UI turns into draw lists.
## Why The editor (S7) draws its UI through the renderer and shows viewports as textures, and thumbnails need to read pixels back. ## Decided - A UI pass per surface (`SurfaceFrame::ui`), drawn after post-processing: textured triangles with clip rectangles (what Dear ImGui produces). - Offscreen surfaces (`graphics::create_offscreen_surface()`), rendered in `render_frame()`, shown in the UI pass by `UiDrawCommand::surface_id`. - `graphics::request_readback()` for thumbnails and tests. ## Read first - [Editor](https://forgejo.unflavoredmeson.com/UnflavoredMeson/Primal_Plus_Plus/wiki/Editor), sections 5.3 and 9. ## Steps - [ ] 1. Write the UI pass on both backends with a GraphicsTests case drawing two clipped quads. - [ ] 2. Add offscreen surfaces and a test that shows one inside another. - [ ] 3. Add readback and compare a pixel. ## Done when - [ ] The tests pass on both backends with validation clean; 0 warnings; tidy 0. ## Claude can help with - The vertex layout and the clip rectangle math. ## Learn - How an immediate-mode UI turns into draw lists.
Sign in to join this conversation.
No assignees
No project
No milestone
Blocks
#39 Dear ImGui in the engine
UnflavoredMeson/Primal_Plus_Plus
#68 Game UI on the UI pass
UnflavoredMeson/Primal_Plus_Plus
Depends on
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
UnflavoredMeson/Primal_Plus_Plus#37
No description provided.