Real-Time Rendering 3rd 读书笔记(二) The Graphics Processing Unit

3.The Graphics Processing Unit

 

GPU实现的渲染管线的流程: 绿色可编程,黄色只可配置,蓝色是不可操作的.

 

可编程阶段:

Shaders are programmed using C-like shading languages such as HLSL, Cg, and GLSL. These are compiled to a machine-independent assembly language, also called the intermediate language (IL).

两种输入类型:

uniform inputs, with values that remain constant throughout a draw call (but can be changed between draw calls). varying inputs, which are different for each vertex or pixel processed by the shader.

 

 

运算符:

加,乘,点乘等非常高效

reciprocal, square root, sine, cosine, exponentiation, logarithm等,相对比较耗时,不过也挺快的.

 

flow control:(这里就提及到了shader中的分支)

 

可编程shader演进

 

 

Shader model (sm)对比

 

 

顶点着色器 The Vertex Shader

顶点的属性值包括:颜色值,法线,纹理坐标,位置信息, 其中位置信息是顶点着色器必须要输出的

现在的GUP都是支持顶点着色器的.

这个过程中不能创建或销毁顶点数据,数据也不能在顶点间相互传递,而是相互独立的,保证了并行性.

The vertex shader can neither create nor destroy vertices, and results generated by one vertex cannot be passed on to another vertex. Since each vertex is treated independently, any number of shader processors on the GPU can be applied in parallel to the incoming stream of vertices.

 

几何着色器 The Geometry Shader

要求:Shader Model 4.0

Similar to the vertex shader, the geometry shader must output a homogeneous clip space location for each vertex produced.

 

流输出 Stream Output

 

 

 

 

 

像素着色器 The Pixel Shader

因为并行处理,逐片段处理,每个像素的处理结果都不允许传递给相邻数据的,而是采用的插值运算,有一种情况下可以访问到相邻像素的数据,求梯度或求导.

 

The Merging Stage

不可编程阶段,但有高的可配置属性.

 

Effect

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值