Skip to content

Commit 0a8fcae

Browse files
committed
ko-translate descriptorSets
1 parent 71bf897 commit 0a8fcae

File tree

6 files changed

+67
-66
lines changed

6 files changed

+67
-66
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Descriptor Sets
1+
# 디스크립터 셋
22

3-
[Vulkan Descriptor](https://docs.vulkan.org/guide/latest/mapping_data_to_shaders.html#descriptors)s are essentially typed pointers to resources that shaders can use, eg uniform/storage buffers or combined image samplers (textures with samplers). A Descriptor Set is a collection of descriptors at various **bindings** that is bound together as an atomic unit. Shaders can declare input based on these set and binding numbers, and any sets the shader uses must have been updated and bound before drawing. A Descriptor Set Layout is a description of a collection of descriptor sets associated with a particular set number, usually describing all the sets in a shader. Descriptor sets are allocated using a Descriptor Pool and the desired set layout(s).
3+
[Vulkan 디스크립터](https://docs.vulkan.org/guide/latest/mapping_data_to_shaders.html#descriptors)는 기본적으로 셰이더가 접근할 수 있는 자원(예 : 유니폼 버퍼, 스토리지 버퍼, 샘플러가 결합된 텍스쳐 등)에 대한 타입이 지정된 포인터입니다. 디스크립터 셋은 이러한 디스크립터들을 다양한 **바인딩**에 모아 하나의 단위로 결합한 집합이며, 셰이더는 특정 셋 번호와 바인딩 번호를 기준으로 입력을 선언합니다. 셰이더에서 사용하는 모든 디스크립터 셋은 드로우 콜 전에 반드시 업데이트, 바인딩되어야 합니다. 디스크립터 셋 레이아웃은 특정 셋 번호에 해당하는 디스크립터 셋의 구성 방식을 나타내며, 일반적으로 셰이더에서 사용하는 모든 디스크립터 셋을 나타냅니다. 디스크립터 셋은 디스크립터 풀과 원하는 디스크립터 셋 레이아웃을 이용해 할당됩니다.
44

5-
Structuring set layouts and managing descriptor sets are complex topics with many viable approaches, each with their pros and cons. Some robust ones are described in this [page](https://docs.vulkan.org/samples/latest/samples/performance/descriptor_management/README.html). 2D frameworks - and even simple/basic 3D ones - can simply allocate and update sets every frame, as described in the docs as the "simplest approach". Here's an [extremely detailed](https://zeux.io/2020/02/27/writing-an-efficient-vulkan-renderer/) - albeit a bit dated now - post by Arseny on the subject. A more modern approach, namely "bindless" or Descriptor Indexing, is described in the official docs [here](https://docs.vulkan.org/samples/latest/samples/extensions/descriptor_indexing/README.html).
5+
디스크립터 셋 레이아웃을 구성하고 디스크립터 셋을 관리하는 것은 다양한 접근 방법이 가능하며, 각각 장단점이 있어 꽤 복잡한 주제입니다. [이 페이지](https://docs.vulkan.org/samples/latest/samples/performance/descriptor_management/README.html)에서는 그중에서도 신뢰할 수 있는 몇 가지 방법들을 설명합니다. 2D 프레임워크와 간단한 3D 프레임워크의 경우 문서에서 가장 단순한 접근 방식이라 설명하는 것처럼, 디스크립터 셋을 매 프레임마다 할당하고 업데이트하는 방식으로 처리할 수 있습니다. [이 글은](https://zeux.io/2020/02/27/writing-an-efficient-vulkan-renderer/) 매우 상세하지만 현재는 다소 오래된 자료입니다. 더 현대적인 접근법으로는 바인드리스 혹은 디스크립터 인덱싱이라 불리는 방식이 있으며,이에 대해서는 [공식 문서](https://docs.vulkan.org/samples/latest/samples/extensions/descriptor_indexing/README.html)에서 다루고 있습니다.

guide/translations/ko-KR/src/descriptor_sets/descriptor_buffer.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Descriptor Buffer
1+
# 디스크립터 버퍼
22

3-
Uniform and Storage buffers need to be N-buffered unless they are "GPU const", ie contents do not change after creation. Encapsulate a `vma::Buffer` per virtual frame in a `DescriptorBuffer`:
3+
유니폼과 스토리지 버퍼는 생성 이후 내용이 변경되지 않는 GPU 상수가 아닌 이상, N-버퍼링 되어야 합니다. 각 가상 프레임마다의 하나의 `vma::Buffer``DescriptorBuffer`로 캡슐화하겠습니다.
44

55
```cpp
66
class DescriptorBuffer {
@@ -29,7 +29,7 @@ class DescriptorBuffer {
2929
};
3030
```
3131
32-
The implementation is fairly straightforward, it reuses existing buffers if they are large enough, else recreates them before copying data. It also ensures buffers are always valid to be bound to descriptors.
32+
구현은 꽤 단순합니다. 기존의 버퍼로 충분하다면 재사용하고, 아니라면 데이터를 복사하기 전에 새로 생성합니다. 이렇게 하면 디스크립터 셋에 바인딩할 버퍼가 항상 유효한 상태임을 보장합니다.
3333
3434
```cpp
3535
DescriptorBuffer::DescriptorBuffer(VmaAllocator allocator,
@@ -73,7 +73,7 @@ void DescriptorBuffer::write_to(Buffer& out,
7373
}
7474
```
7575

76-
Store a `DescriptorBuffer` in `App` and rename `create_vertex_buffer()` to `create_shader_resources()`:
76+
`App``DescriptorBuffer`를 저장하고 `create_vertex_buffer()`함수의 이름을 `create_shader_resources()`로 변경합니다.
7777

7878
```cpp
7979
std::optional<DescriptorBuffer> m_view_ubo{};
@@ -86,7 +86,7 @@ m_view_ubo.emplace(m_allocator.get(), m_gpu.queue_family,
8686
vk::BufferUsageFlagBits::eUniformBuffer);
8787
```
8888

89-
Add functions to update the view/projection matrices and bind the frame's descriptor sets:
89+
뷰/프로젝션 행렬을 업데이트하고 프레임별 디스크립터 셋을 바인딩하는 함수를 추가합니다.
9090

9191
```cpp
9292
void App::update_view() {
@@ -120,7 +120,7 @@ void App::bind_descriptor_sets(vk::CommandBuffer const command_buffer) const {
120120
}
121121
```
122122
123-
Add the descriptor set layouts to the Shader, call `update_view()` before `draw()`, and `bind_descriptor_sets()` in `draw()`:
123+
셰이더에 디스크립터 셋 레이아웃을 추가하고, `draw()` 호출 전에 `update_view()`를 호출하며, `draw()` 내부에서 `bind_descriptor_sets()`를 호출합니다.
124124
125125
```cpp
126126
auto const shader_ci = ShaderProgram::CreateInfo{
@@ -142,7 +142,7 @@ bind_descriptor_sets(command_buffer);
142142
// ...
143143
```
144144

145-
Update the vertex shader to use the view UBO:
145+
정점 셰이더를 이에 맞춰 변경해줍니다.
146146

147147
```glsl
148148
layout (set = 0, binding = 0) uniform View {
@@ -158,7 +158,7 @@ void main() {
158158
}
159159
```
160160

161-
Since the projected space is now the framebuffer size instead of [-1, 1], update the vertex positions to be larger than 1 pixel:
161+
투영 공간이 이제 [ -1, 1] 범위가 아닌 프레임버퍼 크기를 기준으로 하기 때문에 정점 위치를 1픽셀보다 크게 위치하도록 업데이트합니다.
162162

163163
```cpp
164164
static constexpr auto vertices_v = std::array{
@@ -171,4 +171,4 @@ static constexpr auto vertices_v = std::array{
171171

172172
![View UBO](./view_ubo.png)
173173

174-
When such descriptor buffers are created and destroyed dynamically, they would need to store a `ScopedWaiter` to ensure all rendering with descriptor sets bound to them completes before destruction. Alternatively, the app can maintain a pool of scratch buffers (similar to small/dynamic vertex buffers) per virtual frame which get destroyed in a batch instead of individually.
174+
이러한 디스크립터 버퍼가 동적으로 생성되고 파괴될 때, 관련 디스크립터 셋을 사용하는 렌더링이 모두 완료된 후에 파괴되도록 `ScopedWaiter`를 사용해 보장합니다. 또는, 프레임마다 임시 버퍼 풀을 유지하여(작거나 동적인 정점 버퍼와 유사하게) 버퍼를 개별이 아닌 일괄적으로 파괴하는 방식도 사용할 수 있습니다.

guide/translations/ko-KR/src/descriptor_sets/instanced_rendering.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# Instanced Rendering
1+
# 인스턴스 렌더링
22

3-
When multiple copies of a drawable object are desired, one option is to use instanced rendering. The basic idea is to store per-instance data in a uniform/storage buffer and index into it in the vertex shader. We shall represent one model matrix per instance, feel free to add more data like an overall tint (color) that gets multiplied to the existing output color in the fragment shader. This will be bound to a Storage Buffer (SSBO), which can be "unbounded" in the shader (size is determined during invocation).
3+
하나의 객체를 여러 번 그려야 할 때 사용할 수 있는 방법 중 하나는 인스턴스 렌더링입니다. 기본 아이디어는 인스턴스별 데이터를 유니폼 버퍼 또는 스토리지 버퍼에 담고, 이를 정점 셰이더에서 참조하는 것입니다. 우리는 인스턴스마다 하나의 모델 행렬을 표현하겠습니다. 필요하다면 색상과 같은 정보를 포함해 프래그먼트 셰이더에서 기존 출력 색상에 곱하는 방식으로 사용할 수도 있습니다. 이러한 데이터는 스토리지 버퍼(SSBO)에 바인딩되며, 버퍼의 크기는 호출 시점에 결정됩니다.
44

5-
Store the SSBO and a buffer for instance matrices:
5+
SSBO와 인스턴스 행렬을 저장할 버퍼를 추가합니다.
66

77
```cpp
88
std::vector<glm::mat4> m_instance_data{}; // model matrices.
99
std::optional<DescriptorBuffer> m_instance_ssbo{};
1010
```
1111

12-
Add two `Transform`s as the source of rendering instances, and a function to update the matrices:
12+
렌더링할 인스턴스에 사용할 `Transform`을 추가하고 이를 기반으로 행렬을 업데이트하는 함수를 추가합니다.
1313

1414
```cpp
1515
void update_instances();
@@ -33,19 +33,19 @@ void App::update_instances() {
3333
}
3434
```
3535

36-
Update the descriptor pool to also provide storage buffers:
36+
디스크립터 풀을 업데이트하여 스토리지 버퍼를 지원하도록 합니다.
3737

3838
```cpp
3939
// ...
4040
vk::DescriptorPoolSize{vk::DescriptorType::eCombinedImageSampler, 2},
4141
vk::DescriptorPoolSize{vk::DescriptorType::eStorageBuffer, 2},
4242
```
4343
44-
Add set 2 and its new binding. Such a set layout keeps each "layer" isolated:
44+
디스크립터 셋을 2번과 해당 바인딩을 추가합니다. 이처럼 각 디스크립터 셋을 명확하게 역할별로 분리하는 것이 좋습니다.
4545
46-
* Set 0: view / camera
47-
* Set 1: textures / material
48-
* Set 2: draw instances
46+
* 디스크립터 셋 0 - : 뷰 / 카메라
47+
* 디스크립터 셋 1 - 텍스쳐 / 머테리얼
48+
* 디스크립터 셋 2 : 인스턴싱
4949
5050
```cpp
5151
static constexpr auto set_2_bindings_v = std::array{
@@ -56,22 +56,22 @@ auto set_layout_cis = std::array<vk::DescriptorSetLayoutCreateInfo, 3>{};
5656
set_layout_cis[2].setBindings(set_2_bindings_v);
5757
```
5858

59-
Create the instance SSBO after the view UBO:
59+
뷰 UBO를 생성한 이후 인스턴스용 SSBO를 생성합니다.
6060

6161
```cpp
6262
m_instance_ssbo.emplace(m_allocator.get(), m_gpu.queue_family,
6363
vk::BufferUsageFlagBits::eStorageBuffer);
6464
```
6565

66-
Call `update_instances()` after `update_view()`:
66+
`update_view()`를 호출한 다음 `update_instances()`를 호출합니다.
6767

6868
```cpp
6969
// ...
7070
update_view();
7171
update_instances();
7272
```
7373

74-
Extract transform inspection into a lambda and inspect each instance transform too:
74+
트랜스폼 확인 로직을 람다로 분리해 각 인스턴스의 트랜스폼을 검사합니다.
7575

7676
```cpp
7777
static auto const inspect_transform = [](Transform& out) {
@@ -99,7 +99,7 @@ if (ImGui::TreeNode("Instances")) {
9999
}
100100
```
101101

102-
Add another descriptor write for the SSBO:
102+
SSBO를 위한 descriptorWrite도 추가합니다.
103103

104104
```cpp
105105
auto writes = std::array<vk::WriteDescriptorSet, 3>{};
@@ -115,15 +115,15 @@ write.setBufferInfo(instance_ssbo_info)
115115
writes[2] = write;
116116
```
117117
118-
Finally, change the instance count in the draw call:
118+
마지막으로, 드로우 콜의 인스턴스 수를 변경합니다.
119119
120120
```cpp
121121
auto const instances = static_cast<std::uint32_t>(m_instances.size());
122122
// m_vbo has 6 indices.
123123
command_buffer.drawIndexed(6, instances, 0, 0, 0);
124124
```
125125

126-
Update the vertex shader to incorporate the instance model matrix:
126+
정점 셰이더를 수정하여 인스턴스별 모델 행렬을 적용합니다.
127127

128128
```glsl
129129
// ...

guide/translations/ko-KR/src/descriptor_sets/pipeline_layout.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Pipeline Layout
1+
# 파이프라인 레이아웃
22

3-
A [Vulkan Pipeline Layout](https://registry.khronos.org/vulkan/specs/latest/man/html/VkPipelineLayout.html) represents a sequence of descriptor sets (and push constants) associated with a shader program. Even when using Shader Objects, a Pipeline Layout is needed to utilize descriptor sets.
3+
[Vulkan 파이프라인 레이아웃](https://registry.khronos.org/vulkan/specs/latest/man/html/VkPipelineLayout.html)은 셰이더 프로그램과 연결된 디스크립터 셋과 푸시 상수를 나타냅니다. 셰이더 오브젝트를 사용할 경우에도 디스크립터 셋을 활용하기 위해 파이프라인 레이아웃이 필요합니다.
44

5-
Starting with the layout of a single descriptor set containing a uniform buffer to set the view/projection matrices in, store a descriptor pool in `App` and create it before the shader:
5+
뷰/프로젝션 행렬을 담기 위한 유니폼 버퍼를 포함하는 단일 디스크립터 셋 레이아웃부터 시작합니다. 디스크립터 풀을 `App`에 추가하고 셰이더보다 먼저 생성합니다.
66

77
```cpp
88
vk::UniqueDescriptorPool m_descriptor_pool{};
@@ -20,7 +20,7 @@ void App::create_descriptor_pool() {
2020
}
2121
```
2222

23-
Add new members to `App` to store the set layouts and pipeline layout. `m_set_layout_views` is just a copy of the descriptor set layout handles in a contiguous vector:
23+
새로운 멤버를 `App`에 추가해 디스크립터 셋 레이아웃과 파이프라인 레이아웃을 담도록 합니다. `m_set_layout_views`는 디스크립터 셋 레이아웃의 핸들을 연속된 vector로 복사한 것입니다.
2424

2525
```cpp
2626
std::vector<vk::UniqueDescriptorSetLayout> m_set_layouts{};
@@ -55,7 +55,7 @@ void App::create_pipeline_layout() {
5555
}
5656
```
5757
58-
Add a helper function that allocates a set of descriptor sets for the entire layout:
58+
레이아웃 전체에 해당하는 디스크립터 셋을 할당하는 함수를 추가합니다.
5959
6060
```cpp
6161
auto App::allocate_sets() const -> std::vector<vk::DescriptorSet> {
@@ -66,7 +66,7 @@ auto App::allocate_sets() const -> std::vector<vk::DescriptorSet> {
6666
}
6767
```
6868

69-
Store a Buffered copy of descriptor sets for one drawable object:
69+
그릴 객체에 쓰일 디스크립터 셋을 저장합니다.
7070

7171
```cpp
7272
Buffered<std::vector<vk::DescriptorSet>> m_descriptor_sets{};

guide/translations/ko-KR/src/descriptor_sets/texture.md

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Texture
1+
# 텍스쳐
22

3-
With a large part of the complexity wrapped away in `vma`, a `Texture` is just a combination of three things:
3+
대부분의 복잡한 작업은 `vma`에서 처리하기 때문에, `Texture`는 다음 세 가지로 구성됩니다.
44

5-
1. Sampled Image
6-
2. (Unique) Image View of above
7-
3. (Unique) Sampler
5+
1. 샘플링될 이미지
6+
2. 해당 이미지의 이미지 뷰
7+
3. 고유한 샘플러
88

9-
In `texture.hpp`, create a default sampler:
9+
`texture.hpp`에 기본 샘플러를 생성하겠습니다.
1010

1111
```cpp
1212
[[nodiscard]] constexpr auto
@@ -27,7 +27,8 @@ constexpr auto sampler_ci_v = create_sampler_ci(
2727
vk::SamplerAddressMode::eClampToEdge, vk::Filter::eLinear);
2828
```
2929
30-
Define the Create Info and Texture types:
30+
CreateInfo와 텍스쳐 타입을 정의합니다.
31+
3132
3233
```cpp
3334
struct TextureCreateInfo {
@@ -55,7 +56,7 @@ class Texture {
5556
};
5657
```
5758

58-
Add a fallback bitmap constant, and the implementation:
59+
에러가 발생 시 사용할(fallback) 비트맵 상수도 추가하겠습니다.
5960

6061
```cpp
6162
// 4-channels.
@@ -105,7 +106,7 @@ auto Texture::descriptor_info() const -> vk::DescriptorImageInfo {
105106
}
106107
```
107108
108-
To sample textures, `Vertex` will need a UV coordinate:
109+
텍스쳐를 샘플링하려면 `Vertex`에 UV 좌표를 추가해야 합니다.
109110
110111
```cpp
111112
struct Vertex {
@@ -128,7 +129,7 @@ constexpr auto vertex_attributes_v = std::array{
128129
};
129130
```
130131

131-
Store a texture in `App` and create with the other shader resources:
132+
`App`에 텍스쳐를 담고 다른 셰이더 자원도 함께 생성하겠습니다.
132133

133134
```cpp
134135
std::optional<Texture> m_texture{};
@@ -160,15 +161,15 @@ texture_ci.sampler.setMagFilter(vk::Filter::eNearest);
160161
m_texture.emplace(std::move(texture_ci));
161162
```
162163

163-
Update the descriptor pool sizes to also contain Combined Image Samplers:
164+
DescriptorPoolSize를 업데이트해 CombinedImageSampler도 포함하도록 수정합니다.
164165

165166
```cpp
166167
/// ...
167168
vk::DescriptorPoolSize{vk::DescriptorType::eUniformBuffer, 2},
168169
vk::DescriptorPoolSize{vk::DescriptorType::eCombinedImageSampler, 2},
169170
```
170171
171-
Set up a new descriptor set (number 1) with a combined image sampler at binding 0. This could be added to binding 1 of set 0 as well, since we are not optimizing binding calls (eg binding set 0 only once for multiple draws):
172+
새로운 디스크립터 셋(1번)의 바인딩 0번에 CombinedImageSampler를 설정합니다. 바인딩 호출 최적화를 하지 않을 경우, set 0의 바인딩 1번에 추가해도 괜찮습니다.
172173
173174
```cpp
174175
static constexpr auto set_1_bindings_v = std::array{
@@ -179,7 +180,7 @@ set_layout_cis[0].setBindings(set_0_bindings_v);
179180
set_layout_cis[1].setBindings(set_1_bindings_v);
180181
```
181182

182-
Remove the vertex colors and set the UVs for the quad. In Vulkan UV space is the same as GLFW window space: origin is at the top left, +X moves right, +Y moves down.
183+
정점 색상 값을 지우고 사각형에 UV를 설정합니다. Vulkan에서의 UV 공간은 GLFW 윈도우 공간과 동일합니다. 왼쪽 위가 원점이고, 오른쪽이 +X, 아래쪽이 +Y입니다.
183184

184185
```cpp
185186
static constexpr auto vertices_v = std::array{
@@ -190,7 +191,7 @@ static constexpr auto vertices_v = std::array{
190191
};
191192
```
192193

193-
Finally, update the descriptor writes:
194+
마지막으로, DescriptorWrite를 업데이트 합니다.
194195

195196
```cpp
196197
auto writes = std::array<vk::WriteDescriptorSet, 2>{};
@@ -205,9 +206,9 @@ write.setImageInfo(image_info)
205206
writes[1] = write;
206207
```
207208

208-
Since the Texture is not N-buffered (because it is "GPU const"), in this case the sets could also be updated once after texture creation instead of every frame.
209+
텍스쳐는 N-버퍼링되지 않기 때문에(이는 GPU 상수입니다), 디스크립터 셋도 텍스쳐 생성 이후 한번만 업데이트하면 됩니다.
209210

210-
Add the UV vertex attribute the vertex shader and pass it to the fragment shader:
211+
UV 정점 속성을 정점 셰이더에 추가하고 이를 프래그먼트 셰이더로 전달합니다.
211212

212213
```glsl
213214
layout (location = 2) in vec2 a_uv;
@@ -220,7 +221,7 @@ out_color = a_color;
220221
out_uv = a_uv;
221222
```
222223

223-
Add set 1 and the incoming UV coords to the fragment shader, combine the sampled texture color with the vertex color:
224+
셋 1번과 그에 맞는 UV 좌표도 프래그먼트 셰이더에 추가하고, 샘플링한 텍스쳐 색상과 정점 색상을 섞어봅시다.
224225

225226
```glsl
226227
layout (set = 1, binding = 0) uniform sampler2D tex;
@@ -234,14 +235,14 @@ out_color = vec4(in_color, 1.0) * texture(tex, in_uv);
234235

235236
![RGBY Texture](./rgby_texture.png)
236237

237-
For generating mip-maps, follow the [sample in the Vulkan docs](https://docs.vulkan.org/samples/latest/samples/api/hpp_texture_mipmap_generation/README.html#_generating_the_mip_chain). The high-level steps are:
238-
239-
1. Compute mip levels based on image size
240-
1. Create an image with the desired mip levels
241-
1. Copy the source data to the first mip level as usual
242-
1. Transition the first mip level to TransferSrc
243-
1. Iterate through all the remaining mip levels:
244-
1. Transition the current mip level to TransferDst
245-
1. Record an image blit operation from previous to current mip levels
246-
1. Transition the current mip level to TransferSrc
247-
1. Transition all levels (entire image) to ShaderRead
238+
밉맵을 생성하기 위해서는 [Vulkan 공식 예제](https://docs.vulkan.org/samples/latest/samples/api/hpp_texture_mipmap_generation/README.html#_generating_the_mip_chain)를 참고하세요. 고수준 절차는 다음과 같습니다.
239+
240+
1. 이미지 크기에 기반하여 밉 레벨을 계산합니다.
241+
2. 원하는 밉 레벨 수를 갖는 이미지를 생성합니다.
242+
3. 첫 번째 밉 레벨에 원본 데이터를 복사합니다.
243+
4. 첫 번째 밉 레벨의 레이아웃을 TransferSrc로 변경합니다.
244+
5. 모든 밉 레벨을 순회하며 다음을 수행합니다.
245+
1. 현재 밉 레벨의 레이아웃을 TransferDst로 변경합니다.
246+
2. 이전 밉 레벨에서 현재 밉 레벨로 ImageBlit 작업을 수행합니다.
247+
3. 현재 밉 레벨의 레이아웃을 TransferSrc로 변경합니다.
248+
6. 모든 레벨의 레이아웃을 ShaderRead로 변경합니다.

0 commit comments

Comments
 (0)