Bug 1700717 - Build SWGL with -ffast-math. r=lsalzman

Most GLSL compilers will do the kinds of optimizations that
fast-math allows so we should take advantage of them too.

Differential Revision: https://phabricator.services.mozilla.com/D109657
This commit is contained in:
Jeff Muizelaar 2021-03-29 19:44:28 +00:00
Родитель 112e2edfe5
Коммит 7735c5e6f2
2 изменённых файлов: 17 добавлений и 1 удалений

Просмотреть файл

@ -176,6 +176,22 @@ fn main() {
if tool.args().contains(&"-Oz".into()) { if tool.args().contains(&"-Oz".into()) {
build.flag("-O2"); build.flag("-O2");
} }
// Most GLSL compilers assume something like fast-math so we turn it on.
// However, reciprocal division makes it so 1/1 = 0.999994 which can produce a lot of fuzz
// in reftests and the use of reciprocal instructions usually involves a refinement step
// which bloats our already bloated code. Further, our shader code is sufficiently parallel
// that we're more likely to be throughput bound vs latency bound. Having fewer
// instructions makes things easier on the processor and in places where it matters we can
// probably explicitly use reciprocal instructions and avoid the refinement step.
if tool.is_like_msvc() {
build.flag("/fp:fast")
.flag("-Xclang")
.flag("-mrecip=none");
} else {
build.flag("-ffast-math")
.flag("-mrecip=none");
}
} }
build.file("src/gl.cc") build.file("src/gl.cc")

Просмотреть файл

@ -73,7 +73,7 @@ fuzzy(0-1,0-19200) fails-if(OSX) fuzzy-if(skiaContent,0-3,0-20000) fuzzy-if(webr
fuzzy(0-1,0-912) fuzzy-if(webrender,0-3,0-3008) == border-image-repeating-radial-gradient.html border-image-repeating-radial-gradient-ref.html fuzzy(0-1,0-912) fuzzy-if(webrender,0-3,0-3008) == border-image-repeating-radial-gradient.html border-image-repeating-radial-gradient-ref.html
fuzzy(0-1,0-1720) fuzzy-if(skiaContent,0-3,0-1044) fuzzy-if(webrender,0-3,0-62078) == border-image-repeating-radial-gradient-slice-1.html border-image-repeating-radial-gradient-slice-1-ref.html fuzzy(0-1,0-1720) fuzzy-if(skiaContent,0-3,0-1044) fuzzy-if(webrender,0-3,0-62078) == border-image-repeating-radial-gradient-slice-1.html border-image-repeating-radial-gradient-slice-1-ref.html
fuzzy(0-1,0-2119) fuzzy-if(skiaContent,0-3,0-936) fuzzy-if(webrender,0-3,0-40536) == border-image-repeating-radial-gradient-slice-2.html border-image-repeating-radial-gradient-slice-2-ref.html fuzzy(0-1,0-2119) fuzzy-if(skiaContent,0-3,0-936) fuzzy-if(webrender,0-3,0-40536) == border-image-repeating-radial-gradient-slice-2.html border-image-repeating-radial-gradient-slice-2-ref.html
fuzzy(0-1,0-3170) fuzzy-if(skiaContent,0-3,0-1794) fuzzy-if(webrender&&!geckoview,1-3,30-12193) == border-image-repeating-radial-gradient-slice-fill-1.html border-image-repeating-radial-gradient-slice-fill-1-ref.html fuzzy(0-1,0-3170) fuzzy-if(skiaContent,0-3,0-1794) fuzzy-if(webrender&&!geckoview,1-3,30-12194) == border-image-repeating-radial-gradient-slice-fill-1.html border-image-repeating-radial-gradient-slice-fill-1-ref.html
fuzzy(0-1,0-3281) fails-if(OSX) fuzzy-if(skiaContent,0-3,0-1435) fuzzy-if(webrender&&!geckoview,1-2,20-8000) == border-image-repeating-radial-gradient-slice-fill-2.html border-image-repeating-radial-gradient-slice-fill-2-ref.html fuzzy(0-1,0-3281) fails-if(OSX) fuzzy-if(skiaContent,0-3,0-1435) fuzzy-if(webrender&&!geckoview,1-2,20-8000) == border-image-repeating-radial-gradient-slice-fill-2.html border-image-repeating-radial-gradient-slice-fill-2-ref.html
fuzzy(0-1,0-1328) fuzzy-if(webrender,0-3,0-7441) == border-image-repeating-radial-gradient-width.html border-image-repeating-radial-gradient-width-ref.html fuzzy(0-1,0-1328) fuzzy-if(webrender,0-3,0-7441) == border-image-repeating-radial-gradient-width.html border-image-repeating-radial-gradient-width-ref.html
fuzzy(0-4,0-21628) fails-if(OSX) fuzzy-if(webrender,0-8,0-99728) == border-image-repeating-radial-gradient-slice-width.html border-image-repeating-radial-gradient-slice-width-ref.html fuzzy(0-4,0-21628) fails-if(OSX) fuzzy-if(webrender,0-8,0-99728) == border-image-repeating-radial-gradient-slice-width.html border-image-repeating-radial-gradient-slice-width-ref.html