ARB_precision_hint_fastest,ARB_precision_hint_nicest 的意义,作用
来源:互联网 发布:在淘宝代运营公司工作 编辑:程序博客网 时间:2024/06/06 08:52
首先必须吐槽一下,百度搜任何跟技术相关的东西,简直是辣鸡的不行,还是vpn翻墙google王道,分分钟找到想要的内容。。。
其实之前知道这2个命令是干什么的,但是总是会忘记,鉴于这个情况,所以决定还是做一下笔记了~
首先,这2命令最权威解释的地方,肯定就是openGl官网了,以下是链接:
https://www.opengl.org/registry/specs/NV/fragment_program4.txt
这里有这么一段:
+
Precision Hints (ARB_precision_hint_fastest, ARB_precision_hint_nicest)
Fragment program computations are carried out at an implementation-dependent precision. However, some implementations may be able to performfragment program computations at more than one precision, and may be ableto trade off computation precision for performance.If a fragment program specifies the "ARB_precision_hint_fastest" programoption, implementations should select precision to minimize programexecution time, with possibly reduced precision. If a fragment programspecifies the "ARB_precision_hint_nicest" program option, implementationsshould maximize the precision, with possibly increased execution time.Only one precision control option may be specified by any given fragmentprogram. A fragment program that specifies both the"ARB_precision_hint_fastest" and "ARB_precision_hint_nicest" programoptions will fail to load.
看标题也知道了,也就是精度提示。
ARB_precision_hint_fastest
最快的,意思就是会用低精度(一般是指fp16),以提升片段着色器的运行速度,减少时间。
ARB_precision_hint_nicest
最佳的,意思就是会用高精度(一般是指fp32),可能会降低运行速度,增加时间。
注意:这2个命令不可以同时使用
unity
里的写法是 #pragma fragmentoption ARB_precision_hint_fastest
具体说fp16,fp32是什么的话,就涉及到GPU的知识了,我也不是太懂。
大概说说的话,fp16在gpu里一般被称为半精度计算。
图形计算中使用的精度是:
FP16,16bit,半精度
FX10,10bit,都不是浮点,而是定点数了
FP32,32bit,单精度(最常见的)
FP64,64bit,双精度(不常见的,图像处理一般用不到)
虽然在实际应用中,这2种精度在表现上区别并不大,但是还是建议使用fp16精度的更好。
因为像在 ARM Mali, Imagination PowerVR 这种移动GPU上,都有独立的fp16单元,也就是说,fp16是从硬件电路级别上被支持的,我们知道,这就意味着一个字,那就是“快!”,所以你懂的!
不过据说NVIDIA的gpu里,都是用fp32 CUDA核心
去处理fp16的。(这其实是比单独的fp16单元要慢的)
总结一下就是在写shader时可以顺手把这个命令给加上,但是如果你忘记了,或者懒,其实问题也不是太大,以上!
- ARB_precision_hint_fastest,ARB_precision_hint_nicest 的意义,作用
- 接口的作用和意义
- 关键字super的作用意义
- layout_weight的作用以及意义
- HashCode的意义和作用
- UUID的意义和作用
- Collcition的作用及意义
- NETIF_FLAG_LINK_UP的意义和作用
- RSS的作用及存在的意义
- 软件开发模型的意义和作用
- SDP文件的作用及其意义
- MAC地址 的意义及作用
- C++虚基类的作用、用法和意义
- 认识店面桌面图标的作用和意义
- 离线应用程序的意义及作用
- #pragma mark的意义和作用
- 定义serialVersionUID的作用与意义整理
- wt.method.MethodContext的作用和意义
- 第二章View与动画
- CoherentNoise(相干噪声)
- native2ascii.exe详细使用方法、native2ascii转换示例
- CodeForces 286C Main Sequence
- Linux学习日志(十)
- ARB_precision_hint_fastest,ARB_precision_hint_nicest 的意义,作用
- UVa - 1592 Database(STL综合,强推!)
- Linux学习日志(九)
- 读取spring配置文件的方法(spring读取资源文件)
- LeetCode 026 Remove Duplicates from Sorted Array
- MyBatis入门时的一些细节问题
- NYOJ-6-喷水装置(一)
- 前台提交servlet存入数据库乱码问题
- LeetCode 027 Remove Element