Skip to content

Commit

Permalink
descriptor layout -> descriptor set layout
Browse files Browse the repository at this point in the history
  • Loading branch information
chuigda authored and KyleMayes committed Sep 27, 2023
1 parent 3149da6 commit 6fb2c13
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions tutorial/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]]

Expand Down
2 changes: 1 addition & 1 deletion tutorial/book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tutorial/book/src/dynamic/recycling_command_buffers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
2 changes: 1 addition & 1 deletion tutorial/book/src/texture/combined_image_sampler.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions tutorial/book/src/uniform/descriptor_pool_and_sets.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()];
Expand Down Expand Up @@ -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 { ... }
Expand Down
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
File renamed without changes.

0 comments on commit 6fb2c13

Please sign in to comment.