You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: impeller/docs/babys_first_triangle.md
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ Shaders define the programmable stages of a pipeline. We are going to be define
17
17
18
18
The job of a vertex shader is to transform the vertices of our triangle into [normalized device coordinates](coordinate_system.md) (NDC). The rasterizer will then take these coordinates and convert them to 2D coordinates in the framebuffer.
19
19
20
-
OTOH, the job of the fragment shader is to shade (color) the pixels covered by the triangle.
20
+
On the other hand, the job of the fragment shader is to shade (color) the pixels covered by the triangle.
21
21
22
22
#### Vertex Shader
23
23
@@ -62,9 +62,9 @@ struct PerVertexData {
62
62
63
63
The compiler has detected that the shader expects one point position per vertex. It is going to be our job to fill this in during rendering.
64
64
65
-
This struct is handy because as you tinker on your shader, the compiler will add, remove, and reorder the fields. If there are alignment considerations for the GPU, the compiler knows about these and it will add the appropriate padding between these fields so you all you have to worry about is filling in the position. You don't have to use this struct directly, but trusting the compiler will greatly simplify you experience.
65
+
This struct is handy because as you tinker on your shader, the compiler will add, remove, and reorder the fields. If there are alignment considerations for the GPU, the compiler knows about these and it will add the appropriate padding between these fields so you all you have to worry about is filling in the position. You don't have to use this struct directly, but trusting the compiler will greatly simplify your experience.
66
66
67
-
Notice that all these interfaces and metadata are in a struct called `BabyVertexShader`. Find a similar struct called `BabyFragmentShader` in `baby.frag.h`. [Tinker around with the shader in the compiler explorer](https://tinyurl.com/28fypq2b) to see what the compiler generates.
67
+
All these interfaces and metadata are in a struct called `BabyVertexShader`. Find a similar struct called `BabyFragmentShader` in `baby.frag.h`. [Tinker around with the shader in the compiler explorer](https://tinyurl.com/28fypq2b) to see what the compiler generates.
68
68
69
69
Now, let's put together a pipeline. First you need a pipeline descriptor.
70
70
@@ -119,7 +119,7 @@ If you change the vertex information in your shader, the `PerVertexData` struct
119
119
120
120
### Draw
121
121
122
-
You don't all the heavy lifting already. Per frame, you only need to set the pipeline and vertex buffer you've stashed in the render pass and invoke a draw call.
122
+
You've done all the heavy lifting already. Per frame, you only need to set the pipeline and vertex buffer you've stashed in the render pass and invoke a draw call.
123
123
124
124
```c++
125
125
pass.SetPipeline(pipeline);
@@ -162,7 +162,7 @@ And in the body, set the color of the fragment to the this input.
162
162
frag_color = v_color;
163
163
```
164
164
165
-
Notice we didn't do anything to perform the color mixing. That's because the rasterizer interpolates the values between stages. Since the varies depending on the pixel, we call these "varyings" and use the `v_` prefix for such variables.
165
+
We didn't do anything to perform the color mixing. That's because the rasterizer interpolates the values between stages. Since the varies depending on the pixel, we call these "varyings" and use the `v_` prefix for such variables.
166
166
167
167
We are done with the shaders. But the compiler now warns that the vertex buffer builder can no longer build our vertex buffer! And its right because each vertex now needs to be supplied a color as well. Patch this in.
0 commit comments