Skip to content

Commit dc891b9

Browse files
committed
kr translate 03-03-03 frames in flight
1 parent de9ddfa commit dc891b9

File tree

1 file changed

+31
-47
lines changed

1 file changed

+31
-47
lines changed

kr/03_Drawing_a_triangle/03_Drawing/03_Frames_in_flight.md

Lines changed: 31 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,29 @@
1-
## Frames in flight
1+
## 여러 프레임 사용하기(frames in-flight)
22

3-
Right now our render loop has one glaring flaw. We are required to wait on the
4-
previous frame to finish before we can start rendering the next which results
5-
in unnecessary idling of the host.
3+
지금 우리 렌더링 루프에 눈에 띄는 문제가 하나 있습니다.
4+
다음 프레임을 렌더링 하기 전에 이전 프레임을 기다려야만 하고 이로 인해 호스트는 불필요한 대기(ideling) 시간을 갖게 됩니다.
65

76
<!-- insert diagram showing our current render loop and the 'multi frame in flight' render loop -->
87

9-
The way to fix this is to allow multiple frames to be *in-flight* at once, that
10-
is to say, allow the rendering of one frame to not interfere with the recording
11-
of the next. How do we do this? Any resource that is accessed and modified
12-
during rendering must be duplicated. Thus, we need multiple command buffers,
13-
semaphores, and fences. In later chapters we will also add multiple instances
14-
of other resources, so we will see this concept reappear.
8+
이를 수정하는 방법은 여러 프레임을 동시에 사용하는 것입니다.
9+
즉, 하나의 프레임에 렌더링을 수행하는 것과 다음 프레임의 기록 과정을 서로 간섭이 없도록 할 것입니다.
10+
어떻게 해야 할까요? 일단 렌더링에 필요한 모든 접근과 수정이 필요한 자원들이 모두 복제되어야만 합니다. 즉, 여러 개의 명령 버퍼, 세마포어와 펜스들이 있어야 합니다.
11+
나중 챕터에서는 다른 리소스들에 대한 다중 인스턴스를 추가할 것이고, 그 챕터에서 이러한 개념을 다시 보게될 것입니다.
1512

16-
Start by adding a constant at the top of the program that defines how many
17-
frames should be processed concurrently:
13+
프로그램 상단에 얼마나 많은 프레임을 동시에 처리할 것인지 정의하는 상수를 먼저 추가합니다:
1814

1915
```c++
2016
const int MAX_FRAMES_IN_FLIGHT = 2;
2117
```
2218

23-
We choose the number 2 because we don't want the CPU to get *too* far ahead of
24-
the GPU. With 2 frames in flight, the CPU and the GPU can be working on their
25-
own tasks at the same time. If the CPU finishes early, it will wait till the
26-
GPU finishes rendering before submitting more work. With 3 or more frames in
27-
flight, the CPU could get ahead of the GPU, adding frames of latency.
28-
Generally, extra latency isn't desired. But giving the application control over
29-
the number of frames in flight is another example of Vulkan being explicit.
19+
우리는 CPU가 GPU보다 *너무* 앞서나가는 것을 원하지는 않으므로 2로 설정하였습니다.
20+
두 개의 프레임을 동시에 사용하면 CPU와 GPU는 각자의 작업을 동시에 수행할 수 있습니다.
21+
CPU가 먼저 끝나면, 작업을 더 제출할기 전에 GPU가 렌더링을 끝내길 기다릴 것입니다.
22+
세 개 이상의 프레임을 동시에 사용하면 CPU가 GPU보다 앞서나가 지연되는 프레임이 발생할 수 있습니다.
23+
일반적으로, 이러한 지연은 좋지 않습니다. 하지만 이렇게 사용되는 프레임의 개수를 조정하는 것 또한 Vulkan의 명시성의 한 예가 될 것입니다.
3024

31-
Each frame should have its own command buffer, set of semaphores, and fence.
32-
Rename and then change them to be `std::vector`s of the objects:
25+
각 프레임은 각자의 명령 버퍼, 세마포어 집합과 펜스를 가져야 합니다.
26+
이들을 `std::vector`들로 바꾸고 이름도 변경합니다.
3327

3428
```c++
3529
std::vector<VkCommandBuffer> commandBuffers;
@@ -41,11 +35,9 @@ std::vector<VkSemaphore> renderFinishedSemaphores;
4135
std::vector<VkFence> inFlightFences;
4236
```
4337

44-
Then we need to create multiple command buffers. Rename `createCommandBuffer`
45-
to `createCommandBuffers`. Next we need to resize the command buffers vector
46-
to the size of `MAX_FRAMES_IN_FLIGHT`, alter the `VkCommandBufferAllocateInfo`
47-
to contain that many command buffers, and then change the destination to our
48-
vector of command buffers:
38+
이제 여러 개의 명령 버퍼를 생성해야 합니다.
39+
`createCommandBuffer``createCommandBuffers`로 이름을 변경하고 명령 버퍼 벡터의 크기를 `MAX_FRAMES_IN_FLIGHT`로 수정합니다.
40+
`VkCommandBufferAllocateInfo`를 수정하여 명령 버퍼의 숫자를 받고록 하고 새로운 명령 버퍼 벡터의 위치를 넘겨줍니다:
4941

