Har*_*ain 48 javascript terminology opengl-es webgl fragment-shader
在learnwebgl tutorial1中,我在片段着色器中发现了一条有趣的行.
precision mediump float;
Run Code Online (Sandbox Code Playgroud)
我在这里发现了一篇关于它的文章,但我仍然无法理解这是什么意思?
如果我删除这一行,没有任何变化.一切都是一样的.那precision mediump float
意味着什么?
How*_*ter 72
这决定了GPU在计算浮点数时使用的精度.highp
高精度,当然比mediump
(中等精度)和lowp
(低精度)更密集.
有些系统根本不支持highp
,这会导致代码在这些系统上根本不起作用.
在那些支持系统highp
,你会看到一个性能命中,并应使用mediump
和lowp
尽可能.我看到的一个好的经验法则是:
- highp
对于顶点位置,
- mediump
对于纹理坐标,
- lowp
对于颜色.
希望有所帮助!
归档时间: |
|
查看次数: |
29645 次 |
最近记录: |