Skip to content

Commit eefbe65

Browse files
IRTK embree pathtracer fixes for stb (2024.0) (#2007)
* Flat dir updates for Embree PathTracingWithEmbree Signed-off-by: Carroll, Michael R <michael.r.carroll@intel.com> * embree pathtracer update for msvs debug paths updated but bug claimed in cmake Signed-off-by: Carroll, Michael R <michael.r.carroll@intel.com> --------- Signed-off-by: Carroll, Michael R <michael.r.carroll@intel.com>
1 parent 4ed1911 commit eefbe65

File tree

2 files changed

+50
-26
lines changed

2 files changed

+50
-26
lines changed

RenderingToolkit/Tutorial/PathTracingWithEmbree/cpu/CMakeLists.txt

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,44 @@ if(DEFINED ENV{ONEAPI_ROOT})
66
set(ONEAPI_ROOT "$ENV{ONEAPI_ROOT}")
77
message(STATUS "ONEAPI_ROOT FROM ENVIRONMENT: ${ONEAPI_ROOT}")
88
else()
9-
if(WIN32)
10-
set(ONEAPI_ROOT "C:/Program Files (x86)/Intel/oneAPI")
11-
else()
12-
set(ONEAPI_ROOT /opt/intel/oneapi)
13-
endif()
14-
message(STATUS "ONEAPI_ROOT DEFAULT: ${ONEAPI_ROOT}")
9+
message(FATAL_ERROR "ONEAPI_ROOT not set. Please use a vars script (.bat/.sh) from the oneAPI deployment directory")
1510
endif(DEFINED ENV{ONEAPI_ROOT})
1611

12+
set(EMBREE_BASE_DIR "")
13+
set(RKCOMMON_BASE_DIR "")
14+
set(TBB_BASE_DIR "")
15+
set(DEVUTILITIES_BASE_DIR "")
16+
set(COMPILERRUNTIMES_BASE_DIR "")
17+
set(PATHADDITIONS_DIRS "")
18+
if(EXISTS ${ONEAPI_ROOT}/oneapi-vars.sh OR EXISTS ${ONEAPI_ROOT}/oneapi-vars.bat)
19+
set(EMBREE_BASE_DIR ${ONEAPI_ROOT})
20+
set(RKCOMMON_BASE_DIR ${ONEAPI_ROOT})
21+
set(TBB_BASE_DIR ${ONEAPI_ROOT})
22+
set(DEVUTILITIES_BASE_DIR ${ONEAPI_ROOT})
23+
#Compiler runtimes help for windows MSVS debugger DLL help only
24+
set(COMPILERRUNTIMES_BASE_DIR ${ONEAPI_ROOT})
25+
set(PATHADDITIONS_DIRS "PATH=%PATH%;${ONEAPI_ROOT}/bin")
26+
else()
27+
set(EMBREE_BASE_DIR ${ONEAPI_ROOT}/embree/latest)
28+
set(RKCOMMON_BASE_DIR ${ONEAPI_ROOT}/rkcommon/latest)
29+
set(TBB_BASE_DIR ${ONEAPI_ROOT}/tbb/latest)
30+
set(DEVUTILITIES_BASE_DIR ${ONEAPI_ROOT}/dev-utilities/latest)
31+
#Compiler runtimes help for windows MSVS debugger DLL help only
32+
set(COMPILERRUNTIMES_BASE_DIR ${ONEAPI_ROOT}/compiler/latest)
33+
endif(EXISTS ${ONEAPI_ROOT}/oneapi-vars.sh OR EXISTS ${ONEAPI_ROOT}/oneapi-vars.bat)
34+
1735
#tbb is used for tasking in this example
18-
find_package(TBB REQUIRED PATHS ${ONEAPI_ROOT})
36+
find_package(TBB REQUIRED PATHS ${TBB_BASE_DIR}/lib/cmake NO_DEFAULT_PATH)
1937

20-
find_package(embree 4.0 REQUIRED PATHS ${ONEAPI_ROOT}/embree/latest/lib/cmake NO_DEFAULT_PATH)
38+
find_package(embree 4.0 REQUIRED PATHS ${EMBREE_BASE_DIR}/lib/cmake NO_DEFAULT_PATH)
2139

2240
#rkcommon objects for rendering are used in this example
23-
find_package(rkcommon REQUIRED CONFIG PATHS ${ONEAPI_ROOT}/rkcommon/latest/lib/cmake NO_DEFAULT_PATH)
41+
find_package(rkcommon REQUIRED CONFIG PATHS ${RKCOMMON_BASE_DIR}/lib/cmake NO_DEFAULT_PATH)
42+
43+
if(PATHADDITIONS_DIRS STREQUAL "")
44+
set(PATHADDITIONS_DIRS "PATH=%PATH%;${COMPILERRUNTIMES_BASE_DIR}/bin;${embree_DIR}/../../../bin;${rkcommon_DIR}/../../../bin;${tbb_DIR}/../../../bin;")
45+
endif(PATHADDITIONS_DIRS STREQUAL "")
46+
2447

2548
if(MSVC)
2649
set(CMAKE_CXX_STANDARD 11)
@@ -40,17 +63,18 @@ if (NOT CMAKE_BUILD_TYPE)
4063
endif(NOT CMAKE_BUILD_TYPE)
4164
endif(NOT MSVC)
4265

43-
#stb headers are located in dev-utilities. oneAPI 2022.2 release and earlier: these header only libraries are distributed with the oneAPI Base Toolkit.
44-
include_directories(${ONEAPI_ROOT}/dev-utilities/latest/include)
66+
#stb headers are located in dev-utilities with the old oneAPI dires layout
67+
include_directories(${DEVUTILITIES_BASE_DIR}/include)
4568

4669
set(HEADERS src/CornellBox.h src/DefaultCubeAndPlane.h src/Geometry.h src/Lights.h src/Materials.h src/PathTracer.h src/Pool.h src/Renderer.h src/SceneGraph.h src/Sphere.h src/definitions.h src/RandomSampler.h)
4770
add_executable(rkPathTracer src/rkPathTracer.cpp ${HEADERS})
4871

4972
if(MSVC)
73+
message(STATUS "Using ${PATHADDITIONS_DIRS} for the MSVS Debugger env")
5074
# Set MSVS debugger environment variables so it is easier to attach the MSVS debugger after altering the application
51-
set_target_properties(rkPathTracer
52-
PROPERTIES VS_DEBUGGER_ENVIRONMENT "PATH=%PATH%;${embree_DIR}/../../../bin;${rkcommon_DIR}/../../../bin;${tbb_DIR}/../../../bin;"
53-
)
75+
set_target_properties(rkPathTracer
76+
PROPERTIES VS_DEBUGGER_ENVIRONMENT ${PATHADDITIONS_DIRS}
77+
)
5478
endif(MSVC)
5579
target_link_libraries(rkPathTracer PRIVATE embree TBB::tbb rkcommon::rkcommon)
5680

RenderingToolkit/Tutorial/PathTracingWithEmbree/cpu/README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Path Tracing with Intel&reg; Embree Sample Program
22

3-
This sample program illustrates path tracing using Intel Embree from the Intel&reg; oneAPI Rendering Toolkit (Render Kit).
3+
This sample program illustrates path tracing using Intel Embree from the Intel&reg; Rendering Toolkit (Render Kit).
44

55
[![pathtracer-accu-cornell-spp1-accu4000-plength8-512x512.png](example-images/pathtracer-accu-cornell-spp1-accu4000-plength8-512x512.png)](example-images/pathtracer-accu-cornell-spp1-accu4000-plength8-512x512.png)
66

@@ -33,40 +33,40 @@ Make sure to try the [rkRayTracer](../IntroToRayTracingWithEmbree) sample progra
3333

3434
| Minimum Requirements | Description |
3535
|:-------------------- |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
36-
| OS | Linux* Ubuntu* 18.04 <br>CentOS* 8 (or compatible) <br>Windows* 10 <br>macOS* 10.15+ |
36+
| OS | Linux* Ubuntu* 18.04 <br>CentOS* 8 (or compatible) <br>Windows* 10 or 11<br>macOS* 10.15+ |
3737
| Hardware | <ul><li>Intel&reg; 64 (Intel 64 Penryn or higher with SSE4.1 extensions compatible) <ul><li>Intel Atom&reg; processors</li><li>Intel&reg; Core&trade; processor family</li><li>Intel&reg; Xeon&reg; processor family</li><li>Intel&reg; Xeon&reg; Scalable processor family</li></ul></li><li>ARM</li><ul><li>ARM64 with NEON extensions (ex: Apple* M1)</li></ul></li><li>Intel Embree is further optimized for Intel 64 Skylake or higher with AVX512 extensions</li></ul> |
3838
| Compiler Toolchain | Windows* OS: MSVS 2019 or MSVS 2022 with Windows* SDK and CMake* <br>Other platforms: C++14 compiler and CMake* |
39-
| Libraries | Install Intel oneAPI Rendering Toolkit (Render Kit) for Intel Embree and Intel&reg; oneAPI Threading Building Blocks (oneTBB) <br>Install Intel&reg; oneAPI Base Toolkit for the `dev-utilities` default component |
39+
| Libraries | Install Intel Rendering Toolkit (Render Kit) for Intel Embree and Intel&reg; oneAPI Threading Building Blocks (oneTBB) <br>Install Intel&reg; oneAPI Base Toolkit for the `dev-utilities` default component and Intel&reg; oneAPI DPC++ Compiler Runtimes |
4040
| Tools | .png capable image viewer |
4141

4242
## Build and Run
4343

4444
### Windows*
4545

46-
1. Open an x64 Native Tools Command Prompt for VS 2019 (or 2022).
46+
1. Open an x64 Native Tools Command Prompt for VS 2022 (or 2019).
4747

4848
2. Set toolkit environment variables.
4949

5050
> **Note**: If you have not already done so, set up your CLI
5151
> environment by sourcing the `setvars` script in the root of your oneAPI installation.
5252
>
5353
> Windows*:
54-
> - `C:\Program Files(x86)\Intel\oneAPI\setvars.bat`
55-
> - Windows PowerShell*, use the following command: `cmd.exe "/K" '"C:\Program Files (x86)\Intel\oneAPI\setvars.bat" && powershell'`
54+
> - `C:\Program Files(x86)\Intel\oneAPI\<version>\oneapi-vars.bat`
55+
> - Windows PowerShell*, use the following command: `cmd.exe "/K" '"C:\Program Files (x86)\Intel\oneAPI\<version>\oneapi-vars.bat" && powershell'`
5656
> For more information on configuring environment variables, see [Use the setvars Script with Windows*](https://www.intel.com/content/www/us/en/develop/documentation/oneapi-programming-guide/top/oneapi-development-environment-setup/use-the-setvars-script-with-windows.html).
5757
5858
3. Build and run the application:
5959

6060
```
6161
mkdir build
6262
cd build
63-
cmake -G"Visual Studio 16 2019" -A x64 ..
63+
cmake -G"Visual Studio 17 2022" -A x64 ..
6464
cmake --build . --config Release
6565
cd Release
6666
.\rkPathTracer.exe
6767
```
6868

69-
**Note**: Visual Studio 2022 users should use the `-G"Visual Studio 17 2022"`
69+
**Note**: Visual Studio 2019 users should use the `-G"Visual Studio 16 2019"`
7070
generator flag.
7171

7272
4. Open the resulting .png image files with an image viewer. The .png files will be in the working directory for the executing program.
@@ -87,9 +87,9 @@ devenv rkPathTracer.sln
8787
> environment by sourcing the `setvars` script in the root of your oneAPI installation.
8888
>
8989
> Linux*:
90-
> - For system wide installations: `. /opt/intel/oneapi/setvars.sh`
91-
> - For private installations: ` . ~/intel/oneapi/setvars.sh`
92-
> - For non-POSIX shells, like csh, use the following command: `bash -c 'source <install-dir>/setvars.sh ; exec csh'`
90+
> - For system wide installations: `. /opt/intel/oneapi/<version>/oneapi-vars.sh`
91+
> - For private installations: ` . ~/intel/oneapi/<version>/oneapi-vars.sh`
92+
> - For non-POSIX shells, like csh, use the following command: `bash -c 'source <install-dir>/<version>/oneapi-vars.sh ; exec csh'`
9393
> For more information on configuring environment variables, see [Use the setvars Script with Linux* or macOS*](https://www.intel.com/content/www/us/en/develop/documentation/oneapi-programming-guide/top/oneapi-development-environment-setup/use-the-setvars-script-with-linux-or-macos.html).
9494
9595
3. Build and run the application:
@@ -106,7 +106,7 @@ cmake --build .
106106

107107
### Build Troubleshoot
108108

109-
Imaging headers are used from `%ONEAPI_ROOT%\dev-utilities\latest\include`. If needed, these headers are also available common resources from the [oneAPI-samples](https://github.com/oneapi-src/oneAPI-samples/tree/master/common) GitHub repository.
109+
Imaging headers are used from `%ONEAPI_ROOT%\dev-utilities\latest\include` in the `stb` folder. If needed, these headers are also available common resources from the [oneAPI-samples](https://github.com/oneapi-src/oneAPI-samples/tree/master/common) GitHub repository.
110110

111111
## Path Tracing Concepts
112112

0 commit comments

Comments
 (0)