Skip to content

Commit 2eea9ec

Browse files
committed
Updated NRI, up[dated scripts, added macOS build, updated samples
1 parent 7813cb1 commit 2eea9ec

13 files changed

Lines changed: 836 additions & 139 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,52 @@ jobs:
4747

4848
- name: Build
4949
run: bash Scripts/Linux/2-Build.sh
50+
51+
Build-macOS:
52+
runs-on: macos-latest
53+
steps:
54+
- name: Checkout
55+
uses: actions/checkout@v4
56+
with:
57+
submodules: true
58+
59+
- name: Setup CMake
60+
uses: jwlawson/actions-setup-cmake@v2
61+
with:
62+
cmake-version: 'latest'
63+
64+
- name: Install dependencies
65+
run: brew install ninja
66+
67+
- name: Setup Vulkan SDK
68+
run: |
69+
version=$(curl --fail --silent --show-error --location --retry 3 https://vulkan.lunarg.com/sdk/latest/mac.txt)
70+
sdk="$RUNNER_TEMP/VulkanSDK/macOS"
71+
echo "VULKAN_SDK_VERSION=$version" >> "$GITHUB_ENV"
72+
echo "VULKAN_SDK=$sdk" >> "$GITHUB_ENV"
73+
echo "$sdk/bin" >> "$GITHUB_PATH"
74+
echo "DYLD_LIBRARY_PATH=$sdk/lib/VulkanLoader/lib:$sdk/lib${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}" >> "$GITHUB_ENV"
75+
76+
- name: Cache Vulkan SDK
77+
id: vulkan-cache
78+
uses: actions/cache@v4
79+
with:
80+
path: ${{ runner.temp }}/VulkanSDK
81+
key: vulkan-sdk-macos-${{ runner.arch }}-${{ env.VULKAN_SDK_VERSION }}
82+
83+
- name: Install Vulkan SDK
84+
if: steps.vulkan-cache.outputs.cache-hit != 'true'
85+
run: |
86+
curl --fail --location --retry 3 \
87+
"https://sdk.lunarg.com/sdk/download/$VULKAN_SDK_VERSION/mac/vulkansdk-macos-$VULKAN_SDK_VERSION.zip" \
88+
--output "$RUNNER_TEMP/vulkan-sdk.zip"
89+
unzip -q "$RUNNER_TEMP/vulkan-sdk.zip" -d "$RUNNER_TEMP/vulkan-installer"
90+
installer="vulkansdk-macOS-$VULKAN_SDK_VERSION"
91+
sudo "$RUNNER_TEMP/vulkan-installer/$installer.app/Contents/MacOS/$installer" \
92+
--root "$RUNNER_TEMP/VulkanSDK" --accept-licenses --default-answer --confirm-command install
93+
94+
- name: Deploy
95+
run: bash Scripts/MacOS/1-Deploy.sh
96+
97+
- name: Build
98+
run: bash Scripts/MacOS/2-Build.sh

‎README.md‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ This is the test bench for [*NRI (NVIDIA Rendering Interface)*](https://github.c
66

77
## Build instructions
88

9+
Scripts resolve the project root from their own location and can be launched from any working directory. Build output remains in `_Build` and `_Bin` at the project root.
10+
11+
To clean generated files, run `Scripts/Windows/4-Clean.bat`, `bash Scripts/Linux/4-Clean.sh` or `bash Scripts/MacOS/4-Clean.sh`. Cleanup also removes downloaded `_Data` and runs the matching cleanup scripts in NRIFramework and NRI.
12+
913
### Windows
1014

1115
- Install **WindowsSDK** and **VulkanSDK**
@@ -29,30 +33,26 @@ Or by running scripts only:
2933

3034
### macOS
3135

32-
- Install Xcode command line tools, CMake 3.30+, Ninja and the [Vulkan SDK](https://vulkan.lunarg.com/sdk/home#mac)
36+
- Install **Xcode** 26+ with command line tools and the Metal toolchain (`xcodebuild -downloadComponent MetalToolchain`)
37+
- Install **CMake** 3.30+ and **Ninja**
38+
- Install the [Vulkan SDK](https://vulkan.lunarg.com/sdk/home#mac) (provides *DXC*, required to compile shaders, and *Vulkan* through *MoltenVK*)
3339
- Source the Vulkan SDK's `setup-env.sh`
34-
- Run `bash Scripts/MacOS/1-Deploy.sh`, then `bash Scripts/MacOS/2-Build.sh`
35-
36-
Scripts resolve the project root from their own location and can be launched from any working directory. Build output remains in `_Build` and `_Bin` at the project root.
37-
38-
To clean generated files, run `Scripts/Windows/4-Clean.bat`, `bash Scripts/Linux/4-Clean.sh` or `bash Scripts/MacOS/4-Clean.sh`. Cleanup also removes downloaded `_Data` and runs the matching cleanup scripts in NRIFramework and NRI.
39-
40-
### macOS
41-
42-
- Install **Xcode** 26+ and the Metal toolchain (`xcodebuild -downloadComponent MetalToolchain`)
43-
- Install **VulkanSDK** (provides *DXC*, required to compile shaders, and *Vulkan* through *MoltenVK*)
4440
- Install **Metal Shader Converter** to run the samples on *Metal* (HLSL → DXIL → Metal, enabled automatically if installed, *Metal* becomes the default API; otherwise *Vulkan* is used)
4541
- Clone project and init submodules
4642
- Generate and build project using **cmake**
4743

44+
Or by running scripts only:
45+
- Run `bash Scripts/MacOS/1-Deploy.sh`
46+
- Run `bash Scripts/MacOS/2-Build.sh`
47+
4848
### CMake options
4949

5050
- `DISABLE_SHADER_COMPILATION` - disable compilation of shaders (shaders can be built on other platform)
5151
- `NRIF_USE_WAYLAND` - use Wayland instead of X11 on Linux
5252

5353
## How to run
5454

55-
The executables from `_Bin` directory load resources from `_Data`, therefore the samples need to be run with the working directory set to the project root folder. But the simplest way to run ALL samples sequentially is to click on `Scripts/Windows/3-Test samples.bat`, which sets the working directory to the project root.
55+
The executables from `_Bin` directory load resources from `_Data`, therefore the samples need to be run with the working directory set to the project root folder. To run all samples sequentially, use `Scripts/Windows/3-Test samples.bat`, `bash "Scripts/Linux/3-Test samples.sh"` or `bash "Scripts/MacOS/3-Test samples.sh"`. These scripts set the working directory to the project root. The Linux and macOS runners select backends enabled in `_Build/CMakeCache.txt`.
5656

5757
## Samples
5858

‎Scripts/Linux/3-Test samples.sh‎

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
#!/bin/bash
2+
set -u
3+
4+
cd "$(dirname "${BASH_SOURCE[0]}")/../.." || exit 1
5+
6+
DIR_BIN=""
7+
ADAPTER=0
8+
FAILED=0
9+
10+
for directory in _Bin/Release _Bin/Debug _Bin; do
11+
if [[ -x "$directory/DeviceInfo" ]]; then
12+
DIR_BIN="$directory"
13+
break
14+
fi
15+
done
16+
17+
if [[ -z "$DIR_BIN" ]]; then
18+
echo "The project is not compiled!"
19+
exit 1
20+
fi
21+
22+
API_NAMES=(VULKAN WGPU)
23+
API_OPTIONS=(VK WGPU)
24+
APIS=()
25+
for i in "${!API_NAMES[@]}"; do
26+
if [[ -f _Build/CMakeCache.txt ]] && ! grep -Eq "^NRI_ENABLE_${API_OPTIONS[$i]}_SUPPORT:BOOL=(ON|TRUE|1)$" _Build/CMakeCache.txt; then
27+
continue
28+
fi
29+
APIS+=("${API_NAMES[$i]}")
30+
done
31+
32+
if [[ ${#APIS[@]} -eq 0 ]]; then
33+
echo "No supported graphics APIs are enabled!"
34+
exit 1
35+
fi
36+
37+
echo "Running samples from '$DIR_BIN'..."
38+
echo
39+
40+
run_sample() {
41+
if "$@"; then
42+
echo "=> OK"
43+
else
44+
echo "=> FAILED!"
45+
FAILED=1
46+
fi
47+
echo
48+
}
49+
50+
test_sample() {
51+
local sample="$1"
52+
local api
53+
54+
# Wrapper is built only when the Vulkan SDK is available.
55+
if [[ "$sample" == Wrapper && ! -x "$DIR_BIN/$sample" ]]; then
56+
echo "Wrapper => SKIPPED (not built)"
57+
echo
58+
return
59+
fi
60+
61+
for api in "${APIS[@]}"; do
62+
echo "$sample [$api]"
63+
run_sample "$DIR_BIN/$sample" "--api=$api" --timeLimit=3 --debugAPI --debugNRI "--adapter=$ADAPTER"
64+
done
65+
}
66+
67+
# API independent samples
68+
run_sample "$DIR_BIN/DeviceInfo"
69+
70+
# API dependent samples
71+
test_sample AsyncCompute
72+
test_sample BindlessSceneViewer
73+
test_sample Buffers
74+
test_sample Clear
75+
test_sample ClearStorage
76+
test_sample CopyTests
77+
test_sample DescriptorPoolIndexing
78+
test_sample DescriptorHeapIndexing
79+
test_sample DescriptorManagement
80+
test_sample DedicatedQueues
81+
test_sample GraphicsPipelineStates
82+
test_sample GraphicsVertexInput
83+
test_sample InputAttachment
84+
test_sample IndirectCommands
85+
test_sample LowLatency
86+
test_sample MemoryAliasing
87+
test_sample MeshShader
88+
test_sample Multisample
89+
test_sample MultiThreading
90+
test_sample Multiview
91+
test_sample Queries
92+
test_sample RayTracingAdvanced
93+
test_sample RayTracingBoxes
94+
test_sample RayTracingTriangle
95+
test_sample Readback
96+
test_sample Resize
97+
test_sample ResolveSampleZero
98+
test_sample Resources
99+
test_sample SceneViewer
100+
test_sample Streamer
101+
test_sample TextureTypes
102+
test_sample Triangle
103+
test_sample Wrapper
104+
105+
exit "$FAILED"

‎Scripts/MacOS/3-Test samples.sh‎

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#!/bin/bash
2+
set -u
3+
4+
cd "$(dirname "${BASH_SOURCE[0]}")/../.." || exit 1
5+
6+
DIR_BIN=""
7+
ADAPTER=0
8+
FAILED=0
9+
10+
for directory in _Bin/Release _Bin/Debug _Bin; do
11+
if [[ -x "$directory/DeviceInfo" ]]; then
12+
DIR_BIN="$directory"
13+
break
14+
fi
15+
done
16+
17+
if [[ -z "$DIR_BIN" ]]; then
18+
echo "The project is not compiled!"
19+
exit 1
20+
fi
21+
22+
API_NAMES=(METAL VULKAN WGPU)
23+
API_OPTIONS=(METAL VK WGPU)
24+
APIS=()
25+
for i in "${!API_NAMES[@]}"; do
26+
if [[ -f _Build/CMakeCache.txt ]] && ! grep -Eq "^NRI_ENABLE_${API_OPTIONS[$i]}_SUPPORT:BOOL=(ON|TRUE|1)$" _Build/CMakeCache.txt; then
27+
continue
28+
fi
29+
if [[ "${API_NAMES[$i]}" == METAL && -f _Build/CMakeCache.txt ]] && ! grep -Eq '^NRI_ENABLE_METAL_SHADER_CONVERTER:BOOL=(ON|TRUE|1)$' _Build/CMakeCache.txt; then
30+
echo "Skipping METAL: samples require NRI_ENABLE_METAL_SHADER_CONVERTER."
31+
continue
32+
fi
33+
APIS+=("${API_NAMES[$i]}")
34+
done
35+
36+
if [[ ${#APIS[@]} -eq 0 ]]; then
37+
echo "No supported graphics APIs are enabled!"
38+
exit 1
39+
fi
40+
41+
echo "Running samples from '$DIR_BIN'..."
42+
echo
43+
44+
run_sample() {
45+
if "$@"; then
46+
echo "=> OK"
47+
else
48+
echo "=> FAILED!"
49+
FAILED=1
50+
fi
51+
echo
52+
}
53+
54+
test_sample() {
55+
local sample="$1"
56+
local api
57+
58+
# Wrapper is built only when the Vulkan SDK is available.
59+
if [[ "$sample" == Wrapper && ! -x "$DIR_BIN/$sample" ]]; then
60+
echo "Wrapper => SKIPPED (not built)"
61+
echo
62+
return
63+
fi
64+
65+
for api in "${APIS[@]}"; do
66+
echo "$sample [$api]"
67+
run_sample "$DIR_BIN/$sample" "--api=$api" --timeLimit=3 --debugAPI --debugNRI "--adapter=$ADAPTER"
68+
done
69+
}
70+
71+
# API independent samples
72+
run_sample "$DIR_BIN/DeviceInfo"
73+
74+
# API dependent samples
75+
test_sample AsyncCompute
76+
test_sample BindlessSceneViewer
77+
test_sample Buffers
78+
test_sample Clear
79+
test_sample ClearStorage
80+
test_sample CopyTests
81+
test_sample DescriptorPoolIndexing
82+
test_sample DescriptorHeapIndexing
83+
test_sample DescriptorManagement
84+
test_sample DedicatedQueues
85+
test_sample GraphicsPipelineStates
86+
test_sample GraphicsVertexInput
87+
test_sample InputAttachment
88+
test_sample IndirectCommands
89+
test_sample LowLatency
90+
test_sample MemoryAliasing
91+
test_sample MeshShader
92+
test_sample Multisample
93+
test_sample MultiThreading
94+
test_sample Multiview
95+
test_sample Queries
96+
test_sample RayTracingAdvanced
97+
test_sample RayTracingBoxes
98+
test_sample RayTracingTriangle
99+
test_sample Readback
100+
test_sample Resize
101+
test_sample ResolveSampleZero
102+
test_sample Resources
103+
test_sample SceneViewer
104+
test_sample Streamer
105+
test_sample TextureTypes
106+
test_sample Triangle
107+
test_sample Wrapper
108+
109+
exit "$FAILED"

‎Scripts/Windows/3-Test samples.bat‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ call :TestSample DescriptorHeapIndexing
4444
call :TestSample DescriptorManagement
4545
call :TestSample DedicatedQueues
4646
call :TestSample GraphicsPipelineStates
47+
call :TestSample GraphicsVertexInput
4748
call :TestSample InputAttachment
4849
call :TestSample IndirectCommands
4950
call :TestSample LowLatency

0 commit comments

Comments
 (0)