Repository navigation
feat(render): add 3D mesh staging uploads and camera-relative occlusion - #13
Merged
Merged
Conversation
…ollback upload_mesh on insert error, harden GPU tests
brasga-a
force-pushed
the
feat/m2-p3-render-triangle
branch
from
November 18, 2026 17:03
945155f to
87462e8
Compare
brasga-a
force-pushed
the
feat/m2-p4-render-mesh
branch
from
November 18, 2026 17:03
ff59bc3 to
46330aa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Milestone 2 — Phase 4 (
spawn-render: static 3D vertex/index staging uploads, indexed draws, and camera-relative reversed-Z occlusion), stacked onfeat/m2-p3-render-triangle(#12).ADR-0004,ADR-0010,SPN-INV-006,SPN-INV-009,SPN-INV-011,SPN-INV-023):spawn-render -> spawn-math(default-features = false; headlessspawn-renderpulls only pure-Rustspawn-math -> libmwith zero window/GPU or C/FFI crates).bytemuck = 1.25.2(default-features = false,features = ["derive"],MIT OR Apache-2.0 OR Zlib) behind optional featurevulkan, strictly confined inside privatecrates/spawn-render/src/vulkan/mesh.rswith zero public API leakage (SPN-INV-011).crates/spawn-render/src/{mesh,handle,types}.rs):#![forbid(unsafe_code)]and#![deny(clippy::indexing_slicing)].MeshVertex(40B:position,normal,color),MeshDescriptor::validate(REND-0014pre-allocation bounds/multiplicity/finiteness/index-range checks), generationalMeshHandle(REND-0013),GraphicsPipelineDescriptor::new_mesh_3d,CameraRelativeView,MeshDraw(from_worldsubtractingWorldPosinf64on the CPU viaspawn_math::camera_relative_f32perSPN-INV-052), andPackedMeshPushConstants(128B matchingshaders/mesh_3d.slang).crates/spawn-render/src/vulkan/{mesh,memory,frame,pipeline,mod}.rs,src/renderer.rs):Renderer::{upload_mesh, destroy_mesh, render_meshes, render_offscreen_meshes}: suballocatesHOST_VISIBLE | HOST_COHERENTstaging buffers andDEVICE_LOCALVERTEX_BUFFER+INDEX_BUFFERbuffers withVK_EXT_debug_utilslabels, recordsvkCmdCopyBuffer2+synchronization2VkBufferMemoryBarrier2(COPY/TRANSFER_WRITE -> VERTEX_ATTRIBUTE_INPUT/INDEX_INPUT), retires staging and destroyed mesh buffers on the timeline semaphore, pushes128-byteMeshPushConstants, and executesvkCmdDrawIndexedacross bothCOLOR_ATTACHMENT-only swapchains (SPN-INV-092) andR8G8B8A8_UNORMoffscreen readback targets.Requirements Covered
F3D-FR-02,F3D-FR-06,F3D-FR-07,F3D-FR-08,F3D-FR-10,F3D-FR-12F3D-NFR-01..07F3D-T12, Phase 4F3D-T13,FND-T09(withFND-T01..T10andF3D-T01..T04, T06..T09, T11remaining green)Invariants Touched
SPN-INV-006,SPN-INV-009,SPN-INV-011,SPN-INV-020..023,SPN-INV-030,SPN-INV-033,SPN-INV-034,SPN-INV-035,SPN-INV-050..053,SPN-INV-083,SPN-INV-084,SPN-INV-091,SPN-INV-092,SPN-INV-100,SPN-INV-101F3D-INV-01..04,F3D-INV-06,F3D-INV-07,F3D-INV-11..16ADR-0020andADR-0022remainProposed(SPN-INV-101).Tests Run
slangc2026.22(PATH="$HOME/.local/bin:$PATH" ./scripts/check.sh):cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace(51spawn-renderunit tests +7shader_validation+1f3d_t13_render_hygiene+FND-T01..T10+F3D-T01..T04, T06..T09),cargo doc --workspace --no-deps,cargo doc -p spawn-render --features vulkan --no-deps,cargo deny check(advisories ok, bans ok, licenses ok, sources ok) -> exit0.slangc(PATH="/usr/bin:/usr/local/bin:/bin:$HOME/.cargo/bin" ./scripts/check.sh):0.cargo check --manifest-path crates/spawn-render/fuzz/Cargo.toml):0.PATH="$HOME/.local/bin:$PATH" VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_KHRONOS_VALIDATION_VALIDATE_SYNC=true cargo test -p spawn-render --features vulkan -- --ignored):7/7passed (validation_enabled: true,0validation/sync errors,0leaked allocations):vulkan::gpu_tests(4/4Foundation headless-surface tests)f3d_t11_triangle_gpu(1/1)f3d_t12_mesh_occlusion_gpu(2/2: exercises both self-contained synthesized SPIR-V 1.6 and liveslangc 2026.22-cookedshaders/mesh_3d.slangfor-2.0 mvs-5.0 mfar-after-near occlusion across finite & infinite reversed-Z projections,+Yworld-up top orientation,CullMode::Backbackface culling + directional-shaded 24-vertex 3D cube, byte-exact129x129RGBA8 equivalence betweenWorldPos::ORIGINandWorldPos(50_000, -50_000, 50_000)at2 mmseparation, headless swapchain multi-mesh resize/0x0suspend/resume, and negativeREND-0012..0014unwind checks; also verified self-contained withtarget/shadersremoved andslangcoffPATH).Platforms Tested & Known Limitations
7.2.15-1-omarchy), AMD Ryzen 5 1600, AMD Radeon RX 460 (RADV POLARIS11, Mesa26.2.5-arch1.1, Vulkan1.4.354), pinnedslangc2026.22,VK_LAYER_KHRONOS_validation+VK_KHRONOS_VALIDATION_VALIDATE_SYNC=true.f64FreeCameraandspawn-engineWayland 3D session (PLANNEDfor Phase 5); compositors other than Hyprland; GPUs other than RX 460; X11 and Windows (PLANNED); separate transfer queues, descriptor binding tables, render graph, and materials (PLANNEDfor subsequent milestones).