Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90bc765429 | ||
|
|
6e9f2a5d38 | ||
|
|
bf68fdb676 | ||
|
|
2a12820813 | ||
|
|
d293280ead | ||
|
|
379ac785ed | ||
|
|
587af8b0c6 | ||
|
|
d42a4efec2 |
@@ -1,7 +0,0 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
@@ -11,4 +11,3 @@
|
||||
*.jpg binary
|
||||
*.png binary
|
||||
*.pdf binary
|
||||
*.rc text working-tree-encoding=UTF-16LE-BOM eol=CRLF
|
||||
|
||||
@@ -5,10 +5,3 @@ x64
|
||||
*.ncb
|
||||
.*sw?
|
||||
.DS_Store
|
||||
kernels/config.h
|
||||
kernels/hash.h
|
||||
include/embree3/rtcore_config.h
|
||||
build
|
||||
models
|
||||
tbb
|
||||
doc/intelstyle
|
||||
|
||||
-531
@@ -1,531 +0,0 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#####################################################################
|
||||
# Continuous Test
|
||||
####################################################################
|
||||
|
||||
continuous-macosx-x64-Debug-ICC2020.1-ISPC1.12.0-SSE2-TBB2019.9:
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:ICC2020.1 ispc:ispc1.12.0 isa:SSE2 tasking:TBB2019.9 intensity:2"
|
||||
tags: [mac]
|
||||
only: [pushes]
|
||||
|
||||
continuous-windows-x64-RelWithDebInfo-V120-ISPC1.9.2-SSE2-TBB2019.2:
|
||||
script: "python scripts\\test.py platform:x64 build:RelWithDebInfo compiler:V120 ispc:ispc1.9.2 isa:SSE2 tasking:TBB2019.2 intensity:2"
|
||||
tags: [win10, v120]
|
||||
only: [pushes]
|
||||
|
||||
#continuous-windows-Win32-RelWithDebInfoDebug-V140-ISPC1.12.0-SSE2-TBB2019.9:
|
||||
# script: "python scripts\\test.py platform:Win32 build:RelWithDebInfo compiler:V140 ispc:ispc1.12.0 isa:SSE2 tasking:TBB2019.9 intensity:2"
|
||||
# tags: [win10, v140]
|
||||
# only: [pushes]
|
||||
|
||||
continuous-windows-x64-RelWithDebInfo-V141-ISPC1.12.0-SSE2-TBB2019.9:
|
||||
script: "python scripts\\test.py platform:x64 build:RelWithDebInfo compiler:V141 ispc:ispc1.12.0 isa:SSE2 tasking:TBB2019.9 intensity:2 maxinstancelevelcount:8"
|
||||
tags: [win10, v141]
|
||||
only: [pushes]
|
||||
|
||||
continuous-macosx-x64-Debug-CLANG-ISPC1.12.0-SSE2-TBB2019.9:
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG ispc:ispc1.12.0 isa:SSE2 tasking:TBB2019.9 intensity:2"
|
||||
tags: [mac]
|
||||
only: [pushes]
|
||||
|
||||
continuous-linux-avx512vl-x64-Debug-ICC2019.4-ISPC1.12.0-AVX512SKX-TBB2019.9:
|
||||
image: embreedocker/fedora:27
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:ICC2019.4 ispc:ispc1.12.0 isa:AVX512SKX tasking:TBB2019.9 intensity:2 maxinstancelevelcount:4"
|
||||
tags: [docker, avx512vl]
|
||||
only: [pushes]
|
||||
|
||||
continuous-linux-avx512vl-x64-Debug-CLANG4.0.0-ISPC1.12.0-AVX512SKX-TBB2019.9:
|
||||
image: embreedocker/fedora:26
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isa:AVX512SKX tasking:TBB2019.9 intensity:2"
|
||||
tags: [docker, avx512vl]
|
||||
only: [pushes]
|
||||
|
||||
#continuous-linux-knl-x64-Debug-CLANG4.0.0-ISPC1.12.0-AVX512KNL-TBB2019.9:
|
||||
# image: embreedocker/fedora:26
|
||||
# script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isa:AVX512KNL tasking:TBB2019.9 intensity:2"
|
||||
# tags: [docker-knl]
|
||||
# only: [pushes]
|
||||
|
||||
continuous-linux-x64-Debug-CLANG5.0.0-ISPC1.12.0-AVX2-INT-ADDRSANITIZER:
|
||||
image: embreedocker/fedora:26
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG5.0.0 ispc:ispc1.12.0 isa:AVX tasking:INT intensity:1 addrsanitizer:ON"
|
||||
tags: [docker]
|
||||
only: [pushes]
|
||||
|
||||
#continuous-ubuntu17.10-x64-Debug-GCC-ISPC1.12.0-AVX2-TBB-NAMESPACE:
|
||||
# image: embreedocker/ubuntu:17.10
|
||||
# script: "scripts/test.py platform:x64 build:Debug compiler:GCC ispc:ispc1.12.0 isa:AVX2 tasking:TBB intensity:1 api_namespace:myembree"
|
||||
# tags: [docker]
|
||||
# only: [pushes]
|
||||
|
||||
continuous-centos7.4-x64-Debug-GCC-ISPC1.12.0-AVX2-TBB:
|
||||
image: embreedocker/centos:7.4
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:GCC ispc:ispc1.12.0 isa:AVX2 tasking:TBB intensity:1"
|
||||
tags: [docker]
|
||||
only: [pushes]
|
||||
|
||||
continuous-fedora32-x64-Debug-GCC-ISPC-AVX512SKX-TBB:
|
||||
image: embreedocker/fedora:32
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:GCC ispc:ispc isa:AVX512SKX tasking:TBB intensity:2"
|
||||
tags: [docker, avx512vl]
|
||||
only: [pushes]
|
||||
|
||||
continuous-linux-x64-Debug-GCC-ISPC1.12.0-SSE2-TBB-KLOCKWORK:
|
||||
image: embree-kw-centos7
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:GCC ispc:ispc1.12.0 isa:SSE2 tasking:TBB klocwork:ON intensity:0"
|
||||
tags: [kw-scan-docker]
|
||||
only: [pushes]
|
||||
|
||||
continuous-linux-x64-PROTEX:
|
||||
image: amd64/openjdk:8
|
||||
script: "scripts/source_scan_protex.sh"
|
||||
tags: [docker]
|
||||
dependencies: []
|
||||
|
||||
#####################################################################
|
||||
# Intensive Nightly Tests
|
||||
####################################################################
|
||||
|
||||
nightly-windows-x64-RelWithDebInfo-V120-ISPC1.9.2-SSE2-INT:
|
||||
script: "python scripts\\test.py platform:x64 build:RelWithDebInfo compiler:V120 ispc:ispc1.9.2 isa:SSE2 tasking:INT intensity:2"
|
||||
tags: [win10, v120]
|
||||
only: [schedules]
|
||||
|
||||
nightly-windows-x64-RelWithDebInfo-V120-ISPC1.9.2-AVX-TBB2019.2:
|
||||
script: "python scripts\\test.py platform:x64 build:RelWithDebInfo compiler:V120 ispc:ispc1.9.2 isa:AVX tasking:TBB2019.2 intensity:4"
|
||||
tags: [win10, v120, avx]
|
||||
only: [schedules]
|
||||
|
||||
nightly-windows-Win32-RelWithDebInfo-V140-ISPC1.12.0-SSE2-TBB2019.9:
|
||||
script: "python scripts\\test.py platform:Win32 build:RelWithDebInfo compiler:V140 ispc:ispc1.12.0 isa:SSE2 tasking:TBB2019.9 intensity:2"
|
||||
tags: [win10, v140]
|
||||
only: [schedules]
|
||||
|
||||
nightly-windows-x64-RelWithDebInfo-V140-ISPC1.12.0-AVX2-PPL:
|
||||
script: "python scripts\\test.py platform:x64 build:RelWithDebInfo compiler:V140 ispc:ispc1.12.0 isa:AVX2 tasking:PPL intensity:2"
|
||||
tags: [win10, v140, avx2]
|
||||
only: [schedules]
|
||||
|
||||
nightly-windows-x64-RelWithDebInfo-V141-ISPC1.12.0-AVX2-TBB2019.9-STATIC:
|
||||
script: "python scripts\\test.py platform:x64 build:RelWithDebInfo compiler:V141 ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.9 intensity:2 STATIC_LIB:ON"
|
||||
tags: [win10, v141]
|
||||
only: [schedules]
|
||||
|
||||
nightly-windows-x64-RelWithDebInfo-V142-ISPC1.12.0-AVX2-TBB2019.9-STATIC:
|
||||
script: "python scripts\\test.py platform:x64 build:RelWithDebInfo compiler:V142 ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.9 intensity:2"
|
||||
tags: [win10, v142]
|
||||
only: [schedules]
|
||||
|
||||
nightly-windows-x64-RelWithDebInfo-LLVM-CLANG-ISPC1.12.0-AVX2-TBB2019.9-NAMESPACE:
|
||||
script: "python scripts\\test.py platform:x64 build:RelWithDebInfo compiler:LLVM_CLANG ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.9 intensity:4 api_namespace:myembree"
|
||||
tags: [win10, llvm_clang]
|
||||
only: [schedules]
|
||||
|
||||
nightly-windows-x64-RelWithDebInfo-ICC17-ISPC1.12.0-AVX2-TBB2019.2:
|
||||
script: "python scripts\\test.py platform:x64 build:RelWithDebInfo compiler:ICC17-VC14 ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.2 intensity:4"
|
||||
tags: [win10, icc17]
|
||||
only: [schedules]
|
||||
|
||||
#nightly-windows-x64-RelWithDebInfo-ICC18-ISPC1.12.0-AVX512SKX-TBB2019.9:
|
||||
# script: "python scripts\\test.py platform:x64 build:RelWithDebInfo compiler:ICC18-VC14 ispc:ispc1.12.0 isa:AVX512SKX tasking:TBB2019.9 intensity:2"
|
||||
# tags: [win10, icc18, avx512vl]
|
||||
# only: [schedules]
|
||||
|
||||
nightly-windows-x64-RelWithDebInfo-ICC19-ISPC1.12.0-AVX512SKX-TBB2019.9:
|
||||
script: "python scripts\\test.py platform:x64 build:RelWithDebInfo compiler:ICC19-VC14 ispc:ispc1.12.0 isa:AVX512SKX tasking:TBB2019.9 intensity:2"
|
||||
tags: [win10, icc19, avx512vl]
|
||||
only: [schedules]
|
||||
|
||||
|
||||
# CLANG compilation and testing of different ISAs
|
||||
|
||||
nightly-macosx-x64-Debug-CLANG-ISPC1.12.0-SSE2-TBB2019.9-NAMESPACE:
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG ispc:ispc1.12.0 isa:SSE2 tasking:TBB2019.9 intensity:4 api_namespace:myembree maxinstancelevelcount:4"
|
||||
tags: [mac]
|
||||
only: [schedules]
|
||||
|
||||
nightly-macosx-x64-Debug-CLANG-ISPC1.12.0-AVX-INT:
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG ispc:ispc1.12.0 isa:AVX tasking:INT intensity:4"
|
||||
tags: [mac] # avx
|
||||
only: [schedules]
|
||||
|
||||
nightly-macosx-x64-Debug-CLANG-ISPC1.12.0-SSE2-TBB2019.9-STATIC:
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG ispc:ispc1.12.0 isa:SSE2 tasking:TBB2019.9 intensity:4 STATIC_LIB:ON"
|
||||
tags: [mac] # avx2
|
||||
only: [schedules]
|
||||
|
||||
# ICC compilation and testing of different ISAs
|
||||
|
||||
#nightly-macosx-x64-Debug-ICC15-ISPC1.12.0-AVX-INT:
|
||||
# script: "scripts/test.py platform:x64 build:Debug compiler:ICC15 ispc:ispc1.12.0 isa:AVX tasking:INT intensity:4"
|
||||
# tags: [mac, icc15]
|
||||
# only: [schedules]
|
||||
|
||||
nightly-macosx-x64-Debug-ICC2019.4-ISPC1.12.0-AVX2-TBB2019.9:
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:ICC2019.4 ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.9 intensity:4"
|
||||
tags: [mac]
|
||||
only: [schedules]
|
||||
|
||||
nightly-macosx-x64-Debug-ICC2020.1-ISPC1.12.0-AVX2-TBB2019.9:
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:ICC2020.1 ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.9 intensity:4"
|
||||
tags: [mac]
|
||||
only: [schedules]
|
||||
|
||||
|
||||
# CLANG compilation and testing of different ISAs
|
||||
|
||||
nightly-linux-x64-Debug-CLANG4.0.0-ISPC1.12.0-SSE2-TBB-NAMESPACE:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isa:SSE2 tasking:TBB2019.9 intensity:4 api_namespace:myembree maxinstancelevelcount:8"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-CLANG4.0.0-ISPC1.12.0-AVX-TBB2019.9-VALGRIND:
|
||||
image: embreedocker/fedora:26
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isa:AVX tasking:TBB2019.9 intensity:4 memcheck:ON"
|
||||
tags: [docker] # avx
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-CLANG5.0.0-ISPC1.12.0-AVX2-INT-ADDRSANITIZER:
|
||||
image: embreedocker/fedora:26
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG5.0.0 ispc:ispc1.12.0 isa:AVX tasking:INT intensity:2 addrsanitizer:ON"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-CLANG4.0.0-ISPC1.12.0-AVX2-TBB2019.9-STATIC:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.9 intensity:4 STATIC_LIB:ON"
|
||||
tags: [docker] # avx2
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-knl-x64-Debug-CLANG4.0.0-ISPC1.12.0-AVX512KNL-TBB2019.9:
|
||||
image: embreedocker/fedora:26
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isa:AVX512KNL tasking:TBB2019.9 intensity:3"
|
||||
tags: [docker-knl]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-avx512vl-x64-Debug-CLANG4.0.0-ISPC1.12.0-AVX512SKX-TBB2019.9:
|
||||
image: embreedocker/fedora:26
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isa:AVX512SKX tasking:TBB2019.9 intensity:3"
|
||||
tags: [docker, avx512vl]
|
||||
only: [schedules]
|
||||
|
||||
|
||||
# GCC compilation and testing of different ISAs
|
||||
|
||||
nightly-linux-x64-Debug-GCC-ISPC1.12.0-SSE2-TBB2019.9:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:GCC ispc:ispc1.12.0 isa:SSE2 tasking:TBB2019.9 intensity:4"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-GCC-ISPC1.12.0-AVX-TBB2019.9:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:GCC ispc:ispc1.12.0 isa:AVX tasking:TBB2019.9 intensity:4"
|
||||
tags: [docker] # avx
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-GCC-ISPC1.12.0-AVX2-TBB2019.9:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:GCC ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.9 intensity:4"
|
||||
tags: [docker] # avx2
|
||||
only: [schedules]
|
||||
|
||||
|
||||
# ICC compilation and testing of different ISAs
|
||||
|
||||
nightly-linux-x64-Debug-ICC2015.3-ISPC1.12.0-SSE2-TBB2019.2:
|
||||
image: embreedocker/centos:7.4
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:ICC2015.3 ispc:ispc1.12.0 isa:SSE2 tasking:TBB2019.2 intensity:4"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-ICC2016.3-ISPC1.12.0-AVX-TBB2019.2:
|
||||
image: embreedocker/centos:7.4
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:ICC2016.3 ispc:ispc1.12.0 isa:AVX tasking:TBB2019.2 intensity:4"
|
||||
tags: [docker] # avx
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-ICC2017.1-ISPC1.12.0-AVX2-TBB2019.2:
|
||||
image: embreedocker/centos:7.4
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:ICC2017.1 ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.2 intensity:4"
|
||||
tags: [docker] # avx2
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-knl-x64-Debug-ICC2017.1-ISPC1.12.0-AVX512KNL-TBB2019.2:
|
||||
image: embreedocker/centos:7.4
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:ICC2017.1 ispc:ispc1.12.0 isa:AVX512KNL tasking:TBB2019.2 intensity:3"
|
||||
tags: [docker-knl]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-avx512vl-x64-Debug-ICC2017.1-ISPC1.12.0-AVX512SKX-TBB2019.2:
|
||||
image: embreedocker/centos:7.4
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:ICC2017.1 ispc:ispc1.12.0 isa:AVX512SKX tasking:TBB2019.2 intensity:4"
|
||||
tags: [docker, avx512vl]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-avx512vl-x64-Debug-ICC2018.0-ISPC1.12.0-AVX512SKX-TBB2019.9:
|
||||
image: embreedocker/fedora:26
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:ICC2018.0 ispc:ispc1.12.0 isa:AVX512SKX tasking:TBB2019.9 intensity:4"
|
||||
tags: [docker, avx512vl]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-ICC2019.4-ISPC1.12.0-AVX2-TBB2019.9:
|
||||
image: embreedocker/fedora:26
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:ICC2019.4 ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.9 intensity:4"
|
||||
tags: [docker] # avx2
|
||||
only: [schedules]
|
||||
|
||||
|
||||
# Testing on different Linux distributions
|
||||
|
||||
#nightly-ubuntu17.10-x64-Debug-GCC-ISPC1.12.0-AVX2-TBB:
|
||||
# image: embreedocker/ubuntu:17.10
|
||||
# script: "scripts/test.py platform:x64 build:Debug compiler:GCC ispc:ispc1.12.0 isa:AVX2 tasking:TBB intensity:3"
|
||||
# tags: [docker]
|
||||
# only: [schedules]
|
||||
|
||||
nightly-ubuntu16.04-x64-Debug-GCC-ISPC1.12.0-AVX2-TBB:
|
||||
image: embreedocker/ubuntu:16.04
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:GCC ispc:ispc1.12.0 isa:AVX2 tasking:TBB intensity:3"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
nightly-centos7.4-x64-Debug-GCC-ISPC1.12.0-AVX2-TBB:
|
||||
image: embreedocker/centos:7.4
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:GCC ispc:ispc1.12.0 isa:AVX2 tasking:TBB intensity:3"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
#nightly-centos7.0-x64-Debug-GCC-ISPC1.12.0-AVX2-TBB:
|
||||
# image: embreedocker/centos:7.0
|
||||
# script: "scripts/test.py platform:x64 build:Debug compiler:GCC ispc:ispc1.12.0 isa:AVX2 tasking:TBB intensity:3"
|
||||
# tags: [docker]
|
||||
# only: [schedules]
|
||||
|
||||
nightly-fedora32-x64-Debug-GCC-ISPC-AVX512SKX-TBB:
|
||||
image: embreedocker/fedora:32
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:GCC ispc:ispc isas:AVX512SKX tasking:TBB intensity:3"
|
||||
tags: [docker, avx512vl]
|
||||
only: [schedules]
|
||||
|
||||
nightly-fedora28-x64-Debug-GCC-ISPC-AVX512SKX-TBB:
|
||||
image: embreedocker/fedora:28
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:GCC ispc:ispc isas:SSE2-SSE42-AVX-AVX2-AVX512SKX tasking:TBB intensity:3" # AVX512KNL triggers internal compiler bug in GCC 8.0.1
|
||||
tags: [docker, avx512vl]
|
||||
only: [schedules]
|
||||
|
||||
nightly-fedora27-x64-Debug-GCC-ISPC-AVX2-TBB:
|
||||
image: embreedocker/fedora:27
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:GCC ispc:ispc isa:AVX2 tasking:TBB intensity:3"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
nightly-fedora26-x64-Debug-GCC-ISPC-AVX2-TBB:
|
||||
image: embreedocker/fedora:26
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:GCC ispc:ispc isa:AVX2 tasking:TBB intensity:3"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
nightly-fedora25-x64-Debug-GCC-ISPC-AVX2-TBB:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:GCC ispc:ispc isa:AVX2 tasking:TBB intensity:3"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
|
||||
# Compilation test of disabled features
|
||||
|
||||
nightly-linux-x64-Debug-CLANG4.0.0-AVX2-TBB2019.9-NO-ISPC:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.9 ISPC_SUPPORT:OFF intensity:0"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-CLANG4.0.0-ISPC1.12.0-AVX2-TBB2019.9-NO-TUTORIALS:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.9 TUTORIALS:OFF intensity:0"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-CLANG4.0.0-ISPC1.12.0-AVX2-TBB2019.9-BACKFACECULLING:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.9 BACKFACE_CULLING:ON intensity:0"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-CLANG4.0.0-ISPC1.12.0-AVX2-TBB2019.9-IGNORE-INVALID-RAYS:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.9 IGNORE_INVALID_RAYS:ON intensity:0"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-CLANG4.0.0-ISPC1.12.0-AVX2-TBB2019.9-NO-FILTER-FUNCTION:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.9 FILTER_FUNCTION:OFF intensity:0"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-CLANG4.0.0-ISPC1.12.0-AVX2-TBB2019.9-RAYMASKS:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.9 RAY_MASK:ON intensity:0"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-CLANG4.0.0-ISPC1.12.0-AVX2-TBB2019.9-NO-PACKETS:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.9 RAY_PACKETS:OFF intensity:0"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-CLANG4.0.0-ISPC1.12.0-AVX2-TBB2019.9-STATCOUNTER:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.9 STAT_COUNTER:ON intensity:0"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
|
||||
# Compilation test of individual ISAs
|
||||
|
||||
nightly-linux-x64-Debug-CLANG4.0.0-ISPC1.12.0-ISAS-SSE2-TBB2019.9:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isas:SSE2 tasking:TBB2019.9 intensity:0"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-CLANG4.0.0-ISPC1.12.0-ISAS-SSE42-TBB2019.9:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isas:SSE42 tasking:TBB2019.9 intensity:0"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-CLANG4.0.0-ISPC1.12.0-ISAS-AVX-TBB2019.9:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isas:AVX tasking:TBB2019.9 intensity:0"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-CLANG4.0.0-ISPC1.12.0-ISAS-AVX2-TBB2019.9:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isas:AVX2 tasking:TBB2019.9 intensity:0"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-CLANG4.0.0-ISPC1.12.0-ISAS-AVX512SKX-TBB2019.9:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isas:AVX512SKX tasking:TBB2019.9 intensity:0"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
|
||||
# Compilation test of individual primitive types enabled
|
||||
|
||||
nightly-linux-x64-Debug-CLANG4.0.0-ISPC1.12.0-AVX2-TBB2019.9-TRI:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.9 TRI:ON QUAD:OFF GRID:OFF CURVE:OFF SUBDIV:OFF USERGEOM:OFF INSTANCE:OFF intensity:0"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-CLANG4.0.0-ISPC1.12.0-AVX2-TBB2019.9-QUAD:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.9 TRI:OFF QUAD:ON GRID:OFF CURVE:OFF SUBDIV:OFF USERGEOM:OFF INSTANCE:OFF intensity:0"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-CLANG4.0.0-ISPC1.12.0-AVX2-TBB2019.9-GRID:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.9 TRI:OFF QUAD:OFF GRID:ON CURVE:OFF SUBDIV:OFF USERGEOM:OFF INSTANCE:OFF intensity:0"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-CLANG4.0.0-ISPC1.12.0-AVX2-TBB2019.9-CURVE:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.9 TRI:ON QUAD:OFF GRID:OFF CURVE:ON SUBDIV:OFF USERGEOM:OFF INSTANCE:OFF intensity:0"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-CLANG4.0.0-ISPC1.12.0-AVX2-TBB2019.9-SUBDIV:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.9 TRI:ON QUAD:OFF GRID:OFF CURVE:OFF SUBDIV:ON USERGEOM:OFF INSTANCE:OFF intensity:0"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-CLANG4.0.0-ISPC1.12.0-AVX2-TBB2019.9-USERGEOM:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.9 TRI:ON QUAD:OFF GRID:OFF CURVE:OFF SUBDIV:OFF USERGEOM:ON INSTANCE:OFF intensity:0"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
nightly-linux-x64-Debug-CLANG4.0.0-ISPC1.12.0-AVX2-TBB2019.9-INSTANCE:
|
||||
image: embreedocker/fedora:25
|
||||
script: "scripts/test.py platform:x64 build:Debug compiler:CLANG4.0.0 ispc:ispc1.12.0 isa:AVX2 tasking:TBB2019.9 TRI:ON QUAD:OFF GRID:OFF CURVE:OFF SUBDIV:OFF USERGEOM:OFF INSTANCE:ON intensity:0"
|
||||
tags: [docker]
|
||||
only: [schedules]
|
||||
|
||||
|
||||
#####################################################################
|
||||
# Release Builds
|
||||
####################################################################
|
||||
|
||||
release-windows-x64-Release-ICC17-VC12-ISPC1.9.2-TBB2019.2-PACKAGE-ZIP:
|
||||
script: "python scripts\\test.py platform:x64 build:Release compiler:ICC17-VC12 ispc:ispc1.9.2 isas:SSE2-SSE42-AVX-AVX2-AVX512SKX tasking:TBB2019.2 intensity:4 package:ZIP"
|
||||
tags: [win10, icc17, avx512vl]
|
||||
only: [web, schedules]
|
||||
artifacts:
|
||||
name: "$env:CI_JOB_NAME"
|
||||
paths: [build/*.zip]
|
||||
when: always
|
||||
expire_in: 2 mos
|
||||
|
||||
release-windows-x64-Release-ICC17-VC14-ISPC1.12.0-TBB2019.9-PACKAGE-ZIP:
|
||||
script: "python scripts\\test.py platform:x64 build:Release compiler:ICC17-VC14 ispc:ispc1.12.0 isas:SSE2-SSE42-AVX-AVX2-AVX512SKX tasking:TBB2019.9 intensity:4 package:ZIP"
|
||||
tags: [win10, icc17, avx512vl]
|
||||
only: [web, schedules]
|
||||
artifacts:
|
||||
name: "$env:CI_JOB_NAME"
|
||||
paths: [build/*.zip]
|
||||
when: always
|
||||
expire_in: 2 mos
|
||||
|
||||
release-windows-x64-Release-ICC17-VC14-ISPC1.12.0-TBB2019.9-PACKAGE-MSI:
|
||||
script: "python scripts\\test.py platform:x64 build:Release compiler:ICC17-VC14 ispc:ispc1.12.0 isas:SSE2-SSE42-AVX-AVX2-AVX512SKX tasking:TBB2019.9 intensity:4 package:MSI"
|
||||
tags: [win10, icc17, avx512vl]
|
||||
only: [web, schedules]
|
||||
artifacts:
|
||||
name: "$env:CI_JOB_NAME"
|
||||
paths: [build/*.msi]
|
||||
when: always
|
||||
expire_in: 2 mos
|
||||
|
||||
release-macosx-x64-Release-ICC2020.1-ISPC1.12.0-TBB2019.9-PACKAGE-ZIP:
|
||||
script: "scripts/test.py platform:x64 build:Release compiler:ICC2020.1 ispc:ispc1.12.0 isas:SSE2-SSE42-AVX-AVX2 tasking:TBB2019.9 intensity:4 package:ZIP"
|
||||
tags: [mac]
|
||||
only: [web, schedules]
|
||||
artifacts:
|
||||
name: "$CI_JOB_NAME"
|
||||
paths: [build/*.zip]
|
||||
when: always
|
||||
expire_in: 2 mos
|
||||
|
||||
release-macosx-x64-Release-ICC2020.1-ISPC1.12.0-TBB-PACKAGE-PKG:
|
||||
script: "scripts/test.py platform:x64 build:Release compiler:ICC2020.1 ispc:ispc1.12.0 isas:SSE2-SSE42-AVX-AVX2 tasking:TBB intensity:4 package:PKG"
|
||||
tags: [mac]
|
||||
only: [web, schedules]
|
||||
artifacts:
|
||||
name: "$CI_JOB_NAME"
|
||||
paths: [build/*.pkg]
|
||||
when: always
|
||||
expire_in: 2 mos
|
||||
|
||||
release-linux-x64-Release-ICC2019.4-ISPC1.12.0-TBB2019.9-PACKAGE-ZIP:
|
||||
image: embreedocker/centos:7.4
|
||||
script: "scripts/test.py platform:x64 build:Release compiler:ICC2019.4 ispc:ispc1.12.0 isas:SSE2-SSE42-AVX-AVX2-AVX512KNL-AVX512SKX tasking:TBB2019.9 intensity:4 package:ZIP"
|
||||
tags: [docker, avx512vl]
|
||||
only: [web, schedules]
|
||||
artifacts:
|
||||
name: "$CI_JOB_NAME"
|
||||
paths: [build/*.tar.gz]
|
||||
when: always
|
||||
expire_in: 2 mos
|
||||
+2
-272
@@ -1,275 +1,6 @@
|
||||
Version History
|
||||
---------------
|
||||
|
||||
### Embree 3.9.0
|
||||
|
||||
- Added round linear curve geometry support. In this mode a real geometric surface for curves
|
||||
with linear basis is rendered using capped cones with spherical filling between
|
||||
the curve segments.
|
||||
- Added rtcGetSceneDevice API function, that returns the device a scene got created in.
|
||||
- Improved performance of round curve rendering by up to 1.8x.
|
||||
- Bugfix to sphere intersection filter invokation for back hit.
|
||||
- Fixed wrong assertion that triggered for invalid curves which anyway get filtered out.
|
||||
- RelWithDebInfo mode no longer enables assertions.
|
||||
- Fixed an issue in FindTBB.cmake that caused compile error with Debug build under Linux.
|
||||
- Embree releases no longer provide RPMs for Linux. Please use the RPMs coming with the package
|
||||
manager of your Linux distribution.
|
||||
|
||||
### Embree 3.8.0
|
||||
|
||||
- Added collision detection support for user geometries (see rtcCollide API function)
|
||||
- Passing geomID to user geometry callbacks.
|
||||
- Bugfix in AVX512VL codepath for rtcIntersect1
|
||||
- For sphere geometries the intersection filter gets now invoked for
|
||||
front and back hit.
|
||||
- Fixed some bugs for quaternion motion blur.
|
||||
- RTCIntersectContext always non-const in Embree API
|
||||
- Made RTCHit aligned to 16 bytes in Embree API
|
||||
|
||||
### New Features in Embree 3.7.0
|
||||
- Added quaternion motion blur for correct interpolation of rotational transformations.
|
||||
- Fixed wrong bounding calculations when a motion blurred instance did
|
||||
instantiate a motion blurred scene.
|
||||
- In robust mode the depth test consistently uses tnear <= t <= tfar now in order
|
||||
to robustly continue traversal at a previous hit point
|
||||
in a way that guarentees reaching all hits, even hits at the same place.
|
||||
- Fixed depth test in robust mode to be precise at tnear and tfar.
|
||||
- Added next_hit tutorial to demonstrate robustly collecting all hits
|
||||
along a ray using multiple ray queries.
|
||||
- Implemented robust mode for curves. This has a small performance impact but
|
||||
fixes bounding problems with flat curves.
|
||||
- Improved quality of motion blur BVH by using linear bounds during binning.
|
||||
- Implemented issue with motion blur builder where number of time segments
|
||||
for SAH heuristic were counted wrong due to some numerical issues.
|
||||
- Fixed an accuracy issue with rendering very short fat curves.
|
||||
- rtcCommitScene can now get called during rendering from multiple threads
|
||||
to lazily build geometry. When TBB is used this causes a much lower overhead
|
||||
than using rtcJoinCommitScene.
|
||||
- Geometries can now get attached to multiple scenes at the same time, which
|
||||
simplifies mapping general scene graphs to API.
|
||||
- Updated to TBB 2019.9 for release builds.
|
||||
- Fixed a bug in the BVH builder for Grid geometries.
|
||||
- Added macOS Catalina support to Embree releases.
|
||||
|
||||
### New Features in Embree 3.6.1
|
||||
- Restored binary compatibility between Embree 3.6 and 3.5 when single-level instancing is used.
|
||||
- Fixed bug in subgrid intersector
|
||||
- Removed point query alignment in ISPC header
|
||||
|
||||
### New Features in Embree 3.6
|
||||
- Added Catmull-Rom curve types.
|
||||
- Added support for multi-level instancing.
|
||||
- Added support for point queries.
|
||||
- Fixed a bug preventing normal oriented curves being used unless timesteps were
|
||||
specified.
|
||||
- Fixed bug in external BVH builder when configured for dynamic build.
|
||||
- Added support for new config flag "user_threads=N" to device initialization
|
||||
which sets the number of threads used by TBB but created by the user.
|
||||
- Fixed automatic vertex buffer padding when using rtcSetNewGeometry API function.
|
||||
|
||||
### New Features in Embree 3.5.2
|
||||
- Added EMBREE_API_NAMESPACE cmake option that allows to put all Embree API functions
|
||||
inside a user defined namespace.
|
||||
- Added EMBREE_LIBRARY_NAME cmake option that allows to rename the Embree library.
|
||||
- When Embree is compiled as static library, EMBREE_STATIC_LIB has no longer to get
|
||||
defined before including the Embree API headers.
|
||||
- Added CPU frequency_level device configuration to allow an application to specify the
|
||||
frequency level it wants to run on. This forces Embree to not use optimizations that
|
||||
may reduce the CPU frequency below that level. By default Embree is configured to the
|
||||
the AVX-heavy frequency level, thus if the application uses solely non-AVX code, configuring
|
||||
the Embree device with "frequency_level=simd128" may give better performance.
|
||||
- Fixed a bug in the spatial split builder which caused it to fail
|
||||
for scenes with more than 2^24 geometries.
|
||||
|
||||
### New Features in Embree 3.5.1
|
||||
- Fixed ray/sphere intersector to work also for non-normalized rays.
|
||||
- Fixed self intersection avoidance for ray oriented discs when
|
||||
non-normalized rays were used.
|
||||
- Increased maximal face valence for subdiv patch to 64 and reduced stack size
|
||||
requirement for subdiv patch evaluation.
|
||||
|
||||
### New Features in Embree 3.5.0
|
||||
- Changed normal oriented curve definition to fix waving artefacts.
|
||||
- Fixed bounding issue for normal oriented motion blurred curves.
|
||||
- Fixed performance issue with motion blurred point geometry.
|
||||
- Fixed generation of documentation with new pandoc versions.
|
||||
|
||||
### New Features in Embree 3.4.0
|
||||
- Added point primitives (spheres, ray-oriented discs, normal-oriented discs).
|
||||
- Fixed crash triggered by scenes with only invalid primitives.
|
||||
- Improved robustness of quad/grid-based intersectors.
|
||||
- Upgraded to TBB 2019.2 for release builds.
|
||||
|
||||
### New Features in Embree 3.3.0
|
||||
- Added support for motion blur time range per geometry. This way geometries
|
||||
can appear and disappear during the camera shutter and time steps do not have
|
||||
to start and end at camera shutter interval boundaries.
|
||||
- Fixed crash with pathtracer when using --triangle-sphere command line.
|
||||
- Fixed crash with pathtracer when using --shader ao command line.
|
||||
- Fixed tutorials showing a black window on macOS 10.14 until moved.
|
||||
|
||||
### New Features in Embree 3.2.4
|
||||
- Fixed compile issues with ICC 2019.
|
||||
- Released ZIP files for Windows are now provided in a
|
||||
version linked against Visual Studio 2013 and Visual Studio 2015.
|
||||
|
||||
### New Features in Embree 3.2.3
|
||||
- Fixed crash when using curves with RTC_SCENE_FLAG_DYNAMIC
|
||||
combined with RTC_BUILD_QUALITY_MEDIUM.
|
||||
|
||||
### New Features in Embree 3.2.2
|
||||
- Fixed intersection distance for unnormalized rays with line segments.
|
||||
- Removed libmmd.dll dependency in release builds for Windows.
|
||||
- Fixed detection of AppleClang compiler under MacOSX.
|
||||
|
||||
### New Features in Embree 3.2.1
|
||||
- Bugfix in flat mode for hermite curves.
|
||||
- Added EMBREE_CURVE_SELF_INTERSECTION_AVOIDANCE_FACTOR cmake option to
|
||||
control self intersection avoidance for flat curves.
|
||||
- Performance fix when instantiating motion blurred scenes. The application
|
||||
should best use two (or more) time steps for an instance that instantiates
|
||||
a motion blurred scene.
|
||||
- Fixed AVX512 compile issue with GCC 6.1.1.
|
||||
- Fixed performance issue with rtcGetGeometryUserData when used
|
||||
during rendering.
|
||||
- Bugfix in length of derivatives for grid geometry.
|
||||
- Added BVH8 support for motion blurred curves and lines. For some workloads
|
||||
this increases performance by up to 7%.
|
||||
- Fixed rtcGetGeometryTransform to return the local to world transform.
|
||||
- Fixed bug in multi segment motion blur that caused missing of perfectly
|
||||
axis aligned geometry.
|
||||
- Reduced memory consumption of small scenes by 4x.
|
||||
- Reduced temporal storage of grid builder.
|
||||
|
||||
### New Features in Embree 3.2.0
|
||||
- Improved watertightness of robust mode.
|
||||
- Line segments, and other curves are now all contained in a single
|
||||
BVH which improves performance when these are both used in a scene.
|
||||
- Performance improvement of up to 20% for line segments.
|
||||
- Bugfix to Embree2 to Embree3 conversion script.
|
||||
- Added support for Hermite curve basis.
|
||||
- Semantics of normal buffer for normal oriented curves has
|
||||
changed to simplify usage. Please see documentation for details.
|
||||
- Using GLFW and imgui in tutorials.
|
||||
- Fixed floating point exception in static variable initialization.
|
||||
- Fixed invalid memory access in rtcGetGeometryTransform for non-motion
|
||||
blur instances.
|
||||
- Improved self intersection avoidance for flat curves. Transparency rays
|
||||
with tnear set to previous hit distance do not need curve radius
|
||||
based self intersection avoidance as same hit is calculated again. For this
|
||||
reason self intersection avoidance is now only applied to ray origin.
|
||||
|
||||
### New Features in Embree 3.1.0
|
||||
- Added new normal-oriented curve primitive for ray tracing of grass-like
|
||||
structures.
|
||||
- Added new grid primitive for ray tracing tessellated and displaced surfaces
|
||||
in very memory efficient manner.
|
||||
- Fixed bug of ribbon curve intersector when derivative was zero.
|
||||
- Installing all static libraries when EMBREE_STATIC_LIB is enabled.
|
||||
- Added API functions to access topology of subdivision mesh.
|
||||
- Reduced memory consumption of instances.
|
||||
- Improved performance of instances by 8%.
|
||||
- Reduced memory consumption of curves by up to 2x.
|
||||
- Up to 5% higher performance on AVX-512 architectures.
|
||||
- Added native support for multiple curve basis functions. Internal
|
||||
basis conversions are no longer performed, which saves additional
|
||||
memory when multiple bases are used.
|
||||
- Fixed issue with non thread safe local static variable initialization
|
||||
in VS2013.
|
||||
- Bugfix in rtcSetNewGeometry. Vertex buffers did not get properly
|
||||
overallocated.
|
||||
- Replaced ImageMagick with OpenImageIO in the tutorials.
|
||||
|
||||
### New Features in Embree 3.0.0
|
||||
- Switched to a new version of the API which provides improved
|
||||
flexibility but is not backward compatible. Please see "Upgrading
|
||||
from Embree 2 to Embree 3" section of the documentation for upgrade
|
||||
instructions. In particular, we provide a Python script that performs
|
||||
most of the transition work.
|
||||
- User geometries inside an instanced scene and a top-level scene no
|
||||
longer need to handle the instID field of the ray differently. They
|
||||
both just need to copy the context.instID into the ray.instID field.
|
||||
- Support for context filter functions that can be assigned to a ray
|
||||
query.
|
||||
- User geometries can now invoke filter functions using the
|
||||
rtcFilterIntersection and rtcFilterOcclusion calls.
|
||||
- Higher flexibility through specifying build quality per scene and
|
||||
geometry.
|
||||
- Geometry normal uses commonly used right-hand rule from now on.
|
||||
- Added self-intersection avoidance to ribbon curves and lines.
|
||||
Applications do not have to implement self-intersection workarounds
|
||||
for these primitive types anymore.
|
||||
- Added support for 4 billion primitives in a single scene.
|
||||
- Removed the RTC_MAX_USER_VERTEX_BUFFERS and RTC_MAX_INDEX_BUFFERS
|
||||
limitations.
|
||||
- Reduced memory consumption by 192 bytes per instance.
|
||||
- Fixed some performance issues on AVX-512 architectures.
|
||||
- Individual Contributor License Agreement (ICLA) and Corporate
|
||||
Contributor License Agreement (CCLA) no longer required to
|
||||
contribute to the project.
|
||||
|
||||
### New Features in Embree 2.17.5
|
||||
- Improved watertightness of robust mode.
|
||||
- Fixed floating point exception in static variable initialization.
|
||||
- Fixed AVX512 compile issue with GCC 6.1.1.
|
||||
|
||||
### New Features in Embree 2.17.4
|
||||
- Fixed AVX512 compile issue with GCC 7.
|
||||
- Fixed issue with not thread safe local static variable
|
||||
initialization in VS2013.
|
||||
- Fixed bug in the 4 and 8-wide packet intersection of instances with
|
||||
multi-segment motion blur on AVX-512 architectures.
|
||||
- Fixed bug in rtcOccluded4/8/16 when only AVX-512 ISA was enabled.
|
||||
|
||||
### New Features in Embree 2.17.3
|
||||
- Fixed GCC compile warning in debug mode.
|
||||
- Fixed bug of ribbon curve intersector when derivative was zero.
|
||||
- Installing all static libraries when EMBREE_STATIC_LIB is enabled.
|
||||
|
||||
### New Features in Embree 2.17.2
|
||||
- Made BVH build of curve geometry deterministic.
|
||||
|
||||
### New Features in Embree 2.17.1
|
||||
- Improved performance of occlusion ray packets by up to 50%.
|
||||
- Fixed detection of Clang for CMake 3 under MacOSX
|
||||
- Fixed AVX code compilation issue with GCC 7 compiler caused by
|
||||
explicit use of vzeroupper intrinsics.
|
||||
- Fixed an issue where Clang address sanitizer reported an error in
|
||||
the internal tasking system.
|
||||
- Added fix to compile on 32 bit Linux distribution.
|
||||
- Fixed some wrong relative include paths in Embree.
|
||||
- Improved performance of robust single ray mode by 5%.
|
||||
- Added EMBREE_INSTALL_DEPENDENCIES option (default OFF) to enable
|
||||
installing of Embree dependencies.
|
||||
- Fixed performance regression for occlusion ray streams.
|
||||
- Reduced temporary memory requirements of BVH builder for curves and
|
||||
line segments.
|
||||
- Fixed performance regression for user geometries and packet ray tracing.
|
||||
- Fixed bug where wrong closest hit was reported for very curvy hair segment.
|
||||
|
||||
### New Features in Embree 2.17.0
|
||||
- Improved packet ray tracing performance for coherent rays by 10-60%
|
||||
(requires RTC_INTERSECT_COHERENT flag).
|
||||
- Improved ray tracing performance for incoherent rays on
|
||||
AVX-512 architectures by 5%.
|
||||
- Improved ray tracing performance for streams of incoherent rays
|
||||
by 5-15%.
|
||||
- Fixed tbb_debug.lib linking error under Windows.
|
||||
- Fast coherent ray stream and packet code paths now also work in robust mode.
|
||||
- Using less agressive prefetching for large BVH nodes which
|
||||
results in 1-2% higher ray tracing performance.
|
||||
- Precompiled binaries have stack-protector enabled, except for
|
||||
traversal kernels. BVH builders can be slightly slower due to this
|
||||
change. If you want stack-protectors disabled please turn off
|
||||
EMBREE_STACK_PROTECTOR in cmake and build the binaries yourself.
|
||||
- When enabling ISAs individually, the 8-wide BVH was previously only
|
||||
available when the AVX ISA was also selected. This issue is now
|
||||
fixed, and one can enable only AVX2 and still get best
|
||||
performance by using an 8-wide BVH.
|
||||
- Fixed rtcOccluded1 and rtcOccluded1Ex API functions which were
|
||||
broken in ISPC.
|
||||
- Providing MSI installer for Windows.
|
||||
|
||||
### New Features in Embree 2.16.5
|
||||
- Bugfix in the robust triangle intersector that rarely caused NaNs.
|
||||
- Fixed bug in hybrid traversal kernel when BVH leaf was entered with no
|
||||
@@ -353,7 +84,7 @@ Version History
|
||||
- Removed support for Visual Studio 2012.
|
||||
- Precompiled binaries now require a CPU supporting at least the
|
||||
SSE4.2 ISA.
|
||||
- We no longer provide precompiled binaries for 32-bit on Windows.
|
||||
- We no longer provide precompiled binaries for 32 bit on Windows.
|
||||
- Under Windows one now has to use the platform toolset option in
|
||||
CMake to switch to Clang or the Intel® Compiler.
|
||||
- Fixed a bug for subdivision meshes when using the incoherent scene
|
||||
@@ -663,7 +394,7 @@ Version History
|
||||
|
||||
- Improved mixed AABB/OBB-BVH for hair geometry (Xeon Phi)
|
||||
- Reduced amount of pre-allocated memory for BVH builders (Xeon Phi)
|
||||
- New 64-bit Morton code-based BVH builder (Xeon Phi)
|
||||
- New 64 bit Morton code-based BVH builder (Xeon Phi)
|
||||
- (Enhanced) Morton code-based BVH builders use now tree rotations to
|
||||
improve BVH quality (Xeon Phi)
|
||||
- Bug fixes (Xeon and Xeon Phi)
|
||||
@@ -727,4 +458,3 @@ Version History
|
||||
- Integration with the Intel® SPMD Program Compiler (ISPC)
|
||||
- Instantiation and fast BVH reconstruction
|
||||
- Example photo-realistic rendering engine for both C++ and ISPC
|
||||
|
||||
|
||||
+113
-202
@@ -1,11 +1,23 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2017 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
SET(EMBREE_VERSION_MAJOR 3)
|
||||
SET(EMBREE_VERSION_MINOR 9)
|
||||
SET(EMBREE_VERSION_MAJOR 2)
|
||||
SET(EMBREE_VERSION_MINOR 17)
|
||||
SET(EMBREE_VERSION_PATCH 0)
|
||||
SET(EMBREE_VERSION_NOTE "")
|
||||
|
||||
SET(EMBREE_VERSION_NOTE "-alpha.0")
|
||||
SET(EMBREE_VERSION ${EMBREE_VERSION_MAJOR}.${EMBREE_VERSION_MINOR}.${EMBREE_VERSION_PATCH})
|
||||
MATH(EXPR EMBREE_VERSION_NUMBER "10000*${EMBREE_VERSION_MAJOR} + 100*${EMBREE_VERSION_MINOR} + ${EMBREE_VERSION_PATCH}")
|
||||
SET(CPACK_RPM_PACKAGE_RELEASE 1)
|
||||
@@ -14,30 +26,6 @@ PROJECT(embree${EMBREE_VERSION_MAJOR})
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11)
|
||||
|
||||
# We use our own strip tool on macOS to sign during install. This is required as CMake modifies RPATH of the binary during install.
|
||||
IF (APPLE AND EMBREE_SIGN_FILE)
|
||||
SET(EMBREE_STRIP ${CMAKE_STRIP})
|
||||
SET(CMAKE_STRIP ${PROJECT_BINARY_DIR}/post_install_target.sh)
|
||||
CONFIGURE_FILE(scripts/post_install_target.sh.in ${PROJECT_BINARY_DIR}/post_install_target.sh @ONLY)
|
||||
ENDIF()
|
||||
|
||||
MACRO (SIGN_TARGET target)
|
||||
IF (EMBREE_SIGN_FILE)
|
||||
IF (WIN32)
|
||||
# on Windows we sign and do not strip as debug symbols not included in binary
|
||||
ADD_CUSTOM_COMMAND(TARGET ${target} POST_BUILD
|
||||
COMMAND ${EMBREE_SIGN_FILE} $<TARGET_FILE:${target}>)
|
||||
ELSEIF (APPLE)
|
||||
# on MacOSX we strip and sign here for testing purposes but also during install, as CMake modifies binary during install
|
||||
ADD_CUSTOM_COMMAND(TARGET ${target} POST_BUILD
|
||||
COMMAND ${EMBREE_STRIP} -x $<TARGET_FILE:${target}>
|
||||
COMMAND ${EMBREE_SIGN_FILE} -o runtime -e ${CMAKE_SOURCE_DIR}/common/cmake/embree.entitlements $<TARGET_FILE:${target}>)
|
||||
ELSE()
|
||||
# on Linux signing of binaries is not supported and stripping is done during install
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
# find git version
|
||||
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
|
||||
FIND_PACKAGE(Git)
|
||||
@@ -53,15 +41,22 @@ IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
CONFIGURE_FILE(
|
||||
"${PROJECT_SOURCE_DIR}/kernels/rtcore_version.h.in"
|
||||
"${PROJECT_SOURCE_DIR}/include/embree2/rtcore_version.h"
|
||||
)
|
||||
CONFIGURE_FILE(
|
||||
"${PROJECT_SOURCE_DIR}/kernels/hash.h.in"
|
||||
"${PROJECT_BINARY_DIR}/hash.h"
|
||||
)
|
||||
FILE(WRITE "${PROJECT_BINARY_DIR}/hash" "${EMBREE_HASH}")
|
||||
|
||||
IF(COMMAND cmake_policy)
|
||||
if (POLICY CMP0003)
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
endif()
|
||||
if (POLICY CMP0042)
|
||||
cmake_policy(SET CMP0042 NEW)
|
||||
endif()
|
||||
if(POLICY CMP0072)
|
||||
cmake_policy(SET CMP0072 OLD)
|
||||
cmake_policy(SET CMP0042 OLD)
|
||||
endif()
|
||||
ENDIF(COMMAND cmake_policy)
|
||||
|
||||
@@ -73,12 +68,11 @@ MARK_AS_ADVANCED(CMAKE_OSX_ARCHITECTURES)
|
||||
MARK_AS_ADVANCED(CMAKE_OSX_DEPLOYMENT_TARGET)
|
||||
MARK_AS_ADVANCED(CMAKE_OSX_SYSROOT)
|
||||
MARK_AS_ADVANCED(CLEAR CMAKE_CXX_COMPILER)
|
||||
MARK_AS_ADVANCED(GLUT_cocoa_LIBRARY)
|
||||
|
||||
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/common/cmake ${CMAKE_MODULE_PATH})
|
||||
|
||||
IF (BUILD_TESTING)
|
||||
INCLUDE(test)
|
||||
ENDIF()
|
||||
INCLUDE(test)
|
||||
|
||||
##############################################################
|
||||
# Embree configuration
|
||||
@@ -94,45 +88,41 @@ ELSE()
|
||||
ENDIF()
|
||||
IF (EMBREE_STATIC_LIB)
|
||||
SET(EMBREE_LIB_TYPE STATIC)
|
||||
ADD_DEFINITIONS(-DEMBREE_STATIC_LIB)
|
||||
ELSE()
|
||||
SET(EMBREE_LIB_TYPE SHARED)
|
||||
ENDIF()
|
||||
|
||||
OPTION(EMBREE_ISPC_SUPPORT "Build Embree with support for ISPC applications." ON)
|
||||
OPTION(EMBREE_TUTORIALS "Enable to build Embree tutorials" ON)
|
||||
SET(EMBREE_API_NAMESPACE "" CACHE STRING "C++ namespace to put API symbols into.")
|
||||
SET(EMBREE_LIBRARY_NAME "embree${EMBREE_VERSION_MAJOR}" CACHE STRING "Name of the embree library file (default is embree${EMBREE_VERSION_MAJOR})")
|
||||
|
||||
IF (EMBREE_API_NAMESPACE AND EMBREE_ISPC_SUPPORT)
|
||||
MESSAGE(FATAL_ERROR "You cannot enable ISPC when EMBREE_API_NAMESPACE is used.")
|
||||
ENDIF()
|
||||
|
||||
##############################################################################
|
||||
# Configurations (add configurations also to common/cmake/embree-config.cmake)
|
||||
|
||||
OPTION(EMBREE_INSTALL_DEPENDENCIES "Install Embree dependencies in binary packages and install" OFF)
|
||||
MARK_AS_ADVANCED(EMBREE_INSTALL_DEPENDENCIES)
|
||||
# Configurations (add configurations also to common/cmake/embree-config-default.cmake)
|
||||
|
||||
OPTION(EMBREE_STAT_COUNTERS "Enables statistic counters.")
|
||||
OPTION(EMBREE_STACK_PROTECTOR "When enabled Embree compiles with stack protection against return address overrides." OFF)
|
||||
|
||||
OPTION(EMBREE_RAY_MASK "Enables ray mask support.")
|
||||
OPTION(EMBREE_BACKFACE_CULLING "Enables backface culling.")
|
||||
OPTION(EMBREE_FILTER_FUNCTION "Enables filter functions." ON)
|
||||
OPTION(EMBREE_INTERSECTION_FILTER "Enables intersection filter callback." ON)
|
||||
OPTION(EMBREE_INTERSECTION_FILTER_RESTORE "Restores previous hit when hit is filtered out." ON)
|
||||
OPTION(EMBREE_IGNORE_INVALID_RAYS "Ignores invalid rays." OFF) # FIXME: enable by default?
|
||||
|
||||
OPTION(EMBREE_GEOMETRY_TRIANGLE "Enables support for triangle geometries." ON)
|
||||
OPTION(EMBREE_GEOMETRY_QUAD "Enables support for quad geometries." ON)
|
||||
OPTION(EMBREE_GEOMETRY_CURVE "Enables support for curve geometries." ON)
|
||||
OPTION(EMBREE_GEOMETRY_SUBDIVISION "Enables support for subdiv geometries." ON)
|
||||
OPTION(EMBREE_GEOMETRY_TRIANGLES "Enables support for triangle geometries." ON)
|
||||
OPTION(EMBREE_GEOMETRY_QUADS "Enables support for quad geometries." ON)
|
||||
OPTION(EMBREE_GEOMETRY_LINES "Enables support for line geometries." ON)
|
||||
OPTION(EMBREE_GEOMETRY_HAIR "Enables support for hair geometries." ON)
|
||||
OPTION(EMBREE_GEOMETRY_SUBDIV "Enables support for subdiv geometries." ON)
|
||||
OPTION(EMBREE_GEOMETRY_USER "Enables support for user geometries." ON)
|
||||
OPTION(EMBREE_GEOMETRY_INSTANCE "Enables support for instances." ON)
|
||||
OPTION(EMBREE_GEOMETRY_GRID "Enables support for grid geometries." ON)
|
||||
OPTION(EMBREE_GEOMETRY_POINT "Enables support for point geometries." ON)
|
||||
OPTION(EMBREE_RAY_PACKETS "Enabled support for ray packets." ON)
|
||||
|
||||
SET(EMBREE_MAX_INSTANCE_LEVEL_COUNT 1 CACHE STRING "Maximum number of instance levels.")
|
||||
SET(EMBREE_CURVE_SELF_INTERSECTION_AVOIDANCE_FACTOR 2.0 CACHE STRING "Self intersection avoidance factor for flat curves. Specify floating point value in range 0 to inf.")
|
||||
SET(EMBREE_NATIVE_SPLINE_BASIS BEZIER CACHE STRING "Sets the basis for curves which Embree uses internally. Other types are converted and need more memory.")
|
||||
SET_PROPERTY(CACHE EMBREE_NATIVE_SPLINE_BASIS PROPERTY STRINGS BSPLINE BEZIER)
|
||||
IF (EMBREE_NATIVE_SPLINE_BASIS STREQUAL "BSPLINE")
|
||||
SET(EMBREE_NATIVE_CURVE_BSPLINE ON)
|
||||
ELSE()
|
||||
SET(EMBREE_NATIVE_CURVE_BSPLINE OFF)
|
||||
ENDIF()
|
||||
|
||||
SET(EMBREE_TASKING_SYSTEM "TBB" CACHE STRING "Selects tasking system")
|
||||
IF (WIN32)
|
||||
@@ -161,100 +151,37 @@ ELSE()
|
||||
LIST(APPEND ISPC_DEFINITIONS -DTASKING_INTERNAL)
|
||||
ENDIF()
|
||||
|
||||
##############################################################
|
||||
# Compiler
|
||||
##############################################################
|
||||
|
||||
SET(CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo")
|
||||
|
||||
IF (WIN32)
|
||||
IF (NOT DEFAULT_CMAKE_CONFIGURATION_TYPES_SET)
|
||||
SET(CMAKE_CONFIGURATION_TYPES "${CONFIGURATION_TYPES}" CACHE STRING "List of generated configurations." FORCE)
|
||||
SET(DEFAULT_CMAKE_CONFIGURATION_TYPES_SET ON CACHE INTERNAL "Default CMake configuration types set.")
|
||||
ENDIF()
|
||||
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
IF (${CMAKE_GENERATOR_TOOLSET} MATCHES "^LLVM" )
|
||||
MESSAGE("CLANG detected")
|
||||
INCLUDE(clang)
|
||||
ELSEIF(${CMAKE_GENERATOR_TOOLSET} MATCHES "^Intel")
|
||||
MESSAGE("Intel Compiler detected")
|
||||
INCLUDE (intel)
|
||||
ELSE()
|
||||
IF (EMBREE_ISA_AVX512KNL OR EMBREE_ISA_AVX512SKX)
|
||||
MESSAGE(FATAL_ERROR "Microsoft Visual C++ Compiler does not support AVX512. Please use Intel Compiler or Clang.")
|
||||
ENDIF()
|
||||
INCLUDE (msvc)
|
||||
ENDIF()
|
||||
|
||||
ELSE (WIN32)
|
||||
IF(CMAKE_CXX_COMPILER_WRAPPER STREQUAL "CrayPrgEnv")
|
||||
INCLUDE (crayprgenv)
|
||||
ELSE()
|
||||
STRING(TOLOWER "${CMAKE_CXX_COMPILER_ID}" _LOWER_CXX_COMPILER_ID)
|
||||
STRING(REPLACE "appleclang" "clang" _LOWER_CXX_COMPILER_ID ${_LOWER_CXX_COMPILER_ID})
|
||||
INCLUDE(${_LOWER_CXX_COMPILER_ID} OPTIONAL RESULT_VARIABLE COMPILER_FOUND)
|
||||
IF (NOT COMPILER_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Unsupported compiler: " ${CMAKE_CXX_COMPILER_ID})
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
|
||||
IF(NOT CMAKE_BUILD_TYPE)
|
||||
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Specifies the build type." FORCE)
|
||||
SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CONFIGURATION_TYPES})
|
||||
ENDIF(NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
OPTION(CMAKE_VERBOSE_MAKEFILE "Enables verbose mode.")
|
||||
MARK_AS_ADVANCED(CLEAR CMAKE_VERBOSE_MAKEFILE)
|
||||
|
||||
ENDIF (WIN32)
|
||||
CONFIGURE_FILE(
|
||||
"${PROJECT_SOURCE_DIR}/kernels/config.h.in"
|
||||
"${PROJECT_BINARY_DIR}/config.h"
|
||||
)
|
||||
|
||||
##############################################################
|
||||
# ISA configuration
|
||||
##############################################################
|
||||
|
||||
IF(CMAKE_CXX_COMPILER_WRAPPER STREQUAL "CrayPrgEnv")
|
||||
SET(EMBREE_MAX_ISA "DEFAULT" CACHE STRING "Selects highest ISA to support.")
|
||||
ELSE()
|
||||
SET(EMBREE_MAX_ISA "NONE" CACHE STRING "Selects highest ISA to support.")
|
||||
ELSE()
|
||||
SET(EMBREE_MAX_ISA "AVX2" CACHE STRING "Selects highest ISA to support.")
|
||||
ENDIF()
|
||||
SET_PROPERTY(CACHE EMBREE_MAX_ISA PROPERTY STRINGS NONE SSE2 SSE4.2 AVX AVX2 AVX512KNL AVX512SKX DEFAULT)
|
||||
SET_PROPERTY(CACHE EMBREE_MAX_ISA PROPERTY STRINGS NONE SSE2 SSE4.2 AVX AVX2 AVX512KNL AVX512SKX)
|
||||
|
||||
IF (EMBREE_MAX_ISA STREQUAL "NONE")
|
||||
TRY_COMPILE(COMPILER_SUPPORTS_AVX ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/common/cmake/check_isa.cpp COMPILE_DEFINITIONS ${FLAGS_AVX})
|
||||
TRY_COMPILE(COMPILER_SUPPORTS_AVX2 ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/common/cmake/check_isa.cpp COMPILE_DEFINITIONS ${FLAGS_AVX2})
|
||||
TRY_COMPILE(COMPILER_SUPPORTS_AVX512KNL ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/common/cmake/check_isa.cpp COMPILE_DEFINITIONS ${FLAGS_AVX512KNL})
|
||||
TRY_COMPILE(COMPILER_SUPPORTS_AVX512SKX ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/common/cmake/check_isa.cpp COMPILE_DEFINITIONS ${FLAGS_AVX512SKX})
|
||||
|
||||
OPTION(EMBREE_ISA_SSE2 "Enables SSE2 ISA." ON)
|
||||
OPTION(EMBREE_ISA_SSE42 "Enables SSE4.2 ISA." ON)
|
||||
OPTION(EMBREE_ISA_AVX "Enables AVX ISA." ${COMPILER_SUPPORTS_AVX})
|
||||
OPTION(EMBREE_ISA_AVX2 "Enables AVX2 ISA." ${COMPILER_SUPPORTS_AVX2})
|
||||
IF (WIN32 OR APPLE)
|
||||
OPTION(EMBREE_ISA_AVX512KNL "Enables AVX512 ISA for Knights Landing." OFF)
|
||||
OPTION(EMBREE_ISA_AVX512SKX "Enables AVX512 ISA for Skylake." OFF)
|
||||
ELSE()
|
||||
OPTION(EMBREE_ISA_AVX512KNL "Enables AVX512 ISA for Knights Landing." OFF) # compilation on GCC 8 broken
|
||||
OPTION(EMBREE_ISA_AVX512SKX "Enables AVX512 ISA for Skylake." ${COMPILER_SUPPORTS_AVX512SKX})
|
||||
OPTION(EMBREE_ISA_SSE2 "Enables SSE2 ISA.")
|
||||
OPTION(EMBREE_ISA_SSE42 "Enables SSE4.2 ISA.")
|
||||
OPTION(EMBREE_ISA_AVX "Enables AVX ISA.")
|
||||
OPTION(EMBREE_ISA_AVX2 "Enables AVX2 ISA.")
|
||||
OPTION(EMBREE_ISA_AVX512KNL "Enables AVX512 ISA for Knights Landing.")
|
||||
OPTION(EMBREE_ISA_AVX512SKX "Enables AVX512 ISA for Skylake.")
|
||||
IF(NOT (EMBREE_ISA_SSE2 OR EMBREE_ISA_SSE42 OR EMBREE_ISA_AVX OR
|
||||
EMBREE_ISA_AVX2 OR EMBREE_ISA_AVX512KNL OR EMBREE_ISA_AVX512SKX))
|
||||
MESSAGE(STATUS "Detecting default ISA:")
|
||||
INCLUDE(check_isa_default)
|
||||
CHECK_ISA_DEFAULT(EMBREE_ISA_DEFAULT)
|
||||
MESSAGE(STATUS "Detecting default ISA: ${EMBREE_ISA_DEFAULT}")
|
||||
SET(EMBREE_ISA_${EMBREE_ISA_DEFAULT} ON)
|
||||
ENDIF()
|
||||
ELSEIF (EMBREE_MAX_ISA STREQUAL "DEFAULT")
|
||||
UNSET(EMBREE_ISA_SSE2 CACHE)
|
||||
UNSET(EMBREE_ISA_SSE42 CACHE)
|
||||
UNSET(EMBREE_ISA_AVX CACHE)
|
||||
UNSET(EMBREE_ISA_AVX2 CACHE)
|
||||
UNSET(EMBREE_ISA_AVX512KNL CACHE)
|
||||
UNSET(EMBREE_ISA_AVX512SKX CACHE)
|
||||
SET(EMBREE_ISA_SSE2 OFF)
|
||||
SET(EMBREE_ISA_SSE42 OFF)
|
||||
SET(EMBREE_ISA_AVX OFF)
|
||||
SET(EMBREE_ISA_AVX2 OFF)
|
||||
SET(EMBREE_ISA_AVX512KNL OFF)
|
||||
SET(EMBREE_ISA_AVX512SKX OFF)
|
||||
MESSAGE(STATUS "Detecting default ISA...")
|
||||
INCLUDE(check_isa_default)
|
||||
CHECK_ISA_DEFAULT(EMBREE_ISA_DEFAULT)
|
||||
MESSAGE(STATUS "Detected default ISA: ${EMBREE_ISA_DEFAULT}")
|
||||
SET(EMBREE_ISA_${EMBREE_ISA_DEFAULT} ON)
|
||||
ELSE()
|
||||
UNSET(EMBREE_ISA_SSE2 CACHE)
|
||||
UNSET(EMBREE_ISA_SSE42 CACHE)
|
||||
@@ -306,41 +233,54 @@ ELSE()
|
||||
ENDIF ()
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_CXX_COMPILER_WRAPPER STREQUAL "CrayPrgEnv")
|
||||
SET(EMBREE_ISA_SSE42 OFF)
|
||||
ENDIF()
|
||||
##############################################################
|
||||
# Compiler
|
||||
##############################################################
|
||||
|
||||
IF (APPLE AND EMBREE_STATIC_LIB)
|
||||
SET(CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo")
|
||||
|
||||
# count number of set ISAs
|
||||
SET(NUMISA 0)
|
||||
IF (EMBREE_ISA_SSE2)
|
||||
MATH(EXPR NUMISA "${NUMISA}+1")
|
||||
ENDIF()
|
||||
IF (EMBREE_ISA_SSE42)
|
||||
MATH(EXPR NUMISA "${NUMISA}+1")
|
||||
ENDIF()
|
||||
IF (EMBREE_ISA_AVX)
|
||||
MATH(EXPR NUMISA "${NUMISA}+1")
|
||||
ENDIF()
|
||||
IF (EMBREE_ISA_AVX2)
|
||||
MATH(EXPR NUMISA "${NUMISA}+1")
|
||||
ENDIF()
|
||||
IF (EMBREE_ISA_AVX512KNL)
|
||||
MATH(EXPR NUMISA "${NUMISA}+1")
|
||||
ENDIF()
|
||||
IF (EMBREE_ISA_AVX512SKX)
|
||||
MATH(EXPR NUMISA "${NUMISA}+1")
|
||||
IF (WIN32)
|
||||
IF (NOT DEFAULT_CMAKE_CONFIGURATION_TYPES_SET)
|
||||
SET(CMAKE_CONFIGURATION_TYPES "${CONFIGURATION_TYPES}" CACHE STRING "List of generated configurations." FORCE)
|
||||
SET(DEFAULT_CMAKE_CONFIGURATION_TYPES_SET ON CACHE INTERNAL "Default CMake configuration types set.")
|
||||
ENDIF()
|
||||
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
IF (NUMISA GREATER 1)
|
||||
IF (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
||||
IF (${CMAKE_CXX_COMPILER_VERSION} MATCHES "^9\\..*")
|
||||
MESSAGE(FATAL_ERROR "Using Embree as static library is not supported with AppleClang 9.X when multiple ISAs are selected. Please either build a shared library or enable only one ISA.")
|
||||
ENDIF()
|
||||
IF (${CMAKE_GENERATOR_TOOLSET} MATCHES "^LLVM" )
|
||||
MESSAGE("CLANG detected")
|
||||
INCLUDE(clang)
|
||||
ELSEIF(${CMAKE_GENERATOR_TOOLSET} MATCHES "^Intel")
|
||||
MESSAGE("Intel Compiler detected")
|
||||
INCLUDE (icc)
|
||||
ELSE()
|
||||
IF (EMBREE_ISA_AVX512KNL OR EMBREE_ISA_AVX512SKX)
|
||||
MESSAGE(FATAL_ERROR "Microsoft Visual C++ Compiler does not support AVX512. Please use Intel Compiler or Clang.")
|
||||
ENDIF()
|
||||
INCLUDE (msvc)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
ELSE (WIN32)
|
||||
IF(CMAKE_CXX_COMPILER_WRAPPER STREQUAL "CrayPrgEnv")
|
||||
INCLUDE(crayprgenv)
|
||||
ELSEIF (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
||||
INCLUDE (gcc)
|
||||
ELSEIF (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
|
||||
INCLUDE (clang)
|
||||
ELSEIF (${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
|
||||
INCLUDE (icc)
|
||||
ELSE ()
|
||||
MESSAGE(FATAL_ERROR "Unsupported compiler: " ${CMAKE_CXX_COMPILER_ID})
|
||||
ENDIF ()
|
||||
|
||||
IF(NOT CMAKE_BUILD_TYPE)
|
||||
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Specifies the build type." FORCE)
|
||||
SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CONFIGURATION_TYPES})
|
||||
ENDIF(NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
OPTION(CMAKE_VERBOSE_MAKEFILE "Enables verbose mode.")
|
||||
MARK_AS_ADVANCED(CLEAR CMAKE_VERBOSE_MAKEFILE)
|
||||
|
||||
ENDIF (WIN32)
|
||||
|
||||
##############################################################
|
||||
# ISA configuration continued
|
||||
@@ -354,7 +294,6 @@ SET(AVX512KNL 4)
|
||||
SET(AVX512SKX 5)
|
||||
|
||||
UNSET(FLAGS_LOWEST)
|
||||
SET(ISA_LOWEST_AVX 2)
|
||||
|
||||
IF (EMBREE_ISA_SSE2)
|
||||
ADD_DEFINITIONS(-DEMBREE_TARGET_SSE2)
|
||||
@@ -379,7 +318,6 @@ IF (EMBREE_ISA_AVX)
|
||||
LIST(APPEND ISPC_TARGETS "avx")
|
||||
IF(NOT FLAGS_LOWEST)
|
||||
SET(ISA_LOWEST ${AVX})
|
||||
SET(ISA_LOWEST_AVX ${AVX})
|
||||
SET(FLAGS_LOWEST ${FLAGS_AVX})
|
||||
ENDIF()
|
||||
ENDIF ()
|
||||
@@ -389,7 +327,6 @@ IF (EMBREE_ISA_AVX2)
|
||||
LIST(APPEND ISPC_TARGETS "avx2")
|
||||
IF(NOT FLAGS_LOWEST)
|
||||
SET(ISA_LOWEST ${AVX2})
|
||||
SET(ISA_LOWEST_AVX ${AVX2})
|
||||
SET(FLAGS_LOWEST ${FLAGS_AVX2})
|
||||
ENDIF()
|
||||
ENDIF ()
|
||||
@@ -399,7 +336,6 @@ IF (EMBREE_ISA_AVX512KNL)
|
||||
LIST(APPEND ISPC_TARGETS "avx512knl-i32x16")
|
||||
IF(NOT FLAGS_LOWEST)
|
||||
SET(ISA_LOWEST ${AVX512KNL})
|
||||
SET(ISA_LOWEST_AVX ${AVX512KNL})
|
||||
SET(FLAGS_LOWEST ${FLAGS_AVX512KNL})
|
||||
ENDIF()
|
||||
ENDIF ()
|
||||
@@ -409,7 +345,6 @@ IF (EMBREE_ISA_AVX512SKX)
|
||||
LIST(APPEND ISPC_TARGETS "avx512skx-i32x16")
|
||||
IF(NOT FLAGS_LOWEST)
|
||||
SET(ISA_LOWEST ${AVX512SKX})
|
||||
SET(ISA_LOWEST_AVX ${AVX512SKX})
|
||||
SET(FLAGS_LOWEST ${FLAGS_AVX512SKX})
|
||||
ENDIF()
|
||||
ENDIF ()
|
||||
@@ -421,36 +356,12 @@ INCLUDE (ispc)
|
||||
##############################################################
|
||||
include(package)
|
||||
|
||||
##############################################################
|
||||
# Create Config files
|
||||
##############################################################
|
||||
|
||||
CONFIGURE_FILE(
|
||||
"${PROJECT_SOURCE_DIR}/kernels/config.h.in"
|
||||
"${PROJECT_SOURCE_DIR}/kernels/config.h"
|
||||
)
|
||||
|
||||
CONFIGURE_FILE(
|
||||
"${PROJECT_SOURCE_DIR}/kernels/rtcore_config.h.in"
|
||||
"${PROJECT_SOURCE_DIR}/include/embree3/rtcore_config.h"
|
||||
)
|
||||
|
||||
CONFIGURE_FILE(
|
||||
"${PROJECT_SOURCE_DIR}/kernels/hash.h.in"
|
||||
"${PROJECT_SOURCE_DIR}/kernels/hash.h"
|
||||
)
|
||||
CONFIGURE_FILE(
|
||||
"${PROJECT_SOURCE_DIR}/kernels/export.linux.map.in"
|
||||
"${PROJECT_SOURCE_DIR}/kernels/export.linux.map"
|
||||
)
|
||||
CONFIGURE_FILE(
|
||||
"${PROJECT_SOURCE_DIR}/kernels/export.macosx.map.in"
|
||||
"${PROJECT_SOURCE_DIR}/kernels/export.macosx.map"
|
||||
)
|
||||
|
||||
##############################################################
|
||||
# Search paths
|
||||
##############################################################
|
||||
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include)
|
||||
INCLUDE_DIRECTORIES("${PROJECT_BINARY_DIR}")
|
||||
INCLUDE_DIRECTORIES_ISPC("${PROJECT_BINARY_DIR}")
|
||||
IF (TASKING_TBB)
|
||||
FIND_PACKAGE(TBB REQUIRED)
|
||||
INCLUDE_DIRECTORIES(${TBB_INCLUDE_DIRS})
|
||||
@@ -469,6 +380,7 @@ SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
ADD_SUBDIRECTORY(common)
|
||||
ADD_SUBDIRECTORY(kernels)
|
||||
|
||||
IF (EMBREE_TUTORIALS)
|
||||
ADD_SUBDIRECTORY(tutorials)
|
||||
ENDIF()
|
||||
@@ -490,5 +402,4 @@ SET_PROPERTY(TARGET uninstall PROPERTY FOLDER CMakePredefinedTargets)
|
||||
##############################################################
|
||||
# Has to be last
|
||||
##############################################################
|
||||
|
||||
INCLUDE(CPack)
|
||||
|
||||
+31
-3
@@ -1,5 +1,33 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2017 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
set(CTEST_PROJECT_NAME "Embree")
|
||||
set(TEST_MODELS_HASH 9f7aa420e2f931c51c8a72a812da0631d04f9ed9)
|
||||
set(CTEST_NIGHTLY_START_TIME "22:00:00 UTC")
|
||||
set(TEST_MODELS_HASH 01ada7ec1ace15ddba73aaab3f53ac6aac6a0309)
|
||||
|
||||
IF (NOT CTEST_DROP_SITE)
|
||||
set(CTEST_DROP_METHOD "http")
|
||||
set(CTEST_DROP_SITE "cdash")
|
||||
set(CTEST_DROP_LOCATION "/CDash/submit.php?project=Embree")
|
||||
set(CTEST_DROP_SITE_CDASH TRUE)
|
||||
endif()
|
||||
|
||||
list (APPEND CTEST_CUSTOM_WARNING_EXCEPTION "warning #1478") # deprecated function used
|
||||
#list (APPEND CTEST_CUSTOM_WARNING_EXCEPTION "warning #10237") # -lcilkrts linked in dynamically, static library not available")
|
||||
list (APPEND CTEST_CUSTOM_WARNING_EXCEPTION "-Wextern-initializer")
|
||||
|
||||
SET(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 200000)
|
||||
SET(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE 800000)
|
||||
|
||||
+15
-2
@@ -1,5 +1,18 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2017 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
ADD_SUBDIRECTORY(sys)
|
||||
ADD_SUBDIRECTORY(math)
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2017 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
ADD_LIBRARY(algorithms OBJECT
|
||||
parallel_for.cpp
|
||||
@@ -15,4 +28,5 @@ ADD_LIBRARY(algorithms OBJECT
|
||||
)
|
||||
|
||||
SET_PROPERTY(TARGET algorithms PROPERTY FOLDER common)
|
||||
SET_PROPERTY(TARGET algorithms APPEND PROPERTY COMPILE_FLAGS " ${FLAGS_LOWEST}")
|
||||
|
||||
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include "parallel_reduce.h"
|
||||
|
||||
namespace embree
|
||||
{
|
||||
|
||||
template<typename Index, class UnaryPredicate>
|
||||
__forceinline bool parallel_any_of (Index first, Index last, UnaryPredicate pred)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
#if defined(TASKING_TBB)
|
||||
tbb::parallel_for(tbb::blocked_range<size_t>{first, last}, [&ret,pred](const tbb::blocked_range<size_t>& r) {
|
||||
if (tbb::task::self().is_cancelled()) return;
|
||||
for (size_t i = r.begin(); i != r.end(); ++i) {
|
||||
if (pred(i)) {
|
||||
ret = true;
|
||||
tbb::task::self().cancel_group_execution();
|
||||
}
|
||||
}
|
||||
});
|
||||
#else
|
||||
ret = parallel_reduce (first, last, false,
|
||||
[pred](const range<size_t>& r)->bool {
|
||||
bool localret = false;
|
||||
for (auto i=r.begin(); i<r.end(); ++i) {
|
||||
localret |= pred(i);
|
||||
}
|
||||
return localret;
|
||||
},
|
||||
std::bit_or<bool>()
|
||||
);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // end namespace
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#include "parallel_filter.h"
|
||||
#include "../sys/regression.h"
|
||||
@@ -20,31 +33,29 @@ namespace embree
|
||||
|
||||
for (size_t N=10; N<1000000; N=size_t(2.1*N))
|
||||
{
|
||||
size_t N0 = rand() % N;
|
||||
|
||||
/* initialize array with random numbers */
|
||||
std::vector<uint32_t> src(N);
|
||||
std::map<uint32_t,int> m;
|
||||
for (size_t i=0; i<N; i++) src[i] = rand();
|
||||
|
||||
/* count elements up */
|
||||
for (size_t i=N0; i<N; i++)
|
||||
for (size_t i=0; i<N; i++)
|
||||
if (pred(src[i]))
|
||||
m[src[i]] = 0;
|
||||
for (size_t i=N0; i<N; i++)
|
||||
for (size_t i=0; i<N; i++)
|
||||
if (pred(src[i]))
|
||||
m[src[i]]++;
|
||||
|
||||
/* filter array */
|
||||
//size_t M = sequential_filter(src.data(),N0,N,pred);
|
||||
size_t M = parallel_filter(src.data(),N0,N,size_t(1024),pred);
|
||||
//size_t_t M = sequential_filter(src.data(),size_t(0),N,pred);
|
||||
size_t M = parallel_filter(src.data(),size_t(0),N,size_t(1024),pred);
|
||||
|
||||
/* check if filtered data is correct */
|
||||
for (size_t i=N0; i<M; i++) {
|
||||
for (size_t i=0; i<M; i++) {
|
||||
passed &= pred(src[i]);
|
||||
m[src[i]]--;
|
||||
}
|
||||
for (size_t i=N0; i<M; i++)
|
||||
for (size_t i=0; i<M; i++)
|
||||
passed &= (m[src[i]] == 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -26,7 +39,7 @@ namespace embree
|
||||
return sequential_filter(data,begin,end,predicate);
|
||||
|
||||
/* calculate number of tasks to use */
|
||||
enum { MAX_TASKS = 64 };
|
||||
enum { MAX_TASKS = 512 };
|
||||
const Index numThreads = TaskScheduler::threadCount();
|
||||
const Index numBlocks = (end-begin+minStepSize-1)/minStepSize;
|
||||
const Index taskCount = min(numThreads,numBlocks,(Index)MAX_TASKS);
|
||||
@@ -63,8 +76,8 @@ namespace embree
|
||||
parallel_for(taskCount, [&](const Index taskIndex)
|
||||
{
|
||||
/* destination to write elements to */
|
||||
Index dst = begin+(taskIndex+0)*(end-begin)/taskCount+nused[taskIndex];
|
||||
Index dst_end = min(dst+nfree[taskIndex],begin+sused);
|
||||
Index dst = (taskIndex+0)*(end-begin)/taskCount+nused[taskIndex];
|
||||
Index dst_end = min(dst+nfree[taskIndex],sused);
|
||||
if (dst_end <= dst) return;
|
||||
|
||||
/* range of misplaced elements to copy to destination */
|
||||
@@ -79,10 +92,7 @@ namespace embree
|
||||
Index k1 = k0+nused[i];
|
||||
Index src = begin+(i+0)*(end-begin)/taskCount+nused[i];
|
||||
for (Index i=max(r0,k0); i<min(r1,k1); i++) {
|
||||
Index isrc = src-i+k0-1;
|
||||
assert(dst >= begin && dst < end);
|
||||
assert(isrc >= begin && isrc < end);
|
||||
data[dst++] = data[isrc];
|
||||
data[dst++] = data[src-i+k0-1];
|
||||
}
|
||||
k0 = k1;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#include "parallel_for.h"
|
||||
#include "../sys/regression.h"
|
||||
|
||||
@@ -1,12 +1,25 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../tasking/taskscheduler.h"
|
||||
#include "../common/tasking/taskscheduler.h"
|
||||
#include "../sys/array.h"
|
||||
#include "../math/math.h"
|
||||
#include "../math/range.h"
|
||||
#include "../common/math/range.h"
|
||||
|
||||
namespace embree
|
||||
{
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#include "parallel_for_for.h"
|
||||
#include "../sys/regression.h"
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -22,7 +35,7 @@ namespace embree
|
||||
{
|
||||
public:
|
||||
|
||||
enum { MAX_TASKS = 64 };
|
||||
enum { MAX_TASKS = 512 };
|
||||
|
||||
__forceinline ParallelForForState ()
|
||||
: taskCount(0) {}
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#include "parallel_for_for_prefix_sum.h"
|
||||
#include "../sys/regression.h"
|
||||
@@ -37,7 +50,7 @@ namespace embree
|
||||
ParallelForForPrefixSumState<size_t> state(array2,size_t(1));
|
||||
|
||||
/* dry run only counts */
|
||||
size_t S = parallel_for_for_prefix_sum0( state, array2, size_t(0), [&](std::vector<size_t>* v, const range<size_t>& r, size_t k, size_t i) -> size_t
|
||||
size_t S = parallel_for_for_prefix_sum0( state, array2, size_t(0), [&](std::vector<size_t>* v, const range<size_t>& r, size_t k) -> size_t
|
||||
{
|
||||
size_t s = 0;
|
||||
for (size_t i=r.begin(); i<r.end(); i++) {
|
||||
@@ -52,7 +65,7 @@ namespace embree
|
||||
for (auto& a : flattened) a.store(0);
|
||||
|
||||
/* now we actually fill the flattened array */
|
||||
parallel_for_for_prefix_sum1( state, array2, size_t(0), [&](std::vector<size_t>* v, const range<size_t>& r, size_t k, size_t i, const size_t base) -> size_t
|
||||
parallel_for_for_prefix_sum1( state, array2, size_t(0), [&](std::vector<size_t>* v, const range<size_t>& r, size_t k, const size_t base) -> size_t
|
||||
{
|
||||
size_t s = 0;
|
||||
for (size_t i=r.begin(); i<r.end(); i++) {
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -40,7 +53,7 @@ namespace embree
|
||||
for (size_t i=i0; k<k1; i++) {
|
||||
const size_t size = array2[i] ? array2[i]->size() : 0;
|
||||
const size_t r0 = j0, r1 = min(size,r0+k1-k);
|
||||
if (r1 > r0) N = reduction(N, func(array2[i],range<Index>((Index)r0,(Index)r1),(Index)k,(Index)i));
|
||||
if (r1 > r0) N = reduction(N, func(array2[i],range<size_t>(r0,r1),k));
|
||||
k+=r1-r0; j0 = 0;
|
||||
}
|
||||
state.prefix_state.counts[taskIndex] = N;
|
||||
@@ -78,7 +91,7 @@ namespace embree
|
||||
for (size_t i=i0; k<k1; i++) {
|
||||
const size_t size = array2[i] ? array2[i]->size() : 0;
|
||||
const size_t r0 = j0, r1 = min(size,r0+k1-k);
|
||||
if (r1 > r0) N = reduction(N, func(array2[i],range<Index>((Index)r0,(Index)r1),(Index)k,(Index)i,reduction(state.prefix_state.sums[taskIndex],N)));
|
||||
if (r1 > r0) N = reduction(N, func(array2[i],range<size_t>(r0,r1),k,reduction(state.prefix_state.sums[taskIndex],N)));
|
||||
k+=r1-r0; j0 = 0;
|
||||
}
|
||||
state.prefix_state.counts[taskIndex] = N;
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#include "parallel_map.h"
|
||||
#include "../sys/regression.h"
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#include "parallel_partition.h"
|
||||
#include "../sys/regression.h"
|
||||
|
||||
@@ -1,10 +1,23 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "parallel_for.h"
|
||||
#include "../math/range.h"
|
||||
#include "../common/math/range.h"
|
||||
|
||||
namespace embree
|
||||
{
|
||||
@@ -51,10 +64,10 @@ namespace embree
|
||||
template<typename T, typename V, typename Vi, typename IsLeft, typename Reduction_T, typename Reduction_V>
|
||||
class __aligned(64) parallel_partition_task
|
||||
{
|
||||
ALIGNED_CLASS_(64);
|
||||
ALIGNED_CLASS;
|
||||
private:
|
||||
|
||||
static const size_t MAX_TASKS = 64;
|
||||
static const size_t MAX_TASKS = 512;
|
||||
|
||||
T* array;
|
||||
size_t N;
|
||||
@@ -262,22 +275,4 @@ namespace embree
|
||||
return begin+p->partition(leftReduction,rightReduction);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename T, typename IsLeft>
|
||||
inline size_t parallel_partitioning(T* array,
|
||||
const size_t begin,
|
||||
const size_t end,
|
||||
const IsLeft& is_left,
|
||||
size_t BLOCK_SIZE = 128)
|
||||
{
|
||||
size_t leftReduction = 0;
|
||||
size_t rightReduction = 0;
|
||||
return parallel_partitioning(
|
||||
array,begin,end,0,leftReduction,rightReduction,is_left,
|
||||
[] (size_t& t,const T& ref) { },
|
||||
[] (size_t& t0,size_t& t1) { },
|
||||
BLOCK_SIZE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#include "parallel_prefix_sum.h"
|
||||
#include "../sys/regression.h"
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -10,7 +23,7 @@ namespace embree
|
||||
template<typename Value>
|
||||
struct ParallelPrefixSumState
|
||||
{
|
||||
enum { MAX_TASKS = 64 };
|
||||
enum { MAX_TASKS = 512 };
|
||||
Value counts[MAX_TASKS];
|
||||
Value sums [MAX_TASKS];
|
||||
};
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#include "parallel_reduce.h"
|
||||
#include "../sys/regression.h"
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -27,7 +40,7 @@ namespace embree
|
||||
taskCount = min(taskCount,threadCount,maxTasks);
|
||||
|
||||
/* parallel invokation of all tasks */
|
||||
dynamic_large_stack_array(Value,values,taskCount,8192); // consumes at most 8192 bytes on the stack
|
||||
dynamic_large_stack_array(Value,values,taskCount,4096); // consumes at most 4096 bytes on the stack
|
||||
parallel_for(taskCount, [&](const Index taskIndex) {
|
||||
const Index k0 = first+(taskIndex+0)*(last-first)/taskCount;
|
||||
const Index k1 = first+(taskIndex+1)*(last-first)/taskCount;
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#include "parallel_set.h"
|
||||
#include "../sys/regression.h"
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#include "parallel_sort.h"
|
||||
#include "../sys/regression.h"
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -253,7 +266,7 @@ namespace embree
|
||||
template<typename Ty, typename Key>
|
||||
class ParallelRadixSort
|
||||
{
|
||||
static const size_t MAX_TASKS = 64;
|
||||
static const size_t MAX_TASKS = 512;
|
||||
static const size_t BITS = 8;
|
||||
static const size_t BUCKETS = (1 << BITS);
|
||||
typedef unsigned int TyRadixCount[BUCKETS];
|
||||
@@ -262,17 +275,10 @@ namespace embree
|
||||
static bool compare(const T& v0, const T& v1) {
|
||||
return (Key)v0 < (Key)v1;
|
||||
}
|
||||
|
||||
private:
|
||||
ParallelRadixSort (const ParallelRadixSort& other) DELETED; // do not implement
|
||||
ParallelRadixSort& operator= (const ParallelRadixSort& other) DELETED; // do not implement
|
||||
|
||||
|
||||
public:
|
||||
ParallelRadixSort (Ty* const src, Ty* const tmp, const size_t N)
|
||||
: radixCount(nullptr), src(src), tmp(tmp), N(N) {}
|
||||
|
||||
void sort(const size_t blockSize)
|
||||
ParallelRadixSort (Ty* const src, Ty* const tmp, const size_t N, const size_t blockSize)
|
||||
: radixCount(nullptr), src(src), tmp(tmp), N(N)
|
||||
{
|
||||
assert(blockSize > 0);
|
||||
|
||||
@@ -290,12 +296,6 @@ namespace embree
|
||||
tbbRadixSort(numThreads);
|
||||
}
|
||||
}
|
||||
|
||||
~ParallelRadixSort()
|
||||
{
|
||||
alignedFree(radixCount);
|
||||
radixCount = nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -402,7 +402,7 @@ namespace embree
|
||||
|
||||
void tbbRadixSort(const size_t numTasks)
|
||||
{
|
||||
radixCount = (TyRadixCount*) alignedMalloc(MAX_TASKS*sizeof(TyRadixCount),64);
|
||||
radixCount = (TyRadixCount*) alignedMalloc(MAX_TASKS*sizeof(TyRadixCount));
|
||||
|
||||
if (sizeof(Key) == sizeof(uint32_t)) {
|
||||
tbbRadixIteration(0*BITS,0,src,tmp,numTasks);
|
||||
@@ -421,6 +421,8 @@ namespace embree
|
||||
tbbRadixIteration(6*BITS,0,src,tmp,numTasks);
|
||||
tbbRadixIteration(7*BITS,1,tmp,src,numTasks);
|
||||
}
|
||||
alignedFree(radixCount);
|
||||
radixCount = nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -433,13 +435,13 @@ namespace embree
|
||||
template<typename Ty>
|
||||
void radix_sort(Ty* const src, Ty* const tmp, const size_t N, const size_t blockSize = 8192)
|
||||
{
|
||||
ParallelRadixSort<Ty,Ty>(src,tmp,N).sort(blockSize);
|
||||
ParallelRadixSort<Ty,Ty>(src,tmp,N,blockSize);
|
||||
}
|
||||
|
||||
template<typename Ty, typename Key>
|
||||
void radix_sort(Ty* const src, Ty* const tmp, const size_t N, const size_t blockSize = 8192)
|
||||
{
|
||||
ParallelRadixSort<Ty,Key>(src,tmp,N).sort(blockSize);
|
||||
ParallelRadixSort<Ty,Key>(src,tmp,N,blockSize);
|
||||
}
|
||||
|
||||
template<typename Ty>
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
IF (NOT OPENIMAGEIO_ROOT)
|
||||
SET(OPENIMAGEIO_ROOT $ENV{OPENIMAGEIO_ROOT})
|
||||
ENDIF()
|
||||
IF (NOT OPENIMAGEIO_ROOT)
|
||||
SET(OPENIMAGEIO_ROOT $ENV{OPENIMAGEIOROOT})
|
||||
ENDIF()
|
||||
|
||||
# detect changed OPENIMAGEIO_ROOT
|
||||
IF (NOT OPENIMAGEIO_ROOT STREQUAL OPENIMAGEIO_ROOT_LAST)
|
||||
UNSET(OPENIMAGEIO_INCLUDE_DIR CACHE)
|
||||
UNSET(OPENIMAGEIO_LIBRARY CACHE)
|
||||
ENDIF()
|
||||
|
||||
set(OPENIMAGEIO_LIB_SUFFIX "")
|
||||
IF (WIN32)
|
||||
IF (MSVC14)
|
||||
SET(OPENIMAGEIO_LIB_SUFFIX "vc2015")
|
||||
ELSEIF (MSVC12)
|
||||
SET(OPENIMAGEIO_LIB_SUFFIX "vc2013")
|
||||
ELSEIF (MSVC11)
|
||||
SET(OPENIMAGEIO_LIB_SUFFIX "vc2012")
|
||||
ELSEIF (MINGW)
|
||||
IF (X64)
|
||||
SET(OPENIMAGEIO_LIB_SUFFIX "mingw-w64")
|
||||
# Who's ever going to build for 32bit??
|
||||
ELSE ()
|
||||
SET(OPENIMAGEIO_LIB_SUFFIX "mingw-w64")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF ()
|
||||
|
||||
FIND_PATH(OPENIMAGEIO_ROOT include/OpenImageIO/imageio.h
|
||||
DOC "Root of OpenImageIO installation"
|
||||
HINTS ${OPENIMAGEIO_ROOT}
|
||||
PATHS
|
||||
${PROJECT_SOURCE_DIR}/oiio
|
||||
/usr/local
|
||||
/usr
|
||||
/
|
||||
)
|
||||
|
||||
FIND_PATH(OPENIMAGEIO_INCLUDE_DIR OpenImageIO/imageio.h PATHS ${OPENIMAGEIO_ROOT}/include NO_DEFAULT_PATH)
|
||||
SET(OPENIMAGEIO_HINTS
|
||||
HINTS
|
||||
${OPENIMAGEIO_ROOT}
|
||||
PATH_SUFFIXES
|
||||
/lib
|
||||
/lib64
|
||||
/lib-${OPENIMAGEIO_LIB_SUFFIX}
|
||||
)
|
||||
SET(OPENIMAGEIO_PATHS PATHS /usr/lib /usr/lib64 /lib /lib64)
|
||||
FIND_LIBRARY(OPENIMAGEIO_LIBRARY OpenImageIO ${OPENIMAGEIO_HINTS} ${OPENIMAGEIO_PATHS})
|
||||
|
||||
SET(OPENIMAGEIO_ROOT_LAST ${OPENIMAGEIO_ROOT} CACHE INTERNAL "Last value of OPENIMAGEIO_ROOT to detect changes")
|
||||
|
||||
SET(OPENIMAGEIO_ERROR_MESSAGE "OpenImageIO not found in your environment. You can 1) install
|
||||
via your OS package manager, or 2) install it
|
||||
somewhere on your machine and point OPENIMAGEIO_ROOT to it.")
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenImageIO
|
||||
${OPENIMAGEIO_ERROR_MESSAGE}
|
||||
OPENIMAGEIO_INCLUDE_DIR OPENIMAGEIO_LIBRARY
|
||||
)
|
||||
|
||||
IF (OPENIMAGEIO_FOUND)
|
||||
SET(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO_INCLUDE_DIR})
|
||||
SET(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARY})
|
||||
ENDIF()
|
||||
|
||||
MARK_AS_ADVANCED(OPENIMAGEIO_INCLUDE_DIR)
|
||||
MARK_AS_ADVANCED(OPENIMAGEIO_LIBRARY)
|
||||
@@ -1,5 +1,18 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2017 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
FIND_PATH( PNG_INCLUDE_DIR NAMES png.h )
|
||||
FIND_LIBRARY( PNG_LIBRARIES NAMES png )
|
||||
|
||||
+110
-322
@@ -1,340 +1,128 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2017 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
IF (WIN32)
|
||||
FIND_PATH(EMBREE_TBB_ROOT include/tbb/tbb.h
|
||||
DOC "Root of TBB installation"
|
||||
PATHS ${PROJECT_SOURCE_DIR}/tbb "C:/Program Files (x86)/Intel/Composer XE/tbb"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
FIND_PATH(EMBREE_TBB_ROOT include/tbb/tbb.h)
|
||||
|
||||
macro(find_tbb TARGET
|
||||
ROOT_VAR
|
||||
INCLUDE_DIR_VAR
|
||||
BIN_DIR_VAR
|
||||
LIB_DIR_VAR
|
||||
TBB_LIBRARY_VAR
|
||||
TBBMALLOC_LIBRARY_VAR
|
||||
TBB_LIBRARY_NAME
|
||||
TBBMALLOC_LIBRARY_NAME)
|
||||
IF (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
SET(TBB_ARCH intel64)
|
||||
ELSE()
|
||||
SET(TBB_ARCH ia32)
|
||||
ENDIF()
|
||||
|
||||
if(${ROOT_VAR})
|
||||
message(STATUS "Looking for ${TARGET} (${TBB_LIBRARY_NAME}, ${TBBMALLOC_LIBRARY_NAME})"
|
||||
" in ${${ROOT_VAR}}")
|
||||
else()
|
||||
message(STATUS "Looking for ${TARGET} (${TBB_LIBRARY_NAME}, ${TBBMALLOC_LIBRARY_NAME})"
|
||||
" in standard locations")
|
||||
endif()
|
||||
IF (MSVC10)
|
||||
SET(TBB_VCVER vc10)
|
||||
ELSEIF (MSVC11)
|
||||
SET(TBB_VCVER vc11)
|
||||
ELSE()
|
||||
SET(TBB_VCVER vc12)
|
||||
ENDIF()
|
||||
|
||||
if(WIN32)
|
||||
# workaround for parentheses in variable name / CMP0053
|
||||
set(PROGRAMFILESx86 "PROGRAMFILES(x86)")
|
||||
set(PROGRAMFILES32 "$ENV{${PROGRAMFILESx86}}")
|
||||
if(NOT PROGRAMFILES32)
|
||||
set(PROGRAMFILES32 "$ENV{PROGRAMFILES}")
|
||||
endif()
|
||||
if(NOT PROGRAMFILES32)
|
||||
set(PROGRAMFILES32 "C:/Program Files (x86)")
|
||||
endif()
|
||||
find_path(${ROOT_VAR} include/tbb/tbb.h
|
||||
DOC "Root of ${TBB_LIBRARY_NAME} installation"
|
||||
PATHS ${PROJECT_SOURCE_DIR}/tbb
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
find_path(${ROOT_VAR} include/tbb/tbb.h
|
||||
DOC "Root of ${TBB_LIBRARY_NAME} installation"
|
||||
PATHS
|
||||
${PROJECT_SOURCE_DIR}/../tbb
|
||||
"${PROGRAMFILES32}/IntelSWTools/compilers_and_libraries/windows/tbb"
|
||||
"${PROGRAMFILES32}/Intel/Composer XE/tbb"
|
||||
"${PROGRAMFILES32}/Intel/compilers_and_libraries/windows/tbb"
|
||||
)
|
||||
SET(TBB_LIBDIR ${EMBREE_TBB_ROOT}/lib/${TBB_ARCH}/${TBB_VCVER})
|
||||
SET(TBB_BINDIR ${EMBREE_TBB_ROOT}/bin/${TBB_ARCH}/${TBB_VCVER})
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(TBB_ARCH intel64)
|
||||
IF (EMBREE_TBB_ROOT STREQUAL "")
|
||||
FIND_PATH(TBB_INCLUDE_DIR tbb/task_scheduler_init.h)
|
||||
FIND_LIBRARY(TBB_LIBRARY tbb)
|
||||
FIND_LIBRARY(TBB_LIBRARY_MALLOC tbbmalloc)
|
||||
ELSE()
|
||||
SET(TBB_INCLUDE_DIR TBB_INCLUDE_DIR-NOTFOUND)
|
||||
SET(TBB_LIBRARY TBB_LIBRARY-NOTFOUND)
|
||||
SET(TBB_LIBRARY_MALLOC TBB_LIBRARY_MALLOC-NOTFOUND)
|
||||
FIND_PATH(TBB_INCLUDE_DIR tbb/task_scheduler_init.h PATHS ${EMBREE_TBB_ROOT}/include NO_DEFAULT_PATH)
|
||||
FIND_LIBRARY(TBB_LIBRARY tbb PATHS ${TBB_LIBDIR} NO_DEFAULT_PATH)
|
||||
FIND_LIBRARY(TBB_LIBRARY_MALLOC tbbmalloc PATHS ${TBB_LIBDIR} NO_DEFAULT_PATH)
|
||||
ENDIF()
|
||||
|
||||
ELSE ()
|
||||
|
||||
FIND_PATH(EMBREE_TBB_ROOT include/tbb/tbb.h
|
||||
DOC "Root of TBB installation"
|
||||
PATHS ${PROJECT_SOURCE_DIR}/tbb /opt/intel/tbb
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
FIND_PATH(EMBREE_TBB_ROOT include/tbb/tbb.h)
|
||||
|
||||
IF (EMBREE_TBB_ROOT STREQUAL "")
|
||||
FIND_PATH(TBB_INCLUDE_DIR tbb/task_scheduler_init.h)
|
||||
FIND_LIBRARY(TBB_LIBRARY tbb)
|
||||
FIND_LIBRARY(TBB_LIBRARY_MALLOC tbbmalloc)
|
||||
|
||||
ELSEIF (EXISTS ${EMBREE_TBB_ROOT}/src)
|
||||
OPTION(EMBREE_TBB_STATIC_LIB "Build TBB as a static library (building TBB as a static library is NOT recommended)")
|
||||
if (EMBREE_TBB_STATIC_LIB)
|
||||
include(${EMBREE_TBB_ROOT}/cmake/TBBBuild.cmake)
|
||||
tbb_build(TBB_ROOT ${EMBREE_TBB_ROOT} CONFIG_DIR TBB_DIR MAKE_ARGS extra_inc=big_iron.inc)
|
||||
SET(TBB_INCLUDE_DIR ${EMBREE_TBB_ROOT}/include)
|
||||
SET(TBB_LIBRARY ${PROJECT_BINARY_DIR}/tbb_cmake_build/tbb_cmake_build_subdir_release/libtbb.a)
|
||||
SET(TBB_LIBRARY_MALLOC ${PROJECT_BINARY_DIR}/tbb_cmake_build/tbb_cmake_build_subdir_release/libtbbmalloc.a)
|
||||
else()
|
||||
set(TBB_ARCH ia32)
|
||||
include(${EMBREE_TBB_ROOT}/cmake/TBBBuild.cmake)
|
||||
tbb_build(TBB_ROOT ${EMBREE_TBB_ROOT} CONFIG_DIR TBB_DIR)
|
||||
SET(TBB_INCLUDE_DIR ${EMBREE_TBB_ROOT}/include)
|
||||
SET(TBB_LIBRARY ${PROJECT_BINARY_DIR}/tbb_cmake_build/tbb_cmake_build_subdir_release/libtbb.so.2)
|
||||
SET(TBB_LIBRARY_MALLOC ${PROJECT_BINARY_DIR}/tbb_cmake_build/tbb_cmake_build_subdir_release/libtbbmalloc.so.2)
|
||||
endif()
|
||||
|
||||
ELSE()
|
||||
SET(TBB_INCLUDE_DIR TBB_INCLUDE_DIR-NOTFOUND)
|
||||
SET(TBB_LIBRARY TBB_LIBRARY-NOTFOUND)
|
||||
SET(TBB_LIBRARY_MALLOC TBB_LIBRARY_MALLOC-NOTFOUND)
|
||||
IF (APPLE)
|
||||
FIND_PATH(TBB_INCLUDE_DIR tbb/task_scheduler_init.h PATHS ${EMBREE_TBB_ROOT}/include NO_DEFAULT_PATH)
|
||||
FIND_LIBRARY(TBB_LIBRARY tbb PATHS ${EMBREE_TBB_ROOT}/lib NO_DEFAULT_PATH)
|
||||
FIND_LIBRARY(TBB_LIBRARY_MALLOC tbbmalloc PATHS ${EMBREE_TBB_ROOT}/lib NO_DEFAULT_PATH)
|
||||
ELSE()
|
||||
FIND_PATH(TBB_INCLUDE_DIR tbb/task_scheduler_init.h PATHS ${EMBREE_TBB_ROOT}/include NO_DEFAULT_PATH)
|
||||
FIND_LIBRARY(TBB_LIBRARY tbb PATHS ${EMBREE_TBB_ROOT}/lib/intel64/gcc4.4 ${EMBREE_TBB_ROOT}/lib ${EMBREE_TBB_ROOT}/lib64 /usr/libx86_64-linux-gnu/ NO_DEFAULT_PATH)
|
||||
FIND_LIBRARY(TBB_LIBRARY_MALLOC tbbmalloc PATHS ${EMBREE_TBB_ROOT}/lib/intel64/gcc4.4 ${EMBREE_TBB_ROOT}/lib ${EMBREE_TBB_ROOT}/lib64 /usr/libx86_64-linux-gnu/ NO_DEFAULT_PATH)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
if(MSVC10)
|
||||
set(TBB_VCVER vc10)
|
||||
elseif(MSVC11)
|
||||
set(TBB_VCVER vc11)
|
||||
elseif(MSVC12)
|
||||
set(TBB_VCVER vc12)
|
||||
else()
|
||||
set(TBB_VCVER vc14)
|
||||
endif()
|
||||
ENDIF()
|
||||
|
||||
if(${ROOT_VAR} STREQUAL "")
|
||||
find_path(${INCLUDE_DIR_VAR} tbb/task_scheduler_init.h)
|
||||
find_path(${BIN_DIR_VAR} "${TBB_LIBRARY_NAME}.dll")
|
||||
find_library(${TBB_LIBRARY_VAR} ${TBB_LIBRARY_NAME})
|
||||
find_library(${TBBMALLOC_LIBRARY_VAR} ${TBBMALLOC_LIBRARY_NAME})
|
||||
else()
|
||||
set(${INCLUDE_DIR_VAR} ${INCLUDE_DIR_VAR}-NOTFOUND)
|
||||
set(${BIN_DIR_VAR} ${BIN_DIR_VAR}-NOTFOUND)
|
||||
set(${TBB_LIBRARY_VAR} ${TBB_LIBRARY_VAR}-NOTFOUND)
|
||||
set(${TBBMALLOC_LIBRARY_VAR} ${TBBMALLOC_LIBRARY_VAR}-NOTFOUND)
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TBB DEFAULT_MSG TBB_INCLUDE_DIR TBB_LIBRARY TBB_LIBRARY_MALLOC)
|
||||
|
||||
find_path(${INCLUDE_DIR_VAR} tbb/task_scheduler_init.h PATHS ${${ROOT_VAR}}/include NO_DEFAULT_PATH)
|
||||
IF (TBB_FOUND)
|
||||
SET(TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR})
|
||||
SET(TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_LIBRARY_MALLOC})
|
||||
ENDIF()
|
||||
|
||||
find_path(${BIN_DIR_VAR} "${TBB_LIBRARY_NAME}.dll"
|
||||
HINTS
|
||||
${${ROOT_VAR}}/bin/${TBB_ARCH}/${TBB_VCVER}
|
||||
${${ROOT_VAR}}/bin
|
||||
${${ROOT_VAR}}/../redist/${TBB_ARCH}/tbb/${TBB_VCVER}
|
||||
${${ROOT_VAR}}/../redist/${TBB_ARCH}_win/tbb/${TBB_VCVER}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
set(${LIB_DIR_VAR} ${${ROOT_VAR}}/lib/${TBB_ARCH}/${TBB_VCVER})
|
||||
|
||||
find_library(${TBB_LIBRARY_VAR} ${TBB_LIBRARY_NAME}
|
||||
PATHS
|
||||
${${LIB_DIR_VAR}}
|
||||
${${ROOT_VAR}}/lib
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_library(${TBBMALLOC_LIBRARY_VAR} ${TBBMALLOC_LIBRARY_NAME}
|
||||
PATHS
|
||||
${${LIB_DIR_VAR}}
|
||||
${${ROOT_VAR}}/lib
|
||||
NO_DEFAULT_PATH)
|
||||
endif()
|
||||
|
||||
else()
|
||||
|
||||
find_path(${ROOT_VAR} include/tbb/tbb.h
|
||||
DOC "Root of ${TBB_LIBRARY_NAME} installation"
|
||||
PATHS ${PROJECT_SOURCE_DIR}/tbb
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
find_path(${ROOT_VAR} include/tbb/tbb.h
|
||||
DOC "Root of ${TBB_LIBRARY_NAME} installation"
|
||||
HINTS ${${ROOT_VAR}}
|
||||
PATHS
|
||||
${PROJECT_SOURCE_DIR}/tbb
|
||||
/opt/intel/composerxe/tbb
|
||||
/opt/intel/compilers_and_libraries/tbb
|
||||
/opt/intel/tbb
|
||||
)
|
||||
|
||||
if(${ROOT_VAR} STREQUAL "")
|
||||
find_path(${INCLUDE_DIR_VAR} tbb/task_scheduler_init.h)
|
||||
find_library(${TBB_LIBRARY_VAR} ${TBB_LIBRARY_NAME})
|
||||
find_library(${TBBMALLOC_LIBRARY_VAR} ${TBBMALLOC_LIBRARY_NAME})
|
||||
elseif(EXISTS ${${ROOT_VAR}}/cmake/TBBBuild.cmake AND EXISTS ${${ROOT_VAR}}/src/tbb/tbb_version.h)
|
||||
option(TBB_STATIC_LIB "Build TBB as a static library (building TBB as a static library is NOT recommended)")
|
||||
if(TBB_STATIC_LIB)
|
||||
include(${${ROOT_VAR}}/cmake/TBBBuild.cmake)
|
||||
tbb_build(TBB_ROOT ${${ROOT_VAR}} CONFIG_DIR TBB_DIR MAKE_ARGS extra_inc=big_iron.inc)
|
||||
|
||||
set(${INCLUDE_DIR_VAR} ${${ROOT_VAR}}/include)
|
||||
set(${TBB_LIBRARY_VAR} ${PROJECT_BINARY_DIR}/tbb_cmake_build/tbb_cmake_build_subdir_release/lib${TBB_LIBRARY_NAME}.a)
|
||||
set(${TBBMALLOC_LIBRARY_VAR} ${PROJECT_BINARY_DIR}/tbb_cmake_build/tbb_cmake_build_subdir_release/lib${TBBMALLOC_LIBRARY_NAME}.a)
|
||||
else()
|
||||
include(${${ROOT_VAR}}/cmake/TBBBuild.cmake)
|
||||
tbb_build(TBB_ROOT ${${ROOT_VAR}} CONFIG_DIR TBB_DIR)
|
||||
set(${INCLUDE_DIR_VAR} ${${ROOT_VAR}}/include)
|
||||
set(${TBB_LIBRARY_VAR} ${PROJECT_BINARY_DIR}/tbb_cmake_build/tbb_cmake_build_subdir_release/lib${TBB_LIBRARY_NAME}.so.2)
|
||||
set(${TBBMALLOC_LIBRARY_VAR} ${PROJECT_BINARY_DIR}/tbb_cmake_build/tbb_cmake_build_subdir_release/lib${TBBMALLOC_LIBRARY_NAME}.so.2)
|
||||
endif()
|
||||
else()
|
||||
set(${INCLUDE_DIR_VAR} ${INCLUDE_DIR_VAR}-NOTFOUND)
|
||||
set(${BIN_DIR_VAR} ${BIN_DIR_VAR}-NOTFOUND)
|
||||
set(${TBB_LIBRARY_VAR} ${TBB_LIBRARY_VAR}-NOTFOUND)
|
||||
set(${TBBMALLOC_LIBRARY_VAR} ${TBBMALLOC_LIBRARY_VAR}-NOTFOUND)
|
||||
if(APPLE)
|
||||
find_path(${INCLUDE_DIR_VAR} tbb/task_scheduler_init.h PATHS ${${ROOT_VAR}}/include NO_DEFAULT_PATH)
|
||||
find_library(${TBB_LIBRARY_VAR} ${TBB_LIBRARY_NAME} PATHS ${${ROOT_VAR}}/lib NO_DEFAULT_PATH)
|
||||
find_library(${TBBMALLOC_LIBRARY_VAR} ${TBBMALLOC_LIBRARY_NAME} PATHS ${${ROOT_VAR}}/lib NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_path(${INCLUDE_DIR_VAR} tbb/task_scheduler_init.h PATHS ${${ROOT_VAR}}/include NO_DEFAULT_PATH)
|
||||
file(GLOB ALL_HINTS PATHS ${${ROOT_VAR}}/lib/intel64/gcc*)
|
||||
list(REVERSE ALL_HINTS)
|
||||
set(ALL_HINTS
|
||||
HINTS
|
||||
${ALL_HINTS}
|
||||
${${ROOT_VAR}}/lib
|
||||
${${ROOT_VAR}}/lib/x86_64-linux-gnu
|
||||
${${ROOT_VAR}}/lib64
|
||||
${${ROOT_VAR}}/libx86_64-linux-gnu
|
||||
NO_DEFAULT_PATH)
|
||||
find_library(${TBB_LIBRARY_VAR} ${TBB_LIBRARY_NAME} ${ALL_HINTS})
|
||||
find_library(${TBBMALLOC_LIBRARY_VAR} ${TBBMALLOC_LIBRARY_NAME} ${ALL_HINTS})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(${TARGET}
|
||||
DEFAULT_MSG ${INCLUDE_DIR_VAR} ${TBB_LIBRARY_VAR} ${TBBMALLOC_LIBRARY_VAR})
|
||||
|
||||
# Do not display these variables in GUIs unless the advanced flag is on.
|
||||
mark_as_advanced(${INCLUDE_DIR_VAR})
|
||||
mark_as_advanced(${BIN_DIR_VAR})
|
||||
mark_as_advanced(${LIB_DIR_VAR})
|
||||
mark_as_advanced(${TBB_LIBRARY_VAR})
|
||||
mark_as_advanced(${TBBMALLOC_LIBRARY_VAR})
|
||||
|
||||
# Create an imported library target for TBB.
|
||||
if(${TARGET}_FOUND)
|
||||
add_library(${TARGET}::tbb SHARED IMPORTED)
|
||||
set_target_properties(${TARGET}::tbb PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${${INCLUDE_DIR_VAR}}
|
||||
INTERFACE_COMPILE_DEFINITIONS "__TBB_NO_IMPLICIT_LINKAGE=1"
|
||||
)
|
||||
add_library(${TARGET}::tbbmalloc SHARED IMPORTED)
|
||||
set_target_properties(${TARGET}::tbbmalloc PROPERTIES
|
||||
INTERFACE_COMPILE_DEFINITIONS "__TBBMALLOC_NO_IMPLICIT_LINKAGE=1"
|
||||
)
|
||||
if(WIN32)
|
||||
set_target_properties(${TARGET}::tbb PROPERTIES
|
||||
IMPORTED_IMPLIB ${${TBB_LIBRARY_VAR}}
|
||||
)
|
||||
set_target_properties(${TARGET}::tbbmalloc PROPERTIES
|
||||
IMPORTED_IMPLIB ${${TBBMALLOC_LIBRARY_VAR}}
|
||||
)
|
||||
else()
|
||||
# Note: IMPORTED_NO_SONAME must be set or cmake will attempt
|
||||
# to link to the full path of libtbb.so. Instead, we
|
||||
# rely on the linker to find libtbb.so.2.
|
||||
set_target_properties(${TARGET}::tbb PROPERTIES
|
||||
IMPORTED_LOCATION ${${TBB_LIBRARY_VAR}}
|
||||
IMPORTED_NO_SONAME TRUE
|
||||
)
|
||||
set_target_properties(${TARGET}::tbbmalloc PROPERTIES
|
||||
IMPORTED_LOCATION ${${TBBMALLOC_LIBRARY_VAR}}
|
||||
IMPORTED_NO_SONAME TRUE
|
||||
)
|
||||
endif()
|
||||
get_filename_component(${LIB_DIR_VAR} ${${TBB_LIBRARY_VAR}} DIRECTORY)
|
||||
message(STATUS "FOUND ${TARGET} AT ${${LIB_DIR_VAR}}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
#===============================================================================
|
||||
# User configuration.
|
||||
#===============================================================================
|
||||
|
||||
SET(EMBREE_TBB_ROOT "" CACHE PATH "Sets the root path of the release version of TBB.")
|
||||
SET(EMBREE_TBB_DEBUG_ROOT "" CACHE PATH "Sets the root path of the debug version of TBB.")
|
||||
SET(EMBREE_TBB_POSTFIX "" CACHE STRING "Link to tbb<EMBREE_TBB_POSTFIX>.(dll,lib,so) in release mode.")
|
||||
SET(EMBREE_TBB_DEBUG_POSTFIX "_debug" CACHE STRING "Link to tbb<EMBREE_TBB_DEBUG_POSTFIX>.(dll,lib,so) in debug mode.")
|
||||
|
||||
if (NOT EMBREE_TBB_ROOT)
|
||||
set(EMBREE_TBB_ROOT $ENV{EMBREE_TBB_ROOT})
|
||||
if(NOT EMBREE_TBB_ROOT)
|
||||
set(EMBREE_TBB_ROOT $ENV{EMBREE_TBBROOT})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# For the debug root we fall back to TBB_ROOT!
|
||||
if (NOT EMBREE_TBB_DEBUG_ROOT)
|
||||
set(EMBREE_TBB_DEBUG_ROOT $ENV{EMBREE_TBB_DEBUG_ROOT})
|
||||
if(NOT EMBREE_TBB_DEBUG_ROOT)
|
||||
set(EMBREE_TBB_DEBUG_ROOT $ENV{EMBREE_TBBDEBUGROOT})
|
||||
if(NOT EMBREE_TBB_DEBUG_ROOT)
|
||||
set(EMBREE_TBB_DEBUG_ROOT ${EMBREE_TBB_ROOT})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT EMBREE_TBB_LIBRARY_NAME)
|
||||
set(EMBREE_TBB_LIBRARY_NAME $ENV{EMBREE_TBB_LIBRARY_NAME})
|
||||
if (NOT EMBREE_TBB_LIBRARY_NAME)
|
||||
set(EMBREE_TBB_LIBRARY_NAME "tbb${EMBREE_TBB_POSTFIX}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT EMBREE_TBBMALLOC_LIBRARY_NAME)
|
||||
set(EMBREE_TBBMALLOC_LIBRARY_NAME $ENV{EMBREE_TBBMALLOC_LIBRARY_NAME})
|
||||
if (NOT EMBREE_TBBMALLOC_LIBRARY_NAME)
|
||||
set(EMBREE_TBBMALLOC_LIBRARY_NAME "tbbmalloc${EMBREE_TBB_POSTFIX}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT EMBREE_TBB_DEBUG_LIBRARY_NAME)
|
||||
set(EMBREE_TBB_DEBUG_LIBRARY_NAME $ENV{EMBREE_TBB_DEBUG_LIBRARY_NAME})
|
||||
if (NOT EMBREE_TBB_DEBUG_LIBRARY_NAME)
|
||||
set(EMBREE_TBB_DEBUG_LIBRARY_NAME "tbb${EMBREE_TBB_DEBUG_POSTFIX}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT EMBREE_TBBMALLOC_DEBUG_LIBRARY_NAME)
|
||||
set(EMBREE_TBBMALLOC_DEBUG_LIBRARY_NAME $ENV{EMBREE_TBBMALLOC_DEBUG_LIBRARY_NAME})
|
||||
if (NOT EMBREE_TBBMALLOC_DEBUG_LIBRARY_NAME)
|
||||
set(EMBREE_TBBMALLOC_DEBUG_LIBRARY_NAME "tbbmalloc${EMBREE_TBB_DEBUG_POSTFIX}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_tbb(TBB
|
||||
EMBREE_TBB_ROOT
|
||||
EMBREE_TBB_INCLUDE_DIR
|
||||
EMBREE_TBB_BIN_DIR
|
||||
EMBREE_TBB_LIB_DIR
|
||||
EMBREE_TBB_LIBRARY
|
||||
EMBREE_TBBMALLOC_LIBRARY
|
||||
${EMBREE_TBB_LIBRARY_NAME}
|
||||
${EMBREE_TBBMALLOC_LIBRARY_NAME})
|
||||
|
||||
find_tbb(TBB_DEBUG
|
||||
EMBREE_TBB_DEBUG_ROOT
|
||||
EMBREE_TBB_DEBUG_INCLUDE_DIR
|
||||
EMBREE_TBB_DEBUG_BIN_DIR
|
||||
EMBREE_TBB_DEBUG_LIB_DIR
|
||||
EMBREE_TBB_DEBUG_LIBRARY
|
||||
EMBREE_TBBMALLOC_DEBUG_LIBRARY
|
||||
${EMBREE_TBB_DEBUG_LIBRARY_NAME}
|
||||
${EMBREE_TBBMALLOC_DEBUG_LIBRARY_NAME})
|
||||
|
||||
#===============================================================================
|
||||
# For linking, attempt to differentiate between release and debug builds,
|
||||
# but fall back if possible to avoid breaking existing build pipelines.
|
||||
#===============================================================================
|
||||
|
||||
if(TBB_FOUND AND TBB_DEBUG_FOUND)
|
||||
set(TBB_LIBRARIES
|
||||
optimized TBB::tbbmalloc
|
||||
optimized TBB::tbb
|
||||
debug TBB_DEBUG::tbbmalloc
|
||||
debug TBB_DEBUG::tbb)
|
||||
set(TBB_INCLUDE_DIRS ${EMBREE_TBB_INCLUDE_DIR} ${EMBREE_TBB_DEBUG_INCLUDE_DIR})
|
||||
elseif(TBB_FOUND)
|
||||
# This is a status message only because there is no performance penalty in
|
||||
# falling back to the release version of TBB. This fallback is quite likely
|
||||
# to happen because users may use tbb as provided by their OS distribution.
|
||||
message(STATUS "Could not find TBB_DEBUG. Falling back to TBB in Debug mode. Consider setting EMBREE_TBB_DEBUG_ROOT or EMBREE_TBB_DEBUG_POSTIFX.")
|
||||
set(TBB_LIBRARIES TBB::tbbmalloc TBB::tbb)
|
||||
set(TBB_INCLUDE_DIRS ${EMBREE_TBB_INCLUDE_DIR})
|
||||
elseif(TBB_DEBUG_FOUND)
|
||||
# Warn in this case because we are falling back to debug mode!
|
||||
message(WARNING "Could not find TBB. Falling back to TBB_DEBUG in Release mode. Consider setting EMBREE_TBB_ROOT or EMBREE_TBB_POSTIFX.")
|
||||
set(TBB_LIBRARIES TBB_DEBUG::tbbmalloc TBB_DEBUG::tbb)
|
||||
set(TBB_INCLUDE_DIRS ${EMBREE_TBB_DEBUG_INCLUDE_DIR})
|
||||
else()
|
||||
message(FATAL_ERROR "Could not find TBB or TBB_DEBUG. Consider setting EMBREE_TBB_ROOT and EMBREE_TBB_DEBUG_ROOT.")
|
||||
endif()
|
||||
MARK_AS_ADVANCED(TBB_INCLUDE_DIR)
|
||||
MARK_AS_ADVANCED(TBB_LIBRARY)
|
||||
MARK_AS_ADVANCED(TBB_LIBRARY_MALLOC)
|
||||
|
||||
##############################################################
|
||||
# Install TBB
|
||||
##############################################################
|
||||
|
||||
IF (EMBREE_INSTALL_DEPENDENCIES)
|
||||
IF (TBB_FOUND)
|
||||
IF (WIN32)
|
||||
INSTALL(PROGRAMS ${EMBREE_TBB_BIN_DIR}/${EMBREE_TBB_LIBRARY_NAME}.dll ${EMBREE_TBB_BIN_DIR}/${EMBREE_TBBMALLOC_LIBRARY_NAME}.dll DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT examples)
|
||||
INSTALL(PROGRAMS ${EMBREE_TBB_LIB_DIR}/${EMBREE_TBB_LIBRARY_NAME}.lib ${EMBREE_TBB_LIB_DIR}/${EMBREE_TBBMALLOC_LIBRARY_NAME}.lib DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib)
|
||||
ELSEIF (APPLE)
|
||||
INSTALL(PROGRAMS ${EMBREE_TBB_LIBRARY} ${EMBREE_TBBMALLOC_LIBRARY} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib)
|
||||
ELSE()
|
||||
INSTALL(PROGRAMS ${EMBREE_TBB_LIBRARY}.2 ${EMBREE_TBBMALLOC_LIBRARY}.2 DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
IF (TBB_DEBUG_FOUND)
|
||||
IF (WIN32)
|
||||
INSTALL(PROGRAMS ${EMBREE_TBB_BIN_DIR}/${EMBREE_TBB_DEBUG_LIBRARY_NAME}.dll ${EMBREE_TBB_DEBUG_BIN_DIR}/${EMBREE_TBBMALLOC_DEBUG_LIBRARY_NAME}.dll DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT examples)
|
||||
INSTALL(PROGRAMS ${EMBREE_TBB_LIB_DIR}/${EMBREE_TBB_DEBUG_LIBRARY_NAME}.lib ${EMBREE_TBB_DEBUG_LIB_DIR}/${EMBREE_TBBMALLOC_DEBUG_LIBRARY_NAME}.lib DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib)
|
||||
ELSEIF (APPLE)
|
||||
INSTALL(PROGRAMS ${EMBREE_TBB_DEBUG_LIBRARY} ${EMBREE_TBBMALLOC_DEBUG_LIBRARY} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib)
|
||||
ELSE()
|
||||
INSTALL(PROGRAMS ${EMBREE_TBB_DEBUG_LIBRARY}.2 ${EMBREE_TBBMALLOC_DEBUG_LIBRARY}.2 DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib)
|
||||
ENDIF()
|
||||
IF (WIN32)
|
||||
INSTALL(PROGRAMS ${TBB_BINDIR}/tbb.dll ${TBB_BINDIR}/tbbmalloc.dll DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT examples)
|
||||
INSTALL(PROGRAMS ${TBB_BINDIR}/tbb.dll ${TBB_BINDIR}/tbbmalloc.dll DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib)
|
||||
INSTALL(PROGRAMS ${TBB_LIBDIR}/tbb.lib ${TBB_LIBDIR}/tbbmalloc.lib DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib)
|
||||
ELSEIF (EMBREE_ZIP_MODE)
|
||||
IF (APPLE)
|
||||
INSTALL(PROGRAMS ${EMBREE_TBB_ROOT}/lib/libtbb.dylib ${EMBREE_TBB_ROOT}/lib/libtbbmalloc.dylib DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib)
|
||||
ELSE()
|
||||
INSTALL(PROGRAMS ${EMBREE_TBB_ROOT}/lib/intel64/gcc4.4/libtbb.so.2 ${EMBREE_TBB_ROOT}/lib/intel64/gcc4.4/libtbbmalloc.so.2 DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2017 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
IF (WIN32 OR APPLE)
|
||||
return()
|
||||
@@ -10,10 +23,8 @@ string(REPLACE "\n" ";" output ${output})
|
||||
|
||||
foreach (line ${output})
|
||||
if ("${line}" MATCHES "O .bss")
|
||||
if (NOT "${line}" MATCHES "std::__ioinit" AND # this is caused by iostream initialization and is likely also ok
|
||||
NOT "${line}" MATCHES "\\(\\)::" AND # this matches a static inside a function which is fine
|
||||
NOT "${line}" MATCHES "function_local_static_" AND # static variable inside a function (explicitely named)
|
||||
NOT "${line}" MATCHES "__\\$U") # ICC generated locks for static variable inside a function
|
||||
if (NOT "${line}" MATCHES "std::__ioinit" AND # this is caused by iostream initialization and is likely also ok
|
||||
NOT "${line}" MATCHES "\\(\\)::") # this matches a static inside a function which is fine
|
||||
message(WARNING "\nProblematic global variable in non-SSE code:\n" ${line})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2017 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
IF (WIN32 OR APPLE)
|
||||
return()
|
||||
|
||||
+41
-51
@@ -1,18 +1,28 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2017 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
MACRO(_SET_IF_EMPTY VAR VALUE)
|
||||
IF(NOT ${VAR})
|
||||
SET(${VAR} "${VALUE}")
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
_SET_IF_EMPTY(FLAGS_SSE2 "-msse2")
|
||||
_SET_IF_EMPTY(FLAGS_SSE42 "-msse4.2")
|
||||
_SET_IF_EMPTY(FLAGS_AVX "-mavx")
|
||||
_SET_IF_EMPTY(FLAGS_AVX2 "-mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
|
||||
_SET_IF_EMPTY(FLAGS_AVX512KNL "-march=knl")
|
||||
_SET_IF_EMPTY(FLAGS_AVX512SKX "-march=skx")
|
||||
SET(FLAGS_SSE2 "-msse2")
|
||||
SET(FLAGS_SSE3 "-msse3")
|
||||
SET(FLAGS_SSSE3 "-mssse3")
|
||||
SET(FLAGS_SSE41 "-msse4.1")
|
||||
SET(FLAGS_SSE42 "-msse4.2")
|
||||
SET(FLAGS_AVX "-mavx")
|
||||
SET(FLAGS_AVX2 "-mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
|
||||
SET(FLAGS_AVX512KNL "-march=knl")
|
||||
SET(FLAGS_AVX512SKX "-march=skx")
|
||||
|
||||
IF (WIN32)
|
||||
|
||||
@@ -21,34 +31,27 @@ IF (WIN32)
|
||||
# SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /MP") # compile source files in parallel
|
||||
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /GR") # enable runtime type information (on by default)
|
||||
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} -Xclang -fcxx-exceptions") # enable C++ exceptions in Clang
|
||||
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /w") # disable all warnings
|
||||
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /Gy") # package individual functions
|
||||
IF (EMBREE_STACK_PROTECTOR)
|
||||
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /GS") # protects against return address overrides
|
||||
ELSE()
|
||||
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /GS-") # do not protect against return address overrides
|
||||
ENDIF()
|
||||
MACRO(DISABLE_STACK_PROTECTOR_FOR_FILE file)
|
||||
IF (EMBREE_STACK_PROTECTOR)
|
||||
SET_SOURCE_FILES_PROPERTIES(${file} PROPERTIES COMPILE_FLAGS "/GS-")
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COMMON_CXX_FLAGS}")
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /DDEBUG") # enables assertions
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /DTBB_USE_DEBUG") # configures TBB in debug mode
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Ox") # enable full optimizations
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Oi") # inline intrinsic functions
|
||||
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /DEBUG") # generate debug information
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /DEBUG") # generate debug information
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${COMMON_CXX_FLAGS}")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Ox") # enable full optimizations
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi") # inline intrinsic functions
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Gy") # package individual functions
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-vectorize") # disable auto vectorization
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${COMMON_CXX_FLAGS}")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Ox") # enable full optimizations
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Oi") # inline intrinsic functions
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Gy") # package individual functions
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fno-vectorize") # disable auto vectorization
|
||||
SET(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /DEBUG") # generate debug information
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /DEBUG") # generate debug information
|
||||
|
||||
@@ -66,65 +69,52 @@ IF (WIN32)
|
||||
ELSE()
|
||||
|
||||
OPTION(EMBREE_IGNORE_CMAKE_CXX_FLAGS "When enabled Embree ignores default CMAKE_CXX_FLAGS." ON)
|
||||
OPTION(EMBREE_ADDRESS_SANITIZER "Enabled CLANG address sanitizer." OFF)
|
||||
IF (EMBREE_IGNORE_CMAKE_CXX_FLAGS)
|
||||
SET(CMAKE_CXX_FLAGS "")
|
||||
ENDIF()
|
||||
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") # enables most warnings
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat -Wformat-security") # enables string format vulnerability warnings
|
||||
IF (NOT APPLE)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE") # enables support for more secure position independent execution
|
||||
ENDIF()
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") # generate position independent code suitable for shared libraries
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") # generate position independent code suitable for shared libraries
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") # enables C++11 features
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") # makes all symbols hidden by default
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden") # makes all inline symbols hidden by default
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing") # disables strict aliasing rules
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-tree-vectorize") # disable auto vectorizer
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORTIFY_SOURCE=2") # perform extra security checks for some standard library calls
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-tree-vectorize") # disable auto vectorizer
|
||||
IF (EMBREE_STACK_PROTECTOR)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector") # protects against return address overrides
|
||||
ENDIF()
|
||||
MACRO(DISABLE_STACK_PROTECTOR_FOR_FILE file)
|
||||
IF (EMBREE_STACK_PROTECTOR)
|
||||
SET_SOURCE_FILES_PROPERTIES(${file} PROPERTIES COMPILE_FLAGS "-fno-stack-protector")
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
IF (EMBREE_ADDRESS_SANITIZER)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize-address-use-after-scope -fno-omit-frame-pointer -fno-optimize-sibling-calls")
|
||||
ENDIF()
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "")
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g") # generate debug information
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") # enable assertions
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DTBB_USE_DEBUG") # configure TBB in debug mode
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O3") # enable full optimizations
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") # enable assertions
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DTBB_USE_DEBUG") # configure TBB in debug mode
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g") # generate debug information
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0") # disable optimizations
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG") # disable assertions
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3") # enable full optimizations
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DDEBUG") # enable assertions
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DTBB_USE_DEBUG") # configure TBB in debug mode
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g") # generate debug information
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DNDEBUG") # disable assertions
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O3") # enable full optimizations
|
||||
|
||||
IF (APPLE)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.7") # makes sure code runs on older MacOSX versions
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") # link against libc++ which supports C++11 features
|
||||
ELSE(APPLE)
|
||||
IF (NOT EMBREE_ADDRESS_SANITIZER) # for address sanitizer this causes link errors
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") # issues link error for undefined symbols in shared library
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z noexecstack") # we do not need an executable stack
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z relro -z now") # re-arranges data sections to increase security
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -z noexecstack") # we do not need an executable stack
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -z relro -z now") # re-arranges data sections to increase security
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") # enables position independent execution for executable
|
||||
ENDIF()
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") # issues link error for undefined symbols in shared library
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z noexecstack") # we do not need an executable stack
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z relro -z now") # re-arranges data sections to increase security
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -z noexecstack") # we do not need an executable stack
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -z relro -z now") # re-arranges data sections to increase security
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") # enables position independent execution for executable
|
||||
ENDIF(APPLE)
|
||||
|
||||
ENDIF()
|
||||
|
||||
@@ -13,12 +13,10 @@
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
SET(FLAGS_SSE2 "-target-cpu=x86_64")
|
||||
SET(FLAGS_SSE42 "NOT_SUPPORTED")
|
||||
|
||||
SET(FLAGS_SSE2 "-target-cpu=xeon")
|
||||
SET(FLAGS_SSE42 "-target-cpu=interlagos")
|
||||
SET(FLAGS_AVX "-target-cpu=sandybridge")
|
||||
SET(FLAGS_AVX2 "-target-cpu=haswell")
|
||||
SET(FLAGS_AVX512KNL "-target-cpu=mic-knl")
|
||||
SET(FLAGS_AVX512SKX "-target-cpu=x86-skylake")
|
||||
|
||||
STRING(TOLOWER "${CMAKE_CXX_COMPILER_ID}" _lower_compiler_id)
|
||||
INCLUDE("${CMAKE_CURRENT_LIST_DIR}/${_lower_compiler_id}.cmake" OPTIONAL)
|
||||
|
||||
@@ -1,4 +1,17 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2017 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
file(WRITE ${dst} "#include \"${src}\"\n")
|
||||
|
||||
@@ -1,10 +1,23 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2017 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
# use default install config
|
||||
INCLUDE(${CMAKE_CURRENT_LIST_DIR}/embree-config-install.cmake)
|
||||
|
||||
# and override path variables to match for build directory
|
||||
SET(EMBREE_INCLUDE_DIRS @PROJECT_SOURCE_DIR@/include)
|
||||
SET(EMBREE_LIBRARY @PROJECT_BINARY_DIR@/@EMBREE_LIBRARY_FULLNAME@)
|
||||
SET(EMBREE_LIBRARY @PROJECT_BINARY_DIR@/@EMBREE_LIBRARY_NAME@)
|
||||
SET(EMBREE_LIBRARIES ${EMBREE_LIBRARY})
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2017 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
SET(PACKAGE_VERSION @EMBREE_VERSION@)
|
||||
|
||||
|
||||
@@ -1,11 +1,24 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2017 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
SET(EMBREE_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/@EMBREE_RELATIV_ROOT_DIR@)
|
||||
GET_FILENAME_COMPONENT(EMBREE_ROOT_DIR "${EMBREE_ROOT_DIR}" ABSOLUTE)
|
||||
|
||||
SET(EMBREE_INCLUDE_DIRS ${EMBREE_ROOT_DIR}/@CMAKE_INSTALL_INCLUDEDIR@)
|
||||
SET(EMBREE_LIBRARY ${EMBREE_ROOT_DIR}/@CMAKE_INSTALL_LIBDIR@/@EMBREE_LIBRARY_FULLNAME@)
|
||||
SET(EMBREE_LIBRARY ${EMBREE_ROOT_DIR}/@CMAKE_INSTALL_LIBDIR@/@EMBREE_LIBRARY_NAME@)
|
||||
SET(EMBREE_LIBRARIES ${EMBREE_LIBRARY})
|
||||
|
||||
MARK_AS_ADVANCED(embree_DIR)
|
||||
@@ -32,24 +45,15 @@ SET(EMBREE_TUTORIALS @EMBREE_TUTORIALS@)
|
||||
SET(EMBREE_RAY_MASK @EMBREE_RAY_MASK@)
|
||||
SET(EMBREE_STAT_COUNTERS @EMBREE_STAT_COUNTERS@)
|
||||
SET(EMBREE_BACKFACE_CULLING @EMBREE_BACKFACE_CULLING@)
|
||||
SET(EMBREE_FILTER_FUNCTION @EMBREE_FILTER_FUNCTION@)
|
||||
SET(EMBREE_INTERSECTION_FILTER @EMBREE_INTERSECTION_FILTER@)
|
||||
SET(EMBREE_INTERSECTION_FILTER_RESTORE @EMBREE_INTERSECTION_FILTER_RESTORE@)
|
||||
SET(EMBREE_IGNORE_INVALID_RAYS @EMBREE_IGNORE_INVALID_RAYS@)
|
||||
SET(EMBREE_TASKING_SYSTEM @EMBREE_TASKING_SYSTEM@)
|
||||
|
||||
SET(EMBREE_GEOMETRY_TRIANGLE @EMBREE_GEOMETRY_TRIANGLE@)
|
||||
SET(EMBREE_GEOMETRY_QUAD @EMBREE_GEOMETRY_QUAD@)
|
||||
SET(EMBREE_GEOMETRY_CURVE @EMBREE_GEOMETRY_CURVE@)
|
||||
SET(EMBREE_GEOMETRY_SUBDIVISION @EMBREE_GEOMETRY_SUBDIVISION@)
|
||||
SET(EMBREE_GEOMETRY_TRIANGLES @EMBREE_GEOMETRY_TRIANGLES@)
|
||||
SET(EMBREE_GEOMETRY_QUADS @EMBREE_GEOMETRY_QUADS@)
|
||||
SET(EMBREE_GEOMETRY_LINES @EMBREE_GEOMETRY_LINES@)
|
||||
SET(EMBREE_GEOMETRY_HAIR @EMBREE_GEOMETRY_HAIR@)
|
||||
SET(EMBREE_GEOMETRY_SUBDIV @EMBREE_GEOMETRY_SUBDIV@)
|
||||
SET(EMBREE_GEOMETRY_USER @EMBREE_GEOMETRY_USER@)
|
||||
SET(EMBREE_GEOMETRY_POINT @EMBREE_GEOMETRY_POINT@)
|
||||
|
||||
SET(EMBREE_RAY_PACKETS @EMBREE_RAY_PACKETS@)
|
||||
SET(EMBREE_MAX_INSTANCE_LEVEL_COUNT @EMBREE_MAX_INSTANCE_LEVEL_COUNT@)
|
||||
|
||||
IF(EMBREE_STATIC_LIB)
|
||||
FILE(GLOB CONFIG_FILES "${EMBREE_ROOT_DIR}/@EMBREE_CMAKECONFIG_DIR@/*-targets.cmake")
|
||||
FOREACH(f ${CONFIG_FILES})
|
||||
INCLUDE(${f})
|
||||
ENDFOREACH()
|
||||
LINK_DIRECTORIES(${EMBREE_ROOT_DIR}/@CMAKE_INSTALL_LIBDIR@)
|
||||
ENDIF()
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.cs.disable-library-validation</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,61 +1,61 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2017 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
MACRO(_SET_IF_EMPTY VAR VALUE)
|
||||
IF(NOT ${VAR})
|
||||
SET(${VAR} "${VALUE}")
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
_SET_IF_EMPTY(FLAGS_SSE2 "-msse2")
|
||||
_SET_IF_EMPTY(FLAGS_SSE42 "-msse4.2")
|
||||
_SET_IF_EMPTY(FLAGS_AVX "-mavx")
|
||||
_SET_IF_EMPTY(FLAGS_AVX2 "-mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
|
||||
_SET_IF_EMPTY(FLAGS_AVX512KNL "-mavx512f -mavx512pf -mavx512er -mavx512cd -mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
|
||||
_SET_IF_EMPTY(FLAGS_AVX512SKX "-mavx512f -mavx512dq -mavx512cd -mavx512bw -mavx512vl -mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2 -mprefer-vector-width=256")
|
||||
SET(FLAGS_SSE2 "-msse2")
|
||||
SET(FLAGS_SSE42 "-msse4.2")
|
||||
SET(FLAGS_AVX "-mavx")
|
||||
SET(FLAGS_AVX2 "-mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
|
||||
SET(FLAGS_AVX512KNL "-mavx512f -mavx512pf -mavx512er -mavx512cd -mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
|
||||
SET(FLAGS_AVX512SKX "-mavx512f -mavx512dq -mavx512cd -mavx512bw -mavx512vl -mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
|
||||
|
||||
OPTION(EMBREE_IGNORE_CMAKE_CXX_FLAGS "When enabled Embree ignores default CMAKE_CXX_FLAGS." ON)
|
||||
IF (EMBREE_IGNORE_CMAKE_CXX_FLAGS)
|
||||
SET(CMAKE_CXX_FLAGS "")
|
||||
ENDIF()
|
||||
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") # enables most warnings
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat -Wformat-security") # enables string format vulnerability warnings
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-class-memaccess") # disables clearing an object of type ‘XXX’ with no trivial copy-assignment; use assignment or value-initialization instead
|
||||
IF (NOT APPLE)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE") # enables support for more secure position independent execution
|
||||
ENDIF()
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") # generate position independent code suitable for shared libraries
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") # generate position independent code suitable for shared libraries
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") # enables C++11 features
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") # makes all symbols hidden by default
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden") # makes all inline symbols hidden by default
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing") # disables strict aliasing rules
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-tree-vectorize") # disable auto vectorizer
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORTIFY_SOURCE=2") # perform extra security checks for some standard library calls
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-tree-vectorize") # disable auto vectorizer
|
||||
IF (EMBREE_STACK_PROTECTOR)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector") # protects against return address overrides
|
||||
ENDIF()
|
||||
MACRO(DISABLE_STACK_PROTECTOR_FOR_FILE file)
|
||||
IF (EMBREE_STACK_PROTECTOR)
|
||||
SET_SOURCE_FILES_PROPERTIES(${file} PROPERTIES COMPILE_FLAGS "-fno-stack-protector")
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "")
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g") # generate debug information
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") # enable assertions
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DTBB_USE_DEBUG") # configure TBB in debug mode
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O3") # enable full optimizations
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") # enable assertions
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DTBB_USE_DEBUG") # configure TBB in debug mode
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g") # generate debug information
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0") # disable optimizations
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG") # disable assertions
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3") # enable full optimizations
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DDEBUG") # enable assertions
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DTBB_USE_DEBUG") # configure TBB in debug mode
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g") # generate debug information
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DNDEBUG") # disable assertions
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O3") # enable full optimizations
|
||||
|
||||
IF (APPLE)
|
||||
@@ -1,45 +1,43 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
MACRO(_SET_IF_EMPTY VAR VALUE)
|
||||
IF(NOT ${VAR})
|
||||
SET(${VAR} "${VALUE}")
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2017 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
IF (WIN32)
|
||||
|
||||
_SET_IF_EMPTY(FLAGS_SSE2 "/QxSSE2")
|
||||
_SET_IF_EMPTY(FLAGS_SSE42 "/QxSSE4.2")
|
||||
_SET_IF_EMPTY(FLAGS_AVX "/arch:AVX")
|
||||
_SET_IF_EMPTY(FLAGS_AVX2 "/QxCORE-AVX2")
|
||||
_SET_IF_EMPTY(FLAGS_AVX512KNL "/QxMIC-AVX512")
|
||||
_SET_IF_EMPTY(FLAGS_AVX512SKX "/QxCORE-AVX512")
|
||||
SET(FLAGS_SSE2 "/QxSSE2")
|
||||
SET(FLAGS_SSE42 "/QxSSE4.2")
|
||||
SET(FLAGS_AVX "/arch:AVX")
|
||||
SET(FLAGS_AVX2 "/QxCORE-AVX2")
|
||||
SET(FLAGS_AVX512KNL "/QxMIC-AVX512")
|
||||
SET(FLAGS_AVX512SKX "/QxCORE-AVX512")
|
||||
|
||||
SET(COMMON_CXX_FLAGS "")
|
||||
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /EHsc") # catch C++ exceptions only and extern "C" functions never throw a C++ exception
|
||||
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /MP") # compile source files in parallel
|
||||
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /GR") # enable runtime type information (on by default)
|
||||
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /Qvec-") # disable auto vectorizer
|
||||
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /Qfast-transcendentals-") # disable fast transcendentals, prevents sin(x),cos(x) -> sincos(x) optimization
|
||||
IF (EMBREE_STACK_PROTECTOR)
|
||||
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /GS") # protects against return address overrides
|
||||
ELSE()
|
||||
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /GS-") # do not protect against return address overrides
|
||||
ENDIF()
|
||||
MACRO(DISABLE_STACK_PROTECTOR_FOR_FILE file)
|
||||
IF (EMBREE_STACK_PROTECTOR)
|
||||
SET_SOURCE_FILES_PROPERTIES(${file} PROPERTIES COMPILE_FLAGS "/GS-")
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /Qdiag-disable:11074 ") # remark #11074: Inlining inhibited by limit max-size
|
||||
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /Qdiag-disable:11075 ") # remark #11075: To get full report use -Qopt-report:4 -Qopt-report-phase ipo
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COMMON_CXX_FLAGS}")
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /DDEBUG") # enables assertions
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /DTBB_USE_DEBUG") # configures TBB in debug mode
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Oi") # inline intrinsic functions
|
||||
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /DEBUG") # generate debug information
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /DEBUG") # generate debug information
|
||||
|
||||
@@ -48,15 +46,14 @@ IF (WIN32)
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi") # inline intrinsic functions
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Gy") # package individual functions
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Qinline-max-total-size-") # no size limit when performing inlining
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Qinline-factor=150") # increase default inline factors by 2x
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Qinline-factor=200") # increase default inline factors by 2x
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${COMMON_CXX_FLAGS}")
|
||||
# SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /DTBB_USE_DEBUG") # configures TBB in debug mode
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Ox") # enable full optimizations
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Oi") # inline intrinsic functions
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Gy") # package individual functions
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Qinline-max-total-size-") # no size limit when performing inlining
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Qinline-factor=150") # increase default inline factors by 2x
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Qinline-factor=200") # increase default inline factors by 2x
|
||||
SET(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /DEBUG") # generate debug information
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /DEBUG") # generate debug information
|
||||
|
||||
@@ -74,84 +71,72 @@ IF (WIN32)
|
||||
|
||||
INCLUDE(msvc_post)
|
||||
|
||||
# remove libmmd dependency
|
||||
IF (NOT EMBREE_STATIC_RUNTIME)
|
||||
STRING(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG " /nodefaultlib:libmmdd.lib")
|
||||
STRING(APPEND CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO " /nodefaultlib:libmmd.lib")
|
||||
STRING(APPEND CMAKE_EXE_LINKER_FLAGS_RELEASE " /nodefaultlib:libmmd.lib")
|
||||
STRING(APPEND CMAKE_SHARED_LINKER_FLAGS_DEBUG " /nodefaultlib:libmmdd.lib")
|
||||
STRING(APPEND CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO " /nodefaultlib:libmmd.lib")
|
||||
STRING(APPEND CMAKE_SHARED_LINKER_FLAGS_RELEASE " /nodefaultlib:libmmd.lib")
|
||||
ENDIF()
|
||||
|
||||
ELSE()
|
||||
|
||||
IF (APPLE)
|
||||
_SET_IF_EMPTY(FLAGS_SSE2 "-xssse3") # on MacOSX ICC does not support SSE2
|
||||
SET(FLAGS_SSE2 "-xssse3") # on MacOSX ICC does not support SSE2
|
||||
ELSE()
|
||||
_SET_IF_EMPTY(FLAGS_SSE2 "-xsse2")
|
||||
SET(FLAGS_SSE2 "-xsse2")
|
||||
ENDIF()
|
||||
_SET_IF_EMPTY(FLAGS_SSE42 "-xsse4.2")
|
||||
_SET_IF_EMPTY(FLAGS_AVX "-xAVX")
|
||||
_SET_IF_EMPTY(FLAGS_AVX2 "-xCORE-AVX2")
|
||||
_SET_IF_EMPTY(FLAGS_AVX512KNL "-xMIC-AVX512")
|
||||
_SET_IF_EMPTY(FLAGS_AVX512SKX "-xCORE-AVX512")
|
||||
SET(FLAGS_SSE42 "-xsse4.2")
|
||||
SET(FLAGS_AVX "-xAVX")
|
||||
SET(FLAGS_AVX2 "-xCORE-AVX2")
|
||||
SET(FLAGS_AVX512KNL "-xMIC-AVX512")
|
||||
SET(FLAGS_AVX512SKX "-xCORE-AVX512")
|
||||
|
||||
OPTION(EMBREE_IGNORE_CMAKE_CXX_FLAGS "When enabled Embree ignores default CMAKE_CXX_FLAGS." ON)
|
||||
IF (EMBREE_IGNORE_CMAKE_CXX_FLAGS)
|
||||
SET(CMAKE_CXX_FLAGS "")
|
||||
ENDIF()
|
||||
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") # enables most warnings
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat -Wformat-security") # enables string format vulnerability warnings
|
||||
IF (NOT APPLE)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE") # enables support for more secure position independent execution
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftls-model=local-dynamic") # otherwise ICC2019 cannot compile code with -fPIE enabled
|
||||
ENDIF()
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") # generate position independent code suitable for shared libraries
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") # generate position independent code suitable for shared libraries
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") # enables C++11 features
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") # makes all symbols hidden by default
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden") # makes all inline symbols hidden by default
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-ansi-alias") # disables strict aliasing rules
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORTIFY_SOURCE=2") # perform extra security checks for some standard library calls
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-vec") # disable auto vectorizer
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fasm-blocks") # enable assembly blocks
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORTIFY_SOURCE=2") # perform extra security checks for some standard library calls
|
||||
IF (EMBREE_STACK_PROTECTOR)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector") # protects against return address overrides
|
||||
ENDIF()
|
||||
MACRO(DISABLE_STACK_PROTECTOR_FOR_FILE file)
|
||||
IF (EMBREE_STACK_PROTECTOR)
|
||||
SET_SOURCE_FILES_PROPERTIES(${file} PROPERTIES COMPILE_FLAGS "-fno-stack-protector")
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -restrict") # enable restrict keyword
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-inline-max-total-size") # no size limit when performing inlining
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-inline-max-per-compile") # no maximal number of inlinings per compilation unit
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -inline-factor=150") # increase default inline factors by 2x
|
||||
|
||||
IF(NOT CMAKE_CXX_COMPILER_WRAPPER STREQUAL "CrayPrgEnv")
|
||||
IF(NOT CMAKE_CXX_COMPILER_WRAPPER STREQUAL "CrayPrgEnv")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-intel") # links intel runtime statically
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-intel-extensions") # disables some intel extensions which cause symbols to be exported
|
||||
ENDIF()
|
||||
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "")
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") # enables assertions
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DTBB_USE_DEBUG") # configures TBB in debug mode
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g") # generate debug information
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") # enable assertions
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DTBB_USE_DEBUG") # configure TBB in debug mode
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O3") # enable full optimizations
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0") # disable all optimizations
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG") # disable assertions
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3") # enable full optimizations
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g") # generate debug information
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DNDEBUG") # disable assertions
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O3") # enable full optimizations
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG") # disable assertions
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3") # full optimizations
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -restrict") # enable restrict keyword
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -no-inline-max-total-size") # no size limit when performing inlining
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -no-inline-max-per-compile") # no maximal number of inlinings per compilation unit
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -inline-factor=200") # increase default inline factors limits by 2x
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DDEBUG") # enables assertions
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DTBB_USE_DEBUG") # configures TBB in debug mode
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g") # generate debug information
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O3") # full optimizations
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -restrict") # enable restrict keyword
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -no-inline-max-total-size") # no size limit when performing inlining
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -no-inline-max-per-compile") # no maximal number of inlinings per compilation unit
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -inline-factor=200") # increase default inline factors by 2x
|
||||
|
||||
#SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -g -debug inline-debug-info")
|
||||
#SET(CMAKE_EXE_LINKER_FLAGS "-g")
|
||||
|
||||
IF (APPLE)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.7") # makes sure code runs on older MacOSX versions
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") # link against libc++ which supports C++11 features
|
||||
+20
-15
@@ -1,5 +1,18 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2017 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
# ##################################################################
|
||||
# add macro INCLUDE_DIRECTORIES_ISPC() that allows to specify search
|
||||
@@ -45,25 +58,17 @@ IF (NOT EMBREE_ISPC_EXECUTABLE)
|
||||
ENDIF()
|
||||
|
||||
# check ISPC version
|
||||
EXECUTE_PROCESS(COMMAND ${EMBREE_ISPC_EXECUTABLE} --version
|
||||
OUTPUT_VARIABLE ISPC_OUTPUT
|
||||
RESULT_VARIABLE ISPC_RESULT)
|
||||
|
||||
IF (NOT ${ISPC_RESULT} STREQUAL "0")
|
||||
MESSAGE(FATAL_ERROR "Error executing ISPC executable '${EMBREE_ISPC_EXECUTABLE}': ${ISPC_RESULT}")
|
||||
ENDIF()
|
||||
|
||||
STRING(REGEX MATCH "([0-9]+[.][0-9]+[.][0-9]+)" DUMMY "${ISPC_OUTPUT}")
|
||||
EXECUTE_PROCESS(COMMAND ${EMBREE_ISPC_EXECUTABLE} --version OUTPUT_VARIABLE ISPC_OUTPUT)
|
||||
STRING(REGEX MATCH " ([0-9]+[.][0-9]+[.][0-9]+)(dev|knl)? " DUMMY "${ISPC_OUTPUT}")
|
||||
SET(ISPC_VERSION ${CMAKE_MATCH_1})
|
||||
|
||||
IF (ISPC_VERSION VERSION_LESS ISPC_VERSION_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "ISPC ${ISPC_VERSION} is too old. You need at least ISPC ${ISPC_VERSION_REQUIRED}.")
|
||||
MESSAGE(FATAL_ERROR "Need at least version ${ISPC_VERSION_REQUIRED} of Intel SPMD Compiler (ISPC).")
|
||||
ENDIF()
|
||||
|
||||
GET_FILENAME_COMPONENT(ISPC_DIR ${EMBREE_ISPC_EXECUTABLE} PATH)
|
||||
|
||||
SET(EMBREE_ISPC_ADDRESSING 32 CACHE STRING "32vs64 bit addressing in ispc")
|
||||
SET_PROPERTY(CACHE EMBREE_ISPC_ADDRESSING PROPERTY STRINGS 32 64)
|
||||
SET(EMBREE_ISPC_ADDRESSING 32 CACHE INT "32vs64 bit addressing in ispc")
|
||||
MARK_AS_ADVANCED(EMBREE_ISPC_ADDRESSING)
|
||||
|
||||
MACRO (ISPC_COMPILE)
|
||||
@@ -88,7 +93,7 @@ MACRO (ISPC_COMPILE)
|
||||
IF (WIN32 OR "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||
SET(ISPC_OPT_FLAGS -O3)
|
||||
ELSE()
|
||||
SET(ISPC_OPT_FLAGS -O2)
|
||||
SET(ISPC_OPT_FLAGS -O2 -g)
|
||||
ENDIF()
|
||||
|
||||
IF (WIN32)
|
||||
|
||||
+19
-14
@@ -1,5 +1,18 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2017 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
SET(FLAGS_SSE2 "/D__SSE__ /D__SSE2__")
|
||||
SET(FLAGS_SSE42 "${FLAGS_SSE2} /D__SSE3__ /D__SSSE3__ /D__SSE4_1__ /D__SSE4_2__")
|
||||
@@ -10,37 +23,29 @@ SET(COMMON_CXX_FLAGS "")
|
||||
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /EHsc") # catch C++ exceptions only and extern "C" functions never throw a C++ exception
|
||||
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /MP") # compile source files in parallel
|
||||
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /GR") # enable runtime type information (on by default)
|
||||
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /Gy") # package individual functions
|
||||
IF (EMBREE_STACK_PROTECTOR)
|
||||
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /GS") # protects against return address overrides
|
||||
ELSE()
|
||||
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /GS-") # do not protect against return address overrides
|
||||
ENDIF()
|
||||
MACRO(DISABLE_STACK_PROTECTOR_FOR_FILE file)
|
||||
IF (EMBREE_STACK_PROTECTOR)
|
||||
SET_SOURCE_FILES_PROPERTIES(${file} PROPERTIES COMPILE_FLAGS "/GS-")
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} ${FLAGS_SSE2}")
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COMMON_CXX_FLAGS}")
|
||||
STRING(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) # disable native runtime checks
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /DDEBUG") # enables assertions
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /DTBB_USE_DEBUG") # configures TBB in debug mode
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Ox") # enable full optimizations
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Oi") # inline intrinsic functions
|
||||
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /DEBUG") # generate debug information
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /DEBUG") # generate debug information
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${COMMON_CXX_FLAGS}")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Ox") # enable full optimizations
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi") # inline intrinsic functions
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Gy") # package individual functions
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${COMMON_CXX_FLAGS}")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Ox") # enable full optimizations
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Oi") # inline intrinsic functions
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Gy") # package individual functions
|
||||
SET(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /DEBUG") # generate debug information
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /DEBUG") # generate debug information
|
||||
|
||||
|
||||
SET(SECURE_LINKER_FLAGS "")
|
||||
SET(SECURE_LINKER_FLAGS "${SECURE_LINKER_FLAGS} /NXCompat") # compatible with data execution prevention (on by default)
|
||||
SET(SECURE_LINKER_FLAGS "${SECURE_LINKER_FLAGS} /DynamicBase") # random rebase of executable at load time
|
||||
|
||||
@@ -1,13 +1,26 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2017 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
# optionally use static runtime library
|
||||
OPTION(EMBREE_STATIC_RUNTIME "Use the static version of the C/C++ runtime library." OFF)
|
||||
OPTION(EMBREE_STATIC_RUNTIME "Use the static version of the C/C++ runtime library." ON)
|
||||
IF (EMBREE_STATIC_RUNTIME)
|
||||
STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
|
||||
STRING(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
|
||||
STRING(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
|
||||
ENDIF()
|
||||
|
||||
|
||||
# remove define NDEBUG and instead set define DEBUG for config RelWithDebInfo
|
||||
STRING(REPLACE "NDEBUG" "DEBUG" CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
|
||||
|
||||
+68
-61
@@ -1,5 +1,18 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2017 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
INCLUDE(GNUInstallDirs)
|
||||
|
||||
@@ -26,19 +39,12 @@ ENDIF()
|
||||
##############################################################
|
||||
# Install Headers
|
||||
##############################################################
|
||||
|
||||
INSTALL(DIRECTORY include/embree3 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT devel)
|
||||
IF (NOT WIN32)
|
||||
INSTALL(DIRECTORY man/man3 DESTINATION ${CMAKE_INSTALL_MANDIR} COMPONENT devel)
|
||||
ENDIF()
|
||||
INSTALL(DIRECTORY include/embree2 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT devel)
|
||||
|
||||
##############################################################
|
||||
# Install Models
|
||||
##############################################################
|
||||
|
||||
IF (EMBREE_TUTORIALS)
|
||||
INSTALL(DIRECTORY tutorials/models DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT examples)
|
||||
ENDIF()
|
||||
INSTALL(DIRECTORY tutorials/models DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT examples)
|
||||
|
||||
##############################################################
|
||||
# Install Documentation
|
||||
@@ -48,8 +54,11 @@ INSTALL(FILES ${PROJECT_SOURCE_DIR}/LICENSE.txt DESTINATION ${CMAKE_INSTALL_DOCD
|
||||
INSTALL(FILES ${PROJECT_SOURCE_DIR}/CHANGELOG.md DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT lib)
|
||||
INSTALL(FILES ${PROJECT_SOURCE_DIR}/README.md DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT lib)
|
||||
INSTALL(FILES ${PROJECT_SOURCE_DIR}/readme.pdf DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT lib)
|
||||
INSTALL(FILES ${PROJECT_SOURCE_DIR}/third-party-programs.txt DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT lib)
|
||||
INSTALL(FILES ${PROJECT_SOURCE_DIR}/third-party-programs-TBB.txt DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT lib)
|
||||
|
||||
SET(CPACK_NSIS_MENU_LINKS ${CPACK_NSIS_MENU_LINKS} "${CMAKE_INSTALL_DOCDIR}/LICENSE.txt" "LICENSE")
|
||||
SET(CPACK_NSIS_MENU_LINKS ${CPACK_NSIS_MENU_LINKS} "${CMAKE_INSTALL_DOCDIR}/CHANGELOG.txt" "CHANGELOG")
|
||||
SET(CPACK_NSIS_MENU_LINKS ${CPACK_NSIS_MENU_LINKS} "${CMAKE_INSTALL_DOCDIR}/README.md" "README.md")
|
||||
SET(CPACK_NSIS_MENU_LINKS ${CPACK_NSIS_MENU_LINKS} "${CMAKE_INSTALL_DOCDIR}/readme.pdf" "readme.pdf")
|
||||
|
||||
##############################################################
|
||||
# Install scripts to set embree paths
|
||||
@@ -86,16 +95,12 @@ IF (APPLE AND NOT EMBREE_ZIP_MODE)
|
||||
ENDIF()
|
||||
|
||||
# why does this have to be so complicated...
|
||||
IF (EMBREE_STATIC_LIB)
|
||||
SET(EMBREE_LIBRARY_FULLNAME ${CMAKE_STATIC_LIBRARY_PREFIX}${EMBREE_LIBRARY_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
IF (WIN32)
|
||||
SET(EMBREE_LIBRARY_NAME ${CMAKE_IMPORT_LIBRARY_PREFIX}embree${CMAKE_IMPORT_LIBRARY_SUFFIX})
|
||||
ELSEIF (APPLE)
|
||||
SET(EMBREE_LIBRARY_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}embree.${EMBREE_CONFIG_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
ELSE()
|
||||
IF (WIN32)
|
||||
SET(EMBREE_LIBRARY_FULLNAME ${CMAKE_IMPORT_LIBRARY_PREFIX}${EMBREE_LIBRARY_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX})
|
||||
ELSEIF (APPLE)
|
||||
SET(EMBREE_LIBRARY_FULLNAME ${CMAKE_SHARED_LIBRARY_PREFIX}${EMBREE_LIBRARY_NAME}.${EMBREE_CONFIG_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
ELSE()
|
||||
SET(EMBREE_LIBRARY_FULLNAME ${CMAKE_SHARED_LIBRARY_PREFIX}${EMBREE_LIBRARY_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.${EMBREE_CONFIG_VERSION})
|
||||
ENDIF()
|
||||
SET(EMBREE_LIBRARY_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}embree${CMAKE_SHARED_LIBRARY_SUFFIX}.${EMBREE_CONFIG_VERSION})
|
||||
ENDIF()
|
||||
|
||||
IF (WIN32 OR EMBREE_ZIP_MODE)
|
||||
@@ -106,7 +111,7 @@ IF (WIN32 OR EMBREE_ZIP_MODE)
|
||||
SET(EMBREE_RELATIV_ROOT_DIR ".")
|
||||
ELSE()
|
||||
SET(EMBREE_CMAKECONFIG_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/embree-${EMBREE_VERSION}")
|
||||
FILE(RELATIVE_PATH EMBREE_RELATIV_ROOT_DIR "/${EMBREE_CMAKECONFIG_DIR}" "/")
|
||||
SET(EMBREE_RELATIV_ROOT_DIR "../../..")
|
||||
ENDIF()
|
||||
CONFIGURE_FILE(common/cmake/embree-config.cmake embree-config-install.cmake @ONLY)
|
||||
CONFIGURE_FILE(common/cmake/embree-config-version.cmake embree-config-version.cmake @ONLY)
|
||||
@@ -120,7 +125,7 @@ INSTALL(FILES "${PROJECT_BINARY_DIR}/embree-config-version.cmake" DESTINATION ${
|
||||
# CPack specific stuff
|
||||
##############################################################
|
||||
|
||||
SET(CPACK_PACKAGE_NAME "Embree Ray Tracing Kernels")
|
||||
SET(CPACK_PACKAGE_NAME "Embree")
|
||||
SET(CPACK_PACKAGE_FILE_NAME "embree-${EMBREE_VERSION}")
|
||||
#SET(CPACK_PACKAGE_ICON ${PROJECT_SOURCE_DIR}/embree-doc/images/icon.png)
|
||||
#SET(CPACK_PACKAGE_RELOCATABLE TRUE)
|
||||
@@ -143,9 +148,9 @@ SET(CPACK_COMPONENT_EXAMPLES_DISPLAY_NAME "Examples")
|
||||
SET(CPACK_COMPONENT_EXAMPLES_DESCRIPTION "Tutorials demonstrating how to use Embree.")
|
||||
|
||||
# dependencies between components
|
||||
#SET(CPACK_COMPONENT_DEVEL_DEPENDS lib)
|
||||
#SET(CPACK_COMPONENT_EXAMPLES_DEPENDS lib)
|
||||
#SET(CPACK_COMPONENT_LIB_REQUIRED ON) # always install the libs
|
||||
SET(CPACK_COMPONENT_DEVEL_DEPENDS lib)
|
||||
SET(CPACK_COMPONENT_EXAMPLES_DEPENDS lib)
|
||||
SET(CPACK_COMPONENT_LIB_REQUIRED ON) # always install the libs
|
||||
|
||||
# point to readme and license files
|
||||
SET(CPACK_RESOURCE_FILE_README ${PROJECT_SOURCE_DIR}/README.md)
|
||||
@@ -156,34 +161,42 @@ IF(WIN32)
|
||||
|
||||
IF (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
SET(ARCH x64)
|
||||
SET(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME} x64")
|
||||
SET(PROGRAMFILES "\$PROGRAMFILES64")
|
||||
SET(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME} x64")
|
||||
ELSE()
|
||||
SET(ARCH win32)
|
||||
SET(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME} Win32")
|
||||
ENDIF()
|
||||
|
||||
IF (MSVC12)
|
||||
SET(VCVER vc12)
|
||||
ELSEIF(MSVC14) # also for VC15, which is toolset v141
|
||||
SET(VCVER vc14)
|
||||
SET(PROGRAMFILES "\$PROGRAMFILES")
|
||||
SET(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME} Win32")
|
||||
ENDIF()
|
||||
|
||||
# NSIS specific settings
|
||||
IF (NOT EMBREE_ZIP_MODE)
|
||||
SET(CPACK_GENERATOR WIX)
|
||||
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.${ARCH}.${VCVER}")
|
||||
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "Intel\\\\Embree${EMBREE_VERSION_MAJOR} ${ARCH}")
|
||||
SET(CPACK_WIX_PRODUCT_GUID "331BD5A9-DAD6-486B-A435-18AAB80${EMBREE_VERSION_NUMBER}")
|
||||
SET(CPACK_WIX_UPGRADE_GUID "331BD5A9-DAD6-486B-A435-18AAB80${EMBREE_VERSION_MAJOR}0000") # upgrade as long as major version is the same
|
||||
SET(CPACK_WIX_CMAKE_PACKAGE_REGISTRY TRUE)
|
||||
SET(CPACK_GENERATOR NSIS)
|
||||
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.${ARCH}")
|
||||
SET(CPACK_COMPONENTS_ALL lib devel examples)
|
||||
SET(CPACK_NSIS_INSTALL_ROOT "${PROGRAMFILES}\\\\Intel")
|
||||
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "Embree v${EMBREE_VERSION} ${ARCH}")
|
||||
SET(CPACK_NSIS_DISPLAY_NAME "Embree v${EMBREE_VERSION} ${ARCH}")
|
||||
SET(CPACK_NSIS_PACKAGE_NAME "Embree v${EMBREE_VERSION} ${ARCH}")
|
||||
SET(CPACK_NSIS_URL_INFO_ABOUT http://embree.github.io/)
|
||||
#SET(CPACK_NSIS_HELP_LINK http://embree.github.io/downloads.html#windows)
|
||||
SET(CPACK_NSIS_MUI_ICON ${PROJECT_SOURCE_DIR}/scripts/install_windows/icon32.ico)
|
||||
SET(CPACK_NSIS_CONTACT ${CPACK_PACKAGE_CONTACT})
|
||||
#SET(CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS ${CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS} "\n CreateDirectory \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\"")
|
||||
#SET(CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS ${CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS} "\n CreateDirectory \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\documentation\\\"")
|
||||
#SET(CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS ${CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS} "\n CreateDirectory \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\tutorials\\\" \n")
|
||||
#SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS ${CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS} "\n ${UNINSTALL_LIST}\n RMDir \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\documentation\\\"")
|
||||
#SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS ${CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS} "\n ${UNINSTALL_LIST}\n RMDir \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\tutorials\\\"")
|
||||
#SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS ${CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS} "\n ${UNINSTALL_LIST}\n RMDir \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\"\n")
|
||||
IF (EMBREE_TESTING_PACKAGE)
|
||||
ADD_TEST(NAME "BuildPackage" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${PROJECT_SOURCE_DIR}/scripts/package_win.bat ${CMAKE_BUILD_TYPE} ${CPACK_PACKAGE_FILE_NAME}.msi ${EMBREE_SIGN_FILE})
|
||||
ADD_TEST(NAME "BuildPackage" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${PROJECT_SOURCE_DIR}/scripts/package_win.bat ${CPACK_PACKAGE_FILE_NAME}.exe ${CMAKE_BUILD_TYPE})
|
||||
ENDIF()
|
||||
ELSE()
|
||||
SET(CPACK_GENERATOR ZIP)
|
||||
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.${ARCH}.${VCVER}.windows")
|
||||
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.${ARCH}.windows")
|
||||
SET(CPACK_MONOLITHIC_INSTALL 1)
|
||||
IF (EMBREE_TESTING_PACKAGE)
|
||||
ADD_TEST(NAME "BuildPackage" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${PROJECT_SOURCE_DIR}/scripts/package_win.bat ${CMAKE_BUILD_TYPE} ${CPACK_PACKAGE_FILE_NAME}.zip)
|
||||
ADD_TEST(NAME "BuildPackage" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${PROJECT_SOURCE_DIR}/scripts/package_win.bat ${CPACK_PACKAGE_FILE_NAME}.zip ${CMAKE_BUILD_TYPE})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
@@ -195,32 +208,32 @@ ELSEIF(APPLE)
|
||||
|
||||
IF (NOT EMBREE_ZIP_MODE)
|
||||
SET(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
|
||||
SET(CPACK_GENERATOR productbuild)
|
||||
SET(CPACK_GENERATOR PackageMaker)
|
||||
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.x86_64")
|
||||
SET(CPACK_COMPONENTS_ALL lib devel examples)
|
||||
#SET(CPACK_MONOLITHIC_INSTALL 1)
|
||||
#SET(CPACK_COMPONENTS_ALL lib devel examples)
|
||||
SET(CPACK_MONOLITHIC_INSTALL 1)
|
||||
SET(CPACK_PACKAGE_NAME embree-${EMBREE_VERSION})
|
||||
SET(CPACK_PACKAGE_VENDOR "intel") # creates short name com.intel.embree3.xxx in pkgutil
|
||||
SET(CPACK_PACKAGE_VENDOR "intel") # creates short name com.intel.embree2.xxx in pkgutil
|
||||
SET(CPACK_OSX_PACKAGE_VERSION 10.7)
|
||||
IF (EMBREE_TESTING_PACKAGE)
|
||||
ADD_TEST(NAME "BuildPackage" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${PROJECT_SOURCE_DIR}/scripts/package_macosx.sh ${CMAKE_BUILD_TYPE} ${CPACK_PACKAGE_FILE_NAME}.pkg ${EMBREE_SIGN_FILE})
|
||||
ADD_TEST(NAME "BuildPackage" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${PROJECT_SOURCE_DIR}/scripts/package_macosx.sh ${CMAKE_BUILD_TYPE} ${CPACK_PACKAGE_FILE_NAME}.dmg)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
SET(CPACK_GENERATOR ZIP)
|
||||
SET(CPACK_GENERATOR TGZ)
|
||||
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.x86_64.macosx")
|
||||
SET(CPACK_MONOLITHIC_INSTALL 1)
|
||||
IF (EMBREE_TESTING_PACKAGE)
|
||||
ADD_TEST(NAME "BuildPackage" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${PROJECT_SOURCE_DIR}/scripts/package_macosx.sh ${CMAKE_BUILD_TYPE} ${CPACK_PACKAGE_FILE_NAME}.zip ${EMBREE_SIGN_FILE})
|
||||
ADD_TEST(NAME "BuildPackage" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${PROJECT_SOURCE_DIR}/scripts/package_macosx.sh ${CMAKE_BUILD_TYPE} ${CPACK_PACKAGE_FILE_NAME}.tgz)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Linux specific settings
|
||||
ELSE()
|
||||
|
||||
|
||||
IF (NOT EMBREE_ZIP_MODE)
|
||||
|
||||
SET(CPACK_GENERATOR RPM)
|
||||
SET(CPACK_RPM_PACKAGE_NAME "embree${EMBREE_VERSION_MAJOR}")
|
||||
SET(CPACK_COMPONENTS_ALL devel lib examples)
|
||||
SET(CPACK_RPM_COMPONENT_INSTALL ON)
|
||||
SET(CPACK_RPM_FILE_NAME RPM-DEFAULT)
|
||||
@@ -228,11 +241,7 @@ ELSE()
|
||||
SET(CPACK_RPM_PACKAGE_LICENSE "ASL 2.0") # Apache Software License, Version 2.0
|
||||
SET(CPACK_RPM_PACKAGE_GROUP "Development/Libraries")
|
||||
SET(CPACK_RPM_CHANGELOG_FILE ${CMAKE_BINARY_DIR}/rpm_changelog.txt) # ChangeLog of the RPM
|
||||
IF (CMAKE_VERSION VERSION_LESS "3.7.0")
|
||||
EXECUTE_PROCESS(COMMAND date "+%a %b %d %Y" OUTPUT_VARIABLE CHANGELOG_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
ELSE()
|
||||
STRING(TIMESTAMP CHANGELOG_DATE "%a %b %d %Y")
|
||||
ENDIF()
|
||||
STRING(TIMESTAMP CHANGELOG_DATE "%a %b %d %Y")
|
||||
SET(RPM_CHANGELOG "* ${CHANGELOG_DATE} Johannes Günther <johannes.guenther@intel.com> - ${EMBREE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}\n- First package")
|
||||
FILE(WRITE ${CPACK_RPM_CHANGELOG_FILE} ${RPM_CHANGELOG})
|
||||
SET(CPACK_RPM_PACKAGE_URL http://embree.github.io/)
|
||||
@@ -242,8 +251,7 @@ ELSE()
|
||||
SET(CPACK_RPM_lib_POST_INSTALL_SCRIPT_FILE ${PROJECT_SOURCE_DIR}/common/cmake/rpm_ldconfig.sh)
|
||||
SET(CPACK_RPM_lib_POST_UNINSTALL_SCRIPT_FILE ${PROJECT_SOURCE_DIR}/common/cmake/rpm_ldconfig.sh)
|
||||
IF (EMBREE_TESTING_PACKAGE)
|
||||
ADD_TEST(NAME "BuildPackage" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${PROJECT_SOURCE_DIR}/scripts/package_linux.sh
|
||||
${EMBREE_ZIP_MODE} ${EMBREE_LIBRARY_NAME} ${EMBREE_VERSION} ${EMBREE_VERSION_MAJOR} ${EMBREE_SIGN_FILE})
|
||||
ADD_TEST(NAME "BuildPackage" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${PROJECT_SOURCE_DIR}/scripts/package_linux.sh ${EMBREE_ZIP_MODE} ${EMBREE_VERSION})
|
||||
ENDIF()
|
||||
ELSE()
|
||||
|
||||
@@ -251,8 +259,7 @@ ELSE()
|
||||
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.x86_64.linux")
|
||||
SET(CPACK_MONOLITHIC_INSTALL 1)
|
||||
IF (EMBREE_TESTING_PACKAGE)
|
||||
ADD_TEST(NAME "BuildPackage" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${PROJECT_SOURCE_DIR}/scripts/package_linux.sh
|
||||
${EMBREE_ZIP_MODE} ${EMBREE_LIBRARY_NAME} ${EMBREE_VERSION} ${EMBREE_VERSION_MAJOR} ${EMBREE_SIGN_FILE})
|
||||
ADD_TEST(NAME "BuildPackage" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${PROJECT_SOURCE_DIR}/scripts/package_linux.sh ${EMBREE_ZIP_MODE} ${EMBREE_VERSION})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
|
||||
@@ -1,4 +1 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/sbin/ldconfig
|
||||
|
||||
+119
-92
@@ -1,118 +1,145 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2017 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
IF(NOT BUILD_TESTING)
|
||||
SET(BUILD_TESTING OFF CACHE BOOL "Build the testing tree.")
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(CTest)
|
||||
|
||||
IF (WIN32)
|
||||
IF (BUILD_TESTING)
|
||||
|
||||
CMAKE_HOST_SYSTEM_INFORMATION(RESULT memory QUERY TOTAL_PHYSICAL_MEMORY)
|
||||
|
||||
SET(EMBREE_TESTING_MODEL_DIR "${PROJECT_SOURCE_DIR}/models" CACHE PATH "Path to the folder containing the Embree models for regression testing.")
|
||||
SET(EMBREE_TESTING_INTENSIVE OFF CACHE BOOL "Turns intensive testing on.")
|
||||
SET(EMBREE_TESTING_MEMCHECK OFF CACHE BOOL "Turns on memory checking for some tests.")
|
||||
SET(EMBREE_TESTING_BENCHMARK OFF CACHE BOOL "Turns benchmarking on.")
|
||||
SET(EMBREE_TESTING_BENCHMARK_DATABASE "${PROJECT_BINARY_DIR}" CACHE PATH "Path to database for benchmarking.")
|
||||
SET(EMBREE_TESTING_PACKAGE OFF CACHE BOOL "Packages release as test.")
|
||||
SET(EMBREE_TESTING_KLOCWORK OFF CACHE BOOL "Runs Kocwork as test.")
|
||||
|
||||
SET(EMBREE_TESTING_SDE OFF CACHE STRING "Uses SDE to run tests for specified CPU.")
|
||||
SET_PROPERTY(CACHE EMBREE_TESTING_SDE PROPERTY STRINGS OFF pnr nhm wsm snb ivb hsw bdw knl skl skx cnl)
|
||||
|
||||
IF( NOT EXISTS "${EMBREE_TESTING_MODEL_DIR}/embree-models-subdiv.txt"
|
||||
OR NOT EXISTS "${EMBREE_TESTING_MODEL_DIR}/embree-models-small-win32.txt"
|
||||
OR NOT EXISTS "${EMBREE_TESTING_MODEL_DIR}/embree-models-small-x64.txt"
|
||||
OR NOT EXISTS "${EMBREE_TESTING_MODEL_DIR}/embree-models-large.txt")
|
||||
MESSAGE(FATAL_ERROR "Invalid Embree testing model repository. Either disable BUILD_TESTING or properly set EMBREE_TESTING_MODEL_DIR.")
|
||||
ENDIF()
|
||||
|
||||
FILE(READ "${EMBREE_TESTING_MODEL_DIR}/embree-models-subdiv.txt" models_subdiv)
|
||||
STRING(REGEX REPLACE "\n" ";" models_subdiv "${models_subdiv}")
|
||||
|
||||
FILE(READ "${EMBREE_TESTING_MODEL_DIR}/embree-models-small-win32.txt" models_small_win32)
|
||||
STRING(REGEX REPLACE "\n" ";" models_small_win32 "${models_small_win32}")
|
||||
|
||||
FILE(READ "${EMBREE_TESTING_MODEL_DIR}/embree-models-small-x64.txt" models_small_x64)
|
||||
STRING(REGEX REPLACE "\n" ";" models_small_x64 "${models_small_x64}")
|
||||
|
||||
FILE(READ "${EMBREE_TESTING_MODEL_DIR}/embree-models-large.txt" models_large)
|
||||
STRING(REGEX REPLACE "\n" ";" models_large "${models_large}")
|
||||
|
||||
IF (EMBREE_TESTING_INTENSIVE)
|
||||
SET(models ${models_small_x64})
|
||||
IF (${memory} GREATER 10000)
|
||||
SET(models ${models} ${models_large})
|
||||
ENDIF()
|
||||
ELSE()
|
||||
SET(models ${models_small_win32})
|
||||
ENDIF()
|
||||
|
||||
IF (WIN32)
|
||||
SET(MY_PROJECT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}")
|
||||
ELSE()
|
||||
ELSE()
|
||||
SET(MY_PROJECT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
ENDIF()
|
||||
|
||||
FIND_PATH(EMBREE_TESTING_MODEL_DIR
|
||||
NAMES test-models-intensity2.txt
|
||||
PATHS "${PROJECT_SOURCE_DIR}/models"
|
||||
DOC "Path to the folder containing the Embree models for regression testing."
|
||||
NO_DEFAULT_PATHS)
|
||||
|
||||
SET(EMBREE_TESTING_INTENSITY 1 CACHE STRING "Intensity of testing (0 = no testing, 1 = verify and tutorials, 2 = light testing, 3 = intensive testing.")
|
||||
SET_PROPERTY(CACHE EMBREE_TESTING_INTENSITY PROPERTY STRINGS 0 1 2 3)
|
||||
SET(EMBREE_TESTING_MEMCHECK OFF CACHE BOOL "Turns on memory checking for some tests.")
|
||||
SET(EMBREE_TESTING_BENCHMARK OFF CACHE BOOL "Turns benchmarking on.")
|
||||
SET(EMBREE_TESTING_BENCHMARK_DATABASE "${PROJECT_BINARY_DIR}" CACHE PATH "Path to database for benchmarking.")
|
||||
SET(EMBREE_TESTING_PACKAGE OFF CACHE BOOL "Packages release as test.")
|
||||
SET(EMBREE_TESTING_KLOCWORK OFF CACHE BOOL "Runs Kocwork as test.")
|
||||
SET(EMBREE_TESTING_SDE OFF CACHE STRING "Uses SDE to run tests for specified CPU.")
|
||||
SET_PROPERTY(CACHE EMBREE_TESTING_SDE PROPERTY STRINGS OFF pnr nhm wsm snb ivb hsw bdw knl skl skx cnl)
|
||||
|
||||
SET(EMBREE_MODEL_DIR "none")
|
||||
IF (EMBREE_TESTING_MODEL_DIR)
|
||||
SET(EMBREE_MODEL_DIR ${EMBREE_TESTING_MODEL_DIR})
|
||||
ENDIF()
|
||||
|
||||
MACRO (ADD_EMBREE_NORMAL_TEST name reference executable args)
|
||||
IF (BUILD_TESTING)
|
||||
ADD_TEST(NAME ${name}
|
||||
WORKING_DIRECTORY ${MY_PROJECT_BINARY_DIR}
|
||||
COMMAND ${executable} --compare ${EMBREE_MODEL_DIR}/reference/${reference}.tga ${args})
|
||||
ENDIF()
|
||||
|
||||
IF (EMBREE_ISPC_SUPPORT AND EMBREE_RAY_PACKETS)
|
||||
IF (BUILD_TESTING)
|
||||
MACRO (ADD_EMBREE_MODEL_TEST name reference executable args model)
|
||||
|
||||
ADD_TEST(NAME ${name}
|
||||
WORKING_DIRECTORY ${MY_PROJECT_BINARY_DIR}
|
||||
COMMAND python ${PROJECT_SOURCE_DIR}/scripts/invoke_test.py
|
||||
--name ${name}
|
||||
--modeldir ${EMBREE_TESTING_MODEL_DIR}
|
||||
--reference ${reference}
|
||||
--model ${model}
|
||||
--sde ${EMBREE_TESTING_SDE}
|
||||
--execute ${MY_PROJECT_BINARY_DIR}/${executable} ${args})
|
||||
|
||||
IF (EMBREE_ISPC_SUPPORT AND EMBREE_RAY_PACKETS)
|
||||
ADD_TEST(NAME ${name}_ispc
|
||||
WORKING_DIRECTORY ${MY_PROJECT_BINARY_DIR}
|
||||
COMMAND ${executable}_ispc --compare ${EMBREE_MODEL_DIR}/reference/${reference}.tga ${args})
|
||||
COMMAND python ${PROJECT_SOURCE_DIR}/scripts/invoke_test.py
|
||||
--name ${name}_ispc
|
||||
--modeldir ${EMBREE_TESTING_MODEL_DIR}
|
||||
--reference ${reference}
|
||||
--model ${model}
|
||||
--sde ${EMBREE_TESTING_SDE}
|
||||
--execute ${MY_PROJECT_BINARY_DIR}/${executable}_ispc ${args})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO (ADD_EMBREE_TEST_WITHOUT_ISPC name)
|
||||
IF (BUILD_TESTING)
|
||||
ADD_TEST(NAME ${name}
|
||||
WORKING_DIRECTORY ${MY_PROJECT_BINARY_DIR}
|
||||
COMMAND ${executable} --compare ${EMBREE_MODEL_DIR}/reference/${reference}.tga ${args})
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO (ADD_EMBREE_TEST name)
|
||||
ADD_EMBREE_NORMAL_TEST(${name} ${name} ${name} "")
|
||||
ENDMACRO()
|
||||
|
||||
MACRO (ADD_EMBREE_TEST2 name exe args)
|
||||
ADD_EMBREE_NORMAL_TEST(${name} ${exe} ${exe} "${args}")
|
||||
ENDMACRO()
|
||||
|
||||
MACRO (ADD_EMBREE_MODEL_TEST name reference executable args model)
|
||||
IF (BUILD_TESTING)
|
||||
ADD_TEST(NAME ${name}
|
||||
WORKING_DIRECTORY ${MY_PROJECT_BINARY_DIR}
|
||||
COMMAND ${executable} -c ${EMBREE_MODEL_DIR}/${model} --compare ${EMBREE_MODEL_DIR}/reference/${reference}.tga ${args})
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
IF (EMBREE_ISPC_SUPPORT AND EMBREE_RAY_PACKETS)
|
||||
IF (BUILD_TESTING)
|
||||
ADD_TEST(NAME ${name}_ispc
|
||||
WORKING_DIRECTORY ${MY_PROJECT_BINARY_DIR}
|
||||
COMMAND COMMAND ${executable}_ispc -c ${EMBREE_MODEL_DIR}/${model} --compare ${EMBREE_MODEL_DIR}/reference/${reference}.tga ${args})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO (ADD_EMBREE_MODELS_TEST model_list_file name reference executable)
|
||||
IF (BUILD_TESTING)
|
||||
|
||||
SET(full_model_list_file ${EMBREE_TESTING_MODEL_DIR}/${model_list_file})
|
||||
|
||||
IF(NOT EXISTS "${full_model_list_file}")
|
||||
MESSAGE(FATAL_ERROR "File ${EMBREE_TESTING_MODEL_DIR}/${model_list_file} does not exist!")
|
||||
ENDIF()
|
||||
|
||||
FILE(READ "${full_model_list_file}" models)
|
||||
STRING(REGEX REPLACE "\n" ";" models "${models}")
|
||||
|
||||
MACRO (ADD_EMBREE_MODELS_TEST name reference executable)
|
||||
FOREACH (model ${models})
|
||||
STRING(REGEX REPLACE "/" "_" modelname "${model}")
|
||||
STRING(REGEX REPLACE ".ecs" "" modelname "${modelname}")
|
||||
ADD_EMBREE_MODEL_TEST(${name}_${modelname} ${reference}_${modelname} ${executable} "${ARGN}" ${model})
|
||||
ENDFOREACH()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO (ADD_EMBREE_SUBDIV_MODELS_TEST name reference executable)
|
||||
FOREACH (model ${models_subdiv})
|
||||
STRING(REGEX REPLACE "/" "_" modelname "${model}")
|
||||
STRING(REGEX REPLACE ".ecs" "" modelname "${modelname}")
|
||||
ADD_EMBREE_MODEL_TEST(${name}_${modelname} ${reference}_${modelname} ${executable} "${ARGN}" ${model})
|
||||
ENDFOREACH()
|
||||
ENDMACRO()
|
||||
|
||||
IF (EMBREE_TESTING_KLOCWORK)
|
||||
ADD_TEST(NAME Klocwork WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${PROJECT_SOURCE_DIR}/scripts/klocwork.sh)
|
||||
SET_TESTS_PROPERTIES(Klocwork PROPERTIES TIMEOUT 2400)
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
ELSE()
|
||||
|
||||
MACRO (ADD_EMBREE_MODEL_TEST name reference executable args model)
|
||||
ENDMACRO()
|
||||
|
||||
MACRO (ADD_EMBREE_SUBDIV_MODELS_TEST name reference executable)
|
||||
ENDMACRO()
|
||||
|
||||
MACRO (ADD_EMBREE_MODELS_TEST name)
|
||||
ENDMACRO()
|
||||
|
||||
# add klocwork test
|
||||
IF (EMBREE_TESTING_KLOCWORK)
|
||||
ADD_TEST(NAME Klocwork-Build WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${PROJECT_SOURCE_DIR}/scripts/klocwork_build.sh)
|
||||
ADD_TEST(NAME Klocwork-Check WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${PROJECT_SOURCE_DIR}/scripts/klocwork_check.sh)
|
||||
SET_TESTS_PROPERTIES(Klocwork-Build PROPERTIES TIMEOUT 2400)
|
||||
SET_TESTS_PROPERTIES(Klocwork-Check PROPERTIES TIMEOUT 300)
|
||||
ENDIF()
|
||||
|
||||
# add valgrind test
|
||||
MACRO (ADD_EMBREE_TEST name)
|
||||
ADD_EMBREE_MODEL_TEST(${name} ${name} ${name} "" "default")
|
||||
ENDMACRO()
|
||||
|
||||
MACRO (ADD_EMBREE_TEST2 name exe args)
|
||||
ADD_EMBREE_MODEL_TEST(${name} ${exe} ${exe} "${args}" "default")
|
||||
ENDMACRO()
|
||||
|
||||
IF (EMBREE_TESTING_MEMCHECK)
|
||||
find_program( EMBREE_MEMORYCHECK_COMMAND valgrind )
|
||||
set( EMBREE_MEMORYCHECK_COMMAND_OPTIONS "--trace-children=yes --leak-check=full --show-leak-kinds=definite --errors-for-leak-kinds=definite --error-exitcode=1" )
|
||||
IF (NOT EMBREE_MEMORYCHECK_COMMAND)
|
||||
MESSAGE(FATAL_ERROR "valgrind not found")
|
||||
ENDIF()
|
||||
|
||||
FUNCTION(ADD_MEMCHECK_TEST name binary)
|
||||
set(memcheck_command "${EMBREE_MEMORYCHECK_COMMAND} ${EMBREE_MEMORYCHECK_COMMAND_OPTIONS}")
|
||||
separate_arguments(memcheck_command)
|
||||
|
||||
+28
-15
@@ -1,25 +1,38 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2017 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
# additional parameters (beyond the name) are treated as additional dependencies
|
||||
# if ADDITIONAL_LIBRARIES is set these will be included during linking
|
||||
|
||||
MACRO (ADD_TUTORIAL TUTORIAL_NAME)
|
||||
ADD_EXECUTABLE(${TUTORIAL_NAME} ../../kernels/embree.rc ${TUTORIAL_NAME}.cpp ${TUTORIAL_NAME}_device.cpp ${ARGN})
|
||||
TARGET_LINK_LIBRARIES(${TUTORIAL_NAME} embree image tutorial noise ${ADDITIONAL_LIBRARIES})
|
||||
SET_PROPERTY(TARGET ${TUTORIAL_NAME} PROPERTY FOLDER tutorials/single)
|
||||
SET_PROPERTY(TARGET ${TUTORIAL_NAME} APPEND PROPERTY COMPILE_FLAGS " ${FLAGS_LOWEST}")
|
||||
INSTALL(TARGETS ${TUTORIAL_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT examples)
|
||||
SIGN_TARGET(${TUTORIAL_NAME})
|
||||
ENDMACRO ()
|
||||
|
||||
MACRO (ADD_TUTORIAL_ISPC TUTORIAL_NAME)
|
||||
IF (EMBREE_ISPC_SUPPORT)
|
||||
ADD_EMBREE_ISPC_EXECUTABLE(${TUTORIAL_NAME}_ispc ../../kernels/embree.rc ${TUTORIAL_NAME}.cpp ${TUTORIAL_NAME}_device.ispc ${ARGN})
|
||||
TARGET_LINK_LIBRARIES(${TUTORIAL_NAME}_ispc embree image tutorial_ispc noise noise_ispc)
|
||||
ADD_EXECUTABLE(${TUTORIAL_NAME} ${TUTORIAL_NAME}.cpp ${TUTORIAL_NAME}_device.cpp ${ARGN})
|
||||
TARGET_LINK_LIBRARIES(${TUTORIAL_NAME} embree tutorial image tutorial_device noise ${ADDITIONAL_LIBRARIES})
|
||||
SET_PROPERTY(TARGET ${TUTORIAL_NAME} PROPERTY FOLDER tutorials/single)
|
||||
INSTALL(TARGETS ${TUTORIAL_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT examples)
|
||||
SET(CPACK_NSIS_MENU_LINKS ${CPACK_NSIS_MENU_LINKS} "${CMAKE_INSTALL_BINDIR}/${TUTORIAL_NAME}" "${TUTORIAL_NAME}")
|
||||
|
||||
IF (EMBREE_ISPC_SUPPORT AND EMBREE_RAY_PACKETS)
|
||||
ADD_EMBREE_ISPC_EXECUTABLE(${TUTORIAL_NAME}_ispc ${TUTORIAL_NAME}.cpp ${TUTORIAL_NAME}_device.ispc)
|
||||
TARGET_LINK_LIBRARIES(${TUTORIAL_NAME}_ispc embree tutorial image tutorial_device_ispc noise noise_ispc)
|
||||
SET_PROPERTY(TARGET ${TUTORIAL_NAME}_ispc PROPERTY FOLDER tutorials/ispc)
|
||||
SET_PROPERTY(TARGET ${TUTORIAL_NAME}_ispc APPEND PROPERTY COMPILE_FLAGS " ${FLAGS_LOWEST}")
|
||||
INSTALL(TARGETS ${TUTORIAL_NAME}_ispc DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT examples)
|
||||
SIGN_TARGET(${TUTORIAL_NAME}_ispc)
|
||||
SET(CPACK_NSIS_MENU_LINKS ${CPACK_NSIS_MENU_LINKS} "${CMAKE_INSTALL_BINDIR}/${TUTORIAL_NAME}_ispc" "${TUTORIAL_NAME}_ispc")
|
||||
ENDIF()
|
||||
|
||||
SET(CPACK_NSIS_MENU_LINKS ${CPACK_NSIS_MENU_LINKS} PARENT_SCOPE)
|
||||
|
||||
ENDMACRO ()
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2015 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
MESSAGE(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2017 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
ADD_LIBRARY(lexers STATIC
|
||||
stringstream.cpp
|
||||
@@ -7,10 +20,3 @@ ADD_LIBRARY(lexers STATIC
|
||||
)
|
||||
TARGET_LINK_LIBRARIES(lexers sys math)
|
||||
SET_PROPERTY(TARGET lexers PROPERTY FOLDER common)
|
||||
SET_PROPERTY(TARGET lexers APPEND PROPERTY COMPILE_FLAGS " ${FLAGS_LOWEST}")
|
||||
|
||||
IF (EMBREE_STATIC_LIB)
|
||||
INSTALL(TARGETS lexers EXPORT lexers-targets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT devel)
|
||||
INSTALL(EXPORT lexers-targets DESTINATION ${EMBREE_CMAKECONFIG_DIR} COMPONENT devel)
|
||||
SIGN_TARGET(lexers)
|
||||
ENDIF()
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
+20
-6
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -19,9 +32,9 @@ namespace embree
|
||||
class ParseLocation
|
||||
{
|
||||
public:
|
||||
ParseLocation () : lineNumber(-1), colNumber(-1) {}
|
||||
ParseLocation (std::shared_ptr<std::string> fileName, ssize_t lineNumber, ssize_t colNumber, ssize_t /*charNumber*/)
|
||||
: fileName(fileName), lineNumber(lineNumber), colNumber(colNumber) {}
|
||||
ParseLocation () : lineNumber(-1), colNumber(-1), charNumber(-1) {}
|
||||
ParseLocation (std::shared_ptr<std::string> fileName, ssize_t lineNumber, ssize_t colNumber, ssize_t charNumber)
|
||||
: fileName(fileName), lineNumber(lineNumber), colNumber(colNumber), charNumber(charNumber) {}
|
||||
|
||||
std::string str() const
|
||||
{
|
||||
@@ -36,6 +49,7 @@ namespace embree
|
||||
std::shared_ptr<std::string> fileName; /// name of the file (or stream) the token is from
|
||||
ssize_t lineNumber; /// the line number the token is from
|
||||
ssize_t colNumber; /// the character number in the current line
|
||||
ssize_t charNumber; /// the character in the file
|
||||
};
|
||||
|
||||
/*! a stream class templated over the stream elements */
|
||||
@@ -53,7 +67,7 @@ namespace embree
|
||||
}
|
||||
__forceinline void push_back(const std::pair<T,ParseLocation>& v) {
|
||||
if (past+future == BUF_SIZE) pop_front();
|
||||
size_t end = (start+past+future++)%BUF_SIZE;
|
||||
int end = (start+past+future++)%BUF_SIZE;
|
||||
buffer[end] = v;
|
||||
}
|
||||
__forceinline void pop_front() {
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#include "stringstream.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -17,7 +30,7 @@ namespace embree
|
||||
ParseLocation location() { return cin->loc(); }
|
||||
std::string next();
|
||||
private:
|
||||
__forceinline bool isSeparator(int c) const { return c<256 && isSepMap[c]; }
|
||||
__forceinline bool isSeparator(int c) const { return isSepMap[c]; }
|
||||
private:
|
||||
Ref<Stream<int> > cin; /*! source character stream */
|
||||
bool isSepMap[256]; /*! map for fast classification of separators */
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#include "tokenstream.h"
|
||||
#include "../math/math.h"
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -147,13 +160,13 @@ namespace embree
|
||||
std::vector<std::string> symbols;
|
||||
|
||||
/*! checks if a character is a separator */
|
||||
__forceinline bool isSeparator(int c) const { return c<256 && isSepMap[c]; }
|
||||
__forceinline bool isSeparator(int c) const { return isSepMap[c]; }
|
||||
|
||||
/*! checks if a character is a number */
|
||||
__forceinline bool isDigit(int c) const { return c >= '0' && c <= '9';}
|
||||
|
||||
/*! checks if a character is legal for an identifier */
|
||||
__forceinline bool isAlpha(int c) const { return c<256 && isAlphaMap[c]; }
|
||||
__forceinline bool isAlpha(int c) const { return isAlphaMap[c]; }
|
||||
__forceinline bool isAlphaNum(int c) const { return isAlpha(c) || isDigit(c); }
|
||||
};
|
||||
}
|
||||
|
||||
+15
-10
@@ -1,13 +1,18 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2017 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
ADD_LIBRARY(math STATIC constants.cpp)
|
||||
SET_PROPERTY(TARGET math PROPERTY FOLDER common)
|
||||
SET_PROPERTY(TARGET math APPEND PROPERTY COMPILE_FLAGS " ${FLAGS_LOWEST}")
|
||||
|
||||
IF (EMBREE_STATIC_LIB)
|
||||
INSTALL(TARGETS math EXPORT math-targets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT devel)
|
||||
INSTALL(EXPORT math-targets DESTINATION ${EMBREE_CMAKECONFIG_DIR} COMPONENT devel)
|
||||
SIGN_TARGET(math)
|
||||
ENDIF()
|
||||
|
||||
|
||||
+27
-214
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -7,7 +20,6 @@
|
||||
#include "linearspace3.h"
|
||||
#include "quaternion.h"
|
||||
#include "bbox.h"
|
||||
#include "vec4.h"
|
||||
|
||||
namespace embree
|
||||
{
|
||||
@@ -69,10 +81,6 @@ namespace embree
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// template specialization to get correct identity matrix for type AffineSpace3fa
|
||||
template<>
|
||||
__forceinline AffineSpaceT<LinearSpace3fa>::AffineSpaceT( OneTy ) : l(one), p(0.f, 0.f, 0.f, 1.f) {}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Unary Operators
|
||||
@@ -99,9 +107,9 @@ namespace embree
|
||||
template<typename L> __forceinline AffineSpaceT<L>& operator /=( AffineSpaceT<L>& a, const AffineSpaceT<L>& b ) { return a = a / b; }
|
||||
template<typename L> __forceinline AffineSpaceT<L>& operator /=( AffineSpaceT<L>& a, const ScalarT & b ) { return a = a / b; }
|
||||
|
||||
template<typename L> __forceinline VectorT xfmPoint (const AffineSpaceT<L>& m, const VectorT& p) { return madd(VectorT(p.x),m.l.vx,madd(VectorT(p.y),m.l.vy,madd(VectorT(p.z),m.l.vz,m.p))); }
|
||||
template<typename L> __forceinline VectorT xfmVector(const AffineSpaceT<L>& m, const VectorT& v) { return xfmVector(m.l,v); }
|
||||
template<typename L> __forceinline VectorT xfmNormal(const AffineSpaceT<L>& m, const VectorT& n) { return xfmNormal(m.l,n); }
|
||||
template<typename L> __forceinline const VectorT xfmPoint (const AffineSpaceT<L>& m, const VectorT& p) { return madd(VectorT(p.x),m.l.vx,madd(VectorT(p.y),m.l.vy,madd(VectorT(p.z),m.l.vz,m.p))); }
|
||||
template<typename L> __forceinline const VectorT xfmVector(const AffineSpaceT<L>& m, const VectorT& v) { return xfmVector(m.l,v); }
|
||||
template<typename L> __forceinline const VectorT xfmNormal(const AffineSpaceT<L>& m, const VectorT& n) { return xfmNormal(m.l,n); }
|
||||
|
||||
__forceinline const BBox<Vec3fa> xfmBounds(const AffineSpaceT<LinearSpace3<Vec3fa> >& m, const BBox<Vec3fa>& b)
|
||||
{
|
||||
@@ -132,11 +140,17 @@ namespace embree
|
||||
return AffineSpaceT<L>(select(s,t.l,f.l),select(s,t.p,f.p));
|
||||
}
|
||||
|
||||
/*! blending */
|
||||
template<typename T>
|
||||
__forceinline AffineSpaceT<T> lerp(const AffineSpaceT<T>& l0, const AffineSpaceT<T>& l1, const float t) {
|
||||
return AffineSpaceT<T>(lerp(l0.l,l1.l,t),lerp(l0.p,l1.p,t));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Output Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename L> static embree_ostream operator<<(embree_ostream cout, const AffineSpaceT<L>& m) {
|
||||
template<typename L> static std::ostream& operator<<(std::ostream& cout, const AffineSpaceT<L>& m) {
|
||||
return cout << "{ l = " << m.l << ", p = " << m.p << " }";
|
||||
}
|
||||
|
||||
@@ -149,210 +163,9 @@ namespace embree
|
||||
typedef AffineSpaceT<LinearSpace3fa> AffineSpace3fa;
|
||||
typedef AffineSpaceT<Quaternion3f > OrthonormalSpace3f;
|
||||
|
||||
template<int N> using AffineSpace3vf = AffineSpaceT<LinearSpace3<Vec3<vfloat<N>>>>;
|
||||
typedef AffineSpaceT<LinearSpace3<Vec3<vfloat<4>>>> AffineSpace3vf4;
|
||||
typedef AffineSpaceT<LinearSpace3<Vec3<vfloat<8>>>> AffineSpace3vf8;
|
||||
typedef AffineSpaceT<LinearSpace3<Vec3<vfloat<16>>>> AffineSpace3vf16;
|
||||
|
||||
template<int N> using AffineSpace3vfa = AffineSpaceT<LinearSpace3<Vec4<vfloat<N>>>>;
|
||||
typedef AffineSpaceT<LinearSpace3<Vec4<vfloat<4>>>> AffineSpace3vfa4;
|
||||
typedef AffineSpaceT<LinearSpace3<Vec4<vfloat<8>>>> AffineSpace3vfa8;
|
||||
typedef AffineSpaceT<LinearSpace3<Vec4<vfloat<16>>>> AffineSpace3vfa16;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// Interpolation
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template<typename T, typename R>
|
||||
__forceinline AffineSpaceT<T> lerp(const AffineSpaceT<T>& M0,
|
||||
const AffineSpaceT<T>& M1,
|
||||
const R& t)
|
||||
{
|
||||
return AffineSpaceT<T>(lerp(M0.l,M1.l,t),lerp(M0.p,M1.p,t));
|
||||
}
|
||||
|
||||
// slerp interprets the 16 floats of the matrix M = D * R * S as components of
|
||||
// three matrizes (D, R, S) that are interpolated individually.
|
||||
template<typename T> __forceinline AffineSpaceT<LinearSpace3<Vec3<T>>>
|
||||
slerp(const AffineSpaceT<LinearSpace3<Vec4<T>>>& M0,
|
||||
const AffineSpaceT<LinearSpace3<Vec4<T>>>& M1,
|
||||
const T& t)
|
||||
{
|
||||
QuaternionT<T> q0(M0.p.w, M0.l.vx.w, M0.l.vy.w, M0.l.vz.w);
|
||||
QuaternionT<T> q1(M1.p.w, M1.l.vx.w, M1.l.vy.w, M1.l.vz.w);
|
||||
QuaternionT<T> q = slerp(q0, q1, t);
|
||||
|
||||
AffineSpaceT<LinearSpace3<Vec3<T>>> S = lerp(M0, M1, t);
|
||||
AffineSpaceT<LinearSpace3<Vec3<T>>> D(one);
|
||||
D.p.x = S.l.vx.y;
|
||||
D.p.y = S.l.vx.z;
|
||||
D.p.z = S.l.vy.z;
|
||||
S.l.vx.y = 0;
|
||||
S.l.vx.z = 0;
|
||||
S.l.vy.z = 0;
|
||||
|
||||
AffineSpaceT<LinearSpace3<Vec3<T>>> R = LinearSpace3<Vec3<T>>(q);
|
||||
return D * R * S;
|
||||
}
|
||||
|
||||
// this is a specialized version for Vec3fa because that does
|
||||
// not play along nicely with the other templated Vec3/Vec4 types
|
||||
__forceinline AffineSpace3fa slerp(const AffineSpace3fa& M0,
|
||||
const AffineSpace3fa& M1,
|
||||
const float& t)
|
||||
{
|
||||
Quaternion3f q0(M0.p.w, M0.l.vx.w, M0.l.vy.w, M0.l.vz.w);
|
||||
Quaternion3f q1(M1.p.w, M1.l.vx.w, M1.l.vy.w, M1.l.vz.w);
|
||||
Quaternion3f q = slerp(q0, q1, t);
|
||||
|
||||
AffineSpace3fa S = lerp(M0, M1, t);
|
||||
AffineSpace3fa D(one);
|
||||
D.p.x = S.l.vx.y;
|
||||
D.p.y = S.l.vx.z;
|
||||
D.p.z = S.l.vy.z;
|
||||
S.l.vx.y = 0;
|
||||
S.l.vx.z = 0;
|
||||
S.l.vy.z = 0;
|
||||
|
||||
AffineSpace3fa R = LinearSpace3fa(q);
|
||||
return D * R * S;
|
||||
}
|
||||
|
||||
__forceinline AffineSpace3fa quaternionDecompositionToAffineSpace(const AffineSpace3fa& qd)
|
||||
{
|
||||
// compute affine transform from quaternion decomposition
|
||||
Quaternion3f q(qd.p.w, qd.l.vx.w, qd.l.vy.w, qd.l.vz.w);
|
||||
AffineSpace3fa M = qd;
|
||||
AffineSpace3fa D(one);
|
||||
D.p.x = M.l.vx.y;
|
||||
D.p.y = M.l.vx.z;
|
||||
D.p.z = M.l.vy.z;
|
||||
M.l.vx.y = 0;
|
||||
M.l.vx.z = 0;
|
||||
M.l.vy.z = 0;
|
||||
AffineSpace3fa R = LinearSpace3fa(q);
|
||||
return D * R * M;
|
||||
}
|
||||
|
||||
__forceinline void quaternionDecomposition(const AffineSpace3fa& qd, Vec3fa& T, Quaternion3f& q, AffineSpace3fa& S)
|
||||
{
|
||||
q = Quaternion3f(qd.p.w, qd.l.vx.w, qd.l.vy.w, qd.l.vz.w);
|
||||
S = qd;
|
||||
T.x = qd.l.vx.y;
|
||||
T.y = qd.l.vx.z;
|
||||
T.z = qd.l.vy.z;
|
||||
S.l.vx.y = 0;
|
||||
S.l.vx.z = 0;
|
||||
S.l.vy.z = 0;
|
||||
}
|
||||
|
||||
__forceinline AffineSpace3fa quaternionDecomposition(Vec3fa const& T, Quaternion3f const& q, AffineSpace3fa const& S)
|
||||
{
|
||||
AffineSpace3fa M = S;
|
||||
M.l.vx.w = q.i;
|
||||
M.l.vy.w = q.j;
|
||||
M.l.vz.w = q.k;
|
||||
M.p.w = q.r;
|
||||
M.l.vx.y = T.x;
|
||||
M.l.vx.z = T.y;
|
||||
M.l.vy.z = T.z;
|
||||
return M;
|
||||
}
|
||||
|
||||
struct __aligned(16) QuaternionDecomposition
|
||||
{
|
||||
float scale_x = 1.f;
|
||||
float scale_y = 1.f;
|
||||
float scale_z = 1.f;
|
||||
float skew_xy = 0.f;
|
||||
float skew_xz = 0.f;
|
||||
float skew_yz = 0.f;
|
||||
float shift_x = 0.f;
|
||||
float shift_y = 0.f;
|
||||
float shift_z = 0.f;
|
||||
float quaternion_r = 1.f;
|
||||
float quaternion_i = 0.f;
|
||||
float quaternion_j = 0.f;
|
||||
float quaternion_k = 0.f;
|
||||
float translation_x = 0.f;
|
||||
float translation_y = 0.f;
|
||||
float translation_z = 0.f;
|
||||
};
|
||||
|
||||
__forceinline QuaternionDecomposition quaternionDecomposition(AffineSpace3fa const& M)
|
||||
{
|
||||
QuaternionDecomposition qd;
|
||||
qd.scale_x = M.l.vx.x;
|
||||
qd.scale_y = M.l.vy.y;
|
||||
qd.scale_z = M.l.vz.z;
|
||||
qd.shift_x = M.p.x;
|
||||
qd.shift_y = M.p.y;
|
||||
qd.shift_z = M.p.z;
|
||||
qd.translation_x = M.l.vx.y;
|
||||
qd.translation_y = M.l.vx.z;
|
||||
qd.translation_z = M.l.vy.z;
|
||||
qd.skew_xy = M.l.vy.x;
|
||||
qd.skew_xz = M.l.vz.x;
|
||||
qd.skew_yz = M.l.vz.y;
|
||||
qd.quaternion_r = M.p.w;
|
||||
qd.quaternion_i = M.l.vx.w;
|
||||
qd.quaternion_j = M.l.vy.w;
|
||||
qd.quaternion_k = M.l.vz.w;
|
||||
return qd;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* ! Template Specialization for 2D: return matrix for rotation around point
|
||||
* (rotation around arbitrarty vector is not meaningful in 2D)
|
||||
*/
|
||||
template<> __forceinline
|
||||
AffineSpace2f AffineSpace2f::rotate(const Vec2f& p, const float& r) {
|
||||
return translate(+p)*AffineSpace2f(LinearSpace2f::rotate(r))*translate(-p);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Similarity Transform
|
||||
//
|
||||
// checks, if M is a similarity transformation, i.e if there exists a factor D
|
||||
// such that for all x,y: distance(Mx, My) = D * distance(x, y)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
__forceinline bool similarityTransform(const AffineSpace3fa& M, float* D)
|
||||
{
|
||||
if (D) *D = 0.f;
|
||||
if (abs(dot(M.l.vx, M.l.vy)) > 1e-5f) return false;
|
||||
if (abs(dot(M.l.vx, M.l.vz)) > 1e-5f) return false;
|
||||
if (abs(dot(M.l.vy, M.l.vz)) > 1e-5f) return false;
|
||||
|
||||
const float D_x = dot(M.l.vx, M.l.vx);
|
||||
const float D_y = dot(M.l.vy, M.l.vy);
|
||||
const float D_z = dot(M.l.vz, M.l.vz);
|
||||
|
||||
if (abs(D_x - D_y) > 1e-5f ||
|
||||
abs(D_x - D_z) > 1e-5f ||
|
||||
abs(D_y - D_z) > 1e-5f)
|
||||
return false;
|
||||
|
||||
if (D) *D = sqrtf(D_x);
|
||||
return true;
|
||||
}
|
||||
|
||||
__forceinline void AffineSpace3fa_store_unaligned(const AffineSpace3fa &source, AffineSpace3fa* ptr)
|
||||
{
|
||||
Vec3fa::storeu(&ptr->l.vx, source.l.vx);
|
||||
Vec3fa::storeu(&ptr->l.vy, source.l.vy);
|
||||
Vec3fa::storeu(&ptr->l.vz, source.l.vz);
|
||||
Vec3fa::storeu(&ptr->p, source.p);
|
||||
}
|
||||
|
||||
__forceinline AffineSpace3fa AffineSpace3fa_load_unaligned(AffineSpace3fa* ptr)
|
||||
{
|
||||
AffineSpace3fa space;
|
||||
space.l.vx = Vec3fa::loadu(&ptr->l.vx);
|
||||
space.l.vy = Vec3fa::loadu(&ptr->l.vy);
|
||||
space.l.vz = Vec3fa::loadu(&ptr->l.vz);
|
||||
space.p = Vec3fa::loadu(&ptr->p);
|
||||
return space;
|
||||
}
|
||||
/*! Template Specialization for 2D: return matrix for rotation around point (rotation around arbitrarty vector is not meaningful in 2D) */
|
||||
template<> __forceinline AffineSpace2f AffineSpace2f::rotate(const Vec2f& p, const float& r) { return translate(+p) * AffineSpace2f(LinearSpace2f::rotate(r)) * translate(-p); }
|
||||
|
||||
#undef VectorT
|
||||
#undef ScalarT
|
||||
|
||||
+19
-23
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -8,13 +21,6 @@
|
||||
|
||||
namespace embree
|
||||
{
|
||||
namespace internal {
|
||||
|
||||
template <typename T> __forceinline T divideByTwo(const T& v) { return v / T(2); }
|
||||
template <> __forceinline float divideByTwo<float>(const float& v) { return v * 0.5f; }
|
||||
template <> __forceinline double divideByTwo<double>(const double& v) { return v * 0.5; }
|
||||
|
||||
} // namespace internal
|
||||
template<typename T>
|
||||
struct BBox
|
||||
{
|
||||
@@ -45,7 +51,7 @@ namespace embree
|
||||
__forceinline T size() const { return upper - lower; }
|
||||
|
||||
/*! computes the center of the box */
|
||||
__forceinline T center() const { return internal::divideByTwo<T>(lower+upper); }
|
||||
__forceinline T center() const { return 0.5f*(lower+upper); }
|
||||
|
||||
/*! computes twice the center of the box */
|
||||
__forceinline T center2() const { return lower+upper; }
|
||||
@@ -54,11 +60,6 @@ namespace embree
|
||||
__forceinline static const BBox merge (const BBox& a, const BBox& b) {
|
||||
return BBox(min(a.lower, b.lower), max(a.upper, b.upper));
|
||||
}
|
||||
|
||||
/*! enlarge box by some scaling factor */
|
||||
__forceinline BBox enlarge_by(const float a) const {
|
||||
return BBox(lower - T(a)*abs(lower), upper + T(a)*abs(upper));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Constants
|
||||
@@ -97,7 +98,7 @@ namespace embree
|
||||
|
||||
/*! computes the center of the box */
|
||||
template<typename T> __forceinline const T center2(const BBox<T>& box) { return box.lower + box.upper; }
|
||||
template<typename T> __forceinline const T center (const BBox<T>& box) { return internal::divideByTwo<T>(center2(box)); }
|
||||
template<typename T> __forceinline const T center (const BBox<T>& box) { return T(0.5f)*center2(box); }
|
||||
|
||||
/*! computes the volume of a bounding box */
|
||||
__forceinline float volume ( const BBox<Vec3fa>& b ) { return reduce_mul(b.size()); }
|
||||
@@ -110,7 +111,7 @@ namespace embree
|
||||
template<typename T> __forceinline const T area( const BBox<Vec2<T> >& b ) { const Vec2<T> d = b.size(); return d.x*d.y; }
|
||||
|
||||
template<typename T> __forceinline const T halfArea( const BBox<Vec3<T> >& b ) { return halfArea(b.size()); }
|
||||
template<typename T> __forceinline const T area( const BBox<Vec3<T> >& b ) { return T(2)*halfArea(b); }
|
||||
template<typename T> __forceinline const T area( const BBox<Vec3<T> >& b ) { return 2.0f*halfArea(b); }
|
||||
|
||||
__forceinline float halfArea( const BBox<Vec3fa>& b ) { return halfArea(b.size()); }
|
||||
__forceinline float area( const BBox<Vec3fa>& b ) { return 2.0f*halfArea(b); }
|
||||
@@ -183,10 +184,6 @@ namespace embree
|
||||
return true;
|
||||
}
|
||||
|
||||
template<> __inline bool subset( const BBox<Vec3fa>& a, const BBox<Vec3fa>& b ) {
|
||||
return all(ge_mask(a.lower,b.lower)) & all(le_mask(a.upper,b.upper));
|
||||
}
|
||||
|
||||
/*! blending */
|
||||
template<typename T>
|
||||
__forceinline BBox<T> lerp(const BBox<T>& b0, const BBox<T>& b1, const float t) {
|
||||
@@ -194,14 +191,13 @@ namespace embree
|
||||
}
|
||||
|
||||
/*! output operator */
|
||||
template<typename T> __forceinline embree_ostream operator<<(embree_ostream cout, const BBox<T>& box) {
|
||||
template<typename T> __forceinline std::ostream& operator<<(std::ostream& cout, const BBox<T>& box) {
|
||||
return cout << "[" << box.lower << "; " << box.upper << "]";
|
||||
}
|
||||
|
||||
/*! default template instantiations */
|
||||
typedef BBox<float> BBox1f;
|
||||
typedef BBox<Vec2f> BBox2f;
|
||||
typedef BBox<Vec2fa> BBox2fa;
|
||||
typedef BBox<Vec3f> BBox3f;
|
||||
typedef BBox<Vec3fa> BBox3fa;
|
||||
}
|
||||
|
||||
+16
-3
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -37,7 +50,7 @@ namespace embree
|
||||
};
|
||||
|
||||
/*! output operator */
|
||||
template<typename T> __forceinline embree_ostream operator<<(embree_ostream cout, const Col3<T>& a) {
|
||||
template<typename T> inline std::ostream& operator<<(std::ostream& cout, const Col3<T>& a) {
|
||||
return cout << "(" << a.r << ", " << a.g << ", " << a.b << ")";
|
||||
}
|
||||
|
||||
|
||||
+16
-3
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -37,7 +50,7 @@ namespace embree
|
||||
};
|
||||
|
||||
/*! output operator */
|
||||
template<typename T> __forceinline embree_ostream operator<<(embree_ostream cout, const Col4<T>& a) {
|
||||
template<typename T> inline std::ostream& operator<<(std::ostream& cout, const Col4<T>& a) {
|
||||
return cout << "(" << a.r << ", " << a.g << ", " << a.b << ", " << a.a << ")";
|
||||
}
|
||||
|
||||
|
||||
+20
-7
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -40,8 +53,8 @@ namespace embree
|
||||
__forceinline Color4 ( const Color4& other ) : m128(other.m128) {}
|
||||
__forceinline Color4& operator=( const Color4& other ) { m128 = other.m128; return *this; }
|
||||
|
||||
__forceinline operator const __m128&() const { return m128; }
|
||||
__forceinline operator __m128&() { return m128; }
|
||||
__forceinline operator const __m128&( void ) const { return m128; }
|
||||
__forceinline operator __m128&( void ) { return m128; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Set
|
||||
@@ -102,8 +115,8 @@ namespace embree
|
||||
__forceinline Color ( const Color4& other ) : m128(other.m128) {}
|
||||
__forceinline Color& operator=( const Color4& other ) { m128 = other.m128; return *this; }
|
||||
|
||||
__forceinline operator const __m128&() const { return m128; }
|
||||
__forceinline operator __m128&() { return m128; }
|
||||
__forceinline operator const __m128&( void ) const { return m128; }
|
||||
__forceinline operator __m128&( void ) { return m128; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Set
|
||||
@@ -235,7 +248,7 @@ namespace embree
|
||||
__forceinline float luminance (const Color& a) { return madd(0.212671f,a.r,madd(0.715160f,a.g,0.072169f*a.b)); }
|
||||
|
||||
/*! output operator */
|
||||
__forceinline embree_ostream operator<<(embree_ostream cout, const Color& a) {
|
||||
inline std::ostream& operator<<(std::ostream& cout, const Color& a) {
|
||||
return cout << "(" << a.r << ", " << a.g << ", " << a.b << ")";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#include "constants.h"
|
||||
|
||||
@@ -23,5 +36,4 @@ namespace embree
|
||||
StepTy step;
|
||||
ReverseStepTy reverse_step;
|
||||
EmptyTy empty;
|
||||
UndefinedTy undefined;
|
||||
}
|
||||
|
||||
+18
-11
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -10,15 +23,14 @@
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h> // using cmath causes issues under Windows
|
||||
#include <cfloat>
|
||||
#include <climits>
|
||||
|
||||
namespace embree
|
||||
{
|
||||
static MAYBE_UNUSED const float one_over_255 = 1.0f/255.0f;
|
||||
static MAYBE_UNUSED const float min_rcp_input = 1E-18f; // for abs(x) >= min_rcp_input the newton raphson rcp calculation does not fail
|
||||
static const float one_over_255 = 1.0f/255.0f;
|
||||
static const float min_rcp_input = 1E-18f; // for abs(x) >= min_rcp_input the newton raphson rcp calculation does not fail
|
||||
|
||||
/* we consider floating point numbers in that range as valid input numbers */
|
||||
static MAYBE_UNUSED float FLT_LARGE = 1.844E18f;
|
||||
static float FLT_LARGE = 1.844E18f;
|
||||
|
||||
struct TrueTy {
|
||||
__forceinline operator bool( ) const { return true; }
|
||||
@@ -189,9 +201,4 @@ namespace embree
|
||||
};
|
||||
|
||||
extern MAYBE_UNUSED FullTy full;
|
||||
|
||||
struct UndefinedTy {
|
||||
};
|
||||
|
||||
extern MAYBE_UNUSED UndefinedTy undefined;
|
||||
}
|
||||
|
||||
@@ -1,161 +0,0 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "vec2.h"
|
||||
#include "vec3.h"
|
||||
#include "bbox.h"
|
||||
|
||||
namespace embree
|
||||
{
|
||||
template<typename V>
|
||||
struct Interval
|
||||
{
|
||||
V lower, upper;
|
||||
|
||||
__forceinline Interval() {}
|
||||
__forceinline Interval ( const Interval& other ) { lower = other.lower; upper = other.upper; }
|
||||
__forceinline Interval& operator=( const Interval& other ) { lower = other.lower; upper = other.upper; return *this; }
|
||||
|
||||
__forceinline Interval(const V& a) : lower(a), upper(a) {}
|
||||
__forceinline Interval(const V& lower, const V& upper) : lower(lower), upper(upper) {}
|
||||
__forceinline Interval(const BBox<V>& a) : lower(a.lower), upper(a.upper) {}
|
||||
|
||||
/*! tests if box is empty */
|
||||
//__forceinline bool empty() const { return lower > upper; }
|
||||
|
||||
/*! computes the size of the interval */
|
||||
__forceinline V size() const { return upper - lower; }
|
||||
|
||||
__forceinline V center() const { return 0.5f*(lower+upper); }
|
||||
|
||||
__forceinline const Interval& extend(const Interval& other) { lower = min(lower,other.lower); upper = max(upper,other.upper); return *this; }
|
||||
__forceinline const Interval& extend(const V & other) { lower = min(lower,other ); upper = max(upper,other ); return *this; }
|
||||
|
||||
__forceinline friend Interval operator +( const Interval& a, const Interval& b ) {
|
||||
return Interval(a.lower+b.lower,a.upper+b.upper);
|
||||
}
|
||||
|
||||
__forceinline friend Interval operator -( const Interval& a, const Interval& b ) {
|
||||
return Interval(a.lower-b.upper,a.upper-b.lower);
|
||||
}
|
||||
|
||||
__forceinline friend Interval operator -( const Interval& a, const V& b ) {
|
||||
return Interval(a.lower-b,a.upper-b);
|
||||
}
|
||||
|
||||
__forceinline friend Interval operator *( const Interval& a, const Interval& b )
|
||||
{
|
||||
const V ll = a.lower*b.lower;
|
||||
const V lu = a.lower*b.upper;
|
||||
const V ul = a.upper*b.lower;
|
||||
const V uu = a.upper*b.upper;
|
||||
return Interval(min(ll,lu,ul,uu),max(ll,lu,ul,uu));
|
||||
}
|
||||
|
||||
__forceinline friend Interval merge( const Interval& a, const Interval& b) {
|
||||
return Interval(min(a.lower,b.lower),max(a.upper,b.upper));
|
||||
}
|
||||
|
||||
__forceinline friend Interval merge( const Interval& a, const Interval& b, const Interval& c) {
|
||||
return merge(merge(a,b),c);
|
||||
}
|
||||
|
||||
__forceinline friend Interval merge( const Interval& a, const Interval& b, const Interval& c, const Interval& d) {
|
||||
return merge(merge(a,b),merge(c,d));
|
||||
}
|
||||
|
||||
/*! intersect bounding boxes */
|
||||
__forceinline friend const Interval intersect( const Interval& a, const Interval& b ) { return Interval(max(a.lower, b.lower), min(a.upper, b.upper)); }
|
||||
__forceinline friend const Interval intersect( const Interval& a, const Interval& b, const Interval& c ) { return intersect(a,intersect(b,c)); }
|
||||
__forceinline friend const Interval intersect( const Interval& a, const Interval& b, const Interval& c, const Interval& d ) { return intersect(intersect(a,b),intersect(c,d)); }
|
||||
|
||||
friend embree_ostream operator<<(embree_ostream cout, const Interval& a) {
|
||||
return cout << "[" << a.lower << ", " << a.upper << "]";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Constants
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline Interval( EmptyTy ) : lower(pos_inf), upper(neg_inf) {}
|
||||
__forceinline Interval( FullTy ) : lower(neg_inf), upper(pos_inf) {}
|
||||
};
|
||||
|
||||
__forceinline bool isEmpty(const Interval<float>& v) {
|
||||
return v.lower > v.upper;
|
||||
}
|
||||
|
||||
__forceinline vboolx isEmpty(const Interval<vfloatx>& v) {
|
||||
return v.lower > v.upper;
|
||||
}
|
||||
|
||||
/*! subset relation */
|
||||
template<typename T> __forceinline bool subset( const Interval<T>& a, const Interval<T>& b ) {
|
||||
return (a.lower > b.lower) && (a.upper < b.upper);
|
||||
}
|
||||
|
||||
template<typename T> __forceinline bool subset( const Vec2<Interval<T>>& a, const Vec2<Interval<T>>& b ) {
|
||||
return subset(a.x,b.x) && subset(a.y,b.y);
|
||||
}
|
||||
|
||||
template<typename T> __forceinline const Vec2<Interval<T>> intersect( const Vec2<Interval<T>>& a, const Vec2<Interval<T>>& b ) {
|
||||
return Vec2<Interval<T>>(intersect(a.x,b.x),intersect(a.y,b.y));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Select
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename T> __forceinline Interval<T> select ( bool s, const Interval<T>& t, const Interval<T>& f ) {
|
||||
return Interval<T>(select(s,t.lower,f.lower),select(s,t.upper,f.upper));
|
||||
}
|
||||
|
||||
template<typename T> __forceinline Interval<T> select ( const typename T::Bool& s, const Interval<T>& t, const Interval<T>& f ) {
|
||||
return Interval<T>(select(s,t.lower,f.lower),select(s,t.upper,f.upper));
|
||||
}
|
||||
|
||||
__forceinline int numRoots(const Interval<float>& p0, const Interval<float>& p1)
|
||||
{
|
||||
float eps = 1E-4f;
|
||||
bool neg0 = p0.lower < eps; bool pos0 = p0.upper > -eps;
|
||||
bool neg1 = p1.lower < eps; bool pos1 = p1.upper > -eps;
|
||||
return (neg0 && pos1) || (pos0 && neg1) || (neg0 && pos0) || (neg1 && pos1);
|
||||
}
|
||||
|
||||
typedef Interval<float> Interval1f;
|
||||
typedef Vec2<Interval<float>> Interval2f;
|
||||
typedef Vec3<Interval<float>> Interval3f;
|
||||
|
||||
inline void swap(float& a, float& b) { float tmp = a; a = b; b = tmp; }
|
||||
|
||||
inline Interval1f shift(const Interval1f& v, float shift) { return Interval1f(v.lower + shift, v.upper + shift); }
|
||||
|
||||
#define TWO_PI (2.0*M_PI)
|
||||
inline Interval1f sin(Interval1f interval)
|
||||
{
|
||||
if (interval.upper-interval.lower >= M_PI) { return Interval1f(-1.0, 1.0); }
|
||||
if (interval.upper > TWO_PI) { interval = shift(interval, -TWO_PI*floor(interval.upper/TWO_PI)); }
|
||||
if (interval.lower < 0) { interval = shift(interval, -TWO_PI*floor(interval.lower/TWO_PI)); }
|
||||
float sinLower = sin(interval.lower);
|
||||
float sinUpper = sin(interval.upper);
|
||||
if (sinLower > sinUpper) swap(sinLower, sinUpper);
|
||||
if (interval.lower < M_PI / 2.0 && interval.upper > M_PI / 2.0) sinUpper = 1.0;
|
||||
if (interval.lower < 3.0 * M_PI / 2.0 && interval.upper > 3.0 * M_PI / 2.0) sinLower = -1.0;
|
||||
return Interval1f(sinLower, sinUpper);
|
||||
}
|
||||
|
||||
inline Interval1f cos(Interval1f interval)
|
||||
{
|
||||
if (interval.upper-interval.lower >= M_PI) { return Interval1f(-1.0, 1.0); }
|
||||
if (interval.upper > TWO_PI) { interval = shift(interval, -TWO_PI*floor(interval.upper/TWO_PI)); }
|
||||
if (interval.lower < 0) { interval = shift(interval, -TWO_PI*floor(interval.lower/TWO_PI)); }
|
||||
float cosLower = cos(interval.lower);
|
||||
float cosUpper = cos(interval.upper);
|
||||
if (cosLower > cosUpper) swap(cosLower, cosUpper);
|
||||
if (interval.lower < M_PI && interval.upper > M_PI) cosLower = -1.0;
|
||||
return Interval1f(cosLower, cosUpper);
|
||||
}
|
||||
#undef TWO_PI
|
||||
}
|
||||
+17
-66
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -96,56 +109,6 @@ namespace embree
|
||||
bounds1 = b1;
|
||||
}
|
||||
|
||||
/*! calculates the linear bounds of a primitive for the specified time range */
|
||||
template<typename BoundsFunc>
|
||||
__forceinline LBBox(const BoundsFunc& bounds, const BBox1f& time_range_in, const BBox1f& geom_time_range, float geom_time_segments)
|
||||
{
|
||||
/* normalize global time_range_in to local geom_time_range */
|
||||
const BBox1f time_range((time_range_in.lower-geom_time_range.lower)/geom_time_range.size(),
|
||||
(time_range_in.upper-geom_time_range.lower)/geom_time_range.size());
|
||||
|
||||
const float lower = time_range.lower*geom_time_segments;
|
||||
const float upper = time_range.upper*geom_time_segments;
|
||||
const float ilowerf = floor(lower);
|
||||
const float iupperf = ceil(upper);
|
||||
const float ilowerfc = max(0.0f,ilowerf);
|
||||
const float iupperfc = min(iupperf,geom_time_segments);
|
||||
const int ilowerc = (int)ilowerfc;
|
||||
const int iupperc = (int)iupperfc;
|
||||
assert(iupperc-ilowerc > 0);
|
||||
|
||||
/* this larger iteration range guarantees that we process borders of geom_time_range is (partially) inside time_range_in */
|
||||
const int ilower_iter = max(-1,(int)ilowerf);
|
||||
const int iupper_iter = min((int)iupperf,(int)geom_time_segments+1);
|
||||
|
||||
const BBox<T> blower0 = bounds(ilowerc);
|
||||
const BBox<T> bupper1 = bounds(iupperc);
|
||||
if (iupper_iter-ilower_iter == 1) {
|
||||
bounds0 = lerp(blower0, bupper1, max(0.0f,lower-ilowerfc));
|
||||
bounds1 = lerp(bupper1, blower0, max(0.0f,iupperfc-upper));
|
||||
return;
|
||||
}
|
||||
|
||||
const BBox<T> blower1 = bounds(ilowerc+1);
|
||||
const BBox<T> bupper0 = bounds(iupperc-1);
|
||||
BBox<T> b0 = lerp(blower0, blower1, max(0.0f,lower-ilowerfc));
|
||||
BBox<T> b1 = lerp(bupper1, bupper0, max(0.0f,iupperfc-upper));
|
||||
|
||||
for (int i = ilower_iter+1; i < iupper_iter; i++)
|
||||
{
|
||||
const float f = (float(i)/geom_time_segments - time_range.lower) / time_range.size();
|
||||
const BBox<T> bt = lerp(b0, b1, f);
|
||||
const BBox<T> bi = bounds(i);
|
||||
const T dlower = min(bi.lower-bt.lower, T(zero));
|
||||
const T dupper = max(bi.upper-bt.upper, T(zero));
|
||||
b0.lower += dlower; b1.lower += dlower;
|
||||
b0.upper += dupper; b1.upper += dupper;
|
||||
}
|
||||
|
||||
bounds0 = b0;
|
||||
bounds1 = b1;
|
||||
}
|
||||
|
||||
/*! calculates the linear bounds of a primitive for the specified time range */
|
||||
template<typename BoundsFunc>
|
||||
__forceinline LBBox(const BoundsFunc& bounds, const range<int>& time_range, int numTimeSegments)
|
||||
@@ -156,8 +119,7 @@ namespace embree
|
||||
BBox<T> b0 = bounds(ilower);
|
||||
BBox<T> b1 = bounds(iupper);
|
||||
|
||||
if (iupper-ilower == 1)
|
||||
{
|
||||
if (iupper-ilower == 1) {
|
||||
bounds0 = b0;
|
||||
bounds1 = b1;
|
||||
return;
|
||||
@@ -225,7 +187,7 @@ namespace embree
|
||||
template<typename TT> friend __forceinline bool operator!=( const LBBox<TT>& a, const LBBox<TT>& b ) { return a.bounds0 != b.bounds0 || a.bounds1 != b.bounds1; }
|
||||
|
||||
/*! output operator */
|
||||
friend __forceinline embree_ostream operator<<(embree_ostream cout, const LBBox& box) {
|
||||
friend __forceinline std::ostream& operator<<(std::ostream& cout, const LBBox& box) {
|
||||
return cout << "LBBox { " << box.bounds0 << "; " << box.bounds1 << " }";
|
||||
}
|
||||
|
||||
@@ -233,12 +195,6 @@ namespace embree
|
||||
BBox<T> bounds0, bounds1;
|
||||
};
|
||||
|
||||
/*! tests if box is finite */
|
||||
template<typename T>
|
||||
__forceinline bool isvalid( const LBBox<T>& v ) {
|
||||
return isvalid(v.bounds0) && isvalid(v.bounds1);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
__forceinline T expectedArea(const T& a0, const T& a1, const T& b0, const T& b1)
|
||||
{
|
||||
@@ -267,11 +223,6 @@ namespace embree
|
||||
return LBBox<T>(merge(a.bounds0, b.bounds0), merge(a.bounds1, b.bounds1));
|
||||
}
|
||||
|
||||
/*! subset relation */
|
||||
template<typename T> __inline bool subset( const LBBox<T>& a, const LBBox<T>& b ) {
|
||||
return subset(a.bounds0,b.bounds0) && subset(a.bounds1,b.bounds1);
|
||||
}
|
||||
|
||||
/*! default template instantiations */
|
||||
typedef LBBox<float> LBBox1f;
|
||||
typedef LBBox<Vec2f> LBBox2f;
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -45,10 +58,10 @@ namespace embree
|
||||
__forceinline const LinearSpace2 transposed() const { return LinearSpace2(vx.x,vx.y,vy.x,vy.y); }
|
||||
|
||||
/*! returns first row of matrix */
|
||||
__forceinline Vector row0() const { return Vector(vx.x,vy.x); }
|
||||
__forceinline const Vector row0() const { return Vector(vx.x,vy.x); }
|
||||
|
||||
/*! returns second row of matrix */
|
||||
__forceinline Vector row1() const { return Vector(vx.y,vy.y); }
|
||||
__forceinline const Vector row1() const { return Vector(vx.y,vy.y); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Constants
|
||||
@@ -138,11 +151,10 @@ namespace embree
|
||||
/// Output Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename T> static embree_ostream operator<<(embree_ostream cout, const LinearSpace2<T>& m) {
|
||||
template<typename T> static std::ostream& operator<<(std::ostream& cout, const LinearSpace2<T>& m) {
|
||||
return cout << "{ vx = " << m.vx << ", vy = " << m.vy << "}";
|
||||
}
|
||||
|
||||
/*! Shortcuts for common linear spaces. */
|
||||
typedef LinearSpace2<Vec2f> LinearSpace2f;
|
||||
typedef LinearSpace2<Vec2fa> LinearSpace2fa;
|
||||
}
|
||||
|
||||
+31
-26
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -53,13 +66,13 @@ namespace embree
|
||||
__forceinline const LinearSpace3 transposed() const { return LinearSpace3(vx.x,vx.y,vx.z,vy.x,vy.y,vy.z,vz.x,vz.y,vz.z); }
|
||||
|
||||
/*! returns first row of matrix */
|
||||
__forceinline Vector row0() const { return Vector(vx.x,vy.x,vz.x); }
|
||||
__forceinline const Vector row0() const { return Vector(vx.x,vy.x,vz.x); }
|
||||
|
||||
/*! returns second row of matrix */
|
||||
__forceinline Vector row1() const { return Vector(vx.y,vy.y,vz.y); }
|
||||
__forceinline const Vector row1() const { return Vector(vx.y,vy.y,vz.y); }
|
||||
|
||||
/*! returns third row of matrix */
|
||||
__forceinline Vector row2() const { return Vector(vx.z,vy.z,vz.z); }
|
||||
__forceinline const Vector row2() const { return Vector(vx.z,vy.z,vz.z); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Constants
|
||||
@@ -171,32 +184,24 @@ namespace embree
|
||||
return LinearSpace3<T>(select(s,t.vx,f.vx),select(s,t.vy,f.vy),select(s,t.vz,f.vz));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Output Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename T> static embree_ostream operator<<(embree_ostream cout, const LinearSpace3<T>& m) {
|
||||
return cout << "{ vx = " << m.vx << ", vy = " << m.vy << ", vz = " << m.vz << "}";
|
||||
}
|
||||
|
||||
/*! Shortcuts for common linear spaces. */
|
||||
typedef LinearSpace3<Vec3f> LinearSpace3f;
|
||||
typedef LinearSpace3<Vec3fa> LinearSpace3fa;
|
||||
|
||||
template<int N> using LinearSpace3vf = LinearSpace3<Vec3<vfloat<N>>>;
|
||||
typedef LinearSpace3<Vec3<vfloat<4>>> LinearSpace3vf4;
|
||||
typedef LinearSpace3<Vec3<vfloat<8>>> LinearSpace3vf8;
|
||||
typedef LinearSpace3<Vec3<vfloat<16>>> LinearSpace3vf16;
|
||||
|
||||
/*! blending */
|
||||
template<typename T, typename S>
|
||||
__forceinline LinearSpace3<T> lerp(const LinearSpace3<T>& l0,
|
||||
const LinearSpace3<T>& l1,
|
||||
const S& t)
|
||||
template<typename T>
|
||||
__forceinline LinearSpace3<T> lerp(const LinearSpace3<T>& l0, const LinearSpace3<T>& l1, const float t)
|
||||
{
|
||||
return LinearSpace3<T>(lerp(l0.vx,l1.vx,t),
|
||||
lerp(l0.vy,l1.vy,t),
|
||||
lerp(l0.vz,l1.vz,t));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Output Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename T> static std::ostream& operator<<(std::ostream& cout, const LinearSpace3<T>& m) {
|
||||
return cout << "{ vx = " << m.vx << ", vy = " << m.vy << ", vz = " << m.vz << "}";
|
||||
}
|
||||
|
||||
/*! Shortcuts for common linear spaces. */
|
||||
typedef LinearSpace3<Vec3f> LinearSpace3f;
|
||||
typedef LinearSpace3<Vec3fa> LinearSpace3fa;
|
||||
}
|
||||
|
||||
+18
-8
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -37,9 +50,6 @@ namespace embree
|
||||
union { float f; int i; } v; v.i = i; return v.f;
|
||||
}
|
||||
|
||||
__forceinline int toInt (const float& a) { return int(a); }
|
||||
__forceinline float toFloat(const int& a) { return float(a); }
|
||||
|
||||
#if defined(__WIN32__)
|
||||
__forceinline bool finite ( const float x ) { return _finite(x) != 0; }
|
||||
#endif
|
||||
@@ -259,10 +269,10 @@ namespace embree
|
||||
__forceinline int select(bool s, int t, int f) { return s ? t : f; }
|
||||
__forceinline float select(bool s, float t, float f) { return s ? t : f; }
|
||||
|
||||
__forceinline bool all(bool s) { return s; }
|
||||
|
||||
__forceinline float lerp(const float v0, const float v1, const float t) {
|
||||
return madd(1.0f-t,v0,t*v1);
|
||||
template<typename V>
|
||||
__forceinline V lerp(const V& v0, const V& v1, const float t) {
|
||||
return madd(V(1.0f-t),v0,t*v1);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
||||
+17
-4
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -25,8 +38,8 @@ namespace embree
|
||||
__forceinline OBBox (const LinearSpace3<T>& space, const BBox<T>& bounds)
|
||||
: space(space), bounds(bounds) {}
|
||||
|
||||
friend embree_ostream operator<<(embree_ostream cout, const OBBox& p) {
|
||||
return cout << "{ space = " << p.space << ", bounds = " << p.bounds << "}";
|
||||
friend std::ostream& operator<<(std::ostream& cout, const OBBox& p) {
|
||||
return std::cout << "{ space = " << p.space << ", bounds = " << p.bounds << "}";
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
+20
-81
@@ -1,12 +1,22 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "vec3.h"
|
||||
#include "vec4.h"
|
||||
|
||||
#include "transcendental.h"
|
||||
|
||||
namespace embree
|
||||
{
|
||||
@@ -23,13 +33,12 @@ namespace embree
|
||||
/// Construction
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline QuaternionT () { }
|
||||
__forceinline QuaternionT ( void ) { }
|
||||
__forceinline QuaternionT ( const QuaternionT& other ) { r = other.r; i = other.i; j = other.j; k = other.k; }
|
||||
__forceinline QuaternionT& operator=( const QuaternionT& other ) { r = other.r; i = other.i; j = other.j; k = other.k; return *this; }
|
||||
|
||||
__forceinline QuaternionT( const T& r ) : r(r), i(zero), j(zero), k(zero) {}
|
||||
__forceinline explicit QuaternionT( const Vec3<T>& v ) : r(zero), i(v.x), j(v.y), k(v.z) {}
|
||||
__forceinline explicit QuaternionT( const Vec4<T>& v ) : r(v.x), i(v.y), j(v.z), k(v.w) {}
|
||||
__forceinline QuaternionT( const T& r, const T& i, const T& j, const T& k ) : r(r), i(i), j(j), k(k) {}
|
||||
__forceinline QuaternionT( const T& r, const Vec3<T>& v ) : r(r), i(v.x), j(v.y), k(v.z) {}
|
||||
|
||||
@@ -49,7 +58,7 @@ namespace embree
|
||||
}
|
||||
|
||||
/*! returns the rotation axis of the quaternion as a vector */
|
||||
__forceinline Vec3<T> v( ) const { return Vec3<T>(i, j, k); }
|
||||
__forceinline const Vec3<T> v( ) const { return Vec3<T>(i, j, k); }
|
||||
|
||||
public:
|
||||
T r, i, j, k;
|
||||
@@ -69,25 +78,6 @@ namespace embree
|
||||
template<typename T> __forceinline QuaternionT<T> rcp ( const QuaternionT<T>& a ) { return conj(a)*rcp(a.r*a.r + a.i*a.i + a.j*a.j + a.k*a.k); }
|
||||
template<typename T> __forceinline QuaternionT<T> normalize ( const QuaternionT<T>& a ) { return a*rsqrt(a.r*a.r + a.i*a.i + a.j*a.j + a.k*a.k); }
|
||||
|
||||
// evaluates a*q-r
|
||||
template<typename T> __forceinline QuaternionT<T>
|
||||
msub(const T& a, const QuaternionT<T>& q, const QuaternionT<T>& p)
|
||||
{
|
||||
return QuaternionT<T>(msub(a, q.r, p.r),
|
||||
msub(a, q.i, p.i),
|
||||
msub(a, q.j, p.j),
|
||||
msub(a, q.k, p.k));
|
||||
}
|
||||
// evaluates a*q-r
|
||||
template<typename T> __forceinline QuaternionT<T>
|
||||
madd (const T& a, const QuaternionT<T>& q, const QuaternionT<T>& p)
|
||||
{
|
||||
return QuaternionT<T>(madd(a, q.r, p.r),
|
||||
madd(a, q.i, p.i),
|
||||
madd(a, q.j, p.j),
|
||||
madd(a, q.k, p.k));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Binary Operators
|
||||
////////////////////////////////////////////////////////////////
|
||||
@@ -119,22 +109,10 @@ namespace embree
|
||||
template<typename T> __forceinline QuaternionT<T>& operator /=( QuaternionT<T>& a, const T & b ) { return a = a*rcp(b); }
|
||||
template<typename T> __forceinline QuaternionT<T>& operator /=( QuaternionT<T>& a, const QuaternionT<T>& b ) { return a = a*rcp(b); }
|
||||
|
||||
template<typename T, typename M> __forceinline QuaternionT<T>
|
||||
select(const M& m, const QuaternionT<T>& q, const QuaternionT<T>& p)
|
||||
{
|
||||
return QuaternionT<T>(select(m, q.r, p.r),
|
||||
select(m, q.i, p.i),
|
||||
select(m, q.j, p.j),
|
||||
select(m, q.k, p.k));
|
||||
}
|
||||
|
||||
|
||||
template<typename T> __forceinline Vec3<T> xfmPoint ( const QuaternionT<T>& a, const Vec3<T>& b ) { return (a*QuaternionT<T>(b)*conj(a)).v(); }
|
||||
template<typename T> __forceinline Vec3<T> xfmVector( const QuaternionT<T>& a, const Vec3<T>& b ) { return (a*QuaternionT<T>(b)*conj(a)).v(); }
|
||||
template<typename T> __forceinline Vec3<T> xfmNormal( const QuaternionT<T>& a, const Vec3<T>& b ) { return (a*QuaternionT<T>(b)*conj(a)).v(); }
|
||||
|
||||
template<typename T> __forceinline T dot(const QuaternionT<T>& a, const QuaternionT<T>& b) { return a.r*b.r + a.i*b.i + a.j*b.j + a.k*b.k; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Comparison Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -201,54 +179,15 @@ namespace embree
|
||||
k = sro*cya*cpi - cro*sya*spi;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Output Operators
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename T> static embree_ostream operator<<(embree_ostream cout, const QuaternionT<T>& q) {
|
||||
template<typename T> static std::ostream& operator<<(std::ostream& cout, const QuaternionT<T>& q) {
|
||||
return cout << "{ r = " << q.r << ", i = " << q.i << ", j = " << q.j << ", k = " << q.k << " }";
|
||||
}
|
||||
|
||||
/*! default template instantiations */
|
||||
typedef QuaternionT<float> Quaternion3f;
|
||||
typedef QuaternionT<double> Quaternion3d;
|
||||
|
||||
template<int N> using Quaternion3vf = QuaternionT<vfloat<N>>;
|
||||
typedef QuaternionT<vfloat<4>> Quaternion3vf4;
|
||||
typedef QuaternionT<vfloat<8>> Quaternion3vf8;
|
||||
typedef QuaternionT<vfloat<16>> Quaternion3vf16;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// Interpolation
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template<typename T>
|
||||
__forceinline QuaternionT<T>lerp(const QuaternionT<T>& q0,
|
||||
const QuaternionT<T>& q1,
|
||||
const T& factor)
|
||||
{
|
||||
QuaternionT<T> q;
|
||||
q.r = lerp(q0.r, q1.r, factor);
|
||||
q.i = lerp(q0.i, q1.i, factor);
|
||||
q.j = lerp(q0.j, q1.j, factor);
|
||||
q.k = lerp(q0.k, q1.k, factor);
|
||||
return q;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
__forceinline QuaternionT<T> slerp(const QuaternionT<T>& q0,
|
||||
const QuaternionT<T>& q1_,
|
||||
const T& t)
|
||||
{
|
||||
T cosTheta = dot(q0, q1_);
|
||||
QuaternionT<T> q1 = select(cosTheta < 0.f, -q1_, q1_);
|
||||
cosTheta = select(cosTheta < 0.f, -cosTheta, cosTheta);
|
||||
if (unlikely(all(cosTheta > 0.9995f))) {
|
||||
return normalize(lerp(q0, q1, t));
|
||||
}
|
||||
const T phi = t * fastapprox::acos(cosTheta);
|
||||
T sinPhi, cosPhi;
|
||||
fastapprox::sincos(phi, sinPhi, cosPhi);
|
||||
QuaternionT<T> qperp = sinPhi * normalize(msub(cosTheta, q0, q1));
|
||||
return msub(cosPhi, q0, qperp);
|
||||
}
|
||||
}
|
||||
|
||||
+17
-4
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -74,7 +87,7 @@ namespace embree
|
||||
return r0.size() < r1.size();
|
||||
}
|
||||
|
||||
friend embree_ostream operator<<(embree_ostream cout, const range& r) {
|
||||
friend std::ostream& operator<<(std::ostream& cout, const range& r) {
|
||||
return cout << "range [" << r.begin() << ", " << r.end() << "]";
|
||||
}
|
||||
|
||||
@@ -128,7 +141,7 @@ namespace embree
|
||||
_ext_end += plus;
|
||||
}
|
||||
|
||||
friend embree_ostream operator<<(embree_ostream cout, const extended_range& r) {
|
||||
friend std::ostream& operator<<(std::ostream& cout, const extended_range& r) {
|
||||
return cout << "extended_range [" << r.begin() << ", " << r.end() << " (" << r.ext_end() << ")]";
|
||||
}
|
||||
|
||||
|
||||
@@ -1,525 +0,0 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#pragma once
|
||||
|
||||
// Transcendental functions from "ispc": https://github.com/ispc/ispc/
|
||||
// Most of the transcendental implementations in ispc code come from
|
||||
// Solomon Boulos's "syrah": https://github.com/boulos/syrah/
|
||||
|
||||
#include "../simd/simd.h"
|
||||
|
||||
namespace embree
|
||||
{
|
||||
|
||||
namespace fastapprox
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
__forceinline T sin(const T &v)
|
||||
{
|
||||
static const float piOverTwoVec = 1.57079637050628662109375;
|
||||
static const float twoOverPiVec = 0.636619746685028076171875;
|
||||
auto scaled = v * twoOverPiVec;
|
||||
auto kReal = floor(scaled);
|
||||
auto k = toInt(kReal);
|
||||
|
||||
// Reduced range version of x
|
||||
auto x = v - kReal * piOverTwoVec;
|
||||
auto kMod4 = k & 3;
|
||||
auto sinUseCos = (kMod4 == 1 | kMod4 == 3);
|
||||
auto flipSign = (kMod4 > 1);
|
||||
|
||||
// These coefficients are from sollya with fpminimax(sin(x)/x, [|0, 2,
|
||||
// 4, 6, 8, 10|], [|single...|], [0;Pi/2]);
|
||||
static const float sinC2 = -0.16666667163372039794921875;
|
||||
static const float sinC4 = +8.333347737789154052734375e-3;
|
||||
static const float sinC6 = -1.9842604524455964565277099609375e-4;
|
||||
static const float sinC8 = +2.760012648650445044040679931640625e-6;
|
||||
static const float sinC10 = -2.50293279435709337121807038784027099609375e-8;
|
||||
|
||||
static const float cosC2 = -0.5;
|
||||
static const float cosC4 = +4.166664183139801025390625e-2;
|
||||
static const float cosC6 = -1.388833043165504932403564453125e-3;
|
||||
static const float cosC8 = +2.47562347794882953166961669921875e-5;
|
||||
static const float cosC10 = -2.59630184018533327616751194000244140625e-7;
|
||||
|
||||
auto outside = select(sinUseCos, 1., x);
|
||||
auto c2 = select(sinUseCos, T(cosC2), T(sinC2));
|
||||
auto c4 = select(sinUseCos, T(cosC4), T(sinC4));
|
||||
auto c6 = select(sinUseCos, T(cosC6), T(sinC6));
|
||||
auto c8 = select(sinUseCos, T(cosC8), T(sinC8));
|
||||
auto c10 = select(sinUseCos, T(cosC10), T(sinC10));
|
||||
|
||||
auto x2 = x * x;
|
||||
auto formula = x2 * c10 + c8;
|
||||
formula = x2 * formula + c6;
|
||||
formula = x2 * formula + c4;
|
||||
formula = x2 * formula + c2;
|
||||
formula = x2 * formula + 1.;
|
||||
formula *= outside;
|
||||
|
||||
formula = select(flipSign, -formula, formula);
|
||||
return formula;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__forceinline T cos(const T &v)
|
||||
{
|
||||
static const float piOverTwoVec = 1.57079637050628662109375;
|
||||
static const float twoOverPiVec = 0.636619746685028076171875;
|
||||
auto scaled = v * twoOverPiVec;
|
||||
auto kReal = floor(scaled);
|
||||
auto k = toInt(kReal);
|
||||
|
||||
// Reduced range version of x
|
||||
auto x = v - kReal * piOverTwoVec;
|
||||
|
||||
auto kMod4 = k & 3;
|
||||
auto cosUseCos = (kMod4 == 0 | kMod4 == 2);
|
||||
auto flipSign = (kMod4 == 1 | kMod4 == 2);
|
||||
|
||||
const float sinC2 = -0.16666667163372039794921875;
|
||||
const float sinC4 = +8.333347737789154052734375e-3;
|
||||
const float sinC6 = -1.9842604524455964565277099609375e-4;
|
||||
const float sinC8 = +2.760012648650445044040679931640625e-6;
|
||||
const float sinC10 = -2.50293279435709337121807038784027099609375e-8;
|
||||
|
||||
const float cosC2 = -0.5;
|
||||
const float cosC4 = +4.166664183139801025390625e-2;
|
||||
const float cosC6 = -1.388833043165504932403564453125e-3;
|
||||
const float cosC8 = +2.47562347794882953166961669921875e-5;
|
||||
const float cosC10 = -2.59630184018533327616751194000244140625e-7;
|
||||
|
||||
auto outside = select(cosUseCos, 1., x);
|
||||
auto c2 = select(cosUseCos, T(cosC2), T(sinC2));
|
||||
auto c4 = select(cosUseCos, T(cosC4), T(sinC4));
|
||||
auto c6 = select(cosUseCos, T(cosC6), T(sinC6));
|
||||
auto c8 = select(cosUseCos, T(cosC8), T(sinC8));
|
||||
auto c10 = select(cosUseCos, T(cosC10), T(sinC10));
|
||||
|
||||
auto x2 = x * x;
|
||||
auto formula = x2 * c10 + c8;
|
||||
formula = x2 * formula + c6;
|
||||
formula = x2 * formula + c4;
|
||||
formula = x2 * formula + c2;
|
||||
formula = x2 * formula + 1.;
|
||||
formula *= outside;
|
||||
|
||||
formula = select(flipSign, -formula, formula);
|
||||
return formula;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__forceinline void sincos(const T &v, T &sinResult, T &cosResult)
|
||||
{
|
||||
const float piOverTwoVec = 1.57079637050628662109375;
|
||||
const float twoOverPiVec = 0.636619746685028076171875;
|
||||
auto scaled = v * twoOverPiVec;
|
||||
auto kReal = floor(scaled);
|
||||
auto k = toInt(kReal);
|
||||
|
||||
// Reduced range version of x
|
||||
auto x = v - kReal * piOverTwoVec;
|
||||
auto kMod4 = k & 3;
|
||||
auto cosUseCos = ((kMod4 == 0) | (kMod4 == 2));
|
||||
auto sinUseCos = ((kMod4 == 1) | (kMod4 == 3));
|
||||
auto sinFlipSign = (kMod4 > 1);
|
||||
auto cosFlipSign = ((kMod4 == 1) | (kMod4 == 2));
|
||||
|
||||
const float oneVec = +1.;
|
||||
const float sinC2 = -0.16666667163372039794921875;
|
||||
const float sinC4 = +8.333347737789154052734375e-3;
|
||||
const float sinC6 = -1.9842604524455964565277099609375e-4;
|
||||
const float sinC8 = +2.760012648650445044040679931640625e-6;
|
||||
const float sinC10 = -2.50293279435709337121807038784027099609375e-8;
|
||||
|
||||
const float cosC2 = -0.5;
|
||||
const float cosC4 = +4.166664183139801025390625e-2;
|
||||
const float cosC6 = -1.388833043165504932403564453125e-3;
|
||||
const float cosC8 = +2.47562347794882953166961669921875e-5;
|
||||
const float cosC10 = -2.59630184018533327616751194000244140625e-7;
|
||||
|
||||
auto x2 = x * x;
|
||||
|
||||
auto sinFormula = x2 * sinC10 + sinC8;
|
||||
auto cosFormula = x2 * cosC10 + cosC8;
|
||||
sinFormula = x2 * sinFormula + sinC6;
|
||||
cosFormula = x2 * cosFormula + cosC6;
|
||||
|
||||
sinFormula = x2 * sinFormula + sinC4;
|
||||
cosFormula = x2 * cosFormula + cosC4;
|
||||
|
||||
sinFormula = x2 * sinFormula + sinC2;
|
||||
cosFormula = x2 * cosFormula + cosC2;
|
||||
|
||||
sinFormula = x2 * sinFormula + oneVec;
|
||||
cosFormula = x2 * cosFormula + oneVec;
|
||||
|
||||
sinFormula *= x;
|
||||
|
||||
sinResult = select(sinUseCos, cosFormula, sinFormula);
|
||||
cosResult = select(cosUseCos, cosFormula, sinFormula);
|
||||
|
||||
sinResult = select(sinFlipSign, -sinResult, sinResult);
|
||||
cosResult = select(cosFlipSign, -cosResult, cosResult);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__forceinline T tan(const T &v)
|
||||
{
|
||||
const float piOverFourVec = 0.785398185253143310546875;
|
||||
const float fourOverPiVec = 1.27323949337005615234375;
|
||||
|
||||
auto xLt0 = v < 0.;
|
||||
auto y = select(xLt0, -v, v);
|
||||
auto scaled = y * fourOverPiVec;
|
||||
|
||||
auto kReal = floor(scaled);
|
||||
auto k = toInt(kReal);
|
||||
|
||||
auto x = y - kReal * piOverFourVec;
|
||||
|
||||
// If k & 1, x -= Pi/4
|
||||
auto needOffset = (k & 1) != 0;
|
||||
x = select(needOffset, x - piOverFourVec, x);
|
||||
|
||||
// If k & 3 == (0 or 3) let z = tan_In...(y) otherwise z = -cot_In0To...
|
||||
auto kMod4 = k & 3;
|
||||
auto useCotan = (kMod4 == 1) | (kMod4 == 2);
|
||||
|
||||
const float oneVec = 1.0;
|
||||
|
||||
const float tanC2 = +0.33333075046539306640625;
|
||||
const float tanC4 = +0.13339905440807342529296875;
|
||||
const float tanC6 = +5.3348250687122344970703125e-2;
|
||||
const float tanC8 = +2.46033705770969390869140625e-2;
|
||||
const float tanC10 = +2.892402000725269317626953125e-3;
|
||||
const float tanC12 = +9.500005282461643218994140625e-3;
|
||||
|
||||
const float cotC2 = -0.3333333432674407958984375;
|
||||
const float cotC4 = -2.222204394638538360595703125e-2;
|
||||
const float cotC6 = -2.11752182804048061370849609375e-3;
|
||||
const float cotC8 = -2.0846328698098659515380859375e-4;
|
||||
const float cotC10 = -2.548247357481159269809722900390625e-5;
|
||||
const float cotC12 = -3.5257363606433500535786151885986328125e-7;
|
||||
|
||||
auto x2 = x * x;
|
||||
T z;
|
||||
if (any(useCotan))
|
||||
{
|
||||
auto cotVal = x2 * cotC12 + cotC10;
|
||||
cotVal = x2 * cotVal + cotC8;
|
||||
cotVal = x2 * cotVal + cotC6;
|
||||
cotVal = x2 * cotVal + cotC4;
|
||||
cotVal = x2 * cotVal + cotC2;
|
||||
cotVal = x2 * cotVal + oneVec;
|
||||
// The equation is for x * cot(x) but we need -x * cot(x) for the tan part.
|
||||
cotVal /= -x;
|
||||
z = cotVal;
|
||||
}
|
||||
auto useTan = !useCotan;
|
||||
if (any(useTan))
|
||||
{
|
||||
auto tanVal = x2 * tanC12 + tanC10;
|
||||
tanVal = x2 * tanVal + tanC8;
|
||||
tanVal = x2 * tanVal + tanC6;
|
||||
tanVal = x2 * tanVal + tanC4;
|
||||
tanVal = x2 * tanVal + tanC2;
|
||||
tanVal = x2 * tanVal + oneVec;
|
||||
// Equation was for tan(x)/x
|
||||
tanVal *= x;
|
||||
z = select(useTan, tanVal, z);
|
||||
}
|
||||
return select(xLt0, -z, z);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__forceinline T asin(const T &x0)
|
||||
{
|
||||
auto isneg = (x0 < 0.f);
|
||||
auto x = abs(x0);
|
||||
auto isnan = (x > 1.f);
|
||||
|
||||
// sollya
|
||||
// fpminimax(((asin(x)-pi/2)/-sqrt(1-x)), [|0,1,2,3,4,5|],[|single...|],
|
||||
// [1e-20;.9999999999999999]);
|
||||
// avg error: 1.1105439e-06, max error 1.3187528e-06
|
||||
auto v = 1.57079517841339111328125f +
|
||||
x * (-0.21450997889041900634765625f +
|
||||
x * (8.78556668758392333984375e-2f +
|
||||
x * (-4.489909112453460693359375e-2f +
|
||||
x * (1.928029954433441162109375e-2f +
|
||||
x * (-4.3095736764371395111083984375e-3f)))));
|
||||
|
||||
v *= -sqrt(1.f - x);
|
||||
v = v + 1.57079637050628662109375f;
|
||||
|
||||
v = select(v < 0.f, T(0.f), v);
|
||||
v = select(isneg, -v, v);
|
||||
v = select(isnan, T(cast_i2f(0x7fc00000)), v);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__forceinline T acos(const T &v)
|
||||
{
|
||||
return 1.57079637050628662109375f - asin(v);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__forceinline T atan(const T &v)
|
||||
{
|
||||
const float piOverTwoVec = 1.57079637050628662109375;
|
||||
// atan(-x) = -atan(x) (so flip from negative to positive first)
|
||||
// If x > 1 -> atan(x) = Pi/2 - atan(1/x)
|
||||
auto xNeg = v < 0.f;
|
||||
auto xFlipped = select(xNeg, -v, v);
|
||||
|
||||
auto xGt1 = xFlipped > 1.;
|
||||
auto x = select(xGt1, rcpSafe(xFlipped), xFlipped);
|
||||
|
||||
// These coefficients approximate atan(x)/x
|
||||
const float atanC0 = +0.99999988079071044921875;
|
||||
const float atanC2 = -0.3333191573619842529296875;
|
||||
const float atanC4 = +0.199689209461212158203125;
|
||||
const float atanC6 = -0.14015688002109527587890625;
|
||||
const float atanC8 = +9.905083477497100830078125e-2;
|
||||
const float atanC10 = -5.93664981424808502197265625e-2;
|
||||
const float atanC12 = +2.417283318936824798583984375e-2;
|
||||
const float atanC14 = -4.6721356920897960662841796875e-3;
|
||||
|
||||
auto x2 = x * x;
|
||||
auto result = x2 * atanC14 + atanC12;
|
||||
result = x2 * result + atanC10;
|
||||
result = x2 * result + atanC8;
|
||||
result = x2 * result + atanC6;
|
||||
result = x2 * result + atanC4;
|
||||
result = x2 * result + atanC2;
|
||||
result = x2 * result + atanC0;
|
||||
result *= x;
|
||||
|
||||
result = select(xGt1, piOverTwoVec - result, result);
|
||||
result = select(xNeg, -result, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__forceinline T atan2(const T &y, const T &x)
|
||||
{
|
||||
const float piVec = 3.1415926536;
|
||||
// atan2(y, x) =
|
||||
//
|
||||
// atan2(y > 0, x = +-0) -> Pi/2
|
||||
// atan2(y < 0, x = +-0) -> -Pi/2
|
||||
// atan2(y = +-0, x < +0) -> +-Pi
|
||||
// atan2(y = +-0, x >= +0) -> +-0
|
||||
//
|
||||
// atan2(y >= 0, x < 0) -> Pi + atan(y/x)
|
||||
// atan2(y < 0, x < 0) -> -Pi + atan(y/x)
|
||||
// atan2(y, x > 0) -> atan(y/x)
|
||||
//
|
||||
// and then a bunch of code for dealing with infinities.
|
||||
auto yOverX = y * rcpSafe(x);
|
||||
auto atanArg = atan(yOverX);
|
||||
auto xLt0 = x < 0.f;
|
||||
auto yLt0 = y < 0.f;
|
||||
auto offset = select(xLt0,
|
||||
select(yLt0, T(-piVec), T(piVec)), 0.f);
|
||||
return offset + atanArg;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__forceinline T exp(const T &v)
|
||||
{
|
||||
const float ln2Part1 = 0.6931457519;
|
||||
const float ln2Part2 = 1.4286067653e-6;
|
||||
const float oneOverLn2 = 1.44269502162933349609375;
|
||||
|
||||
auto scaled = v * oneOverLn2;
|
||||
auto kReal = floor(scaled);
|
||||
auto k = toInt(kReal);
|
||||
|
||||
// Reduced range version of x
|
||||
auto x = v - kReal * ln2Part1;
|
||||
x -= kReal * ln2Part2;
|
||||
|
||||
// These coefficients are for e^x in [0, ln(2)]
|
||||
const float one = 1.;
|
||||
const float c2 = 0.4999999105930328369140625;
|
||||
const float c3 = 0.166668415069580078125;
|
||||
const float c4 = 4.16539050638675689697265625e-2;
|
||||
const float c5 = 8.378830738365650177001953125e-3;
|
||||
const float c6 = 1.304379315115511417388916015625e-3;
|
||||
const float c7 = 2.7555381529964506626129150390625e-4;
|
||||
|
||||
auto result = x * c7 + c6;
|
||||
result = x * result + c5;
|
||||
result = x * result + c4;
|
||||
result = x * result + c3;
|
||||
result = x * result + c2;
|
||||
result = x * result + one;
|
||||
result = x * result + one;
|
||||
|
||||
// Compute 2^k (should differ for float and double, but I'll avoid
|
||||
// it for now and just do floats)
|
||||
const int fpbias = 127;
|
||||
auto biasedN = k + fpbias;
|
||||
auto overflow = kReal > fpbias;
|
||||
// Minimum exponent is -126, so if k is <= -127 (k + 127 <= 0)
|
||||
// we've got underflow. -127 * ln(2) -> -88.02. So the most
|
||||
// negative float input that doesn't result in zero is like -88.
|
||||
auto underflow = kReal <= -fpbias;
|
||||
const int infBits = 0x7f800000;
|
||||
biasedN <<= 23;
|
||||
// Reinterpret this thing as float
|
||||
auto twoToTheN = asFloat(biasedN);
|
||||
// Handle both doubles and floats (hopefully eliding the copy for float)
|
||||
auto elemtype2n = twoToTheN;
|
||||
result *= elemtype2n;
|
||||
result = select(overflow, cast_i2f(infBits), result);
|
||||
result = select(underflow, 0., result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// Range reduction for logarithms takes log(x) -> log(2^n * y) -> n
|
||||
// * log(2) + log(y) where y is the reduced range (usually in [1/2, 1)).
|
||||
template <typename T, typename R>
|
||||
__forceinline void __rangeReduceLog(const T &input,
|
||||
T &reduced,
|
||||
R &exponent)
|
||||
{
|
||||
auto intVersion = asInt(input);
|
||||
// single precision = SEEE EEEE EMMM MMMM MMMM MMMM MMMM MMMM
|
||||
// exponent mask = 0111 1111 1000 0000 0000 0000 0000 0000
|
||||
// 0x7 0xF 0x8 0x0 0x0 0x0 0x0 0x0
|
||||
// non-exponent = 1000 0000 0111 1111 1111 1111 1111 1111
|
||||
// = 0x8 0x0 0x7 0xF 0xF 0xF 0xF 0xF
|
||||
|
||||
//const int exponentMask(0x7F800000)
|
||||
static const int nonexponentMask = 0x807FFFFF;
|
||||
|
||||
// We want the reduced version to have an exponent of -1 which is
|
||||
// -1 + 127 after biasing or 126
|
||||
static const int exponentNeg1 = (126l << 23);
|
||||
// NOTE(boulos): We don't need to mask anything out since we know
|
||||
// the sign bit has to be 0. If it's 1, we need to return infinity/nan
|
||||
// anyway (log(x), x = +-0 -> infinity, x < 0 -> NaN).
|
||||
auto biasedExponent = intVersion >> 23; // This number is [0, 255] but it means [-127, 128]
|
||||
|
||||
auto offsetExponent = biasedExponent + 1; // Treat the number as if it were 2^{e+1} * (1.m)/2
|
||||
exponent = offsetExponent - 127; // get the real value
|
||||
|
||||
// Blend the offset_exponent with the original input (do this in
|
||||
// int for now, until I decide if float can have & and ¬)
|
||||
auto blended = (intVersion & nonexponentMask) | (exponentNeg1);
|
||||
reduced = asFloat(blended);
|
||||
}
|
||||
|
||||
template <typename T> struct ExponentType { };
|
||||
template <int N> struct ExponentType<vfloat<N>> { typedef vint<N> Ty; };
|
||||
template <> struct ExponentType<float> { typedef int Ty; };
|
||||
|
||||
template <typename T>
|
||||
__forceinline T log(const T &v)
|
||||
{
|
||||
T reduced;
|
||||
typename ExponentType<T>::Ty exponent;
|
||||
|
||||
const int nanBits = 0x7fc00000;
|
||||
const int negInfBits = 0xFF800000;
|
||||
const float nan = cast_i2f(nanBits);
|
||||
const float negInf = cast_i2f(negInfBits);
|
||||
auto useNan = v < 0.;
|
||||
auto useInf = v == 0.;
|
||||
auto exceptional = useNan | useInf;
|
||||
const float one = 1.0;
|
||||
|
||||
auto patched = select(exceptional, one, v);
|
||||
__rangeReduceLog(patched, reduced, exponent);
|
||||
|
||||
const float ln2 = 0.693147182464599609375;
|
||||
|
||||
auto x1 = one - reduced;
|
||||
const float c1 = +0.50000095367431640625;
|
||||
const float c2 = +0.33326041698455810546875;
|
||||
const float c3 = +0.2519190013408660888671875;
|
||||
const float c4 = +0.17541764676570892333984375;
|
||||
const float c5 = +0.3424419462680816650390625;
|
||||
const float c6 = -0.599632322788238525390625;
|
||||
const float c7 = +1.98442304134368896484375;
|
||||
const float c8 = -2.4899270534515380859375;
|
||||
const float c9 = +1.7491014003753662109375;
|
||||
|
||||
auto result = x1 * c9 + c8;
|
||||
result = x1 * result + c7;
|
||||
result = x1 * result + c6;
|
||||
result = x1 * result + c5;
|
||||
result = x1 * result + c4;
|
||||
result = x1 * result + c3;
|
||||
result = x1 * result + c2;
|
||||
result = x1 * result + c1;
|
||||
result = x1 * result + one;
|
||||
|
||||
// Equation was for -(ln(red)/(1-red))
|
||||
result *= -x1;
|
||||
result += toFloat(exponent) * ln2;
|
||||
|
||||
return select(exceptional,
|
||||
select(useNan, T(nan), T(negInf)),
|
||||
result);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__forceinline T pow(const T &x, const T &y)
|
||||
{
|
||||
auto x1 = abs(x);
|
||||
auto z = exp(y * log(x1));
|
||||
|
||||
// Handle special cases
|
||||
const float twoOver23 = 8388608.0f;
|
||||
auto yInt = y == round(y);
|
||||
auto yOddInt = select(yInt, asInt(abs(y) + twoOver23) << 31, 0); // set sign bit
|
||||
|
||||
// x == 0
|
||||
z = select(x == 0.0f,
|
||||
select(y < 0.0f, T(inf) | signmsk(x),
|
||||
select(y == 0.0f, T(1.0f), asFloat(yOddInt) & x)), z);
|
||||
|
||||
// x < 0
|
||||
auto xNegative = x < 0.0f;
|
||||
if (any(xNegative))
|
||||
{
|
||||
auto z1 = z | asFloat(yOddInt);
|
||||
z1 = select(yInt, z1, std::numeric_limits<float>::quiet_NaN());
|
||||
z = select(xNegative, z1, z);
|
||||
}
|
||||
|
||||
auto xFinite = isfinite(x);
|
||||
auto yFinite = isfinite(y);
|
||||
if (all(xFinite & yFinite))
|
||||
return z;
|
||||
|
||||
// x finite and y infinite
|
||||
z = select(andn(xFinite, yFinite),
|
||||
select(x1 == 1.0f, 1.0f,
|
||||
select((x1 > 1.0f) ^ (y < 0.0f), inf, T(0.0f))), z);
|
||||
|
||||
// x infinite
|
||||
z = select(xFinite, z,
|
||||
select(y == 0.0f, 1.0f,
|
||||
select(y < 0.0f, T(0.0f), inf) | (asFloat(yOddInt) & x)));
|
||||
|
||||
return z;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__forceinline T pow(const T &x, float y)
|
||||
{
|
||||
return pow(x, T(y));
|
||||
}
|
||||
|
||||
} // namespace fastapprox
|
||||
|
||||
} // namespace embree
|
||||
+29
-76
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -7,23 +20,16 @@
|
||||
|
||||
namespace embree
|
||||
{
|
||||
struct Vec2fa;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Generic 2D vector Class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename T> struct Vec2
|
||||
{
|
||||
enum { N = 2 };
|
||||
union {
|
||||
struct { T x, y; };
|
||||
#if !(defined(__WIN32__) && _MSC_VER == 1800) // workaround for older VS 2013 compiler
|
||||
T components[N];
|
||||
#endif
|
||||
};
|
||||
T x, y;
|
||||
|
||||
typedef T Scalar;
|
||||
enum { N = 2 };
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Construction
|
||||
@@ -34,13 +40,9 @@ namespace embree
|
||||
__forceinline Vec2( const T& x, const T& y ) : x(x), y(y) {}
|
||||
|
||||
__forceinline Vec2( const Vec2& other ) { x = other.x; y = other.y; }
|
||||
__forceinline Vec2( const Vec2fa& other );
|
||||
|
||||
template<typename T1> __forceinline Vec2( const Vec2<T1>& a ) : x(T(a.x)), y(T(a.y)) {}
|
||||
template<typename T1> __forceinline Vec2& operator =( const Vec2<T1>& other ) { x = other.x; y = other.y; return *this; }
|
||||
|
||||
__forceinline Vec2& operator =( const Vec2& other ) { x = other.x; y = other.y; return *this; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Constants
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -50,13 +52,8 @@ namespace embree
|
||||
__forceinline Vec2( PosInfTy ) : x(pos_inf), y(pos_inf) {}
|
||||
__forceinline Vec2( NegInfTy ) : x(neg_inf), y(neg_inf) {}
|
||||
|
||||
#if defined(__WIN32__) && _MSC_VER == 1800 // workaround for older VS 2013 compiler
|
||||
__forceinline const T& operator [](const size_t axis) const { assert(axis < 2); return (&x)[axis]; }
|
||||
__forceinline T& operator [](const size_t axis) { assert(axis < 2); return (&x)[axis]; }
|
||||
#else
|
||||
__forceinline const T& operator [](const size_t axis) const { assert(axis < 2); return components[axis]; }
|
||||
__forceinline T& operator [](const size_t axis ) { assert(axis < 2); return components[axis]; }
|
||||
#endif
|
||||
__forceinline const T& operator []( const size_t axis ) const { assert(axis < 2); return (&x)[axis]; }
|
||||
__forceinline T& operator []( const size_t axis ) { assert(axis < 2); return (&x)[axis]; }
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -95,15 +92,15 @@ namespace embree
|
||||
/// Ternary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename T> __forceinline Vec2<T> madd ( const Vec2<T>& a, const Vec2<T>& b, const Vec2<T>& c) { return Vec2<T>( madd(a.x,b.x,c.x), madd(a.y,b.y,c.y) ); }
|
||||
template<typename T> __forceinline Vec2<T> msub ( const Vec2<T>& a, const Vec2<T>& b, const Vec2<T>& c) { return Vec2<T>( msub(a.x,b.x,c.x), msub(a.y,b.y,c.y) ); }
|
||||
template<typename T> __forceinline Vec2<T> nmadd ( const Vec2<T>& a, const Vec2<T>& b, const Vec2<T>& c) { return Vec2<T>(nmadd(a.x,b.x,c.x),nmadd(a.y,b.y,c.y) ); }
|
||||
template<typename T> __forceinline Vec2<T> nmsub ( const Vec2<T>& a, const Vec2<T>& b, const Vec2<T>& c) { return Vec2<T>(nmsub(a.x,b.x,c.x),nmsub(a.y,b.y,c.y) ); }
|
||||
template<typename T> __forceinline const Vec2<T> madd ( const Vec2<T>& a, const Vec2<T>& b, const Vec2<T>& c) { return Vec2<T>( madd(a.x,b.x,c.x), madd(a.y,b.y,c.y) ); }
|
||||
template<typename T> __forceinline const Vec2<T> msub ( const Vec2<T>& a, const Vec2<T>& b, const Vec2<T>& c) { return Vec2<T>( msub(a.x,b.x,c.x), msub(a.y,b.y,c.y) ); }
|
||||
template<typename T> __forceinline const Vec2<T> nmadd ( const Vec2<T>& a, const Vec2<T>& b, const Vec2<T>& c) { return Vec2<T>(nmadd(a.x,b.x,c.x),nmadd(a.y,b.y,c.y) ); }
|
||||
template<typename T> __forceinline const Vec2<T> nmsub ( const Vec2<T>& a, const Vec2<T>& b, const Vec2<T>& c) { return Vec2<T>(nmsub(a.x,b.x,c.x),nmsub(a.y,b.y,c.y) ); }
|
||||
|
||||
template<typename T> __forceinline Vec2<T> madd ( const T& a, const Vec2<T>& b, const Vec2<T>& c) { return Vec2<T>( madd(a,b.x,c.x), madd(a,b.y,c.y) ); }
|
||||
template<typename T> __forceinline Vec2<T> msub ( const T& a, const Vec2<T>& b, const Vec2<T>& c) { return Vec2<T>( msub(a,b.x,c.x), msub(a,b.y,c.y) ); }
|
||||
template<typename T> __forceinline Vec2<T> nmadd ( const T& a, const Vec2<T>& b, const Vec2<T>& c) { return Vec2<T>(nmadd(a,b.x,c.x),nmadd(a,b.y,c.y) ); }
|
||||
template<typename T> __forceinline Vec2<T> nmsub ( const T& a, const Vec2<T>& b, const Vec2<T>& c) { return Vec2<T>(nmsub(a,b.x,c.x),nmsub(a,b.y,c.y) ); }
|
||||
template<typename T> __forceinline const Vec2<T> madd ( const T& a, const Vec2<T>& b, const Vec2<T>& c) { return Vec2<T>( madd(a,b.x,c.x), madd(a,b.y,c.y) ); }
|
||||
template<typename T> __forceinline const Vec2<T> msub ( const T& a, const Vec2<T>& b, const Vec2<T>& c) { return Vec2<T>( msub(a,b.x,c.x), msub(a,b.y,c.y) ); }
|
||||
template<typename T> __forceinline const Vec2<T> nmadd ( const T& a, const Vec2<T>& b, const Vec2<T>& c) { return Vec2<T>(nmadd(a,b.x,c.x),nmadd(a,b.y,c.y) ); }
|
||||
template<typename T> __forceinline const Vec2<T> nmsub ( const T& a, const Vec2<T>& b, const Vec2<T>& c) { return Vec2<T>(nmsub(a,b.x,c.x),nmsub(a,b.y,c.y) ); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Assignment Operators
|
||||
@@ -135,20 +132,12 @@ namespace embree
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Shift Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename T> __forceinline Vec2<T> shift_right_1( const Vec2<T>& a ) {
|
||||
return Vec2<T>(shift_right_1(a.x),shift_right_1(a.y));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Euclidian Space Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename T> __forceinline T dot ( const Vec2<T>& a, const Vec2<T>& b ) { return madd(a.x,b.x,a.y*b.y); }
|
||||
template<typename T> __forceinline Vec2<T> cross ( const Vec2<T>& a ) { return Vec2<T>(-a.y,a.x); }
|
||||
|
||||
template<typename T> __forceinline T length ( const Vec2<T>& a ) { return sqrt(dot(a,a)); }
|
||||
template<typename T> __forceinline Vec2<T> normalize( const Vec2<T>& a ) { return a*rsqrt(dot(a,a)); }
|
||||
template<typename T> __forceinline T distance ( const Vec2<T>& a, const Vec2<T>& b ) { return length(a-b); }
|
||||
@@ -174,11 +163,6 @@ namespace embree
|
||||
return Vec2<T>(select(s,t.x,f.x),select(s,t.y,f.y));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
__forceinline Vec2<T> lerp(const Vec2<T>& v0, const Vec2<T>& v1, const T& t) {
|
||||
return madd(Vec2<T>(T(1.0f)-t),v0,t*v1);
|
||||
}
|
||||
|
||||
template<typename T> __forceinline int maxDim ( const Vec2<T>& a )
|
||||
{
|
||||
const Vec2<T> b = abs(a);
|
||||
@@ -190,7 +174,7 @@ namespace embree
|
||||
/// Output Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename T> __forceinline embree_ostream operator<<(embree_ostream cout, const Vec2<T>& a) {
|
||||
template<typename T> inline std::ostream& operator<<(std::ostream& cout, const Vec2<T>& a) {
|
||||
return cout << "(" << a.x << ", " << a.y << ")";
|
||||
}
|
||||
|
||||
@@ -202,34 +186,3 @@ namespace embree
|
||||
typedef Vec2<int > Vec2i;
|
||||
typedef Vec2<float> Vec2f;
|
||||
}
|
||||
|
||||
#include "vec2fa.h"
|
||||
|
||||
#if defined __SSE__
|
||||
#include "../simd/sse.h"
|
||||
#endif
|
||||
|
||||
#if defined __AVX__
|
||||
#include "../simd/avx.h"
|
||||
#endif
|
||||
|
||||
#if defined(__AVX512F__)
|
||||
#include "../simd/avx512.h"
|
||||
#endif
|
||||
|
||||
namespace embree
|
||||
{
|
||||
template<> __forceinline Vec2<float>::Vec2(const Vec2fa& a) : x(a.x), y(a.y) {}
|
||||
|
||||
#if defined(__SSE__)
|
||||
template<> __forceinline Vec2<vfloat4>::Vec2(const Vec2fa& a) : x(a.x), y(a.y) {}
|
||||
#endif
|
||||
|
||||
#if defined(__AVX__)
|
||||
template<> __forceinline Vec2<vfloat8>::Vec2(const Vec2fa& a) : x(a.x), y(a.y) {}
|
||||
#endif
|
||||
|
||||
#if defined(__AVX512F__)
|
||||
template<> __forceinline Vec2<vfloat16>::Vec2(const Vec2fa& a) : x(a.x), y(a.y) {}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,297 +0,0 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../sys/alloc.h"
|
||||
#include "math.h"
|
||||
#include "../simd/sse.h"
|
||||
|
||||
namespace embree
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// SSE Vec2fa Type
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct __aligned(16) Vec2fa
|
||||
{
|
||||
ALIGNED_STRUCT_(16);
|
||||
|
||||
typedef float Scalar;
|
||||
enum { N = 2 };
|
||||
union {
|
||||
__m128 m128;
|
||||
struct { float x,y,az,aw; };
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Constructors, Assignment & Cast Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline Vec2fa( ) {}
|
||||
__forceinline Vec2fa( const __m128 a ) : m128(a) {}
|
||||
|
||||
__forceinline Vec2fa ( const Vec2<float>& other ) { x = other.x; y = other.y; }
|
||||
__forceinline Vec2fa& operator =( const Vec2<float>& other ) { x = other.x; y = other.y; return *this; }
|
||||
|
||||
__forceinline Vec2fa ( const Vec2fa& other ) { m128 = other.m128; }
|
||||
__forceinline Vec2fa& operator =( const Vec2fa& other ) { m128 = other.m128; return *this; }
|
||||
|
||||
__forceinline explicit Vec2fa( const float a ) : m128(_mm_set1_ps(a)) {}
|
||||
__forceinline Vec2fa( const float x, const float y) : m128(_mm_set_ps(y, y, y, x)) {}
|
||||
|
||||
__forceinline explicit Vec2fa( const __m128i a ) : m128(_mm_cvtepi32_ps(a)) {}
|
||||
|
||||
__forceinline operator const __m128&() const { return m128; }
|
||||
__forceinline operator __m128&() { return m128; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Loads and Stores
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static __forceinline Vec2fa load( const void* const a ) {
|
||||
return Vec2fa(_mm_and_ps(_mm_load_ps((float*)a),_mm_castsi128_ps(_mm_set_epi32(0, 0, -1, -1))));
|
||||
}
|
||||
|
||||
static __forceinline Vec2fa loadu( const void* const a ) {
|
||||
return Vec2fa(_mm_and_ps(_mm_loadu_ps((float*)a),_mm_castsi128_ps(_mm_set_epi32(0, 0, -1, -1))));
|
||||
}
|
||||
|
||||
static __forceinline void storeu ( void* ptr, const Vec2fa& v ) {
|
||||
_mm_storeu_ps((float*)ptr,v);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Constants
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline Vec2fa( ZeroTy ) : m128(_mm_setzero_ps()) {}
|
||||
__forceinline Vec2fa( OneTy ) : m128(_mm_set1_ps(1.0f)) {}
|
||||
__forceinline Vec2fa( PosInfTy ) : m128(_mm_set1_ps(pos_inf)) {}
|
||||
__forceinline Vec2fa( NegInfTy ) : m128(_mm_set1_ps(neg_inf)) {}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Array Access
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline const float& operator []( const size_t index ) const { assert(index < 2); return (&x)[index]; }
|
||||
__forceinline float& operator []( const size_t index ) { assert(index < 2); return (&x)[index]; }
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Unary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline Vec2fa operator +( const Vec2fa& a ) { return a; }
|
||||
__forceinline Vec2fa operator -( const Vec2fa& a ) {
|
||||
const __m128 mask = _mm_castsi128_ps(_mm_set1_epi32(0x80000000));
|
||||
return _mm_xor_ps(a.m128, mask);
|
||||
}
|
||||
__forceinline Vec2fa abs ( const Vec2fa& a ) {
|
||||
const __m128 mask = _mm_castsi128_ps(_mm_set1_epi32(0x7fffffff));
|
||||
return _mm_and_ps(a.m128, mask);
|
||||
}
|
||||
__forceinline Vec2fa sign ( const Vec2fa& a ) {
|
||||
return blendv_ps(Vec2fa(one), -Vec2fa(one), _mm_cmplt_ps (a,Vec2fa(zero)));
|
||||
}
|
||||
|
||||
__forceinline Vec2fa rcp ( const Vec2fa& a )
|
||||
{
|
||||
#if defined(__AVX512VL__)
|
||||
const Vec2fa r = _mm_rcp14_ps(a.m128);
|
||||
#else
|
||||
const Vec2fa r = _mm_rcp_ps(a.m128);
|
||||
#endif
|
||||
|
||||
#if defined(__AVX2__)
|
||||
const Vec2fa res = _mm_mul_ps(r,_mm_fnmadd_ps(r, a, vfloat4(2.0f)));
|
||||
#else
|
||||
const Vec2fa res = _mm_mul_ps(r,_mm_sub_ps(vfloat4(2.0f), _mm_mul_ps(r, a)));
|
||||
//return _mm_sub_ps(_mm_add_ps(r, r), _mm_mul_ps(_mm_mul_ps(r, r), a));
|
||||
#endif
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
__forceinline Vec2fa sqrt ( const Vec2fa& a ) { return _mm_sqrt_ps(a.m128); }
|
||||
__forceinline Vec2fa sqr ( const Vec2fa& a ) { return _mm_mul_ps(a,a); }
|
||||
|
||||
__forceinline Vec2fa rsqrt( const Vec2fa& a )
|
||||
{
|
||||
#if defined(__AVX512VL__)
|
||||
__m128 r = _mm_rsqrt14_ps(a.m128);
|
||||
#else
|
||||
__m128 r = _mm_rsqrt_ps(a.m128);
|
||||
#endif
|
||||
return _mm_add_ps(_mm_mul_ps(_mm_set1_ps(1.5f),r), _mm_mul_ps(_mm_mul_ps(_mm_mul_ps(a, _mm_set1_ps(-0.5f)), r), _mm_mul_ps(r, r)));
|
||||
}
|
||||
|
||||
__forceinline Vec2fa zero_fix(const Vec2fa& a) {
|
||||
return blendv_ps(a, _mm_set1_ps(min_rcp_input), _mm_cmplt_ps (abs(a).m128, _mm_set1_ps(min_rcp_input)));
|
||||
}
|
||||
__forceinline Vec2fa rcp_safe(const Vec2fa& a) {
|
||||
return rcp(zero_fix(a));
|
||||
}
|
||||
__forceinline Vec2fa log ( const Vec2fa& a ) {
|
||||
return Vec2fa(logf(a.x),logf(a.y));
|
||||
}
|
||||
|
||||
__forceinline Vec2fa exp ( const Vec2fa& a ) {
|
||||
return Vec2fa(expf(a.x),expf(a.y));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Binary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline Vec2fa operator +( const Vec2fa& a, const Vec2fa& b ) { return _mm_add_ps(a.m128, b.m128); }
|
||||
__forceinline Vec2fa operator -( const Vec2fa& a, const Vec2fa& b ) { return _mm_sub_ps(a.m128, b.m128); }
|
||||
__forceinline Vec2fa operator *( const Vec2fa& a, const Vec2fa& b ) { return _mm_mul_ps(a.m128, b.m128); }
|
||||
__forceinline Vec2fa operator *( const Vec2fa& a, const float b ) { return a * Vec2fa(b); }
|
||||
__forceinline Vec2fa operator *( const float a, const Vec2fa& b ) { return Vec2fa(a) * b; }
|
||||
__forceinline Vec2fa operator /( const Vec2fa& a, const Vec2fa& b ) { return _mm_div_ps(a.m128,b.m128); }
|
||||
__forceinline Vec2fa operator /( const Vec2fa& a, const float b ) { return _mm_div_ps(a.m128,_mm_set1_ps(b)); }
|
||||
__forceinline Vec2fa operator /( const float a, const Vec2fa& b ) { return _mm_div_ps(_mm_set1_ps(a),b.m128); }
|
||||
|
||||
__forceinline Vec2fa min( const Vec2fa& a, const Vec2fa& b ) { return _mm_min_ps(a.m128,b.m128); }
|
||||
__forceinline Vec2fa max( const Vec2fa& a, const Vec2fa& b ) { return _mm_max_ps(a.m128,b.m128); }
|
||||
|
||||
#if defined(__SSE4_1__)
|
||||
__forceinline Vec2fa mini(const Vec2fa& a, const Vec2fa& b) {
|
||||
const vint4 ai = _mm_castps_si128(a);
|
||||
const vint4 bi = _mm_castps_si128(b);
|
||||
const vint4 ci = _mm_min_epi32(ai,bi);
|
||||
return _mm_castsi128_ps(ci);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__SSE4_1__)
|
||||
__forceinline Vec2fa maxi(const Vec2fa& a, const Vec2fa& b) {
|
||||
const vint4 ai = _mm_castps_si128(a);
|
||||
const vint4 bi = _mm_castps_si128(b);
|
||||
const vint4 ci = _mm_max_epi32(ai,bi);
|
||||
return _mm_castsi128_ps(ci);
|
||||
}
|
||||
#endif
|
||||
|
||||
__forceinline Vec2fa pow ( const Vec2fa& a, const float& b ) {
|
||||
return Vec2fa(powf(a.x,b),powf(a.y,b));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Ternary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if defined(__AVX2__)
|
||||
__forceinline Vec2fa madd ( const Vec2fa& a, const Vec2fa& b, const Vec2fa& c) { return _mm_fmadd_ps(a,b,c); }
|
||||
__forceinline Vec2fa msub ( const Vec2fa& a, const Vec2fa& b, const Vec2fa& c) { return _mm_fmsub_ps(a,b,c); }
|
||||
__forceinline Vec2fa nmadd ( const Vec2fa& a, const Vec2fa& b, const Vec2fa& c) { return _mm_fnmadd_ps(a,b,c); }
|
||||
__forceinline Vec2fa nmsub ( const Vec2fa& a, const Vec2fa& b, const Vec2fa& c) { return _mm_fnmsub_ps(a,b,c); }
|
||||
#else
|
||||
__forceinline Vec2fa madd ( const Vec2fa& a, const Vec2fa& b, const Vec2fa& c) { return a*b+c; }
|
||||
__forceinline Vec2fa msub ( const Vec2fa& a, const Vec2fa& b, const Vec2fa& c) { return a*b-c; }
|
||||
__forceinline Vec2fa nmadd ( const Vec2fa& a, const Vec2fa& b, const Vec2fa& c) { return -a*b+c;}
|
||||
__forceinline Vec2fa nmsub ( const Vec2fa& a, const Vec2fa& b, const Vec2fa& c) { return -a*b-c; }
|
||||
#endif
|
||||
|
||||
__forceinline Vec2fa madd ( const float a, const Vec2fa& b, const Vec2fa& c) { return madd(Vec2fa(a),b,c); }
|
||||
__forceinline Vec2fa msub ( const float a, const Vec2fa& b, const Vec2fa& c) { return msub(Vec2fa(a),b,c); }
|
||||
__forceinline Vec2fa nmadd ( const float a, const Vec2fa& b, const Vec2fa& c) { return nmadd(Vec2fa(a),b,c); }
|
||||
__forceinline Vec2fa nmsub ( const float a, const Vec2fa& b, const Vec2fa& c) { return nmsub(Vec2fa(a),b,c); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Assignment Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline Vec2fa& operator +=( Vec2fa& a, const Vec2fa& b ) { return a = a + b; }
|
||||
__forceinline Vec2fa& operator -=( Vec2fa& a, const Vec2fa& b ) { return a = a - b; }
|
||||
__forceinline Vec2fa& operator *=( Vec2fa& a, const Vec2fa& b ) { return a = a * b; }
|
||||
__forceinline Vec2fa& operator *=( Vec2fa& a, const float b ) { return a = a * b; }
|
||||
__forceinline Vec2fa& operator /=( Vec2fa& a, const Vec2fa& b ) { return a = a / b; }
|
||||
__forceinline Vec2fa& operator /=( Vec2fa& a, const float b ) { return a = a / b; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Reductions
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline float reduce_add(const Vec2fa& v) { return v.x+v.y; }
|
||||
__forceinline float reduce_mul(const Vec2fa& v) { return v.x*v.y; }
|
||||
__forceinline float reduce_min(const Vec2fa& v) { return min(v.x,v.y); }
|
||||
__forceinline float reduce_max(const Vec2fa& v) { return max(v.x,v.y); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Comparison Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline bool operator ==( const Vec2fa& a, const Vec2fa& b ) { return (_mm_movemask_ps(_mm_cmpeq_ps (a.m128, b.m128)) & 3) == 3; }
|
||||
__forceinline bool operator !=( const Vec2fa& a, const Vec2fa& b ) { return (_mm_movemask_ps(_mm_cmpneq_ps(a.m128, b.m128)) & 3) != 0; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Euclidian Space Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if defined(__SSE4_1__)
|
||||
__forceinline float dot ( const Vec2fa& a, const Vec2fa& b ) {
|
||||
return _mm_cvtss_f32(_mm_dp_ps(a,b,0x3F));
|
||||
}
|
||||
#else
|
||||
__forceinline float dot ( const Vec2fa& a, const Vec2fa& b ) {
|
||||
return reduce_add(a*b);
|
||||
}
|
||||
#endif
|
||||
|
||||
__forceinline Vec2fa cross ( const Vec2fa& a ) {
|
||||
return Vec2fa(-a.y,a.x);
|
||||
}
|
||||
|
||||
__forceinline float sqr_length ( const Vec2fa& a ) { return dot(a,a); }
|
||||
__forceinline float rcp_length ( const Vec2fa& a ) { return rsqrt(dot(a,a)); }
|
||||
__forceinline float rcp_length2( const Vec2fa& a ) { return rcp(dot(a,a)); }
|
||||
__forceinline float length ( const Vec2fa& a ) { return sqrt(dot(a,a)); }
|
||||
__forceinline Vec2fa normalize( const Vec2fa& a ) { return a*rsqrt(dot(a,a)); }
|
||||
__forceinline float distance ( const Vec2fa& a, const Vec2fa& b ) { return length(a-b); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Select
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline Vec2fa select( bool s, const Vec2fa& t, const Vec2fa& f ) {
|
||||
__m128 mask = s ? _mm_castsi128_ps(_mm_cmpeq_epi32(_mm_setzero_si128(), _mm_setzero_si128())) : _mm_setzero_ps();
|
||||
return blendv_ps(f, t, mask);
|
||||
}
|
||||
|
||||
__forceinline Vec2fa lerp(const Vec2fa& v0, const Vec2fa& v1, const float t) {
|
||||
return madd(1.0f-t,v0,t*v1);
|
||||
}
|
||||
|
||||
__forceinline int maxDim ( const Vec2fa& a )
|
||||
{
|
||||
const Vec2fa b = abs(a);
|
||||
if (b.x > b.y) return 0;
|
||||
else return 1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Rounding Functions
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if defined (__SSE4_1__)
|
||||
//__forceinline Vec2fa trunc( const Vec2fa& a ) { return _mm_round_ps(a, _MM_FROUND_TO_NEAREST_INT); }
|
||||
__forceinline Vec2fa floor( const Vec2fa& a ) { return _mm_round_ps(a, _MM_FROUND_TO_NEG_INF ); }
|
||||
__forceinline Vec2fa ceil ( const Vec2fa& a ) { return _mm_round_ps(a, _MM_FROUND_TO_POS_INF ); }
|
||||
#else
|
||||
//__forceinline Vec2fa trunc( const Vec2fa& a ) { return Vec2fa(truncf(a.x),truncf(a.y),truncf(a.z)); }
|
||||
__forceinline Vec2fa floor( const Vec2fa& a ) { return Vec2fa(floorf(a.x),floorf(a.y)); }
|
||||
__forceinline Vec2fa ceil ( const Vec2fa& a ) { return Vec2fa(ceilf (a.x),ceilf (a.y)); }
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Output Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline embree_ostream operator<<(embree_ostream cout, const Vec2fa& a) {
|
||||
return cout << "(" << a.x << ", " << a.y << ")";
|
||||
}
|
||||
|
||||
typedef Vec2fa Vec2fa_t;
|
||||
}
|
||||
+53
-68
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -15,18 +28,10 @@ namespace embree
|
||||
|
||||
template<typename T> struct Vec3
|
||||
{
|
||||
enum { N = 3 };
|
||||
|
||||
union {
|
||||
struct {
|
||||
T x, y, z;
|
||||
};
|
||||
#if !(defined(__WIN32__) && _MSC_VER == 1800) // workaround for older VS 2013 compiler
|
||||
T components[N];
|
||||
#endif
|
||||
};
|
||||
T x, y, z;
|
||||
|
||||
typedef T Scalar;
|
||||
enum { N = 3 };
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Construction
|
||||
@@ -42,8 +47,6 @@ namespace embree
|
||||
template<typename T1> __forceinline Vec3( const Vec3<T1>& a ) : x(T(a.x)), y(T(a.y)), z(T(a.z)) {}
|
||||
template<typename T1> __forceinline Vec3& operator =(const Vec3<T1>& other) { x = other.x; y = other.y; z = other.z; return *this; }
|
||||
|
||||
__forceinline Vec3& operator =(const Vec3& other) { x = other.x; y = other.y; z = other.z; return *this; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Constants
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -53,13 +56,8 @@ namespace embree
|
||||
__forceinline Vec3( PosInfTy ) : x(pos_inf), y(pos_inf), z(pos_inf) {}
|
||||
__forceinline Vec3( NegInfTy ) : x(neg_inf), y(neg_inf), z(neg_inf) {}
|
||||
|
||||
#if defined(__WIN32__) && (_MSC_VER == 1800) // workaround for older VS 2013 compiler
|
||||
__forceinline const T& operator []( const size_t axis ) const { assert(axis < 3); return (&x)[axis]; }
|
||||
__forceinline T& operator []( const size_t axis ) { assert(axis < 3); return (&x)[axis]; }
|
||||
#else
|
||||
__forceinline const T& operator [](const size_t axis) const { assert(axis < 3); return components[axis]; }
|
||||
__forceinline T& operator [](const size_t axis) { assert(axis < 3); return components[axis]; }
|
||||
#endif
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -79,7 +77,7 @@ namespace embree
|
||||
select(abs(a.y)<min_rcp_input,T(min_rcp_input),a.y),
|
||||
select(abs(a.z)<min_rcp_input,T(min_rcp_input),a.z));
|
||||
}
|
||||
template<typename T> __forceinline Vec3<T> rcp_safe(const Vec3<T>& a) { return rcp(zero_fix(a)); }
|
||||
template<typename T> __forceinline const Vec3<T> rcp_safe(const Vec3<T>& a) { return rcp(zero_fix(a)); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Binary Operators
|
||||
@@ -104,25 +102,25 @@ namespace embree
|
||||
/// Ternary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename T> __forceinline Vec3<T> madd ( const Vec3<T>& a, const Vec3<T>& b, const Vec3<T>& c) { return Vec3<T>( madd(a.x,b.x,c.x), madd(a.y,b.y,c.y), madd(a.z,b.z,c.z)); }
|
||||
template<typename T> __forceinline Vec3<T> msub ( const Vec3<T>& a, const Vec3<T>& b, const Vec3<T>& c) { return Vec3<T>( msub(a.x,b.x,c.x), msub(a.y,b.y,c.y), msub(a.z,b.z,c.z)); }
|
||||
template<typename T> __forceinline Vec3<T> nmadd ( const Vec3<T>& a, const Vec3<T>& b, const Vec3<T>& c) { return Vec3<T>(nmadd(a.x,b.x,c.x),nmadd(a.y,b.y,c.y),nmadd(a.z,b.z,c.z));}
|
||||
template<typename T> __forceinline Vec3<T> nmsub ( const Vec3<T>& a, const Vec3<T>& b, const Vec3<T>& c) { return Vec3<T>(nmsub(a.x,b.x,c.x),nmsub(a.y,b.y,c.y),nmsub(a.z,b.z,c.z)); }
|
||||
template<typename T> __forceinline const Vec3<T> madd ( const Vec3<T>& a, const Vec3<T>& b, const Vec3<T>& c) { return Vec3<T>( madd(a.x,b.x,c.x), madd(a.y,b.y,c.y), madd(a.z,b.z,c.z)); }
|
||||
template<typename T> __forceinline const Vec3<T> msub ( const Vec3<T>& a, const Vec3<T>& b, const Vec3<T>& c) { return Vec3<T>( msub(a.x,b.x,c.x), msub(a.y,b.y,c.y), msub(a.z,b.z,c.z)); }
|
||||
template<typename T> __forceinline const Vec3<T> nmadd ( const Vec3<T>& a, const Vec3<T>& b, const Vec3<T>& c) { return Vec3<T>(nmadd(a.x,b.x,c.x),nmadd(a.y,b.y,c.y),nmadd(a.z,b.z,c.z));}
|
||||
template<typename T> __forceinline const Vec3<T> nmsub ( const Vec3<T>& a, const Vec3<T>& b, const Vec3<T>& c) { return Vec3<T>(nmsub(a.x,b.x,c.x),nmsub(a.y,b.y,c.y),nmsub(a.z,b.z,c.z)); }
|
||||
|
||||
template<typename T> __forceinline Vec3<T> madd ( const T& a, const Vec3<T>& b, const Vec3<T>& c) { return Vec3<T>( madd(a,b.x,c.x), madd(a,b.y,c.y), madd(a,b.z,c.z)); }
|
||||
template<typename T> __forceinline Vec3<T> msub ( const T& a, const Vec3<T>& b, const Vec3<T>& c) { return Vec3<T>( msub(a,b.x,c.x), msub(a,b.y,c.y), msub(a,b.z,c.z)); }
|
||||
template<typename T> __forceinline Vec3<T> nmadd ( const T& a, const Vec3<T>& b, const Vec3<T>& c) { return Vec3<T>(nmadd(a,b.x,c.x),nmadd(a,b.y,c.y),nmadd(a,b.z,c.z));}
|
||||
template<typename T> __forceinline Vec3<T> nmsub ( const T& a, const Vec3<T>& b, const Vec3<T>& c) { return Vec3<T>(nmsub(a,b.x,c.x),nmsub(a,b.y,c.y),nmsub(a,b.z,c.z)); }
|
||||
template<typename T> __forceinline const Vec3<T> madd ( const T& a, const Vec3<T>& b, const Vec3<T>& c) { return Vec3<T>( madd(a,b.x,c.x), madd(a,b.y,c.y), madd(a,b.z,c.z)); }
|
||||
template<typename T> __forceinline const Vec3<T> msub ( const T& a, const Vec3<T>& b, const Vec3<T>& c) { return Vec3<T>( msub(a,b.x,c.x), msub(a,b.y,c.y), msub(a,b.z,c.z)); }
|
||||
template<typename T> __forceinline const Vec3<T> nmadd ( const T& a, const Vec3<T>& b, const Vec3<T>& c) { return Vec3<T>(nmadd(a,b.x,c.x),nmadd(a,b.y,c.y),nmadd(a,b.z,c.z));}
|
||||
template<typename T> __forceinline const Vec3<T> nmsub ( const T& a, const Vec3<T>& b, const Vec3<T>& c) { return Vec3<T>(nmsub(a,b.x,c.x),nmsub(a,b.y,c.y),nmsub(a,b.z,c.z)); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Assignment Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename T> __forceinline Vec3<T>& operator +=( Vec3<T>& a, const T b ) { a.x += b; a.y += b; a.z += b; return a; }
|
||||
template<typename T> __forceinline Vec3<T>& operator +=( Vec3<T>& a, const Vec3<T>& b ) { a.x += b.x; a.y += b.y; a.z += b.z; return a; }
|
||||
template<typename T> __forceinline Vec3<T>& operator -=( Vec3<T>& a, const Vec3<T>& b ) { a.x -= b.x; a.y -= b.y; a.z -= b.z; return a; }
|
||||
template<typename T> __forceinline Vec3<T>& operator *=( Vec3<T>& a, const T& b ) { a.x *= b ; a.y *= b ; a.z *= b ; return a; }
|
||||
template<typename T> __forceinline Vec3<T>& operator /=( Vec3<T>& a, const T& b ) { a.x /= b ; a.y /= b ; a.z /= b ; return a; }
|
||||
template<typename T> __forceinline const Vec3<T>& operator +=( Vec3<T>& a, const T b ) { a.x += b; a.y += b; a.z += b; return a; }
|
||||
template<typename T> __forceinline const Vec3<T>& operator +=( Vec3<T>& a, const Vec3<T>& b ) { a.x += b.x; a.y += b.y; a.z += b.z; return a; }
|
||||
template<typename T> __forceinline const Vec3<T>& operator -=( Vec3<T>& a, const Vec3<T>& b ) { a.x -= b.x; a.y -= b.y; a.z -= b.z; return a; }
|
||||
template<typename T> __forceinline const Vec3<T>& operator *=( Vec3<T>& a, const T& b ) { a.x *= b ; a.y *= b ; a.z *= b ; return a; }
|
||||
template<typename T> __forceinline const Vec3<T>& operator /=( Vec3<T>& a, const T& b ) { a.x /= b ; a.y /= b ; a.z /= b ; return a; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Reduction Operators
|
||||
@@ -146,14 +144,6 @@ namespace embree
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Shift Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename T> __forceinline Vec3<T> shift_right_1( const Vec3<T>& a ) {
|
||||
return Vec3<T>(shift_right_1(a.x),shift_right_1(a.y),shift_right_1(a.z));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Select
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -200,11 +190,10 @@ namespace embree
|
||||
/// Euclidian Space Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename T> __forceinline T sqr ( const Vec3<T>& a ) { return dot(a,a); }
|
||||
template<typename T> __forceinline T dot ( const Vec3<T>& a, const Vec3<T>& b ) { return madd(a.x,b.x,madd(a.y,b.y,a.z*b.z)); }
|
||||
template<typename T> __forceinline T length ( const Vec3<T>& a ) { return sqrt(sqr(a)); }
|
||||
template<typename T> __forceinline T rcp_length( const Vec3<T>& a ) { return rsqrt(sqr(a)); }
|
||||
template<typename T> __forceinline Vec3<T> normalize( const Vec3<T>& a ) { return a*rsqrt(sqr(a)); }
|
||||
template<typename T> __forceinline T length ( const Vec3<T>& a ) { return sqrt(dot(a,a)); }
|
||||
template<typename T> __forceinline T rcp_length( const Vec3<T>& a ) { return rsqrt(dot(a,a)); }
|
||||
template<typename T> __forceinline Vec3<T> normalize( const Vec3<T>& a ) { return a*rsqrt(dot(a,a)); }
|
||||
template<typename T> __forceinline T distance ( const Vec3<T>& a, const Vec3<T>& b ) { return length(a-b); }
|
||||
template<typename T> __forceinline Vec3<T> cross ( const Vec3<T>& a, const Vec3<T>& b ) { return Vec3<T>(msub(a.y,b.z,a.z*b.y), msub(a.z,b.x,a.x*b.z), msub(a.x,b.y,a.y*b.x)); }
|
||||
|
||||
@@ -249,7 +238,7 @@ namespace embree
|
||||
/// Output Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename T> __forceinline embree_ostream operator<<(embree_ostream cout, const Vec3<T>& a) {
|
||||
template<typename T> inline std::ostream& operator<<(std::ostream& cout, const Vec3<T>& a) {
|
||||
return cout << "(" << a.x << ", " << a.y << ", " << a.z << ")";
|
||||
}
|
||||
|
||||
@@ -281,70 +270,66 @@ namespace embree
|
||||
namespace embree
|
||||
{
|
||||
template<typename Out, typename In>
|
||||
__forceinline Vec3<Out> broadcast(const Vec3<In>& a, const size_t k) {
|
||||
return Vec3<Out>(Out(a.x[k]), Out(a.y[k]), Out(a.z[k]));
|
||||
__forceinline Vec3<Out> broadcast(const Vec3<In>& a, const size_t k) {
|
||||
return Vec3<Out>(Out(a.x[k]),Out(a.y[k]),Out(a.z[k]));
|
||||
}
|
||||
|
||||
template<> __forceinline Vec3<float>::Vec3(const Vec3fa& a) { x = a.x; y = a.y; z = a.z; }
|
||||
template<> __forceinline Vec3<float>::Vec3( const Vec3fa& a ) { x = a.x; y = a.y; z = a.z; }
|
||||
|
||||
#if defined(__AVX__)
|
||||
template<> __forceinline Vec3<vfloat4>::Vec3(const Vec3fa& a) {
|
||||
template<> __forceinline Vec3<vfloat4>::Vec3( const Vec3fa& a ) {
|
||||
x = a.x; y = a.y; z = a.z;
|
||||
}
|
||||
#elif defined(__SSE__)
|
||||
template<>
|
||||
__forceinline Vec3<vfloat4>::Vec3(const Vec3fa& a) {
|
||||
template<> __forceinline Vec3<vfloat4>::Vec3( const Vec3fa& a ) {
|
||||
const vfloat4 v = vfloat4(a); x = shuffle<0,0,0,0>(v); y = shuffle<1,1,1,1>(v); z = shuffle<2,2,2,2>(v);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__SSE__)
|
||||
__forceinline Vec3<vfloat4> broadcast4f(const Vec3<vfloat4>& a, const size_t k) {
|
||||
__forceinline Vec3<vfloat4> broadcast4f( const Vec3<vfloat4>& a, const size_t k ) {
|
||||
return Vec3<vfloat4>(vfloat4::broadcast(&a.x[k]), vfloat4::broadcast(&a.y[k]), vfloat4::broadcast(&a.z[k]));
|
||||
}
|
||||
|
||||
template<>
|
||||
__forceinline Vec3<vfloat4> broadcast<vfloat4,vfloat4>(const Vec3<vfloat4>& a, const size_t k) {
|
||||
__forceinline Vec3<vfloat4> broadcast<vfloat4,vfloat4>( const Vec3<vfloat4>& a, const size_t k ) {
|
||||
return Vec3<vfloat4>(vfloat4::broadcast(&a.x[k]), vfloat4::broadcast(&a.y[k]), vfloat4::broadcast(&a.z[k]));
|
||||
}
|
||||
|
||||
template<int i0, int i1, int i2, int i3>
|
||||
__forceinline Vec3<vfloat4> shuffle(const Vec3<vfloat4>& b) {
|
||||
return Vec3<vfloat4>(shuffle<i0,i1,i2,i3>(b.x), shuffle<i0,i1,i2,i3>(b.y), shuffle<i0,i1,i2,i3>(b.z));
|
||||
template<size_t i0, size_t i1, size_t i2, size_t i3> __forceinline const Vec3<vfloat4> shuffle( const Vec3<vfloat4>& b ) {
|
||||
return Vec3<vfloat4>(shuffle<i0,i1,i2,i3>(b.x),shuffle<i0,i1,i2,i3>(b.y),shuffle<i0,i1,i2,i3>(b.z));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__AVX__)
|
||||
template<>
|
||||
__forceinline Vec3<vfloat8>::Vec3(const Vec3fa& a) {
|
||||
template<> __forceinline Vec3<vfloat8>::Vec3( const Vec3fa& a ) {
|
||||
x = a.x; y = a.y; z = a.z;
|
||||
}
|
||||
__forceinline Vec3<vfloat4> broadcast4f(const Vec3<vfloat8>& a, const size_t k) {
|
||||
__forceinline Vec3<vfloat4> broadcast4f( const Vec3<vfloat8>& a, const size_t k ) {
|
||||
return Vec3<vfloat4>(vfloat4::broadcast(&a.x[k]), vfloat4::broadcast(&a.y[k]), vfloat4::broadcast(&a.z[k]));
|
||||
}
|
||||
__forceinline Vec3<vfloat8> broadcast8f(const Vec3<vfloat4>& a, const size_t k) {
|
||||
__forceinline Vec3<vfloat8> broadcast8f( const Vec3<vfloat4>& a, const size_t k ) {
|
||||
return Vec3<vfloat8>(vfloat8::broadcast(&a.x[k]), vfloat8::broadcast(&a.y[k]), vfloat8::broadcast(&a.z[k]));
|
||||
}
|
||||
__forceinline Vec3<vfloat8> broadcast8f(const Vec3<vfloat8>& a, const size_t k) {
|
||||
__forceinline Vec3<vfloat8> broadcast8f( const Vec3<vfloat8>& a, const size_t k ) {
|
||||
return Vec3<vfloat8>(vfloat8::broadcast(&a.x[k]), vfloat8::broadcast(&a.y[k]), vfloat8::broadcast(&a.z[k]));
|
||||
}
|
||||
|
||||
template<>
|
||||
__forceinline Vec3<vfloat8> broadcast<vfloat8,vfloat4>(const Vec3<vfloat4>& a, const size_t k) {
|
||||
__forceinline Vec3<vfloat8> broadcast<vfloat8,vfloat4>( const Vec3<vfloat4>& a, const size_t k ) {
|
||||
return Vec3<vfloat8>(vfloat8::broadcast(&a.x[k]), vfloat8::broadcast(&a.y[k]), vfloat8::broadcast(&a.z[k]));
|
||||
}
|
||||
template<>
|
||||
__forceinline Vec3<vfloat8> broadcast<vfloat8,vfloat8>(const Vec3<vfloat8>& a, const size_t k) {
|
||||
__forceinline Vec3<vfloat8> broadcast<vfloat8,vfloat8>( const Vec3<vfloat8>& a, const size_t k ) {
|
||||
return Vec3<vfloat8>(vfloat8::broadcast(&a.x[k]), vfloat8::broadcast(&a.y[k]), vfloat8::broadcast(&a.z[k]));
|
||||
}
|
||||
|
||||
template<int i0, int i1, int i2, int i3>
|
||||
__forceinline Vec3<vfloat8> shuffle(const Vec3<vfloat8>& b) {
|
||||
return Vec3<vfloat8>(shuffle<i0,i1,i2,i3>(b.x), shuffle<i0,i1,i2,i3>(b.y), shuffle<i0,i1,i2,i3>(b.z));
|
||||
template<size_t i0, size_t i1, size_t i2, size_t i3> __forceinline const Vec3<vfloat8> shuffle( const Vec3<vfloat8>& b ) {
|
||||
return Vec3<vfloat8>(shuffle<i0,i1,i2,i3>(b.x),shuffle<i0,i1,i2,i3>(b.y),shuffle<i0,i1,i2,i3>(b.z));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__AVX512F__)
|
||||
template<> __forceinline Vec3<vfloat16>::Vec3(const Vec3fa& a) : x(a.x), y(a.y), z(a.z) {}
|
||||
template<> __forceinline Vec3<vfloat16>::Vec3( const Vec3fa& a ) : x(a.x), y(a.y), z(a.z) {}
|
||||
#endif
|
||||
}
|
||||
|
||||
+28
-15
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -15,7 +28,7 @@ namespace embree
|
||||
|
||||
struct __aligned(16) Vec3ba
|
||||
{
|
||||
ALIGNED_STRUCT_(16);
|
||||
ALIGNED_STRUCT;
|
||||
|
||||
union {
|
||||
__m128 m128;
|
||||
@@ -35,12 +48,12 @@ namespace embree
|
||||
__forceinline Vec3ba& operator =(const Vec3ba& other) { m128 = other.m128; return *this; }
|
||||
|
||||
__forceinline explicit Vec3ba( bool a )
|
||||
: m128(mm_lookupmask_ps[(size_t(a) << 3) | (size_t(a) << 2) | (size_t(a) << 1) | size_t(a)]) {}
|
||||
: m128(_mm_lookupmask_ps[(size_t(a) << 3) | (size_t(a) << 2) | (size_t(a) << 1) | size_t(a)]) {}
|
||||
__forceinline Vec3ba( bool a, bool b, bool c)
|
||||
: m128(mm_lookupmask_ps[(size_t(c) << 2) | (size_t(b) << 1) | size_t(a)]) {}
|
||||
: m128(_mm_lookupmask_ps[(size_t(c) << 2) | (size_t(b) << 1) | size_t(a)]) {}
|
||||
|
||||
__forceinline operator const __m128&() const { return m128; }
|
||||
__forceinline operator __m128&() { return m128; }
|
||||
__forceinline operator const __m128&( void ) const { return m128; }
|
||||
__forceinline operator __m128&( void ) { return m128; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Constants
|
||||
@@ -62,23 +75,23 @@ namespace embree
|
||||
/// Unary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline Vec3ba operator !( const Vec3ba& a ) { return _mm_xor_ps(a.m128, Vec3ba(embree::True)); }
|
||||
__forceinline const Vec3ba operator !( const Vec3ba& a ) { return _mm_xor_ps(a.m128, Vec3ba(embree::True)); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Binary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline Vec3ba operator &( const Vec3ba& a, const Vec3ba& b ) { return _mm_and_ps(a.m128, b.m128); }
|
||||
__forceinline Vec3ba operator |( const Vec3ba& a, const Vec3ba& b ) { return _mm_or_ps (a.m128, b.m128); }
|
||||
__forceinline Vec3ba operator ^( const Vec3ba& a, const Vec3ba& b ) { return _mm_xor_ps(a.m128, b.m128); }
|
||||
__forceinline const Vec3ba operator &( const Vec3ba& a, const Vec3ba& b ) { return _mm_and_ps(a.m128, b.m128); }
|
||||
__forceinline const Vec3ba operator |( const Vec3ba& a, const Vec3ba& b ) { return _mm_or_ps (a.m128, b.m128); }
|
||||
__forceinline const Vec3ba operator ^( const Vec3ba& a, const Vec3ba& b ) { return _mm_xor_ps(a.m128, b.m128); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Assignment Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline Vec3ba& operator &=( Vec3ba& a, const Vec3ba& b ) { return a = a & b; }
|
||||
__forceinline Vec3ba& operator |=( Vec3ba& a, const Vec3ba& b ) { return a = a | b; }
|
||||
__forceinline Vec3ba& operator ^=( Vec3ba& a, const Vec3ba& b ) { return a = a ^ b; }
|
||||
__forceinline const Vec3ba operator &=( Vec3ba& a, const Vec3ba& b ) { return a = a & b; }
|
||||
__forceinline const Vec3ba operator |=( Vec3ba& a, const Vec3ba& b ) { return a = a | b; }
|
||||
__forceinline const Vec3ba operator ^=( Vec3ba& a, const Vec3ba& b ) { return a = a ^ b; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Comparison Operators + Select
|
||||
@@ -112,7 +125,7 @@ namespace embree
|
||||
/// Output Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline embree_ostream operator<<(embree_ostream cout, const Vec3ba& a) {
|
||||
inline std::ostream& operator<<(std::ostream& cout, const Vec3ba& a) {
|
||||
return cout << "(" << (a.x ? "1" : "0") << ", " << (a.y ? "1" : "0") << ", " << (a.z ? "1" : "0") << ")";
|
||||
}
|
||||
}
|
||||
|
||||
+53
-57
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -15,7 +28,7 @@ namespace embree
|
||||
|
||||
struct __aligned(16) Vec3fa
|
||||
{
|
||||
ALIGNED_STRUCT_(16);
|
||||
ALIGNED_STRUCT;
|
||||
|
||||
typedef float Scalar;
|
||||
enum { N = 3 };
|
||||
@@ -39,31 +52,24 @@ namespace embree
|
||||
__forceinline Vec3fa& operator =( const Vec3fa& other ) { m128 = other.m128; return *this; }
|
||||
|
||||
__forceinline explicit Vec3fa( const float a ) : m128(_mm_set1_ps(a)) {}
|
||||
__forceinline Vec3fa( const float x, const float y, const float z) : m128(_mm_set_ps(0, z, y, x)) {}
|
||||
__forceinline Vec3fa( const float x, const float y, const float z) : m128(_mm_set_ps(z, z, y, x)) {}
|
||||
|
||||
__forceinline Vec3fa( const Vec3fa& other, const int a1) { m128 = other.m128; a = a1; }
|
||||
__forceinline Vec3fa( const Vec3fa& other, const unsigned a1) { m128 = other.m128; u = a1; }
|
||||
__forceinline Vec3fa( const Vec3fa& other, const float w1) {
|
||||
#if defined (__SSE4_1__)
|
||||
m128 = _mm_insert_ps(other.m128, _mm_set_ss(w1),3 << 4);
|
||||
#else
|
||||
const vint4 mask(-1,-1,-1,0);
|
||||
m128 = select(vboolf4(_mm_castsi128_ps(mask)),vfloat4(other.m128),vfloat4(w1));
|
||||
#endif
|
||||
}
|
||||
__forceinline Vec3fa( const Vec3fa& other, const float w1) { m128 = other.m128; w = w1; }
|
||||
//__forceinline Vec3fa( const float x, const float y, const float z, const int a) : x(x), y(y), z(z), a(a) {} // not working properly!
|
||||
//__forceinline Vec3fa( const float x, const float y, const float z, const unsigned a) : x(x), y(y), z(z), u(a) {} // not working properly!
|
||||
__forceinline Vec3fa( const float x, const float y, const float z, const float w) : m128(_mm_set_ps(w, z, y, x)) {}
|
||||
|
||||
__forceinline explicit Vec3fa( const __m128i a ) : m128(_mm_cvtepi32_ps(a)) {}
|
||||
|
||||
__forceinline operator const __m128&() const { return m128; }
|
||||
__forceinline operator __m128&() { return m128; }
|
||||
__forceinline operator const __m128&( void ) const { return m128; }
|
||||
__forceinline operator __m128&( void ) { return m128; }
|
||||
|
||||
#if defined (__SSE4_1__)
|
||||
friend __forceinline Vec3fa copy_a( const Vec3fa& a, const Vec3fa& b ) { return _mm_insert_ps(a, b, (3 << 4) | (3 << 6)); }
|
||||
friend __forceinline const Vec3fa copy_a( const Vec3fa& a, const Vec3fa& b ) { return _mm_insert_ps(a, b, (3 << 4) | (3 << 6)); }
|
||||
#else
|
||||
friend __forceinline Vec3fa copy_a( const Vec3fa& a, const Vec3fa& b ) { Vec3fa c = a; c.a = b.a; return c; }
|
||||
friend __forceinline const Vec3fa copy_a( const Vec3fa& a, const Vec3fa& b ) { Vec3fa c = a; c.a = b.a; return c; }
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -75,7 +81,7 @@ namespace embree
|
||||
}
|
||||
|
||||
static __forceinline Vec3fa loadu( const void* const a ) {
|
||||
return Vec3fa(_mm_loadu_ps((float*)a));
|
||||
return Vec3fa(_mm_and_ps(_mm_loadu_ps((float*)a),_mm_castsi128_ps(_mm_set_epi32(0, -1, -1, -1))));
|
||||
}
|
||||
|
||||
static __forceinline void storeu ( void* ptr, const Vec3fa& v ) {
|
||||
@@ -103,20 +109,20 @@ namespace embree
|
||||
/// Unary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline Vec3fa operator +( const Vec3fa& a ) { return a; }
|
||||
__forceinline Vec3fa operator -( const Vec3fa& a ) {
|
||||
__forceinline const Vec3fa operator +( const Vec3fa& a ) { return a; }
|
||||
__forceinline const Vec3fa operator -( const Vec3fa& a ) {
|
||||
const __m128 mask = _mm_castsi128_ps(_mm_set1_epi32(0x80000000));
|
||||
return _mm_xor_ps(a.m128, mask);
|
||||
}
|
||||
__forceinline Vec3fa abs ( const Vec3fa& a ) {
|
||||
__forceinline const Vec3fa abs ( const Vec3fa& a ) {
|
||||
const __m128 mask = _mm_castsi128_ps(_mm_set1_epi32(0x7fffffff));
|
||||
return _mm_and_ps(a.m128, mask);
|
||||
}
|
||||
__forceinline Vec3fa sign ( const Vec3fa& a ) {
|
||||
__forceinline const Vec3fa sign ( const Vec3fa& a ) {
|
||||
return blendv_ps(Vec3fa(one), -Vec3fa(one), _mm_cmplt_ps (a,Vec3fa(zero)));
|
||||
}
|
||||
|
||||
__forceinline Vec3fa rcp ( const Vec3fa& a )
|
||||
__forceinline const Vec3fa rcp ( const Vec3fa& a )
|
||||
{
|
||||
#if defined(__AVX512VL__)
|
||||
const Vec3fa r = _mm_rcp14_ps(a.m128);
|
||||
@@ -134,10 +140,10 @@ namespace embree
|
||||
return res;
|
||||
}
|
||||
|
||||
__forceinline Vec3fa sqrt ( const Vec3fa& a ) { return _mm_sqrt_ps(a.m128); }
|
||||
__forceinline Vec3fa sqr ( const Vec3fa& a ) { return _mm_mul_ps(a,a); }
|
||||
__forceinline const Vec3fa sqrt ( const Vec3fa& a ) { return _mm_sqrt_ps(a.m128); }
|
||||
__forceinline const Vec3fa sqr ( const Vec3fa& a ) { return _mm_mul_ps(a,a); }
|
||||
|
||||
__forceinline Vec3fa rsqrt( const Vec3fa& a )
|
||||
__forceinline const Vec3fa rsqrt( const Vec3fa& a )
|
||||
{
|
||||
#if defined(__AVX512VL__)
|
||||
__m128 r = _mm_rsqrt14_ps(a.m128);
|
||||
@@ -147,10 +153,10 @@ namespace embree
|
||||
return _mm_add_ps(_mm_mul_ps(_mm_set1_ps(1.5f),r), _mm_mul_ps(_mm_mul_ps(_mm_mul_ps(a, _mm_set1_ps(-0.5f)), r), _mm_mul_ps(r, r)));
|
||||
}
|
||||
|
||||
__forceinline Vec3fa zero_fix(const Vec3fa& a) {
|
||||
__forceinline const Vec3fa zero_fix(const Vec3fa& a) {
|
||||
return blendv_ps(a, _mm_set1_ps(min_rcp_input), _mm_cmplt_ps (abs(a).m128, _mm_set1_ps(min_rcp_input)));
|
||||
}
|
||||
__forceinline Vec3fa rcp_safe(const Vec3fa& a) {
|
||||
__forceinline const Vec3fa rcp_safe(const Vec3fa& a) {
|
||||
return rcp(zero_fix(a));
|
||||
}
|
||||
__forceinline Vec3fa log ( const Vec3fa& a ) {
|
||||
@@ -165,17 +171,17 @@ namespace embree
|
||||
/// Binary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline Vec3fa operator +( const Vec3fa& a, const Vec3fa& b ) { return _mm_add_ps(a.m128, b.m128); }
|
||||
__forceinline Vec3fa operator -( const Vec3fa& a, const Vec3fa& b ) { return _mm_sub_ps(a.m128, b.m128); }
|
||||
__forceinline Vec3fa operator *( const Vec3fa& a, const Vec3fa& b ) { return _mm_mul_ps(a.m128, b.m128); }
|
||||
__forceinline Vec3fa operator *( const Vec3fa& a, const float b ) { return a * Vec3fa(b); }
|
||||
__forceinline Vec3fa operator *( const float a, const Vec3fa& b ) { return Vec3fa(a) * b; }
|
||||
__forceinline Vec3fa operator /( const Vec3fa& a, const Vec3fa& b ) { return _mm_div_ps(a.m128,b.m128); }
|
||||
__forceinline Vec3fa operator /( const Vec3fa& a, const float b ) { return _mm_div_ps(a.m128,_mm_set1_ps(b)); }
|
||||
__forceinline Vec3fa operator /( const float a, const Vec3fa& b ) { return _mm_div_ps(_mm_set1_ps(a),b.m128); }
|
||||
__forceinline const Vec3fa operator +( const Vec3fa& a, const Vec3fa& b ) { return _mm_add_ps(a.m128, b.m128); }
|
||||
__forceinline const Vec3fa operator -( const Vec3fa& a, const Vec3fa& b ) { return _mm_sub_ps(a.m128, b.m128); }
|
||||
__forceinline const Vec3fa operator *( const Vec3fa& a, const Vec3fa& b ) { return _mm_mul_ps(a.m128, b.m128); }
|
||||
__forceinline const Vec3fa operator *( const Vec3fa& a, const float b ) { return a * Vec3fa(b); }
|
||||
__forceinline const Vec3fa operator *( const float a, const Vec3fa& b ) { return Vec3fa(a) * b; }
|
||||
__forceinline const Vec3fa operator /( const Vec3fa& a, const Vec3fa& b ) { return _mm_div_ps(a.m128,b.m128); }
|
||||
__forceinline const Vec3fa operator /( const Vec3fa& a, const float b ) { return _mm_div_ps(a.m128,_mm_set1_ps(b)); }
|
||||
__forceinline const Vec3fa operator /( const float a, const Vec3fa& b ) { return _mm_div_ps(_mm_set1_ps(a),b.m128); }
|
||||
|
||||
__forceinline Vec3fa min( const Vec3fa& a, const Vec3fa& b ) { return _mm_min_ps(a.m128,b.m128); }
|
||||
__forceinline Vec3fa max( const Vec3fa& a, const Vec3fa& b ) { return _mm_max_ps(a.m128,b.m128); }
|
||||
__forceinline const Vec3fa min( const Vec3fa& a, const Vec3fa& b ) { return _mm_min_ps(a.m128,b.m128); }
|
||||
__forceinline const Vec3fa max( const Vec3fa& a, const Vec3fa& b ) { return _mm_max_ps(a.m128,b.m128); }
|
||||
|
||||
#if defined(__SSE4_1__)
|
||||
__forceinline Vec3fa mini(const Vec3fa& a, const Vec3fa& b) {
|
||||
@@ -235,13 +241,7 @@ namespace embree
|
||||
/// Reductions
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline float reduce_add(const Vec3fa& v) {
|
||||
const vfloat4 a(v);
|
||||
const vfloat4 b = shuffle<1>(a);
|
||||
const vfloat4 c = shuffle<2>(a);
|
||||
return _mm_cvtss_f32(a+b+c);
|
||||
}
|
||||
|
||||
__forceinline float reduce_add(const Vec3fa& v) { return v.x+v.y+v.z; }
|
||||
__forceinline float reduce_mul(const Vec3fa& v) { return v.x*v.y*v.z; }
|
||||
__forceinline float reduce_min(const Vec3fa& v) { return min(v.x,v.y,v.z); }
|
||||
__forceinline float reduce_max(const Vec3fa& v) { return max(v.x,v.y,v.z); }
|
||||
@@ -316,19 +316,15 @@ namespace embree
|
||||
/// Select
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline Vec3fa select( bool s, const Vec3fa& t, const Vec3fa& f ) {
|
||||
__forceinline const Vec3fa select( bool s, const Vec3fa& t, const Vec3fa& f ) {
|
||||
__m128 mask = s ? _mm_castsi128_ps(_mm_cmpeq_epi32(_mm_setzero_si128(), _mm_setzero_si128())) : _mm_setzero_ps();
|
||||
return blendv_ps(f, t, mask);
|
||||
}
|
||||
|
||||
__forceinline Vec3fa select( const Vec3ba& s, const Vec3fa& t, const Vec3fa& f ) {
|
||||
__forceinline const Vec3fa select( const Vec3ba& s, const Vec3fa& t, const Vec3fa& f ) {
|
||||
return blendv_ps(f, t, s);
|
||||
}
|
||||
|
||||
__forceinline Vec3fa lerp(const Vec3fa& v0, const Vec3fa& v1, const float t) {
|
||||
return madd(1.0f-t,v0,t*v1);
|
||||
}
|
||||
|
||||
__forceinline int maxDim ( const Vec3fa& a )
|
||||
{
|
||||
const Vec3fa b = abs(a);
|
||||
@@ -344,20 +340,20 @@ namespace embree
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if defined (__SSE4_1__)
|
||||
__forceinline Vec3fa trunc( const Vec3fa& a ) { return _mm_round_ps(a, _MM_FROUND_TO_NEAREST_INT); }
|
||||
__forceinline Vec3fa floor( const Vec3fa& a ) { return _mm_round_ps(a, _MM_FROUND_TO_NEG_INF ); }
|
||||
__forceinline Vec3fa ceil ( const Vec3fa& a ) { return _mm_round_ps(a, _MM_FROUND_TO_POS_INF ); }
|
||||
//__forceinline const Vec3fa trunc( const Vec3fa& a ) { return _mm_round_ps(a, _MM_FROUND_TO_NEAREST_INT); }
|
||||
__forceinline const Vec3fa floor( const Vec3fa& a ) { return _mm_round_ps(a, _MM_FROUND_TO_NEG_INF ); }
|
||||
__forceinline const Vec3fa ceil ( const Vec3fa& a ) { return _mm_round_ps(a, _MM_FROUND_TO_POS_INF ); }
|
||||
#else
|
||||
__forceinline Vec3fa trunc( const Vec3fa& a ) { return Vec3fa(truncf(a.x),truncf(a.y),truncf(a.z)); }
|
||||
__forceinline Vec3fa floor( const Vec3fa& a ) { return Vec3fa(floorf(a.x),floorf(a.y),floorf(a.z)); }
|
||||
__forceinline Vec3fa ceil ( const Vec3fa& a ) { return Vec3fa(ceilf (a.x),ceilf (a.y),ceilf (a.z)); }
|
||||
//__forceinline const Vec3fa trunc( const Vec3fa& a ) { return Vec3fa(truncf(a.x),truncf(a.y),truncf(a.z)); }
|
||||
__forceinline const Vec3fa floor( const Vec3fa& a ) { return Vec3fa(floorf(a.x),floorf(a.y),floorf(a.z)); }
|
||||
__forceinline const Vec3fa ceil ( const Vec3fa& a ) { return Vec3fa(ceilf (a.x),ceilf (a.y),ceilf (a.z)); }
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Output Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline embree_ostream operator<<(embree_ostream cout, const Vec3fa& a) {
|
||||
inline std::ostream& operator<<(std::ostream& cout, const Vec3fa& a) {
|
||||
return cout << "(" << a.x << ", " << a.y << ", " << a.z << ")";
|
||||
}
|
||||
|
||||
|
||||
+50
-37
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -15,7 +28,7 @@ namespace embree
|
||||
|
||||
struct __aligned(16) Vec3ia
|
||||
{
|
||||
ALIGNED_STRUCT_(16);
|
||||
ALIGNED_STRUCT;
|
||||
|
||||
union {
|
||||
__m128i m128;
|
||||
@@ -38,8 +51,8 @@ namespace embree
|
||||
__forceinline Vec3ia( const int x, const int y, const int z) : m128(_mm_set_epi32(z, z, y, x)) {}
|
||||
__forceinline explicit Vec3ia( const __m128 a ) : m128(_mm_cvtps_epi32(a)) {}
|
||||
|
||||
__forceinline operator const __m128i&() const { return m128; }
|
||||
__forceinline operator __m128i&() { return m128; }
|
||||
__forceinline operator const __m128i&( void ) const { return m128; }
|
||||
__forceinline operator __m128i&( void ) { return m128; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Constants
|
||||
@@ -63,48 +76,48 @@ namespace embree
|
||||
/// Unary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline Vec3ia operator +( const Vec3ia& a ) { return a; }
|
||||
__forceinline Vec3ia operator -( const Vec3ia& a ) { return _mm_sub_epi32(_mm_setzero_si128(), a.m128); }
|
||||
__forceinline const Vec3ia operator +( const Vec3ia& a ) { return a; }
|
||||
__forceinline const Vec3ia operator -( const Vec3ia& a ) { return _mm_sub_epi32(_mm_setzero_si128(), a.m128); }
|
||||
#if defined(__SSSE3__)
|
||||
__forceinline Vec3ia abs ( const Vec3ia& a ) { return _mm_abs_epi32(a.m128); }
|
||||
__forceinline const Vec3ia abs ( const Vec3ia& a ) { return _mm_abs_epi32(a.m128); }
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Binary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline Vec3ia operator +( const Vec3ia& a, const Vec3ia& b ) { return _mm_add_epi32(a.m128, b.m128); }
|
||||
__forceinline Vec3ia operator +( const Vec3ia& a, const int b ) { return a+Vec3ia(b); }
|
||||
__forceinline Vec3ia operator +( const int a, const Vec3ia& b ) { return Vec3ia(a)+b; }
|
||||
__forceinline const Vec3ia operator +( const Vec3ia& a, const Vec3ia& b ) { return _mm_add_epi32(a.m128, b.m128); }
|
||||
__forceinline const Vec3ia operator +( const Vec3ia& a, const int b ) { return a+Vec3ia(b); }
|
||||
__forceinline const Vec3ia operator +( const int a, const Vec3ia& b ) { return Vec3ia(a)+b; }
|
||||
|
||||
__forceinline Vec3ia operator -( const Vec3ia& a, const Vec3ia& b ) { return _mm_sub_epi32(a.m128, b.m128); }
|
||||
__forceinline Vec3ia operator -( const Vec3ia& a, const int b ) { return a-Vec3ia(b); }
|
||||
__forceinline Vec3ia operator -( const int a, const Vec3ia& b ) { return Vec3ia(a)-b; }
|
||||
__forceinline const Vec3ia operator -( const Vec3ia& a, const Vec3ia& b ) { return _mm_sub_epi32(a.m128, b.m128); }
|
||||
__forceinline const Vec3ia operator -( const Vec3ia& a, const int b ) { return a-Vec3ia(b); }
|
||||
__forceinline const Vec3ia operator -( const int a, const Vec3ia& b ) { return Vec3ia(a)-b; }
|
||||
|
||||
#if defined(__SSE4_1__)
|
||||
__forceinline Vec3ia operator *( const Vec3ia& a, const Vec3ia& b ) { return _mm_mullo_epi32(a.m128, b.m128); }
|
||||
__forceinline Vec3ia operator *( const Vec3ia& a, const int b ) { return a * Vec3ia(b); }
|
||||
__forceinline Vec3ia operator *( const int a, const Vec3ia& b ) { return Vec3ia(a) * b; }
|
||||
__forceinline const Vec3ia operator *( const Vec3ia& a, const Vec3ia& b ) { return _mm_mullo_epi32(a.m128, b.m128); }
|
||||
__forceinline const Vec3ia operator *( const Vec3ia& a, const int b ) { return a * Vec3ia(b); }
|
||||
__forceinline const Vec3ia operator *( const int a, const Vec3ia& b ) { return Vec3ia(a) * b; }
|
||||
#endif
|
||||
|
||||
__forceinline Vec3ia operator &( const Vec3ia& a, const Vec3ia& b ) { return _mm_and_si128(a.m128, b.m128); }
|
||||
__forceinline Vec3ia operator &( const Vec3ia& a, const int b ) { return a & Vec3ia(b); }
|
||||
__forceinline Vec3ia operator &( const int a, const Vec3ia& b ) { return Vec3ia(a) & b; }
|
||||
__forceinline const Vec3ia operator &( const Vec3ia& a, const Vec3ia& b ) { return _mm_and_si128(a.m128, b.m128); }
|
||||
__forceinline const Vec3ia operator &( const Vec3ia& a, const int b ) { return a & Vec3ia(b); }
|
||||
__forceinline const Vec3ia operator &( const int a, const Vec3ia& b ) { return Vec3ia(a) & b; }
|
||||
|
||||
__forceinline Vec3ia operator |( const Vec3ia& a, const Vec3ia& b ) { return _mm_or_si128(a.m128, b.m128); }
|
||||
__forceinline Vec3ia operator |( const Vec3ia& a, const int b ) { return a | Vec3ia(b); }
|
||||
__forceinline Vec3ia operator |( const int a, const Vec3ia& b ) { return Vec3ia(a) | b; }
|
||||
__forceinline const Vec3ia operator |( const Vec3ia& a, const Vec3ia& b ) { return _mm_or_si128(a.m128, b.m128); }
|
||||
__forceinline const Vec3ia operator |( const Vec3ia& a, const int b ) { return a | Vec3ia(b); }
|
||||
__forceinline const Vec3ia operator |( const int a, const Vec3ia& b ) { return Vec3ia(a) | b; }
|
||||
|
||||
__forceinline Vec3ia operator ^( const Vec3ia& a, const Vec3ia& b ) { return _mm_xor_si128(a.m128, b.m128); }
|
||||
__forceinline Vec3ia operator ^( const Vec3ia& a, const int b ) { return a ^ Vec3ia(b); }
|
||||
__forceinline Vec3ia operator ^( const int a, const Vec3ia& b ) { return Vec3ia(a) ^ b; }
|
||||
__forceinline const Vec3ia operator ^( const Vec3ia& a, const Vec3ia& b ) { return _mm_xor_si128(a.m128, b.m128); }
|
||||
__forceinline const Vec3ia operator ^( const Vec3ia& a, const int b ) { return a ^ Vec3ia(b); }
|
||||
__forceinline const Vec3ia operator ^( const int a, const Vec3ia& b ) { return Vec3ia(a) ^ b; }
|
||||
|
||||
__forceinline Vec3ia operator <<( const Vec3ia& a, const int n ) { return _mm_slli_epi32(a.m128, n); }
|
||||
__forceinline Vec3ia operator >>( const Vec3ia& a, const int n ) { return _mm_srai_epi32(a.m128, n); }
|
||||
__forceinline const Vec3ia operator <<( const Vec3ia& a, const int n ) { return _mm_slli_epi32(a.m128, n); }
|
||||
__forceinline const Vec3ia operator >>( const Vec3ia& a, const int n ) { return _mm_srai_epi32(a.m128, n); }
|
||||
|
||||
__forceinline Vec3ia sll ( const Vec3ia& a, const int b ) { return _mm_slli_epi32(a.m128, b); }
|
||||
__forceinline Vec3ia sra ( const Vec3ia& a, const int b ) { return _mm_srai_epi32(a.m128, b); }
|
||||
__forceinline Vec3ia srl ( const Vec3ia& a, const int b ) { return _mm_srli_epi32(a.m128, b); }
|
||||
__forceinline const Vec3ia sll ( const Vec3ia& a, const int b ) { return _mm_slli_epi32(a.m128, b); }
|
||||
__forceinline const Vec3ia sra ( const Vec3ia& a, const int b ) { return _mm_srai_epi32(a.m128, b); }
|
||||
__forceinline const Vec3ia srl ( const Vec3ia& a, const int b ) { return _mm_srli_epi32(a.m128, b); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Assignment Operators
|
||||
@@ -160,7 +173,7 @@ namespace embree
|
||||
/// Select
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline Vec3ia select( const Vec3ba& m, const Vec3ia& t, const Vec3ia& f ) {
|
||||
__forceinline const Vec3ia select( const Vec3ba& m, const Vec3ia& t, const Vec3ia& f ) {
|
||||
#if defined(__SSE4_1__)
|
||||
return _mm_castps_si128(_mm_blendv_ps(_mm_castsi128_ps(f), _mm_castsi128_ps(t), m));
|
||||
#else
|
||||
@@ -169,18 +182,18 @@ namespace embree
|
||||
}
|
||||
|
||||
#if defined(__SSE4_1__)
|
||||
__forceinline Vec3ia min( const Vec3ia& a, const Vec3ia& b ) { return _mm_min_epi32(a.m128,b.m128); }
|
||||
__forceinline Vec3ia max( const Vec3ia& a, const Vec3ia& b ) { return _mm_max_epi32(a.m128,b.m128); }
|
||||
__forceinline const Vec3ia min( const Vec3ia& a, const Vec3ia& b ) { return _mm_min_epi32(a.m128,b.m128); }
|
||||
__forceinline const Vec3ia max( const Vec3ia& a, const Vec3ia& b ) { return _mm_max_epi32(a.m128,b.m128); }
|
||||
#else
|
||||
__forceinline Vec3ia min( const Vec3ia& a, const Vec3ia& b ) { return select(lt_mask(a,b),a,b); }
|
||||
__forceinline Vec3ia max( const Vec3ia& a, const Vec3ia& b ) { return select(gt_mask(a,b),a,b); }
|
||||
__forceinline const Vec3ia min( const Vec3ia& a, const Vec3ia& b ) { return select(lt_mask(a,b),a,b); }
|
||||
__forceinline const Vec3ia max( const Vec3ia& a, const Vec3ia& b ) { return select(gt_mask(a,b),a,b); }
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Output Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline embree_ostream operator<<(embree_ostream cout, const Vec3ia& a) {
|
||||
inline std::ostream& operator<<(std::ostream& cout, const Vec3ia& a) {
|
||||
return cout << "(" << a.x << ", " << a.y << ", " << a.z << ")";
|
||||
}
|
||||
}
|
||||
|
||||
+28
-27
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -14,15 +27,10 @@ namespace embree
|
||||
|
||||
template<typename T> struct Vec4
|
||||
{
|
||||
enum { N = 4 };
|
||||
union {
|
||||
struct { T x, y, z, w; };
|
||||
#if !(defined(__WIN32__) && _MSC_VER == 1800) // workaround for older VS 2013 compiler
|
||||
T components[N];
|
||||
#endif
|
||||
};
|
||||
T x, y, z, w;
|
||||
|
||||
typedef T Scalar;
|
||||
enum { N = 4 };
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Construction
|
||||
@@ -39,8 +47,6 @@ namespace embree
|
||||
template<typename T1> __forceinline Vec4( const Vec4<T1>& a ) : x(T(a.x)), y(T(a.y)), z(T(a.z)), w(T(a.w)) {}
|
||||
template<typename T1> __forceinline Vec4& operator =(const Vec4<T1>& other) { x = other.x; y = other.y; z = other.z; w = other.w; return *this; }
|
||||
|
||||
__forceinline Vec4& operator =(const Vec4& other) { x = other.x; y = other.y; z = other.z; w = other.w; return *this; }
|
||||
|
||||
__forceinline operator Vec3<T> () const { return Vec3<T>(x,y,z); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -52,13 +58,8 @@ namespace embree
|
||||
__forceinline Vec4( PosInfTy ) : x(pos_inf), y(pos_inf), z(pos_inf), w(pos_inf) {}
|
||||
__forceinline Vec4( NegInfTy ) : x(neg_inf), y(neg_inf), z(neg_inf), w(neg_inf) {}
|
||||
|
||||
#if defined(__WIN32__) && (_MSC_VER == 1800) // workaround for older VS 2013 compiler
|
||||
__forceinline const T& operator [](const size_t axis) const { assert(axis < 4); return (&x)[axis]; }
|
||||
__forceinline T& operator [](const size_t axis) { assert(axis < 4); return (&x)[axis]; }
|
||||
#else
|
||||
__forceinline const T& operator [](const size_t axis ) const { assert(axis < 4); return components[axis]; }
|
||||
__forceinline T& operator [](const size_t axis) { assert(axis < 4); return components[axis]; }
|
||||
#endif
|
||||
__forceinline const T& operator []( const size_t axis ) const { assert(axis < 4); return (&x)[axis]; }
|
||||
__forceinline T& operator []( const size_t axis ) { assert(axis < 4); return (&x)[axis]; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Swizzles
|
||||
@@ -98,15 +99,15 @@ namespace embree
|
||||
/// Ternary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename T> __forceinline Vec4<T> madd ( const Vec4<T>& a, const Vec4<T>& b, const Vec4<T>& c) { return Vec4<T>( madd(a.x,b.x,c.x), madd(a.y,b.y,c.y), madd(a.z,b.z,c.z), madd(a.w,b.w,c.w)); }
|
||||
template<typename T> __forceinline Vec4<T> msub ( const Vec4<T>& a, const Vec4<T>& b, const Vec4<T>& c) { return Vec4<T>( msub(a.x,b.x,c.x), msub(a.y,b.y,c.y), msub(a.z,b.z,c.z), msub(a.w,b.w,c.w)); }
|
||||
template<typename T> __forceinline Vec4<T> nmadd ( const Vec4<T>& a, const Vec4<T>& b, const Vec4<T>& c) { return Vec4<T>(nmadd(a.x,b.x,c.x),nmadd(a.y,b.y,c.y),nmadd(a.z,b.z,c.z),nmadd(a.w,b.w,c.w)); }
|
||||
template<typename T> __forceinline Vec4<T> nmsub ( const Vec4<T>& a, const Vec4<T>& b, const Vec4<T>& c) { return Vec4<T>(nmsub(a.x,b.x,c.x),nmsub(a.y,b.y,c.y),nmsub(a.z,b.z,c.z),nmsub(a.w,b.w,c.w)); }
|
||||
template<typename T> __forceinline const Vec4<T> madd ( const Vec4<T>& a, const Vec4<T>& b, const Vec4<T>& c) { return Vec4<T>( madd(a.x,b.x,c.x), madd(a.y,b.y,c.y), madd(a.z,b.z,c.z), madd(a.w,b.w,c.w)); }
|
||||
template<typename T> __forceinline const Vec4<T> msub ( const Vec4<T>& a, const Vec4<T>& b, const Vec4<T>& c) { return Vec4<T>( msub(a.x,b.x,c.x), msub(a.y,b.y,c.y), msub(a.z,b.z,c.z), msub(a.w,b.w,c.w)); }
|
||||
template<typename T> __forceinline const Vec4<T> nmadd ( const Vec4<T>& a, const Vec4<T>& b, const Vec4<T>& c) { return Vec4<T>(nmadd(a.x,b.x,c.x),nmadd(a.y,b.y,c.y),nmadd(a.z,b.z,c.z),nmadd(a.w,b.w,c.w)); }
|
||||
template<typename T> __forceinline const Vec4<T> nmsub ( const Vec4<T>& a, const Vec4<T>& b, const Vec4<T>& c) { return Vec4<T>(nmsub(a.x,b.x,c.x),nmsub(a.y,b.y,c.y),nmsub(a.z,b.z,c.z),nmsub(a.w,b.w,c.w)); }
|
||||
|
||||
template<typename T> __forceinline Vec4<T> madd ( const T& a, const Vec4<T>& b, const Vec4<T>& c) { return Vec4<T>( madd(a,b.x,c.x), madd(a,b.y,c.y), madd(a,b.z,c.z), madd(a,b.w,c.w)); }
|
||||
template<typename T> __forceinline Vec4<T> msub ( const T& a, const Vec4<T>& b, const Vec4<T>& c) { return Vec4<T>( msub(a,b.x,c.x), msub(a,b.y,c.y), msub(a,b.z,c.z), msub(a,b.w,c.w)); }
|
||||
template<typename T> __forceinline Vec4<T> nmadd ( const T& a, const Vec4<T>& b, const Vec4<T>& c) { return Vec4<T>(nmadd(a,b.x,c.x),nmadd(a,b.y,c.y),nmadd(a,b.z,c.z),nmadd(a,b.w,c.w)); }
|
||||
template<typename T> __forceinline Vec4<T> nmsub ( const T& a, const Vec4<T>& b, const Vec4<T>& c) { return Vec4<T>(nmsub(a,b.x,c.x),nmsub(a,b.y,c.y),nmsub(a,b.z,c.z),nmsub(a,b.w,c.w)); }
|
||||
template<typename T> __forceinline const Vec4<T> madd ( const T& a, const Vec4<T>& b, const Vec4<T>& c) { return Vec4<T>( madd(a,b.x,c.x), madd(a,b.y,c.y), madd(a,b.z,c.z), madd(a,b.w,c.w)); }
|
||||
template<typename T> __forceinline const Vec4<T> msub ( const T& a, const Vec4<T>& b, const Vec4<T>& c) { return Vec4<T>( msub(a,b.x,c.x), msub(a,b.y,c.y), msub(a,b.z,c.z), msub(a,b.w,c.w)); }
|
||||
template<typename T> __forceinline const Vec4<T> nmadd ( const T& a, const Vec4<T>& b, const Vec4<T>& c) { return Vec4<T>(nmadd(a,b.x,c.x),nmadd(a,b.y,c.y),nmadd(a,b.z,c.z),nmadd(a,b.w,c.w)); }
|
||||
template<typename T> __forceinline const Vec4<T> nmsub ( const T& a, const Vec4<T>& b, const Vec4<T>& c) { return Vec4<T>(nmsub(a,b.x,c.x),nmsub(a,b.y,c.y),nmsub(a,b.z,c.z),nmsub(a,b.w,c.w)); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Assignment Operators
|
||||
@@ -183,7 +184,7 @@ namespace embree
|
||||
/// Output Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename T> __forceinline embree_ostream operator<<(embree_ostream cout, const Vec4<T>& a) {
|
||||
template<typename T> inline std::ostream& operator<<(std::ostream& cout, const Vec4<T>& a) {
|
||||
return cout << "(" << a.x << ", " << a.y << ", " << a.z << ", " << a.w << ")";
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
## Copyright 2009-2020 Intel Corporation
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## ======================================================================== ##
|
||||
## Copyright 2009-2017 Intel Corporation ##
|
||||
## ##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License"); ##
|
||||
## you may not use this file except in compliance with the License. ##
|
||||
## You may obtain a copy of the License at ##
|
||||
## ##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0 ##
|
||||
## ##
|
||||
## Unless required by applicable law or agreed to in writing, software ##
|
||||
## distributed under the License is distributed on an "AS IS" BASIS, ##
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ##
|
||||
## See the License for the specific language governing permissions and ##
|
||||
## limitations under the License. ##
|
||||
## ======================================================================== ##
|
||||
|
||||
ADD_LIBRARY(simd STATIC sse.cpp)
|
||||
SET_PROPERTY(TARGET simd PROPERTY FOLDER common)
|
||||
SET_PROPERTY(TARGET simd APPEND PROPERTY COMPILE_FLAGS " ${FLAGS_LOWEST}")
|
||||
|
||||
IF (EMBREE_STATIC_LIB)
|
||||
INSTALL(TARGETS simd EXPORT simd-targets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT devel)
|
||||
INSTALL(EXPORT simd-targets DESTINATION ${EMBREE_CMAKECONFIG_DIR} COMPONENT devel)
|
||||
SIGN_TARGET(simd)
|
||||
ENDIF()
|
||||
|
||||
+15
-4
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -15,13 +28,11 @@
|
||||
|
||||
#if defined(__AVX2__)
|
||||
#include "vint8_avx2.h"
|
||||
#include "vuint8_avx2.h"
|
||||
#if defined(__X86_64__)
|
||||
#include "vllong4_avx2.h"
|
||||
#endif
|
||||
#else
|
||||
#include "vint8_avx.h"
|
||||
#include "vuint8_avx.h"
|
||||
#endif
|
||||
#include "vfloat8_avx.h"
|
||||
#if defined(__X86_64__)
|
||||
|
||||
+16
-4
@@ -1,19 +1,31 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../sys/platform.h"
|
||||
#include "../sys/intrinsics.h"
|
||||
#include "../math/constants.h"
|
||||
#include "../sys/alloc.h"
|
||||
#include "varying.h"
|
||||
|
||||
#include "vboolf16_avx512.h"
|
||||
#include "vint16_avx512.h"
|
||||
#include "vuint16_avx512.h"
|
||||
#include "vfloat16_avx512.h"
|
||||
|
||||
#include "vuint16_avx512.h"
|
||||
#include "vboold8_avx512.h"
|
||||
#include "vllong8_avx512.h"
|
||||
#include "vdouble8_avx512.h"
|
||||
|
||||
+39
-49
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -20,72 +33,49 @@
|
||||
# include "avx512.h"
|
||||
#endif
|
||||
|
||||
#if defined(__AVX512F__)
|
||||
# define AVX_ZERO_UPPER()
|
||||
#elif defined (__AVX__)
|
||||
# define AVX_ZERO_UPPER() _mm256_zeroupper()
|
||||
#else
|
||||
# define AVX_ZERO_UPPER()
|
||||
#endif
|
||||
|
||||
namespace embree
|
||||
{
|
||||
template <int N>
|
||||
__forceinline vbool<N> isfinite(const vfloat<N>& v)
|
||||
{
|
||||
return (v >= vfloat<N>(-std::numeric_limits<float>::max()))
|
||||
& (v <= vfloat<N>( std::numeric_limits<float>::max()));
|
||||
}
|
||||
|
||||
/* foreach unique */
|
||||
template<typename vbool, typename vint, typename Closure>
|
||||
__forceinline void foreach_unique(const vbool& valid0, const vint& vi, const Closure& closure)
|
||||
__forceinline void foreach_unique(const vbool& valid0, const vint& vi, const Closure& closure)
|
||||
{
|
||||
vbool valid1 = valid0;
|
||||
while (any(valid1)) {
|
||||
const int j = int(bsf(movemask(valid1)));
|
||||
const int j = int(__bsf(movemask(valid1)));
|
||||
const int i = vi[j];
|
||||
const vbool valid2 = valid1 & (i == vi);
|
||||
valid1 = andn(valid1, valid2);
|
||||
closure(valid2, i);
|
||||
valid1 = valid1 & !valid2;
|
||||
closure(valid2,i);
|
||||
}
|
||||
}
|
||||
|
||||
/* returns the next unique value i in vi and the corresponding valid_i mask */
|
||||
template<typename vbool, typename vint>
|
||||
__forceinline int next_unique(vbool& valid, const vint& vi, /*out*/ vbool& valid_i)
|
||||
{
|
||||
assert(any(valid));
|
||||
const int j = int(bsf(movemask(valid)));
|
||||
const int i = vi[j];
|
||||
valid_i = valid & (i == vi);
|
||||
valid = andn(valid, valid_i);
|
||||
return i;
|
||||
}
|
||||
|
||||
/* foreach unique index */
|
||||
/* foreach unique */
|
||||
template<typename vbool, typename vint, typename Closure>
|
||||
__forceinline void foreach_unique_index(const vbool& valid0, const vint& vi, const Closure& closure)
|
||||
__forceinline void foreach_unique_index(const vbool& valid0, const vint& vi, const Closure& closure)
|
||||
{
|
||||
vbool valid1 = valid0;
|
||||
while (any(valid1)) {
|
||||
const int j = int(bsf(movemask(valid1)));
|
||||
const int j = (int) __bsf(movemask(valid1));
|
||||
const int i = vi[j];
|
||||
const vbool valid2 = valid1 & (i == vi);
|
||||
valid1 = andn(valid1, valid2);
|
||||
closure(valid2, i, j);
|
||||
valid1 = valid1 & !valid2;
|
||||
closure(valid2,i,j);
|
||||
}
|
||||
}
|
||||
|
||||
/* returns the index of the next unique value i in vi and the corresponding valid_i mask */
|
||||
template<typename vbool, typename vint>
|
||||
__forceinline int next_unique_index(vbool& valid, const vint& vi, /*out*/ vbool& valid_i)
|
||||
{
|
||||
assert(any(valid));
|
||||
const int j = int(bsf(movemask(valid)));
|
||||
const int i = vi[j];
|
||||
valid_i = valid & (i == vi);
|
||||
valid = andn(valid, valid_i);
|
||||
return j;
|
||||
}
|
||||
|
||||
template<typename Closure>
|
||||
__forceinline void foreach2(int x0, int x1, int y0, int y1, const Closure& closure)
|
||||
__forceinline void foreach2(int x0, int x1, int y0, int y1, const Closure& closure)
|
||||
{
|
||||
__aligned(64) int U[2*VSIZEX];
|
||||
__aligned(64) int V[2*VSIZEX];
|
||||
__aligned(64) int U[128];
|
||||
__aligned(64) int V[128];
|
||||
int index = 0;
|
||||
for (int y=y0; y<y1; y++) {
|
||||
const bool lasty = y+1>=y1;
|
||||
@@ -93,15 +83,15 @@ namespace embree
|
||||
for (int x=x0; x<x1; ) { //x+=VSIZEX) {
|
||||
const bool lastx = x+VSIZEX >= x1;
|
||||
vintx vx = x+vintx(step);
|
||||
vintx::storeu(&U[index], vx);
|
||||
vintx::storeu(&V[index], vy);
|
||||
vintx::storeu(&U[index],vx);
|
||||
vintx::storeu(&V[index],vy);
|
||||
const int dx = min(x1-x,VSIZEX);
|
||||
index += dx;
|
||||
x += dx;
|
||||
if (index >= VSIZEX || (lastx && lasty)) {
|
||||
const vboolx valid = vintx(step) < vintx(index);
|
||||
closure(valid, vintx::load(U), vintx::load(V));
|
||||
x-= max(0, index-VSIZEX);
|
||||
closure(valid,vintx::load(U),vintx::load(V));
|
||||
x-= max(0,index-VSIZEX);
|
||||
index = 0;
|
||||
}
|
||||
}
|
||||
|
||||
+17
-4
@@ -1,11 +1,24 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#include "sse.h"
|
||||
|
||||
namespace embree
|
||||
{
|
||||
const __m128 mm_lookupmask_ps[16] = {
|
||||
const __m128 _mm_lookupmask_ps[16] = {
|
||||
_mm_castsi128_ps(_mm_set_epi32( 0, 0, 0, 0)),
|
||||
_mm_castsi128_ps(_mm_set_epi32( 0, 0, 0,-1)),
|
||||
_mm_castsi128_ps(_mm_set_epi32( 0, 0,-1, 0)),
|
||||
@@ -24,7 +37,7 @@ namespace embree
|
||||
_mm_castsi128_ps(_mm_set_epi32(-1,-1,-1,-1))
|
||||
};
|
||||
|
||||
const __m128d mm_lookupmask_pd[4] = {
|
||||
const __m128d _mm_lookupmask_pd[4] = {
|
||||
_mm_castsi128_pd(_mm_set_epi32( 0, 0, 0, 0)),
|
||||
_mm_castsi128_pd(_mm_set_epi32( 0, 0,-1,-1)),
|
||||
_mm_castsi128_pd(_mm_set_epi32(-1,-1, 0, 0)),
|
||||
|
||||
+19
-7
@@ -1,28 +1,40 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../sys/platform.h"
|
||||
#include "../sys/intrinsics.h"
|
||||
#include "../sys/alloc.h"
|
||||
#include "../math/constants.h"
|
||||
#include "varying.h"
|
||||
|
||||
namespace embree
|
||||
{
|
||||
#if defined(__SSE4_1__)
|
||||
__forceinline __m128 blendv_ps(__m128 f, __m128 t, __m128 mask) {
|
||||
__forceinline __m128 blendv_ps( __m128 f, __m128 t, __m128 mask ) {
|
||||
return _mm_blendv_ps(f,t,mask);
|
||||
}
|
||||
#else
|
||||
__forceinline __m128 blendv_ps(__m128 f, __m128 t, __m128 mask) {
|
||||
__forceinline __m128 blendv_ps( __m128 f, __m128 t, __m128 mask ) {
|
||||
return _mm_or_ps(_mm_and_ps(mask, t), _mm_andnot_ps(mask, f));
|
||||
}
|
||||
#endif
|
||||
|
||||
extern const __m128 mm_lookupmask_ps[16];
|
||||
extern const __m128d mm_lookupmask_pd[4];
|
||||
extern const __m128 _mm_lookupmask_ps[16];
|
||||
extern const __m128d _mm_lookupmask_pd[4];
|
||||
}
|
||||
|
||||
#if defined(__AVX512VL__)
|
||||
|
||||
+18
-13
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -56,19 +69,13 @@ namespace embree
|
||||
template<int N> using vreal = vfloat<N>;
|
||||
template<int N> using vbool = vboolf<N>;
|
||||
|
||||
/* Varying size constants */
|
||||
#if defined(__AVX512VL__) // SKX
|
||||
const int VSIZEX = 8; // default size
|
||||
const int VSIZEL = 16; // large size
|
||||
#elif defined(__AVX512F__) // KNL
|
||||
/* Maximum supported varying size */
|
||||
#if defined(__AVX512F__)
|
||||
const int VSIZEX = 16;
|
||||
const int VSIZEL = 16;
|
||||
#elif defined(__AVX__)
|
||||
const int VSIZEX = 8;
|
||||
const int VSIZEL = 8;
|
||||
#else
|
||||
const int VSIZEX = 4;
|
||||
const int VSIZEL = 4;
|
||||
#endif
|
||||
|
||||
/* Extends varying size N to optimal or up to max(N, N2) */
|
||||
@@ -102,7 +109,6 @@ namespace embree
|
||||
typedef vdouble<8> vdouble8;
|
||||
typedef vreal<8> vreal8;
|
||||
typedef vint<8> vint8;
|
||||
typedef vuint<8> vuint8;
|
||||
typedef vllong<8> vllong8;
|
||||
typedef vbool<8> vbool8;
|
||||
typedef vboolf<8> vboolf8;
|
||||
@@ -119,12 +125,11 @@ namespace embree
|
||||
typedef vboolf<16> vboolf16;
|
||||
typedef vboold<16> vboold16;
|
||||
|
||||
/* Default shortcuts */
|
||||
/* Maximum shortcuts */
|
||||
typedef vfloat<VSIZEX> vfloatx;
|
||||
typedef vdouble<VSIZEX> vdoublex;
|
||||
typedef vreal<VSIZEX> vrealx;
|
||||
typedef vint<VSIZEX> vintx;
|
||||
typedef vuint<VSIZEX> vuintx;
|
||||
typedef vllong<VSIZEX> vllongx;
|
||||
typedef vbool<VSIZEX> vboolx;
|
||||
typedef vboolf<VSIZEX> vboolfx;
|
||||
|
||||
+59
-52
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -9,8 +22,6 @@ namespace embree
|
||||
template<>
|
||||
struct vboold<4>
|
||||
{
|
||||
ALIGNED_STRUCT_(32);
|
||||
|
||||
typedef vboold4 Bool;
|
||||
|
||||
enum { size = 4 }; // number of SIMD elements
|
||||
@@ -24,18 +35,18 @@ namespace embree
|
||||
/// Constructors, Assignment & Cast Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboold() {}
|
||||
__forceinline vboold(const vboold4& a) { v = a.v; }
|
||||
__forceinline vboold4& operator =(const vboold4& a) { v = a.v; return *this; }
|
||||
__forceinline vboold () {}
|
||||
__forceinline vboold ( const vboold4& a ) { v = a.v; }
|
||||
__forceinline vboold4& operator=( const vboold4& a ) { v = a.v; return *this; }
|
||||
|
||||
__forceinline vboold(__m256d a) : v(a) {}
|
||||
__forceinline vboold(__m256i a) : v(_mm256_castsi256_pd(a)) {}
|
||||
__forceinline vboold( const __m256d a ) : v(a) {}
|
||||
__forceinline vboold( const __m256i a ) : v(_mm256_castsi256_pd(a)) {}
|
||||
|
||||
__forceinline operator const __m256() const { return _mm256_castpd_ps(v); }
|
||||
__forceinline operator const __m256i() const { return _mm256_castpd_si256(v); }
|
||||
__forceinline operator const __m256d() const { return v; }
|
||||
__forceinline operator const __m256( void ) const { return _mm256_castpd_ps(v); }
|
||||
__forceinline operator const __m256i( void ) const { return _mm256_castpd_si256(v); }
|
||||
__forceinline operator const __m256d( void ) const { return v; }
|
||||
|
||||
__forceinline vboold(int a)
|
||||
__forceinline vboold ( const int a )
|
||||
{
|
||||
assert(a >= 0 && a <= 255);
|
||||
#if defined (__AVX2__)
|
||||
@@ -44,56 +55,54 @@ namespace embree
|
||||
const __m256i c = _mm256_and_si256(b,mask);
|
||||
v = _mm256_castsi256_pd(_mm256_cmpeq_epi64(c,mask));
|
||||
#else
|
||||
vl = mm_lookupmask_pd[a & 0x3];
|
||||
vh = mm_lookupmask_pd[a >> 2];
|
||||
vl = _mm_lookupmask_pd[a & 0x3];
|
||||
vh = _mm_lookupmask_pd[a >> 2];
|
||||
#endif
|
||||
}
|
||||
|
||||
__forceinline vboold(__m128d a, __m128d b) : vl(a), vh(b) {}
|
||||
__forceinline vboold ( const __m128d a, const __m128d b) : vl(a), vh(b) {}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Constants
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboold(FalseTy) : v(_mm256_setzero_pd()) {}
|
||||
__forceinline vboold(TrueTy) : v(_mm256_cmp_pd(_mm256_setzero_pd(), _mm256_setzero_pd(), _CMP_EQ_OQ)) {}
|
||||
__forceinline vboold( FalseTy ) : v(_mm256_setzero_pd()) {}
|
||||
__forceinline vboold( TrueTy ) : v(_mm256_cmp_pd(_mm256_setzero_pd(), _mm256_setzero_pd(), _CMP_EQ_OQ)) {}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Array Access
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline bool operator [](size_t index) const { assert(index < 4); return (_mm256_movemask_pd(v) >> index) & 1; }
|
||||
__forceinline long long& operator [](size_t index) { assert(index < 4); return i[index]; }
|
||||
__forceinline bool operator []( const size_t index ) const { assert(index < 4); return (_mm256_movemask_pd(v) >> index) & 1; }
|
||||
__forceinline long long& operator []( const size_t index ) { assert(index < 4); return i[index]; }
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Unary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboold4 operator !(const vboold4& a) { return _mm256_xor_pd(a, vboold4(embree::True)); }
|
||||
__forceinline const vboold4 operator !( const vboold4& a ) { return _mm256_xor_pd(a, vboold4(embree::True)); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Binary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboold4 operator &(const vboold4& a, const vboold4& b) { return _mm256_and_pd(a, b); }
|
||||
__forceinline vboold4 operator |(const vboold4& a, const vboold4& b) { return _mm256_or_pd (a, b); }
|
||||
__forceinline vboold4 operator ^(const vboold4& a, const vboold4& b) { return _mm256_xor_pd(a, b); }
|
||||
__forceinline const vboold4 operator &( const vboold4& a, const vboold4& b ) { return _mm256_and_pd(a, b); }
|
||||
__forceinline const vboold4 operator |( const vboold4& a, const vboold4& b ) { return _mm256_or_pd (a, b); }
|
||||
__forceinline const vboold4 operator ^( const vboold4& a, const vboold4& b ) { return _mm256_xor_pd(a, b); }
|
||||
|
||||
__forceinline vboold4 andn(const vboold4& a, const vboold4& b) { return _mm256_andnot_pd(b, a); }
|
||||
|
||||
__forceinline vboold4& operator &=(vboold4& a, const vboold4& b) { return a = a & b; }
|
||||
__forceinline vboold4& operator |=(vboold4& a, const vboold4& b) { return a = a | b; }
|
||||
__forceinline vboold4& operator ^=(vboold4& a, const vboold4& b) { return a = a ^ b; }
|
||||
__forceinline vboold4 operator &=( vboold4& a, const vboold4& b ) { return a = a & b; }
|
||||
__forceinline vboold4 operator |=( vboold4& a, const vboold4& b ) { return a = a | b; }
|
||||
__forceinline vboold4 operator ^=( vboold4& a, const vboold4& b ) { return a = a ^ b; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Comparison Operators + Select
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboold4 operator !=(const vboold4& a, const vboold4& b) { return _mm256_xor_pd(a, b); }
|
||||
__forceinline vboold4 operator ==(const vboold4& a, const vboold4& b) { return _mm256_xor_pd(_mm256_xor_pd(a,b),vboold4(embree::True)); }
|
||||
__forceinline const vboold4 operator !=( const vboold4& a, const vboold4& b ) { return _mm256_xor_pd(a, b); }
|
||||
__forceinline const vboold4 operator ==( const vboold4& a, const vboold4& b ) { return _mm256_xor_pd(_mm256_xor_pd(a,b),vboold4(embree::True)); }
|
||||
|
||||
__forceinline vboold4 select(const vboold4& mask, const vboold4& t, const vboold4& f) {
|
||||
__forceinline const vboold4 select( const vboold4& mask, const vboold4& t, const vboold4& f ) {
|
||||
return _mm256_blendv_pd(f, t, mask);
|
||||
}
|
||||
|
||||
@@ -101,19 +110,17 @@ namespace embree
|
||||
/// Movement/Shifting/Shuffling Functions
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboold4 unpacklo(const vboold4& a, const vboold4& b) { return _mm256_unpacklo_pd(a, b); }
|
||||
__forceinline vboold4 unpackhi(const vboold4& a, const vboold4& b) { return _mm256_unpackhi_pd(a, b); }
|
||||
__forceinline vboold4 unpacklo( const vboold4& a, const vboold4& b ) { return _mm256_unpacklo_pd(a.v, b.v); }
|
||||
__forceinline vboold4 unpackhi( const vboold4& a, const vboold4& b ) { return _mm256_unpackhi_pd(a.v, b.v); }
|
||||
|
||||
|
||||
#if defined(__AVX2__)
|
||||
template<int i0, int i1, int i2, int i3>
|
||||
__forceinline vboold4 shuffle(const vboold4& v) {
|
||||
return _mm256_permute4x64_pd(v, _MM_SHUFFLE(i3, i2, i1, i0));
|
||||
template<size_t i0, size_t i1, size_t i2, size_t i3> __forceinline const vboold4 shuffle( const vboold4& a ) {
|
||||
return _mm256_permute4x64_pd(a, _MM_SHUFFLE(i3, i2, i1, i0));
|
||||
}
|
||||
|
||||
template<int i>
|
||||
__forceinline vboold4 shuffle(const vboold4& v) {
|
||||
return _mm256_permute4x64_pd(v, _MM_SHUFFLE(i, i, i, i));
|
||||
template<size_t i> __forceinline const vboold4 shuffle( const vboold4& a ) {
|
||||
return _mm256_permute4x64_pd(a, _MM_SHUFFLE(i, i, i, i));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -122,33 +129,33 @@ namespace embree
|
||||
/// Reduction Operations
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline bool reduce_and(const vboold4& a) { return _mm256_movemask_pd(a) == (unsigned int)0xf; }
|
||||
__forceinline bool reduce_or (const vboold4& a) { return !_mm256_testz_pd(a,a); }
|
||||
__forceinline bool reduce_and( const vboold4& a ) { return _mm256_movemask_pd(a) == (unsigned int)0xf; }
|
||||
__forceinline bool reduce_or ( const vboold4& a ) { return !_mm256_testz_pd(a,a); }
|
||||
|
||||
__forceinline bool all (const vboold4& a) { return _mm256_movemask_pd(a) == (unsigned int)0xf; }
|
||||
__forceinline bool any (const vboold4& a) { return !_mm256_testz_pd(a,a); }
|
||||
__forceinline bool none(const vboold4& a) { return _mm256_testz_pd(a,a) != 0; }
|
||||
__forceinline bool all ( const vboold4& a ) { return _mm256_movemask_pd(a) == (unsigned int)0xf; }
|
||||
__forceinline bool any ( const vboold4& a ) { return !_mm256_testz_pd(a,a); }
|
||||
__forceinline bool none ( const vboold4& a ) { return _mm256_testz_pd(a,a) != 0; }
|
||||
|
||||
__forceinline bool all (const vboold4& valid, const vboold4& b) { return all((!valid) | b); }
|
||||
__forceinline bool any (const vboold4& valid, const vboold4& b) { return any(valid & b); }
|
||||
__forceinline bool none(const vboold4& valid, const vboold4& b) { return none(valid & b); }
|
||||
__forceinline bool all ( const vboold4& valid, const vboold4& b ) { return all((!valid) | b); }
|
||||
__forceinline bool any ( const vboold4& valid, const vboold4& b ) { return any( valid & b); }
|
||||
__forceinline bool none ( const vboold4& valid, const vboold4& b ) { return none(valid & b); }
|
||||
|
||||
__forceinline unsigned int movemask(const vboold4& a) { return _mm256_movemask_pd(a); }
|
||||
__forceinline size_t popcnt (const vboold4& a) { return popcnt((size_t)_mm256_movemask_pd(a)); }
|
||||
__forceinline unsigned int movemask( const vboold4& a ) { return _mm256_movemask_pd(a); }
|
||||
__forceinline size_t popcnt ( const vboold4& a ) { return __popcnt((size_t)_mm256_movemask_pd(a)); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Get/Set Functions
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline bool get(const vboold4& a, size_t index) { return a[index]; }
|
||||
__forceinline void set (vboold4& a, size_t index) { a[index] = -1; }
|
||||
__forceinline void set (vboold4& a, size_t index) { a[index] = -1; }
|
||||
__forceinline void clear(vboold4& a, size_t index) { a[index] = 0; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Output Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline embree_ostream operator <<(embree_ostream cout, const vboold4& a) {
|
||||
inline std::ostream& operator<<(std::ostream& cout, const vboold4& a) {
|
||||
return cout << "<" << a[0] << ", " << a[1] << ", " << a[2] << ", " << a[3] << ", "
|
||||
<< a[4] << ", " << a[5] << ", " << a[6] << ", " << a[7] << ">";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -20,8 +33,8 @@ namespace embree
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboold() {}
|
||||
__forceinline vboold(const vboold4& t) { v = t.v; }
|
||||
__forceinline vboold4& operator =(const vboold4& f) { v = f.v; return *this; }
|
||||
__forceinline vboold(const vboold4 &t) { v = t.v; }
|
||||
__forceinline vboold4& operator=(const vboold4 &f) { v = f.v; return *this; }
|
||||
|
||||
__forceinline vboold(const __mmask8 &t) { v = t; }
|
||||
__forceinline operator __mmask8() const { return v; }
|
||||
@@ -49,50 +62,42 @@ namespace embree
|
||||
/// Constants
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboold(FalseTy) : v(0x0) {}
|
||||
__forceinline vboold(TrueTy) : v(0xf) {}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Array Access
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline bool operator [](size_t index) const {
|
||||
assert(index < 4); return (mm512_mask2int(v) >> index) & 1;
|
||||
}
|
||||
__forceinline vboold( FalseTy ) : v(0x0) {}
|
||||
__forceinline vboold( TrueTy ) : v(0xf) {}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Unary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboold4 operator !(const vboold4& a) { return _mm512_kandn(a, 0xf); }
|
||||
__forceinline vboold4 operator!(const vboold4 &a) { return _mm512_kandn(a, 0xf); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Binary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboold4 operator &(const vboold4& a, const vboold4& b) { return _mm512_kand(a, b); }
|
||||
__forceinline vboold4 operator |(const vboold4& a, const vboold4& b) { return _mm512_kor(a, b); }
|
||||
__forceinline vboold4 operator ^(const vboold4& a, const vboold4& b) { return _mm512_kxor(a, b); }
|
||||
__forceinline vboold4 operator&(const vboold4 &a, const vboold4 &b) { return _mm512_kand(a, b); }
|
||||
__forceinline vboold4 operator|(const vboold4 &a, const vboold4 &b) { return _mm512_kor(a, b); }
|
||||
__forceinline vboold4 operator^(const vboold4 &a, const vboold4 &b) { return _mm512_kxor(a, b); }
|
||||
|
||||
__forceinline vboold4 andn(const vboold4& a, const vboold4& b) { return _mm512_kandn(b, a); }
|
||||
__forceinline vboold4 andn(const vboold4 &a, const vboold4 &b) { return _mm512_kandn(b, a); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Assignment Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboold4& operator &=(vboold4& a, const vboold4& b) { return a = a & b; }
|
||||
__forceinline vboold4& operator |=(vboold4& a, const vboold4& b) { return a = a | b; }
|
||||
__forceinline vboold4& operator ^=(vboold4& a, const vboold4& b) { return a = a ^ b; }
|
||||
__forceinline const vboold4 operator &=( vboold4& a, const vboold4& b ) { return a = a & b; }
|
||||
__forceinline const vboold4 operator |=( vboold4& a, const vboold4& b ) { return a = a | b; }
|
||||
__forceinline const vboold4 operator ^=( vboold4& a, const vboold4& b ) { return a = a ^ b; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Comparison Operators + Select
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboold4 operator !=(const vboold4& a, const vboold4& b) { return _mm512_kxor(a, b); }
|
||||
__forceinline vboold4 operator ==(const vboold4& a, const vboold4& b) { return _mm512_kand(_mm512_kxnor(a, b), 0xf); }
|
||||
__forceinline const vboold4 operator !=( const vboold4& a, const vboold4& b ) { return _mm512_kxor(a, b); }
|
||||
__forceinline const vboold4 operator ==( const vboold4& a, const vboold4& b ) { return _mm512_kand(_mm512_kxnor(a, b), 0xf); }
|
||||
|
||||
__forceinline vboold4 select(const vboold4& s, const vboold4& a, const vboold4& b) {
|
||||
__forceinline vboold4 select (const vboold4 &s, const vboold4 &a, const vboold4 &b) {
|
||||
return _mm512_kor(_mm512_kand(s, a), _mm512_kandn(s, b));
|
||||
}
|
||||
|
||||
@@ -100,22 +105,22 @@ namespace embree
|
||||
/// Reduction Operations
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline int all (const vboold4& a) { return a.v == 0xf; }
|
||||
__forceinline int any (const vboold4& a) { return _mm512_kortestz(a, a) == 0; }
|
||||
__forceinline int none(const vboold4& a) { return _mm512_kortestz(a, a) != 0; }
|
||||
__forceinline int all (const vboold4 &a) { return a.v == 0xf; }
|
||||
__forceinline int any (const vboold4 &a) { return _mm512_kortestz(a, a) == 0; }
|
||||
__forceinline int none(const vboold4 &a) { return _mm512_kortestz(a, a) != 0; }
|
||||
|
||||
__forceinline int all (const vboold4& valid, const vboold4& b) { return all((!valid) | b); }
|
||||
__forceinline int any (const vboold4& valid, const vboold4& b) { return any(valid & b); }
|
||||
__forceinline int none(const vboold4& valid, const vboold4& b) { return none(valid & b); }
|
||||
__forceinline int all ( const vboold4& valid, const vboold4& b ) { return all((!valid) | b); }
|
||||
__forceinline int any ( const vboold4& valid, const vboold4& b ) { return any( valid & b); }
|
||||
__forceinline int none( const vboold4& valid, const vboold4& b ) { return none(valid & b); }
|
||||
|
||||
__forceinline size_t movemask(const vboold4& a) { return _mm512_kmov(a); }
|
||||
__forceinline size_t popcnt (const vboold4& a) { return popcnt(a.v); }
|
||||
__forceinline size_t movemask( const vboold4& a ) { return _mm512_kmov(a); }
|
||||
__forceinline size_t popcnt ( const vboold4& a ) { return __popcnt(a.v); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Conversion Operations
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline unsigned int toInt(const vboold4& a) { return mm512_mask2int(a); }
|
||||
__forceinline unsigned int toInt(const vboold4 &a) { return mm512_mask2int(a); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Get/Set Functions
|
||||
@@ -129,7 +134,7 @@ namespace embree
|
||||
/// Output Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline embree_ostream operator <<(embree_ostream cout, const vboold4& a)
|
||||
inline std::ostream& operator<<(std::ostream& cout, const vboold4& a)
|
||||
{
|
||||
cout << "<";
|
||||
for (size_t i=0; i<4; i++) {
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -20,10 +33,10 @@ namespace embree
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboold() {}
|
||||
__forceinline vboold(const vboold8& t) { v = t.v; }
|
||||
__forceinline vboold8& operator =(const vboold8& f) { v = f.v; return *this; }
|
||||
__forceinline vboold(const vboold8 &t) { v = t.v; }
|
||||
__forceinline vboold8& operator=(const vboold8 &f) { v = f.v; return *this; }
|
||||
|
||||
__forceinline vboold(const __mmask8& t) { v = t; }
|
||||
__forceinline vboold(const __mmask8 &t) { v = t; }
|
||||
__forceinline operator __mmask8() const { return v; }
|
||||
|
||||
__forceinline vboold(bool b) { v = b ? 0xff : 0x00; }
|
||||
@@ -57,50 +70,42 @@ namespace embree
|
||||
/// Constants
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboold(FalseTy) : v(0x00) {}
|
||||
__forceinline vboold(TrueTy) : v(0xff) {}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Array Access
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline bool operator [](size_t index) const {
|
||||
assert(index < 8); return (mm512_mask2int(v) >> index) & 1;
|
||||
}
|
||||
__forceinline vboold( FalseTy ) : v(0x00) {}
|
||||
__forceinline vboold( TrueTy ) : v(0xff) {}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Unary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboold8 operator !(const vboold8& a) { return _mm512_knot(a); }
|
||||
__forceinline vboold8 operator!(const vboold8 &a) { return _mm512_knot(a); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Binary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboold8 operator &(const vboold8& a, const vboold8& b) { return _mm512_kand(a, b); }
|
||||
__forceinline vboold8 operator |(const vboold8& a, const vboold8& b) { return _mm512_kor(a, b); }
|
||||
__forceinline vboold8 operator ^(const vboold8& a, const vboold8& b) { return _mm512_kxor(a, b); }
|
||||
__forceinline vboold8 operator&(const vboold8 &a, const vboold8 &b) { return _mm512_kand(a, b); }
|
||||
__forceinline vboold8 operator|(const vboold8 &a, const vboold8 &b) { return _mm512_kor(a, b); }
|
||||
__forceinline vboold8 operator^(const vboold8 &a, const vboold8 &b) { return _mm512_kxor(a, b); }
|
||||
|
||||
__forceinline vboold8 andn(const vboold8& a, const vboold8& b) { return _mm512_kandn(b, a); }
|
||||
__forceinline vboold8 andn(const vboold8 &a, const vboold8 &b) { return _mm512_kandn(b, a); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Assignment Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboold8& operator &=(vboold8& a, const vboold8& b) { return a = a & b; }
|
||||
__forceinline vboold8& operator |=(vboold8& a, const vboold8& b) { return a = a | b; }
|
||||
__forceinline vboold8& operator ^=(vboold8& a, const vboold8& b) { return a = a ^ b; }
|
||||
__forceinline const vboold8 operator &=( vboold8& a, const vboold8& b ) { return a = a & b; }
|
||||
__forceinline const vboold8 operator |=( vboold8& a, const vboold8& b ) { return a = a | b; }
|
||||
__forceinline const vboold8 operator ^=( vboold8& a, const vboold8& b ) { return a = a ^ b; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Comparison Operators + Select
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboold8 operator !=(const vboold8& a, const vboold8& b) { return _mm512_kxor(a, b); }
|
||||
__forceinline vboold8 operator ==(const vboold8& a, const vboold8& b) { return _mm512_kxnor(a, b); }
|
||||
__forceinline const vboold8 operator !=( const vboold8& a, const vboold8& b ) { return _mm512_kxor(a, b); }
|
||||
__forceinline const vboold8 operator ==( const vboold8& a, const vboold8& b ) { return _mm512_kxnor(a, b); }
|
||||
|
||||
__forceinline vboold8 select(const vboold8& s, const vboold8& a, const vboold8& b) {
|
||||
__forceinline vboold8 select(const vboold8 &s, const vboold8 &a, const vboold8 &b) {
|
||||
return _mm512_kor(_mm512_kand(s, a), _mm512_kandn(s, b));
|
||||
}
|
||||
|
||||
@@ -108,22 +113,22 @@ namespace embree
|
||||
/// Reduction Operations
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline int all (const vboold8& a) { return a.v == 0xff; }
|
||||
__forceinline int any (const vboold8& a) { return _mm512_kortestz(a, a) == 0; }
|
||||
__forceinline int none(const vboold8& a) { return _mm512_kortestz(a, a) != 0; }
|
||||
__forceinline int all (const vboold8 &a) { return a.v == 0xff; }
|
||||
__forceinline int any (const vboold8 &a) { return _mm512_kortestz(a, a) == 0; }
|
||||
__forceinline int none(const vboold8 &a) { return _mm512_kortestz(a, a) != 0; }
|
||||
|
||||
__forceinline int all (const vboold8& valid, const vboold8& b) { return all((!valid) | b); }
|
||||
__forceinline int any (const vboold8& valid, const vboold8& b) { return any(valid & b); }
|
||||
__forceinline int none(const vboold8& valid, const vboold8& b) { return none(valid & b); }
|
||||
__forceinline int all ( const vboold8& valid, const vboold8& b ) { return all((!valid) | b); }
|
||||
__forceinline int any ( const vboold8& valid, const vboold8& b ) { return any( valid & b); }
|
||||
__forceinline int none( const vboold8& valid, const vboold8& b ) { return none(valid & b); }
|
||||
|
||||
__forceinline size_t movemask(const vboold8& a) { return _mm512_kmov(a); }
|
||||
__forceinline size_t popcnt (const vboold8& a) { return popcnt(a.v); }
|
||||
__forceinline size_t movemask( const vboold8& a ) { return _mm512_kmov(a); }
|
||||
__forceinline size_t popcnt ( const vboold8& a ) { return __popcnt(a.v); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Conversion Operations
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline unsigned int toInt(const vboold8& a) { return mm512_mask2int(a); }
|
||||
__forceinline unsigned int toInt(const vboold8 &a) { return mm512_mask2int(a); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Get/Set Functions
|
||||
@@ -137,7 +142,7 @@ namespace embree
|
||||
/// Output Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline embree_ostream operator <<(embree_ostream cout, const vboold8& a)
|
||||
inline std::ostream& operator<<(std::ostream& cout, const vboold8& a)
|
||||
{
|
||||
cout << "<";
|
||||
for (size_t i=0; i<8; i++) {
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -21,15 +34,15 @@ namespace embree
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf() {}
|
||||
__forceinline vboolf(const vboolf16& t) { v = t.v; }
|
||||
__forceinline vboolf16& operator =(const vboolf16& f) { v = f.v; return *this; }
|
||||
__forceinline vboolf(const vboolf16 &t) { v = t.v; }
|
||||
__forceinline vboolf16& operator=(const vboolf16 &f) { v = f.v; return *this; }
|
||||
|
||||
__forceinline vboolf(const __mmask16& t) { v = t; }
|
||||
__forceinline operator __mmask16() const { return v; }
|
||||
__forceinline vboolf(const __mmask16 &t) { v = t; }
|
||||
__forceinline operator __mmask16 () const { return v; }
|
||||
|
||||
__forceinline vboolf(bool b) { v = b ? 0xFFFF : 0x0000; }
|
||||
__forceinline vboolf(int t) { v = (__mmask16)t; }
|
||||
__forceinline vboolf(unsigned int t) { v = (__mmask16)t; }
|
||||
__forceinline vboolf(int t ) { v = (__mmask16)t; }
|
||||
__forceinline vboolf(unsigned int t ) { v = (__mmask16)t; }
|
||||
|
||||
/* return int8 mask */
|
||||
__forceinline __m128i mask8() const {
|
||||
@@ -58,14 +71,14 @@ namespace embree
|
||||
/// Constants
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf(FalseTy) : v(0x0000) {}
|
||||
__forceinline vboolf(TrueTy) : v(0xffff) {}
|
||||
__forceinline vboolf( FalseTy ) : v(0x0000) {}
|
||||
__forceinline vboolf( TrueTy ) : v(0xffff) {}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Array Access
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline bool operator [](size_t index) const {
|
||||
__forceinline bool operator []( const size_t index ) const {
|
||||
assert(index < 16); return (mm512_mask2int(v) >> index) & 1;
|
||||
}
|
||||
};
|
||||
@@ -74,34 +87,34 @@ namespace embree
|
||||
/// Unary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf16 operator !(const vboolf16& a) { return _mm512_knot(a); }
|
||||
__forceinline vboolf16 operator!(const vboolf16 &a) { return _mm512_knot(a); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Binary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf16 operator &(const vboolf16& a, const vboolf16& b) { return _mm512_kand(a,b); }
|
||||
__forceinline vboolf16 operator |(const vboolf16& a, const vboolf16& b) { return _mm512_kor(a,b); }
|
||||
__forceinline vboolf16 operator ^(const vboolf16& a, const vboolf16& b) { return _mm512_kxor(a,b); }
|
||||
__forceinline vboolf16 operator&(const vboolf16 &a, const vboolf16 &b) { return _mm512_kand(a,b); }
|
||||
__forceinline vboolf16 operator|(const vboolf16 &a, const vboolf16 &b) { return _mm512_kor(a,b); }
|
||||
__forceinline vboolf16 operator^(const vboolf16 &a, const vboolf16 &b) { return _mm512_kxor(a,b); }
|
||||
|
||||
__forceinline vboolf16 andn(const vboolf16& a, const vboolf16& b) { return _mm512_kandn(b,a); }
|
||||
__forceinline vboolf16 andn(const vboolf16 &a, const vboolf16 &b) { return _mm512_kandn(b,a); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Assignment Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf16& operator &=(vboolf16& a, const vboolf16& b) { return a = a & b; }
|
||||
__forceinline vboolf16& operator |=(vboolf16& a, const vboolf16& b) { return a = a | b; }
|
||||
__forceinline vboolf16& operator ^=(vboolf16& a, const vboolf16& b) { return a = a ^ b; }
|
||||
__forceinline const vboolf16 operator &=( vboolf16& a, const vboolf16& b ) { return a = a & b; }
|
||||
__forceinline const vboolf16 operator |=( vboolf16& a, const vboolf16& b ) { return a = a | b; }
|
||||
__forceinline const vboolf16 operator ^=( vboolf16& a, const vboolf16& b ) { return a = a ^ b; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Comparison Operators + Select
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf16 operator !=(const vboolf16& a, const vboolf16& b) { return _mm512_kxor(a, b); }
|
||||
__forceinline vboolf16 operator ==(const vboolf16& a, const vboolf16& b) { return _mm512_kxnor(a, b); }
|
||||
__forceinline const vboolf16 operator !=( const vboolf16& a, const vboolf16& b ) { return _mm512_kxor(a, b); }
|
||||
__forceinline const vboolf16 operator ==( const vboolf16& a, const vboolf16& b ) { return _mm512_kxnor(a, b); }
|
||||
|
||||
__forceinline vboolf16 select(const vboolf16& s, const vboolf16& a, const vboolf16& b) {
|
||||
__forceinline vboolf16 select (const vboolf16 &s, const vboolf16 &a, const vboolf16 &b) {
|
||||
return _mm512_kor(_mm512_kand(s,a),_mm512_kandn(s,b));
|
||||
}
|
||||
|
||||
@@ -109,23 +122,23 @@ namespace embree
|
||||
/// Reduction Operations
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline int all (const vboolf16& a) { return _mm512_kortestc(a,a) != 0; }
|
||||
__forceinline int any (const vboolf16& a) { return _mm512_kortestz(a,a) == 0; }
|
||||
__forceinline int none(const vboolf16& a) { return _mm512_kortestz(a,a) != 0; }
|
||||
__forceinline int all (const vboolf16 &a) { return _mm512_kortestc(a,a) != 0; }
|
||||
__forceinline int any (const vboolf16 &a) { return _mm512_kortestz(a,a) == 0; }
|
||||
__forceinline int none(const vboolf16 &a) { return _mm512_kortestz(a,a) != 0; }
|
||||
|
||||
__forceinline int all (const vboolf16& valid, const vboolf16& b) { return all((!valid) | b); }
|
||||
__forceinline int any (const vboolf16& valid, const vboolf16& b) { return any(valid & b); }
|
||||
__forceinline int none(const vboolf16& valid, const vboolf16& b) { return none(valid & b); }
|
||||
__forceinline int all ( const vboolf16& valid, const vboolf16& b ) { return all((!valid) | b); }
|
||||
__forceinline int any ( const vboolf16& valid, const vboolf16& b ) { return any( valid & b); }
|
||||
__forceinline int none( const vboolf16& valid, const vboolf16& b ) { return none(valid & b); }
|
||||
|
||||
__forceinline size_t movemask(const vboolf16& a) { return _mm512_kmov(a); }
|
||||
__forceinline size_t popcnt (const vboolf16& a) { return popcnt(a.v); }
|
||||
__forceinline size_t movemask( const vboolf16& a ) { return _mm512_kmov(a); }
|
||||
__forceinline size_t popcnt ( const vboolf16& a ) { return __popcnt(a.v); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Convertion Operations
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline unsigned int toInt (const vboolf16& a) { return mm512_mask2int(a); }
|
||||
__forceinline vboolf16 toMask(const int& a) { return mm512_int2mask(a); }
|
||||
__forceinline unsigned int toInt (const vboolf16 &a) { return mm512_mask2int(a); }
|
||||
__forceinline vboolf16 toMask(const int &a) { return mm512_int2mask(a); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Get/Set Functions
|
||||
@@ -139,7 +152,7 @@ namespace embree
|
||||
/// Output Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline embree_ostream operator <<(embree_ostream cout, const vboolf16& a)
|
||||
inline std::ostream& operator<<(std::ostream& cout, const vboolf16& a)
|
||||
{
|
||||
cout << "<";
|
||||
for (size_t i=0; i<16; i++) {
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -20,8 +33,8 @@ namespace embree
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf() {}
|
||||
__forceinline vboolf(const vboolf4& t) { v = t.v; }
|
||||
__forceinline vboolf4& operator =(const vboolf4& f) { v = f.v; return *this; }
|
||||
__forceinline vboolf(const vboolf4 &t) { v = t.v; }
|
||||
__forceinline vboolf4& operator=(const vboolf4 &f) { v = f.v; return *this; }
|
||||
|
||||
__forceinline vboolf(const __mmask8 &t) { v = t; }
|
||||
__forceinline operator __mmask8() const { return v; }
|
||||
@@ -30,9 +43,6 @@ namespace embree
|
||||
__forceinline vboolf(int t) { v = (__mmask8)t; }
|
||||
__forceinline vboolf(unsigned int t) { v = (__mmask8)t; }
|
||||
|
||||
__forceinline vboolf(bool a, bool b, bool c, bool d)
|
||||
: v((__mmask8)((int(d) << 3) | (int(c) << 2) | (int(b) << 1) | int(a))) {}
|
||||
|
||||
/* return int8 mask */
|
||||
__forceinline __m128i mask8() const {
|
||||
return _mm_movm_epi8(v);
|
||||
@@ -52,50 +62,42 @@ namespace embree
|
||||
/// Constants
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf(FalseTy) : v(0x0) {}
|
||||
__forceinline vboolf(TrueTy) : v(0xf) {}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Array Access
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline bool operator [](size_t index) const {
|
||||
assert(index < 4); return (mm512_mask2int(v) >> index) & 1;
|
||||
}
|
||||
__forceinline vboolf( FalseTy ) : v(0x0) {}
|
||||
__forceinline vboolf( TrueTy ) : v(0xf) {}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Unary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf4 operator !(const vboolf4& a) { return _mm512_kandn(a, 0xf); }
|
||||
__forceinline vboolf4 operator!(const vboolf4 &a) { return _mm512_kandn(a, 0xf); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Binary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf4 operator &(const vboolf4& a, const vboolf4& b) { return _mm512_kand(a, b); }
|
||||
__forceinline vboolf4 operator |(const vboolf4& a, const vboolf4& b) { return _mm512_kor(a, b); }
|
||||
__forceinline vboolf4 operator ^(const vboolf4& a, const vboolf4& b) { return _mm512_kxor(a, b); }
|
||||
__forceinline vboolf4 operator&(const vboolf4 &a, const vboolf4 &b) { return _mm512_kand(a, b); }
|
||||
__forceinline vboolf4 operator|(const vboolf4 &a, const vboolf4 &b) { return _mm512_kor(a, b); }
|
||||
__forceinline vboolf4 operator^(const vboolf4 &a, const vboolf4 &b) { return _mm512_kxor(a, b); }
|
||||
|
||||
__forceinline vboolf4 andn(const vboolf4& a, const vboolf4& b) { return _mm512_kandn(b, a); }
|
||||
__forceinline vboolf4 andn(const vboolf4 &a, const vboolf4 &b) { return _mm512_kandn(b, a); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Assignment Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf4& operator &=(vboolf4& a, const vboolf4& b) { return a = a & b; }
|
||||
__forceinline vboolf4& operator |=(vboolf4& a, const vboolf4& b) { return a = a | b; }
|
||||
__forceinline vboolf4& operator ^=(vboolf4& a, const vboolf4& b) { return a = a ^ b; }
|
||||
__forceinline const vboolf4 operator &=( vboolf4& a, const vboolf4& b ) { return a = a & b; }
|
||||
__forceinline const vboolf4 operator |=( vboolf4& a, const vboolf4& b ) { return a = a | b; }
|
||||
__forceinline const vboolf4 operator ^=( vboolf4& a, const vboolf4& b ) { return a = a ^ b; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Comparison Operators + Select
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf4 operator !=(const vboolf4& a, const vboolf4& b) { return _mm512_kxor(a, b); }
|
||||
__forceinline vboolf4 operator ==(const vboolf4& a, const vboolf4& b) { return _mm512_kand(_mm512_kxnor(a, b), 0xf); }
|
||||
__forceinline const vboolf4 operator !=( const vboolf4& a, const vboolf4& b ) { return _mm512_kxor(a, b); }
|
||||
__forceinline const vboolf4 operator ==( const vboolf4& a, const vboolf4& b ) { return _mm512_kand(_mm512_kxnor(a, b), 0xf); }
|
||||
|
||||
__forceinline vboolf4 select(const vboolf4& s, const vboolf4& a, const vboolf4& b) {
|
||||
__forceinline vboolf4 select (const vboolf4 &s, const vboolf4 &a, const vboolf4 &b) {
|
||||
return _mm512_kor(_mm512_kand(s, a), _mm512_kandn(s, b));
|
||||
}
|
||||
|
||||
@@ -103,22 +105,22 @@ namespace embree
|
||||
/// Reduction Operations
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline int all (const vboolf4& a) { return a.v == 0xf; }
|
||||
__forceinline int any (const vboolf4& a) { return _mm512_kortestz(a, a) == 0; }
|
||||
__forceinline int none(const vboolf4& a) { return _mm512_kortestz(a, a) != 0; }
|
||||
__forceinline int all (const vboolf4 &a) { return a.v == 0xf; }
|
||||
__forceinline int any (const vboolf4 &a) { return _mm512_kortestz(a, a) == 0; }
|
||||
__forceinline int none(const vboolf4 &a) { return _mm512_kortestz(a, a) != 0; }
|
||||
|
||||
__forceinline int all (const vboolf4& valid, const vboolf4& b) { return all((!valid) | b); }
|
||||
__forceinline int any (const vboolf4& valid, const vboolf4& b) { return any(valid & b); }
|
||||
__forceinline int none(const vboolf4& valid, const vboolf4& b) { return none(valid & b); }
|
||||
__forceinline int all ( const vboolf4& valid, const vboolf4& b ) { return all((!valid) | b); }
|
||||
__forceinline int any ( const vboolf4& valid, const vboolf4& b ) { return any( valid & b); }
|
||||
__forceinline int none( const vboolf4& valid, const vboolf4& b ) { return none(valid & b); }
|
||||
|
||||
__forceinline size_t movemask(const vboolf4& a) { return _mm512_kmov(a); }
|
||||
__forceinline size_t popcnt (const vboolf4& a) { return popcnt(a.v); }
|
||||
__forceinline size_t movemask( const vboolf4& a ) { return _mm512_kmov(a); }
|
||||
__forceinline size_t popcnt ( const vboolf4& a ) { return __popcnt(a.v); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Conversion Operations
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline unsigned int toInt(const vboolf4& a) { return mm512_mask2int(a); }
|
||||
__forceinline unsigned int toInt(const vboolf4 &a) { return mm512_mask2int(a); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Get/Set Functions
|
||||
@@ -132,7 +134,7 @@ namespace embree
|
||||
/// Output Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline embree_ostream operator <<(embree_ostream cout, const vboolf4& a)
|
||||
inline std::ostream& operator<<(std::ostream& cout, const vboolf4& a)
|
||||
{
|
||||
cout << "<";
|
||||
for (size_t i=0; i<4; i++) {
|
||||
|
||||
+69
-63
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -9,8 +22,6 @@ namespace embree
|
||||
template<>
|
||||
struct vboolf<4>
|
||||
{
|
||||
ALIGNED_STRUCT_(16);
|
||||
|
||||
typedef vboolf4 Bool;
|
||||
typedef vint4 Int;
|
||||
typedef vfloat4 Float;
|
||||
@@ -22,23 +33,23 @@ namespace embree
|
||||
/// Constructors, Assignment & Cast Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf() {}
|
||||
__forceinline vboolf(const vboolf4& other) { v = other.v; }
|
||||
__forceinline vboolf4& operator =(const vboolf4& other) { v = other.v; return *this; }
|
||||
__forceinline vboolf ( ) {}
|
||||
__forceinline vboolf ( const vboolf4& other ) { v = other.v; }
|
||||
__forceinline vboolf4& operator=( const vboolf4& other ) { v = other.v; return *this; }
|
||||
|
||||
__forceinline vboolf(__m128 input) : v(input) {}
|
||||
__forceinline operator const __m128&() const { return v; }
|
||||
__forceinline operator const __m128i() const { return _mm_castps_si128(v); }
|
||||
__forceinline operator const __m128d() const { return _mm_castps_pd(v); }
|
||||
__forceinline vboolf( const __m128 input ) : v(input) {}
|
||||
__forceinline operator const __m128&( void ) const { return v; }
|
||||
__forceinline operator const __m128i( void ) const { return _mm_castps_si128(v); }
|
||||
__forceinline operator const __m128d( void ) const { return _mm_castps_pd(v); }
|
||||
|
||||
__forceinline vboolf(bool a)
|
||||
: v(mm_lookupmask_ps[(size_t(a) << 3) | (size_t(a) << 2) | (size_t(a) << 1) | size_t(a)]) {}
|
||||
__forceinline vboolf(bool a, bool b)
|
||||
: v(mm_lookupmask_ps[(size_t(b) << 3) | (size_t(a) << 2) | (size_t(b) << 1) | size_t(a)]) {}
|
||||
__forceinline vboolf(bool a, bool b, bool c, bool d)
|
||||
: v(mm_lookupmask_ps[(size_t(d) << 3) | (size_t(c) << 2) | (size_t(b) << 1) | size_t(a)]) {}
|
||||
__forceinline vboolf(int mask) { assert(mask >= 0 && mask < 16); v = mm_lookupmask_ps[mask]; }
|
||||
__forceinline vboolf(unsigned int mask) { assert(mask < 16); v = mm_lookupmask_ps[mask]; }
|
||||
__forceinline vboolf( bool a )
|
||||
: v(_mm_lookupmask_ps[(size_t(a) << 3) | (size_t(a) << 2) | (size_t(a) << 1) | size_t(a)]) {}
|
||||
__forceinline vboolf( bool a, bool b )
|
||||
: v(_mm_lookupmask_ps[(size_t(b) << 3) | (size_t(a) << 2) | (size_t(b) << 1) | size_t(a)]) {}
|
||||
__forceinline vboolf( bool a, bool b, bool c, bool d )
|
||||
: v(_mm_lookupmask_ps[(size_t(d) << 3) | (size_t(c) << 2) | (size_t(b) << 1) | size_t(a)]) {}
|
||||
__forceinline vboolf( int mask ) { assert(mask >= 0 && mask < 16); v = _mm_lookupmask_ps[mask]; }
|
||||
__forceinline vboolf( unsigned mask ) { assert(mask >= 0 && mask < 16); v = _mm_lookupmask_ps[mask]; }
|
||||
|
||||
/* return int32 mask */
|
||||
__forceinline __m128i mask32() const {
|
||||
@@ -49,49 +60,47 @@ namespace embree
|
||||
/// Constants
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf(FalseTy) : v(_mm_setzero_ps()) {}
|
||||
__forceinline vboolf(TrueTy) : v(_mm_castsi128_ps(_mm_cmpeq_epi32(_mm_setzero_si128(), _mm_setzero_si128()))) {}
|
||||
__forceinline vboolf( FalseTy ) : v(_mm_setzero_ps()) {}
|
||||
__forceinline vboolf( TrueTy ) : v(_mm_castsi128_ps(_mm_cmpeq_epi32(_mm_setzero_si128(), _mm_setzero_si128()))) {}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Array Access
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline bool operator [](size_t index) const { assert(index < 4); return (_mm_movemask_ps(v) >> index) & 1; }
|
||||
__forceinline int& operator [](size_t index) { assert(index < 4); return i[index]; }
|
||||
__forceinline bool operator []( const size_t index ) const { assert(index < 4); return (_mm_movemask_ps(v) >> index) & 1; }
|
||||
__forceinline int& operator []( const size_t index ) { assert(index < 4); return i[index]; }
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Unary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf4 operator !(const vboolf4& a) { return _mm_xor_ps(a, vboolf4(embree::True)); }
|
||||
__forceinline const vboolf4 operator !( const vboolf4& a ) { return _mm_xor_ps(a, vboolf4(embree::True)); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Binary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf4 operator &(const vboolf4& a, const vboolf4& b) { return _mm_and_ps(a, b); }
|
||||
__forceinline vboolf4 operator |(const vboolf4& a, const vboolf4& b) { return _mm_or_ps (a, b); }
|
||||
__forceinline vboolf4 operator ^(const vboolf4& a, const vboolf4& b) { return _mm_xor_ps(a, b); }
|
||||
|
||||
__forceinline vboolf4 andn(const vboolf4& a, const vboolf4& b) { return _mm_andnot_ps(b, a); }
|
||||
__forceinline const vboolf4 operator &( const vboolf4& a, const vboolf4& b ) { return _mm_and_ps(a, b); }
|
||||
__forceinline const vboolf4 operator |( const vboolf4& a, const vboolf4& b ) { return _mm_or_ps (a, b); }
|
||||
__forceinline const vboolf4 operator ^( const vboolf4& a, const vboolf4& b ) { return _mm_xor_ps(a, b); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Assignment Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf4& operator &=(vboolf4& a, const vboolf4& b) { return a = a & b; }
|
||||
__forceinline vboolf4& operator |=(vboolf4& a, const vboolf4& b) { return a = a | b; }
|
||||
__forceinline vboolf4& operator ^=(vboolf4& a, const vboolf4& b) { return a = a ^ b; }
|
||||
__forceinline const vboolf4 operator &=( vboolf4& a, const vboolf4& b ) { return a = a & b; }
|
||||
__forceinline const vboolf4 operator |=( vboolf4& a, const vboolf4& b ) { return a = a | b; }
|
||||
__forceinline const vboolf4 operator ^=( vboolf4& a, const vboolf4& b ) { return a = a ^ b; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Comparison Operators + Select
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf4 operator !=(const vboolf4& a, const vboolf4& b) { return _mm_xor_ps(a, b); }
|
||||
__forceinline vboolf4 operator ==(const vboolf4& a, const vboolf4& b) { return _mm_castsi128_ps(_mm_cmpeq_epi32(a, b)); }
|
||||
__forceinline const vboolf4 operator !=( const vboolf4& a, const vboolf4& b ) { return _mm_xor_ps(a, b); }
|
||||
__forceinline const vboolf4 operator ==( const vboolf4& a, const vboolf4& b ) { return _mm_castsi128_ps(_mm_cmpeq_epi32(a, b)); }
|
||||
|
||||
__forceinline vboolf4 select(const vboolf4& m, const vboolf4& t, const vboolf4& f) {
|
||||
__forceinline const vboolf4 select( const vboolf4& m, const vboolf4& t, const vboolf4& f ) {
|
||||
#if defined(__SSE4_1__)
|
||||
return _mm_blendv_ps(f, t, m);
|
||||
#else
|
||||
@@ -103,56 +112,53 @@ namespace embree
|
||||
/// Movement/Shifting/Shuffling Functions
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf4 unpacklo(const vboolf4& a, const vboolf4& b) { return _mm_unpacklo_ps(a, b); }
|
||||
__forceinline vboolf4 unpackhi(const vboolf4& a, const vboolf4& b) { return _mm_unpackhi_ps(a, b); }
|
||||
__forceinline const vboolf4 unpacklo( const vboolf4& a, const vboolf4& b ) { return _mm_unpacklo_ps(a, b); }
|
||||
__forceinline const vboolf4 unpackhi( const vboolf4& a, const vboolf4& b ) { return _mm_unpackhi_ps(a, b); }
|
||||
|
||||
template<int i0, int i1, int i2, int i3>
|
||||
__forceinline vboolf4 shuffle(const vboolf4& v) {
|
||||
return _mm_castsi128_ps(_mm_shuffle_epi32(v, _MM_SHUFFLE(i3, i2, i1, i0)));
|
||||
template<size_t i0, size_t i1, size_t i2, size_t i3> __forceinline const vboolf4 shuffle( const vboolf4& a ) {
|
||||
return _mm_shuffle_epi32(a, _MM_SHUFFLE(i3, i2, i1, i0));
|
||||
}
|
||||
|
||||
template<int i0, int i1, int i2, int i3>
|
||||
__forceinline vboolf4 shuffle(const vboolf4& a, const vboolf4& b) {
|
||||
template<size_t i0, size_t i1, size_t i2, size_t i3> __forceinline const vboolf4 shuffle( const vboolf4& a, const vboolf4& b ) {
|
||||
return _mm_shuffle_ps(a, b, _MM_SHUFFLE(i3, i2, i1, i0));
|
||||
}
|
||||
|
||||
template<int i0>
|
||||
__forceinline vboolf4 shuffle(const vboolf4& v) {
|
||||
return shuffle<i0,i0,i0,i0>(v);
|
||||
template<size_t i0> __forceinline const vboolf4 shuffle( const vboolf4& b ) {
|
||||
return shuffle<i0,i0,i0,i0>(b);
|
||||
}
|
||||
|
||||
#if defined(__SSE3__)
|
||||
template<> __forceinline vboolf4 shuffle<0, 0, 2, 2>(const vboolf4& v) { return _mm_moveldup_ps(v); }
|
||||
template<> __forceinline vboolf4 shuffle<1, 1, 3, 3>(const vboolf4& v) { return _mm_movehdup_ps(v); }
|
||||
template<> __forceinline vboolf4 shuffle<0, 1, 0, 1>(const vboolf4& v) { return _mm_castpd_ps(_mm_movedup_pd(v)); }
|
||||
template<> __forceinline const vboolf4 shuffle<0, 0, 2, 2>( const vboolf4& a ) { return _mm_moveldup_ps(a); }
|
||||
template<> __forceinline const vboolf4 shuffle<1, 1, 3, 3>( const vboolf4& a ) { return _mm_movehdup_ps(a); }
|
||||
template<> __forceinline const vboolf4 shuffle<0, 1, 0, 1>( const vboolf4& a ) { return _mm_castpd_ps(_mm_movedup_pd (a)); }
|
||||
#endif
|
||||
|
||||
#if defined(__SSE4_1__)
|
||||
template<int dst, int src, int clr> __forceinline vboolf4 insert(const vboolf4& a, const vboolf4& b) { return _mm_insert_ps(a, b, (dst << 4) | (src << 6) | clr); }
|
||||
template<int dst, int src> __forceinline vboolf4 insert(const vboolf4& a, const vboolf4& b) { return insert<dst, src, 0>(a, b); }
|
||||
template<int dst> __forceinline vboolf4 insert(const vboolf4& a, const bool b) { return insert<dst, 0>(a, vboolf4(b)); }
|
||||
template<size_t dst, size_t src, size_t clr> __forceinline const vboolf4 insert( const vboolf4& a, const vboolf4& b ) { return _mm_insert_ps(a, b, (dst << 4) | (src << 6) | clr); }
|
||||
template<size_t dst, size_t src> __forceinline const vboolf4 insert( const vboolf4& a, const vboolf4& b ) { return insert<dst, src, 0>(a, b); }
|
||||
template<size_t dst> __forceinline const vboolf4 insert( const vboolf4& a, const bool b ) { return insert<dst,0>(a, vboolf4(b)); }
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Reduction Operations
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline bool reduce_and(const vboolf4& a) { return _mm_movemask_ps(a) == 0xf; }
|
||||
__forceinline bool reduce_or (const vboolf4& a) { return _mm_movemask_ps(a) != 0x0; }
|
||||
__forceinline bool reduce_and( const vboolf4& a ) { return _mm_movemask_ps(a) == 0xf; }
|
||||
__forceinline bool reduce_or ( const vboolf4& a ) { return _mm_movemask_ps(a) != 0x0; }
|
||||
|
||||
__forceinline bool all (const vboolf4& b) { return _mm_movemask_ps(b) == 0xf; }
|
||||
__forceinline bool any (const vboolf4& b) { return _mm_movemask_ps(b) != 0x0; }
|
||||
__forceinline bool none(const vboolf4& b) { return _mm_movemask_ps(b) == 0x0; }
|
||||
__forceinline bool all ( const vboolf4& b ) { return _mm_movemask_ps(b) == 0xf; }
|
||||
__forceinline bool any ( const vboolf4& b ) { return _mm_movemask_ps(b) != 0x0; }
|
||||
__forceinline bool none ( const vboolf4& b ) { return _mm_movemask_ps(b) == 0x0; }
|
||||
|
||||
__forceinline bool all (const vboolf4& valid, const vboolf4& b) { return all((!valid) | b); }
|
||||
__forceinline bool any (const vboolf4& valid, const vboolf4& b) { return any(valid & b); }
|
||||
__forceinline bool none(const vboolf4& valid, const vboolf4& b) { return none(valid & b); }
|
||||
__forceinline bool all ( const vboolf4& valid, const vboolf4& b ) { return all((!valid) | b); }
|
||||
__forceinline bool any ( const vboolf4& valid, const vboolf4& b ) { return any( valid & b); }
|
||||
__forceinline bool none ( const vboolf4& valid, const vboolf4& b ) { return none(valid & b); }
|
||||
|
||||
__forceinline size_t movemask(const vboolf4& a) { return _mm_movemask_ps(a); }
|
||||
__forceinline size_t movemask( const vboolf4& a ) { return _mm_movemask_ps(a); }
|
||||
#if defined(__SSE4_2__)
|
||||
__forceinline size_t popcnt(const vboolf4& a) { return popcnt((size_t)_mm_movemask_ps(a)); }
|
||||
__forceinline size_t popcnt( const vboolf4& a ) { return __popcnt((size_t)_mm_movemask_ps(a)); }
|
||||
#else
|
||||
__forceinline size_t popcnt(const vboolf4& a) { return bool(a[0])+bool(a[1])+bool(a[2])+bool(a[3]); }
|
||||
__forceinline size_t popcnt( const vboolf4& a ) { return bool(a[0])+bool(a[1])+bool(a[2])+bool(a[3]); }
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -167,7 +173,7 @@ namespace embree
|
||||
/// Output Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline embree_ostream operator <<(embree_ostream cout, const vboolf4& a) {
|
||||
inline std::ostream& operator<<(std::ostream& cout, const vboolf4& a) {
|
||||
return cout << "<" << a[0] << ", " << a[1] << ", " << a[2] << ", " << a[3] << ">";
|
||||
}
|
||||
}
|
||||
|
||||
+73
-69
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -9,8 +22,6 @@ namespace embree
|
||||
template<>
|
||||
struct vboolf<8>
|
||||
{
|
||||
ALIGNED_STRUCT_(32);
|
||||
|
||||
typedef vboolf8 Bool;
|
||||
typedef vint8 Int;
|
||||
typedef vfloat8 Float;
|
||||
@@ -26,16 +37,16 @@ namespace embree
|
||||
/// Constructors, Assignment & Cast Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf() {}
|
||||
__forceinline vboolf(const vboolf8& a) { v = a.v; }
|
||||
__forceinline vboolf8& operator =(const vboolf8& a) { v = a.v; return *this; }
|
||||
__forceinline vboolf () {}
|
||||
__forceinline vboolf ( const vboolf8& a ) { v = a.v; }
|
||||
__forceinline vboolf8& operator=( const vboolf8& a ) { v = a.v; return *this; }
|
||||
|
||||
__forceinline vboolf(__m256 a) : v(a) {}
|
||||
__forceinline operator const __m256&() const { return v; }
|
||||
__forceinline operator const __m256i() const { return _mm256_castps_si256(v); }
|
||||
__forceinline operator const __m256d() const { return _mm256_castps_pd(v); }
|
||||
__forceinline vboolf( const __m256 a ) : v(a) {}
|
||||
__forceinline operator const __m256&( void ) const { return v; }
|
||||
__forceinline operator const __m256i( void ) const { return _mm256_castps_si256(v); }
|
||||
__forceinline operator const __m256d( void ) const { return _mm256_castps_pd(v); }
|
||||
|
||||
__forceinline vboolf(int a)
|
||||
__forceinline vboolf ( const int a )
|
||||
{
|
||||
assert(a >= 0 && a <= 255);
|
||||
#if defined (__AVX2__)
|
||||
@@ -44,19 +55,19 @@ namespace embree
|
||||
const __m256i c = _mm256_and_si256(b,mask);
|
||||
v = _mm256_castsi256_ps(_mm256_cmpeq_epi32(c,mask));
|
||||
#else
|
||||
vl = mm_lookupmask_ps[a & 0xF];
|
||||
vh = mm_lookupmask_ps[a >> 4];
|
||||
vl = _mm_lookupmask_ps[a & 0xF];
|
||||
vh = _mm_lookupmask_ps[a >> 4];
|
||||
#endif
|
||||
}
|
||||
|
||||
__forceinline vboolf(const vboolf4& a) : v(_mm256_insertf128_ps(_mm256_castps128_ps256(a),a,1)) {}
|
||||
__forceinline vboolf(const vboolf4& a, const vboolf4& b) : v(_mm256_insertf128_ps(_mm256_castps128_ps256(a),b,1)) {}
|
||||
__forceinline vboolf(__m128 a, __m128 b) : vl(a), vh(b) {}
|
||||
__forceinline vboolf ( const vboolf4& a ) : v(_mm256_insertf128_ps(_mm256_castps128_ps256(a),a,1)) {}
|
||||
__forceinline vboolf ( const vboolf4& a, const vboolf4& b) : v(_mm256_insertf128_ps(_mm256_castps128_ps256(a),b,1)) {}
|
||||
__forceinline vboolf ( const __m128 a, const __m128 b) : vl(a), vh(b) {}
|
||||
|
||||
__forceinline vboolf(bool a) : v(vboolf8(vboolf4(a), vboolf4(a))) {}
|
||||
__forceinline vboolf(bool a, bool b) : v(vboolf8(vboolf4(a), vboolf4(b))) {}
|
||||
__forceinline vboolf(bool a, bool b, bool c, bool d) : v(vboolf8(vboolf4(a,b), vboolf4(c,d))) {}
|
||||
__forceinline vboolf(bool a, bool b, bool c, bool d, bool e, bool f, bool g, bool h) : v(vboolf8(vboolf4(a,b,c,d), vboolf4(e,f,g,h))) {}
|
||||
__forceinline vboolf ( bool a ) : v(vboolf8(vboolf4(a), vboolf4(a))) {}
|
||||
__forceinline vboolf ( bool a, bool b) : v(vboolf8(vboolf4(a), vboolf4(b))) {}
|
||||
__forceinline vboolf ( bool a, bool b, bool c, bool d) : v(vboolf8(vboolf4(a,b), vboolf4(c,d))) {}
|
||||
__forceinline vboolf ( bool a, bool b, bool c, bool d, bool e, bool f, bool g, bool vh ) : v(vboolf8(vboolf4(a,b,c,d), vboolf4(e,f,g,vh))) {}
|
||||
|
||||
/* return int32 mask */
|
||||
__forceinline __m256i mask32() const {
|
||||
@@ -67,45 +78,43 @@ namespace embree
|
||||
/// Constants
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf(FalseTy) : v(_mm256_setzero_ps()) {}
|
||||
__forceinline vboolf(TrueTy) : v(_mm256_cmp_ps(_mm256_setzero_ps(), _mm256_setzero_ps(), _CMP_EQ_OQ)) {}
|
||||
__forceinline vboolf( FalseTy ) : v(_mm256_setzero_ps()) {}
|
||||
__forceinline vboolf( TrueTy ) : v(_mm256_cmp_ps(_mm256_setzero_ps(), _mm256_setzero_ps(), _CMP_EQ_OQ)) {}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Array Access
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline bool operator [](size_t index) const { assert(index < 8); return (_mm256_movemask_ps(v) >> index) & 1; }
|
||||
__forceinline int& operator [](size_t index) { assert(index < 8); return i[index]; }
|
||||
__forceinline bool operator []( const size_t index ) const { assert(index < 8); return (_mm256_movemask_ps(v) >> index) & 1; }
|
||||
__forceinline int& operator []( const size_t index ) { assert(index < 8); return i[index]; }
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Unary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf8 operator !(const vboolf8& a) { return _mm256_xor_ps(a, vboolf8(embree::True)); }
|
||||
__forceinline const vboolf8 operator !( const vboolf8& a ) { return _mm256_xor_ps(a, vboolf8(embree::True)); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Binary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf8 operator &(const vboolf8& a, const vboolf8& b) { return _mm256_and_ps(a, b); }
|
||||
__forceinline vboolf8 operator |(const vboolf8& a, const vboolf8& b) { return _mm256_or_ps (a, b); }
|
||||
__forceinline vboolf8 operator ^(const vboolf8& a, const vboolf8& b) { return _mm256_xor_ps(a, b); }
|
||||
__forceinline const vboolf8 operator &( const vboolf8& a, const vboolf8& b ) { return _mm256_and_ps(a, b); }
|
||||
__forceinline const vboolf8 operator |( const vboolf8& a, const vboolf8& b ) { return _mm256_or_ps (a, b); }
|
||||
__forceinline const vboolf8 operator ^( const vboolf8& a, const vboolf8& b ) { return _mm256_xor_ps(a, b); }
|
||||
|
||||
__forceinline vboolf8 andn(const vboolf8& a, const vboolf8& b) { return _mm256_andnot_ps(b, a); }
|
||||
|
||||
__forceinline vboolf8& operator &=(vboolf8& a, const vboolf8& b) { return a = a & b; }
|
||||
__forceinline vboolf8& operator |=(vboolf8& a, const vboolf8& b) { return a = a | b; }
|
||||
__forceinline vboolf8& operator ^=(vboolf8& a, const vboolf8& b) { return a = a ^ b; }
|
||||
__forceinline vboolf8 operator &=( vboolf8& a, const vboolf8& b ) { return a = a & b; }
|
||||
__forceinline vboolf8 operator |=( vboolf8& a, const vboolf8& b ) { return a = a | b; }
|
||||
__forceinline vboolf8 operator ^=( vboolf8& a, const vboolf8& b ) { return a = a ^ b; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Comparison Operators + Select
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf8 operator !=(const vboolf8& a, const vboolf8& b) { return _mm256_xor_ps(a, b); }
|
||||
__forceinline vboolf8 operator ==(const vboolf8& a, const vboolf8& b) { return _mm256_xor_ps(_mm256_xor_ps(a,b),vboolf8(embree::True)); }
|
||||
__forceinline const vboolf8 operator !=( const vboolf8& a, const vboolf8& b ) { return _mm256_xor_ps(a, b); }
|
||||
__forceinline const vboolf8 operator ==( const vboolf8& a, const vboolf8& b ) { return _mm256_xor_ps(_mm256_xor_ps(a,b),vboolf8(embree::True)); }
|
||||
|
||||
__forceinline vboolf8 select(const vboolf8& mask, const vboolf8& t, const vboolf8& f) {
|
||||
__forceinline const vboolf8 select( const vboolf8& mask, const vboolf8& t, const vboolf8& f ) {
|
||||
return _mm256_blendv_ps(f, t, mask);
|
||||
}
|
||||
|
||||
@@ -113,59 +122,54 @@ namespace embree
|
||||
/// Movement/Shifting/Shuffling Functions
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf8 unpacklo(const vboolf8& a, const vboolf8& b) { return _mm256_unpacklo_ps(a, b); }
|
||||
__forceinline vboolf8 unpackhi(const vboolf8& a, const vboolf8& b) { return _mm256_unpackhi_ps(a, b); }
|
||||
__forceinline vboolf8 unpacklo( const vboolf8& a, const vboolf8& b ) { return _mm256_unpacklo_ps(a.v, b.v); }
|
||||
__forceinline vboolf8 unpackhi( const vboolf8& a, const vboolf8& b ) { return _mm256_unpackhi_ps(a.v, b.v); }
|
||||
|
||||
template<int i>
|
||||
__forceinline vboolf8 shuffle(const vboolf8& v) {
|
||||
return _mm256_permute_ps(v, _MM_SHUFFLE(i, i, i, i));
|
||||
template<size_t i> __forceinline const vboolf8 shuffle( const vboolf8& a ) {
|
||||
return _mm256_permute_ps(a, _MM_SHUFFLE(i, i, i, i));
|
||||
}
|
||||
|
||||
template<int i0, int i1>
|
||||
__forceinline vboolf8 shuffle4(const vboolf8& v) {
|
||||
return _mm256_permute2f128_ps(v, v, (i1 << 4) | (i0 << 0));
|
||||
template<size_t i0, size_t i1> __forceinline const vboolf8 shuffle4( const vboolf8& a ) {
|
||||
return _mm256_permute2f128_ps(a, a, (i1 << 4) | (i0 << 0));
|
||||
}
|
||||
|
||||
template<int i0, int i1>
|
||||
__forceinline vboolf8 shuffle4(const vboolf8& a, const vboolf8& b) {
|
||||
template<size_t i0, size_t i1> __forceinline const vboolf8 shuffle4( const vboolf8& a, const vboolf8& b) {
|
||||
return _mm256_permute2f128_ps(a, b, (i1 << 4) | (i0 << 0));
|
||||
}
|
||||
|
||||
template<int i0, int i1, int i2, int i3>
|
||||
__forceinline vboolf8 shuffle(const vboolf8& v) {
|
||||
return _mm256_permute_ps(v, _MM_SHUFFLE(i3, i2, i1, i0));
|
||||
template<size_t i0, size_t i1, size_t i2, size_t i3> __forceinline const vboolf8 shuffle( const vboolf8& a ) {
|
||||
return _mm256_permute_ps(a, _MM_SHUFFLE(i3, i2, i1, i0));
|
||||
}
|
||||
|
||||
template<int i0, int i1, int i2, int i3>
|
||||
__forceinline vboolf8 shuffle(const vboolf8& a, const vboolf8& b) {
|
||||
template<size_t i0, size_t i1, size_t i2, size_t i3> __forceinline const vboolf8 shuffle( const vboolf8& a, const vboolf8& b ) {
|
||||
return _mm256_shuffle_ps(a, b, _MM_SHUFFLE(i3, i2, i1, i0));
|
||||
}
|
||||
|
||||
template<> __forceinline vboolf8 shuffle<0, 0, 2, 2>(const vboolf8& v) { return _mm256_moveldup_ps(v); }
|
||||
template<> __forceinline vboolf8 shuffle<1, 1, 3, 3>(const vboolf8& v) { return _mm256_movehdup_ps(v); }
|
||||
template<> __forceinline vboolf8 shuffle<0, 1, 0, 1>(const vboolf8& v) { return _mm256_castpd_ps(_mm256_movedup_pd(_mm256_castps_pd(v))); }
|
||||
template<> __forceinline const vboolf8 shuffle<0, 0, 2, 2>( const vboolf8& b ) { return _mm256_moveldup_ps(b); }
|
||||
template<> __forceinline const vboolf8 shuffle<1, 1, 3, 3>( const vboolf8& b ) { return _mm256_movehdup_ps(b); }
|
||||
template<> __forceinline const vboolf8 shuffle<0, 1, 0, 1>( const vboolf8& b ) { return _mm256_castpd_ps(_mm256_movedup_pd(_mm256_castps_pd(b))); }
|
||||
|
||||
template<int i> __forceinline vboolf8 insert4(const vboolf8& a, const vboolf4& b) { return _mm256_insertf128_ps(a, b, i); }
|
||||
template<int i> __forceinline vboolf4 extract4 (const vboolf8& a) { return _mm256_extractf128_ps(a, i); }
|
||||
template<> __forceinline vboolf4 extract4<0>(const vboolf8& a) { return _mm256_castps256_ps128(a); }
|
||||
template<size_t i> __forceinline const vboolf8 insert4(const vboolf8& a, const vboolf4& b) { return _mm256_insertf128_ps(a, b, i); }
|
||||
template<size_t i> __forceinline const vboolf4 extract4 (const vboolf8& a) { return _mm256_extractf128_ps(a, i); }
|
||||
template<> __forceinline const vboolf4 extract4<0>(const vboolf8& a) { return _mm256_castps256_ps128(a); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Reduction Operations
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline bool reduce_and(const vboolf8& a) { return _mm256_movemask_ps(a) == (unsigned int)0xff; }
|
||||
__forceinline bool reduce_or (const vboolf8& a) { return !_mm256_testz_ps(a,a); }
|
||||
__forceinline bool reduce_and( const vboolf8& a ) { return _mm256_movemask_ps(a) == (unsigned int)0xff; }
|
||||
__forceinline bool reduce_or ( const vboolf8& a ) { return !_mm256_testz_ps(a,a); }
|
||||
|
||||
__forceinline bool all (const vboolf8& a) { return _mm256_movemask_ps(a) == (unsigned int)0xff; }
|
||||
__forceinline bool any (const vboolf8& a) { return !_mm256_testz_ps(a,a); }
|
||||
__forceinline bool none(const vboolf8& a) { return _mm256_testz_ps(a,a) != 0; }
|
||||
__forceinline bool all ( const vboolf8& a ) { return _mm256_movemask_ps(a) == (unsigned int)0xff; }
|
||||
__forceinline bool any ( const vboolf8& a ) { return !_mm256_testz_ps(a,a); }
|
||||
__forceinline bool none ( const vboolf8& a ) { return _mm256_testz_ps(a,a) != 0; }
|
||||
|
||||
__forceinline bool all (const vboolf8& valid, const vboolf8& b) { return all((!valid) | b); }
|
||||
__forceinline bool any (const vboolf8& valid, const vboolf8& b) { return any(valid & b); }
|
||||
__forceinline bool none(const vboolf8& valid, const vboolf8& b) { return none(valid & b); }
|
||||
__forceinline bool all ( const vboolf8& valid, const vboolf8& b ) { return all((!valid) | b); }
|
||||
__forceinline bool any ( const vboolf8& valid, const vboolf8& b ) { return any( valid & b); }
|
||||
__forceinline bool none ( const vboolf8& valid, const vboolf8& b ) { return none(valid & b); }
|
||||
|
||||
__forceinline unsigned int movemask(const vboolf8& a) { return _mm256_movemask_ps(a); }
|
||||
__forceinline size_t popcnt (const vboolf8& a) { return popcnt((size_t)_mm256_movemask_ps(a)); }
|
||||
__forceinline unsigned int movemask( const vboolf8& a ) { return _mm256_movemask_ps(a); }
|
||||
__forceinline size_t popcnt ( const vboolf8& a ) { return __popcnt((size_t)_mm256_movemask_ps(a)); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Get/Set Functions
|
||||
@@ -179,7 +183,7 @@ namespace embree
|
||||
/// Output Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline embree_ostream operator <<(embree_ostream cout, const vboolf8& a) {
|
||||
inline std::ostream& operator<<(std::ostream& cout, const vboolf8& a) {
|
||||
return cout << "<" << a[0] << ", " << a[1] << ", " << a[2] << ", " << a[3] << ", "
|
||||
<< a[4] << ", " << a[5] << ", " << a[6] << ", " << a[7] << ">";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Copyright 2009-2020 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// ======================================================================== //
|
||||
// Copyright 2009-2017 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -20,8 +33,8 @@ namespace embree
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf() {}
|
||||
__forceinline vboolf(const vboolf8& t) { v = t.v; }
|
||||
__forceinline vboolf8& operator =(const vboolf8& f) { v = f.v; return *this; }
|
||||
__forceinline vboolf(const vboolf8 &t) { v = t.v; }
|
||||
__forceinline vboolf8& operator=(const vboolf8 &f) { v = f.v; return *this; }
|
||||
|
||||
__forceinline vboolf(const __mmask8 &t) { v = t; }
|
||||
__forceinline operator __mmask8() const { return v; }
|
||||
@@ -30,9 +43,6 @@ namespace embree
|
||||
__forceinline vboolf(int t) { v = (__mmask8)t; }
|
||||
__forceinline vboolf(unsigned int t) { v = (__mmask8)t; }
|
||||
|
||||
__forceinline vboolf(bool a, bool b, bool c, bool d, bool e, bool f, bool g, bool h)
|
||||
: v((__mmask8)((int(h) << 7) | (int(g) << 6) | (int(f) << 5) | (int(e) << 4) | (int(d) << 3) | (int(c) << 2) | (int(b) << 1) | int(a))) {}
|
||||
|
||||
/* return int8 mask */
|
||||
__forceinline __m128i mask8() const {
|
||||
return _mm_movm_epi8(v);
|
||||
@@ -52,50 +62,42 @@ namespace embree
|
||||
/// Constants
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf(FalseTy) : v(0x00) {}
|
||||
__forceinline vboolf(TrueTy) : v(0xff) {}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Array Access
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline bool operator [](size_t index) const {
|
||||
assert(index < 8); return (mm512_mask2int(v) >> index) & 1;
|
||||
}
|
||||
__forceinline vboolf( FalseTy ) : v(0x00) {}
|
||||
__forceinline vboolf( TrueTy ) : v(0xff) {}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Unary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf8 operator !(const vboolf8& a) { return _mm512_knot(a); }
|
||||
__forceinline vboolf8 operator!(const vboolf8 &a) { return _mm512_knot(a); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Binary Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf8 operator &(const vboolf8& a, const vboolf8& b) { return _mm512_kand(a, b); }
|
||||
__forceinline vboolf8 operator |(const vboolf8& a, const vboolf8& b) { return _mm512_kor(a, b); }
|
||||
__forceinline vboolf8 operator ^(const vboolf8& a, const vboolf8& b) { return _mm512_kxor(a, b); }
|
||||
__forceinline vboolf8 operator&(const vboolf8 &a, const vboolf8 &b) { return _mm512_kand(a, b); }
|
||||
__forceinline vboolf8 operator|(const vboolf8 &a, const vboolf8 &b) { return _mm512_kor(a, b); }
|
||||
__forceinline vboolf8 operator^(const vboolf8 &a, const vboolf8 &b) { return _mm512_kxor(a, b); }
|
||||
|
||||
__forceinline vboolf8 andn(const vboolf8& a, const vboolf8& b) { return _mm512_kandn(b, a); }
|
||||
__forceinline vboolf8 andn(const vboolf8 &a, const vboolf8 &b) { return _mm512_kandn(b, a); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Assignment Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf8& operator &=(vboolf8& a, const vboolf8& b) { return a = a & b; }
|
||||
__forceinline vboolf8& operator |=(vboolf8& a, const vboolf8& b) { return a = a | b; }
|
||||
__forceinline vboolf8& operator ^=(vboolf8& a, const vboolf8& b) { return a = a ^ b; }
|
||||
__forceinline const vboolf8 operator &=( vboolf8& a, const vboolf8& b ) { return a = a & b; }
|
||||
__forceinline const vboolf8 operator |=( vboolf8& a, const vboolf8& b ) { return a = a | b; }
|
||||
__forceinline const vboolf8 operator ^=( vboolf8& a, const vboolf8& b ) { return a = a ^ b; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Comparison Operators + Select
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline vboolf8 operator !=(const vboolf8& a, const vboolf8& b) { return _mm512_kxor(a, b); }
|
||||
__forceinline vboolf8 operator ==(const vboolf8& a, const vboolf8& b) { return _mm512_kxnor(a, b); }
|
||||
__forceinline const vboolf8 operator !=( const vboolf8& a, const vboolf8& b ) { return _mm512_kxor(a, b); }
|
||||
__forceinline const vboolf8 operator ==( const vboolf8& a, const vboolf8& b ) { return _mm512_kxnor(a, b); }
|
||||
|
||||
__forceinline vboolf8 select(const vboolf8& s, const vboolf8& a, const vboolf8& b) {
|
||||
__forceinline vboolf8 select(const vboolf8 &s, const vboolf8 &a, const vboolf8 &b) {
|
||||
return _mm512_kor(_mm512_kand(s, a), _mm512_kandn(s, b));
|
||||
}
|
||||
|
||||
@@ -103,22 +105,22 @@ namespace embree
|
||||
/// Reduction Operations
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline int all (const vboolf8& a) { return a.v == 0xff; }
|
||||
__forceinline int any (const vboolf8& a) { return _mm512_kortestz(a, a) == 0; }
|
||||
__forceinline int none(const vboolf8& a) { return _mm512_kortestz(a, a) != 0; }
|
||||
__forceinline int all (const vboolf8 &a) { return a.v == 0xff; }
|
||||
__forceinline int any (const vboolf8 &a) { return _mm512_kortestz(a, a) == 0; }
|
||||
__forceinline int none(const vboolf8 &a) { return _mm512_kortestz(a, a) != 0; }
|
||||
|
||||
__forceinline int all (const vboolf8& valid, const vboolf8& b) { return all((!valid) | b); }
|
||||
__forceinline int any (const vboolf8& valid, const vboolf8& b) { return any(valid & b); }
|
||||
__forceinline int none(const vboolf8& valid, const vboolf8& b) { return none(valid & b); }
|
||||
__forceinline int all ( const vboolf8& valid, const vboolf8& b ) { return all((!valid) | b); }
|
||||
__forceinline int any ( const vboolf8& valid, const vboolf8& b ) { return any( valid & b); }
|
||||
__forceinline int none( const vboolf8& valid, const vboolf8& b ) { return none(valid & b); }
|
||||
|
||||
__forceinline size_t movemask(const vboolf8& a) { return _mm512_kmov(a); }
|
||||
__forceinline size_t popcnt (const vboolf8& a) { return popcnt(a.v); }
|
||||
__forceinline size_t movemask( const vboolf8& a ) { return _mm512_kmov(a); }
|
||||
__forceinline size_t popcnt ( const vboolf8& a ) { return __popcnt(a.v); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Conversion Operations
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline unsigned int toInt(const vboolf8& a) { return mm512_mask2int(a); }
|
||||
__forceinline unsigned int toInt(const vboolf8 &a) { return mm512_mask2int(a); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// Get/Set Functions
|
||||
@@ -132,7 +134,7 @@ namespace embree
|
||||
/// Output Operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__forceinline embree_ostream operator <<(embree_ostream cout, const vboolf8& a)
|
||||
inline std::ostream& operator<<(std::ostream& cout, const vboolf8& a)
|
||||
{
|
||||
cout << "<";
|
||||
for (size_t i=0; i<8; i++) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user