From 6fb2c13c52c517887ec48dbe05373ac97570fd50 Mon Sep 17 00:00:00 2001 From: Chuigda Date: Tue, 26 Sep 2023 09:21:21 +0800 Subject: [PATCH] descriptor layout -> descriptor set layout --- tutorial/Cargo.toml | 4 ++-- tutorial/book/src/SUMMARY.md | 2 +- tutorial/book/src/dynamic/recycling_command_buffers.md | 2 +- tutorial/book/src/texture/combined_image_sampler.md | 2 +- tutorial/book/src/uniform/descriptor_pool_and_sets.md | 6 +++--- ...ut_and_buffer.md => descriptor_set_layout_and_buffer.md} | 2 +- ...{21_descriptor_layout.rs => 21_descriptor_set_layout.rs} | 0 7 files changed, 9 insertions(+), 9 deletions(-) rename tutorial/book/src/uniform/{descriptor_layout_and_buffer.md => descriptor_set_layout_and_buffer.md} (98%) rename tutorial/src/{21_descriptor_layout.rs => 21_descriptor_set_layout.rs} (100%) diff --git a/tutorial/Cargo.toml b/tutorial/Cargo.toml index b3ce8909..6b314fcc 100644 --- a/tutorial/Cargo.toml +++ b/tutorial/Cargo.toml @@ -133,8 +133,8 @@ path = "src/20_index_buffer.rs" [[bin]] -name = "21_descriptor_layout" -path = "src/21_descriptor_layout.rs" +name = "21_descriptor_set_layout" +path = "src/21_descriptor_set_layout.rs" [[bin]] diff --git a/tutorial/book/src/SUMMARY.md b/tutorial/book/src/SUMMARY.md index dc3259e9..1c265a3e 100644 --- a/tutorial/book/src/SUMMARY.md +++ b/tutorial/book/src/SUMMARY.md @@ -46,7 +46,7 @@ # Uniform buffers -- [Descriptor layout and buffer](./uniform/descriptor_layout_and_buffer.md) +- [Descriptor set layout and buffer](./uniform/descriptor_set_layout_and_buffer.md) - [Descriptor pool and sets](./uniform/descriptor_pool_and_sets.md) # Texture mapping diff --git a/tutorial/book/src/dynamic/recycling_command_buffers.md b/tutorial/book/src/dynamic/recycling_command_buffers.md index 569772f1..f1ac8ab3 100644 --- a/tutorial/book/src/dynamic/recycling_command_buffers.md +++ b/tutorial/book/src/dynamic/recycling_command_buffers.md @@ -49,7 +49,7 @@ unsafe fn render(&mut self, window: &Window) -> Result<()> { } ``` -Note that we do need to be careful about when we call `update_command_buffer`. This method will reset the command buffer which could cause serious issues if the command buffer is still being used to render a previously submitted frame. This issue was also discussed in the [`Descriptor layout and buffer` chapter](../uniform/descriptor_layout_and_buffer.html#updating-uniform-data) which is why the call to `App::update_uniform_buffer` is where it is. As discussed in more detail in that chapter, both of these calls only happen after the call to `wait_for_fences` which waits for the GPU to be done with the acquired swapchain image and its associated resources so we are safe to do whatever we want with the command buffer. +Note that we do need to be careful about when we call `update_command_buffer`. This method will reset the command buffer which could cause serious issues if the command buffer is still being used to render a previously submitted frame. This issue was also discussed in the [`Descriptor set layout and buffer` chapter](../uniform/descriptor_set_layout_and_buffer.html#updating-uniform-data) which is why the call to `App::update_uniform_buffer` is where it is. As discussed in more detail in that chapter, both of these calls only happen after the call to `wait_for_fences` which waits for the GPU to be done with the acquired swapchain image and its associated resources so we are safe to do whatever we want with the command buffer. In the new method, reset the command buffer with `reset_command_buffer`. diff --git a/tutorial/book/src/texture/combined_image_sampler.md b/tutorial/book/src/texture/combined_image_sampler.md index 7fa25b08..e46233a3 100644 --- a/tutorial/book/src/texture/combined_image_sampler.md +++ b/tutorial/book/src/texture/combined_image_sampler.md @@ -4,7 +4,7 @@ We looked at descriptors for the first time in the uniform buffers part of the tutorial. In this chapter we will look at a new type of descriptor: *combined image sampler*. This descriptor makes it possible for shaders to access an image resource through a sampler object like the one we created in the previous chapter. -We'll start by modifying the descriptor layout, descriptor pool and descriptor set to include such a combined image sampler descriptor. After that, we're going to add texture coordinates to `Vertex` and modify the fragment shader to read colors from the texture instead of just interpolating the vertex colors. +We'll start by modifying the descriptor set layout, descriptor pool and descriptor set to include such a combined image sampler descriptor. After that, we're going to add texture coordinates to `Vertex` and modify the fragment shader to read colors from the texture instead of just interpolating the vertex colors. ## Updating the descriptors diff --git a/tutorial/book/src/uniform/descriptor_pool_and_sets.md b/tutorial/book/src/uniform/descriptor_pool_and_sets.md index e8543d60..c97c812e 100644 --- a/tutorial/book/src/uniform/descriptor_pool_and_sets.md +++ b/tutorial/book/src/uniform/descriptor_pool_and_sets.md @@ -2,7 +2,7 @@ **Code:** [main.rs](https://github.com/KyleMayes/vulkanalia/tree/master/tutorial/src/22_descriptor_sets.rs) -The descriptor layout from the previous chapter describes the type of descriptors that can be bound. In this chapter we're going to create a descriptor set for each `vk::Buffer` resource to bind it to the uniform buffer descriptor. +The descriptor set layout from the previous chapter describes the type of descriptors that can be bound. In this chapter we're going to create a descriptor set for each `vk::Buffer` resource to bind it to the uniform buffer descriptor. ## Descriptor pool @@ -104,7 +104,7 @@ unsafe fn create_descriptor_sets(device: &Device, data: &mut AppData) -> Result< } ``` -A descriptor set allocation is described with a `vk::DescriptorSetAllocateInfo` struct. You need to specify the descriptor pool to allocate from and an array of descriptor layouts that describes each of the descriptor sets you are allocating: +A descriptor set allocation is described with a `vk::DescriptorSetAllocateInfo` struct. You need to specify the descriptor pool to allocate from and an array of descriptor set layouts that describes each of the descriptor sets you are allocating: ```rust,noplaypen let layouts = vec![data.descriptor_set_layout; data.swapchain_images.len()]; @@ -291,7 +291,7 @@ If you now compile and run your program again you should see that the shader cor ## Multiple descriptor sets -As some of the structures and function calls hinted at, it is actually possible to bind multiple descriptor sets simultaneously. You need to specify a descriptor layout for each descriptor set when creating the pipeline layout. Shaders can then reference specific descriptor sets like this: +As some of the structures and function calls hinted at, it is actually possible to bind multiple descriptor sets simultaneously. You need to specify a descriptor set layout for each descriptor set when creating the pipeline layout. Shaders can then reference specific descriptor sets like this: ```glsl layout(set = 0, binding = 0) uniform UniformBufferObject { ... } diff --git a/tutorial/book/src/uniform/descriptor_layout_and_buffer.md b/tutorial/book/src/uniform/descriptor_set_layout_and_buffer.md similarity index 98% rename from tutorial/book/src/uniform/descriptor_layout_and_buffer.md rename to tutorial/book/src/uniform/descriptor_set_layout_and_buffer.md index 5a9d1818..e44e7e53 100644 --- a/tutorial/book/src/uniform/descriptor_layout_and_buffer.md +++ b/tutorial/book/src/uniform/descriptor_set_layout_and_buffer.md @@ -1,6 +1,6 @@ # Descriptor layout and buffer -**Code:** [main.rs](https://github.com/KyleMayes/vulkanalia/tree/master/tutorial/src/21_descriptor_layout.rs) | [shader.vert](https://github.com/KyleMayes/vulkanalia/tree/master/tutorial/shaders/21/shader.vert) | [shader.frag](https://github.com/KyleMayes/vulkanalia/tree/master/tutorial/shaders/21/shader.frag) +**Code:** [main.rs](https://github.com/KyleMayes/vulkanalia/tree/master/tutorial/src/21_descriptor_set_layout.rs) | [shader.vert](https://github.com/KyleMayes/vulkanalia/tree/master/tutorial/shaders/21/shader.vert) | [shader.frag](https://github.com/KyleMayes/vulkanalia/tree/master/tutorial/shaders/21/shader.frag) We're now able to pass arbitrary attributes to the vertex shader for each vertex, but what about global variables? We're going to move on to 3D graphics from this chapter on and that requires a model-view-projection matrix. We could include it as vertex data, but that's a waste of memory and it would require us to update the vertex buffer whenever the transformation changes. The transformation could easily change every single frame. diff --git a/tutorial/src/21_descriptor_layout.rs b/tutorial/src/21_descriptor_set_layout.rs similarity index 100% rename from tutorial/src/21_descriptor_layout.rs rename to tutorial/src/21_descriptor_set_layout.rs