This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // half->float variants. | |
| // by Fabian "ryg" Giesen. | |
| // | |
| // I hereby place this code in the public domain. | |
| // | |
| // half_to_float_fast: table based | |
| // tables could be done in a more compact fashion (in particular, can store tab2 in low word of tab1!) | |
| // but something of a dead end since not very SIMD-friendly. pretty much abandoned at this point. | |
| // | |
| // half_to_float_fast2: use FP adder hardware to deal with denormals. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // THIS IS ONLY A PORTION OF THE FILE | |
| // WILL NOT COMPILE OUT OF THE BOX! | |
| void OrthogonalizeTangent (TangentInfo& tangentInfo, Vector3f normalf, Vector4f& outputTangent) | |
| { | |
| TangentInfo::Vector3d normal = { normalf.x, normalf.y, normalf.z }; | |
| TangentInfo::Vector3d tangent = tangentInfo.tangent; | |
| TangentInfo::Vector3d binormal = tangentInfo.binormal; |