Primitives are basic drawing
shapes, like triangles, lines, and points. Exactly how the list of vertices is
interpreted as primitives is handled via a later stage.

图元是OpenGL能画的最基本的图形，比如三角形、线段和点。后续步骤会解决如何解释这些顶点的问题。

This part of the pipeline deals
with a number of objects like Vertex Array Objects and Vertex Buffer Objects. Vertex Array Objects
define what data each vertex has, while Vertex Buffer Objects store the actual
vertex data itself.

A vertex's data is a series of attributes.
Each attribute is a small set of data that the next stage will do computations
on. While a set of attributes do specify a vertex, there is nothing that says
that part of a vertex's attribute set needs to be a position or normal.
Attribute data is entirely arbitrary; the only meaning assigned to any of it
happens in the vertex processing stage.

Vertex
Rendering(顶点渲染)

Once the vertex data is properly
specified, it is then rendered as a Primitive via
a drawing command.

准备好了顶点数据，就可以通过绘制指令将其渲染为图元了。

+BIT祝威+悄悄在此留下版了个权的信息说：

Vertex
Processing(顶点处理)

Vertices fetched due to the prior
vertex rendering stage begin their processing here. The vertex processing
stages are almost all programmable operations. This allows user code to customize
the way vertices are processed. Each stage represents a different kind of
shader operation.

Vertex
shader(顶点着色器)

Vertex shaders perform basic
processing of each individual vertex. Vertex shaders receive the attribute
inputs from the vertex rendering and converts each incoming vertex into a
single outgoing vertex based on an arbitrary, user-defined program.

Vertex shaders can have
user-defined outputs, but there is also a special output that represents the
final position of the vertex. If there are no subsequent vertex processing
stages, vertex shaders are expected to fill in this position with the
clip-space position of the vertex, for rendering purposes.

One limitation on vertex
processing is that each input vertex must map to a specific output
vertex. And because vertex shader invocations cannot share state
between them, the input attributes to output vertex data mapping is 1:1. That
is, if you feed the exact same attributes to the same vertex shader in the same
primitive, you will get the same output vertex data. This gives implementations
the right to optimize vertex processing; if they can detect that they're about
to process a previously processed vertex, they can use the previously processed
data stored in a post-transform cache. Thus they do not have to
run the vertex processing on that data again.

Tessellation(曲面细分)

Primitives can be tessellated
using two shader stages and a fixed-function tessellator between them. The Tessellation Control Shader (TCS) stage
comes first, and it determines the amount of tessellation to apply to a
primitive, as well as ensuring connectivity between adjacent tessellated primitives.
The Tessellation Evaluation Shader (TES)
stage comes last, and it applies the interpolation or other operations used to
compute user-defined data values for primitives generated by the fixed-function
tessellation process.

Tessellation as a process is
optional. Tessellation is considered active if a TES is active. The TCS is
optional, but a TCS can only be used alongside a TES. 曲面细分是可选的。启用TES就等于启用了曲面细分。TCS是可选的，但TCS只能陪伴着TES出现。

Geometry
Shader(几何着色器)

Geometry shaders are user-defined
programs that process each incoming primitive, returning zero or more output
primitives.

几何着色器的输入数据是一个图元，输出是0~多个图元。

The input primitives for geometry
shaders are the output primitives from a subset of the Primitive
Assembly process. So if you send a triangle strip as a single primitive,
what the geometry shader will see is a series of triangles.

几何着色器的输入图元的类型是图元组装步骤的一个子集。所以当你将三角形带作为一个单独的图元输送给几何着色器时，它会将其视作若干个三角形。

However, there are a number of
input primitive types that are defined specifically for geometry shaders. These
adjacency primitives give GS's a larger view of the primitives; they provide
access to vertices of primitives adjacent to the current one.

不过，有几个图元类型是几何着色器特有的。邻接图元给了GS更大的选择范围，它们提供了对与当前图元相邻的图元的处理方法。

The output of a GS is zero or
more simple primitives, much like the output of primitive assembly. The GS is
able to remove primitives, or tessellate them by outputting many primitives for
a single input. The GS can also tinker with the vertex values themselves,
either doing some of the work for the vertex shader, or just to interpolate the
values when tessellating them. Geometry shaders can even convert primitives to
different types; input point primitives can become triangles, or lines can
become points.

Transform
Feedback(这个术语还是不翻译的好)

The outputs of the geometry
shader or primitive assembly are written to a series of buffer
objects that have been setup for this purpose. This is called transform
feedback mode; it allows the user to do transform data via vertex and geometry
shaders, then hold on to that data for use later.

Clipping(裁剪)

The primitives are then clipped.
Clipping means that primitives that lie on the boundary between the inside of
the viewing volume and the outside are split into several primitives, such that
the entire primitive lies in the volume. Also, the last Vertex
Processing shader stage can specify user-defined clipping operations, on a
per-vertex basis.

Primitive
assembly(图元组装)

Primitive assembly is the process
of collecting a run of vertex data output from the prior stages and composing
it into a sequence of primitives. The type of primitive the user rendered with
determines how this process works.

