Closed seabassjh closed 2 years ago
This is awesome! Thank you for the contribution!
The existing Cornell box example has double the LOC and isn't as clear so this will be super useful for first-time users. I'm ready to merge it but I want to provide this feedback in case you plan on making any changes:
ray_trace.rs
example however for this one if you had some inspiration/source that would be fine to add.vk::BufferUsageFlags::STORAGE_BUFFER
is required for any of these buffers.let image =
does not need to be outside the event loop; inside the loop would prevent needing to use the Option<Arc<..>>
wrapper. Either way usage of the leased image is identical.image
/image_node
may be removed entirely, along with .copy_image(image_node, frame.swapchain_image)
if you write descriptor 1 directly to frame.swapchain_image
.These changes are not required and certainly could serve as places for new users to modify existing code to suit their needs.
Actually I referenced this, it's in C++ and is a bit old (still used the NV rt extension) but it covers the fundamentals nicely. I will change the link to this if you think it's good enough!
And those suggestions sounds good; will update the PR for them.
Also, I have a local branch with a working proof-of-concept for compiling the example shaders to SPIRV at runtime using shaderc
, so we don't have to scroll through all that inlined shader code and they can be nested away in their own dedicated files. Do you think this would be a valuable contribution?
LGTM 😊
Compiling shaders at runtime would be a fine example; especially if it showed ways you could reload a shader and update a pipeline (create a new one, drop the old one). I do like the inline-spirv
crate in the basic examples because it puts all the code right in one place for example purposes. I wouldn't use it in a real program because it increases build times for things which don't change often.
Another strategy is shown in the shader-toy
example which uses build.rs
to compile when shaders change (using shaderc
).
- I don't believe
vk::BufferUsageFlags::STORAGE_BUFFER
is required for any of these buffers.
Update: This was incorrect advice - a recent update to the Vulkan SDK added validation errors for the scratch buffers unless they include this. See 2b28faa.
Adds the "hello world of graphics" triangle to examples. Similar to the existing
triangle.rs
but this one is ray-traced.