Skip to content

Commit 45860e6

Browse files
committed
ko-translate shader_objects
1 parent 5903fa1 commit 45860e6

File tree

6 files changed

+54
-47
lines changed

6 files changed

+54
-47
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Shader Objects
1+
# 셰이더 객체
22

3-
A [Vulkan Graphics Pipeline](https://docs.vulkan.org/spec/latest/chapters/pipelines.html) is a large object that encompasses the entire graphics pipeline. It consists of many stages - all this happens during a single `draw()` call. There is however an extension called [`VK_EXT_shader_object`](https://www.khronos.org/blog/you-can-use-vulkan-without-pipelines-today) which enables avoiding graphics pipelines entirely. Almost all pipeline state becomes dynamic, ie set at draw time, and the only Vulkan handles to own are `ShaderEXT` objects. For a comprehensive guide, check out the [Vulkan Sample from Khronos](https://github.com/KhronosGroup/Vulkan-Samples/tree/main/samples/extensions/shader_object).
3+
[Vulkan의 그래픽스 파이프라인](https://docs.vulkan.org/spec/latest/chapters/pipelines.html)은 전체 렌더링 과정을 아우르는 거대한 객체로, `draw()` 호출 한 번에 여러 단계를 수행합니다. 하지만 [`VK_EXT_shader_object`](https://www.khronos.org/blog/you-can-use-vulkan-without-pipelines-today)라는 확장을 사용하면, 이러한 그래픽스 파이프라인 자체를 완전히 생략할 수 있습니다. 이 확장을 사용할 경우 대부분의 파이프라인 상태가 동적으로 설정되며, 그리는 시점에 설정됩니다. 이때 개발자가 직접 다뤄야할 Vulkan 핸들은 `ShaderEXT` 객체뿐입니다. 더 자세한 정보는 [여기](https://github.com/KhronosGroup/Vulkan-Samples/tree/main/samples/extensions/shader_object)를 참고하세요.
44

5-
Vulkan requires shader code to be provided as SPIR-V (IR). We shall use `glslc` (part of the Vulkan SDK) to compile GLSL to SPIR-V manually when required.
5+
Vulkan에서는 셰이더 코드를 SPIR-V 형태로 제공해야 합니다. 우리는 Vulkan SDK에 포함된 `glslc`를 사용해 GLSL 코드를 필요할 때 수동으로 SPIR-V 파일로 컴파일하겠습니다.

guide/translations/ko-KR/src/shader_objects/drawing_triangle.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Drawing a Triangle
1+
# 삼각형 그리기
22

3-
Add a `ShaderProgram` to `App` and its create function:
3+
`App` 클래스에 `ShaderProgram`과 이를 생성하는 함수를 추가합니다.
44

55
```cpp
66
[[nodiscard]] auto asset_path(std::string_view uri) const -> fs::path;
@@ -12,7 +12,7 @@ void create_shader();
1212
std::optional<ShaderProgram> m_shader{};
1313
```
1414
15-
Implement and call `create_shader()` (and `asset_path()`):
15+
`asset_path()`와 `create_shader()`를 구현하고 호출합니다.
1616
1717
```cpp
1818
void App::create_shader() {
@@ -33,7 +33,7 @@ auto App::asset_path(std::string_view const uri) const -> fs::path {
3333
}
3434
```
3535

36-
Before `render()` grows to an unwieldy size, extract the higher level logic into two member functions:
36+
`render()`가 걷잡을 수 없이 커지기 전에, 고수준 로직을 두 멤버 함수로 분리합니다.
3737

3838
```cpp
3939
// ImGui code goes here.
@@ -54,7 +54,7 @@ draw(command_buffer);
5454
command_buffer.endRendering();
5555
```
5656
57-
We can now bind the shader and use it to draw the triangle in the shader. Making `draw()` `const` forces us to ensure no `App` state is changed:
57+
이제 셰이더를 바인딩하고 이를 삼각형을 그리는 데 사용할 수 있습니다. `draw()`함수를 `const`로 만들어 `App`을 건드리지 않도록 합니다.
5858
5959
```cpp
6060
void App::draw(vk::CommandBuffer const command_buffer) const {
@@ -66,7 +66,7 @@ void App::draw(vk::CommandBuffer const command_buffer) const {
6666

6767
![White Triangle](./white_triangle.png)
6868

69-
Updating the shaders to use interpolated RGB on each vertex:
69+
셰이더를 각 정점에 대해 보간된 RGB를 사용하도록 업데이트합니다.
7070

7171
```glsl
7272
// shader.vert
@@ -91,22 +91,22 @@ layout (location = 0) in vec3 in_color;
9191
out_color = vec4(in_color, 1.0);
9292
```
9393

94-
> Make sure to recompile both the SPIR-V shaders in assets/.
94+
> `assets/`에 있는 두 SPIR-V 파일을 다시 컴파일하는 것을 잊지 마세요.
9595
96-
And a black clear color:
96+
그리고 초기화 색상을 검은 색으로 설정합니다.
9797

9898
```cpp
9999
// ...
100100
.setClearValue(vk::ClearColorValue{0.0f, 0.0f, 0.0f, 1.0f});
101101
```
102102
103-
Gives us the renowned Vulkan sRGB triangle:
103+
이제 Vulkan에서 sRGB 포맷으로 표현되는 삼각형을 볼 수 있습니다.
104104
105105
![sRGB Triangle](./srgb_triangle.png)
106106
107-
## Modifying Dynamic State
107+
## 동적 상태 변경하기
108108
109-
We can use an ImGui window to inspect / tweak some pipeline state:
109+
ImGui 창을 사용해 파이프라인 상태를 관찰하거나 일부 설정을 변경할 수 있습니다.
110110
111111
```cpp
112112
ImGui::SetNextWindowSize({200.0f, 100.0f}, ImGuiCond_Once);

guide/translations/ko-KR/src/shader_objects/glsl_to_spir_v.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
# GLSL to SPIR-V
1+
# GLSL 에서 SPIR-V
22

33
Shaders work in NDC space: -1 to +1 for X and Y. We output a triangle's coordinates in a new vertex shader and save it to `src/glsl/shader.vert`:
4+
셰이더는 NDC 공간 X축과 Y축에서 -1에서 1까지 작동합니다. 새로운 정점 셰이더의 삼각형 좌표계를 출력하고 이를 `src/glsl/shader.vert`에 저장합니다.
45

56
```glsl
67
#version 450 core
@@ -19,6 +20,7 @@ void main() {
1920
```
2021

2122
The fragment shader just outputs white for now, in `src/glsl/shader.frag`:
23+
`src/glsl/shader.frag`의 프래그먼트 셰이더는 지금은 흰 색을 출력하기만 할 것입니다.
2224

2325
```glsl
2426
#version 450 core
@@ -31,17 +33,20 @@ void main() {
3133
```
3234

3335
Compile both shaders into `assets/`:
36+
이 둘을 `assets/`로 컴파일합니다.
3437

3538
```
3639
glslc src/glsl/shader.vert -o assets/shader.vert
3740
glslc src/glsl/shader.frag -o assets/shader.frag
3841
```
3942

4043
> glslc is part of the Vulkan SDK.
44+
> glslc는 Vulkan SDK의 일부입니다.
4145
42-
## Loading SPIR-V
46+
## SPIR-V 불러오기
4347

4448
SPIR-V shaders are binary files with a stride/alignment of 4 bytes. As we have seen, the Vulkan API accepts a span of `std::uint32_t`s, so we need to load it into such a buffer (and _not_ `std::vector<std::byte>` or other 1-byte equivalents). Add a helper function in `app.cpp`:
49+
SPIR-V 셰이더는 4바이트 단위로 정렬이 되어있는 바이너리 파일입니다. 지금까지 봐왔던 대로, Vulkan API는 `std::uint32_t`의 묶음을 받습니다. 따라서 이러한 종류의 버퍼(단, `std::vector<std::byte>` 혹은 다른 종류의 1바이트 컨테이너는 아닙니다)에 담습니다. 이를 돕는 함수를 `app.cpp`에 추가합니다.
4550

4651
```cpp
4752
[[nodiscard]] auto to_spir_v(fs::path const& path)

guide/translations/ko-KR/src/shader_objects/locating_assets.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Locating Assets
1+
# 에셋 위치
22

3-
Before we can use shaders, we need to load them as asset/data files. To do that correctly, first the asset directory needs to be located. There are a few ways to go about this, we will use the approach of looking for a particular subdirectory, starting from the working directory and walking up the parent directory tree. This enables `app` in any project/build subdirectory to locate `assets/` in the various examples below:
3+
셰이더를 사용하기 전에, 에셋 파일들을 불러와야 합니다. 이를 제대로 수행하려면 우선 에셋들이 위치한 경로를 알아야 합니다. 에셋 경로를 찾는 방법에는 여러 가지가 있지만, 우리는 현재 작업 디렉토리에서 시작하여 상위 디렉토리로 올라가며 특정 하위 폴더(`assets/`)를 찾는 방식을 사용할 것입니다. 이렇게 하면 프로젝트나 빌드 디렉토리 어디에서 `app`이 실행되더라도 `assets/` 디렉토리를 자동으로 찾아 접근할 수 있게 됩니다.
44

55
```
66
.
@@ -15,11 +15,11 @@ Before we can use shaders, we need to load them as asset/data files. To do that
1515
|-- app
1616
```
1717

18-
In a release package you would want to use the path to the executable instead (and probably not perform an "upfind" walk), the working directory could be anywhere whereas assets shipped with the package will be in the vicinity of the executable.
18+
릴리즈 패키지에서는 일반적으로 실행 파일의 경로를 기준으로 에셋 경로를 설정하며, 상위 경로로 거슬러 올라가는 방식은 사용하지 않는 것이 보통입니다. 작업 경로에 상관없이 패키지에 포함된 에셋은 보통 실행 파일과 같은 위치나 그 주변에 위치하기 때문입니다.
1919

20-
## Assets Directory
21-
22-
Add a member to `App` to store this path to `assets/`:
20+
## 에셋 경로
21+
:
22+
`App``assets/` 경로를 담을 멤버를 추가합니다.
2323

2424
```cpp
2525
namespace fs = std::filesystem;
@@ -28,7 +28,7 @@ namespace fs = std::filesystem;
2828
fs::path m_assets_dir{};
2929
```
3030
31-
Add a helper function to locate the assets dir, and assign `m_assets_dir` to its return value at the top of `run()`:
31+
에셋 경로를 찾는 함수를 추가하고, 그 반환값을 `run()` 함수 상단에서 `m_assets_dir`에 저장하세요.
3232
3333
```cpp
3434
[[nodiscard]] auto locate_assets_dir() -> fs::path {

guide/translations/ko-KR/src/shader_objects/pipelines.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Graphics Pipelines
1+
# 그래픽스 파이프라인
22

3-
This page describes the usage of Graphics Pipelines _instead of_ Shader Objects. While the guide assumes Shader Object usage, not much should change in the rest of the code if you instead choose to use Graphics Pipelines. A notable exception is the setup of Descriptor Set Layouts: with pipelines it needs to be specified as part of the Pipeline Layout, whereas with Shader Objects it is part of each ShaderEXT's CreateInfo.
3+
여기서는 셰이더 오브젝트 대신 그래픽스 파이프라인을 사용하는 방법을 설명합니다. 이 가이드는 셰이더 오브젝트를 사용한다고 가정하지만, 그래픽스 파이프라인을 대신 사용하더라도 나머지 코드에는 큰 변화가 없을 것입니다. 다만, 알아둬야할 예외 사항은 디스크립터 셋 레이아웃 설정 방식입니다. 셰이더 오브젝트에서는 ShaderEXT의 CreateInfo에 포함되지만, 파이프라인을 사용할 경우 파이프라인 레이아웃에 지정해야 합니다.
44

5-
## Pipeline State
5+
## 파이프라인 상태
66

7-
Most dynamic state with Shader Objects is static with pipelines: specified at pipeline creation time. Pipelines also require additional parameters, like attachment formats and sample count: these will be considered constant and stored in the builder later. Expose a subset of dynamic states through a struct:
7+
셰이더 오브젝트는 대부분의 동적 상태를 런타임에 설정할 수 있었지만, 파이프라인에서는 파이프라인 생성 시점에 고정되기 때문에 정적입니다. 파이프라인은 또한 어태치먼트 포맷과 샘플 수 같은 추가 파라미터를 요구합니다. 이러한 값들은 상수로 간주되어 이후의 추상화 클래스에 담길 것입니다. 동적 상태의 일부를 구조체를 통해 나타냅시다.
88

99
```cpp
1010
// bit flags for various binary Pipeline States.
@@ -38,7 +38,7 @@ struct PipelineState {
3838
};
3939
```
4040
41-
Encapsulate building pipelines into a class:
41+
파이프라인을 구성하는 과정을 클래스로 캡슐화합시다.
4242
4343
```cpp
4444
struct PipelineBuilderCreateInfo {
@@ -64,7 +64,7 @@ class PipelineBuilder {
6464
};
6565
```
6666

67-
The implementation is quite verbose, splitting it into multiple functions helps a bit:
67+
구현은 다소 길어질 수 있으니, 여러 함수로 나누어 작성하는 것이 좋습니다.
6868

6969
```cpp
7070
// single viewport and scissor.
@@ -192,6 +192,7 @@ auto PipelineBuilder::build(vk::PipelineLayout const layout,
192192
```
193193
194194
`App` will need to store a builder, a Pipeline Layout, and the Pipeline(s):
195+
`App`은 빌더, 파이프라인 레이아웃, 그리고 파이프라인을 담아야 합니다.
195196
196197
```cpp
197198
std::optional<PipelineBuilder> m_pipeline_builder{};
@@ -236,7 +237,7 @@ void create_pipeline() {
236237
}
237238
```
238239

239-
Finally, `App::draw()`:
240+
마지막으로 `App::draw()`를 구현합니다.
240241

241242
```cpp
242243
void draw(vk::CommandBuffer const command_buffer) const {

guide/translations/ko-KR/src/shader_objects/shader_program.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Shader Program
1+
# 셰이더 프로그램
22

3-
To use Shader Objects we need to enable the corresponding feature and extension during device creation:
3+
셰이더 오브젝트를 사용하려면 디바이스 생성 시 대응되는 기능과 확장을 활성화해야 합니다.
44

55
```cpp
66
auto shader_object_feature =
@@ -15,9 +15,10 @@ static constexpr auto extensions_v = std::array{
1515
};
1616
```
1717

18-
## Emulation Layer
18+
## 에뮬레이션 레이어
19+
20+
현재 사용중인 드라이버나 물리 디바이스가 `VK_EXT_shader_object`를 지원하지 않을 수 있기 때문에(특히 인텔에서 자주 발생합니다) 디바이스 생성이 실패할 수 있습니다. Vulkan SDK는 이 확장을 구현하는 레이어 [`VK_LAYER_KHRONOS_shader_object`](https://github.com/KhronosGroup/Vulkan-ExtensionLayer/blob/main/docs/shader_object_layer.md)를 제공합니다. 이 레이어를 InstanceCreateInfo에 추가하면 해당 기능을 사용할 수 있습니다.
1921

20-
It's possible device creation now fails because the driver or physical device does not support `VK_EXT_shader_object` (especially likely with Intel). Vulkan SDK provides a layer that implements this extension: [`VK_LAYER_KHRONOS_shader_object`](https://github.com/KhronosGroup/Vulkan-ExtensionLayer/blob/main/docs/shader_object_layer.md). Adding this layer to the Instance Create Info should unblock usage of this feature:
2122

2223
```cpp
2324
// ...
@@ -32,10 +33,10 @@ m_instance = vk::createInstanceUnique(instance_ci);
3233
```
3334

3435
<div class="warning">
35-
This layer <em>is not</em> part of standard Vulkan driver installs, you must package the layer with the application for it to run on environments without Vulkan SDK / Vulkan Configurator. Read more <a href="https://docs.vulkan.org/samples/latest/samples/extensions/shader_object/README.html#_emulation_layer">here</a>.
36+
이 레이어는 표준 Vulkan 드라이버 설치에 포함되어 있지 <em>않기</em> 때문에, Vulkan SDK나 Vulkan Configurator가 없는 환경에서도 실행할 수 있도록 애플리케이션과 함께 패키징해야 합니다. 자세한 내용은<a href="https://docs.vulkan.org/samples/latest/samples/extensions/shader_object/README.html#_emulation_layer">여기</a>를 참고하세요.
3637
</div>
3738

38-
Since desired layers may not be available, we can set up a defensive check:
39+
원하는 레이어가 사용 불가능할 수 있으므로, 이를 확인하는 코드를 추가하는 것이 좋습니다.
3940

4041
```cpp
4142
[[nodiscard]] auto get_layers(std::span<char const* const> desired)
@@ -64,9 +65,9 @@ instance_ci.setPEnabledLayerNames(layers);
6465
6566
## `class ShaderProgram`
6667
67-
We will encapsulate both vertex and fragment shaders into a single `ShaderProgram`, which will also bind the shaders before a draw, and expose/set various dynamic states.
68+
정점 셰이더와 프래그먼트 셰이더를 하나의 `ShaderProgram`으로 캡슐화하여, 그리기 전에 셰이더를 바인딩하고 다양한 동적 상태를 설정할 수 있도록 하겠습니다.
6869
69-
In `shader_program.hpp`, first add a `ShaderProgramCreateInfo` struct:
70+
`shader_program.hpp`에서 가장 먼저 `ShaderProgramCreateInfo` 구조체를 추가합니다.
7071
7172
```cpp
7273
struct ShaderProgramCreateInfo {
@@ -77,9 +78,9 @@ struct ShaderProgramCreateInfo {
7778
};
7879
```
7980

80-
> Descriptor Sets and their Layouts will be covered later.
81+
> 디스크립터 셋과 레이아웃은 이후에 다루겠습니다.
8182
82-
Start with a skeleton definition:
83+
간단한 형태의 정의부터 시작합니다.
8384

8485
```cpp
8586
class ShaderProgram {
@@ -95,7 +96,7 @@ class ShaderProgram {
9596
};
9697
```
9798
98-
The definition of the constructor is fairly straightforward:
99+
생성자의 정의는 꽤 단순합니다.
99100
100101
```cpp
101102
ShaderProgram::ShaderProgram(CreateInfo const& create_info) {
@@ -129,7 +130,7 @@ ShaderProgram::ShaderProgram(CreateInfo const& create_info) {
129130
}
130131
```
131132

132-
Expose some dynamic states via public members:
133+
몇 가지 동적 상태를 public 멤버를 통해 나타냅니다.
133134

134135
```cpp
135136
static constexpr auto color_blend_equation_v = [] {
@@ -150,7 +151,7 @@ vk::ColorBlendEquationEXT color_blend_equation{color_blend_equation_v};
150151
vk::CompareOp depth_compare_op{vk::CompareOp::eLessOrEqual};
151152
```
152153
153-
Encapsulate booleans into bit flags:
154+
불 값을 비트 플래그로 캡슐화합니다.
154155
155156
```cpp
156157
// bit flags for various binary states.
@@ -167,7 +168,7 @@ static constexpr auto flags_v = AlphaBlend | DepthTest;
167168
std::uint8_t flags{flags_v};
168169
```
169170

170-
There is one more piece of pipeline state needed: vertex input. We will consider this to be constant per shader and store it in the constructor:
171+
파이프라인 상태에 필요한 요소가 하나 남아있습니다. 정점 입력입니다. 이는 셰이더마다 고정된 값이 될 것이므로 생성자에 저장할 것입니다.
171172

172173
```cpp
173174
// shader_program.hpp
@@ -198,14 +199,14 @@ ShaderProgram::ShaderProgram(CreateInfo const& create_info)
198199
}
199200
```
200201
201-
The API to bind will take the command buffer and the framebuffer size (to set the viewport and scissor):
202+
바인딩할 API는 Viewport와 Scissor 설정을 위해 커맨드 버퍼와 프레임 버퍼 크기를 받습니다
202203
203204
```cpp
204205
void bind(vk::CommandBuffer command_buffer,
205206
glm::ivec2 framebuffer_size) const;
206207
```
207208

208-
Add helper member functions and implement `bind()` by calling them in succession:
209+
멤버 함수를 추가하고 순차적으로 이를 호출하여 `bind()`를 구현합니다.
209210

210211
```cpp
211212
static void set_viewport_scissor(vk::CommandBuffer command_buffer,
@@ -228,7 +229,7 @@ void ShaderProgram::bind(vk::CommandBuffer const command_buffer,
228229
}
229230
```
230231
231-
Implementations are long but straightforward:
232+
구현은 길지만 꽤 단순합니다.
232233
233234
```cpp
234235
namespace {

0 commit comments

Comments
 (0)