图元组装就是把顶点组合为图元的过程。图元的类型是用户（OpenGL程序员）指定的。

The output of this process is an
ordered sequence of simple primitives (lines, points, or triangles). If the
input is a triangle strip primitive containing 12 vertices, for example, the
output of this process will be 10 triangles.

这一步骤的输出结果是一系列有序的简单图元（线段、点或三角形等）。例如，若输入的是由包含12个顶点的三角形带，那么输出的就是10个三角形。

If tessellation or geometry
shaders are active, then a limited form of primitive assembly is executed
before these Vertex Processing stages. This is used to feed
those particular shader stages with individual primitives, rather than a
sequence of vertices.

Face
culling(面剔除)

Triangle primitives can be culled
(ie: discarded without rendering) based on the triangle's facing in window
space. This allows you to avoid rendering triangles facing away from the
viewer. For closed surfaces, such triangles would naturally be covered up by
triangles facing the user, so there is never any need to render them. Face
culling is a way to avoid rendering such primitives.

Rasterization(光栅化)

Primitives that reach this stage
are then rasterized in the order in which they were given. The result of
rasterizing a primitive is a sequence of Fragments.

到达这一阶段的图元依次被光栅化，得到的结果就是若干片段（片元）。

A fragment is a set of state that
is used to compute the final data for a pixel (or sample if multisampling
is enabled) in the output framebuffer. The state for a fragment includes its
position in screen-space, the sample coverage if multisampling is enabled, and
a list of arbitrary data that was output from the previous vertex or geometry
shader.

Fragment
Processing(片段处理)

The data for each fragment from
the rasterization stage is processed by a fragment shader. The output from a
fragment shader is a list of colors for each of the color buffers being written
to, a depth value, and a stencil value. Fragment shaders are not able to set
the stencil data for a fragment, but they do have control over the color and
depth values.

Fragment shaders are optional. If
you render without a fragment shader, the depth (and stencil) values of the
fragment get their usual values. But the value of all of the colors that a
fragment could have are undefined. Rendering without a fragment shader is
useful when rendering only a primitive's default depth information to the depth
buffer, such as when performing Occlusion
Query tests.

Per-Sample
Operations(逐采样的操作)

The fragment data output from the
fragment processor is then passed through a sequence of steps.

片段着色器输出的片段数据要经过一系列后续步骤。

The first step is a sequence of
culling tests; if a test is active and the fragment fails the test, the
underlying pixels/samples are not updated (usually). Many of these tests are
only active if the user activates them. The tests are: (第一步是一系列剔除测试。如果某项测试被启用了并且一个片段没有通过测试，那么（一般情况下）这个片段就会被抛弃，即不会影响到将来的像素/采样值。许多测试只有用户（OpenGL程序员）启用他们后才会生效。这些测试是：)

Pixel
ownership test: Fails if the fragment's pixel is not "owned" by
OpenGL (if another window is overlapping with the GL window). Always
passes when using a Framebuffer Object. Failure means that the
pixel contains undefined values.(像素归属测试：如果片段所在的像素不属于OpenGL（如果另一个窗口覆盖在GL窗口上），那么测试不通过。当使用Framebuffer对象时，测试永远通过。测试不通过意味着像素包含未定义的值。)

Scissor
Test: When enabled, the test fails if the fragment's pixel lies
outside of a specified rectangle of the screen.(剪切测试：启用后，若片段的像素位于指定范围之外则测试不通过。)

Stencil
Test: When enabled, the test fails if the stencil value provided by
the test does not compare as the user specifies against the stencil value
from the underlying sample in the stencil buffer. Note that the stencil
value in the framebuffer can still be modified even if the stencil test
fails (and even if the depth test fails).(模板测试：启用后，若test提供的模板值与模板缓存中的模板值并不具有用户指定的关系，则测试不通过。注意，即使模板测试失败，Framebuffer中的模板值仍旧会被修改。)

Depth
Test: When enabled, the test fails if the fragment's depth does not
compare as the user specifies against the depth value from the underlying
sample in the depth buffer.(深度测试：启用后，若片段的深度值与深度缓存中的深度值并不符合用户指定的要求，则测试不通过。)

Note: Though these are specified to happen
after the Fragment Shader, they can be made to happen before the fragment shader under certain
conditions. If they happen before the FS, then any culling of the fragment will
also prevent the fragment shader from executing, this saving performance.(注意：尽管这些测试名义上是在片段着色器之后发生的，在某些条件下他们其实可以在片段着色器之前发生。如果他们在片段着色器之前发生，那么在任何剔除片段的测试不通过时，接下来的片段着色器都不会执行了。这可以提升性能。)

After this, color blending
happens. For each fragment color value, there is a specific blending operation
between it and the color already in the framebuffer at that location. Logical
Operations may also take place in lieu of blending, which perform bitwise
operations between the fragment colors and framebuffer colors.

Lastly, the fragment data is
written to the framebuffer. Masking operations allow the user to prevent writes to
certain values. Color, depth, and stencil writes can be masked on and off;
individual color channels can be masked as well.