5042
```c++
5143
void createCommandBuffers() {
@@ -59,7 +51,7 @@ void createCommandBuffers() {
5951
}
6052
```
6153

62-
The `createSyncObjects` function should be changed to create all of the objects:
54+
`createSyncObjects` 함수는 모든 객체를 생성하도록 수정되어야 합니다:
6355

6456
```c++
6557
void createSyncObjects() {
@@ -85,7 +77,7 @@ void createSyncObjects() {
8577
}
8678
```
8779

88-
Similarly, they should also all be cleaned up:
80+
모두 정리되어야 하는 것도 마찬가지입니다:
8981

9082
```c++
9183
void cleanup() {
@@ -99,17 +91,16 @@ void cleanup() {
9991
}
10092
```
10193

102-
Remember, because command buffers are freed for us when we free the command
103-
pool, there is nothing extra to do for command buffer cleanup.
94+
명령 풀을 해제하면 명령 버퍼가 자동으로 해제되기 때문에 명령 버퍼 정리에는 별도의 작업이 필요 없다는 사실을 기억하세요.
95+
96+
각 프레임에서 올바른 객체를 사용하기 위해서는 현재 프레임이 무엇인지를 알고 있어야 합니다. 이를 위해 프레임 인덱스를 사용할 것입니다:
10497

105-
To use the right objects every frame, we need to keep track of the current
106-
frame. We will use a frame index for that purpose:
10798

10899
```c++
109100
uint32_t currentFrame = 0;
110101
```
111102

112-
The `drawFrame` function can now be modified to use the right objects:
103+
`drawFrame` 함수에서는 적절한 객체를 사용하도록 수정합니다:
113104

114105
```c++
115106
void drawFrame() {
@@ -141,7 +132,7 @@ void drawFrame() {
141132
}
142133
```
143134

144-
Of course, we shouldn't forget to advance to the next frame every time:
135+
당연히 다음 프레임에는 프레임을 증가시켜주어야 합니다:
145136

146137
```c++
147138
void drawFrame() {
@@ -151,25 +142,18 @@ void drawFrame() {
151142
}
152143
```
153144

154-
By using the modulo (%) operator, we ensure that the frame index loops around
155-
after every `MAX_FRAMES_IN_FLIGHT` enqueued frames.
145+
모듈로 연산(%)을 사용해 프레임 인덱스가 `MAX_FRAMES_IN_FLIGHT`개의 프레임 뒤에는 다시 0이 되도록 합니다.
156146

157147
<!-- Possibly use swapchain-image-count for renderFinished semaphores, as it can't
158148
be known with a fence whether the semaphore is ready for re-use. -->
159149

160-
We've now implemented all the needed synchronization to ensure that there are
161-
no more than `MAX_FRAMES_IN_FLIGHT` frames of work enqueued and that these
162-
frames are not stepping over eachother. Note that it is fine for other parts of
163-
the code, like the final cleanup, to rely on more rough synchronization like
164-
`vkDeviceWaitIdle`. You should decide on which approach to use based on
165-
performance requirements.
166-
167-
To learn more about synchronization through examples, have a look at [this extensive overview](https://github.com/KhronosGroup/Vulkan-Docs/wiki/Synchronization-Examples#swapchain-image-acquire-and-present) by Khronos.
168-
150+
이제 동기화화 관련한 모든 구현을 마쳐서 `MAX_FRAMES_IN_FLIGHT`개 이상의 프레임 작업이 동시에 큐에 들어가지 않도록 하였으며 이러한 프레임들이 서로 겹치지도 않게 되었습니다.
151+
정리 부분과 같은 나머지 부분은 `vkDeviceWaitIdle` 처럼 보다 기초적인 동기화 방법에 의존하고 있습니다.
152+
어떠한 접근법을 사용할지는 성능 요구사항에 따라서 여러분이 선택하셔야 합니다.
169153

170-
In the next chapter we'll deal with one more small thing that is required for a
171-
well-behaved Vulkan program.
154+
동기화에 대해 예를 통해 더 알고 싶으시면 Khronos에서 제공하는 [이 개요 문서](https://github.com/KhronosGroup/Vulkan-Docs/wiki/Synchronization-Examples#swapchain-image-acquire-and-present)를 살펴보세요.
172155

156+
다음 챕터에서는 잘 동작하는 Vulkan 프로그램에 필요한 또다른 요구사항을 살펴보겠습니다.
173157

174158
[C++ code](/code/16_frames_in_flight.cpp) /
175159
[Vertex shader](/code/09_shader_base.vert) /

0 commit comments

Comments
 (0)