当前位置:   article > 正文

Unity Shader 数据精度使用情况 float half fixed_unity中怎么在shader确定float的精度

unity中怎么在shader确定float的精度

Unity Shader 数据精度使用情况 float half fixed

Most mobile GPUs support both precision types, half being more efficient. So if you’re optimizing for mobiles it makes sense to use half as much as possible. The rule of thumb is to use float for positions and texture coordinates only and half for everything else, provided that the results are good enough.

When not targeting mobile platforms, precision isn’t an issue because the GPU always uses float, even if we write half. I’ll consistently use float in this tutorial series.

There’s also the fixed type, but it’s only really supported by old hardware that you wouldn’t target for modern apps. It’s usually equivalent to half.

来源:https://catlikecoding.com/unity/tutorials/custom-srp/draw-calls/

翻译:
大多数移动GPU都支持这两种精度类型,half类型效率要高。所以,如果你在优化移动设备,那么尽可能多地使用half是有意义的。根据使用经验,只在位置(Positions)和纹理坐标(Texture Coordinates)上使用float,其他的在结果足够好的情况下使用half。

当不针对移动平台时,精度不是问题,因为GPU总是使用浮点数,即使我们写了half。

也有fixed类型,但它只主要支持旧设备,现代应用程序不用考虑它。fixed通常就相当于half。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/125733
推荐阅读
相关标签
  

闽ICP备14008679号