zoukankan      html  css  js  c++  java
  • 关于fixed-point

    今天又出现了shader的问题,编译到真机效果就没了,后来仔细还是因为浮点数精度的问题,后来仔细查找了些资料,才发现自己太粗心,没有看清楚 fixed-point 数据类型就乱用,这是个范围在 [-1,+1]或者[-1,+2]之间的浮点数,我却当做普通的浮点数用,导致很多数据溢出,所以才丢失原有的效果,得注意了!

    不明白的就去看 http://http.developer.nvidia.com/CgTutorial/cg_tutorial_chapter03.html 的3.3.2小节吧

    重点:Continuous quantities are not limited to integer values. When programming a CPU, programmers typically use floating-point data types to represent continuous values because floating-point types can represent fractional values. Continuous values processed by GPUs, particularly at the fragment level, have been limited to narrow ranges such as [0, 1] or [-1, +1], rather than supporting the expansive range provided by floating-point. For example, colors are often limited to the [0, 1] range, and normalized vectors are, by definition, confined to the [-1, +1] range. These range-limited data types are known as "fixed-point," rather than floating-point.

     
  • 相关阅读:
    功能测试
    数据库
    loadrunner
    笔记
    基础知识
    类方法, 实例方法, 静态方法
    统计英文单词次数
    合并文件内容
    字典排序
    排序算法
  • 原文地址:https://www.cnblogs.com/yaukey/p/3416290.html
Copyright © 2011-2022 走看看