Mesh_Renderer carries a colour and the mesh pipeline draws with depth (#70) #102

Merged
crowmaki merged 11 commits from issue-70-mesh-colour-depth into main 2026-09-07 00:05:01 +00:00
Owner

Closes #70.

What

  • Mesh_Renderer gains a colour field defaulting to white. The pipeline copies it into the Push-Constant Prelude payload as Mesh_Payload, and mesh.slang multiplies it with the vertex colour and the Pass tint. The grid-offset logic leaves the shader.
  • The mesh Pass declares a D32_Float depth attachment sized from the swapchain description, cleared to 1.0, and its pipeline enables depth test and write. Headless runs the same declaration against configured defaults.
  • ADR-0005 makes the shader own the attachment count, so the Core Shader Module gains a [DepthAttachment] entry-point attribute. shaderc reflects it into a depth slot after the colour slots, Attachment_Output carries a kind, and Core refuses a wiring whose image format disagrees with the slot's kind. Depth slots do not count against the colour-attachment limit. Every generated Pass Interface is regenerated.
  • The sample writes a white payload and drops its grid payload; the grid itself goes in the sample rewrite.

Resize

A depth buffer sized at init goes stale when the window changes size, which lost the device in a real run. This adds:

  • A resize Hook on Plugin, run by engine_report_resize after the drain in Plugin List Order (ADR-0030).
  • engine_resize_image, legal only inside that Hook; it refuses the Swapchain Target and buffers.
  • The Vulkan backend recreates its swapchain in its own Hook so later Plugins read the new extent, and execute skips a frame whose Schedule predates a swapchain size change.

Verification

  • just check, just build, just test (479 tests) pass.
  • Headless sample dumps the mesh Pass with a colour target and a D32 depth attachment cleared to 1.
  • Windowed sample run with four scripted window resizes: swapchain and depth buffer move together, no validation errors beyond the pre-existing SPIR-V source-language warning that main also emits.

Not in scope

The 4096 grid instances now stack at the origin, as the issue anticipates; the sample rewrite replaces the grid.

Closes #70. ## What - `Mesh_Renderer` gains a `colour` field defaulting to white. The pipeline copies it into the Push-Constant Prelude payload as `Mesh_Payload`, and `mesh.slang` multiplies it with the vertex colour and the Pass tint. The grid-offset logic leaves the shader. - The mesh Pass declares a `D32_Float` depth attachment sized from the swapchain description, cleared to 1.0, and its pipeline enables depth test and write. Headless runs the same declaration against configured defaults. - ADR-0005 makes the shader own the attachment count, so the Core Shader Module gains a `[DepthAttachment]` entry-point attribute. shaderc reflects it into a depth slot after the colour slots, `Attachment_Output` carries a `kind`, and Core refuses a wiring whose image format disagrees with the slot's kind. Depth slots do not count against the colour-attachment limit. Every generated Pass Interface is regenerated. - The sample writes a white payload and drops its grid payload; the grid itself goes in the sample rewrite. ## Resize A depth buffer sized at `init` goes stale when the window changes size, which lost the device in a real run. This adds: - A `resize` Hook on `Plugin`, run by `engine_report_resize` after the drain in Plugin List Order (ADR-0030). - `engine_resize_image`, legal only inside that Hook; it refuses the Swapchain Target and buffers. - The Vulkan backend recreates its swapchain in its own Hook so later Plugins read the new extent, and `execute` skips a frame whose Schedule predates a swapchain size change. ## Verification - `just check`, `just build`, `just test` (479 tests) pass. - Headless sample dumps the mesh Pass with a colour target and a `D32` depth attachment cleared to 1. - Windowed sample run with four scripted window resizes: swapchain and depth buffer move together, no validation errors beyond the pre-existing SPIR-V source-language warning that main also emits. ## Not in scope The 4096 grid instances now stack at the origin, as the issue anticipates; the sample rewrite replaces the grid.
crowmaki deleted branch issue-70-mesh-colour-depth 2026-09-07 00:05:01 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
crowmaki/cinnabar!102
No description provided.