`premise mediump float'是什么意思? [英] What does `precision mediump float` mean?

查看:114
本文介绍了`premise mediump float'是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

learningwebgl tutorial1 中,我在片段着色器中发现了一条有趣的行. /p>

In the learningwebgl tutorial1 I've found an interesting line in the fragment shader.

precision mediump float;

我找到了有关它的文章在这里,但是我还是不明白这是什么意思?

I've found an article about it here, but I still can't understand what does it mean?

如果我删除此行,则没有任何变化.一切都一样. 那么precision mediump float是什么意思?

And if I remove this line, nothing changes. Everything is the same. So what does precision mediump float mean?

推荐答案

这确定GPU在计算浮点数时使用的精度. highp是高精度,并且当然比mediump(中精度)和lowp(低精度)更密集.

This determines how much precision the GPU uses when calculating floats. highp is high precision, and of course more intensive than mediump (medium precision) and lowp (low precision).

某些系统完全不支持highp,这将导致代码在这些系统上根本无法工作.

Some systems do not support highp at all, which will cause code not to work at all on those systems.

在确实支持highp的系统上,您会看到性能下降,应尽可能使用mediumplowp.我看到的一个好的经验法则是:
-highp用于顶点位置,
-mediump用于纹理坐标,
-lowp表示颜色.

On systems that DO support highp, you will see a performance hit, and should use mediump and lowp wherever possible. A good rule of thumb that I saw was:
- highp for vertex positions,
- mediump for texture coordinates,
- lowp for colors.

希望有帮助!

这篇关于`premise mediump float'是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