Skip to content

Commit 2d05955

Browse files
committed
[Impeller] Followup feedback on "Baby's First Triangle".
Addresses comments made after flutter#52703 landed.
1 parent ba8e0d3 commit 2d05955

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

impeller/docs/babys_first_triangle.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Shaders define the programmable stages of a pipeline. We are going to be define
1717

1818
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.
1919

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.
2121

2222
#### Vertex Shader
2323

@@ -62,9 +62,9 @@ struct PerVertexData {
6262
6363
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.
6464
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.
6666
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.
6868
6969
Now, let's put together a pipeline. First you need a pipeline descriptor.
7070
@@ -119,7 +119,7 @@ If you change the vertex information in your shader, the `PerVertexData` struct
119119

120120
### Draw
121121

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.
123123

124124
```c++
125125
pass.SetPipeline(pipeline);
@@ -162,7 +162,7 @@ And in the body, set the color of the fragment to the this input.
162162
frag_color = v_color;
163163
```
164164

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.
166166

167167
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.
168168

0 commit comments

Comments
 (0)