animated example
This commit is contained in:
parent
216972e73a
commit
c9fd1b1585
17 changed files with 576 additions and 465 deletions
|
|
@ -1,25 +1,38 @@
|
|||
# HelloWindow Example
|
||||
# VulkanTriangle
|
||||
|
||||
## Description
|
||||
The minimal ray-traced example. Renders a single static triangle through
|
||||
`vkCmdTraceRaysKHR`. No UI.
|
||||
|
||||
This example demonstrates how to load shaders and render a triangle.
|
||||
## What it shows
|
||||
|
||||
## Expected Result
|
||||
- `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.
|
||||
|
||||
A blue tinted vulkan window with a white triangle in the center.
|
||||
It's the smallest sensible test of the bindless `VK_EXT_descriptor_heap`
|
||||
+ ray-tracing path.
|
||||
|
||||
## Highlighted Code Snippet
|
||||
|
||||
```cpp
|
||||
EventListener<VkCommandBuffer> listener(&window.onDraw, [&descriptors, &meshShader](VkCommandBuffer cmd){
|
||||
vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, Pipeline::pipelineLayout, 0, 2, &descriptors.set[0], 0, NULL);
|
||||
vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, Pipeline::pipeline);
|
||||
Device::vkCmdDrawMeshTasksEXTProc(cmd, meshShader.threadCount, 1, 1);
|
||||
});
|
||||
```
|
||||
|
||||
## How to Run
|
||||
## Run
|
||||
|
||||
```bash
|
||||
crafter-build build executable -r
|
||||
```
|
||||
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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue