Repository navigation
feat(render): Milestone 2 Phase 3 — GPU block suballocator, D32_SFLOAT reversed-Z depth & dynamicRendering triangle - #12
Merged
Conversation
…, and dynamicRendering triangle
brasga-a
force-pushed
the
feat/m2-p2-shader-cook
branch
from
November 18, 2026 17:03
359c9fc to
c3bc712
Compare
brasga-a
force-pushed
the
feat/m2-p3-render-triangle
branch
from
November 18, 2026 17:03
945155f to
87462e8
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 3 (
crates/spawn-render+examples/vulkan_triangle.rs), stacked cleanly onfeat/m2-p2-shader-cook(359c9fc):src/selection.rs,src/vulkan/device.rs):VK_FORMAT_D32_SFLOATsupport forVK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT,maxPushConstantsSize >= 128, vertex-input limits (maxVertexInputAttributes >= 3,maxVertexInputBindings >= 1,maxVertexInputBindingStride >= 40), andtimelineSemaphorealongsidesynchronization2anddynamicRendering, reporting every missing requirement per GPU underREND-0003.src/allocator.rs,src/vulkan/memory.rs,ADR-0004decision 3):PureGpuAllocator(default-features = false,#![forbid(unsafe_code)],#![deny(clippy::indexing_slicing)]) paired withVulkanMemoryAllocator(16 MiBDEVICE_LOCALblocks + persistently mapped4 MiBHOST_VISIBLE | HOST_COHERENTblocks, dedicated oversized block fallback, configurableGpuMemoryBudgetreturning locatedREND-0012GpuMemoryExhaustedon exhaustion).bufferImageGranularitypage separation between linear (VkBuffer) and optimal (VkImage) suballocations, deterministically coalesces adjacent freed ranges without fragmentation, retires Vulkan child handles and suballocations on the timeline semaphore (completed_timeline >= last_used_timeline) beforevkFreeMemory, and verifies zero leaks on shutdown.D32_SFLOATreversed-Z depth (src/depth.rs,src/vulkan/{frame,mod}.rs):DepthAttachmentController+DEVICE_LOCALVK_FORMAT_D32_SFLOATdepth image/view (REVERSED_Z_CLEAR_DEPTH = 0.0, never allocated at0x0whileSuspended, idempotent extent reuse/recreation across resize and surface recovery).imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BITonly (SPN-INV-092).dynamicRenderingpipelines & offscreen RGBA8 readback (src/handle.rs,src/vulkan/pipeline.rs,examples/vulkan_triangle.rs):ShaderHandle,PipelineHandle, andOffscreenTargetHandle(SPN-INV-035: stale, destroyed, or forged handles return locatedREND-0013InvalidResourceHandle; invalid descriptors returnREND-0014InvalidResourceDescriptor)..spnshdrartifacts viaCookedShader::from_bytesandvalidate_graphics_pipeline_shadersBEFOREvkCreateShaderModule(SPN-INV-034).VkPipelineRenderingCreateInfo(zeroVkRenderPass/VkFramebuffer):TRIANGLE_LIST,VK_FRONT_FACE_COUNTER_CLOCKWISE,VK_CULL_MODE_BACK_BIT, reversed-ZVK_COMPARE_OP_GREATER_OR_EQUAL, positive-height[0.0, 1.0]VkViewport,synchronization2barriers, andVK_EXT_debug_utilsnames on memory blocks, buffers, depth/offscreen images, views, shader modules, pipeline layouts, and pipelines.DEVICE_LOCALVK_FORMAT_R8G8B8A8_UNORM(COLOR_ATTACHMENT | TRANSFER_SRC) +D32_SFLOAToffscreen targets withvkCmdCopyImageToBuffer2(COPY -> HOST_READbarrier) into suballocatedHOST_VISIBLE | HOST_COHERENTbuffers, plusexamples/vulkan_triangle.rs(keepingexamples/vulkan_clear.rsintact).Requirements Covered
F3D-FR-05(cooked-shader + layout validation before GPU shader module/pipeline creation)F3D-FR-06(in-house GPU block suballocator, staging/readback host-visible blocks, timeline retirement, leak-free shutdown)F3D-FR-07(VK_FORMAT_D32_SFLOATreversed-Z depth attachment across resize,0x0suspend, and recovery)F3D-FR-08(Vulkan 1.3dynamicRenderingtriangle pass, CCW front-face, backface culling, offscreen readback)F3D-FR-12(locatedRenderErrorsREND-0012..0014with#[track_caller]and reverse-order unwind)F3D-NFR-01..07(genre neutrality, zero new crate edges, zero default-feature third-party deps,#![forbid(unsafe_code)]outsidesrc/vulkan/, zero Khronos validation/sync errors, recorded reference-hardware smoke evidence)Tests Run
./scripts/check.sh) withslangc2026.22onPATHand headless withoutslangc:PATH="$HOME/.local/bin:$PATH" ./scripts/check.sh→ exit0PATH="/usr/bin:/usr/local/bin:/bin:$HOME/.cargo/bin" ./scripts/check.sh→ exit0F3D-T08(allocator.rsunit +proptest+instaOOM snapshot),F3D-T09(depth.rslifecycle +selection.rsrejections), Phase 3F3D-T13(tests/f3d_t13_render_hygiene.rs),F3D-T01..T04,F3D-T06..T07,FND-T01..T10,cargo clippy --all-targets -- -D warnings,RUSTDOCFLAGS="-D warnings" cargo doc, andcargo deny check.cargo check --manifest-path crates/spawn-render/fuzz/Cargo.toml→ exit0VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_KHRONOS_VALIDATION_VALIDATE_SYNC=true cargo test -p spawn-render --features vulkan -- --ignored→5/5passed (4Foundation headless-surface tests +tests/f3d_t11_triangle_gpu.rsF3D-T11: offscreen65x65R8G8B8A8_UNORMCCW triangle readback[153, 115, 102, 255]center &[13, 26, 38, 255]corners, CW backface culling, reversed-Zz = 0.0vs clippedz = -0.25, negative shader/layout/stale-handle/OOM checks, headless swapchain resize/0x0suspend,validation_errors=0,0leaked blocks/suballocations).vulkan_trianglesmoke run & missing-shader probe:PATH="$HOME/.local/bin:$PATH" cargo run -p spawn-cli -- shaders build && SPAWN_SMOKE_SECONDS=3 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_KHRONOS_VALIDATION_VALIDATE_SYNC=true cargo run --example vulkan_triangle976x512, handled live Hyprland tiling resize to968x504inside a single16 MiB(16,777,216 B)DEVICE_LOCALblock (blocks=1,live_allocs=1,live_bytes=2,129,928,peak_block_bytes=16,777,216),presented=157,suspended=0,skipped=0,validation_errors=0, clean close (shutdown_blocks=0,shutdown_live_allocs=0,shutdown_retired_allocs=0, exit0).SPAWN_SHADER_DIR=/tmp/nonexistent_spawn_shaders): actionable diagnostic naming missing.spnshdrpath, exit1, no panic.Platforms Tested
7.2.15-1-omarchy), Hyprland0.56.2(Wayland native), AMD Ryzen 5 1600, AMD Radeon RX 460 (RADV POLARIS11, Mesa26.2.5-arch1.1, Vulkan1.4.354),VK_LAYER_KHRONOS_validation+VK_KHRONOS_VALIDATION_VALIDATE_SYNC=true, pinnedslangc2026.22, Rust1.99.1.Invariants Touched / Verified
SPN-INV-001..006,009,011,020..023,030..035,050,053,081,083..084,090..092,100..101F3D-INV-01..04,07,09,11..16ADR-0020andADR-0022remainProposed.Known Limitations
spawn-render -> spawn-mathdependency edge, static vertex/index buffer staging uploads (vkCmdCopyBuffer2), and indexed camera-relative 3D mesh occlusion (F3D-T12) arePLANNEDfor Phase 4.f64free-fly camera simulation andalpha-interpolated procedural 3D scene (F3D-T05,F3D-T10) arePLANNEDfor Phase 5.PLANNED); Linux/Wayland on Hyprland + RADV RX 460 is the only smoke-tested native target.