src/common/mathutil.cpp


Log

Author Commit Date CI Message
Alexey Knyazev 0ac0603e 2024-05-14T00:00:00 Fold nested std::max calls When a maximum of three values is needed, an initializer list with all three values is more readable than two std::max calls. Fixed: angleproject:8695 Change-Id: I073ea1af07b215610c85981eea03f6e73107bce6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5541974 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Carl Woffenden 679d1187 2021-01-12T18:25:39 Fix to build with VS2019 When building with VS2019 (using is_clang=false) multiples of the following error are given: ../../src/common/mathutil.cpp(75): error C4244: '=': conversion from 'double' to 'float', possible loss of data (This is due to pow(), when passed an int for the second param, widens the first param to a double then returns a double). Since the code was being changed the opportunity was taken to: - add missing unit tests for the two 999E5 conversions - optimise out the common pow() functions The unit tests were written against the original implementation, then the optimisations added and verified against the original results. Bug: angleproject:5521, dawn:602 Change-Id: Ic9e5eaedbe3fc7ceeed697898823b76dffcd989a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2624888 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Alexey Knyazev 31e36a63 2020-03-14T21:40:58 Reland "Refactor BitCount" This is a reland of baecb7d55c692a93a29a46939029b8262174ca62 Directly use NEON instructions on ARM/ARM64 on MSVC. Original change's description: > Refactor BitCount > > POPCNT intrinsics cannot be used without hardware support, so a CPUID > check and polyfills are required for some CPUs when using MSVC to > avoid runtime failure. > > Other changes include: > - Clang: use builtins on all platforms to provide exact intent to the > compiler; > - MSVC on ARM: use dedicated intrinsics; > - x86/x64 fallback is now branchless and works in constant time. > > Bug: angleproject:4462 > Change-Id: I00fcabda1c842677d8cb4bfd280d932d0d10c0a5 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2102811 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Commit-Queue: Geoff Lang <geofflang@chromium.org> Bug: angleproject:4462 Change-Id: Ia58ae00fa4230f77d981d4ba393fa3481806c5b0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2113570 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Jamie Madill 26f8f1a9 2020-03-20T14:54:11 Revert "Refactor BitCount" This reverts commit baecb7d55c692a93a29a46939029b8262174ca62. Reason for revert: Broke Skia Win/ARM builder. See issue for details. Original change's description: > Refactor BitCount > > POPCNT intrinsics cannot be used without hardware support, so a CPUID > check and polyfills are required for some CPUs when using MSVC to > avoid runtime failure. > > Other changes include: > - Clang: use builtins on all platforms to provide exact intent to the > compiler; > - MSVC on ARM: use dedicated intrinsics; > - x86/x64 fallback is now branchless and works in constant time. > > Bug: angleproject:4462 > Change-Id: I00fcabda1c842677d8cb4bfd280d932d0d10c0a5 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2102811 > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Commit-Queue: Geoff Lang <geofflang@chromium.org> TBR=geofflang@chromium.org,jmadill@chromium.org,lexa.knyazev@gmail.com Change-Id: Ia1756abdf7da2aa9574149eb388915f97758bba0 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:4462 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2112276 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Alexey Knyazev baecb7d5 2020-03-14T21:40:58 Refactor BitCount POPCNT intrinsics cannot be used without hardware support, so a CPUID check and polyfills are required for some CPUs when using MSVC to avoid runtime failure. Other changes include: - Clang: use builtins on all platforms to provide exact intent to the compiler; - MSVC on ARM: use dedicated intrinsics; - x86/x64 fallback is now branchless and works in constant time. Bug: angleproject:4462 Change-Id: I00fcabda1c842677d8cb4bfd280d932d0d10c0a5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2102811 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Stuart Morgan 9d737966 2019-08-14T12:25:12 Standardize copyright notices to project style For all "ANGLE Project" copyrights, standardize to the format specified by the style guide. Changes: - "Copyright (c)" and "Copyright(c)" changed to just "Copyright". - Removed the second half of date ranges ("Y1Y1-Y2Y2"->"Y1Y1"). - Fixed a small number of files that had no copyright date using the initial commit year from the version control history. - Fixed one instance of copyright being "The ANGLE Project" rather than "The ANGLE Project Authors" These changes are applied both to the copyright of source file, and where applicable to copyright statements that are generated by templates. BUG=angleproject:3811 Change-Id: I973dd65e4ef9deeba232d5be74c768256a0eb2e5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1754397 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill b980c563 2018-11-27T11:34:27 Reformat all cpp and h files. This applies git cl format --full to all ANGLE sources. Bug: angleproject:2986 Change-Id: Ib504e618c1589332a37e97696cdc3515d739308f Reviewed-on: https://chromium-review.googlesource.com/c/1351367 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jeff Gilbert c0b82333 2018-09-26T18:04:05 Polyfill BitCount for ARM/ARM64 on MSVC. Also _WIN64 implies _WIN32. Bug: angleproject:2858 Change-Id: I63e2ffd2e9e304171ea6adb99836733981cc1813 Reviewed-on: https://chromium-review.googlesource.com/1248441 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 51c4768b 2016-10-25T15:50:14 Fix a couple global variable warnings. The DynamicHLSL code was using global strings to find stubs. The math code was also using pow in a global, which can be replaced with a simple bit shift. BUG=angleproject:1459 Change-Id: Idb0602ab7640c221843385b0a0a4cfecd5fd3a26 Reviewed-on: https://chromium-review.googlesource.com/403289 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Sami Väisänen e45e53bd 2016-05-25T10:36:04 Support CHROMIUM_path_rendering This is partial support for CHROMIUM_path_rendering and implements basic path management and non-instanced rendering. BUG=angleproject:1382 Change-Id: I9c0e88183e0a915d522889323933439d25b45b5f Reviewed-on: https://chromium-review.googlesource.com/348630 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
hendrikw 75782629 2015-09-25T11:28:50 Fix possible compiler errors on linux Change-Id: Ifc45446c749690eddc406f66f144304262f04664 Reviewed-on: https://chromium-review.googlesource.com/302478 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Minmin Gong 794e0009 2015-04-07T18:31:54 Fix and enable warning C4244 (Conversion from 'type1' to 'type2', possible loss of data) Change-Id: Id0e06d7d6600344d858f00dabc219d79289bbc82 Reviewed-on: https://chromium-review.googlesource.com/265020 Tested-by: Minmin Gong <mgong@microsoft.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill b3584fb4 2015-04-09T17:34:21 Revert "Fix and enable warning C4244 (Conversion from 'type1' to 'type2', possible loss of data)" Causing a build failure on Mac/Clang: ./Tokenizer.cpp:551:7: error: extra tokens at end of #else directive [-Werror,-Wextra-tokens] #else if defined(_MSC_VER) http://build.chromium.org/p/chromium.gpu.fyi/builders/GPU%20Mac%20Builder/builds/29136 This reverts commit 3b26e231d99154814eb428f75a67bbe7a21adadc. Change-Id: I2d11ddcc18130d908fd2ec3d6f5ab890cfccd5e7 Reviewed-on: https://chromium-review.googlesource.com/264983 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Minmin Gong 3b26e231 2015-04-07T18:31:54 Fix and enable warning C4244 (Conversion from 'type1' to 'type2', possible loss of data) Change-Id: I73d9a2b9ad16f032be974b9c819de0dc1247c2ea Reviewed-on: https://chromium-review.googlesource.com/264533 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang 0b7eef7c 2014-06-12T14:10:47 Removed common_includes.h reordered includes. Since we are not using precompiled headers anymore, remove common_includes.h so that fewer files are included in cpp files. Reordered includes to be in the following order: 1) Local ANGLE project headers, ordered by directory in descending depth 2) GL headers 3) STL headers This helps enforce the include-what-you-use principal by reducing the number of STL headers unexpectedly shared between files. This include order conflicts with some of the Google c++ style guide which states that STL includes should be first but this helps us catch more issues. Change-Id: I8f7785f4ad574e253dd3c7b4fb1e54d3ce3b99fc Reviewed-on: https://chromium-review.googlesource.com/214850 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 4f267868 2014-04-17T15:53:37 Fix Linux build. We were missing several header includes necessary for GCC. Also our static assert macro had a bug, preventing us from using the same assert in multiple places. BUG=angle:568 Change-Id: I01bcdef033a9380f436cbf4bd2a9f11b1553887c Reviewed-on: https://chromium-review.googlesource.com/195471 Reviewed-by: Shannon Woods <shannonwoods@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang 17732823 2013-08-29T13:46:49 Moved the compiler source files into directories based on their project and added a compiler.gypi to generate the compiler projects.
shannonwoods@chromium.org 92b9cd57 2013-05-30T00:14:48 Added support for the GL_RGB9_E5 format. git-svn-id: https://angleproject.googlecode.com/svn/branches/es3proto@2363 736b8ea6-26fd-11df-bfd4-992fa37f6226