Crafter.Graphics/examples/VulkanTriangle/README.md

38 lines
1.2 KiB
Markdown
Raw Normal View History

2026-05-02 00:03:24 +02:00
# VulkanTriangle
2025-06-13 23:59:36 +02:00
2026-05-02 00:03:24 +02:00
The minimal ray-traced example. Renders a single static triangle through
`vkCmdTraceRaysKHR`. No UI.
2025-06-13 23:59:36 +02:00
2026-05-02 00:03:24 +02:00
## What it shows
2025-06-13 23:59:36 +02:00
2026-05-02 00:03:24 +02:00
- `Device::Initialize()` + `Window` + swapchain bring-up.
- A `DescriptorHeapVulkan` sized for one image + one buffer slot, with
slot ranges allocated via the bump-allocator API
(`AllocateImageSlots`, `AllocateBufferSlots`).
- A `PipelineRTVulkan` built from raygen / miss / closesthit SPIR-V
shaders compiled at build time.
- `Mesh::Build` constructing a BLAS and `RenderingElement3D::BuildTLAS`
the per-frame TLAS.
- Direct descriptor writes via `vkWriteResourceDescriptorsEXT` for the
swapchain views and TLAS device addresses.
- `RTPass{&pipeline}` plugged into `window.passes` — the canonical
way to add ray tracing to a window in this library.
2025-06-13 23:59:36 +02:00
2026-05-02 00:03:24 +02:00
It's the smallest sensible test of the bindless `VK_EXT_descriptor_heap`
+ ray-tracing path.
2025-06-13 23:59:36 +02:00
2026-05-02 00:03:24 +02:00
## Run
2025-06-13 23:59:36 +02:00
```bash
2026-05-02 00:03:24 +02:00
cd examples/VulkanTriangle
crafter-build -r
```
You should see a 1280×720 window with a triangle filling roughly the
centre.
## Notes
`raygen.glsl`'s `traceRayEXT` call is currently commented out — the
example exercises the dispatch and `imageStore` paths only. Uncomment
it to actually trace into the BLAS.