diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index c34cf92..c73507b 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -1,4 +1,4 @@ -name: Build binary wheels and sdist +name: Build and Publish on: push: @@ -7,52 +7,128 @@ on: workflow_dispatch: jobs: - build_wheels: - name: Build wheels on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ubuntu-20.04, windows-2019] + build: + name: Build wheel and sdist + runs-on: ubuntu-latest steps: - name: Checkout source - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Build wheels - uses: pypa/cibuildwheel@v2.1.3 - env: - CIBW_BUILD: cp37-* cp38-* cp39-* cp310-* - CIBW_SKIP: "*-win32 *-manylinux_i686" + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" - - uses: actions/upload-artifact@v2 + - name: Install build dependencies + run: | + python -m pip install -U pip + python -m pip install build twine + + - name: Build wheel and sdist + run: | + python -m build + + - name: Check distributions + run: | + twine check dist/* + + - name: List built files + run: | + ls -la dist/ + + - name: Upload wheel artifact + uses: actions/upload-artifact@v4 + with: + name: wheel + path: dist/*.whl + + - name: Upload sdist artifact + uses: actions/upload-artifact@v4 with: - path: ./wheelhouse/*.whl + name: sdist + path: dist/*.tar.gz - build_sdist: - name: Build sdist + # Optional: test the built wheel installs correctly + test-wheel: + name: Test wheel installation + needs: build runs-on: ubuntu-latest + steps: - - name: Checkout source - uses: actions/checkout@v2 + - name: Install Python + uses: actions/setup-python@v5 with: - fetch-depth: 0 + python-version: "3.12" - - name: Install Python - uses: actions/setup-python@v2 + - name: Download wheel + uses: actions/download-artifact@v4 with: - python-version: 3.9 + name: wheel + path: dist/ - - name: Install dependencies + - name: Install wheel and verify contents run: | - pip install setuptools>=42 wheel + # Install without importing (rtxpy requires cupy/GPU at import time) + python -m pip install dist/*.whl --no-deps + python -m pip install numpy - - name: Build sdist - run: | - python setup.py sdist + # Verify the package files are installed correctly + python -c " + import importlib.util + import os + + # Find where rtxpy was installed + spec = importlib.util.find_spec('rtxpy') + assert spec is not None, 'rtxpy package not found' + pkg_dir = os.path.dirname(spec.origin) + print(f'Package installed at: {pkg_dir}') - - uses: actions/upload-artifact@v2 + # Check that required files exist + init_path = os.path.join(pkg_dir, '__init__.py') + rtx_path = os.path.join(pkg_dir, 'rtx.py') + ptx_path = os.path.join(pkg_dir, 'kernel.ptx') + + assert os.path.exists(init_path), f'__init__.py not found' + assert os.path.exists(rtx_path), f'rtx.py not found' + assert os.path.exists(ptx_path), f'kernel.ptx not found' + + print('All required files present:') + print(f' - __init__.py') + print(f' - rtx.py') + print(f' - kernel.ptx') + print('Wheel installation test PASSED!') + " + + # Publish to PyPI (only on tag push, not workflow_dispatch) + publish: + name: Publish to PyPI + needs: [build, test-wheel] + runs-on: ubuntu-latest + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + + # Required for trusted publishing to PyPI + permissions: + id-token: write + + environment: + name: pypi + url: https://pypi.org/project/rtxpy/ + + steps: + - name: Download wheel + uses: actions/download-artifact@v4 with: - path: dist/*.tar.gz + name: wheel + path: dist/ + + - name: Download sdist + uses: actions/download-artifact@v4 + with: + name: sdist + path: dist/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/gpu-test-cleanup.yml b/.github/workflows/gpu-test-cleanup.yml new file mode 100644 index 0000000..830509c --- /dev/null +++ b/.github/workflows/gpu-test-cleanup.yml @@ -0,0 +1,45 @@ +name: GPU Test Cleanup + +# Remove the "GPU CI" label after GPU tests complete +# This requires maintainers to explicitly re-add the label for each test run +on: + workflow_run: + workflows: ["GPU Test"] + types: [completed] + +jobs: + remove-label: + name: Remove GPU CI Label + runs-on: ubuntu-latest + # Only run if there's an associated PR + if: github.event.workflow_run.event == 'pull_request' + + steps: + - name: Remove GPU CI label + uses: actions/github-script@v7 + with: + script: | + // Get the PR number from the workflow run + const prNumber = context.payload.workflow_run.pull_requests[0]?.number; + + if (!prNumber) { + console.log('No PR number found, skipping label removal'); + return; + } + + try { + await github.rest.issues.removeLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + name: 'GPU CI' + }); + console.log(`Removed "GPU CI" label from PR #${prNumber}`); + } catch (error) { + // Label might already be removed or not exist + if (error.status === 404) { + console.log('Label not found, may have already been removed'); + } else { + throw error; + } + } diff --git a/.github/workflows/gpu-test.yml b/.github/workflows/gpu-test.yml new file mode 100644 index 0000000..0e61d6a --- /dev/null +++ b/.github/workflows/gpu-test.yml @@ -0,0 +1,162 @@ +name: GPU Test + +# GPU tests are triggered by adding the "GPU CI" label to a PR +# This prevents expensive GPU runners from running on every commit +on: + pull_request: + types: [labeled] + +jobs: + gpu-test: + name: GPU Test ${{ matrix.python-version }} + # Only run when the "GPU CI" label is added + if: github.event.label.name == 'GPU CI' + + # Use the GPU runner group - you need to create this in your org settings + # Go to: Organization Settings > Actions > Runner groups > Create new runner group + # Select "NVIDIA GPU-Optimized Image for Linux" when creating the runner + runs-on: + group: gpu-runners + labels: linux-gpu + + strategy: + fail-fast: false + matrix: + python-version: ["3.12", "3.13"] + + steps: + - name: Checkout source + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Verify GPU + run: | + echo "=== NVIDIA GPU Info ===" + nvidia-smi + echo "" + echo "=== Driver version check ===" + echo "OptiX 7.7 requires driver 530.41+" + echo "OptiX 8.0 requires driver 535+" + echo "OptiX 9.1 requires driver 590+" + + - name: Install CUDA Toolkit + uses: Jimver/cuda-toolkit@v0.2.21 + id: cuda-toolkit + with: + cuda: '12.6.3' + method: 'network' + # Only install toolkit components, not drivers (runner already has drivers) + sub-packages: '["nvcc", "cudart-dev", "nvrtc-dev", "thrust"]' + + - name: Verify CUDA installation + run: | + echo "=== CUDA Version ===" + nvcc --version + echo "CUDA_PATH=${CUDA_PATH:-not set}" + echo "CUDA installed to: ${{ steps.cuda-toolkit.outputs.CUDA_PATH }}" + + - name: Install build dependencies + run: | + sudo apt-get update + sudo apt-get install -y cmake + + - name: Install OptiX SDK headers + run: | + # Clone NVIDIA's public OptiX headers repository + # This contains the minimal headers needed to build OptiX applications + # See: https://github.com/NVIDIA/optix-dev + OPTIX_DIR="/opt/optix" + sudo mkdir -p ${OPTIX_DIR} + sudo chown -R $(whoami) ${OPTIX_DIR} + + echo "=== Cloning OptiX SDK headers from NVIDIA/optix-dev ===" + # Use OptiX 7.7 for broader driver compatibility (requires driver 530.41+) + # OptiX 9.x requires R590+ drivers which may not be available on all runners + git clone --depth 1 --branch v7.7.0 --verbose https://github.com/NVIDIA/optix-dev.git ${OPTIX_DIR} + + # Debug: show what was cloned + echo "=== Contents of ${OPTIX_DIR} ===" + ls -la ${OPTIX_DIR} + echo "=== Contents of ${OPTIX_DIR}/include (if exists) ===" + ls -la ${OPTIX_DIR}/include/ 2>/dev/null || echo "include directory not found" + + # Verify the headers are present + if [ -f "${OPTIX_DIR}/include/optix.h" ]; then + echo "OptiX headers installed successfully at: ${OPTIX_DIR}" + echo "OptiX_INSTALL_DIR=${OPTIX_DIR}" >> $GITHUB_ENV + else + echo "ERROR: OptiX headers not found after clone" + echo "Attempting alternative: checking if files are in subdirectory..." + find ${OPTIX_DIR} -name "optix.h" 2>/dev/null || echo "optix.h not found anywhere" + exit 1 + fi + + - name: Compile PTX for target GPU + run: | + # Detect GPU compute capability + GPU_ARCH=$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader | head -1 | tr -d '.') + echo "Detected GPU compute capability: sm_${GPU_ARCH}" + + # Compile kernel.cu to PTX for the target architecture + echo "=== Compiling kernel.cu to PTX ===" + nvcc -ptx \ + -arch=sm_${GPU_ARCH} \ + -I${OptiX_INSTALL_DIR}/include \ + -I cuda \ + --use_fast_math \ + -o rtxpy/kernel.ptx \ + cuda/kernel.cu + + echo "=== PTX compiled successfully ===" + head -15 rtxpy/kernel.ptx + + - name: Install otk-pyoptix from source + run: | + echo "Using OptiX from: ${OptiX_INSTALL_DIR}" + + # Clone and install otk-pyoptix + git clone --depth 1 https://github.com/NVIDIA/otk-pyoptix.git /tmp/otk-pyoptix + cd /tmp/otk-pyoptix/optix + + # Install with OptiX path set + pip install . + + - name: Install rtxpy with CUDA dependencies + run: | + python -m pip install -U pip + python -m pip install -ve .[tests,cuda12] + python -m pip list + + - name: Run GPU tests + run: | + python -m pytest -v rtxpy/tests + + - name: Test basic ray tracing + run: | + python -c " + from rtxpy import RTX + import numpy as np + + # Simple triangle mesh test + verts = np.float32([0,0,0, 1,0,0, 0,1,0, 1,1,0]) + triangles = np.int32([0,1,2, 2,1,3]) + rays = np.float32([0.33,0.33,100, 0,0,0, -1,1000]) + hits = np.float32([0,0,0,0]) + + optix = RTX() + res = optix.build(0, verts, triangles) + assert res == 0, f'Build failed with {res}' + + res = optix.trace(rays, hits, 1) + assert res == 0, f'Trace failed with {res}' + + print(f'Hit result: t={hits[0]}, normal=({hits[1]}, {hits[2]}, {hits[3]})') + assert hits[0] > 0, 'Expected a hit' + print('GPU ray tracing test PASSED!') + " diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 14d395d..88436cd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,46 +7,32 @@ on: branches: [master] jobs: - test: - name: Test ${{ matrix.python-version }} ${{ matrix.os }} - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest] - python-version: ["3.11", "3.12", "3.13", "3.14"] - + # Lightweight checks that run on every PR (no GPU needed) + lint: + name: Lint & Import Check + runs-on: ubuntu-latest steps: - name: Checkout source - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Install Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python-version }} - - # Install CUDA toolkit (nvcc + CUDA_PATH) - - name: Install CUDA Toolkit - uses: Jimver/cuda-toolkit@v0.2.29 + - name: Install Python + uses: actions/setup-python@v5 with: - cuda: "12.3.0" + python-version: "3.12" - - name: Verify CUDA - shell: bash - run: | - echo "CUDA_PATH=$CUDA_PATH" - nvcc --version - - - name: Install rtxpy + - name: Install dependencies run: | python -m pip install -U pip - python -m pip install -ve .[tests] - python -m pip list + python -m pip install ruff - - name: Run tests + - name: Run ruff linter run: | - python -m pytest -v rtxpy/tests + ruff check rtxpy/ --output-format=github || true + - name: Check package structure + run: | + python -c "import ast; ast.parse(open('rtxpy/__init__.py').read())" + python -c "import ast; ast.parse(open('rtxpy/rtx.py').read())" + echo "Package syntax OK" diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 89a35d6..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,59 +0,0 @@ -cmake_minimum_required(VERSION 3.10) -project(rtxpy) - -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -add_definitions(-DRTX_EXPORTS) - -if (WIN32) - add_definitions(-D_CRT_SECURE_NO_WARNINGS) -endif() - -set(SOURCE_DIR "crtx") - -set(HEADERS - ${SOURCE_DIR}/common.h - ${SOURCE_DIR}/internal.h - ${SOURCE_DIR}/rtx.h -) - -set(SOURCES - ${SOURCE_DIR}/dllmain.cpp - ${SOURCE_DIR}/cuew/cuew.c -) - -add_library(${PROJECT_NAME} SHARED ${HEADERS} ${SOURCES}) -target_compile_definitions(${PROJECT_NAME} PRIVATE CUDA_NO_PROTOTYPES OPTIX_DONT_INCLUDE_CUDA) - -# ---- CUDA toolkit path (adjust if yours differs) ---- -set(CUDA_TOOLKIT_ROOT_DIR "/usr/local/cuda") -set(CUDA_INCLUDE_DIR "${CUDA_TOOLKIT_ROOT_DIR}/include") -set(CUDA_LIB_DIR "${CUDA_TOOLKIT_ROOT_DIR}/lib64") - -target_include_directories(${PROJECT_NAME} PRIVATE - ${SOURCE_DIR} - ${SOURCE_DIR}/optix_9.1/include - ${SOURCE_DIR}/optix_9.1 - ${SOURCE_DIR}/cuew - ${CUDA_INCLUDE_DIR} -) - -# Link search paths: -# - CUDA toolkit libs (cudart, etc.) live here -# - WSL provides the NVIDIA driver libcuda.so here -target_link_directories(${PROJECT_NAME} PRIVATE - ${CUDA_LIB_DIR} - /usr/lib/wsl/lib -) - -target_link_libraries(${PROJECT_NAME} PRIVATE - cuda # libcuda.so (driver API) - dl - pthread -) - -# Ensure runtime can find libcuda.so on WSL -target_link_options(${PROJECT_NAME} PRIVATE - "-Wl,-rpath,/usr/lib/wsl/lib" -) diff --git a/MANIFEST.in b/MANIFEST.in index 46bb81c..c43f378 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,3 @@ -# Extra files required in sdist -include CMakeLists.txt -recursive-include crtx *.h *.c *cpp *.cu *.sh *.ptx -recursive-include rtxpy *.ptx *.so +include README.md +include LICENSE +recursive-include rtxpy *.ptx diff --git a/README.md b/README.md index 9698bcf..e496475 100644 --- a/README.md +++ b/README.md @@ -2,99 +2,120 @@ Ray tracing using CUDA, accessible from Python. -## Hardware requirements +## Prerequisites - * Nvidia Maxwell GPU or newer - * Nvidia driver version: - * 456.71 or newer for Windows - * 455.28 or newer for Linux +- NVIDIA GPU with RTX support (Maxwell architecture or newer) +- NVIDIA driver version: + - 456.71 or newer for Windows + - 455.28 or newer for Linux +- OptiX SDK 7.6+ (set `OptiX_INSTALL_DIR` environment variable) +- CUDA 12.x+ ## Installation - pip install rtxpy +First, install the OptiX Python bindings (otk-pyoptix): -## Installation from source +```bash +export OptiX_INSTALL_DIR=/path/to/OptiX-SDK +pip install otk-pyoptix +``` -Requires CMake 3.10 or higher to build. +Then install rtxpy: -To install RTXpy from source use +```bash +pip install rtxpy +``` - pip install -ve . +## Installation from source -`cupy` is an optional runtime dependency. If you know the version of the CUDA -toolkit you have installed, which can be obtained by running `nvcc --version`, -you can install the appropriate `cupy` wheel. For example, for CUDA toolkit -11.2 use +To install RTXpy from source: - pip install cupy-cuda112 +```bash +export OptiX_INSTALL_DIR=/path/to/OptiX-SDK +pip install otk-pyoptix +pip install -ve . +``` -To run tests +To run tests: - pip install -ve .[tests] - pytest -v rtxpy/tests +```bash +pip install -ve .[tests] +pytest -v rtxpy/tests +``` +## Building kernel.ptx from source -## Building from source: +If you need to rebuild the PTX kernel (e.g., for a different GPU architecture or OptiX version): -### Building kernel.ptx ```bash -cd crtx -bash compileOptiX.sh -cp kernel.ptx ../rtxpy +# Detect your GPU's compute capability (e.g., 75 for Turing, 86 for Ampere) +GPU_ARCH=$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader | tr -d '.') + +# Compile for your GPU architecture +nvcc -ptx -o rtxpy/kernel.ptx cuda/kernel.cu \ + -arch=sm_${GPU_ARCH} \ + -I/path/to/OptiX-SDK/include \ + -I cuda \ + --use_fast_math ``` -### Building `librtxpy.so` -```bash -bash clean_build.sh -cp build/librtxpy.so ./rtxpy -``` +The CUDA source files are in the `cuda/` directory. + +## WSL2 Support -### Building on WSL2: -To get the build working on WSL, I followed the post below: +To get OptiX working on WSL2, follow the instructions from the NVIDIA forums: https://forums.developer.nvidia.com/t/problem-running-optix-7-6-in-wsl/239355/8 ---------------------- +Summary: +1. Install WSL 2 and enable CUDA +2. Download and extract the Linux display driver (e.g., `NVIDIA-Linux-x86_64-590.44.01.run`) +3. Extract with `./NVIDIA-Linux-x86_64-XXX.XX.run -x` +4. Copy the following files to `C:/Windows/System32/lxss/lib`: + - `libnvoptix.so.XXX.00` (rename to `libnvoptix.so.1`) + - `libnvidia-rtcore.so.XXX.00` (keep original name) + - `libnvidia-ptxjitcompiler.so.XXX.00` (rename to `libnvidia-ptxjitcompiler.so.1`) +5. Add `/usr/lib/wsl/lib` to your `LD_LIBRARY_PATH` +6. Reset WSL cache with `wsl --shutdown` from PowerShell -Welcome @chris.schwindt, +## Usage -I believe we’re not yet packaging OptiX into the WSL2 driver. I believe this is hung up on a redesign of the driver packaging and delivery process, which is why it’s taking such a long time. +```python +import numpy as np +from rtxpy import RTX -I have heard rumors that people have been able to get OptiX to work in WSL2 via manual install. This is unofficial and subject to change, so your mileage may vary, but here are some steps that may work for you: +# Create RTX instance +rtx = RTX() -Running OptiX Applications on WSL 2 -Install WSL 2 and enable CUDA -Follow the canonical methods for installing WSL, display driver, and CUDA Toolkit within WSL +# Define geometry (vertices and triangle indices) +verts = np.float32([0,0,0, 1,0,0, 0,1,0, 1,1,0]) +triangles = np.int32([0,1,2, 2,1,3]) -As mentioned in the docs, do not install a Linux Display driver in WSL, this will break the mapping of libcuda. -There are CUDA Toolkit downloads specifically for WSL that will not attempt to install a driver, only the toolkit. -You can also deselect the driver in a normal version of the toolkit. -Obtain OptiX / RTCore libraries for Linux -Download and extract libraries from the linux display driver. -You can run the driver installer in WSL using ./[driver filename].run -x which will unpack the driver but not install it. -Copy libnvoptix.so.XXX.00, libnvidia-rtcore.so.XXX.00, and libnvidia-ptxjitcompiler.so.XXX.00 into C:/Windows/System32/lxss/lib where XXX is the driver version. -Rename libnvoptix.so.XX.00 to libnvoptix.so.1 -Rename libnvidia-ptxjitcompiler.so.XXX.00 to libnvidia-ptxjitcompiler.so.1 -Do not rename libnvidia-rtcore.so.XXX.00 -Be aware that future drivers may need additional libraries that will need to be copied. -Building an OptiX Application -You may need to add /usr/local/cuda/bin to your PATH to access NVCC, but do NOT add /usr/local/cuda/lib64 to LD_LIBRARY_PATH as you normally would when installing the CUDA toolkit. libcuda and other libraries are passed through from C:/Windows/System32/lxss/lib where you placed the OptiX and RTCore libs. -Instead, add /usr/lib/wsl/lib to your LD_LIBRARY_PATH to pick up CUDA, OptiX, etc. -Running an OptiX Application -With LD_LIBRARY_PATH set per the previous step, you should be able to run an OptiX executable. -You may need to rebuild the WSL cache. You can do so by quitting any WSL sessions and running wsl --shutdown from Powershell, then starting a new WSL session. Failing to reset the cache may lead to strange load paths. -You may verify paths are correct using strace, e.g., strace -o trace ./bin/optixHello -– -David. +# Build acceleration structure +rtx.build(0, verts, triangles) ---------------------- +# Define rays: [ox, oy, oz, tmin, dx, dy, dz, tmax] +rays = np.float32([0.33, 0.33, 100, 0, 0, 0, -1, 1000]) +hits = np.float32([0, 0, 0, 0]) -I ended up downloading: https://uk.download.nvidia.com/XFree86/Linux-x86_64/590.44.01/NVIDIA-Linux-x86_64-590.44.01.run -Nvidia Driver: 591.44 +# Trace rays +rtx.trace(rays, hits, 1) -I then extract files and followed instructions above +# hits contains: [t, nx, ny, nz] +# t = distance to hit point (-1 if miss) +# nx, ny, nz = surface normal at hit point +print(hits) # [100.0, 0.0, 0.0, 1.0] +``` +For GPU-resident data, use CuPy arrays for better performance: -I then extracted -```bash -bash +```python +import cupy + +verts = cupy.float32([0,0,0, 1,0,0, 0,1,0, 1,1,0]) +triangles = cupy.int32([0,1,2, 2,1,3]) +rays = cupy.float32([0.33, 0.33, 100, 0, 0, 0, -1, 1000]) +hits = cupy.float32([0, 0, 0, 0]) + +rtx.build(0, verts, triangles) +rtx.trace(rays, hits, 1) ``` diff --git a/clean_build.sh b/clean_build.sh deleted file mode 100644 index 5138a27..0000000 --- a/clean_build.sh +++ /dev/null @@ -1,5 +0,0 @@ -rm -rf build -mkdir build -cd build -cmake .. -cmake --build . -j diff --git a/conda-recipe/README.md b/conda-recipe/README.md new file mode 100644 index 0000000..c8937cf --- /dev/null +++ b/conda-recipe/README.md @@ -0,0 +1,93 @@ +# RTXpy Conda Recipe + +This conda recipe builds rtxpy with all required dependencies including OptiX and CUDA support. + +## Prerequisites + +- NVIDIA GPU with compute capability 5.2+ (Maxwell or newer) +- NVIDIA driver 530.41+ (for OptiX 7.7 compatibility) +- conda-build installed + +## Building the Package + +### Basic build (auto-detect GPU architecture): + +```bash +conda build conda-recipe +``` + +### Build for a specific GPU architecture: + +```bash +# For Turing (RTX 20xx, T4) - sm_75 +GPU_ARCH=75 conda build conda-recipe + +# For Ampere (RTX 30xx, A100) - sm_86 +GPU_ARCH=86 conda build conda-recipe + +# For Ada Lovelace (RTX 40xx) - sm_89 +GPU_ARCH=89 conda build conda-recipe + +# For broad compatibility (Turing+) - sm_75 (default) +GPU_ARCH=75 conda build conda-recipe +``` + +### Build with a specific OptiX version: + +```bash +# Use OptiX 7.6 (requires driver 522.25+) +OPTIX_VERSION=7.6.0 conda build conda-recipe + +# Use OptiX 8.0 (requires driver 535+) +OPTIX_VERSION=8.0.0 conda build conda-recipe +``` + +## Installing the Built Package + +```bash +conda install --use-local rtxpy +``` + +## What the Build Does + +1. **Clones OptiX SDK headers** from NVIDIA/optix-dev (v7.7.0 by default) +2. **Detects GPU architecture** or uses the specified `GPU_ARCH` +3. **Compiles kernel.cu to PTX** for the target architecture +4. **Installs otk-pyoptix** from NVIDIA's repository +5. **Installs rtxpy** with the compiled PTX kernel + +## GPU Architecture Reference + +| GPU Series | Architecture | Compute Capability | +|------------|--------------|-------------------| +| GTX 900, Tesla M | Maxwell | sm_52 | +| GTX 1000, Tesla P | Pascal | sm_60, sm_61 | +| RTX 2000, Tesla T4 | Turing | sm_75 | +| RTX 3000, A100 | Ampere | sm_80, sm_86 | +| RTX 4000, L40 | Ada Lovelace | sm_89 | +| H100 | Hopper | sm_90 | + +## OptiX Version / Driver Requirements + +| OptiX Version | Minimum Driver | +|--------------|----------------| +| 7.6.0 | 522.25+ | +| 7.7.0 | 530.41+ | +| 8.0.0 | 535+ | +| 8.1.0 | 535+ | +| 9.0.0 | 560+ | +| 9.1.0 | 590+ | + +## Troubleshooting + +### "Unsupported ABI version" error +Your driver is too old for the OptiX version. Either: +- Update your NVIDIA driver, or +- Build with an older OptiX version: `OPTIX_VERSION=7.6.0 conda build conda-recipe` + +### "Invalid target architecture" error +The PTX was compiled for a different GPU. Rebuild with your GPU's architecture: +```bash +GPU_ARCH=$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader | tr -d '.') +conda build conda-recipe +``` diff --git a/conda-recipe/build.sh b/conda-recipe/build.sh new file mode 100755 index 0000000..4448fd8 --- /dev/null +++ b/conda-recipe/build.sh @@ -0,0 +1,74 @@ +#!/bin/bash +set -ex + +echo "=== RTXpy Conda Build ===" + +# --------------------------------------------------------------------------- +# Step 1: Install OptiX SDK headers +# --------------------------------------------------------------------------- +OPTIX_VERSION="${OPTIX_VERSION:-7.7.0}" +OPTIX_DIR="${SRC_DIR}/optix-sdk" + +echo "=== Installing OptiX SDK headers (v${OPTIX_VERSION}) ===" +git clone --depth 1 --branch "v${OPTIX_VERSION}" \ + https://github.com/NVIDIA/optix-dev.git "${OPTIX_DIR}" + +if [ ! -f "${OPTIX_DIR}/include/optix.h" ]; then + echo "ERROR: OptiX headers not found after clone" + exit 1 +fi + +export OptiX_INSTALL_DIR="${OPTIX_DIR}" +echo "OptiX headers installed at: ${OptiX_INSTALL_DIR}" + +# --------------------------------------------------------------------------- +# Step 2: Detect GPU architecture and compile PTX +# --------------------------------------------------------------------------- +echo "=== Compiling PTX kernel ===" + +# Try to detect GPU architecture, fall back to a compatible default +if command -v nvidia-smi &> /dev/null; then + GPU_ARCH_DETECTED=$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader 2>/dev/null | head -1 | tr -d '.') + if [ -n "${GPU_ARCH_DETECTED}" ]; then + GPU_ARCH="${GPU_ARCH:-${GPU_ARCH_DETECTED}}" + fi +fi + +# Default to sm_75 (Turing) - minimum supported by CUDA 12+ +# PTX is forward-compatible, so this will JIT-compile on newer GPUs +GPU_ARCH="${GPU_ARCH:-75}" + +echo "Target GPU architecture: sm_${GPU_ARCH}" + +nvcc -ptx \ + -arch="sm_${GPU_ARCH}" \ + -I"${OptiX_INSTALL_DIR}/include" \ + -I"${SRC_DIR}/cuda" \ + --use_fast_math \ + -o "${SRC_DIR}/rtxpy/kernel.ptx" \ + "${SRC_DIR}/cuda/kernel.cu" + +echo "PTX compiled successfully:" +head -15 "${SRC_DIR}/rtxpy/kernel.ptx" + +# --------------------------------------------------------------------------- +# Step 3: Install otk-pyoptix from source +# --------------------------------------------------------------------------- +echo "=== Installing otk-pyoptix ===" +OTK_PYOPTIX_DIR="${SRC_DIR}/otk-pyoptix" + +git clone --depth 1 https://github.com/NVIDIA/otk-pyoptix.git "${OTK_PYOPTIX_DIR}" +cd "${OTK_PYOPTIX_DIR}/optix" + +# Install otk-pyoptix +${PYTHON} -m pip install . --no-deps --no-build-isolation -vv + +# --------------------------------------------------------------------------- +# Step 4: Install rtxpy +# --------------------------------------------------------------------------- +echo "=== Installing rtxpy ===" +cd "${SRC_DIR}" + +${PYTHON} -m pip install . --no-deps --no-build-isolation -vv + +echo "=== RTXpy build complete ===" diff --git a/conda-recipe/conda_build_config.yaml b/conda-recipe/conda_build_config.yaml new file mode 100644 index 0000000..61f6258 --- /dev/null +++ b/conda-recipe/conda_build_config.yaml @@ -0,0 +1,16 @@ +# CUDA versions to build against +cuda_compiler_version: + - "12.6" + +# Python versions to support +python: + - "3.12" + - "3.13" + +# Pin numpy for ABI compatibility +numpy: + - "1.26" + +# Zip keys to create version combinations +zip_keys: + - - python diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml new file mode 100644 index 0000000..a03df75 --- /dev/null +++ b/conda-recipe/meta.yaml @@ -0,0 +1,67 @@ +{% set name = "rtxpy" %} +{% set version = "0.0.4" %} + +package: + name: {{ name|lower }} + version: {{ version }} + +source: + path: .. + +build: + number: 0 + skip: true # [not linux] + skip: true # [py<310] + script_env: + - OPTIX_VERSION=7.7.0 + # GPU_ARCH can be set by user, otherwise detected at build time + - GPU_ARCH + +requirements: + build: + - {{ compiler('c') }} + - {{ compiler('cxx') }} + - cmake + - git + - cuda-nvcc + - cuda-cudart-dev + - cuda-nvrtc-dev + + host: + - python + - pip + - setuptools >=68 + - wheel + - cuda-version >=12 + - cuda-cudart-dev + - cuda-nvrtc-dev + + run: + - python >=3.10 + - numpy >=1.21 + - cupy >=12.0 + - cuda-version >=12 + - __cuda + +test: + imports: + - rtxpy + requires: + - pytest + commands: + - python -c "from rtxpy import RTX; print('rtxpy imported successfully')" + +about: + home: https://github.com/makepath/rtxpy + license: MIT + license_family: MIT + license_file: LICENSE + summary: Ray tracing using CUDA accessible from Python + description: | + RTXpy provides GPU-accelerated ray-triangle intersection using + NVIDIA's OptiX ray tracing engine via the otk-pyoptix Python bindings. + dev_url: https://github.com/makepath/rtxpy + +extra: + recipe-maintainers: + - makepath diff --git a/crtx/compileOptiX.sh b/crtx/compileOptiX.sh deleted file mode 100644 index 19c7a7f..0000000 --- a/crtx/compileOptiX.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash -set -euo pipefail - -unameOut="$(uname -s)" -case "${unameOut}" in - Linux*) machine=Linux;; - Darwin*) machine=Mac;; - CYGWIN*) machine=Cygwin;; - MINGW*) machine=MinGw;; - *) machine="UNKNOWN:${unameOut}";; -esac - -mkdir -p external/shaders - -OPTIX_VERSION=9.1.0 - -if [ "${machine}" == "Linux" ] -then - echo "Setting up variables for Linux" - - NVCC="/usr/local/cuda/bin/nvcc" - COMPILER="g++" - - INCLUDES=( - -I"./optix_9.1" # <-- OptiX 9.1 headers vendored in this repo - -I"../include" - -I"/usr/local/cuda/samples/common/inc" # For helper_math.h / math_helper.h (CUDA samples) - ) - -elif [ "${machine}" == "MinGw" ] -then - echo "Setting up variables for Windows (Git Bash)" - - CUDA_VERSION=11.4 - INCLUDES=( - -I"./optix_7.1" # <-- also use vendored headers on Windows - -I"../include" - -I"/c/ProgramData/NVIDIA Corporation/CUDA Samples/v${CUDA_VERSION}/common/inc" - ) - - NVCC="/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v${CUDA_VERSION}/bin/nvcc" - COMPILER="/c/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64" -else - echo "Unsupported OS : ${machine}" - exit 1 -fi - -echo "Compiling for OptiX ${OPTIX_VERSION}" -echo "NVCC compiler currently set: ${NVCC}" -echo "C++ compiler currently set: ${COMPILER}" - -NVCC_FLAGS=( - -m64 - --std=c++11 - --use_fast_math - -cudart=static - -arch=sm_86 - -Xptxas -v -) - -rm -f kernel.ptx - -exec "${NVCC}" "${NVCC_FLAGS[@]}" -ccbin "${COMPILER}" "${INCLUDES[@]}" -ptx -o kernel.ptx kernel.cu \ - >> cudaoutput.txt | tee diff --git a/crtx/cuew/cuew.c b/crtx/cuew/cuew.c deleted file mode 100644 index e34f191..0000000 --- a/crtx/cuew/cuew.c +++ /dev/null @@ -1,913 +0,0 @@ -/* - * Copyright 2011-2014 Blender Foundation - * - * 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 - */ - -#ifdef _MSC_VER -# if _MSC_VER < 1900 -# define snprintf _snprintf -# endif -# define popen _popen -# define pclose _pclose -# ifndef _CRT_SECURE_NO_WARNINGS -# define _CRT_SECURE_NO_WARNINGS -# endif -#endif - -#include -#include -#include -#include -#include - -#ifdef _WIN32 -# define WIN32_LEAN_AND_MEAN -# define VC_EXTRALEAN -# include - - /* Utility macros. */ - -typedef HMODULE DynamicLibrary; - -# define dynamic_library_open(path) LoadLibraryA(path) -# define dynamic_library_close(lib) FreeLibrary(lib) -# define dynamic_library_find(lib, symbol) GetProcAddress(lib, symbol) -#else -# include - -typedef void* DynamicLibrary; - -# define dynamic_library_open(path) dlopen(path, RTLD_NOW) -# define dynamic_library_close(lib) dlclose(lib) -# define dynamic_library_find(lib, symbol) dlsym(lib, symbol) -#endif - -#define _LIBRARY_FIND_CHECKED(lib, name) \ - name = (t##name *)dynamic_library_find(lib, #name); \ - assert(name); - -#define _LIBRARY_FIND(lib, name) \ - name = (t##name *)dynamic_library_find(lib, #name); - -#define CUDA_LIBRARY_FIND_CHECKED(name) \ - _LIBRARY_FIND_CHECKED(cuda_lib, name) -#define CUDA_LIBRARY_FIND(name) _LIBRARY_FIND(cuda_lib, name) - -#define NVRTC_LIBRARY_FIND_CHECKED(name) \ - _LIBRARY_FIND_CHECKED(nvrtc_lib, name) -#define NVRTC_LIBRARY_FIND(name) _LIBRARY_FIND(nvrtc_lib, name) - -static DynamicLibrary cuda_lib; -static DynamicLibrary nvrtc_lib; - -/* Function definitions. */ -tcuGetErrorString* cuGetErrorString; -tcuGetErrorName* cuGetErrorName; -tcuInit* cuInit; -tcuDriverGetVersion* cuDriverGetVersion; -tcuDeviceGet* cuDeviceGet; -tcuDeviceGetCount* cuDeviceGetCount; -tcuDeviceGetName* cuDeviceGetName; -tcuDeviceGetUuid* cuDeviceGetUuid; -tcuDeviceTotalMem_v2* cuDeviceTotalMem_v2; -tcuDeviceGetAttribute* cuDeviceGetAttribute; -tcuDeviceGetProperties* cuDeviceGetProperties; -tcuDeviceComputeCapability* cuDeviceComputeCapability; -tcuDevicePrimaryCtxRetain* cuDevicePrimaryCtxRetain; -tcuDevicePrimaryCtxRelease* cuDevicePrimaryCtxRelease; -tcuDevicePrimaryCtxSetFlags* cuDevicePrimaryCtxSetFlags; -tcuDevicePrimaryCtxGetState* cuDevicePrimaryCtxGetState; -tcuDevicePrimaryCtxReset* cuDevicePrimaryCtxReset; -tcuCtxCreate_v2* cuCtxCreate_v2; -tcuCtxDestroy_v2* cuCtxDestroy_v2; -tcuCtxPushCurrent_v2* cuCtxPushCurrent_v2; -tcuCtxPopCurrent_v2* cuCtxPopCurrent_v2; -tcuCtxSetCurrent* cuCtxSetCurrent; -tcuCtxGetCurrent* cuCtxGetCurrent; -tcuCtxGetDevice* cuCtxGetDevice; -tcuCtxGetFlags* cuCtxGetFlags; -tcuCtxSynchronize* cuCtxSynchronize; -tcuCtxSetLimit* cuCtxSetLimit; -tcuCtxGetLimit* cuCtxGetLimit; -tcuCtxGetCacheConfig* cuCtxGetCacheConfig; -tcuCtxSetCacheConfig* cuCtxSetCacheConfig; -tcuCtxGetSharedMemConfig* cuCtxGetSharedMemConfig; -tcuCtxSetSharedMemConfig* cuCtxSetSharedMemConfig; -tcuCtxGetApiVersion* cuCtxGetApiVersion; -tcuCtxGetStreamPriorityRange* cuCtxGetStreamPriorityRange; -tcuCtxAttach* cuCtxAttach; -tcuCtxDetach* cuCtxDetach; -tcuModuleLoad* cuModuleLoad; -tcuModuleLoadData* cuModuleLoadData; -tcuModuleLoadDataEx* cuModuleLoadDataEx; -tcuModuleLoadFatBinary* cuModuleLoadFatBinary; -tcuModuleUnload* cuModuleUnload; -tcuModuleGetFunction* cuModuleGetFunction; -tcuModuleGetGlobal_v2* cuModuleGetGlobal_v2; -tcuModuleGetTexRef* cuModuleGetTexRef; -tcuModuleGetSurfRef* cuModuleGetSurfRef; -tcuLinkCreate_v2* cuLinkCreate_v2; -tcuLinkAddData_v2* cuLinkAddData_v2; -tcuLinkAddFile_v2* cuLinkAddFile_v2; -tcuLinkComplete* cuLinkComplete; -tcuLinkDestroy* cuLinkDestroy; -tcuMemGetInfo_v2* cuMemGetInfo_v2; -tcuMemAlloc_v2* cuMemAlloc_v2; -tcuMemAllocPitch_v2* cuMemAllocPitch_v2; -tcuMemFree_v2* cuMemFree_v2; -tcuMemGetAddressRange_v2* cuMemGetAddressRange_v2; -tcuMemAllocHost_v2* cuMemAllocHost_v2; -tcuMemFreeHost* cuMemFreeHost; -tcuMemHostAlloc* cuMemHostAlloc; -tcuMemHostGetDevicePointer_v2* cuMemHostGetDevicePointer_v2; -tcuMemHostGetFlags* cuMemHostGetFlags; -tcuMemAllocManaged* cuMemAllocManaged; -tcuDeviceGetByPCIBusId* cuDeviceGetByPCIBusId; -tcuDeviceGetPCIBusId* cuDeviceGetPCIBusId; -tcuIpcGetEventHandle* cuIpcGetEventHandle; -tcuIpcOpenEventHandle* cuIpcOpenEventHandle; -tcuIpcGetMemHandle* cuIpcGetMemHandle; -tcuIpcOpenMemHandle* cuIpcOpenMemHandle; -tcuIpcCloseMemHandle* cuIpcCloseMemHandle; -tcuMemHostRegister_v2* cuMemHostRegister_v2; -tcuMemHostUnregister* cuMemHostUnregister; -tcuMemcpy* cuMemcpy; -tcuMemcpyPeer* cuMemcpyPeer; -tcuMemcpyHtoD_v2* cuMemcpyHtoD_v2; -tcuMemcpyDtoH_v2* cuMemcpyDtoH_v2; -tcuMemcpyDtoD_v2* cuMemcpyDtoD_v2; -tcuMemcpyDtoA_v2* cuMemcpyDtoA_v2; -tcuMemcpyAtoD_v2* cuMemcpyAtoD_v2; -tcuMemcpyHtoA_v2* cuMemcpyHtoA_v2; -tcuMemcpyAtoH_v2* cuMemcpyAtoH_v2; -tcuMemcpyAtoA_v2* cuMemcpyAtoA_v2; -tcuMemcpy2D_v2* cuMemcpy2D_v2; -tcuMemcpy2DUnaligned_v2* cuMemcpy2DUnaligned_v2; -tcuMemcpy3D_v2* cuMemcpy3D_v2; -tcuMemcpy3DPeer* cuMemcpy3DPeer; -tcuMemcpyAsync* cuMemcpyAsync; -tcuMemcpyPeerAsync* cuMemcpyPeerAsync; -tcuMemcpyHtoDAsync_v2* cuMemcpyHtoDAsync_v2; -tcuMemcpyDtoHAsync_v2* cuMemcpyDtoHAsync_v2; -tcuMemcpyDtoDAsync_v2* cuMemcpyDtoDAsync_v2; -tcuMemcpyHtoAAsync_v2* cuMemcpyHtoAAsync_v2; -tcuMemcpyAtoHAsync_v2* cuMemcpyAtoHAsync_v2; -tcuMemcpy2DAsync_v2* cuMemcpy2DAsync_v2; -tcuMemcpy3DAsync_v2* cuMemcpy3DAsync_v2; -tcuMemcpy3DPeerAsync* cuMemcpy3DPeerAsync; -tcuMemsetD8_v2* cuMemsetD8_v2; -tcuMemsetD16_v2* cuMemsetD16_v2; -tcuMemsetD32_v2* cuMemsetD32_v2; -tcuMemsetD2D8_v2* cuMemsetD2D8_v2; -tcuMemsetD2D16_v2* cuMemsetD2D16_v2; -tcuMemsetD2D32_v2* cuMemsetD2D32_v2; -tcuMemsetD8Async* cuMemsetD8Async; -tcuMemsetD16Async* cuMemsetD16Async; -tcuMemsetD32Async* cuMemsetD32Async; -tcuMemsetD2D8Async* cuMemsetD2D8Async; -tcuMemsetD2D16Async* cuMemsetD2D16Async; -tcuMemsetD2D32Async* cuMemsetD2D32Async; -tcuArrayCreate_v2* cuArrayCreate_v2; -tcuArrayGetDescriptor_v2* cuArrayGetDescriptor_v2; -tcuArrayDestroy* cuArrayDestroy; -tcuArray3DCreate_v2* cuArray3DCreate_v2; -tcuArray3DGetDescriptor_v2* cuArray3DGetDescriptor_v2; -tcuMipmappedArrayCreate* cuMipmappedArrayCreate; -tcuMipmappedArrayGetLevel* cuMipmappedArrayGetLevel; -tcuMipmappedArrayDestroy* cuMipmappedArrayDestroy; -tcuPointerGetAttribute* cuPointerGetAttribute; -tcuMemPrefetchAsync* cuMemPrefetchAsync; -tcuMemAdvise* cuMemAdvise; -tcuMemRangeGetAttribute* cuMemRangeGetAttribute; -tcuMemRangeGetAttributes* cuMemRangeGetAttributes; -tcuPointerSetAttribute* cuPointerSetAttribute; -tcuPointerGetAttributes* cuPointerGetAttributes; -tcuStreamCreate* cuStreamCreate; -tcuStreamCreateWithPriority* cuStreamCreateWithPriority; -tcuStreamGetPriority* cuStreamGetPriority; -tcuStreamGetFlags* cuStreamGetFlags; -tcuStreamGetCtx* cuStreamGetCtx; -tcuStreamWaitEvent* cuStreamWaitEvent; -tcuStreamAddCallback* cuStreamAddCallback; -tcuStreamAttachMemAsync* cuStreamAttachMemAsync; -tcuStreamQuery* cuStreamQuery; -tcuStreamSynchronize* cuStreamSynchronize; -tcuStreamDestroy_v2* cuStreamDestroy_v2; -tcuEventCreate* cuEventCreate; -tcuEventRecord* cuEventRecord; -tcuEventQuery* cuEventQuery; -tcuEventSynchronize* cuEventSynchronize; -tcuEventDestroy_v2* cuEventDestroy_v2; -tcuEventElapsedTime* cuEventElapsedTime; -tcuStreamWaitValue32* cuStreamWaitValue32; -tcuStreamWaitValue64* cuStreamWaitValue64; -tcuStreamWriteValue32* cuStreamWriteValue32; -tcuStreamWriteValue64* cuStreamWriteValue64; -tcuStreamBatchMemOp* cuStreamBatchMemOp; -tcuFuncGetAttribute* cuFuncGetAttribute; -tcuFuncSetAttribute* cuFuncSetAttribute; -tcuFuncSetCacheConfig* cuFuncSetCacheConfig; -tcuFuncSetSharedMemConfig* cuFuncSetSharedMemConfig; -tcuLaunchKernel* cuLaunchKernel; -tcuLaunchCooperativeKernel* cuLaunchCooperativeKernel; -tcuLaunchCooperativeKernelMultiDevice* cuLaunchCooperativeKernelMultiDevice; -tcuFuncSetBlockShape* cuFuncSetBlockShape; -tcuFuncSetSharedSize* cuFuncSetSharedSize; -tcuParamSetSize* cuParamSetSize; -tcuParamSeti* cuParamSeti; -tcuParamSetf* cuParamSetf; -tcuParamSetv* cuParamSetv; -tcuLaunch* cuLaunch; -tcuLaunchGrid* cuLaunchGrid; -tcuLaunchGridAsync* cuLaunchGridAsync; -tcuParamSetTexRef* cuParamSetTexRef; -tcuOccupancyMaxActiveBlocksPerMultiprocessor* cuOccupancyMaxActiveBlocksPerMultiprocessor; -tcuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags* cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags; -tcuOccupancyMaxPotentialBlockSize* cuOccupancyMaxPotentialBlockSize; -tcuOccupancyMaxPotentialBlockSizeWithFlags* cuOccupancyMaxPotentialBlockSizeWithFlags; -tcuTexRefSetArray* cuTexRefSetArray; -tcuTexRefSetMipmappedArray* cuTexRefSetMipmappedArray; -tcuTexRefSetAddress_v2* cuTexRefSetAddress_v2; -tcuTexRefSetAddress2D_v3* cuTexRefSetAddress2D_v3; -tcuTexRefSetFormat* cuTexRefSetFormat; -tcuTexRefSetAddressMode* cuTexRefSetAddressMode; -tcuTexRefSetFilterMode* cuTexRefSetFilterMode; -tcuTexRefSetMipmapFilterMode* cuTexRefSetMipmapFilterMode; -tcuTexRefSetMipmapLevelBias* cuTexRefSetMipmapLevelBias; -tcuTexRefSetMipmapLevelClamp* cuTexRefSetMipmapLevelClamp; -tcuTexRefSetMaxAnisotropy* cuTexRefSetMaxAnisotropy; -tcuTexRefSetBorderColor* cuTexRefSetBorderColor; -tcuTexRefSetFlags* cuTexRefSetFlags; -tcuTexRefGetAddress_v2* cuTexRefGetAddress_v2; -tcuTexRefGetArray* cuTexRefGetArray; -tcuTexRefGetMipmappedArray* cuTexRefGetMipmappedArray; -tcuTexRefGetAddressMode* cuTexRefGetAddressMode; -tcuTexRefGetFilterMode* cuTexRefGetFilterMode; -tcuTexRefGetFormat* cuTexRefGetFormat; -tcuTexRefGetMipmapFilterMode* cuTexRefGetMipmapFilterMode; -tcuTexRefGetMipmapLevelBias* cuTexRefGetMipmapLevelBias; -tcuTexRefGetMipmapLevelClamp* cuTexRefGetMipmapLevelClamp; -tcuTexRefGetMaxAnisotropy* cuTexRefGetMaxAnisotropy; -tcuTexRefGetBorderColor* cuTexRefGetBorderColor; -tcuTexRefGetFlags* cuTexRefGetFlags; -tcuTexRefCreate* cuTexRefCreate; -tcuTexRefDestroy* cuTexRefDestroy; -tcuSurfRefSetArray* cuSurfRefSetArray; -tcuSurfRefGetArray* cuSurfRefGetArray; -tcuTexObjectCreate* cuTexObjectCreate; -tcuTexObjectDestroy* cuTexObjectDestroy; -tcuTexObjectGetResourceDesc* cuTexObjectGetResourceDesc; -tcuTexObjectGetTextureDesc* cuTexObjectGetTextureDesc; -tcuTexObjectGetResourceViewDesc* cuTexObjectGetResourceViewDesc; -tcuSurfObjectCreate* cuSurfObjectCreate; -tcuSurfObjectDestroy* cuSurfObjectDestroy; -tcuSurfObjectGetResourceDesc* cuSurfObjectGetResourceDesc; -tcuDeviceCanAccessPeer* cuDeviceCanAccessPeer; -tcuCtxEnablePeerAccess* cuCtxEnablePeerAccess; -tcuCtxDisablePeerAccess* cuCtxDisablePeerAccess; -tcuDeviceGetP2PAttribute* cuDeviceGetP2PAttribute; -tcuGraphicsUnregisterResource* cuGraphicsUnregisterResource; -tcuGraphicsSubResourceGetMappedArray* cuGraphicsSubResourceGetMappedArray; -tcuGraphicsResourceGetMappedMipmappedArray* cuGraphicsResourceGetMappedMipmappedArray; -tcuGraphicsResourceGetMappedPointer_v2* cuGraphicsResourceGetMappedPointer_v2; -tcuGraphicsResourceSetMapFlags_v2* cuGraphicsResourceSetMapFlags_v2; -tcuGraphicsMapResources* cuGraphicsMapResources; -tcuGraphicsUnmapResources* cuGraphicsUnmapResources; -tcuGetExportTable* cuGetExportTable; - -tcuGraphicsGLRegisterBuffer* cuGraphicsGLRegisterBuffer; -tcuGraphicsGLRegisterImage* cuGraphicsGLRegisterImage; -tcuGLGetDevices_v2* cuGLGetDevices_v2; -tcuGLCtxCreate_v2* cuGLCtxCreate_v2; -tcuGLInit* cuGLInit; -tcuGLRegisterBufferObject* cuGLRegisterBufferObject; -tcuGLMapBufferObject_v2* cuGLMapBufferObject_v2; -tcuGLUnmapBufferObject* cuGLUnmapBufferObject; -tcuGLUnregisterBufferObject* cuGLUnregisterBufferObject; -tcuGLSetBufferObjectMapFlags* cuGLSetBufferObjectMapFlags; -tcuGLMapBufferObjectAsync_v2* cuGLMapBufferObjectAsync_v2; -tcuGLUnmapBufferObjectAsync* cuGLUnmapBufferObjectAsync; - -tnvrtcGetErrorString* nvrtcGetErrorString; -tnvrtcVersion* nvrtcVersion; -tnvrtcCreateProgram* nvrtcCreateProgram; -tnvrtcDestroyProgram* nvrtcDestroyProgram; -tnvrtcCompileProgram* nvrtcCompileProgram; -tnvrtcGetPTXSize* nvrtcGetPTXSize; -tnvrtcGetPTX* nvrtcGetPTX; -tnvrtcGetProgramLogSize* nvrtcGetProgramLogSize; -tnvrtcGetProgramLog* nvrtcGetProgramLog; -tnvrtcAddNameExpression* nvrtcAddNameExpression; -tnvrtcGetLoweredName* nvrtcGetLoweredName; - - -static DynamicLibrary dynamic_library_open_find(const char** paths) { - int i = 0; - while (paths[i] != NULL) { - DynamicLibrary lib = dynamic_library_open(paths[i]); - if (lib != NULL) { - return lib; - } - ++i; - } - return NULL; -} - -/* Implementation function. */ -static void cuewCudaExit(void) { - if (cuda_lib != NULL) { - /* Ignore errors. */ - dynamic_library_close(cuda_lib); - cuda_lib = NULL; - } -} - -static int cuewCudaInit(void) { - /* Library paths. */ -#ifdef _WIN32 - /* Expected in c:/windows/system or similar, no path needed. */ - const char* cuda_paths[] = { "nvcuda.dll", NULL }; -#elif defined(__APPLE__) - /* Default installation path. */ - const char* cuda_paths[] = { "/usr/local/cuda/lib/libcuda.dylib", NULL }; -#else - const char* cuda_paths[] = { "libcuda.so", "libcuda.so.1", NULL }; -#endif - - int cuda_initialized = 0; - //static int cuda_initialized = 0; - static int result = 0; - int error, driver_version; - - if (cuda_initialized) { - return result; - } - - cuda_initialized = 1; - - error = atexit(cuewCudaExit); - if (error) { - result = CUEW_ERROR_ATEXIT_FAILED; - return result; - } - - /* Load library. */ - cuda_lib = dynamic_library_open_find(cuda_paths); - - if (cuda_lib == NULL) { - result = CUEW_ERROR_OPEN_FAILED; - return result; - } - - /* Detect driver version. */ - driver_version = 1000; - - CUDA_LIBRARY_FIND_CHECKED(cuDriverGetVersion); - if (cuDriverGetVersion) { - cuDriverGetVersion(&driver_version); - } - - /* We require version 4.0. */ - if (driver_version < 4000) { - result = CUEW_ERROR_OPEN_FAILED; - return result; - } - /* Fetch all function pointers. */ - CUDA_LIBRARY_FIND(cuGetErrorString); - CUDA_LIBRARY_FIND(cuGetErrorName); - CUDA_LIBRARY_FIND(cuInit); - CUDA_LIBRARY_FIND(cuDriverGetVersion); - CUDA_LIBRARY_FIND(cuDeviceGet); - CUDA_LIBRARY_FIND(cuDeviceGetCount); - CUDA_LIBRARY_FIND(cuDeviceGetName); - CUDA_LIBRARY_FIND(cuDeviceGetUuid); - CUDA_LIBRARY_FIND(cuDeviceTotalMem_v2); - CUDA_LIBRARY_FIND(cuDeviceGetAttribute); - CUDA_LIBRARY_FIND(cuDeviceGetProperties); - CUDA_LIBRARY_FIND(cuDeviceComputeCapability); - CUDA_LIBRARY_FIND(cuDevicePrimaryCtxRetain); - CUDA_LIBRARY_FIND(cuDevicePrimaryCtxRelease); - CUDA_LIBRARY_FIND(cuDevicePrimaryCtxSetFlags); - CUDA_LIBRARY_FIND(cuDevicePrimaryCtxGetState); - CUDA_LIBRARY_FIND(cuDevicePrimaryCtxReset); - CUDA_LIBRARY_FIND(cuCtxCreate_v2); - CUDA_LIBRARY_FIND(cuCtxDestroy_v2); - CUDA_LIBRARY_FIND(cuCtxPushCurrent_v2); - CUDA_LIBRARY_FIND(cuCtxPopCurrent_v2); - CUDA_LIBRARY_FIND(cuCtxSetCurrent); - CUDA_LIBRARY_FIND(cuCtxGetCurrent); - CUDA_LIBRARY_FIND(cuCtxGetDevice); - CUDA_LIBRARY_FIND(cuCtxGetFlags); - CUDA_LIBRARY_FIND(cuCtxSynchronize); - CUDA_LIBRARY_FIND(cuCtxSetLimit); - CUDA_LIBRARY_FIND(cuCtxGetLimit); - CUDA_LIBRARY_FIND(cuCtxGetCacheConfig); - CUDA_LIBRARY_FIND(cuCtxSetCacheConfig); - CUDA_LIBRARY_FIND(cuCtxGetSharedMemConfig); - CUDA_LIBRARY_FIND(cuCtxSetSharedMemConfig); - CUDA_LIBRARY_FIND(cuCtxGetApiVersion); - CUDA_LIBRARY_FIND(cuCtxGetStreamPriorityRange); - CUDA_LIBRARY_FIND(cuCtxAttach); - CUDA_LIBRARY_FIND(cuCtxDetach); - CUDA_LIBRARY_FIND(cuModuleLoad); - CUDA_LIBRARY_FIND(cuModuleLoadData); - CUDA_LIBRARY_FIND(cuModuleLoadDataEx); - CUDA_LIBRARY_FIND(cuModuleLoadFatBinary); - CUDA_LIBRARY_FIND(cuModuleUnload); - CUDA_LIBRARY_FIND(cuModuleGetFunction); - CUDA_LIBRARY_FIND(cuModuleGetGlobal_v2); - CUDA_LIBRARY_FIND(cuModuleGetTexRef); - CUDA_LIBRARY_FIND(cuModuleGetSurfRef); - CUDA_LIBRARY_FIND(cuLinkCreate_v2); - CUDA_LIBRARY_FIND(cuLinkAddData_v2); - CUDA_LIBRARY_FIND(cuLinkAddFile_v2); - CUDA_LIBRARY_FIND(cuLinkComplete); - CUDA_LIBRARY_FIND(cuLinkDestroy); - CUDA_LIBRARY_FIND(cuMemGetInfo_v2); - CUDA_LIBRARY_FIND(cuMemAlloc_v2); - CUDA_LIBRARY_FIND(cuMemAllocPitch_v2); - CUDA_LIBRARY_FIND(cuMemFree_v2); - CUDA_LIBRARY_FIND(cuMemGetAddressRange_v2); - CUDA_LIBRARY_FIND(cuMemAllocHost_v2); - CUDA_LIBRARY_FIND(cuMemFreeHost); - CUDA_LIBRARY_FIND(cuMemHostAlloc); - CUDA_LIBRARY_FIND(cuMemHostGetDevicePointer_v2); - CUDA_LIBRARY_FIND(cuMemHostGetFlags); - CUDA_LIBRARY_FIND(cuMemAllocManaged); - CUDA_LIBRARY_FIND(cuDeviceGetByPCIBusId); - CUDA_LIBRARY_FIND(cuDeviceGetPCIBusId); - CUDA_LIBRARY_FIND(cuIpcGetEventHandle); - CUDA_LIBRARY_FIND(cuIpcOpenEventHandle); - CUDA_LIBRARY_FIND(cuIpcGetMemHandle); - CUDA_LIBRARY_FIND(cuIpcOpenMemHandle); - CUDA_LIBRARY_FIND(cuIpcCloseMemHandle); - CUDA_LIBRARY_FIND(cuMemHostRegister_v2); - CUDA_LIBRARY_FIND(cuMemHostUnregister); - CUDA_LIBRARY_FIND(cuMemcpy); - CUDA_LIBRARY_FIND(cuMemcpyPeer); - CUDA_LIBRARY_FIND(cuMemcpyHtoD_v2); - CUDA_LIBRARY_FIND(cuMemcpyDtoH_v2); - CUDA_LIBRARY_FIND(cuMemcpyDtoD_v2); - CUDA_LIBRARY_FIND(cuMemcpyDtoA_v2); - CUDA_LIBRARY_FIND(cuMemcpyAtoD_v2); - CUDA_LIBRARY_FIND(cuMemcpyHtoA_v2); - CUDA_LIBRARY_FIND(cuMemcpyAtoH_v2); - CUDA_LIBRARY_FIND(cuMemcpyAtoA_v2); - CUDA_LIBRARY_FIND(cuMemcpy2D_v2); - CUDA_LIBRARY_FIND(cuMemcpy2DUnaligned_v2); - CUDA_LIBRARY_FIND(cuMemcpy3D_v2); - CUDA_LIBRARY_FIND(cuMemcpy3DPeer); - CUDA_LIBRARY_FIND(cuMemcpyAsync); - CUDA_LIBRARY_FIND(cuMemcpyPeerAsync); - CUDA_LIBRARY_FIND(cuMemcpyHtoDAsync_v2); - CUDA_LIBRARY_FIND(cuMemcpyDtoHAsync_v2); - CUDA_LIBRARY_FIND(cuMemcpyDtoDAsync_v2); - CUDA_LIBRARY_FIND(cuMemcpyHtoAAsync_v2); - CUDA_LIBRARY_FIND(cuMemcpyAtoHAsync_v2); - CUDA_LIBRARY_FIND(cuMemcpy2DAsync_v2); - CUDA_LIBRARY_FIND(cuMemcpy3DAsync_v2); - CUDA_LIBRARY_FIND(cuMemcpy3DPeerAsync); - CUDA_LIBRARY_FIND(cuMemsetD8_v2); - CUDA_LIBRARY_FIND(cuMemsetD16_v2); - CUDA_LIBRARY_FIND(cuMemsetD32_v2); - CUDA_LIBRARY_FIND(cuMemsetD2D8_v2); - CUDA_LIBRARY_FIND(cuMemsetD2D16_v2); - CUDA_LIBRARY_FIND(cuMemsetD2D32_v2); - CUDA_LIBRARY_FIND(cuMemsetD8Async); - CUDA_LIBRARY_FIND(cuMemsetD16Async); - CUDA_LIBRARY_FIND(cuMemsetD32Async); - CUDA_LIBRARY_FIND(cuMemsetD2D8Async); - CUDA_LIBRARY_FIND(cuMemsetD2D16Async); - CUDA_LIBRARY_FIND(cuMemsetD2D32Async); - CUDA_LIBRARY_FIND(cuArrayCreate_v2); - CUDA_LIBRARY_FIND(cuArrayGetDescriptor_v2); - CUDA_LIBRARY_FIND(cuArrayDestroy); - CUDA_LIBRARY_FIND(cuArray3DCreate_v2); - CUDA_LIBRARY_FIND(cuArray3DGetDescriptor_v2); - CUDA_LIBRARY_FIND(cuMipmappedArrayCreate); - CUDA_LIBRARY_FIND(cuMipmappedArrayGetLevel); - CUDA_LIBRARY_FIND(cuMipmappedArrayDestroy); - CUDA_LIBRARY_FIND(cuPointerGetAttribute); - CUDA_LIBRARY_FIND(cuMemPrefetchAsync); - CUDA_LIBRARY_FIND(cuMemAdvise); - CUDA_LIBRARY_FIND(cuMemRangeGetAttribute); - CUDA_LIBRARY_FIND(cuMemRangeGetAttributes); - CUDA_LIBRARY_FIND(cuPointerSetAttribute); - CUDA_LIBRARY_FIND(cuPointerGetAttributes); - CUDA_LIBRARY_FIND(cuStreamCreate); - CUDA_LIBRARY_FIND(cuStreamCreateWithPriority); - CUDA_LIBRARY_FIND(cuStreamGetPriority); - CUDA_LIBRARY_FIND(cuStreamGetFlags); - CUDA_LIBRARY_FIND(cuStreamGetCtx); - CUDA_LIBRARY_FIND(cuStreamWaitEvent); - CUDA_LIBRARY_FIND(cuStreamAddCallback); - CUDA_LIBRARY_FIND(cuStreamAttachMemAsync); - CUDA_LIBRARY_FIND(cuStreamQuery); - CUDA_LIBRARY_FIND(cuStreamSynchronize); - CUDA_LIBRARY_FIND(cuStreamDestroy_v2); - CUDA_LIBRARY_FIND(cuEventCreate); - CUDA_LIBRARY_FIND(cuEventRecord); - CUDA_LIBRARY_FIND(cuEventQuery); - CUDA_LIBRARY_FIND(cuEventSynchronize); - CUDA_LIBRARY_FIND(cuEventDestroy_v2); - CUDA_LIBRARY_FIND(cuEventElapsedTime); - CUDA_LIBRARY_FIND(cuStreamWaitValue32); - CUDA_LIBRARY_FIND(cuStreamWaitValue64); - CUDA_LIBRARY_FIND(cuStreamWriteValue32); - CUDA_LIBRARY_FIND(cuStreamWriteValue64); - CUDA_LIBRARY_FIND(cuStreamBatchMemOp); - CUDA_LIBRARY_FIND(cuFuncGetAttribute); - CUDA_LIBRARY_FIND(cuFuncSetAttribute); - CUDA_LIBRARY_FIND(cuFuncSetCacheConfig); - CUDA_LIBRARY_FIND(cuFuncSetSharedMemConfig); - CUDA_LIBRARY_FIND(cuLaunchKernel); - CUDA_LIBRARY_FIND(cuLaunchCooperativeKernel); - CUDA_LIBRARY_FIND(cuLaunchCooperativeKernelMultiDevice); - CUDA_LIBRARY_FIND(cuFuncSetBlockShape); - CUDA_LIBRARY_FIND(cuFuncSetSharedSize); - CUDA_LIBRARY_FIND(cuParamSetSize); - CUDA_LIBRARY_FIND(cuParamSeti); - CUDA_LIBRARY_FIND(cuParamSetf); - CUDA_LIBRARY_FIND(cuParamSetv); - CUDA_LIBRARY_FIND(cuLaunch); - CUDA_LIBRARY_FIND(cuLaunchGrid); - CUDA_LIBRARY_FIND(cuLaunchGridAsync); - CUDA_LIBRARY_FIND(cuParamSetTexRef); - CUDA_LIBRARY_FIND(cuOccupancyMaxActiveBlocksPerMultiprocessor); - CUDA_LIBRARY_FIND(cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags); - CUDA_LIBRARY_FIND(cuOccupancyMaxPotentialBlockSize); - CUDA_LIBRARY_FIND(cuOccupancyMaxPotentialBlockSizeWithFlags); - CUDA_LIBRARY_FIND(cuTexRefSetArray); - CUDA_LIBRARY_FIND(cuTexRefSetMipmappedArray); - CUDA_LIBRARY_FIND(cuTexRefSetAddress_v2); - CUDA_LIBRARY_FIND(cuTexRefSetAddress2D_v3); - CUDA_LIBRARY_FIND(cuTexRefSetFormat); - CUDA_LIBRARY_FIND(cuTexRefSetAddressMode); - CUDA_LIBRARY_FIND(cuTexRefSetFilterMode); - CUDA_LIBRARY_FIND(cuTexRefSetMipmapFilterMode); - CUDA_LIBRARY_FIND(cuTexRefSetMipmapLevelBias); - CUDA_LIBRARY_FIND(cuTexRefSetMipmapLevelClamp); - CUDA_LIBRARY_FIND(cuTexRefSetMaxAnisotropy); - CUDA_LIBRARY_FIND(cuTexRefSetBorderColor); - CUDA_LIBRARY_FIND(cuTexRefSetFlags); - CUDA_LIBRARY_FIND(cuTexRefGetAddress_v2); - CUDA_LIBRARY_FIND(cuTexRefGetArray); - CUDA_LIBRARY_FIND(cuTexRefGetMipmappedArray); - CUDA_LIBRARY_FIND(cuTexRefGetAddressMode); - CUDA_LIBRARY_FIND(cuTexRefGetFilterMode); - CUDA_LIBRARY_FIND(cuTexRefGetFormat); - CUDA_LIBRARY_FIND(cuTexRefGetMipmapFilterMode); - CUDA_LIBRARY_FIND(cuTexRefGetMipmapLevelBias); - CUDA_LIBRARY_FIND(cuTexRefGetMipmapLevelClamp); - CUDA_LIBRARY_FIND(cuTexRefGetMaxAnisotropy); - CUDA_LIBRARY_FIND(cuTexRefGetBorderColor); - CUDA_LIBRARY_FIND(cuTexRefGetFlags); - CUDA_LIBRARY_FIND(cuTexRefCreate); - CUDA_LIBRARY_FIND(cuTexRefDestroy); - CUDA_LIBRARY_FIND(cuSurfRefSetArray); - CUDA_LIBRARY_FIND(cuSurfRefGetArray); - CUDA_LIBRARY_FIND(cuTexObjectCreate); - CUDA_LIBRARY_FIND(cuTexObjectDestroy); - CUDA_LIBRARY_FIND(cuTexObjectGetResourceDesc); - CUDA_LIBRARY_FIND(cuTexObjectGetTextureDesc); - CUDA_LIBRARY_FIND(cuTexObjectGetResourceViewDesc); - CUDA_LIBRARY_FIND(cuSurfObjectCreate); - CUDA_LIBRARY_FIND(cuSurfObjectDestroy); - CUDA_LIBRARY_FIND(cuSurfObjectGetResourceDesc); - CUDA_LIBRARY_FIND(cuDeviceCanAccessPeer); - CUDA_LIBRARY_FIND(cuCtxEnablePeerAccess); - CUDA_LIBRARY_FIND(cuCtxDisablePeerAccess); - CUDA_LIBRARY_FIND(cuDeviceGetP2PAttribute); - CUDA_LIBRARY_FIND(cuGraphicsUnregisterResource); - CUDA_LIBRARY_FIND(cuGraphicsSubResourceGetMappedArray); - CUDA_LIBRARY_FIND(cuGraphicsResourceGetMappedMipmappedArray); - CUDA_LIBRARY_FIND(cuGraphicsResourceGetMappedPointer_v2); - CUDA_LIBRARY_FIND(cuGraphicsResourceSetMapFlags_v2); - CUDA_LIBRARY_FIND(cuGraphicsMapResources); - CUDA_LIBRARY_FIND(cuGraphicsUnmapResources); - CUDA_LIBRARY_FIND(cuGetExportTable); - - CUDA_LIBRARY_FIND(cuGraphicsGLRegisterBuffer); - CUDA_LIBRARY_FIND(cuGraphicsGLRegisterImage); - CUDA_LIBRARY_FIND(cuGLGetDevices_v2); - CUDA_LIBRARY_FIND(cuGLCtxCreate_v2); - CUDA_LIBRARY_FIND(cuGLInit); - CUDA_LIBRARY_FIND(cuGLRegisterBufferObject); - CUDA_LIBRARY_FIND(cuGLMapBufferObject_v2); - CUDA_LIBRARY_FIND(cuGLUnmapBufferObject); - CUDA_LIBRARY_FIND(cuGLUnregisterBufferObject); - CUDA_LIBRARY_FIND(cuGLSetBufferObjectMapFlags); - CUDA_LIBRARY_FIND(cuGLMapBufferObjectAsync_v2); - CUDA_LIBRARY_FIND(cuGLUnmapBufferObjectAsync); - - result = CUEW_SUCCESS; - return result; -} - -static void cuewExitNvrtc(void) { - if (nvrtc_lib != NULL) { - /* Ignore errors. */ - dynamic_library_close(nvrtc_lib); - nvrtc_lib = NULL; - } -} - -static int cuewNvrtcInit(void) { - /* Library paths. */ -#ifdef _WIN32 - /* Expected in c:/windows/system or similar, no path needed. */ - const char* nvrtc_paths[] = {"nvrtc64_112_0.dll", - "nvrtc64_110_0.dll", - "nvrtc64_101_0.dll", - "nvrtc64_100_0.dll", - "nvrtc64_91.dll", - "nvrtc64_90.dll", - "nvrtc64_80.dll", - NULL }; -#elif defined(__APPLE__) - /* Default installation path. */ - const char* nvrtc_paths[] = { "/usr/local/cuda/lib/libnvrtc.dylib", NULL }; -#else - const char* nvrtc_paths[] = { "libnvrtc.so", - # if defined(__x86_64__) || defined(_M_X64) - "/usr/local/cuda/lib64/libnvrtc.so", - #else - "/usr/local/cuda/lib/libnvrtc.so", - #endif - NULL }; -#endif - static int initialized = 0; - static int result = 0; - int error; - - if (initialized) { - return result; - } - - initialized = 1; - - error = atexit(cuewExitNvrtc); - if (error) { - result = CUEW_ERROR_ATEXIT_FAILED; - return result; - } - - /* Load library. */ - nvrtc_lib = dynamic_library_open_find(nvrtc_paths); - - if (nvrtc_lib == NULL) { - result = CUEW_ERROR_OPEN_FAILED; - return result; - } - - NVRTC_LIBRARY_FIND(nvrtcGetErrorString); - NVRTC_LIBRARY_FIND(nvrtcVersion); - NVRTC_LIBRARY_FIND(nvrtcCreateProgram); - NVRTC_LIBRARY_FIND(nvrtcDestroyProgram); - NVRTC_LIBRARY_FIND(nvrtcCompileProgram); - NVRTC_LIBRARY_FIND(nvrtcGetPTXSize); - NVRTC_LIBRARY_FIND(nvrtcGetPTX); - NVRTC_LIBRARY_FIND(nvrtcGetProgramLogSize); - NVRTC_LIBRARY_FIND(nvrtcGetProgramLog); - NVRTC_LIBRARY_FIND(nvrtcAddNameExpression); - NVRTC_LIBRARY_FIND(nvrtcGetLoweredName); - - result = CUEW_SUCCESS; - return result; -} - - -int cuewInit(cuuint32_t flags) { - int result = CUEW_SUCCESS; - - if (flags & CUEW_INIT_CUDA) { - result = cuewCudaInit(); - if (result != CUEW_SUCCESS) { - return result; - } - } - - if (flags & CUEW_INIT_NVRTC) { - result = cuewNvrtcInit(); - if (result != CUEW_SUCCESS) { - return result; - } - } - - return result; -} - - -const char* cuewErrorString(CUresult result) { - switch (result) { - case CUDA_SUCCESS: return "No errors"; - case CUDA_ERROR_INVALID_VALUE: return "Invalid value"; - case CUDA_ERROR_OUT_OF_MEMORY: return "Out of memory"; - case CUDA_ERROR_NOT_INITIALIZED: return "Driver not initialized"; - case CUDA_ERROR_DEINITIALIZED: return "Driver deinitialized"; - case CUDA_ERROR_PROFILER_DISABLED: return "Profiler disabled"; - case CUDA_ERROR_PROFILER_NOT_INITIALIZED: return "Profiler not initialized"; - case CUDA_ERROR_PROFILER_ALREADY_STARTED: return "Profiler already started"; - case CUDA_ERROR_PROFILER_ALREADY_STOPPED: return "Profiler already stopped"; - case CUDA_ERROR_NO_DEVICE: return "No CUDA-capable device available"; - case CUDA_ERROR_INVALID_DEVICE: return "Invalid device"; - case CUDA_ERROR_INVALID_IMAGE: return "Invalid kernel image"; - case CUDA_ERROR_INVALID_CONTEXT: return "Invalid context"; - case CUDA_ERROR_CONTEXT_ALREADY_CURRENT: return "Context already current"; - case CUDA_ERROR_MAP_FAILED: return "Map failed"; - case CUDA_ERROR_UNMAP_FAILED: return "Unmap failed"; - case CUDA_ERROR_ARRAY_IS_MAPPED: return "Array is mapped"; - case CUDA_ERROR_ALREADY_MAPPED: return "Already mapped"; - case CUDA_ERROR_NO_BINARY_FOR_GPU: return "No binary for GPU"; - case CUDA_ERROR_ALREADY_ACQUIRED: return "Already acquired"; - case CUDA_ERROR_NOT_MAPPED: return "Not mapped"; - case CUDA_ERROR_NOT_MAPPED_AS_ARRAY: return "Mapped resource not available for access as an array"; - case CUDA_ERROR_NOT_MAPPED_AS_POINTER: return "Mapped resource not available for access as a pointer"; - case CUDA_ERROR_ECC_UNCORRECTABLE: return "Uncorrectable ECC error detected"; - case CUDA_ERROR_UNSUPPORTED_LIMIT: return "CUlimit not supported by device"; - case CUDA_ERROR_CONTEXT_ALREADY_IN_USE: return "Context already in use"; - case CUDA_ERROR_PEER_ACCESS_UNSUPPORTED: return "Peer access unsupported"; - case CUDA_ERROR_INVALID_PTX: return "Invalid ptx"; - case CUDA_ERROR_INVALID_GRAPHICS_CONTEXT: return "Invalid graphics context"; - case CUDA_ERROR_NVLINK_UNCORRECTABLE: return "Nvlink uncorrectable"; - case CUDA_ERROR_JIT_COMPILER_NOT_FOUND: return "Jit compiler not found"; - case CUDA_ERROR_INVALID_SOURCE: return "Invalid source"; - case CUDA_ERROR_FILE_NOT_FOUND: return "File not found"; - case CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND: return "Link to a shared object failed to resolve"; - case CUDA_ERROR_SHARED_OBJECT_INIT_FAILED: return "Shared object initialization failed"; - case CUDA_ERROR_OPERATING_SYSTEM: return "Operating system"; - case CUDA_ERROR_INVALID_HANDLE: return "Invalid handle"; - case CUDA_ERROR_NOT_FOUND: return "Not found"; - case CUDA_ERROR_NOT_READY: return "CUDA not ready"; - case CUDA_ERROR_ILLEGAL_ADDRESS: return "Illegal address"; - case CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES: return "Launch exceeded resources"; - case CUDA_ERROR_LAUNCH_TIMEOUT: return "Launch exceeded timeout"; - case CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING: return "Launch with incompatible texturing"; - case CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED: return "Peer access already enabled"; - case CUDA_ERROR_PEER_ACCESS_NOT_ENABLED: return "Peer access not enabled"; - case CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE: return "Primary context active"; - case CUDA_ERROR_CONTEXT_IS_DESTROYED: return "Context is destroyed"; - case CUDA_ERROR_ASSERT: return "Assert"; - case CUDA_ERROR_TOO_MANY_PEERS: return "Too many peers"; - case CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED: return "Host memory already registered"; - case CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED: return "Host memory not registered"; - case CUDA_ERROR_HARDWARE_STACK_ERROR: return "Hardware stack error"; - case CUDA_ERROR_ILLEGAL_INSTRUCTION: return "Illegal instruction"; - case CUDA_ERROR_MISALIGNED_ADDRESS: return "Misaligned address"; - case CUDA_ERROR_INVALID_ADDRESS_SPACE: return "Invalid address space"; - case CUDA_ERROR_INVALID_PC: return "Invalid pc"; - case CUDA_ERROR_LAUNCH_FAILED: return "Launch failed"; - case CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE: return "Cooperative launch too large"; - case CUDA_ERROR_NOT_PERMITTED: return "Not permitted"; - case CUDA_ERROR_NOT_SUPPORTED: return "Not supported"; - case CUDA_ERROR_UNKNOWN: return "Unknown error"; - default: return "Unknown CUDA error value"; - } -} - -static void path_join(const char* path1, - const char* path2, - int maxlen, - char* result) { -#if defined(WIN32) || defined(_WIN32) - const char separator = '\\'; -#else - const char separator = '/'; -#endif - int n = snprintf(result, maxlen, "%s%c%s", path1, separator, path2); - if (n != -1 && n < maxlen) { - result[n] = '\0'; - } - else { - result[maxlen - 1] = '\0'; - } -} - -static int path_exists(const char* path) { - struct stat st; - if (stat(path, &st)) { - return 0; - } - return 1; -} - -const char* cuewCompilerPath(void) { -#ifdef _WIN32 - const char* defaultpaths[] = { "C:/CUDA/bin", NULL }; - const char* executable = "nvcc.exe"; -#else - const char* defaultpaths[] = { - "/Developer/NVIDIA/CUDA-5.0/bin", - "/usr/local/cuda-5.0/bin", - "/usr/local/cuda/bin", - "/Developer/NVIDIA/CUDA-6.0/bin", - "/usr/local/cuda-6.0/bin", - "/Developer/NVIDIA/CUDA-5.5/bin", - "/usr/local/cuda-5.5/bin", - NULL }; - const char* executable = "nvcc"; -#endif - int i; - - const char* binpath = getenv("CUDA_BIN_PATH"); - - static char nvcc[65536]; - - if (binpath) { - path_join(binpath, executable, sizeof(nvcc), nvcc); - if (path_exists(nvcc)) { - return nvcc; - } - } - - for (i = 0; defaultpaths[i]; ++i) { - path_join(defaultpaths[i], executable, sizeof(nvcc), nvcc); - if (path_exists(nvcc)) { - return nvcc; - } - } - -#ifndef _WIN32 - { - FILE* handle = popen("which nvcc", "r"); - if (handle) { - char buffer[4096] = { 0 }; - int len = fread(buffer, 1, sizeof(buffer) - 1, handle); - buffer[len] = '\0'; - pclose(handle); - if (buffer[0]) { - return "nvcc"; - } - } - } -#endif - - return NULL; -} - -int cuewNvrtcVersion(void) { - int major, minor; - if (nvrtcVersion) { - nvrtcVersion(&major, &minor); - return 10 * major + minor; - } - return 0; -} - -int cuewCompilerVersion(void) { - const char* path = cuewCompilerPath(); - const char* marker = "Cuda compilation tools, release "; - FILE* pipe; - int major, minor; - char* versionstr; - char buf[128]; - char output[65536] = "\0"; - char command[65536] = "\0"; - - if (path == NULL) { - return 0; - } - - /* get --version output */ - strncpy(command, path, sizeof(command)); - strncat(command, " --version", sizeof(command) - strlen(path)); - pipe = popen(command, "r"); - if (!pipe) { - fprintf(stderr, "CUDA: failed to run compiler to retrieve version"); - return 0; - } - - while (!feof(pipe)) { - if (fgets(buf, sizeof(buf), pipe) != NULL) { - strncat(output, buf, sizeof(output) - strlen(output) - 1); - } - } - - pclose(pipe); - - /* parse version number */ - versionstr = strstr(output, marker); - if (versionstr == NULL) { - fprintf(stderr, "CUDA: failed to find version number in:\n\n%s\n", output); - return 0; - } - versionstr += strlen(marker); - - if (sscanf(versionstr, "%d.%d", &major, &minor) < 2) { - fprintf(stderr, "CUDA: failed to parse version number from:\n\n%s\n", output); - return 0; - } - - return 10 * major + minor; -} diff --git a/crtx/cuew/cuew.h b/crtx/cuew/cuew.h deleted file mode 100644 index ab7fe28..0000000 --- a/crtx/cuew/cuew.h +++ /dev/null @@ -1,1392 +0,0 @@ -/* - * Copyright 2011-2014 Blender Foundation - * - * 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 - */ - -#ifndef __CUEW_H__ -#define __CUEW_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - - /* Defines. */ -#define CUEW_VERSION_MAJOR 2 -#define CUEW_VERSION_MINOR 0 - -#define CUDA_VERSION 9020 -#define CU_IPC_HANDLE_SIZE 64 -#define CU_STREAM_LEGACY ((CUstream)0x1) -#define CU_STREAM_PER_THREAD ((CUstream)0x2) -#define CU_MEMHOSTALLOC_PORTABLE 0x01 -#define CU_MEMHOSTALLOC_DEVICEMAP 0x02 -#define CU_MEMHOSTALLOC_WRITECOMBINED 0x04 -#define CU_MEMHOSTREGISTER_PORTABLE 0x01 -#define CU_MEMHOSTREGISTER_DEVICEMAP 0x02 -#define CU_MEMHOSTREGISTER_IOMEMORY 0x04 -#define CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_PRE_LAUNCH_SYNC 0x01 -#define CUDA_COOPERATIVE_LAUNCH_MULTI_DEVICE_NO_POST_LAUNCH_SYNC 0x02 -#define CUDA_ARRAY3D_LAYERED 0x01 -#define CUDA_ARRAY3D_2DARRAY 0x01 -#define CUDA_ARRAY3D_SURFACE_LDST 0x02 -#define CUDA_ARRAY3D_CUBEMAP 0x04 -#define CUDA_ARRAY3D_TEXTURE_GATHER 0x08 -#define CUDA_ARRAY3D_DEPTH_TEXTURE 0x10 -#define CU_TRSA_OVERRIDE_FORMAT 0x01 -#define CU_TRSF_READ_AS_INTEGER 0x01 -#define CU_TRSF_NORMALIZED_COORDINATES 0x02 -#define CU_TRSF_SRGB 0x10 -#define CU_LAUNCH_PARAM_END ((void*)0x00) -#define CU_LAUNCH_PARAM_BUFFER_POINTER ((void*)0x01) -#define CU_LAUNCH_PARAM_BUFFER_SIZE ((void*)0x02) -#define CU_PARAM_TR_DEFAULT -1 -#define CU_DEVICE_CPU ((CUdevice)-1) -#define CU_DEVICE_INVALID ((CUdevice)-2) - -/* Functions which changed 3.1 -> 3.2 for 64 bit stuff, - * the cuda library has both the old ones for compatibility and new - * ones with _v2 postfix, - */ -#define cuDeviceTotalMem cuDeviceTotalMem_v2 -#define cuCtxCreate cuCtxCreate_v2 -#define cuModuleGetGlobal cuModuleGetGlobal_v2 -#define cuMemGetInfo cuMemGetInfo_v2 -#define cuMemAlloc cuMemAlloc_v2 -#define cuMemAllocPitch cuMemAllocPitch_v2 -#define cuMemFree cuMemFree_v2 -#define cuMemGetAddressRange cuMemGetAddressRange_v2 -#define cuMemAllocHost cuMemAllocHost_v2 -#define cuMemHostGetDevicePointer cuMemHostGetDevicePointer_v2 -#define cuMemcpyHtoD cuMemcpyHtoD_v2 -#define cuMemcpyDtoH cuMemcpyDtoH_v2 -#define cuMemcpyDtoD cuMemcpyDtoD_v2 -#define cuMemcpyDtoA cuMemcpyDtoA_v2 -#define cuMemcpyAtoD cuMemcpyAtoD_v2 -#define cuMemcpyHtoA cuMemcpyHtoA_v2 -#define cuMemcpyAtoH cuMemcpyAtoH_v2 -#define cuMemcpyAtoA cuMemcpyAtoA_v2 -#define cuMemcpyHtoAAsync cuMemcpyHtoAAsync_v2 -#define cuMemcpyAtoHAsync cuMemcpyAtoHAsync_v2 -#define cuMemcpy2D cuMemcpy2D_v2 -#define cuMemcpy2DUnaligned cuMemcpy2DUnaligned_v2 -#define cuMemcpy3D cuMemcpy3D_v2 -#define cuMemcpyHtoDAsync cuMemcpyHtoDAsync_v2 -#define cuMemcpyDtoHAsync cuMemcpyDtoHAsync_v2 -#define cuMemcpyDtoDAsync cuMemcpyDtoDAsync_v2 -#define cuMemcpy2DAsync cuMemcpy2DAsync_v2 -#define cuMemcpy3DAsync cuMemcpy3DAsync_v2 -#define cuMemsetD8 cuMemsetD8_v2 -#define cuMemsetD16 cuMemsetD16_v2 -#define cuMemsetD32 cuMemsetD32_v2 -#define cuMemsetD2D8 cuMemsetD2D8_v2 -#define cuMemsetD2D16 cuMemsetD2D16_v2 -#define cuMemsetD2D32 cuMemsetD2D32_v2 -#define cuArrayCreate cuArrayCreate_v2 -#define cuArrayGetDescriptor cuArrayGetDescriptor_v2 -#define cuArray3DCreate cuArray3DCreate_v2 -#define cuArray3DGetDescriptor cuArray3DGetDescriptor_v2 -#define cuTexRefSetAddress cuTexRefSetAddress_v2 -#define cuTexRefGetAddress cuTexRefGetAddress_v2 -#define cuGraphicsResourceGetMappedPointer cuGraphicsResourceGetMappedPointer_v2 -#define cuCtxDestroy cuCtxDestroy_v2 -#define cuCtxPopCurrent cuCtxPopCurrent_v2 -#define cuCtxPushCurrent cuCtxPushCurrent_v2 -#define cuStreamDestroy cuStreamDestroy_v2 -#define cuEventDestroy cuEventDestroy_v2 -#define cuLinkCreate cuLinkCreate_v2 -#define cuLinkAddData cuLinkAddData_v2 -#define cuLinkAddFile cuLinkAddFile_v2 -#define cuMemHostRegister cuMemHostRegister_v2 -#define cuGraphicsResourceSetMapFlags cuGraphicsResourceSetMapFlags_v2 -#define cuTexRefSetAddress2D cuTexRefSetAddress2D_v2 -#define cuGLCtxCreate cuGLCtxCreate_v2 -#define cuGLMapBufferObject cuGLMapBufferObject_v2 -#define cuGLMapBufferObjectAsync cuGLMapBufferObjectAsync_v2 -#define cuGLGetDevices cuGLGetDevices_v2 - - /* Types. */ -#ifdef _MSC_VER - typedef unsigned __int32 cuuint32_t; - typedef unsigned __int64 cuuint64_t; -#else -#include - typedef uint32_t cuuint32_t; - typedef uint64_t cuuint64_t; -#endif - -#if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64) || defined (__aarch64__) - typedef unsigned long long CUdeviceptr; -#else - typedef unsigned int CUdeviceptr; -#endif - - -#ifdef _WIN32 -# define CUDAAPI __stdcall -# define CUDA_CB __stdcall -#else -# define CUDAAPI -# define CUDA_CB -#endif - - typedef int CUdevice; - typedef struct CUctx_st* CUcontext; - typedef struct CUmod_st* CUmodule; - typedef struct CUfunc_st* CUfunction; - typedef struct CUarray_st* CUarray; - typedef struct CUmipmappedArray_st* CUmipmappedArray; - typedef struct CUtexref_st* CUtexref; - typedef struct CUsurfref_st* CUsurfref; - typedef struct CUevent_st* CUevent; - typedef struct CUstream_st* CUstream; - typedef struct CUgraphicsResource_st* CUgraphicsResource; - typedef unsigned long long CUtexObject; - typedef unsigned long long CUsurfObject; - - typedef struct CUuuid_st { - char bytes[16]; - } CUuuid; - - typedef struct CUipcEventHandle_st { - char reserved[CU_IPC_HANDLE_SIZE]; - } CUipcEventHandle; - - typedef struct CUipcMemHandle_st { - char reserved[CU_IPC_HANDLE_SIZE]; - } CUipcMemHandle; - - typedef enum CUipcMem_flags_enum { - CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS = 0x1, - } CUipcMem_flags; - - typedef enum CUmemAttach_flags_enum { - CU_MEM_ATTACH_GLOBAL = 0x1, - CU_MEM_ATTACH_HOST = 0x2, - CU_MEM_ATTACH_SINGLE = 0x4, - } CUmemAttach_flags; - - typedef enum CUctx_flags_enum { - CU_CTX_SCHED_AUTO = 0x00, - CU_CTX_SCHED_SPIN = 0x01, - CU_CTX_SCHED_YIELD = 0x02, - CU_CTX_SCHED_BLOCKING_SYNC = 0x04, - CU_CTX_BLOCKING_SYNC = 0x04, - CU_CTX_SCHED_MASK = 0x07, - CU_CTX_MAP_HOST = 0x08, - CU_CTX_LMEM_RESIZE_TO_MAX = 0x10, - CU_CTX_FLAGS_MASK = 0x1f, - } CUctx_flags; - - typedef enum CUstream_flags_enum { - CU_STREAM_DEFAULT = 0x0, - CU_STREAM_NON_BLOCKING = 0x1, - } CUstream_flags; - - typedef enum CUevent_flags_enum { - CU_EVENT_DEFAULT = 0x0, - CU_EVENT_BLOCKING_SYNC = 0x1, - CU_EVENT_DISABLE_TIMING = 0x2, - CU_EVENT_INTERPROCESS = 0x4, - } CUevent_flags; - - typedef enum CUstreamWaitValue_flags_enum { - CU_STREAM_WAIT_VALUE_GEQ = 0x0, - CU_STREAM_WAIT_VALUE_EQ = 0x1, - CU_STREAM_WAIT_VALUE_AND = 0x2, - CU_STREAM_WAIT_VALUE_NOR = 0x3, - CU_STREAM_WAIT_VALUE_FLUSH = (1 << 30), - } CUstreamWaitValue_flags; - - typedef enum CUstreamWriteValue_flags_enum { - CU_STREAM_WRITE_VALUE_DEFAULT = 0x0, - CU_STREAM_WRITE_VALUE_NO_MEMORY_BARRIER = 0x1, - } CUstreamWriteValue_flags; - - typedef enum CUstreamBatchMemOpType_enum { - CU_STREAM_MEM_OP_WAIT_VALUE_32 = 1, - CU_STREAM_MEM_OP_WRITE_VALUE_32 = 2, - CU_STREAM_MEM_OP_WAIT_VALUE_64 = 4, - CU_STREAM_MEM_OP_WRITE_VALUE_64 = 5, - CU_STREAM_MEM_OP_FLUSH_REMOTE_WRITES = 3, - } CUstreamBatchMemOpType; - - typedef union CUstreamBatchMemOpParams_union { - CUstreamBatchMemOpType operation; - struct CUstreamMemOpWaitValueParams_st { - CUstreamBatchMemOpType operation; - CUdeviceptr address; - union { - cuuint32_t value; - cuuint64_t value64; - }; - unsigned int flags; - CUdeviceptr alias; - } waitValue; - struct CUstreamMemOpWriteValueParams_st { - CUstreamBatchMemOpType operation; - CUdeviceptr address; - union { - cuuint32_t value; - cuuint64_t value64; - }; - unsigned int flags; - CUdeviceptr alias; - } writeValue; - struct CUstreamMemOpFlushRemoteWritesParams_st { - CUstreamBatchMemOpType operation; - unsigned int flags; - } flushRemoteWrites; - cuuint64_t pad[6]; - } CUstreamBatchMemOpParams; - - typedef enum CUoccupancy_flags_enum { - CU_OCCUPANCY_DEFAULT = 0x0, - CU_OCCUPANCY_DISABLE_CACHING_OVERRIDE = 0x1, - } CUoccupancy_flags; - - typedef enum CUarray_format_enum { - CU_AD_FORMAT_UNSIGNED_INT8 = 0x01, - CU_AD_FORMAT_UNSIGNED_INT16 = 0x02, - CU_AD_FORMAT_UNSIGNED_INT32 = 0x03, - CU_AD_FORMAT_SIGNED_INT8 = 0x08, - CU_AD_FORMAT_SIGNED_INT16 = 0x09, - CU_AD_FORMAT_SIGNED_INT32 = 0x0a, - CU_AD_FORMAT_HALF = 0x10, - CU_AD_FORMAT_FLOAT = 0x20, - } CUarray_format; - - typedef enum CUaddress_mode_enum { - CU_TR_ADDRESS_MODE_WRAP = 0, - CU_TR_ADDRESS_MODE_CLAMP = 1, - CU_TR_ADDRESS_MODE_MIRROR = 2, - CU_TR_ADDRESS_MODE_BORDER = 3, - } CUaddress_mode; - - typedef enum CUfilter_mode_enum { - CU_TR_FILTER_MODE_POINT = 0, - CU_TR_FILTER_MODE_LINEAR = 1, - } CUfilter_mode; - - typedef enum CUdevice_attribute_enum { - CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 1, - CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X = 2, - CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y = 3, - CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z = 4, - CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X = 5, - CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y = 6, - CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z = 7, - CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK = 8, - CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK = 8, - CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY = 9, - CU_DEVICE_ATTRIBUTE_WARP_SIZE = 10, - CU_DEVICE_ATTRIBUTE_MAX_PITCH = 11, - CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK = 12, - CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK = 12, - CU_DEVICE_ATTRIBUTE_CLOCK_RATE = 13, - CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT = 14, - CU_DEVICE_ATTRIBUTE_GPU_OVERLAP = 15, - CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT = 16, - CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT = 17, - CU_DEVICE_ATTRIBUTE_INTEGRATED = 18, - CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY = 19, - CU_DEVICE_ATTRIBUTE_COMPUTE_MODE = 20, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH = 21, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH = 22, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT = 23, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH = 24, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT = 25, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH = 26, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH = 27, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT = 28, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS = 29, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_WIDTH = 27, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_HEIGHT = 28, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_NUMSLICES = 29, - CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT = 30, - CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS = 31, - CU_DEVICE_ATTRIBUTE_ECC_ENABLED = 32, - CU_DEVICE_ATTRIBUTE_PCI_BUS_ID = 33, - CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID = 34, - CU_DEVICE_ATTRIBUTE_TCC_DRIVER = 35, - CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE = 36, - CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH = 37, - CU_DEVICE_ATTRIBUTE_L2_CACHE_SIZE = 38, - CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR = 39, - CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT = 40, - CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING = 41, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_WIDTH = 42, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_LAYERS = 43, - CU_DEVICE_ATTRIBUTE_CAN_TEX2D_GATHER = 44, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_WIDTH = 45, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_GATHER_HEIGHT = 46, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH_ALTERNATE = 47, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT_ALTERNATE = 48, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH_ALTERNATE = 49, - CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID = 50, - CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT = 51, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_WIDTH = 52, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_WIDTH = 53, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURECUBEMAP_LAYERED_LAYERS = 54, - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_WIDTH = 55, - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_WIDTH = 56, - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_HEIGHT = 57, - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_WIDTH = 58, - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_HEIGHT = 59, - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE3D_DEPTH = 60, - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_WIDTH = 61, - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE1D_LAYERED_LAYERS = 62, - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_WIDTH = 63, - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_HEIGHT = 64, - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACE2D_LAYERED_LAYERS = 65, - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_WIDTH = 66, - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_WIDTH = 67, - CU_DEVICE_ATTRIBUTE_MAXIMUM_SURFACECUBEMAP_LAYERED_LAYERS = 68, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LINEAR_WIDTH = 69, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_WIDTH = 70, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_HEIGHT = 71, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LINEAR_PITCH = 72, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_WIDTH = 73, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_MIPMAPPED_HEIGHT = 74, - CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR = 75, - CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR = 76, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_MIPMAPPED_WIDTH = 77, - CU_DEVICE_ATTRIBUTE_STREAM_PRIORITIES_SUPPORTED = 78, - CU_DEVICE_ATTRIBUTE_GLOBAL_L1_CACHE_SUPPORTED = 79, - CU_DEVICE_ATTRIBUTE_LOCAL_L1_CACHE_SUPPORTED = 80, - CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR = 81, - CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR = 82, - CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY = 83, - CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD = 84, - CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD_GROUP_ID = 85, - CU_DEVICE_ATTRIBUTE_HOST_NATIVE_ATOMIC_SUPPORTED = 86, - CU_DEVICE_ATTRIBUTE_SINGLE_TO_DOUBLE_PRECISION_PERF_RATIO = 87, - CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS = 88, - CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS = 89, - CU_DEVICE_ATTRIBUTE_COMPUTE_PREEMPTION_SUPPORTED = 90, - CU_DEVICE_ATTRIBUTE_CAN_USE_HOST_POINTER_FOR_REGISTERED_MEM = 91, - CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_MEM_OPS = 92, - CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS = 93, - CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_WAIT_VALUE_NOR = 94, - CU_DEVICE_ATTRIBUTE_COOPERATIVE_LAUNCH = 95, - CU_DEVICE_ATTRIBUTE_COOPERATIVE_MULTI_DEVICE_LAUNCH = 96, - CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK_OPTIN = 97, - CU_DEVICE_ATTRIBUTE_CAN_FLUSH_REMOTE_WRITES = 98, - CU_DEVICE_ATTRIBUTE_HOST_REGISTER_SUPPORTED = 99, - CU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLES = 100, - CU_DEVICE_ATTRIBUTE_DIRECT_MANAGED_MEM_ACCESS_FROM_HOST = 101, - CU_DEVICE_ATTRIBUTE_MAX, - } CUdevice_attribute; - - typedef struct CUdevprop_st { - int maxThreadsPerBlock; - int maxThreadsDim[3]; - int maxGridSize[3]; - int sharedMemPerBlock; - int totalConstantMemory; - int SIMDWidth; - int memPitch; - int regsPerBlock; - int clockRate; - int textureAlign; - } CUdevprop; - - typedef enum CUpointer_attribute_enum { - CU_POINTER_ATTRIBUTE_CONTEXT = 1, - CU_POINTER_ATTRIBUTE_MEMORY_TYPE = 2, - CU_POINTER_ATTRIBUTE_DEVICE_POINTER = 3, - CU_POINTER_ATTRIBUTE_HOST_POINTER = 4, - CU_POINTER_ATTRIBUTE_P2P_TOKENS = 5, - CU_POINTER_ATTRIBUTE_SYNC_MEMOPS = 6, - CU_POINTER_ATTRIBUTE_BUFFER_ID = 7, - CU_POINTER_ATTRIBUTE_IS_MANAGED = 8, - CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL = 9, - } CUpointer_attribute; - - typedef enum CUfunction_attribute_enum { - CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 0, - CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES = 1, - CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES = 2, - CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES = 3, - CU_FUNC_ATTRIBUTE_NUM_REGS = 4, - CU_FUNC_ATTRIBUTE_PTX_VERSION = 5, - CU_FUNC_ATTRIBUTE_BINARY_VERSION = 6, - CU_FUNC_ATTRIBUTE_CACHE_MODE_CA = 7, - CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES = 8, - CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT = 9, - CU_FUNC_ATTRIBUTE_MAX, - } CUfunction_attribute; - - typedef enum CUfunc_cache_enum { - CU_FUNC_CACHE_PREFER_NONE = 0x00, - CU_FUNC_CACHE_PREFER_SHARED = 0x01, - CU_FUNC_CACHE_PREFER_L1 = 0x02, - CU_FUNC_CACHE_PREFER_EQUAL = 0x03, - } CUfunc_cache; - - typedef enum CUsharedconfig_enum { - CU_SHARED_MEM_CONFIG_DEFAULT_BANK_SIZE = 0x00, - CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE = 0x01, - CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE = 0x02, - } CUsharedconfig; - - typedef enum CUshared_carveout_enum { - CU_SHAREDMEM_CARVEOUT_DEFAULT, - CU_SHAREDMEM_CARVEOUT_MAX_SHARED = 100, - CU_SHAREDMEM_CARVEOUT_MAX_L1 = 0, - } CUshared_carveout; - - typedef enum CUmemorytype_enum { - CU_MEMORYTYPE_HOST = 0x01, - CU_MEMORYTYPE_DEVICE = 0x02, - CU_MEMORYTYPE_ARRAY = 0x03, - CU_MEMORYTYPE_UNIFIED = 0x04, - } CUmemorytype; - - typedef enum CUcomputemode_enum { - CU_COMPUTEMODE_DEFAULT = 0, - CU_COMPUTEMODE_PROHIBITED = 2, - CU_COMPUTEMODE_EXCLUSIVE_PROCESS = 3, - } CUcomputemode; - - typedef enum CUmem_advise_enum { - CU_MEM_ADVISE_SET_READ_MOSTLY = 1, - CU_MEM_ADVISE_UNSET_READ_MOSTLY = 2, - CU_MEM_ADVISE_SET_PREFERRED_LOCATION = 3, - CU_MEM_ADVISE_UNSET_PREFERRED_LOCATION = 4, - CU_MEM_ADVISE_SET_ACCESSED_BY = 5, - CU_MEM_ADVISE_UNSET_ACCESSED_BY = 6, - } CUmem_advise; - - typedef enum CUmem_range_attribute_enum { - CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY = 1, - CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION = 2, - CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY = 3, - CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION = 4, - } CUmem_range_attribute; - - typedef enum CUjit_option_enum { - CU_JIT_MAX_REGISTERS = 0, - CU_JIT_THREADS_PER_BLOCK, - CU_JIT_WALL_TIME, - CU_JIT_INFO_LOG_BUFFER, - CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES, - CU_JIT_ERROR_LOG_BUFFER, - CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES, - CU_JIT_OPTIMIZATION_LEVEL, - CU_JIT_TARGET_FROM_CUCONTEXT, - CU_JIT_TARGET, - CU_JIT_FALLBACK_STRATEGY, - CU_JIT_GENERATE_DEBUG_INFO, - CU_JIT_LOG_VERBOSE, - CU_JIT_GENERATE_LINE_INFO, - CU_JIT_CACHE_MODE, - CU_JIT_NEW_SM3X_OPT, - CU_JIT_FAST_COMPILE, - CU_JIT_NUM_OPTIONS, - } CUjit_option; - - typedef enum CUjit_target_enum { - CU_TARGET_COMPUTE_20 = 20, - CU_TARGET_COMPUTE_21 = 21, - CU_TARGET_COMPUTE_30 = 30, - CU_TARGET_COMPUTE_32 = 32, - CU_TARGET_COMPUTE_35 = 35, - CU_TARGET_COMPUTE_37 = 37, - CU_TARGET_COMPUTE_50 = 50, - CU_TARGET_COMPUTE_52 = 52, - CU_TARGET_COMPUTE_53 = 53, - CU_TARGET_COMPUTE_60 = 60, - CU_TARGET_COMPUTE_61 = 61, - CU_TARGET_COMPUTE_62 = 62, - CU_TARGET_COMPUTE_70 = 70, - CU_TARGET_COMPUTE_73 = 73, - CU_TARGET_COMPUTE_75 = 75, - } CUjit_target; - - typedef enum CUjit_fallback_enum { - CU_PREFER_PTX = 0, - CU_PREFER_BINARY, - } CUjit_fallback; - - typedef enum CUjit_cacheMode_enum { - CU_JIT_CACHE_OPTION_NONE = 0, - CU_JIT_CACHE_OPTION_CG, - CU_JIT_CACHE_OPTION_CA, - } CUjit_cacheMode; - - typedef enum CUjitInputType_enum { - CU_JIT_INPUT_CUBIN = 0, - CU_JIT_INPUT_PTX, - CU_JIT_INPUT_FATBINARY, - CU_JIT_INPUT_OBJECT, - CU_JIT_INPUT_LIBRARY, - CU_JIT_NUM_INPUT_TYPES, - } CUjitInputType; - - typedef struct CUlinkState_st* CUlinkState; - - typedef enum CUgraphicsRegisterFlags_enum { - CU_GRAPHICS_REGISTER_FLAGS_NONE = 0x00, - CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY = 0x01, - CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD = 0x02, - CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST = 0x04, - CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER = 0x08, - } CUgraphicsRegisterFlags; - - typedef enum CUgraphicsMapResourceFlags_enum { - CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE = 0x00, - CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY = 0x01, - CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD = 0x02, - } CUgraphicsMapResourceFlags; - - typedef enum CUarray_cubemap_face_enum { - CU_CUBEMAP_FACE_POSITIVE_X = 0x00, - CU_CUBEMAP_FACE_NEGATIVE_X = 0x01, - CU_CUBEMAP_FACE_POSITIVE_Y = 0x02, - CU_CUBEMAP_FACE_NEGATIVE_Y = 0x03, - CU_CUBEMAP_FACE_POSITIVE_Z = 0x04, - CU_CUBEMAP_FACE_NEGATIVE_Z = 0x05, - } CUarray_cubemap_face; - - typedef enum CUlimit_enum { - CU_LIMIT_STACK_SIZE = 0x00, - CU_LIMIT_PRINTF_FIFO_SIZE = 0x01, - CU_LIMIT_MALLOC_HEAP_SIZE = 0x02, - CU_LIMIT_DEV_RUNTIME_SYNC_DEPTH = 0x03, - CU_LIMIT_DEV_RUNTIME_PENDING_LAUNCH_COUNT = 0x04, - CU_LIMIT_MAX, - } CUlimit; - - typedef enum CUresourcetype_enum { - CU_RESOURCE_TYPE_ARRAY = 0x00, - CU_RESOURCE_TYPE_MIPMAPPED_ARRAY = 0x01, - CU_RESOURCE_TYPE_LINEAR = 0x02, - CU_RESOURCE_TYPE_PITCH2D = 0x03, - } CUresourcetype; - - typedef enum cudaError_enum { - CUDA_SUCCESS = 0, - CUDA_ERROR_INVALID_VALUE = 1, - CUDA_ERROR_OUT_OF_MEMORY = 2, - CUDA_ERROR_NOT_INITIALIZED = 3, - CUDA_ERROR_DEINITIALIZED = 4, - CUDA_ERROR_PROFILER_DISABLED = 5, - CUDA_ERROR_PROFILER_NOT_INITIALIZED = 6, - CUDA_ERROR_PROFILER_ALREADY_STARTED = 7, - CUDA_ERROR_PROFILER_ALREADY_STOPPED = 8, - CUDA_ERROR_NO_DEVICE = 100, - CUDA_ERROR_INVALID_DEVICE = 101, - CUDA_ERROR_INVALID_IMAGE = 200, - CUDA_ERROR_INVALID_CONTEXT = 201, - CUDA_ERROR_CONTEXT_ALREADY_CURRENT = 202, - CUDA_ERROR_MAP_FAILED = 205, - CUDA_ERROR_UNMAP_FAILED = 206, - CUDA_ERROR_ARRAY_IS_MAPPED = 207, - CUDA_ERROR_ALREADY_MAPPED = 208, - CUDA_ERROR_NO_BINARY_FOR_GPU = 209, - CUDA_ERROR_ALREADY_ACQUIRED = 210, - CUDA_ERROR_NOT_MAPPED = 211, - CUDA_ERROR_NOT_MAPPED_AS_ARRAY = 212, - CUDA_ERROR_NOT_MAPPED_AS_POINTER = 213, - CUDA_ERROR_ECC_UNCORRECTABLE = 214, - CUDA_ERROR_UNSUPPORTED_LIMIT = 215, - CUDA_ERROR_CONTEXT_ALREADY_IN_USE = 216, - CUDA_ERROR_PEER_ACCESS_UNSUPPORTED = 217, - CUDA_ERROR_INVALID_PTX = 218, - CUDA_ERROR_INVALID_GRAPHICS_CONTEXT = 219, - CUDA_ERROR_NVLINK_UNCORRECTABLE = 220, - CUDA_ERROR_JIT_COMPILER_NOT_FOUND = 221, - CUDA_ERROR_INVALID_SOURCE = 300, - CUDA_ERROR_FILE_NOT_FOUND = 301, - CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND = 302, - CUDA_ERROR_SHARED_OBJECT_INIT_FAILED = 303, - CUDA_ERROR_OPERATING_SYSTEM = 304, - CUDA_ERROR_INVALID_HANDLE = 400, - CUDA_ERROR_NOT_FOUND = 500, - CUDA_ERROR_NOT_READY = 600, - CUDA_ERROR_ILLEGAL_ADDRESS = 700, - CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES = 701, - CUDA_ERROR_LAUNCH_TIMEOUT = 702, - CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING = 703, - CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED = 704, - CUDA_ERROR_PEER_ACCESS_NOT_ENABLED = 705, - CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE = 708, - CUDA_ERROR_CONTEXT_IS_DESTROYED = 709, - CUDA_ERROR_ASSERT = 710, - CUDA_ERROR_TOO_MANY_PEERS = 711, - CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED = 712, - CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED = 713, - CUDA_ERROR_HARDWARE_STACK_ERROR = 714, - CUDA_ERROR_ILLEGAL_INSTRUCTION = 715, - CUDA_ERROR_MISALIGNED_ADDRESS = 716, - CUDA_ERROR_INVALID_ADDRESS_SPACE = 717, - CUDA_ERROR_INVALID_PC = 718, - CUDA_ERROR_LAUNCH_FAILED = 719, - CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE = 720, - CUDA_ERROR_NOT_PERMITTED = 800, - CUDA_ERROR_NOT_SUPPORTED = 801, - CUDA_ERROR_UNKNOWN = 999, - } CUresult; - - typedef enum CUdevice_P2PAttribute_enum { - CU_DEVICE_P2P_ATTRIBUTE_PERFORMANCE_RANK = 0x01, - CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED = 0x02, - CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED = 0x03, - CU_DEVICE_P2P_ATTRIBUTE_ARRAY_ACCESS_ACCESS_SUPPORTED = 0x04, - } CUdevice_P2PAttribute; - - typedef void (CUDA_CB* CUstreamCallback)(CUstream hStream, CUresult status, void* userData); - typedef size_t(CUDA_CB* CUoccupancyB2DSize)(int blockSize); - - typedef struct CUDA_MEMCPY2D_st { - size_t srcXInBytes; - size_t srcY; - CUmemorytype srcMemoryType; - const void* srcHost; - CUdeviceptr srcDevice; - CUarray srcArray; - size_t srcPitch; - size_t dstXInBytes; - size_t dstY; - CUmemorytype dstMemoryType; - void* dstHost; - CUdeviceptr dstDevice; - CUarray dstArray; - size_t dstPitch; - size_t WidthInBytes; - size_t Height; - } CUDA_MEMCPY2D; - - typedef struct CUDA_MEMCPY3D_st { - size_t srcXInBytes; - size_t srcY; - size_t srcZ; - size_t srcLOD; - CUmemorytype srcMemoryType; - const void* srcHost; - CUdeviceptr srcDevice; - CUarray srcArray; - void* reserved0; - size_t srcPitch; - size_t srcHeight; - size_t dstXInBytes; - size_t dstY; - size_t dstZ; - size_t dstLOD; - CUmemorytype dstMemoryType; - void* dstHost; - CUdeviceptr dstDevice; - CUarray dstArray; - void* reserved1; - size_t dstPitch; - size_t dstHeight; - size_t WidthInBytes; - size_t Height; - size_t Depth; - } CUDA_MEMCPY3D; - - typedef struct CUDA_MEMCPY3D_PEER_st { - size_t srcXInBytes; - size_t srcY; - size_t srcZ; - size_t srcLOD; - CUmemorytype srcMemoryType; - const void* srcHost; - CUdeviceptr srcDevice; - CUarray srcArray; - CUcontext srcContext; - size_t srcPitch; - size_t srcHeight; - size_t dstXInBytes; - size_t dstY; - size_t dstZ; - size_t dstLOD; - CUmemorytype dstMemoryType; - void* dstHost; - CUdeviceptr dstDevice; - CUarray dstArray; - CUcontext dstContext; - size_t dstPitch; - size_t dstHeight; - size_t WidthInBytes; - size_t Height; - size_t Depth; - } CUDA_MEMCPY3D_PEER; - - typedef struct CUDA_ARRAY_DESCRIPTOR_st { - size_t Width; - size_t Height; - CUarray_format Format; - unsigned int NumChannels; - } CUDA_ARRAY_DESCRIPTOR; - - typedef struct CUDA_ARRAY3D_DESCRIPTOR_st { - size_t Width; - size_t Height; - size_t Depth; - CUarray_format Format; - unsigned int NumChannels; - unsigned int Flags; - } CUDA_ARRAY3D_DESCRIPTOR; - - typedef struct CUDA_RESOURCE_DESC_st { - CUresourcetype resType; - union { - struct { - CUarray hArray; - } array; - struct { - CUmipmappedArray hMipmappedArray; - } mipmap; - struct { - CUdeviceptr devPtr; - CUarray_format format; - unsigned int numChannels; - size_t sizeInBytes; - } linear; - struct { - CUdeviceptr devPtr; - CUarray_format format; - unsigned int numChannels; - size_t width; - size_t height; - size_t pitchInBytes; - } pitch2D; - struct { - int reserved[32]; - } reserved; - } res; - unsigned int flags; - } CUDA_RESOURCE_DESC; - - typedef struct CUDA_TEXTURE_DESC_st { - CUaddress_mode addressMode[3]; - CUfilter_mode filterMode; - unsigned int flags; - unsigned int maxAnisotropy; - CUfilter_mode mipmapFilterMode; - float mipmapLevelBias; - float minMipmapLevelClamp; - float maxMipmapLevelClamp; - float borderColor[4]; - int reserved[12]; - } CUDA_TEXTURE_DESC; - - typedef enum CUresourceViewFormat_enum { - CU_RES_VIEW_FORMAT_NONE = 0x00, - CU_RES_VIEW_FORMAT_UINT_1X8 = 0x01, - CU_RES_VIEW_FORMAT_UINT_2X8 = 0x02, - CU_RES_VIEW_FORMAT_UINT_4X8 = 0x03, - CU_RES_VIEW_FORMAT_SINT_1X8 = 0x04, - CU_RES_VIEW_FORMAT_SINT_2X8 = 0x05, - CU_RES_VIEW_FORMAT_SINT_4X8 = 0x06, - CU_RES_VIEW_FORMAT_UINT_1X16 = 0x07, - CU_RES_VIEW_FORMAT_UINT_2X16 = 0x08, - CU_RES_VIEW_FORMAT_UINT_4X16 = 0x09, - CU_RES_VIEW_FORMAT_SINT_1X16 = 0x0a, - CU_RES_VIEW_FORMAT_SINT_2X16 = 0x0b, - CU_RES_VIEW_FORMAT_SINT_4X16 = 0x0c, - CU_RES_VIEW_FORMAT_UINT_1X32 = 0x0d, - CU_RES_VIEW_FORMAT_UINT_2X32 = 0x0e, - CU_RES_VIEW_FORMAT_UINT_4X32 = 0x0f, - CU_RES_VIEW_FORMAT_SINT_1X32 = 0x10, - CU_RES_VIEW_FORMAT_SINT_2X32 = 0x11, - CU_RES_VIEW_FORMAT_SINT_4X32 = 0x12, - CU_RES_VIEW_FORMAT_FLOAT_1X16 = 0x13, - CU_RES_VIEW_FORMAT_FLOAT_2X16 = 0x14, - CU_RES_VIEW_FORMAT_FLOAT_4X16 = 0x15, - CU_RES_VIEW_FORMAT_FLOAT_1X32 = 0x16, - CU_RES_VIEW_FORMAT_FLOAT_2X32 = 0x17, - CU_RES_VIEW_FORMAT_FLOAT_4X32 = 0x18, - CU_RES_VIEW_FORMAT_UNSIGNED_BC1 = 0x19, - CU_RES_VIEW_FORMAT_UNSIGNED_BC2 = 0x1a, - CU_RES_VIEW_FORMAT_UNSIGNED_BC3 = 0x1b, - CU_RES_VIEW_FORMAT_UNSIGNED_BC4 = 0x1c, - CU_RES_VIEW_FORMAT_SIGNED_BC4 = 0x1d, - CU_RES_VIEW_FORMAT_UNSIGNED_BC5 = 0x1e, - CU_RES_VIEW_FORMAT_SIGNED_BC5 = 0x1f, - CU_RES_VIEW_FORMAT_UNSIGNED_BC6H = 0x20, - CU_RES_VIEW_FORMAT_SIGNED_BC6H = 0x21, - CU_RES_VIEW_FORMAT_UNSIGNED_BC7 = 0x22, - } CUresourceViewFormat; - - typedef struct CUDA_RESOURCE_VIEW_DESC_st { - CUresourceViewFormat format; - size_t width; - size_t height; - size_t depth; - unsigned int firstMipmapLevel; - unsigned int lastMipmapLevel; - unsigned int firstLayer; - unsigned int lastLayer; - unsigned int reserved[16]; - } CUDA_RESOURCE_VIEW_DESC; - - typedef struct CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st { - unsigned long long p2pToken; - unsigned int vaSpaceToken; - } CUDA_POINTER_ATTRIBUTE_P2P_TOKENS; - - typedef struct CUDA_LAUNCH_PARAMS_st { - CUfunction function; - unsigned int gridDimX; - unsigned int gridDimY; - unsigned int gridDimZ; - unsigned int blockDimX; - unsigned int blockDimY; - unsigned int blockDimZ; - unsigned int sharedMemBytes; - CUstream hStream; - void** kernelParams; - } CUDA_LAUNCH_PARAMS; - typedef unsigned int GLenum; - typedef unsigned int GLuint; - typedef int GLint; - - typedef enum CUGLDeviceList_enum { - CU_GL_DEVICE_LIST_ALL = 0x01, - CU_GL_DEVICE_LIST_CURRENT_FRAME = 0x02, - CU_GL_DEVICE_LIST_NEXT_FRAME = 0x03, - } CUGLDeviceList; - - typedef enum CUGLmap_flags_enum { - CU_GL_MAP_RESOURCE_FLAGS_NONE = 0x00, - CU_GL_MAP_RESOURCE_FLAGS_READ_ONLY = 0x01, - CU_GL_MAP_RESOURCE_FLAGS_WRITE_DISCARD = 0x02, - } CUGLmap_flags; - - typedef enum { - NVRTC_SUCCESS = 0, - NVRTC_ERROR_OUT_OF_MEMORY = 1, - NVRTC_ERROR_PROGRAM_CREATION_FAILURE = 2, - NVRTC_ERROR_INVALID_INPUT = 3, - NVRTC_ERROR_INVALID_PROGRAM = 4, - NVRTC_ERROR_INVALID_OPTION = 5, - NVRTC_ERROR_COMPILATION = 6, - NVRTC_ERROR_BUILTIN_OPERATION_FAILURE = 7, - NVRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION = 8, - NVRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION = 9, - NVRTC_ERROR_NAME_EXPRESSION_NOT_VALID = 10, - NVRTC_ERROR_INTERNAL_ERROR = 11, - } nvrtcResult; - - typedef struct _nvrtcProgram* nvrtcProgram; - - - /* Function types. */ - typedef CUresult CUDAAPI tcuGetErrorString(CUresult error, const char** pStr); - typedef CUresult CUDAAPI tcuGetErrorName(CUresult error, const char** pStr); - typedef CUresult CUDAAPI tcuInit(unsigned int Flags); - typedef CUresult CUDAAPI tcuDriverGetVersion(int* driverVersion); - typedef CUresult CUDAAPI tcuDeviceGet(CUdevice* device, int ordinal); - typedef CUresult CUDAAPI tcuDeviceGetCount(int* count); - typedef CUresult CUDAAPI tcuDeviceGetName(char* name, int len, CUdevice dev); - typedef CUresult CUDAAPI tcuDeviceGetUuid(CUuuid* uuid, CUdevice dev); - typedef CUresult CUDAAPI tcuDeviceTotalMem_v2(size_t* bytes, CUdevice dev); - typedef CUresult CUDAAPI tcuDeviceGetAttribute(int* pi, CUdevice_attribute attrib, CUdevice dev); - typedef CUresult CUDAAPI tcuDeviceGetProperties(CUdevprop* prop, CUdevice dev); - typedef CUresult CUDAAPI tcuDeviceComputeCapability(int* major, int* minor, CUdevice dev); - typedef CUresult CUDAAPI tcuDevicePrimaryCtxRetain(CUcontext* pctx, CUdevice dev); - typedef CUresult CUDAAPI tcuDevicePrimaryCtxRelease(CUdevice dev); - typedef CUresult CUDAAPI tcuDevicePrimaryCtxSetFlags(CUdevice dev, unsigned int flags); - typedef CUresult CUDAAPI tcuDevicePrimaryCtxGetState(CUdevice dev, unsigned int* flags, int* active); - typedef CUresult CUDAAPI tcuDevicePrimaryCtxReset(CUdevice dev); - typedef CUresult CUDAAPI tcuCtxCreate_v2(CUcontext* pctx, unsigned int flags, CUdevice dev); - typedef CUresult CUDAAPI tcuCtxDestroy_v2(CUcontext ctx); - typedef CUresult CUDAAPI tcuCtxPushCurrent_v2(CUcontext ctx); - typedef CUresult CUDAAPI tcuCtxPopCurrent_v2(CUcontext* pctx); - typedef CUresult CUDAAPI tcuCtxSetCurrent(CUcontext ctx); - typedef CUresult CUDAAPI tcuCtxGetCurrent(CUcontext* pctx); - typedef CUresult CUDAAPI tcuCtxGetDevice(CUdevice* device); - typedef CUresult CUDAAPI tcuCtxGetFlags(unsigned int* flags); - typedef CUresult CUDAAPI tcuCtxSynchronize(void); - typedef CUresult CUDAAPI tcuCtxSetLimit(CUlimit limit, size_t value); - typedef CUresult CUDAAPI tcuCtxGetLimit(size_t* pvalue, CUlimit limit); - typedef CUresult CUDAAPI tcuCtxGetCacheConfig(CUfunc_cache* pconfig); - typedef CUresult CUDAAPI tcuCtxSetCacheConfig(CUfunc_cache config); - typedef CUresult CUDAAPI tcuCtxGetSharedMemConfig(CUsharedconfig* pConfig); - typedef CUresult CUDAAPI tcuCtxSetSharedMemConfig(CUsharedconfig config); - typedef CUresult CUDAAPI tcuCtxGetApiVersion(CUcontext ctx, unsigned int* version); - typedef CUresult CUDAAPI tcuCtxGetStreamPriorityRange(int* leastPriority, int* greatestPriority); - typedef CUresult CUDAAPI tcuCtxAttach(CUcontext* pctx, unsigned int flags); - typedef CUresult CUDAAPI tcuCtxDetach(CUcontext ctx); - typedef CUresult CUDAAPI tcuModuleLoad(CUmodule* module, const char* fname); - typedef CUresult CUDAAPI tcuModuleLoadData(CUmodule* module, const void* image); - typedef CUresult CUDAAPI tcuModuleLoadDataEx(CUmodule* module, const void* image, unsigned int numOptions, CUjit_option* options, void** optionValues); - typedef CUresult CUDAAPI tcuModuleLoadFatBinary(CUmodule* module, const void* fatCubin); - typedef CUresult CUDAAPI tcuModuleUnload(CUmodule hmod); - typedef CUresult CUDAAPI tcuModuleGetFunction(CUfunction* hfunc, CUmodule hmod, const char* name); - typedef CUresult CUDAAPI tcuModuleGetGlobal_v2(CUdeviceptr* dptr, size_t* bytes, CUmodule hmod, const char* name); - typedef CUresult CUDAAPI tcuModuleGetTexRef(CUtexref* pTexRef, CUmodule hmod, const char* name); - typedef CUresult CUDAAPI tcuModuleGetSurfRef(CUsurfref* pSurfRef, CUmodule hmod, const char* name); - typedef CUresult CUDAAPI tcuLinkCreate_v2(unsigned int numOptions, CUjit_option* options, void** optionValues, CUlinkState* stateOut); - typedef CUresult CUDAAPI tcuLinkAddData_v2(CUlinkState state, CUjitInputType type, void* data, size_t size, const char* name, unsigned int numOptions, CUjit_option* options, void** optionValues); - typedef CUresult CUDAAPI tcuLinkAddFile_v2(CUlinkState state, CUjitInputType type, const char* path, unsigned int numOptions, CUjit_option* options, void** optionValues); - typedef CUresult CUDAAPI tcuLinkComplete(CUlinkState state, void** cubinOut, size_t* sizeOut); - typedef CUresult CUDAAPI tcuLinkDestroy(CUlinkState state); - typedef CUresult CUDAAPI tcuMemGetInfo_v2(size_t* free, size_t* total); - typedef CUresult CUDAAPI tcuMemAlloc_v2(CUdeviceptr* dptr, size_t bytesize); - typedef CUresult CUDAAPI tcuMemAllocPitch_v2(CUdeviceptr* dptr, size_t* pPitch, size_t WidthInBytes, size_t Height, unsigned int ElementSizeBytes); - typedef CUresult CUDAAPI tcuMemFree_v2(CUdeviceptr dptr); - typedef CUresult CUDAAPI tcuMemGetAddressRange_v2(CUdeviceptr* pbase, size_t* psize, CUdeviceptr dptr); - typedef CUresult CUDAAPI tcuMemAllocHost_v2(void** pp, size_t bytesize); - typedef CUresult CUDAAPI tcuMemFreeHost(void* p); - typedef CUresult CUDAAPI tcuMemHostAlloc(void** pp, size_t bytesize, unsigned int Flags); - typedef CUresult CUDAAPI tcuMemHostGetDevicePointer_v2(CUdeviceptr* pdptr, void* p, unsigned int Flags); - typedef CUresult CUDAAPI tcuMemHostGetFlags(unsigned int* pFlags, void* p); - typedef CUresult CUDAAPI tcuMemAllocManaged(CUdeviceptr* dptr, size_t bytesize, unsigned int flags); - typedef CUresult CUDAAPI tcuDeviceGetByPCIBusId(CUdevice* dev, const char* pciBusId); - typedef CUresult CUDAAPI tcuDeviceGetPCIBusId(char* pciBusId, int len, CUdevice dev); - typedef CUresult CUDAAPI tcuIpcGetEventHandle(CUipcEventHandle* pHandle, CUevent event); - typedef CUresult CUDAAPI tcuIpcOpenEventHandle(CUevent* phEvent, CUipcEventHandle handle); - typedef CUresult CUDAAPI tcuIpcGetMemHandle(CUipcMemHandle* pHandle, CUdeviceptr dptr); - typedef CUresult CUDAAPI tcuIpcOpenMemHandle(CUdeviceptr* pdptr, CUipcMemHandle handle, unsigned int Flags); - typedef CUresult CUDAAPI tcuIpcCloseMemHandle(CUdeviceptr dptr); - typedef CUresult CUDAAPI tcuMemHostRegister_v2(void* p, size_t bytesize, unsigned int Flags); - typedef CUresult CUDAAPI tcuMemHostUnregister(void* p); - typedef CUresult CUDAAPI tcuMemcpy(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount); - typedef CUresult CUDAAPI tcuMemcpyPeer(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount); - typedef CUresult CUDAAPI tcuMemcpyHtoD_v2(CUdeviceptr dstDevice, const void* srcHost, size_t ByteCount); - typedef CUresult CUDAAPI tcuMemcpyDtoH_v2(void* dstHost, CUdeviceptr srcDevice, size_t ByteCount); - typedef CUresult CUDAAPI tcuMemcpyDtoD_v2(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount); - typedef CUresult CUDAAPI tcuMemcpyDtoA_v2(CUarray dstArray, size_t dstOffset, CUdeviceptr srcDevice, size_t ByteCount); - typedef CUresult CUDAAPI tcuMemcpyAtoD_v2(CUdeviceptr dstDevice, CUarray srcArray, size_t srcOffset, size_t ByteCount); - typedef CUresult CUDAAPI tcuMemcpyHtoA_v2(CUarray dstArray, size_t dstOffset, const void* srcHost, size_t ByteCount); - typedef CUresult CUDAAPI tcuMemcpyAtoH_v2(void* dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount); - typedef CUresult CUDAAPI tcuMemcpyAtoA_v2(CUarray dstArray, size_t dstOffset, CUarray srcArray, size_t srcOffset, size_t ByteCount); - typedef CUresult CUDAAPI tcuMemcpy2D_v2(const CUDA_MEMCPY2D* pCopy); - typedef CUresult CUDAAPI tcuMemcpy2DUnaligned_v2(const CUDA_MEMCPY2D* pCopy); - typedef CUresult CUDAAPI tcuMemcpy3D_v2(const CUDA_MEMCPY3D* pCopy); - typedef CUresult CUDAAPI tcuMemcpy3DPeer(const CUDA_MEMCPY3D_PEER* pCopy); - typedef CUresult CUDAAPI tcuMemcpyAsync(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount, CUstream hStream); - typedef CUresult CUDAAPI tcuMemcpyPeerAsync(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount, CUstream hStream); - typedef CUresult CUDAAPI tcuMemcpyHtoDAsync_v2(CUdeviceptr dstDevice, const void* srcHost, size_t ByteCount, CUstream hStream); - typedef CUresult CUDAAPI tcuMemcpyDtoHAsync_v2(void* dstHost, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream); - typedef CUresult CUDAAPI tcuMemcpyDtoDAsync_v2(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream); - typedef CUresult CUDAAPI tcuMemcpyHtoAAsync_v2(CUarray dstArray, size_t dstOffset, const void* srcHost, size_t ByteCount, CUstream hStream); - typedef CUresult CUDAAPI tcuMemcpyAtoHAsync_v2(void* dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount, CUstream hStream); - typedef CUresult CUDAAPI tcuMemcpy2DAsync_v2(const CUDA_MEMCPY2D* pCopy, CUstream hStream); - typedef CUresult CUDAAPI tcuMemcpy3DAsync_v2(const CUDA_MEMCPY3D* pCopy, CUstream hStream); - typedef CUresult CUDAAPI tcuMemcpy3DPeerAsync(const CUDA_MEMCPY3D_PEER* pCopy, CUstream hStream); - typedef CUresult CUDAAPI tcuMemsetD8_v2(CUdeviceptr dstDevice, unsigned char uc, size_t N); - typedef CUresult CUDAAPI tcuMemsetD16_v2(CUdeviceptr dstDevice, unsigned short us, size_t N); - typedef CUresult CUDAAPI tcuMemsetD32_v2(CUdeviceptr dstDevice, unsigned int ui, size_t N); - typedef CUresult CUDAAPI tcuMemsetD2D8_v2(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height); - typedef CUresult CUDAAPI tcuMemsetD2D16_v2(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height); - typedef CUresult CUDAAPI tcuMemsetD2D32_v2(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height); - typedef CUresult CUDAAPI tcuMemsetD8Async(CUdeviceptr dstDevice, unsigned char uc, size_t N, CUstream hStream); - typedef CUresult CUDAAPI tcuMemsetD16Async(CUdeviceptr dstDevice, unsigned short us, size_t N, CUstream hStream); - typedef CUresult CUDAAPI tcuMemsetD32Async(CUdeviceptr dstDevice, unsigned int ui, size_t N, CUstream hStream); - typedef CUresult CUDAAPI tcuMemsetD2D8Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height, CUstream hStream); - typedef CUresult CUDAAPI tcuMemsetD2D16Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height, CUstream hStream); - typedef CUresult CUDAAPI tcuMemsetD2D32Async(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height, CUstream hStream); - typedef CUresult CUDAAPI tcuArrayCreate_v2(CUarray* pHandle, const CUDA_ARRAY_DESCRIPTOR* pAllocateArray); - typedef CUresult CUDAAPI tcuArrayGetDescriptor_v2(CUDA_ARRAY_DESCRIPTOR* pArrayDescriptor, CUarray hArray); - typedef CUresult CUDAAPI tcuArrayDestroy(CUarray hArray); - typedef CUresult CUDAAPI tcuArray3DCreate_v2(CUarray* pHandle, const CUDA_ARRAY3D_DESCRIPTOR* pAllocateArray); - typedef CUresult CUDAAPI tcuArray3DGetDescriptor_v2(CUDA_ARRAY3D_DESCRIPTOR* pArrayDescriptor, CUarray hArray); - typedef CUresult CUDAAPI tcuMipmappedArrayCreate(CUmipmappedArray* pHandle, const CUDA_ARRAY3D_DESCRIPTOR* pMipmappedArrayDesc, unsigned int numMipmapLevels); - typedef CUresult CUDAAPI tcuMipmappedArrayGetLevel(CUarray* pLevelArray, CUmipmappedArray hMipmappedArray, unsigned int level); - typedef CUresult CUDAAPI tcuMipmappedArrayDestroy(CUmipmappedArray hMipmappedArray); - typedef CUresult CUDAAPI tcuPointerGetAttribute(void* data, CUpointer_attribute attribute, CUdeviceptr ptr); - typedef CUresult CUDAAPI tcuMemPrefetchAsync(CUdeviceptr devPtr, size_t count, CUdevice dstDevice, CUstream hStream); - typedef CUresult CUDAAPI tcuMemAdvise(CUdeviceptr devPtr, size_t count, CUmem_advise advice, CUdevice device); - typedef CUresult CUDAAPI tcuMemRangeGetAttribute(void* data, size_t dataSize, CUmem_range_attribute attribute, CUdeviceptr devPtr, size_t count); - typedef CUresult CUDAAPI tcuMemRangeGetAttributes(void** data, size_t* dataSizes, CUmem_range_attribute* attributes, size_t numAttributes, CUdeviceptr devPtr, size_t count); - typedef CUresult CUDAAPI tcuPointerSetAttribute(const void* value, CUpointer_attribute attribute, CUdeviceptr ptr); - typedef CUresult CUDAAPI tcuPointerGetAttributes(unsigned int numAttributes, CUpointer_attribute* attributes, void** data, CUdeviceptr ptr); - typedef CUresult CUDAAPI tcuStreamCreate(CUstream* phStream, unsigned int Flags); - typedef CUresult CUDAAPI tcuStreamCreateWithPriority(CUstream* phStream, unsigned int flags, int priority); - typedef CUresult CUDAAPI tcuStreamGetPriority(CUstream hStream, int* priority); - typedef CUresult CUDAAPI tcuStreamGetFlags(CUstream hStream, unsigned int* flags); - typedef CUresult CUDAAPI tcuStreamGetCtx(CUstream hStream, CUcontext* pctx); - typedef CUresult CUDAAPI tcuStreamWaitEvent(CUstream hStream, CUevent hEvent, unsigned int Flags); - typedef CUresult CUDAAPI tcuStreamAddCallback(CUstream hStream, CUstreamCallback callback, void* userData, unsigned int flags); - typedef CUresult CUDAAPI tcuStreamAttachMemAsync(CUstream hStream, CUdeviceptr dptr, size_t length, unsigned int flags); - typedef CUresult CUDAAPI tcuStreamQuery(CUstream hStream); - typedef CUresult CUDAAPI tcuStreamSynchronize(CUstream hStream); - typedef CUresult CUDAAPI tcuStreamDestroy_v2(CUstream hStream); - typedef CUresult CUDAAPI tcuEventCreate(CUevent* phEvent, unsigned int Flags); - typedef CUresult CUDAAPI tcuEventRecord(CUevent hEvent, CUstream hStream); - typedef CUresult CUDAAPI tcuEventQuery(CUevent hEvent); - typedef CUresult CUDAAPI tcuEventSynchronize(CUevent hEvent); - typedef CUresult CUDAAPI tcuEventDestroy_v2(CUevent hEvent); - typedef CUresult CUDAAPI tcuEventElapsedTime(float* pMilliseconds, CUevent hStart, CUevent hEnd); - typedef CUresult CUDAAPI tcuStreamWaitValue32(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags); - typedef CUresult CUDAAPI tcuStreamWaitValue64(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags); - typedef CUresult CUDAAPI tcuStreamWriteValue32(CUstream stream, CUdeviceptr addr, cuuint32_t value, unsigned int flags); - typedef CUresult CUDAAPI tcuStreamWriteValue64(CUstream stream, CUdeviceptr addr, cuuint64_t value, unsigned int flags); - typedef CUresult CUDAAPI tcuStreamBatchMemOp(CUstream stream, unsigned int count, CUstreamBatchMemOpParams* paramArray, unsigned int flags); - typedef CUresult CUDAAPI tcuFuncGetAttribute(int* pi, CUfunction_attribute attrib, CUfunction hfunc); - typedef CUresult CUDAAPI tcuFuncSetAttribute(CUfunction hfunc, CUfunction_attribute attrib, int value); - typedef CUresult CUDAAPI tcuFuncSetCacheConfig(CUfunction hfunc, CUfunc_cache config); - typedef CUresult CUDAAPI tcuFuncSetSharedMemConfig(CUfunction hfunc, CUsharedconfig config); - typedef CUresult CUDAAPI tcuLaunchKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void** kernelParams, void** extra); - typedef CUresult CUDAAPI tcuLaunchCooperativeKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void** kernelParams); - typedef CUresult CUDAAPI tcuLaunchCooperativeKernelMultiDevice(CUDA_LAUNCH_PARAMS* launchParamsList, unsigned int numDevices, unsigned int flags); - typedef CUresult CUDAAPI tcuFuncSetBlockShape(CUfunction hfunc, int x, int y, int z); - typedef CUresult CUDAAPI tcuFuncSetSharedSize(CUfunction hfunc, unsigned int bytes); - typedef CUresult CUDAAPI tcuParamSetSize(CUfunction hfunc, unsigned int numbytes); - typedef CUresult CUDAAPI tcuParamSeti(CUfunction hfunc, int offset, unsigned int value); - typedef CUresult CUDAAPI tcuParamSetf(CUfunction hfunc, int offset, float value); - typedef CUresult CUDAAPI tcuParamSetv(CUfunction hfunc, int offset, void* ptr, unsigned int numbytes); - typedef CUresult CUDAAPI tcuLaunch(CUfunction f); - typedef CUresult CUDAAPI tcuLaunchGrid(CUfunction f, int grid_width, int grid_height); - typedef CUresult CUDAAPI tcuLaunchGridAsync(CUfunction f, int grid_width, int grid_height, CUstream hStream); - typedef CUresult CUDAAPI tcuParamSetTexRef(CUfunction hfunc, int texunit, CUtexref hTexRef); - typedef CUresult CUDAAPI tcuOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize); - typedef CUresult CUDAAPI tcuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int* numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize, unsigned int flags); - typedef CUresult CUDAAPI tcuOccupancyMaxPotentialBlockSize(int* minGridSize, int* blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit); - typedef CUresult CUDAAPI tcuOccupancyMaxPotentialBlockSizeWithFlags(int* minGridSize, int* blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit, unsigned int flags); - typedef CUresult CUDAAPI tcuTexRefSetArray(CUtexref hTexRef, CUarray hArray, unsigned int Flags); - typedef CUresult CUDAAPI tcuTexRefSetMipmappedArray(CUtexref hTexRef, CUmipmappedArray hMipmappedArray, unsigned int Flags); - typedef CUresult CUDAAPI tcuTexRefSetAddress_v2(size_t* ByteOffset, CUtexref hTexRef, CUdeviceptr dptr, size_t bytes); - typedef CUresult CUDAAPI tcuTexRefSetAddress2D_v3(CUtexref hTexRef, const CUDA_ARRAY_DESCRIPTOR* desc, CUdeviceptr dptr, size_t Pitch); - typedef CUresult CUDAAPI tcuTexRefSetFormat(CUtexref hTexRef, CUarray_format fmt, int NumPackedComponents); - typedef CUresult CUDAAPI tcuTexRefSetAddressMode(CUtexref hTexRef, int dim, CUaddress_mode am); - typedef CUresult CUDAAPI tcuTexRefSetFilterMode(CUtexref hTexRef, CUfilter_mode fm); - typedef CUresult CUDAAPI tcuTexRefSetMipmapFilterMode(CUtexref hTexRef, CUfilter_mode fm); - typedef CUresult CUDAAPI tcuTexRefSetMipmapLevelBias(CUtexref hTexRef, float bias); - typedef CUresult CUDAAPI tcuTexRefSetMipmapLevelClamp(CUtexref hTexRef, float minMipmapLevelClamp, float maxMipmapLevelClamp); - typedef CUresult CUDAAPI tcuTexRefSetMaxAnisotropy(CUtexref hTexRef, unsigned int maxAniso); - typedef CUresult CUDAAPI tcuTexRefSetBorderColor(CUtexref hTexRef, float* pBorderColor); - typedef CUresult CUDAAPI tcuTexRefSetFlags(CUtexref hTexRef, unsigned int Flags); - typedef CUresult CUDAAPI tcuTexRefGetAddress_v2(CUdeviceptr* pdptr, CUtexref hTexRef); - typedef CUresult CUDAAPI tcuTexRefGetArray(CUarray* phArray, CUtexref hTexRef); - typedef CUresult CUDAAPI tcuTexRefGetMipmappedArray(CUmipmappedArray* phMipmappedArray, CUtexref hTexRef); - typedef CUresult CUDAAPI tcuTexRefGetAddressMode(CUaddress_mode* pam, CUtexref hTexRef, int dim); - typedef CUresult CUDAAPI tcuTexRefGetFilterMode(CUfilter_mode* pfm, CUtexref hTexRef); - typedef CUresult CUDAAPI tcuTexRefGetFormat(CUarray_format* pFormat, int* pNumChannels, CUtexref hTexRef); - typedef CUresult CUDAAPI tcuTexRefGetMipmapFilterMode(CUfilter_mode* pfm, CUtexref hTexRef); - typedef CUresult CUDAAPI tcuTexRefGetMipmapLevelBias(float* pbias, CUtexref hTexRef); - typedef CUresult CUDAAPI tcuTexRefGetMipmapLevelClamp(float* pminMipmapLevelClamp, float* pmaxMipmapLevelClamp, CUtexref hTexRef); - typedef CUresult CUDAAPI tcuTexRefGetMaxAnisotropy(int* pmaxAniso, CUtexref hTexRef); - typedef CUresult CUDAAPI tcuTexRefGetBorderColor(float* pBorderColor, CUtexref hTexRef); - typedef CUresult CUDAAPI tcuTexRefGetFlags(unsigned int* pFlags, CUtexref hTexRef); - typedef CUresult CUDAAPI tcuTexRefCreate(CUtexref* pTexRef); - typedef CUresult CUDAAPI tcuTexRefDestroy(CUtexref hTexRef); - typedef CUresult CUDAAPI tcuSurfRefSetArray(CUsurfref hSurfRef, CUarray hArray, unsigned int Flags); - typedef CUresult CUDAAPI tcuSurfRefGetArray(CUarray* phArray, CUsurfref hSurfRef); - typedef CUresult CUDAAPI tcuTexObjectCreate(CUtexObject* pTexObject, const CUDA_RESOURCE_DESC* pResDesc, const CUDA_TEXTURE_DESC* pTexDesc, const CUDA_RESOURCE_VIEW_DESC* pResViewDesc); - typedef CUresult CUDAAPI tcuTexObjectDestroy(CUtexObject texObject); - typedef CUresult CUDAAPI tcuTexObjectGetResourceDesc(CUDA_RESOURCE_DESC* pResDesc, CUtexObject texObject); - typedef CUresult CUDAAPI tcuTexObjectGetTextureDesc(CUDA_TEXTURE_DESC* pTexDesc, CUtexObject texObject); - typedef CUresult CUDAAPI tcuTexObjectGetResourceViewDesc(CUDA_RESOURCE_VIEW_DESC* pResViewDesc, CUtexObject texObject); - typedef CUresult CUDAAPI tcuSurfObjectCreate(CUsurfObject* pSurfObject, const CUDA_RESOURCE_DESC* pResDesc); - typedef CUresult CUDAAPI tcuSurfObjectDestroy(CUsurfObject surfObject); - typedef CUresult CUDAAPI tcuSurfObjectGetResourceDesc(CUDA_RESOURCE_DESC* pResDesc, CUsurfObject surfObject); - typedef CUresult CUDAAPI tcuDeviceCanAccessPeer(int* canAccessPeer, CUdevice dev, CUdevice peerDev); - typedef CUresult CUDAAPI tcuCtxEnablePeerAccess(CUcontext peerContext, unsigned int Flags); - typedef CUresult CUDAAPI tcuCtxDisablePeerAccess(CUcontext peerContext); - typedef CUresult CUDAAPI tcuDeviceGetP2PAttribute(int* value, CUdevice_P2PAttribute attrib, CUdevice srcDevice, CUdevice dstDevice); - typedef CUresult CUDAAPI tcuGraphicsUnregisterResource(CUgraphicsResource resource); - typedef CUresult CUDAAPI tcuGraphicsSubResourceGetMappedArray(CUarray* pArray, CUgraphicsResource resource, unsigned int arrayIndex, unsigned int mipLevel); - typedef CUresult CUDAAPI tcuGraphicsResourceGetMappedMipmappedArray(CUmipmappedArray* pMipmappedArray, CUgraphicsResource resource); - typedef CUresult CUDAAPI tcuGraphicsResourceGetMappedPointer_v2(CUdeviceptr* pDevPtr, size_t* pSize, CUgraphicsResource resource); - typedef CUresult CUDAAPI tcuGraphicsResourceSetMapFlags_v2(CUgraphicsResource resource, unsigned int flags); - typedef CUresult CUDAAPI tcuGraphicsMapResources(unsigned int count, CUgraphicsResource* resources, CUstream hStream); - typedef CUresult CUDAAPI tcuGraphicsUnmapResources(unsigned int count, CUgraphicsResource* resources, CUstream hStream); - typedef CUresult CUDAAPI tcuGetExportTable(const void** ppExportTable, const CUuuid* pExportTableId); - - typedef CUresult CUDAAPI tcuGraphicsGLRegisterBuffer(CUgraphicsResource* pCudaResource, GLuint buffer, unsigned int Flags); - typedef CUresult CUDAAPI tcuGraphicsGLRegisterImage(CUgraphicsResource* pCudaResource, GLuint image, GLenum target, unsigned int Flags); - typedef CUresult CUDAAPI tcuGLGetDevices_v2(unsigned int* pCudaDeviceCount, CUdevice* pCudaDevices, unsigned int cudaDeviceCount, CUGLDeviceList deviceList); - typedef CUresult CUDAAPI tcuGLCtxCreate_v2(CUcontext* pCtx, unsigned int Flags, CUdevice device); - typedef CUresult CUDAAPI tcuGLInit(void); - typedef CUresult CUDAAPI tcuGLRegisterBufferObject(GLuint buffer); - typedef CUresult CUDAAPI tcuGLMapBufferObject_v2(CUdeviceptr* dptr, size_t* size, GLuint buffer); - typedef CUresult CUDAAPI tcuGLUnmapBufferObject(GLuint buffer); - typedef CUresult CUDAAPI tcuGLUnregisterBufferObject(GLuint buffer); - typedef CUresult CUDAAPI tcuGLSetBufferObjectMapFlags(GLuint buffer, unsigned int Flags); - typedef CUresult CUDAAPI tcuGLMapBufferObjectAsync_v2(CUdeviceptr* dptr, size_t* size, GLuint buffer, CUstream hStream); - typedef CUresult CUDAAPI tcuGLUnmapBufferObjectAsync(GLuint buffer, CUstream hStream); - - typedef const char* CUDAAPI tnvrtcGetErrorString(nvrtcResult result); - typedef nvrtcResult CUDAAPI tnvrtcVersion(int* major, int* minor); - typedef nvrtcResult CUDAAPI tnvrtcCreateProgram(nvrtcProgram* prog, const char* src, const char* name, int numHeaders, const char** headers, const char** includeNames); - typedef nvrtcResult CUDAAPI tnvrtcDestroyProgram(nvrtcProgram* prog); - typedef nvrtcResult CUDAAPI tnvrtcCompileProgram(nvrtcProgram prog, int numOptions, const char** options); - typedef nvrtcResult CUDAAPI tnvrtcGetPTXSize(nvrtcProgram prog, size_t* ptxSizeRet); - typedef nvrtcResult CUDAAPI tnvrtcGetPTX(nvrtcProgram prog, char* ptx); - typedef nvrtcResult CUDAAPI tnvrtcGetProgramLogSize(nvrtcProgram prog, size_t* logSizeRet); - typedef nvrtcResult CUDAAPI tnvrtcGetProgramLog(nvrtcProgram prog, char* log); - typedef nvrtcResult CUDAAPI tnvrtcAddNameExpression(nvrtcProgram prog, const char* name_expression); - typedef nvrtcResult CUDAAPI tnvrtcGetLoweredName(nvrtcProgram prog, const char* name_expression, const char** lowered_name); - - - /* Function declarations. */ - extern tcuGetErrorString* cuGetErrorString; - extern tcuGetErrorName* cuGetErrorName; - extern tcuInit* cuInit; - extern tcuDriverGetVersion* cuDriverGetVersion; - extern tcuDeviceGet* cuDeviceGet; - extern tcuDeviceGetCount* cuDeviceGetCount; - extern tcuDeviceGetName* cuDeviceGetName; - extern tcuDeviceGetUuid* cuDeviceGetUuid; - extern tcuDeviceTotalMem_v2* cuDeviceTotalMem_v2; - extern tcuDeviceGetAttribute* cuDeviceGetAttribute; - extern tcuDeviceGetProperties* cuDeviceGetProperties; - extern tcuDeviceComputeCapability* cuDeviceComputeCapability; - extern tcuDevicePrimaryCtxRetain* cuDevicePrimaryCtxRetain; - extern tcuDevicePrimaryCtxRelease* cuDevicePrimaryCtxRelease; - extern tcuDevicePrimaryCtxSetFlags* cuDevicePrimaryCtxSetFlags; - extern tcuDevicePrimaryCtxGetState* cuDevicePrimaryCtxGetState; - extern tcuDevicePrimaryCtxReset* cuDevicePrimaryCtxReset; - extern tcuCtxCreate_v2* cuCtxCreate_v2; - extern tcuCtxDestroy_v2* cuCtxDestroy_v2; - extern tcuCtxPushCurrent_v2* cuCtxPushCurrent_v2; - extern tcuCtxPopCurrent_v2* cuCtxPopCurrent_v2; - extern tcuCtxSetCurrent* cuCtxSetCurrent; - extern tcuCtxGetCurrent* cuCtxGetCurrent; - extern tcuCtxGetDevice* cuCtxGetDevice; - extern tcuCtxGetFlags* cuCtxGetFlags; - extern tcuCtxSynchronize* cuCtxSynchronize; - extern tcuCtxSetLimit* cuCtxSetLimit; - extern tcuCtxGetLimit* cuCtxGetLimit; - extern tcuCtxGetCacheConfig* cuCtxGetCacheConfig; - extern tcuCtxSetCacheConfig* cuCtxSetCacheConfig; - extern tcuCtxGetSharedMemConfig* cuCtxGetSharedMemConfig; - extern tcuCtxSetSharedMemConfig* cuCtxSetSharedMemConfig; - extern tcuCtxGetApiVersion* cuCtxGetApiVersion; - extern tcuCtxGetStreamPriorityRange* cuCtxGetStreamPriorityRange; - extern tcuCtxAttach* cuCtxAttach; - extern tcuCtxDetach* cuCtxDetach; - extern tcuModuleLoad* cuModuleLoad; - extern tcuModuleLoadData* cuModuleLoadData; - extern tcuModuleLoadDataEx* cuModuleLoadDataEx; - extern tcuModuleLoadFatBinary* cuModuleLoadFatBinary; - extern tcuModuleUnload* cuModuleUnload; - extern tcuModuleGetFunction* cuModuleGetFunction; - extern tcuModuleGetGlobal_v2* cuModuleGetGlobal_v2; - extern tcuModuleGetTexRef* cuModuleGetTexRef; - extern tcuModuleGetSurfRef* cuModuleGetSurfRef; - extern tcuLinkCreate_v2* cuLinkCreate_v2; - extern tcuLinkAddData_v2* cuLinkAddData_v2; - extern tcuLinkAddFile_v2* cuLinkAddFile_v2; - extern tcuLinkComplete* cuLinkComplete; - extern tcuLinkDestroy* cuLinkDestroy; - extern tcuMemGetInfo_v2* cuMemGetInfo_v2; - extern tcuMemAlloc_v2* cuMemAlloc_v2; - extern tcuMemAllocPitch_v2* cuMemAllocPitch_v2; - extern tcuMemFree_v2* cuMemFree_v2; - extern tcuMemGetAddressRange_v2* cuMemGetAddressRange_v2; - extern tcuMemAllocHost_v2* cuMemAllocHost_v2; - extern tcuMemFreeHost* cuMemFreeHost; - extern tcuMemHostAlloc* cuMemHostAlloc; - extern tcuMemHostGetDevicePointer_v2* cuMemHostGetDevicePointer_v2; - extern tcuMemHostGetFlags* cuMemHostGetFlags; - extern tcuMemAllocManaged* cuMemAllocManaged; - extern tcuDeviceGetByPCIBusId* cuDeviceGetByPCIBusId; - extern tcuDeviceGetPCIBusId* cuDeviceGetPCIBusId; - extern tcuIpcGetEventHandle* cuIpcGetEventHandle; - extern tcuIpcOpenEventHandle* cuIpcOpenEventHandle; - extern tcuIpcGetMemHandle* cuIpcGetMemHandle; - extern tcuIpcOpenMemHandle* cuIpcOpenMemHandle; - extern tcuIpcCloseMemHandle* cuIpcCloseMemHandle; - extern tcuMemHostRegister_v2* cuMemHostRegister_v2; - extern tcuMemHostUnregister* cuMemHostUnregister; - extern tcuMemcpy* cuMemcpy; - extern tcuMemcpyPeer* cuMemcpyPeer; - extern tcuMemcpyHtoD_v2* cuMemcpyHtoD_v2; - extern tcuMemcpyDtoH_v2* cuMemcpyDtoH_v2; - extern tcuMemcpyDtoD_v2* cuMemcpyDtoD_v2; - extern tcuMemcpyDtoA_v2* cuMemcpyDtoA_v2; - extern tcuMemcpyAtoD_v2* cuMemcpyAtoD_v2; - extern tcuMemcpyHtoA_v2* cuMemcpyHtoA_v2; - extern tcuMemcpyAtoH_v2* cuMemcpyAtoH_v2; - extern tcuMemcpyAtoA_v2* cuMemcpyAtoA_v2; - extern tcuMemcpy2D_v2* cuMemcpy2D_v2; - extern tcuMemcpy2DUnaligned_v2* cuMemcpy2DUnaligned_v2; - extern tcuMemcpy3D_v2* cuMemcpy3D_v2; - extern tcuMemcpy3DPeer* cuMemcpy3DPeer; - extern tcuMemcpyAsync* cuMemcpyAsync; - extern tcuMemcpyPeerAsync* cuMemcpyPeerAsync; - extern tcuMemcpyHtoDAsync_v2* cuMemcpyHtoDAsync_v2; - extern tcuMemcpyDtoHAsync_v2* cuMemcpyDtoHAsync_v2; - extern tcuMemcpyDtoDAsync_v2* cuMemcpyDtoDAsync_v2; - extern tcuMemcpyHtoAAsync_v2* cuMemcpyHtoAAsync_v2; - extern tcuMemcpyAtoHAsync_v2* cuMemcpyAtoHAsync_v2; - extern tcuMemcpy2DAsync_v2* cuMemcpy2DAsync_v2; - extern tcuMemcpy3DAsync_v2* cuMemcpy3DAsync_v2; - extern tcuMemcpy3DPeerAsync* cuMemcpy3DPeerAsync; - extern tcuMemsetD8_v2* cuMemsetD8_v2; - extern tcuMemsetD16_v2* cuMemsetD16_v2; - extern tcuMemsetD32_v2* cuMemsetD32_v2; - extern tcuMemsetD2D8_v2* cuMemsetD2D8_v2; - extern tcuMemsetD2D16_v2* cuMemsetD2D16_v2; - extern tcuMemsetD2D32_v2* cuMemsetD2D32_v2; - extern tcuMemsetD8Async* cuMemsetD8Async; - extern tcuMemsetD16Async* cuMemsetD16Async; - extern tcuMemsetD32Async* cuMemsetD32Async; - extern tcuMemsetD2D8Async* cuMemsetD2D8Async; - extern tcuMemsetD2D16Async* cuMemsetD2D16Async; - extern tcuMemsetD2D32Async* cuMemsetD2D32Async; - extern tcuArrayCreate_v2* cuArrayCreate_v2; - extern tcuArrayGetDescriptor_v2* cuArrayGetDescriptor_v2; - extern tcuArrayDestroy* cuArrayDestroy; - extern tcuArray3DCreate_v2* cuArray3DCreate_v2; - extern tcuArray3DGetDescriptor_v2* cuArray3DGetDescriptor_v2; - extern tcuMipmappedArrayCreate* cuMipmappedArrayCreate; - extern tcuMipmappedArrayGetLevel* cuMipmappedArrayGetLevel; - extern tcuMipmappedArrayDestroy* cuMipmappedArrayDestroy; - extern tcuPointerGetAttribute* cuPointerGetAttribute; - extern tcuMemPrefetchAsync* cuMemPrefetchAsync; - extern tcuMemAdvise* cuMemAdvise; - extern tcuMemRangeGetAttribute* cuMemRangeGetAttribute; - extern tcuMemRangeGetAttributes* cuMemRangeGetAttributes; - extern tcuPointerSetAttribute* cuPointerSetAttribute; - extern tcuPointerGetAttributes* cuPointerGetAttributes; - extern tcuStreamCreate* cuStreamCreate; - extern tcuStreamCreateWithPriority* cuStreamCreateWithPriority; - extern tcuStreamGetPriority* cuStreamGetPriority; - extern tcuStreamGetFlags* cuStreamGetFlags; - extern tcuStreamGetCtx* cuStreamGetCtx; - extern tcuStreamWaitEvent* cuStreamWaitEvent; - extern tcuStreamAddCallback* cuStreamAddCallback; - extern tcuStreamAttachMemAsync* cuStreamAttachMemAsync; - extern tcuStreamQuery* cuStreamQuery; - extern tcuStreamSynchronize* cuStreamSynchronize; - extern tcuStreamDestroy_v2* cuStreamDestroy_v2; - extern tcuEventCreate* cuEventCreate; - extern tcuEventRecord* cuEventRecord; - extern tcuEventQuery* cuEventQuery; - extern tcuEventSynchronize* cuEventSynchronize; - extern tcuEventDestroy_v2* cuEventDestroy_v2; - extern tcuEventElapsedTime* cuEventElapsedTime; - extern tcuStreamWaitValue32* cuStreamWaitValue32; - extern tcuStreamWaitValue64* cuStreamWaitValue64; - extern tcuStreamWriteValue32* cuStreamWriteValue32; - extern tcuStreamWriteValue64* cuStreamWriteValue64; - extern tcuStreamBatchMemOp* cuStreamBatchMemOp; - extern tcuFuncGetAttribute* cuFuncGetAttribute; - extern tcuFuncSetAttribute* cuFuncSetAttribute; - extern tcuFuncSetCacheConfig* cuFuncSetCacheConfig; - extern tcuFuncSetSharedMemConfig* cuFuncSetSharedMemConfig; - extern tcuLaunchKernel* cuLaunchKernel; - extern tcuLaunchCooperativeKernel* cuLaunchCooperativeKernel; - extern tcuLaunchCooperativeKernelMultiDevice* cuLaunchCooperativeKernelMultiDevice; - extern tcuFuncSetBlockShape* cuFuncSetBlockShape; - extern tcuFuncSetSharedSize* cuFuncSetSharedSize; - extern tcuParamSetSize* cuParamSetSize; - extern tcuParamSeti* cuParamSeti; - extern tcuParamSetf* cuParamSetf; - extern tcuParamSetv* cuParamSetv; - extern tcuLaunch* cuLaunch; - extern tcuLaunchGrid* cuLaunchGrid; - extern tcuLaunchGridAsync* cuLaunchGridAsync; - extern tcuParamSetTexRef* cuParamSetTexRef; - extern tcuOccupancyMaxActiveBlocksPerMultiprocessor* cuOccupancyMaxActiveBlocksPerMultiprocessor; - extern tcuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags* cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags; - extern tcuOccupancyMaxPotentialBlockSize* cuOccupancyMaxPotentialBlockSize; - extern tcuOccupancyMaxPotentialBlockSizeWithFlags* cuOccupancyMaxPotentialBlockSizeWithFlags; - extern tcuTexRefSetArray* cuTexRefSetArray; - extern tcuTexRefSetMipmappedArray* cuTexRefSetMipmappedArray; - extern tcuTexRefSetAddress_v2* cuTexRefSetAddress_v2; - extern tcuTexRefSetAddress2D_v3* cuTexRefSetAddress2D_v3; - extern tcuTexRefSetFormat* cuTexRefSetFormat; - extern tcuTexRefSetAddressMode* cuTexRefSetAddressMode; - extern tcuTexRefSetFilterMode* cuTexRefSetFilterMode; - extern tcuTexRefSetMipmapFilterMode* cuTexRefSetMipmapFilterMode; - extern tcuTexRefSetMipmapLevelBias* cuTexRefSetMipmapLevelBias; - extern tcuTexRefSetMipmapLevelClamp* cuTexRefSetMipmapLevelClamp; - extern tcuTexRefSetMaxAnisotropy* cuTexRefSetMaxAnisotropy; - extern tcuTexRefSetBorderColor* cuTexRefSetBorderColor; - extern tcuTexRefSetFlags* cuTexRefSetFlags; - extern tcuTexRefGetAddress_v2* cuTexRefGetAddress_v2; - extern tcuTexRefGetArray* cuTexRefGetArray; - extern tcuTexRefGetMipmappedArray* cuTexRefGetMipmappedArray; - extern tcuTexRefGetAddressMode* cuTexRefGetAddressMode; - extern tcuTexRefGetFilterMode* cuTexRefGetFilterMode; - extern tcuTexRefGetFormat* cuTexRefGetFormat; - extern tcuTexRefGetMipmapFilterMode* cuTexRefGetMipmapFilterMode; - extern tcuTexRefGetMipmapLevelBias* cuTexRefGetMipmapLevelBias; - extern tcuTexRefGetMipmapLevelClamp* cuTexRefGetMipmapLevelClamp; - extern tcuTexRefGetMaxAnisotropy* cuTexRefGetMaxAnisotropy; - extern tcuTexRefGetBorderColor* cuTexRefGetBorderColor; - extern tcuTexRefGetFlags* cuTexRefGetFlags; - extern tcuTexRefCreate* cuTexRefCreate; - extern tcuTexRefDestroy* cuTexRefDestroy; - extern tcuSurfRefSetArray* cuSurfRefSetArray; - extern tcuSurfRefGetArray* cuSurfRefGetArray; - extern tcuTexObjectCreate* cuTexObjectCreate; - extern tcuTexObjectDestroy* cuTexObjectDestroy; - extern tcuTexObjectGetResourceDesc* cuTexObjectGetResourceDesc; - extern tcuTexObjectGetTextureDesc* cuTexObjectGetTextureDesc; - extern tcuTexObjectGetResourceViewDesc* cuTexObjectGetResourceViewDesc; - extern tcuSurfObjectCreate* cuSurfObjectCreate; - extern tcuSurfObjectDestroy* cuSurfObjectDestroy; - extern tcuSurfObjectGetResourceDesc* cuSurfObjectGetResourceDesc; - extern tcuDeviceCanAccessPeer* cuDeviceCanAccessPeer; - extern tcuCtxEnablePeerAccess* cuCtxEnablePeerAccess; - extern tcuCtxDisablePeerAccess* cuCtxDisablePeerAccess; - extern tcuDeviceGetP2PAttribute* cuDeviceGetP2PAttribute; - extern tcuGraphicsUnregisterResource* cuGraphicsUnregisterResource; - extern tcuGraphicsSubResourceGetMappedArray* cuGraphicsSubResourceGetMappedArray; - extern tcuGraphicsResourceGetMappedMipmappedArray* cuGraphicsResourceGetMappedMipmappedArray; - extern tcuGraphicsResourceGetMappedPointer_v2* cuGraphicsResourceGetMappedPointer_v2; - extern tcuGraphicsResourceSetMapFlags_v2* cuGraphicsResourceSetMapFlags_v2; - extern tcuGraphicsMapResources* cuGraphicsMapResources; - extern tcuGraphicsUnmapResources* cuGraphicsUnmapResources; - extern tcuGetExportTable* cuGetExportTable; - - extern tcuGraphicsGLRegisterBuffer* cuGraphicsGLRegisterBuffer; - extern tcuGraphicsGLRegisterImage* cuGraphicsGLRegisterImage; - extern tcuGLGetDevices_v2* cuGLGetDevices_v2; - extern tcuGLCtxCreate_v2* cuGLCtxCreate_v2; - extern tcuGLInit* cuGLInit; - extern tcuGLRegisterBufferObject* cuGLRegisterBufferObject; - extern tcuGLMapBufferObject_v2* cuGLMapBufferObject_v2; - extern tcuGLUnmapBufferObject* cuGLUnmapBufferObject; - extern tcuGLUnregisterBufferObject* cuGLUnregisterBufferObject; - extern tcuGLSetBufferObjectMapFlags* cuGLSetBufferObjectMapFlags; - extern tcuGLMapBufferObjectAsync_v2* cuGLMapBufferObjectAsync_v2; - extern tcuGLUnmapBufferObjectAsync* cuGLUnmapBufferObjectAsync; - - extern tnvrtcGetErrorString* nvrtcGetErrorString; - extern tnvrtcVersion* nvrtcVersion; - extern tnvrtcCreateProgram* nvrtcCreateProgram; - extern tnvrtcDestroyProgram* nvrtcDestroyProgram; - extern tnvrtcCompileProgram* nvrtcCompileProgram; - extern tnvrtcGetPTXSize* nvrtcGetPTXSize; - extern tnvrtcGetPTX* nvrtcGetPTX; - extern tnvrtcGetProgramLogSize* nvrtcGetProgramLogSize; - extern tnvrtcGetProgramLog* nvrtcGetProgramLog; - extern tnvrtcAddNameExpression* nvrtcAddNameExpression; - extern tnvrtcGetLoweredName* nvrtcGetLoweredName; - - - enum { - CUEW_SUCCESS = 0, - CUEW_ERROR_OPEN_FAILED = -1, - CUEW_ERROR_ATEXIT_FAILED = -2, - }; - - enum { - CUEW_INIT_CUDA = 1, - CUEW_INIT_NVRTC = 2 - }; - - int cuewInit(cuuint32_t flags); - const char* cuewErrorString(CUresult result); - const char* cuewCompilerPath(void); - int cuewCompilerVersion(void); - int cuewNvrtcVersion(void); - -#ifdef __cplusplus -} -#endif - -#endif /* __CUEW_H__ */ \ No newline at end of file diff --git a/crtx/dllmain.cpp b/crtx/dllmain.cpp deleted file mode 100644 index b21ed25..0000000 --- a/crtx/dllmain.cpp +++ /dev/null @@ -1,742 +0,0 @@ -#include "cuew/cuew.h" // this pulls in cuda.h safely (no prototypes) - -#include -#include -#include -#include - -// now your other includes: -#include -#include -#include -#include -#include -#include - -struct float3 { float x,y,z; }; -struct int3 { int i[3]; }; - -#include "common.h" -#include "rtx.h" -#include "internal.h" - - -// Optional: returns CUDA driver version as int like 12040 == 12.4 -static int getCudaDriverVersion() -{ - int v = 0; - cuDriverGetVersion(&v); - return v; -} - -#define OPTIX_CHECK_RTX(call) \ - do { \ - OptixResult _res = (call); \ - if (_res != OPTIX_SUCCESS) { \ - std::ostringstream _oss; \ - _oss << "OptiX call failed: " << #call \ - << " at " << __FILE__ << ":" << __LINE__ \ - << " (" << __FUNCTION__ << ")\n" \ - << " OptixResult: " << optixResultToString(_res) \ - << " (" << static_cast(_res) << ")\n" \ - << " CUDA driver version: " << getCudaDriverVersion() << "\n" \ - << " OPTIX_ABI_VERSION (compiled): " << OPTIX_ABI_VERSION \ - << "\n"; \ - if (_res == OPTIX_ERROR_UNSUPPORTED_ABI_VERSION) { \ - _oss << " Hint: driver/runtime ABI mismatch. Your NVIDIA " \ - "driver is likely too old for this OptiX SDK.\n"; \ - } \ - setLastErrorRTX(_oss.str().c_str()); \ - return static_cast(_res); \ - } \ - } while (0) - -State global_state; - -/// Read the contents of a text file @fileName and return them in a string -std::string getTextFileContents(const char* fileName) { - FILE* f = fopen(fileName, "rt"); - std::string res; - - if (f) { - fseek(f, 0, SEEK_END); - size_t size = ftell(f); - fseek(f, 0, SEEK_SET); - - if (size > 0) { - res.resize(size + 1); - size_t bytes_read = fread(&res[0], 1, size, f); - (void)bytes_read; - res[size] = 0; - } - fclose(f); - - } - return res; -} - - -static thread_local std::string g_last_error; - -extern "C" void setLastErrorRTX(const char* msg) -{ - g_last_error = (msg ? msg : ""); -} - -extern "C" const char* getLastErrorRTX() -{ - return g_last_error.empty() ? nullptr : g_last_error.c_str(); -} - - -static const char* optixResultToString(OptixResult r) -{ - switch (r) - { - case OPTIX_SUCCESS: return "OPTIX_SUCCESS"; - case OPTIX_ERROR_INVALID_VALUE: return "OPTIX_ERROR_INVALID_VALUE"; - case OPTIX_ERROR_HOST_OUT_OF_MEMORY: return "OPTIX_ERROR_HOST_OUT_OF_MEMORY"; - case OPTIX_ERROR_INVALID_OPERATION: return "OPTIX_ERROR_INVALID_OPERATION"; - case OPTIX_ERROR_FILE_IO_ERROR: return "OPTIX_ERROR_FILE_IO_ERROR"; - case OPTIX_ERROR_INVALID_FILE_FORMAT: return "OPTIX_ERROR_INVALID_FILE_FORMAT"; - case OPTIX_ERROR_DISK_CACHE_INVALID_PATH: return "OPTIX_ERROR_DISK_CACHE_INVALID_PATH"; - case OPTIX_ERROR_UNSUPPORTED_ABI_VERSION: return "OPTIX_ERROR_UNSUPPORTED_ABI_VERSION"; - case OPTIX_ERROR_FUNCTION_TABLE_SIZE_MISMATCH: return "OPTIX_ERROR_FUNCTION_TABLE_SIZE_MISMATCH"; - case OPTIX_ERROR_INVALID_DEVICE_CONTEXT: return "OPTIX_ERROR_INVALID_DEVICE_CONTEXT"; - default: return "OPTIX_ERROR_UNKNOWN"; - } -} - -int createModule(State& state) -{ - char log[16384]; - size_t logSize = sizeof(log); - - OptixModuleCompileOptions module_compile_options = {}; - module_compile_options.maxRegisterCount = OPTIX_COMPILE_DEFAULT_MAX_REGISTER_COUNT; - module_compile_options.optLevel = OPTIX_COMPILE_OPTIMIZATION_DEFAULT; - module_compile_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_MINIMAL; - - state.pipeline_compile_options.usesMotionBlur = false; - state.pipeline_compile_options.traversableGraphFlags = OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_SINGLE_GAS; - state.pipeline_compile_options.numPayloadValues = 4; - state.pipeline_compile_options.numAttributeValues = 2; - state.pipeline_compile_options.exceptionFlags = OPTIX_EXCEPTION_FLAG_NONE; - state.pipeline_compile_options.pipelineLaunchParamsVariableName = "params"; - - std::string ptx = load_ptx_file("kernel.ptx"); - if (ptx.empty()) { - fprintf(stderr, "Failed to load kernel.ptx\n"); - return -1; - } - - const char* input = ptx.data(); - const size_t inputSize = ptx.size(); - - OPTIX_CHECK_LOG( - optixModuleCreate( - state.context, - &module_compile_options, - &state.pipeline_compile_options, - input, - inputSize, - log, - &logSize, - &state.ptx_module - ) - ); - - return 0; -} - - - -int createProgramGroups(State& state) -{ - char log[2048]; - size_t logSize = sizeof( log ); - - OptixProgramGroupOptions program_group_options = {}; - - OptixProgramGroupDesc raygen_prog_group_desc = {}; - raygen_prog_group_desc.kind = OPTIX_PROGRAM_GROUP_KIND_RAYGEN; - raygen_prog_group_desc.raygen.module = state.ptx_module; - raygen_prog_group_desc.raygen.entryFunctionName = "__raygen__main"; - - OPTIX_CHECK_LOG( - optixProgramGroupCreate( - state.context, - &raygen_prog_group_desc, - 1, // num program groups - &program_group_options, - log, - &logSize, - &state.raygen - ) - ); - - OptixProgramGroupDesc miss_prog_group_desc = {}; - miss_prog_group_desc.kind = OPTIX_PROGRAM_GROUP_KIND_MISS; - miss_prog_group_desc.miss.module = state.ptx_module; - miss_prog_group_desc.miss.entryFunctionName = "__miss__miss"; - OPTIX_CHECK_LOG( - optixProgramGroupCreate( - state.context, - &miss_prog_group_desc, - 1, // num program groups - &program_group_options, - log, - &logSize, - &state.miss - ) - ); - - OptixProgramGroupDesc hit_prog_group_desc = {}; - hit_prog_group_desc.kind = OPTIX_PROGRAM_GROUP_KIND_HITGROUP; - hit_prog_group_desc.hitgroup.moduleCH = state.ptx_module; - hit_prog_group_desc.hitgroup.entryFunctionNameCH = "__closesthit__chit"; - OPTIX_CHECK_LOG( - optixProgramGroupCreate( - state.context, - &hit_prog_group_desc, - 1, // num program groups - &program_group_options, - log, - &logSize, - &state.hit - ) - ); - return 0; -} - -int createPipelines(State& state) -{ - OptixResult res = OPTIX_SUCCESS; - char log[2048]; - size_t sizeof_log = sizeof(log); - - const uint32_t max_trace_depth = 1; - OptixProgramGroup program_groups[3] = { state.raygen, state.miss, state.hit }; - - OptixPipelineLinkOptions pipeline_link_options = {}; - pipeline_link_options.maxTraceDepth = max_trace_depth; - - res = optixPipelineCreate( - state.context, - &state.pipeline_compile_options, - &pipeline_link_options, - program_groups, - sizeof(program_groups) / sizeof(program_groups[0]), - log, - &sizeof_log, - &state.pipeline - ); - if (res != OPTIX_SUCCESS) { - fprintf(stderr, "Failed to create OptiX Pipeline.\nLog:\n%s\n", log); - return -1; - } - - OptixStackSizes stack_sizes = {}; - for (auto& prog_group : program_groups) { - OPTIX_CHECK(optixUtilAccumulateStackSizes(prog_group, &stack_sizes, state.pipeline)); - } - - uint32_t direct_callable_stack_size_from_traversal = 0; - uint32_t direct_callable_stack_size_from_state = 0; - uint32_t continuation_stack_size = 0; - - OPTIX_CHECK( - optixUtilComputeStackSizes( - &stack_sizes, - max_trace_depth, - 0, // maxCCDepth - 0, // maxDCDepth - &direct_callable_stack_size_from_traversal, - &direct_callable_stack_size_from_state, - &continuation_stack_size - ) - ); - - OPTIX_CHECK( - optixPipelineSetStackSize( - state.pipeline, - direct_callable_stack_size_from_traversal, - direct_callable_stack_size_from_state, - continuation_stack_size, - 1 // maxTraversableDepth - ) - ); - - return 0; -} - - -int createSBT(State& state) -{ - CUresult err = CUDA_SUCCESS; - // raygen - RayGenSbtRecord rgSBT; - OPTIX_CHECK(optixSbtRecordPackHeader(state.raygen, &rgSBT)); - const int raygenRecordSize = sizeof(RayGenSbtRecord); - - CUdeviceptr d_raygen_record = 0; - err = cuMemAlloc(&d_raygen_record, raygenRecordSize); - assert(err == CUDA_SUCCESS); - err = cuMemcpyHtoD(d_raygen_record, &rgSBT, raygenRecordSize); - assert(err == CUDA_SUCCESS); - - // miss - MissSbtRecord msSBT; - OPTIX_CHECK(optixSbtRecordPackHeader(state.miss, &msSBT)); - const int missSbtRecordSize = sizeof(MissSbtRecord); - - CUdeviceptr d_miss_record = 0; - err = cuMemAlloc(&d_miss_record, missSbtRecordSize); - assert(err == CUDA_SUCCESS); - err = cuMemcpyHtoD(d_miss_record, &msSBT, missSbtRecordSize); - assert(err == CUDA_SUCCESS); - - // hit group - HitGroupSbtRecord hgSBT; - OPTIX_CHECK(optixSbtRecordPackHeader(state.hit, &hgSBT)); - const int hitgroupSbtRecordSize = sizeof(MissSbtRecord); - - CUdeviceptr d_chit_record = 0; - err = cuMemAlloc(&d_chit_record, hitgroupSbtRecordSize); - assert(err == CUDA_SUCCESS); - err = cuMemcpyHtoD(d_chit_record, &hgSBT, hitgroupSbtRecordSize); - assert(err == CUDA_SUCCESS); - - OptixShaderBindingTable &shaderbt = state.sbt; - memset(&shaderbt, 0, sizeof(OptixShaderBindingTable)); - shaderbt.raygenRecord = d_raygen_record; - shaderbt.missRecordBase = d_miss_record; - shaderbt.missRecordStrideInBytes = sizeof(MissSbtRecord); - shaderbt.missRecordCount = 1; - shaderbt.hitgroupRecordBase = d_chit_record; - shaderbt.hitgroupRecordStrideInBytes = sizeof(HitGroupSbtRecord); - shaderbt.hitgroupRecordCount = 1; - return err; -} - -int cleanup_internal(State& state); -int buildRTX_internal(State& state, uint64_t hash, float3* verts, int64_t numVerts, int3* triangles, int numTriangles); -int initRTX_internal(State& state); -int traceRTX_internal(State& state, Ray* rays, Hit* hits, int size); -int initBuffers_internal(State& state, int numRays); - -int buildRTX_internal(State& state, uint64_t hash, float3* verts, int64_t numVerts, int3* triangles, int numTriangles) { - assert(numVerts= 70300 -#if DEBUG_PRINTS - options.validationMode = OPTIX_DEVICE_CONTEXT_VALIDATION_MODE_ALL; -#endif -#endif - - OPTIX_CHECK_RTX(optixDeviceContextCreate(state.cuda.context, &options, &state.context)); - - if (!state.context) { - setLastErrorRTX("optixDeviceContextCreate returned success but state.context is null"); - return -1; - } - - // For your other helpers, also setLastErrorRTX before returning -1 - if (createModule(state)) { /* setLastErrorRTX inside createModule */ return -1; } - if (createProgramGroups(state)) { /* ... */ return -1; } - if (createPipelines(state)) { /* ... */ return -1; } - if (createSBT(state)) { /* ... */ return -1; } - - state.valid = true; - return 0; -} - -int initBuffers_internal(State& state, int numRays) { - if (!state.valid) { - fprintf(stderr, "State is invalid!"); - return -2; - } - - CUresult err = CUDA_SUCCESS; - size_t newRaysSize = sizeof(Ray) * (size_t)numRays; - size_t newHitsSize = sizeof(Hit) * (size_t)numRays; - - if (newRaysSize != state.d_rays_size || newHitsSize != state.d_hits_size) { - - // Only free if we actually have something allocated - if (state.d_rays) { - err = cuMemFree(state.d_rays); - CHECK_CUDA_LOG(err, "Failed to deallocate old input data buffer"); - state.d_rays = 0; - } - if (state.d_hits) { - err = cuMemFree(state.d_hits); - CHECK_CUDA_LOG(err, "Failed to deallocate old output data buffer"); - state.d_hits = 0; - } - - // Allocate new buffers - state.d_rays_size = newRaysSize; - err = cuMemAlloc(&state.d_rays, state.d_rays_size); - CHECK_CUDA_LOG(err, "Failed to allocate input data buffer"); - - state.d_hits_size = newHitsSize; - err = cuMemAlloc(&state.d_hits, state.d_hits_size); - CHECK_CUDA_LOG(err, "Failed to allocate output data buffer"); - } - - return err; -} - -//////////////////////////////////////////////////////// -// DLL exposed functionality methods start here -//////////////////////////////////////////////////////// - -DLL_API int buildRTX(uint64_t hash, void* pverts, int64_t vBytes, void* ptriangles, int tBytes) { - - const int numVerts = int(vBytes / (sizeof(float) * 3)); - const int numTriangles = int(tBytes / (sizeof(int) * 3)); - int3* triangles = reinterpret_cast(ptriangles); - float3* verts = reinterpret_cast(pverts); - - if (!verts || !triangles || numVerts == 0 || numTriangles == 0) { -#if DEBUG_PRINTS - fprintf(stderr, "[ERROR] Empty index/vertex buffer detected!\n"); -#endif - return -1; - } -#if DEBUG_PRINTS - fprintf(stderr, "%s[%d]: %s\n", __FILE__, __LINE__, __FUNCTION__); - fprintf(stderr, "%s[%d]: verts = %p numVerts = %d | tris = %p, numtris = %d\n", __FILE__, __LINE__, - verts, numVerts, triangles, numTriangles - ); -#endif - - int err = buildRTX_internal(global_state, hash, verts, numVerts, triangles, numTriangles); - return err; -} - -DLL_API int initRTX() -{ -#if DEBUG_PRINTS - fprintf(stderr, "%s[%d]: %s\n", __FILE__, __LINE__, __FUNCTION__); -#endif - int err = initRTX_internal(global_state); - return err; -} - -DLL_API int traceRTX(void* rrays, void* hhits, int size) { -#if DEBUG_PRINTS - fprintf(stderr, "%s[%d]: %s\n", __FILE__, __LINE__, __FUNCTION__); -#endif - if (!rrays || !hhits || size == 0) { - fprintf(stderr, "Invalid call to trace with empty buffers\n"); - return -1; - } - Ray* rays = reinterpret_cast(rrays); - Hit* hits = reinterpret_cast(hhits); - int err = traceRTX_internal(global_state, rays, hits, size); - return err; -} - -DLL_API int cleanRTX() { -#if DEBUG_PRINTS - fprintf(stderr, "%s[%d]: %s\n", __FILE__, __LINE__, __FUNCTION__); -#endif - cleanup_internal(global_state); - return 0; -} - -DLL_API uint64_t getHashRTX() { -#if DEBUG_PRINTS - fprintf(stderr, "%s[%d]: %s\n", __FILE__, __LINE__, __FUNCTION__); -#endif - if (!global_state.valid) { - fprintf(stderr, "State is invalid!"); - return uint64_t(-1); - } - return global_state.scene.hash; -} diff --git a/crtx/internal.h b/crtx/internal.h deleted file mode 100644 index 57c97b9..0000000 --- a/crtx/internal.h +++ /dev/null @@ -1,171 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// NOTE: dllmain.cpp must include and BEFORE including this file. -#ifdef WIN32 -#define __align__(X) __declspec(align(X)) -#else -#define __align__(X) __attribute__((aligned(X))) -#endif - -template -struct Record { - __align__(OPTIX_SBT_RECORD_ALIGNMENT) char header[OPTIX_SBT_RECORD_HEADER_SIZE]; - T data; -}; - -struct Empty {}; -typedef Record RayGenSbtRecord; -typedef Record MissSbtRecord; -typedef Record HitGroupSbtRecord; - -#define OPTIX_CHECK( call ) \ - do \ - { \ - OptixResult res = call; \ - if( res != OPTIX_SUCCESS ) \ - { \ - std::stringstream ss; \ - ss << "Optix call '" << #call << "' failed with code(" \ - << res << "): " __FILE__ ":" \ - << __LINE__ << ")\n"; \ - fprintf(stderr, "[OptiX Error] %s\n", ss.str().c_str()); \ - return res; \ - } \ - } while( 0 ) - -#define OPTIX_CHECK_LOG( call ) \ - do \ - { \ - OptixResult res = call; \ - const size_t sizeof_log_returned = logSize; \ - logSize = sizeof( log ); \ - if( res != OPTIX_SUCCESS ) \ - { \ - std::stringstream ss; \ - ss << "Optix call '" << #call << "' failed with code(" \ - << res << "): " __FILE__ ":" \ - << __LINE__ << ")\nLog:\n" << log \ - << ( sizeof_log_returned > sizeof( log ) ? "" : "" ) \ - << "\n"; \ - fprintf(stderr, "[OptiX Error] %s\n", ss.str().c_str()); \ - return res; \ - } \ - } while( 0 ) - -inline void checkCuda(int err, const char* msg, const char* fn, int line) { - if (!msg || msg[0] == '\0') { - fprintf(stderr, "CUDA Error[%d] at %s[%d]\n", err, fn, line); - } else { - fprintf(stderr, "CUDA Error[%d] at %s[%d] : %s\n", err, fn, line, msg); - } -} - -#define CHECK_CUDA_LOG(err, msg) \ - do { \ - if ((err) != CUDA_SUCCESS) { \ - checkCuda(int(err), msg, __FUNCTION__, __LINE__); \ - return err; \ - } \ - } while (false) - -#define CHECK_CUDA(err) CHECK_CUDA_LOG(err, "") - -struct Scene { - Scene() { - accelerationStructureHandle = 0; - memory = 0; - hash = uint64_t(-1); - } - ~Scene() { freeMem(); } - - void freeMem() { - if (memory) { - cuMemFree(memory); - memory = 0; - } - } - - uint64_t hash; - CUdeviceptr memory; - OptixTraversableHandle accelerationStructureHandle; -}; - -struct State { - OptixDeviceContext context = 0; - Scene scene; - - OptixPipelineCompileOptions pipeline_compile_options = {}; - OptixModule ptx_module = 0; - OptixPipeline pipeline = 0; - - OptixProgramGroup raygen = 0; - OptixProgramGroup miss = 0; - OptixProgramGroup hit = 0; - - OptixShaderBindingTable sbt = {}; - - CUdeviceptr d_params = 0; - - CUdeviceptr d_rays = 0; - size_t d_rays_size = 0; - CUdeviceptr d_hits = 0; - size_t d_hits_size = 0; - - struct { - CUdevice device = 0; - CUstream stream = 0; - CUcontext context = 0; - } cuda; - - bool valid = false; -}; - - - -#include - -static std::string read_file_to_string(const std::string& path) -{ - std::ifstream f(path.c_str(), std::ios::binary); - if (!f) return ""; - std::ostringstream ss; - ss << f.rdbuf(); - return ss.str(); -} - -static std::string shared_lib_dir() -{ - Dl_info info{}; - if (dladdr((void*)&shared_lib_dir, &info) && info.dli_fname) { - std::string full(info.dli_fname); - auto pos = full.find_last_of('/'); - return (pos == std::string::npos) ? "." : full.substr(0, pos); - } - return "."; -} - -std::string load_ptx_file(const std::string& filename) -{ - std::string dir = shared_lib_dir(); - - std::string p1 = dir + "/" + filename; - std::string s = read_file_to_string(p1); - if (!s.empty()) return s; - - std::string p2 = dir + "/data/" + filename; - s = read_file_to_string(p2); - if (!s.empty()) return s; - - return ""; -} - diff --git a/crtx/optix_7.1/internal/optix_7_device_impl.h b/crtx/optix_7.1/internal/optix_7_device_impl.h deleted file mode 100644 index d13af7c..0000000 --- a/crtx/optix_7.1/internal/optix_7_device_impl.h +++ /dev/null @@ -1,1324 +0,0 @@ -/* -* Copyright (c) 2020 NVIDIA Corporation. All rights reserved. -* -* NVIDIA Corporation and its licensors retain all intellectual property and proprietary -* rights in and to this software, related documentation and any modifications thereto. -* Any use, reproduction, disclosure or distribution of this software and related -* documentation without an express license agreement from NVIDIA Corporation is strictly -* prohibited. -* -* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS* -* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, -* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY -* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT -* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF -* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR -* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF -* SUCH DAMAGES -*/ - -/** -* @file optix_7_device_impl.h -* @author NVIDIA Corporation -* @brief OptiX public API -* -* OptiX public API Reference - Device side implementation -*/ - -#if !defined( __OPTIX_INCLUDE_INTERNAL_HEADERS__ ) -#error("optix_7_device_impl.h is an internal header file and must not be used directly. Please use optix_device.h or optix.h instead.") -#endif - -#ifndef __optix_optix_7_device_impl_h__ -#define __optix_optix_7_device_impl_h__ - -#include "internal/optix_7_device_impl_exception.h" -#include "internal/optix_7_device_impl_transformations.h" - -static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex ) -{ - float ox = rayOrigin.x, oy = rayOrigin.y, oz = rayOrigin.z; - float dx = rayDirection.x, dy = rayDirection.y, dz = rayDirection.z; - asm volatile( - "call _optix_trace_0" - ", (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14" - ");" - : - /* no return value */ - : "l"( handle ), "f"( ox ), "f"( oy ), "f"( oz ), "f"( dx ), "f"( dy ), "f"( dz ), "f"( tmin ), "f"( tmax ), - "f"( rayTime ), "r"( visibilityMask ), "r"( rayFlags ), "r"( SBToffset ), "r"( SBTstride ), "r"( missSBTIndex ) - : ); -} - -static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex, - unsigned int& p0 ) -{ - float ox = rayOrigin.x, oy = rayOrigin.y, oz = rayOrigin.z; - float dx = rayDirection.x, dy = rayDirection.y, dz = rayDirection.z; - unsigned int p0_out; - asm volatile( - "call (%0), _optix_trace_1" - ", (%1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15" - ", %16" - ");" - : "=r"( p0_out ) - : "l"( handle ), "f"( ox ), "f"( oy ), "f"( oz ), "f"( dx ), "f"( dy ), "f"( dz ), "f"( tmin ), "f"( tmax ), "f"( rayTime ), - "r"( visibilityMask ), "r"( rayFlags ), "r"( SBToffset ), "r"( SBTstride ), "r"( missSBTIndex ), "r"( p0 ) - : ); - p0 = p0_out; -} - -static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex, - unsigned int& p0, - unsigned int& p1 ) -{ - float ox = rayOrigin.x, oy = rayOrigin.y, oz = rayOrigin.z; - float dx = rayDirection.x, dy = rayDirection.y, dz = rayDirection.z; - unsigned int p0_out, p1_out; - asm volatile( - "call (%0, %1), _optix_trace_2" - ", (%2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16" - ", %17, %18" - ");" - : "=r"( p0_out ), "=r"( p1_out ) - : "l"( handle ), "f"( ox ), "f"( oy ), "f"( oz ), "f"( dx ), "f"( dy ), "f"( dz ), "f"( tmin ), "f"( tmax ), - "f"( rayTime ), "r"( visibilityMask ), "r"( rayFlags ), "r"( SBToffset ), "r"( SBTstride ), - "r"( missSBTIndex ), "r"( p0 ), "r"( p1 ) - : ); - p0 = p0_out; - p1 = p1_out; -} -static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex, - unsigned int& p0, - unsigned int& p1, - unsigned int& p2 ) -{ - float ox = rayOrigin.x, oy = rayOrigin.y, oz = rayOrigin.z; - float dx = rayDirection.x, dy = rayDirection.y, dz = rayDirection.z; - unsigned int p0_out, p1_out, p2_out; - asm volatile( - "call (%0, %1, %2), _optix_trace_3" - ", (%3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17" - ", %18, %19, %20" - ");" - : "=r"( p0_out ), "=r"( p1_out ), "=r"( p2_out ) - : "l"( handle ), "f"( ox ), "f"( oy ), "f"( oz ), "f"( dx ), "f"( dy ), "f"( dz ), "f"( tmin ), "f"( tmax ), - "f"( rayTime ), "r"( visibilityMask ), "r"( rayFlags ), "r"( SBToffset ), "r"( SBTstride ), - "r"( missSBTIndex ), "r"( p0 ), "r"( p1 ), "r"( p2 ) - : ); - p0 = p0_out; - p1 = p1_out; - p2 = p2_out; -} -static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex, - unsigned int& p0, - unsigned int& p1, - unsigned int& p2, - unsigned int& p3 ) -{ - float ox = rayOrigin.x, oy = rayOrigin.y, oz = rayOrigin.z; - float dx = rayDirection.x, dy = rayDirection.y, dz = rayDirection.z; - unsigned int p0_out, p1_out, p2_out, p3_out; - asm volatile( - "call (%0, %1, %2, %3), _optix_trace_4" - ", (%4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18" - ", %19, %20, %21, %22" - ");" - : "=r"( p0_out ), "=r"( p1_out ), "=r"( p2_out ), "=r"( p3_out ) - : "l"( handle ), "f"( ox ), "f"( oy ), "f"( oz ), "f"( dx ), "f"( dy ), "f"( dz ), "f"( tmin ), "f"( tmax ), - "f"( rayTime ), "r"( visibilityMask ), "r"( rayFlags ), "r"( SBToffset ), "r"( SBTstride ), - "r"( missSBTIndex ), "r"( p0 ), "r"( p1 ), "r"( p2 ), "r"( p3 ) - : ); - p0 = p0_out; - p1 = p1_out; - p2 = p2_out; - p3 = p3_out; -} -static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex, - unsigned int& p0, - unsigned int& p1, - unsigned int& p2, - unsigned int& p3, - unsigned int& p4 ) -{ - float ox = rayOrigin.x, oy = rayOrigin.y, oz = rayOrigin.z; - float dx = rayDirection.x, dy = rayDirection.y, dz = rayDirection.z; - unsigned int p0_out, p1_out, p2_out, p3_out, p4_out; - asm volatile( - "call (%0, %1, %2, %3, %4), _optix_trace_5" - ", (%5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19" - ", %20, %21, %22, %23, %24" - ");" - : "=r"( p0_out ), "=r"( p1_out ), "=r"( p2_out ), "=r"( p3_out ), "=r"( p4_out ) - : "l"( handle ), "f"( ox ), "f"( oy ), "f"( oz ), "f"( dx ), "f"( dy ), "f"( dz ), "f"( tmin ), "f"( tmax ), - "f"( rayTime ), "r"( visibilityMask ), "r"( rayFlags ), "r"( SBToffset ), "r"( SBTstride ), - "r"( missSBTIndex ), "r"( p0 ), "r"( p1 ), "r"( p2 ), "r"( p3 ), "r"( p4 ) - : ); - p0 = p0_out; - p1 = p1_out; - p2 = p2_out; - p3 = p3_out; - p4 = p4_out; -} -static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex, - unsigned int& p0, - unsigned int& p1, - unsigned int& p2, - unsigned int& p3, - unsigned int& p4, - unsigned int& p5 ) -{ - float ox = rayOrigin.x, oy = rayOrigin.y, oz = rayOrigin.z; - float dx = rayDirection.x, dy = rayDirection.y, dz = rayDirection.z; - unsigned int p0_out, p1_out, p2_out, p3_out, p4_out, p5_out; - asm volatile( - "call (%0, %1, %2, %3, %4, %5), _optix_trace_6" - ", (%6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20" - ", %21, %22, %23, %24, %25, %26" - ");" - : "=r"( p0_out ), "=r"( p1_out ), "=r"( p2_out ), "=r"( p3_out ), "=r"( p4_out ), "=r"( p5_out ) - : "l"( handle ), "f"( ox ), "f"( oy ), "f"( oz ), "f"( dx ), "f"( dy ), "f"( dz ), "f"( tmin ), "f"( tmax ), - "f"( rayTime ), "r"( visibilityMask ), "r"( rayFlags ), "r"( SBToffset ), "r"( SBTstride ), - "r"( missSBTIndex ), "r"( p0 ), "r"( p1 ), "r"( p2 ), "r"( p3 ), "r"( p4 ), "r"( p5 ) - : ); - p0 = p0_out; - p1 = p1_out; - p2 = p2_out; - p3 = p3_out; - p4 = p4_out; - p5 = p5_out; -} -static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex, - unsigned int& p0, - unsigned int& p1, - unsigned int& p2, - unsigned int& p3, - unsigned int& p4, - unsigned int& p5, - unsigned int& p6 ) -{ - float ox = rayOrigin.x, oy = rayOrigin.y, oz = rayOrigin.z; - float dx = rayDirection.x, dy = rayDirection.y, dz = rayDirection.z; - unsigned int p0_out, p1_out, p2_out, p3_out, p4_out, p5_out, p6_out; - asm volatile( - "call (%0, %1, %2, %3, %4, %5, %6), _optix_trace_7" - ", (%7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21" - ", %22, %23, %24, %25, %26, %27, %28" - ");" - : "=r"( p0_out ), "=r"( p1_out ), "=r"( p2_out ), "=r"( p3_out ), "=r"( p4_out ), "=r"( p5_out ), "=r"( p6_out ) - : "l"( handle ), "f"( ox ), "f"( oy ), "f"( oz ), "f"( dx ), "f"( dy ), "f"( dz ), "f"( tmin ), "f"( tmax ), - "f"( rayTime ), "r"( visibilityMask ), "r"( rayFlags ), "r"( SBToffset ), "r"( SBTstride ), - "r"( missSBTIndex ), "r"( p0 ), "r"( p1 ), "r"( p2 ), "r"( p3 ), "r"( p4 ), "r"( p5 ), "r"( p6 ) - : ); - p0 = p0_out; - p1 = p1_out; - p2 = p2_out; - p3 = p3_out; - p4 = p4_out; - p5 = p5_out; - p6 = p6_out; -} -static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex, - unsigned int& p0, - unsigned int& p1, - unsigned int& p2, - unsigned int& p3, - unsigned int& p4, - unsigned int& p5, - unsigned int& p6, - unsigned int& p7 ) -{ - float ox = rayOrigin.x, oy = rayOrigin.y, oz = rayOrigin.z; - float dx = rayDirection.x, dy = rayDirection.y, dz = rayDirection.z; - unsigned int p0_out, p1_out, p2_out, p3_out, p4_out, p5_out, p6_out, p7_out; - asm volatile( - "call (%0, %1, %2, %3, %4, %5, %6, %7), _optix_trace_8" - ", (%8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, %21, %22" - ", %23, %24, %25, %26, %27, %28, %29, %30" - ");" - : "=r"( p0_out ), "=r"( p1_out ), "=r"( p2_out ), "=r"( p3_out ), "=r"( p4_out ), "=r"( p5_out ), - "=r"( p6_out ), "=r"( p7_out ) - : "l"( handle ), "f"( ox ), "f"( oy ), "f"( oz ), "f"( dx ), "f"( dy ), "f"( dz ), "f"( tmin ), "f"( tmax ), - "f"( rayTime ), "r"( visibilityMask ), "r"( rayFlags ), "r"( SBToffset ), "r"( SBTstride ), - "r"( missSBTIndex ), "r"( p0 ), "r"( p1 ), "r"( p2 ), "r"( p3 ), "r"( p4 ), "r"( p5 ), "r"( p6 ), "r"( p7 ) - : ); - p0 = p0_out; - p1 = p1_out; - p2 = p2_out; - p3 = p3_out; - p4 = p4_out; - p5 = p5_out; - p6 = p6_out; - p7 = p7_out; -} - -#define OPTIX_DEFINE_optixSetPayload_BODY( which ) \ - asm volatile( "call _optix_set_payload_" #which ", (%0);" : : "r"( p ) : ); - -#define OPTIX_DEFINE_optixGetPayload_BODY( which ) \ - unsigned int result; \ - asm volatile( "call (%0), _optix_get_payload_" #which ", ();" : "=r"( result ) : ); \ - return result; - -static __forceinline__ __device__ void optixSetPayload_0( unsigned int p ) -{ - OPTIX_DEFINE_optixSetPayload_BODY( 0 ) -} - -static __forceinline__ __device__ void optixSetPayload_1( unsigned int p ) -{ - OPTIX_DEFINE_optixSetPayload_BODY( 1 ) -} - -static __forceinline__ __device__ void optixSetPayload_2( unsigned int p ) -{ - OPTIX_DEFINE_optixSetPayload_BODY( 2 ) -} - -static __forceinline__ __device__ void optixSetPayload_3( unsigned int p ) -{ - OPTIX_DEFINE_optixSetPayload_BODY( 3 ) -} - -static __forceinline__ __device__ void optixSetPayload_4( unsigned int p ) -{ - OPTIX_DEFINE_optixSetPayload_BODY( 4 ) -} - -static __forceinline__ __device__ void optixSetPayload_5( unsigned int p ) -{ - OPTIX_DEFINE_optixSetPayload_BODY( 5 ) -} - -static __forceinline__ __device__ void optixSetPayload_6( unsigned int p ) -{ - OPTIX_DEFINE_optixSetPayload_BODY( 6 ) -} - -static __forceinline__ __device__ void optixSetPayload_7( unsigned int p ) -{ - OPTIX_DEFINE_optixSetPayload_BODY( 7 ) -} - -static __forceinline__ __device__ unsigned int optixGetPayload_0() -{ - OPTIX_DEFINE_optixGetPayload_BODY( 0 ); -} - -static __forceinline__ __device__ unsigned int optixGetPayload_1() -{ - OPTIX_DEFINE_optixGetPayload_BODY( 1 ); -} - -static __forceinline__ __device__ unsigned int optixGetPayload_2() -{ - OPTIX_DEFINE_optixGetPayload_BODY( 2 ); -} - -static __forceinline__ __device__ unsigned int optixGetPayload_3() -{ - OPTIX_DEFINE_optixGetPayload_BODY( 3 ); -} - -static __forceinline__ __device__ unsigned int optixGetPayload_4() -{ - OPTIX_DEFINE_optixGetPayload_BODY( 4 ); -} - -static __forceinline__ __device__ unsigned int optixGetPayload_5() -{ - OPTIX_DEFINE_optixGetPayload_BODY( 5 ); -} - -static __forceinline__ __device__ unsigned int optixGetPayload_6() -{ - OPTIX_DEFINE_optixGetPayload_BODY( 6 ); -} - -static __forceinline__ __device__ unsigned int optixGetPayload_7() -{ - OPTIX_DEFINE_optixGetPayload_BODY( 7 ); -} - -#undef OPTIX_DEFINE_optixSetPayload_BODY -#undef OPTIX_DEFINE_optixGetPayload_BODY - -static __forceinline__ __device__ unsigned int optixUndefinedValue() -{ - unsigned int u0; - asm( "call (%0), _optix_undef_value, ();" : "=r"( u0 ) : ); - return u0; -} - -static __forceinline__ __device__ float3 optixGetWorldRayOrigin() -{ - float f0, f1, f2; - asm( "call (%0), _optix_get_world_ray_origin_x, ();" : "=f"( f0 ) : ); - asm( "call (%0), _optix_get_world_ray_origin_y, ();" : "=f"( f1 ) : ); - asm( "call (%0), _optix_get_world_ray_origin_z, ();" : "=f"( f2 ) : ); - return make_float3( f0, f1, f2 ); -} - -static __forceinline__ __device__ float3 optixGetWorldRayDirection() -{ - float f0, f1, f2; - asm( "call (%0), _optix_get_world_ray_direction_x, ();" : "=f"( f0 ) : ); - asm( "call (%0), _optix_get_world_ray_direction_y, ();" : "=f"( f1 ) : ); - asm( "call (%0), _optix_get_world_ray_direction_z, ();" : "=f"( f2 ) : ); - return make_float3( f0, f1, f2 ); -} - -static __forceinline__ __device__ float3 optixGetObjectRayOrigin() -{ - float f0, f1, f2; - asm( "call (%0), _optix_get_object_ray_origin_x, ();" : "=f"( f0 ) : ); - asm( "call (%0), _optix_get_object_ray_origin_y, ();" : "=f"( f1 ) : ); - asm( "call (%0), _optix_get_object_ray_origin_z, ();" : "=f"( f2 ) : ); - return make_float3( f0, f1, f2 ); -} - -static __forceinline__ __device__ float3 optixGetObjectRayDirection() -{ - float f0, f1, f2; - asm( "call (%0), _optix_get_object_ray_direction_x, ();" : "=f"( f0 ) : ); - asm( "call (%0), _optix_get_object_ray_direction_y, ();" : "=f"( f1 ) : ); - asm( "call (%0), _optix_get_object_ray_direction_z, ();" : "=f"( f2 ) : ); - return make_float3( f0, f1, f2 ); -} - -static __forceinline__ __device__ float optixGetRayTmin() -{ - float f0; - asm( "call (%0), _optix_get_ray_tmin, ();" : "=f"( f0 ) : ); - return f0; -} - -static __forceinline__ __device__ float optixGetRayTmax() -{ - float f0; - asm( "call (%0), _optix_get_ray_tmax, ();" : "=f"( f0 ) : ); - return f0; -} - -static __forceinline__ __device__ float optixGetRayTime() -{ - float f0; - asm( "call (%0), _optix_get_ray_time, ();" : "=f"( f0 ) : ); - return f0; -} - -static __forceinline__ __device__ unsigned int optixGetRayFlags() -{ - unsigned int u0; - asm( "call (%0), _optix_get_ray_flags, ();" : "=r"( u0 ) : ); - return u0; -} - -static __forceinline__ __device__ unsigned int optixGetRayVisibilityMask() -{ - unsigned int u0; - asm( "call (%0), _optix_get_ray_visibility_mask, ();" : "=r"( u0 ) : ); - return u0; -} - -static __forceinline__ __device__ void optixGetTriangleVertexData( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float3 data[3] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8), _optix_get_triangle_vertex_data, " - "(%9, %10, %11, %12);" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[1].x ), "=f"( data[1].y ), - "=f"( data[1].z ), "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ) - : ); -} - -static __forceinline__ __device__ void optixGetLinearCurveVertexData( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[2] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7), _optix_get_linear_curve_vertex_data, " - "(%8, %9, %10, %11);" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), - "=f"( data[1].x ), "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ) - : ); -} - -static __forceinline__ __device__ void optixGetQuadraticBSplineVertexData( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[3] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11), _optix_get_quadratic_bspline_vertex_data, " - "(%12, %13, %14, %15);" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), - "=f"( data[1].x ), "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), - "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ), "=f"( data[2].w ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ) - : ); -} - -static __forceinline__ __device__ void optixGetCubicBSplineVertexData( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[4] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), " - "_optix_get_cubic_bspline_vertex_data, " - "(%16, %17, %18, %19);" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), - "=f"( data[1].x ), "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), - "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ), "=f"( data[2].w ), - "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ) - : ); -} - -static __forceinline__ __device__ OptixTraversableHandle optixGetGASTraversableHandle() -{ - unsigned long long handle; - asm( "call (%0), _optix_get_gas_traversable_handle, ();" : "=l"( handle ) : ); - return (OptixTraversableHandle)handle; -} - -static __forceinline__ __device__ float optixGetGASMotionTimeBegin( OptixTraversableHandle handle ) -{ - float f0; - asm( "call (%0), _optix_get_gas_motion_time_begin, (%1);" : "=f"( f0 ) : "l"( handle ) : ); - return f0; -} - -static __forceinline__ __device__ float optixGetGASMotionTimeEnd( OptixTraversableHandle handle ) -{ - float f0; - asm( "call (%0), _optix_get_gas_motion_time_end, (%1);" : "=f"( f0 ) : "l"( handle ) : ); - return f0; -} - -static __forceinline__ __device__ unsigned int optixGetGASMotionStepCount( OptixTraversableHandle handle ) -{ - unsigned int u0; - asm( "call (%0), _optix_get_gas_motion_step_count, (%1);" : "=r"( u0 ) : "l"( handle ) : ); - return u0; -} - -static __forceinline__ __device__ void optixGetWorldToObjectTransformMatrix( float m[12] ) -{ - if( optixGetTransformListSize() == 0 ) - { - m[0] = 1.0f; - m[1] = 0.0f; - m[2] = 0.0f; - m[3] = 0.0f; - m[4] = 0.0f; - m[5] = 1.0f; - m[6] = 0.0f; - m[7] = 0.0f; - m[8] = 0.0f; - m[9] = 0.0f; - m[10] = 1.0f; - m[11] = 0.0f; - return; - } - - float4 m0, m1, m2; - optix_impl::optixGetWorldToObjectTransformMatrix( m0, m1, m2 ); - m[0] = m0.x; - m[1] = m0.y; - m[2] = m0.z; - m[3] = m0.w; - m[4] = m1.x; - m[5] = m1.y; - m[6] = m1.z; - m[7] = m1.w; - m[8] = m2.x; - m[9] = m2.y; - m[10] = m2.z; - m[11] = m2.w; -} - -static __forceinline__ __device__ void optixGetObjectToWorldTransformMatrix( float m[12] ) -{ - if( optixGetTransformListSize() == 0 ) - { - m[0] = 1.0f; - m[1] = 0.0f; - m[2] = 0.0f; - m[3] = 0.0f; - m[4] = 0.0f; - m[5] = 1.0f; - m[6] = 0.0f; - m[7] = 0.0f; - m[8] = 0.0f; - m[9] = 0.0f; - m[10] = 1.0f; - m[11] = 0.0f; - return; - } - - float4 m0, m1, m2; - optix_impl::optixGetObjectToWorldTransformMatrix( m0, m1, m2 ); - m[0] = m0.x; - m[1] = m0.y; - m[2] = m0.z; - m[3] = m0.w; - m[4] = m1.x; - m[5] = m1.y; - m[6] = m1.z; - m[7] = m1.w; - m[8] = m2.x; - m[9] = m2.y; - m[10] = m2.z; - m[11] = m2.w; -} - -static __forceinline__ __device__ float3 optixTransformPointFromWorldToObjectSpace( float3 point ) -{ - if( optixGetTransformListSize() == 0 ) - return point; - - float4 m0, m1, m2; - optix_impl::optixGetWorldToObjectTransformMatrix( m0, m1, m2 ); - return optix_impl::optixTransformPoint( m0, m1, m2, point ); -} - -static __forceinline__ __device__ float3 optixTransformVectorFromWorldToObjectSpace( float3 vec ) -{ - if( optixGetTransformListSize() == 0 ) - return vec; - - float4 m0, m1, m2; - optix_impl::optixGetWorldToObjectTransformMatrix( m0, m1, m2 ); - return optix_impl::optixTransformVector( m0, m1, m2, vec ); -} - -static __forceinline__ __device__ float3 optixTransformNormalFromWorldToObjectSpace( float3 normal ) -{ - if( optixGetTransformListSize() == 0 ) - return normal; - - float4 m0, m1, m2; - optix_impl::optixGetObjectToWorldTransformMatrix( m0, m1, m2 ); // inverse of optixGetWorldToObjectTransformMatrix() - return optix_impl::optixTransformNormal( m0, m1, m2, normal ); -} - -static __forceinline__ __device__ float3 optixTransformPointFromObjectToWorldSpace( float3 point ) -{ - if( optixGetTransformListSize() == 0 ) - return point; - - float4 m0, m1, m2; - optix_impl::optixGetObjectToWorldTransformMatrix( m0, m1, m2 ); - return optix_impl::optixTransformPoint( m0, m1, m2, point ); -} - -static __forceinline__ __device__ float3 optixTransformVectorFromObjectToWorldSpace( float3 vec ) -{ - if( optixGetTransformListSize() == 0 ) - return vec; - - float4 m0, m1, m2; - optix_impl::optixGetObjectToWorldTransformMatrix( m0, m1, m2 ); - return optix_impl::optixTransformVector( m0, m1, m2, vec ); -} - -static __forceinline__ __device__ float3 optixTransformNormalFromObjectToWorldSpace( float3 normal ) -{ - if( optixGetTransformListSize() == 0 ) - return normal; - - float4 m0, m1, m2; - optix_impl::optixGetWorldToObjectTransformMatrix( m0, m1, m2 ); // inverse of optixGetObjectToWorldTransformMatrix() - return optix_impl::optixTransformNormal( m0, m1, m2, normal ); -} - -static __forceinline__ __device__ unsigned int optixGetTransformListSize() -{ - unsigned int u0; - asm( "call (%0), _optix_get_transform_list_size, ();" : "=r"( u0 ) : ); - return u0; -} - -static __forceinline__ __device__ OptixTraversableHandle optixGetTransformListHandle( unsigned int index ) -{ - unsigned long long u0; - asm( "call (%0), _optix_get_transform_list_handle, (%1);" : "=l"( u0 ) : "r"( index ) : ); - return u0; -} - -static __forceinline__ __device__ OptixTransformType optixGetTransformTypeFromHandle( OptixTraversableHandle handle ) -{ - int i0; - asm( "call (%0), _optix_get_transform_type_from_handle, (%1);" : "=r"( i0 ) : "l"( handle ) : ); - return (OptixTransformType)i0; -} - -static __forceinline__ __device__ const OptixStaticTransform* optixGetStaticTransformFromHandle( OptixTraversableHandle handle ) -{ - unsigned long long ptr; - asm( "call (%0), _optix_get_static_transform_from_handle, (%1);" : "=l"( ptr ) : "l"( handle ) : ); - return (const OptixStaticTransform*)ptr; -} - -static __forceinline__ __device__ const OptixSRTMotionTransform* optixGetSRTMotionTransformFromHandle( OptixTraversableHandle handle ) -{ - unsigned long long ptr; - asm( "call (%0), _optix_get_srt_motion_transform_from_handle, (%1);" : "=l"( ptr ) : "l"( handle ) : ); - return (const OptixSRTMotionTransform*)ptr; -} - -static __forceinline__ __device__ const OptixMatrixMotionTransform* optixGetMatrixMotionTransformFromHandle( OptixTraversableHandle handle ) -{ - unsigned long long ptr; - asm( "call (%0), _optix_get_matrix_motion_transform_from_handle, (%1);" : "=l"( ptr ) : "l"( handle ) : ); - return (const OptixMatrixMotionTransform*)ptr; -} - -static __forceinline__ __device__ unsigned int optixGetInstanceIdFromHandle( OptixTraversableHandle handle ) -{ - int i0; - asm( "call (%0), _optix_get_instance_id_from_handle, (%1);" : "=r"( i0 ) : "l"( handle ) : ); - return i0; -} - -static __forceinline__ __device__ const float4* optixGetInstanceTransformFromHandle( OptixTraversableHandle handle ) -{ - unsigned long long ptr; - asm( "call (%0), _optix_get_instance_transform_from_handle, (%1);" : "=l"( ptr ) : "l"( handle ) : ); - return (const float4*)ptr; -} - -static __forceinline__ __device__ const float4* optixGetInstanceInverseTransformFromHandle( OptixTraversableHandle handle ) -{ - unsigned long long ptr; - asm( "call (%0), _optix_get_instance_inverse_transform_from_handle, (%1);" : "=l"( ptr ) : "l"( handle ) : ); - return (const float4*)ptr; -} - -static __forceinline__ __device__ bool optixReportIntersection( float hitT, unsigned int hitKind ) -{ - int ret; - asm volatile( - "call (%0), _optix_report_intersection_0" - ", (%1, %2);" - : "=r"( ret ) - : "f"( hitT ), "r"( hitKind ) - : ); - return ret; -} - -static __forceinline__ __device__ bool optixReportIntersection( float hitT, unsigned int hitKind, unsigned int a0 ) -{ - int ret; - asm volatile( - "call (%0), _optix_report_intersection_1" - ", (%1, %2, %3);" - : "=r"( ret ) - : "f"( hitT ), "r"( hitKind ), "r"( a0 ) - : ); - return ret; -} - -static __forceinline__ __device__ bool optixReportIntersection( float hitT, unsigned int hitKind, unsigned int a0, unsigned int a1 ) -{ - int ret; - asm volatile( - "call (%0), _optix_report_intersection_2" - ", (%1, %2, %3, %4);" - : "=r"( ret ) - : "f"( hitT ), "r"( hitKind ), "r"( a0 ), "r"( a1 ) - : ); - return ret; -} - -static __forceinline__ __device__ bool optixReportIntersection( float hitT, unsigned int hitKind, unsigned int a0, unsigned int a1, unsigned int a2 ) -{ - int ret; - asm volatile( - "call (%0), _optix_report_intersection_3" - ", (%1, %2, %3, %4, %5);" - : "=r"( ret ) - : "f"( hitT ), "r"( hitKind ), "r"( a0 ), "r"( a1 ), "r"( a2 ) - : ); - return ret; -} - -static __forceinline__ __device__ bool optixReportIntersection( float hitT, - unsigned int hitKind, - unsigned int a0, - unsigned int a1, - unsigned int a2, - unsigned int a3 ) -{ - int ret; - asm volatile( - "call (%0), _optix_report_intersection_4" - ", (%1, %2, %3, %4, %5, %6);" - : "=r"( ret ) - : "f"( hitT ), "r"( hitKind ), "r"( a0 ), "r"( a1 ), "r"( a2 ), "r"( a3 ) - : ); - return ret; -} - -static __forceinline__ __device__ bool optixReportIntersection( float hitT, - unsigned int hitKind, - unsigned int a0, - unsigned int a1, - unsigned int a2, - unsigned int a3, - unsigned int a4 ) -{ - int ret; - asm volatile( - "call (%0), _optix_report_intersection_5" - ", (%1, %2, %3, %4, %5, %6, %7);" - : "=r"( ret ) - : "f"( hitT ), "r"( hitKind ), "r"( a0 ), "r"( a1 ), "r"( a2 ), "r"( a3 ), "r"( a4 ) - : ); - return ret; -} - -static __forceinline__ __device__ bool optixReportIntersection( float hitT, - unsigned int hitKind, - unsigned int a0, - unsigned int a1, - unsigned int a2, - unsigned int a3, - unsigned int a4, - unsigned int a5 ) -{ - int ret; - asm volatile( - "call (%0), _optix_report_intersection_6" - ", (%1, %2, %3, %4, %5, %6, %7, %8);" - : "=r"( ret ) - : "f"( hitT ), "r"( hitKind ), "r"( a0 ), "r"( a1 ), "r"( a2 ), "r"( a3 ), "r"( a4 ), "r"( a5 ) - : ); - return ret; -} - -static __forceinline__ __device__ bool optixReportIntersection( float hitT, - unsigned int hitKind, - unsigned int a0, - unsigned int a1, - unsigned int a2, - unsigned int a3, - unsigned int a4, - unsigned int a5, - unsigned int a6 ) -{ - int ret; - asm volatile( - "call (%0), _optix_report_intersection_7" - ", (%1, %2, %3, %4, %5, %6, %7, %8, %9);" - : "=r"( ret ) - : "f"( hitT ), "r"( hitKind ), "r"( a0 ), "r"( a1 ), "r"( a2 ), "r"( a3 ), "r"( a4 ), "r"( a5 ), "r"( a6 ) - : ); - return ret; -} - -static __forceinline__ __device__ bool optixReportIntersection( float hitT, - unsigned int hitKind, - unsigned int a0, - unsigned int a1, - unsigned int a2, - unsigned int a3, - unsigned int a4, - unsigned int a5, - unsigned int a6, - unsigned int a7 ) -{ - int ret; - asm volatile( - "call (%0), _optix_report_intersection_8" - ", (%1, %2, %3, %4, %5, %6, %7, %8, %9, %10);" - : "=r"( ret ) - : "f"( hitT ), "r"( hitKind ), "r"( a0 ), "r"( a1 ), "r"( a2 ), "r"( a3 ), "r"( a4 ), "r"( a5 ), "r"( a6 ), "r"( a7 ) - : ); - return ret; -} - -#define OPTIX_DEFINE_optixGetAttribute_BODY( which ) \ - unsigned int ret; \ - asm( "call (%0), _optix_get_attribute_" #which ", ();" : "=r"( ret ) : ); \ - return ret; - -static __forceinline__ __device__ unsigned int optixGetAttribute_0() -{ - OPTIX_DEFINE_optixGetAttribute_BODY( 0 ); -} - -static __forceinline__ __device__ unsigned int optixGetAttribute_1() -{ - OPTIX_DEFINE_optixGetAttribute_BODY( 1 ); -} - -static __forceinline__ __device__ unsigned int optixGetAttribute_2() -{ - OPTIX_DEFINE_optixGetAttribute_BODY( 2 ); -} - -static __forceinline__ __device__ unsigned int optixGetAttribute_3() -{ - OPTIX_DEFINE_optixGetAttribute_BODY( 3 ); -} - -static __forceinline__ __device__ unsigned int optixGetAttribute_4() -{ - OPTIX_DEFINE_optixGetAttribute_BODY( 4 ); -} - -static __forceinline__ __device__ unsigned int optixGetAttribute_5() -{ - OPTIX_DEFINE_optixGetAttribute_BODY( 5 ); -} - -static __forceinline__ __device__ unsigned int optixGetAttribute_6() -{ - OPTIX_DEFINE_optixGetAttribute_BODY( 6 ); -} - -static __forceinline__ __device__ unsigned int optixGetAttribute_7() -{ - OPTIX_DEFINE_optixGetAttribute_BODY( 7 ); -} - -#undef OPTIX_DEFINE_optixGetAttribute_BODY - -static __forceinline__ __device__ void optixTerminateRay() -{ - asm volatile( "call _optix_terminate_ray, ();" ); -} - -static __forceinline__ __device__ void optixIgnoreIntersection() -{ - asm volatile( "call _optix_ignore_intersection, ();" ); -} - -static __forceinline__ __device__ unsigned int optixGetPrimitiveIndex() -{ - unsigned int u0; - asm( "call (%0), _optix_read_primitive_idx, ();" : "=r"( u0 ) : ); - return u0; -} - -static __forceinline__ __device__ unsigned int optixGetSbtGASIndex() -{ - unsigned int u0; - asm( "call (%0), _optix_read_sbt_gas_idx, ();" : "=r"( u0 ) : ); - return u0; -} - -static __forceinline__ __device__ unsigned int optixGetInstanceId() -{ - unsigned int u0; - asm( "call (%0), _optix_read_instance_id, ();" : "=r"( u0 ) : ); - return u0; -} - -static __forceinline__ __device__ unsigned int optixGetInstanceIndex() -{ - unsigned int u0; - asm( "call (%0), _optix_read_instance_idx, ();" : "=r"( u0 ) : ); - return u0; -} - -static __forceinline__ __device__ unsigned int optixGetHitKind() -{ - unsigned int u0; - asm( "call (%0), _optix_get_hit_kind, ();" : "=r"( u0 ) : ); - return u0; -} - -static __forceinline__ __device__ OptixPrimitiveType optixGetPrimitiveType(unsigned int hitKind) -{ - unsigned int u0; - asm( "call (%0), _optix_get_primitive_type_from_hit_kind, (%1);" : "=r"( u0 ) : "r"( hitKind ) ); - return (OptixPrimitiveType)u0; -} - -static __forceinline__ __device__ bool optixIsBackFaceHit( unsigned int hitKind ) -{ - unsigned int u0; - asm( "call (%0), _optix_get_backface_from_hit_kind, (%1);" : "=r"( u0 ) : "r"( hitKind ) ); - return (u0 == 0x1); -} - -static __forceinline__ __device__ bool optixIsFrontFaceHit( unsigned int hitKind ) -{ - return !optixIsBackFaceHit( hitKind ); -} - - -static __forceinline__ __device__ OptixPrimitiveType optixGetPrimitiveType() -{ - return optixGetPrimitiveType( optixGetHitKind() ); -} - -static __forceinline__ __device__ bool optixIsBackFaceHit() -{ - return optixIsBackFaceHit( optixGetHitKind() ); -} - -static __forceinline__ __device__ bool optixIsFrontFaceHit() -{ - return optixIsFrontFaceHit( optixGetHitKind() ); -} - -static __forceinline__ __device__ bool optixIsTriangleHit() -{ - return optixIsTriangleFrontFaceHit() || optixIsTriangleBackFaceHit(); -} - -static __forceinline__ __device__ bool optixIsTriangleFrontFaceHit() -{ - return optixGetHitKind() == OPTIX_HIT_KIND_TRIANGLE_FRONT_FACE; -} - -static __forceinline__ __device__ bool optixIsTriangleBackFaceHit() -{ - return optixGetHitKind() == OPTIX_HIT_KIND_TRIANGLE_BACK_FACE; -} - -static __forceinline__ __device__ float optixGetCurveParameter() -{ - return __int_as_float( optixGetAttribute_0() ); -} - -static __forceinline__ __device__ float2 optixGetTriangleBarycentrics() -{ - float f0, f1; - asm( "call (%0, %1), _optix_get_triangle_barycentrics, ();" : "=f"( f0 ), "=f"( f1 ) : ); - return make_float2( f0, f1 ); -} - -static __forceinline__ __device__ uint3 optixGetLaunchIndex() -{ - unsigned int u0, u1, u2; - asm( "call (%0), _optix_get_launch_index_x, ();" : "=r"( u0 ) : ); - asm( "call (%0), _optix_get_launch_index_y, ();" : "=r"( u1 ) : ); - asm( "call (%0), _optix_get_launch_index_z, ();" : "=r"( u2 ) : ); - return make_uint3( u0, u1, u2 ); -} - -static __forceinline__ __device__ uint3 optixGetLaunchDimensions() -{ - unsigned int u0, u1, u2; - asm( "call (%0), _optix_get_launch_dimension_x, ();" : "=r"( u0 ) : ); - asm( "call (%0), _optix_get_launch_dimension_y, ();" : "=r"( u1 ) : ); - asm( "call (%0), _optix_get_launch_dimension_z, ();" : "=r"( u2 ) : ); - return make_uint3( u0, u1, u2 ); -} - -static __forceinline__ __device__ CUdeviceptr optixGetSbtDataPointer() -{ - unsigned long long ptr; - asm( "call (%0), _optix_get_sbt_data_ptr_64, ();" : "=l"( ptr ) : ); - return (CUdeviceptr)ptr; -} - -static __forceinline__ __device__ void optixThrowException( int exceptionCode ) -{ - asm volatile( - "call _optix_throw_exception_0, (%0);" - : /* no return value */ - : "r"( exceptionCode ) - : ); -} - -static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0 ) -{ - asm volatile( - "call _optix_throw_exception_1, (%0, %1);" - : /* no return value */ - : "r"( exceptionCode ), "r"( exceptionDetail0 ) - : ); -} - -static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0, unsigned int exceptionDetail1 ) -{ - asm volatile( - "call _optix_throw_exception_2, (%0, %1, %2);" - : /* no return value */ - : "r"( exceptionCode ), "r"( exceptionDetail0 ), "r"( exceptionDetail1 ) - : ); -} - -static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0, unsigned int exceptionDetail1, unsigned int exceptionDetail2 ) -{ - asm volatile( - "call _optix_throw_exception_3, (%0, %1, %2, %3);" - : /* no return value */ - : "r"( exceptionCode ), "r"( exceptionDetail0 ), "r"( exceptionDetail1 ), "r"( exceptionDetail2 ) - : ); -} - -static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0, unsigned int exceptionDetail1, unsigned int exceptionDetail2, unsigned int exceptionDetail3 ) -{ - asm volatile( - "call _optix_throw_exception_4, (%0, %1, %2, %3, %4);" - : /* no return value */ - : "r"( exceptionCode ), "r"( exceptionDetail0 ), "r"( exceptionDetail1 ), "r"( exceptionDetail2 ), "r"( exceptionDetail3 ) - : ); -} - -static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0, unsigned int exceptionDetail1, unsigned int exceptionDetail2, unsigned int exceptionDetail3, unsigned int exceptionDetail4 ) -{ - asm volatile( - "call _optix_throw_exception_5, (%0, %1, %2, %3, %4, %5);" - : /* no return value */ - : "r"( exceptionCode ), "r"( exceptionDetail0 ), "r"( exceptionDetail1 ), "r"( exceptionDetail2 ), "r"( exceptionDetail3 ), "r"( exceptionDetail4 ) - : ); -} - -static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0, unsigned int exceptionDetail1, unsigned int exceptionDetail2, unsigned int exceptionDetail3, unsigned int exceptionDetail4, unsigned int exceptionDetail5 ) -{ - asm volatile( - "call _optix_throw_exception_6, (%0, %1, %2, %3, %4, %5, %6);" - : /* no return value */ - : "r"( exceptionCode ), "r"( exceptionDetail0 ), "r"( exceptionDetail1 ), "r"( exceptionDetail2 ), "r"( exceptionDetail3 ), "r"( exceptionDetail4 ), "r"( exceptionDetail5 ) - : ); -} - -static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0, unsigned int exceptionDetail1, unsigned int exceptionDetail2, unsigned int exceptionDetail3, unsigned int exceptionDetail4, unsigned int exceptionDetail5, unsigned int exceptionDetail6 ) -{ - asm volatile( - "call _optix_throw_exception_7, (%0, %1, %2, %3, %4, %5, %6, %7);" - : /* no return value */ - : "r"( exceptionCode ), "r"( exceptionDetail0 ), "r"( exceptionDetail1 ), "r"( exceptionDetail2 ), "r"( exceptionDetail3 ), "r"( exceptionDetail4 ), "r"( exceptionDetail5 ), "r"( exceptionDetail6 ) - : ); -} - -static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0, unsigned int exceptionDetail1, unsigned int exceptionDetail2, unsigned int exceptionDetail3, unsigned int exceptionDetail4, unsigned int exceptionDetail5, unsigned int exceptionDetail6, unsigned int exceptionDetail7 ) -{ - asm volatile( - "call _optix_throw_exception_8, (%0, %1, %2, %3, %4, %5, %6, %7, %8);" - : /* no return value */ - : "r"( exceptionCode ), "r"( exceptionDetail0 ), "r"( exceptionDetail1 ), "r"( exceptionDetail2 ), "r"( exceptionDetail3 ), "r"( exceptionDetail4 ), "r"( exceptionDetail5 ), "r"( exceptionDetail6 ), "r"( exceptionDetail7 ) - : ); -} - -static __forceinline__ __device__ int optixGetExceptionCode() -{ - int s0; - asm( "call (%0), _optix_get_exception_code, ();" : "=r"( s0 ) : ); - return s0; -} - -#define OPTIX_DEFINE_optixGetExceptionDetail_BODY( which ) \ - unsigned int ret; \ - asm( "call (%0), _optix_get_exception_detail_" #which ", ();" : "=r"( ret ) : ); \ - return ret; - -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_0() -{ - OPTIX_DEFINE_optixGetExceptionDetail_BODY( 0 ); -} - -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_1() -{ - OPTIX_DEFINE_optixGetExceptionDetail_BODY( 1 ); -} - -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_2() -{ - OPTIX_DEFINE_optixGetExceptionDetail_BODY( 2 ); -} - -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_3() -{ - OPTIX_DEFINE_optixGetExceptionDetail_BODY( 3 ); -} - -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_4() -{ - OPTIX_DEFINE_optixGetExceptionDetail_BODY( 4 ); -} - -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_5() -{ - OPTIX_DEFINE_optixGetExceptionDetail_BODY( 5 ); -} - -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_6() -{ - OPTIX_DEFINE_optixGetExceptionDetail_BODY( 6 ); -} - -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_7() -{ - OPTIX_DEFINE_optixGetExceptionDetail_BODY( 7 ); -} - -#undef OPTIX_DEFINE_optixGetExceptionDetail_BODY - -static __forceinline__ __device__ OptixTraversableHandle optixGetExceptionInvalidTraversable() -{ - unsigned long long handle; - asm( "call (%0), _optix_get_exception_invalid_traversable, ();" : "=l"( handle ) : ); - return (OptixTraversableHandle)handle; -} - -static __forceinline__ __device__ int optixGetExceptionInvalidSbtOffset() -{ - int s0; - asm( "call (%0), _optix_get_exception_invalid_sbt_offset, ();" : "=r"( s0 ) : ); - return s0; -} - -static __forceinline__ __device__ OptixInvalidRayExceptionDetails optixGetExceptionInvalidRay() -{ - float rayOriginX, rayOriginY, rayOriginZ, rayDirectionX, rayDirectionY, rayDirectionZ, tmin, tmax, rayTime; - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8), _optix_get_exception_invalid_ray, ();" - : "=f"( rayOriginX ), "=f"( rayOriginY ), "=f"( rayOriginZ ), "=f"( rayDirectionX ), "=f"( rayDirectionY ), - "=f"( rayDirectionZ ), "=f"( tmin ), "=f"( tmax ), "=f"( rayTime ) - : ); - OptixInvalidRayExceptionDetails ray; - ray.origin = make_float3( rayOriginX, rayOriginY, rayOriginZ ); - ray.direction = make_float3( rayDirectionX, rayDirectionY, rayDirectionZ ); - ray.tmin = tmin; - ray.tmax = tmax; - ray.time = rayTime; - return ray; -} - -static __forceinline__ __device__ OptixParameterMismatchExceptionDetails optixGetExceptionParameterMismatch() -{ - unsigned int expected, actual, sbtIdx; - unsigned long long calleeName; - asm( - "call (%0, %1, %2, %3), _optix_get_exception_parameter_mismatch, ();" - : "=r"(expected), "=r"(actual), "=r"(sbtIdx), "=l"(calleeName) : ); - OptixParameterMismatchExceptionDetails details; - details.expectedParameterCount = expected; - details.passedArgumentCount = actual; - details.sbtIndex = sbtIdx; - details.callableName = (char*)calleeName; - return details; -} - -static __forceinline__ __device__ char* optixGetExceptionLineInfo() -{ - unsigned long long ptr; - asm( "call (%0), _optix_get_exception_line_info, ();" : "=l"(ptr) : ); - return (char*)ptr; -} - -template -static __forceinline__ __device__ ReturnT optixDirectCall( unsigned int sbtIndex, ArgTypes... args ) -{ - unsigned long long func; - asm( "call (%0), _optix_call_direct_callable,(%1);" : "=l"( func ) : "r"( sbtIndex ) : ); - using funcT = ReturnT ( * )( ArgTypes... ); - funcT call = ( funcT )( func ); - return call( args... ); -} - -template -static __forceinline__ __device__ ReturnT optixContinuationCall( unsigned int sbtIndex, ArgTypes... args ) -{ - unsigned long long func; - asm( "call (%0), _optix_call_continuation_callable,(%1);" : "=l"( func ) : "r"( sbtIndex ) : ); - using funcT = ReturnT ( * )( ArgTypes... ); - funcT call = ( funcT )( func ); - return call( args... ); -} -#endif diff --git a/crtx/optix_7.1/internal/optix_7_device_impl_exception.h b/crtx/optix_7.1/internal/optix_7_device_impl_exception.h deleted file mode 100644 index 9469311..0000000 --- a/crtx/optix_7.1/internal/optix_7_device_impl_exception.h +++ /dev/null @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2020 NVIDIA Corporation. All rights reserved. -* -* NVIDIA Corporation and its licensors retain all intellectual property and proprietary -* rights in and to this software, related documentation and any modifications thereto. -* Any use, reproduction, disclosure or distribution of this software and related -* documentation without an express license agreement from NVIDIA Corporation is strictly -* prohibited. -* -* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS* -* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, -* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY -* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT -* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF -* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR -* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF -* SUCH DAMAGES -*/ - -/** -* @file optix_7_device_impl_exception.h -* @author NVIDIA Corporation -* @brief OptiX public API -* -* OptiX public API Reference - Device side implementation for exception helper function. -*/ - -#if !defined( __OPTIX_INCLUDE_INTERNAL_HEADERS__ ) -#error("optix_7_device_impl_exception.h is an internal header file and must not be used directly. Please use optix_device.h or optix.h instead.") -#endif - -#ifndef __optix_optix_7_device_impl_exception_h__ -#define __optix_optix_7_device_impl_exception_h__ - -#if !defined(__CUDACC_RTC__) -#include /* for printf */ -#endif - -namespace optix_impl { - - static __forceinline__ __device__ void optixDumpStaticTransformFromHandle( OptixTraversableHandle handle ) - { - const OptixStaticTransform* traversable = optixGetStaticTransformFromHandle( handle ); - if( traversable ) - { - const uint3 index = optixGetLaunchIndex(); - printf( "(%4i,%4i,%4i) OptixStaticTransform@%p = {\n" - " child = %p,\n" - " transform = { %f,%f,%f,%f,\n" - " %f,%f,%f,%f,\n" - " %f,%f,%f,%f } }\n", - index.x,index.y,index.z, - traversable, - (void*)traversable->child, - traversable->transform[0], traversable->transform[1], traversable->transform[2], traversable->transform[3], - traversable->transform[4], traversable->transform[5], traversable->transform[6], traversable->transform[7], - traversable->transform[8], traversable->transform[9], traversable->transform[10], traversable->transform[11] ); - } - } - - static __forceinline__ __device__ void optixDumpMotionMatrixTransformFromHandle( OptixTraversableHandle handle ) - { - const OptixMatrixMotionTransform* traversable = optixGetMatrixMotionTransformFromHandle( handle ); - if( traversable ) - { - const uint3 index = optixGetLaunchIndex(); - printf( "(%4i,%4i,%4i) OptixMatrixMotionTransform@%p = {\n" - " child = %p,\n" - " motionOptions = { numKeys = %i, flags = %i, timeBegin = %f, timeEnd = %f },\n" - " transform = { { %f,%f,%f,%f,\n" - " %f,%f,%f,%f,\n" - " %f,%f,%f,%f }, ... }\n", - index.x,index.y,index.z, - traversable, - (void*)traversable->child, - (int)traversable->motionOptions.numKeys, (int)traversable->motionOptions.flags, traversable->motionOptions.timeBegin, traversable->motionOptions.timeEnd, - traversable->transform[0][0], traversable->transform[0][1], traversable->transform[0][2], traversable->transform[0][3], - traversable->transform[0][4], traversable->transform[0][5], traversable->transform[0][6], traversable->transform[0][7], - traversable->transform[0][8], traversable->transform[0][9], traversable->transform[0][10], traversable->transform[0][11] ); - } - } - - static __forceinline__ __device__ void optixDumpSrtMatrixTransformFromHandle( OptixTraversableHandle handle ) - { - const OptixSRTMotionTransform* traversable = optixGetSRTMotionTransformFromHandle( handle ); - if( traversable ) - { - const uint3 index = optixGetLaunchIndex(); - printf( "(%4i,%4i,%4i) OptixSRTMotionTransform@%p = {\n" - " child = %p,\n" - " motionOptions = { numKeys = %i, flags = %i, timeBegin = %f, timeEnd = %f },\n" - " srtData = { { sx = %f, a = %f, b = %f, pvx = %f,\n" - " sy = %f, c = %f, pvy = %f, sz = %f,\n" - " pvz = %f, qx = %f, qy = %f, qz = %f,\n" - " qw = %f, tx = %f, ty = %f, tz = %f }, ... }\n", - index.x,index.y,index.z, - traversable, - (void*)traversable->child, - (int)traversable->motionOptions.numKeys, (int)traversable->motionOptions.flags, traversable->motionOptions.timeBegin, traversable->motionOptions.timeEnd, - traversable->srtData[0].sx, traversable->srtData[0].a, traversable->srtData[0].b, traversable->srtData[0].pvx, - traversable->srtData[0].sy, traversable->srtData[0].c, traversable->srtData[0].pvy,traversable->srtData[0].sz, - traversable->srtData[0].pvz,traversable->srtData[0].qx,traversable->srtData[0].qy, traversable->srtData[0].qz, - traversable->srtData[0].qw, traversable->srtData[0].tx,traversable->srtData[0].ty, traversable->srtData[0].tz ); - } - } - - static __forceinline__ __device__ void optixDumpInstanceFromHandle( OptixTraversableHandle handle ) - { - if( optixGetTransformTypeFromHandle( handle ) == OPTIX_TRANSFORM_TYPE_INSTANCE ) - { - unsigned int instanceId = optixGetInstanceIdFromHandle( handle ); - const float4* transform = optixGetInstanceTransformFromHandle( handle ); - - const uint3 index = optixGetLaunchIndex(); - printf( "(%4i,%4i,%4i) OptixInstance = {\n" - " instanceId = %i,\n" - " transform = { %f,%f,%f,%f,\n" - " %f,%f,%f,%f,\n" - " %f,%f,%f,%f } }\n", - index.x,index.y,index.z, - instanceId, - transform[0].x, transform[0].y, transform[0].z, transform[0].w, - transform[1].x, transform[1].y, transform[1].z, transform[1].w, - transform[2].x, transform[2].y, transform[2].z, transform[2].w ); - } - } - - static __forceinline__ __device__ void optixDumpTransform( OptixTraversableHandle handle ) - { - const OptixTransformType type = optixGetTransformTypeFromHandle( handle ); - const uint3 index = optixGetLaunchIndex(); - - switch( type ) - { - case OPTIX_TRANSFORM_TYPE_NONE: - break; - case OPTIX_TRANSFORM_TYPE_STATIC_TRANSFORM: - optixDumpStaticTransformFromHandle( handle ); - break; - case OPTIX_TRANSFORM_TYPE_MATRIX_MOTION_TRANSFORM: - optixDumpMotionMatrixTransformFromHandle( handle ); - break; - case OPTIX_TRANSFORM_TYPE_SRT_MOTION_TRANSFORM: - optixDumpSrtMatrixTransformFromHandle( handle ); - break; - case OPTIX_TRANSFORM_TYPE_INSTANCE: - optixDumpInstanceFromHandle( handle ); - break; - default: - break; - } - } - - static __forceinline__ __device__ void optixDumpTransformList() - { - const int tlistSize = optixGetTransformListSize(); - const uint3 index = optixGetLaunchIndex(); - - printf("(%4i,%4i,%4i) transform list of size %i:\n", index.x,index.y,index.z, tlistSize); - - for( unsigned int i = 0 ; i < tlistSize ; ++i ) - { - OptixTraversableHandle handle = optixGetTransformListHandle( i ); - printf("(%4i,%4i,%4i) transform[%i] = %p\n", index.x, index.y, index.z, i, (void*)handle); - optixDumpTransform(handle); - } - } - - static __forceinline__ __device__ void optixDumpExceptionDetails() - { - bool dumpTlist = false; - const int exceptionCode = optixGetExceptionCode(); - const uint3 index = optixGetLaunchIndex(); - - if( exceptionCode == OPTIX_EXCEPTION_CODE_STACK_OVERFLOW ) - { - printf("(%4i,%4i,%4i) error: stack overflow\n", index.x,index.y,index.z); - } - else if( exceptionCode == OPTIX_EXCEPTION_CODE_TRACE_DEPTH_EXCEEDED ) - { - printf("(%4i,%4i,%4i) error: trace depth exceeded\n", index.x,index.y,index.z); - } - else if( exceptionCode == OPTIX_EXCEPTION_CODE_TRAVERSAL_DEPTH_EXCEEDED ) - { - printf("(%4i,%4i,%4i) error: traversal depth exceeded\n", index.x,index.y,index.z); - dumpTlist = true; - } - else if( exceptionCode == OPTIX_EXCEPTION_CODE_TRAVERSAL_INVALID_TRAVERSABLE ) - { - OptixTraversableHandle handle = optixGetExceptionInvalidTraversable(); - printf("(%4i,%4i,%4i) error: invalid traversable %p\n", index.x,index.y,index.z, (void*)handle); - dumpTlist = true; - } - else if( exceptionCode == OPTIX_EXCEPTION_CODE_TRAVERSAL_INVALID_MISS_SBT ) - { - int sbtOffset = optixGetExceptionInvalidSbtOffset(); - printf("(%4i,%4i,%4i) error: invalid miss sbt of %i\n", index.x,index.y,index.z, sbtOffset); - } - else if( exceptionCode == OPTIX_EXCEPTION_CODE_TRAVERSAL_INVALID_HIT_SBT ) - { - int sbtOffset = optixGetExceptionInvalidSbtOffset(); - printf("(%4i,%4i,%4i) error: invalid hit sbt of %i at primitive with gas sbt index %i\n", index.x,index.y,index.z, sbtOffset, optixGetSbtGASIndex() ); - dumpTlist = true; - } - else if( exceptionCode == OPTIX_EXCEPTION_CODE_UNSUPPORTED_PRIMITIVE_TYPE ) - { - dumpTlist = true; - printf( "(%4i,%4i,%4i) error: shader encountered unsupported builtin type\n" - " call location: %s\n", index.x, index.y, index.z, optixGetExceptionLineInfo() ); - } - else if( exceptionCode == OPTIX_EXCEPTION_CODE_INVALID_RAY ) - { - OptixInvalidRayExceptionDetails ray = optixGetExceptionInvalidRay(); - printf( "(%4i,%4i,%4i) error: encountered ray with nan or inf values:\n", index.x, index.y, index.z ); - printf( - " origin: [%f, %f, %f]\n" - " direction: [%f, %f, %f]\n" - " tmin: %f\n" - " tmax: %f\n" - " rayTime: %f\n" - " call location: %s\n", - ray.origin.x, ray.origin.y, ray.origin.z, ray.direction.x, ray.direction.y, - ray.direction.z, ray.tmin, ray.tmax, ray.time, optixGetExceptionLineInfo() ); - } - else if( exceptionCode == OPTIX_EXCEPTION_CODE_CALLABLE_PARAMETER_MISMATCH ) - { - OptixParameterMismatchExceptionDetails details = optixGetExceptionParameterMismatch(); - printf( "(%4i,%4i,%4i) error: parameter mismatch in callable call.\n", index.x, index.y, index.z ); - printf( - " passed packed arguments: %u 32 Bit values\n" - " expected packed parameters: %u 32 Bit values\n" - " SBT index: %u\n" - " called function: %s\n" - " call location: %s\n", - details.passedArgumentCount, details.expectedParameterCount, details.sbtIndex, - details.callableName, optixGetExceptionLineInfo() ); - } - else if( exceptionCode == OPTIX_EXCEPTION_CODE_BUILTIN_IS_MISMATCH ) - { - dumpTlist = true; - printf("(%4i,%4i,%4i) error: mismatch between builtin IS shader and build input\n" - " call location: %s\n", index.x,index.y,index.z, optixGetExceptionLineInfo() ); - } - else if( exceptionCode == OPTIX_EXCEPTION_CODE_UNSUPPORTED_SINGLE_LEVEL_GAS ) - { - OptixTraversableHandle handle = optixGetExceptionInvalidTraversable(); - printf("(%4i,%4i,%4i) error: unsupported single GAS traversable graph %p\n", index.x,index.y,index.z, (void*)handle); - dumpTlist = true; - } - else if( exceptionCode >= 0 ) - { - dumpTlist = true; - printf( "(%4i,%4i,%4i) error: user exception with error code %i\n" - " call location: %s\n", index.x, index.y, index.z, exceptionCode, optixGetExceptionLineInfo() ); - } - else - { - printf("(%4i,%4i,%4i) error: unknown exception with error code %i\n", index.x,index.y,index.z, exceptionCode); - } - - if( dumpTlist ) - optixDumpTransformList(); - } - -} // namespace optix_impl - -#endif diff --git a/crtx/optix_7.1/internal/optix_7_device_impl_transformations.h b/crtx/optix_7.1/internal/optix_7_device_impl_transformations.h deleted file mode 100644 index a58c47a..0000000 --- a/crtx/optix_7.1/internal/optix_7_device_impl_transformations.h +++ /dev/null @@ -1,424 +0,0 @@ -/* -* Copyright (c) 2020 NVIDIA Corporation. All rights reserved. -* -* NVIDIA Corporation and its licensors retain all intellectual property and proprietary -* rights in and to this software, related documentation and any modifications thereto. -* Any use, reproduction, disclosure or distribution of this software and related -* documentation without an express license agreement from NVIDIA Corporation is strictly -* prohibited. -* -* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS* -* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, -* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY -* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT -* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF -* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR -* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF -* SUCH DAMAGES -*/ - -/** -* @file optix_7_device_impl_transformations.h -* @author NVIDIA Corporation -* @brief OptiX public API -* -* OptiX public API Reference - Device side implementation for transformation helper functions. -*/ - -#if !defined( __OPTIX_INCLUDE_INTERNAL_HEADERS__ ) -#error("optix_7_device_impl_transformations.h is an internal header file and must not be used directly. Please use optix_device.h or optix.h instead.") -#endif - -#ifndef __optix_optix_7_device_impl_transformations_h__ -#define __optix_optix_7_device_impl_transformations_h__ - -namespace optix_impl { - -static __forceinline__ __device__ float4 optixAddFloat4( const float4& a, const float4& b ) -{ - return make_float4( a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w ); -} - -static __forceinline__ __device__ float4 optixMulFloat4( const float4& a, float b ) -{ - return make_float4( a.x * b, a.y * b, a.z * b, a.w * b ); -} - -static __forceinline__ __device__ uint4 optixLdg( unsigned long long addr ) -{ - const uint4* ptr; - asm volatile( "cvta.to.global.u64 %0, %1;" : "=l"( ptr ) : "l"( addr ) ); - uint4 ret; - asm volatile( "ld.global.v4.u32 {%0,%1,%2,%3}, [%4];" - : "=r"( ret.x ), "=r"( ret.y ), "=r"( ret.z ), "=r"( ret.w ) - : "l"( ptr ) ); - return ret; -} - -template -static __forceinline__ __device__ T optixLoadReadOnlyAlign16( const T* ptr ) -{ - T v; - for( int ofs = 0; ofs < sizeof( T ); ofs += 16 ) - *(uint4*)( (char*)&v + ofs ) = optixLdg( (unsigned long long)( (char*)ptr + ofs ) ); - return v; -} - -// Multiplies the row vector vec with the 3x4 matrix with rows m0, m1, and m2 -static __forceinline__ __device__ float4 optixMultiplyRowMatrix( const float4 vec, const float4 m0, const float4 m1, const float4 m2 ) -{ - float4 result; - - result.x = vec.x * m0.x + vec.y * m1.x + vec.z * m2.x; - result.y = vec.x * m0.y + vec.y * m1.y + vec.z * m2.y; - result.z = vec.x * m0.z + vec.y * m1.z + vec.z * m2.z; - result.w = vec.x * m0.w + vec.y * m1.w + vec.z * m2.w + vec.w; - - return result; -} - -// Converts the SRT transformation srt into a 3x4 matrix with rows m0, m1, and m2 -static __forceinline__ __device__ void optixGetMatrixFromSrt( float4& m0, float4& m1, float4& m2, const OptixSRTData& srt ) -{ - const float4 q = {srt.qx, srt.qy, srt.qz, srt.qw}; - - // normalize - const float inv_sql = 1.f / ( srt.qx * srt.qx + srt.qy * srt.qy + srt.qz * srt.qz + srt.qw * srt.qw ); - const float4 nq = optixMulFloat4( q, inv_sql ); - - const float sqw = q.w * nq.w; - const float sqx = q.x * nq.x; - const float sqy = q.y * nq.y; - const float sqz = q.z * nq.z; - - const float xy = q.x * nq.y; - const float zw = q.z * nq.w; - const float xz = q.x * nq.z; - const float yw = q.y * nq.w; - const float yz = q.y * nq.z; - const float xw = q.x * nq.w; - - m0.x = ( sqx - sqy - sqz + sqw ); - m0.y = 2.0f * ( xy - zw ); - m0.z = 2.0f * ( xz + yw ); - - m1.x = 2.0f * ( xy + zw ); - m1.y = ( -sqx + sqy - sqz + sqw ); - m1.z = 2.0f * ( yz - xw ); - - m2.x = 2.0f * ( xz - yw ); - m2.y = 2.0f * ( yz + xw ); - m2.z = ( -sqx - sqy + sqz + sqw ); - - m0.w = m0.x * srt.pvx + m0.y * srt.pvy + m0.z * srt.pvz + srt.tx; - m1.w = m1.x * srt.pvx + m1.y * srt.pvy + m1.z * srt.pvz + srt.ty; - m2.w = m2.x * srt.pvx + m2.y * srt.pvy + m2.z * srt.pvz + srt.tz; - - m0.z = m0.x * srt.b + m0.y * srt.c + m0.z * srt.sz; - m1.z = m1.x * srt.b + m1.y * srt.c + m1.z * srt.sz; - m2.z = m2.x * srt.b + m2.y * srt.c + m2.z * srt.sz; - - m0.y = m0.x * srt.a + m0.y * srt.sy; - m1.y = m1.x * srt.a + m1.y * srt.sy; - m2.y = m2.x * srt.a + m2.y * srt.sy; - - m0.x = m0.x * srt.sx; - m1.x = m1.x * srt.sx; - m2.x = m2.x * srt.sx; -} - -// Inverts a 3x4 matrix in place -static __forceinline__ __device__ void optixInvertMatrix( float4& m0, float4& m1, float4& m2 ) -{ - const float det3 = - m0.x * ( m1.y * m2.z - m1.z * m2.y ) - m0.y * ( m1.x * m2.z - m1.z * m2.x ) + m0.z * ( m1.x * m2.y - m1.y * m2.x ); - - const float inv_det3 = 1.0f / det3; - - float inv3[3][3]; - inv3[0][0] = inv_det3 * ( m1.y * m2.z - m2.y * m1.z ); - inv3[0][1] = inv_det3 * ( m0.z * m2.y - m2.z * m0.y ); - inv3[0][2] = inv_det3 * ( m0.y * m1.z - m1.y * m0.z ); - - inv3[1][0] = inv_det3 * ( m1.z * m2.x - m2.z * m1.x ); - inv3[1][1] = inv_det3 * ( m0.x * m2.z - m2.x * m0.z ); - inv3[1][2] = inv_det3 * ( m0.z * m1.x - m1.z * m0.x ); - - inv3[2][0] = inv_det3 * ( m1.x * m2.y - m2.x * m1.y ); - inv3[2][1] = inv_det3 * ( m0.y * m2.x - m2.y * m0.x ); - inv3[2][2] = inv_det3 * ( m0.x * m1.y - m1.x * m0.y ); - - const float b[3] = {m0.w, m1.w, m2.w}; - - m0.x = inv3[0][0]; - m0.y = inv3[0][1]; - m0.z = inv3[0][2]; - m0.w = -inv3[0][0] * b[0] - inv3[0][1] * b[1] - inv3[0][2] * b[2]; - - m1.x = inv3[1][0]; - m1.y = inv3[1][1]; - m1.z = inv3[1][2]; - m1.w = -inv3[1][0] * b[0] - inv3[1][1] * b[1] - inv3[1][2] * b[2]; - - m2.x = inv3[2][0]; - m2.y = inv3[2][1]; - m2.z = inv3[2][2]; - m2.w = -inv3[2][0] * b[0] - inv3[2][1] * b[1] - inv3[2][2] * b[2]; -} - -static __forceinline__ __device__ void optixLoadInterpolatedMatrixKey( float4& m0, float4& m1, float4& m2, const float4* matrix, const float t1 ) -{ - m0 = optixLoadReadOnlyAlign16( &matrix[0] ); - m1 = optixLoadReadOnlyAlign16( &matrix[1] ); - m2 = optixLoadReadOnlyAlign16( &matrix[2] ); - - // The conditional prevents concurrent loads leading to spills - if( t1 > 0.0f ) - { - const float t0 = 1.0f - t1; - m0 = optixAddFloat4( optixMulFloat4( m0, t0 ), optixMulFloat4( optixLoadReadOnlyAlign16( &matrix[3] ), t1 ) ); - m1 = optixAddFloat4( optixMulFloat4( m1, t0 ), optixMulFloat4( optixLoadReadOnlyAlign16( &matrix[4] ), t1 ) ); - m2 = optixAddFloat4( optixMulFloat4( m2, t0 ), optixMulFloat4( optixLoadReadOnlyAlign16( &matrix[5] ), t1 ) ); - } -} - -static __forceinline__ __device__ void optixLoadInterpolatedSrtKey( float4& srt0, - float4& srt1, - float4& srt2, - float4& srt3, - const float4* srt, - const float t1 ) -{ - srt0 = optixLoadReadOnlyAlign16( &srt[0] ); - srt1 = optixLoadReadOnlyAlign16( &srt[1] ); - srt2 = optixLoadReadOnlyAlign16( &srt[2] ); - srt3 = optixLoadReadOnlyAlign16( &srt[3] ); - - // The conditional prevents concurrent loads leading to spills - if( t1 > 0.0f ) - { - const float t0 = 1.0f - t1; - srt0 = optixAddFloat4( optixMulFloat4( srt0, t0 ), optixMulFloat4( optixLoadReadOnlyAlign16( &srt[4] ), t1 ) ); - srt1 = optixAddFloat4( optixMulFloat4( srt1, t0 ), optixMulFloat4( optixLoadReadOnlyAlign16( &srt[5] ), t1 ) ); - srt2 = optixAddFloat4( optixMulFloat4( srt2, t0 ), optixMulFloat4( optixLoadReadOnlyAlign16( &srt[6] ), t1 ) ); - srt3 = optixAddFloat4( optixMulFloat4( srt3, t0 ), optixMulFloat4( optixLoadReadOnlyAlign16( &srt[7] ), t1 ) ); - - float inv_length = 1.f / sqrt( srt2.y * srt2.y + srt2.z * srt2.z + srt2.w * srt2.w + srt3.x * srt3.x ); - srt2.y *= inv_length; - srt2.z *= inv_length; - srt2.w *= inv_length; - srt3.x *= inv_length; - } -} - -static __forceinline__ __device__ void optixResolveMotionKey( float& localt, int& key, const OptixMotionOptions& options, const float globalt ) -{ - const float timeBegin = options.timeBegin; - const float timeEnd = options.timeEnd; - const float numIntervals = (float)( options.numKeys - 1 ); - - // No need to check the motion flags. If data originates from a valid transform list handle, then globalt is in - // range, or vanish flags are not set. - - const float time = max( 0.f, min( numIntervals, ( globalt - timeBegin ) * numIntervals / ( timeEnd - timeBegin ) ) ); - const float fltKey = floorf( time ); - - localt = time - fltKey; - key = (int)fltKey; -} - -// Returns the interpolated transformation matrix for a particular matrix motion transformation and point in time. -static __forceinline__ __device__ void optixGetInterpolatedTransformation( float4& trf0, - float4& trf1, - float4& trf2, - const OptixMatrixMotionTransform* transformData, - const float time ) -{ - // Compute key and intra key time - float keyTime; - int key; - optixResolveMotionKey( keyTime, key, optixLoadReadOnlyAlign16( transformData ).motionOptions, time ); - - // Get pointer to left key - const float4* transform = (const float4*)( &transformData->transform[key][0] ); - - // Load and interpolate matrix keys - optixLoadInterpolatedMatrixKey( trf0, trf1, trf2, transform, keyTime ); -} - -// Returns the interpolated transformation matrix for a particular SRT motion transformation and point in time. -static __forceinline__ __device__ void optixGetInterpolatedTransformation( float4& trf0, - float4& trf1, - float4& trf2, - const OptixSRTMotionTransform* transformData, - const float time ) -{ - // Compute key and intra key time - float keyTime; - int key; - optixResolveMotionKey( keyTime, key, optixLoadReadOnlyAlign16( transformData ).motionOptions, time ); - - // Get pointer to left key - const float4* dataPtr = reinterpret_cast( &transformData->srtData[key] ); - - // Load and interpolated SRT keys - float4 data[4]; - optixLoadInterpolatedSrtKey( data[0], data[1], data[2], data[3], dataPtr, keyTime ); - - OptixSRTData srt = {data[0].x, data[0].y, data[0].z, data[0].w, data[1].x, data[1].y, data[1].z, data[1].w, - data[2].x, data[2].y, data[2].z, data[2].w, data[3].x, data[3].y, data[3].z, data[3].w}; - - // Convert SRT into a matrix - optixGetMatrixFromSrt( trf0, trf1, trf2, srt ); -} - -// Returns the interpolated transformation matrix for a particular traversable handle and point in time. -static __forceinline__ __device__ void optixGetInterpolatedTransformationFromHandle( float4& trf0, - float4& trf1, - float4& trf2, - const OptixTraversableHandle handle, - const float time, - const bool objectToWorld ) -{ - const OptixTransformType type = optixGetTransformTypeFromHandle( handle ); - - if( type == OPTIX_TRANSFORM_TYPE_MATRIX_MOTION_TRANSFORM || type == OPTIX_TRANSFORM_TYPE_SRT_MOTION_TRANSFORM ) - { - if( type == OPTIX_TRANSFORM_TYPE_MATRIX_MOTION_TRANSFORM ) - { - const OptixMatrixMotionTransform* transformData = optixGetMatrixMotionTransformFromHandle( handle ); - optixGetInterpolatedTransformation( trf0, trf1, trf2, transformData, time ); - } - else - { - const OptixSRTMotionTransform* transformData = optixGetSRTMotionTransformFromHandle( handle ); - optixGetInterpolatedTransformation( trf0, trf1, trf2, transformData, time ); - } - - if( !objectToWorld ) - optixInvertMatrix( trf0, trf1, trf2 ); - } - else if( type == OPTIX_TRANSFORM_TYPE_INSTANCE || type == OPTIX_TRANSFORM_TYPE_STATIC_TRANSFORM ) - { - const float4* transform; - - if( type == OPTIX_TRANSFORM_TYPE_INSTANCE ) - { - transform = ( objectToWorld ) ? optixGetInstanceTransformFromHandle( handle ) : - optixGetInstanceInverseTransformFromHandle( handle ); - } - else - { - const OptixStaticTransform* traversable = optixGetStaticTransformFromHandle( handle ); - transform = (const float4*)( ( objectToWorld ) ? traversable->transform : traversable->invTransform ); - } - - trf0 = optixLoadReadOnlyAlign16( &transform[0] ); - trf1 = optixLoadReadOnlyAlign16( &transform[1] ); - trf2 = optixLoadReadOnlyAlign16( &transform[2] ); - } - else - { - trf0 = {1.0f, 0.0f, 0.0f, 0.0f}; - trf1 = {0.0f, 1.0f, 0.0f, 0.0f}; - trf2 = {0.0f, 0.0f, 1.0f, 0.0f}; - } -} - -// Returns the world-to-object transformation matrix resulting from the current transform stack and current ray time. -static __forceinline__ __device__ void optixGetWorldToObjectTransformMatrix( float4& m0, float4& m1, float4& m2 ) -{ - const unsigned int size = optixGetTransformListSize(); - const float time = optixGetRayTime(); - -#pragma unroll 1 - for( unsigned int i = 0; i < size; ++i ) - { - OptixTraversableHandle handle = optixGetTransformListHandle( i ); - - float4 trf0, trf1, trf2; - optixGetInterpolatedTransformationFromHandle( trf0, trf1, trf2, handle, time, /*objectToWorld*/ false ); - - if( i == 0 ) - { - m0 = trf0; - m1 = trf1; - m2 = trf2; - } - else - { - // m := trf * m - float4 tmp0 = m0, tmp1 = m1, tmp2 = m2; - m0 = optixMultiplyRowMatrix( trf0, tmp0, tmp1, tmp2 ); - m1 = optixMultiplyRowMatrix( trf1, tmp0, tmp1, tmp2 ); - m2 = optixMultiplyRowMatrix( trf2, tmp0, tmp1, tmp2 ); - } - } -} - -// Returns the object-to-world transformation matrix resulting from the current transform stack and current ray time. -static __forceinline__ __device__ void optixGetObjectToWorldTransformMatrix( float4& m0, float4& m1, float4& m2 ) -{ - const int size = optixGetTransformListSize(); - const float time = optixGetRayTime(); - -#pragma unroll 1 - for( int i = size - 1; i >= 0; --i ) - { - OptixTraversableHandle handle = optixGetTransformListHandle( i ); - - float4 trf0, trf1, trf2; - optixGetInterpolatedTransformationFromHandle( trf0, trf1, trf2, handle, time, /*objectToWorld*/ true ); - - if( i == size - 1 ) - { - m0 = trf0; - m1 = trf1; - m2 = trf2; - } - else - { - // m := trf * m - float4 tmp0 = m0, tmp1 = m1, tmp2 = m2; - m0 = optixMultiplyRowMatrix( trf0, tmp0, tmp1, tmp2 ); - m1 = optixMultiplyRowMatrix( trf1, tmp0, tmp1, tmp2 ); - m2 = optixMultiplyRowMatrix( trf2, tmp0, tmp1, tmp2 ); - } - } -} - -// Multiplies the 3x4 matrix with rows m0, m1, m2 with the point p. -static __forceinline__ __device__ float3 optixTransformPoint( const float4& m0, const float4& m1, const float4& m2, const float3& p ) -{ - float3 result; - result.x = m0.x * p.x + m0.y * p.y + m0.z * p.z + m0.w; - result.y = m1.x * p.x + m1.y * p.y + m1.z * p.z + m1.w; - result.z = m2.x * p.x + m2.y * p.y + m2.z * p.z + m2.w; - return result; -} - -// Multiplies the 3x3 linear submatrix of the 3x4 matrix with rows m0, m1, m2 with the vector v. -static __forceinline__ __device__ float3 optixTransformVector( const float4& m0, const float4& m1, const float4& m2, const float3& v ) -{ - float3 result; - result.x = m0.x * v.x + m0.y * v.y + m0.z * v.z; - result.y = m1.x * v.x + m1.y * v.y + m1.z * v.z; - result.z = m2.x * v.x + m2.y * v.y + m2.z * v.z; - return result; -} - -// Multiplies the transpose of the 3x3 linear submatrix of the 3x4 matrix with rows m0, m1, m2 with the normal n. -// Note that the given matrix is supposed to be the inverse of the actual transformation matrix. -static __forceinline__ __device__ float3 optixTransformNormal( const float4& m0, const float4& m1, const float4& m2, const float3& n ) -{ - float3 result; - result.x = m0.x * n.x + m1.x * n.y + m2.x * n.z; - result.y = m0.y * n.x + m1.y * n.y + m2.y * n.z; - result.z = m0.z * n.x + m1.z * n.y + m2.z * n.z; - return result; -} - -} // namespace optix_impl - -#endif diff --git a/crtx/optix_7.1/optix.h b/crtx/optix_7.1/optix.h deleted file mode 100644 index 3beaf71..0000000 --- a/crtx/optix_7.1/optix.h +++ /dev/null @@ -1,47 +0,0 @@ - -/* - * Copyright (c) 2020 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual property and proprietary - * rights in and to this software, related documentation and any modifications thereto. - * Any use, reproduction, disclosure or distribution of this software and related - * documentation without an express license agreement from NVIDIA Corporation is strictly - * prohibited. - * - * TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS* - * AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, - * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY - * SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT - * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF - * BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR - * INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGES - */ - -/// @file -/// @author NVIDIA Corporation -/// @brief OptiX public API header -/// -/// Includes the host api if compiling host code, includes the cuda api if compiling device code. -/// For the math library routines include optix_math.h - -#ifndef __optix_optix_h__ -#define __optix_optix_h__ - -/// The OptiX version. -/// -/// - major = OPTIX_VERSION/10000 -/// - minor = (OPTIX_VERSION%10000)/100 -/// - micro = OPTIX_VERSION%100 -#define OPTIX_VERSION 70100 - - -#ifdef __CUDACC__ -#include "optix_device.h" -#else -#include "optix_host.h" -#endif - - -#endif // __optix_optix_h__ diff --git a/crtx/optix_7.1/optix_7_device.h b/crtx/optix_7.1/optix_7_device.h deleted file mode 100644 index f86f156..0000000 --- a/crtx/optix_7.1/optix_7_device.h +++ /dev/null @@ -1,895 +0,0 @@ -/* -* Copyright (c) 2020 NVIDIA Corporation. All rights reserved. -* -* NVIDIA Corporation and its licensors retain all intellectual property and proprietary -* rights in and to this software, related documentation and any modifications thereto. -* Any use, reproduction, disclosure or distribution of this software and related -* documentation without an express license agreement from NVIDIA Corporation is strictly -* prohibited. -* -* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS* -* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, -* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY -* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT -* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF -* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR -* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF -* SUCH DAMAGES -*/ - -/// @file -/// @author NVIDIA Corporation -/// @brief OptiX public API header -/// -/// OptiX public API Reference - Device API declarations - -#if !defined( __OPTIX_INCLUDE_INTERNAL_HEADERS__ ) -#error("optix_7_device.h is an internal header file and must not be used directly. Please use optix_device.h or optix.h instead.") -#endif - - -#ifndef __optix_optix_7_device_h__ -#define __optix_optix_7_device_h__ - -#if defined( __cplusplus ) && ( __cplusplus < 201103L ) && !defined( _WIN32 ) -#error Device code for OptiX requires at least C++11. Consider adding "--std c++11" to the nvcc command-line. -#endif - -#include "optix_7_types.h" - -/// \defgroup optix_device_api Device API -/// \brief OptiX Device API - -/** \addtogroup optix_device_api -@{ -*/ - -/// Initiates a ray tracing query starting with the given traversable (overload without payload). -/// -/// \param[in] handle -/// \param[in] rayOrigin -/// \param[in] rayDirection -/// \param[in] tmin -/// \param[in] tmax -/// \param[in] rayTime -/// \param[in] visibilityMask really only 8 bits -/// \param[in] rayFlags really only 8 bits, combination of OptixRayFlags -/// \param[in] SBToffset really only 8 bits -/// \param[in] SBTstride really only 8 bits -/// \param[in] missSBTIndex specifies the miss program invoked on a miss -static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex ); - -/// Initiates a ray tracing query starting with the given traversable (overload with 1 payload register). -/// -/// \see #optixTrace(OptixTraversableHandle,float3,float3,float,float,float,OptixVisibilityMask,unsigned int,unsigned int,unsigned int,unsigned int) -static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex, - unsigned int& p0 ); - -/// Initiates a ray tracing query starting with the given traversable (overload with 2 payload registers). -/// -/// \see #optixTrace(OptixTraversableHandle,float3,float3,float,float,float,OptixVisibilityMask,unsigned int,unsigned int,unsigned int,unsigned int) -static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex, - unsigned int& p0, - unsigned int& p1 ); - -/// Initiates a ray tracing query starting with the given traversable (overload with 3 payload registers). -/// -/// \see #optixTrace(OptixTraversableHandle,float3,float3,float,float,float,OptixVisibilityMask,unsigned int,unsigned int,unsigned int,unsigned int) -static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex, - unsigned int& p0, - unsigned int& p1, - unsigned int& p2 ); - -/// Initiates a ray tracing query starting with the given traversable (overload with 4 payload registers). -/// -/// \see #optixTrace(OptixTraversableHandle,float3,float3,float,float,float,OptixVisibilityMask,unsigned int,unsigned int,unsigned int,unsigned int) -static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex, - unsigned int& p0, - unsigned int& p1, - unsigned int& p2, - unsigned int& p3 ); - -/// Initiates a ray tracing query starting with the given traversable (overload with 5 payload registers). -/// -/// \see #optixTrace(OptixTraversableHandle,float3,float3,float,float,float,OptixVisibilityMask,unsigned int,unsigned int,unsigned int,unsigned int) -static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex, - unsigned int& p0, - unsigned int& p1, - unsigned int& p2, - unsigned int& p3, - unsigned int& p4 ); - -/// Initiates a ray tracing query starting with the given traversable (overload with 6 payload registers). -/// -/// \see #optixTrace(OptixTraversableHandle,float3,float3,float,float,float,OptixVisibilityMask,unsigned int,unsigned int,unsigned int,unsigned int) -static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex, - unsigned int& p0, - unsigned int& p1, - unsigned int& p2, - unsigned int& p3, - unsigned int& p4, - unsigned int& p5 ); - -/// Initiates a ray tracing query starting with the given traversable (overload with 7 payload registers). -/// -/// \see #optixTrace(OptixTraversableHandle,float3,float3,float,float,float,OptixVisibilityMask,unsigned int,unsigned int,unsigned int,unsigned int) -static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex, - unsigned int& p0, - unsigned int& p1, - unsigned int& p2, - unsigned int& p3, - unsigned int& p4, - unsigned int& p5, - unsigned int& p6 ); - -/// Initiates a ray tracing query starting with the given traversable (overload with 8 payload registers). -/// -/// \see #optixTrace(OptixTraversableHandle,float3,float3,float,float,float,OptixVisibilityMask,unsigned int,unsigned int,unsigned int,unsigned int) -static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex, - unsigned int& p0, - unsigned int& p1, - unsigned int& p2, - unsigned int& p3, - unsigned int& p4, - unsigned int& p5, - unsigned int& p6, - unsigned int& p7 ); - -/// Writes the 32-bit payload value at slot 0. -static __forceinline__ __device__ void optixSetPayload_0( unsigned int p ); -/// Writes the 32-bit payload value at slot 1. -static __forceinline__ __device__ void optixSetPayload_1( unsigned int p ); -/// Writes the 32-bit payload value at slot 2. -static __forceinline__ __device__ void optixSetPayload_2( unsigned int p ); -/// Writes the 32-bit payload value at slot 3. -static __forceinline__ __device__ void optixSetPayload_3( unsigned int p ); -/// Writes the 32-bit payload value at slot 4. -static __forceinline__ __device__ void optixSetPayload_4( unsigned int p ); -/// Writes the 32-bit payload value at slot 5. -static __forceinline__ __device__ void optixSetPayload_5( unsigned int p ); -/// Writes the 32-bit payload value at slot 6. -static __forceinline__ __device__ void optixSetPayload_6( unsigned int p ); -/// Writes the 32-bit payload value at slot 7. -static __forceinline__ __device__ void optixSetPayload_7( unsigned int p ); - -/// Reads the 32-bit payload value at slot 0. -static __forceinline__ __device__ unsigned int optixGetPayload_0(); -/// Reads the 32-bit payload value at slot 1. -static __forceinline__ __device__ unsigned int optixGetPayload_1(); -/// Reads the 32-bit payload value at slot 2. -static __forceinline__ __device__ unsigned int optixGetPayload_2(); -/// Reads the 32-bit payload value at slot 3. -static __forceinline__ __device__ unsigned int optixGetPayload_3(); -/// Reads the 32-bit payload value at slot 4. -static __forceinline__ __device__ unsigned int optixGetPayload_4(); -/// Reads the 32-bit payload value at slot 5. -static __forceinline__ __device__ unsigned int optixGetPayload_5(); -/// Reads the 32-bit payload value at slot 6. -static __forceinline__ __device__ unsigned int optixGetPayload_6(); -/// Reads the 32-bit payload value at slot 7. -static __forceinline__ __device__ unsigned int optixGetPayload_7(); - -/// Returns an undefined value. -static __forceinline__ __device__ unsigned int optixUndefinedValue(); - -/// Returns the rayOrigin passed into optixTrace. -/// -/// May be more expensive to call in IS and AH than their object space counterparts, -/// so effort should be made to use the object space ray in those programs. -/// Only available in IS, AH, CH, MS -static __forceinline__ __device__ float3 optixGetWorldRayOrigin(); - -/// Returns the rayDirection passed into optixTrace. -/// -/// May be more expensive to call in IS and AH than their object space counterparts, -/// so effort should be made to use the object space ray in those programs. -/// Only available in IS, AH, CH, MS -static __forceinline__ __device__ float3 optixGetWorldRayDirection(); - -/// Returns the current object space ray origin based on the current transform stack. -/// -/// Only available in IS and AH. -static __forceinline__ __device__ float3 optixGetObjectRayOrigin(); - -/// Returns the current object space ray direction based on the current transform stack. -/// -/// Only available in IS and AH. -static __forceinline__ __device__ float3 optixGetObjectRayDirection(); - -/// Returns the tmin passed into optixTrace. -/// -/// Only available in IS, AH, CH, MS -static __forceinline__ __device__ float optixGetRayTmin(); - -/// In IS and CH returns the current smallest reported hitT or the tmax passed into optixTrace if no hit has been reported -/// In AH returns the hitT value as passed in to optixReportIntersection -/// In MS returns the tmax passed into optixTrace -/// Only available in IS, AH, CH, MS -static __forceinline__ __device__ float optixGetRayTmax(); - -/// Returns the rayTime passed into optixTrace. -/// -/// Will return 0 if motion is disabled. -/// Only available in IS, AH, CH, MS -static __forceinline__ __device__ float optixGetRayTime(); - -/// Returns the rayFlags passed into optixTrace -/// -/// Only available in IS, AH, CH, MS -static __forceinline__ __device__ unsigned int optixGetRayFlags(); - -/// Returns the visibilityMask passed into optixTrace -/// -/// Only available in IS, AH, CH, MS -static __forceinline__ __device__ unsigned int optixGetRayVisibilityMask(); - -/// Return the object space triangle vertex positions of a given triangle in a Geometry -/// Acceleration Structure (GAS) at a given motion time. -/// -/// If motion is disabled via OptixPipelineCompileOptions::usesMotionBlur, or the GAS does not contain motion, the -/// time parameter is ignored. -static __forceinline__ __device__ void optixGetTriangleVertexData( OptixTraversableHandle gas, unsigned int primIdx, unsigned int sbtGASIndex, float time, float3 data[3]); - -/// Return the object space curve control vertex data of a linear curve in a Geometry -/// Acceleration Structure (GAS) at a given motion time. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// If motion is disabled via OptixPipelineCompileOptions::usesMotionBlur, or the GAS does not contain motion, the -/// time parameter is ignored. -static __forceinline__ __device__ void optixGetLinearCurveVertexData( OptixTraversableHandle gas, unsigned int primIdx, unsigned int sbtGASIndex, float time, float4 data[2] ); - -/// Return the object space curve control vertex data of a quadratic BSpline curve in a Geometry -/// Acceleration Structure (GAS) at a given motion time. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// If motion is disabled via OptixPipelineCompileOptions::usesMotionBlur, or the GAS does not contain motion, the -/// time parameter is ignored. -static __forceinline__ __device__ void optixGetQuadraticBSplineVertexData( OptixTraversableHandle gas, unsigned int primIdx, unsigned int sbtGASIndex, float time, float4 data[3] ); - -/// Return the object space curve control vertex data of a cubic BSpline curve in a Geometry -/// Acceleration Structure (GAS) at a given motion time. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// If motion is disabled via OptixPipelineCompileOptions::usesMotionBlur, or the GAS does not contain motion, the -/// time parameter is ignored. -static __forceinline__ __device__ void optixGetCubicBSplineVertexData( OptixTraversableHandle gas, unsigned int primIdx, unsigned int sbtGASIndex, float time, float4 data[4] ); - -/// Returns the traversable handle for the Geometry Acceleration Structure (GAS) containing -/// the current hit. May be called from IS, AH and CH. -static __forceinline__ __device__ OptixTraversableHandle optixGetGASTraversableHandle(); - -/// Returns the motion begin time of a GAS (see OptixMotionOptions) -static __forceinline__ __device__ float optixGetGASMotionTimeBegin( OptixTraversableHandle gas ); - -/// Returns the motion end time of a GAS (see OptixMotionOptions) -static __forceinline__ __device__ float optixGetGASMotionTimeEnd( OptixTraversableHandle gas ); - -/// Returns the number of motion steps of a GAS (see OptixMotionOptions) -static __forceinline__ __device__ unsigned int optixGetGASMotionStepCount( OptixTraversableHandle gas ); - -/// Returns the world-to-object transformation matrix resulting from the current active transformation list. -/// -/// The cost of this function may be proportional to the size of the transformation list. -static __forceinline__ __device__ void optixGetWorldToObjectTransformMatrix( float m[12] ); - -/// Returns the object-to-world transformation matrix resulting from the current active transformation list. -/// -/// The cost of this function may be proportional to the size of the transformation list. -static __forceinline__ __device__ void optixGetObjectToWorldTransformMatrix( float m[12] ); - -/// Transforms the point using world-to-object transformation matrix resulting from the current active transformation -/// list. -/// -/// The cost of this function may be proportional to the size of the transformation list. -static __forceinline__ __device__ float3 optixTransformPointFromWorldToObjectSpace( float3 point ); - -/// Transforms the vector using world-to-object transformation matrix resulting from the current active transformation -/// list. -/// -/// The cost of this function may be proportional to the size of the transformation list. -static __forceinline__ __device__ float3 optixTransformVectorFromWorldToObjectSpace( float3 vec ); - -/// Transforms the normal using world-to-object transformation matrix resulting from the current active transformation -/// list. -/// -/// The cost of this function may be proportional to the size of the transformation list. -static __forceinline__ __device__ float3 optixTransformNormalFromWorldToObjectSpace( float3 normal ); - -/// Transforms the point using object-to-world transformation matrix resulting from the current active transformation -/// list. -/// -/// The cost of this function may be proportional to the size of the transformation list. -static __forceinline__ __device__ float3 optixTransformPointFromObjectToWorldSpace( float3 point ); - -/// Transforms the vector using object-to-world transformation matrix resulting from the current active transformation -/// list. -/// -/// The cost of this function may be proportional to the size of the transformation list. -static __forceinline__ __device__ float3 optixTransformVectorFromObjectToWorldSpace( float3 vec ); - -/// Transforms the normal using object-to-world transformation matrix resulting from the current active transformation -/// list. -/// -/// The cost of this function may be proportional to the size of the transformation list. -static __forceinline__ __device__ float3 optixTransformNormalFromObjectToWorldSpace( float3 normal ); - -/// Returns the number of transforms on the current transform list. -/// -/// Only available in IS, AH, CH, EX -static __forceinline__ __device__ unsigned int optixGetTransformListSize(); - -/// Returns the traversable handle for a transform on the current transform list. -/// -/// Only available in IS, AH, CH, EX -static __forceinline__ __device__ OptixTraversableHandle optixGetTransformListHandle( unsigned int index ); - - -/// Returns the transform type of a traversable handle from a transform list. -static __forceinline__ __device__ OptixTransformType optixGetTransformTypeFromHandle( OptixTraversableHandle handle ); - -/// Returns a pointer to a OptixStaticTransform from its traversable handle. -/// -/// Returns 0 if the traversable is not of type OPTIX_TRANSFORM_TYPE_STATIC_TRANSFORM. -static __forceinline__ __device__ const OptixStaticTransform* optixGetStaticTransformFromHandle( OptixTraversableHandle handle ); - -/// Returns a pointer to a OptixSRTMotionTransform from its traversable handle. -/// -/// Returns 0 if the traversable is not of type OPTIX_TRANSFORM_TYPE_SRT_MOTION_TRANSFORM. -static __forceinline__ __device__ const OptixSRTMotionTransform* optixGetSRTMotionTransformFromHandle( OptixTraversableHandle handle ); - -/// Returns a pointer to a OptixMatrixMotionTransform from its traversable handle. -/// -/// Returns 0 if the traversable is not of type OPTIX_TRANSFORM_TYPE_MATRIX_MOTION_TRANSFORM. -static __forceinline__ __device__ const OptixMatrixMotionTransform* optixGetMatrixMotionTransformFromHandle( OptixTraversableHandle handle ); - -/// Returns instanceId from an OptixInstance traversable. -/// -/// Returns 0 if the traversable handle does not reference an OptixInstance. -static __forceinline__ __device__ unsigned int optixGetInstanceIdFromHandle( OptixTraversableHandle handle ); - -/// Returns object-to-world transform from an OptixInstance traversable. -/// -/// Returns 0 if the traversable handle does not reference an OptixInstance. -static __forceinline__ __device__ const float4* optixGetInstanceTransformFromHandle( OptixTraversableHandle handle ); - -/// Returns world-to-object transform from an OptixInstance traversable. -/// -/// Returns 0 if the traversable handle does not reference an OptixInstance. -static __forceinline__ __device__ const float4* optixGetInstanceInverseTransformFromHandle( OptixTraversableHandle handle ); - -/// Reports an intersections (overload without attributes). -/// -/// If optixGetRayTmin() <= hitT <= optixGetRayTmax(), the any hit program associated with this intersection program (via the SBT entry) is called. -/// The AH program can do one of three things: -/// 1. call optixIgnoreIntersection - no hit is recorded, optixReportIntersection returns false -/// 2. call optixTerminateRay - hit is recorded, optixReportIntersection does not return, no further traversal occurs, -/// and the associated closest hit program is called -/// 3. neither - hit is recorded, optixReportIntersection returns true -/// hitKind - Only the 7 least significant bits should be written [0..127]. Any values above 127 are reserved for built in intersection. The value can be queried with optixGetHitKind() in AH and CH. -/// -/// The attributes specified with a0..a7 are available in the AH and CH programs. -/// Note that the attributes available in the CH program correspond to the closest recorded intersection. -/// The number of attributes in registers and memory can be configured in the pipeline. -/// -/// \param[in] hitT -/// \param[in] hitKind -static __forceinline__ __device__ bool optixReportIntersection( float hitT, unsigned int hitKind ); - -/// Reports an intersection (overload with 1 attribute register). -/// -/// \see #optixReportIntersection(float,unsigned int) -static __forceinline__ __device__ bool optixReportIntersection( float hitT, unsigned int hitKind, unsigned int a0 ); - -/// Reports an intersection (overload with 2 attribute registers). -/// -/// \see #optixReportIntersection(float,unsigned int) -static __forceinline__ __device__ bool optixReportIntersection( float hitT, unsigned int hitKind, unsigned int a0, unsigned int a1 ); - -/// Reports an intersection (overload with 3 attribute registers). -/// -/// \see #optixReportIntersection(float,unsigned int) -static __forceinline__ __device__ bool optixReportIntersection( float hitT, unsigned int hitKind, unsigned int a0, unsigned int a1, unsigned int a2 ); - -/// Reports an intersection (overload with 4 attribute registers). -/// -/// \see #optixReportIntersection(float,unsigned int) -static __forceinline__ __device__ bool optixReportIntersection( float hitT, - unsigned int hitKind, - unsigned int a0, - unsigned int a1, - unsigned int a2, - unsigned int a3 ); - -/// Reports an intersection (overload with 5 attribute registers). -/// -/// \see #optixReportIntersection(float,unsigned int) -static __forceinline__ __device__ bool optixReportIntersection( float hitT, - unsigned int hitKind, - unsigned int a0, - unsigned int a1, - unsigned int a2, - unsigned int a3, - unsigned int a4 ); - -/// Reports an intersection (overload with 6 attribute registers). -/// -/// \see #optixReportIntersection(float,unsigned int) -static __forceinline__ __device__ bool optixReportIntersection( float hitT, - unsigned int hitKind, - unsigned int a0, - unsigned int a1, - unsigned int a2, - unsigned int a3, - unsigned int a4, - unsigned int a5 ); - -/// Reports an intersection (overload with 7 attribute registers). -/// -/// \see #optixReportIntersection(float,unsigned int) -static __forceinline__ __device__ bool optixReportIntersection( float hitT, - unsigned int hitKind, - unsigned int a0, - unsigned int a1, - unsigned int a2, - unsigned int a3, - unsigned int a4, - unsigned int a5, - unsigned int a6 ); - -/// Reports an intersection (overload with 8 attribute registers). -/// -/// \see #optixReportIntersection(float,unsigned int) -static __forceinline__ __device__ bool optixReportIntersection( float hitT, - unsigned int hitKind, - unsigned int a0, - unsigned int a1, - unsigned int a2, - unsigned int a3, - unsigned int a4, - unsigned int a5, - unsigned int a6, - unsigned int a7 ); - -/// Returns the attribute at slot 0. -static __forceinline__ __device__ unsigned int optixGetAttribute_0(); -/// Returns the attribute at slot 1. -static __forceinline__ __device__ unsigned int optixGetAttribute_1(); -/// Returns the attribute at slot 2. -static __forceinline__ __device__ unsigned int optixGetAttribute_2(); -/// Returns the attribute at slot 3. -static __forceinline__ __device__ unsigned int optixGetAttribute_3(); -/// Returns the attribute at slot 4. -static __forceinline__ __device__ unsigned int optixGetAttribute_4(); -/// Returns the attribute at slot 5. -static __forceinline__ __device__ unsigned int optixGetAttribute_5(); -/// Returns the attribute at slot 6. -static __forceinline__ __device__ unsigned int optixGetAttribute_6(); -/// Returns the attribute at slot 7. -static __forceinline__ __device__ unsigned int optixGetAttribute_7(); - -/// Record the hit, stops traversal, and proceeds to CH. -/// -/// Available only in AH. -static __forceinline__ __device__ void optixTerminateRay(); - -/// Discards the hit, and returns control to the calling optixReportIntersection or built-in intersection routine. -/// -/// Available only in AH. -static __forceinline__ __device__ void optixIgnoreIntersection(); - - -/// For a given OptixBuildInputTriangleArray the number of primitives is defined as -/// "(OptixBuildInputTriangleArray::indexBuffer == 0) ? OptixBuildInputTriangleArray::numVertices/3 : -/// OptixBuildInputTriangleArray::numIndexTriplets;". -/// For a given OptixBuildInputCustomPrimitiveArray the number of primitives is defined as -/// numAabbs. -/// -/// The primitive index returns the index into the array of primitives -/// plus the primitiveIndexOffset. -/// -/// In IS and AH this corresponds to the currently intersected primitive. -/// In CH this corresponds to the primitive index of the closest intersected primitive. -static __forceinline__ __device__ unsigned int optixGetPrimitiveIndex(); - -/// Returns the Sbt GAS index of the primitive associated with the current intersection. -/// -/// In IS and AH this corresponds to the currently intersected primitive. -/// In CH this corresponds to the Sbt GAS index of the closest intersected primitive. -/// In EX with exception code OPTIX_EXCEPTION_CODE_TRAVERSAL_INVALID_HIT_SBT corresponds to the sbt index within the hit GAS. Returns zero for all other exceptions. -static __forceinline__ __device__ unsigned int optixGetSbtGASIndex(); - - -/// Returns the OptixInstance::instanceId of the instance within the top level acceleration structure associated with the current intersection. -/// -/// When building an acceleration structure using OptixBuildInputInstanceArray each OptixInstance has a user supplied instanceId. -/// OptixInstance objects reference another acceleration structure. During traversal the acceleration structures are visited top down. -/// In the IS and AH programs the OptixInstance::instanceId corresponding to the most recently visited OptixInstance is returned when calling optixGetInstanceId(). -/// In CH optixGetInstanceId() returns the OptixInstance::instanceId when the hit was recorded with optixReportIntersection. -/// In the case where there is no OptixInstance visited, optixGetInstanceId returns ~0u -static __forceinline__ __device__ unsigned int optixGetInstanceId(); - -/// Returns the zero-based index of the instance within its instance acceleration structure associated with the current intersection. -/// -/// In the IS and AH programs the index corresponding to the most recently visited OptixInstance is returned when calling optixGetInstanceIndex(). -/// In CH optixGetInstanceIndex() returns the index when the hit was recorded with optixReportIntersection. -/// In the case where there is no OptixInstance visited, optixGetInstanceIndex returns 0 -static __forceinline__ __device__ unsigned int optixGetInstanceIndex(); - -/// Returns the 8 bit hit kind associated with the current hit. -/// -/// Use optixGetPrimitiveType() to interpret the hit kind. -/// For custom intersections (primitive type OPTIX_PRIMITIVE_TYPE_CUSTOM), -/// this is the 7-bit hitKind passed to optixReportIntersection(). -/// Hit kinds greater than 127 are reserved for built-in primitives. -/// -/// Available only in AH and CH. -static __forceinline__ __device__ unsigned int optixGetHitKind(); - -/// Function interpreting the result of #optixGetHitKind(). -static __forceinline__ __device__ OptixPrimitiveType optixGetPrimitiveType( unsigned int hitKind ); - -/// Function interpreting the result of #optixGetHitKind(). -static __forceinline__ __device__ bool optixIsFrontFaceHit( unsigned int hitKind ); - -/// Function interpreting the result of #optixGetHitKind(). -static __forceinline__ __device__ bool optixIsBackFaceHit( unsigned int hitKind ); - -/// Function interpreting the hit kind associated with the current optixReportIntersection. -static __forceinline__ __device__ OptixPrimitiveType optixGetPrimitiveType(); - -/// Function interpreting the hit kind associated with the current optixReportIntersection. -static __forceinline__ __device__ bool optixIsFrontFaceHit(); - -/// Function interpreting the hit kind associated with the current optixReportIntersection. -static __forceinline__ __device__ bool optixIsBackFaceHit(); - -/// Convenience function interpreting the result of #optixGetHitKind(). -static __forceinline__ __device__ bool optixIsTriangleHit(); - -/// Convenience function interpreting the result of #optixGetHitKind(). -static __forceinline__ __device__ bool optixIsTriangleFrontFaceHit(); - -/// Convenience function interpreting the result of #optixGetHitKind(). -static __forceinline__ __device__ bool optixIsTriangleBackFaceHit(); - -/// Convenience function that returns the first two attributes as floats. -/// -/// When using OptixBuildInputTriangleArray objects, during intersection the barycentric -/// coordinates are stored into the first two attribute registers. -static __forceinline__ __device__ float2 optixGetTriangleBarycentrics(); - -/// Convenience function that returns the curve parameter. -/// -/// When using OptixBuildInputCurveArray objects, during intersection the curve parameter -/// is stored into the first attribute register. -static __forceinline__ __device__ float optixGetCurveParameter(); - -/// Available in any program, it returns the current launch index within the launch dimensions specified by optixLaunch on the host. -/// -/// The raygen program is typically only launched once per launch index. -static __forceinline__ __device__ uint3 optixGetLaunchIndex(); - -/// Available in any program, it returns the dimensions of the current launch specified by optixLaunch on the host. -static __forceinline__ __device__ uint3 optixGetLaunchDimensions(); - -/// Returns the generic memory space pointer to the data region (past the header) of the currently active SBT record corresponding to the current program. -static __forceinline__ __device__ CUdeviceptr optixGetSbtDataPointer(); - -/// Throws a user exception with the given exception code (overload without exception details). -/// -/// The exception code must be in the range from 0 to 2^30 - 1. Up to 8 optional exception details can be passed. They -/// can be queried in the EX program using optixGetExceptionDetail_0() to ..._8(). -/// -/// The exception details must not be used to encode pointers to the stack since the current stack is not preserved in -/// the EX program. -/// -/// Not available in EX. -/// -/// \param[in] exceptionCode The exception code to be thrown. -static __forceinline__ __device__ void optixThrowException( int exceptionCode ); - -/// Throws a user exception with the given exception code (overload with 1 exception detail). -/// -/// \see #optixThrowException(int) -static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0 ); - -/// Throws a user exception with the given exception code (overload with 2 exception details). -/// -/// \see #optixThrowException(int) -static __forceinline__ __device__ void optixThrowException( int exceptionCode, - unsigned int exceptionDetail0, - unsigned int exceptionDetail1 ); - -/// Throws a user exception with the given exception code (overload with 3 exception details). -/// -/// \see #optixThrowException(int) -static __forceinline__ __device__ void optixThrowException( int exceptionCode, - unsigned int exceptionDetail0, - unsigned int exceptionDetail1, - unsigned int exceptionDetail2 ); - -/// Throws a user exception with the given exception code (overload with 4 exception details). -/// -/// \see #optixThrowException(int) -static __forceinline__ __device__ void optixThrowException( int exceptionCode, - unsigned int exceptionDetail0, - unsigned int exceptionDetail1, - unsigned int exceptionDetail2, - unsigned int exceptionDetail3 ); - -/// Throws a user exception with the given exception code (overload with 5 exception details). -/// -/// \see #optixThrowException(int) -static __forceinline__ __device__ void optixThrowException( int exceptionCode, - unsigned int exceptionDetail0, - unsigned int exceptionDetail1, - unsigned int exceptionDetail2, - unsigned int exceptionDetail3, - unsigned int exceptionDetail4 ); - -/// Throws a user exception with the given exception code (overload with 6 exception details). -/// -/// \see #optixThrowException(int) -static __forceinline__ __device__ void optixThrowException( int exceptionCode, - unsigned int exceptionDetail0, - unsigned int exceptionDetail1, - unsigned int exceptionDetail2, - unsigned int exceptionDetail3, - unsigned int exceptionDetail4, - unsigned int exceptionDetail5 ); - -/// Throws a user exception with the given exception code (overload with 7 exception details). -/// -/// \see #optixThrowException(int) -static __forceinline__ __device__ void optixThrowException( int exceptionCode, - unsigned int exceptionDetail0, - unsigned int exceptionDetail1, - unsigned int exceptionDetail2, - unsigned int exceptionDetail3, - unsigned int exceptionDetail4, - unsigned int exceptionDetail5, - unsigned int exceptionDetail6 ); - -/// Throws a user exception with the given exception code (overload with 8 exception details). -/// -/// \see #optixThrowException(int) -static __forceinline__ __device__ void optixThrowException( int exceptionCode, - unsigned int exceptionDetail0, - unsigned int exceptionDetail1, - unsigned int exceptionDetail2, - unsigned int exceptionDetail3, - unsigned int exceptionDetail4, - unsigned int exceptionDetail5, - unsigned int exceptionDetail6, - unsigned int exceptionDetail7 ); - -/// Returns the exception code. -/// -/// Only available in EX. -static __forceinline__ __device__ int optixGetExceptionCode(); - -/// Returns the 32-bit exception detail at slot 0. -/// -/// The behavior is undefined if the exception is not a user exception, or the used overload #optixThrowException() did -/// not provide the queried exception detail. -/// -/// Only available in EX. -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_0(); - -/// Returns the 32-bit exception detail at slot 1. -/// -/// \see #optixGetExceptionDetail_0() -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_1(); - -/// Returns the 32-bit exception detail at slot 2. -/// -/// \see #optixGetExceptionDetail_0() -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_2(); - -/// Returns the 32-bit exception detail at slot 3. -/// -/// \see #optixGetExceptionDetail_0() -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_3(); - -/// Returns the 32-bit exception detail at slot 4. -/// -/// \see #optixGetExceptionDetail_0() -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_4(); - -/// Returns the 32-bit exception detail at slot 5. -/// -/// \see #optixGetExceptionDetail_0() -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_5(); - -/// Returns the 32-bit exception detail at slot 6. -/// -/// \see #optixGetExceptionDetail_0() -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_6(); - -/// Returns the 32-bit exception detail at slot 7. -/// -/// \see #optixGetExceptionDetail_0() -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_7(); - -/// Returns the invalid traversable handle for exceptions with exception code OPTIX_EXCEPTION_CODE_TRAVERSAL_INVALID_TRAVERSABLE. -/// -/// Returns zero for all other exception codes. -/// -/// Only available in EX. -static __forceinline__ __device__ OptixTraversableHandle optixGetExceptionInvalidTraversable(); - -/// Returns the invalid sbt offset for exceptions with exception code OPTIX_EXCEPTION_CODE_TRAVERSAL_INVALID_MISS_SBT and OPTIX_EXCEPTION_CODE_TRAVERSAL_INVALID_HIT_SBT. -/// -/// Returns zero for all other exception codes. -/// -/// Only available in EX. -static __forceinline__ __device__ int optixGetExceptionInvalidSbtOffset(); - -/// Returns the invalid ray for exceptions with exception code OPTIX_EXCEPTION_CODE_INVALID_RAY. -/// Exceptions of type OPTIX_EXCEPTION_CODE_INVALID_RAY are thrown when one or more values that were -/// passed into optixTrace are either inf or nan. -/// -/// OptixInvalidRayExceptionDetails::rayTime will always be 0 if OptixPipelineCompileOptions::usesMotionBlur is 0. -/// Values in the returned struct are all zero for all other exception codes. -/// -/// Only available in EX. -static __forceinline__ __device__ OptixInvalidRayExceptionDetails optixGetExceptionInvalidRay(); - -/// Returns information about an exception with code OPTIX_EXCEPTION_CODE_CALLABLE_PARAMETER_MISMATCH. -/// -/// Exceptions of type OPTIX_EXCEPTION_CODE_CALLABLE_PARAMETER_MISMATCH are called when the number of -/// arguments that were passed into a call to optixDirectCall or optixContinuationCall does not match -/// the number of parameters of the callable that is called. -/// Note that the parameters are packed by OptiX into individual 32 bit values, so the number of -/// expected and passed values may not correspond to the number of arguments passed into optixDirectCall -/// or optixContinuationCall. -/// -/// Values in the returned struct are all zero for all other exception codes. -/// -/// Only available in EX. -static __forceinline__ __device__ OptixParameterMismatchExceptionDetails optixGetExceptionParameterMismatch(); - -/// Returns a string that includes information about the source location that caused the current exception. -/// -/// The source location is only available for exceptions of type OPTIX_EXCEPTION_CODE_CALLABLE_PARAMETER_MISMATCH, -/// OPTIX_EXCEPTION_CODE_UNSUPPORTED_PRIMITIVE_TYPE, OPTIX_EXCEPTION_CODE_INVALID_RAY, and for user exceptions. -/// Line information needs to be present in the input PTX and OptixModuleCompileOptions::debugLevel -/// may not be set to OPTIX_COMPILE_DEBUG_LEVEL_NONE. -/// -/// Returns a NULL pointer if no line information is available. -/// -/// Only available in EX. -static __forceinline__ __device__ char* optixGetExceptionLineInfo(); - -/// Creates a call to the direct callable program at the specified SBT entry. -/// -/// This will call the program that was specified in the OptixProgramGroupCallables::entryFunctionNameDC in the -/// module specified by OptixProgramGroupCallables::moduleDC. -/// The address of the SBT entry is calculated by OptixShaderBindingTable::callablesRecordBase + ( OptixShaderBindingTable::callablesRecordStrideInBytes * sbtIndex ). -/// -/// Behavior is undefined if there is no direct callable program at the specified SBT entry. -/// -/// Behavior is undefined if the number of arguments that are being passed in does not match the number of -/// parameters expected by the program that is called. In that case an exception of type OPTIX_EXCEPTION_CODE_CALLABLE_PARAMETER_MISMATCH -/// will be thrown if OPTIX_EXCEPTION_FLAG_DEBUG was specified for the OptixPipelineCompileOptions::exceptionFlags. -/// -/// \param[in] sbtIndex The offset of the SBT entry of the direct callable program to call relative to OptixShaderBindingTable::callablesRecordBase. -/// \param[in] args The arguments to pass to the direct callable program. -template -static __forceinline__ __device__ ReturnT optixDirectCall( unsigned int sbtIndex, ArgTypes... args ); - - -/// Creates a call to the continuation callable program at the specified SBT entry. -/// -/// This will call the program that was specified in the OptixProgramGroupCallables::entryFunctionNameCC in the -/// module specified by OptixProgramGroupCallables::moduleCC. -/// The address of the SBT entry is calculated by OptixShaderBindingTable::callablesRecordBase + ( OptixShaderBindingTable::callablesRecordStrideInBytes * sbtIndex ). -/// As opposed to direct callable programs, continuation callable programs are allowed to call optixTrace recursively. -/// -/// Behavior is undefined if there is no continuation callable program at the specified SBT entry. -/// -/// Behavior is undefined if the number of arguments that are being passed in does not match the number of -/// parameters expected by the program that is called. In that case an exception of type OPTIX_EXCEPTION_CODE_CALLABLE_PARAMETER_MISMATCH -/// will be thrown if OPTIX_EXCEPTION_FLAG_DEBUG was specified for the OptixPipelineCompileOptions::exceptionFlags. -/// -/// \param[in] sbtIndex The offset of the SBT entry of the continuation callable program to call relative to OptixShaderBindingTable::callablesRecordBase. -/// \param[in] args The arguments to pass to the continuation callable program. -template -static __forceinline__ __device__ ReturnT optixContinuationCall( unsigned int sbtIndex, ArgTypes... args ); - -/*@}*/ // end group optix_device_api - -#include "internal/optix_7_device_impl.h" - -#endif // __optix_optix_7_device_h__ diff --git a/crtx/optix_7.1/optix_7_host.h b/crtx/optix_7.1/optix_7_host.h deleted file mode 100644 index bc944cf..0000000 --- a/crtx/optix_7.1/optix_7_host.h +++ /dev/null @@ -1,727 +0,0 @@ -/* - * Copyright (c) 2020 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual property and proprietary - * rights in and to this software, related documentation and any modifications thereto. - * Any use, reproduction, disclosure or distribution of this software and related - * documentation without an express license agreement from NVIDIA Corporation is strictly - * prohibited. - * - * TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS* - * AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, - * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY - * SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT - * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF - * BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR - * INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGES - */ - -/// @file -/// @author NVIDIA Corporation -/// @brief OptiX public API header -/// -/// OptiX host include file -- includes the host api if compiling host code. -/// For the math library routines include optix_math.h - -#if !defined( __OPTIX_INCLUDE_INTERNAL_HEADERS__ ) -#error("optix_7_host.h is an internal header file and must not be used directly. Please use optix_host.h or optix.h instead.") -#endif - -#ifndef __optix_optix_7_host_h__ -#define __optix_optix_7_host_h__ - -#include "optix_7_types.h" -#if !defined( OPTIX_DONT_INCLUDE_CUDA ) -// If OPTIX_DONT_INCLUDE_CUDA is defined, cuda driver types must be defined through other -// means before including optix headers. -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/// \defgroup optix_host_api Host API -/// \brief OptiX Host API - -/// \defgroup optix_host_api_error_handling Error handling -/// \ingroup optix_host_api -//@{ - -/// Returns a string containing the name of an error code in the enum. -/// -/// Output is a string representation of the enum. For example "OPTIX_SUCCESS" for -/// OPTIX_SUCCESS and "OPTIX_ERROR_INVALID_VALUE" for OPTIX_ERROR_INVALID_VALUE. -/// -/// If the error code is not recognized, "Unrecognized OptixResult code" is returned. -/// -/// \param[in] result OptixResult enum to generate string name for -/// -/// \see #optixGetErrorString -const char* optixGetErrorName( OptixResult result ); - -/// Returns the description string for an error code. -/// -/// Output is a string description of the enum. For example "Success" for -/// OPTIX_SUCCESS and "Invalid value" for OPTIX_ERROR_INVALID_VALUE. -/// -/// If the error code is not recognized, "Unrecognized OptixResult code" is returned. -/// -/// \param[in] result OptixResult enum to generate string description for -/// -/// \see #optixGetErrorName -const char* optixGetErrorString( OptixResult result ); - -//@} -/// \defgroup optix_host_api_device_context Device context -/// \ingroup optix_host_api -//@{ - -/// Create a device context associated with the CUDA context specified with 'fromContext'. -/// -/// If zero is specified for 'fromContext', OptiX will use the current CUDA context. The -/// CUDA context should be initialized before calling optixDeviceContextCreate. -/// -/// \param[in] fromContext -/// \param[in] options -/// \param[out] context -/// \return -/// - OPTIX_ERROR_CUDA_NOT_INITIALIZED -/// If using zero for 'fromContext' and CUDA has not been initialized yet on the calling -/// thread. -/// - OPTIX_ERROR_CUDA_ERROR -/// CUDA operation failed. -/// - OPTIX_ERROR_HOST_OUT_OF_MEMORY -/// Heap allocation failed. -/// - OPTIX_ERROR_INTERNAL_ERROR -/// Internal error -OptixResult optixDeviceContextCreate( CUcontext fromContext, const OptixDeviceContextOptions* options, OptixDeviceContext* context ); - -/// Destroys all CPU and GPU state associated with the device. -/// -/// It will attempt to block on CUDA streams that have launch work outstanding. -/// -/// Any API objects, such as OptixModule and OptixPipeline, not already destroyed will be -/// destroyed. -/// -/// Thread safety: A device context must not be destroyed while it is still in use by concurrent API calls in other threads. -OptixResult optixDeviceContextDestroy( OptixDeviceContext context ); - -/// Query properties of a device context. -/// -/// \param[in] context the device context to query the property for -/// \param[in] property the property to query -/// \param[out] value pointer to the returned -/// \param[in] sizeInBytes size of output -OptixResult optixDeviceContextGetProperty( OptixDeviceContext context, OptixDeviceProperty property, void* value, size_t sizeInBytes ); - -/// Sets the current log callback method. -/// -/// See #OptixLogCallback for more details. -/// -/// Thread safety: It is guaranteed that the callback itself (callbackFunction and callbackData) are updated atomically. -/// It is not guaranteed that the callback itself (callbackFunction and callbackData) and the callbackLevel are updated -/// atomically. It is unspecified when concurrent API calls using the same context start to make use of the new -/// callback method. -/// -/// \param[in] context the device context -/// \param[in] callbackFunction the callback function to call -/// \param[in] callbackData pointer to data passed to callback function while invoking it -/// \param[in] callbackLevel callback level -OptixResult optixDeviceContextSetLogCallback( OptixDeviceContext context, - OptixLogCallback callbackFunction, - void* callbackData, - unsigned int callbackLevel ); - -/// Enables or disables the disk cache. -/// -/// If caching was previously disabled, enabling it will attempt to initialize -/// the disk cache database using the currently configured cache location. An -/// error will be returned if initialization fails. -/// -/// Note that no in-memory cache is used, so no caching behavior will be observed if the disk cache -/// is disabled. -/// -/// \param[in] context the device context -/// \param[in] enabled 1 to enabled, 0 to disable -OptixResult optixDeviceContextSetCacheEnabled( OptixDeviceContext context, - int enabled ); - -/// Sets the location of the disk cache. -/// -/// The location is specified by a directory. This directory should not be used for other purposes -/// and will be created if it does not exist. An error will be returned if is not possible to -/// create the disk cache at the specified location for any reason (e.g., the path is invalid or -/// the directory is not writable). Caching will be disabled if the disk cache cannot be -/// initialized in the new location. If caching is disabled, no error will be returned until caching -/// is enabled. If the disk cache is located on a network file share, behavior is undefined. -/// -/// The location of the disk cache can be overridden with the environment variable OPTIX_CACHE_PATH. -/// The environment variable takes precedence over this setting. -/// -/// The default location depends on the operating system: -/// - Windows: %LOCALAPPDATA%\\NVIDIA\\OptixCache -/// - Linux: /var/tmp/OptixCache_\ (or /tmp/OptixCache_\ if the first choice is not usable), -/// the underscore and username suffix are omitted if the username cannot be obtained -/// - MacOS X: /Library/Application Support/NVIDIA/OptixCache -/// -/// \param[in] context the device context -/// \param[in] location directory of disk cache -OptixResult optixDeviceContextSetCacheLocation( OptixDeviceContext context, const char* location ); - -/// Sets the low and high water marks for disk cache garbage collection. -/// -/// Garbage collection is triggered when a new entry is written to the cache and -/// the current cache data size plus the size of the cache entry that is about -/// to be inserted exceeds the high water mark. Garbage collection proceeds until -/// the size reaches the low water mark. Garbage collection will always free enough -/// space to insert the new entry without exceeding the low water mark. Setting -/// either limit to zero will disable garbage collection. An error will be returned -/// if both limits are non-zero and the high water mark is smaller than the low water mark. -/// -/// Note that garbage collection is performed only on writes to the disk cache. No garbage -/// collection is triggered on disk cache initialization or immediately when calling this function, -/// but on subsequent inserting of data into the database. -/// -/// If the size of a compiled module exceeds the value configured for the high water -/// mark and garbage collection is enabled, the module will not be added to the cache -/// and a warning will be added to the log. -/// -/// \param[in] context the device context -/// \param[in] lowWaterMark the low water mark -/// \param[in] highWaterMark the high water mark -OptixResult optixDeviceContextSetCacheDatabaseSizes( OptixDeviceContext context, size_t lowWaterMark, size_t highWaterMark ); - -/// Indicates whether the disk cache is enabled or disabled. -/// -/// \param[in] context the device context -/// \param[out] enabled 1 if enabled, 0 if disabled -OptixResult optixDeviceContextGetCacheEnabled( OptixDeviceContext context, int* enabled ); -/// Returns the location of the disk cache. -/// -/// \param[in] context the device context -/// \param[out] location directory of disk cache, null terminated if locationSize > 0 -/// \param[in] locationSize locationSize -OptixResult optixDeviceContextGetCacheLocation( OptixDeviceContext context, char* location, size_t locationSize ); - -/// Returns the low and high water marks for disk cache garbage collection. -/// -/// \param[in] context the device context -/// \param[out] lowWaterMark the low water mark -/// \param[out] highWaterMark the high water mark -OptixResult optixDeviceContextGetCacheDatabaseSizes( OptixDeviceContext context, size_t* lowWaterMark, size_t* highWaterMark ); - -//@} -/// \defgroup optix_host_api_pipelines Pipelines -/// \ingroup optix_host_api -//@{ - -/// logString is an optional buffer that contains compiler feedback and errors. This -/// information is also passed to the context logger (if enabled), however it may be -/// difficult to correlate output to the logger to specific API invocations when using -/// multiple threads. The output to logString will only contain feedback for this specific -/// invocation of this API call. -/// -/// logStringSize as input should be a pointer to the number of bytes backing logString. -/// Upon return it contains the length of the log message (including the null terminator) -/// which may be greater than the input value. In this case, the log message will be -/// truncated to fit into logString. -/// -/// If logString or logStringSize are NULL, no output is written to logString. If -/// logStringSize points to a value that is zero, no output is written. This does not -/// affect output to the context logger if enabled. -/// -/// \param[in] context -/// \param[in] pipelineCompileOptions -/// \param[in] pipelineLinkOptions -/// \param[in] programGroups array of ProgramGroup objects -/// \param[in] numProgramGroups number of ProgramGroup objects -/// \param[out] logString Information will be written to this string. If logStringSize > 0 logString will be null terminated. -/// \param[in,out] logStringSize -/// \param[out] pipeline -OptixResult optixPipelineCreate( OptixDeviceContext context, - const OptixPipelineCompileOptions* pipelineCompileOptions, - const OptixPipelineLinkOptions* pipelineLinkOptions, - const OptixProgramGroup* programGroups, - unsigned int numProgramGroups, - char* logString, - size_t* logStringSize, - OptixPipeline* pipeline ); - -/// Thread safety: A pipeline must not be destroyed while it is still in use by concurrent API calls in other threads. -OptixResult optixPipelineDestroy( OptixPipeline pipeline ); - -/// Sets the stack sizes for a pipeline. -/// -/// Users are encouraged to see the programming guide and the implementations of the helper functions -/// to understand how to construct the stack sizes based on their particular needs. -/// -/// If this method is not used, an internal default implementation is used. The default implementation is correct (but -/// not necessarily optimal) as long as the maximum depth of call trees of CC and DC programs is at most 2 and no motion transforms are used. -/// -/// The maxTraversableGraphDepth responds to the maximal number of traversables visited when calling trace. -/// Every acceleration structure and motion transform count as one level of traversal. -/// E.g., for a simple IAS (instance acceleration structure) -> GAS (geometry acceleration structure) -/// traversal graph, the maxTraversableGraphDepth is two. -/// For IAS -> MT (motion transform) -> GAS, the maxTraversableGraphDepth is three. -/// Note that it does not matter whether a IAS or GAS has motion or not, it always counts as one. -/// Launching optix with exceptions turned on (see #OPTIX_EXCEPTION_FLAG_TRACE_DEPTH) will throw an exception -/// if the specified maxTraversableGraphDepth is too small. -/// -/// \param[in] pipeline The pipeline to configure the stack size for. -/// \param[in] directCallableStackSizeFromTraversal The direct stack size requirement for direct callables invoked from IS or AH. -/// \param[in] directCallableStackSizeFromState The direct stack size requirement for direct callables invoked from RG, MS, or CH. -/// \param[in] continuationStackSize The continuation stack requirement. -/// \param[in] maxTraversableGraphDepth The maximum depth of a traversable graph passed to trace. -OptixResult optixPipelineSetStackSize( OptixPipeline pipeline, - unsigned int directCallableStackSizeFromTraversal, - unsigned int directCallableStackSizeFromState, - unsigned int continuationStackSize, - unsigned int maxTraversableGraphDepth ); - -//@} -/// \defgroup optix_host_api_modules Modules -/// \ingroup optix_host_api -//@{ - -/// logString is an optional buffer that contains compiler feedback and errors. This -/// information is also passed to the context logger (if enabled), however it may be -/// difficult to correlate output to the logger to specific API invocations when using -/// multiple threads. The output to logString will only contain feedback for this specific -/// invocation of this API call. -/// -/// logStringSize as input should be a pointer to the number of bytes backing logString. -/// Upon return it contains the length of the log message (including the null terminator) -/// which may be greater than the input value. In this case, the log message will be -/// truncated to fit into logString. -/// -/// If logString or logStringSize are NULL, no output is written to logString. If -/// logStringSize points to a value that is zero, no output is written. This does not -/// affect output to the context logger if enabled. -/// -/// \param[in] context -/// \param[in] moduleCompileOptions -/// \param[in] pipelineCompileOptions All modules in a pipeline need to use the same values for the pipeline compile options. -/// \param[in] PTX Pointer to the PTX input string. -/// \param[in] PTXsize Parsing proceeds up to PTXsize characters, or the first NUL byte, whichever occurs first. -/// \param[out] logString Information will be written to this string. If logStringSize > 0 logString will be null terminated. -/// \param[in,out] logStringSize -/// \param[out] module -/// -/// \return OPTIX_ERROR_INVALID_VALUE - context is 0, moduleCompileOptions is 0, pipelineCompileOptions is 0, PTX is 0, module is 0. -OptixResult optixModuleCreateFromPTX( OptixDeviceContext context, - const OptixModuleCompileOptions* moduleCompileOptions, - const OptixPipelineCompileOptions* pipelineCompileOptions, - const char* PTX, - size_t PTXsize, - char* logString, - size_t* logStringSize, - OptixModule* module ); - -/// Call for OptixModule objects created with optixModuleCreateFromPTX and optixModuleDeserialize. -/// -/// Modules must not be destroyed while they are still used by any program group. -/// -/// Thread safety: A module must not be destroyed while it is still in use by concurrent API calls in other threads. -OptixResult optixModuleDestroy( OptixModule module ); - -/// Returns a module containing the intersection program for the built-in primitive type specified -/// by the builtinISOptions. This module must be used as the moduleIS for the OptixProgramGroupHitgroup -/// in any SBT record for that primitive type. (The entryFunctionNameIS should be null.) -OptixResult optixBuiltinISModuleGet( OptixDeviceContext context, - const OptixModuleCompileOptions* moduleCompileOptions, - const OptixPipelineCompileOptions* pipelineCompileOptions, - const OptixBuiltinISOptions* builtinISOptions, - OptixModule* builtinModule ); - -//@} -/// \defgroup optix_host_api_program_groups Program groups -/// \ingroup optix_host_api -//@{ - -/// Returns the stack sizes for the given program group. -/// -/// \param[in] programGroup the program group -/// \param[out] stackSizes the corresponding stack sizes -OptixResult optixProgramGroupGetStackSize( OptixProgramGroup programGroup, OptixStackSizes* stackSizes ); - -/// logString is an optional buffer that contains compiler feedback and errors. This -/// information is also passed to the context logger (if enabled), however it may be -/// difficult to correlate output to the logger to specific API invocations when using -/// multiple threads. The output to logString will only contain feedback for this specific -/// invocation of this API call. -/// -/// logStringSize as input should be a pointer to the number of bytes backing logString. -/// Upon return it contains the length of the log message (including the null terminator) -/// which may be greater than the input value. In this case, the log message will be -/// truncated to fit into logString. -/// -/// If logString or logStringSize are NULL, no output is written to logString. If -/// logStringSize points to a value that is zero, no output is written. This does not -/// affect output to the context logger if enabled. -/// -/// Creates numProgramGroups OptiXProgramGroup objects from the specified -/// OptixProgramGroupDesc array. The size of the arrays must match. -/// -/// \param[in] context -/// \param[in] programDescriptions N * OptixProgramGroupDesc -/// \param[in] numProgramGroups N -/// \param[in] options -/// \param[out] logString Information will be written to this string. If logStringSize > 0 logString will be null terminated. -/// \param[in,out] logStringSize -/// \param[out] programGroups -OptixResult optixProgramGroupCreate( OptixDeviceContext context, - const OptixProgramGroupDesc* programDescriptions, - unsigned int numProgramGroups, - const OptixProgramGroupOptions* options, - char* logString, - size_t* logStringSize, - OptixProgramGroup* programGroups ); - -/// Thread safety: A program group must not be destroyed while it is still in use by concurrent API calls in other threads. -OptixResult optixProgramGroupDestroy( OptixProgramGroup programGroup ); - -//@} -/// \defgroup optix_host_api_launches Launches -/// \ingroup optix_host_api -//@{ - -/// Where the magic happens. -/// -/// The stream and pipeline must belong to the same device context. Multiple launches -/// may be issues in parallel from multiple threads to different streams. -/// -/// pipelineParamsSize number of bytes are copied from the device memory pointed to by -/// pipelineParams before launch. It is an error if pipelineParamsSize is greater than the -/// size of the variable declared in modules and identified by -/// OptixPipelineCompileOptions::pipelineLaunchParamsVariableName. If the launch params -/// variable was optimized out or not found in the modules linked to the pipeline then -/// the pipelineParams and pipelineParamsSize parameters are ignored. -/// -/// sbt points to the shader binding table, which defines shader -/// groupings and their resources. See the SBT spec. -/// -/// \param[in] pipeline -/// \param[in] stream -/// \param[in] pipelineParams -/// \param[in] pipelineParamsSize -/// \param[in] sbt -/// \param[in] width number of elements to compute -/// \param[in] height number of elements to compute -/// \param[in] depth number of elements to compute -/// -/// Thread safety: In the current implementation concurrent launches to the same pipeline are not -/// supported. Concurrent launches require separate OptixPipeline objects. -OptixResult optixLaunch( OptixPipeline pipeline, - CUstream stream, - CUdeviceptr pipelineParams, - size_t pipelineParamsSize, - const OptixShaderBindingTable* sbt, - unsigned int width, - unsigned int height, - unsigned int depth ); - -/// \param[in] programGroup the program group containing the program(s) -/// \param[out] sbtRecordHeaderHostPointer the result sbt record header -OptixResult optixSbtRecordPackHeader( OptixProgramGroup programGroup, void* sbtRecordHeaderHostPointer ); - -//@} -/// \defgroup optix_host_api_acceleration_structures Acceleration structures -/// \ingroup optix_host_api -//@{ - -/// \param[in] context device context of the pipeline -/// \param[in] accelOptions accel options -/// \param[in] buildInputs an array of OptixBuildInput objects -/// \param[in] numBuildInputs number of elements in buildInputs (must be at least 1) -/// \param[out] bufferSizes fills in buffer sizes -OptixResult optixAccelComputeMemoryUsage( OptixDeviceContext context, - const OptixAccelBuildOptions* accelOptions, - const OptixBuildInput* buildInputs, - unsigned int numBuildInputs, - OptixAccelBufferSizes* bufferSizes ); - -/// \param[in] context -/// \param[in] stream -/// \param[in] accelOptions accel options -/// \param[in] buildInputs an array of OptixBuildInput objects -/// \param[in] numBuildInputs must be >= 1 for GAS, and == 1 for IAS -/// \param[in] tempBuffer must be a multiple of OPTIX_ACCEL_BUFFER_BYTE_ALIGNMENT -/// \param[in] tempBufferSizeInBytes -/// \param[in] outputBuffer must be a multiple of OPTIX_ACCEL_BUFFER_BYTE_ALIGNMENT -/// \param[in] outputBufferSizeInBytes -/// \param[out] outputHandle -/// \param[out] emittedProperties types of requested properties and output buffers -/// \param[in] numEmittedProperties number of post-build properties to populate (may be zero) -OptixResult optixAccelBuild( OptixDeviceContext context, - CUstream stream, - const OptixAccelBuildOptions* accelOptions, - const OptixBuildInput* buildInputs, - unsigned int numBuildInputs, - CUdeviceptr tempBuffer, - size_t tempBufferSizeInBytes, - CUdeviceptr outputBuffer, - size_t outputBufferSizeInBytes, - OptixTraversableHandle* outputHandle, - const OptixAccelEmitDesc* emittedProperties, - unsigned int numEmittedProperties ); - -/// Obtain relocation information, stored in OptixAccelRelocationInfo, for a given context -/// and acceleration structure's traversable handle. -/// -/// The relocation information can be passed to optixAccelCheckRelocationCompatibility to -/// determine if an acceleration structure, referenced by 'handle', can be relocated to a -/// different device's memory space (see #optixAccelCheckRelocationCompatibility). -/// -/// When used with optixAccelRelocate, it provides data necessary for doing the relocation. -/// -/// If the acceleration structure data associated with 'handle' is copied multiple times, -/// the same OptixAccelRelocationInfo can also be used on all copies. -/// -/// \param[in] context -/// \param[in] handle -/// \param[out] info -/// \return OPTIX_ERROR_INVALID_VALUE will be returned for traversable handles that are not from -/// acceleration structure builds. -OptixResult optixAccelGetRelocationInfo( OptixDeviceContext context, OptixTraversableHandle handle, OptixAccelRelocationInfo* info ); - -/// Checks if an acceleration structure built using another OptixDeviceContext (that was -/// used to fill in 'info') is compatible with the OptixDeviceContext specified in the -/// 'context' parameter. -/// -/// Any device is always compatible with itself. -/// -/// \param[in] context -/// \param[in] info -/// \param[out] compatible If OPTIX_SUCCESS is returned 'compatible' will have the value of either: -/// - 0: This context is not compatible with acceleration structure data associated with 'info'. -/// - 1: This context is compatible. -OptixResult optixAccelCheckRelocationCompatibility( OptixDeviceContext context, const OptixAccelRelocationInfo* info, int* compatible ); - -/// optixAccelRelocate is called to update the acceleration structure after it has been -/// relocated. Relocation is necessary when the acceleration structure's location in device -/// memory has changed. optixAccelRelocate does not copy the memory. This function only -/// operates on the relocated memory who's new location is specified by 'targetAccel'. -/// optixAccelRelocate also returns the new OptixTraversableHandle associated with -/// 'targetAccel'. The original memory (source) is not required to be valid, only the -/// OptixAccelRelocationInfo. -/// -/// Before copying the data and calling optixAccelRelocate, -/// optixAccelCheckRelocationCompatibility should be called to ensure the copy will be -/// compatible with the destination device context. -/// -/// The memory pointed to by 'targetAccel' should be allocated with the same size as the -/// source acceleration. Similar to the 'outputBuffer' used in optixAccelBuild, this -/// pointer must be a multiple of OPTIX_ACCEL_BUFFER_BYTE_ALIGNMENT. -/// -/// The memory in 'targetAccel' must be allocated as long as the accel is in use. -/// -/// When relocating an accel that contains instances, 'instanceTraversableHandles' and -/// 'numInstanceTraversableHandles' should be supplied. These are the traversable handles -/// of the instances. These can be used when also relocating the instances. No updates to -/// the bounds are performed. Use optixAccelBuild to update the bounds. -/// 'instanceTraversableHandles' and 'numInstanceTraversableHandles' may be zero when -/// relocating bottom level accel (i.e. an accel with no instances). -/// -/// \param[in] context -/// \param[in] stream -/// \param[in] info -/// \param[in] instanceTraversableHandles -/// \param[in] numInstanceTraversableHandles -/// \param[in] targetAccel -/// \param[in] targetAccelSizeInBytes -/// \param[out] targetHandle -OptixResult optixAccelRelocate( OptixDeviceContext context, - CUstream stream, - const OptixAccelRelocationInfo* info, - CUdeviceptr instanceTraversableHandles, - size_t numInstanceTraversableHandles, - CUdeviceptr targetAccel, - size_t targetAccelSizeInBytes, - OptixTraversableHandle* targetHandle ); - -/// After building an acceleration structure, it can be copied in a compacted form to reduce -/// memory. In order to be compacted, OPTIX_BUILD_FLAG_ALLOW_COMPACTION must be supplied in -/// OptixAccelBuildOptions::buildFlags passed to optixAccelBuild. -/// -/// 'outputBuffer' is the pointer to where the compacted acceleration structure will be -/// written. This pointer must be a multiple of OPTIX_ACCEL_BUFFER_BYTE_ALIGNMENT. -/// -/// The size of the memory specified in 'outputBufferSizeInBytes' should be at least the -/// value computed using the OPTIX_PROPERTY_TYPE_COMPACTED_SIZE that was reported during -/// optixAccelBuild. -/// -/// \param[in] context -/// \param[in] stream -/// \param[in] inputHandle -/// \param[in] outputBuffer -/// \param[in] outputBufferSizeInBytes -/// \param[out] outputHandle -OptixResult optixAccelCompact( OptixDeviceContext context, - CUstream stream, - OptixTraversableHandle inputHandle, - CUdeviceptr outputBuffer, - size_t outputBufferSizeInBytes, - OptixTraversableHandle* outputHandle ); - -/// \param[in] onDevice -/// \param[in] pointer pointer to traversable allocated in OptixDeviceContext. This pointer must be a multiple of OPTIX_TRANSFORM_BYTE_ALIGNMENT -/// \param[in] traversableType Type of OptixTraversableHandle to create -/// \param[out] traversableHandle traversable handle. traversableHandle must be in host memory -OptixResult optixConvertPointerToTraversableHandle( OptixDeviceContext onDevice, - CUdeviceptr pointer, - OptixTraversableType traversableType, - OptixTraversableHandle* traversableHandle ); - -//@} -/// \defgroup optix_host_api_denoiser Denoiser -/// \ingroup optix_host_api -//@{ - -/// Creates a denoiser object with the given options. -/// -/// \param[in] context -/// \param[in] options -/// \param[out] denoiser -OptixResult optixDenoiserCreate( OptixDeviceContext context, const OptixDenoiserOptions* options, OptixDenoiser* denoiser ); - -/// Sets the model of the denoiser. -/// -/// If the kind is OPTIX_DENOISER_MODEL_KIND_USER, then the data and sizeInByes must not be -/// null and zero respectively. For other kinds, these parameters must be zero. -/// -/// \param[in] denoiser -/// \param[in] kind -/// \param[in] data -/// \param[in] sizeInBytes -OptixResult optixDenoiserSetModel( OptixDenoiser denoiser, OptixDenoiserModelKind kind, void* data, size_t sizeInBytes ); - -/// Destroys the denoiser object and any associated host resources. -OptixResult optixDenoiserDestroy( OptixDenoiser denoiser ); - -/// Computes the GPU memory resources required to execute the denoiser. -/// -/// Memory for state and scratch buffers must be allocated with the sizes in 'returnSizes' and scratch memory -/// passed to optixDenoiserSetup, optixDenoiserInvoke and optixDenoiserComputeIntensity. -/// For tiled denoising an overlap area must be added to each tile on all sides which increases the amount of -/// memory needed to denoise a tile. In case of tiling use withOverlapScratchSizeInBytes. -/// If only full resolution images are denoised, withoutOverlapScratchSizeInBytes can be used which is always -/// smaller than withOverlapScratchSizeInBytes. -/// -/// 'outputWidth' and 'outputHeight' is the dimension of the image to be denoised (without overlap in case tiling -/// is being used). -/// 'outputWidth' and 'outputHeight' must be greater than or equal to the dimensions passed to optixDenoiserSetup. -/// -/// \param[in] denoiser -/// \param[in] outputWidth -/// \param[in] outputHeight -/// \param[out] returnSizes -OptixResult optixDenoiserComputeMemoryResources( const OptixDenoiser denoiser, - unsigned int outputWidth, - unsigned int outputHeight, - OptixDenoiserSizes* returnSizes ); - -/// Initializes the state required by the denoiser. -/// -/// 'inputWidth' and 'inputHeight' must include overlap on both sides of the image if tiling is being used. The overlap is -/// returned by #optixDenoiserComputeMemoryResources. -/// For subsequent calls to #optixDenoiserInvoke 'inputWidth' and 'inputHeight' are the maximum dimensions -/// of the input layers. Dimensions of the input layers passed to #optixDenoiserInvoke may be different in each -/// invocation however they always must be smaller than 'inputWidth' and 'inputHeight' passed to #optixDenoiserSetup. -/// -/// \param[in] denoiser -/// \param[in] stream -/// \param[in] inputWidth -/// \param[in] inputHeight -/// \param[in] denoiserState -/// \param[in] denoiserStateSizeInBytes -/// \param[in] scratch -/// \param[in] scratchSizeInBytes -OptixResult optixDenoiserSetup( OptixDenoiser denoiser, - CUstream stream, - unsigned int inputWidth, - unsigned int inputHeight, - CUdeviceptr denoiserState, - size_t denoiserStateSizeInBytes, - CUdeviceptr scratch, - size_t scratchSizeInBytes ); - -/// Invokes denoiser on a set of input data and produces one output -/// image. State memory must be available during the execution of the -/// denoiser (or until optixDenoiserSetup is called with a new state memory pointer). -/// Scratch memory passed is used only for the duration of this function. -/// Scratch and state memory sizes must have a size greater than or equal to the sizes as returned by -/// optixDenoiserComputeMemoryResources. -/// -/// 'inputOffsetX' and 'inputOffsetY' are pixel offsets in the 'inputLayers' image -/// specifying the beginning of the image without overlap. When denoising an entire image without tiling -/// there is no overlap and 'inputOffsetX' and 'inputOffsetY' must be zero. When denoising a tile which is -/// adjacent to one of the four sides of the entire image the corresponding offsets must also be zero since -/// there is no overlap at the side adjacent to the image border. -/// -/// \param[in] denoiser -/// \param[in] stream -/// \param[in] params -/// \param[in] denoiserState -/// \param[in] denoiserStateSizeInBytes -/// \param[in] inputLayers -/// \param[in] numInputLayers -/// \param[in] inputOffsetX -/// \param[in] inputOffsetY -/// \param[in] outputLayer -/// \param[in] scratch -/// \param[in] scratchSizeInBytes -OptixResult optixDenoiserInvoke( OptixDenoiser denoiser, - CUstream stream, - const OptixDenoiserParams* params, - CUdeviceptr denoiserState, - size_t denoiserStateSizeInBytes, - const OptixImage2D* inputLayers, - unsigned int numInputLayers, - unsigned int inputOffsetX, - unsigned int inputOffsetY, - const OptixImage2D* outputLayer, - CUdeviceptr scratch, - size_t scratchSizeInBytes ); - -/// Computes the logarithmic average intensity of the given image. The returned value 'outputIntensity' -/// is multiplied with the RGB values of the input image/tile in optixDenoiserInvoke if given in the parameter -/// OptixDenoiserParams::hdrIntensity (otherwise 'hdrIntensity' must be a null pointer). This is useful for -/// denoising HDR images which are very dark or bright. -/// When denoising tiles the intensity of the entire image should be computed, i.e. not per tile to get -/// consistent results. -/// -/// For each RGB pixel in the inputImage the intensity is calculated and summed if it is greater than 1e-8f: -/// intensity = log(r * 0.212586f + g * 0.715170f + b * 0.072200f). -/// The function returns 0.18 / exp(sum of intensities / number of summed pixels). -/// More details could be found in the Reinhard tonemapping paper: -/// http://www.cmap.polytechnique.fr/~peyre/cours/x2005signal/hdr_photographic.pdf -/// -/// This function needs scratch memory with a size of at least -/// sizeof( int ) * ( 2 + inputImage::width * inputImage::height ). When denoising entire images (no tiling) -/// the same scratch memory as passed to optixDenoiserInvoke could be used. -/// -/// \param[in] denoiser -/// \param[in] stream -/// \param[in] inputImage -/// \param[out] outputIntensity single float -/// \param[in] scratch -/// \param[in] scratchSizeInBytes -OptixResult optixDenoiserComputeIntensity( OptixDenoiser denoiser, - CUstream stream, - const OptixImage2D* inputImage, - CUdeviceptr outputIntensity, - CUdeviceptr scratch, - size_t scratchSizeInBytes ); - -//@} - -#ifdef __cplusplus -} -#endif - -#include "optix_function_table.h" - -#endif // __optix_optix_7_host_h__ diff --git a/crtx/optix_7.1/optix_7_types.h b/crtx/optix_7.1/optix_7_types.h deleted file mode 100644 index fb1aa5b..0000000 --- a/crtx/optix_7.1/optix_7_types.h +++ /dev/null @@ -1,1609 +0,0 @@ - -/* - * Copyright (c) 2020 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual property and proprietary - * rights in and to this software, related documentation and any modifications thereto. - * Any use, reproduction, disclosure or distribution of this software and related - * documentation without an express license agreement from NVIDIA Corporation is strictly - * prohibited. - * - * TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS* - * AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, - * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY - * SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT - * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF - * BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR - * INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGES - */ - -/// @file -/// @author NVIDIA Corporation -/// @brief OptiX public API header -/// -/// OptiX types include file -- defines types and enums used by the API. -/// For the math library routines include optix_math.h - -#if !defined( __OPTIX_INCLUDE_INTERNAL_HEADERS__ ) -#error("optix_7_types.h is an internal header file and must not be used directly. Please use optix_types.h, optix_host.h, optix_device.h or optix.h instead.") -#endif - -#ifndef __optix_optix_7_types_h__ -#define __optix_optix_7_types_h__ - -#if !defined(__CUDACC_RTC__) -#include /* for size_t */ -#endif - -/// \defgroup optix_types Types -/// \brief OptiX Types - -/** \addtogroup optix_types -@{ -*/ - -// This typedef should match the one in cuda.h in order to avoid compilation errors. -#if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64) || defined(__powerpc64__) || defined(__EDG_IA64_ABI)/*=NVRTC*/ || defined(__aarch64__) -/// CUDA device pointer -typedef unsigned long long CUdeviceptr; -#else -/// CUDA device pointer -typedef unsigned int CUdeviceptr; -#endif - -/// Opaque type representing a device context -typedef struct OptixDeviceContext_t* OptixDeviceContext; - -/// Opaque type representing a module -typedef struct OptixModule_t* OptixModule; - -/// Opaque type representing a program group -typedef struct OptixProgramGroup_t* OptixProgramGroup; - -/// Opaque type representing a pipeline -typedef struct OptixPipeline_t* OptixPipeline; - -/// Opaque type representing a denoiser instance -typedef struct OptixDenoiser_t* OptixDenoiser; - -/// Traversable handle -typedef unsigned long long OptixTraversableHandle; - -/// Visibility mask -typedef unsigned int OptixVisibilityMask; - -/// Size of the SBT record headers. -#define OPTIX_SBT_RECORD_HEADER_SIZE ( (size_t)32 ) - -/// Alignment requirement for device pointers in OptixShaderBindingTable. -#define OPTIX_SBT_RECORD_ALIGNMENT 16ull - -/// Alignment requirement for output and temporay buffers for acceleration structures. -#define OPTIX_ACCEL_BUFFER_BYTE_ALIGNMENT 128ull - -/// Alignment requirement for OptixBuildInputInstanceArray::instances. -#define OPTIX_INSTANCE_BYTE_ALIGNMENT 16ull - -/// Alignment requirement for OptixBuildInputCustomPrimitiveArray::aabbBuffers and OptixBuildInputInstanceArray::aabbs. -#define OPTIX_AABB_BUFFER_BYTE_ALIGNMENT 8ull - -/// Alignment requirement for OptixBuildInputTriangleArray::preTransform -#define OPTIX_GEOMETRY_TRANSFORM_BYTE_ALIGNMENT 16ull - -/// Alignment requirement for OptixStaticTransform, OptixMatrixMotionTransform, OptixSRTMotionTransform. -#define OPTIX_TRANSFORM_BYTE_ALIGNMENT 64ull - -/// Maximum number of registers allowed. Defaults to no explicit limit. -#define OPTIX_COMPILE_DEFAULT_MAX_REGISTER_COUNT 0 - - -/// Result codes returned from API functions -/// -/// All host side API functions return OptixResult with the exception of optixGetErrorName -/// and optixGetErrorString. When successful OPTIX_SUCCESS is returned. All return codes -/// except for OPTIX_SUCCESS should be assumed to be errors as opposed to a warning. -/// -/// \see #optixGetErrorName(), #optixGetErrorString() -typedef enum OptixResult -{ - OPTIX_SUCCESS = 0, - OPTIX_ERROR_INVALID_VALUE = 7001, - OPTIX_ERROR_HOST_OUT_OF_MEMORY = 7002, - OPTIX_ERROR_INVALID_OPERATION = 7003, - OPTIX_ERROR_FILE_IO_ERROR = 7004, - OPTIX_ERROR_INVALID_FILE_FORMAT = 7005, - OPTIX_ERROR_DISK_CACHE_INVALID_PATH = 7010, - OPTIX_ERROR_DISK_CACHE_PERMISSION_ERROR = 7011, - OPTIX_ERROR_DISK_CACHE_DATABASE_ERROR = 7012, - OPTIX_ERROR_DISK_CACHE_INVALID_DATA = 7013, - OPTIX_ERROR_LAUNCH_FAILURE = 7050, - OPTIX_ERROR_INVALID_DEVICE_CONTEXT = 7051, - OPTIX_ERROR_CUDA_NOT_INITIALIZED = 7052, - OPTIX_ERROR_INVALID_PTX = 7200, - OPTIX_ERROR_INVALID_LAUNCH_PARAMETER = 7201, - OPTIX_ERROR_INVALID_PAYLOAD_ACCESS = 7202, - OPTIX_ERROR_INVALID_ATTRIBUTE_ACCESS = 7203, - OPTIX_ERROR_INVALID_FUNCTION_USE = 7204, - OPTIX_ERROR_INVALID_FUNCTION_ARGUMENTS = 7205, - OPTIX_ERROR_PIPELINE_OUT_OF_CONSTANT_MEMORY = 7250, - OPTIX_ERROR_PIPELINE_LINK_ERROR = 7251, - OPTIX_ERROR_INTERNAL_COMPILER_ERROR = 7299, - OPTIX_ERROR_DENOISER_MODEL_NOT_SET = 7300, - OPTIX_ERROR_DENOISER_NOT_INITIALIZED = 7301, - OPTIX_ERROR_ACCEL_NOT_COMPATIBLE = 7400, - OPTIX_ERROR_NOT_SUPPORTED = 7800, - OPTIX_ERROR_UNSUPPORTED_ABI_VERSION = 7801, - OPTIX_ERROR_FUNCTION_TABLE_SIZE_MISMATCH = 7802, - OPTIX_ERROR_INVALID_ENTRY_FUNCTION_OPTIONS = 7803, - OPTIX_ERROR_LIBRARY_NOT_FOUND = 7804, - OPTIX_ERROR_ENTRY_SYMBOL_NOT_FOUND = 7805, - OPTIX_ERROR_CUDA_ERROR = 7900, - OPTIX_ERROR_INTERNAL_ERROR = 7990, - OPTIX_ERROR_UNKNOWN = 7999, -} OptixResult; - -/// Parameters used for #optixDeviceContextGetProperty() -/// -/// \see #optixDeviceContextGetProperty() -typedef enum OptixDeviceProperty -{ - /// Maximum value for OptixPipelineLinkOptions::maxTraceDepth. sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_LIMIT_MAX_TRACE_DEPTH = 0x2001, - - /// Maximum value to pass into optixPipelineSetStackSize for parameter - /// maxTraversableGraphDepth.v sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_LIMIT_MAX_TRAVERSABLE_GRAPH_DEPTH = 0x2002, - - /// The maximum number of primitives (over all build inputs) as input to a single - /// Geometry Acceleration Structure (GAS). sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_LIMIT_MAX_PRIMITIVES_PER_GAS = 0x2003, - - /// The maximum number of instances (over all build inputs) as input to a single - /// Instance Acceleration Structure (IAS). sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_LIMIT_MAX_INSTANCES_PER_IAS = 0x2004, - - /// The RT core version supported by the device (0 for no support, 10 for version - /// 1.0). sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_RTCORE_VERSION = 0x2005, - - /// The maximum value for #OptixInstance::instanceId. sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_LIMIT_MAX_INSTANCE_ID = 0x2006, - - /// The number of bits available for the #OptixInstance::visibilityMask. - /// Higher bits must be set to zero. sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_LIMIT_NUM_BITS_INSTANCE_VISIBILITY_MASK = 0x2007, - - /// The maximum number of instances that can be added to a single Instance - /// Acceleration Structure (IAS). sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_LIMIT_MAX_SBT_RECORDS_PER_GAS = 0x2008, - - /// The maximum value for #OptixInstance::sbtOffset. sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_LIMIT_MAX_SBT_OFFSET = 0x2009, -} OptixDeviceProperty; - -/// Type of the callback function used for log messages. -/// -/// \param[in] level The log level indicates the severity of the message. See below for -/// possible values. -/// \param[in] tag A terse message category description (e.g., 'SCENE STAT'). -/// \param[in] message Null terminated log message (without newline at the end). -/// \param[in] cbdata Callback data that was provided with the callback pointer. -/// -/// It is the users responsibility to ensure thread safety within this function. -/// -/// The following log levels are defined. -/// -/// 0 disable Setting the callback level will disable all messages. The callback -/// function will not be called in this case. -/// 1 fatal A non-recoverable error. The context and/or OptiX itself might no longer -/// be in a usable state. -/// 2 error A recoverable error, e.g., when passing invalid call parameters. -/// 3 warning Hints that OptiX might not behave exactly as requested by the user or -/// may perform slower than expected. -/// 4 print Status or progress messages. -/// -/// Higher levels might occur. -/// -/// \see #optixDeviceContextSetLogCallback(), #OptixDeviceContextOptions -typedef void ( *OptixLogCallback )( unsigned int level, const char* tag, const char* message, void* cbdata ); - -/// Parameters used for #optixDeviceContextCreate() -/// -/// \see #optixDeviceContextCreate() -typedef struct OptixDeviceContextOptions -{ - /// Function pointer used when OptiX wishes to generate messages - OptixLogCallback logCallbackFunction; - /// Pointer stored and passed to logCallbackFunction when a message is generated - void* logCallbackData; - /// Maximum callback level to generate message for (see #OptixLogCallback) - int logCallbackLevel; -} OptixDeviceContextOptions; - -/// Flags used by #OptixBuildInputTriangleArray::flags -/// and #OptixBuildInputCurveArray::flags -/// and #OptixBuildInputCustomPrimitiveArray::flags -typedef enum OptixGeometryFlags -{ - /// No flags set - OPTIX_GEOMETRY_FLAG_NONE = 0, - - /// Disables the invocation of the anyhit program. - /// Can be overridden by OPTIX_INSTANCE_FLAG_ENFORCE_ANYHIT and OPTIX_RAY_FLAG_ENFORCE_ANYHIT. - OPTIX_GEOMETRY_FLAG_DISABLE_ANYHIT = 1u << 0, - - /// If set, an intersection with the primitive will trigger one and only one - /// invocation of the anyhit program. Otherwise, the anyhit program may be invoked - /// more than once. - OPTIX_GEOMETRY_FLAG_REQUIRE_SINGLE_ANYHIT_CALL = 1u << 1 -} OptixGeometryFlags; - -/// Legacy type: A subset of the hit kinds for built-in primitive intersections. -/// It is preferred to use optixGetPrimitiveType(), together with -/// optixIsFrontFaceHit() or optixIsBackFaceHit(). -/// -/// \see #optixGetHitKind() -typedef enum OptixHitKind -{ - /// Ray hit the triangle on the front face - OPTIX_HIT_KIND_TRIANGLE_FRONT_FACE = 0xFE, - /// Ray hit the triangle on the back face - OPTIX_HIT_KIND_TRIANGLE_BACK_FACE = 0xFF -} OptixHitKind; - -/// Format of indices used int #OptixBuildInputTriangleArray::indexFormat. -typedef enum OptixIndicesFormat -{ - /// No indices, this format must only be used in combination with triangle soups, i.e., numIndexTriplets must be zero - OPTIX_INDICES_FORMAT_NONE = 0, - /// Three shorts - OPTIX_INDICES_FORMAT_UNSIGNED_SHORT3 = 0x2102, - /// Three ints - OPTIX_INDICES_FORMAT_UNSIGNED_INT3 = 0x2103 -} OptixIndicesFormat; - -/// Format of vertices used in #OptixBuildInputTriangleArray::vertexFormat. -typedef enum OptixVertexFormat -{ - OPTIX_VERTEX_FORMAT_NONE = 0, ///< No vertices - OPTIX_VERTEX_FORMAT_FLOAT3 = 0x2121, ///< Vertices are represented by three floats - OPTIX_VERTEX_FORMAT_FLOAT2 = 0x2122, ///< Vertices are represented by two floats - OPTIX_VERTEX_FORMAT_HALF3 = 0x2123, ///< Vertices are represented by three halfs - OPTIX_VERTEX_FORMAT_HALF2 = 0x2124, ///< Vertices are represented by two halfs - OPTIX_VERTEX_FORMAT_SNORM16_3 = 0x2125, - OPTIX_VERTEX_FORMAT_SNORM16_2 = 0x2126 -} OptixVertexFormat; - -/// Format of transform used in #OptixBuildInputTriangleArray::transformFormat. -typedef enum OptixTransformFormat -{ - OPTIX_TRANSFORM_FORMAT_NONE = 0, ///< no transform, default for zero initialization - OPTIX_TRANSFORM_FORMAT_MATRIX_FLOAT12 = 0x21E1, ///< 3x4 row major affine matrix -} OptixTransformFormat; - -/// Triangle inputs -/// -/// \see #OptixBuildInput::triangleArray -typedef struct OptixBuildInputTriangleArray -{ - /// Points to host array of device pointers, one per motion step. Host array size must match the number of - /// motion keys as set in #OptixMotionOptions (or an array of size 1 if OptixMotionOptions::numKeys is set - /// to 0 or 1). Each per motion key device pointer must point to an array of vertices of the - /// triangles in the format as described by vertexFormat. The minimum alignment must match the natural - /// alignment of the type as specified in the vertexFormat, i.e., for OPTIX_VERTEX_FORMAT_FLOATX 4-byte, - /// for all others a 2-byte alignment. However, an 16-byte stride (and buffer alignment) is recommended for - /// vertices of format OPTIX_VERTEX_FORMAT_FLOAT3 for GAS build performance. - const CUdeviceptr* vertexBuffers; - - /// Number of vertices in each of buffer in OptixBuildInputTriangleArray::vertexBuffers. - unsigned int numVertices; - - /// \see #OptixVertexFormat - OptixVertexFormat vertexFormat; - - /// Stride between vertices. If set to zero, vertices are assumed to be tightly - /// packed and stride is inferred from vertexFormat. - unsigned int vertexStrideInBytes; - - /// Optional pointer to array of 16 or 32-bit int triplets, one triplet per triangle. - /// The minimum alignment must match the natural alignment of the type as specified in the indexFormat, i.e., - /// for OPTIX_INDICES_FORMAT_UNSIGNED_INT3 4-byte and for OPTIX_INDICES_FORMAT_UNSIGNED_SHORT3 a 2-byte alignment. - CUdeviceptr indexBuffer; - - /// Size of array in OptixBuildInputTriangleArray::indexBuffer. For build, needs to be zero if indexBuffer is \c nullptr. - unsigned int numIndexTriplets; - - /// \see #OptixIndicesFormat - OptixIndicesFormat indexFormat; - - /// Stride between triplets of indices. If set to zero, indices are assumed to be tightly - /// packed and stride is inferred from indexFormat. - unsigned int indexStrideInBytes; - - /// Optional pointer to array of floats - /// representing a 3x4 row major affine - /// transformation matrix. This pointer must be a multiple of OPTIX_GEOMETRY_TRANSFORM_BYTE_ALIGNMENT - CUdeviceptr preTransform; - - /// Array of flags, to specify flags per sbt record, - /// combinations of OptixGeometryFlags describing the - /// primitive behavior, size must match numSbtRecords - const unsigned int* flags; - - /// Number of sbt records available to the sbt index offset override. - unsigned int numSbtRecords; - - /// Device pointer to per-primitive local sbt index offset buffer. May be NULL. - /// Every entry must be in range [0,numSbtRecords-1]. - /// Size needs to be the number of primitives. - CUdeviceptr sbtIndexOffsetBuffer; - - /// Size of type of the sbt index offset. Needs to be 0, 1, 2 or 4 (8, 16 or 32 bit). - unsigned int sbtIndexOffsetSizeInBytes; - - /// Stride between the index offsets. If set to zero, the offsets are assumed to be tightly - /// packed and the stride matches the size of the type (sbtIndexOffsetSizeInBytes). - unsigned int sbtIndexOffsetStrideInBytes; - - /// Primitive index bias, applied in optixGetPrimitiveIndex(). - /// Sum of primitiveIndexOffset and number of triangles must not overflow 32bits. - unsigned int primitiveIndexOffset; - - /// \see #OptixTransformFormat - OptixTransformFormat transformFormat; -} OptixBuildInputTriangleArray; - -/// Builtin primitive types -/// -typedef enum OptixPrimitiveType -{ - /// Custom primitive. - OPTIX_PRIMITIVE_TYPE_CUSTOM = 0x2500, - /// B-spline curve of degree 2 with circular cross-section. - OPTIX_PRIMITIVE_TYPE_ROUND_QUADRATIC_BSPLINE = 0x2501, - /// B-spline curve of degree 3 with circular cross-section. - OPTIX_PRIMITIVE_TYPE_ROUND_CUBIC_BSPLINE = 0x2502, - /// Piecewise linear curve with circular cross-section. - OPTIX_PRIMITIVE_TYPE_ROUND_LINEAR = 0x2503, - /// Triangle. - OPTIX_PRIMITIVE_TYPE_TRIANGLE = 0x2531, -} OptixPrimitiveType; - -/// Builtin flags may be bitwise combined. -/// -/// \see #OptixPipelineCompileOptions::usesPrimitiveTypeFlags -typedef enum OptixPrimitiveTypeFlags -{ - /// Custom primitive. - OPTIX_PRIMITIVE_TYPE_FLAGS_CUSTOM = 1 << 0, - /// B-spline curve of degree 2 with circular cross-section. - OPTIX_PRIMITIVE_TYPE_FLAGS_ROUND_QUADRATIC_BSPLINE = 1 << 1, - /// B-spline curve of degree 3 with circular cross-section. - OPTIX_PRIMITIVE_TYPE_FLAGS_ROUND_CUBIC_BSPLINE = 1 << 2, - /// Piecewise linear curve with circular cross-section. - OPTIX_PRIMITIVE_TYPE_FLAGS_ROUND_LINEAR = 1 << 3, - /// Triangle. - OPTIX_PRIMITIVE_TYPE_FLAGS_TRIANGLE = 1 << 31, -} OptixPrimitiveTypeFlags; - -/// Curve inputs -/// -/// A curve is a swept surface defined by a 3D spline curve and a varying width (radius). A curve (or "strand") of -/// degree d (3=cubic, 2=quadratic, 1=linear) is represented by N > d vertices and N width values, and comprises N - d segments. -/// Each segment is defined by d+1 consecutive vertices. Each curve may have a different number of vertices. -/// -/// OptiX describes the curve array as a list of curve segments. The primitive id is the segment number. -/// It is the user's responsibility to maintain a mapping between curves and curve segments. -/// Each index buffer entry i = indexBuffer[primid] specifies the start of a curve segment, -/// represented by d+1 consecutive vertices in the vertex buffer, -/// and d+1 consecutive widths in the width buffer. Width is interpolated the same -/// way vertices are interpolated, that is, using the curve basis. -/// -/// Each curves build input has only one SBT record. -/// To create curves with different materials in the same BVH, use multiple build inputs. -/// -/// \see #OptixBuildInput::curveArray -typedef struct OptixBuildInputCurveArray -{ - /// Curve degree and basis - /// \see #OptixPrimitiveType - OptixPrimitiveType curveType; - /// Number of primitives. Each primitive is a polynomial curve segment. - unsigned int numPrimitives; - - /// Pointer to host array of device pointers, one per motion step. Host array size must match number of - /// motion keys as set in #OptixMotionOptions (or an array of size 1 if OptixMotionOptions::numKeys is set - /// to 1). Each per-motion-key device pointer must point to an array of floats (the vertices of the - /// curves). - const CUdeviceptr* vertexBuffers; - /// Number of vertices in each buffer in vertexBuffers. - unsigned int numVertices; - /// Stride between vertices. If set to zero, vertices are assumed to be tightly - /// packed and stride is sizeof( float3 ). - unsigned int vertexStrideInBytes; - - /// Parallel to vertexBuffers: a device pointer per motion step, each with numVertices float values, - /// specifying the curve width (radius) corresponding to each vertex. - const CUdeviceptr* widthBuffers; - /// Stride between widths. If set to zero, widths are assumed to be tightly - /// packed and stride is sizeof( float ). - unsigned int widthStrideInBytes; - - /// Reserved for future use. - const CUdeviceptr* normalBuffers; - /// Reserved for future use. - unsigned int normalStrideInBytes; - - /// Device pointer to array of unsigned ints, one per curve segment. - /// This buffer is required (unlike for OptixBuildInputTriangleArray). - /// Each index is the start of degree+1 consecutive vertices in vertexBuffers, - /// and corresponding widths in widthBuffers and normals in normalBuffers. - /// These define a single segment. Size of array is numPrimitives. - CUdeviceptr indexBuffer; - /// Stride between indices. If set to zero, indices are assumed to be tightly - /// packed and stride is sizeof( unsigned int ). - unsigned int indexStrideInBytes; - - /// Combination of OptixGeometryFlags describing the - /// primitive behavior. - unsigned int flag; - - /// Primitive index bias, applied in optixGetPrimitiveIndex(). - /// Sum of primitiveIndexOffset and number of primitives must not overflow 32bits. - unsigned int primitiveIndexOffset; -} OptixBuildInputCurveArray; - -/// AABB inputs -typedef struct OptixAabb -{ - float minX; ///< Lower extent in X direction. - float minY; ///< Lower extent in Y direction. - float minZ; ///< Lower extent in Z direction. - float maxX; ///< Upper extent in X direction. - float maxY; ///< Upper extent in Y direction. - float maxZ; ///< Upper extent in Z direction. -} OptixAabb; - -/// Custom primitive inputs -/// -/// \see #OptixBuildInput::customPrimitiveArray -typedef struct OptixBuildInputCustomPrimitiveArray -{ - /// Points to host array of device pointers to AABBs (type OptixAabb), one per motion step. - /// Host array size must match number of motion keys as set in OptixMotionOptions (or an array of size 1 - /// if OptixMotionOptions::numKeys is set to 1). - /// Each device pointer must be a multiple of OPTIX_AABB_BUFFER_BYTE_ALIGNMENT. - const CUdeviceptr* aabbBuffers; - - /// Number of primitives in each buffer (i.e., per motion step) in - /// #OptixBuildInputCustomPrimitiveArray::aabbBuffers. - unsigned int numPrimitives; - - /// Stride between AABBs (per motion key). If set to zero, the aabbs are assumed to be tightly - /// packed and the stride is assumed to be sizeof( OptixAabb ). - /// If non-zero, the value must be a multiple of OPTIX_AABB_BUFFER_BYTE_ALIGNMENT. - unsigned int strideInBytes; - - /// Array of flags, to specify flags per sbt record, - /// combinations of OptixGeometryFlags describing the - /// primitive behavior, size must match numSbtRecords - const unsigned int* flags; - - /// Number of sbt records available to the sbt index offset override. - unsigned int numSbtRecords; - - /// Device pointer to per-primitive local sbt index offset buffer. May be NULL. - /// Every entry must be in range [0,numSbtRecords-1]. - /// Size needs to be the number of primitives. - CUdeviceptr sbtIndexOffsetBuffer; - - /// Size of type of the sbt index offset. Needs to be 0, 1, 2 or 4 (8, 16 or 32 bit). - unsigned int sbtIndexOffsetSizeInBytes; - - /// Stride between the index offsets. If set to zero, the offsets are assumed to be tightly - /// packed and the stride matches the size of the type (sbtIndexOffsetSizeInBytes). - unsigned int sbtIndexOffsetStrideInBytes; - - /// Primitive index bias, applied in optixGetPrimitiveIndex(). - /// Sum of primitiveIndexOffset and number of primitive must not overflow 32bits. - unsigned int primitiveIndexOffset; -} OptixBuildInputCustomPrimitiveArray; - -/// Instance and instance pointer inputs -/// -/// \see #OptixBuildInput::instanceArray -typedef struct OptixBuildInputInstanceArray -{ - /// If OptixBuildInput::type is OPTIX_BUILD_INPUT_TYPE_INSTANCE_POINTERS instances and - /// aabbs should be interpreted as arrays of pointers instead of arrays of structs. - /// - /// This pointer must be a multiple of OPTIX_INSTANCE_BYTE_ALIGNMENT if - /// OptixBuildInput::type is OPTIX_BUILD_INPUT_TYPE_INSTANCES. The array elements must - /// be a multiple of OPTIX_INSTANCE_BYTE_ALIGNMENT if OptixBuildInput::type is - /// OPTIX_BUILD_INPUT_TYPE_INSTANCE_POINTERS. - CUdeviceptr instances; - - /// Number of elements in #OptixBuildInputInstanceArray::instances. - unsigned int numInstances; - - /// Optional AABBs. In OptixAabb format. - /// - /// Required for traversables (OptixMatrixMotionTransform, OptixSRTMotionTransform, - /// OptixStaticTransform) and certain configurations of motion AS as instance. - /// Will be ignored for non-motion AS, since no AABBs are required. May be NULL in that case. - /// - /// The following table illustrates this (IAS is Instance Acceleration Structure) - /// instance type | traversable | motion AS | static AS - /// building a motion IAS | required | required | ignored - /// building a static IAS | required | ignored | ignored - /// - /// The AABBs must enclose the space spanned by the referenced handle of the instance. - /// I.e., the AABBs are in 'object space' and must NOT include the transformation of the - /// instance itself. If the instance's handle references a traversable the AABBs must - /// contain the transformation of the traversable. - /// - /// If OptixBuildInput::type is OPTIX_BUILD_INPUT_TYPE_INSTANCE_POINTERS the unused - /// pointers for unused aabbs may be set to NULL. - /// - /// If OptixBuildInput::type is OPTIX_BUILD_INPUT_TYPE_INSTANCES this pointer must be a - /// multiple of OPTIX_AABB_BUFFER_BYTE_ALIGNMENT. If OptixBuildInput::type is - /// OPTIX_BUILD_INPUT_TYPE_INSTANCE_POINTERS the array elements must be a multiple of - /// OPTIX_AABB_BUFFER_BYTE_ALIGNMENT. - /// - /// Motion: - /// - /// In case of motion (OptixMotionOptions::numKeys>=2), OptixMotionOptions::numKeys - /// aabbs are expected per instance, e.g., for N instances and M motion keys: - /// aabb[inst0][t0], aabb[inst0][t1], ..., aabb[inst0][tM-1], ..., aabb[instN-1][t0], - /// aabb[instN-1][t1],..., aabb[instN-1][tM-1]. - /// - /// If OptixBuildInput::type is OPTIX_BUILD_INPUT_TYPE_INSTANCES aabbs must be a device - /// pointer to an array of N * M * 6 floats. - /// - /// If OptixBuildInput::type is OPTIX_BUILD_INPUT_TYPE_INSTANCE_POINTERS aabbs must be - /// a device pointer to an array of N device pointers, each pointing to an array of M * - /// 6 floats in OptixAabb format. Pointers may be NULL if the aabbs are not required. - /// Hence, if the second instance (inst1) points to a static GAS, aabbs are not - /// required for that instance. While being ignored, aabbs must still be a device - /// pointer to an array of N elements. - /// - /// In case of OPTIX_BUILD_INPUT_TYPE_INSTANCES, the second element (with a size of M * - /// 6 floats) will be ignored. In case of OPTIX_BUILD_INPUT_TYPE_INSTANCE_POINTERS, - /// the second element (with a size of pointer to M * 6 floats) can be NULL. - CUdeviceptr aabbs; - - /// number of aabbs, in case of motion, this needs to match - /// numInstances multiplied with OptixMotionOptions::numKeys - unsigned int numAabbs; - -} OptixBuildInputInstanceArray; - -/// Enum to distinguish the different build input types. -/// -/// \see #OptixBuildInput::type -typedef enum OptixBuildInputType -{ - /// Triangle inputs. \see #OptixBuildInputTriangleArray - OPTIX_BUILD_INPUT_TYPE_TRIANGLES = 0x2141, - /// Custom primitive inputs. \see #OptixBuildInputCustomPrimitiveArray - OPTIX_BUILD_INPUT_TYPE_CUSTOM_PRIMITIVES = 0x2142, - /// Instance inputs. \see #OptixBuildInputInstanceArray - OPTIX_BUILD_INPUT_TYPE_INSTANCES = 0x2143, - /// Instance pointer inputs. \see #OptixBuildInputInstanceArray - OPTIX_BUILD_INPUT_TYPE_INSTANCE_POINTERS = 0x2144, - /// Curve inputs. \see #OptixBuildInputCurveArray - OPTIX_BUILD_INPUT_TYPE_CURVES = 0x2145 -} OptixBuildInputType; - -/// Build inputs. -/// -/// All of them support motion and the size of the data arrays needs to match the number of motion steps -/// -/// \see #optixAccelComputeMemoryUsage(), #optixAccelBuild() -typedef struct OptixBuildInput -{ - /// The type of the build input. - OptixBuildInputType type; - - union - { - /// Triangle inputs. - OptixBuildInputTriangleArray triangleArray; - /// Curve inputs. - OptixBuildInputCurveArray curveArray; - /// Custom primitive inputs. - OptixBuildInputCustomPrimitiveArray customPrimitiveArray; - /// Instance and instance pointer inputs. - OptixBuildInputInstanceArray instanceArray; - char pad[1024]; - }; -} OptixBuildInput; - -// Some 32-bit tools use this header. This static_assert fails for them because -// the default enum size is 4 bytes, rather than 8, under 32-bit compilers. -// This #ifndef allows them to disable the static assert. - -// TODO Define a static assert for C/pre-C++-11 -#if defined( __cplusplus ) && __cplusplus >= 201103L -static_assert( sizeof( OptixBuildInput ) == 8 + 1024, "OptixBuildInput has wrong size" ); -#endif - -/// Flags set on the #OptixInstance::flags. -/// -/// These can be or'ed together to combine multiple flags. -typedef enum OptixInstanceFlags -{ - /// No special flag set - OPTIX_INSTANCE_FLAG_NONE = 0, - - /// Prevent triangles from getting culled due to their orientation. - /// Effectively ignores ray flags - /// OPTIX_RAY_FLAG_CULL_BACK_FACING_TRIANGLES and OPTIX_RAY_FLAG_CULL_FRONT_FACING_TRIANGLES. - OPTIX_INSTANCE_FLAG_DISABLE_TRIANGLE_FACE_CULLING = 1u << 0, - - /// Flip triangle orientation. - /// This affects front/backface culling as well as the reported face in case of a hit. - OPTIX_INSTANCE_FLAG_FLIP_TRIANGLE_FACING = 1u << 1, - - /// Disable anyhit programs for all geometries of the instance. - /// Can be overridden by OPTIX_RAY_FLAG_ENFORCE_ANYHIT. - /// This flag is mutually exclusive with OPTIX_INSTANCE_FLAG_ENFORCE_ANYHIT. - OPTIX_INSTANCE_FLAG_DISABLE_ANYHIT = 1u << 2, - - /// Enables anyhit programs for all geometries of the instance. - /// Overrides OPTIX_GEOMETRY_FLAG_DISABLE_ANYHIT - /// Can be overridden by OPTIX_RAY_FLAG_DISABLE_ANYHIT. - /// This flag is mutually exclusive with OPTIX_INSTANCE_FLAG_DISABLE_ANYHIT. - OPTIX_INSTANCE_FLAG_ENFORCE_ANYHIT = 1u << 3, - - /// Disable the instance transformation - OPTIX_INSTANCE_FLAG_DISABLE_TRANSFORM = 1u << 6, -} OptixInstanceFlags; - -/// Instances -/// -/// \see #OptixBuildInputInstanceArray::instances -typedef struct OptixInstance -{ - /// affine object-to-world transformation as 3x4 matrix in row-major layout - float transform[12]; - - /// Application supplied ID. The maximal ID can be queried using OPTIX_DEVICE_PROPERTY_LIMIT_MAX_INSTANCE_ID. - unsigned int instanceId; - - /// SBT record offset. Will only be used for instances of geometry acceleration structure (GAS) objects. - /// Needs to be set to 0 for instances of instance acceleration structure (IAS) objects. The maximal SBT offset - /// can be queried using OPTIX_DEVICE_PROPERTY_LIMIT_MAX_INSTANCE_SBT_OFFSET. - unsigned int sbtOffset; - - /// Visibility mask. If rayMask & instanceMask == 0 the instance is culled. The number of available bits can be - /// queried using OPTIX_DEVICE_PROPERTY_LIMIT_NUM_BITS_INSTANCE_VISIBILITY_MASK. - unsigned int visibilityMask; - - /// Any combination of OptixInstanceFlags is allowed. - unsigned int flags; - - /// Set with an OptixTraversableHandle. - OptixTraversableHandle traversableHandle; - - /// round up to 80-byte, to ensure 16-byte alignment - unsigned int pad[2]; -} OptixInstance; - -/// Builder Options -/// -/// Used for #OptixAccelBuildOptions::buildFlags. Can be or'ed together. -typedef enum OptixBuildFlags -{ - /// No special flags set. - OPTIX_BUILD_FLAG_NONE = 0, - - /// Allow updating the build with new vertex positions with subsequent calls to - /// optixAccelBuild. - OPTIX_BUILD_FLAG_ALLOW_UPDATE = 1u << 0, - - OPTIX_BUILD_FLAG_ALLOW_COMPACTION = 1u << 1, - - OPTIX_BUILD_FLAG_PREFER_FAST_TRACE = 1u << 2, - - OPTIX_BUILD_FLAG_PREFER_FAST_BUILD = 1u << 3, - - /// Allow access to random baked vertex in closesthit - OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS = 1u << 4, -} OptixBuildFlags; - -/// Enum to specify the acceleration build operation. -/// -/// Used in OptixAccelBuildOptions, which is then passed to optixAccelBuild and -/// optixAccelComputeMemoryUsage, this enum indicates whether to do a build or an update -/// of the acceleration structure. -/// -/// Acceleration structure updates utilize the same acceleration structure, but with -/// updated bounds. Updates are typically much faster than builds, however, large -/// perturbations can degrade the quality of the acceleration structure. -/// -/// \see #optixAccelComputeMemoryUsage(), #optixAccelBuild(), #OptixAccelBuildOptions -typedef enum OptixBuildOperation -{ - /// Perform a full build operation - OPTIX_BUILD_OPERATION_BUILD = 0x2161, - /// Perform an update using new bounds - OPTIX_BUILD_OPERATION_UPDATE = 0x2162, -} OptixBuildOperation; - -/// Enum to specify motion flags. -/// -/// \see #OptixMotionOptions::flags. -typedef enum OptixMotionFlags -{ - OPTIX_MOTION_FLAG_NONE = 0, - OPTIX_MOTION_FLAG_START_VANISH = 1u << 0, - OPTIX_MOTION_FLAG_END_VANISH = 1u << 1 -} OptixMotionFlags; - -/// Motion options -/// -/// \see #OptixAccelBuildOptions::motionOptions, #OptixMatrixMotionTransform::motionOptions, -/// #OptixSRTMotionTransform::motionOptions -typedef struct OptixMotionOptions -{ - /// If numKeys > 1, motion is enabled. timeBegin, - /// timeEnd and flags are all ignored when motion is disabled. - unsigned short numKeys; - - /// Combinations of #OptixMotionFlags - unsigned short flags; - - /// Point in time where motion starts. - float timeBegin; - - /// Point in time where motion ends. - float timeEnd; -} OptixMotionOptions; - -/// Build options for acceleration structures. -/// -/// \see #optixAccelComputeMemoryUsage(), #optixAccelBuild() -typedef struct OptixAccelBuildOptions -{ - /// Combinations of OptixBuildFlags - unsigned int buildFlags; - - /// If OPTIX_BUILD_OPERATION_UPDATE the output buffer is assumed to contain the result - /// of a full build with OPTIX_BUILD_FLAG_ALLOW_UPDATE set and using the same number of - /// primitives. It is updated incrementally to reflect the current position of the - /// primitives. - OptixBuildOperation operation; - - /// Options for motion. - OptixMotionOptions motionOptions; -} OptixAccelBuildOptions; - -/// Struct for querying builder allocation requirements. -/// -/// Once queried the sizes should be used to allocate device memory of at least these sizes. -/// -/// \see #optixAccelComputeMemoryUsage() -typedef struct OptixAccelBufferSizes -{ - /// The size in bytes required for the outputBuffer parameter to optixAccelBuild when - /// doing a build (OPTIX_BUILD_OPERATION_BUILD). - size_t outputSizeInBytes; - - /// The size in bytes required for the tempBuffer paramter to optixAccelBuild when - /// doing a build (OPTIX_BUILD_OPERATION_BUILD). - size_t tempSizeInBytes; - - /// The size in bytes required for the tempBuffer parameter to optixAccelBuild - /// when doing an update (OPTIX_BUILD_OPERATION_UPDATE). This value can be different - /// than tempSizeInBytes used for a full build. Only non-zero if - /// OPTIX_BUILD_FLAG_ALLOW_UPDATE flag is set in OptixAccelBuildOptions. - size_t tempUpdateSizeInBytes; -} OptixAccelBufferSizes; - -/// Properties which can be emitted during acceleration structure build. -/// -/// \see #OptixAccelEmitDesc::type. -typedef enum OptixAccelPropertyType -{ - /// Size of a compacted acceleration structure. The device pointer points to a uint64. - OPTIX_PROPERTY_TYPE_COMPACTED_SIZE = 0x2181, - - /// OptixAabb * numMotionSteps - OPTIX_PROPERTY_TYPE_AABBS = 0x2182, -} OptixAccelPropertyType; - -/// Specifies a type and output destination for emitted post-build properties. -/// -/// \see #optixAccelBuild() -typedef struct OptixAccelEmitDesc -{ - /// Output buffer for the properties - CUdeviceptr result; - - /// Requested property - OptixAccelPropertyType type; -} OptixAccelEmitDesc; - -/// Used to store information related to relocation of acceleration structures. -/// -/// \see #optixAccelGetRelocationInfo(), #optixAccelCheckRelocationCompatibility(), #optixAccelRelocate() -typedef struct OptixAccelRelocationInfo -{ - /// Opaque data, used internally, should not be modified - unsigned long long info[4]; -} OptixAccelRelocationInfo; - -/// Static transform -/// -/// The device address of instances of this type must be a multiple of OPTIX_TRANSFORM_BYTE_ALIGNMENT. -/// -/// \see #optixConvertPointerToTraversableHandle() -typedef struct OptixStaticTransform -{ - /// The traversable transformed by this transformation - OptixTraversableHandle child; - - /// Padding to make the transformations 16 byte aligned - unsigned int pad[2]; - - /// Affine object-to-world transformation as 3x4 matrix in row-major layout - float transform[12]; - - /// Affine world-to-object transformation as 3x4 matrix in row-major layout - /// Must be the inverse of the transform matrix - float invTransform[12]; -} OptixStaticTransform; - -/// Represents a matrix motion transformation. -/// -/// The device address of instances of this type must be a multiple of OPTIX_TRANSFORM_BYTE_ALIGNMENT. -/// -/// This struct, as defined here, handles only N=2 motion keys due to the fixed array length of its transform member. -/// The following example shows how to create instances for an arbitrary number N of motion keys: -/// -/// \code -/// float matrixData[N][12]; -/// ... // setup matrixData -/// -/// size_t transformSizeInBytes = sizeof( OptixMatrixMotionTransform ) + ( N-2 ) * 12 * sizeof( float ); -/// OptixMatrixMotionTransform* matrixMoptionTransform = (OptixMatrixMotionTransform*) malloc( transformSizeInBytes ); -/// memset( matrixMoptionTransform, 0, transformSizeInBytes ); -/// -/// ... // setup other members of matrixMoptionTransform -/// matrixMoptionTransform->motionOptions.numKeys/// = N; -/// memcpy( matrixMoptionTransform->transform, matrixData, N * 12 * sizeof( float ) ); -/// -/// ... // copy matrixMoptionTransform to device memory -/// free( matrixMoptionTransform ) -/// \endcode -/// -/// \see #optixConvertPointerToTraversableHandle() -typedef struct OptixMatrixMotionTransform -{ - /// The traversable that is transformed by this transformation - OptixTraversableHandle child; - - /// The motion options for this transformation - OptixMotionOptions motionOptions; - - /// Padding to make the transformation 16 byte aligned - unsigned int pad[3]; - - /// Affine object-to-world transformation as 3x4 matrix in row-major layout - float transform[2][12]; -} OptixMatrixMotionTransform; - -/// Represents an SRT transformation. -/// -/// An SRT transformation can represent a smooth rotation with fewer motion keys than a matrix transformation. Each -/// motion key is constructed from elements taken from a matrix S, a quaternion R, and a translation T. -/// -/// [ sx a b pvx ] -/// The scaling matrix S = [ 0 sy c pvy ] defines an affine transformation that can include scale, shear, and a -/// [ 0 0 sz pvz ] -/// -/// translation. The translation allows to define the pivot point for the subsequent rotation. -/// -/// The quaternion R = [ qx, qy, qz, qw ] describes a rotation with angular component qw = cos(theta/2) and other -/// components [ qx, qy, qz ] = sin(theta/2) * [ ax, ay, az ] where the axis [ ax, ay, az ] is normalized. -/// -/// [ 1 0 0 tx ] -/// The translation T = [ 0 1 0 ty ] defines another translation that is applied after the rotation. Typically, this -/// [ 0 0 1 tz ] -/// -/// translation includes the inverse translation from the matrix S to reverse its effect. -/// -/// To obtain the effective transformation at time t, the elements of the components of S, R, and T will be interpolated -/// linearly. The components are then multiplied to obtain the combined transformation C = T * R * S. The transformation -/// C is the effective object-to-world transformations at time t, and C^(-1) is the effective world-to-object -/// transformation at time t. -/// -/// \see #OptixSRTMotionTransform::srtData, #optixConvertPointerToTraversableHandle() -typedef struct OptixSRTData -{ - /// \name Parameters describing the SRT transformation - /// @{ - float sx, a, b, pvx, sy, c, pvy, sz, pvz, qx, qy, qz, qw, tx, ty, tz; - /// @} -} OptixSRTData; - -// TODO Define a static assert for C/pre-C++-11 -#if defined( __cplusplus ) && __cplusplus >= 201103L -static_assert( sizeof( OptixSRTData ) == 16 * 4, "OptixSRTData has wrong size" ); -#endif - -/// Represents an SRT motion transformation. -/// -/// The device address of instances of this type must be a multiple of OPTIX_TRANSFORM_BYTE_ALIGNMENT. -/// -/// This struct, as defined here, handles only N=2 motion keys due to the fixed array length of its srtData member. -/// The following example shows how to create instances for an arbitrary number N of motion keys: -/// -/// \code -/// OptixSRTData srtData[N]; -/// ... // setup srtData -/// -/// size_t transformSizeInBytes = sizeof( OptixSRTMotionTransform ) + ( N-2 ) * sizeof( OptixSRTData ); -/// OptixSRTMotionTransform* srtMotionTransform = (OptixSRTMotionTransform*) malloc( transformSizeInBytes ); -/// memset( srtMotionTransform, 0, transformSizeInBytes ); -/// -/// ... // setup other members of srtMotionTransform -/// srtMotionTransform->motionOptions.numKeys = N; -/// memcpy( srtMotionTransform->srtData, srtData, N * sizeof( OptixSRTData ) ); -/// -/// ... // copy srtMotionTransform to device memory -/// free( srtMotionTransform ) -/// \endcode -/// -/// \see #optixConvertPointerToTraversableHandle() -typedef struct OptixSRTMotionTransform -{ - /// The traversable transformed by this transformation - OptixTraversableHandle child; - - /// The motion options for this transformation - OptixMotionOptions motionOptions; - - /// Padding to make the SRT data 16 byte aligned - unsigned int pad[3]; - - /// The actual SRT data describing the transformation - OptixSRTData srtData[2]; -} OptixSRTMotionTransform; - -// TODO Define a static assert for C/pre-C++-11 -#if defined( __cplusplus ) && __cplusplus >= 201103L -static_assert( sizeof( OptixSRTMotionTransform ) == 8 + 12 + 12 + 2 * 16 * 4, "OptixSRTMotionTransform has wrong size" ); -#endif - -/// Traversable Handles -/// -/// \see #optixConvertPointerToTraversableHandle() -typedef enum OptixTraversableType -{ - /// Static transforms. \see #OptixStaticTransform - OPTIX_TRAVERSABLE_TYPE_STATIC_TRANSFORM = 0x21C1, - /// Matrix motion transform. \see #OptixMatrixMotionTransform - OPTIX_TRAVERSABLE_TYPE_MATRIX_MOTION_TRANSFORM = 0x21C2, - /// SRT motion transform. \see #OptixSRTMotionTransform - OPTIX_TRAVERSABLE_TYPE_SRT_MOTION_TRANSFORM = 0x21C3, -} OptixTraversableType; - -/// Pixel formats used by the denoiser. -/// -/// \see #OptixImage2D::format -typedef enum OptixPixelFormat -{ - OPTIX_PIXEL_FORMAT_HALF3 = 0x2201, ///< three halfs, RGB - OPTIX_PIXEL_FORMAT_HALF4 = 0x2202, ///< four halfs, RGBA - OPTIX_PIXEL_FORMAT_FLOAT3 = 0x2203, ///< three floats, RGB - OPTIX_PIXEL_FORMAT_FLOAT4 = 0x2204, ///< four floats, RGBA - OPTIX_PIXEL_FORMAT_UCHAR3 = 0x2205, ///< three unsigned chars, RGB - OPTIX_PIXEL_FORMAT_UCHAR4 = 0x2206 ///< four unsigned chars, RGBA -} OptixPixelFormat; - -/// Image descriptor used by the denoiser. -/// -/// \see #optixDenoiserInvoke(), #optixDenoiserComputeIntensity() -typedef struct OptixImage2D -{ - /// Pointer to the actual pixel data. - CUdeviceptr data; - /// Width of the image (in pixels) - unsigned int width; - /// Height of the image (in pixels) - unsigned int height; - /// Stride between subsequent rows of the image (in bytes). - unsigned int rowStrideInBytes; - /// Stride between subsequent pixels of the image (in bytes). - /// For now, only 0 or the value that corresponds to a dense packing of pixels (no gaps) is supported. - unsigned int pixelStrideInBytes; - /// Pixel format. - OptixPixelFormat format; -} OptixImage2D; - -/// Input kinds used by the denoiser. -/// -/// RGB(A) values less than zero will be clamped to zero. -/// Albedo values must be in the range [0..1] (values less than zero will be clamped to zero). -/// The normals must be transformed into screen space. The z component is not used. -/// \see #OptixDenoiserOptions::inputKind -typedef enum OptixDenoiserInputKind -{ - OPTIX_DENOISER_INPUT_RGB = 0x2301, - OPTIX_DENOISER_INPUT_RGB_ALBEDO = 0x2302, - OPTIX_DENOISER_INPUT_RGB_ALBEDO_NORMAL = 0x2303, -} OptixDenoiserInputKind; - -/// Model kind used by the denoiser. -/// -/// \see #optixDenoiserSetModel() -typedef enum OptixDenoiserModelKind -{ - /// Use the model provided by the associated pointer. See the programming guide for a - /// description of how to format the data. - OPTIX_DENOISER_MODEL_KIND_USER = 0x2321, - - /// Use the built-in model appropriate for low dynamic range input. - OPTIX_DENOISER_MODEL_KIND_LDR = 0x2322, - - /// Use the built-in model appropriate for high dynamic range input. - OPTIX_DENOISER_MODEL_KIND_HDR = 0x2323, -} OptixDenoiserModelKind; - -/// Options used by the denoiser -/// -/// \see #optixDenoiserCreate() -typedef struct OptixDenoiserOptions -{ - /// The kind of denoiser input. - OptixDenoiserInputKind inputKind; -} OptixDenoiserOptions; - -/// Various parameters used by the denoiser -/// -/// \see #optixDenoiserInvoke() -typedef struct OptixDenoiserParams -{ - unsigned int denoiseAlpha; - CUdeviceptr hdrIntensity; - float blendFactor; -} OptixDenoiserParams; - -/// Various sizes related to the denoiser. -/// -/// \see #optixDenoiserComputeMemoryResources() -typedef struct OptixDenoiserSizes -{ - size_t stateSizeInBytes; - size_t withOverlapScratchSizeInBytes; - size_t withoutOverlapScratchSizeInBytes; - unsigned int overlapWindowSizeInPixels; -} OptixDenoiserSizes; - -/// Ray flags passed to the device function #optixTrace(). These affect the behavior of -/// traversal per invocation. -/// -/// \see #optixTrace() -typedef enum OptixRayFlags -{ - /// No change from the behavior configured for the individual AS. - OPTIX_RAY_FLAG_NONE = 0u, - - /// Disables anyhit programs for the ray. - /// Overrides OPTIX_INSTANCE_FLAG_ENFORCE_ANYHIT. - /// This flag is mutually exclusive with OPTIX_RAY_FLAG_ENFORCE_ANYHIT, - /// OPTIX_RAY_FLAG_CULL_DISABLED_ANYHIT, OPTIX_RAY_FLAG_CULL_ENFORCED_ANYHIT. - OPTIX_RAY_FLAG_DISABLE_ANYHIT = 1u << 0, - - /// Forces anyhit program execution for the ray. - /// Overrides OPTIX_GEOMETRY_FLAG_DISABLE_ANYHIT as well as OPTIX_INSTANCE_FLAG_DISABLE_ANYHIT. - /// This flag is mutually exclusive with OPTIX_RAY_FLAG_DISABLE_ANYHIT, - /// OPTIX_RAY_FLAG_CULL_DISABLED_ANYHIT, OPTIX_RAY_FLAG_CULL_ENFORCED_ANYHIT. - OPTIX_RAY_FLAG_ENFORCE_ANYHIT = 1u << 1, - - /// Terminates the ray after the first hit and executes - /// the closesthit program of that hit. - OPTIX_RAY_FLAG_TERMINATE_ON_FIRST_HIT = 1u << 2, - - /// Disables closesthit programs for the ray, but still executes miss program in case of a miss. - OPTIX_RAY_FLAG_DISABLE_CLOSESTHIT = 1u << 3, - - /// Do not intersect triangle back faces - /// (respects a possible face change due to instance flag - /// OPTIX_INSTANCE_FLAG_FLIP_TRIANGLE_FACING). - /// This flag is mutually exclusive with OPTIX_RAY_FLAG_CULL_FRONT_FACING_TRIANGLES. - OPTIX_RAY_FLAG_CULL_BACK_FACING_TRIANGLES = 1u << 4, - - /// Do not intersect triangle front faces - /// (respects a possible face change due to instance flag - /// OPTIX_INSTANCE_FLAG_FLIP_TRIANGLE_FACING). - /// This flag is mutually exclusive with OPTIX_RAY_FLAG_CULL_BACK_FACING_TRIANGLES. - OPTIX_RAY_FLAG_CULL_FRONT_FACING_TRIANGLES = 1u << 5, - - /// Do not intersect geometry which disables anyhit programs - /// (due to setting geometry flag OPTIX_GEOMETRY_FLAG_DISABLE_ANYHIT or - /// instance flag OPTIX_INSTANCE_FLAG_DISABLE_ANYHIT). - /// This flag is mutually exclusive with OPTIX_RAY_FLAG_CULL_ENFORCED_ANYHIT, - /// OPTIX_RAY_FLAG_ENFORCE_ANYHIT, OPTIX_RAY_FLAG_DISABLE_ANYHIT. - OPTIX_RAY_FLAG_CULL_DISABLED_ANYHIT = 1u << 6, - - /// Do not intersect geometry which have an enabled anyhit program - /// (due to not setting geometry flag OPTIX_GEOMETRY_FLAG_DISABLE_ANYHIT or - /// setting instance flag OPTIX_INSTANCE_FLAG_ENFORCE_ANYHIT). - /// This flag is mutually exclusive with OPTIX_RAY_FLAG_CULL_DISABLED_ANYHIT, - /// OPTIX_RAY_FLAG_ENFORCE_ANYHIT, OPTIX_RAY_FLAG_DISABLE_ANYHIT. - OPTIX_RAY_FLAG_CULL_ENFORCED_ANYHIT = 1u << 7 -} OptixRayFlags; - -/// Transform -/// -/// OptixTransformType is used by the device function #optixGetTransformTypeFromHandle() to -/// determine the type of the OptixTraversableHandle returned from -/// optixGetTransformListHandle(). -typedef enum OptixTransformType -{ - OPTIX_TRANSFORM_TYPE_NONE = 0, ///< Not a transformation - OPTIX_TRANSFORM_TYPE_STATIC_TRANSFORM = 1, ///< \see #OptixStaticTransform - OPTIX_TRANSFORM_TYPE_MATRIX_MOTION_TRANSFORM = 2, ///< \see #OptixMatrixMotionTransform - OPTIX_TRANSFORM_TYPE_SRT_MOTION_TRANSFORM = 3, ///< \see #OptixSRTMotionTransform - OPTIX_TRANSFORM_TYPE_INSTANCE = 4, ///< \see #OptixInstance -} OptixTransformType; - -/// Specifies the set of valid traversable graphs that may be -/// passed to invocation of #optixTrace(). Flags may be bitwise combined. -typedef enum OptixTraversableGraphFlags -{ - /// Used to signal that any traversable graphs is valid. - /// This flag is mutually exclusive with all other flags. - OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_ANY = 0, - - /// Used to signal that a traversable graph of a single Geometry Acceleration - /// Structure (GAS) without any transforms is valid. This flag may be combined with - /// other flags except for OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_ANY. - OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_SINGLE_GAS = 1u << 0, - - /// Used to signal that a traversable graph of a single Instance Acceleration - /// Structure (IAS) directly connected to Geometry Acceleration Structure (GAS) - /// traversables without transform traversables in between is valid. This flag may - /// be combined with other flags except for OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_ANY. - OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_SINGLE_LEVEL_INSTANCING = 1u << 1, -} OptixTraversableGraphFlags; - -/// Optimization levels -/// -/// \see #OptixModuleCompileOptions::optLevel -typedef enum OptixCompileOptimizationLevel -{ - /// Default is to run all optimizations - OPTIX_COMPILE_OPTIMIZATION_DEFAULT = 0, - /// No optimizations - OPTIX_COMPILE_OPTIMIZATION_LEVEL_0 = 0x2340, - /// Some optimizations - OPTIX_COMPILE_OPTIMIZATION_LEVEL_1 = 0x2341, - /// Most optimizations - OPTIX_COMPILE_OPTIMIZATION_LEVEL_2 = 0x2342, - /// All optimizations - OPTIX_COMPILE_OPTIMIZATION_LEVEL_3 = 0x2343, -} OptixCompileOptimizationLevel; - -/// Debug levels -/// -/// \see #OptixModuleCompileOptions::debugLevel -typedef enum OptixCompileDebugLevel -{ - /// Default currently is to add line info - OPTIX_COMPILE_DEBUG_LEVEL_DEFAULT = 0, - /// No debug information - OPTIX_COMPILE_DEBUG_LEVEL_NONE = 0x2350, - /// Generate lineinfo only - OPTIX_COMPILE_DEBUG_LEVEL_LINEINFO = 0x2351, - /// Generate dwarf debug information. - OPTIX_COMPILE_DEBUG_LEVEL_FULL = 0x2352, -} OptixCompileDebugLevel; - -/// Compilation options for module -/// -/// \see #optixModuleCreateFromPTX() -typedef struct OptixModuleCompileOptions -{ - /// Maximum number of registers allowed when compiling to SASS. - /// Set to 0 for no explicit limit. May vary within a pipeline. - int maxRegisterCount; - - /// Optimization level. May vary within a pipeline. - OptixCompileOptimizationLevel optLevel; - - /// Generate debug information. - OptixCompileDebugLevel debugLevel; -} OptixModuleCompileOptions; - -/// Distinguishes different kinds of program groups. -typedef enum OptixProgramGroupKind -{ - /// Program group containing a raygen (RG) program - /// \see #OptixProgramGroupSingleModule, #OptixProgramGroupDesc::raygen - OPTIX_PROGRAM_GROUP_KIND_RAYGEN = 0x2421, - - /// Program group containing a miss (MS) program - /// \see #OptixProgramGroupSingleModule, #OptixProgramGroupDesc::miss - OPTIX_PROGRAM_GROUP_KIND_MISS = 0x2422, - - /// Program group containing an exception (EX) program - /// \see OptixProgramGroupHitgroup, #OptixProgramGroupDesc::exception - OPTIX_PROGRAM_GROUP_KIND_EXCEPTION = 0x2423, - - /// Program group containing an intersection (IS), any hit (AH), and/or closest hit (CH) program - /// \see #OptixProgramGroupSingleModule, #OptixProgramGroupDesc::hitgroup - OPTIX_PROGRAM_GROUP_KIND_HITGROUP = 0x2424, - - /// Program group containing a direct (DC) or continuation (CC) callable program - /// \see OptixProgramGroupCallables, #OptixProgramGroupDesc::callables - OPTIX_PROGRAM_GROUP_KIND_CALLABLES = 0x2425 -} OptixProgramGroupKind; - -/// Flags for program groups -typedef enum OptixProgramGroupFlags -{ - /// Currently there are no flags - OPTIX_PROGRAM_GROUP_FLAGS_NONE = 0 -} OptixProgramGroupFlags; - -/// Program group representing a single module. -/// -/// Used for raygen, miss, and exception programs. In case of raygen and exception programs, module and entry -/// function name need to be valid. For miss programs, module and entry function name might both be \c nullptr. -/// -/// \see #OptixProgramGroupDesc::raygen, #OptixProgramGroupDesc::miss, #OptixProgramGroupDesc::exception -typedef struct OptixProgramGroupSingleModule -{ - /// Module holding single program. - OptixModule module; - /// Entry function name of the single program. - const char* entryFunctionName; -} OptixProgramGroupSingleModule; - -/// Program group representing the hitgroup. -/// -/// For each of the three program types, module and entry function name might both be \c nullptr. -/// -/// \see #OptixProgramGroupDesc::hitgroup -typedef struct OptixProgramGroupHitgroup -{ - /// Module holding the closest hit (CH) program. - OptixModule moduleCH; - /// Entry function name of the closest hit (CH) program. - const char* entryFunctionNameCH; - /// Module holding the any hit (AH) program. - OptixModule moduleAH; - /// Entry function name of the any hit (AH) program. - const char* entryFunctionNameAH; - /// Module holding the intersection (Is) program. - OptixModule moduleIS; - /// Entry function name of the intersection (IS) program. - const char* entryFunctionNameIS; -} OptixProgramGroupHitgroup; - -/// Program group representing callables. -/// -/// Module and entry function name need to be valid for at least one of the two callables. -/// -/// \see ##OptixProgramGroupDesc::callables -typedef struct OptixProgramGroupCallables -{ - /// Module holding the direct callable (DC) program. - OptixModule moduleDC; - /// Entry function name of the direct callable (DC) program. - const char* entryFunctionNameDC; - /// Module holding the continuation callable (CC) program. - OptixModule moduleCC; - /// Entry function name of the continuation callable (CC) program. - const char* entryFunctionNameCC; -} OptixProgramGroupCallables; - -/// Descriptor for program groups. -typedef struct OptixProgramGroupDesc -{ - /// The kind of program group. - OptixProgramGroupKind kind; - - /// See #OptixProgramGroupFlags - unsigned int flags; - - union - { - /// \see #OPTIX_PROGRAM_GROUP_KIND_RAYGEN - OptixProgramGroupSingleModule raygen; - /// \see #OPTIX_PROGRAM_GROUP_KIND_MISS - OptixProgramGroupSingleModule miss; - /// \see #OPTIX_PROGRAM_GROUP_KIND_EXCEPTION - OptixProgramGroupSingleModule exception; - /// \see #OPTIX_PROGRAM_GROUP_KIND_CALLABLES - OptixProgramGroupCallables callables; - /// \see #OPTIX_PROGRAM_GROUP_KIND_HITGROUP - OptixProgramGroupHitgroup hitgroup; - }; -} OptixProgramGroupDesc; - -/// Program group options -/// -/// \see #optixProgramGroupCreate() -typedef struct OptixProgramGroupOptions -{ - /// Currently no options, so include a placeholder - int placeholder; -} OptixProgramGroupOptions; - -/// The following values are used to indicate which exception was thrown. -typedef enum OptixExceptionCodes -{ - /// Stack overflow of the continuation stack. - /// no exception details. - OPTIX_EXCEPTION_CODE_STACK_OVERFLOW = -1, - - /// The trace depth is exceeded. - /// no exception details. - OPTIX_EXCEPTION_CODE_TRACE_DEPTH_EXCEEDED = -2, - - /// The traversal depth is exceeded. - /// Exception details: - /// optixGetTransformListSize() - /// optixGetTransformListHandle() - OPTIX_EXCEPTION_CODE_TRAVERSAL_DEPTH_EXCEEDED = -3, - - /// Traversal encountered an invalid traversable type. - /// Exception details: - /// optixGetTransformListSize() - /// optixGetTransformListHandle() - /// optixGetExceptionInvalidTraversable() - OPTIX_EXCEPTION_CODE_TRAVERSAL_INVALID_TRAVERSABLE = -5, - - /// The miss SBT record index is out of bounds - /// A miss SBT record index is valid within the range [0, OptixShaderBindingTable::missRecordCount) (See optixLaunch) - /// Exception details: - /// optixGetExceptionInvalidSbtOffset() - OPTIX_EXCEPTION_CODE_TRAVERSAL_INVALID_MISS_SBT = -6, - - /// The traversal hit SBT record index out of bounds. - /// - /// A traversal hit SBT record index is valid within the range [0, OptixShaderBindingTable::hitgroupRecordCount) (See optixLaunch) - /// The following formula relates the - // sbt-index (See optixGetExceptionInvalidSbtOffset), - // sbt-instance-offset (See OptixInstance::sbtOffset), - /// sbt-geometry-acceleration-structure-index (See optixGetSbtGASIndex), - /// sbt-stride-from-trace-call and sbt-offset-from-trace-call (See optixTrace) - /// - /// sbt-index = sbt-instance-offset + (sbt-geometry-acceleration-structure-index * sbt-stride-from-trace-call) + sbt-offset-from-trace-call - /// - /// Exception details: - /// optixGetTransformListSize() - /// optixGetTransformListHandle() - /// optixGetExceptionInvalidSbtOffset() - /// optixGetSbtGASIndex() - OPTIX_EXCEPTION_CODE_TRAVERSAL_INVALID_HIT_SBT = -7, - - /// The shader encountered an unsupported primitive type (See OptixPipelineCompileOptions::usesPrimitiveTypeFlags). - /// no exception details. - OPTIX_EXCEPTION_CODE_UNSUPPORTED_PRIMITIVE_TYPE = -8, - - /// The shader encountered a call to optixTrace with at least - /// one of the float arguments being inf or nan. - /// Exception details: - /// optixGetExceptionInvalidRay() - OPTIX_EXCEPTION_CODE_INVALID_RAY = -9, - - /// The shader encountered a call to either optixDirectCall or optixCallableCall - /// where the argument count does not match the parameter count of the callable - /// program which is called. - /// Exception details: - /// optixGetExceptionParameterMismatch - OPTIX_EXCEPTION_CODE_CALLABLE_PARAMETER_MISMATCH = -10, - - /// The invoked builtin IS does not match the current GAS - OPTIX_EXCEPTION_CODE_BUILTIN_IS_MISMATCH = -11, - - /// Tried to directly traverse a single gas while single gas traversable graphs are not enabled - // (see OptixTraversableGraphFlags::OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_SINGLE_GAS). - /// Exception details: - /// optixGetTransformListSize() - /// optixGetTransformListHandle() - /// optixGetExceptionInvalidTraversable() - OPTIX_EXCEPTION_CODE_UNSUPPORTED_SINGLE_LEVEL_GAS = -15, -} OptixExceptionCodes; - -/// Exception flags. -/// -/// \see #OptixPipelineCompileOptions::exceptionFlags, #OptixExceptionCodes -typedef enum OptixExceptionFlags -{ - /// No exception are enabled. - OPTIX_EXCEPTION_FLAG_NONE = 0, - - /// Enables exceptions check related to the continuation stack. - OPTIX_EXCEPTION_FLAG_STACK_OVERFLOW = 1u << 0, - - /// Enables exceptions check related to trace depth. - OPTIX_EXCEPTION_FLAG_TRACE_DEPTH = 1u << 1, - - /// Enables user exceptions via optixThrowException(). This flag must be specified for all modules in a pipeline - /// if any module calls optixThrowException(). - OPTIX_EXCEPTION_FLAG_USER = 1u << 2, - - /// Enables various exceptions check related to traversal. - OPTIX_EXCEPTION_FLAG_DEBUG = 1u << 3 -} OptixExceptionFlags; - -/// Compilation options for all modules of a pipeline. -/// -/// Similar to #OptixModuleCompileOptions, but these options here need to be equal for all modules of a pipeline. -/// -/// \see #optixModuleCreateFromPTX(), #optixPipelineCreate() -typedef struct OptixPipelineCompileOptions -{ - /// Boolean value indicating whether motion blur could be used - int usesMotionBlur; - - /// Traversable graph bitfield. See OptixTraversableGraphFlags - unsigned int traversableGraphFlags; - - /// How much storage, in 32b words, to make available for the payload, [0..8] - int numPayloadValues; - - /// How much storage, in 32b words, to make available for the attributes. The - /// minimum number is 2. Values below that will automatically be changed to 2. [2..8] - int numAttributeValues; - - /// A bitmask of OptixExceptionFlags indicating which exceptions are enabled. - unsigned int exceptionFlags; - - /// The name of the pipeline parameter variable. If 0, no pipeline parameter - /// will be available. This will be ignored if the launch param variable was - /// optimized out or was not found in the modules linked to the pipeline. - const char* pipelineLaunchParamsVariableName; - - /// Bit field enabling primitive types. See OptixPrimitiveTypeFlags. - /// Setting to zero corresponds to enabling OPTIX_PRIMITIVE_TYPE_FLAGS_CUSTOM and OPTIX_PRIMITIVE_TYPE_FLAGS_TRIANGLE. - unsigned int usesPrimitiveTypeFlags; -} OptixPipelineCompileOptions; - -/// Link options for a pipeline -/// -/// \see #optixPipelineCreate() -typedef struct OptixPipelineLinkOptions -{ - /// Maximum trace recursion depth. 0 means a ray generation program can be - /// launched, but can't trace any rays. The maximum allowed value is 31. - unsigned int maxTraceDepth; - - /// Generate debug information. - OptixCompileDebugLevel debugLevel; -} OptixPipelineLinkOptions; - -/// Describes the shader binding table (SBT) -/// -/// \see #optixLaunch() -typedef struct OptixShaderBindingTable -{ - /// Device address of the SBT record of the ray gen program to start launch at. The address must be a multiple of - /// OPTIX_SBT_RECORD_ALIGNMENT. - CUdeviceptr raygenRecord; - - /// Device address of the SBT record of the exception program. The address must be a multiple of - /// OPTIX_SBT_RECORD_ALIGNMENT. - CUdeviceptr exceptionRecord; - - /// Arrays of SBT records for miss programs. The base address and the stride must be a multiple of - /// OPTIX_SBT_RECORD_ALIGNMENT. - /// @{ - CUdeviceptr missRecordBase; - unsigned int missRecordStrideInBytes; - unsigned int missRecordCount; - /// @} - - /// Arrays of SBT records for hit groups. The base address and the stride must be a multiple of - /// OPTIX_SBT_RECORD_ALIGNMENT. - /// @{ - CUdeviceptr hitgroupRecordBase; - unsigned int hitgroupRecordStrideInBytes; - unsigned int hitgroupRecordCount; - /// @} - - /// Arrays of SBT records for callable programs. If the base address is not null, the stride and count must not be - /// zero. If the base address is null, then the count needs to zero. The base address and the stride must be a - /// multiple of OPTIX_SBT_RECORD_ALIGNMENT. - /// @{ - CUdeviceptr callablesRecordBase; - unsigned int callablesRecordStrideInBytes; - unsigned int callablesRecordCount; - /// @} - -} OptixShaderBindingTable; - -/// Describes the stack size requirements of a program group. -/// -/// \see optixProgramGroupGetStackSize() -typedef struct OptixStackSizes -{ - /// Continuation stack size of RG programs in bytes - unsigned int cssRG; - /// Continuation stack size of MS programs in bytes - unsigned int cssMS; - /// Continuation stack size of CH programs in bytes - unsigned int cssCH; - /// Continuation stack size of AH programs in bytes - unsigned int cssAH; - /// Continuation stack size of IS programs in bytes - unsigned int cssIS; - /// Continuation stack size of CC programs in bytes - unsigned int cssCC; - /// Direct stack size of DC programs in bytes - unsigned int dssDC; - -} OptixStackSizes; - -/// Options that can be passed to \c optixQueryFunctionTable() -typedef enum OptixQueryFunctionTableOptions -{ - /// Placeholder (there are no options yet) - OPTIX_QUERY_FUNCTION_TABLE_OPTION_DUMMY = 0 - -} OptixQueryFunctionTableOptions; - -/// Type of the function \c optixQueryFunctionTable() -typedef OptixResult( OptixQueryFunctionTable_t )( int abiId, - unsigned int numOptions, - OptixQueryFunctionTableOptions* /*optionKeys*/, - const void** /*optionValues*/, - void* functionTable, - size_t sizeOfTable ); - -/// Specifies the options for retrieving an intersection program for a built-in primitive type. -/// The primitive type must not be OPTIX_PRIMITIVE_TYPE_CUSTOM. -/// -/// \see #optixBuiltinISModuleGet() -typedef struct OptixBuiltinISOptions -{ - OptixPrimitiveType builtinISModuleType; - int usesMotionBlur; -} OptixBuiltinISOptions; - -#if defined( __CUDACC__ ) -/// Describes the ray that was passed into \c optixTrace() which caused an exception with -/// exception code OPTIX_EXCEPTION_CODE_INVALID_RAY. -/// -/// \see #optixGetExceptionInvalidRay() -typedef struct OptixInvalidRayExceptionDetails -{ - float3 origin; - float3 direction; - float tmin; - float tmax; - float time; -} OptixInvalidRayExceptionDetails; - -/// Describes the details of a call to a callable program which caused an exception with -/// exception code OPTIX_EXCEPTION_CODE_CALLABLE_PARAMETER_MISMATCH, -/// Note that OptiX packs the parameters into individual 32 bit values, so the number of -/// expected and passed values may not correspond to the number of arguments passed into -/// optixDirectCall or optixContinuationCall, or the number parameters in the definition -/// of the function that is called. -typedef struct OptixParameterMismatchExceptionDetails -{ - /// Number of 32 bit values expected by the callable program - unsigned int expectedParameterCount; - /// Number of 32 bit values that were passed to the callable program - unsigned int passedArgumentCount; - /// The offset of the SBT entry of the callable program relative to OptixShaderBindingTable::callablesRecordBase - unsigned int sbtIndex; - /// Pointer to a string that holds the name of the callable program that was called - char* callableName; -} OptixParameterMismatchExceptionDetails; -#endif - - -/*@}*/ // end group optix_types - -#endif // __optix_optix_7_types_h__ diff --git a/crtx/optix_7.1/optix_denoiser_tiling.h b/crtx/optix_7.1/optix_denoiser_tiling.h deleted file mode 100644 index 2d65c55..0000000 --- a/crtx/optix_7.1/optix_denoiser_tiling.h +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright (c) 2020 NVIDIA Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of NVIDIA CORPORATION nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/// @file -/// @author NVIDIA Corporation -/// @brief OptiX public API header - -#ifndef optix_denoiser_tiling_h -#define optix_denoiser_tiling_h - - -#include - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** \addtogroup optix_utilities -@{ -*/ - -/// Tile definition -/// -/// see #optixUtilDenoiserSplitImage -/// -struct OptixUtilDenoiserImageTile -{ - // input tile image - OptixImage2D input; - - // output tile image - OptixImage2D output; - - // overlap offsets, parameters for #optixUtilDenoiserInvoke - unsigned int inputOffsetX; - unsigned int inputOffsetY; -}; - -/// Return pixel stride in bytes for the given pixel format -/// if the pixelStrideInBytes member of the image is zero. -/// Otherwise return pixelStrideInBytes from the image. -/// -/// \param[in] image Image containing the pixel stride -/// -inline unsigned int optixUtilGetPixelStride( const OptixImage2D& image ) -{ - unsigned int pixelStrideInBytes = image.pixelStrideInBytes; - if( pixelStrideInBytes == 0 ) - { - switch( image.format ) - { - case OPTIX_PIXEL_FORMAT_HALF3: - pixelStrideInBytes = 3 * sizeof( short ); - break; - case OPTIX_PIXEL_FORMAT_HALF4: - pixelStrideInBytes = 4 * sizeof( short ); - break; - case OPTIX_PIXEL_FORMAT_FLOAT3: - pixelStrideInBytes = 3 * sizeof( float ); - break; - case OPTIX_PIXEL_FORMAT_FLOAT4: - pixelStrideInBytes = 4 * sizeof( float ); - break; - case OPTIX_PIXEL_FORMAT_UCHAR3: - pixelStrideInBytes = 3 * sizeof( char ); - break; - case OPTIX_PIXEL_FORMAT_UCHAR4: - pixelStrideInBytes = 4 * sizeof( char ); - break; - } - } - return pixelStrideInBytes; -} - -/// Split image into 2D tiles given horizontal and vertical tile size -/// -/// \param[in] input full resolution input image to be split -/// \param[in] output full resolution output image -/// \param[in] overlapWindowSizeInPixels see #OptixDenoiserSizes, #optixDenoiserComputeMemoryResources -/// \param[in] tileWidth maximum width of tiles -/// \param[in] tileHeight maximum height of tiles -/// \param[out] tiles list of tiles covering the input image -/// -inline OptixResult optixUtilDenoiserSplitImage( - const OptixImage2D& input, - const OptixImage2D& output, - unsigned int overlapWindowSizeInPixels, - unsigned int tileWidth, - unsigned int tileHeight, - std::vector& tiles ) -{ - if( tileWidth == 0 || tileHeight == 0 ) - return OPTIX_ERROR_INVALID_VALUE; - - unsigned int inPixelStride = optixUtilGetPixelStride( input ); - unsigned int outPixelStride = optixUtilGetPixelStride( output ); - - int inp_w = std::min( tileWidth + 2 * overlapWindowSizeInPixels, input.width ); - int inp_h = std::min( tileHeight + 2 * overlapWindowSizeInPixels, input.height ); - int inp_y = 0, copied_y = 0; - - do - { - int inputOffsetY = inp_y == 0 ? 0 : std::max( (int)overlapWindowSizeInPixels, inp_h - ( (int)input.height - inp_y ) ); - int copy_y = inp_y == 0 ? std::min( input.height, tileHeight + overlapWindowSizeInPixels ) : - std::min( tileHeight, input.height - copied_y ); - - int inp_x = 0, copied_x = 0; - do - { - int inputOffsetX = inp_x == 0 ? 0 : std::max( (int)overlapWindowSizeInPixels, inp_w - ( (int)input.width - inp_x ) ); - int copy_x = inp_x == 0 ? std::min( input.width, tileWidth + overlapWindowSizeInPixels ) : - std::min( tileWidth, input.width - copied_x ); - - OptixUtilDenoiserImageTile tile; - tile.input.data = input.data + ( inp_y - inputOffsetY ) * input.rowStrideInBytes - + ( inp_x - inputOffsetX ) * inPixelStride; - tile.input.width = inp_w; - tile.input.height = inp_h; - tile.input.rowStrideInBytes = input.rowStrideInBytes; - tile.input.pixelStrideInBytes = input.pixelStrideInBytes; - tile.input.format = input.format; - - tile.output.data = output.data + inp_y * output.rowStrideInBytes + inp_x * outPixelStride; - tile.output.width = copy_x; - tile.output.height = copy_y; - tile.output.rowStrideInBytes = output.rowStrideInBytes; - tile.output.pixelStrideInBytes = output.pixelStrideInBytes; - tile.output.format = output.format; - - tile.inputOffsetX = inputOffsetX; - tile.inputOffsetY = inputOffsetY; - tiles.push_back( tile ); - - inp_x += inp_x == 0 ? tileWidth + overlapWindowSizeInPixels : tileWidth; - copied_x += copy_x; - } while( inp_x < static_cast( input.width ) ); - - inp_y += inp_y == 0 ? tileHeight + overlapWindowSizeInPixels : tileHeight; - copied_y += copy_y; - } while( inp_y < static_cast( input.height ) ); - - return OPTIX_SUCCESS; -} - -/// Run denoiser on input layers -/// see #optixDenoiserInvoke -/// additional parameters: - -/// Runs the denoiser on the input layers on a single GPU and stream using #optixDenoiserInvoke. -/// If the input layers' dimensions are larger than the specified tile size, the image is divided into -/// tiles using #optixUtilDenoiserSplitImage, and multiple back-to-back invocations are performed in -/// order to reuse the scratch space. Multiple tiles can be invoked concurrently if -/// #optixUtilDenoiserSplitImage is used directly and multiple scratch allocations for each concurrent -/// invocation are used. - -/// The input parameters are the same as #optixDenoiserInvoke except for the addition of the maximum tile size. -/// -/// \param[in] denoiser -/// \param[in] stream -/// \param[in] params -/// \param[in] denoiserState -/// \param[in] denoiserStateSizeInBytes -/// \param[in] inputLayers -/// \param[in] numInputLayers -/// \param[in] inputOffsetX -/// \param[in] inputOffsetY -/// \param[in] outputLayer -/// \param[in] scratch -/// \param[in] scratchSizeInBytes -/// \param[in] overlapWindowSizeInPixels -/// \param[in] tileWidth -/// \param[in] tileHeight -inline OptixResult optixUtilDenoiserInvokeTiled( - OptixDenoiser& denoiser, - CUstream stream, - const OptixDenoiserParams* params, - CUdeviceptr denoiserState, - size_t denoiserStateSizeInBytes, - const OptixImage2D* inputLayers, - unsigned int numInputLayers, - const OptixImage2D* outputLayer, - CUdeviceptr scratch, - size_t scratchSizeInBytes, - unsigned int overlapWindowSizeInPixels, - unsigned int tileWidth, - unsigned int tileHeight ) -{ - if( !inputLayers || !outputLayer ) - return OPTIX_ERROR_INVALID_VALUE; - - std::vector> tiles( numInputLayers ); - for( unsigned int l = 0; l < numInputLayers; l++ ) - if( const OptixResult res = optixUtilDenoiserSplitImage( inputLayers[l], *outputLayer, overlapWindowSizeInPixels, - tileWidth, tileHeight, tiles[l] ) ) - return res; - - for( size_t t = 0; t < tiles[0].size(); t++ ) - { - std::vector tlayers; - for( int l = 0; l < static_cast( numInputLayers ); l++ ) - tlayers.push_back( ( tiles[l] )[t].input ); - - if( const OptixResult res = - optixDenoiserInvoke( denoiser, stream, params, denoiserState, denoiserStateSizeInBytes, &tlayers[0], - numInputLayers, ( tiles[0] )[t].inputOffsetX, ( tiles[0] )[t].inputOffsetY, - &( tiles[0] )[t].output, scratch, scratchSizeInBytes ) ) - return res; - } - return OPTIX_SUCCESS; -} - -/*@}*/ // end group optix_utilities - -#ifdef __cplusplus -} -#endif - -#endif // __optix_optix_stack_size_h__ diff --git a/crtx/optix_7.1/optix_device.h b/crtx/optix_7.1/optix_device.h deleted file mode 100644 index bbd37a0..0000000 --- a/crtx/optix_7.1/optix_device.h +++ /dev/null @@ -1,47 +0,0 @@ - -/* - * Copyright (c) 2020 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual property and proprietary - * rights in and to this software, related documentation and any modifications thereto. - * Any use, reproduction, disclosure or distribution of this software and related - * documentation without an express license agreement from NVIDIA Corporation is strictly - * prohibited. - * - * TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS* - * AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, - * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY - * SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT - * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF - * BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR - * INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGES - */ - - /** - * @file optix_device.h - * @author NVIDIA Corporation - * @brief OptiX public API - * - * OptiX public API Reference - Host/Device side - */ - -/******************************************************************************\ - * optix_cuda.h - * - * This file provides the nvcc interface for generating PTX that the OptiX is - * capable of parsing and weaving into the final kernel. This is included by - * optix.h automatically if compiling device code. It can be included explicitly - * in host code if desired. - * -\******************************************************************************/ -#if !defined(__OPTIX_INCLUDE_INTERNAL_HEADERS__) -# define __OPTIX_INCLUDE_INTERNAL_HEADERS__ -# define __UNDEF_OPTIX_INCLUDE_INTERNAL_HEADERS_OPTIX_DEVICE_H__ -#endif -#include "optix_7_device.h" -#if defined( __UNDEF_OPTIX_INCLUDE_INTERNAL_HEADERS_OPTIX_DEVICE_H__ ) -# undef __OPTIX_INCLUDE_INTERNAL_HEADERS__ -# undef __UNDEF_OPTIX_INCLUDE_INTERNAL_HEADERS_OPTIX_DEVICE_H__ -#endif diff --git a/crtx/optix_7.1/optix_function_table.h b/crtx/optix_7.1/optix_function_table.h deleted file mode 100644 index 2ae354f..0000000 --- a/crtx/optix_7.1/optix_function_table.h +++ /dev/null @@ -1,310 +0,0 @@ -/* - * Copyright (c) 2020 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual property and proprietary - * rights in and to this software, related documentation and any modifications thereto. - * Any use, reproduction, disclosure or distribution of this software and related - * documentation without an express license agreement from NVIDIA Corporation is strictly - * prohibited. - * - * TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS* - * AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, - * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY - * SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT - * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF - * BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR - * INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGES - */ - -/// @file -/// @author NVIDIA Corporation -/// @brief OptiX public API header - -#ifndef __optix_optix_function_table_h__ -#define __optix_optix_function_table_h__ - -/// The OptiX ABI version. -#define OPTIX_ABI_VERSION 36 - -#ifndef OPTIX_DEFINE_ABI_VERSION_ONLY - -#include "optix_types.h" - -#if !defined( OPTIX_DONT_INCLUDE_CUDA ) -// If OPTIX_DONT_INCLUDE_CUDA is defined, cuda driver types must be defined through other -// means before including optix headers. -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/// \defgroup optix_function_table Function Table -/// \brief OptiX Function Table - -/** \addtogroup optix_function_table -@{ -*/ - -/// The function table containing all API functions. -/// -/// See #optixInit() and #optixInitWithHandle(). -typedef struct OptixFunctionTable -{ - /// \name Error handling - //@ { - - /// See ::optixGetErrorName(). - const char* ( *optixGetErrorName )( OptixResult result ); - - /// See ::optixGetErrorString(). - const char* ( *optixGetErrorString )( OptixResult result ); - - //@ } - /// \name Device context - //@ { - - /// See ::optixDeviceContextCreate(). - OptixResult ( *optixDeviceContextCreate )( CUcontext fromContext, const OptixDeviceContextOptions* options, OptixDeviceContext* context ); - - /// See ::optixDeviceContextDestroy(). - OptixResult ( *optixDeviceContextDestroy )( OptixDeviceContext context ); - - /// See ::optixDeviceContextGetProperty(). - OptixResult ( *optixDeviceContextGetProperty )( OptixDeviceContext context, OptixDeviceProperty property, void* value, size_t sizeInBytes ); - - /// See ::optixDeviceContextSetLogCallback(). - OptixResult ( *optixDeviceContextSetLogCallback )( OptixDeviceContext context, - OptixLogCallback callbackFunction, - void* callbackData, - unsigned int callbackLevel ); - - /// See ::optixDeviceContextSetCacheEnabled(). - OptixResult ( *optixDeviceContextSetCacheEnabled )( OptixDeviceContext context, int enabled ); - - /// See ::optixDeviceContextSetCacheLocation(). - OptixResult ( *optixDeviceContextSetCacheLocation )( OptixDeviceContext context, const char* location ); - - /// See ::optixDeviceContextSetCacheDatabaseSizes(). - OptixResult ( *optixDeviceContextSetCacheDatabaseSizes )( OptixDeviceContext context, size_t lowWaterMark, size_t highWaterMark ); - - /// See ::optixDeviceContextGetCacheEnabled(). - OptixResult ( *optixDeviceContextGetCacheEnabled )( OptixDeviceContext context, int* enabled ); - - /// See ::optixDeviceContextGetCacheLocation(). - OptixResult ( *optixDeviceContextGetCacheLocation )( OptixDeviceContext context, char* location, size_t locationSize ); - - /// See ::optixDeviceContextGetCacheDatabaseSizes(). - OptixResult ( *optixDeviceContextGetCacheDatabaseSizes )( OptixDeviceContext context, size_t* lowWaterMark, size_t* highWaterMark ); - - //@ } - /// \name Modules - //@ { - - /// See ::optixModuleCreateFromPTX(). - OptixResult ( *optixModuleCreateFromPTX )( OptixDeviceContext context, - const OptixModuleCompileOptions* moduleCompileOptions, - const OptixPipelineCompileOptions* pipelineCompileOptions, - const char* PTX, - size_t PTXsize, - char* logString, - size_t* logStringSize, - OptixModule* module ); - - /// See ::optixModuleDestroy(). - OptixResult ( *optixModuleDestroy )( OptixModule module ); - - /// See ::optixBuiltinISModuleGet(). - OptixResult( *optixBuiltinISModuleGet )( OptixDeviceContext context, - const OptixModuleCompileOptions* moduleCompileOptions, - const OptixPipelineCompileOptions* pipelineCompileOptions, - const OptixBuiltinISOptions* builtinISOptions, - OptixModule* builtinModule); - - //@ } - /// \name Program groups - //@ { - - /// See ::optixProgramGroupCreate(). - OptixResult ( *optixProgramGroupCreate )( OptixDeviceContext context, - const OptixProgramGroupDesc* programDescriptions, - unsigned int numProgramGroups, - const OptixProgramGroupOptions* options, - char* logString, - size_t* logStringSize, - OptixProgramGroup* programGroups ); - - /// See ::optixProgramGroupDestroy(). - OptixResult ( *optixProgramGroupDestroy )( OptixProgramGroup programGroup ); - - /// See ::optixProgramGroupGetStackSize(). - OptixResult ( *optixProgramGroupGetStackSize )( OptixProgramGroup programGroup, OptixStackSizes* stackSizes ); - - //@ } - /// \name Pipeline - //@ { - - /// See ::optixPipelineCreate(). - OptixResult ( *optixPipelineCreate )( OptixDeviceContext context, - const OptixPipelineCompileOptions* pipelineCompileOptions, - const OptixPipelineLinkOptions* pipelineLinkOptions, - const OptixProgramGroup* programGroups, - unsigned int numProgramGroups, - char* logString, - size_t* logStringSize, - OptixPipeline* pipeline ); - - /// See ::optixPipelineDestroy(). - OptixResult ( *optixPipelineDestroy )( OptixPipeline pipeline ); - - /// See ::optixPipelineSetStackSize(). - OptixResult ( *optixPipelineSetStackSize )( OptixPipeline pipeline, - unsigned int directCallableStackSizeFromTraversal, - unsigned int directCallableStackSizeFromState, - unsigned int continuationStackSize, - unsigned int maxTraversableGraphDepth ); - - //@ } - /// \name Acceleration structures - //@ { - - /// See ::optixAccelComputeMemoryUsage(). - OptixResult ( *optixAccelComputeMemoryUsage )( OptixDeviceContext context, - const OptixAccelBuildOptions* accelOptions, - const OptixBuildInput* buildInputs, - unsigned int numBuildInputs, - OptixAccelBufferSizes* bufferSizes ); - - /// See ::optixAccelBuild(). - OptixResult ( *optixAccelBuild )( OptixDeviceContext context, - CUstream stream, - const OptixAccelBuildOptions* accelOptions, - const OptixBuildInput* buildInputs, - unsigned int numBuildInputs, - CUdeviceptr tempBuffer, - size_t tempBufferSizeInBytes, - CUdeviceptr outputBuffer, - size_t outputBufferSizeInBytes, - OptixTraversableHandle* outputHandle, - const OptixAccelEmitDesc* emittedProperties, - unsigned int numEmittedProperties ); - - /// See ::optixAccelGetRelocationInfo(). - OptixResult ( *optixAccelGetRelocationInfo )( OptixDeviceContext context, OptixTraversableHandle handle, OptixAccelRelocationInfo* info ); - - - /// See ::optixAccelCheckRelocationCompatibility(). - OptixResult ( *optixAccelCheckRelocationCompatibility )( OptixDeviceContext context, - const OptixAccelRelocationInfo* info, - int* compatible ); - - /// See ::optixAccelRelocate(). - OptixResult ( *optixAccelRelocate )( OptixDeviceContext context, - CUstream stream, - const OptixAccelRelocationInfo* info, - CUdeviceptr instanceTraversableHandles, - size_t numInstanceTraversableHandles, - CUdeviceptr targetAccel, - size_t targetAccelSizeInBytes, - OptixTraversableHandle* targetHandle ); - - - /// See ::optixAccelCompact(). - OptixResult ( *optixAccelCompact )( OptixDeviceContext context, - CUstream stream, - OptixTraversableHandle inputHandle, - CUdeviceptr outputBuffer, - size_t outputBufferSizeInBytes, - OptixTraversableHandle* outputHandle ); - - /// See ::optixConvertPointerToTraversableHandle(). - OptixResult ( *optixConvertPointerToTraversableHandle )( OptixDeviceContext onDevice, - CUdeviceptr pointer, - OptixTraversableType traversableType, - OptixTraversableHandle* traversableHandle ); - - //@ } - /// \name Launch - //@ { - - /// See ::optixConvertPointerToTraversableHandle(). - OptixResult ( *optixSbtRecordPackHeader )( OptixProgramGroup programGroup, void* sbtRecordHeaderHostPointer ); - - /// See ::optixConvertPointerToTraversableHandle(). - OptixResult ( *optixLaunch )( OptixPipeline pipeline, - CUstream stream, - CUdeviceptr pipelineParams, - size_t pipelineParamsSize, - const OptixShaderBindingTable* sbt, - unsigned int width, - unsigned int height, - unsigned int depth ); - - //@ } - /// \name Denoiser - //@ { - - /// See ::optixDenoiserCreate(). - OptixResult ( *optixDenoiserCreate )( OptixDeviceContext context, const OptixDenoiserOptions* options, OptixDenoiser* returnHandle ); - - /// See ::optixDenoiserDestroy(). - OptixResult ( *optixDenoiserDestroy )( OptixDenoiser handle ); - - /// See ::optixDenoiserComputeMemoryResources(). - OptixResult ( *optixDenoiserComputeMemoryResources )( const OptixDenoiser handle, - unsigned int maximumInputWidth, - unsigned int maximumInputHeight, - OptixDenoiserSizes* returnSizes ); - - /// See ::optixDenoiserSetup(). - OptixResult ( *optixDenoiserSetup )( OptixDenoiser denoiser, - CUstream stream, - unsigned int inputWidth, - unsigned int inputHeight, - CUdeviceptr state, - size_t stateSizeInBytes, - CUdeviceptr scratch, - size_t scratchSizeInBytes ); - - - /// See ::optixDenoiserInvoke(). - OptixResult ( *optixDenoiserInvoke )( OptixDenoiser denoiser, - CUstream stream, - const OptixDenoiserParams* params, - CUdeviceptr denoiserState, - size_t denoiserStateSizeInBytes, - const OptixImage2D* inputLayers, - unsigned int numInputLayers, - unsigned int inputOffsetX, - unsigned int inputOffsetY, - const OptixImage2D* outputLayer, - CUdeviceptr scratch, - size_t scratchSizeInBytes ); - - /// See ::optixDenoiserSetModel(). - OptixResult ( *optixDenoiserSetModel )( OptixDenoiser handle, OptixDenoiserModelKind kind, void* data, size_t sizeInBytes ); - - /// See ::optixDenoiserComputeIntensity(). - OptixResult ( *optixDenoiserComputeIntensity )( OptixDenoiser handle, - CUstream stream, - const OptixImage2D* inputImage, - CUdeviceptr outputIntensity, - CUdeviceptr scratch, - size_t scratchSizeInBytes ); - - //@ } - -} OptixFunctionTable; - -/*@}*/ // end group optix_function_table - -#ifdef __cplusplus -} -#endif - -#endif /* OPTIX_DEFINE_ABI_VERSION_ONLY */ - -#endif /* __optix_optix_function_table_h__ */ diff --git a/crtx/optix_7.1/optix_function_table_definition.h b/crtx/optix_7.1/optix_function_table_definition.h deleted file mode 100644 index 97f9255..0000000 --- a/crtx/optix_7.1/optix_function_table_definition.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2020 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual property and proprietary - * rights in and to this software, related documentation and any modifications thereto. - * Any use, reproduction, disclosure or distribution of this software and related - * documentation without an express license agreement from NVIDIA Corporation is strictly - * prohibited. - * - * TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS* - * AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, - * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY - * SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT - * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF - * BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR - * INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGES - */ - -/// @file -/// @author NVIDIA Corporation -/// @brief OptiX public API header - -#ifndef __optix_optix_function_table_definition_h__ -#define __optix_optix_function_table_definition_h__ - -#include "optix_function_table.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** \addtogroup optix_function_table -@{ -*/ - -/// If the stubs in optix_stubs.h are used, then the function table needs to be defined in exactly -/// one translation unit. This can be achieved by including this header file in that translation -/// unit. -OptixFunctionTable g_optixFunctionTable; - -/*@}*/ // end group optix_function_table - -#ifdef __cplusplus -} -#endif - -#endif // __optix_optix_function_table_definition_h__ diff --git a/crtx/optix_7.1/optix_host.h b/crtx/optix_7.1/optix_host.h deleted file mode 100644 index ca7269a..0000000 --- a/crtx/optix_7.1/optix_host.h +++ /dev/null @@ -1,38 +0,0 @@ - -/* - * Copyright (c) 2020 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual property and proprietary - * rights in and to this software, related documentation and any modifications thereto. - * Any use, reproduction, disclosure or distribution of this software and related - * documentation without an express license agreement from NVIDIA Corporation is strictly - * prohibited. - * - * TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS* - * AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, - * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY - * SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT - * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF - * BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR - * INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGES - */ - -/** - * @file optix_host.h - * @author NVIDIA Corporation - * @brief OptiX public API - * - * OptiX public API Reference - Host side - */ - -#if !defined(__OPTIX_INCLUDE_INTERNAL_HEADERS__) -# define __OPTIX_INCLUDE_INTERNAL_HEADERS__ -# define __UNDEF_OPTIX_INCLUDE_INTERNAL_HEADERS_OPTIX_HOST_H__ -#endif -#include "optix_7_host.h" -#if defined( __UNDEF_OPTIX_INCLUDE_INTERNAL_HEADERS_OPTIX_HOST_H__ ) -# undef __OPTIX_INCLUDE_INTERNAL_HEADERS__ -# undef __UNDEF_OPTIX_INCLUDE_INTERNAL_HEADERS_OPTIX_HOST_H__ -#endif diff --git a/crtx/optix_7.1/optix_stack_size.h b/crtx/optix_7.1/optix_stack_size.h deleted file mode 100644 index 270a780..0000000 --- a/crtx/optix_7.1/optix_stack_size.h +++ /dev/null @@ -1,337 +0,0 @@ -/* - * Copyright (c) 2020 NVIDIA Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of NVIDIA CORPORATION nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/// @file -/// @author NVIDIA Corporation -/// @brief OptiX public API header - -#ifndef __optix_optix_stack_size_h__ -#define __optix_optix_stack_size_h__ - -#include "optix.h" - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** \addtogroup optix_utilities -@{ -*/ - -/// Retrieves direct and continuation stack sizes for each program in the program group and accumulates the upper bounds -/// in the correponding output variables based on the semantic type of the program. Before the first invocation of this -/// function with a given instance of #OptixStackSizes, the members of that instance should be set to 0. -OptixResult optixUtilAccumulateStackSizes( OptixProgramGroup programGroup, OptixStackSizes* stackSizes ) -{ - if( !stackSizes ) - return OPTIX_ERROR_INVALID_VALUE; - - OptixStackSizes localStackSizes; - OptixResult result = optixProgramGroupGetStackSize( programGroup, &localStackSizes ); - if( result != OPTIX_SUCCESS ) - return result; - - stackSizes->cssRG = std::max( stackSizes->cssRG, localStackSizes.cssRG ); - stackSizes->cssMS = std::max( stackSizes->cssMS, localStackSizes.cssMS ); - stackSizes->cssCH = std::max( stackSizes->cssCH, localStackSizes.cssCH ); - stackSizes->cssAH = std::max( stackSizes->cssAH, localStackSizes.cssAH ); - stackSizes->cssIS = std::max( stackSizes->cssIS, localStackSizes.cssIS ); - stackSizes->cssCC = std::max( stackSizes->cssCC, localStackSizes.cssCC ); - stackSizes->dssDC = std::max( stackSizes->dssDC, localStackSizes.dssDC ); - - return OPTIX_SUCCESS; -} - -/// Computes the stack size values needed to configure a pipeline. -/// -/// See the programming guide for an explanation of the formula. -/// -/// \param[in] stackSizes Accumulated stack sizes of all programs in the call graph. -/// \param[in] maxTraceDepth Maximum depth of #optixTrace() calls. -/// \param[in] maxCCDepth Maximum depth of calls trees of continuation callables. -/// \param[in] maxDCDepth Maximum depth of calls trees of direct callables. -/// \param[out] directCallableStackSizeFromTraversal Direct stack size requirement for direct callables invoked from -/// IS or AH. -/// \param[out] directCallableStackSizeFromState Direct stack size requirement for direct callables invoked from -/// RG, MS, or CH. -/// \param[out] continuationStackSize Continuation stack requirement. -OptixResult optixUtilComputeStackSizes( const OptixStackSizes* stackSizes, - unsigned int maxTraceDepth, - unsigned int maxCCDepth, - unsigned int maxDCDepth, - unsigned int* directCallableStackSizeFromTraversal, - unsigned int* directCallableStackSizeFromState, - unsigned int* continuationStackSize ) -{ - if( !stackSizes ) - return OPTIX_ERROR_INVALID_VALUE; - - const unsigned int cssRG = stackSizes->cssRG; - const unsigned int cssMS = stackSizes->cssMS; - const unsigned int cssCH = stackSizes->cssCH; - const unsigned int cssAH = stackSizes->cssAH; - const unsigned int cssIS = stackSizes->cssIS; - const unsigned int cssCC = stackSizes->cssCC; - const unsigned int dssDC = stackSizes->dssDC; - - if( directCallableStackSizeFromTraversal ) - *directCallableStackSizeFromTraversal = maxDCDepth * dssDC; - if( directCallableStackSizeFromState ) - *directCallableStackSizeFromState = maxDCDepth * dssDC; - - // upper bound on continuation stack used by call trees of continuation callables - unsigned int cssCCTree = maxCCDepth * cssCC; - - // upper bound on continuation stack used by CH or MS programs including the call tree of - // continuation callables - unsigned int cssCHOrMSPlusCCTree = std::max( cssCH, cssMS ) + cssCCTree; - - // clang-format off - if( continuationStackSize ) - *continuationStackSize - = cssRG + cssCCTree - + ( std::max( maxTraceDepth, 1u ) - 1 ) * cssCHOrMSPlusCCTree - + std::min( maxTraceDepth, 1u ) * std::max( cssCHOrMSPlusCCTree, cssIS + cssAH ); - // clang-format on - - return OPTIX_SUCCESS; -} - -/// Computes the stack size values needed to configure a pipeline. -/// -/// This variant is similar to #optixUtilComputeStackSizes(), except that it expects the values dssDC and -/// maxDCDepth split by call site semantic. -/// -/// See programming guide for an explanation of the formula. -/// -/// \param[in] stackSizes Accumulated stack sizes of all programs in the call graph. -/// \param[in] dssDCFromTraversal Accumulated direct stack size of all DC programs invoked from IS -/// or AH. -/// \param[in] dssDCFromState Accumulated direct stack size of all DC programs invoked from RG, -/// MS, or CH. -/// \param[in] maxTraceDepth Maximum depth of #optixTrace() calls. -/// \param[in] maxCCDepth Maximum depth of calls trees of continuation callables. -/// \param[in] maxDCDepthFromTraversal Maximum depth of calls trees of direct callables invoked from IS -/// or AH. -/// \param[in] maxDCDepthFromState Maximum depth of calls trees of direct callables invoked from RG, -/// MS, or CH. -/// \param[out] directCallableStackSizeFromTraversal Direct stack size requirement for direct callables invoked from -/// IS or AH. -/// \param[out] directCallableStackSizeFromState Direct stack size requirement for direct callables invoked from -/// RG, MS, or CH. -/// \param[out] continuationStackSize Continuation stack requirement. -OptixResult optixUtilComputeStackSizesDCSplit( const OptixStackSizes* stackSizes, - unsigned int dssDCFromTraversal, - unsigned int dssDCFromState, - unsigned int maxTraceDepth, - unsigned int maxCCDepth, - unsigned int maxDCDepthFromTraversal, - unsigned int maxDCDepthFromState, - unsigned int* directCallableStackSizeFromTraversal, - unsigned int* directCallableStackSizeFromState, - unsigned int* continuationStackSize ) -{ - if( !stackSizes ) - return OPTIX_ERROR_INVALID_VALUE; - - const unsigned int cssRG = stackSizes->cssRG; - const unsigned int cssMS = stackSizes->cssMS; - const unsigned int cssCH = stackSizes->cssCH; - const unsigned int cssAH = stackSizes->cssAH; - const unsigned int cssIS = stackSizes->cssIS; - const unsigned int cssCC = stackSizes->cssCC; - // use dssDCFromTraversal and dssDCFromState instead of stackSizes->dssDC - - if( directCallableStackSizeFromTraversal ) - *directCallableStackSizeFromTraversal = maxDCDepthFromTraversal * dssDCFromTraversal; - if( directCallableStackSizeFromState ) - *directCallableStackSizeFromState = maxDCDepthFromState * dssDCFromState; - - // upper bound on continuation stack used by call trees of continuation callables - unsigned int cssCCTree = maxCCDepth * cssCC; - - // upper bound on continuation stack used by CH or MS programs including the call tree of - // continuation callables - unsigned int cssCHOrMSPlusCCTree = std::max( cssCH, cssMS ) + cssCCTree; - - // clang-format off - if( continuationStackSize ) - *continuationStackSize - = cssRG + cssCCTree - + ( std::max( maxTraceDepth, 1u ) - 1 ) * cssCHOrMSPlusCCTree - + std::min( maxTraceDepth, 1u ) * std::max( cssCHOrMSPlusCCTree, cssIS + cssAH ); - // clang-format on - - return OPTIX_SUCCESS; -} - -/// Computes the stack size values needed to configure a pipeline. -/// -/// This variant is similar to #optixUtilComputeStackSizes(), except that it expects the value cssCCTree -/// instead of cssCC and maxCCDepth. -/// -/// See programming guide for an explanation of the formula. -/// -/// \param[in] stackSizes Accumulated stack sizes of all programs in the call graph. -/// \param[in] cssCCTree Maximum stack size used by calls trees of continuation callables. -/// \param[in] maxTraceDepth Maximum depth of #optixTrace() calls. -/// \param[in] maxDCDepth Maximum depth of calls trees of direct callables. -/// \param[out] directCallableStackSizeFromTraversal Direct stack size requirement for direct callables invoked from -/// IS or AH. -/// \param[out] directCallableStackSizeFromState Direct stack size requirement for direct callables invoked from -/// RG, MS, or CH. -/// \param[out] continuationStackSize Continuation stack requirement. -OptixResult optixUtilComputeStackSizesCssCCTree( const OptixStackSizes* stackSizes, - unsigned int cssCCTree, - unsigned int maxTraceDepth, - unsigned int maxDCDepth, - unsigned int* directCallableStackSizeFromTraversal, - unsigned int* directCallableStackSizeFromState, - unsigned int* continuationStackSize ) -{ - if( !stackSizes ) - return OPTIX_ERROR_INVALID_VALUE; - - const unsigned int cssRG = stackSizes->cssRG; - const unsigned int cssMS = stackSizes->cssMS; - const unsigned int cssCH = stackSizes->cssCH; - const unsigned int cssAH = stackSizes->cssAH; - const unsigned int cssIS = stackSizes->cssIS; - // use cssCCTree instead of stackSizes->cssCC and maxCCDepth - const unsigned int dssDC = stackSizes->dssDC; - - if( directCallableStackSizeFromTraversal ) - *directCallableStackSizeFromTraversal = maxDCDepth * dssDC; - if( directCallableStackSizeFromState ) - *directCallableStackSizeFromState = maxDCDepth * dssDC; - - // upper bound on continuation stack used by CH or MS programs including the call tree of - // continuation callables - unsigned int cssCHOrMSPlusCCTree = std::max( cssCH, cssMS ) + cssCCTree; - - // clang-format off - if( continuationStackSize ) - *continuationStackSize - = cssRG + cssCCTree - + ( std::max( maxTraceDepth, 1u ) - 1 ) * cssCHOrMSPlusCCTree - + std::min( maxTraceDepth, 1u ) * std::max( cssCHOrMSPlusCCTree, cssIS + cssAH ); - // clang-format on - - return OPTIX_SUCCESS; -} - -/// Computes the stack size values needed to configure a pipeline. -/// -/// This variant is a specialization of #optixUtilComputeStackSizes() for a simple path tracer with the following -/// assumptions: There are only two ray types, camera rays and shadow rays. There are only RG, MS, and CH programs, and -/// no AH, IS, CC, or DC programs. The camera rays invoke only the miss and closest hit programs MS1 and CH1, -/// respectively. The CH1 program might trace shadow rays, which invoke only the miss and closest hit programs MS2 and -/// CH2, respectively. -/// -/// For flexibility, we allow for each of CH1 and CH2 not just one single program group, but an array of programs -/// groups, and compute the maximas of the stack size requirements per array. -/// -/// See programming guide for an explanation of the formula. -OptixResult optixUtilComputeStackSizesSimplePathTracer( OptixProgramGroup programGroupRG, - OptixProgramGroup programGroupMS1, - const OptixProgramGroup* programGroupCH1, - unsigned int programGroupCH1Count, - OptixProgramGroup programGroupMS2, - const OptixProgramGroup* programGroupCH2, - unsigned int programGroupCH2Count, - unsigned int* directCallableStackSizeFromTraversal, - unsigned int* directCallableStackSizeFromState, - unsigned int* continuationStackSize ) -{ - if( !programGroupCH1 && ( programGroupCH1Count > 0 ) ) - return OPTIX_ERROR_INVALID_VALUE; - if( !programGroupCH2 && ( programGroupCH2Count > 0 ) ) - return OPTIX_ERROR_INVALID_VALUE; - - OptixResult result; - - OptixStackSizes stackSizesRG = {}; - result = optixProgramGroupGetStackSize( programGroupRG, &stackSizesRG ); - if( result != OPTIX_SUCCESS ) - return result; - - OptixStackSizes stackSizesMS1 = {}; - result = optixProgramGroupGetStackSize( programGroupMS1, &stackSizesMS1 ); - if( result != OPTIX_SUCCESS ) - return result; - - OptixStackSizes stackSizesCH1 = {}; - for( unsigned int i = 0; i < programGroupCH1Count; ++i ) - { - result = optixUtilAccumulateStackSizes( programGroupCH1[i], &stackSizesCH1 ); - if( result != OPTIX_SUCCESS ) - return result; - } - - OptixStackSizes stackSizesMS2 = {}; - result = optixProgramGroupGetStackSize( programGroupMS2, &stackSizesMS2 ); - if( result != OPTIX_SUCCESS ) - return result; - - OptixStackSizes stackSizesCH2 = {}; - memset( &stackSizesCH2, 0, sizeof( OptixStackSizes ) ); - for( unsigned int i = 0; i < programGroupCH2Count; ++i ) - { - result = optixUtilAccumulateStackSizes( programGroupCH2[i], &stackSizesCH2 ); - if( result != OPTIX_SUCCESS ) - return result; - } - - const unsigned int cssRG = stackSizesRG.cssRG; - const unsigned int cssMS1 = stackSizesMS1.cssMS; - const unsigned int cssCH1 = stackSizesCH1.cssCH; - const unsigned int cssMS2 = stackSizesMS2.cssMS; - const unsigned int cssCH2 = stackSizesCH2.cssCH; - // no AH, IS, CC, or DC programs - - if( directCallableStackSizeFromTraversal ) - *directCallableStackSizeFromTraversal = 0; - if( directCallableStackSizeFromState ) - *directCallableStackSizeFromState = 0; - - if( continuationStackSize ) - *continuationStackSize = cssRG + std::max( cssMS1, cssCH1 + std::max( cssMS2, cssCH2 ) ); - - return OPTIX_SUCCESS; -} - -/*@}*/ // end group optix_utilities - -#ifdef __cplusplus -} -#endif - -#endif // __optix_optix_stack_size_h__ diff --git a/crtx/optix_7.1/optix_stubs.h b/crtx/optix_7.1/optix_stubs.h deleted file mode 100644 index c860b21..0000000 --- a/crtx/optix_7.1/optix_stubs.h +++ /dev/null @@ -1,563 +0,0 @@ -/* - * Copyright (c) 2020 NVIDIA Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of NVIDIA CORPORATION nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/// @file -/// @author NVIDIA Corporation -/// @brief OptiX public API header - -#ifndef __optix_optix_stubs_h__ -#define __optix_optix_stubs_h__ - -#include "optix_function_table.h" - -#ifdef _WIN32 -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN 1 -#endif -#include -// The cfgmgr32 header is necessary for interrogating driver information in the registry. -// For convenience the library is also linked in automatically using the #pragma command. -#include -#pragma comment( lib, "Cfgmgr32.lib" ) -#include -#else -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -// The function table needs to be defined in exactly one translation unit. This can be -// achieved by including optix_function_table_definition.h in that translation unit. -extern OptixFunctionTable g_optixFunctionTable; - -#ifdef _WIN32 -static void* optixLoadWindowsDllFromName( const char* optixDllName ) -{ - void* handle = NULL; - - - // Get the size of the path first, then allocate - unsigned int size = GetSystemDirectoryA( NULL, 0 ); - if( size == 0 ) - { - // Couldn't get the system path size, so bail - return NULL; - } - size_t pathSize = size + 1 + strlen( optixDllName ); - char* systemPath = (char*)malloc( pathSize ); - if( GetSystemDirectoryA( systemPath, size ) != size - 1 ) - { - // Something went wrong - free( systemPath ); - return NULL; - } - strcat( systemPath, "\\" ); - strcat( systemPath, optixDllName ); - handle = LoadLibraryA( systemPath ); - free( systemPath ); - if( handle ) - return handle; - - // If we didn't find it, go looking in the register store. Since nvoptix.dll doesn't - // have its own registry entry, we are going to look for the opengl driver which lives - // next to nvoptix.dll. 0 (null) will be returned if any errors occured. - - static const char* deviceInstanceIdentifiersGUID = "{4d36e968-e325-11ce-bfc1-08002be10318}"; - const ULONG flags = CM_GETIDLIST_FILTER_CLASS | CM_GETIDLIST_FILTER_PRESENT; - ULONG deviceListSize = 0; - if( CM_Get_Device_ID_List_SizeA( &deviceListSize, deviceInstanceIdentifiersGUID, flags ) != CR_SUCCESS ) - { - return NULL; - } - char* deviceNames = (char*)malloc( deviceListSize ); - if( CM_Get_Device_ID_ListA( deviceInstanceIdentifiersGUID, deviceNames, deviceListSize, flags ) ) - { - free( deviceNames ); - return NULL; - } - DEVINST devID = 0; - char* dllPath = 0; - - // Continue to the next device if errors are encountered. - for( char* deviceName = deviceNames; *deviceName; deviceName += strlen( deviceName ) + 1 ) - { - if( CM_Locate_DevNodeA( &devID, deviceName, CM_LOCATE_DEVNODE_NORMAL ) != CR_SUCCESS ) - { - continue; - } - HKEY regKey = 0; - if( CM_Open_DevNode_Key( devID, KEY_QUERY_VALUE, 0, RegDisposition_OpenExisting, ®Key, CM_REGISTRY_SOFTWARE ) != CR_SUCCESS ) - { - continue; - } - const char* valueName = "OpenGLDriverName"; - DWORD valueSize = 0; - LSTATUS ret = RegQueryValueExA( regKey, valueName, NULL, NULL, NULL, &valueSize ); - if( ret != ERROR_SUCCESS ) - { - RegCloseKey( regKey ); - continue; - } - char* regValue = (char*)malloc( valueSize ); - ret = RegQueryValueExA( regKey, valueName, NULL, NULL, (LPBYTE)regValue, &valueSize ); - if( ret != ERROR_SUCCESS ) - { - free( regValue ); - RegCloseKey( regKey ); - continue; - } - // Strip the opengl driver dll name from the string then create a new string with - // the path and the nvoptix.dll name - for( int i = valueSize - 1; i >= 0 && regValue[i] != '\\'; --i ) - regValue[i] = '\0'; - size_t newPathSize = strlen( regValue ) + strlen( optixDllName ) + 1; - dllPath = (char*)malloc( newPathSize ); - strcpy( dllPath, regValue ); - strcat( dllPath, optixDllName ); - free( regValue ); - RegCloseKey( regKey ); - handle = LoadLibraryA( (LPCSTR)dllPath ); - free( dllPath ); - if( handle ) - break; - } - free( deviceNames ); - return handle; -} - -static void* optixLoadWindowsDll( ) -{ - return optixLoadWindowsDllFromName( "nvoptix.dll" ); -} -#endif - -/// \defgroup optix_utilities Utilities -/// \brief OptiX Utilities - -/** \addtogroup optix_utilities -@{ -*/ - -/// Loads the OptiX library and initializes the function table used by the stubs below. -/// -/// If handlePtr is not nullptr, an OS-specific handle to the library will be returned in *handlePtr. -inline OptixResult optixInitWithHandle( void** handlePtr ) -{ - // Make sure these functions get initialized to zero in case the DLL and function - // table can't be loaded - g_optixFunctionTable.optixGetErrorName = 0; - g_optixFunctionTable.optixGetErrorString = 0; - - if( !handlePtr ) - return OPTIX_ERROR_INVALID_VALUE; - -#ifdef _WIN32 - *handlePtr = optixLoadWindowsDll(); - if( !*handlePtr ) - return OPTIX_ERROR_LIBRARY_NOT_FOUND; - - void* symbol = GetProcAddress( (HMODULE)*handlePtr, "optixQueryFunctionTable" ); - if( !symbol ) - return OPTIX_ERROR_ENTRY_SYMBOL_NOT_FOUND; -#else - *handlePtr = dlopen( "libnvoptix.so.1", RTLD_NOW ); - if( !*handlePtr ) - return OPTIX_ERROR_LIBRARY_NOT_FOUND; - - void* symbol = dlsym( *handlePtr, "optixQueryFunctionTable" ); - if( !symbol ) - return OPTIX_ERROR_ENTRY_SYMBOL_NOT_FOUND; -#endif - - OptixQueryFunctionTable_t* optixQueryFunctionTable = (OptixQueryFunctionTable_t*)symbol; - - return optixQueryFunctionTable( OPTIX_ABI_VERSION, 0, 0, 0, &g_optixFunctionTable, sizeof( g_optixFunctionTable ) ); -} - -/// Loads the OptiX library and initializes the function table used by the stubs below. -/// -/// A variant of #optixInitWithHandle() that does not make the handle to the loaded library available. -inline OptixResult optixInit( void ) -{ - void* handle; - return optixInitWithHandle( &handle ); -} - -/*@}*/ // end group optix_utilities - -#ifndef OPTIX_DOXYGEN_SHOULD_SKIP_THIS - -// Stub functions that forward calls to the corresponding function pointer in the function table. - -inline const char* optixGetErrorName( OptixResult result ) -{ - if( g_optixFunctionTable.optixGetErrorName ) - return g_optixFunctionTable.optixGetErrorName( result ); - - // If the DLL and symbol table couldn't be loaded, provide a set of error strings - // suitable for processing errors related to the DLL loading. - switch( result ) - { - case OPTIX_SUCCESS: - return "OPTIX_SUCCESS"; - case OPTIX_ERROR_INVALID_VALUE: - return "OPTIX_ERROR_INVALID_VALUE"; - case OPTIX_ERROR_UNSUPPORTED_ABI_VERSION: - return "OPTIX_ERROR_UNSUPPORTED_ABI_VERSION"; - case OPTIX_ERROR_FUNCTION_TABLE_SIZE_MISMATCH: - return "OPTIX_ERROR_FUNCTION_TABLE_SIZE_MISMATCH"; - case OPTIX_ERROR_INVALID_ENTRY_FUNCTION_OPTIONS: - return "OPTIX_ERROR_INVALID_ENTRY_FUNCTION_OPTIONS"; - case OPTIX_ERROR_LIBRARY_NOT_FOUND: - return "OPTIX_ERROR_LIBRARY_NOT_FOUND"; - case OPTIX_ERROR_ENTRY_SYMBOL_NOT_FOUND: - return "OPTIX_ERROR_ENTRY_SYMBOL_NOT_FOUND"; - default: - return "Unknown OptixResult code"; - } -} - -inline const char* optixGetErrorString( OptixResult result ) -{ - if( g_optixFunctionTable.optixGetErrorString ) - return g_optixFunctionTable.optixGetErrorString( result ); - - // If the DLL and symbol table couldn't be loaded, provide a set of error strings - // suitable for processing errors related to the DLL loading. - switch( result ) - { - case OPTIX_SUCCESS: - return "Success"; - case OPTIX_ERROR_INVALID_VALUE: - return "Invalid value"; - case OPTIX_ERROR_UNSUPPORTED_ABI_VERSION: - return "Unsupported ABI version"; - case OPTIX_ERROR_FUNCTION_TABLE_SIZE_MISMATCH: - return "Function table size mismatch"; - case OPTIX_ERROR_INVALID_ENTRY_FUNCTION_OPTIONS: - return "Invalid options to entry function"; - case OPTIX_ERROR_LIBRARY_NOT_FOUND: - return "Library not found"; - case OPTIX_ERROR_ENTRY_SYMBOL_NOT_FOUND: - return "Entry symbol not found"; - default: - return "Unknown OptixResult code"; - } -} - -inline OptixResult optixDeviceContextCreate( CUcontext fromContext, const OptixDeviceContextOptions* options, OptixDeviceContext* context ) -{ - return g_optixFunctionTable.optixDeviceContextCreate( fromContext, options, context ); -} - -inline OptixResult optixDeviceContextDestroy( OptixDeviceContext context ) -{ - return g_optixFunctionTable.optixDeviceContextDestroy( context ); -} - -inline OptixResult optixDeviceContextGetProperty( OptixDeviceContext context, OptixDeviceProperty property, void* value, size_t sizeInBytes ) -{ - return g_optixFunctionTable.optixDeviceContextGetProperty( context, property, value, sizeInBytes ); -} - -inline OptixResult optixDeviceContextSetLogCallback( OptixDeviceContext context, - OptixLogCallback callbackFunction, - void* callbackData, - unsigned int callbackLevel ) -{ - return g_optixFunctionTable.optixDeviceContextSetLogCallback( context, callbackFunction, callbackData, callbackLevel ); -} - -inline OptixResult optixDeviceContextSetCacheEnabled( OptixDeviceContext context, int enabled ) -{ - return g_optixFunctionTable.optixDeviceContextSetCacheEnabled( context, enabled ); -} - -inline OptixResult optixDeviceContextSetCacheLocation( OptixDeviceContext context, const char* location ) -{ - return g_optixFunctionTable.optixDeviceContextSetCacheLocation( context, location ); -} - -inline OptixResult optixDeviceContextSetCacheDatabaseSizes( OptixDeviceContext context, size_t lowWaterMark, size_t highWaterMark ) -{ - return g_optixFunctionTable.optixDeviceContextSetCacheDatabaseSizes( context, lowWaterMark, highWaterMark ); -} - -inline OptixResult optixDeviceContextGetCacheEnabled( OptixDeviceContext context, int* enabled ) -{ - return g_optixFunctionTable.optixDeviceContextGetCacheEnabled( context, enabled ); -} - -inline OptixResult optixDeviceContextGetCacheLocation( OptixDeviceContext context, char* location, size_t locationSize ) -{ - return g_optixFunctionTable.optixDeviceContextGetCacheLocation( context, location, locationSize ); -} - -inline OptixResult optixDeviceContextGetCacheDatabaseSizes( OptixDeviceContext context, size_t* lowWaterMark, size_t* highWaterMark ) -{ - return g_optixFunctionTable.optixDeviceContextGetCacheDatabaseSizes( context, lowWaterMark, highWaterMark ); -} - -inline OptixResult optixModuleCreateFromPTX( OptixDeviceContext context, - const OptixModuleCompileOptions* moduleCompileOptions, - const OptixPipelineCompileOptions* pipelineCompileOptions, - const char* PTX, - size_t PTXsize, - char* logString, - size_t* logStringSize, - OptixModule* module ) -{ - return g_optixFunctionTable.optixModuleCreateFromPTX( context, moduleCompileOptions, pipelineCompileOptions, PTX, - PTXsize, logString, logStringSize, module ); -} - -inline OptixResult optixModuleDestroy( OptixModule module ) -{ - return g_optixFunctionTable.optixModuleDestroy( module ); -} - -inline OptixResult optixBuiltinISModuleGet( OptixDeviceContext context, - const OptixModuleCompileOptions* moduleCompileOptions, - const OptixPipelineCompileOptions* pipelineCompileOptions, - const OptixBuiltinISOptions* builtinISOptions, - OptixModule* builtinModule ) -{ - return g_optixFunctionTable.optixBuiltinISModuleGet( context, moduleCompileOptions, pipelineCompileOptions, - builtinISOptions, builtinModule ); -} - -inline OptixResult optixProgramGroupCreate( OptixDeviceContext context, - const OptixProgramGroupDesc* programDescriptions, - unsigned int numProgramGroups, - const OptixProgramGroupOptions* options, - char* logString, - size_t* logStringSize, - OptixProgramGroup* programGroups ) -{ - return g_optixFunctionTable.optixProgramGroupCreate( context, programDescriptions, numProgramGroups, options, - logString, logStringSize, programGroups ); -} - -inline OptixResult optixProgramGroupDestroy( OptixProgramGroup programGroup ) -{ - return g_optixFunctionTable.optixProgramGroupDestroy( programGroup ); -} - -inline OptixResult optixProgramGroupGetStackSize( OptixProgramGroup programGroup, OptixStackSizes* stackSizes ) -{ - return g_optixFunctionTable.optixProgramGroupGetStackSize( programGroup, stackSizes ); -} - -inline OptixResult optixPipelineCreate( OptixDeviceContext context, - const OptixPipelineCompileOptions* pipelineCompileOptions, - const OptixPipelineLinkOptions* pipelineLinkOptions, - const OptixProgramGroup* programGroups, - unsigned int numProgramGroups, - char* logString, - size_t* logStringSize, - OptixPipeline* pipeline ) -{ - return g_optixFunctionTable.optixPipelineCreate( context, pipelineCompileOptions, pipelineLinkOptions, programGroups, - numProgramGroups, logString, logStringSize, pipeline ); -} - -inline OptixResult optixPipelineDestroy( OptixPipeline pipeline ) -{ - return g_optixFunctionTable.optixPipelineDestroy( pipeline ); -} - -inline OptixResult optixPipelineSetStackSize( OptixPipeline pipeline, - unsigned int directCallableStackSizeFromTraversal, - unsigned int directCallableStackSizeFromState, - unsigned int continuationStackSize, - unsigned int maxTraversableGraphDepth ) -{ - return g_optixFunctionTable.optixPipelineSetStackSize( pipeline, directCallableStackSizeFromTraversal, directCallableStackSizeFromState, - continuationStackSize, maxTraversableGraphDepth ); -} - -inline OptixResult optixAccelComputeMemoryUsage( OptixDeviceContext context, - const OptixAccelBuildOptions* accelOptions, - const OptixBuildInput* buildInputs, - unsigned int numBuildInputs, - OptixAccelBufferSizes* bufferSizes ) -{ - return g_optixFunctionTable.optixAccelComputeMemoryUsage( context, accelOptions, buildInputs, numBuildInputs, bufferSizes ); -} - -inline OptixResult optixAccelBuild( OptixDeviceContext context, - CUstream stream, - const OptixAccelBuildOptions* accelOptions, - const OptixBuildInput* buildInputs, - unsigned int numBuildInputs, - CUdeviceptr tempBuffer, - size_t tempBufferSizeInBytes, - CUdeviceptr outputBuffer, - size_t outputBufferSizeInBytes, - OptixTraversableHandle* outputHandle, - const OptixAccelEmitDesc* emittedProperties, - unsigned int numEmittedProperties ) -{ - return g_optixFunctionTable.optixAccelBuild( context, stream, accelOptions, buildInputs, numBuildInputs, tempBuffer, - tempBufferSizeInBytes, outputBuffer, outputBufferSizeInBytes, - outputHandle, emittedProperties, numEmittedProperties ); -} - - -inline OptixResult optixAccelGetRelocationInfo( OptixDeviceContext context, OptixTraversableHandle handle, OptixAccelRelocationInfo* info ) -{ - return g_optixFunctionTable.optixAccelGetRelocationInfo( context, handle, info ); -} - - -inline OptixResult optixAccelCheckRelocationCompatibility( OptixDeviceContext context, const OptixAccelRelocationInfo* info, int* compatible ) -{ - return g_optixFunctionTable.optixAccelCheckRelocationCompatibility( context, info, compatible ); -} - -inline OptixResult optixAccelRelocate( OptixDeviceContext context, - CUstream stream, - const OptixAccelRelocationInfo* info, - CUdeviceptr instanceTraversableHandles, - size_t numInstanceTraversableHandles, - CUdeviceptr targetAccel, - size_t targetAccelSizeInBytes, - OptixTraversableHandle* targetHandle ) -{ - return g_optixFunctionTable.optixAccelRelocate( context, stream, info, instanceTraversableHandles, numInstanceTraversableHandles, - targetAccel, targetAccelSizeInBytes, targetHandle ); -} - -inline OptixResult optixAccelCompact( OptixDeviceContext context, - CUstream stream, - OptixTraversableHandle inputHandle, - CUdeviceptr outputBuffer, - size_t outputBufferSizeInBytes, - OptixTraversableHandle* outputHandle ) -{ - return g_optixFunctionTable.optixAccelCompact( context, stream, inputHandle, outputBuffer, outputBufferSizeInBytes, outputHandle ); -} - -inline OptixResult optixConvertPointerToTraversableHandle( OptixDeviceContext onDevice, - CUdeviceptr pointer, - OptixTraversableType traversableType, - OptixTraversableHandle* traversableHandle ) -{ - return g_optixFunctionTable.optixConvertPointerToTraversableHandle( onDevice, pointer, traversableType, traversableHandle ); -} - -inline OptixResult optixSbtRecordPackHeader( OptixProgramGroup programGroup, void* sbtRecordHeaderHostPointer ) -{ - return g_optixFunctionTable.optixSbtRecordPackHeader( programGroup, sbtRecordHeaderHostPointer ); -} - -inline OptixResult optixLaunch( OptixPipeline pipeline, - CUstream stream, - CUdeviceptr pipelineParams, - size_t pipelineParamsSize, - const OptixShaderBindingTable* sbt, - unsigned int width, - unsigned int height, - unsigned int depth ) -{ - return g_optixFunctionTable.optixLaunch( pipeline, stream, pipelineParams, pipelineParamsSize, sbt, width, height, depth ); -} - -inline OptixResult optixDenoiserCreate( OptixDeviceContext context, const OptixDenoiserOptions* options, OptixDenoiser* returnHandle ) -{ - return g_optixFunctionTable.optixDenoiserCreate( context, options, returnHandle ); -} - -inline OptixResult optixDenoiserDestroy( OptixDenoiser handle ) -{ - return g_optixFunctionTable.optixDenoiserDestroy( handle ); -} - -inline OptixResult optixDenoiserComputeMemoryResources( const OptixDenoiser handle, - unsigned int maximumInputWidth, - unsigned int maximumInputHeight, - OptixDenoiserSizes* returnSizes ) -{ - return g_optixFunctionTable.optixDenoiserComputeMemoryResources( handle, maximumInputWidth, maximumInputHeight, returnSizes ); -} - -inline OptixResult optixDenoiserSetup( OptixDenoiser denoiser, - CUstream stream, - unsigned int inputWidth, - unsigned int inputHeight, - CUdeviceptr denoiserState, - size_t denoiserStateSizeInBytes, - CUdeviceptr scratch, - size_t scratchSizeInBytes ) -{ - return g_optixFunctionTable.optixDenoiserSetup( denoiser, stream, inputWidth, inputHeight, denoiserState, - denoiserStateSizeInBytes, scratch, scratchSizeInBytes ); -} - -inline OptixResult optixDenoiserInvoke( OptixDenoiser handle, - CUstream stream, - const OptixDenoiserParams* params, - CUdeviceptr denoiserData, - size_t denoiserDataSize, - const OptixImage2D* inputLayers, - unsigned int numInputLayers, - unsigned int inputOffsetX, - unsigned int inputOffsetY, - const OptixImage2D* outputLayer, - CUdeviceptr scratch, - size_t scratchSizeInBytes ) -{ - return g_optixFunctionTable.optixDenoiserInvoke( handle, stream, params, denoiserData, denoiserDataSize, - inputLayers, numInputLayers, inputOffsetX, inputOffsetY, - outputLayer, scratch, scratchSizeInBytes ); -} - -inline OptixResult optixDenoiserSetModel( OptixDenoiser handle, OptixDenoiserModelKind kind, void* data, size_t sizeInBytes ) -{ - return g_optixFunctionTable.optixDenoiserSetModel( handle, kind, data, sizeInBytes ); -} - -inline OptixResult optixDenoiserComputeIntensity( OptixDenoiser handle, - CUstream stream, - const OptixImage2D* inputImage, - CUdeviceptr outputIntensity, - CUdeviceptr scratch, - size_t scratchSizeInBytes ) -{ - return g_optixFunctionTable.optixDenoiserComputeIntensity( handle, stream, inputImage, outputIntensity, scratch, scratchSizeInBytes ); -} - -#endif // OPTIX_DOXYGEN_SHOULD_SKIP_THIS - -#ifdef __cplusplus -} -#endif - -#endif // __optix_optix_stubs_h__ diff --git a/crtx/optix_7.1/optix_types.h b/crtx/optix_7.1/optix_types.h deleted file mode 100644 index 0b013e0..0000000 --- a/crtx/optix_7.1/optix_types.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2020 NVIDIA Corporation. All rights reserved. - * - * NVIDIA Corporation and its licensors retain all intellectual property and proprietary - * rights in and to this software, related documentation and any modifications thereto. - * Any use, reproduction, disclosure or distribution of this software and related - * documentation without an express license agreement from NVIDIA Corporation is strictly - * prohibited. - * - * TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS* - * AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, - * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY - * SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT - * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF - * BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR - * INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGES - */ - -/** - * @file optix_types.h - * @author NVIDIA Corporation - * @brief OptiX public API header - * - */ - -#ifndef __optix_optix_types_h__ -#define __optix_optix_types_h__ - -// clang-format off -#if !defined(__OPTIX_INCLUDE_INTERNAL_HEADERS__) -# define __OPTIX_INCLUDE_INTERNAL_HEADERS__ -# define __UNDEF_OPTIX_INCLUDE_INTERNAL_HEADERS_OPTIX_TYPES_H__ -#endif -#include "optix_7_types.h" -#if defined( __UNDEF_OPTIX_INCLUDE_INTERNAL_HEADERS_OPTIX_TYPES_H__ ) -# undef __OPTIX_INCLUDE_INTERNAL_HEADERS__ -# undef __UNDEF_OPTIX_INCLUDE_INTERNAL_HEADERS_OPTIX_TYPES_H__ -#endif -// clang-format on - -#endif // #ifndef __optix_optix_types_h__ diff --git a/crtx/optix_9.1/internal/optix_device_impl.h b/crtx/optix_9.1/internal/optix_device_impl.h deleted file mode 100644 index 556fd85..0000000 --- a/crtx/optix_9.1/internal/optix_device_impl.h +++ /dev/null @@ -1,2785 +0,0 @@ -/* -* SPDX-FileCopyrightText: Copyright (c) 2019 - 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -* SPDX-License-Identifier: LicenseRef-NvidiaProprietary -* -* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual -* property and proprietary rights in and to this material, related -* documentation and any modifications thereto. Any use, reproduction, -* disclosure or distribution of this material and related documentation -* without an express license agreement from NVIDIA CORPORATION or -* its affiliates is strictly prohibited. -*/ -/** -* @file optix_device_impl.h -* @author NVIDIA Corporation -* @brief OptiX public API -* -* OptiX public API Reference - Device side implementation -*/ - -#if !defined( __OPTIX_INCLUDE_INTERNAL_HEADERS__ ) -#error("optix_device_impl.h is an internal header file and must not be used directly. Please use optix_device.h or optix.h instead.") -#endif - -#ifndef OPTIX_OPTIX_DEVICE_IMPL_H -#define OPTIX_OPTIX_DEVICE_IMPL_H - -#include "internal/optix_device_impl_transformations.h" - -#ifndef __CUDACC_RTC__ -#include -#include -#endif - -namespace optix_internal { -template -struct TypePack{}; -} // namespace optix_internal - -template -static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex, - Payload&... payload ) -{ - static_assert( sizeof...( Payload ) <= 32, "Only up to 32 payload values are allowed." ); - // std::is_same compares each type in the two TypePacks to make sure that all types are unsigned int. - // TypePack 1 unsigned int T0 T1 T2 ... Tn-1 Tn - // TypePack 2 T0 T1 T2 T3 ... Tn unsigned int -#ifndef __CUDACC_RTC__ - static_assert( std::is_same, optix_internal::TypePack>::value, - "All payload parameters need to be unsigned int." ); -#endif - - OptixPayloadTypeID type = OPTIX_PAYLOAD_TYPE_DEFAULT; - float ox = rayOrigin.x, oy = rayOrigin.y, oz = rayOrigin.z; - float dx = rayDirection.x, dy = rayDirection.y, dz = rayDirection.z; - unsigned int p[33] = { 0, payload... }; - int payloadSize = (int)sizeof...( Payload ); - asm volatile( - "call" - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%17,%18,%19,%20,%21,%22,%23,%24,%25,%26,%27,%28,%" - "29,%30,%31)," - "_optix_trace_typed_32," - "(%32,%33,%34,%35,%36,%37,%38,%39,%40,%41,%42,%43,%44,%45,%46,%47,%48,%49,%50,%51,%52,%53,%54,%55,%56,%57,%58,%" - "59,%60,%61,%62,%63,%64,%65,%66,%67,%68,%69,%70,%71,%72,%73,%74,%75,%76,%77,%78,%79,%80);" - : "=r"( p[1] ), "=r"( p[2] ), "=r"( p[3] ), "=r"( p[4] ), "=r"( p[5] ), "=r"( p[6] ), "=r"( p[7] ), - "=r"( p[8] ), "=r"( p[9] ), "=r"( p[10] ), "=r"( p[11] ), "=r"( p[12] ), "=r"( p[13] ), "=r"( p[14] ), - "=r"( p[15] ), "=r"( p[16] ), "=r"( p[17] ), "=r"( p[18] ), "=r"( p[19] ), "=r"( p[20] ), "=r"( p[21] ), - "=r"( p[22] ), "=r"( p[23] ), "=r"( p[24] ), "=r"( p[25] ), "=r"( p[26] ), "=r"( p[27] ), "=r"( p[28] ), - "=r"( p[29] ), "=r"( p[30] ), "=r"( p[31] ), "=r"( p[32] ) - : "r"( type ), "l"( handle ), "f"( ox ), "f"( oy ), "f"( oz ), "f"( dx ), "f"( dy ), "f"( dz ), "f"( tmin ), - "f"( tmax ), "f"( rayTime ), "r"( visibilityMask ), "r"( rayFlags ), "r"( SBToffset ), "r"( SBTstride ), - "r"( missSBTIndex ), "r"( payloadSize ), "r"( p[1] ), "r"( p[2] ), "r"( p[3] ), "r"( p[4] ), "r"( p[5] ), - "r"( p[6] ), "r"( p[7] ), "r"( p[8] ), "r"( p[9] ), "r"( p[10] ), "r"( p[11] ), "r"( p[12] ), "r"( p[13] ), - "r"( p[14] ), "r"( p[15] ), "r"( p[16] ), "r"( p[17] ), "r"( p[18] ), "r"( p[19] ), "r"( p[20] ), - "r"( p[21] ), "r"( p[22] ), "r"( p[23] ), "r"( p[24] ), "r"( p[25] ), "r"( p[26] ), "r"( p[27] ), - "r"( p[28] ), "r"( p[29] ), "r"( p[30] ), "r"( p[31] ), "r"( p[32] ) - : ); - unsigned int index = 1; - (void)std::initializer_list{index, ( payload = p[index++] )...}; -} - -template -static __forceinline__ __device__ void optixTraverse( OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex, - Payload&... payload ) -{ - static_assert( sizeof...( Payload ) <= 32, "Only up to 32 payload values are allowed." ); - // std::is_same compares each type in the two TypePacks to make sure that all types are unsigned int. - // TypePack 1 unsigned int T0 T1 T2 ... Tn-1 Tn - // TypePack 2 T0 T1 T2 T3 ... Tn unsigned int -#ifndef __CUDACC_RTC__ - static_assert( std::is_same, optix_internal::TypePack>::value, - "All payload parameters need to be unsigned int." ); -#endif - - OptixPayloadTypeID type = OPTIX_PAYLOAD_TYPE_DEFAULT; - float ox = rayOrigin.x, oy = rayOrigin.y, oz = rayOrigin.z; - float dx = rayDirection.x, dy = rayDirection.y, dz = rayDirection.z; - unsigned int p[33] = {0, payload...}; - int payloadSize = (int)sizeof...( Payload ); - asm volatile( - "call" - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%17,%18,%19,%20,%21,%22,%23,%24,%25,%26,%27,%28,%" - "29,%30,%31)," - "_optix_hitobject_traverse," - "(%32,%33,%34,%35,%36,%37,%38,%39,%40,%41,%42,%43,%44,%45,%46,%47,%48,%49,%50,%51,%52,%53,%54,%55,%56,%57,%58,%" - "59,%60,%61,%62,%63,%64,%65,%66,%67,%68,%69,%70,%71,%72,%73,%74,%75,%76,%77,%78,%79,%80);" - : "=r"( p[1] ), "=r"( p[2] ), "=r"( p[3] ), "=r"( p[4] ), "=r"( p[5] ), "=r"( p[6] ), "=r"( p[7] ), - "=r"( p[8] ), "=r"( p[9] ), "=r"( p[10] ), "=r"( p[11] ), "=r"( p[12] ), "=r"( p[13] ), "=r"( p[14] ), - "=r"( p[15] ), "=r"( p[16] ), "=r"( p[17] ), "=r"( p[18] ), "=r"( p[19] ), "=r"( p[20] ), "=r"( p[21] ), - "=r"( p[22] ), "=r"( p[23] ), "=r"( p[24] ), "=r"( p[25] ), "=r"( p[26] ), "=r"( p[27] ), "=r"( p[28] ), - "=r"( p[29] ), "=r"( p[30] ), "=r"( p[31] ), "=r"( p[32] ) - : "r"( type ), "l"( handle ), "f"( ox ), "f"( oy ), "f"( oz ), "f"( dx ), "f"( dy ), "f"( dz ), "f"( tmin ), - "f"( tmax ), "f"( rayTime ), "r"( visibilityMask ), "r"( rayFlags ), "r"( SBToffset ), "r"( SBTstride ), - "r"( missSBTIndex ), "r"( payloadSize ), "r"( p[1] ), "r"( p[2] ), "r"( p[3] ), "r"( p[4] ), "r"( p[5] ), - "r"( p[6] ), "r"( p[7] ), "r"( p[8] ), "r"( p[9] ), "r"( p[10] ), "r"( p[11] ), "r"( p[12] ), "r"( p[13] ), - "r"( p[14] ), "r"( p[15] ), "r"( p[16] ), "r"( p[17] ), "r"( p[18] ), "r"( p[19] ), "r"( p[20] ), - "r"( p[21] ), "r"( p[22] ), "r"( p[23] ), "r"( p[24] ), "r"( p[25] ), "r"( p[26] ), "r"( p[27] ), - "r"( p[28] ), "r"( p[29] ), "r"( p[30] ), "r"( p[31] ), "r"( p[32] ) - : ); - unsigned int index = 1; - (void)std::initializer_list{index, ( payload = p[index++] )...}; -} - -template -static __forceinline__ __device__ void optixTrace( OptixPayloadTypeID type, - OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex, - Payload&... payload ) -{ - // std::is_same compares each type in the two TypePacks to make sure that all types are unsigned int. - // TypePack 1 unsigned int T0 T1 T2 ... Tn-1 Tn - // TypePack 2 T0 T1 T2 T3 ... Tn unsigned int - static_assert( sizeof...( Payload ) <= 32, "Only up to 32 payload values are allowed." ); -#ifndef __CUDACC_RTC__ - static_assert( std::is_same, optix_internal::TypePack>::value, - "All payload parameters need to be unsigned int." ); -#endif - - float ox = rayOrigin.x, oy = rayOrigin.y, oz = rayOrigin.z; - float dx = rayDirection.x, dy = rayDirection.y, dz = rayDirection.z; - unsigned int p[33] = {0, payload...}; - int payloadSize = (int)sizeof...( Payload ); - - asm volatile( - "call" - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%17,%18,%19,%20,%21,%22,%23,%24,%25,%26,%27,%28,%" - "29,%30,%31)," - "_optix_trace_typed_32," - "(%32,%33,%34,%35,%36,%37,%38,%39,%40,%41,%42,%43,%44,%45,%46,%47,%48,%49,%50,%51,%52,%53,%54,%55,%56,%57,%58,%" - "59,%60,%61,%62,%63,%64,%65,%66,%67,%68,%69,%70,%71,%72,%73,%74,%75,%76,%77,%78,%79,%80);" - : "=r"( p[1] ), "=r"( p[2] ), "=r"( p[3] ), "=r"( p[4] ), "=r"( p[5] ), "=r"( p[6] ), "=r"( p[7] ), - "=r"( p[8] ), "=r"( p[9] ), "=r"( p[10] ), "=r"( p[11] ), "=r"( p[12] ), "=r"( p[13] ), "=r"( p[14] ), - "=r"( p[15] ), "=r"( p[16] ), "=r"( p[17] ), "=r"( p[18] ), "=r"( p[19] ), "=r"( p[20] ), "=r"( p[21] ), - "=r"( p[22] ), "=r"( p[23] ), "=r"( p[24] ), "=r"( p[25] ), "=r"( p[26] ), "=r"( p[27] ), "=r"( p[28] ), - "=r"( p[29] ), "=r"( p[30] ), "=r"( p[31] ), "=r"( p[32] ) - : "r"( type ), "l"( handle ), "f"( ox ), "f"( oy ), "f"( oz ), "f"( dx ), "f"( dy ), "f"( dz ), "f"( tmin ), - "f"( tmax ), "f"( rayTime ), "r"( visibilityMask ), "r"( rayFlags ), "r"( SBToffset ), "r"( SBTstride ), - "r"( missSBTIndex ), "r"( payloadSize ), "r"( p[1] ), "r"( p[2] ), "r"( p[3] ), "r"( p[4] ), "r"( p[5] ), - "r"( p[6] ), "r"( p[7] ), "r"( p[8] ), "r"( p[9] ), "r"( p[10] ), "r"( p[11] ), "r"( p[12] ), "r"( p[13] ), - "r"( p[14] ), "r"( p[15] ), "r"( p[16] ), "r"( p[17] ), "r"( p[18] ), "r"( p[19] ), "r"( p[20] ), - "r"( p[21] ), "r"( p[22] ), "r"( p[23] ), "r"( p[24] ), "r"( p[25] ), "r"( p[26] ), "r"( p[27] ), - "r"( p[28] ), "r"( p[29] ), "r"( p[30] ), "r"( p[31] ), "r"( p[32] ) - : ); - unsigned int index = 1; - (void)std::initializer_list{index, ( payload = p[index++] )...}; -} - -template -static __forceinline__ __device__ void optixTraverse( OptixPayloadTypeID type, - OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex, - Payload&... payload ) -{ - // std::is_same compares each type in the two TypePacks to make sure that all types are unsigned int. - // TypePack 1 unsigned int T0 T1 T2 ... Tn-1 Tn - // TypePack 2 T0 T1 T2 T3 ... Tn unsigned int - static_assert( sizeof...( Payload ) <= 32, "Only up to 32 payload values are allowed." ); -#ifndef __CUDACC_RTC__ - static_assert( std::is_same, optix_internal::TypePack>::value, - "All payload parameters need to be unsigned int." ); -#endif - - float ox = rayOrigin.x, oy = rayOrigin.y, oz = rayOrigin.z; - float dx = rayDirection.x, dy = rayDirection.y, dz = rayDirection.z; - unsigned int p[33] = {0, payload...}; - int payloadSize = (int)sizeof...( Payload ); - asm volatile( - "call" - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%17,%18,%19,%20,%21,%22,%23,%24,%25,%26,%27,%28,%" - "29,%30,%31)," - "_optix_hitobject_traverse," - "(%32,%33,%34,%35,%36,%37,%38,%39,%40,%41,%42,%43,%44,%45,%46,%47,%48,%49,%50,%51,%52,%53,%54,%55,%56,%57,%58,%" - "59,%60,%61,%62,%63,%64,%65,%66,%67,%68,%69,%70,%71,%72,%73,%74,%75,%76,%77,%78,%79,%80);" - : "=r"( p[1] ), "=r"( p[2] ), "=r"( p[3] ), "=r"( p[4] ), "=r"( p[5] ), "=r"( p[6] ), "=r"( p[7] ), - "=r"( p[8] ), "=r"( p[9] ), "=r"( p[10] ), "=r"( p[11] ), "=r"( p[12] ), "=r"( p[13] ), "=r"( p[14] ), - "=r"( p[15] ), "=r"( p[16] ), "=r"( p[17] ), "=r"( p[18] ), "=r"( p[19] ), "=r"( p[20] ), "=r"( p[21] ), - "=r"( p[22] ), "=r"( p[23] ), "=r"( p[24] ), "=r"( p[25] ), "=r"( p[26] ), "=r"( p[27] ), "=r"( p[28] ), - "=r"( p[29] ), "=r"( p[30] ), "=r"( p[31] ), "=r"( p[32] ) - : "r"( type ), "l"( handle ), "f"( ox ), "f"( oy ), "f"( oz ), "f"( dx ), "f"( dy ), "f"( dz ), "f"( tmin ), - "f"( tmax ), "f"( rayTime ), "r"( visibilityMask ), "r"( rayFlags ), "r"( SBToffset ), "r"( SBTstride ), - "r"( missSBTIndex ), "r"( payloadSize ), "r"( p[1] ), "r"( p[2] ), "r"( p[3] ), "r"( p[4] ), "r"( p[5] ), - "r"( p[6] ), "r"( p[7] ), "r"( p[8] ), "r"( p[9] ), "r"( p[10] ), "r"( p[11] ), "r"( p[12] ), "r"( p[13] ), - "r"( p[14] ), "r"( p[15] ), "r"( p[16] ), "r"( p[17] ), "r"( p[18] ), "r"( p[19] ), "r"( p[20] ), - "r"( p[21] ), "r"( p[22] ), "r"( p[23] ), "r"( p[24] ), "r"( p[25] ), "r"( p[26] ), "r"( p[27] ), - "r"( p[28] ), "r"( p[29] ), "r"( p[30] ), "r"( p[31] ), "r"( p[32] ) - : ); - unsigned int index = 1; - (void)std::initializer_list{index, ( payload = p[index++] )...}; -} - -static __forceinline__ __device__ void optixReorder( unsigned int coherenceHint, unsigned int numCoherenceHintBits ) -{ - asm volatile( - "call" - "()," - "_optix_hitobject_reorder," - "(%0,%1);" - : - : "r"( coherenceHint ), "r"( numCoherenceHintBits ) - : ); -} - -static __forceinline__ __device__ void optixReorder() -{ - unsigned int coherenceHint = 0; - unsigned int numCoherenceHintBits = 0; - asm volatile( - "call" - "()," - "_optix_hitobject_reorder," - "(%0,%1);" - : - : "r"( coherenceHint ), "r"( numCoherenceHintBits ) - : ); -} - -template -static __forceinline__ __device__ void optixInvoke( OptixPayloadTypeID type, Payload&... payload ) -{ - // std::is_same compares each type in the two TypePacks to make sure that all types are unsigned int. - // TypePack 1 unsigned int T0 T1 T2 ... Tn-1 Tn - // TypePack 2 T0 T1 T2 T3 ... Tn unsigned int - static_assert( sizeof...( Payload ) <= 32, "Only up to 32 payload values are allowed." ); -#ifndef __CUDACC_RTC__ - static_assert( std::is_same, optix_internal::TypePack>::value, - "All payload parameters need to be unsigned int." ); -#endif - - unsigned int p[33] = {0, payload...}; - int payloadSize = (int)sizeof...( Payload ); - - asm volatile( - "call" - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%17,%18,%19,%20,%21,%22,%23,%24,%25,%26,%27,%28,%" - "29,%30,%31)," - "_optix_hitobject_invoke," - "(%32,%33,%34,%35,%36,%37,%38,%39,%40,%41,%42,%43,%44,%45,%46,%47,%48,%49,%50,%51,%52,%53,%54,%55,%56,%57,%58,%" - "59,%60,%61,%62,%63,%64,%65);" - : "=r"( p[1] ), "=r"( p[2] ), "=r"( p[3] ), "=r"( p[4] ), "=r"( p[5] ), "=r"( p[6] ), "=r"( p[7] ), - "=r"( p[8] ), "=r"( p[9] ), "=r"( p[10] ), "=r"( p[11] ), "=r"( p[12] ), "=r"( p[13] ), "=r"( p[14] ), - "=r"( p[15] ), "=r"( p[16] ), "=r"( p[17] ), "=r"( p[18] ), "=r"( p[19] ), "=r"( p[20] ), "=r"( p[21] ), - "=r"( p[22] ), "=r"( p[23] ), "=r"( p[24] ), "=r"( p[25] ), "=r"( p[26] ), "=r"( p[27] ), "=r"( p[28] ), - "=r"( p[29] ), "=r"( p[30] ), "=r"( p[31] ), "=r"( p[32] ) - : "r"( type ), "r"( payloadSize ), "r"( p[1] ), "r"( p[2] ), - "r"( p[3] ), "r"( p[4] ), "r"( p[5] ), "r"( p[6] ), "r"( p[7] ), "r"( p[8] ), "r"( p[9] ), "r"( p[10] ), - "r"( p[11] ), "r"( p[12] ), "r"( p[13] ), "r"( p[14] ), "r"( p[15] ), "r"( p[16] ), "r"( p[17] ), - "r"( p[18] ), "r"( p[19] ), "r"( p[20] ), "r"( p[21] ), "r"( p[22] ), "r"( p[23] ), "r"( p[24] ), - "r"( p[25] ), "r"( p[26] ), "r"( p[27] ), "r"( p[28] ), "r"( p[29] ), "r"( p[30] ), "r"( p[31] ), "r"( p[32] ) - : ); - - unsigned int index = 1; - (void)std::initializer_list{index, ( payload = p[index++] )...}; -} - -template -static __forceinline__ __device__ void optixInvoke( Payload&... payload ) -{ - // std::is_same compares each type in the two TypePacks to make sure that all types are unsigned int. - // TypePack 1 unsigned int T0 T1 T2 ... Tn-1 Tn - // TypePack 2 T0 T1 T2 T3 ... Tn unsigned int - static_assert( sizeof...( Payload ) <= 32, "Only up to 32 payload values are allowed." ); -#ifndef __CUDACC_RTC__ - static_assert( std::is_same, optix_internal::TypePack>::value, - "All payload parameters need to be unsigned int." ); -#endif - - OptixPayloadTypeID type = OPTIX_PAYLOAD_TYPE_DEFAULT; - unsigned int p[33] = {0, payload...}; - int payloadSize = (int)sizeof...( Payload ); - - asm volatile( - "call" - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%17,%18,%19,%20,%21,%22,%23,%24,%25,%26,%27,%28,%" - "29,%30,%31)," - "_optix_hitobject_invoke," - "(%32,%33,%34,%35,%36,%37,%38,%39,%40,%41,%42,%43,%44,%45,%46,%47,%48,%49,%50,%51,%52,%53,%54,%55,%56,%57,%58,%" - "59,%60,%61,%62,%63,%64,%65);" - : "=r"( p[1] ), "=r"( p[2] ), "=r"( p[3] ), "=r"( p[4] ), "=r"( p[5] ), "=r"( p[6] ), "=r"( p[7] ), - "=r"( p[8] ), "=r"( p[9] ), "=r"( p[10] ), "=r"( p[11] ), "=r"( p[12] ), "=r"( p[13] ), "=r"( p[14] ), - "=r"( p[15] ), "=r"( p[16] ), "=r"( p[17] ), "=r"( p[18] ), "=r"( p[19] ), "=r"( p[20] ), "=r"( p[21] ), - "=r"( p[22] ), "=r"( p[23] ), "=r"( p[24] ), "=r"( p[25] ), "=r"( p[26] ), "=r"( p[27] ), "=r"( p[28] ), - "=r"( p[29] ), "=r"( p[30] ), "=r"( p[31] ), "=r"( p[32] ) - : "r"( type ), "r"( payloadSize ), "r"( p[1] ), "r"( p[2] ), - "r"( p[3] ), "r"( p[4] ), "r"( p[5] ), "r"( p[6] ), "r"( p[7] ), "r"( p[8] ), "r"( p[9] ), "r"( p[10] ), - "r"( p[11] ), "r"( p[12] ), "r"( p[13] ), "r"( p[14] ), "r"( p[15] ), "r"( p[16] ), "r"( p[17] ), - "r"( p[18] ), "r"( p[19] ), "r"( p[20] ), "r"( p[21] ), "r"( p[22] ), "r"( p[23] ), "r"( p[24] ), - "r"( p[25] ), "r"( p[26] ), "r"( p[27] ), "r"( p[28] ), "r"( p[29] ), "r"( p[30] ), "r"( p[31] ), "r"( p[32] ) - : ); - - unsigned int index = 1; - (void)std::initializer_list{index, ( payload = p[index++] )...}; -} - -static __forceinline__ __device__ void optixMakeHitObject( OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float rayTime, - unsigned int rayFlags, - OptixTraverseData traverseData, - const OptixTraversableHandle* transforms, - unsigned int numTransforms ) -{ - float ox = rayOrigin.x, oy = rayOrigin.y, oz = rayOrigin.z; - float dx = rayDirection.x, dy = rayDirection.y, dz = rayDirection.z; - - asm volatile( - "call" - "()," - "_optix_hitobject_make_with_traverse_data_v2," - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%17,%18,%19,%20,%21,%22,%23,%24,%25,%26,%27,%28,%29,%30,%31);" - : - : "l"( handle ), "f"( ox ), "f"( oy ), "f"( oz ), "f"( dx ), "f"( dy ), "f"( dz ), "f"( tmin ), "f"( rayTime ), "r"( rayFlags ), - "r"( traverseData.data[0] ), "r"( traverseData.data[1] ), "r"( traverseData.data[2] ), - "r"( traverseData.data[3] ), "r"( traverseData.data[4] ), "r"( traverseData.data[5] ), - "r"( traverseData.data[6] ), "r"( traverseData.data[7] ), "r"( traverseData.data[8] ), - "r"( traverseData.data[9] ), "r"( traverseData.data[10] ), "r"( traverseData.data[11] ), - "r"( traverseData.data[12] ), "r"( traverseData.data[13] ), "r"( traverseData.data[14] ), - "r"( traverseData.data[15] ), "r"( traverseData.data[16] ), "r"( traverseData.data[17] ), - "r"( traverseData.data[18] ), "r"( traverseData.data[19] ), "l"( transforms ), "r"( numTransforms ) - : ); -} - - static __forceinline__ __device__ void optixMakeMissHitObject( unsigned int missSBTIndex, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - unsigned int rayFlags ) -{ - float ox = rayOrigin.x, oy = rayOrigin.y, oz = rayOrigin.z; - float dx = rayDirection.x, dy = rayDirection.y, dz = rayDirection.z; - - asm volatile( - "call" - "()," - "_optix_hitobject_make_miss_v2," - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10);" - : - : "r"( missSBTIndex ), "f"( ox ), "f"( oy ), "f"( oz ), "f"( dx ), "f"( dy ), "f"( dz ), "f"( tmin ), - "f"( tmax ), "f"( rayTime ), "r"( rayFlags ) - : ); -} - -static __forceinline__ __device__ void optixMakeNopHitObject() -{ - asm volatile( - "call" - "()," - "_optix_hitobject_make_nop," - "();" - : - : - : ); -} - -static __forceinline__ __device__ void optixHitObjectGetTraverseData( OptixTraverseData* data ) -{ - asm volatile( - "call" - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%17,%18,%19)," - "_optix_hitobject_get_traverse_data," - "();" - : "=r"( data->data[0] ), "=r"( data->data[1] ), "=r"( data->data[2] ), "=r"( data->data[3] ), "=r"( data->data[4] ), - "=r"( data->data[5] ), "=r"( data->data[6] ), "=r"( data->data[7] ), "=r"( data->data[8] ), "=r"( data->data[9] ), - "=r"( data->data[10] ), "=r"( data->data[11] ), "=r"( data->data[12] ), "=r"( data->data[13] ), "=r"( data->data[14] ), - "=r"( data->data[15] ), "=r"( data->data[16] ), "=r"( data->data[17] ), "=r"( data->data[18] ), "=r"( data->data[19] ) - : - : ); -} - -static __forceinline__ __device__ bool optixHitObjectIsHit() -{ - unsigned int result; - asm volatile( - "call (%0), _optix_hitobject_is_hit," - "();" - : "=r"( result ) - : - : ); - return result; -} - -static __forceinline__ __device__ bool optixHitObjectIsMiss() -{ - unsigned int result; - asm volatile( - "call (%0), _optix_hitobject_is_miss," - "();" - : "=r"( result ) - : - : ); - return result; -} - -static __forceinline__ __device__ bool optixHitObjectIsNop() -{ - unsigned int result; - asm volatile( - "call (%0), _optix_hitobject_is_nop," - "();" - : "=r"( result ) - : - : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixHitObjectGetInstanceId() -{ - unsigned int result; - asm volatile( - "call (%0), _optix_hitobject_get_instance_id," - "();" - : "=r"( result ) - : - : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixHitObjectGetInstanceIndex() -{ - unsigned int result; - asm volatile( - "call (%0), _optix_hitobject_get_instance_idx," - "();" - : "=r"( result ) - : - : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixHitObjectGetPrimitiveIndex() -{ - unsigned int result; - asm volatile( - "call (%0), _optix_hitobject_get_primitive_idx," - "();" - : "=r"( result ) - : - : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixHitObjectGetTransformListSize() -{ - unsigned int result; - asm volatile( - "call (%0), _optix_hitobject_get_transform_list_size," - "();" - : "=r"( result ) - : - : ); - return result; -} - -static __forceinline__ __device__ OptixTraversableHandle optixHitObjectGetTransformListHandle( unsigned int index ) -{ - unsigned long long result; - asm volatile( - "call (%0), _optix_hitobject_get_transform_list_handle," - "(%1);" - : "=l"( result ) - : "r"( index ) - : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixHitObjectGetSbtGASIndex() -{ - unsigned int result; - asm volatile( - "call (%0), _optix_hitobject_get_sbt_gas_idx," - "();" - : "=r"( result ) - : - : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixHitObjectGetHitKind() -{ - unsigned int result; - asm volatile( - "call (%0), _optix_hitobject_get_hitkind," - "();" - : "=r"( result ) - : - : ); - return result; -} - -static __forceinline__ __device__ float3 optixHitObjectGetWorldRayOrigin() -{ - float x, y, z; - asm volatile( - "call (%0), _optix_hitobject_get_world_ray_origin_x," - "();" - : "=f"( x ) - : - : ); - asm volatile( - "call (%0), _optix_hitobject_get_world_ray_origin_y," - "();" - : "=f"( y ) - : - : ); - asm volatile( - "call (%0), _optix_hitobject_get_world_ray_origin_z," - "();" - : "=f"( z ) - : - : ); - return make_float3( x, y, z ); -} - -static __forceinline__ __device__ float3 optixHitObjectGetWorldRayDirection() -{ - float x, y, z; - asm volatile( - "call (%0), _optix_hitobject_get_world_ray_direction_x," - "();" - : "=f"( x ) - : - : ); - asm volatile( - "call (%0), _optix_hitobject_get_world_ray_direction_y," - "();" - : "=f"( y ) - : - : ); - asm volatile( - "call (%0), _optix_hitobject_get_world_ray_direction_z," - "();" - : "=f"( z ) - : - : ); - return make_float3( x, y, z ); -} - -static __forceinline__ __device__ float optixHitObjectGetRayTmin() -{ - float result; - asm volatile( - "call (%0), _optix_hitobject_get_ray_tmin," - "();" - : "=f"( result ) - : - : ); - return result; -} - -static __forceinline__ __device__ float optixHitObjectGetRayTmax() -{ - float result; - asm volatile( - "call (%0), _optix_hitobject_get_ray_tmax," - "();" - : "=f"( result ) - : - : ); - return result; -} - -static __forceinline__ __device__ float optixHitObjectGetRayTime() -{ - float result; - asm volatile( - "call (%0), _optix_hitobject_get_ray_time," - "();" - : "=f"( result ) - : - : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixHitObjectGetAttribute_0() -{ - unsigned int ret; - asm volatile( - "call (%0), _optix_hitobject_get_attribute," - "(%1);" - : "=r"( ret ) - : "r"( 0 ) - : ); - return ret; -} - -static __forceinline__ __device__ unsigned int optixHitObjectGetAttribute_1() -{ - unsigned int ret; - asm volatile( - "call (%0), _optix_hitobject_get_attribute," - "(%1);" - : "=r"( ret ) - : "r"( 1 ) - : ); - return ret; -} - -static __forceinline__ __device__ unsigned int optixHitObjectGetAttribute_2() -{ - unsigned int ret; - asm volatile( - "call (%0), _optix_hitobject_get_attribute," - "(%1);" - : "=r"( ret ) - : "r"( 2 ) - : ); - return ret; -} - -static __forceinline__ __device__ unsigned int optixHitObjectGetAttribute_3() -{ - unsigned int ret; - asm volatile( - "call (%0), _optix_hitobject_get_attribute," - "(%1);" - : "=r"( ret ) - : "r"( 3 ) - : ); - return ret; -} - -static __forceinline__ __device__ unsigned int optixHitObjectGetAttribute_4() -{ - unsigned int ret; - asm volatile( - "call (%0), _optix_hitobject_get_attribute," - "(%1);" - : "=r"( ret ) - : "r"( 4 ) - : ); - return ret; -} - -static __forceinline__ __device__ unsigned int optixHitObjectGetAttribute_5() -{ - unsigned int ret; - asm volatile( - "call (%0), _optix_hitobject_get_attribute," - "(%1);" - : "=r"( ret ) - : "r"( 5 ) - : ); - return ret; -} - -static __forceinline__ __device__ unsigned int optixHitObjectGetAttribute_6() -{ - unsigned int ret; - asm volatile( - "call (%0), _optix_hitobject_get_attribute," - "(%1);" - : "=r"( ret ) - : "r"( 6 ) - : ); - return ret; -} - -static __forceinline__ __device__ unsigned int optixHitObjectGetAttribute_7() -{ - unsigned int ret; - asm volatile( - "call (%0), _optix_hitobject_get_attribute," - "(%1);" - : "=r"( ret ) - : "r"( 7 ) - : ); - return ret; -} - -static __forceinline__ __device__ unsigned int optixHitObjectGetSbtRecordIndex() -{ - unsigned int result; - asm volatile( - "call (%0), _optix_hitobject_get_sbt_record_index," - "();" - : "=r"( result ) - : - : ); - return result; -} - -static __forceinline__ __device__ void optixHitObjectSetSbtRecordIndex( unsigned int sbtRecordIndex ) -{ - asm volatile( - "call (), _optix_hitobject_set_sbt_record_index," - "(%0);" - : - : "r"(sbtRecordIndex) - : ); -} - -static __forceinline__ __device__ CUdeviceptr optixHitObjectGetSbtDataPointer() -{ - unsigned long long ptr; - asm volatile( - "call (%0), _optix_hitobject_get_sbt_data_pointer," - "();" - : "=l"( ptr ) - : - : ); - return ptr; -} - - -static __forceinline__ __device__ OptixTraversableHandle optixHitObjectGetGASTraversableHandle() -{ - unsigned long long handle; - asm( "call (%0), _optix_hitobject_get_gas_traversable_handle, ();" : "=l"( handle ) : ); - return (OptixTraversableHandle)handle; -} - - -static __forceinline__ __device__ unsigned int optixHitObjectGetRayFlags() -{ - unsigned int u0; - asm( "call (%0), _optix_hitobject_get_ray_flags, ();" : "=r"( u0 ) : ); - return u0; -} - - -static __forceinline__ __device__ void optixSetPayload_0( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 0 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_1( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 1 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_2( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 2 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_3( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 3 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_4( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 4 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_5( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 5 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_6( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 6 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_7( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 7 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_8( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 8 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_9( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 9 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_10( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 10 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_11( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 11 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_12( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 12 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_13( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 13 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_14( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 14 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_15( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 15 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_16( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 16 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_17( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 17 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_18( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 18 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_19( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 19 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_20( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 20 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_21( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 21 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_22( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 22 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_23( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 23 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_24( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 24 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_25( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 25 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_26( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 26 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_27( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 27 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_28( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 28 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_29( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 29 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_30( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 30 ), "r"( p ) : ); -} - -static __forceinline__ __device__ void optixSetPayload_31( unsigned int p ) -{ - asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 31 ), "r"( p ) : ); -} - -static __forceinline__ __device__ unsigned int optixGetPayload_0() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 0 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_1() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 1 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_2() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 2 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_3() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 3 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_4() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 4 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_5() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 5 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_6() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 6 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_7() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 7 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_8() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 8 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_9() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 9 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_10() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 10 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_11() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 11 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_12() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 12 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_13() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 13 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_14() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 14 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_15() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 15 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_16() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 16 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_17() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 17 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_18() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 18 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_19() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 19 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_20() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 20 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_21() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 21 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_22() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 22 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_23() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 23 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_24() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 24 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_25() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 25 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_26() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 26 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_27() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 27 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_28() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 28 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_29() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 29 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_30() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 30 ) : ); - return result; -} - -static __forceinline__ __device__ unsigned int optixGetPayload_31() -{ - unsigned int result; - asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 31 ) : ); - return result; -} - -static __forceinline__ __device__ void optixSetPayloadTypes( unsigned int types ) -{ - asm volatile( "call _optix_set_payload_types, (%0);" : : "r"( types ) : ); -} - -static __forceinline__ __device__ unsigned int optixUndefinedValue() -{ - unsigned int u0; - asm( "call (%0), _optix_undef_value, ();" : "=r"( u0 ) : ); - return u0; -} - -__device__ __forceinline__ unsigned int optixGetRemainingTraceDepth() -{ - unsigned int result; - asm ( - "call (%0), _optix_get_remaining_trace_depth," - "();" - : "=r"( result ) - : - : ); - return result; -} - -static __forceinline__ __device__ float3 optixGetWorldRayOrigin() -{ - float f0, f1, f2; - asm( "call (%0), _optix_get_world_ray_origin_x, ();" : "=f"( f0 ) : ); - asm( "call (%0), _optix_get_world_ray_origin_y, ();" : "=f"( f1 ) : ); - asm( "call (%0), _optix_get_world_ray_origin_z, ();" : "=f"( f2 ) : ); - return make_float3( f0, f1, f2 ); -} - -static __forceinline__ __device__ float3 optixGetWorldRayDirection() -{ - float f0, f1, f2; - asm( "call (%0), _optix_get_world_ray_direction_x, ();" : "=f"( f0 ) : ); - asm( "call (%0), _optix_get_world_ray_direction_y, ();" : "=f"( f1 ) : ); - asm( "call (%0), _optix_get_world_ray_direction_z, ();" : "=f"( f2 ) : ); - return make_float3( f0, f1, f2 ); -} - -static __forceinline__ __device__ float3 optixGetObjectRayOrigin() -{ - float f0, f1, f2; - asm( "call (%0), _optix_get_object_ray_origin_x, ();" : "=f"( f0 ) : ); - asm( "call (%0), _optix_get_object_ray_origin_y, ();" : "=f"( f1 ) : ); - asm( "call (%0), _optix_get_object_ray_origin_z, ();" : "=f"( f2 ) : ); - return make_float3( f0, f1, f2 ); -} - -static __forceinline__ __device__ float3 optixGetObjectRayDirection() -{ - float f0, f1, f2; - asm( "call (%0), _optix_get_object_ray_direction_x, ();" : "=f"( f0 ) : ); - asm( "call (%0), _optix_get_object_ray_direction_y, ();" : "=f"( f1 ) : ); - asm( "call (%0), _optix_get_object_ray_direction_z, ();" : "=f"( f2 ) : ); - return make_float3( f0, f1, f2 ); -} - -static __forceinline__ __device__ float optixGetRayTmin() -{ - float f0; - asm( "call (%0), _optix_get_ray_tmin, ();" : "=f"( f0 ) : ); - return f0; -} - -static __forceinline__ __device__ float optixGetRayTmax() -{ - float f0; - asm( "call (%0), _optix_get_ray_tmax, ();" : "=f"( f0 ) : ); - return f0; -} - -static __forceinline__ __device__ float optixGetRayTime() -{ - float f0; - asm( "call (%0), _optix_get_ray_time, ();" : "=f"( f0 ) : ); - return f0; -} - -static __forceinline__ __device__ unsigned int optixGetRayFlags() -{ - unsigned int u0; - asm( "call (%0), _optix_get_ray_flags, ();" : "=r"( u0 ) : ); - return u0; -} - -static __forceinline__ __device__ unsigned int optixGetRayVisibilityMask() -{ - unsigned int u0; - asm( "call (%0), _optix_get_ray_visibility_mask, ();" : "=r"( u0 ) : ); - return u0; -} - -static __forceinline__ __device__ OptixTraversableHandle optixGetInstanceTraversableFromIAS( OptixTraversableHandle ias, - unsigned int instIdx ) -{ - unsigned long long handle; - asm( "call (%0), _optix_get_instance_traversable_from_ias, (%1, %2);" - : "=l"( handle ) : "l"( ias ), "r"( instIdx ) ); - return (OptixTraversableHandle)handle; -} - - -static __forceinline__ __device__ void optixGetTriangleVertexData( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float3 data[3] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8), _optix_get_triangle_vertex_data, " - "(%9, %10, %11, %12);" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[1].x ), "=f"( data[1].y ), - "=f"( data[1].z ), "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ) - : ); -} - - -static __forceinline__ __device__ void optixGetTriangleVertexDataFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float3 data[3] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8), _optix_get_triangle_vertex_data_from_handle, " - "(%9, %10, %11, %12);" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[1].x ), "=f"( data[1].y ), - "=f"( data[1].z ), "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ) - : ); -} - -static __forceinline__ __device__ void optixGetTriangleVertexData( float3 data[3] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8), _optix_get_triangle_vertex_data_current_hit, " - "();" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[1].x ), "=f"( data[1].y ), - "=f"( data[1].z ), "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ) - : ); -} - -static __forceinline__ __device__ void optixHitObjectGetTriangleVertexData( float3 data[3] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8), _optix_hitobject_get_triangle_vertex_data, " - "();" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[1].x ), "=f"( data[1].y ), - "=f"( data[1].z ), "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ) - : ); -} - - -static __forceinline__ __device__ void optixGetLinearCurveVertexData( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[2] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7), _optix_get_linear_curve_vertex_data, " - "(%8, %9, %10, %11);" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), - "=f"( data[1].x ), "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ) - : ); -} - -static __forceinline__ __device__ void optixGetLinearCurveVertexDataFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[2] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7), _optix_get_linear_curve_vertex_data_from_handle, " - "(%8, %9, %10, %11);" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), - "=f"( data[1].x ), "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ) - : ); -} - -static __forceinline__ __device__ void optixGetLinearCurveVertexData( float4 data[2] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7), _optix_get_linear_curve_vertex_data_current_hit, " - "();" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), - "=f"( data[1].x ), "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ) - : ); -} - -static __forceinline__ __device__ void optixHitObjectGetLinearCurveVertexData( float4 data[2] ) - -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7), _optix_hitobject_get_linear_curve_vertex_data, " - "();" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), - "=f"( data[1].x ), "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ) - : ); -} - -static __forceinline__ __device__ void optixGetQuadraticBSplineVertexData( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[3] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11), _optix_get_quadratic_bspline_vertex_data, " - "(%12, %13, %14, %15);" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), - "=f"( data[1].x ), "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), - "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ), "=f"( data[2].w ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ) - : ); -} - -static __forceinline__ __device__ void optixGetQuadraticBSplineVertexDataFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[3] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11), _optix_get_quadratic_bspline_vertex_data_from_handle, " - "(%12, %13, %14, %15);" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), - "=f"( data[1].x ), "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), - "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ), "=f"( data[2].w ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ) - : ); -} - -static __forceinline__ __device__ void optixGetQuadraticBSplineVertexData( float4 data[3] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11), _optix_get_quadratic_bspline_vertex_data_current_hit, " - "();" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), - "=f"( data[1].x ), "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), - "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ), "=f"( data[2].w ) - : ); -} - -static __forceinline__ __device__ void optixHitObjectGetQuadraticBSplineVertexData( float4 data[3] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11), _optix_hitobject_get_quadratic_bspline_vertex_data, " - "();" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), - "=f"( data[1].x ), "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), - "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ), "=f"( data[2].w ) - : ); -} - -static __forceinline__ __device__ void optixGetQuadraticBSplineRocapsVertexDataFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[3] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11), _optix_get_quadratic_bspline_rocaps_vertex_data_from_handle, " - "(%12, %13, %14, %15);" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), "=f"( data[1].y ), - "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ), "=f"( data[2].w ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ) - : ); -} - -static __forceinline__ __device__ void optixGetQuadraticBSplineRocapsVertexData( float4 data[3] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11), _optix_get_quadratic_bspline_rocaps_vertex_data_current_hit, " - "();" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), "=f"( data[1].y ), - "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ), "=f"( data[2].w ) - : ); -} - -static __forceinline__ __device__ void optixHitObjectGetQuadraticBSplineRocapsVertexData( float4 data[3] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11), _optix_hitobject_get_quadratic_bspline_rocaps_vertex_data, " - "();" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), "=f"( data[1].y ), - "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ), "=f"( data[2].w ) - : ); -} - -static __forceinline__ __device__ void optixGetCubicBSplineVertexData( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[4] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), " - "_optix_get_cubic_bspline_vertex_data, " - "(%16, %17, %18, %19);" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), - "=f"( data[1].x ), "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), - "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ), "=f"( data[2].w ), - "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ) - : ); -} - -static __forceinline__ __device__ void optixGetCubicBSplineVertexDataFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[4] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), " - "_optix_get_cubic_bspline_vertex_data_from_handle, " - "(%16, %17, %18, %19);" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), - "=f"( data[1].x ), "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), - "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ), "=f"( data[2].w ), - "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ) - : ); -} - -static __forceinline__ __device__ void optixGetCubicBSplineVertexData( float4 data[4] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), " - "_optix_get_cubic_bspline_vertex_data_current_hit, " - "();" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), - "=f"( data[1].x ), "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), - "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ), "=f"( data[2].w ), - "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w ) - : ); -} - -static __forceinline__ __device__ void optixHitObjectGetCubicBSplineVertexData( float4 data[4] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), " - "_optix_hitobject_get_cubic_bspline_vertex_data, " - "();" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), - "=f"( data[1].x ), "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), - "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ), "=f"( data[2].w ), - "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w ) - : ); -} - -static __forceinline__ __device__ void optixGetCubicBSplineRocapsVertexDataFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[4] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), " - "_optix_get_cubic_bspline_rocaps_vertex_data_from_handle, " - "(%16, %17, %18, %19);" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), - "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), - "=f"( data[2].z ), "=f"( data[2].w ), "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ) - : ); -} - -static __forceinline__ __device__ void optixGetCubicBSplineRocapsVertexData( float4 data[4] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), " - "_optix_get_cubic_bspline_rocaps_vertex_data_current_hit, " - "();" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), - "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), - "=f"( data[2].z ), "=f"( data[2].w ), "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w ) - : ); -} - -static __forceinline__ __device__ void optixHitObjectGetCubicBSplineRocapsVertexData( float4 data[4] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), " - "_optix_hitobject_get_cubic_bspline_rocaps_vertex_data, " - "();" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), - "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), - "=f"( data[2].z ), "=f"( data[2].w ), "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w ) - : ); -} - -static __forceinline__ __device__ void optixGetCatmullRomVertexData( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[4] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), " - "_optix_get_catmullrom_vertex_data, " - "(%16, %17, %18, %19);" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), - "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), - "=f"( data[2].z ), "=f"( data[2].w ), "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ) - : ); -} - -static __forceinline__ __device__ void optixGetCatmullRomVertexDataFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[4] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), " - "_optix_get_catmullrom_vertex_data_from_handle, " - "(%16, %17, %18, %19);" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), - "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), - "=f"( data[2].z ), "=f"( data[2].w ), "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ) - : ); -} - -static __forceinline__ __device__ void optixGetCatmullRomVertexData( float4 data[4] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), " - "_optix_get_catmullrom_vertex_data_current_hit, " - "();" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), - "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), - "=f"( data[2].z ), "=f"( data[2].w ), "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w ) - : ); -} - -static __forceinline__ __device__ void optixHitObjectGetCatmullRomVertexData( float4 data[4] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), " - "_optix_hitobject_get_catmullrom_vertex_data, " - "();" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), - "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), - "=f"( data[2].z ), "=f"( data[2].w ), "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w ) - : ); -} - -static __forceinline__ __device__ void optixGetCatmullRomRocapsVertexDataFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[4] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), " - "_optix_get_catmullrom_rocaps_vertex_data_from_handle, " - "(%16, %17, %18, %19);" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), - "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), - "=f"( data[2].z ), "=f"( data[2].w ), "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ) - : ); -} - -static __forceinline__ __device__ void optixGetCatmullRomRocapsVertexData( float4 data[4] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), " - "_optix_get_catmullrom_rocaps_vertex_data_current_hit, " - "();" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), - "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), - "=f"( data[2].z ), "=f"( data[2].w ), "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w ) - : ); -} - -static __forceinline__ __device__ void optixHitObjectGetCatmullRomRocapsVertexData( float4 data[4] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), " - "_optix_hitobject_get_catmullrom_rocaps_vertex_data, " - "();" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), - "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), - "=f"( data[2].z ), "=f"( data[2].w ), "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w ) - : ); -} - -static __forceinline__ __device__ void optixGetCubicBezierVertexData( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[4] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), " - "_optix_get_cubic_bezier_vertex_data, " - "(%16, %17, %18, %19);" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), - "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), - "=f"( data[2].z ), "=f"( data[2].w ), "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ) - : ); -} - -static __forceinline__ __device__ void optixGetCubicBezierVertexDataFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[4] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), " - "_optix_get_cubic_bezier_vertex_data_from_handle, " - "(%16, %17, %18, %19);" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), - "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), - "=f"( data[2].z ), "=f"( data[2].w ), "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ) - : ); -} - -static __forceinline__ __device__ void optixGetCubicBezierVertexData( float4 data[4] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), " - "_optix_get_cubic_bezier_vertex_data_current_hit, " - "();" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), - "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), - "=f"( data[2].z ), "=f"( data[2].w ), "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w ) - : ); -} - -static __forceinline__ __device__ void optixHitObjectGetCubicBezierVertexData( float4 data[4] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), " - "_optix_hitobject_get_cubic_bezier_vertex_data, " - "();" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), - "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), - "=f"( data[2].z ), "=f"( data[2].w ), "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w ) - : ); -} - -static __forceinline__ __device__ void optixGetCubicBezierRocapsVertexDataFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[4] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), " - "_optix_get_cubic_bezier_rocaps_vertex_data_from_handle, " - "(%16, %17, %18, %19);" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), - "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), - "=f"( data[2].z ), "=f"( data[2].w ), "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ) - : ); -} - -static __forceinline__ __device__ void optixGetCubicBezierRocapsVertexData( float4 data[4] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), " - "_optix_get_cubic_bezier_rocaps_vertex_data_current_hit, " - "();" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), - "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), - "=f"( data[2].z ), "=f"( data[2].w ), "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w ) - : ); -} - -static __forceinline__ __device__ void optixHitObjectGetCubicBezierRocapsVertexData( float4 data[4] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), " - "_optix_hitobject_get_cubic_bezier_rocaps_vertex_data, " - "();" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), - "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), - "=f"( data[2].z ), "=f"( data[2].w ), "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w ) - : ); -} - -static __forceinline__ __device__ void optixGetRibbonVertexData( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[3] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11), _optix_get_ribbon_vertex_data, " - "(%12, %13, %14, %15);" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), "=f"( data[1].y ), - "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ), "=f"( data[2].w ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ) - : ); -} - -static __forceinline__ __device__ void optixGetRibbonVertexDataFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[3] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11), _optix_get_ribbon_vertex_data_from_handle, " - "(%12, %13, %14, %15);" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), "=f"( data[1].y ), - "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ), "=f"( data[2].w ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ) - : ); -} - -static __forceinline__ __device__ void optixGetRibbonVertexData( float4 data[3] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11), _optix_get_ribbon_vertex_data_current_hit, " - "();" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), "=f"( data[1].y ), - "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ), "=f"( data[2].w ) - : ); -} - -static __forceinline__ __device__ void optixHitObjectGetRibbonVertexData( float4 data[3] ) -{ - asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11), _optix_hitobject_get_ribbon_vertex_data, " - "();" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), "=f"( data[1].y ), - "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ), "=f"( data[2].w ) - : ); -} - -static __forceinline__ __device__ float3 optixGetRibbonNormal( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float2 ribbonParameters ) -{ - float3 normal; - asm( "call (%0, %1, %2), _optix_get_ribbon_normal, " - "(%3, %4, %5, %6, %7, %8);" - : "=f"( normal.x ), "=f"( normal.y ), "=f"( normal.z ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ), - "f"( ribbonParameters.x ), "f"( ribbonParameters.y ) - : ); - return normal; -} - -static __forceinline__ __device__ float3 optixGetRibbonNormalFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float2 ribbonParameters ) -{ - float3 normal; - asm( "call (%0, %1, %2), _optix_get_ribbon_normal_from_handle, " - "(%3, %4, %5, %6, %7, %8);" - : "=f"( normal.x ), "=f"( normal.y ), "=f"( normal.z ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ), - "f"( ribbonParameters.x ), "f"( ribbonParameters.y ) - : ); - return normal; -} - -static __forceinline__ __device__ float3 optixGetRibbonNormal( float2 ribbonParameters ) -{ - float3 normal; - asm( "call (%0, %1, %2), _optix_get_ribbon_normal_current_hit, " - "(%3, %4);" - : "=f"( normal.x ), "=f"( normal.y ), "=f"( normal.z ) - : "f"( ribbonParameters.x ), "f"( ribbonParameters.y ) - : ); - return normal; -} - -static __forceinline__ __device__ float3 optixHitObjectGetRibbonNormal( float2 ribbonParameters ) -{ - float3 normal; - asm( "call (%0, %1, %2), _optix_hitobject_get_ribbon_normal, " - "(%3, %4);" - : "=f"( normal.x ), "=f"( normal.y ), "=f"( normal.z ) - : "f"( ribbonParameters.x ), "f"( ribbonParameters.y ) - : ); - return normal; -} - -static __forceinline__ __device__ void optixGetSphereData( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[1] ) -{ - asm( "call (%0, %1, %2, %3), " - "_optix_get_sphere_data, " - "(%4, %5, %6, %7);" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ) - : ); -} - -static __forceinline__ __device__ void optixGetSphereDataFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[1] ) -{ - asm( "call (%0, %1, %2, %3), " - "_optix_get_sphere_data_from_handle, " - "(%4, %5, %6, %7);" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ) - : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ) - : ); -} - -static __forceinline__ __device__ void optixGetSphereData( float4 data[1] ) -{ - asm( "call (%0, %1, %2, %3), " - "_optix_get_sphere_data_current_hit, " - "();" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ) - : ); -} - -static __forceinline__ __device__ void optixHitObjectGetSphereData( float4 data[1] ) -{ - asm( "call (%0, %1, %2, %3), " - "_optix_hitobject_get_sphere_data, " - "();" - : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ) - : ); -} - -static __forceinline__ __device__ OptixTraversableHandle optixGetGASTraversableHandle() -{ - unsigned long long handle; - asm( "call (%0), _optix_get_gas_traversable_handle, ();" : "=l"( handle ) : ); - return (OptixTraversableHandle)handle; -} - -static __forceinline__ __device__ float optixGetGASMotionTimeBegin( OptixTraversableHandle handle ) -{ - float f0; - asm( "call (%0), _optix_get_gas_motion_time_begin, (%1);" : "=f"( f0 ) : "l"( handle ) : ); - return f0; -} - -static __forceinline__ __device__ float optixGetGASMotionTimeEnd( OptixTraversableHandle handle ) -{ - float f0; - asm( "call (%0), _optix_get_gas_motion_time_end, (%1);" : "=f"( f0 ) : "l"( handle ) : ); - return f0; -} - -static __forceinline__ __device__ unsigned int optixGetGASMotionStepCount( OptixTraversableHandle handle ) -{ - unsigned int u0; - asm( "call (%0), _optix_get_gas_motion_step_count, (%1);" : "=r"( u0 ) : "l"( handle ) : ); - return u0; -} - -template -static __forceinline__ __device__ void optixGetWorldToObjectTransformMatrix( const HitState& hs, float m[12] ) -{ - if( hs.getTransformListSize() == 0 ) - { - m[0] = 1.0f; - m[1] = 0.0f; - m[2] = 0.0f; - m[3] = 0.0f; - m[4] = 0.0f; - m[5] = 1.0f; - m[6] = 0.0f; - m[7] = 0.0f; - m[8] = 0.0f; - m[9] = 0.0f; - m[10] = 1.0f; - m[11] = 0.0f; - return; - } - - float4 m0, m1, m2; - optix_impl::optixGetWorldToObjectTransformMatrix( hs, m0, m1, m2 ); - m[0] = m0.x; - m[1] = m0.y; - m[2] = m0.z; - m[3] = m0.w; - m[4] = m1.x; - m[5] = m1.y; - m[6] = m1.z; - m[7] = m1.w; - m[8] = m2.x; - m[9] = m2.y; - m[10] = m2.z; - m[11] = m2.w; -} - -static __forceinline__ __device__ void optixGetWorldToObjectTransformMatrix( float m[12] ) -{ - optixGetWorldToObjectTransformMatrix( OptixIncomingHitObject{}, m ); -} - -static __forceinline__ __device__ void optixHitObjectGetWorldToObjectTransformMatrix( float m[12] ) -{ - optixGetWorldToObjectTransformMatrix( OptixOutgoingHitObject{}, m ); -} - -template -static __forceinline__ __device__ void optixGetObjectToWorldTransformMatrix( const HitState& hs, float m[12] ) -{ - if( hs.getTransformListSize() == 0 ) - { - m[0] = 1.0f; - m[1] = 0.0f; - m[2] = 0.0f; - m[3] = 0.0f; - m[4] = 0.0f; - m[5] = 1.0f; - m[6] = 0.0f; - m[7] = 0.0f; - m[8] = 0.0f; - m[9] = 0.0f; - m[10] = 1.0f; - m[11] = 0.0f; - return; - } - - float4 m0, m1, m2; - optix_impl::optixGetObjectToWorldTransformMatrix( hs, m0, m1, m2 ); - m[0] = m0.x; - m[1] = m0.y; - m[2] = m0.z; - m[3] = m0.w; - m[4] = m1.x; - m[5] = m1.y; - m[6] = m1.z; - m[7] = m1.w; - m[8] = m2.x; - m[9] = m2.y; - m[10] = m2.z; - m[11] = m2.w; -} - -static __forceinline__ __device__ void optixGetObjectToWorldTransformMatrix( float m[12] ) -{ - optixGetObjectToWorldTransformMatrix( OptixIncomingHitObject{}, m ); -} - -static __forceinline__ __device__ void optixHitObjectGetObjectToWorldTransformMatrix( float m[12] ) -{ - optixGetObjectToWorldTransformMatrix( OptixOutgoingHitObject{}, m ); -} - -template -static __forceinline__ __device__ float3 optixTransformPointFromWorldToObjectSpace( const HitState& hs, float3 point ) -{ - if( hs.getTransformListSize() == 0 ) - return point; - - float4 m0, m1, m2; - optix_impl::optixGetWorldToObjectTransformMatrix( hs, m0, m1, m2 ); - return optix_impl::optixTransformPoint( m0, m1, m2, point ); -} - -static __forceinline__ __device__ float3 optixTransformPointFromWorldToObjectSpace( float3 point ) -{ - return optixTransformPointFromWorldToObjectSpace( OptixIncomingHitObject{}, point ); -} - -static __forceinline__ __device__ float3 optixHitObjectTransformPointFromWorldToObjectSpace( float3 point ) -{ - return optixTransformPointFromWorldToObjectSpace( OptixOutgoingHitObject{}, point ); -} - -template -static __forceinline__ __device__ float3 optixTransformVectorFromWorldToObjectSpace( const HitState& hs, float3 vec ) -{ - if( hs.getTransformListSize() == 0 ) - return vec; - - float4 m0, m1, m2; - optix_impl::optixGetWorldToObjectTransformMatrix( hs, m0, m1, m2 ); - return optix_impl::optixTransformVector( m0, m1, m2, vec ); -} - -static __forceinline__ __device__ float3 optixTransformVectorFromWorldToObjectSpace( float3 vec ) -{ - return optixTransformVectorFromWorldToObjectSpace( OptixIncomingHitObject{}, vec ); -} - -static __forceinline__ __device__ float3 optixHitObjectTransformVectorFromWorldToObjectSpace( float3 vec ) -{ - return optixTransformVectorFromWorldToObjectSpace( OptixOutgoingHitObject{}, vec ); -} - -template -static __forceinline__ __device__ float3 optixTransformNormalFromWorldToObjectSpace( const HitState& hs, float3 normal ) -{ - if( hs.getTransformListSize() == 0 ) - return normal; - - float4 m0, m1, m2; - optix_impl::optixGetObjectToWorldTransformMatrix( hs, m0, m1, m2 ); // inverse of optixGetWorldToObjectTransformMatrix() - return optix_impl::optixTransformNormal( m0, m1, m2, normal ); -} - -static __forceinline__ __device__ float3 optixTransformNormalFromWorldToObjectSpace( float3 normal ) -{ - return optixTransformNormalFromWorldToObjectSpace( OptixIncomingHitObject{}, normal ); -} - -static __forceinline__ __device__ float3 optixHitObjectTransformNormalFromWorldToObjectSpace( float3 normal ) -{ - return optixTransformNormalFromWorldToObjectSpace( OptixOutgoingHitObject{}, normal ); -} - -template -static __forceinline__ __device__ float3 optixTransformPointFromObjectToWorldSpace( const HitState& hs, float3 point ) -{ - if( hs.getTransformListSize() == 0 ) - return point; - - float4 m0, m1, m2; - optix_impl::optixGetObjectToWorldTransformMatrix( hs, m0, m1, m2 ); - return optix_impl::optixTransformPoint( m0, m1, m2, point ); -} - -static __forceinline__ __device__ float3 optixTransformPointFromObjectToWorldSpace( float3 point ) -{ - return optixTransformPointFromObjectToWorldSpace( OptixIncomingHitObject{}, point ); -} - -static __forceinline__ __device__ float3 optixHitObjectTransformPointFromObjectToWorldSpace( float3 point ) -{ - return optixTransformPointFromObjectToWorldSpace( OptixOutgoingHitObject{}, point ); -} - -template -static __forceinline__ __device__ float3 optixTransformVectorFromObjectToWorldSpace( const HitState& hs, float3 vec ) -{ - if( hs.getTransformListSize() == 0 ) - return vec; - - float4 m0, m1, m2; - optix_impl::optixGetObjectToWorldTransformMatrix( hs, m0, m1, m2 ); - return optix_impl::optixTransformVector( m0, m1, m2, vec ); -} - -static __forceinline__ __device__ float3 optixTransformVectorFromObjectToWorldSpace( float3 vec ) -{ - return optixTransformVectorFromObjectToWorldSpace( OptixIncomingHitObject{}, vec ); -} - -static __forceinline__ __device__ float3 optixHitObjectTransformVectorFromObjectToWorldSpace( float3 vec ) -{ - return optixTransformVectorFromObjectToWorldSpace( OptixOutgoingHitObject{}, vec ); -} - -template -static __forceinline__ __device__ float3 optixTransformNormalFromObjectToWorldSpace( const HitState& hs, float3 normal ) -{ - if( hs.getTransformListSize() == 0 ) - return normal; - - float4 m0, m1, m2; - optix_impl::optixGetWorldToObjectTransformMatrix( hs, m0, m1, m2 ); // inverse of optixGetObjectToWorldTransformMatrix() - return optix_impl::optixTransformNormal( m0, m1, m2, normal ); -} - -static __forceinline__ __device__ float3 optixTransformNormalFromObjectToWorldSpace( float3 normal ) -{ - return optixTransformNormalFromObjectToWorldSpace( OptixIncomingHitObject{}, normal ); -} - -static __forceinline__ __device__ float3 optixHitObjectTransformNormalFromObjectToWorldSpace( float3 normal ) -{ - return optixTransformNormalFromObjectToWorldSpace( OptixOutgoingHitObject{}, normal ); -} - -static __forceinline__ __device__ unsigned int optixGetTransformListSize() -{ - unsigned int u0; - asm( "call (%0), _optix_get_transform_list_size, ();" : "=r"( u0 ) : ); - return u0; -} - -static __forceinline__ __device__ OptixTraversableHandle optixGetTransformListHandle( unsigned int index ) -{ - unsigned long long u0; - asm( "call (%0), _optix_get_transform_list_handle, (%1);" : "=l"( u0 ) : "r"( index ) : ); - return u0; -} - -static __forceinline__ __device__ OptixTransformType optixGetTransformTypeFromHandle( OptixTraversableHandle handle ) -{ - int i0; - asm( "call (%0), _optix_get_transform_type_from_handle, (%1);" : "=r"( i0 ) : "l"( handle ) : ); - return (OptixTransformType)i0; -} - -static __forceinline__ __device__ const OptixStaticTransform* optixGetStaticTransformFromHandle( OptixTraversableHandle handle ) -{ - unsigned long long ptr; - asm( "call (%0), _optix_get_static_transform_from_handle, (%1);" : "=l"( ptr ) : "l"( handle ) : ); - return (const OptixStaticTransform*)ptr; -} - -static __forceinline__ __device__ const OptixSRTMotionTransform* optixGetSRTMotionTransformFromHandle( OptixTraversableHandle handle ) -{ - unsigned long long ptr; - asm( "call (%0), _optix_get_srt_motion_transform_from_handle, (%1);" : "=l"( ptr ) : "l"( handle ) : ); - return (const OptixSRTMotionTransform*)ptr; -} - -static __forceinline__ __device__ const OptixMatrixMotionTransform* optixGetMatrixMotionTransformFromHandle( OptixTraversableHandle handle ) -{ - unsigned long long ptr; - asm( "call (%0), _optix_get_matrix_motion_transform_from_handle, (%1);" : "=l"( ptr ) : "l"( handle ) : ); - return (const OptixMatrixMotionTransform*)ptr; -} - -static __forceinline__ __device__ unsigned int optixGetInstanceIdFromHandle( OptixTraversableHandle handle ) -{ - int i0; - asm( "call (%0), _optix_get_instance_id_from_handle, (%1);" : "=r"( i0 ) : "l"( handle ) : ); - return i0; -} - -static __forceinline__ __device__ OptixTraversableHandle optixGetInstanceChildFromHandle( OptixTraversableHandle handle ) -{ - unsigned long long i0; - asm( "call (%0), _optix_get_instance_child_from_handle, (%1);" : "=l"( i0 ) : "l"( handle ) : ); - return (OptixTraversableHandle)i0; -} - -static __forceinline__ __device__ const float4* optixGetInstanceTransformFromHandle( OptixTraversableHandle handle ) -{ - unsigned long long ptr; - asm( "call (%0), _optix_get_instance_transform_from_handle, (%1);" : "=l"( ptr ) : "l"( handle ) : ); - return (const float4*)ptr; -} - -static __forceinline__ __device__ const float4* optixGetInstanceInverseTransformFromHandle( OptixTraversableHandle handle ) -{ - unsigned long long ptr; - asm( "call (%0), _optix_get_instance_inverse_transform_from_handle, (%1);" : "=l"( ptr ) : "l"( handle ) : ); - return (const float4*)ptr; -} - -static __device__ __forceinline__ CUdeviceptr optixGetGASPointerFromHandle( OptixTraversableHandle handle ) -{ - unsigned long long ptr; - asm( "call (%0), _optix_get_gas_ptr_from_handle, (%1);" : "=l"( ptr ) : "l"( handle ) : ); - return (CUdeviceptr)ptr; -} -static __forceinline__ __device__ bool optixReportIntersection( float hitT, unsigned int hitKind ) -{ - int ret; - asm volatile( - "call (%0), _optix_report_intersection_0" - ", (%1, %2);" - : "=r"( ret ) - : "f"( hitT ), "r"( hitKind ) - : ); - return ret; -} - -static __forceinline__ __device__ bool optixReportIntersection( float hitT, unsigned int hitKind, unsigned int a0 ) -{ - int ret; - asm volatile( - "call (%0), _optix_report_intersection_1" - ", (%1, %2, %3);" - : "=r"( ret ) - : "f"( hitT ), "r"( hitKind ), "r"( a0 ) - : ); - return ret; -} - -static __forceinline__ __device__ bool optixReportIntersection( float hitT, unsigned int hitKind, unsigned int a0, unsigned int a1 ) -{ - int ret; - asm volatile( - "call (%0), _optix_report_intersection_2" - ", (%1, %2, %3, %4);" - : "=r"( ret ) - : "f"( hitT ), "r"( hitKind ), "r"( a0 ), "r"( a1 ) - : ); - return ret; -} - -static __forceinline__ __device__ bool optixReportIntersection( float hitT, unsigned int hitKind, unsigned int a0, unsigned int a1, unsigned int a2 ) -{ - int ret; - asm volatile( - "call (%0), _optix_report_intersection_3" - ", (%1, %2, %3, %4, %5);" - : "=r"( ret ) - : "f"( hitT ), "r"( hitKind ), "r"( a0 ), "r"( a1 ), "r"( a2 ) - : ); - return ret; -} - -static __forceinline__ __device__ bool optixReportIntersection( float hitT, - unsigned int hitKind, - unsigned int a0, - unsigned int a1, - unsigned int a2, - unsigned int a3 ) -{ - int ret; - asm volatile( - "call (%0), _optix_report_intersection_4" - ", (%1, %2, %3, %4, %5, %6);" - : "=r"( ret ) - : "f"( hitT ), "r"( hitKind ), "r"( a0 ), "r"( a1 ), "r"( a2 ), "r"( a3 ) - : ); - return ret; -} - -static __forceinline__ __device__ bool optixReportIntersection( float hitT, - unsigned int hitKind, - unsigned int a0, - unsigned int a1, - unsigned int a2, - unsigned int a3, - unsigned int a4 ) -{ - int ret; - asm volatile( - "call (%0), _optix_report_intersection_5" - ", (%1, %2, %3, %4, %5, %6, %7);" - : "=r"( ret ) - : "f"( hitT ), "r"( hitKind ), "r"( a0 ), "r"( a1 ), "r"( a2 ), "r"( a3 ), "r"( a4 ) - : ); - return ret; -} - -static __forceinline__ __device__ bool optixReportIntersection( float hitT, - unsigned int hitKind, - unsigned int a0, - unsigned int a1, - unsigned int a2, - unsigned int a3, - unsigned int a4, - unsigned int a5 ) -{ - int ret; - asm volatile( - "call (%0), _optix_report_intersection_6" - ", (%1, %2, %3, %4, %5, %6, %7, %8);" - : "=r"( ret ) - : "f"( hitT ), "r"( hitKind ), "r"( a0 ), "r"( a1 ), "r"( a2 ), "r"( a3 ), "r"( a4 ), "r"( a5 ) - : ); - return ret; -} - -static __forceinline__ __device__ bool optixReportIntersection( float hitT, - unsigned int hitKind, - unsigned int a0, - unsigned int a1, - unsigned int a2, - unsigned int a3, - unsigned int a4, - unsigned int a5, - unsigned int a6 ) -{ - int ret; - asm volatile( - "call (%0), _optix_report_intersection_7" - ", (%1, %2, %3, %4, %5, %6, %7, %8, %9);" - : "=r"( ret ) - : "f"( hitT ), "r"( hitKind ), "r"( a0 ), "r"( a1 ), "r"( a2 ), "r"( a3 ), "r"( a4 ), "r"( a5 ), "r"( a6 ) - : ); - return ret; -} - -static __forceinline__ __device__ bool optixReportIntersection( float hitT, - unsigned int hitKind, - unsigned int a0, - unsigned int a1, - unsigned int a2, - unsigned int a3, - unsigned int a4, - unsigned int a5, - unsigned int a6, - unsigned int a7 ) -{ - int ret; - asm volatile( - "call (%0), _optix_report_intersection_8" - ", (%1, %2, %3, %4, %5, %6, %7, %8, %9, %10);" - : "=r"( ret ) - : "f"( hitT ), "r"( hitKind ), "r"( a0 ), "r"( a1 ), "r"( a2 ), "r"( a3 ), "r"( a4 ), "r"( a5 ), "r"( a6 ), "r"( a7 ) - : ); - return ret; -} - -#define OPTIX_DEFINE_optixGetAttribute_BODY( which ) \ - unsigned int ret; \ - asm( "call (%0), _optix_get_attribute_" #which ", ();" : "=r"( ret ) : ); \ - return ret; - -static __forceinline__ __device__ unsigned int optixGetAttribute_0() -{ - OPTIX_DEFINE_optixGetAttribute_BODY( 0 ); -} - -static __forceinline__ __device__ unsigned int optixGetAttribute_1() -{ - OPTIX_DEFINE_optixGetAttribute_BODY( 1 ); -} - -static __forceinline__ __device__ unsigned int optixGetAttribute_2() -{ - OPTIX_DEFINE_optixGetAttribute_BODY( 2 ); -} - -static __forceinline__ __device__ unsigned int optixGetAttribute_3() -{ - OPTIX_DEFINE_optixGetAttribute_BODY( 3 ); -} - -static __forceinline__ __device__ unsigned int optixGetAttribute_4() -{ - OPTIX_DEFINE_optixGetAttribute_BODY( 4 ); -} - -static __forceinline__ __device__ unsigned int optixGetAttribute_5() -{ - OPTIX_DEFINE_optixGetAttribute_BODY( 5 ); -} - -static __forceinline__ __device__ unsigned int optixGetAttribute_6() -{ - OPTIX_DEFINE_optixGetAttribute_BODY( 6 ); -} - -static __forceinline__ __device__ unsigned int optixGetAttribute_7() -{ - OPTIX_DEFINE_optixGetAttribute_BODY( 7 ); -} - -#undef OPTIX_DEFINE_optixGetAttribute_BODY - -static __forceinline__ __device__ void optixTerminateRay() -{ - asm volatile( "call _optix_terminate_ray, ();" ); -} - -static __forceinline__ __device__ void optixIgnoreIntersection() -{ - asm volatile( "call _optix_ignore_intersection, ();" ); -} - -static __forceinline__ __device__ unsigned int optixGetPrimitiveIndex() -{ - unsigned int u0; - asm( "call (%0), _optix_read_primitive_idx, ();" : "=r"( u0 ) : ); - return u0; -} - -static __forceinline__ __device__ unsigned int optixGetClusterId() -{ - unsigned int u0; - asm( "call (%0), _optix_get_cluster_id, ();" : "=r"( u0 ) : ); - return u0; -} - -static __forceinline__ __device__ unsigned int optixHitObjectGetClusterId() -{ - unsigned int u0; - asm( "call (%0), _optix_hitobject_get_cluster_id, ();" : "=r"( u0 ) : ); - return u0; -} - -static __forceinline__ __device__ unsigned int optixGetSbtGASIndex() -{ - unsigned int u0; - asm( "call (%0), _optix_read_sbt_gas_idx, ();" : "=r"( u0 ) : ); - return u0; -} - -static __forceinline__ __device__ unsigned int optixGetInstanceId() -{ - unsigned int u0; - asm( "call (%0), _optix_read_instance_id, ();" : "=r"( u0 ) : ); - return u0; -} - -static __forceinline__ __device__ unsigned int optixGetInstanceIndex() -{ - unsigned int u0; - asm( "call (%0), _optix_read_instance_idx, ();" : "=r"( u0 ) : ); - return u0; -} - -static __forceinline__ __device__ unsigned int optixGetHitKind() -{ - unsigned int u0; - asm( "call (%0), _optix_get_hit_kind, ();" : "=r"( u0 ) : ); - return u0; -} - -static __forceinline__ __device__ OptixPrimitiveType optixGetPrimitiveType(unsigned int hitKind) -{ - unsigned int u0; - asm( "call (%0), _optix_get_primitive_type_from_hit_kind, (%1);" : "=r"( u0 ) : "r"( hitKind ) ); - return (OptixPrimitiveType)u0; -} - -static __forceinline__ __device__ bool optixIsBackFaceHit( unsigned int hitKind ) -{ - unsigned int u0; - asm( "call (%0), _optix_get_backface_from_hit_kind, (%1);" : "=r"( u0 ) : "r"( hitKind ) ); - return (u0 == 0x1); -} - -static __forceinline__ __device__ bool optixIsFrontFaceHit( unsigned int hitKind ) -{ - return !optixIsBackFaceHit( hitKind ); -} - - -static __forceinline__ __device__ OptixPrimitiveType optixGetPrimitiveType() -{ - return optixGetPrimitiveType( optixGetHitKind() ); -} - -static __forceinline__ __device__ bool optixIsBackFaceHit() -{ - return optixIsBackFaceHit( optixGetHitKind() ); -} - -static __forceinline__ __device__ bool optixIsFrontFaceHit() -{ - return optixIsFrontFaceHit( optixGetHitKind() ); -} - -static __forceinline__ __device__ bool optixIsTriangleHit() -{ - return optixIsTriangleFrontFaceHit() || optixIsTriangleBackFaceHit(); -} - -static __forceinline__ __device__ bool optixIsTriangleFrontFaceHit() -{ - return optixGetHitKind() == OPTIX_HIT_KIND_TRIANGLE_FRONT_FACE; -} - -static __forceinline__ __device__ bool optixIsTriangleBackFaceHit() -{ - return optixGetHitKind() == OPTIX_HIT_KIND_TRIANGLE_BACK_FACE; -} - - -static __forceinline__ __device__ float optixGetCurveParameter() -{ - float f0; - asm( "call (%0), _optix_get_curve_parameter, ();" : "=f"( f0 ) : ); - return f0; -} - -static __forceinline__ __device__ float optixHitObjectGetCurveParameter() -{ - float f0; - asm( "call (%0), _optix_hitobject_get_curve_parameter, ();" : "=f"( f0 ) : ); - return f0; -} - -static __forceinline__ __device__ float2 optixGetRibbonParameters() -{ - float f0, f1; - asm( "call (%0, %1), _optix_get_ribbon_parameters, ();" : "=f"( f0 ), "=f"( f1 ) : ); - return make_float2( f0, f1 ); -} - -static __forceinline__ __device__ float2 optixHitObjectGetRibbonParameters() -{ - float f0, f1; - asm( "call (%0, %1), _optix_hitobject_get_ribbon_parameters, ();" : "=f"( f0 ), "=f"( f1 ) : ); - return make_float2( f0, f1 ); -} - -static __forceinline__ __device__ float2 optixGetTriangleBarycentrics() -{ - float f0, f1; - asm( "call (%0, %1), _optix_get_triangle_barycentrics, ();" : "=f"( f0 ), "=f"( f1 ) : ); - return make_float2( f0, f1 ); -} - -static __forceinline__ __device__ float2 optixHitObjectGetTriangleBarycentrics() -{ - float f0, f1; - asm( "call (%0, %1), _optix_hitobject_get_triangle_barycentrics, ();" : "=f"( f0 ), "=f"( f1 ) : ); - return make_float2( f0, f1 ); -} - -static __forceinline__ __device__ uint3 optixGetLaunchIndex() -{ - unsigned int u0, u1, u2; - asm( "call (%0), _optix_get_launch_index_x, ();" : "=r"( u0 ) : ); - asm( "call (%0), _optix_get_launch_index_y, ();" : "=r"( u1 ) : ); - asm( "call (%0), _optix_get_launch_index_z, ();" : "=r"( u2 ) : ); - return make_uint3( u0, u1, u2 ); -} - -static __forceinline__ __device__ uint3 optixGetLaunchDimensions() -{ - unsigned int u0, u1, u2; - asm( "call (%0), _optix_get_launch_dimension_x, ();" : "=r"( u0 ) : ); - asm( "call (%0), _optix_get_launch_dimension_y, ();" : "=r"( u1 ) : ); - asm( "call (%0), _optix_get_launch_dimension_z, ();" : "=r"( u2 ) : ); - return make_uint3( u0, u1, u2 ); -} - -static __forceinline__ __device__ CUdeviceptr optixGetSbtDataPointer() -{ - unsigned long long ptr; - asm( "call (%0), _optix_get_sbt_data_ptr_64, ();" : "=l"( ptr ) : ); - return (CUdeviceptr)ptr; -} - -static __forceinline__ __device__ void optixThrowException( int exceptionCode ) -{ - asm volatile( - "call _optix_throw_exception_0, (%0);" - : /* no return value */ - : "r"( exceptionCode ) - : ); -} - -static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0 ) -{ - asm volatile( - "call _optix_throw_exception_1, (%0, %1);" - : /* no return value */ - : "r"( exceptionCode ), "r"( exceptionDetail0 ) - : ); -} - -static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0, unsigned int exceptionDetail1 ) -{ - asm volatile( - "call _optix_throw_exception_2, (%0, %1, %2);" - : /* no return value */ - : "r"( exceptionCode ), "r"( exceptionDetail0 ), "r"( exceptionDetail1 ) - : ); -} - -static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0, unsigned int exceptionDetail1, unsigned int exceptionDetail2 ) -{ - asm volatile( - "call _optix_throw_exception_3, (%0, %1, %2, %3);" - : /* no return value */ - : "r"( exceptionCode ), "r"( exceptionDetail0 ), "r"( exceptionDetail1 ), "r"( exceptionDetail2 ) - : ); -} - -static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0, unsigned int exceptionDetail1, unsigned int exceptionDetail2, unsigned int exceptionDetail3 ) -{ - asm volatile( - "call _optix_throw_exception_4, (%0, %1, %2, %3, %4);" - : /* no return value */ - : "r"( exceptionCode ), "r"( exceptionDetail0 ), "r"( exceptionDetail1 ), "r"( exceptionDetail2 ), "r"( exceptionDetail3 ) - : ); -} - -static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0, unsigned int exceptionDetail1, unsigned int exceptionDetail2, unsigned int exceptionDetail3, unsigned int exceptionDetail4 ) -{ - asm volatile( - "call _optix_throw_exception_5, (%0, %1, %2, %3, %4, %5);" - : /* no return value */ - : "r"( exceptionCode ), "r"( exceptionDetail0 ), "r"( exceptionDetail1 ), "r"( exceptionDetail2 ), "r"( exceptionDetail3 ), "r"( exceptionDetail4 ) - : ); -} - -static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0, unsigned int exceptionDetail1, unsigned int exceptionDetail2, unsigned int exceptionDetail3, unsigned int exceptionDetail4, unsigned int exceptionDetail5 ) -{ - asm volatile( - "call _optix_throw_exception_6, (%0, %1, %2, %3, %4, %5, %6);" - : /* no return value */ - : "r"( exceptionCode ), "r"( exceptionDetail0 ), "r"( exceptionDetail1 ), "r"( exceptionDetail2 ), "r"( exceptionDetail3 ), "r"( exceptionDetail4 ), "r"( exceptionDetail5 ) - : ); -} - -static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0, unsigned int exceptionDetail1, unsigned int exceptionDetail2, unsigned int exceptionDetail3, unsigned int exceptionDetail4, unsigned int exceptionDetail5, unsigned int exceptionDetail6 ) -{ - asm volatile( - "call _optix_throw_exception_7, (%0, %1, %2, %3, %4, %5, %6, %7);" - : /* no return value */ - : "r"( exceptionCode ), "r"( exceptionDetail0 ), "r"( exceptionDetail1 ), "r"( exceptionDetail2 ), "r"( exceptionDetail3 ), "r"( exceptionDetail4 ), "r"( exceptionDetail5 ), "r"( exceptionDetail6 ) - : ); -} - -static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0, unsigned int exceptionDetail1, unsigned int exceptionDetail2, unsigned int exceptionDetail3, unsigned int exceptionDetail4, unsigned int exceptionDetail5, unsigned int exceptionDetail6, unsigned int exceptionDetail7 ) -{ - asm volatile( - "call _optix_throw_exception_8, (%0, %1, %2, %3, %4, %5, %6, %7, %8);" - : /* no return value */ - : "r"( exceptionCode ), "r"( exceptionDetail0 ), "r"( exceptionDetail1 ), "r"( exceptionDetail2 ), "r"( exceptionDetail3 ), "r"( exceptionDetail4 ), "r"( exceptionDetail5 ), "r"( exceptionDetail6 ), "r"( exceptionDetail7 ) - : ); -} - -static __forceinline__ __device__ int optixGetExceptionCode() -{ - int s0; - asm( "call (%0), _optix_get_exception_code, ();" : "=r"( s0 ) : ); - return s0; -} - -#define OPTIX_DEFINE_optixGetExceptionDetail_BODY( which ) \ - unsigned int ret; \ - asm( "call (%0), _optix_get_exception_detail_" #which ", ();" : "=r"( ret ) : ); \ - return ret; - -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_0() -{ - OPTIX_DEFINE_optixGetExceptionDetail_BODY( 0 ); -} - -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_1() -{ - OPTIX_DEFINE_optixGetExceptionDetail_BODY( 1 ); -} - -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_2() -{ - OPTIX_DEFINE_optixGetExceptionDetail_BODY( 2 ); -} - -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_3() -{ - OPTIX_DEFINE_optixGetExceptionDetail_BODY( 3 ); -} - -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_4() -{ - OPTIX_DEFINE_optixGetExceptionDetail_BODY( 4 ); -} - -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_5() -{ - OPTIX_DEFINE_optixGetExceptionDetail_BODY( 5 ); -} - -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_6() -{ - OPTIX_DEFINE_optixGetExceptionDetail_BODY( 6 ); -} - -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_7() -{ - OPTIX_DEFINE_optixGetExceptionDetail_BODY( 7 ); -} - -#undef OPTIX_DEFINE_optixGetExceptionDetail_BODY - - -static __forceinline__ __device__ char* optixGetExceptionLineInfo() -{ - unsigned long long ptr; - asm( "call (%0), _optix_get_exception_line_info, ();" : "=l"(ptr) : ); - return (char*)ptr; -} - -template -static __forceinline__ __device__ ReturnT optixDirectCall( unsigned int sbtIndex, ArgTypes... args ) -{ - unsigned long long func; - asm( "call (%0), _optix_call_direct_callable,(%1);" : "=l"( func ) : "r"( sbtIndex ) : ); - using funcT = ReturnT ( * )( ArgTypes... ); - funcT call = ( funcT )( func ); - return call( args... ); -} - -template -static __forceinline__ __device__ ReturnT optixContinuationCall( unsigned int sbtIndex, ArgTypes... args ) -{ - unsigned long long func; - asm( "call (%0), _optix_call_continuation_callable,(%1);" : "=l"( func ) : "r"( sbtIndex ) : ); - using funcT = ReturnT ( * )( ArgTypes... ); - funcT call = ( funcT )( func ); - return call( args... ); -} - -static __forceinline__ __device__ uint4 optixTexFootprint2D( unsigned long long tex, unsigned int texInfo, float x, float y, unsigned int* singleMipLevel ) -{ - uint4 result; - unsigned long long resultPtr = reinterpret_cast( &result ); - unsigned long long singleMipLevelPtr = reinterpret_cast( singleMipLevel ); - // Cast float args to integers, because the intrinics take .b32 arguments when compiled to PTX. - asm volatile( - "call _optix_tex_footprint_2d_v2" - ", (%0, %1, %2, %3, %4, %5);" - : - : "l"( tex ), "r"( texInfo ), "r"( __float_as_uint( x ) ), "r"( __float_as_uint( y ) ), - "l"( singleMipLevelPtr ), "l"( resultPtr ) - : ); - return result; -} - -static __forceinline__ __device__ uint4 optixTexFootprint2DGrad( unsigned long long tex, - unsigned int texInfo, - float x, - float y, - float dPdx_x, - float dPdx_y, - float dPdy_x, - float dPdy_y, - bool coarse, - unsigned int* singleMipLevel ) -{ - uint4 result; - unsigned long long resultPtr = reinterpret_cast( &result ); - unsigned long long singleMipLevelPtr = reinterpret_cast( singleMipLevel ); - // Cast float args to integers, because the intrinics take .b32 arguments when compiled to PTX. - asm volatile( - "call _optix_tex_footprint_2d_grad_v2" - ", (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10);" - : - : "l"( tex ), "r"( texInfo ), "r"( __float_as_uint( x ) ), "r"( __float_as_uint( y ) ), - "r"( __float_as_uint( dPdx_x ) ), "r"( __float_as_uint( dPdx_y ) ), "r"( __float_as_uint( dPdy_x ) ), - "r"( __float_as_uint( dPdy_y ) ), "r"( static_cast( coarse ) ), "l"( singleMipLevelPtr ), "l"( resultPtr ) - : ); - - return result; -} - -static __forceinline__ __device__ uint4 -optixTexFootprint2DLod( unsigned long long tex, unsigned int texInfo, float x, float y, float level, bool coarse, unsigned int* singleMipLevel ) -{ - uint4 result; - unsigned long long resultPtr = reinterpret_cast( &result ); - unsigned long long singleMipLevelPtr = reinterpret_cast( singleMipLevel ); - // Cast float args to integers, because the intrinics take .b32 arguments when compiled to PTX. - asm volatile( - "call _optix_tex_footprint_2d_lod_v2" - ", (%0, %1, %2, %3, %4, %5, %6, %7);" - : - : "l"( tex ), "r"( texInfo ), "r"( __float_as_uint( x ) ), "r"( __float_as_uint( y ) ), - "r"( __float_as_uint( level ) ), "r"( static_cast( coarse ) ), "l"( singleMipLevelPtr ), "l"( resultPtr ) - : ); - return result; -} - -#endif // OPTIX_OPTIX_DEVICE_IMPL_H diff --git a/crtx/optix_9.1/internal/optix_device_impl_coop_vec.h b/crtx/optix_9.1/internal/optix_device_impl_coop_vec.h deleted file mode 100644 index 7e936db..0000000 --- a/crtx/optix_9.1/internal/optix_device_impl_coop_vec.h +++ /dev/null @@ -1,951 +0,0 @@ -/* -* SPDX-FileCopyrightText: Copyright (c) 2019 - 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -* SPDX-License-Identifier: LicenseRef-NvidiaProprietary -* -* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual -* property and proprietary rights in and to this material, related -* documentation and any modifications thereto. Any use, reproduction, -* disclosure or distribution of this material and related documentation -* without an express license agreement from NVIDIA CORPORATION or -* its affiliates is strictly prohibited. -*/ -/// @file optix_device_impl_coopvec.h -/// @author NVIDIA Corporation -/// @brief OptiX public API header -/// - -#ifndef OPTIX_OPTIX_DEVICE_IMPL_COOP_VEC_H -#define OPTIX_OPTIX_DEVICE_IMPL_COOP_VEC_H - -#if !defined( __OPTIX_INCLUDE_INTERNAL_HEADERS__ ) -#error("optix_device_impl.h is an internal header file and must not be used directly. Please use optix_device.h or optix.h instead.") -#endif - -namespace optix_internal { - -typedef enum OptixCoopVecOp -{ - OPTIX_COOP_VEC_OP_UNKNOWN = 0x2A20, - OPTIX_COOP_VEC_OP_EXP2 = 0x2A21, - OPTIX_COOP_VEC_OP_LOG2 = 0x2A22, - OPTIX_COOP_VEC_OP_TANH = 0x2A23, - OPTIX_COOP_VEC_OP_MAX = 0x2A24, - OPTIX_COOP_VEC_OP_MIN = 0x2A25, - OPTIX_COOP_VEC_OP_FFMA = 0x2A26, - OPTIX_COOP_VEC_OP_MUL = 0x2A27, - OPTIX_COOP_VEC_OP_ADD = 0x2A28, - OPTIX_COOP_VEC_OP_SUB = 0x2A29, - OPTIX_COOP_VEC_OP_CVT = 0x2A2A, - OPTIX_COOP_VEC_OP_STEP = 0x2A2B, -} OptixCoopVecOp; -} // end namespace optix_internal - -#if !defined( OPTIX_DONT_INCLUDE_CUDA ) -// If OPTIX_DONT_INCLUDE_CUDA is defined, cuda driver types must be defined through other -// means before including optix headers. -#include -#endif - - -namespace optix_internal { -namespace coop_vec_type_traits { -// clang-format off - -// We need to implement code that is available in since nvrtc does not support the header. -// Custom is_float implementation - specialized only for half and float -template struct is_float { static const bool value = false; }; -template <> struct is_float { static const bool value = true; }; -template <> struct is_float { static const bool value = true; }; - -template struct is_integral { static const bool value = !is_float::value; }; - -template struct is_signed_impl { static const bool value = static_cast(-1) < static_cast(0); }; - -// If it's a float type, it's signed. Otherwise use the generic test. -template -struct is_signed { static const bool value = is_float::value ? true : is_signed_impl::value; }; -// NVRTC is stricter about template instantiation requirements and requires both branches of a ternary operator -// to be syntactically valid during compilation, so we need to explicitly specialize half to bypass the generic -// is_signed_impl template that uses static_cast, avoiding the ambiguous conversion issue entirely. -template <> struct is_signed { static const bool value = true; }; - -template struct TT; -template <> struct TT { static const OptixCoopVecElemType value = OPTIX_COOP_VEC_ELEM_TYPE_INT8; }; -template <> struct TT { static const OptixCoopVecElemType value = OPTIX_COOP_VEC_ELEM_TYPE_UINT8; }; -template <> struct TT { static const OptixCoopVecElemType value = OPTIX_COOP_VEC_ELEM_TYPE_INT32; }; -template <> struct TT { static const OptixCoopVecElemType value = OPTIX_COOP_VEC_ELEM_TYPE_UINT32; }; -template <> struct TT { static const OptixCoopVecElemType value = OPTIX_COOP_VEC_ELEM_TYPE_FLOAT32; }; -template <> struct TT { static const OptixCoopVecElemType value = OPTIX_COOP_VEC_ELEM_TYPE_FLOAT16; }; - -template< size_t byte_size > struct TB; -template<> struct TB<1> { using bitType = unsigned char; }; -template<> struct TB<2> { using bitType = unsigned short; }; -template<> struct TB<4> { using bitType = unsigned int; }; -// clang-format on - -// The non-specialized template can take advantage of all the built-in types, while for -// other special types like half, will be handled by specialization. -template -struct OptixCoopVecElemTypeTrait -{ - static const OptixCoopVecElemType elementType = - TT::value, coop_vec_type_traits::is_signed::value, sizeof( T )>::value; - using bitType = typename TB::bitType; -}; -} // end namespace coop_vec_type_traits -} // end namespace optix_internal - -namespace optix_internal { - -template -struct OptixCoopVecLoadASMGenerator -{ - static const OptixCoopVecElemType outputElementType = - optix_internal::coop_vec_type_traits::OptixCoopVecElemTypeTrait::elementType; - using outputBitType = - typename optix_internal::coop_vec_type_traits::OptixCoopVecElemTypeTrait::bitType; - - __forceinline__ __device__ static VecTOut generateASMPtr( CUdeviceptr ptr ) - { - VecTOut result; - asm( "call" - "()," - "_optix_vector_load_ptr," - "(%0,%1,%2,%3);" - : - : "r"( outputElementType ), "r"( VecTOut::size ), "l"( ptr ), "l"( result.data() ) ); - return result; - } - __forceinline__ __device__ static VecTOut generateASM( CUdeviceptr ptr ) - { - if( VecTOut::size > 64 || sizeof( typename VecTOut::value_type ) > sizeof( unsigned int ) ) - return generateASMPtr( ptr ); - else - { - // This code needs to live in an else, block otherwise the compiler will - // complain about the loop being unreachable. - unsigned int O[64]; - if( VecTOut::size <= 16 ) - asm( "call" - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15)," - "_optix_vector_load_16xi32," - "(%16,%17,%18);" - : "=r"( O[0] ), "=r"( O[1] ), "=r"( O[2] ), "=r"( O[3] ), "=r"( O[4] ), "=r"( O[5] ), "=r"( O[6] ), - "=r"( O[7] ), "=r"( O[8] ), "=r"( O[9] ), "=r"( O[10] ), "=r"( O[11] ), "=r"( O[12] ), - "=r"( O[13] ), "=r"( O[14] ), "=r"( O[15] ) - : "r"( outputElementType ), "r"( VecTOut::size ), "l"( ptr ) ); - else - asm( "call" - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%17,%18,%19,%20,%21,%22,%23,%24,%25,%" - "26,%27,%28,%29,%30,%31,%32,%33,%34,%35,%36,%37,%38,%39,%40,%41,%42,%43,%44,%45,%46,%47,%48,%49,%" - "50,%51,%52,%53,%54,%55,%56,%57,%58,%59,%60,%61,%62,%63)," - "_optix_vector_load_64xi32," - "(%64,%65,%66);" - : "=r"( O[0] ), "=r"( O[1] ), "=r"( O[2] ), "=r"( O[3] ), "=r"( O[4] ), "=r"( O[5] ), "=r"( O[6] ), - "=r"( O[7] ), "=r"( O[8] ), "=r"( O[9] ), "=r"( O[10] ), "=r"( O[11] ), "=r"( O[12] ), - "=r"( O[13] ), "=r"( O[14] ), "=r"( O[15] ), "=r"( O[16] ), "=r"( O[17] ), "=r"( O[18] ), - "=r"( O[19] ), "=r"( O[20] ), "=r"( O[21] ), "=r"( O[22] ), "=r"( O[23] ), "=r"( O[24] ), - "=r"( O[25] ), "=r"( O[26] ), "=r"( O[27] ), "=r"( O[28] ), "=r"( O[29] ), "=r"( O[30] ), - "=r"( O[31] ), "=r"( O[32] ), "=r"( O[33] ), "=r"( O[34] ), "=r"( O[35] ), "=r"( O[36] ), - "=r"( O[37] ), "=r"( O[38] ), "=r"( O[39] ), "=r"( O[40] ), "=r"( O[41] ), "=r"( O[42] ), - "=r"( O[43] ), "=r"( O[44] ), "=r"( O[45] ), "=r"( O[46] ), "=r"( O[47] ), "=r"( O[48] ), - "=r"( O[49] ), "=r"( O[50] ), "=r"( O[51] ), "=r"( O[52] ), "=r"( O[53] ), "=r"( O[54] ), - "=r"( O[55] ), "=r"( O[56] ), "=r"( O[57] ), "=r"( O[58] ), "=r"( O[59] ), "=r"( O[60] ), - "=r"( O[61] ), "=r"( O[62] ), "=r"( O[63] ) - : "r"( outputElementType ), "r"( VecTOut::size ), "l"( ptr ) ); - - VecTOut result; - for( unsigned int i = 0; i < VecTOut::size; ++i ) - { - outputBitType o = O[i]; - result[i] = *( reinterpret_cast( &( o ) ) ); - } - return result; - } - } -}; - - -template -struct OptixCoopVecASMGenerator -{ - static const OptixCoopVecElemType outputElementType = - optix_internal::coop_vec_type_traits::OptixCoopVecElemTypeTrait::elementType; - using outputBitType = - typename optix_internal::coop_vec_type_traits::OptixCoopVecElemTypeTrait::bitType; - static const OptixCoopVecElemType inputElementType = - optix_internal::coop_vec_type_traits::OptixCoopVecElemTypeTrait::elementType; - using inputBitType = - typename optix_internal::coop_vec_type_traits::OptixCoopVecElemTypeTrait::bitType; - - __forceinline__ __device__ static VecTOut generateASMPtr( const VecTIn& vecA ) - { - VecTOut result; - asm( "call" - "()," - "_optix_vector_op1_ptr," - "(%0,%1,%2,%3,%4,%5,%6);" - : - : "r"( VectorOp ), "r"( outputElementType ), "r"( VecTOut::size ), "r"( inputElementType ), - "r"( VecTIn::size ), "l"( vecA.data() ), "l"( result.data() ) ); - return result; - } - - __forceinline__ __device__ static VecTOut generateASMPtr( const VecTIn& vecA, const VecTIn& vecB ) - { - VecTOut result; - asm( "call" - "()," - "_optix_vector_op2_ptr," - "(%0,%1,%2,%3,%4,%5,%6,%7);" - : - : "r"( VectorOp ), "r"( outputElementType ), "r"( VecTOut::size ), "r"( inputElementType ), - "r"( VecTIn::size ), "l"( vecA.data() ), "l"( vecB.data() ), "l"( result.data() ) ); - return result; - } - - __forceinline__ __device__ static VecTOut generateASMPtr( const VecTIn& vecA, const VecTIn& vecB, const VecTIn& vecC ) - { - VecTOut result; - asm( "call" - "()," - "_optix_vector_op3_ptr," - "(%0,%1,%2,%3,%4,%5,%6,%7,%8);" - : - : "r"( VectorOp ), "r"( outputElementType ), "r"( VecTOut::size ), "r"( inputElementType ), - "r"( VecTIn::size ), "l"( vecA.data() ), "l"( vecB.data() ), "l"( vecC.data() ), "l"( result.data() ) ); - return result; - } - - __forceinline__ __device__ static VecTOut generateASM( const VecTIn& vecA ) - { - if( VecTIn::size > 64 || VecTOut::size > 64 || sizeof( typename VecTIn::value_type ) > sizeof( unsigned int ) - || sizeof( typename VecTOut::value_type ) > sizeof( unsigned int ) ) - return generateASMPtr( vecA ); - else - { - // This code needs to live in an else, block otherwise the compiler will - // complain about the loop being unreachable. - unsigned int IA[64]; - unsigned int O[64]; - for( unsigned int i = 0; i < VecTIn::size; ++i ) - { - IA[i] = *( reinterpret_cast( &( vecA[i] ) ) ); - } - if( VecTOut::size <= 16 && VecTIn::size <= 16 ) - asm( "call" - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15)," - "_optix_vector_op1_16xi32," - "(%16,%17,%18,%19,%20,%21,%22,%23,%24,%25,%26,%27,%28,%29,%30,%31,%32,%33,%34,%35,%36);" - : "=r"( O[0] ), "=r"( O[1] ), "=r"( O[2] ), "=r"( O[3] ), "=r"( O[4] ), "=r"( O[5] ), "=r"( O[6] ), - "=r"( O[7] ), "=r"( O[8] ), "=r"( O[9] ), "=r"( O[10] ), "=r"( O[11] ), "=r"( O[12] ), - "=r"( O[13] ), "=r"( O[14] ), "=r"( O[15] ) - : "r"( VectorOp ), "r"( outputElementType ), "r"( VecTOut::size ), "r"( inputElementType ), - "r"( VecTIn::size ), "r"( IA[0] ), "r"( IA[1] ), "r"( IA[2] ), "r"( IA[3] ), "r"( IA[4] ), - "r"( IA[5] ), "r"( IA[6] ), "r"( IA[7] ), "r"( IA[8] ), "r"( IA[9] ), "r"( IA[10] ), - "r"( IA[11] ), "r"( IA[12] ), "r"( IA[13] ), "r"( IA[14] ), "r"( IA[15] ) ); - else - asm( "call" - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%17,%18,%19,%20,%21,%22,%23,%24,%25,%" - "26,%27,%28,%29,%30,%31,%32,%33,%34,%35,%36,%37,%38,%39,%40,%41,%42,%43,%44,%45,%46,%47,%48,%49,%" - "50,%51,%52,%53,%54,%55,%56,%57,%58,%59,%60,%61,%62,%63)," - "_optix_vector_op1_64xi32," - "(%64,%65,%66,%67,%68,%69,%70,%71,%72,%73,%74,%75,%76,%77,%78,%79,%80,%81,%82,%83,%84,%85,%86,%87," - "%88,%89,%90,%91,%92,%93,%94,%95,%96,%97,%98,%99,%100,%101,%102,%103,%104,%105,%106,%107,%108,%" - "109,%110,%111,%112,%113,%114,%115,%116,%117,%118,%119,%120,%121,%122,%123,%124,%125,%126,%127,%" - "128,%129,%130,%131,%132);" - : "=r"( O[0] ), "=r"( O[1] ), "=r"( O[2] ), "=r"( O[3] ), "=r"( O[4] ), "=r"( O[5] ), "=r"( O[6] ), - "=r"( O[7] ), "=r"( O[8] ), "=r"( O[9] ), "=r"( O[10] ), "=r"( O[11] ), "=r"( O[12] ), - "=r"( O[13] ), "=r"( O[14] ), "=r"( O[15] ), "=r"( O[16] ), "=r"( O[17] ), "=r"( O[18] ), - "=r"( O[19] ), "=r"( O[20] ), "=r"( O[21] ), "=r"( O[22] ), "=r"( O[23] ), "=r"( O[24] ), - "=r"( O[25] ), "=r"( O[26] ), "=r"( O[27] ), "=r"( O[28] ), "=r"( O[29] ), "=r"( O[30] ), - "=r"( O[31] ), "=r"( O[32] ), "=r"( O[33] ), "=r"( O[34] ), "=r"( O[35] ), "=r"( O[36] ), - "=r"( O[37] ), "=r"( O[38] ), "=r"( O[39] ), "=r"( O[40] ), "=r"( O[41] ), "=r"( O[42] ), - "=r"( O[43] ), "=r"( O[44] ), "=r"( O[45] ), "=r"( O[46] ), "=r"( O[47] ), "=r"( O[48] ), - "=r"( O[49] ), "=r"( O[50] ), "=r"( O[51] ), "=r"( O[52] ), "=r"( O[53] ), "=r"( O[54] ), - "=r"( O[55] ), "=r"( O[56] ), "=r"( O[57] ), "=r"( O[58] ), "=r"( O[59] ), "=r"( O[60] ), - "=r"( O[61] ), "=r"( O[62] ), "=r"( O[63] ) - : "r"( VectorOp ), "r"( outputElementType ), "r"( VecTOut::size ), "r"( inputElementType ), - "r"( VecTIn::size ), "r"( IA[0] ), "r"( IA[1] ), "r"( IA[2] ), "r"( IA[3] ), "r"( IA[4] ), - "r"( IA[5] ), "r"( IA[6] ), "r"( IA[7] ), "r"( IA[8] ), "r"( IA[9] ), "r"( IA[10] ), - "r"( IA[11] ), "r"( IA[12] ), "r"( IA[13] ), "r"( IA[14] ), "r"( IA[15] ), "r"( IA[16] ), - "r"( IA[17] ), "r"( IA[18] ), "r"( IA[19] ), "r"( IA[20] ), "r"( IA[21] ), "r"( IA[22] ), - "r"( IA[23] ), "r"( IA[24] ), "r"( IA[25] ), "r"( IA[26] ), "r"( IA[27] ), "r"( IA[28] ), - "r"( IA[29] ), "r"( IA[30] ), "r"( IA[31] ), "r"( IA[32] ), "r"( IA[33] ), "r"( IA[34] ), - "r"( IA[35] ), "r"( IA[36] ), "r"( IA[37] ), "r"( IA[38] ), "r"( IA[39] ), "r"( IA[40] ), - "r"( IA[41] ), "r"( IA[42] ), "r"( IA[43] ), "r"( IA[44] ), "r"( IA[45] ), "r"( IA[46] ), - "r"( IA[47] ), "r"( IA[48] ), "r"( IA[49] ), "r"( IA[50] ), "r"( IA[51] ), "r"( IA[52] ), - "r"( IA[53] ), "r"( IA[54] ), "r"( IA[55] ), "r"( IA[56] ), "r"( IA[57] ), "r"( IA[58] ), - "r"( IA[59] ), "r"( IA[60] ), "r"( IA[61] ), "r"( IA[62] ), "r"( IA[63] ) ); - - VecTOut result; - for( unsigned int i = 0; i < VecTOut::size; ++i ) - { - outputBitType o = O[i]; - result[i] = *( reinterpret_cast( &( o ) ) ); - } - return result; - } - } - - __forceinline__ __device__ static VecTOut generateASM( const VecTIn& vecA, const VecTIn& vecB ) - { - if( VecTIn::size > 64 || VecTOut::size > 64 || sizeof( typename VecTIn::value_type ) > sizeof( unsigned int ) - || sizeof( typename VecTOut::value_type ) > sizeof( unsigned int ) ) - return generateASMPtr( vecA, vecB ); - else - { - // This code needs to live in an else, block otherwise the compiler will - // complain about the loop being unreachable. - unsigned int IA[64]; - unsigned int IB[64]; - unsigned int O[64]; - for( unsigned int i = 0; i < VecTIn::size; ++i ) - { - IA[i] = *( reinterpret_cast( &( vecA[i] ) ) ); - IB[i] = *( reinterpret_cast( &( vecB[i] ) ) ); - } - if( VecTOut::size <= 16 && VecTIn::size <= 16 ) - asm( "call" - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15)," - "_optix_vector_op2_16xi32," - "(%16,%17,%18,%19,%20,%21,%22,%23,%24,%25,%26,%27,%28,%29,%30,%31,%32,%33,%34,%35,%36,%37,%38,%39," - "%40,%41,%42,%43,%44,%45,%46,%47,%48,%49,%50,%51,%52);" - : "=r"( O[0] ), "=r"( O[1] ), "=r"( O[2] ), "=r"( O[3] ), "=r"( O[4] ), "=r"( O[5] ), "=r"( O[6] ), - "=r"( O[7] ), "=r"( O[8] ), "=r"( O[9] ), "=r"( O[10] ), "=r"( O[11] ), "=r"( O[12] ), - "=r"( O[13] ), "=r"( O[14] ), "=r"( O[15] ) - : "r"( VectorOp ), "r"( outputElementType ), "r"( VecTOut::size ), "r"( inputElementType ), - "r"( VecTIn::size ), "r"( IA[0] ), "r"( IA[1] ), "r"( IA[2] ), "r"( IA[3] ), "r"( IA[4] ), - "r"( IA[5] ), "r"( IA[6] ), "r"( IA[7] ), "r"( IA[8] ), "r"( IA[9] ), "r"( IA[10] ), "r"( IA[11] ), - "r"( IA[12] ), "r"( IA[13] ), "r"( IA[14] ), "r"( IA[15] ), "r"( IB[0] ), "r"( IB[1] ), "r"( IB[2] ), - "r"( IB[3] ), "r"( IB[4] ), "r"( IB[5] ), "r"( IB[6] ), "r"( IB[7] ), "r"( IB[8] ), "r"( IB[9] ), - "r"( IB[10] ), "r"( IB[11] ), "r"( IB[12] ), "r"( IB[13] ), "r"( IB[14] ), "r"( IB[15] ) ); - else - asm( "call" - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%17,%18,%19,%20,%21,%22,%23,%24,%25,%" - "26,%27,%28,%29,%30,%31,%32,%33,%34,%35,%36,%37,%38,%39,%40,%41,%42,%43,%44,%45,%46,%47,%48,%49,%" - "50,%51,%52,%53,%54,%55,%56,%57,%58,%59,%60,%61,%62,%63)," - "_optix_vector_op2_64xi32," - "(%64,%65,%66,%67,%68,%69,%70,%71,%72,%73,%74,%75,%76,%77,%78,%79,%80,%81,%82,%83,%84,%85,%86,%87," - "%88,%89,%90,%91,%92,%93,%94,%95,%96,%97,%98,%99,%100,%101,%102,%103,%104,%105,%106,%107,%108,%" - "109,%110,%111,%112,%113,%114,%115,%116,%117,%118,%119,%120,%121,%122,%123,%124,%125,%126,%127,%" - "128,%129,%130,%131,%132,%133,%134,%135,%136,%137,%138,%139,%140,%141,%142,%143,%144,%145,%146,%" - "147,%148,%149,%150,%151,%152,%153,%154,%155,%156,%157,%158,%159,%160,%161,%162,%163,%164,%165,%" - "166,%167,%168,%169,%170,%171,%172,%173,%174,%175,%176,%177,%178,%179,%180,%181,%182,%183,%184,%" - "185,%186,%187,%188,%189,%190,%191,%192,%193,%194,%195,%196);" - : "=r"( O[0] ), "=r"( O[1] ), "=r"( O[2] ), "=r"( O[3] ), "=r"( O[4] ), "=r"( O[5] ), "=r"( O[6] ), - "=r"( O[7] ), "=r"( O[8] ), "=r"( O[9] ), "=r"( O[10] ), "=r"( O[11] ), "=r"( O[12] ), - "=r"( O[13] ), "=r"( O[14] ), "=r"( O[15] ), "=r"( O[16] ), "=r"( O[17] ), "=r"( O[18] ), - "=r"( O[19] ), "=r"( O[20] ), "=r"( O[21] ), "=r"( O[22] ), "=r"( O[23] ), "=r"( O[24] ), - "=r"( O[25] ), "=r"( O[26] ), "=r"( O[27] ), "=r"( O[28] ), "=r"( O[29] ), "=r"( O[30] ), - "=r"( O[31] ), "=r"( O[32] ), "=r"( O[33] ), "=r"( O[34] ), "=r"( O[35] ), "=r"( O[36] ), - "=r"( O[37] ), "=r"( O[38] ), "=r"( O[39] ), "=r"( O[40] ), "=r"( O[41] ), "=r"( O[42] ), - "=r"( O[43] ), "=r"( O[44] ), "=r"( O[45] ), "=r"( O[46] ), "=r"( O[47] ), "=r"( O[48] ), - "=r"( O[49] ), "=r"( O[50] ), "=r"( O[51] ), "=r"( O[52] ), "=r"( O[53] ), "=r"( O[54] ), - "=r"( O[55] ), "=r"( O[56] ), "=r"( O[57] ), "=r"( O[58] ), "=r"( O[59] ), "=r"( O[60] ), - "=r"( O[61] ), "=r"( O[62] ), "=r"( O[63] ) - : "r"( VectorOp ), "r"( outputElementType ), "r"( VecTOut::size ), "r"( inputElementType ), - "r"( VecTIn::size ), "r"( IA[0] ), "r"( IA[1] ), "r"( IA[2] ), "r"( IA[3] ), "r"( IA[4] ), - "r"( IA[5] ), "r"( IA[6] ), "r"( IA[7] ), "r"( IA[8] ), "r"( IA[9] ), "r"( IA[10] ), "r"( IA[11] ), - "r"( IA[12] ), "r"( IA[13] ), "r"( IA[14] ), "r"( IA[15] ), "r"( IA[16] ), "r"( IA[17] ), - "r"( IA[18] ), "r"( IA[19] ), "r"( IA[20] ), "r"( IA[21] ), "r"( IA[22] ), "r"( IA[23] ), - "r"( IA[24] ), "r"( IA[25] ), "r"( IA[26] ), "r"( IA[27] ), "r"( IA[28] ), "r"( IA[29] ), - "r"( IA[30] ), "r"( IA[31] ), "r"( IA[32] ), "r"( IA[33] ), "r"( IA[34] ), "r"( IA[35] ), - "r"( IA[36] ), "r"( IA[37] ), "r"( IA[38] ), "r"( IA[39] ), "r"( IA[40] ), "r"( IA[41] ), - "r"( IA[42] ), "r"( IA[43] ), "r"( IA[44] ), "r"( IA[45] ), "r"( IA[46] ), "r"( IA[47] ), - "r"( IA[48] ), "r"( IA[49] ), "r"( IA[50] ), "r"( IA[51] ), "r"( IA[52] ), "r"( IA[53] ), - "r"( IA[54] ), "r"( IA[55] ), "r"( IA[56] ), "r"( IA[57] ), "r"( IA[58] ), "r"( IA[59] ), - "r"( IA[60] ), "r"( IA[61] ), "r"( IA[62] ), "r"( IA[63] ), "r"( IB[0] ), "r"( IB[1] ), "r"( IB[2] ), - "r"( IB[3] ), "r"( IB[4] ), "r"( IB[5] ), "r"( IB[6] ), "r"( IB[7] ), "r"( IB[8] ), "r"( IB[9] ), - "r"( IB[10] ), "r"( IB[11] ), "r"( IB[12] ), "r"( IB[13] ), "r"( IB[14] ), "r"( IB[15] ), - "r"( IB[16] ), "r"( IB[17] ), "r"( IB[18] ), "r"( IB[19] ), "r"( IB[20] ), "r"( IB[21] ), - "r"( IB[22] ), "r"( IB[23] ), "r"( IB[24] ), "r"( IB[25] ), "r"( IB[26] ), "r"( IB[27] ), - "r"( IB[28] ), "r"( IB[29] ), "r"( IB[30] ), "r"( IB[31] ), "r"( IB[32] ), "r"( IB[33] ), - "r"( IB[34] ), "r"( IB[35] ), "r"( IB[36] ), "r"( IB[37] ), "r"( IB[38] ), "r"( IB[39] ), - "r"( IB[40] ), "r"( IB[41] ), "r"( IB[42] ), "r"( IB[43] ), "r"( IB[44] ), "r"( IB[45] ), - "r"( IB[46] ), "r"( IB[47] ), "r"( IB[48] ), "r"( IB[49] ), "r"( IB[50] ), "r"( IB[51] ), - "r"( IB[52] ), "r"( IB[53] ), "r"( IB[54] ), "r"( IB[55] ), "r"( IB[56] ), "r"( IB[57] ), - "r"( IB[58] ), "r"( IB[59] ), "r"( IB[60] ), "r"( IB[61] ), "r"( IB[62] ), "r"( IB[63] ) ); - - VecTOut result; - for( unsigned int i = 0; i < VecTOut::size; ++i ) - { - outputBitType o = O[i]; - result[i] = *( reinterpret_cast( &( o ) ) ); - } - return result; - } - } - - __forceinline__ __device__ static VecTOut generateASM( const VecTIn& vecA, const VecTIn& vecB, const VecTIn& vecC ) - { - if( VecTIn::size > 64 || VecTOut::size > 64 || sizeof( typename VecTIn::value_type ) > sizeof( unsigned int ) - || sizeof( typename VecTOut::value_type ) > sizeof( unsigned int ) ) - return generateASMPtr( vecA, vecB, vecC ); - else - { - // This code needs to live in an else, block otherwise the compiler will - // complain about the loop being unreachable. - unsigned int IA[64]; - unsigned int IB[64]; - unsigned int IC[64]; - unsigned int O[64]; - for( unsigned int i = 0; i < VecTIn::size; ++i ) - { - IA[i] = *( reinterpret_cast( &( vecA[i] ) ) ); - IB[i] = *( reinterpret_cast( &( vecB[i] ) ) ); - IC[i] = *( reinterpret_cast( &( vecC[i] ) ) ); - } - if( VecTOut::size <= 16 && VecTIn::size <= 16 ) - asm( "call" - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15)," - "_optix_vector_op3_16xi32," - "(%16,%17,%18,%19,%20,%21,%22,%23,%24,%25,%26,%27,%28,%29,%30,%31,%32,%33,%34,%35,%36,%37,%38,%39," - "%40,%41,%42,%43,%44,%45,%46,%47,%48,%49,%50,%51,%52,%53,%54,%55,%56,%57,%58,%59,%60,%61,%62,%63,%" - "64,%65,%66,%67,%68);" - : "=r"( O[0] ), "=r"( O[1] ), "=r"( O[2] ), "=r"( O[3] ), "=r"( O[4] ), "=r"( O[5] ), "=r"( O[6] ), - "=r"( O[7] ), "=r"( O[8] ), "=r"( O[9] ), "=r"( O[10] ), "=r"( O[11] ), "=r"( O[12] ), - "=r"( O[13] ), "=r"( O[14] ), "=r"( O[15] ) - : "r"( VectorOp ), "r"( outputElementType ), "r"( VecTOut::size ), "r"( inputElementType ), - "r"( VecTIn::size ), "r"( IA[0] ), "r"( IA[1] ), "r"( IA[2] ), "r"( IA[3] ), "r"( IA[4] ), - "r"( IA[5] ), "r"( IA[6] ), "r"( IA[7] ), "r"( IA[8] ), "r"( IA[9] ), "r"( IA[10] ), - "r"( IA[11] ), "r"( IA[12] ), "r"( IA[13] ), "r"( IA[14] ), "r"( IA[15] ), "r"( IB[0] ), - "r"( IB[1] ), "r"( IB[2] ), "r"( IB[3] ), "r"( IB[4] ), "r"( IB[5] ), "r"( IB[6] ), "r"( IB[7] ), - "r"( IB[8] ), "r"( IB[9] ), "r"( IB[10] ), "r"( IB[11] ), "r"( IB[12] ), "r"( IB[13] ), - "r"( IB[14] ), "r"( IB[15] ), "r"( IC[0] ), "r"( IC[1] ), "r"( IC[2] ), "r"( IC[3] ), - "r"( IC[4] ), "r"( IC[5] ), "r"( IC[6] ), "r"( IC[7] ), "r"( IC[8] ), "r"( IC[9] ), - "r"( IC[10] ), "r"( IC[11] ), "r"( IC[12] ), "r"( IC[13] ), "r"( IC[14] ), "r"( IC[15] ) ); - else - asm( "call" - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%17,%18,%19,%20,%21,%22,%23,%24,%25,%" - "26,%27,%28,%29,%30,%31,%32,%33,%34,%35,%36,%37,%38,%39,%40,%41,%42,%43,%44,%45,%46,%47,%48,%49,%" - "50,%51,%52,%53,%54,%55,%56,%57,%58,%59,%60,%61,%62,%63)," - "_optix_vector_op3_64xi32," - "(%64,%65,%66,%67,%68,%69,%70,%71,%72,%73,%74,%75,%76,%77,%78,%79,%80,%81,%82,%83,%84,%85,%86,%87," - "%88,%89,%90,%91,%92,%93,%94,%95,%96,%97,%98,%99,%100,%101,%102,%103,%104,%105,%106,%107,%108,%" - "109,%110,%111,%112,%113,%114,%115,%116,%117,%118,%119,%120,%121,%122,%123,%124,%125,%126,%127,%" - "128,%129,%130,%131,%132,%133,%134,%135,%136,%137,%138,%139,%140,%141,%142,%143,%144,%145,%146,%" - "147,%148,%149,%150,%151,%152,%153,%154,%155,%156,%157,%158,%159,%160,%161,%162,%163,%164,%165,%" - "166,%167,%168,%169,%170,%171,%172,%173,%174,%175,%176,%177,%178,%179,%180,%181,%182,%183,%184,%" - "185,%186,%187,%188,%189,%190,%191,%192,%193,%194,%195,%196,%197,%198,%199,%200,%201,%202,%203,%" - "204,%205,%206,%207,%208,%209,%210,%211,%212,%213,%214,%215,%216,%217,%218,%219,%220,%221,%222,%" - "223,%224,%225,%226,%227,%228,%229,%230,%231,%232,%233,%234,%235,%236,%237,%238,%239,%240,%241,%" - "242,%243,%244,%245,%246,%247,%248,%249,%250,%251,%252,%253,%254,%255,%256,%257,%258,%259,%260);" - : "=r"( O[0] ), "=r"( O[1] ), "=r"( O[2] ), "=r"( O[3] ), "=r"( O[4] ), "=r"( O[5] ), "=r"( O[6] ), - "=r"( O[7] ), "=r"( O[8] ), "=r"( O[9] ), "=r"( O[10] ), "=r"( O[11] ), "=r"( O[12] ), - "=r"( O[13] ), "=r"( O[14] ), "=r"( O[15] ), "=r"( O[16] ), "=r"( O[17] ), "=r"( O[18] ), - "=r"( O[19] ), "=r"( O[20] ), "=r"( O[21] ), "=r"( O[22] ), "=r"( O[23] ), "=r"( O[24] ), - "=r"( O[25] ), "=r"( O[26] ), "=r"( O[27] ), "=r"( O[28] ), "=r"( O[29] ), "=r"( O[30] ), - "=r"( O[31] ), "=r"( O[32] ), "=r"( O[33] ), "=r"( O[34] ), "=r"( O[35] ), "=r"( O[36] ), - "=r"( O[37] ), "=r"( O[38] ), "=r"( O[39] ), "=r"( O[40] ), "=r"( O[41] ), "=r"( O[42] ), - "=r"( O[43] ), "=r"( O[44] ), "=r"( O[45] ), "=r"( O[46] ), "=r"( O[47] ), "=r"( O[48] ), - "=r"( O[49] ), "=r"( O[50] ), "=r"( O[51] ), "=r"( O[52] ), "=r"( O[53] ), "=r"( O[54] ), - "=r"( O[55] ), "=r"( O[56] ), "=r"( O[57] ), "=r"( O[58] ), "=r"( O[59] ), "=r"( O[60] ), - "=r"( O[61] ), "=r"( O[62] ), "=r"( O[63] ) - : "r"( VectorOp ), "r"( outputElementType ), "r"( VecTOut::size ), "r"( inputElementType ), - "r"( VecTIn::size ), "r"( IA[0] ), "r"( IA[1] ), "r"( IA[2] ), "r"( IA[3] ), "r"( IA[4] ), - "r"( IA[5] ), "r"( IA[6] ), "r"( IA[7] ), "r"( IA[8] ), "r"( IA[9] ), "r"( IA[10] ), - "r"( IA[11] ), "r"( IA[12] ), "r"( IA[13] ), "r"( IA[14] ), "r"( IA[15] ), "r"( IA[16] ), - "r"( IA[17] ), "r"( IA[18] ), "r"( IA[19] ), "r"( IA[20] ), "r"( IA[21] ), "r"( IA[22] ), - "r"( IA[23] ), "r"( IA[24] ), "r"( IA[25] ), "r"( IA[26] ), "r"( IA[27] ), "r"( IA[28] ), - "r"( IA[29] ), "r"( IA[30] ), "r"( IA[31] ), "r"( IA[32] ), "r"( IA[33] ), "r"( IA[34] ), - "r"( IA[35] ), "r"( IA[36] ), "r"( IA[37] ), "r"( IA[38] ), "r"( IA[39] ), "r"( IA[40] ), - "r"( IA[41] ), "r"( IA[42] ), "r"( IA[43] ), "r"( IA[44] ), "r"( IA[45] ), "r"( IA[46] ), - "r"( IA[47] ), "r"( IA[48] ), "r"( IA[49] ), "r"( IA[50] ), "r"( IA[51] ), "r"( IA[52] ), - "r"( IA[53] ), "r"( IA[54] ), "r"( IA[55] ), "r"( IA[56] ), "r"( IA[57] ), "r"( IA[58] ), - "r"( IA[59] ), "r"( IA[60] ), "r"( IA[61] ), "r"( IA[62] ), "r"( IA[63] ), "r"( IB[0] ), - "r"( IB[1] ), "r"( IB[2] ), "r"( IB[3] ), "r"( IB[4] ), "r"( IB[5] ), "r"( IB[6] ), "r"( IB[7] ), - "r"( IB[8] ), "r"( IB[9] ), "r"( IB[10] ), "r"( IB[11] ), "r"( IB[12] ), "r"( IB[13] ), - "r"( IB[14] ), "r"( IB[15] ), "r"( IB[16] ), "r"( IB[17] ), "r"( IB[18] ), "r"( IB[19] ), - "r"( IB[20] ), "r"( IB[21] ), "r"( IB[22] ), "r"( IB[23] ), "r"( IB[24] ), "r"( IB[25] ), - "r"( IB[26] ), "r"( IB[27] ), "r"( IB[28] ), "r"( IB[29] ), "r"( IB[30] ), "r"( IB[31] ), - "r"( IB[32] ), "r"( IB[33] ), "r"( IB[34] ), "r"( IB[35] ), "r"( IB[36] ), "r"( IB[37] ), - "r"( IB[38] ), "r"( IB[39] ), "r"( IB[40] ), "r"( IB[41] ), "r"( IB[42] ), "r"( IB[43] ), - "r"( IB[44] ), "r"( IB[45] ), "r"( IB[46] ), "r"( IB[47] ), "r"( IB[48] ), "r"( IB[49] ), - "r"( IB[50] ), "r"( IB[51] ), "r"( IB[52] ), "r"( IB[53] ), "r"( IB[54] ), "r"( IB[55] ), - "r"( IB[56] ), "r"( IB[57] ), "r"( IB[58] ), "r"( IB[59] ), "r"( IB[60] ), "r"( IB[61] ), - "r"( IB[62] ), "r"( IB[63] ), "r"( IC[0] ), "r"( IC[1] ), "r"( IC[2] ), "r"( IC[3] ), - "r"( IC[4] ), "r"( IC[5] ), "r"( IC[6] ), "r"( IC[7] ), "r"( IC[8] ), "r"( IC[9] ), - "r"( IC[10] ), "r"( IC[11] ), "r"( IC[12] ), "r"( IC[13] ), "r"( IC[14] ), "r"( IC[15] ), - "r"( IC[16] ), "r"( IC[17] ), "r"( IC[18] ), "r"( IC[19] ), "r"( IC[20] ), "r"( IC[21] ), - "r"( IC[22] ), "r"( IC[23] ), "r"( IC[24] ), "r"( IC[25] ), "r"( IC[26] ), "r"( IC[27] ), - "r"( IC[28] ), "r"( IC[29] ), "r"( IC[30] ), "r"( IC[31] ), "r"( IC[32] ), "r"( IC[33] ), - "r"( IC[34] ), "r"( IC[35] ), "r"( IC[36] ), "r"( IC[37] ), "r"( IC[38] ), "r"( IC[39] ), - "r"( IC[40] ), "r"( IC[41] ), "r"( IC[42] ), "r"( IC[43] ), "r"( IC[44] ), "r"( IC[45] ), - "r"( IC[46] ), "r"( IC[47] ), "r"( IC[48] ), "r"( IC[49] ), "r"( IC[50] ), "r"( IC[51] ), - "r"( IC[52] ), "r"( IC[53] ), "r"( IC[54] ), "r"( IC[55] ), "r"( IC[56] ), "r"( IC[57] ), - "r"( IC[58] ), "r"( IC[59] ), "r"( IC[60] ), "r"( IC[61] ), "r"( IC[62] ), "r"( IC[63] ) ); - VecTOut result; - for( unsigned int i = 0; i < VecTOut::size; ++i ) - { - outputBitType o = O[i]; - result[i] = *( reinterpret_cast( &o ) ); - } - return result; - } - } -}; - -} // end namespace optix_internal - -template -static __forceinline__ __device__ VecTOut optixCoopVecLoad( CUdeviceptr ptr ) -{ - return optix_internal::OptixCoopVecLoadASMGenerator::generateASM( ptr ); -} - -template -static __forceinline__ __device__ VecTOut optixCoopVecLoad( T* ptr ) -{ - return optixCoopVecLoad( reinterpret_cast( ptr ) ); -} - - -template -static __forceinline__ __device__ VecT optixCoopVecExp2( const VecT& vec ) -{ - return optix_internal::OptixCoopVecASMGenerator::generateASM( vec ); -} - -template -static __forceinline__ __device__ VecT optixCoopVecLog2( const VecT& vec ) -{ - return optix_internal::OptixCoopVecASMGenerator::generateASM( vec ); -} - -template -static __forceinline__ __device__ VecT optixCoopVecTanh( const VecT& vec ) -{ - return optix_internal::OptixCoopVecASMGenerator::generateASM( vec ); -} - -template -static __forceinline__ __device__ VecTOut optixCoopVecCvt( const VecTIn& vec ) -{ - return optix_internal::OptixCoopVecASMGenerator::generateASM( vec ); -} - -template -static __forceinline__ __device__ VecT optixCoopVecMin( const VecT& vecA, const VecT& vecB ) -{ - return optix_internal::OptixCoopVecASMGenerator::generateASM( vecA, vecB ); -} - -template -static __forceinline__ __device__ VecT optixCoopVecMin( const VecT& vecA, typename VecT::value_type B ) -{ - VecT vecB( B ); - return optixCoopVecMin( vecA, vecB ); -} - -template -static __forceinline__ __device__ VecT optixCoopVecMax( const VecT& vecA, const VecT& vecB ) -{ - return optix_internal::OptixCoopVecASMGenerator::generateASM( vecA, vecB ); -} - -template -static __forceinline__ __device__ VecT optixCoopVecMax( const VecT& vecA, typename VecT::value_type B ) -{ - VecT vecB( B ); - return optixCoopVecMax( vecA, vecB ); -} - -template -static __forceinline__ __device__ VecT optixCoopVecMul( const VecT& vecA, const VecT& vecB ) -{ - return optix_internal::OptixCoopVecASMGenerator::generateASM( vecA, vecB ); -} - -template -static __forceinline__ __device__ VecT optixCoopVecAdd( const VecT& vecA, const VecT& vecB ) -{ - return optix_internal::OptixCoopVecASMGenerator::generateASM( vecA, vecB ); -} - -template -static __forceinline__ __device__ VecT optixCoopVecSub( const VecT& vecA, const VecT& vecB ) -{ - return optix_internal::OptixCoopVecASMGenerator::generateASM( vecA, vecB ); -} - -template -static __forceinline__ __device__ VecT optixCoopVecStep( const VecT& vecA, const VecT& vecB ) -{ - return optix_internal::OptixCoopVecASMGenerator::generateASM( vecA, vecB ); -} - -template -static __forceinline__ __device__ VecT optixCoopVecFFMA( const VecT& vecA, const VecT& vecB, const VecT& vecC ) -{ - return optix_internal::OptixCoopVecASMGenerator::generateASM( vecA, vecB, vecC ); -} - - -namespace optix_internal { -template -struct OptixCoopVecMatMulASMGenerator -{ - static const OptixCoopVecElemType outputElementType = - optix_internal::coop_vec_type_traits::OptixCoopVecElemTypeTrait::elementType; - using outputBitType = - typename optix_internal::coop_vec_type_traits::OptixCoopVecElemTypeTrait::bitType; - static const OptixCoopVecElemType inputElementType = - optix_internal::coop_vec_type_traits::OptixCoopVecElemTypeTrait::elementType; - using inputBitType = - typename optix_internal::coop_vec_type_traits::OptixCoopVecElemTypeTrait::bitType; - - __forceinline__ __device__ static VecTOut generateASMPtr( const VecTIn& inputVector, - CUdeviceptr matrix, - unsigned matrixOffsetInBytes, - unsigned rowColumnStrideInBytes, - CUdeviceptr bias, - unsigned biasOffsetInBytes ) - { - VecTOut result; - // clang-format off - asm( "call" - "()," - "_optix_matvecmul_ptr," - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%17);" - : - : "r"( outputElementType ), "r"( VecTOut::size ), - "r"( inputElementType), "r"( VecTIn::size ), "r"( inputInterpretation ), - "r"( N ), "r"( K ), - "l"( matrix ), "r"( matrixOffsetInBytes ), "r"( rowColumnStrideInBytes ), - "r"( matrixLayout ), "r"( (unsigned)transpose ), "r"( matrixElementType ), - "l"( bias ), "r"( biasOffsetInBytes ), "r"( biasElementType ), - "l"( inputVector.data() ), "l"( result.data() ) - ); - // clang-format on - return result; - } - - __forceinline__ __device__ static VecTOut generateASM( const VecTIn& inputVector, - CUdeviceptr matrix, - unsigned matrixOffsetInBytes, - unsigned rowColumnStrideInBytes, - CUdeviceptr bias, - unsigned biasOffsetInBytes ) - { - // If too many elements or elements too large, fall back to the pointer passing method - if( VecTIn::size > 64 || VecTOut::size > 64 || sizeof( typename VecTIn::value_type ) > sizeof( unsigned int ) - || sizeof( typename VecTOut::value_type ) > sizeof( unsigned int ) ) - return generateASMPtr( inputVector, matrix, matrixOffsetInBytes, rowColumnStrideInBytes, bias, biasOffsetInBytes ); - else - { - // This code needs to live in an else, block otherwise the compiler will - // complain about the loop being unreachable. - unsigned int I[64]; - unsigned int O[64]; - for( unsigned int i = 0; i < VecTIn::size; ++i ) - { - I[i] = *( reinterpret_cast( &( inputVector[i] ) ) ); - } - if( VecTOut::size <= 16 && VecTIn::size <= 16 ) - asm( "call" - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15)," - "_optix_matvecmul_16xi32," - "(%16,%17,%18,%19,%20,%21,%22,%23,%24,%25,%26,%27,%28,%29,%30,%31,%32,%33,%34,%35,%36,%37,%38,%39," - "%40,%41,%42,%43,%44,%45,%46,%47);" - : "=r"( O[0] ), "=r"( O[1] ), "=r"( O[2] ), "=r"( O[3] ), "=r"( O[4] ), "=r"( O[5] ), "=r"( O[6] ), - "=r"( O[7] ), "=r"( O[8] ), "=r"( O[9] ), "=r"( O[10] ), "=r"( O[11] ), "=r"( O[12] ), - "=r"( O[13] ), "=r"( O[14] ), "=r"( O[15] ) - : "r"( outputElementType ), "r"( VecTOut::size ), "r"( inputElementType ), "r"( VecTIn::size ), - "r"( inputInterpretation ), "r"( N ), "r"( K ), "l"( matrix ), "r"( matrixOffsetInBytes ), - "r"( rowColumnStrideInBytes ), "r"( matrixLayout ), "r"( (unsigned)transpose ), "r"( matrixElementType ), - "l"( bias ), "r"( biasOffsetInBytes ), "r"( biasElementType ), "r"( I[0] ), "r"( I[1] ), - "r"( I[2] ), "r"( I[3] ), "r"( I[4] ), "r"( I[5] ), "r"( I[6] ), "r"( I[7] ), "r"( I[8] ), - "r"( I[9] ), "r"( I[10] ), "r"( I[11] ), "r"( I[12] ), "r"( I[13] ), "r"( I[14] ), "r"( I[15] ) ); - else - asm( "call" - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%17,%18,%19,%20,%21,%22,%23,%24,%25,%" - "26,%27,%28,%29,%30,%31,%32,%33,%34,%35,%36,%37,%38,%39,%40,%41,%42,%43,%44,%45,%46,%47,%48,%49,%" - "50,%51,%52,%53,%54,%55,%56,%57,%58,%59,%60,%61,%62,%63)," - "_optix_matvecmul_64xi32," - "(%64,%65,%66,%67,%68,%69,%70,%71,%72,%73,%74,%75,%76,%77,%78,%79,%80,%81,%82,%83,%84,%85,%86,%87," - "%88,%89,%90,%91,%92,%93,%94,%95,%96,%97,%98,%99,%100,%101,%102,%103,%104,%105,%106,%107,%108,%" - "109,%110,%111,%112,%113,%114,%115,%116,%117,%118,%119,%120,%121,%122,%123,%124,%125,%126,%127,%" - "128,%129,%130,%131,%132,%133,%134,%135,%136,%137,%138,%139,%140,%141,%142,%143);" - : "=r"( O[0] ), "=r"( O[1] ), "=r"( O[2] ), "=r"( O[3] ), "=r"( O[4] ), "=r"( O[5] ), "=r"( O[6] ), - "=r"( O[7] ), "=r"( O[8] ), "=r"( O[9] ), "=r"( O[10] ), "=r"( O[11] ), "=r"( O[12] ), - "=r"( O[13] ), "=r"( O[14] ), "=r"( O[15] ), "=r"( O[16] ), "=r"( O[17] ), "=r"( O[18] ), - "=r"( O[19] ), "=r"( O[20] ), "=r"( O[21] ), "=r"( O[22] ), "=r"( O[23] ), "=r"( O[24] ), - "=r"( O[25] ), "=r"( O[26] ), "=r"( O[27] ), "=r"( O[28] ), "=r"( O[29] ), "=r"( O[30] ), - "=r"( O[31] ), "=r"( O[32] ), "=r"( O[33] ), "=r"( O[34] ), "=r"( O[35] ), "=r"( O[36] ), - "=r"( O[37] ), "=r"( O[38] ), "=r"( O[39] ), "=r"( O[40] ), "=r"( O[41] ), "=r"( O[42] ), - "=r"( O[43] ), "=r"( O[44] ), "=r"( O[45] ), "=r"( O[46] ), "=r"( O[47] ), "=r"( O[48] ), - "=r"( O[49] ), "=r"( O[50] ), "=r"( O[51] ), "=r"( O[52] ), "=r"( O[53] ), "=r"( O[54] ), - "=r"( O[55] ), "=r"( O[56] ), "=r"( O[57] ), "=r"( O[58] ), "=r"( O[59] ), "=r"( O[60] ), - "=r"( O[61] ), "=r"( O[62] ), "=r"( O[63] ) - : "r"( outputElementType ), "r"( VecTOut::size ), "r"( inputElementType ), "r"( VecTIn::size ), - "r"( inputInterpretation ), "r"( N ), "r"( K ), "l"( matrix ), "r"( matrixOffsetInBytes ), - "r"( rowColumnStrideInBytes ), "r"( matrixLayout ), "r"( (unsigned)transpose ), - "r"( matrixElementType ), "l"( bias ), "r"( biasOffsetInBytes ), "r"( biasElementType ), "r"( I[0] ), - "r"( I[1] ), "r"( I[2] ), "r"( I[3] ), "r"( I[4] ), "r"( I[5] ), "r"( I[6] ), "r"( I[7] ), - "r"( I[8] ), "r"( I[9] ), "r"( I[10] ), "r"( I[11] ), "r"( I[12] ), "r"( I[13] ), "r"( I[14] ), - "r"( I[15] ), "r"( I[16] ), "r"( I[17] ), "r"( I[18] ), "r"( I[19] ), "r"( I[20] ), "r"( I[21] ), - "r"( I[22] ), "r"( I[23] ), "r"( I[24] ), "r"( I[25] ), "r"( I[26] ), "r"( I[27] ), "r"( I[28] ), - "r"( I[29] ), "r"( I[30] ), "r"( I[31] ), "r"( I[32] ), "r"( I[33] ), "r"( I[34] ), "r"( I[35] ), - "r"( I[36] ), "r"( I[37] ), "r"( I[38] ), "r"( I[39] ), "r"( I[40] ), "r"( I[41] ), "r"( I[42] ), - "r"( I[43] ), "r"( I[44] ), "r"( I[45] ), "r"( I[46] ), "r"( I[47] ), "r"( I[48] ), "r"( I[49] ), - "r"( I[50] ), "r"( I[51] ), "r"( I[52] ), "r"( I[53] ), "r"( I[54] ), "r"( I[55] ), "r"( I[56] ), - "r"( I[57] ), "r"( I[58] ), "r"( I[59] ), "r"( I[60] ), "r"( I[61] ), "r"( I[62] ), "r"( I[63] ) ); - VecTOut result; - for( unsigned int i = 0; i < VecTOut::size; ++i ) - { - outputBitType o = O[i]; - result[i] = *( reinterpret_cast( &( o ) ) ); - } - return result; - } - } -}; - -template -struct OptixCoopVecReduceSumAccumulateASMGenerator -{ - static const OptixCoopVecElemType inputElementType = - optix_internal::coop_vec_type_traits::OptixCoopVecElemTypeTrait::elementType; - using inputBitType = - typename optix_internal::coop_vec_type_traits::OptixCoopVecElemTypeTrait::bitType; - - __forceinline__ __device__ static void generateASMPtr( const VecTIn& vecA, CUdeviceptr outputVector, unsigned offsetInBytes ) - { - asm volatile( - "call" - "()," - "_optix_reduce_sum_accumulate_ptr," - "(%0,%1,%2,%3,%4);" - : - : "r"( inputElementType ), "r"( VecTIn::size ), "l"( outputVector ), "r"( offsetInBytes ), "l"( vecA.data() ) ); - } - - __forceinline__ __device__ static void generateASM( const VecTIn& vecA, CUdeviceptr outputVector, unsigned offsetInBytes ) - { - if( VecTIn::size > 64 || sizeof( typename VecTIn::value_type ) > sizeof( unsigned int ) ) - return generateASMPtr( vecA, outputVector, offsetInBytes ); - else - { - // This code needs to live in an else, block otherwise the compiler will - // complain about the loop being unreachable. - unsigned int IA[64]; - for( unsigned int i = 0; i < VecTIn::size; ++i ) - { - IA[i] = *( reinterpret_cast( &( vecA[i] ) ) ); - } - if( VecTIn::size <= 16 ) - asm volatile( - "call" - "()," - "_optix_reduce_sum_accumulate_16xi32," - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%17,%18,%19);" - : - : "r"( inputElementType ), "r"( VecTIn::size ), "l"( outputVector ), "r"( offsetInBytes ), - "r"( IA[0] ), "r"( IA[1] ), "r"( IA[2] ), "r"( IA[3] ), "r"( IA[4] ), "r"( IA[5] ), "r"( IA[6] ), - "r"( IA[7] ), "r"( IA[8] ), "r"( IA[9] ), "r"( IA[10] ), "r"( IA[11] ), "r"( IA[12] ), - "r"( IA[13] ), "r"( IA[14] ), "r"( IA[15] ) ); - else - asm volatile( - "call" - "()," - "_optix_reduce_sum_accumulate_64xi32," - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%17,%18,%19,%20,%21,%22,%23,%24,%25,%" - "26,%27,%28,%29,%30,%31,%32,%33,%34,%35,%36,%37,%38,%39,%40,%41,%42,%43,%44,%45,%46,%47,%48,%49,%" - "50,%51,%52,%53,%54,%55,%56,%57,%58,%59,%60,%61,%62,%63," - "%64,%65,%66,%67);" - : - : "r"( inputElementType ), "r"( VecTIn::size ), "l"( outputVector ), "r"( offsetInBytes ), "r"( IA[0] ), - "r"( IA[1] ), "r"( IA[2] ), "r"( IA[3] ), "r"( IA[4] ), "r"( IA[5] ), "r"( IA[6] ), "r"( IA[7] ), - "r"( IA[8] ), "r"( IA[9] ), "r"( IA[10] ), "r"( IA[11] ), "r"( IA[12] ), "r"( IA[13] ), "r"( IA[14] ), - "r"( IA[15] ), "r"( IA[16] ), "r"( IA[17] ), "r"( IA[18] ), "r"( IA[19] ), "r"( IA[20] ), - "r"( IA[21] ), "r"( IA[22] ), "r"( IA[23] ), "r"( IA[24] ), "r"( IA[25] ), "r"( IA[26] ), - "r"( IA[27] ), "r"( IA[28] ), "r"( IA[29] ), "r"( IA[30] ), "r"( IA[31] ), "r"( IA[32] ), - "r"( IA[33] ), "r"( IA[34] ), "r"( IA[35] ), "r"( IA[36] ), "r"( IA[37] ), "r"( IA[38] ), - "r"( IA[39] ), "r"( IA[40] ), "r"( IA[41] ), "r"( IA[42] ), "r"( IA[43] ), "r"( IA[44] ), - "r"( IA[45] ), "r"( IA[46] ), "r"( IA[47] ), "r"( IA[48] ), "r"( IA[49] ), "r"( IA[50] ), - "r"( IA[51] ), "r"( IA[52] ), "r"( IA[53] ), "r"( IA[54] ), "r"( IA[55] ), "r"( IA[56] ), "r"( IA[57] ), - "r"( IA[58] ), "r"( IA[59] ), "r"( IA[60] ), "r"( IA[61] ), "r"( IA[62] ), "r"( IA[63] ) ); - } - } -}; - -template -struct OptixCoopVecOuterProductAccumulateASMGenerator -{ - static const OptixCoopVecElemType vecAElementType = - optix_internal::coop_vec_type_traits::OptixCoopVecElemTypeTrait::elementType; - using vecABitType = - typename optix_internal::coop_vec_type_traits::OptixCoopVecElemTypeTrait::bitType; - static const OptixCoopVecElemType vecBElementType = - optix_internal::coop_vec_type_traits::OptixCoopVecElemTypeTrait::elementType; - using vecBBitType = - typename optix_internal::coop_vec_type_traits::OptixCoopVecElemTypeTrait::bitType; - - __forceinline__ __device__ static void generateASMPtr( const VecTA& vecA, - const VecTB& vecB, - CUdeviceptr outputMatrix, - unsigned offsetInBytes, - unsigned rowColumnStrideInBytes ) - { - asm volatile( - "call" - "()," - "_optix_outer_product_accumulate_ptr," - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9);" - : - : "r"( vecAElementType ), "r"( VecTA::size ), "r"( vecBElementType ), "r"( VecTB::size ), "l"( outputMatrix ), - "r"( offsetInBytes ), "r"( matrixLayout ), "r"( rowColumnStrideInBytes ), "l"( vecA.data() ), "l"( vecB.data() ) ); - } - - __forceinline__ __device__ static void generateASM( const VecTA& vecA, - const VecTB& vecB, - CUdeviceptr outputMatrix, - unsigned offsetInBytes, - unsigned rowColumnStrideInBytes ) - { - if( VecTA::size > 64 || VecTB::size > 64 || sizeof( typename VecTA::value_type ) > sizeof( unsigned int ) - || sizeof( typename VecTB::value_type ) > sizeof( unsigned int ) ) - return generateASMPtr( vecA, vecB, outputMatrix, offsetInBytes, rowColumnStrideInBytes ); - else - { - // This code needs to live in an else, block otherwise the compiler will - // complain about the loop being unreachable. - unsigned int IA[64]; - unsigned int IB[64]; - for( unsigned int i = 0; i < VecTA::size; ++i ) - { - IA[i] = *( reinterpret_cast( &( vecA[i] ) ) ); - } - for( unsigned int i = 0; i < VecTB::size; ++i ) - { - IB[i] = *( reinterpret_cast( &( vecB[i] ) ) ); - } - if( VecTB::size <= 16 && VecTA::size <= 16 ) - asm volatile( - "call" - "()," - "_optix_outer_product_accumulate_16xi32," - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%17,%18,%19,%20,%21,%22,%23,%24,%25,%" - "26,%27,%28,%29,%30,%31,%32,%33,%34,%35,%36,%37,%38,%39);" - : - : "r"( vecAElementType ), "r"( VecTA::size ), "r"( vecBElementType ), "r"( VecTB::size ), - "l"( outputMatrix ), "r"( offsetInBytes ), "r"( matrixLayout ), "r"( rowColumnStrideInBytes ), - "r"( IA[0] ), "r"( IA[1] ), "r"( IA[2] ), "r"( IA[3] ), "r"( IA[4] ), "r"( IA[5] ), "r"( IA[6] ), - "r"( IA[7] ), "r"( IA[8] ), "r"( IA[9] ), "r"( IA[10] ), "r"( IA[11] ), "r"( IA[12] ), - "r"( IA[13] ), "r"( IA[14] ), "r"( IA[15] ), "r"( IB[0] ), "r"( IB[1] ), "r"( IB[2] ), - "r"( IB[3] ), "r"( IB[4] ), "r"( IB[5] ), "r"( IB[6] ), "r"( IB[7] ), "r"( IB[8] ), "r"( IB[9] ), - "r"( IB[10] ), "r"( IB[11] ), "r"( IB[12] ), "r"( IB[13] ), "r"( IB[14] ), "r"( IB[15] ) ); - else - asm volatile( - "call" - "()," - "_optix_outer_product_accumulate_64xi32," - "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%17,%18,%19,%20,%21,%22,%23,%24,%25,%" - "26,%27,%28,%29,%30,%31,%32,%33,%34,%35,%36,%37,%38,%39,%40,%41,%42,%43,%44,%45,%46,%47,%48,%49,%" - "50,%51,%52,%53,%54,%55,%56,%57,%58,%59,%60,%61,%62,%63,%64,%65,%66,%67,%68,%69,%70,%71,%72,%73,%" - "74,%75,%76,%77,%78,%79,%80,%81,%82,%83,%84,%85,%86,%87,%88,%89,%90,%91,%92,%93,%94,%95,%96,%97,%" - "98,%99,%100,%101,%102,%103,%104,%105,%106,%107,%108,%109,%110,%111,%112,%113,%114,%115,%116,%117," - "%118,%119,%120,%121,%122,%123,%124,%125,%126,%127,%128,%129,%130,%131,%132,%133,%134,%135);" - : - : "r"( vecAElementType ), "r"( VecTA::size ), "r"( vecBElementType ), "r"( VecTB::size ), - "l"( outputMatrix ), "r"( offsetInBytes ), "r"( matrixLayout ), "r"( rowColumnStrideInBytes ), - "r"( IA[0] ), "r"( IA[1] ), "r"( IA[2] ), "r"( IA[3] ), "r"( IA[4] ), "r"( IA[5] ), "r"( IA[6] ), - "r"( IA[7] ), "r"( IA[8] ), "r"( IA[9] ), "r"( IA[10] ), "r"( IA[11] ), "r"( IA[12] ), - "r"( IA[13] ), "r"( IA[14] ), "r"( IA[15] ), "r"( IA[16] ), "r"( IA[17] ), "r"( IA[18] ), - "r"( IA[19] ), "r"( IA[20] ), "r"( IA[21] ), "r"( IA[22] ), "r"( IA[23] ), "r"( IA[24] ), - "r"( IA[25] ), "r"( IA[26] ), "r"( IA[27] ), "r"( IA[28] ), "r"( IA[29] ), "r"( IA[30] ), - "r"( IA[31] ), "r"( IA[32] ), "r"( IA[33] ), "r"( IA[34] ), "r"( IA[35] ), "r"( IA[36] ), - "r"( IA[37] ), "r"( IA[38] ), "r"( IA[39] ), "r"( IA[40] ), "r"( IA[41] ), "r"( IA[42] ), - "r"( IA[43] ), "r"( IA[44] ), "r"( IA[45] ), "r"( IA[46] ), "r"( IA[47] ), "r"( IA[48] ), - "r"( IA[49] ), "r"( IA[50] ), "r"( IA[51] ), "r"( IA[52] ), "r"( IA[53] ), "r"( IA[54] ), - "r"( IA[55] ), "r"( IA[56] ), "r"( IA[57] ), "r"( IA[58] ), "r"( IA[59] ), "r"( IA[60] ), - "r"( IA[61] ), "r"( IA[62] ), "r"( IA[63] ), "r"( IB[0] ), "r"( IB[1] ), "r"( IB[2] ), - "r"( IB[3] ), "r"( IB[4] ), "r"( IB[5] ), "r"( IB[6] ), "r"( IB[7] ), "r"( IB[8] ), "r"( IB[9] ), - "r"( IB[10] ), "r"( IB[11] ), "r"( IB[12] ), "r"( IB[13] ), "r"( IB[14] ), "r"( IB[15] ), - "r"( IB[16] ), "r"( IB[17] ), "r"( IB[18] ), "r"( IB[19] ), "r"( IB[20] ), "r"( IB[21] ), - "r"( IB[22] ), "r"( IB[23] ), "r"( IB[24] ), "r"( IB[25] ), "r"( IB[26] ), "r"( IB[27] ), - "r"( IB[28] ), "r"( IB[29] ), "r"( IB[30] ), "r"( IB[31] ), "r"( IB[32] ), "r"( IB[33] ), - "r"( IB[34] ), "r"( IB[35] ), "r"( IB[36] ), "r"( IB[37] ), "r"( IB[38] ), "r"( IB[39] ), - "r"( IB[40] ), "r"( IB[41] ), "r"( IB[42] ), "r"( IB[43] ), "r"( IB[44] ), "r"( IB[45] ), - "r"( IB[46] ), "r"( IB[47] ), "r"( IB[48] ), "r"( IB[49] ), "r"( IB[50] ), "r"( IB[51] ), - "r"( IB[52] ), "r"( IB[53] ), "r"( IB[54] ), "r"( IB[55] ), "r"( IB[56] ), "r"( IB[57] ), - "r"( IB[58] ), "r"( IB[59] ), "r"( IB[60] ), "r"( IB[61] ), "r"( IB[62] ), "r"( IB[63] ) ); - } - } -}; -} // end namespace optix_internal - - -template -static __forceinline__ __device__ VecTOut optixCoopVecMatMul( const VecTIn& inputVector, - CUdeviceptr matrix, // 64 byte aligned, Array of KxN elements - unsigned matrixOffsetInBytes, // 64 byte aligned - CUdeviceptr bias, // 16 byte aligned, Array of N elements - unsigned biasOffsetInBytes, // 16 byte aligned - unsigned rowColumnStrideInBytes ) -{ - return optix_internal::OptixCoopVecMatMulASMGenerator::generateASM( - inputVector, matrix, matrixOffsetInBytes, rowColumnStrideInBytes, bias, biasOffsetInBytes ); -} - -template -static __forceinline__ __device__ VecTOut optixCoopVecMatMul( const VecTIn& inputVector, - CUdeviceptr matrix, // 64 byte aligned, Array of KxN elements - unsigned matrixOffsetInBytes, // 64 byte aligned - unsigned rowColumnStrideInBytes ) -{ - return optix_internal::OptixCoopVecMatMulASMGenerator::generateASM( inputVector, matrix, - matrixOffsetInBytes, - rowColumnStrideInBytes, - 0, 0 ); -} - -template -static __forceinline__ __device__ void optixCoopVecReduceSumAccumulate( const VecTIn& inputVector, CUdeviceptr outputVector, unsigned offsetInBytes ) -{ - optix_internal::OptixCoopVecReduceSumAccumulateASMGenerator::generateASM( inputVector, outputVector, offsetInBytes ); -} - -template -static __forceinline__ __device__ void optixCoopVecOuterProductAccumulate( const VecTA& vecA, - const VecTB& vecB, - CUdeviceptr outputMatrix, - unsigned offsetInBytes, - unsigned rowColumnStrideInBytes ) -{ - optix_internal::OptixCoopVecOuterProductAccumulateASMGenerator::generateASM( - vecA, vecB, outputMatrix, offsetInBytes, rowColumnStrideInBytes ); -} - - -template -static __forceinline__ __device__ unsigned int optixCoopVecGetMatrixSize() -{ - unsigned int size; - asm( "call" - "(%0)," - "_optix_coop_vec_get_matrix_size," - "(%1,%2,%3,%4,%5);" - : "=r"( size ) - : "r"( N ), "r"( K ), "r"( elementType ), "r"( layout ), "r"( rowColumnStrideInBytes ) ); - return size; -} - -#endif // #ifndef OPTIX_OPTIX_DEVICE_IMPL_COOP_VEC_H diff --git a/crtx/optix_9.1/internal/optix_device_impl_transformations.h b/crtx/optix_9.1/internal/optix_device_impl_transformations.h deleted file mode 100644 index dd5b958..0000000 --- a/crtx/optix_9.1/internal/optix_device_impl_transformations.h +++ /dev/null @@ -1,422 +0,0 @@ -/* -* SPDX-FileCopyrightText: Copyright (c) 2019 - 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -* SPDX-License-Identifier: LicenseRef-NvidiaProprietary -* -* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual -* property and proprietary rights in and to this material, related -* documentation and any modifications thereto. Any use, reproduction, -* disclosure or distribution of this material and related documentation -* without an express license agreement from NVIDIA CORPORATION or -* its affiliates is strictly prohibited. -*/ -/** -* @file optix_device_impl_transformations.h -* @author NVIDIA Corporation -* @brief OptiX public API -* -* OptiX public API Reference - Device side implementation for transformation helper functions. -*/ - -#if !defined( __OPTIX_INCLUDE_INTERNAL_HEADERS__ ) -#error("optix_device_impl_transformations.h is an internal header file and must not be used directly. Please use optix_device.h or optix.h instead.") -#endif - -#ifndef OPTIX_OPTIX_DEVICE_IMPL_TRANSFORMATIONS_H -#define OPTIX_OPTIX_DEVICE_IMPL_TRANSFORMATIONS_H - -namespace optix_impl { - -static __forceinline__ __device__ float4 optixAddFloat4( const float4& a, const float4& b ) -{ - return make_float4( a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w ); -} - -static __forceinline__ __device__ float4 optixMulFloat4( const float4& a, float b ) -{ - return make_float4( a.x * b, a.y * b, a.z * b, a.w * b ); -} - -static __forceinline__ __device__ uint4 optixLdg( unsigned long long addr ) -{ - const uint4* ptr; - asm volatile( "cvta.to.global.u64 %0, %1;" : "=l"( ptr ) : "l"( addr ) ); - uint4 ret; - asm volatile( "ld.global.v4.u32 {%0,%1,%2,%3}, [%4];" - : "=r"( ret.x ), "=r"( ret.y ), "=r"( ret.z ), "=r"( ret.w ) - : "l"( ptr ) ); - return ret; -} - -template -static __forceinline__ __device__ T optixLoadReadOnlyAlign16( const T* ptr ) -{ - // Debug mode may keep this temporary variable - // If T does not enforce 16B alignment, v may not be 16B aligned and storing the loaded data from ptr fails - __align__(16) T v; - for( unsigned int ofs = 0; ofs < (unsigned int)sizeof( T ); ofs += 16 ) - *(uint4*)( (char*)&v + ofs ) = optixLdg( (unsigned long long)( (char*)ptr + ofs ) ); - return v; -} - -// Multiplies the row vector vec with the 3x4 matrix with rows m0, m1, and m2 -static __forceinline__ __device__ float4 optixMultiplyRowMatrix( const float4 vec, const float4 m0, const float4 m1, const float4 m2 ) -{ - float4 result; - - result.x = vec.x * m0.x + vec.y * m1.x + vec.z * m2.x; - result.y = vec.x * m0.y + vec.y * m1.y + vec.z * m2.y; - result.z = vec.x * m0.z + vec.y * m1.z + vec.z * m2.z; - result.w = vec.x * m0.w + vec.y * m1.w + vec.z * m2.w + vec.w; - - return result; -} - -// Converts the SRT transformation srt into a 3x4 matrix with rows m0, m1, and m2 -static __forceinline__ __device__ void optixGetMatrixFromSrt( float4& m0, float4& m1, float4& m2, const OptixSRTData& srt ) -{ - // assumed to be normalized - const float4 q = {srt.qx, srt.qy, srt.qz, srt.qw}; - - const float sqw = q.w * q.w; - const float sqx = q.x * q.x; - const float sqy = q.y * q.y; - const float sqz = q.z * q.z; - - const float xy = q.x * q.y; - const float zw = q.z * q.w; - const float xz = q.x * q.z; - const float yw = q.y * q.w; - const float yz = q.y * q.z; - const float xw = q.x * q.w; - - m0.x = ( sqx - sqy - sqz + sqw ); - m0.y = 2.0f * ( xy - zw ); - m0.z = 2.0f * ( xz + yw ); - - m1.x = 2.0f * ( xy + zw ); - m1.y = ( -sqx + sqy - sqz + sqw ); - m1.z = 2.0f * ( yz - xw ); - - m2.x = 2.0f * ( xz - yw ); - m2.y = 2.0f * ( yz + xw ); - m2.z = ( -sqx - sqy + sqz + sqw ); - - m0.w = m0.x * srt.pvx + m0.y * srt.pvy + m0.z * srt.pvz + srt.tx; - m1.w = m1.x * srt.pvx + m1.y * srt.pvy + m1.z * srt.pvz + srt.ty; - m2.w = m2.x * srt.pvx + m2.y * srt.pvy + m2.z * srt.pvz + srt.tz; - - m0.z = m0.x * srt.b + m0.y * srt.c + m0.z * srt.sz; - m1.z = m1.x * srt.b + m1.y * srt.c + m1.z * srt.sz; - m2.z = m2.x * srt.b + m2.y * srt.c + m2.z * srt.sz; - - m0.y = m0.x * srt.a + m0.y * srt.sy; - m1.y = m1.x * srt.a + m1.y * srt.sy; - m2.y = m2.x * srt.a + m2.y * srt.sy; - - m0.x = m0.x * srt.sx; - m1.x = m1.x * srt.sx; - m2.x = m2.x * srt.sx; -} - -// Inverts a 3x4 matrix in place -static __forceinline__ __device__ void optixInvertMatrix( float4& m0, float4& m1, float4& m2 ) -{ - const float det3 = - m0.x * ( m1.y * m2.z - m1.z * m2.y ) - m0.y * ( m1.x * m2.z - m1.z * m2.x ) + m0.z * ( m1.x * m2.y - m1.y * m2.x ); - - const float inv_det3 = 1.0f / det3; - - float inv3[3][3]; - inv3[0][0] = inv_det3 * ( m1.y * m2.z - m2.y * m1.z ); - inv3[0][1] = inv_det3 * ( m0.z * m2.y - m2.z * m0.y ); - inv3[0][2] = inv_det3 * ( m0.y * m1.z - m1.y * m0.z ); - - inv3[1][0] = inv_det3 * ( m1.z * m2.x - m2.z * m1.x ); - inv3[1][1] = inv_det3 * ( m0.x * m2.z - m2.x * m0.z ); - inv3[1][2] = inv_det3 * ( m0.z * m1.x - m1.z * m0.x ); - - inv3[2][0] = inv_det3 * ( m1.x * m2.y - m2.x * m1.y ); - inv3[2][1] = inv_det3 * ( m0.y * m2.x - m2.y * m0.x ); - inv3[2][2] = inv_det3 * ( m0.x * m1.y - m1.x * m0.y ); - - const float b[3] = {m0.w, m1.w, m2.w}; - - m0.x = inv3[0][0]; - m0.y = inv3[0][1]; - m0.z = inv3[0][2]; - m0.w = -inv3[0][0] * b[0] - inv3[0][1] * b[1] - inv3[0][2] * b[2]; - - m1.x = inv3[1][0]; - m1.y = inv3[1][1]; - m1.z = inv3[1][2]; - m1.w = -inv3[1][0] * b[0] - inv3[1][1] * b[1] - inv3[1][2] * b[2]; - - m2.x = inv3[2][0]; - m2.y = inv3[2][1]; - m2.z = inv3[2][2]; - m2.w = -inv3[2][0] * b[0] - inv3[2][1] * b[1] - inv3[2][2] * b[2]; -} - -static __forceinline__ __device__ void optixLoadInterpolatedMatrixKey( float4& m0, float4& m1, float4& m2, const float4* matrix, const float t1 ) -{ - m0 = optixLoadReadOnlyAlign16( &matrix[0] ); - m1 = optixLoadReadOnlyAlign16( &matrix[1] ); - m2 = optixLoadReadOnlyAlign16( &matrix[2] ); - - // The conditional prevents concurrent loads leading to spills - if( t1 > 0.0f ) - { - const float t0 = 1.0f - t1; - m0 = optixAddFloat4( optixMulFloat4( m0, t0 ), optixMulFloat4( optixLoadReadOnlyAlign16( &matrix[3] ), t1 ) ); - m1 = optixAddFloat4( optixMulFloat4( m1, t0 ), optixMulFloat4( optixLoadReadOnlyAlign16( &matrix[4] ), t1 ) ); - m2 = optixAddFloat4( optixMulFloat4( m2, t0 ), optixMulFloat4( optixLoadReadOnlyAlign16( &matrix[5] ), t1 ) ); - } -} - -static __forceinline__ __device__ void optixLoadInterpolatedSrtKey( float4& srt0, - float4& srt1, - float4& srt2, - float4& srt3, - const float4* srt, - const float t1 ) -{ - srt0 = optixLoadReadOnlyAlign16( &srt[0] ); - srt1 = optixLoadReadOnlyAlign16( &srt[1] ); - srt2 = optixLoadReadOnlyAlign16( &srt[2] ); - srt3 = optixLoadReadOnlyAlign16( &srt[3] ); - - // The conditional prevents concurrent loads leading to spills - if( t1 > 0.0f ) - { - const float t0 = 1.0f - t1; - srt0 = optixAddFloat4( optixMulFloat4( srt0, t0 ), optixMulFloat4( optixLoadReadOnlyAlign16( &srt[4] ), t1 ) ); - srt1 = optixAddFloat4( optixMulFloat4( srt1, t0 ), optixMulFloat4( optixLoadReadOnlyAlign16( &srt[5] ), t1 ) ); - srt2 = optixAddFloat4( optixMulFloat4( srt2, t0 ), optixMulFloat4( optixLoadReadOnlyAlign16( &srt[6] ), t1 ) ); - srt3 = optixAddFloat4( optixMulFloat4( srt3, t0 ), optixMulFloat4( optixLoadReadOnlyAlign16( &srt[7] ), t1 ) ); - - float inv_length = 1.f / sqrt( srt2.y * srt2.y + srt2.z * srt2.z + srt2.w * srt2.w + srt3.x * srt3.x ); - srt2.y *= inv_length; - srt2.z *= inv_length; - srt2.w *= inv_length; - srt3.x *= inv_length; - } -} - -static __forceinline__ __device__ void optixResolveMotionKey( float& localt, int& key, const OptixMotionOptions& options, const float globalt ) -{ - const float timeBegin = options.timeBegin; - const float timeEnd = options.timeEnd; - const float numIntervals = (float)( options.numKeys - 1 ); - - // No need to check the motion flags. If data originates from a valid transform list handle, then globalt is in - // range, or vanish flags are not set. - - // should be NaN or in [0,numIntervals] - float time = max( 0.f, min( numIntervals, numIntervals * __fdividef( globalt - timeBegin, timeEnd - timeBegin ) ) ); - - // catch NaN (for example when timeBegin=timeEnd) - if( time != time ) - time = 0.f; - - const float fltKey = fminf( floorf(time), numIntervals - 1 ); - - localt = time - fltKey; - key = (int)fltKey; -} - -// Returns the interpolated transformation matrix for a particular matrix motion transformation and point in time. -static __forceinline__ __device__ void optixGetInterpolatedTransformation( float4& trf0, - float4& trf1, - float4& trf2, - const OptixMatrixMotionTransform* transformData, - const float time ) -{ - // Compute key and intra key time - float keyTime; - int key; - optixResolveMotionKey( keyTime, key, optixLoadReadOnlyAlign16( transformData ).motionOptions, time ); - - // Get pointer to left key - const float4* transform = (const float4*)( &transformData->transform[key][0] ); - - // Load and interpolate matrix keys - optixLoadInterpolatedMatrixKey( trf0, trf1, trf2, transform, keyTime ); -} - -// Returns the interpolated transformation matrix for a particular SRT motion transformation and point in time. -static __forceinline__ __device__ void optixGetInterpolatedTransformation( float4& trf0, - float4& trf1, - float4& trf2, - const OptixSRTMotionTransform* transformData, - const float time ) -{ - // Compute key and intra key time - float keyTime; - int key; - optixResolveMotionKey( keyTime, key, optixLoadReadOnlyAlign16( transformData ).motionOptions, time ); - - // Get pointer to left key - const float4* dataPtr = reinterpret_cast( &transformData->srtData[key] ); - - // Load and interpolated SRT keys - float4 data[4]; - optixLoadInterpolatedSrtKey( data[0], data[1], data[2], data[3], dataPtr, keyTime ); - - OptixSRTData srt = {data[0].x, data[0].y, data[0].z, data[0].w, data[1].x, data[1].y, data[1].z, data[1].w, - data[2].x, data[2].y, data[2].z, data[2].w, data[3].x, data[3].y, data[3].z, data[3].w}; - - // Convert SRT into a matrix - optixGetMatrixFromSrt( trf0, trf1, trf2, srt ); -} - -// Returns the interpolated transformation matrix for a particular traversable handle and point in time. -static __forceinline__ __device__ void optixGetInterpolatedTransformationFromHandle( float4& trf0, - float4& trf1, - float4& trf2, - const OptixTraversableHandle handle, - const float time, - const bool objectToWorld ) -{ - const OptixTransformType type = optixGetTransformTypeFromHandle( handle ); - - if( type == OPTIX_TRANSFORM_TYPE_MATRIX_MOTION_TRANSFORM || type == OPTIX_TRANSFORM_TYPE_SRT_MOTION_TRANSFORM ) - { - if( type == OPTIX_TRANSFORM_TYPE_MATRIX_MOTION_TRANSFORM ) - { - const OptixMatrixMotionTransform* transformData = optixGetMatrixMotionTransformFromHandle( handle ); - optixGetInterpolatedTransformation( trf0, trf1, trf2, transformData, time ); - } - else - { - const OptixSRTMotionTransform* transformData = optixGetSRTMotionTransformFromHandle( handle ); - optixGetInterpolatedTransformation( trf0, trf1, trf2, transformData, time ); - } - - if( !objectToWorld ) - optixInvertMatrix( trf0, trf1, trf2 ); - } - else if( type == OPTIX_TRANSFORM_TYPE_INSTANCE || type == OPTIX_TRANSFORM_TYPE_STATIC_TRANSFORM ) - { - const float4* transform; - - if( type == OPTIX_TRANSFORM_TYPE_INSTANCE ) - { - transform = ( objectToWorld ) ? optixGetInstanceTransformFromHandle( handle ) : - optixGetInstanceInverseTransformFromHandle( handle ); - } - else - { - const OptixStaticTransform* traversable = optixGetStaticTransformFromHandle( handle ); - transform = (const float4*)( ( objectToWorld ) ? traversable->transform : traversable->invTransform ); - } - - trf0 = optixLoadReadOnlyAlign16( &transform[0] ); - trf1 = optixLoadReadOnlyAlign16( &transform[1] ); - trf2 = optixLoadReadOnlyAlign16( &transform[2] ); - } - else - { - trf0 = {1.0f, 0.0f, 0.0f, 0.0f}; - trf1 = {0.0f, 1.0f, 0.0f, 0.0f}; - trf2 = {0.0f, 0.0f, 1.0f, 0.0f}; - } -} - -// Returns the world-to-object transformation matrix resulting from the transform stack and ray time of the given hit object. -template -static __forceinline__ __device__ void optixGetWorldToObjectTransformMatrix( const HitState& hs, float4& m0, float4& m1, float4& m2 ) -{ - const unsigned int size = hs.getTransformListSize(); - const float time = hs.getRayTime(); - -#pragma unroll 1 - for( unsigned int i = 0; i < size; ++i ) - { - OptixTraversableHandle handle = hs.getTransformListHandle( i ); - - float4 trf0, trf1, trf2; - optixGetInterpolatedTransformationFromHandle( trf0, trf1, trf2, handle, time, /*objectToWorld*/ false ); - - if( i == 0 ) - { - m0 = trf0; - m1 = trf1; - m2 = trf2; - } - else - { - // m := trf * m - float4 tmp0 = m0, tmp1 = m1, tmp2 = m2; - m0 = optixMultiplyRowMatrix( trf0, tmp0, tmp1, tmp2 ); - m1 = optixMultiplyRowMatrix( trf1, tmp0, tmp1, tmp2 ); - m2 = optixMultiplyRowMatrix( trf2, tmp0, tmp1, tmp2 ); - } - } -} - -// Returns the object-to-world transformation matrix resulting from the transform stack and ray time of the given hit object. -template -static __forceinline__ __device__ void optixGetObjectToWorldTransformMatrix( const HitState& hs, float4& m0, float4& m1, float4& m2 ) -{ - const int size = hs.getTransformListSize(); - const float time = hs.getRayTime(); - -#pragma unroll 1 - for( int i = size - 1; i >= 0; --i ) - { - OptixTraversableHandle handle = hs.getTransformListHandle( i ); - - float4 trf0, trf1, trf2; - optixGetInterpolatedTransformationFromHandle( trf0, trf1, trf2, handle, time, /*objectToWorld*/ true ); - - if( i == size - 1 ) - { - m0 = trf0; - m1 = trf1; - m2 = trf2; - } - else - { - // m := trf * m - float4 tmp0 = m0, tmp1 = m1, tmp2 = m2; - m0 = optixMultiplyRowMatrix( trf0, tmp0, tmp1, tmp2 ); - m1 = optixMultiplyRowMatrix( trf1, tmp0, tmp1, tmp2 ); - m2 = optixMultiplyRowMatrix( trf2, tmp0, tmp1, tmp2 ); - } - } -} - -// Multiplies the 3x4 matrix with rows m0, m1, m2 with the point p. -static __forceinline__ __device__ float3 optixTransformPoint( const float4& m0, const float4& m1, const float4& m2, const float3& p ) -{ - float3 result; - result.x = m0.x * p.x + m0.y * p.y + m0.z * p.z + m0.w; - result.y = m1.x * p.x + m1.y * p.y + m1.z * p.z + m1.w; - result.z = m2.x * p.x + m2.y * p.y + m2.z * p.z + m2.w; - return result; -} - -// Multiplies the 3x3 linear submatrix of the 3x4 matrix with rows m0, m1, m2 with the vector v. -static __forceinline__ __device__ float3 optixTransformVector( const float4& m0, const float4& m1, const float4& m2, const float3& v ) -{ - float3 result; - result.x = m0.x * v.x + m0.y * v.y + m0.z * v.z; - result.y = m1.x * v.x + m1.y * v.y + m1.z * v.z; - result.z = m2.x * v.x + m2.y * v.y + m2.z * v.z; - return result; -} - -// Multiplies the transpose of the 3x3 linear submatrix of the 3x4 matrix with rows m0, m1, m2 with the normal n. -// Note that the given matrix is supposed to be the inverse of the actual transformation matrix. -static __forceinline__ __device__ float3 optixTransformNormal( const float4& m0, const float4& m1, const float4& m2, const float3& n ) -{ - float3 result; - result.x = m0.x * n.x + m1.x * n.y + m2.x * n.z; - result.y = m0.y * n.x + m1.y * n.y + m2.y * n.z; - result.z = m0.z * n.x + m1.z * n.y + m2.z * n.z; - return result; -} - -} // namespace optix_impl - -#endif // OPTIX_OPTIX_DEVICE_IMPL_TRANSFORMATIONS_H diff --git a/crtx/optix_9.1/internal/optix_micromap_impl.h b/crtx/optix_9.1/internal/optix_micromap_impl.h deleted file mode 100644 index a98ef28..0000000 --- a/crtx/optix_9.1/internal/optix_micromap_impl.h +++ /dev/null @@ -1,185 +0,0 @@ -/* - * SPDX-FileCopyrightText: Copyright (c) 2022 - 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. - * SPDX-License-Identifier: BSD-3-Clause - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** -* @file optix_micromap_impl.h -* @author NVIDIA Corporation -* @brief OptiX micromap helper functions -*/ - -#ifndef OPTIX_OPTIX_MICROMAP_IMPL_H -#define OPTIX_OPTIX_MICROMAP_IMPL_H - -#ifndef OPTIX_MICROMAP_FUNC -#ifdef __CUDACC__ -#define OPTIX_MICROMAP_FUNC __device__ -#else -#define OPTIX_MICROMAP_FUNC -#endif -#endif - -namespace optix_impl { - -/** \addtogroup optix_utilities -@{ -*/ - -#define OPTIX_MICROMAP_INLINE_FUNC OPTIX_MICROMAP_FUNC inline - -#ifdef __CUDACC__ -// the device implementation of __uint_as_float is declared in cuda_runtime.h -#else -// the host implementation of __uint_as_float -OPTIX_MICROMAP_INLINE_FUNC float __uint_as_float( unsigned int x ) -{ - union { float f; unsigned int i; } var; - var.i = x; - return var.f; -} -#endif - -// Extract even bits -OPTIX_MICROMAP_INLINE_FUNC unsigned int extractEvenBits( unsigned int x ) -{ - x &= 0x55555555; - x = ( x | ( x >> 1 ) ) & 0x33333333; - x = ( x | ( x >> 2 ) ) & 0x0f0f0f0f; - x = ( x | ( x >> 4 ) ) & 0x00ff00ff; - x = ( x | ( x >> 8 ) ) & 0x0000ffff; - return x; -} - - -// Calculate exclusive prefix or (log(n) XOR's and SHF's) -OPTIX_MICROMAP_INLINE_FUNC unsigned int prefixEor( unsigned int x ) -{ - x ^= x >> 1; - x ^= x >> 2; - x ^= x >> 4; - x ^= x >> 8; - return x; -} - -// Convert distance along the curve to discrete barycentrics -OPTIX_MICROMAP_INLINE_FUNC void index2dbary( unsigned int index, unsigned int& u, unsigned int& v, unsigned int& w ) -{ - unsigned int b0 = extractEvenBits( index ); - unsigned int b1 = extractEvenBits( index >> 1 ); - - unsigned int fx = prefixEor( b0 ); - unsigned int fy = prefixEor( b0 & ~b1 ); - - unsigned int t = fy ^ b1; - - u = ( fx & ~t ) | ( b0 & ~t ) | ( ~b0 & ~fx & t ); - v = fy ^ b0; - w = ( ~fx & ~t ) | ( b0 & ~t ) | ( ~b0 & fx & t ); -} - -// Compute barycentrics of a sub or micro triangle wrt a base triangle. The order of the returned -// bary0, bary1, bary2 matters and allows for using this function for sub triangles and the -// conversion from sub triangle to base triangle barycentric space -OPTIX_MICROMAP_INLINE_FUNC void micro2bary( unsigned int index, unsigned int subdivisionLevel, float2& bary0, float2& bary1, float2& bary2 ) -{ - if( subdivisionLevel == 0 ) - { - bary0 = { 0, 0 }; - bary1 = { 1, 0 }; - bary2 = { 0, 1 }; - return; - } - - unsigned int iu, iv, iw; - index2dbary( index, iu, iv, iw ); - - // we need to only look at "level" bits - iu = iu & ( ( 1 << subdivisionLevel ) - 1 ); - iv = iv & ( ( 1 << subdivisionLevel ) - 1 ); - iw = iw & ( ( 1 << subdivisionLevel ) - 1 ); - - int yFlipped = ( iu & 1 ) ^ ( iv & 1 ) ^ ( iw & 1 ) ^ 1; - - int xFlipped = ( ( 0x8888888888888888ull ^ 0xf000f000f000f000ull ^ 0xffff000000000000ull ) >> index ) & 1; - xFlipped ^= ( ( 0x8888888888888888ull ^ 0xf000f000f000f000ull ^ 0xffff000000000000ull ) >> ( index >> 6 ) ) & 1; - - const float levelScale = __uint_as_float( ( 127u - subdivisionLevel ) << 23 ); - - // scale the barycentic coordinate to the global space/scale - float du = 1.f * levelScale; - float dv = 1.f * levelScale; - - // scale the barycentic coordinate to the global space/scale - float u = (float)iu * levelScale; - float v = (float)iv * levelScale; - - // c d - // x-----x - // / \ / - // / \ / - // x-----x - // a b - // - // !xFlipped && !yFlipped: abc - // !xFlipped && yFlipped: cdb - // xFlipped && !yFlipped: bac - // xFlipped && yFlipped: dcb - - bary0 = { u + xFlipped * du , v + yFlipped * dv }; - bary1 = { u + (1-xFlipped) * du, v + yFlipped * dv }; - bary2 = { u + yFlipped * du , v + (1-yFlipped) * dv }; -} - -// avoid any conflicts due to multiple definitions -#define OPTIX_MICROMAP_FLOAT2_SUB(a,b) { a.x - b.x, a.y - b.y } - -// Compute barycentrics for micro triangle from base barycentrics -OPTIX_MICROMAP_INLINE_FUNC float2 base2micro( const float2& baseBarycentrics, const float2 microVertexBaseBarycentrics[3] ) -{ - float2 baryV0P = OPTIX_MICROMAP_FLOAT2_SUB( baseBarycentrics, microVertexBaseBarycentrics[0] ); - float2 baryV0V1 = OPTIX_MICROMAP_FLOAT2_SUB( microVertexBaseBarycentrics[1], microVertexBaseBarycentrics[0] ); - float2 baryV0V2 = OPTIX_MICROMAP_FLOAT2_SUB( microVertexBaseBarycentrics[2], microVertexBaseBarycentrics[0] ); - - float rdetA = 1.f / ( baryV0V1.x * baryV0V2.y - baryV0V1.y * baryV0V2.x ); - float4 A = { baryV0V2.y, -baryV0V2.x, -baryV0V1.y, baryV0V1.x }; - - float2 localUV; - localUV.x = rdetA * ( baryV0P.x * A.x + baryV0P.y * A.y ); - localUV.y = rdetA * ( baryV0P.x * A.z + baryV0P.y * A.w ); - - return localUV; -} -#undef OPTIX_MICROMAP_FLOAT2_SUB - -/*@}*/ // end group optix_utilities - -} // namespace optix_impl - -#endif // OPTIX_OPTIX_MICROMAP_IMPL_H diff --git a/crtx/optix_9.1/optix.h b/crtx/optix_9.1/optix.h deleted file mode 100644 index 080f473..0000000 --- a/crtx/optix_9.1/optix.h +++ /dev/null @@ -1,38 +0,0 @@ - -/* -* SPDX-FileCopyrightText: Copyright (c) 2009 - 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -* SPDX-License-Identifier: LicenseRef-NvidiaProprietary -* -* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual -* property and proprietary rights in and to this material, related -* documentation and any modifications thereto. Any use, reproduction, -* disclosure or distribution of this material and related documentation -* without an express license agreement from NVIDIA CORPORATION or -* its affiliates is strictly prohibited. -*/ -/// @file -/// @author NVIDIA Corporation -/// @brief OptiX public API header -/// -/// Includes the host api if compiling host code, includes the cuda api if compiling device code. -/// For the math library routines include optix_math.h - -#ifndef OPTIX_OPTIX_H -#define OPTIX_OPTIX_H - -/// The OptiX version. -/// -/// - major = OPTIX_VERSION/10000 -/// - minor = (OPTIX_VERSION%10000)/100 -/// - micro = OPTIX_VERSION%100 -#define OPTIX_VERSION 90100 - - -#ifdef __CUDACC__ -#include "optix_device.h" -#else -#include "optix_host.h" -#endif - - -#endif // OPTIX_OPTIX_H diff --git a/crtx/optix_9.1/optix_denoiser_tiling.h b/crtx/optix_9.1/optix_denoiser_tiling.h deleted file mode 100644 index 4dbd131..0000000 --- a/crtx/optix_9.1/optix_denoiser_tiling.h +++ /dev/null @@ -1,363 +0,0 @@ -/* - * SPDX-FileCopyrightText: Copyright (c) 2019 - 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. - * SPDX-License-Identifier: BSD-3-Clause - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/// @file -/// @author NVIDIA Corporation -/// @brief OptiX public API header - -#ifndef OPTIX_DENOISER_TILING_H -#define OPTIX_DENOISER_TILING_H - -#include - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** \addtogroup optix_utilities -@{ -*/ - -/// Tile definition -/// -/// see #optixUtilDenoiserSplitImage -/// -struct OptixUtilDenoiserImageTile -{ - // input tile image - OptixImage2D input; - - // output tile image - OptixImage2D output; - - // overlap offsets, parameters for #optixUtilDenoiserInvoke - unsigned int inputOffsetX; - unsigned int inputOffsetY; -}; - -/// Return pixel stride in bytes for the given pixel format -/// if the pixelStrideInBytes member of the image is zero. -/// Otherwise return pixelStrideInBytes from the image. -/// -/// \param[in] image Image containing the pixel stride -/// \param[in] pixelStrideInBytes Pixel stride in bytes -/// -inline OptixResult optixUtilGetPixelStride( const OptixImage2D& image, unsigned int& pixelStrideInBytes ) -{ - pixelStrideInBytes = image.pixelStrideInBytes; - if( pixelStrideInBytes == 0 ) - { - switch( image.format ) - { - case OPTIX_PIXEL_FORMAT_HALF1: - pixelStrideInBytes = 1 * sizeof( short ); - break; - case OPTIX_PIXEL_FORMAT_HALF2: - pixelStrideInBytes = 2 * sizeof( short ); - break; - case OPTIX_PIXEL_FORMAT_HALF3: - pixelStrideInBytes = 3 * sizeof( short ); - break; - case OPTIX_PIXEL_FORMAT_HALF4: - pixelStrideInBytes = 4 * sizeof( short ); - break; - case OPTIX_PIXEL_FORMAT_FLOAT1: - pixelStrideInBytes = 1 * sizeof( float ); - break; - case OPTIX_PIXEL_FORMAT_FLOAT2: - pixelStrideInBytes = 2 * sizeof( float ); - break; - case OPTIX_PIXEL_FORMAT_FLOAT3: - pixelStrideInBytes = 3 * sizeof( float ); - break; - case OPTIX_PIXEL_FORMAT_FLOAT4: - pixelStrideInBytes = 4 * sizeof( float ); - break; - case OPTIX_PIXEL_FORMAT_UCHAR3: - pixelStrideInBytes = 3 * sizeof( char ); - break; - case OPTIX_PIXEL_FORMAT_UCHAR4: - pixelStrideInBytes = 4 * sizeof( char ); - break; - case OPTIX_PIXEL_FORMAT_INTERNAL_GUIDE_LAYER: - return OPTIX_ERROR_INVALID_VALUE; - break; - } - } - return OPTIX_SUCCESS; -} - -/// Split image into 2D tiles given horizontal and vertical tile size -/// -/// \param[in] input full resolution input image to be split -/// \param[in] output full resolution output image -/// \param[in] overlapWindowSizeInPixels see #OptixDenoiserSizes, #optixDenoiserComputeMemoryResources -/// \param[in] tileWidth maximum width of tiles -/// \param[in] tileHeight maximum height of tiles -/// \param[out] tiles list of tiles covering the input image -/// -inline OptixResult optixUtilDenoiserSplitImage( - const OptixImage2D& input, - const OptixImage2D& output, - unsigned int overlapWindowSizeInPixels, - unsigned int tileWidth, - unsigned int tileHeight, - std::vector& tiles ) -{ - if( tileWidth == 0 || tileHeight == 0 ) - return OPTIX_ERROR_INVALID_VALUE; - - unsigned int inPixelStride, outPixelStride; - if( const OptixResult res = optixUtilGetPixelStride( input, inPixelStride ) ) - return res; - if( const OptixResult res = optixUtilGetPixelStride( output, outPixelStride ) ) - return res; - - int inp_w = std::min( tileWidth + 2 * overlapWindowSizeInPixels, input.width ); - int inp_h = std::min( tileHeight + 2 * overlapWindowSizeInPixels, input.height ); - int inp_y = 0, copied_y = 0; - - int upscaleX = output.width / input.width; - int upscaleY = output.height / input.height; - - do - { - int inputOffsetY = inp_y == 0 ? 0 : std::max( (int)overlapWindowSizeInPixels, inp_h - ( (int)input.height - inp_y ) ); - int copy_y = inp_y == 0 ? std::min( input.height, tileHeight + overlapWindowSizeInPixels ) : - std::min( tileHeight, input.height - copied_y ); - - int inp_x = 0, copied_x = 0; - do - { - int inputOffsetX = inp_x == 0 ? 0 : std::max( (int)overlapWindowSizeInPixels, inp_w - ( (int)input.width - inp_x ) ); - int copy_x = inp_x == 0 ? std::min( input.width, tileWidth + overlapWindowSizeInPixels ) : - std::min( tileWidth, input.width - copied_x ); - - OptixUtilDenoiserImageTile tile; - tile.input.data = input.data + (size_t)( inp_y - inputOffsetY ) * input.rowStrideInBytes - + (size_t)( inp_x - inputOffsetX ) * inPixelStride; - tile.input.width = inp_w; - tile.input.height = inp_h; - tile.input.rowStrideInBytes = input.rowStrideInBytes; - tile.input.pixelStrideInBytes = input.pixelStrideInBytes; - tile.input.format = input.format; - - tile.output.data = output.data + (size_t)( upscaleY * inp_y ) * output.rowStrideInBytes - + (size_t)( upscaleX * inp_x ) * outPixelStride; - tile.output.width = upscaleX * copy_x; - tile.output.height = upscaleY * copy_y; - tile.output.rowStrideInBytes = output.rowStrideInBytes; - tile.output.pixelStrideInBytes = output.pixelStrideInBytes; - tile.output.format = output.format; - - tile.inputOffsetX = inputOffsetX; - tile.inputOffsetY = inputOffsetY; - - tiles.push_back( tile ); - - inp_x += inp_x == 0 ? tileWidth + overlapWindowSizeInPixels : tileWidth; - copied_x += copy_x; - } while( inp_x < static_cast( input.width ) ); - - inp_y += inp_y == 0 ? tileHeight + overlapWindowSizeInPixels : tileHeight; - copied_y += copy_y; - } while( inp_y < static_cast( input.height ) ); - - return OPTIX_SUCCESS; -} - -/// Run denoiser on input layers -/// see #optixDenoiserInvoke -/// additional parameters: - -/// Runs the denoiser on the input layers on a single GPU and stream using #optixDenoiserInvoke. -/// If the input layers' dimensions are larger than the specified tile size, the image is divided into -/// tiles using #optixUtilDenoiserSplitImage, and multiple back-to-back invocations are performed in -/// order to reuse the scratch space. Multiple tiles can be invoked concurrently if -/// #optixUtilDenoiserSplitImage is used directly and multiple scratch allocations for each concurrent -/// invocation are used. - -/// The input parameters are the same as #optixDenoiserInvoke except for the addition of the maximum tile size. -/// -/// \param[in] denoiser -/// \param[in] stream -/// \param[in] params -/// \param[in] denoiserState -/// \param[in] denoiserStateSizeInBytes -/// \param[in] guideLayer -/// \param[in] layers -/// \param[in] numLayers -/// \param[in] scratch -/// \param[in] scratchSizeInBytes -/// \param[in] overlapWindowSizeInPixels -/// \param[in] tileWidth -/// \param[in] tileHeight -inline OptixResult optixUtilDenoiserInvokeTiled( - OptixDenoiser denoiser, - CUstream stream, - const OptixDenoiserParams* params, - CUdeviceptr denoiserState, - size_t denoiserStateSizeInBytes, - const OptixDenoiserGuideLayer* guideLayer, - const OptixDenoiserLayer* layers, - unsigned int numLayers, - CUdeviceptr scratch, - size_t scratchSizeInBytes, - unsigned int overlapWindowSizeInPixels, - unsigned int tileWidth, - unsigned int tileHeight ) -{ - if( !guideLayer || !layers ) - return OPTIX_ERROR_INVALID_VALUE; - - const unsigned int upscale = numLayers > 0 && layers[0].previousOutput.width == 2 * layers[0].input.width ? 2 : 1; - - std::vector> tiles( numLayers ); - std::vector> prevTiles( numLayers ); - for( unsigned int l = 0; l < numLayers; l++ ) - { - if( const OptixResult res = optixUtilDenoiserSplitImage( layers[l].input, layers[l].output, - overlapWindowSizeInPixels, - tileWidth, tileHeight, tiles[l] ) ) - return res; - - if( layers[l].previousOutput.data ) - { - OptixImage2D dummyOutput = layers[l].previousOutput; - if( const OptixResult res = optixUtilDenoiserSplitImage( layers[l].previousOutput, dummyOutput, - upscale * overlapWindowSizeInPixels, - upscale * tileWidth, upscale * tileHeight, prevTiles[l] ) ) - return res; - } - } - - std::vector albedoTiles; - if( guideLayer->albedo.data ) - { - OptixImage2D dummyOutput = guideLayer->albedo; - if( const OptixResult res = optixUtilDenoiserSplitImage( guideLayer->albedo, dummyOutput, - overlapWindowSizeInPixels, - tileWidth, tileHeight, albedoTiles ) ) - return res; - } - - std::vector normalTiles; - if( guideLayer->normal.data ) - { - OptixImage2D dummyOutput = guideLayer->normal; - if( const OptixResult res = optixUtilDenoiserSplitImage( guideLayer->normal, dummyOutput, - overlapWindowSizeInPixels, - tileWidth, tileHeight, normalTiles ) ) - return res; - } - - std::vector flowTiles; - if( guideLayer->flow.data ) - { - OptixImage2D dummyOutput = guideLayer->flow; - if( const OptixResult res = optixUtilDenoiserSplitImage( guideLayer->flow, dummyOutput, - overlapWindowSizeInPixels, - tileWidth, tileHeight, flowTiles ) ) - return res; - } - - std::vector flowTrustTiles; - if( guideLayer->flowTrustworthiness.data ) - { - OptixImage2D dummyOutput = guideLayer->flowTrustworthiness; - if( const OptixResult res = optixUtilDenoiserSplitImage( guideLayer->flowTrustworthiness, dummyOutput, - overlapWindowSizeInPixels, - tileWidth, tileHeight, flowTrustTiles ) ) - return res; - } - - std::vector internalGuideLayerTiles; - if( guideLayer->previousOutputInternalGuideLayer.data && guideLayer->outputInternalGuideLayer.data ) - { - if( const OptixResult res = optixUtilDenoiserSplitImage( guideLayer->previousOutputInternalGuideLayer, - guideLayer->outputInternalGuideLayer, - upscale * overlapWindowSizeInPixels, - upscale * tileWidth, upscale * tileHeight, internalGuideLayerTiles ) ) - return res; - } - - for( size_t t = 0; t < tiles[0].size(); t++ ) - { - std::vector tlayers; - for( unsigned int l = 0; l < numLayers; l++ ) - { - OptixDenoiserLayer layer = {}; - layer.input = ( tiles[l] )[t].input; - layer.output = ( tiles[l] )[t].output; - if( layers[l].previousOutput.data ) - layer.previousOutput = ( prevTiles[l] )[t].input; - layer.type = layers[l].type; - tlayers.push_back( layer ); - } - - OptixDenoiserGuideLayer gl = {}; - if( guideLayer->albedo.data ) - gl.albedo = albedoTiles[t].input; - - if( guideLayer->normal.data ) - gl.normal = normalTiles[t].input; - - if( guideLayer->flow.data ) - gl.flow = flowTiles[t].input; - - if( guideLayer->flowTrustworthiness.data ) - gl.flowTrustworthiness = flowTrustTiles[t].input; - - if( guideLayer->previousOutputInternalGuideLayer.data ) - gl.previousOutputInternalGuideLayer = internalGuideLayerTiles[t].input; - - if( guideLayer->outputInternalGuideLayer.data ) - gl.outputInternalGuideLayer = internalGuideLayerTiles[t].output; - - if( const OptixResult res = - optixDenoiserInvoke( denoiser, stream, params, denoiserState, denoiserStateSizeInBytes, - &gl, &tlayers[0], numLayers, - ( tiles[0] )[t].inputOffsetX, ( tiles[0] )[t].inputOffsetY, - scratch, scratchSizeInBytes ) ) - return res; - } - return OPTIX_SUCCESS; -} - -/**@}*/ // end group optix_utilities - -#ifdef __cplusplus -} -#endif - -#endif // OPTIX_DENOISER_TILING_H diff --git a/crtx/optix_9.1/optix_device.h b/crtx/optix_9.1/optix_device.h deleted file mode 100644 index c718305..0000000 --- a/crtx/optix_9.1/optix_device.h +++ /dev/null @@ -1,2440 +0,0 @@ -/* -* SPDX-FileCopyrightText: Copyright (c) 2010 - 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -* SPDX-License-Identifier: LicenseRef-NvidiaProprietary -* -* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual -* property and proprietary rights in and to this material, related -* documentation and any modifications thereto. Any use, reproduction, -* disclosure or distribution of this material and related documentation -* without an express license agreement from NVIDIA CORPORATION or -* its affiliates is strictly prohibited. -*/ -/// @file -/// @author NVIDIA Corporation -/// @brief OptiX public API header -/// -/// OptiX public API Reference - Device API declarations - -#ifndef OPTIX_OPTIX_DEVICE_H -#define OPTIX_OPTIX_DEVICE_H - -#if defined( __cplusplus ) && ( __cplusplus < 201103L ) && !defined( _WIN32 ) -#error Device code for OptiX requires at least C++11. Consider adding "--std c++11" to the nvcc command-line. -#endif - -#include "optix_types.h" - -/// \defgroup optix_device_api Device API -/// \brief OptiX Device API - -/** \addtogroup optix_device_api -@{ -*/ - - -/// Initiates a ray tracing query starting with the given traversable. -/// -/// \param[in] handle -/// \param[in] rayOrigin -/// \param[in] rayDirection -/// \param[in] tmin -/// \param[in] tmax -/// \param[in] rayTime -/// \param[in] visibilityMask really only 8 bits -/// \param[in] rayFlags really only 16 bits, combination of OptixRayFlags -/// \param[in] SBToffset really only 4 bits -/// \param[in] SBTstride really only 4 bits -/// \param[in] missSBTIndex specifies the miss program invoked on a miss -/// \param[in,out] payload up to 32 unsigned int values that hold the payload -/// -/// Available in RG, CH, MS, CC -template -static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex, - Payload&... payload ); - -/// Similar to optixTrace, but does not invoke closesthit or miss. Instead, it overwrites the -/// current outgoing hit object with the results of traversing the ray. The outgoing hit object may -/// be invoked at some later point with optixInvoke. The outgoing hit object can also be queried -/// through various functions such as optixHitObjectIsHit or optixHitObjectGetAttribute_0. -/// -/// \param[in] handle -/// \param[in] rayOrigin -/// \param[in] rayDirection -/// \param[in] tmin -/// \param[in] tmax -/// \param[in] rayTime -/// \param[in] visibilityMask really only 8 bits -/// \param[in] rayFlags really only 16 bits, combination of OptixRayFlags -/// \param[in] SBToffset really only 4 bits -/// \param[in] SBTstride really only 4 bits -/// \param[in] missSBTIndex specifies the miss program invoked on a miss -/// \param[in,out] payload up to 32 unsigned int values that hold the payload -/// -/// Available in RG, CH, MS, CC, DC -template -static __forceinline__ __device__ void optixTraverse( OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex, - Payload&... payload ); - -/// Initiates a ray tracing query starting with the given traversable. -/// -/// \param[in] type -/// \param[in] handle -/// \param[in] rayOrigin -/// \param[in] rayDirection -/// \param[in] tmin -/// \param[in] tmax -/// \param[in] rayTime -/// \param[in] visibilityMask really only 8 bits -/// \param[in] rayFlags really only 16 bits, combination of OptixRayFlags -/// \param[in] SBToffset really only 4 bits -/// \param[in] SBTstride really only 4 bits -/// \param[in] missSBTIndex specifies the miss program invoked on a miss -/// \param[in,out] payload up to 32 unsigned int values that hold the payload -/// -/// Available in RG, CH, MS, CC -template -static __forceinline__ __device__ void optixTrace( OptixPayloadTypeID type, - OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex, - Payload&... payload ); - -/// Similar to optixTrace, but does not invoke closesthit or miss. Instead, it overwrites the -/// current outgoing hit object with the results of traversing the ray. The outgoing hit object may -/// be invoked at some later point with optixInvoke. The outgoing hit object can also be queried -/// through various functions such as optixHitObjectIsHit or optixHitObjectGetAttribute_0. -/// -/// \param[in] type -/// \param[in] handle -/// \param[in] rayOrigin -/// \param[in] rayDirection -/// \param[in] tmin -/// \param[in] tmax -/// \param[in] rayTime -/// \param[in] visibilityMask really only 8 bits -/// \param[in] rayFlags really only 16 bits, combination of OptixRayFlags -/// \param[in] SBToffset really only 4 bits -/// \param[in] SBTstride really only 4 bits -/// \param[in] missSBTIndex specifies the miss program invoked on a miss -/// \param[in,out] payload up to 32 unsigned int values that hold the payload -/// -/// Available in RG, CH, MS, CC, DC -template -static __forceinline__ __device__ void optixTraverse( OptixPayloadTypeID type, - OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - OptixVisibilityMask visibilityMask, - unsigned int rayFlags, - unsigned int SBToffset, - unsigned int SBTstride, - unsigned int missSBTIndex, - Payload&... payload ); - -/// Reorder the current thread using the current outgoing hit object and the coherence hint bits -/// provided. Note that the coherence hint will take away some of the bits used in the hit object -/// for sorting, so care should be made to reduce the number of hint bits as much as possible. Nop -/// hit objects can use more coherence hint bits. Bits are taken from the lowest significant bit -/// range. The maximum value of numCoherenceHintBitsFromLSB is implementation defined and can vary. -/// -/// \param[in] coherenceHint -/// \param[in] numCoherenceHintBitsFromLSB -/// -/// Available in RG -static __forceinline__ __device__ void optixReorder( unsigned int coherenceHint, unsigned int numCoherenceHintBitsFromLSB ); - -/// Reorder the current thread using the hit object only, ie without further coherence hints. -/// -/// Available in RG -static __forceinline__ __device__ void optixReorder(); - -/// Invokes closesthit, miss or nop based on the current outgoing hit object. After execution the -/// current outgoing hit object will be set to nop. An implied nop hit object is always assumed to -/// exist even if there are no calls to optixTraverse, optixMakeMissHitObject, optixMakeHitObject -/// or optixMakeNopHitObject. -/// -/// \param[in,out] payload up to 32 unsigned int values that hold the payload -/// -/// Available in RG, CH, MS, CC -template -static __forceinline__ __device__ void optixInvoke( Payload&... payload ); - -/// Invokes closesthit, miss or nop based on the current outgoing hit object. After execution the -/// current outgoing hit object will be set to nop. An implied nop hit object is always assumed to -/// exist even if there are no calls to optixTraverse, optixMakeMissHitObject, optixMakeHitObject -/// or optixMakeNopHitObject. -/// -/// \param[in] type -/// \param[in,out] payload up to 32 unsigned int values that hold the payload -/// -/// Available in RG, CH, MS, CC -template -static __forceinline__ __device__ void optixInvoke( OptixPayloadTypeID type, Payload&... payload ); - -/// Constructs an outgoing hit object from the hit object data provided. The traverseData needs to be collected from a previous hit -/// object using #optixHitObjectGetTraverseData. -/// This hit object will now become the current outgoing hit object and will overwrite the current outgoing hit object. -/// -/// \param[in] handle -/// \param[in] rayOrigin -/// \param[in] rayDirection -/// \param[in] tmin -/// \param[in] rayTime -/// \param[in] rayFlags really only 16 bits, combination of OptixRayFlags -/// \param[in] traverseData -/// \param[in] transforms -/// \param[in] numTransforms -/// -/// Available in RG, CH, MS, CC -static __forceinline__ __device__ void optixMakeHitObject( OptixTraversableHandle handle, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float rayTime, - unsigned int rayFlags, - OptixTraverseData traverseData, - const OptixTraversableHandle* transforms, - unsigned int numTransforms ); - -/// Constructs an outgoing hit object from the miss information provided. The SBT record index is -/// explicitly specified as an argument. This hit object will now become the current outgoing hit -/// object and will overwrite the current outgoing hit object. -/// -/// \param[in] missSBTIndex specifies the miss program invoked on a miss -/// \param[in] rayOrigin -/// \param[in] rayDirection -/// \param[in] tmin -/// \param[in] tmax -/// \param[in] rayTime -/// \param[in] rayFlags really only 16 bits, combination of OptixRayFlags -/// -/// Available in RG, CH, MS, CC -static __forceinline__ __device__ void optixMakeMissHitObject( unsigned int missSBTIndex, - float3 rayOrigin, - float3 rayDirection, - float tmin, - float tmax, - float rayTime, - unsigned int rayFlags ); - -/// Constructs an outgoing hit object that when invoked does nothing (neither the miss nor the -/// closest hit shader will be invoked). This hit object will now become the current outgoing hit -/// object and will overwrite the current outgoing hit object. Accessors such as -/// #optixHitObjectGetInstanceId will return 0 or 0 filled structs. Only #optixHitObjectIsNop -/// will return a non-zero result. -/// -/// Available in RG, CH, MS, CC -static __forceinline__ __device__ void optixMakeNopHitObject(); - -/// Serializes the current outgoing hit object which allows to recreate it at a later -/// point using #optixMakeHitObject. -/// -/// \param[out] data -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ void optixHitObjectGetTraverseData( OptixTraverseData* data ); - -/// Returns true if the current outgoing hit object contains a hit. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ bool optixHitObjectIsHit(); - -/// Returns true if the current outgoing hit object contains a miss. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ bool optixHitObjectIsMiss(); - -/// Returns true if the current outgoing hit object contains neither a hit nor miss. If executed -/// with optixInvoke, no operation will result. An implied nop hit object is always assumed to exist -/// even if there are no calls such as optixTraverse to explicitly create one. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ bool optixHitObjectIsNop(); - -/// Returns the SBT record index associated with the hit or miss program for the current outgoing -/// hit object. -/// -/// Returns 0 for nop hit objects. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ unsigned int optixHitObjectGetSbtRecordIndex(); - -/// Sets the SBT record index in the current outgoing hit object. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ void optixHitObjectSetSbtRecordIndex( unsigned int sbtRecordIndex ); - -/// Returns the traversable handle for the Geometry Acceleration Structure (GAS) associated -/// with the current outgoing hit object. -/// Returns 0 if the hit object is not a hit. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ OptixTraversableHandle optixHitObjectGetGASTraversableHandle(); - -/// Writes the 32-bit payload at the given slot index. There are up to 32 attributes available. The -/// number of attributes is configured with OptixPipelineCompileOptions::numPayloadValues or with -/// OptixPayloadType parameters set in OptixModuleCompileOptions. -/// -/// Available in IS, AH, CH, MS -static __forceinline__ __device__ void optixSetPayload_0( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_1( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_2( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_3( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_4( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_5( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_6( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_7( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_8( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_9( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_10( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_11( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_12( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_13( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_14( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_15( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_16( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_17( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_18( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_19( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_20( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_21( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_22( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_23( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_24( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_25( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_26( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_27( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_28( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_29( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_30( unsigned int p ); -static __forceinline__ __device__ void optixSetPayload_31( unsigned int p ); - -/// Returns the 32-bit payload at the given slot index. There are up to 32 attributes available. The -/// number of attributes is configured with OptixPipelineCompileOptions::numPayloadValues or with -/// OptixPayloadType parameters set in OptixModuleCompileOptions. -/// -/// Available in IS, AH, CH, MS -static __forceinline__ __device__ unsigned int optixGetPayload_0(); -static __forceinline__ __device__ unsigned int optixGetPayload_1(); -static __forceinline__ __device__ unsigned int optixGetPayload_2(); -static __forceinline__ __device__ unsigned int optixGetPayload_3(); -static __forceinline__ __device__ unsigned int optixGetPayload_4(); -static __forceinline__ __device__ unsigned int optixGetPayload_5(); -static __forceinline__ __device__ unsigned int optixGetPayload_6(); -static __forceinline__ __device__ unsigned int optixGetPayload_7(); -static __forceinline__ __device__ unsigned int optixGetPayload_8(); -static __forceinline__ __device__ unsigned int optixGetPayload_9(); -static __forceinline__ __device__ unsigned int optixGetPayload_10(); -static __forceinline__ __device__ unsigned int optixGetPayload_11(); -static __forceinline__ __device__ unsigned int optixGetPayload_12(); -static __forceinline__ __device__ unsigned int optixGetPayload_13(); -static __forceinline__ __device__ unsigned int optixGetPayload_14(); -static __forceinline__ __device__ unsigned int optixGetPayload_15(); -static __forceinline__ __device__ unsigned int optixGetPayload_16(); -static __forceinline__ __device__ unsigned int optixGetPayload_17(); -static __forceinline__ __device__ unsigned int optixGetPayload_18(); -static __forceinline__ __device__ unsigned int optixGetPayload_19(); -static __forceinline__ __device__ unsigned int optixGetPayload_20(); -static __forceinline__ __device__ unsigned int optixGetPayload_21(); -static __forceinline__ __device__ unsigned int optixGetPayload_22(); -static __forceinline__ __device__ unsigned int optixGetPayload_23(); -static __forceinline__ __device__ unsigned int optixGetPayload_24(); -static __forceinline__ __device__ unsigned int optixGetPayload_25(); -static __forceinline__ __device__ unsigned int optixGetPayload_26(); -static __forceinline__ __device__ unsigned int optixGetPayload_27(); -static __forceinline__ __device__ unsigned int optixGetPayload_28(); -static __forceinline__ __device__ unsigned int optixGetPayload_29(); -static __forceinline__ __device__ unsigned int optixGetPayload_30(); -static __forceinline__ __device__ unsigned int optixGetPayload_31(); - -/// Specify the supported payload types for a program. -/// -/// The supported types are specified as a bitwise combination of payload types. (See -/// OptixPayloadTypeID) May only be called once per program. -/// -/// Must be called at the top of the program. -/// -/// Available in IS, AH, CH, MS -static __forceinline__ __device__ void optixSetPayloadTypes( unsigned int typeMask ); - -/// Returns an undefined value. -/// -/// Available anywhere -static __forceinline__ __device__ unsigned int optixUndefinedValue(); - -/// If non-zero it is legal to call optixTrace or optixTraverse without triggering an -/// OPTIX_EXCEPTION_CODE_TRACE_DEPTH_EXCEEDED exception. In the case of optixTrace it -/// represents the number of recursive calls that are remaining and counts down. -/// -/// Value is in the range of [0..OptixPipelineLinkOptions::maxTraceDepth], and -/// maxTraceDepth has a maximum value of 31. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ unsigned int optixGetRemainingTraceDepth(); - -/// Returns the rayOrigin passed into optixTrace. -/// -/// May be more expensive to call in IS and AH than their object space counterparts, so effort -/// should be made to use the object space ray in those programs. -/// -/// Available in IS, AH, CH, MS -static __forceinline__ __device__ float3 optixGetWorldRayOrigin(); - -/// Returns the rayOrigin passed into optixTraverse, optixMakeHitObject or optixMakeMissHitObject. -/// -/// Returns [0, 0, 0] for nop hit objects. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ float3 optixHitObjectGetWorldRayOrigin(); - -/// Returns the rayDirection passed into optixTrace. -/// -/// May be more expensive to call in IS and AH than their object space counterparts, so effort -/// should be made to use the object space ray in those programs. -/// -/// Available in IS, AH, CH, MS -static __forceinline__ __device__ float3 optixGetWorldRayDirection(); - -/// Returns the rayDirection passed into optixTraverse, optixMakeHitObject or optixMakeMissHitObject. -/// -/// Returns [0, 0, 0] for nop hit objects. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ float3 optixHitObjectGetWorldRayDirection(); - -/// Returns the current object space ray origin based on the current transform stack. -/// -/// Available in IS and AH -static __forceinline__ __device__ float3 optixGetObjectRayOrigin(); - -/// Returns the current object space ray direction based on the current transform stack. -/// -/// Available in IS and AH -static __forceinline__ __device__ float3 optixGetObjectRayDirection(); - -/// Returns the tmin passed into optixTrace. -/// -/// Available in IS, AH, CH, MS -static __forceinline__ __device__ float optixGetRayTmin(); - -/// Returns the tmin passed into optixTraverse, optixMakeHitObject or optixMakeMissHitObject. -/// -/// Returns 0.0f for nop hit objects. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ float optixHitObjectGetRayTmin(); - -/// In IS and CH returns the current smallest reported hitT or the tmax passed into optixTrace if no -/// hit has been reported -/// -/// In AH returns the hitT value as passed in to optixReportIntersection -/// -/// In MS returns the tmax passed into optixTrace -/// -/// Available in IS, AH, CH, MS -static __forceinline__ __device__ float optixGetRayTmax(); - -/// If the hit object is a hit, returns the smallest reported hitT -/// -/// If the hit object is a miss, returns the tmax passed into optixTraverse, optixMakeHitObject or -/// optixMakeMissHitObject. -/// -/// Returns 0 for nop hit objects. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ float optixHitObjectGetRayTmax(); - -/// Returns the rayTime passed into optixTrace. -/// -/// Returns 0 if motion is disabled. -/// -/// Available in IS, AH, CH, MS -static __forceinline__ __device__ float optixGetRayTime(); - -/// Returns the rayTime passed into optixTraverse, optixMakeHitObject or optixMakeMissHitObject. -/// -/// Returns 0 for nop hit objects or when motion is disabled. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ float optixHitObjectGetRayTime(); - -/// Returns the rayFlags passed into optixTrace -/// -/// Available in IS, AH, CH, MS -static __forceinline__ __device__ unsigned int optixGetRayFlags(); - -/// Returns the rayFlags passed into optixTrace associated with the current outgoing hit object. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ unsigned int optixHitObjectGetRayFlags(); - -/// Returns the visibilityMask passed into optixTrace -/// -/// Available in IS, AH, CH, MS -static __forceinline__ __device__ unsigned int optixGetRayVisibilityMask(); - -/// Return the traversable handle of a given instance in an Instance Acceleration Structure (IAS) -/// -/// To obtain instance traversables by index, the IAS must be built using the flag -/// OPTIX_BUILD_FLAG_ALLOW_RANDOM_INSTANCE_ACCESS. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ OptixTraversableHandle optixGetInstanceTraversableFromIAS( OptixTraversableHandle ias, unsigned int instIdx ); - -/// [DEPRECATED] Returns the object space triangle vertex positions of a given triangle in a Geometry Acceleration -/// Structure (GAS) at a given motion time. -/// This function is deprecated, use optixGetTriangleVertexDataFromHandle for random access triangle vertex data fetch or -/// the overload optixGetTriangleVertexData( float3 data[3] ) for a current triangle hit vertex data fetch. -/// -/// To access vertex data, the GAS must be built using the flag -/// OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS. -/// -/// If motion is disabled via OptixPipelineCompileOptions::usesMotionBlur, or the GAS does not -/// contain motion, the time parameter is ignored. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ void optixGetTriangleVertexData( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float3 data[3] ); - -/// Performs a random access data fetch object space vertex position of a given triangle in a Geometry Acceleration -/// Structure (GAS) at a given motion time. -/// -/// To access vertex data of any triangle, the GAS must be built using the flag -/// OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS. -/// If only the vertex data of a currently intersected triangle is required, it is recommended to -/// use function optixGetTriangleVertexData. A data fetch of the currently hit primitive does NOT -/// require building the corresponding GAS with flag OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS. -/// -/// If motion is disabled via OptixPipelineCompileOptions::usesMotionBlur, or the GAS does not -/// contain motion, the time parameter is ignored. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ void optixGetTriangleVertexDataFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float3 data[3] ); - -/// Returns the object space triangle vertex positions of the currently intersected triangle at the current ray time. -/// -/// Similar to the random access variant optixGetTriangleVertexDataFromHandle, but does not require setting flag -/// OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS when building the corresponding GAS. -/// -/// It is only valid to call this function if the return value of optixGetPrimitiveType( optixGetHitKind() ) equals OPTIX_PRIMITIVE_TYPE_TRIANGLE. -/// -/// Available in AH, CH -static __forceinline__ __device__ void optixGetTriangleVertexData( float3 data[3] ); - -/// Returns the object space triangle vertex positions of the intersected triangle for a valid outgoing hit object. -/// It is the hit object's pendant of optixGetTriangleVertexData( float3 data[3] ). -/// -/// It is only valid to call this function if the return value of optixGetPrimitiveType( optixHitObjectGetHitKind() ) equals OPTIX_PRIMITIVE_TYPE_TRIANGLE. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ void optixHitObjectGetTriangleVertexData( float3 data[3] ); - - -/// Deprecated. Call either optixGetLinearCurveVertexData( float4 data[2] ) for a current-hit data fetch, -/// or optixGetLinearCurveVertexDataFromHandle( ... ) for a random-access data fetch. -/// -/// Returns the object space curve control vertex data of a linear curve in a Geometry Acceleration -/// Structure (GAS) at a given motion time. -/// -/// To access vertex data, the GAS must be built using the flag -/// OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// -/// If motion is disabled via OptixPipelineCompileOptions::usesMotionBlur, or the GAS does not -/// contain motion, the time parameter is ignored. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ void optixGetLinearCurveVertexData( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[2] ); - -/// Performs a random access fetch of the object space curve control vertex data of a linear curve in a Geometry Acceleration -/// Structure (GAS) at a given motion time. -/// -/// To access vertex data of any curve, the GAS must be built using the flag -/// OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS. -/// If only the vertex data of a currently intersected linear curve is required, it is recommended to -/// use function optixGetLinearCurveVertexData. A data fetch of the currently hit primitive does NOT -/// require building the corresponding GAS with flag OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// -/// If motion is disabled via OptixPipelineCompileOptions::usesMotionBlur, or the GAS does not -/// contain motion, the time parameter is ignored. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ void optixGetLinearCurveVertexDataFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[2] ); - -/// Returns the object space control vertex data of the currently intersected linear curve at the current ray time. -/// -/// Similar to the random access variant optixGetLinearCurveVertexDataFromHandle, but does not require setting flag -/// OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS when building the corresponding GAS. -/// -/// It is only valid to call this function if the return value of optixGetPrimitiveType( optixGetHitKind() ) equals OPTIX_PRIMITIVE_TYPE_ROUND_LINEAR. -/// -/// Available in AH, CH -static __forceinline__ __device__ void optixGetLinearCurveVertexData( float4 data[2] ); - -/// Returns the object space control vertex data of the currently intersected linear curve for a valid outgoing hit object. -/// It is the hit object's pendant of optixGetLinearCurveVertexData( float4 data[2] ). -/// -/// It is only valid to call this function if the return value of optixGetPrimitiveType( optixHitObjectGetHitKind() ) equals OPTIX_PRIMITIVE_TYPE_ROUND_LINEAR. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ void optixHitObjectGetLinearCurveVertexData( float4 data[2] ); - -/// Returns the object space curve control vertex data of a quadratic BSpline curve in a Geometry -/// Acceleration Structure (GAS) at a given motion time. -/// -/// To access vertex data, the GAS must be built using the flag -/// OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// -/// If motion is disabled via OptixPipelineCompileOptions::usesMotionBlur, or the GAS does not -/// contain motion, the time parameter is ignored. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ void optixGetQuadraticBSplineVertexData( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[3] ); - -/// Returns the object space curve control vertex data of a quadratic BSpline curve in a Geometry -/// Acceleration Structure (GAS) at a given motion time. -/// -/// To access vertex data, the GAS must be built using the flag -/// OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// -/// If motion is disabled via OptixPipelineCompileOptions::usesMotionBlur, or the GAS does not -/// contain motion, the time parameter is ignored. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ void optixGetQuadraticBSplineVertexDataFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[3] ); -static __forceinline__ __device__ void optixGetQuadraticBSplineRocapsVertexDataFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[3] ); - -/// Returns the object space curve control vertex data of a quadratic BSpline curve in a Geometry -/// Acceleration Structure (GAS) at a given motion time. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// -/// Available in AH, CH -static __forceinline__ __device__ void optixGetQuadraticBSplineVertexData( float4 data[3] ); -static __forceinline__ __device__ void optixGetQuadraticBSplineRocapsVertexData( float4 data[3] ); - -/// Returns the object space curve control vertex data of a quadratic BSpline curve for a valid outgoing hit object. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// -/// It is only valid to call this function if the return value of optixGetPrimitiveType( optixHitObjectGetHitKind() ) -/// equals OPTIX_PRIMITIVE_TYPE_FLAT_QUADRATIC_BSPLINE. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ void optixHitObjectGetQuadraticBSplineVertexData( float4 data[3] ); -static __forceinline__ __device__ void optixHitObjectGetQuadraticBSplineRocapsVertexData( float4 data[3] ); - -/// Deprecated. Call either optixGetCubicBSplineVertexData( float4 data[4] ) for current hit -/// sphere data, or optixGetCubicBSplineVertexDataFromHandle() for random access sphere data. -/// -/// Return the object space curve control vertex data of a cubic BSpline curve in a Geometry -/// Acceleration Structure (GAS) at a given motion time. -/// -/// To access vertex data, the GAS must be built using the flag -/// OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// -/// If motion is disabled via OptixPipelineCompileOptions::usesMotionBlur, or the GAS does not -/// contain motion, the time parameter is ignored. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ void optixGetCubicBSplineVertexData( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[4] ); - -/// Returns the object space curve control vertex data of a cubic BSpline curve in a Geometry -/// Acceleration Structure (GAS) at a given motion time. -/// -/// To access vertex data, the GAS must be built using the flag -/// OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// -/// If motion is disabled via OptixPipelineCompileOptions::usesMotionBlur, or the GAS does not -/// contain motion, the time parameter is ignored. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ void optixGetCubicBSplineVertexDataFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[4] ); -static __forceinline__ __device__ void optixGetCubicBSplineRocapsVertexDataFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[4] ); - -/// Returns the object space curve control vertex data of a cubic BSpline curve in a Geometry -/// Acceleration Structure (GAS) at a given motion time. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// -/// Available in AH, CH -static __forceinline__ __device__ void optixGetCubicBSplineVertexData( float4 data[4] ); -static __forceinline__ __device__ void optixGetCubicBSplineRocapsVertexData( float4 data[4] ); - -/// Returns the object space curve control vertex data of a cubic BSpline curve for a valid -/// outgoing hit object. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// -/// It is only valid to call this function if the return value of optixGetPrimitiveType( optixHitObjectGetHitKind() ) -/// equals OPTIX_PRIMITIVE_TYPE_ROUND_CUBIC_BSPLINE. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ void optixHitObjectGetCubicBSplineVertexData( float4 data[4] ); -/// See #optixHitObjectGetCubicBSplineVertexData for further documentation -/// -/// It is only valid to call this function if the return value of optixGetPrimitiveType( optixHitObjectGetHitKind() ) -/// equals OPTIX_PRIMITIVE_TYPE_ROUND_CUBIC_BSPLINE_ROCAPS. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ void optixHitObjectGetCubicBSplineRocapsVertexData( float4 data[4] ); - -/// Deprecated. Call either optixGetCatmullRomVertexData( float4 data[4] ) for current hit -/// data, or optixGetCatmullRomVertexDataFromHandle() for random access sphere data. -/// -/// Returns the object space curve control vertex data of a CatmullRom spline curve in a Geometry -/// Acceleration Structure (GAS) at a given motion time. -/// -/// To access vertex data, the GAS must be built using the flag -/// OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// -/// If motion is disabled via OptixPipelineCompileOptions::usesMotionBlur, or the GAS does not -/// contain motion, the time parameter is ignored. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ void optixGetCatmullRomVertexData( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[4] ); - -/// Returns the object space curve control vertex data of a CatmullRom spline curve in a Geometry -/// Acceleration Structure (GAS) at a given motion time. -/// -/// To access vertex data, the GAS must be built using the flag -/// OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// -/// If motion is disabled via OptixPipelineCompileOptions::usesMotionBlur, or the GAS does not -/// contain motion, the time parameter is ignored. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ void optixGetCatmullRomVertexDataFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[4] ); -static __forceinline__ __device__ void optixGetCatmullRomRocapsVertexDataFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[4] ); - -/// Returns the object space curve control vertex data of a CatmullRom spline curve in a Geometry -/// Acceleration Structure (GAS) at a given motion time. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// -/// Available in AH, CH -static __forceinline__ __device__ void optixGetCatmullRomVertexData( float4 data[4] ); -static __forceinline__ __device__ void optixGetCatmullRomRocapsVertexData( float4 data[4] ); - -/// Returns the object space curve control vertex data of a CatmullRom spline curve for a valid -/// outgoing hit object. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// -/// It is only valid to call this function if the return value of optixGetPrimitiveType( optixHitObjectGetHitKind() ) -/// equals OPTIX_PRIMITIVE_TYPE_ROUND_CATMULLROM. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ void optixHitObjectGetCatmullRomVertexData( float4 data[4] ); -static __forceinline__ __device__ void optixHitObjectGetCatmullRomRocapsVertexData( float4 data[4] ); - -/// Deprecated. Call either optixGetCubicBezierVertexData( float4 data[4] ) for current hit -/// data, or optixGetCubicBezierVertexDataFromHandle() for random access sphere data. -/// -/// Returns the object space curve control vertex data of a cubic Bezier curve in a Geometry -/// Acceleration Structure (GAS) at a given motion time. -/// -/// To access vertex data, the GAS must be built using the flag -/// OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// -/// If motion is disabled via OptixPipelineCompileOptions::usesMotionBlur, or the GAS does not -/// contain motion, the time parameter is ignored. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ void optixGetCubicBezierVertexData( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[4] ); - -/// Returns the object space curve control vertex data of a cubic Bezier curve in a Geometry -/// Acceleration Structure (GAS) at a given motion time. -/// -/// To access vertex data, the GAS must be built using the flag -/// OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// -/// If motion is disabled via OptixPipelineCompileOptions::usesMotionBlur, or the GAS does not -/// contain motion, the time parameter is ignored. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ void optixGetCubicBezierVertexDataFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[4] ); -static __forceinline__ __device__ void optixGetCubicBezierRocapsVertexDataFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[4] ); - -/// Returns the object space curve control vertex data of a cubic Bezier curve in a Geometry -/// Acceleration Structure (GAS) at a given motion time. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// -/// Available in AH, CH -static __forceinline__ __device__ void optixGetCubicBezierVertexData( float4 data[4] ); -static __forceinline__ __device__ void optixGetCubicBezierRocapsVertexData( float4 data[4] ); - -/// Returns the object space curve control vertex data of a cubic Bezier curve for a valid -/// outgoing hit object. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// -/// It is only valid to call this function if the return value of optixGetPrimitiveType( optixHitObjectGetHitKind() ) -/// equals OPTIX_PRIMITIVE_TYPE_ROUND_CUBIC_BEZIER. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ void optixHitObjectGetCubicBezierVertexData( float4 data[4] ); -static __forceinline__ __device__ void optixHitObjectGetCubicBezierRocapsVertexData( float4 data[4] ); - -/// Deprecated. Call either optixGetRibbonVertexData( float4 data[3] ) for current hit -/// data, or optixGetRibbonVertexDataFromHandle() for random access. -/// -/// Returns the object space curve control vertex data of a ribbon (flat quadratic BSpline) in a -/// Geometry Acceleration Structure (GAS) at a given motion time. -/// -/// To access vertex data, the GAS must be built using the flag -/// OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// -/// If motion is disabled via OptixPipelineCompileOptions::usesMotionBlur, or the GAS does not -/// contain motion, the time parameter is ignored. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ void optixGetRibbonVertexData( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[3] ); - -/// Returns the object space curve control vertex data of a ribbon (flat quadratic BSpline) in a -/// Geometry Acceleration Structure (GAS) at a given motion time. -/// -/// To access vertex data, the GAS must be built using the flag -/// OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// -/// If motion is disabled via OptixPipelineCompileOptions::usesMotionBlur, or the GAS does not -/// contain motion, the time parameter is ignored. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ void optixGetRibbonVertexDataFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[3] ); - -/// Returns the object space curve control vertex data of a ribbon (flat quadratic BSpline) in a -/// Geometry Acceleration Structure (GAS) at a given motion time. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// -/// Available in AH, CH -static __forceinline__ __device__ void optixGetRibbonVertexData( float4 data[3] ); - -/// Returns the object space curve control vertex data of a ribbon (flat quadratic BSpline) for a valid -/// outgoing hit object. -/// -/// data[i] = {x,y,z,w} with {x,y,z} the position and w the radius of control vertex i. -/// -/// It is only valid to call this function if the return value of optixGetPrimitiveType( optixHitObjectGetHitKind() ) -/// equals OPTIX_PRIMITIVE_TYPE_FLAT_QUADRATIC_BSPLINE. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ void optixHitObjectGetRibbonVertexData( float4 data[3] ); - -/// Deprecated. Call either optixGetRibbonNormal( float2 ribbonParameters ) for current hit -/// data, or optixGetRibbonNormalFromHandle() for random access. -/// -/// Returns ribbon normal at intersection reported by optixReportIntersection. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ float3 optixGetRibbonNormal( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float2 ribbonParameters ); - -/// Returns ribbon normal at intersection reported by optixReportIntersection. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ float3 optixGetRibbonNormalFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float2 ribbonParameters ); - -/// Return ribbon normal at intersection reported by optixReportIntersection. -/// -/// Available in AH, CH -static __forceinline__ __device__ float3 optixGetRibbonNormal( float2 ribbonParameters ); - -/// Return ribbon normal at intersection reported by optixReportIntersection. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ float3 optixHitObjectGetRibbonNormal( float2 ribbonParameters ); - -/// Deprecated. Call either optixGetSphereData( float4 data[1] ) for current hit -/// sphere data, or optixGetSphereDataFromHandle() for random access sphere data. -/// -/// Returns the object space sphere data, center point and radius, in a Geometry Acceleration -/// Structure (GAS) at a given motion time. -/// -/// To access sphere data, the GAS must be built using the flag -/// OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS. -/// -/// data[0] = {x,y,z,w} with {x,y,z} the position of the sphere center and w the radius. -/// -/// If motion is disabled via OptixPipelineCompileOptions::usesMotionBlur, or the GAS does not -/// contain motion, the time parameter is ignored. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ void optixGetSphereData( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[1] ); - -/// Performs a random access fetch of the object space sphere data, center point and radius, in a Geometry Acceleration -/// Structure (GAS) at a given motion time. -/// -/// To access vertex data of any curve, the GAS must be built using the flag -/// OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS. -/// If only the vertex data of a currently intersected sphere is required, it is recommended to -/// use function optixGetSphereData. A data fetch of the currently hit primitive does NOT -/// require building the corresponding GAS with flag OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS. -/// -/// data[0] = {x,y,z,w} with {x,y,z} the position of the sphere center and w the radius. -/// -/// If motion is disabled via OptixPipelineCompileOptions::usesMotionBlur, or the GAS does not -/// contain motion, the time parameter is ignored. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ void optixGetSphereDataFromHandle( OptixTraversableHandle gas, - unsigned int primIdx, - unsigned int sbtGASIndex, - float time, - float4 data[1] ); - -/// Returns the object space sphere data of the currently intersected sphere at the current ray time. -/// -/// Similar to the random access variant optixGetSphereDataFromHandle, but does not require setting flag -/// OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS when building the corresponding GAS. -/// -/// It is only valid to call this function if the return value of optixGetPrimitiveType( optixGetHitKind() ) equals OPTIX_PRIMITIVE_TYPE_SPHERE. -/// -/// Available in AH, CH -static __forceinline__ __device__ void optixGetSphereData( float4 data[1] ); - -/// Returns the object space sphere data of the currently intersected sphere for a valid outgoing hit object. -/// It is the hit object's pendant of optixGetSphereData( float4 data[1] ). -/// -/// It is only valid to call this function if the return value of optixGetPrimitiveType( optixHitObjectGetHitKind() ) equals OPTIX_PRIMITIVE_TYPE_SPHERE. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ void optixHitObjectGetSphereData( float4 data[1] ); - -/// Returns the traversable handle for the Geometry Acceleration Structure (GAS) containing the -/// current hit. -/// -/// Available in IS, AH, CH -static __forceinline__ __device__ OptixTraversableHandle optixGetGASTraversableHandle(); - -/// Returns the motion begin time of a GAS (see OptixMotionOptions) -/// -/// Available in all OptiX program types -static __forceinline__ __device__ float optixGetGASMotionTimeBegin( OptixTraversableHandle gas ); - -/// Returns the motion end time of a GAS (see OptixMotionOptions) -/// -/// Available in all OptiX program types -static __forceinline__ __device__ float optixGetGASMotionTimeEnd( OptixTraversableHandle gas ); - -/// Returns the number of motion steps of a GAS (see OptixMotionOptions) -/// -/// Available in all OptiX program types -static __forceinline__ __device__ unsigned int optixGetGASMotionStepCount( OptixTraversableHandle gas ); - -/// Returns the world-to-object transformation matrix resulting from the current active -/// transformation list. -/// -/// The cost of this function may be proportional to the size of the transformation list. -/// -/// Available in IS, AH, CH -static __forceinline__ __device__ void optixGetWorldToObjectTransformMatrix( float m[12] ); - -/// Returns the object-to-world transformation matrix resulting from the current active -/// transformation list. -/// -/// The cost of this function may be proportional to the size of the transformation list. -/// -/// Available in IS, AH, CH -static __forceinline__ __device__ void optixGetObjectToWorldTransformMatrix( float m[12] ); - -/// Transforms the point using world-to-object transformation matrix resulting from the current -/// active transformation list. -/// -/// The cost of this function may be proportional to the size of the transformation list. -/// -/// Available in IS, AH, CH -static __forceinline__ __device__ float3 optixTransformPointFromWorldToObjectSpace( float3 point ); - -/// Transforms the vector using world-to-object transformation matrix resulting from the current -/// active transformation list. -/// -/// The cost of this function may be proportional to the size of the transformation list. -/// -/// Available in IS, AH, CH -static __forceinline__ __device__ float3 optixTransformVectorFromWorldToObjectSpace( float3 vec ); - -/// Transforms the normal using world-to-object transformation matrix resulting from the current -/// active transformation list. -/// -/// The cost of this function may be proportional to the size of the transformation list. -/// -/// Available in IS, AH, CH -static __forceinline__ __device__ float3 optixTransformNormalFromWorldToObjectSpace( float3 normal ); - -/// Transforms the point using object-to-world transformation matrix resulting from the current -/// active transformation list. -/// -/// The cost of this function may be proportional to the size of the transformation list. -/// -/// Available in IS, AH, CH -static __forceinline__ __device__ float3 optixTransformPointFromObjectToWorldSpace( float3 point ); - -/// Transforms the vector using object-to-world transformation matrix resulting from the current -/// active transformation list. -/// -/// The cost of this function may be proportional to the size of the transformation list. -/// -/// Available in IS, AH, CH -static __forceinline__ __device__ float3 optixTransformVectorFromObjectToWorldSpace( float3 vec ); - -/// Transforms the normal using object-to-world transformation matrix resulting from the current -/// active transformation list. -/// -/// The cost of this function may be proportional to the size of the transformation list. -/// -/// Available in IS, AH, CH -static __forceinline__ __device__ float3 optixTransformNormalFromObjectToWorldSpace( float3 normal ); - -/// Returns the world-to-object transformation matrix resulting from the -/// transformation list of the current outgoing hit object. -/// -/// The cost of this function may be proportional to the size of the transformation list. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ void optixHitObjectGetWorldToObjectTransformMatrix( float m[12] ); - -/// Returns the object-to-world transformation matrix resulting from the -/// transformation list of the current outgoing hit object. -/// -/// The cost of this function may be proportional to the size of the transformation list. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ void optixHitObjectGetObjectToWorldTransformMatrix( float m[12] ); - -/// Transforms the point using world-to-object transformation matrix resulting from the -/// transformation list of the current outgoing hit object. -/// -/// The cost of this function may be proportional to the size of the transformation list. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ float3 optixHitObjectTransformPointFromWorldToObjectSpace( float3 point ); - -/// Transforms the vector using world-to-object transformation matrix resulting from the -/// transformation list of the current outgoing hit object. -/// -/// The cost of this function may be proportional to the size of the transformation list. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ float3 optixHitObjectTransformVectorFromWorldToObjectSpace( float3 vec ); - -/// Transforms the normal using world-to-object transformation matrix resulting from the -/// transformation list of the current outgoing hit object. -/// -/// The cost of this function may be proportional to the size of the transformation list. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ float3 optixHitObjectTransformNormalFromWorldToObjectSpace( float3 normal ); - -/// Transforms the point using object-to-world transformation matrix resulting from the -/// transformation list of the current outgoing hit object. -/// -/// The cost of this function may be proportional to the size of the transformation list. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ float3 optixHitObjectTransformPointFromObjectToWorldSpace( float3 point ); - -/// Transforms the vector using object-to-world transformation matrix resulting from the -/// transformation list of the current outgoing hit object. -/// -/// The cost of this function may be proportional to the size of the transformation list. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ float3 optixHitObjectTransformVectorFromObjectToWorldSpace( float3 vec ); - -/// Transforms the normal using object-to-world transformation matrix resulting from the -/// transformation list of the current outgoing hit object. -/// -/// The cost of this function may be proportional to the size of the transformation list. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ float3 optixHitObjectTransformNormalFromObjectToWorldSpace( float3 normal ); - -/// Returns the world-to-object transformation matrix resulting from the transformation list of the -/// templated hit object. Users may implement getRayTime, getTransformListSize, and getTransformListHandle -/// in their own structs, or inherit them from Optix[Incoming|Outgoing]HitObject. Here is an example: -/// -/// struct FixedTimeHitState : OptixIncomingHitObject { -/// float time; -/// __forceinline__ __device__ float getRayTime() { return time; } -/// }; -/// ... -/// optixGetWorldToObjectTransformMatrix( FixedTimeHitState{ 0.4f }, m ); -/// -/// The cost of this function may be proportional to the size of the transformation list. -/// -/// Available in IS, AH, CH -template -static __forceinline__ __device__ void optixGetWorldToObjectTransformMatrix( const HitState& hs, float m[12] ); - -/// Returns the object-to-world transformation matrix resulting from the transformation list -/// of the templated hit object (see optixGetWorldToObjectTransformMatrix for example usage). -/// -/// The cost of this function may be proportional to the size of the transformation list. -/// -/// Available in IS, AH, CH -template -static __forceinline__ __device__ void optixGetObjectToWorldTransformMatrix( const HitState& hs, float m[12] ); - -/// Transforms the point using world-to-object transformation matrix resulting from the transformation -/// list of the templated hit object (see optixGetWorldToObjectTransformMatrix for example usage). -/// -/// The cost of this function may be proportional to the size of the transformation list. -/// -/// Available in IS, AH, CH -template -static __forceinline__ __device__ float3 optixTransformPointFromWorldToObjectSpace( const HitState& hs, float3 point ); - -/// Transforms the vector using world-to-object transformation matrix resulting from the transformation -/// list of the templated hit object (see optixGetWorldToObjectTransformMatrix for example usage). -/// -/// The cost of this function may be proportional to the size of the transformation list. -/// -/// Available in IS, AH, CH -template -static __forceinline__ __device__ float3 optixTransformVectorFromWorldToObjectSpace( const HitState& hs, float3 vec ); - -/// Transforms the normal using world-to-object transformation matrix resulting from the transformation -/// list of the templated hit object (see optixGetWorldToObjectTransformMatrix for example usage). -/// -/// The cost of this function may be proportional to the size of the transformation list. -/// -/// Available in IS, AH, CH -template -static __forceinline__ __device__ float3 optixTransformNormalFromWorldToObjectSpace( const HitState& hs, float3 normal ); - -/// Transforms the point using object-to-world transformation matrix resulting from the transformation -/// list of the templated hit object (see optixGetWorldToObjectTransformMatrix for example usage). -/// -/// The cost of this function may be proportional to the size of the transformation list. -/// -/// Available in IS, AH, CH -template -static __forceinline__ __device__ float3 optixTransformPointFromObjectToWorldSpace( const HitState& hs, float3 point ); - -/// Transforms the vector using object-to-world transformation matrix resulting from the transformation -/// list of the templated hit object (see optixGetWorldToObjectTransformMatrix for example usage). -/// -/// The cost of this function may be proportional to the size of the transformation list. -/// -/// Available in IS, AH, CH -template -static __forceinline__ __device__ float3 optixTransformVectorFromObjectToWorldSpace( const HitState& hs, float3 vec ); - -/// Transforms the normal using object-to-world transformation matrix resulting from the transformation -/// list of the templated hit object (see optixGetWorldToObjectTransformMatrix for example usage). -/// -/// The cost of this function may be proportional to the size of the transformation list. -/// -/// Available in IS, AH, CH -template -static __forceinline__ __device__ float3 optixTransformNormalFromObjectToWorldSpace( const HitState& hs, float3 normal ); - -/// Returns the number of transforms on the current transform list. -/// -/// Available in IS, AH, CH -static __forceinline__ __device__ unsigned int optixGetTransformListSize(); - -/// Returns the number of transforms associated with the current outgoing hit object's transform -/// list. -/// -/// Returns zero when there is no hit (miss and nop). -/// -/// See #optixGetTransformListSize() -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ unsigned int optixHitObjectGetTransformListSize(); - -/// Returns the traversable handle for a transform in the current transform list. -/// -/// Available in IS, AH, CH -static __forceinline__ __device__ OptixTraversableHandle optixGetTransformListHandle( unsigned int index ); - -/// Returns the traversable handle for a transform in the current transform list associated with the -/// outgoing hit object. -/// -/// Results are undefined if the hit object is a miss. -/// -/// See #optixGetTransformListHandle() -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ OptixTraversableHandle optixHitObjectGetTransformListHandle( unsigned int index ); - -struct OptixIncomingHitObject -{ - __forceinline__ __device__ float getRayTime() const { return optixGetRayTime(); } - __forceinline__ __device__ unsigned int getTransformListSize() const { return optixGetTransformListSize(); } - __forceinline__ __device__ OptixTraversableHandle getTransformListHandle( unsigned int index ) const - { - return optixGetTransformListHandle( index ); - } -}; - -struct OptixOutgoingHitObject -{ - __forceinline__ __device__ float getRayTime() const { return optixHitObjectGetRayTime(); } - __forceinline__ __device__ unsigned int getTransformListSize() const - { - return optixHitObjectGetTransformListSize(); - } - __forceinline__ __device__ OptixTraversableHandle getTransformListHandle( unsigned int index ) const - { - return optixHitObjectGetTransformListHandle( index ); - } -}; - -/// Returns the transform type of a traversable handle from a transform list. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ OptixTransformType optixGetTransformTypeFromHandle( OptixTraversableHandle handle ); - -/// Returns a pointer to a OptixStaticTransform from its traversable handle. -/// -/// Returns 0 if the traversable is not of type OPTIX_TRANSFORM_TYPE_STATIC_TRANSFORM. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ const OptixStaticTransform* optixGetStaticTransformFromHandle( OptixTraversableHandle handle ); - -/// Returns a pointer to a OptixSRTMotionTransform from its traversable handle. -/// -/// Returns 0 if the traversable is not of type OPTIX_TRANSFORM_TYPE_SRT_MOTION_TRANSFORM. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ const OptixSRTMotionTransform* optixGetSRTMotionTransformFromHandle( OptixTraversableHandle handle ); - -/// Returns a pointer to a OptixMatrixMotionTransform from its traversable handle. -/// -/// Returns 0 if the traversable is not of type OPTIX_TRANSFORM_TYPE_MATRIX_MOTION_TRANSFORM. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ const OptixMatrixMotionTransform* optixGetMatrixMotionTransformFromHandle( OptixTraversableHandle handle ); - -/// Returns instanceId from an OptixInstance traversable. -/// -/// Returns 0 if the traversable handle does not reference an OptixInstance. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ unsigned int optixGetInstanceIdFromHandle( OptixTraversableHandle handle ); - -/// Returns child traversable handle from an OptixInstance traversable. -/// -/// Returns 0 if the traversable handle does not reference an OptixInstance. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ OptixTraversableHandle optixGetInstanceChildFromHandle( OptixTraversableHandle handle ); - -/// Returns object-to-world transform from an OptixInstance traversable. -/// -/// Returns 0 if the traversable handle does not reference an OptixInstance. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ const float4* optixGetInstanceTransformFromHandle( OptixTraversableHandle handle ); - -/// Returns world-to-object transform from an OptixInstance traversable. -/// -/// Returns 0 if the traversable handle does not reference an OptixInstance. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ const float4* optixGetInstanceInverseTransformFromHandle( OptixTraversableHandle handle ); - -/// Returns a pointer to the geometry acceleration structure from its traversable handle. -/// -/// Returns 0 if the traversable is not a geometry acceleration structure. -/// -/// Available in all OptiX program types -static __device__ __forceinline__ CUdeviceptr optixGetGASPointerFromHandle( OptixTraversableHandle handle ); -/// Reports an intersections (overload without attributes). -/// -/// If optixGetRayTmin() <= hitT <= optixGetRayTmax(), the any hit program associated with this -/// intersection program (via the SBT entry) is called. -/// -/// The AH program can do one of three things: -/// 1. call optixIgnoreIntersection - no hit is recorded, optixReportIntersection returns false -/// 2. call optixTerminateRay - hit is recorded, optixReportIntersection does not return, no further traversal occurs, -/// and the associated closest hit program is called -/// 3. neither - hit is recorded, optixReportIntersection returns true -/// -/// hitKind - Only the 7 least significant bits should be written [0..127]. Any values above 127 -/// are reserved for built in intersection. The value can be queried with optixGetHitKind() in AH -/// and CH. -/// -/// The attributes specified with a0..a7 are available in the AH and CH programs. Note that the -/// attributes available in the CH program correspond to the closest recorded intersection. The -/// number of attributes in registers and memory can be configured in the pipeline. -/// -/// \param[in] hitT -/// \param[in] hitKind -/// -/// Available in IS -static __forceinline__ __device__ bool optixReportIntersection( float hitT, unsigned int hitKind ); - -/// Reports an intersection (overload with 1 attribute register). -/// -/// \see #optixReportIntersection(float,unsigned int) -/// -/// Available in IS -static __forceinline__ __device__ bool optixReportIntersection( float hitT, unsigned int hitKind, unsigned int a0 ); - -/// Reports an intersection (overload with 2 attribute registers). -/// -/// \see #optixReportIntersection(float,unsigned int) -/// -/// Available in IS -static __forceinline__ __device__ bool optixReportIntersection( float hitT, unsigned int hitKind, unsigned int a0, unsigned int a1 ); - -/// Reports an intersection (overload with 3 attribute registers). -/// -/// \see #optixReportIntersection(float,unsigned int) -/// -/// Available in IS -static __forceinline__ __device__ bool optixReportIntersection( float hitT, unsigned int hitKind, unsigned int a0, unsigned int a1, unsigned int a2 ); - -/// Reports an intersection (overload with 4 attribute registers). -/// -/// \see #optixReportIntersection(float,unsigned int) -/// -/// Available in IS -static __forceinline__ __device__ bool optixReportIntersection( float hitT, - unsigned int hitKind, - unsigned int a0, - unsigned int a1, - unsigned int a2, - unsigned int a3 ); - -/// Reports an intersection (overload with 5 attribute registers). -/// -/// \see #optixReportIntersection(float,unsigned int) -/// -/// Available in IS -static __forceinline__ __device__ bool optixReportIntersection( float hitT, - unsigned int hitKind, - unsigned int a0, - unsigned int a1, - unsigned int a2, - unsigned int a3, - unsigned int a4 ); - -/// Reports an intersection (overload with 6 attribute registers). -/// -/// \see #optixReportIntersection(float,unsigned int) -/// -/// Available in IS -static __forceinline__ __device__ bool optixReportIntersection( float hitT, - unsigned int hitKind, - unsigned int a0, - unsigned int a1, - unsigned int a2, - unsigned int a3, - unsigned int a4, - unsigned int a5 ); - -/// Reports an intersection (overload with 7 attribute registers). -/// -/// \see #optixReportIntersection(float,unsigned int) -/// -/// Available in IS -static __forceinline__ __device__ bool optixReportIntersection( float hitT, - unsigned int hitKind, - unsigned int a0, - unsigned int a1, - unsigned int a2, - unsigned int a3, - unsigned int a4, - unsigned int a5, - unsigned int a6 ); - -/// Reports an intersection (overload with 8 attribute registers). -/// -/// \see #optixReportIntersection(float,unsigned int) -/// -/// Available in IS -static __forceinline__ __device__ bool optixReportIntersection( float hitT, - unsigned int hitKind, - unsigned int a0, - unsigned int a1, - unsigned int a2, - unsigned int a3, - unsigned int a4, - unsigned int a5, - unsigned int a6, - unsigned int a7 ); - -/// Returns the attribute at the given slot index. There are up to 8 attributes available. The -/// number of attributes is configured with OptixPipelineCompileOptions::numAttributeValues. -/// -/// Available in AH, CH -static __forceinline__ __device__ unsigned int optixGetAttribute_0(); -static __forceinline__ __device__ unsigned int optixGetAttribute_1(); -static __forceinline__ __device__ unsigned int optixGetAttribute_2(); -static __forceinline__ __device__ unsigned int optixGetAttribute_3(); -static __forceinline__ __device__ unsigned int optixGetAttribute_4(); -static __forceinline__ __device__ unsigned int optixGetAttribute_5(); -static __forceinline__ __device__ unsigned int optixGetAttribute_6(); -static __forceinline__ __device__ unsigned int optixGetAttribute_7(); - - -/// Return the attribute at the given slot index for the current outgoing hit object. There are up -/// to 8 attributes available. The number of attributes is configured with -/// OptixPipelineCompileOptions::numAttributeValues. -/// -/// Results are undefined if the hit object is a miss. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ unsigned int optixHitObjectGetAttribute_0(); -static __forceinline__ __device__ unsigned int optixHitObjectGetAttribute_1(); -static __forceinline__ __device__ unsigned int optixHitObjectGetAttribute_2(); -static __forceinline__ __device__ unsigned int optixHitObjectGetAttribute_3(); -static __forceinline__ __device__ unsigned int optixHitObjectGetAttribute_4(); -static __forceinline__ __device__ unsigned int optixHitObjectGetAttribute_5(); -static __forceinline__ __device__ unsigned int optixHitObjectGetAttribute_6(); -static __forceinline__ __device__ unsigned int optixHitObjectGetAttribute_7(); - -/// Record the hit, stops traversal, and proceeds to CH. -/// -/// Available in AH -static __forceinline__ __device__ void optixTerminateRay(); - -/// Discards the hit, and returns control to the calling optixReportIntersection or built-in -/// intersection routine. -/// -/// Available in AH -static __forceinline__ __device__ void optixIgnoreIntersection(); - - -/// For a given OptixBuildInputTriangleArray the number of primitives is defined as -/// -/// "(OptixBuildInputTriangleArray::indexBuffer == 0) ? OptixBuildInputTriangleArray::numVertices/3 : -/// OptixBuildInputTriangleArray::numIndexTriplets;". -/// -/// For a given OptixBuildInputCustomPrimitiveArray the number of primitives is defined as numAabbs. -/// -/// The primitive index returns the index into the array of primitives plus the -/// primitiveIndexOffset. -/// -/// In IS and AH this corresponds to the currently intersected primitive. -/// -/// In CH this corresponds to the primitive index of the closest intersected primitive. -/// -/// Available in IS, AH, CH -static __forceinline__ __device__ unsigned int optixGetPrimitiveIndex(); - - -/// Returns the user-provided cluster ID of the intersected CLAS of a hit. -/// -/// Returns OPTIX_CLUSTER_ID_INVALID if the closest (or current) intersection -/// is not a cluster. -/// -/// see also OptixPipelineCompileOptions::allowClusteredGeometry -/// -/// Available in AH, CH -static __forceinline__ __device__ unsigned int optixGetClusterId(); - -/// Returns the user-provided cluster ID associated with the current outgoing hit object. -/// -/// Returns OPTIX_CLUSTER_ID_INVALID if the closest intersection is not a cluster, -/// or if the hit object is a miss. -/// -/// see also OptixPipelineCompileOptions::allowClusteredGeometry -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ unsigned int optixHitObjectGetClusterId(); - - -/// Return the primitive index associated with the current outgoing hit object. -/// -/// Results are undefined if the hit object is a miss. -/// -/// See #optixGetPrimitiveIndex() for more details. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ unsigned int optixHitObjectGetPrimitiveIndex(); - -/// Returns the Sbt GAS index of the primitive associated with the current intersection. -/// -/// In IS and AH this corresponds to the currently intersected primitive. -/// -/// In CH this corresponds to the SBT GAS index of the closest intersected primitive. -/// -/// Available in IS, AH, CH -static __forceinline__ __device__ unsigned int optixGetSbtGASIndex(); - -/// Return the SBT GAS index of the closest intersected primitive associated with the current -/// outgoing hit object. -/// -/// Results are undefined if the hit object is a miss. -/// -/// See #optixGetSbtGASIndex() for details on the version for the incoming hit object. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ unsigned int optixHitObjectGetSbtGASIndex(); - - -/// Returns the OptixInstance::instanceId of the instance within the top level acceleration -/// structure associated with the current intersection. -/// -/// When building an acceleration structure using OptixBuildInputInstanceArray each OptixInstance -/// has a user supplied instanceId. OptixInstance objects reference another acceleration structure. -/// During traversal the acceleration structures are visited top down. In the IS and AH programs -/// the OptixInstance::instanceId corresponding to the most recently visited OptixInstance is -/// returned when calling optixGetInstanceId(). In CH optixGetInstanceId() returns the -/// OptixInstance::instanceId when the hit was recorded with optixReportIntersection. In the case -/// where there is no OptixInstance visited, optixGetInstanceId returns 0 -/// -/// Available in IS, AH, CH -static __forceinline__ __device__ unsigned int optixGetInstanceId(); - -/// Returns the OptixInstance::instanceId of the instance within the top level acceleration -/// structure associated with the outgoing hit object. -/// -/// Results are undefined if the hit object is a miss. -/// -/// See #optixGetInstanceId(). -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ unsigned int optixHitObjectGetInstanceId(); - -/// Returns the zero-based index of the instance within its instance acceleration structure -/// associated with the current intersection. -/// -/// In the IS and AH programs the index corresponding to the most recently visited OptixInstance is -/// returned when calling optixGetInstanceIndex(). In CH optixGetInstanceIndex() returns the index -/// when the hit was recorded with optixReportIntersection. In the case where there is no -/// OptixInstance visited, optixGetInstanceIndex returns 0 -/// -/// Available in IS, AH, CH -static __forceinline__ __device__ unsigned int optixGetInstanceIndex(); - -/// Returns the zero-based index of the instance within its instance acceleration structure -/// associated with the outgoing hit object. -/// -/// Results are undefined if the hit object is a miss. -/// -/// See #optixGetInstanceIndex(). -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ unsigned int optixHitObjectGetInstanceIndex(); - -/// Returns the 8 bit hit kind associated with the current hit. -/// -/// Use optixGetPrimitiveType() to interpret the hit kind. For custom intersections (primitive type -/// OPTIX_PRIMITIVE_TYPE_CUSTOM), this is the 7-bit hitKind passed to optixReportIntersection(). -/// Hit kinds greater than 127 are reserved for built-in primitives. -/// -/// Available in AH and CH -static __forceinline__ __device__ unsigned int optixGetHitKind(); - -/// Returns the 8 bit hit kind associated with the current outgoing hit object. -/// -/// Results are undefined if the hit object is a miss. -/// -/// See #optixGetHitKind(). -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ unsigned int optixHitObjectGetHitKind(); - -/// Function interpreting the result of #optixGetHitKind(). -/// -/// Available in all OptiX program types -static __forceinline__ __device__ OptixPrimitiveType optixGetPrimitiveType( unsigned int hitKind ); - -/// Function interpreting the result of #optixGetHitKind(). -/// -/// Available in all OptiX program types -static __forceinline__ __device__ bool optixIsFrontFaceHit( unsigned int hitKind ); - -/// Function interpreting the result of #optixGetHitKind(). -/// -/// Available in all OptiX program types -static __forceinline__ __device__ bool optixIsBackFaceHit( unsigned int hitKind ); - -/// Function interpreting the hit kind associated with the current optixReportIntersection. -/// -/// Available in AH, CH -static __forceinline__ __device__ OptixPrimitiveType optixGetPrimitiveType(); - -/// Function interpreting the hit kind associated with the current optixReportIntersection. -/// -/// Available in AH, CH -static __forceinline__ __device__ bool optixIsFrontFaceHit(); - -/// Function interpreting the hit kind associated with the current optixReportIntersection. -/// -/// Available in AH, CH -static __forceinline__ __device__ bool optixIsBackFaceHit(); - -/// Convenience function interpreting the result of #optixGetHitKind(). -/// -/// Available in AH, CH -static __forceinline__ __device__ bool optixIsTriangleHit(); - -/// Convenience function interpreting the result of #optixGetHitKind(). -/// -/// Available in AH, CH -static __forceinline__ __device__ bool optixIsTriangleFrontFaceHit(); - -/// Convenience function interpreting the result of #optixGetHitKind(). -/// -/// Available in AH, CH -static __forceinline__ __device__ bool optixIsTriangleBackFaceHit(); - - -/// Convenience function that returns the first two attributes as floats. -/// -/// When using OptixBuildInputTriangleArray objects, during intersection with a triangle, the barycentric coordinates of the hit -/// are stored into the first two attribute registers. -/// -/// Available in AH, CH -static __forceinline__ __device__ float2 optixGetTriangleBarycentrics(); - -/// Returns the barycentric coordinates of the hit point on an intersected triangle. -/// -/// This function is the hit object's equivalent to optixGetTriangleBarycentrics(). -/// It is only valid to call this function if the return value of -/// optixGetPrimitiveType( optixHitObjectGetHitKind() ) equals OPTIX_PRIMITIVE_TYPE_TRIANGLE. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ float2 optixHitObjectGetTriangleBarycentrics(); - -/// Returns the curve parameter associated with the current intersection when using -/// OptixBuildInputCurveArray objects. -/// -/// Available in AH, CH -static __forceinline__ __device__ float optixGetCurveParameter(); - -/// Returns the curve parameter associated with the intersection of a curve. -/// -/// This function is the hit object's equivalent to optixGetCurveParameter(). -/// It is only valid to call this function if the return value of -/// optixGetPrimitiveType( optixHitObjectGetHitKind() ) equals a primitive type that can -/// be used to build an AS with OptixBuildInputCurveArray objects. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ float optixHitObjectGetCurveParameter(); - -/// Returns the ribbon parameters along directrix (length) and generator (width) of the current -/// intersection when using OptixBuildInputCurveArray objects with curveType -/// OPTIX_PRIMITIVE_TYPE_FLAT_QUADRATIC_BSPLINE. -/// -/// Available in AH, CH -static __forceinline__ __device__ float2 optixGetRibbonParameters(); - -/// Returns the ribbon parameters along directrix (length) and generator (width) of the current -/// curve intersection with primitive type OPTIX_PRIMITIVE_TYPE_FLAT_QUADRATIC_BSPLINE. -/// -/// This function is the hit object's equivalent to optixGetRibbonParameters(). -/// It is only valid to call this function if the return value of -/// optixGetPrimitiveType( optixHitObjectGetHitKind() ) equals OPTIX_PRIMITIVE_TYPE_FLAT_QUADRATIC_BSPLINE. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ float2 optixHitObjectGetRibbonParameters(); - -/// Available in any program, it returns the current launch index within the launch dimensions -/// specified by optixLaunch on the host. -/// -/// The raygen program is typically only launched once per launch index. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ uint3 optixGetLaunchIndex(); - -/// Available in any program, it returns the dimensions of the current launch specified by -/// optixLaunch on the host. -/// -/// Available in all OptiX program types -static __forceinline__ __device__ uint3 optixGetLaunchDimensions(); - -/// Returns the generic memory space pointer to the data region (past the header) of the -/// currently active SBT record corresponding to the current program. -/// -/// Note that optixGetSbtDataPointer is not available in OptiX-enabled functions, because -/// there is no SBT entry associated with the function. -/// -/// Available in RG, IS, AH, CH, MS, EX, DC, CC -static __forceinline__ __device__ CUdeviceptr optixGetSbtDataPointer(); - -/// Device pointer address for the SBT associated with the hit or miss program for the current -/// outgoing hit object. -/// -/// Returns 0 for nop hit objects. -/// -/// Available in RG, CH, MS, CC, DC -static __forceinline__ __device__ CUdeviceptr optixHitObjectGetSbtDataPointer(); - -/// Throws a user exception with the given exception code (overload without exception details). -/// -/// The exception code must be in the range from 0 to 2^30 - 1. Up to 8 optional exception details -/// can be passed. They can be queried in the EX program using optixGetExceptionDetail_0() to -/// ..._8(). -/// -/// The exception details must not be used to encode pointers to the stack since the current stack -/// is not preserved in the EX program. -/// -/// Not available in EX -/// -/// \param[in] exceptionCode The exception code to be thrown. -/// -/// Available in RG, IS, AH, CH, MS, DC, CC -static __forceinline__ __device__ void optixThrowException( int exceptionCode ); - -/// Throws a user exception with the given exception code (overload with 1 exception detail). -/// -/// \see #optixThrowException(int) -/// -/// Available in RG, IS, AH, CH, MS, DC, CC -static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0 ); - -/// Throws a user exception with the given exception code (overload with 2 exception details). -/// -/// \see #optixThrowException(int) -/// -/// Available in RG, IS, AH, CH, MS, DC, CC -static __forceinline__ __device__ void optixThrowException( int exceptionCode, - unsigned int exceptionDetail0, - unsigned int exceptionDetail1 ); - -/// Throws a user exception with the given exception code (overload with 3 exception details). -/// -/// \see #optixThrowException(int) -/// -/// Available in RG, IS, AH, CH, MS, DC, CC -static __forceinline__ __device__ void optixThrowException( int exceptionCode, - unsigned int exceptionDetail0, - unsigned int exceptionDetail1, - unsigned int exceptionDetail2 ); - -/// Throws a user exception with the given exception code (overload with 4 exception details). -/// -/// \see #optixThrowException(int) -/// -/// Available in RG, IS, AH, CH, MS, DC, CC -static __forceinline__ __device__ void optixThrowException( int exceptionCode, - unsigned int exceptionDetail0, - unsigned int exceptionDetail1, - unsigned int exceptionDetail2, - unsigned int exceptionDetail3 ); - -/// Throws a user exception with the given exception code (overload with 5 exception details). -/// -/// \see #optixThrowException(int) -/// -/// Available in RG, IS, AH, CH, MS, DC, CC -static __forceinline__ __device__ void optixThrowException( int exceptionCode, - unsigned int exceptionDetail0, - unsigned int exceptionDetail1, - unsigned int exceptionDetail2, - unsigned int exceptionDetail3, - unsigned int exceptionDetail4 ); - -/// Throws a user exception with the given exception code (overload with 6 exception details). -/// -/// \see #optixThrowException(int) -/// -/// Available in RG, IS, AH, CH, MS, DC, CC -static __forceinline__ __device__ void optixThrowException( int exceptionCode, - unsigned int exceptionDetail0, - unsigned int exceptionDetail1, - unsigned int exceptionDetail2, - unsigned int exceptionDetail3, - unsigned int exceptionDetail4, - unsigned int exceptionDetail5 ); - -/// Throws a user exception with the given exception code (overload with 7 exception -/// details). -/// -/// \see #optixThrowException(int) -/// -/// Available in RG, IS, AH, CH, MS, DC, CC -static __forceinline__ __device__ void optixThrowException( int exceptionCode, - unsigned int exceptionDetail0, - unsigned int exceptionDetail1, - unsigned int exceptionDetail2, - unsigned int exceptionDetail3, - unsigned int exceptionDetail4, - unsigned int exceptionDetail5, - unsigned int exceptionDetail6 ); - -/// Throws a user exception with the given exception code (overload with 8 exception details). -/// -/// \see #optixThrowException(int) -/// -/// Available in RG, IS, AH, CH, MS, DC, CC -static __forceinline__ __device__ void optixThrowException( int exceptionCode, - unsigned int exceptionDetail0, - unsigned int exceptionDetail1, - unsigned int exceptionDetail2, - unsigned int exceptionDetail3, - unsigned int exceptionDetail4, - unsigned int exceptionDetail5, - unsigned int exceptionDetail6, - unsigned int exceptionDetail7 ); - -/// Returns the exception code. -/// -/// Available in EX -static __forceinline__ __device__ int optixGetExceptionCode(); - -/// Returns the 32-bit exception detail at slot 0. -/// -/// The behavior is undefined if the exception is not a user exception, or the used overload -/// #optixThrowException() did not provide the queried exception detail. -/// -/// Available in EX -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_0(); - -/// Returns the 32-bit exception detail at slot 1. -/// -/// \see #optixGetExceptionDetail_0() -/// -/// Available in EX -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_1(); - -/// Returns the 32-bit exception detail at slot 2. -/// -/// \see #optixGetExceptionDetail_0() -/// -/// Available in EX -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_2(); - -/// Returns the 32-bit exception detail at slot 3. -/// -/// \see #optixGetExceptionDetail_0() -/// -/// Available in EX -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_3(); - -/// Returns the 32-bit exception detail at slot 4. -/// -/// \see #optixGetExceptionDetail_0() -/// -/// Available in EX -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_4(); - -/// Returns the 32-bit exception detail at slot 5. -/// -/// \see #optixGetExceptionDetail_0() -/// -/// Available in EX -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_5(); - -/// Returns the 32-bit exception detail at slot 6. -/// -/// \see #optixGetExceptionDetail_0() -/// -/// Available in EX -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_6(); - -/// Returns the 32-bit exception detail at slot 7. -/// -/// \see #optixGetExceptionDetail_0() -/// -/// Available in EX -static __forceinline__ __device__ unsigned int optixGetExceptionDetail_7(); - - -/// Returns a string that includes information about the source location that caused the current -/// exception. -/// -/// The source location is only available for user exceptions. -/// Line information needs to be present in the input PTX and -/// OptixModuleCompileOptions::debugLevel may not be set to OPTIX_COMPILE_DEBUG_LEVEL_NONE. -/// -/// Returns a NULL pointer if no line information is available. -/// -/// Available in EX -static __forceinline__ __device__ char* optixGetExceptionLineInfo(); - -/// Creates a call to the direct callable program at the specified SBT entry. -/// -/// This will call the program that was specified in the -/// OptixProgramGroupCallables::entryFunctionNameDC in the module specified by -/// OptixProgramGroupCallables::moduleDC. -/// -/// The address of the SBT entry is calculated by: -/// OptixShaderBindingTable::callablesRecordBase + ( OptixShaderBindingTable::callablesRecordStrideInBytes * sbtIndex ). -/// -/// Direct callable programs are allowed to call optixTrace, but any secondary trace calls invoked -/// from subsequently called CH, MS and callable programs will result an an error. -/// -/// Behavior is undefined if there is no direct callable program at the specified SBT entry. -/// -/// Behavior is undefined if the number of arguments that are being passed in does not match the -/// number of parameters expected by the program that is called. In validation mode an exception -/// will be generated. -/// -/// \param[in] sbtIndex The offset of the SBT entry of the direct callable program to call relative -/// to OptixShaderBindingTable::callablesRecordBase. \param[in] args The arguments to pass to the -/// direct callable program. -/// -/// Available in RG, IS, AH, CH, MS, DC, CC -template -static __forceinline__ __device__ ReturnT optixDirectCall( unsigned int sbtIndex, ArgTypes... args ); - - -/// Creates a call to the continuation callable program at the specified SBT entry. -/// -/// This will call the program that was specified in the -/// OptixProgramGroupCallables::entryFunctionNameCC in the module specified by -/// OptixProgramGroupCallables::moduleCC. -/// -/// The address of the SBT entry is calculated by: -/// OptixShaderBindingTable::callablesRecordBase + ( OptixShaderBindingTable::callablesRecordStrideInBytes * sbtIndex ). -/// -/// As opposed to direct callable programs, continuation callable programs are allowed to make -/// secondary optixTrace calls. -/// -/// Behavior is undefined if there is no continuation callable program at the specified SBT entry. -/// -/// Behavior is undefined if the number of arguments that are being passed in does not match the -/// number of parameters expected by the program that is called. In validation mode an exception -/// will be generated. -/// -/// \param[in] sbtIndex The offset of the SBT entry of the continuation callable program to call relative to OptixShaderBindingTable::callablesRecordBase. -/// \param[in] args The arguments to pass to the continuation callable program. -/// -/// Available in RG, CH, MS, CC -template -static __forceinline__ __device__ ReturnT optixContinuationCall( unsigned int sbtIndex, ArgTypes... args ); - - -/// optixTexFootprint2D calculates the footprint of a corresponding 2D texture fetch (non-mipmapped). -/// -/// On Turing and subsequent architectures, a texture footprint instruction allows user programs to -/// determine the set of texels that would be accessed by an equivalent filtered texture lookup. -/// -/// \param[in] tex CUDA texture object (cast to 64-bit integer) -/// \param[in] texInfo Texture info packed into 32-bit integer, described below. -/// \param[in] x Texture coordinate -/// \param[in] y Texture coordinate -/// \param[out] singleMipLevel Result indicating whether the footprint spans only a single miplevel. -/// -/// The texture info argument is a packed 32-bit integer with the following layout: -/// -/// texInfo[31:29] = reserved (3 bits) -/// texInfo[28:24] = miplevel count (5 bits) -/// texInfo[23:20] = log2 of tile width (4 bits) -/// texInfo[19:16] = log2 of tile height (4 bits) -/// texInfo[15:10] = reserved (6 bits) -/// texInfo[9:8] = horizontal wrap mode (2 bits) (CUaddress_mode) -/// texInfo[7:6] = vertical wrap mode (2 bits) (CUaddress_mode) -/// texInfo[5] = mipmap filter mode (1 bit) (CUfilter_mode) -/// texInfo[4:0] = maximum anisotropy (5 bits) -/// -/// Returns a 16-byte structure (as a uint4) that stores the footprint of a texture request at a -/// particular "granularity", which has the following layout: -/// -/// struct Texture2DFootprint -/// { -/// unsigned long long mask; -/// unsigned int tileY : 12; -/// unsigned int reserved1 : 4; -/// unsigned int dx : 3; -/// unsigned int dy : 3; -/// unsigned int reserved2 : 2; -/// unsigned int granularity : 4; -/// unsigned int reserved3 : 4; -/// unsigned int tileX : 12; -/// unsigned int level : 4; -/// unsigned int reserved4 : 16; -/// }; -/// -/// The granularity indicates the size of texel groups that are represented by an 8x8 bitmask. For -/// example, a granularity of 12 indicates texel groups that are 128x64 texels in size. In a -/// footprint call, The returned granularity will either be the actual granularity of the result, or -/// 0 if the footprint call was able to honor the requested granularity (the usual case). -/// -/// level is the mip level of the returned footprint. Two footprint calls are needed to get the -/// complete footprint when a texture call spans multiple mip levels. -/// -/// mask is an 8x8 bitmask of texel groups that are covered, or partially covered, by the footprint. -/// tileX and tileY give the starting position of the mask in 8x8 texel-group blocks. For example, -/// suppose a granularity of 12 (128x64 texels), and tileX=3 and tileY=4. In this case, bit 0 of the -/// mask (the low order bit) corresponds to texel group coordinates (3*8, 4*8), and texel -/// coordinates (3*8*128, 4*8*64), within the specified mip level. -/// -/// If nonzero, dx and dy specify a "toroidal rotation" of the bitmask. Toroidal rotation of a -/// coordinate in the mask simply means that its value is reduced by 8. Continuing the example from -/// above, if dx=0 and dy=0 the mask covers texel groups (3*8, 4*8) to (3*8+7, 4*8+7) inclusive. -/// If, on the other hand, dx=2, the rightmost 2 columns in the mask have their x coordinates -/// reduced by 8, and similarly for dy. -/// -/// See the OptiX SDK for sample code that illustrates how to unpack the result. -/// -/// Available anywhere -static __forceinline__ __device__ uint4 optixTexFootprint2D( unsigned long long tex, unsigned int texInfo, float x, float y, unsigned int* singleMipLevel ); - -/// optixTexFootprint2DLod calculates the footprint of a corresponding 2D texture fetch (tex2DLod) -/// \param[in] tex CUDA texture object (cast to 64-bit integer) -/// \param[in] texInfo Texture info packed into 32-bit integer, described below. -/// \param[in] x Texture coordinate -/// \param[in] y Texture coordinate -/// \param[in] level Level of detail (lod) -/// \param[in] coarse Requests footprint from coarse miplevel, when the footprint spans two levels. -/// \param[out] singleMipLevel Result indicating whether the footprint spans only a single miplevel. -/// \see #optixTexFootprint2D(unsigned long long,unsigned int,float,float,unsigned int*) -/// -/// Available anywhere -static __forceinline__ __device__ uint4 -optixTexFootprint2DLod( unsigned long long tex, unsigned int texInfo, float x, float y, float level, bool coarse, unsigned int* singleMipLevel ); - -/// optixTexFootprint2DGrad calculates the footprint of a corresponding 2D texture fetch (tex2DGrad) -/// \param[in] tex CUDA texture object (cast to 64-bit integer) -/// \param[in] texInfo Texture info packed into 32-bit integer, described below. -/// \param[in] x Texture coordinate -/// \param[in] y Texture coordinate -/// \param[in] dPdx_x Derivative of x coordinte, which determines level of detail. -/// \param[in] dPdx_y Derivative of x coordinte, which determines level of detail. -/// \param[in] dPdy_x Derivative of y coordinte, which determines level of detail. -/// \param[in] dPdy_y Derivative of y coordinte, which determines level of detail. -/// \param[in] coarse Requests footprint from coarse miplevel, when the footprint spans two levels. -/// \param[out] singleMipLevel Result indicating whether the footprint spans only a single miplevel. -/// \see #optixTexFootprint2D(unsigned long long,unsigned int,float,float,unsigned int*) -/// -/// Available anywhere -static __forceinline__ __device__ uint4 optixTexFootprint2DGrad( unsigned long long tex, - unsigned int texInfo, - float x, - float y, - float dPdx_x, - float dPdx_y, - float dPdy_x, - float dPdy_y, - bool coarse, - unsigned int* singleMipLevel ); - -/**@}*/ // end group optix_device_api - -#define __OPTIX_INCLUDE_INTERNAL_HEADERS__ - -#include "internal/optix_device_impl.h" - - -// If you manually define OPTIX_INCLUDE_COOPERATIVE_VECTOR to override the default behavior, you must -// set it to 0 or 1 and not simply define it with no value (which will default it have a value of 0). -#ifndef OPTIX_INCLUDE_COOPERATIVE_VECTOR -# define OPTIX_INCLUDE_COOPERATIVE_VECTOR_UNSET -# define OPTIX_INCLUDE_COOPERATIVE_VECTOR 1 -#endif - -#if OPTIX_INCLUDE_COOPERATIVE_VECTOR -/// \addtogroup optix_device_api -/// \defgroup optix_device_api_coop_vec Cooperative Vector -/// \ingroup optix_device_api -///@{ -/// - -/// Load the vector from global memory. The memory address must be 16 byte aligned -/// regardless of the type and number of elements in the vector. -/// -/// Available anywhere -template -static __forceinline__ __device__ VecTOut optixCoopVecLoad( CUdeviceptr ptr ); -/// Load the vector from global memory. The memory address must be 16 byte aligned -/// regardless of the type and number of elements in the vector. -/// -/// Available anywhere -template -static __forceinline__ __device__ VecTOut optixCoopVecLoad( T* ptr ); - - -/// Following functions are designed to facilitate activation function evaluation between -/// calls to optixCoopVecMatMul. Utilizing only these functions on the activation vectors -/// will typically improve performance. -/// -/// Available anywhere -template -static __forceinline__ __device__ VecT optixCoopVecExp2( const VecT& vec ); -/// -/// Available anywhere -template -static __forceinline__ __device__ VecT optixCoopVecLog2( const VecT& vec ); -/// -/// Available anywhere -template -static __forceinline__ __device__ VecT optixCoopVecTanh( const VecT& vec ); -/// Convert from VecTIn to VecTOut. Not all conversions are supported, only integral to 16 -/// or 32-bit floating point. -/// -/// Available anywhere -template -static __forceinline__ __device__ VecTOut optixCoopVecCvt( const VecTIn& vec ); -/// -/// Available anywhere -template -static __forceinline__ __device__ VecT optixCoopVecMin( const VecT& vecA, const VecT& vecB ); -/// -/// Available anywhere -template -static __forceinline__ __device__ VecT optixCoopVecMin( const VecT& vecA, typename VecT::value_type B ); -/// -/// Available anywhere -template -static __forceinline__ __device__ VecT optixCoopVecMax( const VecT& vecA, const VecT& vecB ); -/// -/// Available anywhere -template -static __forceinline__ __device__ VecT optixCoopVecMax( const VecT& vecA, typename VecT::value_type B ); -/// -/// Available anywhere -template -static __forceinline__ __device__ VecT optixCoopVecMul( const VecT& vecA, const VecT& vecB ); -/// -/// Available anywhere -template -static __forceinline__ __device__ VecT optixCoopVecAdd( const VecT& vecA, const VecT& vecB ); -/// -/// Available anywhere -template -static __forceinline__ __device__ VecT optixCoopVecSub( const VecT& vecA, const VecT& vecB ); -/// Returns result[i] = ( vecA[i] < vecB[i] ) ? 0 : 1; -/// -/// Available anywhere -template -static __forceinline__ __device__ VecT optixCoopVecStep( const VecT& vecA, const VecT& vecB ); -/// -/// Available anywhere -template -static __forceinline__ __device__ VecT optixCoopVecFFMA( const VecT& vecA, const VecT& vecB, const VecT& vecC ); - -/// Computes a vector matrix multiplication with an addition of a bias. -/// -/// \code -/// A * B + C = D -/// Does matrix * inputVector + bias = output -/// [NxK] [Kx1] [Nx1] = [Nx1] -/// \endcode -/// -/// Not all combinations of inputType and matrixElementType are supported. See the -/// following table for supported configurations. -/// -/// inputType | inputInterpretation | matrixElementType | biasElementType | outputType -/// -----------|---------------------|-------------------|-----------------|----------- -/// FLOAT16 | FLOAT16 | FLOAT16 | FLOAT16 | FLOAT16 -/// FLOAT16 | FLOAT8_E4M3 | FLOAT8_E4M3 | FLOAT16 | FLOAT16 -/// FLOAT16 | FLOAT8_E5M4 | FLOAT8_E5M4 | FLOAT16 | FLOAT16 -/// FLOAT16 | UINT8/INT8 | UINT8/INT8 | UINT32/INT32 | UINT32/INT32 -/// FLOAT32 | UINT8/INT8 | UINT8/INT8 | UINT32/INT32 | UINT32/INT32 -/// UINT8/INT8 | UINT8/INT8 | UINT8/INT8 | UINT32/INT32 | UINT32/INT32 -/// -/// If either the input or matrix is signed, then the bias and output must also be signed. -/// -/// When matrixElementType is OPTIX_COOP_VEC_ELEM_TYPE_FLOAT8_E4M3 or -/// OPTIX_COOP_VEC_ELEM_TYPE_FLOAT8_E5M2 the matrixLayout must be either -/// OPTIX_COOP_VEC_MATRIX_LAYOUT_INFERENCING_OPTIMAL or -/// OPTIX_COOP_VEC_MATRIX_LAYOUT_TRAINING_OPTIMAL. -/// -/// When the inputVector's element type does not match the inputInterpretation -/// arithmetically casting is performed on the input values to match the -/// inputInterpretation. -/// -/// If transpose is true, the matrix is treated as being stored transposed in memory -/// (stored as KxN instead of NxK). Set other parameters as if the matrix was not -/// transposed in memory. Not all matrix element types or matrix layouts support -/// transpose. Only OPTIX_COOP_VEC_ELEM_TYPE_FLOAT16 is supported. Only -/// OPTIX_COOP_VEC_MATRIX_LAYOUT_INFERENCING_OPTIMAL and -/// OPTIX_COOP_VEC_MATRIX_LAYOUT_TRAINING_OPTIMAL are supported. -/// -/// The bias pointer is assumed to not be null and may be dereferenced. If you wish to do -/// the matrix multiply without a bias then use the overloaded version of this function -/// that does not take the bias. -/// -/// For row and column ordered matrix layouts, the stride will assume tight packing when -/// rowColumnStrideInBytes is a constant immediate 0 (computed values or loaded from -/// memory will not work). Ignored for other matrix layouts. Value must be 16 byte -/// aligned. -/// -/// \tparam VecTOut Type must match biasElementType and size must match N -/// \tparam VecTIn Type must be i32, f16 or f32 type and size must match K -/// \tparam inputInterpretation Must match matrixLayout -/// \tparam matrixLayout The layout of the matrix in memory -/// \tparam transpose Whether the data in memory for matrix is transposed from the specified layout -/// \tparam N Must match VecTOut::size -/// \tparam K Must match VecTIn::size -/// \tparam matrixElementType Type of elements stored in memory -/// \tparam biasElementType Type of elements stored in memory, must also match VecTOut::elementType -/// -/// \param[in] inputVector -/// \param[in] matrix pointer to global memory. Array of NxK elements. 64 byte aligned. Must not be modified during use. -/// \param[in] matrixOffsetInBytes offset to start of matrix data. Using the same value for matrix with different offsets for all layers yields more effecient execution. 64 byte aligned. -/// \param[in] bias pointer to global memory. Array of N elements. 16 byte aligned. Must not be modified during use. -/// \param[in] biasOffsetInBytes offset to start of bias data. Using the same value for bias with different offsets for all layers yields more effecient execution. 16 byte aligned. -/// \param[in] rowColumnStrideInBytes for row or column major matrix layouts, this identifies the stride between columns or rows. -/// -/// Available in all OptiX program types -template < - typename VecTOut, - typename VecTIn, - OptixCoopVecElemType inputInterpretation, - OptixCoopVecMatrixLayout matrixLayout, - bool transpose, - unsigned int N, - unsigned int K, - OptixCoopVecElemType matrixElementType, - OptixCoopVecElemType biasElementType> -static __forceinline__ __device__ VecTOut optixCoopVecMatMul( const VecTIn& inputVector, - CUdeviceptr matrix, // 64 byte aligned, Array of KxN elements - unsigned matrixOffsetInBytes, // 64 byte aligned - CUdeviceptr bias, // 16 byte aligned, Array of N elements - unsigned biasOffsetInBytes, // 16 byte aligned - unsigned rowColumnStrideInBytes = 0 ); - -/// Same as #optixCoopVecMatMul, but without the bias parameters. -template -static __forceinline__ __device__ VecTOut optixCoopVecMatMul( const VecTIn& inputVector, - CUdeviceptr matrix, // 64 byte aligned, Array of KxN elements - unsigned matrixOffsetInBytes, // 64 byte aligned - unsigned rowColumnStrideInBytes = 0 ); - -/// Performs a component-wise atomic add reduction of the vector into global memory -/// starting at \a offsetInBytes bytes after \a outputVector. -/// -/// VecTIn::elementType must be of type OPTIX_COOP_VEC_ELEM_TYPE_FLOAT16 or -/// OPTIX_COOP_VEC_ELEM_TYPE_FLOAT32 The memory backed by \a outputVector + \a offsetInBytes -/// must be large enough to accomodate VecTIn::size elements. The type of data in -/// \a outputVector must match VecTIn::elementType. No type conversion is performed. -/// \a outputVector + \a offsetInBytes must be 4 byte aligned. -/// -/// \tparam VecTIn Type of inputVector -/// -/// \param[in] inputVector -/// \param[in] outputVector pointer to global memory on the device, sum with \a offsetInBytes must be a multiple of 4 -/// \param[in] offsetInBytes offset in bytes from \a outputVector, sum with \a outputVector must be a multiple of 4 -/// -/// Available in all OptiX program types -template -static __forceinline__ __device__ void optixCoopVecReduceSumAccumulate( const VecTIn& inputVector, - CUdeviceptr outputVector, - unsigned offsetInBytes ); - -/// Produces a matrix outer product of the input vecA and vecB ( vecA * transpose(vecB) ) -/// and does a component-wise atomic add reduction of the result into global memory -/// starting \a offsetInBytes bytes after \a outputMatrix. The dimentions of the matrix are -/// [VecTA::size, VecTB::size]. VecTA::elementType, VecTB::elementType and the element -/// type of the matrix must be the same, no type conversion is performed. The element type -/// must be OPTIX_COOP_VEC_ELEM_TYPE_FLOAT16. -/// -/// outputMatrix + offsetInBytes must be 4B aligned, but performance may be better with -/// 128 byte alignments. -/// -/// The output matrix will be in matrixLayout layout, though currently only -/// OPTIX_COOP_VEC_MATRIX_LAYOUT_TRAINING_OPTIMAL layout is supported. -/// -/// \tparam VecTA Type of vecA -/// \tparam VecTB Type of vecB -/// \tparam matrixLayout Layout of matrix stored in outputMatrix -/// -/// \param [in] vecA -/// \param [in] vecB -/// \param [in] outputMatrix pointer to global memory on the device, sum with \a offsetInBytes must be a multiple of 4 -/// \param [in] offsetInBytes offset in bytes from \a outputMatrix, sum with \a outputMatrix must be a multiple of 4 -/// \param [in] rowColumnStrideInBytes stride between rows or columns, zero takes natural stride, ignored for optimal layouts -/// -/// Available in all OptiX program types -template -static __forceinline__ __device__ void optixCoopVecOuterProductAccumulate( const VecTA& vecA, - const VecTB& vecB, - CUdeviceptr outputMatrix, - unsigned offsetInBytes, - unsigned rowColumnStrideInBytes = 0 ); - -/// This function is intended strictly for matrix layouts that must be computed through -/// the host API, #optixCoopVecMatrixComputeSize, but is needed on the device. For optimal -/// performance the offsets to each layer in a network should be constant, so this -/// function can be used to facilitate calculating the offset for subsequent layers in -/// shader code. It can also be used for calculating the size of row and column major -/// matrices, but the rowColumnStrideInBytes template parameter must be specified, so that -/// it can be calculated during compilation. -/// -/// For row and column ordered matrix layouts, when rowColumnStrideInBytes is 0, the -/// stride will assume tight packing. -/// -/// Results will be rounded to the next multiple of 64 to make it easy to pack the -/// matrices in memory and have the correct alignment. -/// -/// Results are in number of bytes, and should match the output of the host function -/// #optixCoopVecMatrixComputeSize. -/// -/// \tparam N, K dimensions of the matrix -/// \tparam elementType Type of the matrix elements -/// \tparam layout Layout of the matrix -/// -/// Available anywhere -template -static __forceinline__ __device__ unsigned int optixCoopVecGetMatrixSize(); - -/// The API does not require the use of this class specifically, but it must define a -/// certain interface as spelled out by the public members of the class. Note that not all -/// types of T are supported. Only 8 and 32 bit signed and unsigned integral types along -/// with 16 and 32 bit floating point values. -template -class OptixCoopVec -{ - public: - static const unsigned int size = N; - using value_type = T; - - __forceinline__ __device__ OptixCoopVec() {} - __forceinline__ __device__ OptixCoopVec( const value_type& val ) - { - for( unsigned int i = 0; i < size; ++i ) - m_data[i] = val; - } - __forceinline__ __device__ const value_type& operator[]( unsigned int index ) const { return m_data[index]; } - __forceinline__ __device__ value_type& operator[]( unsigned int index ) { return m_data[index]; } - - __forceinline__ __device__ const value_type* data() const { return m_data; } - __forceinline__ __device__ value_type* data() { return m_data; } - - protected: - value_type m_data[size]; -}; - -/**@}*/ // end group optix_device_api - -#include "internal/optix_device_impl_coop_vec.h" - -#endif // OPTIX_INCLUDE_COOPERATIVE_VECTOR - -#ifdef OPTIX_INCLUDE_COOPERATIVE_VECTOR_UNSET -# undef OPTIX_INCLUDE_COOPERATIVE_VECTOR -# undef OPTIX_INCLUDE_COOPERATIVE_VECTOR_UNSET -#endif - - -#endif // OPTIX_OPTIX_DEVICE_H diff --git a/crtx/optix_9.1/optix_function_table.h b/crtx/optix_9.1/optix_function_table.h deleted file mode 100644 index 04ae85c..0000000 --- a/crtx/optix_9.1/optix_function_table.h +++ /dev/null @@ -1,444 +0,0 @@ -/* -* SPDX-FileCopyrightText: Copyright (c) 2019 - 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -* SPDX-License-Identifier: LicenseRef-NvidiaProprietary -* -* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual -* property and proprietary rights in and to this material, related -* documentation and any modifications thereto. Any use, reproduction, -* disclosure or distribution of this material and related documentation -* without an express license agreement from NVIDIA CORPORATION or -* its affiliates is strictly prohibited. -*/ -/// @file -/// @author NVIDIA Corporation -/// @brief OptiX public API header - -#ifndef OPTIX_OPTIX_FUNCTION_TABLE_H -#define OPTIX_OPTIX_FUNCTION_TABLE_H - -/// The OptiX ABI version. -#define OPTIX_ABI_VERSION 118 - -#ifndef OPTIX_DEFINE_ABI_VERSION_ONLY - -#include "optix_types.h" - -#if !defined( OPTIX_DONT_INCLUDE_CUDA ) -// If OPTIX_DONT_INCLUDE_CUDA is defined, cuda driver types must be defined through other -// means before including optix headers. -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/// \defgroup optix_function_table Function Table -/// \brief OptiX Function Table - -/** \addtogroup optix_function_table -@{ -*/ - -/// The function table containing all API functions. -/// -/// See #optixInit() and #optixInitWithHandle(). -typedef struct OptixFunctionTable -{ - /// \name Error handling - //@ { - - /// See ::optixGetErrorName(). - const char* ( *optixGetErrorName )( OptixResult result ); - - /// See ::optixGetErrorString(). - const char* ( *optixGetErrorString )( OptixResult result ); - - //@ } - /// \name Device context - //@ { - - /// See ::optixDeviceContextCreate(). - OptixResult ( *optixDeviceContextCreate )( CUcontext fromContext, const OptixDeviceContextOptions* options, OptixDeviceContext* context ); - - /// See ::optixDeviceContextDestroy(). - OptixResult ( *optixDeviceContextDestroy )( OptixDeviceContext context ); - - /// See ::optixDeviceContextGetProperty(). - OptixResult ( *optixDeviceContextGetProperty )( OptixDeviceContext context, OptixDeviceProperty property, void* value, size_t sizeInBytes ); - - /// See ::optixDeviceContextSetLogCallback(). - OptixResult ( *optixDeviceContextSetLogCallback )( OptixDeviceContext context, - OptixLogCallback callbackFunction, - void* callbackData, - unsigned int callbackLevel ); - - /// See ::optixDeviceContextSetCacheEnabled(). - OptixResult ( *optixDeviceContextSetCacheEnabled )( OptixDeviceContext context, int enabled ); - - /// See ::optixDeviceContextSetCacheLocation(). - OptixResult ( *optixDeviceContextSetCacheLocation )( OptixDeviceContext context, const char* location ); - - /// See ::optixDeviceContextSetCacheDatabaseSizes(). - OptixResult ( *optixDeviceContextSetCacheDatabaseSizes )( OptixDeviceContext context, size_t lowWaterMark, size_t highWaterMark ); - - /// See ::optixDeviceContextGetCacheEnabled(). - OptixResult ( *optixDeviceContextGetCacheEnabled )( OptixDeviceContext context, int* enabled ); - - /// See ::optixDeviceContextGetCacheLocation(). - OptixResult ( *optixDeviceContextGetCacheLocation )( OptixDeviceContext context, char* location, size_t locationSize ); - - /// See ::optixDeviceContextGetCacheDatabaseSizes(). - OptixResult ( *optixDeviceContextGetCacheDatabaseSizes )( OptixDeviceContext context, size_t* lowWaterMark, size_t* highWaterMark ); - - //@ } - /// \name Modules - //@ { - - /// See ::optixModuleCreate(). - OptixResult ( *optixModuleCreate )( OptixDeviceContext context, - const OptixModuleCompileOptions* moduleCompileOptions, - const OptixPipelineCompileOptions* pipelineCompileOptions, - const char* input, - size_t inputSize, - char* logString, - size_t* logStringSize, - OptixModule* module ); - - /// See ::optixModuleCreateWithTasks(). - OptixResult ( *optixModuleCreateWithTasks )( OptixDeviceContext context, - const OptixModuleCompileOptions* moduleCompileOptions, - const OptixPipelineCompileOptions* pipelineCompileOptions, - const char* input, - size_t inputSize, - char* logString, - size_t* logStringSize, - OptixModule* module, - OptixTask* firstTask ); - - /// See ::optixModuleGetCompilationState(). - OptixResult ( *optixModuleGetCompilationState )( OptixModule module, OptixModuleCompileState* state ); - - /// See ::optixModuleCancelCreation(). - OptixResult ( *optixModuleCancelCreation )( OptixModule module, OptixCreationFlags flags ); - - OptixResult ( *optixStub )( void ); - - /// See ::optixDeviceContextCancelCreations(). - OptixResult ( *optixDeviceContextCancelCreations )( OptixDeviceContext context, OptixCreationFlags flags ); - - /// See ::optixModuleDestroy(). - OptixResult ( *optixModuleDestroy )( OptixModule module ); - - /// See ::optixBuiltinISModuleGet(). - OptixResult( *optixBuiltinISModuleGet )( OptixDeviceContext context, - const OptixModuleCompileOptions* moduleCompileOptions, - const OptixPipelineCompileOptions* pipelineCompileOptions, - const OptixBuiltinISOptions* builtinISOptions, - OptixModule* builtinModule); - - //@ } - /// \name Tasks - //@ { - - /// See ::optixTaskExecute(). - OptixResult ( *optixTaskExecute )( OptixTask task, - OptixTask* additionalTasks, - unsigned int maxNumAdditionalTasks, - unsigned int* numAdditionalTasksCreated ); - - /// See ::optixTaskGetSerializationKey(). - OptixResult ( *optixTaskGetSerializationKey )( OptixTask task, void* key, size_t* size ); - - /// See ::optixTaskSerializeOutput(). - OptixResult ( *optixTaskSerializeOutput )( OptixTask task, void* data, size_t* size ); - - /// See ::optixTaskDeserializeOutput(). - OptixResult ( *optixTaskDeserializeOutput )( OptixTask task, - const void* data, - size_t size, - OptixTask* additionalTasks, - unsigned int maxNumAdditionalTasks, - unsigned int* numAdditionalTasksCreated ); - - //@ } - /// \name Program groups - //@ { - - /// See ::optixProgramGroupCreate(). - OptixResult ( *optixProgramGroupCreate )( OptixDeviceContext context, - const OptixProgramGroupDesc* programDescriptions, - unsigned int numProgramGroups, - const OptixProgramGroupOptions* options, - char* logString, - size_t* logStringSize, - OptixProgramGroup* programGroups ); - - /// See ::optixProgramGroupDestroy(). - OptixResult ( *optixProgramGroupDestroy )( OptixProgramGroup programGroup ); - - /// See ::optixProgramGroupGetStackSize(). - OptixResult ( *optixProgramGroupGetStackSize )( OptixProgramGroup programGroup, OptixStackSizes* stackSizes, OptixPipeline pipeline ); - - //@ } - /// \name Pipeline - //@ { - - /// See ::optixPipelineCreate(). - OptixResult ( *optixPipelineCreate )( OptixDeviceContext context, - const OptixPipelineCompileOptions* pipelineCompileOptions, - const OptixPipelineLinkOptions* pipelineLinkOptions, - const OptixProgramGroup* programGroups, - unsigned int numProgramGroups, - char* logString, - size_t* logStringSize, - OptixPipeline* pipeline ); - - /// See ::optixPipelineDestroy(). - OptixResult ( *optixPipelineDestroy )( OptixPipeline pipeline ); - - /// See ::optixPipelineSetStackSizeFromCallDepths(). - OptixResult ( *optixPipelineSetStackSizeFromCallDepths )( OptixPipeline pipeline, - unsigned int maxTraceDepth, - unsigned int maxContinuationCallableDepth, - unsigned int maxDirectCallableDepthFromState, - unsigned int maxDirectCallableDepthFromTraversal, - unsigned int maxTraversableGraphDepth); - - /// See ::optixPipelineSetStackSize(). - OptixResult ( *optixPipelineSetStackSize )( OptixPipeline pipeline, - unsigned int directCallableStackSizeFromTraversal, - unsigned int directCallableStackSizeFromState, - unsigned int continuationStackSize, - unsigned int maxTraversableGraphDepth ); - - OptixResult ( *optixPipelineSymbolMemcpyAsync )( OptixPipeline pipeline, - const char* name, - void* mem, - size_t sizeInBytes, - size_t offsetInBytes, - OptixPipelineSymbolMemcpyKind kind, - CUstream stream ); - - //@ } - /// \name Acceleration structures - //@ { - - /// See ::optixAccelComputeMemoryUsage(). - OptixResult ( *optixAccelComputeMemoryUsage )( OptixDeviceContext context, - const OptixAccelBuildOptions* accelOptions, - const OptixBuildInput* buildInputs, - unsigned int numBuildInputs, - OptixAccelBufferSizes* bufferSizes ); - - /// See ::optixAccelBuild(). - OptixResult ( *optixAccelBuild )( OptixDeviceContext context, - CUstream stream, - const OptixAccelBuildOptions* accelOptions, - const OptixBuildInput* buildInputs, - unsigned int numBuildInputs, - CUdeviceptr tempBuffer, - size_t tempBufferSizeInBytes, - CUdeviceptr outputBuffer, - size_t outputBufferSizeInBytes, - OptixTraversableHandle* outputHandle, - const OptixAccelEmitDesc* emittedProperties, - unsigned int numEmittedProperties ); - - /// See ::optixAccelGetRelocationInfo(). - OptixResult ( *optixAccelGetRelocationInfo )( OptixDeviceContext context, OptixTraversableHandle handle, OptixRelocationInfo* info ); - - - /// See ::optixCheckRelocationCompatibility(). - OptixResult ( *optixCheckRelocationCompatibility )( OptixDeviceContext context, - const OptixRelocationInfo* info, - int* compatible ); - - /// See ::optixAccelRelocate(). - OptixResult ( *optixAccelRelocate )( OptixDeviceContext context, - CUstream stream, - const OptixRelocationInfo* info, - const OptixRelocateInput* relocateInputs, - size_t numRelocateInputs, - CUdeviceptr targetAccel, - size_t targetAccelSizeInBytes, - OptixTraversableHandle* targetHandle ); - - - /// See ::optixAccelCompact(). - OptixResult ( *optixAccelCompact )( OptixDeviceContext context, - CUstream stream, - OptixTraversableHandle inputHandle, - CUdeviceptr outputBuffer, - size_t outputBufferSizeInBytes, - OptixTraversableHandle* outputHandle ); - - OptixResult ( *optixAccelEmitProperty )( OptixDeviceContext context, - CUstream stream, - OptixTraversableHandle handle, - const OptixAccelEmitDesc* emittedProperty ); - - /// See ::optixConvertPointerToTraversableHandle(). - OptixResult ( *optixConvertPointerToTraversableHandle )( OptixDeviceContext onDevice, - CUdeviceptr pointer, - OptixTraversableType traversableType, - OptixTraversableHandle* traversableHandle ); - - /// See ::optixOpacityMicromapArrayComputeMemoryUsage(). - OptixResult ( *optixOpacityMicromapArrayComputeMemoryUsage )( OptixDeviceContext context, - const OptixOpacityMicromapArrayBuildInput* buildInput, - OptixMicromapBufferSizes* bufferSizes ); - - /// See ::optixOpacityMicromapArrayBuild(). - OptixResult ( *optixOpacityMicromapArrayBuild )( OptixDeviceContext context, - CUstream stream, - const OptixOpacityMicromapArrayBuildInput* buildInput, - const OptixMicromapBuffers* buffers ); - - /// See ::optixOpacityMicromapArrayGetRelocationInfo(). - OptixResult ( *optixOpacityMicromapArrayGetRelocationInfo )( OptixDeviceContext context, - CUdeviceptr opacityMicromapArray, - OptixRelocationInfo* info ); - - /// See ::optixOpacityMicromapArrayRelocate(). - OptixResult ( *optixOpacityMicromapArrayRelocate )( OptixDeviceContext context, - CUstream stream, - const OptixRelocationInfo* info, - CUdeviceptr targetOpacityMicromapArray, - size_t targetOpacityMicromapArraySizeInBytes ); - - OptixResult ( *stub1 )( void ); - OptixResult ( *stub2 )( void ); - - /// See ::optixClusterAccelComputeMemoryUsage(). - OptixResult ( *optixClusterAccelComputeMemoryUsage )( OptixDeviceContext context, - OptixClusterAccelBuildMode buildMode, - const OptixClusterAccelBuildInput* buildInput, - OptixAccelBufferSizes* bufferSizes ); - - /// See ::optixClusterAccelBuild(). - OptixResult ( *optixClusterAccelBuild )( OptixDeviceContext context, - CUstream stream, - const OptixClusterAccelBuildModeDesc* buildModeDesc, - const OptixClusterAccelBuildInput* buildInput, - CUdeviceptr argsArray, - CUdeviceptr argsCount, - unsigned int argsStrideInBytes ); - - //@ } - /// \name Launch - //@ { - - /// See ::optixConvertPointerToTraversableHandle(). - OptixResult ( *optixSbtRecordPackHeader )( OptixProgramGroup programGroup, void* sbtRecordHeaderHostPointer ); - - /// See ::optixConvertPointerToTraversableHandle(). - OptixResult ( *optixLaunch )( OptixPipeline pipeline, - CUstream stream, - CUdeviceptr pipelineParams, - size_t pipelineParamsSize, - const OptixShaderBindingTable* sbt, - unsigned int width, - unsigned int height, - unsigned int depth ); - - //@ } - /// \name Cooperative Vector - //@ { - - /// See ::optixCoopVecMatrixConvert(). - OptixResult ( *optixCoopVecMatrixConvert )( OptixDeviceContext context, - CUstream stream, - unsigned int numNetworks, - const OptixNetworkDescription* inputNetworkDescription, - CUdeviceptr inputNetworks, - size_t inputNetworkStrideInBytes, - const OptixNetworkDescription* outputNetworkDescription, - CUdeviceptr outputNetworks, - size_t outputNetworkStrideInBytes ); - - /// See ::optixCoopVecMatrixComputeSize(). - OptixResult ( *optixCoopVecMatrixComputeSize )( OptixDeviceContext context, - unsigned int N, - unsigned int K, - OptixCoopVecElemType elementType, - OptixCoopVecMatrixLayout layout, - size_t rowColumnStrideInBytes, - size_t* sizeInBytes ); - - //@ } - /// \name Denoiser - //@ { - - /// See ::optixDenoiserCreate(). - OptixResult ( *optixDenoiserCreate )( OptixDeviceContext context, OptixDenoiserModelKind modelKind, const OptixDenoiserOptions* options, OptixDenoiser* returnHandle ); - - /// See ::optixDenoiserDestroy(). - OptixResult ( *optixDenoiserDestroy )( OptixDenoiser handle ); - - /// See ::optixDenoiserComputeMemoryResources(). - OptixResult ( *optixDenoiserComputeMemoryResources )( const OptixDenoiser handle, - unsigned int maximumInputWidth, - unsigned int maximumInputHeight, - OptixDenoiserSizes* returnSizes ); - - /// See ::optixDenoiserSetup(). - OptixResult ( *optixDenoiserSetup )( OptixDenoiser denoiser, - CUstream stream, - unsigned int inputWidth, - unsigned int inputHeight, - CUdeviceptr state, - size_t stateSizeInBytes, - CUdeviceptr scratch, - size_t scratchSizeInBytes ); - - /// See ::optixDenoiserInvoke(). - OptixResult ( *optixDenoiserInvoke )( OptixDenoiser denoiser, - CUstream stream, - const OptixDenoiserParams* params, - CUdeviceptr denoiserState, - size_t denoiserStateSizeInBytes, - const OptixDenoiserGuideLayer * guideLayer, - const OptixDenoiserLayer * layers, - unsigned int numLayers, - unsigned int inputOffsetX, - unsigned int inputOffsetY, - CUdeviceptr scratch, - size_t scratchSizeInBytes ); - - /// See ::optixDenoiserComputeIntensity(). - OptixResult ( *optixDenoiserComputeIntensity )( OptixDenoiser handle, - CUstream stream, - const OptixImage2D* inputImage, - CUdeviceptr outputIntensity, - CUdeviceptr scratch, - size_t scratchSizeInBytes ); - - /// See ::optixDenoiserComputeAverageColor(). - OptixResult ( *optixDenoiserComputeAverageColor )( OptixDenoiser handle, - CUstream stream, - const OptixImage2D* inputImage, - CUdeviceptr outputAverageColor, - CUdeviceptr scratch, - size_t scratchSizeInBytes ); - - /// See ::optixDenoiserCreateWithUserModel(). - OptixResult ( *optixDenoiserCreateWithUserModel )( OptixDeviceContext context, const void * data, size_t dataSizeInBytes, OptixDenoiser* returnHandle ); - //@ } - -} OptixFunctionTable; - -// define global function table variable with ABI specific name. -#define OPTIX_CONCATENATE_ABI_VERSION(prefix, macro) OPTIX_CONCATENATE_ABI_VERSION_IMPL(prefix, macro) -#define OPTIX_CONCATENATE_ABI_VERSION_IMPL(prefix, macro) prefix ## _ ## macro -#define OPTIX_FUNCTION_TABLE_SYMBOL OPTIX_CONCATENATE_ABI_VERSION(g_optixFunctionTable, OPTIX_ABI_VERSION) - -/**@}*/ // end group optix_function_table - -#ifdef __cplusplus -} -#endif - -#endif /* OPTIX_DEFINE_ABI_VERSION_ONLY */ - -#endif /* OPTIX_OPTIX_FUNCTION_TABLE_H */ diff --git a/crtx/optix_9.1/optix_function_table_definition.h b/crtx/optix_9.1/optix_function_table_definition.h deleted file mode 100644 index 5432fd7..0000000 --- a/crtx/optix_9.1/optix_function_table_definition.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * SPDX-FileCopyrightText: Copyright (c) 2019 - 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. - * SPDX-License-Identifier: BSD-3-Clause - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/// @file -/// @author NVIDIA Corporation -/// @brief OptiX public API header - -#ifndef OPTIX_OPTIX_FUNCTION_TABLE_DEFINITION_H -#define OPTIX_OPTIX_FUNCTION_TABLE_DEFINITION_H - -#include "optix_function_table.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** \addtogroup optix_function_table -@{ -*/ - -/// If the stubs in optix_stubs.h are used, then the function table needs to be defined in exactly -/// one translation unit. This can be achieved by including this header file in that translation -/// unit. -OptixFunctionTable OPTIX_FUNCTION_TABLE_SYMBOL; - -/**@}*/ // end group optix_function_table - -#ifdef __cplusplus -} -#endif - -#endif // OPTIX_OPTIX_FUNCTION_TABLE_DEFINITION_H diff --git a/crtx/optix_9.1/optix_host.h b/crtx/optix_9.1/optix_host.h deleted file mode 100644 index 9a8b543..0000000 --- a/crtx/optix_9.1/optix_host.h +++ /dev/null @@ -1,1225 +0,0 @@ -/* -* SPDX-FileCopyrightText: Copyright (c) 2010 - 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -* SPDX-License-Identifier: LicenseRef-NvidiaProprietary -* -* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual -* property and proprietary rights in and to this material, related -* documentation and any modifications thereto. Any use, reproduction, -* disclosure or distribution of this material and related documentation -* without an express license agreement from NVIDIA CORPORATION or -* its affiliates is strictly prohibited. -*/ -/// @file -/// @author NVIDIA Corporation -/// @brief OptiX public API header -/// -/// OptiX host include file -- includes the host api if compiling host code. -/// For the math library routines include optix_math.h - -#ifndef OPTIX_OPTIX_HOST_H -#define OPTIX_OPTIX_HOST_H - -/// Mixing multiple SDKs in a single application will result in symbol collisions. -/// To enable different compilation units to use different SDKs, use OPTIX_ENABLE_SDK_MIXING. -#ifndef OPTIXAPI -# ifdef OPTIX_ENABLE_SDK_MIXING -# define OPTIXAPI static -# else // OPTIX_ENABLE_SDK_MIXING -# ifdef __cplusplus -# define OPTIXAPI extern "C" -# else // __cplusplus -# define OPTIXAPI -# endif // __cplusplus -# endif // OPTIX_ENABLE_SDK_MIXING -#endif // OPTIXAPI - -#include "optix_types.h" -#if !defined( OPTIX_DONT_INCLUDE_CUDA ) -// If OPTIX_DONT_INCLUDE_CUDA is defined, cuda driver types must be defined through other -// means before including optix headers. -#include -#endif - - - -/// \defgroup optix_host_api Host API -/// \brief OptiX Host API - -/// \defgroup optix_host_api_error_handling Error handling -/// \ingroup optix_host_api -///@{ - -/// Returns a string containing the name of an error code in the enum. -/// -/// Output is a string representation of the enum. For example "OPTIX_SUCCESS" for -/// OPTIX_SUCCESS and "OPTIX_ERROR_INVALID_VALUE" for OPTIX_ERROR_INVALID_VALUE. -/// -/// If the error code is not recognized, "Unrecognized OptixResult code" is returned. -/// -/// \param[in] result OptixResult enum to generate string name for -/// -/// \see #optixGetErrorString -OPTIXAPI const char* optixGetErrorName( OptixResult result ); - -/// Returns the description string for an error code. -/// -/// Output is a string description of the enum. For example "Success" for -/// OPTIX_SUCCESS and "Invalid value" for OPTIX_ERROR_INVALID_VALUE. -/// -/// If the error code is not recognized, "Unrecognized OptixResult code" is returned. -/// -/// \param[in] result OptixResult enum to generate string description for -/// -/// \see #optixGetErrorName -OPTIXAPI const char* optixGetErrorString( OptixResult result ); - -///@} -/// \defgroup optix_host_api_device_context Device context -/// \ingroup optix_host_api -///@{ - -/// Create a device context associated with the CUDA context specified with 'fromContext'. -/// -/// If zero is specified for 'fromContext', OptiX will use the current CUDA context. The -/// CUDA context should be initialized before calling optixDeviceContextCreate. -/// -/// \param[in] fromContext -/// \param[in] options -/// \param[out] context -/// \return -/// - OPTIX_ERROR_CUDA_NOT_INITIALIZED -/// If using zero for 'fromContext' and CUDA has not been initialized yet on the calling -/// thread. -/// - OPTIX_ERROR_CUDA_ERROR -/// CUDA operation failed. -/// - OPTIX_ERROR_HOST_OUT_OF_MEMORY -/// Heap allocation failed. -/// - OPTIX_ERROR_INTERNAL_ERROR -/// Internal error -OPTIXAPI OptixResult optixDeviceContextCreate( CUcontext fromContext, const OptixDeviceContextOptions* options, OptixDeviceContext* context ); - -/// Destroys all CPU and GPU state associated with the device. -/// -/// It will attempt to block on CUDA streams that have launch work outstanding. -/// -/// Any API objects, such as OptixModule and OptixPipeline, not already destroyed will be -/// destroyed. -/// -/// Thread safety: A device context must not be destroyed while it is still in use by concurrent API calls in other threads. -OPTIXAPI OptixResult optixDeviceContextDestroy( OptixDeviceContext context ); - -/// Query properties of a device context. -/// -/// \param[in] context the device context to query the property for -/// \param[in] property the property to query -/// \param[out] value pointer to the returned -/// \param[in] sizeInBytes size of output -OPTIXAPI OptixResult optixDeviceContextGetProperty( OptixDeviceContext context, OptixDeviceProperty property, void* value, size_t sizeInBytes ); - -/// Sets the current log callback method. -/// -/// See #OptixLogCallback for more details. -/// -/// Thread safety: It is guaranteed that the callback itself (callbackFunction and callbackData) are updated atomically. -/// It is not guaranteed that the callback itself (callbackFunction and callbackData) and the callbackLevel are updated -/// atomically. It is unspecified when concurrent API calls using the same context start to make use of the new -/// callback method. -/// -/// \param[in] context the device context -/// \param[in] callbackFunction the callback function to call -/// \param[in] callbackData pointer to data passed to callback function while invoking it -/// \param[in] callbackLevel callback level -OPTIXAPI OptixResult optixDeviceContextSetLogCallback( OptixDeviceContext context, - OptixLogCallback callbackFunction, - void* callbackData, - unsigned int callbackLevel ); - -/// Enables or disables the disk cache. -/// -/// If caching was previously disabled, enabling it will attempt to initialize -/// the disk cache database using the currently configured cache location. An -/// error will be returned if initialization fails. -/// -/// Note that no in-memory cache is used, so no caching behavior will be observed if the disk cache -/// is disabled. -/// -/// The cache can be disabled by setting the environment variable OPTIX_CACHE_MAXSIZE=0. -/// The environment variable takes precedence over this setting. -/// See #optixDeviceContextSetCacheDatabaseSizes for additional information. -/// -/// Note that the disk cache can be disabled by the environment variable, but it cannot be enabled -/// via the environment if it is disabled via the API. -/// -/// \param[in] context the device context -/// \param[in] enabled 1 to enabled, 0 to disable -OPTIXAPI OptixResult optixDeviceContextSetCacheEnabled( OptixDeviceContext context, int enabled ); - -/// Sets the location of the disk cache. -/// -/// The location is specified by a directory. This directory should not be used for other purposes -/// and will be created if it does not exist. An error will be returned if is not possible to -/// create the disk cache at the specified location for any reason (e.g., the path is invalid or -/// the directory is not writable). Caching will be disabled if the disk cache cannot be -/// initialized in the new location. If caching is disabled, no error will be returned until caching -/// is enabled. If the disk cache is located on a network file share, behavior is undefined. -/// -/// The location of the disk cache can be overridden with the environment variable OPTIX_CACHE_PATH. -/// The environment variable takes precedence over this setting. -/// -/// The default location depends on the operating system: -/// - Windows: %LOCALAPPDATA%\\NVIDIA\\OptixCache -/// - Linux: /var/tmp/OptixCache_\ (or /tmp/OptixCache_\ if the first choice is not usable), -/// the underscore and username suffix are omitted if the username cannot be obtained -/// - MacOS X: /Library/Application Support/NVIDIA/OptixCache -/// -/// \param[in] context the device context -/// \param[in] location directory of disk cache -OPTIXAPI OptixResult optixDeviceContextSetCacheLocation( OptixDeviceContext context, const char* location ); - -/// Sets the low and high water marks for disk cache garbage collection. -/// -/// Garbage collection is triggered when a new entry is written to the cache and -/// the current cache data size plus the size of the cache entry that is about -/// to be inserted exceeds the high water mark. Garbage collection proceeds until -/// the size reaches the low water mark. Garbage collection will always free enough -/// space to insert the new entry without exceeding the low water mark. Setting -/// either limit to zero will disable garbage collection. An error will be returned -/// if both limits are non-zero and the high water mark is smaller than the low water mark. -/// -/// Note that garbage collection is performed only on writes to the disk cache. No garbage -/// collection is triggered on disk cache initialization or immediately when calling this function, -/// but on subsequent inserting of data into the database. -/// -/// If the size of a compiled module exceeds the value configured for the high water -/// mark and garbage collection is enabled, the module will not be added to the cache -/// and a warning will be added to the log. -/// -/// The high water mark can be overridden with the environment variable OPTIX_CACHE_MAXSIZE. -/// The environment variable takes precedence over the function parameters. The low water mark -/// will be set to half the value of OPTIX_CACHE_MAXSIZE. Setting OPTIX_CACHE_MAXSIZE to 0 will -/// disable the disk cache, but will not alter the contents of the cache. Negative and non-integer -/// values will be ignored. -/// -/// \param[in] context the device context -/// \param[in] lowWaterMark the low water mark -/// \param[in] highWaterMark the high water mark -OPTIXAPI OptixResult optixDeviceContextSetCacheDatabaseSizes( OptixDeviceContext context, size_t lowWaterMark, size_t highWaterMark ); - -/// Indicates whether the disk cache is enabled or disabled. -/// -/// \param[in] context the device context -/// \param[out] enabled 1 if enabled, 0 if disabled -OPTIXAPI OptixResult optixDeviceContextGetCacheEnabled( OptixDeviceContext context, int* enabled ); -/// Returns the location of the disk cache. If the cache has been disabled by setting the environment -/// variable OPTIX_CACHE_MAXSIZE=0, this function will return an empy string. -/// -/// \param[in] context the device context -/// \param[out] location directory of disk cache, null terminated if locationSize > 0 -/// \param[in] locationSize locationSize -OPTIXAPI OptixResult optixDeviceContextGetCacheLocation( OptixDeviceContext context, char* location, size_t locationSize ); - -/// Returns the low and high water marks for disk cache garbage collection. If the cache has been disabled by -/// setting the environment variable OPTIX_CACHE_MAXSIZE=0, this function will return 0 for the low and high -/// water marks. -/// -/// \param[in] context the device context -/// \param[out] lowWaterMark the low water mark -/// \param[out] highWaterMark the high water mark -OPTIXAPI OptixResult optixDeviceContextGetCacheDatabaseSizes( OptixDeviceContext context, size_t* lowWaterMark, size_t* highWaterMark ); - -///@} -/// \defgroup optix_host_api_pipelines Pipelines -/// \ingroup optix_host_api -///@{ - -/// logString is an optional buffer that contains compiler feedback and errors. This -/// information is also passed to the context logger (if enabled), however it may be -/// difficult to correlate output to the logger to specific API invocations when using -/// multiple threads. The output to logString will only contain feedback for this specific -/// invocation of this API call. -/// -/// logStringSize as input should be a pointer to the number of bytes backing logString. -/// Upon return it contains the length of the log message (including the null terminator) -/// which may be greater than the input value. In this case, the log message will be -/// truncated to fit into logString. -/// -/// If logString or logStringSize are NULL, no output is written to logString. If -/// logStringSize points to a value that is zero, no output is written. This does not -/// affect output to the context logger if enabled. -/// -/// \param[in] context -/// \param[in] pipelineCompileOptions -/// \param[in] pipelineLinkOptions -/// \param[in] programGroups array of ProgramGroup objects -/// \param[in] numProgramGroups number of ProgramGroup objects -/// \param[out] logString Information will be written to this string. If logStringSize > 0 logString will be null terminated. -/// \param[in,out] logStringSize -/// \param[out] pipeline -OPTIXAPI OptixResult optixPipelineCreate( OptixDeviceContext context, - const OptixPipelineCompileOptions* pipelineCompileOptions, - const OptixPipelineLinkOptions* pipelineLinkOptions, - const OptixProgramGroup* programGroups, - unsigned int numProgramGroups, - char* logString, - size_t* logStringSize, - OptixPipeline* pipeline ); - -/// Thread safety: A pipeline must not be destroyed while it is still in use by concurrent API calls in other threads. -OPTIXAPI OptixResult optixPipelineDestroy( OptixPipeline pipeline ); - -/// Sets the stack size for a pipeline based on the given depth parameters. -/// -/// When the pipeline is created the stack sizes for a pipeline are configured based on the depth values -/// that were given in the OptixPipelineLinkOptions. This method allows to reconfigure the pipeline -/// to new values for the maximum trace depth and the maximum callable depths which includes a recalculation -/// of the stack sizes. -/// -/// \param[in] pipeline The pipeline to set the stack size for. -/// \param[in] maxTraceDepth The maximum trace recursion depth. See #OptixPipelineLinkOptions::maxTraceDepth. -/// \param[in] maxContinuationCallableDepth The maximum depth of continuation callable call graphs. See #OptixPipelineLinkOptions::maxContinuationCallableDepth. -/// \param[in] maxDirectCallableDepthFromState The maximum depth of direct callable call graphs called from RG, CH, MS or CC. See #OptixPipelineLinkOptions::maxDirectCallableDepthFromState. -/// \param[in] maxDirectCallableDepthFromTraversal The maximum depth of direct callable call graphs called from IS or AH. See #OptixPipelineLinkOptions::maxDirectCallableDepthFromTraversal. -/// \param[in] maxTraversableGraphDepth The maximum depth of a traversable graph passed to trace. -OPTIXAPI OptixResult optixPipelineSetStackSizeFromCallDepths( OptixPipeline pipeline, - unsigned int maxTraceDepth, - unsigned int maxContinuationCallableDepth, - unsigned int maxDirectCallableDepthFromState, - unsigned int maxDirectCallableDepthFromTraversal, - unsigned int maxTraversableGraphDepth ); - -/// Sets the stack sizes for a pipeline. -/// -/// Users are encouraged to see the programming guide and the implementations of the helper functions -/// to understand how to construct the stack sizes based on their particular needs. -/// -/// If this method is not used, an internal default implementation is used. The default implementation is correct (but -/// not necessarily optimal) as long as the maximum depth of call trees of CC programs is at most 2, and no DC programs or motion transforms are used. -/// -/// The maxTraversableGraphDepth responds to the maximal number of traversables visited when calling trace. -/// Every acceleration structure and motion transform count as one level of traversal. -/// E.g., for a simple IAS (instance acceleration structure) -> GAS (geometry acceleration structure) -/// traversal graph, the maxTraversableGraphDepth is two. -/// For IAS -> MT (motion transform) -> GAS, the maxTraversableGraphDepth is three. -/// Note that it does not matter whether a IAS or GAS has motion or not, it always counts as one. -/// Launching optix with exceptions turned on (see #OPTIX_EXCEPTION_FLAG_TRACE_DEPTH) will throw an exception -/// if the specified maxTraversableGraphDepth is too small. -/// -/// \param[in] pipeline The pipeline to configure the stack size for. -/// \param[in] directCallableStackSizeFromTraversal The direct stack size requirement for direct callables invoked from IS or AH. -/// \param[in] directCallableStackSizeFromState The direct stack size requirement for direct callables invoked from RG, MS, or CH. -/// \param[in] continuationStackSize The continuation stack requirement. -/// \param[in] maxTraversableGraphDepth The maximum depth of a traversable graph passed to trace. -OPTIXAPI OptixResult optixPipelineSetStackSize( OptixPipeline pipeline, - unsigned int directCallableStackSizeFromTraversal, - unsigned int directCallableStackSizeFromState, - unsigned int continuationStackSize, - unsigned int maxTraversableGraphDepth ); - -/// Copies data from or to a global symbol in the pipeline. -/// Depending on the given kind of the copy operation, the mem parameter acts as the source or the -/// target of the operation. -/// The sizeInBytes parameter determines how many bytes are copied. -/// The offsetInBytes parameter determines the offset in bytes in the target memory. -/// -/// \param[in] pipeline The pipeline to get the symbol address from/to. -/// \param[in] name The name of the symbol to copy data from/to. -/// \param[in] mem The memory where to copy data from/to. Depending on the kind of the copy operation this is either a host or a device pointer. -/// \param[in] sizeInBytes The amount of bytes to copy. -/// \param[in] offsetInBytes The offset in the symbol's memory to copy the data from/to. -/// \param[in] kind A flag that determines the direction of the copy operation. -/// \param[in] stream The CUstream to execute the asynchronous operation in. -OPTIXAPI OptixResult optixPipelineSymbolMemcpyAsync( OptixPipeline pipeline, - const char* name, - void* mem, - size_t sizeInBytes, - size_t offsetInBytes, - OptixPipelineSymbolMemcpyKind kind, - CUstream stream ); - -///@} -/// \defgroup optix_host_api_modules Modules -/// \ingroup optix_host_api -///@{ - -/// Compiling programs into a module. These programs can be passed in as either PTX or OptiX-IR. -/// -/// See the Programming Guide for details, as well as how to generate these encodings from CUDA sources. -/// -/// logString is an optional buffer that contains compiler feedback and errors. This -/// information is also passed to the context logger (if enabled), however it may be -/// difficult to correlate output to the logger to specific API invocations when using -/// multiple threads. The output to logString will only contain feedback for this specific -/// invocation of this API call. -/// -/// logStringSize as input should be a pointer to the number of bytes backing logString. -/// Upon return it contains the length of the log message (including the null terminator) -/// which may be greater than the input value. In this case, the log message will be -/// truncated to fit into logString. -/// -/// If logString or logStringSize are NULL, no output is written to logString. If -/// logStringSize points to a value that is zero, no output is written. This does not -/// affect output to the context logger if enabled. -/// -/// \param[in] context -/// \param[in] moduleCompileOptions -/// \param[in] pipelineCompileOptions All modules in a pipeline need to use the same values for the pipeline compile options. -/// \param[in] input Pointer to the input code. -/// \param[in] inputSize Parsing proceeds up to inputSize characters. Or, when reading PTX input, the first NUL byte, whichever occurs first. -/// \param[out] logString Information will be written to this string. If logStringSize > 0 logString will be null terminated. -/// \param[in,out] logStringSize -/// \param[out] module -/// -/// \return OPTIX_ERROR_INVALID_VALUE - context is 0, moduleCompileOptions is 0, pipelineCompileOptions is 0, input is 0, module is 0. -OPTIXAPI OptixResult optixModuleCreate( OptixDeviceContext context, - const OptixModuleCompileOptions* moduleCompileOptions, - const OptixPipelineCompileOptions* pipelineCompileOptions, - const char* input, - size_t inputSize, - char* logString, - size_t* logStringSize, - OptixModule* module ); - -/// This function is designed to do just enough work to create the OptixTask return -/// parameter and is expected to be fast enough run without needing parallel execution. A -/// single thread could generate all the OptixTask objects for further processing in a -/// work pool. -/// -/// Options are similar to #optixModuleCreate(), aside from the return parameter, -/// firstTask. -/// -/// The memory used to hold the input should be live until all tasks are finished. -/// -/// It is illegal to call #optixModuleDestroy() if any OptixTask objects are currently -/// being executed. In that case OPTIX_ERROR_ILLEGAL_DURING_TASK_EXECUTE will be returned. -/// -/// If an invocation of optixTaskExecute fails, the OptixModule will be marked as -/// OPTIX_MODULE_COMPILE_STATE_IMPENDING_FAILURE if there are outstanding tasks or -/// OPTIX_MODULE_COMPILE_STATE_FAILURE if there are no outstanding tasks. Subsequent calls -/// to #optixTaskExecute() may execute additional work to collect compilation errors -/// generated from the input. Currently executing tasks will not necessarily be terminated -/// immediately but at the next opportunity. -/// -/// Logging will continue to be directed to the logger installed with the -/// OptixDeviceContext. If logString is provided to #optixModuleCreateWithTasks(), -/// it will contain all the compiler feedback from all executed tasks. The lifetime of the -/// memory pointed to by logString should extend from calling -/// #optixModuleCreateWithTasks() to when the compilation state is either -/// OPTIX_MODULE_COMPILE_STATE_FAILURE or OPTIX_MODULE_COMPILE_STATE_COMPLETED. OptiX will -/// not write to the logString outside of execution of -/// #optixModuleCreateWithTasks() or #optixTaskExecute(). If the compilation state -/// is OPTIX_MODULE_COMPILE_STATE_IMPENDING_FAILURE and no further execution of -/// #optixTaskExecute() is performed the logString may be reclaimed by the application -/// before calling #optixModuleDestroy(). The contents of logString will contain output -/// from currently completed tasks. -/// -/// All OptixTask objects associated with a given OptixModule will be cleaned up when -/// #optixModuleDestroy() is called regardless of whether the compilation was successful -/// or not. If the compilation state is OPTIX_MODULE_COMPILE_STATE_IMPENDING_FAILURE, any -/// unstarted OptixTask objects do not need to be executed though there is no harm doing -/// so. -/// -/// \see #optixModuleCreate -OPTIXAPI OptixResult optixModuleCreateWithTasks( OptixDeviceContext context, - const OptixModuleCompileOptions* moduleCompileOptions, - const OptixPipelineCompileOptions* pipelineCompileOptions, - const char* input, - size_t inputSize, - char* logString, - size_t* logStringSize, - OptixModule* module, - OptixTask* firstTask ); - -/// When creating a module with tasks, the current state of the module can be queried -/// using this function. -/// -/// Thread safety: Safe to call from any thread until optixModuleDestroy is called. -/// -/// \see #optixModuleCreateWithTasks -OPTIXAPI OptixResult optixModuleGetCompilationState( OptixModule module, OptixModuleCompileState* state ); - -/// Used to cancel task-based module creation. A canceled module will transition to -/// OPTIX_MODULE_COMPILE_STATE_IMPENDING_FAILURE if there are unfinished tasks that -/// have been returned to the user, or OPTIX_MODULE_COMPILE_STATE_FAILED if all -/// returned tasks have finished executing, at which point it should be treated as -/// any other module that has failed compilation. The user may continue executing -/// tasks of a canceled module, they will simply return OPTIX_ERROR_CREATION_CANCELED -/// without performing any compilation and without creating new tasks. -/// -/// Conditionally blocks (see #OptixCreationFlags) -/// -/// Thread safety: Safe to call from any thread -OPTIXAPI OptixResult optixModuleCancelCreation( OptixModule module, OptixCreationFlags flags ); - - -/// Used to cancel creation of all modules asssociated with an OptixDeviceContext. -/// Conditionally blocks (see #OptixCreationFlags) -/// -/// Thread safety: Safe to call from any thread -OPTIXAPI OptixResult optixDeviceContextCancelCreations( OptixDeviceContext context, OptixCreationFlags flags ); - -/// Call for OptixModule objects created with optixModuleCreate and optixModuleDeserialize. -/// -/// Modules must not be destroyed while they are still used by any program group. -/// -/// Thread safety: A module must not be destroyed while it is still in use by concurrent API calls in other threads. -OPTIXAPI OptixResult optixModuleDestroy( OptixModule module ); - -/// Returns a module containing the intersection program for the built-in primitive type specified -/// by the builtinISOptions. This module must be used as the moduleIS for the OptixProgramGroupHitgroup -/// in any SBT record for that primitive type. (The entryFunctionNameIS should be null.) -OPTIXAPI OptixResult optixBuiltinISModuleGet( OptixDeviceContext context, - const OptixModuleCompileOptions* moduleCompileOptions, - const OptixPipelineCompileOptions* pipelineCompileOptions, - const OptixBuiltinISOptions* builtinISOptions, - OptixModule* builtinModule ); - -///@} -/// \defgroup optix_host_api_tasks Tasks -/// \ingroup optix_host_api -///@{ - -/// Each OptixTask should be executed with #optixTaskExecute(). If additional parallel -/// work is found, new OptixTask objects will be returned in additionalTasks along with -/// the number of additional tasks in numAdditionalTasksCreated. The parameter -/// additionalTasks should point to a user allocated array of minimum size -/// maxNumAdditionalTasks. OptiX can generate upto maxNumAdditionalTasks additional tasks. -/// -/// Each task can be executed in parallel and in any order. -/// -/// Thread safety: Safe to call from any thread until #optixModuleDestroy() is called for -/// any associated task. -/// -/// \see #optixModuleCreateWithTasks -/// -/// \param[in] task the OptixTask to execute -/// \param[in] additionalTasks pointer to array of OptixTask objects to be filled in -/// \param[in] maxNumAdditionalTasks maximum number of additional OptixTask objects -/// \param[out] numAdditionalTasksCreated number of OptixTask objects created by OptiX and written into additionalTasks -OPTIXAPI OptixResult optixTaskExecute( OptixTask task, - OptixTask* additionalTasks, - unsigned int maxNumAdditionalTasks, - unsigned int* numAdditionalTasksCreated ); - -/// Retrieve the task's serialization key and its size. -/// It is expected to call this function twice. Once to get the size and once to retrieve the key after space for it has been allocated. -/// If the size of the key will be zero, the task will not be serializable and the task should be executed through #optixTaskExecute(). -/// -/// \param[in] task the OptixTask which key to retrieve -/// \param[out] key characters representing the key without string-terminating '\0'. If nullptr, no output will be written -/// \param[out] size size of the key. Will be 0 for non-serializable tasks. -/// \return success -OPTIXAPI OptixResult optixTaskGetSerializationKey( OptixTask task, void* key, size_t* size ); - -/// Retrieve the serialized data of the task's output. -/// It is expected to call this function twice. Once to get the size and once to retrieve the data after space for it has been allocated. -/// Calling #optixTaskSerializeOutput() before calling #optixTaskExecute() will return an error. Calling #optixTaskSerializeOutput() -/// after calling #optixTaskDeserializeOutput() will return an error. -/// -/// \param[in] task the OptixTask which output data to retrieve -/// \param[out] data allocated space big enough to hold the output. If nullptr, no output will be written -/// \param[out] size size of the data. Will be 0 for non-serializable tasks. -OPTIXAPI OptixResult optixTaskSerializeOutput( OptixTask task, void* data, size_t* size ); - -/// Given the serialized task output, deserialize it and return potential new dependent tasks similar to #optixTaskExecute(). -/// Calling #optixTaskDeserializeOutput() on a completed (either executed or deserialized) task will return an error. -/// -/// \param[in] task the OptixTask which to be deserialized -/// \param[in] data the deserialized task's output -/// \param[in] size the size of the deserialized task's output -/// \param[in] additionalTasks pointer to array of OptixTask objects to be filled in -/// \param[in] maxNumAdditionalTasks maximum number of additional OptixTask objects -/// \param[out] numAdditionalTasksCreated number of OptixTask objects created by OptiX and written into additionalTasks -OPTIXAPI OptixResult optixTaskDeserializeOutput( OptixTask task, - const void* data, - size_t size, - OptixTask* additionalTasks, - unsigned int maxNumAdditionalTasks, - unsigned int* numAdditionalTasksCreated ); - -///@} -/// \defgroup optix_host_api_program_groups Program groups -/// \ingroup optix_host_api -///@{ - -/// Returns the stack sizes for the given program group. When programs in this \p programGroup are relying on external functions, -/// the corresponding stack sizes can only be correctly retrieved when all functions are known after linking, i.e. when a pipeline -/// has been created. When \p pipeline is set to NULL, the stack size will be calculated excluding external functions. In this case -/// a warning will be issued if external functions are referenced by the OptixModule. -/// -/// \param[in] programGroup the program group -/// \param[out] stackSizes the corresponding stack sizes -/// \param[in] pipeline considering the program group within the given pipeline, can be NULL -OPTIXAPI OptixResult optixProgramGroupGetStackSize( OptixProgramGroup programGroup, OptixStackSizes* stackSizes, OptixPipeline pipeline ); - -/// logString is an optional buffer that contains compiler feedback and errors. This -/// information is also passed to the context logger (if enabled), however it may be -/// difficult to correlate output to the logger to specific API invocations when using -/// multiple threads. The output to logString will only contain feedback for this specific -/// invocation of this API call. -/// -/// logStringSize as input should be a pointer to the number of bytes backing logString. -/// Upon return it contains the length of the log message (including the null terminator) -/// which may be greater than the input value. In this case, the log message will be -/// truncated to fit into logString. -/// -/// If logString or logStringSize are NULL, no output is written to logString. If -/// logStringSize points to a value that is zero, no output is written. This does not -/// affect output to the context logger if enabled. -/// -/// Creates numProgramGroups OptiXProgramGroup objects from the specified -/// OptixProgramGroupDesc array. The size of the arrays must match. -/// -/// \param[in] context -/// \param[in] programDescriptions N * OptixProgramGroupDesc -/// \param[in] numProgramGroups N -/// \param[in] options -/// \param[out] logString Information will be written to this string. If logStringSize > 0 logString will be null terminated. -/// \param[in,out] logStringSize -/// \param[out] programGroups -OPTIXAPI OptixResult optixProgramGroupCreate( OptixDeviceContext context, - const OptixProgramGroupDesc* programDescriptions, - unsigned int numProgramGroups, - const OptixProgramGroupOptions* options, - char* logString, - size_t* logStringSize, - OptixProgramGroup* programGroups ); - -/// Thread safety: A program group must not be destroyed while it is still in use by concurrent API calls in other threads. -OPTIXAPI OptixResult optixProgramGroupDestroy( OptixProgramGroup programGroup ); - -/// \param[in] programGroup the program group containing the program(s) -/// \param[out] sbtRecordHeaderHostPointer the result sbt record header -OPTIXAPI OptixResult optixSbtRecordPackHeader( OptixProgramGroup programGroup, void* sbtRecordHeaderHostPointer ); - -///@} -/// \defgroup optix_host_api_launches Launches -/// \ingroup optix_host_api -///@{ - -/// Where the magic happens. -/// -/// The stream and pipeline must belong to the same device context. Multiple launches -/// may be issues in parallel from multiple threads to different streams. -/// -/// pipelineParamsSize number of bytes are copied from the device memory pointed to by -/// pipelineParams before launch. It is an error if pipelineParamsSize is greater than the -/// size of the variable declared in modules and identified by -/// OptixPipelineCompileOptions::pipelineLaunchParamsVariableName. If the launch params -/// variable was optimized out or not found in the modules linked to the pipeline then -/// the pipelineParams and pipelineParamsSize parameters are ignored. -/// -/// sbt points to the shader binding table, which defines shader -/// groupings and their resources. See the SBT spec. -/// -/// \param[in] pipeline -/// \param[in] stream -/// \param[in] pipelineParams -/// \param[in] pipelineParamsSize -/// \param[in] sbt -/// \param[in] width number of elements to compute -/// \param[in] height number of elements to compute -/// \param[in] depth number of elements to compute -/// -/// Thread safety: In the current implementation concurrent launches to the same pipeline are not -/// supported. Concurrent launches require separate OptixPipeline objects. -OPTIXAPI OptixResult optixLaunch( OptixPipeline pipeline, - CUstream stream, - CUdeviceptr pipelineParams, - size_t pipelineParamsSize, - const OptixShaderBindingTable* sbt, - unsigned int width, - unsigned int height, - unsigned int depth ); - -///@} -/// \defgroup optix_host_api_acceleration_structures Acceleration structures -/// \ingroup optix_host_api -///@{ - -/// \param[in] context -/// \param[in] accelOptions options for the accel build -/// \param[in] buildInputs an array of OptixBuildInput objects -/// \param[in] numBuildInputs number of elements in buildInputs (must be at least 1) -/// \param[out] bufferSizes fills in buffer sizes -OPTIXAPI OptixResult optixAccelComputeMemoryUsage( OptixDeviceContext context, - const OptixAccelBuildOptions* accelOptions, - const OptixBuildInput* buildInputs, - unsigned int numBuildInputs, - OptixAccelBufferSizes* bufferSizes ); - -/// \param[in] context -/// \param[in] stream -/// \param[in] accelOptions accel options -/// \param[in] buildInputs an array of OptixBuildInput objects -/// \param[in] numBuildInputs must be >= 1 for GAS, and == 1 for IAS -/// \param[in] tempBuffer must be a multiple of OPTIX_ACCEL_BUFFER_BYTE_ALIGNMENT -/// \param[in] tempBufferSizeInBytes -/// \param[in] outputBuffer must be a multiple of OPTIX_ACCEL_BUFFER_BYTE_ALIGNMENT -/// \param[in] outputBufferSizeInBytes -/// \param[out] outputHandle -/// \param[in] emittedProperties types of requested properties and output buffers -/// \param[in] numEmittedProperties number of post-build properties to populate (may be zero) -OPTIXAPI OptixResult optixAccelBuild( OptixDeviceContext context, - CUstream stream, - const OptixAccelBuildOptions* accelOptions, - const OptixBuildInput* buildInputs, - unsigned int numBuildInputs, - CUdeviceptr tempBuffer, - size_t tempBufferSizeInBytes, - CUdeviceptr outputBuffer, - size_t outputBufferSizeInBytes, - OptixTraversableHandle* outputHandle, - const OptixAccelEmitDesc* emittedProperties, - unsigned int numEmittedProperties ); - -/// Obtain relocation information, stored in OptixRelocationInfo, for a given context -/// and acceleration structure's traversable handle. -/// -/// The relocation information can be passed to optixCheckRelocationCompatibility to -/// determine if an acceleration structure, referenced by 'handle', can be relocated to a -/// different device's memory space (see #optixCheckRelocationCompatibility). -/// -/// When used with optixAccelRelocate, it provides data necessary for doing the relocation. -/// -/// If the acceleration structure data associated with 'handle' is copied multiple times, -/// the same OptixRelocationInfo can also be used on all copies. -/// -/// \param[in] context -/// \param[in] handle -/// \param[out] info -/// \return OPTIX_ERROR_INVALID_VALUE will be returned for traversable handles that are not from -/// acceleration structure builds. -OPTIXAPI OptixResult optixAccelGetRelocationInfo( OptixDeviceContext context, OptixTraversableHandle handle, OptixRelocationInfo* info ); - -/// Checks if an optix data structure built using another OptixDeviceContext (that was -/// used to fill in 'info') is compatible with the OptixDeviceContext specified in the -/// 'context' parameter. -/// -/// Any device is always compatible with itself. -/// -/// \param[in] context -/// \param[in] info -/// \param[out] compatible If OPTIX_SUCCESS is returned 'compatible' will have the value of either: -/// - 0: This context is not compatible with the optix data structure associated with 'info'. -/// - 1: This context is compatible. -OPTIXAPI OptixResult optixCheckRelocationCompatibility( OptixDeviceContext context, const OptixRelocationInfo* info, int* compatible ); - -/// optixAccelRelocate is called to update the acceleration structure after it has been -/// relocated. Relocation is necessary when the acceleration structure's location in device -/// memory has changed. optixAccelRelocate does not copy the memory. This function only -/// operates on the relocated memory whose new location is specified by 'targetAccel'. -/// optixAccelRelocate also returns the new OptixTraversableHandle associated with -/// 'targetAccel'. The original memory (source) is not required to be valid, only the -/// OptixRelocationInfo. -/// -/// Before calling optixAccelRelocate, optixCheckRelocationCompatibility should be -/// called to ensure the copy will be compatible with the destination device context. -/// -/// The memory pointed to by 'targetAccel' should be allocated with the same size as the -/// source acceleration. Similar to the 'outputBuffer' used in optixAccelBuild, this -/// pointer must be a multiple of OPTIX_ACCEL_BUFFER_BYTE_ALIGNMENT. -/// -/// The memory in 'targetAccel' must be allocated as long as the accel is in use. -/// -/// The instance traversables referenced by an IAS and the -/// micromaps referenced by a triangle GAS may themselves require relocation. -/// 'relocateInputs' and 'numRelocateInputs' should be used to specify the relocated -/// traversables and micromaps. After relocation, the relocated accel will reference -/// these relocated traversables and micromaps instead of their sources. -/// The number of relocate inputs 'numRelocateInputs' must match the number of build -/// inputs 'numBuildInputs' used to build the source accel. Relocation inputs -/// correspond with build inputs used to build the source accel and should appear in -/// the same order (see #optixAccelBuild). -/// 'relocateInputs' and 'numRelocateInputs' may be zero, preserving any references -/// to traversables and micromaps from the source accel. -/// -/// \param[in] context -/// \param[in] stream -/// \param[in] info -/// \param[in] relocateInputs -/// \param[in] numRelocateInputs -/// \param[in] targetAccel -/// \param[in] targetAccelSizeInBytes -/// \param[out] targetHandle -OPTIXAPI OptixResult optixAccelRelocate( OptixDeviceContext context, - CUstream stream, - const OptixRelocationInfo* info, - const OptixRelocateInput* relocateInputs, - size_t numRelocateInputs, - CUdeviceptr targetAccel, - size_t targetAccelSizeInBytes, - OptixTraversableHandle* targetHandle ); - -/// After building an acceleration structure, it can be copied in a compacted form to reduce -/// memory. In order to be compacted, OPTIX_BUILD_FLAG_ALLOW_COMPACTION must be supplied in -/// OptixAccelBuildOptions::buildFlags passed to optixAccelBuild. -/// -/// 'outputBuffer' is the pointer to where the compacted acceleration structure will be -/// written. This pointer must be a multiple of OPTIX_ACCEL_BUFFER_BYTE_ALIGNMENT. -/// -/// The size of the memory specified in 'outputBufferSizeInBytes' should be at least the -/// value computed using the OPTIX_PROPERTY_TYPE_COMPACTED_SIZE that was reported during -/// optixAccelBuild. -/// -/// \param[in] context -/// \param[in] stream -/// \param[in] inputHandle -/// \param[in] outputBuffer -/// \param[in] outputBufferSizeInBytes -/// \param[out] outputHandle -OPTIXAPI OptixResult optixAccelCompact( OptixDeviceContext context, - CUstream stream, - OptixTraversableHandle inputHandle, - CUdeviceptr outputBuffer, - size_t outputBufferSizeInBytes, - OptixTraversableHandle* outputHandle ); - -/// Emit a single property after an acceleration structure was built. -/// The result buffer of the ' emittedProperty' needs to be large enough to hold the -/// requested property (\see #OptixAccelPropertyType). -/// -/// \param[in] context -/// \param[in] stream -/// \param[in] handle -/// \param[in] emittedProperty type of requested property and output buffer -OPTIXAPI OptixResult optixAccelEmitProperty( OptixDeviceContext context, - CUstream stream, - OptixTraversableHandle handle, - const OptixAccelEmitDesc* emittedProperty ); - -/// \param[in] onDevice -/// \param[in] pointer pointer to traversable allocated in OptixDeviceContext. This pointer must be a multiple of OPTIX_TRANSFORM_BYTE_ALIGNMENT -/// \param[in] traversableType Type of OptixTraversableHandle to create -/// \param[out] traversableHandle traversable handle. traversableHandle must be in host memory -OPTIXAPI OptixResult optixConvertPointerToTraversableHandle( OptixDeviceContext onDevice, - CUdeviceptr pointer, - OptixTraversableType traversableType, - OptixTraversableHandle* traversableHandle ); - - -/// Determine the amount of memory necessary for a Opacity Micromap Array build. -/// -/// \param[in] context -/// \param[in] buildInput -/// \param[out] bufferSizes -OPTIXAPI OptixResult optixOpacityMicromapArrayComputeMemoryUsage( OptixDeviceContext context, - const OptixOpacityMicromapArrayBuildInput* buildInput, - OptixMicromapBufferSizes* bufferSizes ); - -/// Construct an array of Opacity Micromaps. -/// -/// Each triangle within an instance/GAS may reference one opacity micromap to give finer -/// control over alpha behavior. A opacity micromap consists of a set of 4^N micro-triangles -/// in a triangular uniform barycentric grid. Multiple opacity micromaps are collected (built) -/// into a opacity micromap array with this function. Each geometry in a GAS may bind a -/// single opacity micromap array and can use opacity micromaps from that array only. -/// -/// Each micro-triangle within a opacity micromap can be in one of four states: Transparent, -/// Opaque, Unknown-Transparent or Unknown-Opaque. During traversal, if a triangle with a -/// opacity micromap attached is intersected, the opacity micromap is queried to categorize -/// the hit as either opaque, unknown (alpha) or a miss. Geometry, ray or instance flags that -/// modify the alpha/opaque behavior are applied _after_ this opacity micromap query. -/// -/// The opacity micromap query may operate in 2-state mode (alpha testing) or 4-state mode (AHS culling), -/// depending on the opacity micromap type and ray/instance flags. When operating in 2-state -/// mode, alpha hits will not be reported, and transparent and opaque hits must be accurate. -/// -/// \param[in] context -/// \param[in] stream -/// \param[in] buildInput a single build input object referencing many opacity micromaps -/// \param[in] buffers the buffers used for build -OPTIXAPI OptixResult optixOpacityMicromapArrayBuild( OptixDeviceContext context, - CUstream stream, - const OptixOpacityMicromapArrayBuildInput* buildInput, - const OptixMicromapBuffers* buffers ); - -/// Obtain relocation information, stored in OptixRelocationInfo, for a given context -/// and opacity micromap array. -/// -/// The relocation information can be passed to optixCheckRelocationCompatibility to -/// determine if a opacity micromap array, referenced by buffers, can be relocated to a -/// different device's memory space (see #optixCheckRelocationCompatibility). -/// -/// When used with optixOpacityMicromapArrayRelocate, it provides data necessary for doing the relocation. -/// -/// If the opacity micromap array data associated with 'opacityMicromapArray' is copied multiple times, -/// the same OptixRelocationInfo can also be used on all copies. -/// -/// \param[in] context -/// \param[in] opacityMicromapArray -/// \param[out] info -OPTIXAPI OptixResult optixOpacityMicromapArrayGetRelocationInfo( OptixDeviceContext context, - CUdeviceptr opacityMicromapArray, - OptixRelocationInfo* info ); - -/// optixOpacityMicromapArrayRelocate is called to update the opacity micromap array after it has been -/// relocated. Relocation is necessary when the opacity micromap array's location in device -/// memory has changed. optixOpacityMicromapArrayRelocate does not copy the memory. This function only -/// operates on the relocated memory whose new location is specified by 'targetOpacityMicromapArray'. -/// The original memory (source) is not required to be valid, only the -/// OptixRelocationInfo. -/// -/// Before calling optixOpacityMicromapArrayRelocate, optixCheckRelocationCompatibility should be called -/// to ensure the copy will be compatible with the destination device context. -/// -/// The memory pointed to by 'targetOpacityMicromapArray' should be allocated with the same size as the -/// source opacity micromap array. Similar to the 'OptixMicromapBuffers::output' used in optixOpacityMicromapArrayBuild, -/// this pointer must be a multiple of OPTIX_OPACITY_MICROMAP_ARRAY_BUFFER_BYTE_ALIGNMENT. -/// -/// The memory in 'targetOpacityMicromapArray' must be allocated as long as the opacity micromap array is in use. -/// -/// Note that any Acceleration Structures build using the original memory (source) as input will -/// still be associated with this original memory. To associate an existing (possibly relocated) -/// Acceleration Structures with the relocated opacity micromap array, use optixAccelBuild -/// to update the existing Acceleration Structures (See OPTIX_BUILD_OPERATION_UPDATE) -/// -/// \param[in] context -/// \param[in] stream -/// \param[in] info -/// \param[in] targetOpacityMicromapArray -/// \param[in] targetOpacityMicromapArraySizeInBytes -OPTIXAPI OptixResult optixOpacityMicromapArrayRelocate( OptixDeviceContext context, - CUstream stream, - const OptixRelocationInfo* info, - CUdeviceptr targetOpacityMicromapArray, - size_t targetOpacityMicromapArraySizeInBytes ); - - -/// Host side conservative memory computation for a subsequent optixClusterAccelBuild call with the same build mode and input. -/// For implicit builds, the output buffer size contains the required size for holding all build outputs as specified in buildInput->maxArgsCount. -/// For explicit builds, the output buffer size contains the required size for holding a single build output. -/// The temp buffer of any optixClusterAccelBuild call must be at least as big as reported by optixClusterAccelComputeMemoryUsage. -/// optixClusterAccelComputeMemoryUsage always returns 0 for OptixAccelBufferSizes::tempUpdateSizeInBytes. -/// -/// \param[in] context -/// \param[in] buildMode Select the kind of output target (implicit: single buffer, explicit: per-build buffers, getSize: compact size computation for future explicit builds) -/// \param[in] buildInput A single input, describes the type of object to build and limits over all objects' arguments -/// \param[out] bufferSizes -OPTIXAPI OptixResult optixClusterAccelComputeMemoryUsage( OptixDeviceContext context, - OptixClusterAccelBuildMode buildMode, - const OptixClusterAccelBuildInput* buildInput, - OptixAccelBufferSizes* bufferSizes ); - -/// Entry point to building one type of cluster objects: a CLAS, a Cluster template, or a GAS-over-CLAS. -/// This is an indirect build function: all build arguments are read from device memory, with only the output location, type of build and limits passed on the host. -/// This is a multi build function: more than one object can be built at once, but only of one type. The supplied limits must bound the inputs (Args) of all builds. -/// Output buffer size constraints for implicit and explicit builds: -/// implicit: The output and temp buffer must be at least as big as reported by a corresponding optixClusterAccelComputeMemoryUsage call. -/// explicit: The output buffers must be at least as big as reported by a corresponding optixClusterAccelBuild call with the getSize mode and all device data supplied. -/// The temp buffer must be at least as big as reported by a corresponding optixClusterAccelComputeMemoryUsage call. -/// getSize: No output buffer is used. The temp buffer must be at least as big as reported by a corresponding optixClusterAccelComputeMemoryUsage call. -/// Consequently, calling optixClusterAccelBuild with the getSize mode and subsequently building with the explicit mode is more memory efficient, but slower compared to -/// building with the implicit mode. -/// -/// \param[in] context -/// \param[in] stream -/// \param[in] buildModeDesc A single input, describes where to write data for the selected build mode -/// \param[in] buildInput A single input, describes the type of object to build and limits over all objects' arguments -/// \param[in] argsArray Pointer to arguments array in device memory, describes each object to build: -/// OptixClusterAccelBuildInputTrianglesArgs when using OPTIX_CLUSTER_ACCEL_BUILD_TYPE_CLUSTERS_FROM_TRIANGLES -/// OptixClusterAccelBuildInputTrianglesArgs when using OPTIX_CLUSTER_ACCEL_BUILD_TYPE_TEMPLATES_FROM_TRIANGLES -/// OptixClusterAccelBuildInputGridsArgs when using OPTIX_CLUSTER_ACCEL_BUILD_TYPE_TEMPLATES_FROM_GRIDS -/// OptixClusterAccelBuildInputTemplatesArgs when using OPTIX_CLUSTER_ACCEL_BUILD_TYPE_CLUSTERS_FROM_TEMPLATES -/// OptixClusterAccelBuildInputClustersArgs when using OPTIX_CLUSTER_ACCEL_BUILD_TYPE_GASES_FROM_CLUSTERS -/// \param[in] argsCount Optional pointer to device memory, storing the number of objects to build, if null is provided, uses maxArgCount from buildInput -/// \param[in] argsStrideInBytes Optional stride of args objects, if null is provided, uses natural stride of Args type -OPTIXAPI OptixResult optixClusterAccelBuild( OptixDeviceContext context, - CUstream stream, - const OptixClusterAccelBuildModeDesc* buildModeDesc, - const OptixClusterAccelBuildInput* buildInput, - CUdeviceptr argsArray, - CUdeviceptr argsCount, - unsigned int argsStrideInBytes ); - - -///@} -/// \defgroup optix_host_api_coop_vec Cooperative Vector -/// \ingroup optix_host_api -///@{ - -/// Convert matrices from one layout and or element type to another. -/// -/// One use case is to convert a matrix in OPTIX_COOP_VEC_MATRIX_LAYOUT_ROW_MAJOR or -/// OPTIX_COOP_VEC_MATRIX_LAYOUT_COLUMN_MAJOR into OPTIX_COOP_VEC_MATRIX_LAYOUT_INFERENCING_OPTIMAL. -/// -/// The alignment base address + offset of each matrix needs to be a minimum of 64 -/// bytes. This is similar to the requirements of #optixCoopVecMatMul. -/// -/// Type conversion is possible, but is limited. If the input elementType and output -/// elementType are not equal, then one must be OPTIX_COOP_VEC_ELEM_TYPE_FLOAT32 or -/// OPTIX_COOP_VEC_ELEM_TYPE_FLOAT16 and the other must be a lower-precision -/// floating-point type. If the output elementType is OPTIX_COOP_VEC_ELEM_TYPE_FLOAT8_E4M3 -/// or OPTIX_COOP_VEC_ELEM_TYPE_FLOAT8_E5M2, then the output layout must be -/// OPTIX_COOP_VEC_MATRIX_LAYOUT_INFERENCING_OPTIMAL or -/// OPTIX_COOP_VEC_MATRIX_LAYOUT_TRAINING_OPTIMAL. -/// - - - -/// \param[in] context -/// \param[in] stream -/// \param[in] numNetworks number of networks to convert -/// \param[in] inputNetworkDescription description of the input network matrix topology (one per invocation) -/// \param[in] inputNetworks base pointer to array of matrices that match the input topology specified in network -/// \param[in] inputNetworkStrideInBytes number of bytes between input networks, ignored if numNetworks is one -/// \param[in] outputNetworkDescription description of the output network matrix topology (one per invocation) -/// \param[in] outputNetworks base pointer to array of matrices that match the output topology specified in network -/// \param[in] outputNetworkStrideInBytes number of bytes between output networks, ignored if numNetworks is one -OPTIXAPI OptixResult optixCoopVecMatrixConvert( OptixDeviceContext context, - CUstream stream, - unsigned int numNetworks, - const OptixNetworkDescription* inputNetworkDescription, - CUdeviceptr inputNetworks, - size_t inputNetworkStrideInBytes, - const OptixNetworkDescription* outputNetworkDescription, - CUdeviceptr outputNetworks, - size_t outputNetworkStrideInBytes ); - - - -/// For row and column ordered matrix layouts, when \a rowColumnStrideInBytes is 0, the -/// stride will assume tight packing. -/// -/// Results will be rounded to the next multiple of 64 to make it easy to pack the -/// matrices in memory and have the correct alignment. -/// -/// \param[in] context -/// \param[in] elementType -/// \param[in] N -/// \param[in] K -/// \param[in] layout -/// \param[in] rowColumnStrideInBytes Ignored for optimal layouts -/// \param[out] sizeInBytes Output size of the matrix in bytes -OPTIXAPI OptixResult optixCoopVecMatrixComputeSize( OptixDeviceContext context, - unsigned int N, - unsigned int K, - OptixCoopVecElemType elementType, - OptixCoopVecMatrixLayout layout, - size_t rowColumnStrideInBytes, - size_t* sizeInBytes ); - - -///@} -/// \defgroup optix_host_api_denoiser Denoiser -/// \ingroup optix_host_api -///@{ - -/// Creates a denoiser object with the given options, using built-in inference models -/// -/// 'modelKind' selects the model used for inference. -/// Inference for the built-in models can be guided (giving hints to improve image quality) with -/// albedo and normal vector images in the guide layer (see 'optixDenoiserInvoke'). -/// Use of these images must be enabled in 'OptixDenoiserOptions'. -/// -/// \param[in] context -/// \param[in] modelKind -/// \param[in] options -/// \param[out] denoiser -OPTIXAPI OptixResult optixDenoiserCreate( OptixDeviceContext context, - OptixDenoiserModelKind modelKind, - const OptixDenoiserOptions* options, - OptixDenoiser* denoiser ); - -/// Creates a denoiser object with the given options, using a provided inference model -/// -/// 'userData' and 'userDataSizeInBytes' provide a user model for inference. -/// The memory passed in userData will be accessed only during the invocation of this function and -/// can be freed after it returns. -/// The user model must export only one weight set which determines both the model kind and the -/// required set of guide images. -/// -/// \param[in] context -/// \param[in] userData -/// \param[in] userDataSizeInBytes -/// \param[out] denoiser -OPTIXAPI OptixResult optixDenoiserCreateWithUserModel( OptixDeviceContext context, - const void* userData, - size_t userDataSizeInBytes, - OptixDenoiser* denoiser ); - -/// Destroys the denoiser object and any associated host resources. -OPTIXAPI OptixResult optixDenoiserDestroy( OptixDenoiser denoiser ); - -/// Computes the GPU memory resources required to execute the denoiser. -/// -/// Memory for state and scratch buffers must be allocated with the sizes in 'returnSizes' and scratch memory -/// passed to optixDenoiserSetup, optixDenoiserInvoke, -/// optixDenoiserComputeIntensity and optixDenoiserComputeAverageColor. -/// For tiled denoising an overlap area ('overlapWindowSizeInPixels') must be added to each tile on all sides -/// which increases the amount of -/// memory needed to denoise a tile. In case of tiling use withOverlapScratchSizeInBytes for scratch memory size. -/// If only full resolution images are denoised, withoutOverlapScratchSizeInBytes can be used which is always -/// smaller than withOverlapScratchSizeInBytes. -/// -/// 'outputWidth' and 'outputHeight' is the dimension of the image to be denoised (without overlap in case tiling -/// is being used). -/// 'outputWidth' and 'outputHeight' must be greater than or equal to the dimensions passed to optixDenoiserSetup. -/// -/// \param[in] denoiser -/// \param[in] outputWidth -/// \param[in] outputHeight -/// \param[out] returnSizes -OPTIXAPI OptixResult optixDenoiserComputeMemoryResources( const OptixDenoiser denoiser, - unsigned int outputWidth, - unsigned int outputHeight, - OptixDenoiserSizes* returnSizes ); - -/// Initializes the state required by the denoiser. -/// -/// 'inputWidth' and 'inputHeight' must include overlap on both sides of the image if tiling is being used. The overlap is -/// returned by #optixDenoiserComputeMemoryResources. -/// For subsequent calls to #optixDenoiserInvoke 'inputWidth' and 'inputHeight' are the maximum dimensions -/// of the input layers. Dimensions of the input layers passed to #optixDenoiserInvoke may be different in each -/// invocation however they always must be smaller than 'inputWidth' and 'inputHeight' passed to #optixDenoiserSetup. -/// -/// \param[in] denoiser -/// \param[in] stream -/// \param[in] inputWidth -/// \param[in] inputHeight -/// \param[in] denoiserState -/// \param[in] denoiserStateSizeInBytes -/// \param[in] scratch -/// \param[in] scratchSizeInBytes -OPTIXAPI OptixResult optixDenoiserSetup( OptixDenoiser denoiser, - CUstream stream, - unsigned int inputWidth, - unsigned int inputHeight, - CUdeviceptr denoiserState, - size_t denoiserStateSizeInBytes, - CUdeviceptr scratch, - size_t scratchSizeInBytes ); - -/// Invokes denoiser on a set of input data and produces at least one output image. -/// State memory must be available during the execution of the -/// denoiser (or until optixDenoiserSetup is called with a new state memory pointer). -/// Scratch memory passed is used only for the duration of this function. -/// Scratch and state memory sizes must have a size greater than or equal to the sizes as returned by -/// optixDenoiserComputeMemoryResources. -/// -/// 'inputOffsetX' and 'inputOffsetY' are pixel offsets in the 'inputLayers' image -/// specifying the beginning of the image without overlap. When denoising an entire image without tiling -/// there is no overlap and 'inputOffsetX' and 'inputOffsetY' must be zero. When denoising a tile which is -/// adjacent to one of the four sides of the entire image the corresponding offsets must also be zero since -/// there is no overlap at the side adjacent to the image border. -/// -/// 'guideLayer' provides additional information to the denoiser. When providing albedo and normal vector -/// guide images, the corresponding fields in the 'OptixDenoiserOptions' must be -/// enabled, see #optixDenoiserCreate. -/// 'guideLayer' must not be null. If a guide image in 'OptixDenoiserOptions' is not enabled, the -/// corresponding image in 'OptixDenoiserGuideLayer' is ignored. -/// -/// If OPTIX_DENOISER_MODEL_KIND_TEMPORAL or OPTIX_DENOISER_MODEL_KIND_TEMPORAL_AOV is selected, a 2d flow -/// image must be given in 'OptixDenoiserGuideLayer'. -/// It describes for each pixel the flow from the previous to the current frame (a 2d vector in pixel space). -/// The denoised beauty/AOV of the previous frame must be given in 'previousOutput'. -/// If this image is not available in the first frame of a sequence, the noisy beauty/AOV from the first frame -/// and zero flow vectors could be given as a substitute. -/// For non-temporal model kinds the flow image in 'OptixDenoiserGuideLayer' is ignored. -/// 'previousOutput' and -/// 'output' may refer to the same buffer if tiling is not used, i.e. 'previousOutput' is first read by this function and later -/// overwritten with the denoised result. 'output' can be passed as 'previousOutput' to the next frame. -/// In other model kinds (not temporal) 'previousOutput' is ignored. -/// -/// The beauty layer must be given as the first entry in 'layers'. -/// In AOV type model kinds (OPTIX_DENOISER_MODEL_KIND_AOV or in user defined models implementing -/// kernel-prediction) additional layers for the AOV images can be given. -/// In each layer the noisy input image is given in 'input', the denoised output is written into the -/// 'output' image. input and output images may refer to the same buffer, with the restriction that -/// the pixel formats must be identical for input and output when the blend mode is selected (see -/// #OptixDenoiserParams). -/// -/// If OPTIX_DENOISER_MODEL_KIND_TEMPORAL or OPTIX_DENOISER_MODEL_KIND_TEMPORAL_AOV is selected, the denoised -/// image from the previous frame must be given in 'previousOutput' in the layer. 'previousOutput' and -/// 'output' may refer to the same buffer if tiling is not used, i.e. 'previousOutput' is first read by this function and later -/// overwritten with the denoised result. 'output' can be passed as 'previousOutput' to the next frame. -/// In addition, 'previousOutputInternalGuideLayer' and 'outputInternalGuideLayer' must both be allocated regardless -/// of tiling mode. The pixel format must be OPTIX_PIXEL_FORMAT_INTERNAL_GUIDE_LAYER and the dimension must be identical to -/// to the other input layers. In the first frame memory in 'previousOutputInternalGuideLayer' must either contain valid -/// data from previous denoiser runs or set to zero. -/// In other model kinds (not temporal) 'previousOutput' and the internal guide layers are ignored. -/// -/// If OPTIX_DENOISER_MODEL_KIND_TEMPORAL or OPTIX_DENOISER_MODEL_KIND_TEMPORAL_AOV is selected, the -/// normal vector guide image must be given as 3d vectors in camera space. In the other models only -/// the x and y channels are used and other channels are ignored. -/// -/// \param[in] denoiser -/// \param[in] stream -/// \param[in] params -/// \param[in] denoiserState -/// \param[in] denoiserStateSizeInBytes -/// \param[in] guideLayer -/// \param[in] layers -/// \param[in] numLayers -/// \param[in] inputOffsetX -/// \param[in] inputOffsetY -/// \param[in] scratch -/// \param[in] scratchSizeInBytes -OPTIXAPI OptixResult optixDenoiserInvoke( OptixDenoiser denoiser, - CUstream stream, - const OptixDenoiserParams* params, - CUdeviceptr denoiserState, - size_t denoiserStateSizeInBytes, - const OptixDenoiserGuideLayer* guideLayer, - const OptixDenoiserLayer* layers, - unsigned int numLayers, - unsigned int inputOffsetX, - unsigned int inputOffsetY, - CUdeviceptr scratch, - size_t scratchSizeInBytes ); - -/// Computes the logarithmic average intensity of the given image. The returned value 'outputIntensity' -/// is multiplied with the RGB values of the input image/tile in optixDenoiserInvoke if given in the parameter -/// OptixDenoiserParams::hdrIntensity (otherwise 'hdrIntensity' must be a null pointer). This is useful for -/// denoising HDR images which are very dark or bright. -/// When denoising tiles the intensity of the entire image should be computed, i.e. not per tile to get -/// consistent results. -/// -/// For each RGB pixel in the inputImage the intensity is calculated and summed if it is greater than 1e-8f: -/// intensity = log(r * 0.212586f + g * 0.715170f + b * 0.072200f). -/// The function returns 0.18 / exp(sum of intensities / number of summed pixels). -/// More details could be found in the Reinhard tonemapping paper: -/// http://www.cmap.polytechnique.fr/~peyre/cours/x2005signal/hdr_photographic.pdf -/// -/// The size of scratch memory required can be queried with #optixDenoiserComputeMemoryResources. -/// -/// data type unsigned char is not supported for 'inputImage', it must be 3 or 4 component half/float. -/// -/// \param[in] denoiser -/// \param[in] stream -/// \param[in] inputImage -/// \param[out] outputIntensity single float -/// \param[in] scratch -/// \param[in] scratchSizeInBytes -OPTIXAPI OptixResult optixDenoiserComputeIntensity( OptixDenoiser denoiser, - CUstream stream, - const OptixImage2D* inputImage, - CUdeviceptr outputIntensity, - CUdeviceptr scratch, - size_t scratchSizeInBytes ); - -/// Compute average logarithmic for each of the first three channels for the given image. -/// When denoising tiles the intensity of the entire image should be computed, i.e. not per tile to get -/// consistent results. -/// -/// The size of scratch memory required can be queried with #optixDenoiserComputeMemoryResources. -/// -/// data type unsigned char is not supported for 'inputImage', it must be 3 or 4 component half/float. -/// -/// \param[in] denoiser -/// \param[in] stream -/// \param[in] inputImage -/// \param[out] outputAverageColor three floats -/// \param[in] scratch -/// \param[in] scratchSizeInBytes -OPTIXAPI OptixResult optixDenoiserComputeAverageColor( OptixDenoiser denoiser, - CUstream stream, - const OptixImage2D* inputImage, - CUdeviceptr outputAverageColor, - CUdeviceptr scratch, - size_t scratchSizeInBytes ); - -///@} - -#include "optix_function_table.h" - -#endif // OPTIX_OPTIX_HOST_H diff --git a/crtx/optix_9.1/optix_micromap.h b/crtx/optix_9.1/optix_micromap.h deleted file mode 100644 index 144c35e..0000000 --- a/crtx/optix_9.1/optix_micromap.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * SPDX-FileCopyrightText: Copyright (c) 2022 - 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. - * SPDX-License-Identifier: BSD-3-Clause - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** -* @file optix_micromap.h -* @author NVIDIA Corporation -* @brief OptiX micromap helper functions -* -* OptiX micromap helper functions. Useable on either host or device. -*/ - -#ifndef OPTIX_OPTIX_MICROMAP_H -#define OPTIX_OPTIX_MICROMAP_H - -#if !defined( OPTIX_DONT_INCLUDE_CUDA ) -// If OPTIX_DONT_INCLUDE_CUDA is defined, cuda driver type float2 must be defined through other -// means before including optix headers. -#include -#endif -#include "internal/optix_micromap_impl.h" - -/// Converts a micromap triangle index to the three base-triangle barycentric coordinates of the micro-triangle vertices in the base triangle. -/// The base triangle is the triangle that the micromap is applied to. -/// Note that for displaced micro-meshes this function can be used to compute a UV mapping from sub triangle to base triangle. -/// -/// \param[in] micromapTriangleIndex Index of a micro- or sub triangle within a micromap. -/// \param[in] subdivisionLevel Number of subdivision levels of the micromap or number of subdivision levels being considered (for sub triangles). -/// \param[out] baseBarycentrics0 Barycentric coordinates in the space of the base triangle of vertex 0 of the micromap triangle. -/// \param[out] baseBarycentrics1 Barycentric coordinates in the space of the base triangle of vertex 1 of the micromap triangle. -/// \param[out] baseBarycentrics2 Barycentric coordinates in the space of the base triangle of vertex 2 of the micromap triangle. -OPTIX_MICROMAP_INLINE_FUNC void optixMicromapIndexToBaseBarycentrics( unsigned int micromapTriangleIndex, - unsigned int subdivisionLevel, - float2& baseBarycentrics0, - float2& baseBarycentrics1, - float2& baseBarycentrics2 ) -{ - optix_impl::micro2bary( micromapTriangleIndex, subdivisionLevel, baseBarycentrics0, baseBarycentrics1, baseBarycentrics2 ); -} - -/// Maps barycentrics in the space of the base triangle to barycentrics of a micro triangle. -/// The vertices of the micro triangle are defined by its barycentrics in the space of the base triangle. -/// These can be queried for a DMM hit by using optixGetMicroTriangleBarycentricsData(). -OPTIX_MICROMAP_INLINE_FUNC float2 optixBaseBarycentricsToMicroBarycentrics( float2 baseBarycentrics, - float2 microVertexBaseBarycentrics[3] ) -{ - return optix_impl::base2micro( baseBarycentrics, microVertexBaseBarycentrics ); -} - -#endif // OPTIX_OPTIX_MICROMAP_H diff --git a/crtx/optix_9.1/optix_stack_size.h b/crtx/optix_9.1/optix_stack_size.h deleted file mode 100644 index 3b88b30..0000000 --- a/crtx/optix_9.1/optix_stack_size.h +++ /dev/null @@ -1,345 +0,0 @@ -/* - * SPDX-FileCopyrightText: Copyright (c) 2019 - 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. - * SPDX-License-Identifier: BSD-3-Clause - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/// @file -/// @author NVIDIA Corporation -/// @brief OptiX public API header - -#ifndef OPTIX_OPTIX_STACK_SIZE_H -#define OPTIX_OPTIX_STACK_SIZE_H - -#include "optix.h" - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** \addtogroup optix_utilities -@{ -*/ - -/// Retrieves direct and continuation stack sizes for each program in the program group and accumulates the upper bounds -/// in the correponding output variables based on the semantic type of the program. Before the first invocation of this -/// function with a given instance of #OptixStackSizes, the members of that instance should be set to 0. -/// If the programs rely on external functions, passing the current pipeline will consider these as well. Otherwise, a null pointer -/// can be passed instead. When external functions are present, a warning will be issued for these cases. -inline OptixResult optixUtilAccumulateStackSizes( OptixProgramGroup programGroup, OptixStackSizes* stackSizes, OptixPipeline pipeline ) -{ - if( !stackSizes ) - return OPTIX_ERROR_INVALID_VALUE; - - OptixStackSizes localStackSizes; - OptixResult result = optixProgramGroupGetStackSize( programGroup, &localStackSizes, pipeline ); - if( result != OPTIX_SUCCESS ) - return result; - - stackSizes->cssRG = std::max( stackSizes->cssRG, localStackSizes.cssRG ); - stackSizes->cssMS = std::max( stackSizes->cssMS, localStackSizes.cssMS ); - stackSizes->cssCH = std::max( stackSizes->cssCH, localStackSizes.cssCH ); - stackSizes->cssAH = std::max( stackSizes->cssAH, localStackSizes.cssAH ); - stackSizes->cssIS = std::max( stackSizes->cssIS, localStackSizes.cssIS ); - stackSizes->cssCC = std::max( stackSizes->cssCC, localStackSizes.cssCC ); - stackSizes->dssDC = std::max( stackSizes->dssDC, localStackSizes.dssDC ); - - return OPTIX_SUCCESS; -} - -/// Computes the stack size values needed to configure a pipeline. -/// -/// See the programming guide for an explanation of the formula. -/// -/// \param[in] stackSizes Accumulated stack sizes of all programs in the call graph. -/// \param[in] maxTraceDepth Maximum depth of #optixTrace() calls. -/// \param[in] maxCCDepth Maximum depth of calls trees of continuation callables. -/// \param[in] maxDCDepth Maximum depth of calls trees of direct callables. -/// \param[out] directCallableStackSizeFromTraversal Direct stack size requirement for direct callables invoked from -/// IS or AH. -/// \param[out] directCallableStackSizeFromState Direct stack size requirement for direct callables invoked from -/// RG, MS, or CH. -/// \param[out] continuationStackSize Continuation stack requirement. -inline OptixResult optixUtilComputeStackSizes( const OptixStackSizes* stackSizes, - unsigned int maxTraceDepth, - unsigned int maxCCDepth, - unsigned int maxDCDepth, - unsigned int* directCallableStackSizeFromTraversal, - unsigned int* directCallableStackSizeFromState, - unsigned int* continuationStackSize ) -{ - if( !stackSizes ) - return OPTIX_ERROR_INVALID_VALUE; - - const unsigned int cssRG = stackSizes->cssRG; - const unsigned int cssMS = stackSizes->cssMS; - const unsigned int cssCH = stackSizes->cssCH; - const unsigned int cssAH = stackSizes->cssAH; - const unsigned int cssIS = stackSizes->cssIS; - const unsigned int cssCC = stackSizes->cssCC; - const unsigned int dssDC = stackSizes->dssDC; - - if( directCallableStackSizeFromTraversal ) - *directCallableStackSizeFromTraversal = maxDCDepth * dssDC; - if( directCallableStackSizeFromState ) - *directCallableStackSizeFromState = maxDCDepth * dssDC; - - // upper bound on continuation stack used by call trees of continuation callables - unsigned int cssCCTree = maxCCDepth * cssCC; - - // upper bound on continuation stack used by CH or MS programs including the call tree of - // continuation callables - unsigned int cssCHOrMSPlusCCTree = std::max( cssCH, cssMS ) + cssCCTree; - - // clang-format off - if( continuationStackSize ) - *continuationStackSize - = cssRG + cssCCTree - + ( std::max( maxTraceDepth, 1u ) - 1 ) * cssCHOrMSPlusCCTree - + std::min( maxTraceDepth, 1u ) * std::max( cssCHOrMSPlusCCTree, cssIS + cssAH ); - // clang-format on - - return OPTIX_SUCCESS; -} - -/// Computes the stack size values needed to configure a pipeline. -/// -/// This variant is similar to #optixUtilComputeStackSizes(), except that it expects the values dssDC and -/// maxDCDepth split by call site semantic. -/// -/// See programming guide for an explanation of the formula. -/// -/// \param[in] stackSizes Accumulated stack sizes of all programs in the call graph. -/// \param[in] dssDCFromTraversal Accumulated direct stack size of all DC programs invoked from IS -/// or AH. -/// \param[in] dssDCFromState Accumulated direct stack size of all DC programs invoked from RG, -/// MS, or CH. -/// \param[in] maxTraceDepth Maximum depth of #optixTrace() calls. -/// \param[in] maxCCDepth Maximum depth of calls trees of continuation callables. -/// \param[in] maxDCDepthFromTraversal Maximum depth of calls trees of direct callables invoked from IS -/// or AH. -/// \param[in] maxDCDepthFromState Maximum depth of calls trees of direct callables invoked from RG, -/// MS, or CH. -/// \param[out] directCallableStackSizeFromTraversal Direct stack size requirement for direct callables invoked from -/// IS or AH. -/// \param[out] directCallableStackSizeFromState Direct stack size requirement for direct callables invoked from -/// RG, MS, or CH. -/// \param[out] continuationStackSize Continuation stack requirement. -inline OptixResult optixUtilComputeStackSizesDCSplit( const OptixStackSizes* stackSizes, - unsigned int dssDCFromTraversal, - unsigned int dssDCFromState, - unsigned int maxTraceDepth, - unsigned int maxCCDepth, - unsigned int maxDCDepthFromTraversal, - unsigned int maxDCDepthFromState, - unsigned int* directCallableStackSizeFromTraversal, - unsigned int* directCallableStackSizeFromState, - unsigned int* continuationStackSize ) -{ - if( !stackSizes ) - return OPTIX_ERROR_INVALID_VALUE; - - const unsigned int cssRG = stackSizes->cssRG; - const unsigned int cssMS = stackSizes->cssMS; - const unsigned int cssCH = stackSizes->cssCH; - const unsigned int cssAH = stackSizes->cssAH; - const unsigned int cssIS = stackSizes->cssIS; - const unsigned int cssCC = stackSizes->cssCC; - // use dssDCFromTraversal and dssDCFromState instead of stackSizes->dssDC - - if( directCallableStackSizeFromTraversal ) - *directCallableStackSizeFromTraversal = maxDCDepthFromTraversal * dssDCFromTraversal; - if( directCallableStackSizeFromState ) - *directCallableStackSizeFromState = maxDCDepthFromState * dssDCFromState; - - // upper bound on continuation stack used by call trees of continuation callables - unsigned int cssCCTree = maxCCDepth * cssCC; - - // upper bound on continuation stack used by CH or MS programs including the call tree of - // continuation callables - unsigned int cssCHOrMSPlusCCTree = std::max( cssCH, cssMS ) + cssCCTree; - - // clang-format off - if( continuationStackSize ) - *continuationStackSize - = cssRG + cssCCTree - + ( std::max( maxTraceDepth, 1u ) - 1 ) * cssCHOrMSPlusCCTree - + std::min( maxTraceDepth, 1u ) * std::max( cssCHOrMSPlusCCTree, cssIS + cssAH ); - // clang-format on - - return OPTIX_SUCCESS; -} - -/// Computes the stack size values needed to configure a pipeline. -/// -/// This variant is similar to #optixUtilComputeStackSizes(), except that it expects the value cssCCTree -/// instead of cssCC and maxCCDepth. -/// -/// See programming guide for an explanation of the formula. -/// -/// \param[in] stackSizes Accumulated stack sizes of all programs in the call graph. -/// \param[in] cssCCTree Maximum stack size used by calls trees of continuation callables. -/// \param[in] maxTraceDepth Maximum depth of #optixTrace() calls. -/// \param[in] maxDCDepth Maximum depth of calls trees of direct callables. -/// \param[out] directCallableStackSizeFromTraversal Direct stack size requirement for direct callables invoked from -/// IS or AH. -/// \param[out] directCallableStackSizeFromState Direct stack size requirement for direct callables invoked from -/// RG, MS, or CH. -/// \param[out] continuationStackSize Continuation stack requirement. -inline OptixResult optixUtilComputeStackSizesCssCCTree( const OptixStackSizes* stackSizes, - unsigned int cssCCTree, - unsigned int maxTraceDepth, - unsigned int maxDCDepth, - unsigned int* directCallableStackSizeFromTraversal, - unsigned int* directCallableStackSizeFromState, - unsigned int* continuationStackSize ) -{ - if( !stackSizes ) - return OPTIX_ERROR_INVALID_VALUE; - - const unsigned int cssRG = stackSizes->cssRG; - const unsigned int cssMS = stackSizes->cssMS; - const unsigned int cssCH = stackSizes->cssCH; - const unsigned int cssAH = stackSizes->cssAH; - const unsigned int cssIS = stackSizes->cssIS; - // use cssCCTree instead of stackSizes->cssCC and maxCCDepth - const unsigned int dssDC = stackSizes->dssDC; - - if( directCallableStackSizeFromTraversal ) - *directCallableStackSizeFromTraversal = maxDCDepth * dssDC; - if( directCallableStackSizeFromState ) - *directCallableStackSizeFromState = maxDCDepth * dssDC; - - // upper bound on continuation stack used by CH or MS programs including the call tree of - // continuation callables - unsigned int cssCHOrMSPlusCCTree = std::max( cssCH, cssMS ) + cssCCTree; - - // clang-format off - if( continuationStackSize ) - *continuationStackSize - = cssRG + cssCCTree - + ( std::max( maxTraceDepth, 1u ) - 1 ) * cssCHOrMSPlusCCTree - + std::min( maxTraceDepth, 1u ) * std::max( cssCHOrMSPlusCCTree, cssIS + cssAH ); - // clang-format on - - return OPTIX_SUCCESS; -} - -/// Computes the stack size values needed to configure a pipeline. -/// -/// This variant is a specialization of #optixUtilComputeStackSizes() for a simple path tracer with the following -/// assumptions: There are only two ray types, camera rays and shadow rays. There are only RG, MS, and CH programs, and -/// no AH, IS, CC, or DC programs. The camera rays invoke only the miss and closest hit programs MS1 and CH1, -/// respectively. The CH1 program might trace shadow rays, which invoke only the miss and closest hit programs MS2 and -/// CH2, respectively. -/// -/// For flexibility, we allow for each of CH1 and CH2 not just one single program group, but an array of programs -/// groups, and compute the maximas of the stack size requirements per array. -/// -/// See programming guide for an explanation of the formula. -/// -/// If the programs rely on external functions, passing the current pipeline will consider these as well. Otherwise, a null pointer -/// can be passed instead. When external functions are present, a warning will be issued for these cases. -inline OptixResult optixUtilComputeStackSizesSimplePathTracer( OptixProgramGroup programGroupRG, - OptixProgramGroup programGroupMS1, - const OptixProgramGroup* programGroupCH1, - unsigned int programGroupCH1Count, - OptixProgramGroup programGroupMS2, - const OptixProgramGroup* programGroupCH2, - unsigned int programGroupCH2Count, - unsigned int* directCallableStackSizeFromTraversal, - unsigned int* directCallableStackSizeFromState, - unsigned int* continuationStackSize, - OptixPipeline pipeline ) -{ - if( !programGroupCH1 && ( programGroupCH1Count > 0 ) ) - return OPTIX_ERROR_INVALID_VALUE; - if( !programGroupCH2 && ( programGroupCH2Count > 0 ) ) - return OPTIX_ERROR_INVALID_VALUE; - - OptixResult result; - - OptixStackSizes stackSizesRG = {}; - result = optixProgramGroupGetStackSize( programGroupRG, &stackSizesRG, pipeline ); - if( result != OPTIX_SUCCESS ) - return result; - - OptixStackSizes stackSizesMS1 = {}; - result = optixProgramGroupGetStackSize( programGroupMS1, &stackSizesMS1, pipeline ); - if( result != OPTIX_SUCCESS ) - return result; - - OptixStackSizes stackSizesCH1 = {}; - for( unsigned int i = 0; i < programGroupCH1Count; ++i ) - { - result = optixUtilAccumulateStackSizes( programGroupCH1[i], &stackSizesCH1, pipeline ); - if( result != OPTIX_SUCCESS ) - return result; - } - - OptixStackSizes stackSizesMS2 = {}; - result = optixProgramGroupGetStackSize( programGroupMS2, &stackSizesMS2, pipeline ); - if( result != OPTIX_SUCCESS ) - return result; - - OptixStackSizes stackSizesCH2 = {}; - memset( &stackSizesCH2, 0, sizeof( OptixStackSizes ) ); - for( unsigned int i = 0; i < programGroupCH2Count; ++i ) - { - result = optixUtilAccumulateStackSizes( programGroupCH2[i], &stackSizesCH2, pipeline ); - if( result != OPTIX_SUCCESS ) - return result; - } - - const unsigned int cssRG = stackSizesRG.cssRG; - const unsigned int cssMS1 = stackSizesMS1.cssMS; - const unsigned int cssCH1 = stackSizesCH1.cssCH; - const unsigned int cssMS2 = stackSizesMS2.cssMS; - const unsigned int cssCH2 = stackSizesCH2.cssCH; - // no AH, IS, CC, or DC programs - - if( directCallableStackSizeFromTraversal ) - *directCallableStackSizeFromTraversal = 0; - if( directCallableStackSizeFromState ) - *directCallableStackSizeFromState = 0; - - if( continuationStackSize ) - *continuationStackSize = cssRG + std::max( cssMS1, cssCH1 + std::max( cssMS2, cssCH2 ) ); - - return OPTIX_SUCCESS; -} - -/**@}*/ // end group optix_utilities - -#ifdef __cplusplus -} -#endif - -#endif // OPTIX_OPTIX_STACK_SIZE_H diff --git a/crtx/optix_9.1/optix_stubs.h b/crtx/optix_9.1/optix_stubs.h deleted file mode 100644 index 17e90ea..0000000 --- a/crtx/optix_9.1/optix_stubs.h +++ /dev/null @@ -1,828 +0,0 @@ -/* - * SPDX-FileCopyrightText: Copyright (c) 2019 - 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. - * SPDX-License-Identifier: BSD-3-Clause - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/// @file -/// @author NVIDIA Corporation -/// @brief OptiX public API header - -#ifndef OPTIX_OPTIX_STUBS_H -#define OPTIX_OPTIX_STUBS_H - -#include "optix_function_table.h" - -#ifdef _WIN32 -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN 1 -#endif -#include -// The cfgmgr32 header is necessary for interrogating driver information in the registry. -// For convenience the library is also linked in automatically using the #pragma command. -#include -#pragma comment( lib, "Cfgmgr32.lib" ) -#include -#else -#include -#endif - -/// Mixing multiple SDKs in a single application will result in symbol collisions. -/// To enable different compilation units to use different SDKs, use OPTIX_ENABLE_SDK_MIXING. -#ifndef OPTIXAPI -# ifdef OPTIX_ENABLE_SDK_MIXING -# define OPTIXAPI static -# else // OPTIX_ENABLE_SDK_MIXING -# ifdef __cplusplus -# define OPTIXAPI extern "C" -# else // __cplusplus -# define OPTIXAPI -# endif // __cplusplus -# endif // OPTIX_ENABLE_SDK_MIXING -#endif // OPTIXAPI - -#ifdef __cplusplus -extern "C" { -#endif - -// The function table needs to be defined in exactly one translation unit. This can be -// achieved by including optix_function_table_definition.h in that translation unit. -extern OptixFunctionTable OPTIX_FUNCTION_TABLE_SYMBOL; - -#ifdef __cplusplus -} -#endif - -#ifdef _WIN32 -#if defined( _MSC_VER ) -// Visual Studio produces warnings suggesting strcpy and friends being replaced with _s -// variants. All the string lengths and allocation sizes have been calculated and should -// be safe, so we are disabling this warning to increase compatibility. -#pragma warning( push ) -#pragma warning( disable : 4996 ) -#endif -static void* optixLoadWindowsDllFromName( const char* optixDllName ) -{ - void* handle = NULL; - - - // Get the size of the path first, then allocate - unsigned int size = GetSystemDirectoryA( NULL, 0 ); - if( size == 0 ) - { - // Couldn't get the system path size, so bail - return NULL; - } - size_t pathSize = size + 1 + strlen( optixDllName ); - char* systemPath = (char*)malloc( pathSize ); - if( systemPath == NULL ) - return NULL; - if( GetSystemDirectoryA( systemPath, size ) != size - 1 ) - { - // Something went wrong - free( systemPath ); - return NULL; - } - strcat( systemPath, "\\" ); - strcat( systemPath, optixDllName ); - handle = LoadLibraryA( systemPath ); - free( systemPath ); - if( handle ) - return handle; - - // If we didn't find it, go looking in the register store. Since nvoptix.dll doesn't - // have its own registry entry, we are going to look for the opengl driver which lives - // next to nvoptix.dll. 0 (null) will be returned if any errors occured. - - static const char* deviceInstanceIdentifiersGUID = "{4d36e968-e325-11ce-bfc1-08002be10318}"; - const ULONG flags = CM_GETIDLIST_FILTER_CLASS | CM_GETIDLIST_FILTER_PRESENT; - ULONG deviceListSize = 0; - if( CM_Get_Device_ID_List_SizeA( &deviceListSize, deviceInstanceIdentifiersGUID, flags ) != CR_SUCCESS ) - { - return NULL; - } - char* deviceNames = (char*)malloc( deviceListSize ); - if( deviceNames == NULL ) - return NULL; - if( CM_Get_Device_ID_ListA( deviceInstanceIdentifiersGUID, deviceNames, deviceListSize, flags ) ) - { - free( deviceNames ); - return NULL; - } - DEVINST devID = 0; - char* dllPath = NULL; - - // Continue to the next device if errors are encountered. - for( char* deviceName = deviceNames; *deviceName; deviceName += strlen( deviceName ) + 1 ) - { - if( CM_Locate_DevNodeA( &devID, deviceName, CM_LOCATE_DEVNODE_NORMAL ) != CR_SUCCESS ) - { - continue; - } - HKEY regKey = 0; - if( CM_Open_DevNode_Key( devID, KEY_QUERY_VALUE, 0, RegDisposition_OpenExisting, ®Key, CM_REGISTRY_SOFTWARE ) != CR_SUCCESS ) - { - continue; - } - const char* valueName = "OpenGLDriverName"; - DWORD valueSize = 0; - LSTATUS ret = RegQueryValueExA( regKey, valueName, NULL, NULL, NULL, &valueSize ); - if( ret != ERROR_SUCCESS ) - { - RegCloseKey( regKey ); - continue; - } - char* regValue = (char*)malloc( valueSize ); - if( regValue == NULL ) - { - RegCloseKey( regKey ); - continue; - } - ret = RegQueryValueExA( regKey, valueName, NULL, NULL, (LPBYTE)regValue, &valueSize ); - if( ret != ERROR_SUCCESS ) - { - free( regValue ); - RegCloseKey( regKey ); - continue; - } - // Strip the opengl driver dll name from the string then create a new string with - // the path and the nvoptix.dll name - for( int i = (int)valueSize - 1; i >= 0 && regValue[i] != '\\'; --i ) - regValue[i] = '\0'; - size_t newPathSize = strlen( regValue ) + strlen( optixDllName ) + 1; - dllPath = (char*)malloc( newPathSize ); - if( dllPath == NULL ) - { - free( regValue ); - RegCloseKey( regKey ); - continue; - } - strcpy( dllPath, regValue ); - strcat( dllPath, optixDllName ); - free( regValue ); - RegCloseKey( regKey ); - handle = LoadLibraryA( (LPCSTR)dllPath ); - free( dllPath ); - if( handle ) - break; - } - free( deviceNames ); - return handle; -} -#if defined( _MSC_VER ) -#pragma warning( pop ) -#endif - -static void* optixLoadWindowsDll() -{ - return optixLoadWindowsDllFromName( "nvoptix.dll" ); -} -#endif - -/// \defgroup optix_utilities Utilities -/// \brief OptiX Utilities - -/** \addtogroup optix_utilities -@{ -*/ - -/// Loads the OptiX library and initializes the function table used by the stubs below. -/// -/// If handlePtr is not nullptr, an OS-specific handle to the library will be returned in *handlePtr. -/// -/// \see #optixUninitWithHandle -OPTIXAPI inline OptixResult optixInitWithHandle( void** handlePtr ) -{ - // Make sure these functions get initialized to zero in case the DLL and function - // table can't be loaded - OPTIX_FUNCTION_TABLE_SYMBOL.optixGetErrorName = 0; - OPTIX_FUNCTION_TABLE_SYMBOL.optixGetErrorString = 0; - - if( !handlePtr ) - return OPTIX_ERROR_INVALID_VALUE; - -#ifdef _WIN32 - *handlePtr = optixLoadWindowsDll(); - if( !*handlePtr ) - return OPTIX_ERROR_LIBRARY_NOT_FOUND; - - void* symbol = (void*)GetProcAddress( (HMODULE)*handlePtr, "optixQueryFunctionTable" ); - if( !symbol ) - return OPTIX_ERROR_ENTRY_SYMBOL_NOT_FOUND; -#else - *handlePtr = dlopen( "libnvoptix.so.1", RTLD_NOW ); - if( !*handlePtr ) - return OPTIX_ERROR_LIBRARY_NOT_FOUND; - - void* symbol = dlsym( *handlePtr, "optixQueryFunctionTable" ); - if( !symbol ) - return OPTIX_ERROR_ENTRY_SYMBOL_NOT_FOUND; -#endif - - OptixQueryFunctionTable_t* optixQueryFunctionTable = (OptixQueryFunctionTable_t*)symbol; - - return optixQueryFunctionTable( OPTIX_ABI_VERSION, 0, 0, 0, &OPTIX_FUNCTION_TABLE_SYMBOL, sizeof( OPTIX_FUNCTION_TABLE_SYMBOL ) ); -} - -/// Loads the OptiX library and initializes the function table used by the stubs below. -/// -/// A variant of #optixInitWithHandle() that does not make the handle to the loaded library available. -OPTIXAPI inline OptixResult optixInit( void ) -{ - void* handle; - return optixInitWithHandle( &handle ); -} - -/// Unloads the OptiX library and zeros the function table used by the stubs below. Takes the -/// handle returned by optixInitWithHandle. All OptixDeviceContext objects must be destroyed -/// before calling this function, or the behavior is undefined. -/// -/// \see #optixInitWithHandle -OPTIXAPI inline OptixResult optixUninitWithHandle( void* handle ) -{ - if( !handle ) - return OPTIX_ERROR_INVALID_VALUE; -#ifdef _WIN32 - if( !FreeLibrary( (HMODULE)handle ) ) - return OPTIX_ERROR_LIBRARY_UNLOAD_FAILURE; -#else - if( dlclose( handle ) ) - return OPTIX_ERROR_LIBRARY_UNLOAD_FAILURE; -#endif - OptixFunctionTable empty -#ifdef __cplusplus - {} -#else - = { 0 } -#endif - ; - OPTIX_FUNCTION_TABLE_SYMBOL = empty; - return OPTIX_SUCCESS; -} - - -/**@}*/ // end group optix_utilities - -#ifndef OPTIX_DOXYGEN_SHOULD_SKIP_THIS - -// Stub functions that forward calls to the corresponding function pointer in the function table. - -OPTIXAPI inline const char* optixGetErrorName( OptixResult result ) -{ - if( OPTIX_FUNCTION_TABLE_SYMBOL.optixGetErrorName ) - return OPTIX_FUNCTION_TABLE_SYMBOL.optixGetErrorName( result ); - - // If the DLL and symbol table couldn't be loaded, provide a set of error strings - // suitable for processing errors related to the DLL loading. - switch( result ) - { - case OPTIX_SUCCESS: - return "OPTIX_SUCCESS"; - case OPTIX_ERROR_INVALID_VALUE: - return "OPTIX_ERROR_INVALID_VALUE"; - case OPTIX_ERROR_UNSUPPORTED_ABI_VERSION: - return "OPTIX_ERROR_UNSUPPORTED_ABI_VERSION"; - case OPTIX_ERROR_FUNCTION_TABLE_SIZE_MISMATCH: - return "OPTIX_ERROR_FUNCTION_TABLE_SIZE_MISMATCH"; - case OPTIX_ERROR_INVALID_ENTRY_FUNCTION_OPTIONS: - return "OPTIX_ERROR_INVALID_ENTRY_FUNCTION_OPTIONS"; - case OPTIX_ERROR_LIBRARY_NOT_FOUND: - return "OPTIX_ERROR_LIBRARY_NOT_FOUND"; - case OPTIX_ERROR_ENTRY_SYMBOL_NOT_FOUND: - return "OPTIX_ERROR_ENTRY_SYMBOL_NOT_FOUND"; - case OPTIX_ERROR_LIBRARY_UNLOAD_FAILURE: - return "OPTIX_ERROR_LIBRARY_UNLOAD_FAILURE"; - default: - return "Unknown OptixResult code"; - } -} - -OPTIXAPI inline const char* optixGetErrorString( OptixResult result ) -{ - if( OPTIX_FUNCTION_TABLE_SYMBOL.optixGetErrorString ) - return OPTIX_FUNCTION_TABLE_SYMBOL.optixGetErrorString( result ); - - // If the DLL and symbol table couldn't be loaded, provide a set of error strings - // suitable for processing errors related to the DLL loading. - switch( result ) - { - case OPTIX_SUCCESS: - return "Success"; - case OPTIX_ERROR_INVALID_VALUE: - return "Invalid value"; - case OPTIX_ERROR_UNSUPPORTED_ABI_VERSION: - return "Unsupported ABI version"; - case OPTIX_ERROR_FUNCTION_TABLE_SIZE_MISMATCH: - return "Function table size mismatch"; - case OPTIX_ERROR_INVALID_ENTRY_FUNCTION_OPTIONS: - return "Invalid options to entry function"; - case OPTIX_ERROR_LIBRARY_NOT_FOUND: - return "Library not found"; - case OPTIX_ERROR_ENTRY_SYMBOL_NOT_FOUND: - return "Entry symbol not found"; - case OPTIX_ERROR_LIBRARY_UNLOAD_FAILURE: - return "Library could not be unloaded"; - default: - return "Unknown OptixResult code"; - } -} - -OPTIXAPI inline OptixResult optixDeviceContextCreate( CUcontext fromContext, const OptixDeviceContextOptions* options, OptixDeviceContext* context ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixDeviceContextCreate( fromContext, options, context ); -} - -OPTIXAPI inline OptixResult optixDeviceContextDestroy( OptixDeviceContext context ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixDeviceContextDestroy( context ); -} - -OPTIXAPI inline OptixResult optixDeviceContextGetProperty( OptixDeviceContext context, OptixDeviceProperty property, void* value, size_t sizeInBytes ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixDeviceContextGetProperty( context, property, value, sizeInBytes ); -} - -OPTIXAPI inline OptixResult optixDeviceContextSetLogCallback( OptixDeviceContext context, - OptixLogCallback callbackFunction, - void* callbackData, - unsigned int callbackLevel ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixDeviceContextSetLogCallback( context, callbackFunction, callbackData, callbackLevel ); -} - -OPTIXAPI inline OptixResult optixDeviceContextSetCacheEnabled( OptixDeviceContext context, int enabled ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixDeviceContextSetCacheEnabled( context, enabled ); -} - -OPTIXAPI inline OptixResult optixDeviceContextSetCacheLocation( OptixDeviceContext context, const char* location ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixDeviceContextSetCacheLocation( context, location ); -} - -OPTIXAPI inline OptixResult optixDeviceContextSetCacheDatabaseSizes( OptixDeviceContext context, size_t lowWaterMark, size_t highWaterMark ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixDeviceContextSetCacheDatabaseSizes( context, lowWaterMark, highWaterMark ); -} - -OPTIXAPI inline OptixResult optixDeviceContextGetCacheEnabled( OptixDeviceContext context, int* enabled ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixDeviceContextGetCacheEnabled( context, enabled ); -} - -OPTIXAPI inline OptixResult optixDeviceContextGetCacheLocation( OptixDeviceContext context, char* location, size_t locationSize ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixDeviceContextGetCacheLocation( context, location, locationSize ); -} - -OPTIXAPI inline OptixResult optixDeviceContextGetCacheDatabaseSizes( OptixDeviceContext context, size_t* lowWaterMark, size_t* highWaterMark ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixDeviceContextGetCacheDatabaseSizes( context, lowWaterMark, highWaterMark ); -} - -OPTIXAPI inline OptixResult optixModuleCreate( OptixDeviceContext context, - const OptixModuleCompileOptions* moduleCompileOptions, - const OptixPipelineCompileOptions* pipelineCompileOptions, - const char* input, - size_t inputSize, - char* logString, - size_t* logStringSize, - OptixModule* module ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixModuleCreate( context, moduleCompileOptions, pipelineCompileOptions, input, - inputSize, logString, logStringSize, module ); -} - -OPTIXAPI inline OptixResult optixModuleCreateWithTasks( OptixDeviceContext context, - const OptixModuleCompileOptions* moduleCompileOptions, - const OptixPipelineCompileOptions* pipelineCompileOptions, - const char* input, - size_t inputSize, - char* logString, - size_t* logStringSize, - OptixModule* module, - OptixTask* firstTask ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixModuleCreateWithTasks( context, moduleCompileOptions, pipelineCompileOptions, input, - inputSize, logString, logStringSize, module, firstTask ); -} - -OPTIXAPI inline OptixResult optixModuleGetCompilationState( OptixModule module, OptixModuleCompileState* state ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixModuleGetCompilationState( module, state ); -} - -OPTIXAPI inline OptixResult optixModuleCancelCreation( OptixModule module, OptixCreationFlags flags ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixModuleCancelCreation( module, flags ); -} - - -OPTIXAPI inline OptixResult optixDeviceContextCancelCreations( OptixDeviceContext context, OptixCreationFlags flags ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixDeviceContextCancelCreations( context, flags ); -} - -OPTIXAPI inline OptixResult optixModuleDestroy( OptixModule module ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixModuleDestroy( module ); -} - -OPTIXAPI inline OptixResult optixBuiltinISModuleGet( OptixDeviceContext context, - const OptixModuleCompileOptions* moduleCompileOptions, - const OptixPipelineCompileOptions* pipelineCompileOptions, - const OptixBuiltinISOptions* builtinISOptions, - OptixModule* builtinModule ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixBuiltinISModuleGet( context, moduleCompileOptions, pipelineCompileOptions, - builtinISOptions, builtinModule ); -} - -OPTIXAPI inline OptixResult optixTaskExecute( OptixTask task, - OptixTask* additionalTasks, - unsigned int maxNumAdditionalTasks, - unsigned int* numAdditionalTasksCreated ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixTaskExecute( task, additionalTasks, maxNumAdditionalTasks, numAdditionalTasksCreated ); -} - -OPTIXAPI inline OptixResult optixTaskGetSerializationKey( OptixTask task, void* key, size_t* size ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixTaskGetSerializationKey( task, key, size ); -} - -OPTIXAPI inline OptixResult optixTaskSerializeOutput( OptixTask task, void* data, size_t* size ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixTaskSerializeOutput( task, data, size ); -} - -OPTIXAPI inline OptixResult optixTaskDeserializeOutput( OptixTask task, - const void* data, - size_t size, - OptixTask* additionalTasks, - unsigned int maxNumAdditionalTasks, - unsigned int* numAdditionalTasksCreated ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixTaskDeserializeOutput( task, data, size, additionalTasks, - maxNumAdditionalTasks, numAdditionalTasksCreated ); -} - -OPTIXAPI inline OptixResult optixProgramGroupCreate( OptixDeviceContext context, - const OptixProgramGroupDesc* programDescriptions, - unsigned int numProgramGroups, - const OptixProgramGroupOptions* options, - char* logString, - size_t* logStringSize, - OptixProgramGroup* programGroups ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixProgramGroupCreate( context, programDescriptions, numProgramGroups, options, - logString, logStringSize, programGroups ); -} - -OPTIXAPI inline OptixResult optixProgramGroupDestroy( OptixProgramGroup programGroup ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixProgramGroupDestroy( programGroup ); -} - -OPTIXAPI inline OptixResult optixProgramGroupGetStackSize( OptixProgramGroup programGroup, OptixStackSizes* stackSizes, OptixPipeline pipeline ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixProgramGroupGetStackSize( programGroup, stackSizes, pipeline ); -} - -OPTIXAPI inline OptixResult optixPipelineCreate( OptixDeviceContext context, - const OptixPipelineCompileOptions* pipelineCompileOptions, - const OptixPipelineLinkOptions* pipelineLinkOptions, - const OptixProgramGroup* programGroups, - unsigned int numProgramGroups, - char* logString, - size_t* logStringSize, - OptixPipeline* pipeline ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixPipelineCreate( context, pipelineCompileOptions, pipelineLinkOptions, programGroups, - numProgramGroups, logString, logStringSize, pipeline ); -} - -OPTIXAPI inline OptixResult optixPipelineDestroy( OptixPipeline pipeline ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixPipelineDestroy( pipeline ); -} - -OPTIXAPI inline OptixResult optixPipelineSetStackSizeFromCallDepths( OptixPipeline pipeline, - unsigned int maxTraceDepth, - unsigned int maxContinuationCallableDepth, - unsigned int maxDirectCallableDepthFromState, - unsigned int maxDirectCallableDepthFromTraversal, - unsigned int maxTraversableGraphDepth ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixPipelineSetStackSizeFromCallDepths( pipeline, maxTraceDepth, maxContinuationCallableDepth, - maxDirectCallableDepthFromState, - maxDirectCallableDepthFromTraversal, maxTraversableGraphDepth ); -} - -OPTIXAPI inline OptixResult optixPipelineSetStackSize( OptixPipeline pipeline, - unsigned int directCallableStackSizeFromTraversal, - unsigned int directCallableStackSizeFromState, - unsigned int continuationStackSize, - unsigned int maxTraversableGraphDepth ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixPipelineSetStackSize( pipeline, directCallableStackSizeFromTraversal, - directCallableStackSizeFromState, - continuationStackSize, maxTraversableGraphDepth ); -} - -OPTIXAPI inline OptixResult optixPipelineSymbolMemcpyAsync( OptixPipeline pipeline, - const char* name, - void* mem, - size_t sizeInBytes, - size_t offsetInBytes, - OptixPipelineSymbolMemcpyKind kind, - CUstream stream ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixPipelineSymbolMemcpyAsync( pipeline, name, mem, sizeInBytes, offsetInBytes, kind, stream ); -} - -OPTIXAPI inline OptixResult optixAccelComputeMemoryUsage( OptixDeviceContext context, - const OptixAccelBuildOptions* accelOptions, - const OptixBuildInput* buildInputs, - unsigned int numBuildInputs, - OptixAccelBufferSizes* bufferSizes ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixAccelComputeMemoryUsage( context, accelOptions, buildInputs, numBuildInputs, bufferSizes ); -} - -OPTIXAPI inline OptixResult optixAccelBuild( OptixDeviceContext context, - CUstream stream, - const OptixAccelBuildOptions* accelOptions, - const OptixBuildInput* buildInputs, - unsigned int numBuildInputs, - CUdeviceptr tempBuffer, - size_t tempBufferSizeInBytes, - CUdeviceptr outputBuffer, - size_t outputBufferSizeInBytes, - OptixTraversableHandle* outputHandle, - const OptixAccelEmitDesc* emittedProperties, - unsigned int numEmittedProperties ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixAccelBuild( context, stream, accelOptions, buildInputs, numBuildInputs, tempBuffer, - tempBufferSizeInBytes, outputBuffer, outputBufferSizeInBytes, - outputHandle, emittedProperties, numEmittedProperties ); -} - - -OPTIXAPI inline OptixResult optixAccelGetRelocationInfo( OptixDeviceContext context, OptixTraversableHandle handle, OptixRelocationInfo* info ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixAccelGetRelocationInfo( context, handle, info ); -} - - -OPTIXAPI inline OptixResult optixCheckRelocationCompatibility( OptixDeviceContext context, const OptixRelocationInfo* info, int* compatible ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixCheckRelocationCompatibility( context, info, compatible ); -} - -OPTIXAPI inline OptixResult optixAccelRelocate( OptixDeviceContext context, - CUstream stream, - const OptixRelocationInfo* info, - const OptixRelocateInput* relocateInputs, - size_t numRelocateInputs, - CUdeviceptr targetAccel, - size_t targetAccelSizeInBytes, - OptixTraversableHandle* targetHandle ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixAccelRelocate( context, stream, info, relocateInputs, numRelocateInputs, - targetAccel, targetAccelSizeInBytes, targetHandle ); -} - -OPTIXAPI inline OptixResult optixAccelCompact( OptixDeviceContext context, - CUstream stream, - OptixTraversableHandle inputHandle, - CUdeviceptr outputBuffer, - size_t outputBufferSizeInBytes, - OptixTraversableHandle* outputHandle ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixAccelCompact( context, stream, inputHandle, outputBuffer, - outputBufferSizeInBytes, outputHandle ); -} - -OPTIXAPI inline OptixResult optixAccelEmitProperty( OptixDeviceContext context, - CUstream stream, - OptixTraversableHandle handle, - const OptixAccelEmitDesc* emittedProperty ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixAccelEmitProperty( context, stream, handle, emittedProperty ); -} - -OPTIXAPI inline OptixResult optixConvertPointerToTraversableHandle( OptixDeviceContext onDevice, - CUdeviceptr pointer, - OptixTraversableType traversableType, - OptixTraversableHandle* traversableHandle ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixConvertPointerToTraversableHandle( onDevice, pointer, traversableType, traversableHandle ); -} - -OPTIXAPI inline OptixResult optixOpacityMicromapArrayComputeMemoryUsage( OptixDeviceContext context, - const OptixOpacityMicromapArrayBuildInput* buildInput, - OptixMicromapBufferSizes* bufferSizes ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixOpacityMicromapArrayComputeMemoryUsage( context, buildInput, bufferSizes ); -} - -OPTIXAPI inline OptixResult optixOpacityMicromapArrayBuild( OptixDeviceContext context, - CUstream stream, - const OptixOpacityMicromapArrayBuildInput* buildInput, - const OptixMicromapBuffers* buffers ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixOpacityMicromapArrayBuild( context, stream, buildInput, buffers ); -} - -OPTIXAPI inline OptixResult optixOpacityMicromapArrayGetRelocationInfo( OptixDeviceContext context, - CUdeviceptr opacityMicromapArray, - OptixRelocationInfo* info ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixOpacityMicromapArrayGetRelocationInfo( context, opacityMicromapArray, info ); -} - -OPTIXAPI inline OptixResult optixOpacityMicromapArrayRelocate( OptixDeviceContext context, - CUstream stream, - const OptixRelocationInfo* info, - CUdeviceptr targetOpacityMicromapArray, - size_t targetOpacityMicromapArraySizeInBytes ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixOpacityMicromapArrayRelocate( context, stream, info, targetOpacityMicromapArray, - targetOpacityMicromapArraySizeInBytes ); -} - - -OPTIXAPI inline OptixResult optixClusterAccelComputeMemoryUsage( OptixDeviceContext context, - OptixClusterAccelBuildMode buildMode, - const OptixClusterAccelBuildInput* buildInput, - OptixAccelBufferSizes* bufferSizes ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixClusterAccelComputeMemoryUsage( context, buildMode, buildInput, bufferSizes ); -} - -OPTIXAPI inline OptixResult optixClusterAccelBuild( OptixDeviceContext context, - CUstream stream, - const OptixClusterAccelBuildModeDesc* buildModeDesc, - const OptixClusterAccelBuildInput* buildInput, - CUdeviceptr argsArray, - CUdeviceptr argsCount, - unsigned int argsStrideInBytes ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixClusterAccelBuild( context, stream, buildModeDesc, buildInput, argsArray, - argsCount, argsStrideInBytes ); -} - -OPTIXAPI inline OptixResult optixSbtRecordPackHeader( OptixProgramGroup programGroup, void* sbtRecordHeaderHostPointer ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixSbtRecordPackHeader( programGroup, sbtRecordHeaderHostPointer ); -} - -OPTIXAPI inline OptixResult optixLaunch( OptixPipeline pipeline, - CUstream stream, - CUdeviceptr pipelineParams, - size_t pipelineParamsSize, - const OptixShaderBindingTable* sbt, - unsigned int width, - unsigned int height, - unsigned int depth ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixLaunch( pipeline, stream, pipelineParams, pipelineParamsSize, sbt, width, height, depth ); -} - -OPTIXAPI inline OptixResult optixCoopVecMatrixConvert( OptixDeviceContext context, - CUstream stream, - unsigned int numNetworks, - const OptixNetworkDescription* inputNetworkDescription, - CUdeviceptr inputNetworks, - size_t inputNetworkStrideInBytes, - const OptixNetworkDescription* outputNetworkDescription, - CUdeviceptr outputNetworks, - size_t outputNetworkStrideInBytes ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixCoopVecMatrixConvert( context, stream, numNetworks, inputNetworkDescription, - inputNetworks, inputNetworkStrideInBytes, outputNetworkDescription, - outputNetworks, outputNetworkStrideInBytes ); -} - -OPTIXAPI inline OptixResult optixCoopVecMatrixComputeSize( OptixDeviceContext context, - unsigned int N, - unsigned int K, - OptixCoopVecElemType elementType, - OptixCoopVecMatrixLayout layout, - size_t rowColumnStrideInBytes, - size_t* sizeInBytes ) -{ - - return OPTIX_FUNCTION_TABLE_SYMBOL.optixCoopVecMatrixComputeSize( context, N, K, elementType, layout, - rowColumnStrideInBytes, sizeInBytes ); -} -OPTIXAPI inline OptixResult optixDenoiserCreate( OptixDeviceContext context, - OptixDenoiserModelKind modelKind, - const OptixDenoiserOptions* options, - OptixDenoiser* returnHandle ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixDenoiserCreate( context, modelKind, options, returnHandle ); -} - -OPTIXAPI inline OptixResult optixDenoiserCreateWithUserModel( OptixDeviceContext context, - const void* data, - size_t dataSizeInBytes, - OptixDenoiser* returnHandle ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixDenoiserCreateWithUserModel( context, data, dataSizeInBytes, returnHandle ); -} - -OPTIXAPI inline OptixResult optixDenoiserDestroy( OptixDenoiser handle ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixDenoiserDestroy( handle ); -} - -OPTIXAPI inline OptixResult optixDenoiserComputeMemoryResources( const OptixDenoiser handle, - unsigned int maximumInputWidth, - unsigned int maximumInputHeight, - OptixDenoiserSizes* returnSizes ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixDenoiserComputeMemoryResources( handle, maximumInputWidth, maximumInputHeight, returnSizes ); -} - -OPTIXAPI inline OptixResult optixDenoiserSetup( OptixDenoiser denoiser, - CUstream stream, - unsigned int inputWidth, - unsigned int inputHeight, - CUdeviceptr denoiserState, - size_t denoiserStateSizeInBytes, - CUdeviceptr scratch, - size_t scratchSizeInBytes ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixDenoiserSetup( denoiser, stream, inputWidth, inputHeight, denoiserState, - denoiserStateSizeInBytes, scratch, scratchSizeInBytes ); -} - -OPTIXAPI inline OptixResult optixDenoiserInvoke( OptixDenoiser handle, - CUstream stream, - const OptixDenoiserParams* params, - CUdeviceptr denoiserData, - size_t denoiserDataSize, - const OptixDenoiserGuideLayer* guideLayer, - const OptixDenoiserLayer* layers, - unsigned int numLayers, - unsigned int inputOffsetX, - unsigned int inputOffsetY, - CUdeviceptr scratch, - size_t scratchSizeInBytes ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixDenoiserInvoke( handle, stream, params, denoiserData, denoiserDataSize, - guideLayer, layers, numLayers, inputOffsetX, inputOffsetY, - scratch, scratchSizeInBytes ); -} - -OPTIXAPI inline OptixResult optixDenoiserComputeIntensity( OptixDenoiser handle, - CUstream stream, - const OptixImage2D* inputImage, - CUdeviceptr outputIntensity, - CUdeviceptr scratch, - size_t scratchSizeInBytes ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixDenoiserComputeIntensity( handle, stream, inputImage, outputIntensity, - scratch, scratchSizeInBytes ); -} - -OPTIXAPI inline OptixResult optixDenoiserComputeAverageColor( OptixDenoiser handle, - CUstream stream, - const OptixImage2D* inputImage, - CUdeviceptr outputAverageColor, - CUdeviceptr scratch, - size_t scratchSizeInBytes ) -{ - return OPTIX_FUNCTION_TABLE_SYMBOL.optixDenoiserComputeAverageColor( handle, stream, inputImage, outputAverageColor, - scratch, scratchSizeInBytes ); -} - -#endif // OPTIX_DOXYGEN_SHOULD_SKIP_THIS - -#endif // OPTIX_OPTIX_STUBS_H diff --git a/crtx/optix_9.1/optix_types.h b/crtx/optix_9.1/optix_types.h deleted file mode 100644 index 09d178f..0000000 --- a/crtx/optix_9.1/optix_types.h +++ /dev/null @@ -1,2747 +0,0 @@ - -/* -* SPDX-FileCopyrightText: Copyright (c) 2019 - 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -* SPDX-License-Identifier: LicenseRef-NvidiaProprietary -* -* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual -* property and proprietary rights in and to this material, related -* documentation and any modifications thereto. Any use, reproduction, -* disclosure or distribution of this material and related documentation -* without an express license agreement from NVIDIA CORPORATION or -* its affiliates is strictly prohibited. -*/ -/// @file -/// @author NVIDIA Corporation -/// @brief OptiX public API header -/// -/// OptiX types include file -- defines types and enums used by the API. -/// - -#ifndef OPTIX_OPTIX_TYPES_H -#define OPTIX_OPTIX_TYPES_H - -#if !defined(__CUDACC_RTC__) -#include /* for size_t */ -#endif - - - -/// \defgroup optix_types Types -/// \brief OptiX Types - -/** \addtogroup optix_types -@{ -*/ - -// This typedef should match the one in cuda.h in order to avoid compilation errors. -#if defined(_WIN64) || defined(__LP64__) -/// CUDA device pointer -typedef unsigned long long CUdeviceptr; -#else -/// CUDA device pointer -typedef unsigned int CUdeviceptr; -#endif - -/// Opaque type representing a device context -typedef struct OptixDeviceContext_t* OptixDeviceContext; - -/// Opaque type representing a module -typedef struct OptixModule_t* OptixModule; - -/// Opaque type representing a program group -typedef struct OptixProgramGroup_t* OptixProgramGroup; - -/// Opaque type representing a pipeline -typedef struct OptixPipeline_t* OptixPipeline; - -/// Opaque type representing a denoiser instance -typedef struct OptixDenoiser_t* OptixDenoiser; - -/// Opaque type representing a work task -typedef struct OptixTask_t* OptixTask; - -/// Traversable handle -typedef unsigned long long OptixTraversableHandle; - -/// Visibility mask -typedef unsigned int OptixVisibilityMask; - -/// Size of the SBT record headers. -#define OPTIX_SBT_RECORD_HEADER_SIZE ( (size_t)32 ) - -/// Alignment requirement for device pointers in OptixShaderBindingTable. -#define OPTIX_SBT_RECORD_ALIGNMENT 16ull - -/// Alignment requirement for output and temporay buffers for acceleration structures. -#define OPTIX_ACCEL_BUFFER_BYTE_ALIGNMENT 128ull - -/// Alignment requirement for OptixBuildInputInstanceArray::instances. -#define OPTIX_INSTANCE_BYTE_ALIGNMENT 16ull - -/// Alignment requirement for OptixBuildInputCustomPrimitiveArray::aabbBuffers -#define OPTIX_AABB_BUFFER_BYTE_ALIGNMENT 8ull - -/// Alignment requirement for OptixBuildInputTriangleArray::preTransform -#define OPTIX_GEOMETRY_TRANSFORM_BYTE_ALIGNMENT 16ull - -/// Alignment requirement for OptixStaticTransform, OptixMatrixMotionTransform, OptixSRTMotionTransform. -#define OPTIX_TRANSFORM_BYTE_ALIGNMENT 64ull - -/// Alignment requirement for OptixOpacityMicromapArrayBuildInput::perMicromapDescBuffer. -#define OPTIX_OPACITY_MICROMAP_DESC_BUFFER_BYTE_ALIGNMENT 8ull - -/// Maximum number of registers allowed. Defaults to no explicit limit. -#define OPTIX_COMPILE_DEFAULT_MAX_REGISTER_COUNT 0 - -/// Maximum number of payload types allowed. -#define OPTIX_COMPILE_DEFAULT_MAX_PAYLOAD_TYPE_COUNT 8 - -/// Maximum number of payload values allowed. -#define OPTIX_COMPILE_DEFAULT_MAX_PAYLOAD_VALUE_COUNT 32 - -/// Opacity micromaps encode the states of microtriangles in either 1 bit (2-state) or 2 bits (4-state) using -/// the following values. -#define OPTIX_OPACITY_MICROMAP_STATE_TRANSPARENT ( 0 ) -#define OPTIX_OPACITY_MICROMAP_STATE_OPAQUE ( 1 ) -#define OPTIX_OPACITY_MICROMAP_STATE_UNKNOWN_TRANSPARENT ( 2 ) -#define OPTIX_OPACITY_MICROMAP_STATE_UNKNOWN_OPAQUE ( 3 ) - -/// Predefined index to indicate that a triangle in the BVH build doesn't have an associated opacity micromap, -/// and that it should revert to one of the four possible states for the full triangle. -#define OPTIX_OPACITY_MICROMAP_PREDEFINED_INDEX_FULLY_TRANSPARENT ( -1 ) -#define OPTIX_OPACITY_MICROMAP_PREDEFINED_INDEX_FULLY_OPAQUE ( -2 ) -#define OPTIX_OPACITY_MICROMAP_PREDEFINED_INDEX_FULLY_UNKNOWN_TRANSPARENT ( -3 ) -#define OPTIX_OPACITY_MICROMAP_PREDEFINED_INDEX_FULLY_UNKNOWN_OPAQUE ( -4 ) -/// Predefined index to indicate that no opacity micromap applies for a triangle. The opaque/non-opaque state is determined by the geometry flags, -/// similar as for triangles in instances with the OPTIX_INSTANCE_FLAG_DISABLE_OPACITY_MICROMAPS flag set. -/// This special index is only available for the opacity micromap index array supplied to OptixClusterAccelBuildInputTrianglesArgs. -/// This special index does NOT require the cluster to be built with OPTIX_CLUSTER_ACCEL_CLUSTER_FLAG_ALLOW_DISABLE_OPACITY_MICROMAPS. -#define OPTIX_OPACITY_MICROMAP_PREDEFINED_INDEX_CLUSTER_SKIP_OPACITY_MICROMAP ( -5 ) - -/// Alignment requirement for opacity micromap array buffers -#define OPTIX_OPACITY_MICROMAP_ARRAY_BUFFER_BYTE_ALIGNMENT 128ull - -/// Maximum subdivision level for opacity micromaps -#define OPTIX_OPACITY_MICROMAP_MAX_SUBDIVISION_LEVEL 12 - -/// Result codes returned from API functions -/// -/// All host side API functions return OptixResult with the exception of optixGetErrorName -/// and optixGetErrorString. When successful OPTIX_SUCCESS is returned. All return codes -/// except for OPTIX_SUCCESS should be assumed to be errors as opposed to a warning. -/// -/// \see #optixGetErrorName(), #optixGetErrorString() -typedef enum OptixResult -{ - OPTIX_SUCCESS = 0, - OPTIX_ERROR_INVALID_VALUE = 7001, - OPTIX_ERROR_HOST_OUT_OF_MEMORY = 7002, - OPTIX_ERROR_INVALID_OPERATION = 7003, - OPTIX_ERROR_FILE_IO_ERROR = 7004, - OPTIX_ERROR_INVALID_FILE_FORMAT = 7005, - OPTIX_ERROR_DISK_CACHE_INVALID_PATH = 7010, - OPTIX_ERROR_DISK_CACHE_PERMISSION_ERROR = 7011, - OPTIX_ERROR_DISK_CACHE_DATABASE_ERROR = 7012, - OPTIX_ERROR_DISK_CACHE_INVALID_DATA = 7013, - OPTIX_ERROR_LAUNCH_FAILURE = 7050, - OPTIX_ERROR_INVALID_DEVICE_CONTEXT = 7051, - OPTIX_ERROR_CUDA_NOT_INITIALIZED = 7052, - OPTIX_ERROR_VALIDATION_FAILURE = 7053, - OPTIX_ERROR_INVALID_INPUT = 7200, - OPTIX_ERROR_INVALID_LAUNCH_PARAMETER = 7201, - OPTIX_ERROR_INVALID_PAYLOAD_ACCESS = 7202, - OPTIX_ERROR_INVALID_ATTRIBUTE_ACCESS = 7203, - OPTIX_ERROR_INVALID_FUNCTION_USE = 7204, - OPTIX_ERROR_INVALID_FUNCTION_ARGUMENTS = 7205, - OPTIX_ERROR_PIPELINE_OUT_OF_CONSTANT_MEMORY = 7250, - OPTIX_ERROR_PIPELINE_LINK_ERROR = 7251, - OPTIX_ERROR_ILLEGAL_DURING_TASK_EXECUTE = 7270, - OPTIX_ERROR_CREATION_CANCELED = 7290, - OPTIX_ERROR_INTERNAL_COMPILER_ERROR = 7299, - OPTIX_ERROR_DENOISER_MODEL_NOT_SET = 7300, - OPTIX_ERROR_DENOISER_NOT_INITIALIZED = 7301, - OPTIX_ERROR_NOT_COMPATIBLE = 7400, - OPTIX_ERROR_PAYLOAD_TYPE_MISMATCH = 7500, - OPTIX_ERROR_PAYLOAD_TYPE_RESOLUTION_FAILED = 7501, - OPTIX_ERROR_PAYLOAD_TYPE_ID_INVALID = 7502, - OPTIX_ERROR_NOT_SUPPORTED = 7800, - OPTIX_ERROR_UNSUPPORTED_ABI_VERSION = 7801, - OPTIX_ERROR_FUNCTION_TABLE_SIZE_MISMATCH = 7802, - OPTIX_ERROR_INVALID_ENTRY_FUNCTION_OPTIONS = 7803, - OPTIX_ERROR_LIBRARY_NOT_FOUND = 7804, - OPTIX_ERROR_ENTRY_SYMBOL_NOT_FOUND = 7805, - OPTIX_ERROR_LIBRARY_UNLOAD_FAILURE = 7806, - OPTIX_ERROR_DEVICE_OUT_OF_MEMORY = 7807, - OPTIX_ERROR_INVALID_POINTER = 7808, - OPTIX_ERROR_SYMBOL_NOT_FOUND = 7809, - OPTIX_ERROR_CUDA_ERROR = 7900, - OPTIX_ERROR_INTERNAL_ERROR = 7990, - OPTIX_ERROR_UNKNOWN = 7999, -} OptixResult; - -/// Parameters used for #optixDeviceContextGetProperty() -/// -/// \see #optixDeviceContextGetProperty() -typedef enum OptixDeviceProperty -{ - /// Maximum value for OptixPipelineLinkOptions::maxTraceDepth. sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_LIMIT_MAX_TRACE_DEPTH = 0x2001, - - /// Maximum value to pass into optixPipelineSetStackSize for parameter - /// maxTraversableGraphDepth. sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_LIMIT_MAX_TRAVERSABLE_GRAPH_DEPTH = 0x2002, - - /// The maximum number of primitives (over all build inputs) as input to a single - /// Geometry Acceleration Structure (GAS). sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_LIMIT_MAX_PRIMITIVES_PER_GAS = 0x2003, - - /// The maximum number of instances (over all build inputs) as input to a single - /// Instance Acceleration Structure (IAS). sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_LIMIT_MAX_INSTANCES_PER_IAS = 0x2004, - - /// The RT core version supported by the device (0 for no support, 10 for version - /// 1.0). sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_RTCORE_VERSION = 0x2005, - - /// The maximum value for #OptixInstance::instanceId. sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_LIMIT_MAX_INSTANCE_ID = 0x2006, - - /// The number of bits available for the #OptixInstance::visibilityMask. - /// Higher bits must be set to zero. sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_LIMIT_NUM_BITS_INSTANCE_VISIBILITY_MASK = 0x2007, - - /// The maximum number of instances that can be added to a single Instance - /// Acceleration Structure (IAS). sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_LIMIT_MAX_SBT_RECORDS_PER_GAS = 0x2008, - - /// The maximum summed value of #OptixInstance::sbtOffset. - /// Also the maximum summed value of sbt offsets of all ancestor - /// instances of a GAS in a traversable graph. sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_LIMIT_MAX_SBT_OFFSET = 0x2009, - - /// Returns a flag specifying capabilities of the optixReorder() device function. See - /// OptixDevicePropertyShaderExecutionReorderingFlags for documentation on the values - /// that can be returned. sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_SHADER_EXECUTION_REORDERING = 0x200A, - - /// Returns a flag specifying whether cooperative vector support is enabled for this - /// device. See OptixDevicePropertyCoopVecFlags for documentation on the values that - /// can be returned. sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_COOP_VEC = 0x200B, - - /// Returns a flag specifying support for cluster acceleration structure builds. See - /// OptixDevicePropertyClusterAccelFlags for documentation on the values - /// that can be returned. sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_CLUSTER_ACCEL = 0x2020, - - /// Returns a maximum unique vertices per cluster in a cluster acceleration structure (CLAS) build. - /// sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_LIMIT_MAX_CLUSTER_VERTICES = 0x2021, - - /// Returns a maximum triangles per cluster in a cluster acceleration structure (CLAS) build. - /// sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_LIMIT_MAX_CLUSTER_TRIANGLES = 0x2022, - - /// Returns a maximum resolution per cluster in a structured cluster - /// acceleration (CLAS) structure build. sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_LIMIT_MAX_STRUCTURED_GRID_RESOLUTION = 0x2023, - - /// Returns a maximum sbt index allowed in a cluster acceleration structure (CLAS) build. - /// sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_LIMIT_MAX_CLUSTER_SBT_INDEX = 0x2024, - - /// Returns the maximum number of clusters (CLAS) as input to a single - /// Geometry Acceleration Structure (GAS). sizeof( unsigned int ) - OPTIX_DEVICE_PROPERTY_LIMIT_MAX_CLUSTERS_PER_GAS = 0x2025, -} OptixDeviceProperty; - -/// Type of the callback function used for log messages. -/// -/// \param[in] level The log level indicates the severity of the message. See below for -/// possible values. -/// \param[in] tag A terse message category description (e.g., 'SCENE STAT'). -/// \param[in] message Null terminated log message (without newline at the end). -/// \param[in] cbdata Callback data that was provided with the callback pointer. -/// -/// It is the users responsibility to ensure thread safety within this function. -/// -/// The following log levels are defined. -/// -/// 0 disable Setting the callback level will disable all messages. The callback -/// function will not be called in this case. -/// 1 fatal A non-recoverable error. The context and/or OptiX itself might no longer -/// be in a usable state. -/// 2 error A recoverable error, e.g., when passing invalid call parameters. -/// 3 warning Hints that OptiX might not behave exactly as requested by the user or -/// may perform slower than expected. -/// 4 print Status or progress messages. -/// -/// Higher levels might occur. -/// -/// \see #optixDeviceContextSetLogCallback(), #OptixDeviceContextOptions -typedef void ( *OptixLogCallback )( unsigned int level, const char* tag, const char* message, void* cbdata ); - -/// Validation mode settings. -/// -/// When enabled, certain device code utilities will be enabled to provide as good debug and -/// error checking facilities as possible. -/// -/// -/// \see #optixDeviceContextCreate() -typedef enum OptixDeviceContextValidationMode -{ - OPTIX_DEVICE_CONTEXT_VALIDATION_MODE_OFF = 0, - OPTIX_DEVICE_CONTEXT_VALIDATION_MODE_ALL = 0xFFFFFFFF -} OptixDeviceContextValidationMode; - -/// Parameters used for #optixDeviceContextCreate() -/// -/// \see #optixDeviceContextCreate() -typedef struct OptixDeviceContextOptions -{ - /// Function pointer used when OptiX wishes to generate messages - OptixLogCallback logCallbackFunction; - /// Pointer stored and passed to logCallbackFunction when a message is generated - void* logCallbackData; - /// Maximum callback level to generate message for (see #OptixLogCallback) - int logCallbackLevel; - /// Validation mode of context. - OptixDeviceContextValidationMode validationMode; -} OptixDeviceContextOptions; - -/// Flags used to interpret the source and target of memory copies when using -/// #optixPipelineSymbolMemcpyAsync() -/// -/// \see #optixPipelineSymbolMemcpyAsync() -typedef enum OptixPipelineSymbolMemcpyKind -{ - OPTIX_PIPELINE_SYMBOL_MEMCPY_KIND_FROM_DEVICE = 0x21A0, - OPTIX_PIPELINE_SYMBOL_MEMCPY_KIND_FROM_HOST = 0x21A1, - OPTIX_PIPELINE_SYMBOL_MEMCPY_KIND_TO_DEVICE = 0x21A2, - OPTIX_PIPELINE_SYMBOL_MEMCPY_KIND_TO_HOST = 0x21A3, -} OptixPipelineSymbolMemcpyKind; - -/// Flags used to interpret the result of #optixDeviceContextGetProperty() and -/// OPTIX_DEVICE_PROPERTY_SHADER_EXECUTION_REORDERING -/// -/// \see #optixDeviceContextGetProperty() -typedef enum OptixDevicePropertyShaderExecutionReorderingFlags -{ - /// optixReorder() acts as a no-op, and no thread reordering is performed. Note that - /// it is still legal to call this device function; no errors will be generated. - OPTIX_DEVICE_PROPERTY_SHADER_EXECUTION_REORDERING_FLAG_NONE = 0, - - // Standard thread reordering is supported - OPTIX_DEVICE_PROPERTY_SHADER_EXECUTION_REORDERING_FLAG_STANDARD = 1 << 0, -} OptixDevicePropertyShaderExecutionReorderingFlags; - -/// Flags used to interpret the result of #optixDeviceContextGetProperty() and -/// OPTIX_DEVICE_PROPERTY_CLUSTER_ACCEL -/// -/// \see #optixDeviceContextGetProperty() -typedef enum OptixDevicePropertyClusterAccelFlags -{ - /// Cluster acceleration structure builds are not supported. - OPTIX_DEVICE_PROPERTY_CLUSTER_ACCEL_FLAG_NONE = 0, - - // Cluster acceleration structure builds are supported. - OPTIX_DEVICE_PROPERTY_CLUSTER_ACCEL_FLAG_STANDARD = 1 << 0, -} OptixDevicePropertyClusterAccelFlags; - -/// Flags used by #OptixBuildInputTriangleArray::flags, -/// #OptixBuildInputSphereArray::flags -/// and #OptixBuildInputCustomPrimitiveArray::flags -typedef enum OptixGeometryFlags -{ - /// No flags set - OPTIX_GEOMETRY_FLAG_NONE = 0, - - /// Disables the invocation of the anyhit program. - /// Can be overridden by OPTIX_INSTANCE_FLAG_ENFORCE_ANYHIT and OPTIX_RAY_FLAG_ENFORCE_ANYHIT. - OPTIX_GEOMETRY_FLAG_DISABLE_ANYHIT = 1u << 0, - - /// If set, an intersection with the primitive will trigger one and only one - /// invocation of the anyhit program. Otherwise, the anyhit program may be invoked - /// more than once. - OPTIX_GEOMETRY_FLAG_REQUIRE_SINGLE_ANYHIT_CALL = 1u << 1, - - /// Prevent triangles from getting culled due to their orientation. - /// Effectively ignores ray flags - /// OPTIX_RAY_FLAG_CULL_BACK_FACING_TRIANGLES and OPTIX_RAY_FLAG_CULL_FRONT_FACING_TRIANGLES. - OPTIX_GEOMETRY_FLAG_DISABLE_TRIANGLE_FACE_CULLING = 1u << 2, -} OptixGeometryFlags; - -/// Legacy type: A subset of the hit kinds for built-in primitive intersections. -/// It is preferred to use optixGetPrimitiveType(), together with -/// optixIsFrontFaceHit() or optixIsBackFaceHit(). -/// -/// \see #optixGetHitKind() -typedef enum OptixHitKind -{ - /// Ray hit the triangle on the front face - OPTIX_HIT_KIND_TRIANGLE_FRONT_FACE = 0xFE, - /// Ray hit the triangle on the back face - OPTIX_HIT_KIND_TRIANGLE_BACK_FACE = 0xFF -} OptixHitKind; - -/// Format of indices used int #OptixBuildInputTriangleArray::indexFormat. -typedef enum OptixIndicesFormat -{ - /// No indices, this format must only be used in combination with triangle soups, i.e., numIndexTriplets must be zero - OPTIX_INDICES_FORMAT_NONE = 0, - /// Three bytes - OPTIX_INDICES_FORMAT_UNSIGNED_BYTE3 = 0x2101, - /// Three shorts - OPTIX_INDICES_FORMAT_UNSIGNED_SHORT3 = 0x2102, - /// Three ints - OPTIX_INDICES_FORMAT_UNSIGNED_INT3 = 0x2103 -} OptixIndicesFormat; - -/// Format of vertices used in #OptixBuildInputTriangleArray::vertexFormat. -typedef enum OptixVertexFormat -{ - OPTIX_VERTEX_FORMAT_NONE = 0, ///< No vertices - OPTIX_VERTEX_FORMAT_FLOAT3 = 0x2121, ///< Vertices are represented by three floats - OPTIX_VERTEX_FORMAT_FLOAT2 = 0x2122, ///< Vertices are represented by two floats - OPTIX_VERTEX_FORMAT_HALF3 = 0x2123, ///< Vertices are represented by three halfs - OPTIX_VERTEX_FORMAT_HALF2 = 0x2124, ///< Vertices are represented by two halfs - OPTIX_VERTEX_FORMAT_SNORM16_3 = 0x2125, - OPTIX_VERTEX_FORMAT_SNORM16_2 = 0x2126 -} OptixVertexFormat; - -/// Format of transform used in #OptixBuildInputTriangleArray::transformFormat. -typedef enum OptixTransformFormat -{ - OPTIX_TRANSFORM_FORMAT_NONE = 0, ///< no transform, default for zero initialization - OPTIX_TRANSFORM_FORMAT_MATRIX_FLOAT12 = 0x21E1, ///< 3x4 row major affine matrix -} OptixTransformFormat; - -/// Specifies whether to use a 2- or 4-state opacity micromap format. -typedef enum OptixOpacityMicromapFormat -{ - /// invalid format - OPTIX_OPACITY_MICROMAP_FORMAT_NONE = 0, - /// 0: Transparent, 1: Opaque - OPTIX_OPACITY_MICROMAP_FORMAT_2_STATE = 1, - /// 0: Transparent, 1: Opaque, 2: Unknown-Transparent, 3: Unknown-Opaque - OPTIX_OPACITY_MICROMAP_FORMAT_4_STATE = 2, -} OptixOpacityMicromapFormat; - -/// indexing mode of triangles to opacity micromaps in an array, used in #OptixBuildInputOpacityMicromap. -typedef enum OptixOpacityMicromapArrayIndexingMode -{ - /// No opacity micromap is used - OPTIX_OPACITY_MICROMAP_ARRAY_INDEXING_MODE_NONE = 0, - /// An implicit linear mapping of triangles to opacity micromaps in the - /// opacity micromap array is used. triangle[i] will use opacityMicromapArray[i]. - OPTIX_OPACITY_MICROMAP_ARRAY_INDEXING_MODE_LINEAR = 1, - /// OptixBuildInputOpacityMicromap::indexBuffer provides a per triangle array of predefined indices - /// and/or indices into OptixBuildInputOpacityMicromap::opacityMicromapArray. - /// See OptixBuildInputOpacityMicromap::indexBuffer for more details. - OPTIX_OPACITY_MICROMAP_ARRAY_INDEXING_MODE_INDEXED = 2, -} OptixOpacityMicromapArrayIndexingMode; - -/// Opacity micromap usage count for acceleration structure builds. -/// Specifies how many opacity micromaps of a specific type are referenced by triangles when building the AS. -/// Note that while this is similar to OptixOpacityMicromapHistogramEntry, the usage count specifies how many opacity micromaps -/// of a specific type are referenced by triangles in the AS. -typedef struct OptixOpacityMicromapUsageCount -{ - /// Number of opacity micromaps with this format and subdivision level referenced by triangles in the corresponding - /// triangle build input at AS build time. - unsigned int count; - /// Number of micro-triangles is 4^level. Valid levels are [0, 12] - unsigned int subdivisionLevel; - /// opacity micromap format. - OptixOpacityMicromapFormat format; -} OptixOpacityMicromapUsageCount; - -typedef struct OptixBuildInputOpacityMicromap -{ - /// Indexing mode of triangle to opacity micromap array mapping. - OptixOpacityMicromapArrayIndexingMode indexingMode; - - /// Device pointer to a opacity micromap array used by this build input array. - /// This buffer is required when #OptixBuildInputOpacityMicromap::indexingMode is - /// OPTIX_OPACITY_MICROMAP_ARRAY_INDEXING_MODE_LINEAR or OPTIX_OPACITY_MICROMAP_ARRAY_INDEXING_MODE_INDEXED. - /// Must be zero if #OptixBuildInputOpacityMicromap::indexingMode is OPTIX_OPACITY_MICROMAP_ARRAY_INDEXING_MODE_NONE. - CUdeviceptr opacityMicromapArray; - - /// int16 or int32 buffer specifying which opacity micromap index to use for each triangle. - /// Instead of an actual index, one of the predefined indices - /// OPTIX_OPACITY_MICROMAP_PREDEFINED_INDEX_(FULLY_TRANSPARENT | FULLY_OPAQUE | FULLY_UNKNOWN_TRANSPARENT | FULLY_UNKNOWN_OPAQUE) - /// can be used to indicate that there is no opacity micromap for this particular triangle - /// but the triangle is in a uniform state and the selected behavior is applied - /// to the entire triangle. - /// This buffer is required when #OptixBuildInputOpacityMicromap::indexingMode is OPTIX_OPACITY_MICROMAP_ARRAY_INDEXING_MODE_INDEXED. - /// Must be zero if #OptixBuildInputOpacityMicromap::indexingMode is - /// OPTIX_OPACITY_MICROMAP_ARRAY_INDEXING_MODE_LINEAR or OPTIX_OPACITY_MICROMAP_ARRAY_INDEXING_MODE_NONE. - CUdeviceptr indexBuffer; - - /// 0, 2 or 4 (unused, 16 or 32 bit) - /// Must be non-zero when #OptixBuildInputOpacityMicromap::indexingMode is OPTIX_OPACITY_MICROMAP_ARRAY_INDEXING_MODE_INDEXED. - unsigned int indexSizeInBytes; - - /// Opacity micromap index buffer stride. If set to zero, indices are assumed to be tightly - /// packed and stride is inferred from #OptixBuildInputOpacityMicromap::indexSizeInBytes. - unsigned int indexStrideInBytes; - - /// Constant offset to non-negative opacity micromap indices - unsigned int indexOffset; - - /// Number of OptixOpacityMicromapUsageCount. - unsigned int numMicromapUsageCounts; - /// List of number of usages of opacity micromaps of format and subdivision combinations. - /// Counts with equal format and subdivision combination (duplicates) are added together. - const OptixOpacityMicromapUsageCount* micromapUsageCounts; -} OptixBuildInputOpacityMicromap; - -typedef struct OptixRelocateInputOpacityMicromap -{ - /// Device pointer to a relocated opacity micromap array used by the source build input array. - /// May be zero when no micromaps where used in the source accel, or the referenced opacity - /// micromaps don't require relocation (for example relocation of a GAS on the source device). - CUdeviceptr opacityMicromapArray; -} OptixRelocateInputOpacityMicromap; - - - -/// Triangle inputs -/// -/// \see #OptixBuildInput::triangleArray -typedef struct OptixBuildInputTriangleArray -{ - /// Points to host array of device pointers, one per motion step. Host array size must match the number of - /// motion keys as set in #OptixMotionOptions (or an array of size 1 if OptixMotionOptions::numKeys is set - /// to 0 or 1). Each per motion key device pointer must point to an array of vertices of the - /// triangles in the format as described by vertexFormat. The minimum alignment must match the natural - /// alignment of the type as specified in the vertexFormat, i.e., for OPTIX_VERTEX_FORMAT_FLOATX 4-byte, - /// for all others a 2-byte alignment. However, an 16-byte stride (and buffer alignment) is recommended for - /// vertices of format OPTIX_VERTEX_FORMAT_FLOAT3 for GAS build performance. - const CUdeviceptr* vertexBuffers; - - /// Number of vertices in each of buffer in OptixBuildInputTriangleArray::vertexBuffers. - unsigned int numVertices; - - /// \see #OptixVertexFormat - OptixVertexFormat vertexFormat; - - /// Stride between vertices. If set to zero, vertices are assumed to be tightly - /// packed and stride is inferred from vertexFormat. - unsigned int vertexStrideInBytes; - - /// Optional pointer to array of 16 or 32-bit int triplets, one triplet per triangle. - /// The minimum alignment must match the natural alignment of the type as specified in the indexFormat, i.e., - /// for OPTIX_INDICES_FORMAT_UNSIGNED_INT3 4-byte and for OPTIX_INDICES_FORMAT_UNSIGNED_SHORT3 a 2-byte alignment. - CUdeviceptr indexBuffer; - - /// Size of array in OptixBuildInputTriangleArray::indexBuffer. For build, needs to be zero if indexBuffer is \c nullptr. - unsigned int numIndexTriplets; - - /// \see #OptixIndicesFormat - OptixIndicesFormat indexFormat; - - /// Stride between triplets of indices. If set to zero, indices are assumed to be tightly - /// packed and stride is inferred from indexFormat. - unsigned int indexStrideInBytes; - - /// Optional pointer to array of floats - /// representing a 3x4 row major affine - /// transformation matrix. This pointer must be a multiple of OPTIX_GEOMETRY_TRANSFORM_BYTE_ALIGNMENT - CUdeviceptr preTransform; - - /// Array of flags, to specify flags per sbt record, - /// combinations of OptixGeometryFlags describing the - /// primitive behavior, size must match numSbtRecords - const unsigned int* flags; - - /// Number of sbt records available to the sbt index offset override. - unsigned int numSbtRecords; - - /// Device pointer to per-primitive local sbt index offset buffer. May be NULL. - /// Every entry must be in range [0,numSbtRecords-1]. - /// Size needs to be the number of primitives. - CUdeviceptr sbtIndexOffsetBuffer; - - /// Size of type of the sbt index offset. Needs to be 0, 1, 2 or 4 (8, 16 or 32 bit). - unsigned int sbtIndexOffsetSizeInBytes; - - /// Stride between the index offsets. If set to zero, the offsets are assumed to be tightly - /// packed and the stride matches the size of the type (sbtIndexOffsetSizeInBytes). - unsigned int sbtIndexOffsetStrideInBytes; - - /// Primitive index bias, applied in optixGetPrimitiveIndex(). - /// Sum of primitiveIndexOffset and number of triangles must not overflow 32bits. - unsigned int primitiveIndexOffset; - - /// \see #OptixTransformFormat - OptixTransformFormat transformFormat; - - /// Optional opacity micromap inputs. - OptixBuildInputOpacityMicromap opacityMicromap; - -} OptixBuildInputTriangleArray; - -/// Triangle inputs -/// -/// \see #OptixRelocateInput::triangleArray -typedef struct OptixRelocateInputTriangleArray -{ - /// Number of sbt records available to the sbt index offset override. - /// Must match #OptixBuildInputTriangleArray::numSbtRecords of the source build input. - unsigned int numSbtRecords; - - /// Opacity micromap inputs. - OptixRelocateInputOpacityMicromap opacityMicromap; -} OptixRelocateInputTriangleArray; - -/// Builtin primitive types -/// -typedef enum OptixPrimitiveType -{ - /// Custom primitive. - OPTIX_PRIMITIVE_TYPE_CUSTOM = 0x2500, - /// B-spline curve of degree 2 with circular cross-section. - OPTIX_PRIMITIVE_TYPE_ROUND_QUADRATIC_BSPLINE = 0x2501, - /// B-spline curve of degree 3 with circular cross-section. - OPTIX_PRIMITIVE_TYPE_ROUND_CUBIC_BSPLINE = 0x2502, - /// Piecewise linear curve with circular cross-section. - OPTIX_PRIMITIVE_TYPE_ROUND_LINEAR = 0x2503, - /// CatmullRom curve with circular cross-section. - OPTIX_PRIMITIVE_TYPE_ROUND_CATMULLROM = 0x2504, - /// B-spline curve of degree 2 with oriented, flat cross-section. - OPTIX_PRIMITIVE_TYPE_FLAT_QUADRATIC_BSPLINE = 0x2505, - /// Sphere. - OPTIX_PRIMITIVE_TYPE_SPHERE = 0x2506, - /// Bezier curve of degree 3 with circular cross-section. - OPTIX_PRIMITIVE_TYPE_ROUND_CUBIC_BEZIER = 0x2507, - /// B-spline curve of degree 2 with circular cross-section, using rocaps intersection. - OPTIX_PRIMITIVE_TYPE_ROUND_QUADRATIC_BSPLINE_ROCAPS = 0x2508, - /// B-spline curve of degree 3 with circular cross-section, using rocaps intersection. - OPTIX_PRIMITIVE_TYPE_ROUND_CUBIC_BSPLINE_ROCAPS = 0x2509, - /// CatmullRom curve with circular cross-section, using rocaps intersection. - OPTIX_PRIMITIVE_TYPE_ROUND_CATMULLROM_ROCAPS = 0x250A, - /// Bezier curve of degree 3 with circular cross-section, using rocaps intersection. - OPTIX_PRIMITIVE_TYPE_ROUND_CUBIC_BEZIER_ROCAPS = 0x250B, - /// Triangle. - OPTIX_PRIMITIVE_TYPE_TRIANGLE = 0x2531, -} OptixPrimitiveType; - -/// Builtin flags may be bitwise combined. -/// -/// \see #OptixPipelineCompileOptions::usesPrimitiveTypeFlags -typedef enum OptixPrimitiveTypeFlags -{ - /// Custom primitive. - OPTIX_PRIMITIVE_TYPE_FLAGS_CUSTOM = 1 << 0, - /// B-spline curve of degree 2 with circular cross-section. - OPTIX_PRIMITIVE_TYPE_FLAGS_ROUND_QUADRATIC_BSPLINE = 1 << 1, - /// B-spline curve of degree 3 with circular cross-section. - OPTIX_PRIMITIVE_TYPE_FLAGS_ROUND_CUBIC_BSPLINE = 1 << 2, - /// Piecewise linear curve with circular cross-section. - OPTIX_PRIMITIVE_TYPE_FLAGS_ROUND_LINEAR = 1 << 3, - /// CatmullRom curve with circular cross-section. - OPTIX_PRIMITIVE_TYPE_FLAGS_ROUND_CATMULLROM = 1 << 4, - /// B-spline curve of degree 2 with oriented, flat cross-section. - OPTIX_PRIMITIVE_TYPE_FLAGS_FLAT_QUADRATIC_BSPLINE = 1 << 5, - /// Sphere. - OPTIX_PRIMITIVE_TYPE_FLAGS_SPHERE = 1 << 6, - /// Bezier curve of degree 3 with circular cross-section. - OPTIX_PRIMITIVE_TYPE_FLAGS_ROUND_CUBIC_BEZIER = 1 << 7, - /// B-spline curve of degree 2 with circular cross-section, using rocaps intersection. - OPTIX_PRIMITIVE_TYPE_FLAGS_ROUND_QUADRATIC_BSPLINE_ROCAPS = 1 << 8, - /// B-spline curve of degree 3 with circular cross-section, using rocaps intersection. - OPTIX_PRIMITIVE_TYPE_FLAGS_ROUND_CUBIC_BSPLINE_ROCAPS = 1 << 9, - /// CatmullRom curve with circular cross-section, using rocaps intersection. - OPTIX_PRIMITIVE_TYPE_FLAGS_ROUND_CATMULLROM_ROCAPS = 1 << 10, - /// Bezier curve of degree 3 with circular cross-section, using rocaps intersection. - OPTIX_PRIMITIVE_TYPE_FLAGS_ROUND_CUBIC_BEZIER_ROCAPS = 1 << 11, - /// Triangle. - OPTIX_PRIMITIVE_TYPE_FLAGS_TRIANGLE = 1 << 31, -} OptixPrimitiveTypeFlags; - -/// Curve end cap types, for non-linear curves -/// -typedef enum OptixCurveEndcapFlags -{ - /// Default end caps. Round end caps for linear, no end caps for quadratic/cubic. - OPTIX_CURVE_ENDCAP_DEFAULT = 0, - /// Flat end caps at both ends of quadratic/cubic curve segments. Not valid for linear. - OPTIX_CURVE_ENDCAP_ON = 1 << 0, -} OptixCurveEndcapFlags; - -/// Curve inputs -/// -/// A curve is a swept surface defined by a 3D spline curve and a varying width (radius). A curve (or "strand") of -/// degree d (3=cubic, 2=quadratic, 1=linear) is represented by N > d vertices and N width values, and comprises N - d segments. -/// Each segment is defined by d+1 consecutive vertices. Each curve may have a different number of vertices. -/// -/// OptiX describes the curve array as a list of curve segments. The primitive id is the segment number. -/// It is the user's responsibility to maintain a mapping between curves and curve segments. -/// Each index buffer entry i = indexBuffer[primid] specifies the start of a curve segment, -/// represented by d+1 consecutive vertices in the vertex buffer, -/// and d+1 consecutive widths in the width buffer. Width is interpolated the same -/// way vertices are interpolated, that is, using the curve basis. -/// -/// Each curves build input has only one SBT record. -/// To create curves with different materials in the same BVH, use multiple build inputs. -/// -/// \see #OptixBuildInput::curveArray -typedef struct OptixBuildInputCurveArray -{ - /// Curve degree and basis - /// \see #OptixPrimitiveType - OptixPrimitiveType curveType; - /// Number of primitives. Each primitive is a polynomial curve segment. - unsigned int numPrimitives; - - /// Pointer to host array of device pointers, one per motion step. Host array size must match number of - /// motion keys as set in #OptixMotionOptions (or an array of size 1 if OptixMotionOptions::numKeys is set - /// to 1). Each per-motion-key device pointer must point to an array of floats (the vertices of the - /// curves). - const CUdeviceptr* vertexBuffers; - /// Number of vertices in each buffer in vertexBuffers. - unsigned int numVertices; - /// Stride between vertices. If set to zero, vertices are assumed to be tightly - /// packed and stride is sizeof( float3 ). - unsigned int vertexStrideInBytes; - - /// Parallel to vertexBuffers: a device pointer per motion step, each with numVertices float values, - /// specifying the curve width (radius) corresponding to each vertex. - const CUdeviceptr* widthBuffers; - /// Stride between widths. If set to zero, widths are assumed to be tightly - /// packed and stride is sizeof( float ). - unsigned int widthStrideInBytes; - - /// Reserved for future use. - const CUdeviceptr* normalBuffers; - /// Reserved for future use. - unsigned int normalStrideInBytes; - - /// Device pointer to array of unsigned ints, one per curve segment. - /// This buffer is required (unlike for OptixBuildInputTriangleArray). - /// Each index is the start of degree+1 consecutive vertices in vertexBuffers, - /// and corresponding widths in widthBuffers and normals in normalBuffers. - /// These define a single segment. Size of array is numPrimitives. - CUdeviceptr indexBuffer; - /// Stride between indices. If set to zero, indices are assumed to be tightly - /// packed and stride is sizeof( unsigned int ). - unsigned int indexStrideInBytes; - - /// Combination of OptixGeometryFlags describing the - /// primitive behavior. - unsigned int flag; - - /// Primitive index bias, applied in optixGetPrimitiveIndex(). - /// Sum of primitiveIndexOffset and number of primitives must not overflow 32bits. - unsigned int primitiveIndexOffset; - - /// End cap flags, see OptixCurveEndcapFlags - unsigned int endcapFlags; -} OptixBuildInputCurveArray; - -/// Sphere inputs -/// -/// A sphere is defined by a center point and a radius. -/// Each center point is represented by a vertex in the vertex buffer. -/// There is either a single radius for all spheres, or the radii are represented by entries in the radius buffer. -/// -/// The vertex buffers and radius buffers point to a host array of device pointers, one per motion step. -/// Host array size must match the number of motion keys as set in #OptixMotionOptions (or an array of size 1 if OptixMotionOptions::numKeys is set -/// to 0 or 1). Each per motion key device pointer must point to an array of vertices corresponding to the center points of the spheres, or -/// an array of 1 or N radii. Format OPTIX_VERTEX_FORMAT_FLOAT3 is used for vertices, OPTIX_VERTEX_FORMAT_FLOAT for radii. -/// -/// \see #OptixBuildInput::sphereArray -typedef struct OptixBuildInputSphereArray -{ - /// Pointer to host array of device pointers, one per motion step. Host array size must match number of - /// motion keys as set in #OptixMotionOptions (or an array of size 1 if OptixMotionOptions::numKeys is set - /// to 1). Each per-motion-key device pointer must point to an array of floats (the center points of - /// the spheres). - const CUdeviceptr* vertexBuffers; - - /// Stride between vertices. If set to zero, vertices are assumed to be tightly - /// packed and stride is sizeof( float3 ). - unsigned int vertexStrideInBytes; - /// Number of vertices in each buffer in vertexBuffers. - unsigned int numVertices; - - /// Parallel to vertexBuffers: a device pointer per motion step, each with numRadii float values, - /// specifying the sphere radius corresponding to each vertex. - const CUdeviceptr* radiusBuffers; - /// Stride between radii. If set to zero, widths are assumed to be tightly - /// packed and stride is sizeof( float ). - unsigned int radiusStrideInBytes; - /// Boolean value indicating whether a single radius per radius buffer is used, - /// or the number of radii in radiusBuffers equals numVertices. - int singleRadius; - - /// Array of flags, to specify flags per sbt record, - /// combinations of OptixGeometryFlags describing the - /// primitive behavior, size must match numSbtRecords - const unsigned int* flags; - - /// Number of sbt records available to the sbt index offset override. - unsigned int numSbtRecords; - /// Device pointer to per-primitive local sbt index offset buffer. May be NULL. - /// Every entry must be in range [0,numSbtRecords-1]. - /// Size needs to be the number of primitives. - CUdeviceptr sbtIndexOffsetBuffer; - /// Size of type of the sbt index offset. Needs to be 0, 1, 2 or 4 (8, 16 or 32 bit). - unsigned int sbtIndexOffsetSizeInBytes; - /// Stride between the sbt index offsets. If set to zero, the offsets are assumed to be tightly - /// packed and the stride matches the size of the type (sbtIndexOffsetSizeInBytes). - unsigned int sbtIndexOffsetStrideInBytes; - - /// Primitive index bias, applied in optixGetPrimitiveIndex(). - /// Sum of primitiveIndexOffset and number of primitives must not overflow 32bits. - unsigned int primitiveIndexOffset; -} OptixBuildInputSphereArray; - -/// AABB inputs -typedef struct OptixAabb -{ - float minX; ///< Lower extent in X direction. - float minY; ///< Lower extent in Y direction. - float minZ; ///< Lower extent in Z direction. - float maxX; ///< Upper extent in X direction. - float maxY; ///< Upper extent in Y direction. - float maxZ; ///< Upper extent in Z direction. -} OptixAabb; - -/// Custom primitive inputs -/// -/// \see #OptixBuildInput::customPrimitiveArray -typedef struct OptixBuildInputCustomPrimitiveArray -{ - /// Points to host array of device pointers to AABBs (type OptixAabb), one per motion step. - /// Host array size must match number of motion keys as set in OptixMotionOptions (or an array of size 1 - /// if OptixMotionOptions::numKeys is set to 1). - /// Each device pointer must be a multiple of OPTIX_AABB_BUFFER_BYTE_ALIGNMENT. - const CUdeviceptr* aabbBuffers; - - /// Number of primitives in each buffer (i.e., per motion step) in - /// #OptixBuildInputCustomPrimitiveArray::aabbBuffers. - unsigned int numPrimitives; - - /// Stride between AABBs (per motion key). If set to zero, the aabbs are assumed to be tightly - /// packed and the stride is assumed to be sizeof( OptixAabb ). - /// If non-zero, the value must be a multiple of OPTIX_AABB_BUFFER_BYTE_ALIGNMENT. - unsigned int strideInBytes; - - /// Array of flags, to specify flags per sbt record, - /// combinations of OptixGeometryFlags describing the - /// primitive behavior, size must match numSbtRecords - const unsigned int* flags; - - /// Number of sbt records available to the sbt index offset override. - unsigned int numSbtRecords; - - /// Device pointer to per-primitive local sbt index offset buffer. May be NULL. - /// Every entry must be in range [0,numSbtRecords-1]. - /// Size needs to be the number of primitives. - CUdeviceptr sbtIndexOffsetBuffer; - - /// Size of type of the sbt index offset. Needs to be 0, 1, 2 or 4 (8, 16 or 32 bit). - unsigned int sbtIndexOffsetSizeInBytes; - - /// Stride between the index offsets. If set to zero, the offsets are assumed to be tightly - /// packed and the stride matches the size of the type (sbtIndexOffsetSizeInBytes). - unsigned int sbtIndexOffsetStrideInBytes; - - /// Primitive index bias, applied in optixGetPrimitiveIndex(). - /// Sum of primitiveIndexOffset and number of primitive must not overflow 32bits. - unsigned int primitiveIndexOffset; -} OptixBuildInputCustomPrimitiveArray; - -/// Instance and instance pointer inputs -/// -/// \see #OptixBuildInput::instanceArray -typedef struct OptixBuildInputInstanceArray -{ - /// If OptixBuildInput::type is OPTIX_BUILD_INPUT_TYPE_INSTANCE_POINTERS instances and - /// aabbs should be interpreted as arrays of pointers instead of arrays of structs. - /// - /// This pointer must be a multiple of OPTIX_INSTANCE_BYTE_ALIGNMENT if - /// OptixBuildInput::type is OPTIX_BUILD_INPUT_TYPE_INSTANCES. The array elements must - /// be a multiple of OPTIX_INSTANCE_BYTE_ALIGNMENT if OptixBuildInput::type is - /// OPTIX_BUILD_INPUT_TYPE_INSTANCE_POINTERS. - CUdeviceptr instances; - - /// Number of elements in #OptixBuildInputInstanceArray::instances. - unsigned int numInstances; - - /// Only valid for OPTIX_BUILD_INPUT_TYPE_INSTANCE - /// Defines the stride between instances. A stride of 0 indicates a tight packing, i.e., - /// stride = sizeof( OptixInstance ) - unsigned int instanceStride; -} OptixBuildInputInstanceArray; - -/// Instance and instance pointer inputs -/// -/// \see #OptixRelocateInput::instanceArray -typedef struct OptixRelocateInputInstanceArray -{ - /// Number of elements in #OptixRelocateInputInstanceArray::traversableHandles. - /// Must match #OptixBuildInputInstanceArray::numInstances of the source build input. - unsigned int numInstances; - - /// These are the traversable handles of the instances (See OptixInstance::traversableHandle) - /// These can be used when also relocating the instances. No updates to - /// the bounds are performed. Use optixAccelBuild to update the bounds. - /// 'traversableHandles' may be zero when the traversables are not relocated - /// (i.e. relocation of an IAS on the source device). - CUdeviceptr traversableHandles; - -} OptixRelocateInputInstanceArray; - -/// Enum to distinguish the different build input types. -/// -/// \see #OptixBuildInput::type -typedef enum OptixBuildInputType -{ - /// Triangle inputs. \see #OptixBuildInputTriangleArray - OPTIX_BUILD_INPUT_TYPE_TRIANGLES = 0x2141, - /// Custom primitive inputs. \see #OptixBuildInputCustomPrimitiveArray - OPTIX_BUILD_INPUT_TYPE_CUSTOM_PRIMITIVES = 0x2142, - /// Instance inputs. \see #OptixBuildInputInstanceArray - OPTIX_BUILD_INPUT_TYPE_INSTANCES = 0x2143, - /// Instance pointer inputs. \see #OptixBuildInputInstanceArray - OPTIX_BUILD_INPUT_TYPE_INSTANCE_POINTERS = 0x2144, - /// Curve inputs. \see #OptixBuildInputCurveArray - OPTIX_BUILD_INPUT_TYPE_CURVES = 0x2145, - /// Sphere inputs. \see #OptixBuildInputSphereArray - OPTIX_BUILD_INPUT_TYPE_SPHERES = 0x2146 -} OptixBuildInputType; - -/// Build inputs. -/// -/// All of them support motion and the size of the data arrays needs to match the number of motion steps -/// -/// \see #optixAccelComputeMemoryUsage(), #optixAccelBuild() -typedef struct OptixBuildInput -{ - /// The type of the build input. - OptixBuildInputType type; - - union - { - char pad[1024]; - /// Triangle inputs. - OptixBuildInputTriangleArray triangleArray; - /// Curve inputs. - OptixBuildInputCurveArray curveArray; - /// Sphere inputs. - OptixBuildInputSphereArray sphereArray; - /// Custom primitive inputs. - OptixBuildInputCustomPrimitiveArray customPrimitiveArray; - /// Instance and instance pointer inputs. - OptixBuildInputInstanceArray instanceArray; - }; -} OptixBuildInput; - -/// Relocation inputs. -/// -/// \see #optixAccelRelocate() -typedef struct OptixRelocateInput -{ - /// The type of the build input to relocate. - OptixBuildInputType type; - - union - { - /// Instance and instance pointer inputs. - OptixRelocateInputInstanceArray instanceArray; - - /// Triangle inputs. - OptixRelocateInputTriangleArray triangleArray; - - /// Inputs of any of the other types don't require any relocation data. - }; -} OptixRelocateInput; - -/// Flags set on the #OptixInstance::flags. -/// -/// These can be or'ed together to combine multiple flags. -typedef enum OptixInstanceFlags -{ - /// No special flag set - OPTIX_INSTANCE_FLAG_NONE = 0, - - /// Prevent triangles from getting culled due to their orientation. - /// Effectively ignores ray flags - /// OPTIX_RAY_FLAG_CULL_BACK_FACING_TRIANGLES and OPTIX_RAY_FLAG_CULL_FRONT_FACING_TRIANGLES. - OPTIX_INSTANCE_FLAG_DISABLE_TRIANGLE_FACE_CULLING = 1u << 0, - - /// Flip triangle orientation. - /// This affects front/backface culling as well as the reported face in case of a hit. - OPTIX_INSTANCE_FLAG_FLIP_TRIANGLE_FACING = 1u << 1, - - /// Disable anyhit programs for all geometries of the instance. - /// Can be overridden by OPTIX_RAY_FLAG_ENFORCE_ANYHIT. - /// This flag is mutually exclusive with OPTIX_INSTANCE_FLAG_ENFORCE_ANYHIT. - OPTIX_INSTANCE_FLAG_DISABLE_ANYHIT = 1u << 2, - - /// Enables anyhit programs for all geometries of the instance. - /// Overrides OPTIX_GEOMETRY_FLAG_DISABLE_ANYHIT - /// Can be overridden by OPTIX_RAY_FLAG_DISABLE_ANYHIT. - /// This flag is mutually exclusive with OPTIX_INSTANCE_FLAG_DISABLE_ANYHIT. - OPTIX_INSTANCE_FLAG_ENFORCE_ANYHIT = 1u << 3, - - - /// Force 4-state opacity micromaps to behave as 2-state opacity micromaps during traversal. - OPTIX_INSTANCE_FLAG_FORCE_OPACITY_MICROMAP_2_STATE = 1u << 4, - /// Don't perform opacity micromap query for this instance. Triangle GAS must be built with ALLOW_DISABLE_OPACITY_MICROMAPS for this to be valid. - /// Clusters in a GAS must be build with OPTIX_CLUSTER_ACCEL_CLUSTER_FLAG_ALLOW_DISABLE_OPACITY_MICROMAPS for this to be valid. - /// This flag overrides FORCE_OPACTIY_MIXROMAP_2_STATE instance and ray flags. - OPTIX_INSTANCE_FLAG_DISABLE_OPACITY_MICROMAPS = 1u << 5, - -} OptixInstanceFlags; - -/// Instances -/// -/// \see #OptixBuildInputInstanceArray::instances -typedef struct OptixInstance -{ - /// affine object-to-world transformation as 3x4 matrix in row-major layout - float transform[12]; - - /// Application supplied ID. The maximal ID can be queried using OPTIX_DEVICE_PROPERTY_LIMIT_MAX_INSTANCE_ID. - unsigned int instanceId; - - /// SBT record offset. - /// In a traversable graph with multiple levels of instance acceleration structure (IAS) objects, offsets are summed together. - /// The maximal SBT offset can be queried using OPTIX_DEVICE_PROPERTY_LIMIT_MAX_SBT_OFFSET. - unsigned int sbtOffset; - - /// Visibility mask. If rayMask & instanceMask == 0 the instance is culled. The number of available bits can be - /// queried using OPTIX_DEVICE_PROPERTY_LIMIT_NUM_BITS_INSTANCE_VISIBILITY_MASK. - unsigned int visibilityMask; - - /// Any combination of OptixInstanceFlags is allowed. - unsigned int flags; - - /// Set with an OptixTraversableHandle. - OptixTraversableHandle traversableHandle; - - /// round up to 80-byte, to ensure 16-byte alignment - unsigned int pad[2]; -} OptixInstance; - -/// Builder Options -/// -/// Used for #OptixAccelBuildOptions::buildFlags. Can be or'ed together. -typedef enum OptixBuildFlags -{ - /// No special flags set. - OPTIX_BUILD_FLAG_NONE = 0, - - /// Allow updating the build with new vertex positions with subsequent calls to - /// optixAccelBuild. - OPTIX_BUILD_FLAG_ALLOW_UPDATE = 1u << 0, - - OPTIX_BUILD_FLAG_ALLOW_COMPACTION = 1u << 1, - - /// This flag is mutually exclusive with OPTIX_BUILD_FLAG_PREFER_FAST_BUILD. - OPTIX_BUILD_FLAG_PREFER_FAST_TRACE = 1u << 2, - - /// This flag is mutually exclusive with OPTIX_BUILD_FLAG_PREFER_FAST_TRACE. - OPTIX_BUILD_FLAG_PREFER_FAST_BUILD = 1u << 3, - - /// Allow random access to build input vertices - /// See optixGetTriangleVertexDataFromHandle - /// optixGetLinearCurveVertexDataFromHandle - /// optixGetQuadraticBSplineVertexDataFromHandle - /// optixGetCubicBSplineVertexDataFromHandle - /// optixGetCatmullRomVertexDataFromHandle - /// optixGetCubicBezierVertexDataFromHandle - /// optixGetQuadraticBSplineRocapsVertexDataFromHandle - /// optixGetCubicBSplineRocapsVertexDataFromHandle - /// optixGetCatmullRomRocapsVertexDataFromHandle - /// optixGetCubicBezierRocapsVertexDataFromHandle - /// optixGetRibbonVertexDataFromHandle - /// optixGetRibbonNormalFromHandle - /// optixGetSphereDataFromHandle - OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS = 1u << 4, - - /// Allow random access to instances - /// See optixGetInstanceTraversableFromIAS - OPTIX_BUILD_FLAG_ALLOW_RANDOM_INSTANCE_ACCESS = 1u << 5, - - /// Support updating the opacity micromap array and opacity micromap indices on refits. - /// May increase AS size and may have a small negative impact on traversal performance. - /// If this flag is absent, all opacity micromap inputs must remain unchanged between the initial AS builds and their subsequent refits. - OPTIX_BUILD_FLAG_ALLOW_OPACITY_MICROMAP_UPDATE = 1u << 6, - - /// If enabled, any instances referencing this GAS are allowed to disable the opacity micromap test through the DISABLE_OPACITY_MICROMAPS flag instance flag. - /// Note that the GAS will not be optimized for the attached opacity micromap Arrays if this flag is set, - /// which may result in reduced traversal performance. - OPTIX_BUILD_FLAG_ALLOW_DISABLE_OPACITY_MICROMAPS = 1u << 7, -} OptixBuildFlags; - - -/// Flags defining behavior of opacity micromaps in a opacity micromap array. -typedef enum OptixOpacityMicromapFlags -{ - OPTIX_OPACITY_MICROMAP_FLAG_NONE = 0, - - /// This flag is mutually exclusive with OPTIX_OPACITY_MICROMAP_FLAG_PREFER_FAST_BUILD. - OPTIX_OPACITY_MICROMAP_FLAG_PREFER_FAST_TRACE = 1 << 0, - - /// This flag is mutually exclusive with OPTIX_OPACITY_MICROMAP_FLAG_PREFER_FAST_TRACE. - OPTIX_OPACITY_MICROMAP_FLAG_PREFER_FAST_BUILD = 1 << 1, -} OptixOpacityMicromapFlags; - -/// Opacity micromap descriptor. -typedef struct OptixOpacityMicromapDesc -{ - /// Byte offset to opacity micromap in data input buffer of opacity micromap array build - unsigned int byteOffset; - /// Number of micro-triangles is 4^level. Valid levels are [0, 12] - unsigned short subdivisionLevel; - /// OptixOpacityMicromapFormat - unsigned short format; -} OptixOpacityMicromapDesc; - -/// Opacity micromap histogram entry. -/// Specifies how many opacity micromaps of a specific type are input to the opacity micromap array build. -/// Note that while this is similar to OptixOpacityMicromapUsageCount, the histogram entry specifies how many opacity micromaps -/// of a specific type are combined into a opacity micromap array. -typedef struct OptixOpacityMicromapHistogramEntry -{ - /// Number of opacity micromaps with the format and subdivision level that are input to the opacity micromap array build. - unsigned int count; - /// Number of micro-triangles is 4^level. Valid levels are [0, 12]. - unsigned int subdivisionLevel; - /// Opacity micromap format. - OptixOpacityMicromapFormat format; -} OptixOpacityMicromapHistogramEntry; - -/// Inputs to opacity micromap array construction. -typedef struct OptixOpacityMicromapArrayBuildInput -{ - /// Applies to all opacity micromaps in array. - unsigned int flags; - - /// 128B aligned base pointer for raw opacity micromap input data. - CUdeviceptr inputBuffer; - - /// One OptixOpacityMicromapDesc entry per opacity micromap. - /// This device pointer must be a multiple of OPTIX_OPACITY_MICROMAP_DESC_BYTE_ALIGNMENT. - CUdeviceptr perMicromapDescBuffer; - - /// Stride between OptixOpacityMicromapDescs in perOmDescBuffer. - /// If set to zero, the opacity micromap descriptors are assumed to be tightly packed and the stride is assumed to be sizeof( OptixOpacityMicromapDesc ). - /// This stride must be a multiple of OPTIX_OPACITY_MICROMAP_DESC_BYTE_ALIGNMENT. - unsigned int perMicromapDescStrideInBytes; - - /// Number of OptixOpacityMicromapHistogramEntry. - unsigned int numMicromapHistogramEntries; - /// Histogram over opacity micromaps of input format and subdivision combinations. - /// Counts of entries with equal format and subdivision combination (duplicates) are added together. - const OptixOpacityMicromapHistogramEntry* micromapHistogramEntries; -} OptixOpacityMicromapArrayBuildInput; - -/// Conservative memory requirements for building a opacity micromap array -typedef struct OptixMicromapBufferSizes -{ - size_t outputSizeInBytes; - size_t tempSizeInBytes; -} OptixMicromapBufferSizes; - -/// Buffer inputs for opacity micromap array builds. -typedef struct OptixMicromapBuffers -{ - /// Output buffer - CUdeviceptr output; - /// Output buffer size - size_t outputSizeInBytes; - /// Temp buffer - CUdeviceptr temp; - /// Temp buffer size - size_t tempSizeInBytes; -} OptixMicromapBuffers; - - -/// Enum to specify the acceleration build operation. -/// -/// Used in OptixAccelBuildOptions, which is then passed to optixAccelBuild and -/// optixAccelComputeMemoryUsage, this enum indicates whether to do a build or an update -/// of the acceleration structure. -/// -/// Acceleration structure updates utilize the same acceleration structure, but with -/// updated bounds. Updates are typically much faster than builds, however, large -/// perturbations can degrade the quality of the acceleration structure. -/// -/// \see #optixAccelComputeMemoryUsage(), #optixAccelBuild(), #OptixAccelBuildOptions -typedef enum OptixBuildOperation -{ - /// Perform a full build operation - OPTIX_BUILD_OPERATION_BUILD = 0x2161, - /// Perform an update using new bounds - OPTIX_BUILD_OPERATION_UPDATE = 0x2162, -} OptixBuildOperation; - -/// Enum to specify motion flags. -/// -/// \see #OptixMotionOptions::flags. -typedef enum OptixMotionFlags -{ - OPTIX_MOTION_FLAG_NONE = 0, - OPTIX_MOTION_FLAG_START_VANISH = 1u << 0, - OPTIX_MOTION_FLAG_END_VANISH = 1u << 1 -} OptixMotionFlags; - -/// Motion options -/// -/// \see #OptixAccelBuildOptions::motionOptions, #OptixMatrixMotionTransform::motionOptions, -/// #OptixSRTMotionTransform::motionOptions -typedef struct OptixMotionOptions -{ - /// If numKeys > 1, motion is enabled. timeBegin, - /// timeEnd and flags are all ignored when motion is disabled. - unsigned short numKeys; - - /// Combinations of #OptixMotionFlags - unsigned short flags; - - /// Point in time where motion starts. Must be lesser than timeEnd. - float timeBegin; - - /// Point in time where motion ends. Must be greater than timeBegin. - float timeEnd; -} OptixMotionOptions; - -/// Build options for acceleration structures. -/// -/// \see #optixAccelComputeMemoryUsage(), #optixAccelBuild() -typedef struct OptixAccelBuildOptions -{ - /// Combinations of OptixBuildFlags - unsigned int buildFlags; - - /// If OPTIX_BUILD_OPERATION_UPDATE the output buffer is assumed to contain the result - /// of a full build with OPTIX_BUILD_FLAG_ALLOW_UPDATE set and using the same number of - /// primitives. It is updated incrementally to reflect the current position of the - /// primitives. - /// If a BLAS has been built with OPTIX_BUILD_FLAG_ALLOW_OPACITY_MICROMAP_UPDATE, new opacity micromap arrays - /// and opacity micromap indices may be provided to the refit. - OptixBuildOperation operation; - - /// Options for motion. - OptixMotionOptions motionOptions; -} OptixAccelBuildOptions; - -/// Struct for querying builder allocation requirements. -/// -/// Once queried the sizes should be used to allocate device memory of at least these sizes. -/// -/// \see #optixAccelComputeMemoryUsage() -typedef struct OptixAccelBufferSizes -{ - /// The size in bytes required for the outputBuffer parameter to optixAccelBuild when - /// doing a build (OPTIX_BUILD_OPERATION_BUILD). - size_t outputSizeInBytes; - - /// The size in bytes required for the tempBuffer paramter to optixAccelBuild when - /// doing a build (OPTIX_BUILD_OPERATION_BUILD). - size_t tempSizeInBytes; - - /// The size in bytes required for the tempBuffer parameter to optixAccelBuild - /// when doing an update (OPTIX_BUILD_OPERATION_UPDATE). This value can be different - /// than tempSizeInBytes used for a full build. Only non-zero if - /// OPTIX_BUILD_FLAG_ALLOW_UPDATE flag is set in OptixAccelBuildOptions. - size_t tempUpdateSizeInBytes; -} OptixAccelBufferSizes; - -/// Properties which can be emitted during acceleration structure build. -/// -/// \see #OptixAccelEmitDesc::type. -typedef enum OptixAccelPropertyType -{ - /// Size of a compacted acceleration structure. The device pointer points to a uint64. - OPTIX_PROPERTY_TYPE_COMPACTED_SIZE = 0x2181, - - /// OptixAabb * numMotionSteps - OPTIX_PROPERTY_TYPE_AABBS = 0x2182, -} OptixAccelPropertyType; - -/// Specifies a type and output destination for emitted post-build properties. -/// -/// \see #optixAccelBuild() -typedef struct OptixAccelEmitDesc -{ - /// Output buffer for the properties - CUdeviceptr result; - - /// Requested property - OptixAccelPropertyType type; -} OptixAccelEmitDesc; - -/// Used to store information related to relocation of optix data structures. -/// -/// \see #optixOpacityMicromapArrayGetRelocationInfo(), #optixOpacityMicromapArrayRelocate(), -/// #optixAccelGetRelocationInfo(), #optixAccelRelocate(), #optixCheckRelocationCompatibility() -typedef struct OptixRelocationInfo -{ - /// Opaque data, used internally, should not be modified - unsigned long long info[4]; -} OptixRelocationInfo; - -/// Static transform -/// -/// The device address of instances of this type must be a multiple of OPTIX_TRANSFORM_BYTE_ALIGNMENT. -/// -/// \see #optixConvertPointerToTraversableHandle() -typedef struct OptixStaticTransform -{ - /// The traversable transformed by this transformation - OptixTraversableHandle child; - - /// Padding to make the transformations 16 byte aligned - unsigned int pad[2]; - - /// Affine object-to-world transformation as 3x4 matrix in row-major layout - float transform[12]; - - /// Affine world-to-object transformation as 3x4 matrix in row-major layout - /// Must be the inverse of the transform matrix - float invTransform[12]; -} OptixStaticTransform; - -/// Represents a matrix motion transformation. -/// -/// The device address of instances of this type must be a multiple of OPTIX_TRANSFORM_BYTE_ALIGNMENT. -/// -/// This struct, as defined here, handles only N=2 motion keys due to the fixed array length of its transform member. -/// The following example shows how to create instances for an arbitrary number N of motion keys: -/// -/// \code -/// float matrixData[N][12]; -/// ... // setup matrixData -/// -/// size_t transformSizeInBytes = sizeof( OptixMatrixMotionTransform ) + ( N-2 ) * 12 * sizeof( float ); -/// OptixMatrixMotionTransform* matrixMoptionTransform = (OptixMatrixMotionTransform*) malloc( transformSizeInBytes ); -/// memset( matrixMoptionTransform, 0, transformSizeInBytes ); -/// -/// ... // setup other members of matrixMoptionTransform -/// matrixMoptionTransform->motionOptions.numKeys/// = N; -/// memcpy( matrixMoptionTransform->transform, matrixData, N * 12 * sizeof( float ) ); -/// -/// ... // copy matrixMoptionTransform to device memory -/// free( matrixMoptionTransform ) -/// \endcode -/// -/// \see #optixConvertPointerToTraversableHandle() -typedef struct OptixMatrixMotionTransform -{ - /// The traversable that is transformed by this transformation - OptixTraversableHandle child; - - /// The motion options for this transformation. - /// Must have at least two motion keys. - OptixMotionOptions motionOptions; - - /// Padding to make the transformation 16 byte aligned - unsigned int pad[3]; - - /// Affine object-to-world transformation as 3x4 matrix in row-major layout - float transform[2][12]; -} OptixMatrixMotionTransform; - -/// Represents an SRT transformation. -/// -/// An SRT transformation can represent a smooth rotation with fewer motion keys than a matrix transformation. Each -/// motion key is constructed from elements taken from a matrix S, a quaternion R, and a translation T. -/// -/// The scaling matrix -/// \f$S = \begin{bmatrix} sx & a & b & pvx \\ 0 & sy & c & pvy \\ 0 & 0 & sz & pvz \end{bmatrix}\f$ -// [ sx a b pvx ] -// S = [ 0 sy c pvy ] -// [ 0 0 sz pvz ] -/// defines an affine transformation that can include scale, shear, and a translation. -/// The translation allows to define the pivot point for the subsequent rotation. -/// -/// The quaternion R = [ qx, qy, qz, qw ] describes a rotation with angular component qw = cos(theta/2) and other -/// components [ qx, qy, qz ] = sin(theta/2) * [ ax, ay, az ] where the axis [ ax, ay, az ] is normalized. -/// -/// The translation matrix -/// \f$T = \begin{bmatrix} 1 & 0 & 0 & tx \\ 0 & 1 & 0 & ty \\ 0 & 0 & 1 & tz \end{bmatrix}\f$ -// [ 1 0 0 tx ] -// T = [ 0 1 0 ty ] -// [ 0 0 1 tz ] -/// defines another translation that is applied after the rotation. Typically, this translation includes -/// the inverse translation from the matrix S to reverse the translation for the pivot point for R. -/// -/// To obtain the effective transformation at time t, the elements of the components of S, R, and T will be interpolated -/// linearly. The components are then multiplied to obtain the combined transformation C = T * R * S. The transformation -/// C is the effective object-to-world transformations at time t, and C^(-1) is the effective world-to-object -/// transformation at time t. -/// -/// \see #OptixSRTMotionTransform::srtData, #optixConvertPointerToTraversableHandle() -typedef struct OptixSRTData -{ - /// \name Parameters describing the SRT transformation - /// @{ - float sx, a, b, pvx, sy, c, pvy, sz, pvz, qx, qy, qz, qw, tx, ty, tz; - /// @} -} OptixSRTData; - - -/// Represents an SRT motion transformation. -/// -/// The device address of instances of this type must be a multiple of OPTIX_TRANSFORM_BYTE_ALIGNMENT. -/// -/// This struct, as defined here, handles only N=2 motion keys due to the fixed array length of its srtData member. -/// The following example shows how to create instances for an arbitrary number N of motion keys: -/// -/// \code -/// OptixSRTData srtData[N]; -/// ... // setup srtData -/// -/// size_t transformSizeInBytes = sizeof( OptixSRTMotionTransform ) + ( N-2 ) * sizeof( OptixSRTData ); -/// OptixSRTMotionTransform* srtMotionTransform = (OptixSRTMotionTransform*) malloc( transformSizeInBytes ); -/// memset( srtMotionTransform, 0, transformSizeInBytes ); -/// -/// ... // setup other members of srtMotionTransform -/// srtMotionTransform->motionOptions.numKeys = N; -/// memcpy( srtMotionTransform->srtData, srtData, N * sizeof( OptixSRTData ) ); -/// -/// ... // copy srtMotionTransform to device memory -/// free( srtMotionTransform ) -/// \endcode -/// -/// \see #optixConvertPointerToTraversableHandle() -typedef struct OptixSRTMotionTransform -{ - /// The traversable transformed by this transformation - OptixTraversableHandle child; - - /// The motion options for this transformation - /// Must have at least two motion keys. - OptixMotionOptions motionOptions; - - /// Padding to make the SRT data 16 byte aligned - unsigned int pad[3]; - - /// The actual SRT data describing the transformation - OptixSRTData srtData[2]; -} OptixSRTMotionTransform; - -/// Traversable Handles -/// -/// \see #optixConvertPointerToTraversableHandle() -typedef enum OptixTraversableType -{ - /// Static transforms. \see #OptixStaticTransform - OPTIX_TRAVERSABLE_TYPE_STATIC_TRANSFORM = 0x21C1, - /// Matrix motion transform. \see #OptixMatrixMotionTransform - OPTIX_TRAVERSABLE_TYPE_MATRIX_MOTION_TRANSFORM = 0x21C2, - /// SRT motion transform. \see #OptixSRTMotionTransform - OPTIX_TRAVERSABLE_TYPE_SRT_MOTION_TRANSFORM = 0x21C3, -} OptixTraversableType; - - -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -///// Cluster AS build -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// - -/// Host-side flags for all types of cluster builds -typedef enum OptixClusterAccelBuildFlags -{ - OPTIX_CLUSTER_ACCEL_BUILD_FLAG_NONE = 0, - OPTIX_CLUSTER_ACCEL_BUILD_FLAG_PREFER_FAST_TRACE = 1 << 0, - OPTIX_CLUSTER_ACCEL_BUILD_FLAG_PREFER_FAST_BUILD = 1 << 1, - OPTIX_CLUSTER_ACCEL_BUILD_FLAG_ALLOW_OPACITY_MICROMAPS = 1 << 2 -} OptixClusterAccelBuildFlags; - -/// Device-side flags for clusters builds -typedef enum OptixClusterAccelClusterFlags -{ - OPTIX_CLUSTER_ACCEL_CLUSTER_FLAG_NONE = 0, - /// Similar to the 'ALLOW_DISABLE_OPACITY_MICROMAPS' build flag of regular triangle GAS builds. - /// This flag is required if the CLAS is in an instance with the OPTIX_INSTANCE_FLAG_DISABLE_OPACITY_MICROMAPS flag set. - OPTIX_CLUSTER_ACCEL_CLUSTER_FLAG_ALLOW_DISABLE_OPACITY_MICROMAPS = 1 << 0, -} OptixClusterAccelClusterFlags; - -/// Device-side flags that specify per-primitive specific behavior -/// Note the packing within the 32b struct OptixClusterAccelPrimitiveInfo -typedef enum OptixClusterAccelPrimitiveFlags -{ - OPTIX_CLUSTER_ACCEL_PRIMITIVE_FLAG_NONE = 0, - OPTIX_CLUSTER_ACCEL_PRIMITIVE_FLAG_DISABLE_TRIANGLE_FACE_CULLING = 1 << 0, - OPTIX_CLUSTER_ACCEL_PRIMITIVE_FLAG_REQUIRE_SINGLE_ANYHIT_CALL = 1 << 1, - OPTIX_CLUSTER_ACCEL_PRIMITIVE_FLAG_DISABLE_ANYHIT = 1 << 2, -} OptixClusterAccelPrimitiveFlags; - -/// Build type for cluster builds - specifying the type of data input and output -typedef enum OptixClusterAccelBuildType -{ - OPTIX_CLUSTER_ACCEL_BUILD_TYPE_GASES_FROM_CLUSTERS = 0x2545, - OPTIX_CLUSTER_ACCEL_BUILD_TYPE_CLUSTERS_FROM_TRIANGLES = 0x2546, - OPTIX_CLUSTER_ACCEL_BUILD_TYPE_TEMPLATES_FROM_TRIANGLES = 0x2547, - OPTIX_CLUSTER_ACCEL_BUILD_TYPE_CLUSTERS_FROM_TEMPLATES = 0x2548, - OPTIX_CLUSTER_ACCEL_BUILD_TYPE_TEMPLATES_FROM_GRIDS = 0x2549 -} OptixClusterAccelBuildType; - -/// Build mode for cluster builds -typedef enum OptixClusterAccelBuildMode -{ - /// Fastest build, single output buffer, build outputs may have padding wrt each other - OPTIX_CLUSTER_ACCEL_BUILD_MODE_IMPLICIT_DESTINATIONS = 0, - /// Compact build, application specifies output destination per Arg; requires Get Sizes build run beforehand - OPTIX_CLUSTER_ACCEL_BUILD_MODE_EXPLICIT_DESTINATIONS = 1, - /// Size computation for future explicit build; computes output sizes for all Args - OPTIX_CLUSTER_ACCEL_BUILD_MODE_GET_SIZES = 2 -} OptixClusterAccelBuildMode; - -/// Helper enum where values match the byte count of the corresponding index format, allowing usage of enum value when specifying byte count -typedef enum OptixClusterAccelIndicesFormat -{ - OPTIX_CLUSTER_ACCEL_INDICES_FORMAT_8BIT = 1, - OPTIX_CLUSTER_ACCEL_INDICES_FORMAT_16BIT = 2, - OPTIX_CLUSTER_ACCEL_INDICES_FORMAT_32BIT = 4, -} OptixClusterAccelIndicesFormat; - -typedef struct OptixClusterAccelBuildModeDescImplicitDest -{ - /// alignment of outputBuffer must match result type. - /// Clusters: 128 bytes - /// Templates: 32 bytes - /// GASes: 128 bytes, see OPTIX_ACCEL_BUFFER_BYTE_ALIGNMENT - CUdeviceptr outputBuffer; - /// size of outputHandlesBuffer is outputHandlesStrideInBytes * number of inputs specified with either argCount or maxArgCount - size_t outputBufferSizeInBytes; - /// 128-byte aligned, see OPTIX_ACCEL_BUFFER_BYTE_ALIGNMENT - CUdeviceptr tempBuffer; - size_t tempBufferSizeInBytes; - - /// TraversableHandle for GAS, pointer for cluster and template outputs - CUdeviceptr outputHandlesBuffer; - /// Minimum 8, Stride of 0 implies natural stride of 8B - unsigned int outputHandlesStrideInBytes; - /// Optional, uint32 array (4 byte aligned) - CUdeviceptr outputSizesBuffer; - /// Minimum 4, Stride of 0 implies natural stride of 4B - unsigned int outputSizesStrideInBytes; -} OptixClusterAccelBuildModeDescImplicitDest; - -typedef struct OptixClusterAccelBuildModeDescExplicitDest -{ - /// 128-byte aligned, see OPTIX_ACCEL_BUFFER_BYTE_ALIGNMENT - CUdeviceptr tempBuffer; - size_t tempBufferSizeInBytes; - /// Entries must be aligned according to the output type - CUdeviceptr destAddressesBuffer; - /// Minimum 8, Stride of 0 implies natural stride of 8B - unsigned int destAddressesStrideInBytes; - - /// TraversableHandle for GAS, pointer for cluster and template outputs, can be the same as destAddresses in which case they will overwrite the input - CUdeviceptr outputHandlesBuffer; - /// Minimum 8, Stride of 0 implies natural stride of 8B - unsigned int outputHandlesStrideInBytes; - /// Optional, uint32 array (4 byte aligned) - CUdeviceptr outputSizesBuffer; - /// Minimum 4, Stride of 0 implies natural stride of 4B - unsigned int outputSizesStrideInBytes; -} OptixClusterAccelBuildModeDescExplicitDest; - -typedef struct OptixClusterAccelBuildModeDescGetSize -{ - /// Mandatory, uint32 array (4 byte aligned) - CUdeviceptr outputSizesBuffer; - /// Minimum 4, Stride of 0 implies natural stride of 4B - unsigned int outputSizesStrideInBytes; - /// 128-byte aligned, see OPTIX_ACCEL_BUFFER_BYTE_ALIGNMENT - CUdeviceptr tempBuffer; - size_t tempBufferSizeInBytes; -} OptixClusterAccelBuildModeDescGetSize; - -typedef struct OptixClusterAccelBuildInputTriangles -{ - OptixClusterAccelBuildFlags flags; - - /// Max number of OptixClusterAccelBuildInputTrianglesArgs provided at build time for OPTIX_CLUSTER_ACCEL_BUILD_TYPE_CLUSTERS_FROM_TRIANGLES - /// and OPTIX_CLUSTER_ACCEL_BUILD_TYPE_TEMPLATES_FROM_TRIANGLES. - /// Max number of OptixClusterAccelBuildInputTemplatesArgs provided at build time for OPTIX_CLUSTER_ACCEL_BUILD_TYPE_CLUSTERS_FROM_TEMPLATES. - unsigned int maxArgCount; - /// OptixVertexFormat (see documentation for supported formats) - OptixVertexFormat vertexFormat; - /// The maximum used sbt index over all clusters; - /// This must include the base sbt offset (::basePrimitiveInfo), any potential per primitive offset (::primitiveInfoBuffer), - /// as well as a potential offset at template instantiation (OptixClusterAccelBuildInputTemplatesArgs::sbtIndexOffset) - unsigned int maxSbtIndexValue; - /// Number of unique SBT indices per cluster. If the cluster has the same SBT index for all its triangles, this value is 1. - unsigned int maxUniqueSbtIndexCountPerArg; - - /// Upper bound on the number of triangles per Arg - unsigned int maxTriangleCountPerArg; - /// Upper bound on the number of vertices per Arg - unsigned int maxVertexCountPerArg; - /// Optional, upper bound on the number of triangles over all Args, maxTriangleCountPerArg * maxArgCount otherwise - unsigned int maxTotalTriangleCount; - /// Optional, upper bound on the number of vertices over all Args, maxVertexCountPerArg * maxArgCount otherwise - unsigned int maxTotalVertexCount; - /// Lower bound on the number of bits being truncated of the vertex positions. - unsigned int minPositionTruncateBitCount; -} OptixClusterAccelBuildInputTriangles; - -typedef struct OptixClusterAccelBuildInputGrids -{ - OptixClusterAccelBuildFlags flags; - // Max number of OptixClusterAccelBuildInputGridsArgs provided at build time for OPTIX_CLUSTER_ACCEL_BUILD_TYPE_TEMPLATES_FROM_GRIDS - unsigned int maxArgCount; - - /// OptixVertexFormat (see documentation for supported formats) - OptixVertexFormat vertexFormat; - /// The maximum used SBT index over all clusters. - /// This must include the base SBT offset (::basePrimitiveInfo), any potential per primitive offset (::primitiveInfoBuffer), - /// as well as a potential offset at template instantiation (OptixClusterAccelBuildInputTemplatesArgs::sbtIndexOffset) - unsigned int maxSbtIndexValue; - - - /// The maximum number of edge segments along the width of any grid - unsigned int maxWidth; - /// The maximum number of edge segments along the height of any grid - unsigned int maxHeight; -} OptixClusterAccelBuildInputGrids; - -typedef struct OptixClusterAccelBuildInputClusters -{ - OptixClusterAccelBuildFlags flags; - /// Max number of OptixClusterAccelBuildInputClustersArgs provided at build time for OPTIX_CLUSTER_ACCEL_BUILD_TYPE_GASES_FROM_CLUSTERS - unsigned int maxArgCount; - - unsigned int maxTotalClusterCount; - unsigned int maxClusterCountPerArg; -} OptixClusterAccelBuildInputClusters; - -typedef struct OptixClusterAccelPrimitiveInfo -{ - unsigned int sbtIndex : 24; - unsigned int reserved : 5; - /// Combination of OptixClusterAccelPrimitiveFlags - unsigned int primitiveFlags : 3; -} OptixClusterAccelPrimitiveInfo; - -/// Reserved value for cluster IDs in Args -typedef enum OptixClusterIDValues { - OPTIX_CLUSTER_ID_INVALID = 0xFFFFFFFFu, -} OptixClusterIDValues; - -/// Device data, args provided for OPTIX_CLUSTER_ACCEL_BUILD_TYPE_CLUSTERS_FROM_TRIANGLES builds and OPTIX_CLUSTER_ACCEL_BUILD_TYPE_TEMPLATES_FROM_TRIANGLES builds -typedef struct OptixClusterAccelBuildInputTrianglesArgs -{ - /// 32-bit user-defined ID, for template creation acts as the baseClusterId and can be offset at template instantiation - /// (see OptixClusterAccelBuildInputTemplatesArgs::clusterIdOffset) - unsigned int clusterId; - /// Combination of OptixClusterAccelClusterFlags - unsigned int clusterFlags; - - // Packing the following values into a single 32b value - /// Number of triangles for cluster / cluster template, max value can be queried - unsigned int triangleCount : 9; - /// Number of vertices shared by triangles for cluster / cluster template, max value can be queried - unsigned int vertexCount : 9; - /// Number of LSB in mantissa that are dropped (0 means don't drop any) for float32 positions. Other formats are first converted to float32 before dropping bits. - /// Builder will drop bits when building CLAS / instantiating cluster templates (no need to truncate the input before build). - unsigned int positionTruncateBitCount : 6; - /// Can use OptixClusterAccelIndicesFormat as helper to set value: 1, 2, or 4 bytes-wide indices - unsigned int indexFormat : 4; - /// Can use OptixClusterAccelIndicesFormat as helper to set value: 1, 2, or 4 bytes-wide indices - unsigned int opacityMicromapIndexFormat : 4; - - /// Applied to all triangles in cluster. Additional per triangle flags can be specified in PrimitiveInfoBuffer. - OptixClusterAccelPrimitiveInfo basePrimitiveInfo; - - /// Stride between elements in index buffer. Stride 0 -> natural stride - unsigned short indexBufferStrideInBytes; - /// Stride between elements in vertex buffer. Stride 0 -> natural stride - unsigned short vertexBufferStrideInBytes; - /// Stride between elements in primitive info buffer. Stride 0 -> natural stride - unsigned short primitiveInfoBufferStrideInBytes; - /// Stride between elements in omm index buffer. Stride 0 -> natural stride - unsigned short opacityMicromapIndexBufferStrideInBytes; - - /// Triplets of vertex indices into vertexBuffer per triangle. Must contain 3 * triangleCount indices. - CUdeviceptr indexBuffer; - /// vertexBuffer is mandatory when using OPTIX_CLUSTER_ACCEL_BUILD_TYPE_CLUSTERS_FROM_TRIANGLES. - /// Optional with OPTIX_CLUSTER_ACCEL_BUILD_TYPE_TEMPLATES_FROM_TRIANGLES - /// and when specified provide example "hint" vertices for templates; actual vertices are specified at template instantiation. - /// It is typically useful to provide vertices for template creation in scenarios such as animation, where the relative locality - /// of vertices is expected to be similar between the template creation and instantiation. - CUdeviceptr vertexBuffer; - /// Optional, per primitive array of OptixClusterAccelPrimitiveInfo - CUdeviceptr primitiveInfoBuffer; - /// Optional, needs to be set if OMMs are used - CUdeviceptr opacityMicromapArray; - /// Optional, needs to be set if OMMs are used - CUdeviceptr opacityMicromapIndexBuffer; - - /// Optional with OPTIX_CLUSTER_ACCEL_BUILD_TYPE_TEMPLATES_FROM_TRIANGLES, 32-byte-aligned pointer to OptixAabb, one per cluster, - /// limiting the extent of each cluster. Vertices provided for template instantiation must not be outside the bounding box. - /// Providing a bounding box may improve compression (reduced CLAS size) as well as trace performance. - /// Ignored for OPTIX_CLUSTER_ACCEL_BUILD_TYPE_CLUSTERS_FROM_TRIANGLES - CUdeviceptr instantiationBoundingBoxLimit; -} OptixClusterAccelBuildInputTrianglesArgs; - -/// Device data, args provided for OPTIX_CLUSTER_ACCEL_BUILD_TYPE_TEMPLATES_FROM_GRIDS builds -typedef struct OptixClusterAccelBuildInputGridsArgs -{ - /// 32-bit user-defined ID, serves as a base value for the template and can be offset at template instantiation - /// (see OptixClusterAccelBuildInputTemplatesArgs::clusterIdOffset) - unsigned int baseClusterId; - /// Combination of OptixClusterAccelClusterFlags - unsigned int clusterFlags; - - /// Applied to all triangles in cluster - OptixClusterAccelPrimitiveInfo basePrimitiveInfo; - - // Packing the following values into a single 32b value - /// See OptixClusterAccelBuildInputTrianglesArgs::positionTruncateBitCount - unsigned int positionTruncateBitCount : 6; - unsigned int reserved : 26; - - // Packing the following values into a single 32b value - /// Resolution of the 2D grid, max value per dimension can be queried - unsigned char dimensions[2]; - unsigned short reserved2; -} OptixClusterAccelBuildInputGridsArgs; - -/// Device data, args provided for OPTIX_CLUSTER_ACCEL_BUILD_TYPE_CLUSTERS_FROM_TEMPLATES builds -typedef struct OptixClusterAccelBuildInputTemplatesArgs -{ - /// Offset applied to template baseClusterId, effective clusterId = clusterTemplate.baseClusterId + clusterIdOffset. Either may be 0. - unsigned int clusterIdOffset; - - /// Offset to base sbtIndex from template creation (which may define a constant or per-triangle base sbtIndex), - /// final sbt index is also limited to fit into 24b - unsigned int sbtIndexOffset; - - /// Opaque pointer to the template - CUdeviceptr clusterTemplate; - /// The vertex data to use to instantiate the template; vertex order must match that of template creation. - /// For templates created from grids, see documentation. - CUdeviceptr vertexBuffer; - /// Stride between elements in vertex buffer. Stride 0 -> natural stride - unsigned int vertexStrideInBytes; - unsigned int reserved; -} OptixClusterAccelBuildInputTemplatesArgs; - -/// Device data, args provided for OPTIX_CLUSTER_ACCEL_BUILD_TYPE_GASES_FROM_CLUSTERS builds -typedef struct OptixClusterAccelBuildInputClustersArgs -{ - /// Number of CLAS input to the BLAS build (size of the clusterHandles buffer) - unsigned int clusterHandlesCount; - unsigned int clusterHandlesBufferStrideInBytes; - /// The clusterHandlesBuffer can come directly from CLAS builds output via - /// OptixClusterAccelBuildModeDescImplicitDest::outputHandlesBuffer or - /// OptixClusterAccelBuildModeDescExplicitDest::outputHandlesBuffer - CUdeviceptr clusterHandlesBuffer; -} OptixClusterAccelBuildInputClustersArgs; - -typedef struct OptixClusterAccelBuildInput -{ - OptixClusterAccelBuildType type; - - union - { - /// Used for OPTIX_CLUSTER_ACCEL_BUILD_TYPE_CLUSTERS_FROM_TRIANGLES, OPTIX_CLUSTER_ACCEL_BUILD_TYPE_TEMPLATES_FROM_TRIANGLES, - /// OPTIX_CLUSTER_ACCEL_BUILD_TYPE_CLUSTERS_FROM_TEMPLATES type builds - OptixClusterAccelBuildInputTriangles triangles; - /// Used for OPTIX_CLUSTER_ACCEL_BUILD_TYPE_GASES_FROM_CLUSTERS type builds - OptixClusterAccelBuildInputClusters clusters; - /// Used for OPTIX_CLUSTER_ACCEL_BUILD_TYPE_TEMPLATES_FROM_GRIDS type builds - OptixClusterAccelBuildInputGrids grids; - }; -} OptixClusterAccelBuildInput; - -typedef struct OptixClusterAccelBuildModeDesc -{ - OptixClusterAccelBuildMode mode; - union - { - OptixClusterAccelBuildModeDescImplicitDest implicitDest; - OptixClusterAccelBuildModeDescExplicitDest explicitDest; - OptixClusterAccelBuildModeDescGetSize getSize; - }; -} OptixClusterAccelBuildModeDesc; - - -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -///// Denoiser -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// - - -/// Pixel formats used by the denoiser. -/// -/// \see #OptixImage2D::format -typedef enum OptixPixelFormat -{ - OPTIX_PIXEL_FORMAT_HALF1 = 0x220a, ///< one half - OPTIX_PIXEL_FORMAT_HALF2 = 0x2207, ///< two halfs, XY - OPTIX_PIXEL_FORMAT_HALF3 = 0x2201, ///< three halfs, RGB - OPTIX_PIXEL_FORMAT_HALF4 = 0x2202, ///< four halfs, RGBA - OPTIX_PIXEL_FORMAT_FLOAT1 = 0x220b, ///< one float - OPTIX_PIXEL_FORMAT_FLOAT2 = 0x2208, ///< two floats, XY - OPTIX_PIXEL_FORMAT_FLOAT3 = 0x2203, ///< three floats, RGB - OPTIX_PIXEL_FORMAT_FLOAT4 = 0x2204, ///< four floats, RGBA - OPTIX_PIXEL_FORMAT_UCHAR3 = 0x2205, ///< three unsigned chars, RGB - OPTIX_PIXEL_FORMAT_UCHAR4 = 0x2206, ///< four unsigned chars, RGBA - OPTIX_PIXEL_FORMAT_INTERNAL_GUIDE_LAYER = 0x2209 ///< internal format -} OptixPixelFormat; - -/// Image descriptor used by the denoiser. -/// -/// \see #optixDenoiserInvoke(), #optixDenoiserComputeIntensity() -typedef struct OptixImage2D -{ - /// Pointer to the actual pixel data. - CUdeviceptr data; - /// Width of the image (in pixels) - unsigned int width; - /// Height of the image (in pixels) - unsigned int height; - /// Stride between subsequent rows of the image (in bytes). - unsigned int rowStrideInBytes; - /// Stride between subsequent pixels of the image (in bytes). - /// If set to 0, dense packing (no gaps) is assumed. - /// For pixel format OPTIX_PIXEL_FORMAT_INTERNAL_GUIDE_LAYER it must be set to - /// OptixDenoiserSizes::internalGuideLayerPixelSizeInBytes. - unsigned int pixelStrideInBytes; - /// Pixel format. - OptixPixelFormat format; -} OptixImage2D; - -/// Model kind used by the denoiser. -/// -/// \see #optixDenoiserCreate -typedef enum OptixDenoiserModelKind -{ - /// Built-in model for denoising single image. - OPTIX_DENOISER_MODEL_KIND_AOV = 0x2324, - - /// Built-in model for denoising image sequence, temporally stable. - OPTIX_DENOISER_MODEL_KIND_TEMPORAL_AOV = 0x2326, - - /// Built-in model for denoising single image upscaling (supports AOVs). - OPTIX_DENOISER_MODEL_KIND_UPSCALE2X = 0x2327, - - /// Built-in model for denoising image sequence upscaling, temporally stable (supports AOVs). - OPTIX_DENOISER_MODEL_KIND_TEMPORAL_UPSCALE2X = 0x2328, - - /// Deprecated. Use OPTIX_DENOISER_MODEL_KIND_AOV. - /// When used, internally mapped to OPTIX_DENOISER_MODEL_KIND_AOV. - OPTIX_DENOISER_MODEL_KIND_LDR = 0x2322, - OPTIX_DENOISER_MODEL_KIND_HDR = 0x2323, - - /// Deprecated. Use OPTIX_DENOISER_MODEL_KIND_TEMPORAL_AOV. - OPTIX_DENOISER_MODEL_KIND_TEMPORAL = 0x2325 - -} OptixDenoiserModelKind; - -/// Alpha denoising mode -/// -/// \see #optixDenoiserCreate() -typedef enum OptixDenoiserAlphaMode -{ - /// Copy alpha (if present) from input layer, no denoising. - OPTIX_DENOISER_ALPHA_MODE_COPY = 0, - - /// Denoise alpha. - OPTIX_DENOISER_ALPHA_MODE_DENOISE = 1 -} OptixDenoiserAlphaMode; - -/// Options used by the denoiser -/// -/// \see #optixDenoiserCreate() -typedef struct OptixDenoiserOptions -{ - // if nonzero, albedo image must be given in OptixDenoiserGuideLayer - unsigned int guideAlbedo; - - // if nonzero, normal image must be given in OptixDenoiserGuideLayer - unsigned int guideNormal; - - /// alpha denoise mode - OptixDenoiserAlphaMode denoiseAlpha; -} OptixDenoiserOptions; - -/// Guide layer for the denoiser -/// -/// \see #optixDenoiserInvoke() -typedef struct OptixDenoiserGuideLayer -{ - // image with three components: R, G, B. - OptixImage2D albedo; - - // image with two or three components: X, Y, Z. - // (X, Y) camera space for OPTIX_DENOISER_MODEL_KIND_LDR, OPTIX_DENOISER_MODEL_KIND_HDR models. - // (X, Y, Z) world space, all other models. - OptixImage2D normal; - - // image with two components: X, Y. - // pixel movement from previous to current frame for each pixel in screen space. - OptixImage2D flow; - - // Internal images used in temporal AOV denoising modes, - // pixel format OPTIX_PIXEL_FORMAT_INTERNAL_GUIDE_LAYER. - OptixImage2D previousOutputInternalGuideLayer; - OptixImage2D outputInternalGuideLayer; - - // image with a single component value that specifies how trustworthy the flow vector at x,y position in - // OptixDenoiserGuideLayer::flow is. Range 0..1 (low->high trustworthiness). - // Ignored if data pointer in the image is zero. - OptixImage2D flowTrustworthiness; - -} OptixDenoiserGuideLayer; - -/// AOV type used by the denoiser -/// -typedef enum OptixDenoiserAOVType -{ - /// Unspecified AOV type - OPTIX_DENOISER_AOV_TYPE_NONE = 0, - - OPTIX_DENOISER_AOV_TYPE_BEAUTY = 0x7000, - OPTIX_DENOISER_AOV_TYPE_SPECULAR = 0x7001, - OPTIX_DENOISER_AOV_TYPE_REFLECTION = 0x7002, - OPTIX_DENOISER_AOV_TYPE_REFRACTION = 0x7003, - OPTIX_DENOISER_AOV_TYPE_DIFFUSE = 0x7004 - -} OptixDenoiserAOVType; - -/// Input/Output layers for the denoiser -/// -/// \see #optixDenoiserInvoke() -typedef struct OptixDenoiserLayer -{ - // input image (beauty or AOV) - OptixImage2D input; - - // denoised output image from previous frame if temporal model kind selected - OptixImage2D previousOutput; - - // denoised output for given input - OptixImage2D output; - - // Type of AOV, used in temporal AOV modes as a hint to improve image quality. - OptixDenoiserAOVType type; -} OptixDenoiserLayer; - -/// Various parameters used by the denoiser -/// -/// \see #optixDenoiserInvoke() -/// \see #optixDenoiserComputeIntensity() -/// \see #optixDenoiserComputeAverageColor() - -typedef struct OptixDenoiserParams -{ - /// average log intensity of input image (default null pointer). points to a single float. - /// if set to null, autoexposure will be calculated automatically for the input image. - /// Should be set to average log intensity of the entire image at least if tiling is used to - /// get consistent autoexposure for all tiles. - CUdeviceptr hdrIntensity; - - /// blend factor. - /// If set to 0 the output is 100% of the denoised input. If set to 1, the output is 100% of - /// the unmodified input. Values between 0 and 1 will linearly interpolate between the denoised - /// and unmodified input. - float blendFactor; - - /// this parameter is used when the OPTIX_DENOISER_MODEL_KIND_AOV model kind is set. - /// average log color of input image, separate for RGB channels (default null pointer). - /// points to three floats. - /// if set to null, average log color will be calculated automatically. See hdrIntensity for tiling, - /// this also applies here. - CUdeviceptr hdrAverageColor; - - /// In temporal modes this parameter must be set to 1 if previous layers (e.g. - /// previousOutputInternalGuideLayer) contain valid data. This is the case in the - /// second and subsequent frames of a sequence (for example after a change of camera - /// angle). In the first frame of such a sequence this parameter must be set to 0. - unsigned int temporalModeUsePreviousLayers; - - /// Multiplication factors for motion vectors (flow guide layer). - /// When set to zero, motion vectors are not scaled. - float flowMulX; - float flowMulY; -} OptixDenoiserParams; - -/// Various sizes related to the denoiser. -/// -/// \see #optixDenoiserComputeMemoryResources() -typedef struct OptixDenoiserSizes -{ - /// Size of state memory passed to #optixDenoiserSetup, #optixDenoiserInvoke. - size_t stateSizeInBytes; - - /// Size of scratch memory passed to #optixDenoiserSetup, #optixDenoiserInvoke. - /// Overlap added to dimensions passed to #optixDenoiserComputeMemoryResources. - size_t withOverlapScratchSizeInBytes; - - /// Size of scratch memory passed to #optixDenoiserSetup, #optixDenoiserInvoke. - /// No overlap added. - size_t withoutOverlapScratchSizeInBytes; - - /// Overlap on all four tile sides. - unsigned int overlapWindowSizeInPixels; - - /// Size of scratch memory passed to #optixDenoiserComputeAverageColor. - /// The size is independent of the tile/image resolution. - size_t computeAverageColorSizeInBytes; - - /// Size of scratch memory passed to #optixDenoiserComputeIntensity. - /// The size is independent of the tile/image resolution. - size_t computeIntensitySizeInBytes; - - /// Number of bytes for each pixel in internal guide layers. - size_t internalGuideLayerPixelSizeInBytes; -} OptixDenoiserSizes; - - -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -///// Traversal and Module/Pipeline/SBT -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// - - -/// Ray flags passed to the device function #optixTrace(). These affect the behavior of -/// traversal per invocation. -/// -/// \see #optixTrace() -typedef enum OptixRayFlags -{ - /// No change from the behavior configured for the individual AS. - OPTIX_RAY_FLAG_NONE = 0u, - - /// Disables anyhit programs for the ray. - /// Overrides OPTIX_INSTANCE_FLAG_ENFORCE_ANYHIT. - /// This flag is mutually exclusive with OPTIX_RAY_FLAG_ENFORCE_ANYHIT, - /// OPTIX_RAY_FLAG_CULL_DISABLED_ANYHIT, OPTIX_RAY_FLAG_CULL_ENFORCED_ANYHIT. - OPTIX_RAY_FLAG_DISABLE_ANYHIT = 1u << 0, - - /// Forces anyhit program execution for the ray. - /// Overrides OPTIX_GEOMETRY_FLAG_DISABLE_ANYHIT as well as OPTIX_INSTANCE_FLAG_DISABLE_ANYHIT. - /// This flag is mutually exclusive with OPTIX_RAY_FLAG_DISABLE_ANYHIT, - /// OPTIX_RAY_FLAG_CULL_DISABLED_ANYHIT, OPTIX_RAY_FLAG_CULL_ENFORCED_ANYHIT. - OPTIX_RAY_FLAG_ENFORCE_ANYHIT = 1u << 1, - - /// Terminates the ray after the first hit and executes - /// the closesthit program of that hit. - OPTIX_RAY_FLAG_TERMINATE_ON_FIRST_HIT = 1u << 2, - - /// Disables closesthit programs for the ray, but still executes miss program in case of a miss. - OPTIX_RAY_FLAG_DISABLE_CLOSESTHIT = 1u << 3, - - /// Do not intersect triangle back faces - /// (respects a possible face change due to instance flag - /// OPTIX_INSTANCE_FLAG_FLIP_TRIANGLE_FACING). - /// This flag is mutually exclusive with OPTIX_RAY_FLAG_CULL_FRONT_FACING_TRIANGLES. - OPTIX_RAY_FLAG_CULL_BACK_FACING_TRIANGLES = 1u << 4, - - /// Do not intersect triangle front faces - /// (respects a possible face change due to instance flag - /// OPTIX_INSTANCE_FLAG_FLIP_TRIANGLE_FACING). - /// This flag is mutually exclusive with OPTIX_RAY_FLAG_CULL_BACK_FACING_TRIANGLES. - OPTIX_RAY_FLAG_CULL_FRONT_FACING_TRIANGLES = 1u << 5, - - /// Do not intersect geometry which disables anyhit programs - /// (due to setting geometry flag OPTIX_GEOMETRY_FLAG_DISABLE_ANYHIT or - /// instance flag OPTIX_INSTANCE_FLAG_DISABLE_ANYHIT). - /// This flag is mutually exclusive with OPTIX_RAY_FLAG_CULL_ENFORCED_ANYHIT, - /// OPTIX_RAY_FLAG_ENFORCE_ANYHIT, OPTIX_RAY_FLAG_DISABLE_ANYHIT. - OPTIX_RAY_FLAG_CULL_DISABLED_ANYHIT = 1u << 6, - - /// Do not intersect geometry which have an enabled anyhit program - /// (due to not setting geometry flag OPTIX_GEOMETRY_FLAG_DISABLE_ANYHIT or - /// setting instance flag OPTIX_INSTANCE_FLAG_ENFORCE_ANYHIT). - /// This flag is mutually exclusive with OPTIX_RAY_FLAG_CULL_DISABLED_ANYHIT, - /// OPTIX_RAY_FLAG_ENFORCE_ANYHIT, OPTIX_RAY_FLAG_DISABLE_ANYHIT. - OPTIX_RAY_FLAG_CULL_ENFORCED_ANYHIT = 1u << 7, - - /// Force 4-state opacity micromaps to behave as 2-state opacity micromaps during traversal. - OPTIX_RAY_FLAG_FORCE_OPACITY_MICROMAP_2_STATE = 1u << 10, -} OptixRayFlags; - -/// Transform -/// -/// OptixTransformType is used by the device function #optixGetTransformTypeFromHandle() to -/// determine the type of the OptixTraversableHandle returned from -/// optixGetTransformListHandle(). -typedef enum OptixTransformType -{ - OPTIX_TRANSFORM_TYPE_NONE = 0, ///< Not a transformation - OPTIX_TRANSFORM_TYPE_STATIC_TRANSFORM = 1, ///< \see #OptixStaticTransform - OPTIX_TRANSFORM_TYPE_MATRIX_MOTION_TRANSFORM = 2, ///< \see #OptixMatrixMotionTransform - OPTIX_TRANSFORM_TYPE_SRT_MOTION_TRANSFORM = 3, ///< \see #OptixSRTMotionTransform - OPTIX_TRANSFORM_TYPE_INSTANCE = 4, ///< \see #OptixInstance -} OptixTransformType; - -/// Hit Object -/// Struct to store the data collected in a hit object during traversal in an internal format -/// using \c optixHitObjectGetTraverseData(). -/// The hit object can be reconstructed using that data at a later point with -/// \c optixMakeHitObjectWithTraverseData(). -typedef struct OptixTraverseData -{ - unsigned int data[20]; -} OptixTraverseData; - -/// Specifies the set of valid traversable graphs that may be -/// passed to invocation of #optixTrace(). Flags may be bitwise combined. -typedef enum OptixTraversableGraphFlags -{ - /// Used to signal that any traversable graphs is valid. - /// This flag is mutually exclusive with all other flags. - OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_ANY = 0, - - /// Used to signal that a traversable graph of a single Geometry Acceleration - /// Structure (GAS) without any transforms is valid. This flag may be combined with - /// other flags except for OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_ANY. - OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_SINGLE_GAS = 1u << 0, - - /// Used to signal that a traversable graph of a single Instance Acceleration - /// Structure (IAS) directly connected to Geometry Acceleration Structure (GAS) - /// traversables without transform traversables in between is valid. This flag may - /// be combined with other flags except for OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_ANY. - OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_SINGLE_LEVEL_INSTANCING = 1u << 1, -} OptixTraversableGraphFlags; - -/// Optimization levels -/// -/// \see #OptixModuleCompileOptions::optLevel -typedef enum OptixCompileOptimizationLevel -{ - /// Default is to run all optimizations - OPTIX_COMPILE_OPTIMIZATION_DEFAULT = 0, - /// No optimizations - OPTIX_COMPILE_OPTIMIZATION_LEVEL_0 = 0x2340, - /// Some optimizations - OPTIX_COMPILE_OPTIMIZATION_LEVEL_1 = 0x2341, - /// Most optimizations - OPTIX_COMPILE_OPTIMIZATION_LEVEL_2 = 0x2342, - /// All optimizations - OPTIX_COMPILE_OPTIMIZATION_LEVEL_3 = 0x2343, -} OptixCompileOptimizationLevel; - -/// Debug levels -/// -/// \see #OptixModuleCompileOptions::debugLevel -typedef enum OptixCompileDebugLevel -{ - /// Default currently is minimal - OPTIX_COMPILE_DEBUG_LEVEL_DEFAULT = 0, - /// No debug information - OPTIX_COMPILE_DEBUG_LEVEL_NONE = 0x2350, - /// Generate information that does not impact performance. - /// Note this replaces OPTIX_COMPILE_DEBUG_LEVEL_LINEINFO. - OPTIX_COMPILE_DEBUG_LEVEL_MINIMAL = 0x2351, - /// Generate some debug information with slight performance cost - OPTIX_COMPILE_DEBUG_LEVEL_MODERATE = 0x2353, - /// Generate full debug information - OPTIX_COMPILE_DEBUG_LEVEL_FULL = 0x2352, -} OptixCompileDebugLevel; - -/// Module compilation state. -/// -/// \see #optixModuleGetCompilationState(), #optixModuleCreateWithTasks() -typedef enum OptixModuleCompileState -{ - /// No OptixTask objects have started - OPTIX_MODULE_COMPILE_STATE_NOT_STARTED = 0x2360, - - /// Started, but not all OptixTask objects have completed. No detected failures. - OPTIX_MODULE_COMPILE_STATE_STARTED = 0x2361, - - /// Not all OptixTask objects have completed, but at least one has failed. - OPTIX_MODULE_COMPILE_STATE_IMPENDING_FAILURE = 0x2362, - - /// All OptixTask objects have completed, and at least one has failed - OPTIX_MODULE_COMPILE_STATE_FAILED = 0x2363, - - /// All OptixTask objects have completed. The OptixModule is ready to be used. - OPTIX_MODULE_COMPILE_STATE_COMPLETED = 0x2364, -} OptixModuleCompileState; - -/// Flags for canceling the creation of an OptiX object. -/// -/// If OPTIX_CREATION_FLAG_BLOCK_UNTIL_EFFECTIVE is set, the calling thread will block until one of these conditions is met: -/// 1. All executing object creation threads have processed the new state -/// 2. The creation of the object has finished, in which case the new state will be ignored -/// -/// If OPTIX_CREATION_FLAG_BLOCK_UNTIL_EFFECTIVE is not set, any *CancelCreation* call will return without blocking. -/// Note that the cancel request may still be ignored if all creation threads finish their tasks before they can process the new state. -/// -/// \see #optixModuleCancelCreation(), #optixPipelineCancelCreations(), #optixDeviceContextCancelCreations() -typedef enum OptixCreationFlags -{ - OPTIX_CREATION_FLAG_NONE = 0, - OPTIX_CREATION_FLAG_BLOCK_UNTIL_EFFECTIVE = 1 << 0, -} OptixCreationFlags; - - -/// Struct for specifying specializations for pipelineParams as specified in -/// OptixPipelineCompileOptions::pipelineLaunchParamsVariableName. -/// -/// The bound values are supposed to represent a constant value in the -/// pipelineParams. OptiX will attempt to locate all loads from the pipelineParams and -/// correlate them to the appropriate bound value, but there are cases where OptiX cannot -/// safely or reliably do this. For example if the pointer to the pipelineParams is passed -/// as an argument to a non-inline function or the offset of the load to the -/// pipelineParams cannot be statically determined (e.g. accessed in a loop). No module -/// should rely on the value being specialized in order to work correctly. The values in -/// the pipelineParams specified on optixLaunch should match the bound value. If -/// validation mode is enabled on the context, OptiX will verify that the bound values -/// specified matches the values in pipelineParams specified to optixLaunch. -/// -/// These values are compiled in to the module as constants. Once the constants are -/// inserted into the code, an optimization pass will be run that will attempt to -/// propagate the consants and remove unreachable code. -/// -/// If caching is enabled, changes in these values will result in newly compiled modules. -/// -/// The pipelineParamOffset and sizeInBytes must be within the bounds of the -/// pipelineParams variable. OPTIX_ERROR_INVALID_VALUE will be returned from -/// optixModuleCreate otherwise. -/// -/// If more than one bound value overlaps or the size of a bound value is equal to 0, -/// an OPTIX_ERROR_INVALID_VALUE will be returned from optixModuleCreate. -/// -/// The same set of bound values do not need to be used for all modules in a pipeline, but -/// overlapping values between modules must have the same value. -/// OPTIX_ERROR_INVALID_VALUE will be returned from optixPipelineCreate otherwise. -/// -/// \see #OptixModuleCompileOptions -typedef struct OptixModuleCompileBoundValueEntry { - size_t pipelineParamOffsetInBytes; - size_t sizeInBytes; - const void* boundValuePtr; - const char* annotation; // optional string to display, set to 0 if unused. If unused, - // OptiX will report the annotation as "No annotation" -} OptixModuleCompileBoundValueEntry; - -/// Payload type identifiers. -typedef enum OptixPayloadTypeID { - OPTIX_PAYLOAD_TYPE_DEFAULT = 0, - OPTIX_PAYLOAD_TYPE_ID_0 = (1 << 0u), - OPTIX_PAYLOAD_TYPE_ID_1 = (1 << 1u), - OPTIX_PAYLOAD_TYPE_ID_2 = (1 << 2u), - OPTIX_PAYLOAD_TYPE_ID_3 = (1 << 3u), - OPTIX_PAYLOAD_TYPE_ID_4 = (1 << 4u), - OPTIX_PAYLOAD_TYPE_ID_5 = (1 << 5u), - OPTIX_PAYLOAD_TYPE_ID_6 = (1 << 6u), - OPTIX_PAYLOAD_TYPE_ID_7 = (1 << 7u) -} OptixPayloadTypeID; - -/// Semantic flags for a single payload word. -/// -/// Used to specify the semantics of a payload word per shader type. -/// "read": Shader of this type may read the payload word. -/// "write": Shader of this type may write the payload word. -/// -/// "trace_caller_write": Shaders may consume the value of the payload word passed to optixTrace by the caller. -/// "trace_caller_read": The caller to optixTrace may read the payload word after the call to optixTrace. -/// -/// Semantics can be bitwise combined. -/// Combining "read" and "write" is equivalent to specifying "read_write". -/// A payload needs to be writable by the caller or at least one shader type. -/// A payload needs to be readable by the caller or at least one shader type after a being writable. -typedef enum OptixPayloadSemantics -{ - OPTIX_PAYLOAD_SEMANTICS_TRACE_CALLER_NONE = 0, - OPTIX_PAYLOAD_SEMANTICS_TRACE_CALLER_READ = 1u << 0, - OPTIX_PAYLOAD_SEMANTICS_TRACE_CALLER_WRITE = 2u << 0, - OPTIX_PAYLOAD_SEMANTICS_TRACE_CALLER_READ_WRITE = 3u << 0, - - OPTIX_PAYLOAD_SEMANTICS_CH_NONE = 0, - OPTIX_PAYLOAD_SEMANTICS_CH_READ = 1u << 2, - OPTIX_PAYLOAD_SEMANTICS_CH_WRITE = 2u << 2, - OPTIX_PAYLOAD_SEMANTICS_CH_READ_WRITE = 3u << 2, - - OPTIX_PAYLOAD_SEMANTICS_MS_NONE = 0, - OPTIX_PAYLOAD_SEMANTICS_MS_READ = 1u << 4, - OPTIX_PAYLOAD_SEMANTICS_MS_WRITE = 2u << 4, - OPTIX_PAYLOAD_SEMANTICS_MS_READ_WRITE = 3u << 4, - - OPTIX_PAYLOAD_SEMANTICS_AH_NONE = 0, - OPTIX_PAYLOAD_SEMANTICS_AH_READ = 1u << 6, - OPTIX_PAYLOAD_SEMANTICS_AH_WRITE = 2u << 6, - OPTIX_PAYLOAD_SEMANTICS_AH_READ_WRITE = 3u << 6, - - OPTIX_PAYLOAD_SEMANTICS_IS_NONE = 0, - OPTIX_PAYLOAD_SEMANTICS_IS_READ = 1u << 8, - OPTIX_PAYLOAD_SEMANTICS_IS_WRITE = 2u << 8, - OPTIX_PAYLOAD_SEMANTICS_IS_READ_WRITE = 3u << 8, -} OptixPayloadSemantics; - -/// Specifies a single payload type -typedef struct OptixPayloadType -{ - /// The number of 32b words the payload of this type holds - unsigned int numPayloadValues; - - /// Points to host array of payload word semantics, size must match numPayloadValues - const unsigned int *payloadSemantics; -} OptixPayloadType; - -/// Compilation options for module -/// -/// \see #optixModuleCreate() -typedef struct OptixModuleCompileOptions -{ - /// Maximum number of registers allowed when compiling to SASS. - /// Set to 0 for no explicit limit. May vary within a pipeline. - int maxRegisterCount; - - /// Optimization level. May vary within a pipeline. - OptixCompileOptimizationLevel optLevel; - - /// Generate debug information. - OptixCompileDebugLevel debugLevel; - - /// Ingored if numBoundValues is set to 0 - const OptixModuleCompileBoundValueEntry* boundValues; - - /// set to 0 if unused - unsigned int numBoundValues; - - /// The number of different payload types available for compilation. - /// Must be zero if OptixPipelineCompileOptions::numPayloadValues is not zero. - unsigned int numPayloadTypes; - - /// Points to host array of payload type definitions, size must match numPayloadTypes - const OptixPayloadType* payloadTypes; - - /// If not \c nullptr, pointer to the base module for potential specialization. - OptixModule baseModule; -} OptixModuleCompileOptions; - -/// Specifies the options for retrieving an intersection program for a built-in primitive type. -/// The primitive type must not be OPTIX_PRIMITIVE_TYPE_CUSTOM. -/// -/// \see #optixBuiltinISModuleGet() -typedef struct OptixBuiltinISOptions -{ - OptixPrimitiveType builtinISModuleType; - /// Boolean value indicating whether vertex motion blur is used (but not motion transform blur). - int usesMotionBlur; - /// Build flags, see OptixBuildFlags. - unsigned int buildFlags; - /// End cap properties of curves, see OptixCurveEndcapFlags, 0 for non-curve types. - unsigned int curveEndcapFlags; -} OptixBuiltinISOptions; - -/// Distinguishes different kinds of program groups. -typedef enum OptixProgramGroupKind -{ - /// Program group containing a raygen (RG) program - /// \see #OptixProgramGroupSingleModule, #OptixProgramGroupDesc::raygen - OPTIX_PROGRAM_GROUP_KIND_RAYGEN = 0x2421, - - /// Program group containing a miss (MS) program - /// \see #OptixProgramGroupSingleModule, #OptixProgramGroupDesc::miss - OPTIX_PROGRAM_GROUP_KIND_MISS = 0x2422, - - /// Program group containing an exception (EX) program - /// \see OptixProgramGroupHitgroup, #OptixProgramGroupDesc::exception - OPTIX_PROGRAM_GROUP_KIND_EXCEPTION = 0x2423, - - /// Program group containing an intersection (IS), any hit (AH), and/or closest hit (CH) program - /// \see #OptixProgramGroupSingleModule, #OptixProgramGroupDesc::hitgroup - OPTIX_PROGRAM_GROUP_KIND_HITGROUP = 0x2424, - - /// Program group containing a direct (DC) or continuation (CC) callable program - /// \see OptixProgramGroupCallables, #OptixProgramGroupDesc::callables - OPTIX_PROGRAM_GROUP_KIND_CALLABLES = 0x2425 -} OptixProgramGroupKind; - -/// Flags for program groups -typedef enum OptixProgramGroupFlags -{ - /// Currently there are no flags - OPTIX_PROGRAM_GROUP_FLAGS_NONE = 0 -} OptixProgramGroupFlags; - -/// Program group representing a single module. -/// -/// Used for raygen, miss, and exception programs. In case of raygen and exception programs, module and entry -/// function name need to be valid. For miss programs, module and entry function name might both be \c nullptr. -/// -/// \see #OptixProgramGroupDesc::raygen, #OptixProgramGroupDesc::miss, #OptixProgramGroupDesc::exception -typedef struct OptixProgramGroupSingleModule -{ - /// Module holding single program. - OptixModule module; - /// Entry function name of the single program. - const char* entryFunctionName; -} OptixProgramGroupSingleModule; - -/// Program group representing the hitgroup. -/// -/// For each of the three program types, module and entry function name might both be \c nullptr. -/// -/// \see #OptixProgramGroupDesc::hitgroup -typedef struct OptixProgramGroupHitgroup -{ - /// Module holding the closest hit (CH) program. - OptixModule moduleCH; - /// Entry function name of the closest hit (CH) program. - const char* entryFunctionNameCH; - /// Module holding the any hit (AH) program. - OptixModule moduleAH; - /// Entry function name of the any hit (AH) program. - const char* entryFunctionNameAH; - /// Module holding the intersection (Is) program. - OptixModule moduleIS; - /// Entry function name of the intersection (IS) program. - const char* entryFunctionNameIS; -} OptixProgramGroupHitgroup; - -/// Program group representing callables. -/// -/// Module and entry function name need to be valid for at least one of the two callables. -/// -/// \see ##OptixProgramGroupDesc::callables -typedef struct OptixProgramGroupCallables -{ - /// Module holding the direct callable (DC) program. - OptixModule moduleDC; - /// Entry function name of the direct callable (DC) program. - const char* entryFunctionNameDC; - /// Module holding the continuation callable (CC) program. - OptixModule moduleCC; - /// Entry function name of the continuation callable (CC) program. - const char* entryFunctionNameCC; -} OptixProgramGroupCallables; - -/// Descriptor for program groups. -typedef struct OptixProgramGroupDesc -{ - /// The kind of program group. - OptixProgramGroupKind kind; - - /// See #OptixProgramGroupFlags - unsigned int flags; - - union - { - /// \see #OPTIX_PROGRAM_GROUP_KIND_HITGROUP - OptixProgramGroupHitgroup hitgroup; - /// \see #OPTIX_PROGRAM_GROUP_KIND_RAYGEN - OptixProgramGroupSingleModule raygen; - /// \see #OPTIX_PROGRAM_GROUP_KIND_MISS - OptixProgramGroupSingleModule miss; - /// \see #OPTIX_PROGRAM_GROUP_KIND_EXCEPTION - OptixProgramGroupSingleModule exception; - /// \see #OPTIX_PROGRAM_GROUP_KIND_CALLABLES - OptixProgramGroupCallables callables; - }; -} OptixProgramGroupDesc; - -/// Program group options -/// -/// \see #optixProgramGroupCreate() -typedef struct OptixProgramGroupOptions -{ - /// Specifies the payload type of this program group. - /// All programs in the group must support the payload type - /// (Program support for a type is specified by calling - /// \see #optixSetPayloadTypes or otherwise all types specified in - /// \see #OptixModuleCompileOptions are supported). - /// If a program is not available for the requested payload type, - /// optixProgramGroupCreate returns OPTIX_ERROR_PAYLOAD_TYPE_MISMATCH. - /// If the payloadType is left zero, a unique type is deduced. - /// The payload type can be uniquely deduced if there is exactly one payload type - /// for which all programs in the group are available. - /// If the payload type could not be deduced uniquely - /// optixProgramGroupCreate returns OPTIX_ERROR_PAYLOAD_TYPE_RESOLUTION_FAILED. - const OptixPayloadType* payloadType; -} OptixProgramGroupOptions; - -/// The following values are used to indicate which exception was thrown. -typedef enum OptixExceptionCodes -{ - /// Stack overflow of the continuation stack. - /// no exception details. - OPTIX_EXCEPTION_CODE_STACK_OVERFLOW = -1, - - /// The trace depth is exceeded. - /// no exception details. - OPTIX_EXCEPTION_CODE_TRACE_DEPTH_EXCEEDED = -2, - - -} OptixExceptionCodes; - -/// Exception flags. -/// -/// \see #OptixPipelineCompileOptions::exceptionFlags, #OptixExceptionCodes -typedef enum OptixExceptionFlags -{ - /// No exception are enabled. - OPTIX_EXCEPTION_FLAG_NONE = 0, - - /// Enables exceptions check related to the continuation stack. - /// This flag should be used when the application handles stack overflows - /// in a user exception program as part of the normal flow of execution. - /// For catching overflows during debugging and development, the - /// device context validation mode should be used instead. - /// \see OptixDeviceContextValidationMode - OPTIX_EXCEPTION_FLAG_STACK_OVERFLOW = 1u << 0, - - /// Enables exceptions check related to trace depth. - /// This flag should be used when the application handles trace depth overflows - /// in a user exception program as part of the normal flow of execution. - /// For catching overflows during debugging and development, the - /// device context validation mode should be used instead. - /// \see OptixDeviceContextValidationMode - OPTIX_EXCEPTION_FLAG_TRACE_DEPTH = 1u << 1, - - /// Enables user exceptions via optixThrowException(). This flag must be specified for all modules in a pipeline - /// if any module calls optixThrowException(). - OPTIX_EXCEPTION_FLAG_USER = 1u << 2, - -} OptixExceptionFlags; - -/// Compilation options for all modules of a pipeline. -/// -/// Similar to #OptixModuleCompileOptions, but these options here need to be equal for all modules of a pipeline. -/// -/// \see #optixModuleCreate(), #optixPipelineCreate() -typedef struct OptixPipelineCompileOptions -{ - /// Boolean value indicating whether motion blur could be used - int usesMotionBlur; - - /// Traversable graph bitfield. See OptixTraversableGraphFlags - unsigned int traversableGraphFlags; - - /// How much storage, in 32b words, to make available for the payload, [0..32] - /// Must be zero if numPayloadTypes is not zero. - int numPayloadValues; - - /// How much storage, in 32b words, to make available for the attributes. The - /// minimum number is 2. Values below that will automatically be changed to 2. [2..8] - int numAttributeValues; - - /// A bitmask of OptixExceptionFlags indicating which exceptions are enabled. - unsigned int exceptionFlags; - - /// The name of the pipeline parameter variable. If 0, no pipeline parameter - /// will be available. This will be ignored if the launch param variable was - /// optimized out or was not found in the modules linked to the pipeline. - const char* pipelineLaunchParamsVariableName; - - /// Size of the variable pointed to by pipelineLaunchParamsVariableName. It will be a - /// compiler error if the size of the variable pointed to by - /// pipelineLaunchParamsVariableName is not equal to this size. - size_t pipelineLaunchParamsSizeInBytes; - - /// Bit field enabling primitive types. See OptixPrimitiveTypeFlags. - /// Setting to zero corresponds to enabling OPTIX_PRIMITIVE_TYPE_FLAGS_CUSTOM and OPTIX_PRIMITIVE_TYPE_FLAGS_TRIANGLE. - unsigned int usesPrimitiveTypeFlags; - - /// Boolean value indicating whether opacity micromaps may be used - int allowOpacityMicromaps; - - /// Boolean value indicating whether clusters (cluster acceleration structures) may be used. - /// This value MUST be set if clusters are present in the BVH, otherwise validation will return an error. - int allowClusteredGeometry; -} OptixPipelineCompileOptions; - -/// Link options for a pipeline -/// -/// \see #optixPipelineCreate() -typedef struct OptixPipelineLinkOptions -{ - /// Maximum trace recursion depth. 0 means a ray generation program can be - /// launched, but can't trace any rays. The maximum allowed value is 31. - unsigned int maxTraceDepth; - - /// Maximum depth of continuation callable call graphs. 0 means that continuation callables - /// will not take part in the stack size calculation and can most likely not be called. - unsigned int maxContinuationCallableDepth; - /// Maximum depth of direct callable call graphs called from raygen, closesthit, miss or continuation callable programs. - /// 0 means that direct callables will not take part in the default stack size calculation for that part of the pipeline - /// and can not be called from the programs mentioned above if the callable needs any stack. - unsigned int maxDirectCallableDepthFromState; - /// Maximum depth of direct callable call graphs called from intersect or anyhit programs. - /// 0 means that direct callables will not take part in the default stack size calculation for that part of the pipeline - /// and can not be called from the programs mentioned above if the callable needs any stack. - unsigned int maxDirectCallableDepthFromTraversal; - - /// The maximum depth of a traversable graph passed to trace. - /// 0 means to take a default value based on the traversableGraphFlags passed to - /// OptixPipelineCompileOptions::traversableGraphFlags: - /// OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_SINGLE_GAS means to take 1, otherwise 2 will be taken. - unsigned int maxTraversableGraphDepth; -} OptixPipelineLinkOptions; - -/// Describes the shader binding table (SBT) -/// -/// \see #optixLaunch() -typedef struct OptixShaderBindingTable -{ - /// Device address of the SBT record of the ray gen program to start launch at. The address must be a multiple of - /// OPTIX_SBT_RECORD_ALIGNMENT. - CUdeviceptr raygenRecord; - - /// Device address of the SBT record of the exception program. The address must be a multiple of - /// OPTIX_SBT_RECORD_ALIGNMENT. - CUdeviceptr exceptionRecord; - - /// Arrays of SBT records for miss programs. The base address and the stride must be a multiple of - /// OPTIX_SBT_RECORD_ALIGNMENT. - /// @{ - CUdeviceptr missRecordBase; - unsigned int missRecordStrideInBytes; - unsigned int missRecordCount; - /// @} - - /// Arrays of SBT records for hit groups. The base address and the stride must be a multiple of - /// OPTIX_SBT_RECORD_ALIGNMENT. - /// @{ - CUdeviceptr hitgroupRecordBase; - unsigned int hitgroupRecordStrideInBytes; - unsigned int hitgroupRecordCount; - /// @} - - /// Arrays of SBT records for callable programs. If the base address is not null, the stride and count must not be - /// zero. If the base address is null, then the count needs to zero. The base address and the stride must be a - /// multiple of OPTIX_SBT_RECORD_ALIGNMENT. - /// @{ - CUdeviceptr callablesRecordBase; - unsigned int callablesRecordStrideInBytes; - unsigned int callablesRecordCount; - /// @} - -} OptixShaderBindingTable; - -/// Describes the stack size requirements of a program group. -/// -/// \see optixProgramGroupGetStackSize() -typedef struct OptixStackSizes -{ - /// Continuation stack size of RG programs in bytes - unsigned int cssRG; - /// Continuation stack size of MS programs in bytes - unsigned int cssMS; - /// Continuation stack size of CH programs in bytes - unsigned int cssCH; - /// Continuation stack size of AH programs in bytes - unsigned int cssAH; - /// Continuation stack size of IS programs in bytes - unsigned int cssIS; - /// Continuation stack size of CC programs in bytes - unsigned int cssCC; - /// Direct stack size of DC programs in bytes - unsigned int dssDC; - -} OptixStackSizes; - - -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -///// Cooperative Vector -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// - -/// Flags used to interpret the result of #optixDeviceContextGetProperty() and -/// OPTIX_DEVICE_PROPERTY_COOP_VEC -/// -/// \see #optixDeviceContextGetProperty() -typedef enum OptixDevicePropertyCoopVecFlags -{ - /// Any use of cooperative vector host APIs or device intrinsics will result in an - /// error. - OPTIX_DEVICE_PROPERTY_COOP_VEC_FLAG_NONE = 0, - - // Standard cooperative vector features are supported - OPTIX_DEVICE_PROPERTY_COOP_VEC_FLAG_STANDARD = 1 << 0, -} OptixDevicePropertyCoopVecFlags; - -typedef enum OptixCoopVecElemType -{ - OPTIX_COOP_VEC_ELEM_TYPE_UNKNOWN = 0x2A00, - /// 16 bit float - OPTIX_COOP_VEC_ELEM_TYPE_FLOAT16 = 0x2A01, - /// 32 bit float - OPTIX_COOP_VEC_ELEM_TYPE_FLOAT32 = 0x2A03, - /// 8 bit unsigned integer - OPTIX_COOP_VEC_ELEM_TYPE_UINT8 = 0x2A04, - /// 8 bit signed integer - OPTIX_COOP_VEC_ELEM_TYPE_INT8 = 0x2A05, - /// 32 bit unsigned integer - OPTIX_COOP_VEC_ELEM_TYPE_UINT32 = 0x2A08, - /// 32 bit signed integer - OPTIX_COOP_VEC_ELEM_TYPE_INT32 = 0x2A09, - /// FLOAT8 type with 4 bits exponent, 3 bits mantissa. Only supported as the inputInterpretation and matrixElementType. - OPTIX_COOP_VEC_ELEM_TYPE_FLOAT8_E4M3 = 0x2A0A, - /// FLOAT8 type with 5 bits exponent, 2 bits mantissa. Only supported as the inputInterpretation and matrixElementType. - OPTIX_COOP_VEC_ELEM_TYPE_FLOAT8_E5M2 = 0x2A0B, -} OptixCoopVecElemType; - -typedef enum OptixCoopVecMatrixLayout -{ - OPTIX_COOP_VEC_MATRIX_LAYOUT_ROW_MAJOR = 0x2A40, - OPTIX_COOP_VEC_MATRIX_LAYOUT_COLUMN_MAJOR = 0x2A41, - OPTIX_COOP_VEC_MATRIX_LAYOUT_INFERENCING_OPTIMAL = 0x2A42, - OPTIX_COOP_VEC_MATRIX_LAYOUT_TRAINING_OPTIMAL = 0x2A43, -} OptixCoopVecMatrixLayout; - -/// Each matrix's offset from the base address is expressed with offsetInBytes. This -/// allows for non-uniform matrices to be tightly packed. -/// -/// The rowColumnStrideInBytes is ignored if the layout is either -/// OPTIX_COOP_VEC_MATRIX_LAYOUT_INFERENCING_OPTIMAL or -/// OPTIX_COOP_VEC_MATRIX_LAYOUT_TRAINING_OPTIMAL -typedef struct OptixCoopVecMatrixDescription -{ - unsigned int N; - unsigned int K; - unsigned int offsetInBytes; - OptixCoopVecElemType elementType; - OptixCoopVecMatrixLayout layout; - unsigned int rowColumnStrideInBytes; - unsigned int sizeInBytes; -} OptixCoopVecMatrixDescription; - -typedef struct OptixNetworkDescription -{ - OptixCoopVecMatrixDescription* layers; - unsigned int numLayers; -} OptixNetworkDescription; - -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -///// Function table -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// - - -/// Options that can be passed to \c optixQueryFunctionTable() -typedef enum OptixQueryFunctionTableOptions -{ - /// Placeholder (there are no options yet) - OPTIX_QUERY_FUNCTION_TABLE_OPTION_DUMMY = 0 - -} OptixQueryFunctionTableOptions; - -/// Type of the function \c optixQueryFunctionTable() -typedef OptixResult( OptixQueryFunctionTable_t )( int abiId, - unsigned int numOptions, - OptixQueryFunctionTableOptions* /*optionKeys*/, - const void** /*optionValues*/, - void* functionTable, - size_t sizeOfTable ); - - - -/**@}*/ // end group optix_types - -#endif // OPTIX_OPTIX_TYPES_H diff --git a/crtx/rtx.h b/crtx/rtx.h deleted file mode 100644 index 04b8203..0000000 --- a/crtx/rtx.h +++ /dev/null @@ -1,60 +0,0 @@ -#pragma once - -#ifdef RTX_EXPORTS - #ifdef _MSC_VER - #define DLL_API __declspec(dllexport) - #elif(__GNUG__) - #if __clang__ - #define DLL_API __attribute__((visibility("default"))) - #else - #define DLL_API __attribute__((visibility("default"))) - #endif - #else - #define DLL_API - #endif -#else - #ifdef _MSC_VER - #define DLL_API __declspec(dllimport) - #else - #define DLL_API - #endif //_MSC_VER -#endif - -extern "C" { - - /// Initialize OptiX and CUDA and prepare a context ready for device 0 - /// @return 0 on success and appropriate error code on error - DLL_API int initRTX(); - - /// Return the hash value that identifies the current acceleration structure - /// @return uint64(-1) if no acceleration structure is present and the hash - /// that was provided to buildRTX if it is present - DLL_API uint64_t getHashRTX(); - - /// Build an OptiX ray/triangle acceleration structure based on the vertex and index buffer provided - /// @param hash A hash value that should uniquely identify the index and vertex buffers - /// @param verts Pointer to the vertex buffer. Format is 3 float32 per vertex. - /// @param vBytes The size of the vertex buffer in bytes. - /// @param triangles Pointer to the index buffer. Format is 3 int32 per triangle. - /// @param tBytes The size of the index buffer in bytes. - /// @return 0 on success and appropriate error code on error - DLL_API int buildRTX(uint64_t hash, void* verts, int64_t vBytes, void* triangles, int tBytes); - - /// Trace the array of rays provided and return the result in hits - /// @param rays A buffer of rays to trace. Each ray is made of 8 float32 and has the following layout: - /// [0:3] - ray origin - /// [3] - ray minT (intersection closer than this value are ignored) - /// [4:7] - ray direction (normalized) - /// [7] - ray maxT (intersections farther than this value are ignored) - /// @param hits A buffer containing data for each hit. Each entry is made of 4 float32 and they have the following layout: - /// [0] - distance to the intersection point or -1 if the ray failed to intersect anything - /// [1:4] - the normal vector at the point of intersection. The vector is of unit length. If there is no valid hit, - /// the contents are undefined - /// @param size The number of rays we're tracing. - /// @return 0 on success and appropriate error code on error - DLL_API int traceRTX(void* rays, void* hits, int size); - - /// Deallocate all resources currently owned - /// @return 0 on success and appropriate error code on error - DLL_API int cleanRTX(); -} diff --git a/crtx/common.h b/cuda/common.h similarity index 99% rename from crtx/common.h rename to cuda/common.h index 36e7167..cef3b4f 100644 --- a/crtx/common.h +++ b/cuda/common.h @@ -54,4 +54,3 @@ struct Params Ray* rays; Hit* hits; }; - diff --git a/crtx/kernel.cu b/cuda/kernel.cu similarity index 90% rename from crtx/kernel.cu rename to cuda/kernel.cu index 35d982a..317596e 100644 --- a/crtx/kernel.cu +++ b/cuda/kernel.cu @@ -26,20 +26,20 @@ extern "C" __global__ void __raygen__main() unsigned int t, nx, ny, nz; Ray ray = params.rays[linear_idx]; optixTrace( - params.handle, - ray.origin, - ray.dir, - ray.tmin, - ray.tmax, - 0.0f, + params.handle, + ray.origin, + ray.dir, + ray.tmin, + ray.tmax, + 0.0f, OptixVisibilityMask( 1 ), - OPTIX_RAY_FLAG_NONE, - RAY_TYPE_RADIANCE, - RAY_TYPE_COUNT, - RAY_TYPE_RADIANCE, - t, - nx, - ny, + OPTIX_RAY_FLAG_NONE, + RAY_TYPE_RADIANCE, + RAY_TYPE_COUNT, + RAY_TYPE_RADIANCE, + t, + nx, + ny, nz ); diff --git a/examples/ham_radio_viewshed_analysis.ipynb b/examples/ham_radio_viewshed_analysis.ipynb index 099aca2..a75e7f2 100644 --- a/examples/ham_radio_viewshed_analysis.ipynb +++ b/examples/ham_radio_viewshed_analysis.ipynb @@ -210,7 +210,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 3, "id": "download-dem", "metadata": {}, "outputs": [ @@ -218,27 +218,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Downloading SRTM elevation data...\n", - "(This may take a minute on first run)\n", - "make: Entering directory '/home/brendan/.cache/elevation/SRTM1'\n", - "make: Nothing to be done for 'download'.\n", - "make: Leaving directory '/home/brendan/.cache/elevation/SRTM1'\n", - "make: Entering directory '/home/brendan/.cache/elevation/SRTM1'\n", - "make: Nothing to be done for 'all'.\n", - "make: Leaving directory '/home/brendan/.cache/elevation/SRTM1'\n", - "make: Entering directory '/home/brendan/.cache/elevation/SRTM1'\n", - "cp SRTM1.vrt SRTM1.c8a6cc268e724b08bcd290ec34e307ac.vrt\n", - "make: Leaving directory '/home/brendan/.cache/elevation/SRTM1'\n", - "make: Entering directory '/home/brendan/.cache/elevation/SRTM1'\n", - "gdal_translate -q -co TILED=YES -co COMPRESS=DEFLATE -co ZLEVEL=9 -co PREDICTOR=2 -projwin -105.4 40.05 -104.85 39.55 SRTM1.c8a6cc268e724b08bcd290ec34e307ac.vrt /home/brendan/rtxpy/examples/denver_dem_wgs84.tif\n", - "rm -f SRTM1.c8a6cc268e724b08bcd290ec34e307ac.vrt\n", - "make: Leaving directory '/home/brendan/.cache/elevation/SRTM1'\n", - "make: Entering directory '/home/brendan/.cache/elevation/SRTM1'\n", - "find cache -size 0 -name \"*.tif\" -delete\n", - "rm -f SRTM1.*.vrt\n", - "rm -f -r spool/*\n", - "make: Leaving directory '/home/brendan/.cache/elevation/SRTM1'\n", - "Download complete!\n", + "Using existing DEM file: /home/brendan/rtxpy/examples/denver_dem_wgs84.tif\n", "\n", "Reprojecting to EPSG:5070...\n", "Filling 683,908 NaN values from reprojection...\n", @@ -300,7 +280,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 4, "id": "visualize-dem", "metadata": {}, "outputs": [ @@ -350,7 +330,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 5, "id": "query-api", "metadata": {}, "outputs": [ @@ -416,7 +396,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 6, "id": "filter-repeaters", "metadata": {}, "outputs": [ @@ -519,7 +499,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 7, "id": "cpu-viewshed", "metadata": {}, "outputs": [ @@ -530,14 +510,14 @@ "Computing CPU viewsheds for 5 repeaters...\n", "Observer height: 30m, Target height: 1.5m\n", "\n", - " W0TLM: 12.57s - 16.0% coverage\n", - " N0VOF: 4.86s - 7.3% coverage\n", - " W0CDS: 6.52s - 14.2% coverage\n", - " K0MTN: 13.07s - 30.7% coverage\n", - " N0DN: 4.53s - 7.1% coverage\n", + " W0TLM: 12.67s - 16.0% coverage\n", + " N0VOF: 4.98s - 7.3% coverage\n", + " W0CDS: 6.56s - 14.2% coverage\n", + " K0MTN: 13.05s - 30.7% coverage\n", + " N0DN: 4.73s - 7.1% coverage\n", "\n", - "Total CPU time: 41.55s\n", - "Average per viewshed: 8.31s\n" + "Total CPU time: 41.98s\n", + "Average per viewshed: 8.40s\n" ] } ], @@ -626,7 +606,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 8, "id": "gpu-viewshed", "metadata": {}, "outputs": [ @@ -645,27 +625,6 @@ "name": "stderr", "output_type": "stream", "text": [ - "[OPTIX CB][4][KNOBS] All knobs on default.\n", - "\n", - "[OPTIX CB][4][DISKCACHE] Opened database: \"/var/tmp/OptixCache_brendan/optix7cache.db\"\n", - "[OPTIX CB][4][DISKCACHE] Cache data size: \"22.7 KiB\"\n", - "[OPTIX CB][4][MEMORY] GPU memory capacity exceeds host memory (GPU: 47.99 GiB, host: 47.04 GiB). Please ensure that host allocations do not exceed the amount of physical memory available.\n", - "[OPTIX CB][4][DISKCACHE] Cache hit for key: ptx-4576-keyafe4a7e681865c555d8da5b20732705e-sm_86-rtc1-drv591.44\n", - "\n", - "[OPTIX CB][4][COMPILER] \n", - "[OPTIX CB][4][COMPILER] Info: Pipeline statistics\n", - "\tmodule(s) : 1\n", - "\tentry function(s) : 3\n", - "\ttrace call(s) : 1\n", - "\tcontinuation callable call(s) : 0\n", - "\tdirect callable call(s) : 0\n", - "\tbasic block(s) in entry functions : 3\n", - "\tinstruction(s) in entry functions : 128\n", - "\tnon-entry function(s) : 0\n", - "\tbasic block(s) in non-entry functions: 0\n", - "\tinstruction(s) in non-entry functions: 0\n", - "\tdebug information : no\n", - "\n", "/home/brendan/miniconda/envs/xarray-spatial-everything/lib/python3.14/site-packages/numba/cuda/dispatcher.py:536: NumbaPerformanceWarning: Grid size 100 will likely result in GPU under-utilization due to low occupancy.\n", " warn(NumbaPerformanceWarning(msg))\n" ] @@ -674,16 +633,16 @@ "name": "stdout", "output_type": "stream", "text": [ - " W0TLM: 0.5657s\n", - " N0VOF: 0.0245s\n", - " W0CDS: 0.0180s\n", - " K0MTN: 0.0137s\n", - " N0DN: 0.0129s\n", + " W0TLM: 0.6930s\n", + " N0VOF: 0.0229s\n", + " W0CDS: 0.0184s\n", + " K0MTN: 0.0141s\n", + " N0DN: 0.0149s\n", "\n", - "Total GPU time: 0.6348s\n", - "Average per viewshed: 0.1270s\n", + "Total GPU time: 0.7632s\n", + "Average per viewshed: 0.1526s\n", "\n", - "Speedup: 65.4x faster on GPU!\n" + "Speedup: 55.0x faster on GPU!\n" ] } ], @@ -756,7 +715,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 9, "id": "visualize-single", "metadata": {}, "outputs": [ @@ -822,7 +781,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 10, "id": "visualize-multiple", "metadata": {}, "outputs": [ @@ -870,7 +829,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 11, "id": "combined-coverage", "metadata": {}, "outputs": [ @@ -925,7 +884,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 12, "id": "plot-combined", "metadata": {}, "outputs": [ @@ -1003,13 +962,13 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 13, "id": "benchmark-comparison", "metadata": {}, "outputs": [ { "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAABKUAAAHqCAYAAADVi/1VAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjgsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvwVt1zgAAAAlwSFlzAAAPYQAAD2EBqD+naQAAlZdJREFUeJzs3Xl8TGf7x/HvJJGNJJaQiDW1x16U2JWKvVp7qZ0+T6PaKkXVWqSbtYJWa2nRoi1a+lC11FJL7CqoJZaWWIqEICE5vz/8MjVNYolkTiSf9+s1L8597jnnOnMmkyvX3Oc+FsMwDAEAAAAAAAB25GB2AAAAAAAAAMh6KEoBAAAAAADA7ihKAQAAAAAAwO4oSgEAAAAAAMDuKEoBAAAAAADA7ihKAQAAAAAAwO4oSgEAAAAAAMDuKEoBAAAAAADA7ihKAQAAAAAAwO4oSgEmmDt3riwWi06ePGl2KFYbNmyQxWLRt99+m+77GjVqlCwWS7rvB3d1795dRYsWNTuMFGXEnwcAAJA2yPsA3A9FKSANtGrVSu7u7rp27VqKfTp37ixnZ2f9/fffdowsc9iwYYNefPFF+fr6ytnZWfny5VPLli31/fffmx1ampk+fbrmzp2b6u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6tSpun79uvbs2aNx48ZZn+Pm5qaNGzdq/fr1WrlypVatWqVFixbp2Wef1c8//2xTMEupeGb8/wTYibF+9NFHqlSpUrJ9c+TI8cBf5A+SeGvjAwcOPNZ2UpLScT7o+B9FSklm4qSaD2P8+PEaPny4evbsqffee0+5c+eWg4OD3njjjQeOeksrafmapMV+H/Y9OnDgwBS/nS1evHgaRAgAeNJ5eXkpf/78+v3335OsSxyJe7/CR926da1330uOq6urpLtzXybnxo0b1j4PK3/+/OrYsaPatGmjsmXLavHixZo7d26Su7zd6985SUJCgiwWi/73v/8l+3s1ceRYeuR9aZEfPUwhT5Jq1KihokWLavHixXrppZf0448/6ubNmzY3A7JYLPr222+1bds2/fjjj1q9erV69uypCRMmaNu2bcmOopNsc9XWrVs/dOzly5dXo0aNUlyfHu8ZICOjKAWksc6dO2v48OHav3+/Fi5cqBIlSljvjJaSxEuj8uXLd99fUtLd0SOFCxfWpk2bdOLECevldXXr1tWAAQO0ZMkSxcfHJ5nk2sHBQQ0bNlTDhg01ceJEjR8/XsOGDdP69esfuM/kYvX09Lzv8/LmzSs3NzfrN2z3OnLkyAP3U7JkSZUqVUrLly/XlClTUkwIEhUpUkT79+9XQkKCzWipw4cPW9enpcTROPcmRX/88YckWe90lzjK7OrVq9ah4VLSkUhSysnVt99+qwYNGuiLL76wab969apNEvywyZl097X45ZdfdO3aNZvRUun1WtnbU089Jenu5ZuP8t4GAGRNzZs31+eff64dO3Y88E5pjyrxd+qRI0eSjPS9ceOGzpw5o8aNG6dq29myZVOFChV09OhR66V3iY4ePSp/f3/r8rFjx5SQkGDNUYoVKybDMOTv728d6Z2c9Mj77s2P7pVcfvSwx3M/7du315QpUxQdHa1FixapaNGiqlGjRpJ+NWrUUI0aNTRu3DgtXLhQnTt31jfffKPevXsnu93atWtbL6d85513Hmuy83vd+55JzpEjR574XA24F5fvAWkscVTUiBEjtHfv3geOkpKkoKAgeXp6avz48cley37x4kWb5Tp16mjdunXasWOHtShVqVIleXh46P3335ebm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xtvvGEzqfmTKjQ0VLVr11b58uXVp08fPfXUUzp//ry2bt2qP//8U/v27TM7RABABlGiRAktXLhQnTp1UqlSpdS5c2dVrFhRhmEoIiJCCxculIODgwoWLPjI286XL59GjBihd999V3Xr1lWrVq3k7u6u3377TV9//bUaN26sli1b3ncb+/bt00svvaSmTZuqTp06yp07t/766y/NmzdPZ8+e1eTJk5OM0omIiFCrVq3UpEkTbd26VfPnz9dLL72kihUrSrqbN4wdO1ZDhw7VyZMn1bp1a3l4eCgiIkJLly5V3759NXDgwHTL+3r37q33339fvXv3VtWqVbVx40briPPkPOh47ufpp59W8eLFNWzYMMXGxtpcuidJ8+bN0/Tp0/XCCy+oWLFiunbtmmbNmiVPT081a9bsvtseNGiQDh48qAkTJmj9+vVq27atfH19FRkZqWXLlmnHjh367bffHhjjv02cOFFBQUGqVKmSunfvLj8/Px06dEifffaZ8ufPr6FDhz7yNoEMy+73+wOygNDQUEOS8cwzzyS7fs6cOYYkIyIiwqZ9/fr1RlBQkOHl5WW4uroaxYoVM7p3727s3LnTpt/BgwcNSUaZMmVs2seOHWtIMoYPH27TvnbtWuP55583/Pz8DGdnZ8PPz8/o1KmT8ccff9jsW8ncfjal2/bu2bPHePHFF408efIYLi4uRpEiRYz27dsba9euten366+/GlWqVDGcnZ2Np556ypg5c6b19r4PKzH+fPnyGU5OTkbevHmNli1bGsuXL7fpd/78eaNHjx6Gt7e34ezsbJQvXz5J3InH89FHH9m0p3T8iefq3tsEFylSxGjevLmxevVqo0KFCoaLi4tRunTpZG/du2vXLqN69eqGs7OzUbhwYWPixInJnv/IyEijefPmhoeHhyHJenvoW7duGW+99ZaRP39+w83NzahVq5axdetWo169ekluIb18+XIjICDAcHJysjln3bp1M4oUKWLT99q1a8abb75p+Pn5GdmyZTNKlChhfPTRRza3ezaMu7dmDg4OTnJcRYoUMbp165akPSVLliwxJBnr169Psi651yPxNf635OJJ6ZweP37c6Nq1q+Hr62tky5bNKFCggNGiRQvj22+/fei4AQBZx7Fj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ciXZd2xsrGJjY63LCQkJunz5svLkyUMeBQBAFvOwORRFqfs4e/asChUqZHYYAADAZGfOnFHBggXNDuOBIiMjJUk+Pj427T4+PtZ1kZGRypcvn816Jycn5c6d26aPv79/km0krkuuKBUSEqLRo0enzYEAAIBM4UE5FEWp+/Dw8JB090X09PQ0ORoAAGBv0dHRKlSokDUnQMqGDh2qAQMGWJejoqJUuHBh8igAALKgh82hKErdR+JQc09PT5IpAACysCfl8jNfX19J0vnz55U/f35r+/nz51WpUiVrnwsXLtg8786dO7p8+bL1+b6+vjp//rxNn8TlxD7/5uLiIhcXlyTt5FEAAGRdD8qhMv7kCAAAAHgo/v7+8vX11dq1a61t0dHR2r59uwIDAyVJgYGBunr1qnbt2mXts27dOiUkJKh69erWPhs3btTt27etfdasWaNSpUole+keAABAalCUAgAAeIJcv35de/fu1d69eyXdndx87969On36tCwWi9544w2NHTtWP/zwgw4cOKCuXbvKz8/Peoe+MmXKqEmTJurTp4927NihLVu2qF+/furYsaP8/PwkSS+99JKcnZ3Vq1cvHTx4UIsWLdKUKVNsLs8DAAB4XFy+BwAA8ATZuXOnGjRoYF1OLBR169ZNc+fO1dtvv62YmBj17dtXV69eVe3atbVq1Sq5urpan7NgwQL169dPDRs2lIODg9q0aaOpU6da13t5eennn39WcHCwqlSpIm9vb40YMUJ9+/a134ECAIBMz2IYhmF2EBlVdHS0vLy8FBUVxVwIAIAnQnx8vM0lV7i/bNmyydHRMcX15AKp97CvHe9ZPKoH/dwCAMz3sHkAI6UAAMgEDMNQZGSkrl69anYoT5ycOXPK19f3iZnMPLPgPYvHwc8tAGQOFKUAAMgEEv+4z5cvn9zd3flD7SEYhqEbN25Y70R3793qkP54zyI1+LkFgMyFohQAAE+4+Ph46x/3efLkMTucJ4qbm5sk6cKFC8qXLx+XBNkJ71k8Dn5uASDz4O57AAA84RLn43F3dzc5kidT4uvGvEb2w3sWj4ufWwDIHChKAQCQSXD5U+rwupmH1x6pxXsHADIHilIAAAAAAACwO4pSAAAAAAAAsDsmOgcAIBMLem+lXfe3enjzVD0vMjJS48aN08qVK/XXX38pX758qlSpkt544w01bNhQRYsW1alTpyTdnUumVKlSGjp0qNq1aydJ6t69u65evaply5bZbHfDhg1q0KCBrly5opw5cz7OoQHq3r275s2bp1deeUUzZ860WRccHKzp06erW7dumjt3rjkB3seoUaP0zTff6MyZM3J2dlaVKlU0btw4Va9eXdI/PyvJ2bFjh6pVq6ZRo0Zp9OjRSda7u7srJibmvvufO3euJk6cqD/++EOenp5q166dQkNDH//AAABPNEZKAQAAU508eVJVqlTRunXr9NFHH+nAgQNatWqVGjRooODgYGu/MWPG6Ny5c9qzZ4+qVaumDh066LfffjMxcmRFhQoV0jfffKObN29a227duqWFCxeqcOHCJkZ2fyVLltS0adN04MABbd68WUWLFlXjxo118eJFSVLNmjV17tw5m0fv3r3l7++vqlWrSpIGDhyYpE9AQIC1OJySiRMnatiwYRoyZIgOHjyoX375RUFBQel+zACAjI+iFAAAMNWrr74qi8WiHTt2qE2bNipZsqTKli2rAQMGaNu2bdZ+Hh4e8vX1VcmSJRUaGio3Nzf9+OOPJkaOrOjpp59WoUKF9P3331vbvv/+exUuXFiVK1e26ZuQkKCQkBD5+/vLzc1NFStW1LfffmtdHx8fr169elnXlypVSlOmTLHZRvfu3dW6dWt9/PHHyp8/v/LkyaPg4OBHvuvcSy+9pEaNGumpp55S2bJlNXHiREVHR2v//v2SJGdnZ/n6+lofefLk0fLly9WjRw/rpOI5cuSw6XP+/HmFh4erV69eKe73ypUrevfdd/Xll1/qpZdeUrFixVShQgW1atXK2qdnz56qUKGCYmNjJUlxcXGqXLmyunbt+kjHCAB48nD5HgDgvux9+df9pPbSMGRcly9f1qpVqzRu3Dhlz549yfqULrlzcnJStmzZFBcXl84Rwq7udwmYo6Pk6vpwfR0cJDe3B/dN5j33MHr27Kk5c+aoc+fOkqTZs2erR48e2rBhg02/kJAQzZ8/XzNnzlSJEiW0ceNGdenSRXnz5lW9evWUkJCgggULasmSJcqTJ49+++039e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72t7/V2+FQ48jJycHvf/97mEwmLFu2DH369AEAlJSUYO/evcjOzsb+/fuxefNm7uAbCMeFvl28eBGzZs2Cg4MDrly5AhFBr169YDAYYDAYUFVVBYPBgMrKSnTq1AmrVq3SumT6fw8GViJ6Ojw26Q8zmvlxHOgLM1nTwQzWMNiUagQlJSVISEjA6tWr4efnh+HDh2POnDkAgEmTJgEA1q1bh+eeew5FRUXIzMxEfHw84uLi4O3trV3hzcyFCxfw1ltvAbj/2NQBAwbUW193+TI1DI4L/cvJyUFUVBRSUlJgY2OD8PBwXLp0CYqioFWrVqitrUVNTQ3i4uLg4+OjdblERM+MxyZ9YkYzL44D/WEmo+aETalGlJmZiT/+8Y84ffo0OnbsiA0bNuDMmTPYt28fxo8fj0GDBqnb1t3HTeZ14cIFzJ49GyKCxYsX15uojhoHx4W+Xbx4EXPmzEF1dTXi4+MZNomoWeCxSX+Y0cyP40BfmMmoueCcUo3Iy8sLGzduxNq1a1FaWoqhQ4fi1KlTOHfuHD7//PN623Knrg1PT08kJCSgZcuWePvtt3H8+HGtS7J4HBf61qVLF6xevRoGgwExMTFISUmpt57nMYjIEvHYpD/MaObHcaAvzGTUXPBKKTOKiopCdnY2zp49i8LCQmzatAlTp07VuiwCkJ2djT/84Q+Ij49X76Mn8+C40KcHnyqydu1a9O3bV+uSiIjMhscm/WBG0w7HgT4wk5GlY1PKDB68vDUpKQkHDhzARx99hBMnTqB79+4aV0d1OFGdeXFc6B//ECCi5obHJn1iRjMvjgP9YSYjS8amlJk8fN/1nTt34OjoqGFFRNrjuNA//iFARM0Nj01EHAd6xExGlopNKSIiIiIiIiIiMjtOdE5ERERERERERGbHphQREREREREREZkdm1JERERERERERGR2bEoREREREREREZHZsSlFRERERERERERmx6YUERERERERERGZHZtSRERERERERERkdmxKERERERERERGR2bEpRUREREREREREZsemFBE1CZMmTYKiKFAUBS1btoSHhwfmzZuHyspKrUurJykpCYqioKSkROtSiIiIiAAwRxGRfllpXQAR0ZN67bXXsGXLFtTU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Llu3brlwAifDHc/b/by4osv2iy7u7trwoQJevHFFxP8lZj3AwDAHo4ePapWrVopT548WrlypbJnz26z/uOPP9akSZPk5BT/5JJmzZrJz89PkvT666+radOm+umnn7R582ZVqVIlReLbtm2blixZopEjR+r999+3WTdx4kRdvnw5RR4HD2/MmDGaMWOG3nnnHY0dO9amEDlw4EB99913cnGx/a929erV1axZM0lSp06dVLhwYfXs2VMzZ87UgAED7Bo/kJpw+h6Qwjw8PNSkSROtXLlS586di7d+zpw58vb2VqNGjSQlPofOb7/9purVqyt9+vTy9vZW/fr1tX//fuv6X375RRaLxWZY+Y8//iiLxaImTZrYbKtYsWJq2bKldXnFihWqVq2aMmTIIC8vLxUpUiResiNJsbGxGjlypHLmzCl3d3fVqlVLR44ciddvy5Yteumll+Tr6ytPT0/VqFFDGzZsiNdv/fr1qlChgtzd3VWgQAF9+eWXiTyL8Q0aNEiZMmXStGnTEiysBAUFqUGDBtblc+fOqUuXLsqWLZvc3d1VunRpzZw50+Y+x48fl8Vi0WeffaaQkBDlz59fnp6eqlOnjk6dOiVjjD788EPlzJlTHh4eevnll3Xx4kWbbeTNm1cNGjTQ77//rjJlysjd3V2BgYHxTidMbF6Fe49/3rx5tX//fv3555/WYd5xhZuLFy+qT58+KlmypLy8vOTj46O6detqz5491u2tWbNGFSpUkHQn4YnbRtzpgAnNKRUZGal3331XuXLlkpubm4oUKaLPPvtMxhibfhaLRT169NDPP/+sEiVKyM3NTcWLF9eyZcvi7VdyJfR+iHuO16xZo/Lly8vDw0MlS5bUmjVrJEk//fSTSpYsKXd3d5UrV067du2Kt92DBw+qWbNmypQpk9zd3VW+fHn98ssvKRY3AODJ88knnygyMlLTp0+PV5CSJBcXF/Xs2VO5cuV64LZeeOEFSXdOBUwpR48elSRVrVo13jpnZ2dlzpzZuhyXZxw8eFAtWrSQj4+PMmfOrLfffls3b96Md/9Zs2apXLly8vDwUKZMmdSqVSudOnUqXr+UzPHi8q6Epii49zT+h92fu/Xo0UNeXl66fv16vHWtW7eWv7+/YmJiJEnbt29XUFCQ/Pz85OHhoXz58qlz58733f6NGzc0evRoFS1aVJ999lmC+d2rr76qihUr3nc7j+M1AzyJKEoBj0Hbtm11+/ZtzZ8/36b94sWLWr58uV555RV5eHgkev/vvvtO9evXl5eXlz7++GMNGjRIoaGhqlatmvU/69WqVZPFYtHatWut91u3bp2cnJy0fv16a9v58+d18OBBPffcc5Kk/fv3q0GDBoqKitLw4cM1ZswYNWrUKMEE46OPPtLChQvVp08fDRgwQJs3b7aO8IqzatUqPffcc4qIiNCQIUM0atQoXb58WS+88IK2bt1q7bdv3z7VqVNH586d09ChQ9WpUycNGTJECxcufODzefjwYR08eFCNGzeWt7f3A/vfuHFDNWvW1Hfffae2bdvq008/la+vrzp27Kjx48fH6z979mxNmjRJb731lt599139+eefatGihT744AMtW7ZM7733nrp3767FixerT58+CcbXsmVL1a1bV6NHj5aLi4uaN2+uFStWPDDWe40bN045c+ZU0aJF9d133+m7777TwIEDJUnHjh3Tzz//rAYNGmjs2LHq27ev9u3bpxo1aujMmTOS7hQghw8fLknq3r27dRtxx/9exhg1atRIn3/+uV566SWNHTtWRYoUUd++fdW7d+94/devX68333xTrVq10ieffKKbN2+qadOmj31+tCNHjqhNmzZq2LChRo8erUuXLqlhw4aaPXu2evXqpXbt2mnYsGE6evSoWrRoYXOK4v79+1W5cmUdOHBA/fv315gxY5Q+fXo1btw4Sa8/AEDatGTJEhUsWFCVKlV65G3FFZDuLhQ9qrhTBmfPnq3bt28n6T4tWrTQzZs3NXr0aNWrV08TJkxQ9+7dbfqMHDlS7du3V6FChTR27Fi98847WrlypZ577jmb0Vf2yPFSYn/u1bJlS0VGRmrp0qU27devX9fixYvVrFkzOTs769y5c6pTp46OHz+u/v3764svvlDbtm21efPm+25//fr1unjxotq0afNIo7sfx2sGeCIZACnu9u3bJnv27KZKlSo27VOmTDGSzPLly61t06dPN5JMWFiYMcaYq1evmgwZMphu3brZ3Dc8PNz4+vratBcvXty0aNHCuvzMM8+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bPH0eEBAADYBXNKAQAA2FmBAgW0YcMGvfPOO3rppZfk7OysmTNnqnXr1o4ODQAAwG4YKQUAAOAAS5cu1dy5c1WlShVlyJBB33zzjc6cOePosAAAAOyGohQAAICdvfbaa2revLnee+89rVu3Tnv37pWrq6tKliyp+fPnOzo8AAAAu+D0PQAAADvbsGGDtmzZotKlS0uS/P399euvvyokJESdO3dWixYtHBwhAADA40dRCgAAwM527NghNze3eO3BwcGqXbu2AyICAACwv2QVpcLCwrRu3TqdOHFC169fV5YsWVS2bFlVqVJF7u7uKR0jAABAmpJQQSpOkSJF7BgJAACA4zxUUWr27NkaP368tm/frmzZsikgIEAeHh66ePGijh49Knd3d7Vt21bvvfee8uTJ87hiBgAAeOK89NJLGjp0qCpXrnzfflevXtWkSZPk5eWl4OBgO0UHAABgf0kuSpUtW1aurq7q2LGjfvzxR+XKlctmfVRUlDZt2qS5c+eqfPnymjRpkpo3b57iAQMAADyJmjdvrqZNm8rX11cNGzZU+fLlFRAQIHd3d126dEmhoaFav369fv31V9WvX1+ffvqpo0MGAAB4rJJclProo48UFBSU6Ho3NzfVrFlTNWvW1MiRI3X8+PGUiO+RLVmyRO+++65iY2P13nvvqWvXro4OCQAAPIW6dOmidu3aacGCBZo3b56++uorXblyRZJksVgUGBiooKAgbdu2TcWKFXNwtAAAAI+fU1I73q8gda/MmTOrXLlyyQooJd2+fVu9e/fWqlWrtGvXLn366af677//HB0WAAB4Srm5ualdu3ZavHixLl26pEuXLunMmTO6efOm9u3bp88+++yhC1L//POP2rVrp8yZM8vDw0MlS5bU9u3breuNMRo8eLCyZ88uDw8P1a5dW4cPH7bZxsWLF9W2bVv5+PgoQ4YM6tKli65du5Yi+wwAAJCYJBel7rZz507t27fPurxo0SI1btxY77//vqKjo1MsuEe1detWFS9eXDly5JCXl5fq1q2r33//3dFhAQAASJJ8fX3l7++vdOnSJev+ly5dUtWqVZUuXTr99ttvCg0N1ZgxY5QxY0Zrn08++UQTJkzQlClTtGXLFqVPn15BQU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SpevLhWrFiR0jECAACkKaNHj5afn1+89qxZs2rUqFEOiAgAAMD+kjVSqn///urVq5c++uijeO3vvfeeXnzxxRQJDgAAIC06efKk8uXLF689T548OnnypAMiAgAAsL9kjZQ6cOCAunTpEq+9c+fOCg0NfeSgAAAA0rKsWbNq79698dr37NmjzJkzOyAiAAAA+0tWUSpLlizavXt3vPbdu3cra9asjxoTAABAmta6dWv17NlTq1evVkxMjGJiYrRq1Sq9/fbbatWqlaPDAwAAsItknb7XrVs3de/eXceOHdOzzz4rSdqwYYM+/vhj9e7dO0UDdISQkBCFhIQoJibG0aEAAIA06MMPP9Tx48dVq1YtubjcScdiY2PVvn175pQCAABPjWQVpQYNGiRvb2+NGTNGAwYMkCQFBARo6NCh6tmzZ4oG6AjBwcEKDg5WRESEfH19HR0OAABIY1xdXTVv3jx9+OGH2rNnjzw8PFSyZEnlyZPH0aEBAADYTbKKUhaLRb169VKvXr109epVSZK3t3eKBgYAAJDWFS5cWIULF3Z0GAAAAA6RrKJUWFiYbt++rUKFCtkUow4fPqx06dIpb968KRUfAABAmnT69Gn98ssvOnnypKKjo23WjR071kFRAQAA2E+yilIdO3ZU586dVahQIZv2LVu26Ouvv9aaNWtSIjYAAIA0aeXKlWrUqJHy58+vgwcPqkSJEjp+/LiMMXrmmWccHR4AAIBdJOvqe7t27VLVqlXjtVeuXDnBq/IBAADgfwYMGKA+ffpo3759cnd3148//qhTp06pRo0aat68uaPDAwAAsItkFaUsFot1Lqm7XblyhSvWAQAAPMCBAwfUvn17SZKLi4tu3LghLy8vDR8+XB9//LGDowMAALCPZBWlnnvuOY0ePdqmABUTE6PRo0erWrVqKRYcAABAWpQ+fXrrPFLZs2fX0aNHresuXLjgqLAAAADsKllzSn388cd67rnnVKRIEVWvXl2StG7dOkVERGjVqlUpGiAAAEBaU7lyZa1fv17FihVTvXr19O6772rfvn366aefVLlyZUeHBwAAYBfJGikVGBiovXv3qkWLFjp37pyuXr2q9u3bWyfqfNKFhIQoMDBQFSpUcH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tm/P39zcCBA83169eNMcZcv37d/Pnnn8bPz8+UKFHCbN261RhjzI4dO0zjxo2Np6enOXTokCPDTpN27dpl0qdPb/r162euXbtmbT958qQZOXKkcXZ2Nv369bO2T5482ZQtW9Y8++yzZu/evY4I+akQGhpqMmbMaLp27WqMuXNufNx/wiIjI82sWbNMQECATVIU9yWOlHf06FHTp08fU7ZsWZM+fXpTtWpVM3z4cOv6qVOnmmeeecZ06dKF9wWQTORnjkFOlnqQk6UO5GCOQ76VNBSlnkBxv6Ldnbjc/ffs2bNNQECACQ4OtqmukuikvLjn9KOPPjKNGzc20dHR1l/Z4v7dvXu3yZQpk2nTpo31ftu2bTOtWrV6aqrf9nLs2DHj5ORkRo0aZYz53zGIO07nzp0zffr0MenTpzd//PGHMcaYGzdumKVLl5ozZ844JuinwO7du423t7fx9fU17dq1syb+MTEx1mNzd1LUqVMnR4ab5sX9at2xY0czePBgM3v2bPP8888bb29v06xZM2u/r7/+2jzzzDPmtddes048CyBx5GeORU6WupCTpQ7kYI5DvpV0FKWeMCdOnDCdOnWyDqO8X+KTI0cO884775gDBw7YPc6nTbNmzUy9evXitcf9CjFmzBiTLl06s3//fuu6u4dv4tHFxMSY7777zri5udkMTb53KP7OnTuNt7e3+frrr+0d4lNp+/btxsvLywwePNjMmzfP1KhRwzRr1izRpGjOnDnG3d3dvP76644MO83avXu39VfryMhIa/uZM2fM8OHDjYeHh+ncubO1febMmSZfvnymZ8+eJioqyhEhA08E8rPUg5zM8cjJUgdyMMch33o4FKWeILGxsWbFihWmRIkSplWrVtYPlLuTnbsvF/n9998bd3d307dvX+YoeAzOnDljTp48aYwxpkGDBubFF1+0rrv3V89169YZZ2dns23bNrvG+LS5fv26+frrr02WLFlMcHCwtf327ds2xyR37txm6NChjgjxqRIREWGKFStm3nrrLWvb9OnT75sUXbt2zcyfP59frB+DY8eOGVdXVzNw4EBjzP+G5sf9J+H8+fPm7bffNtmzZzfLly+33m/OnDnm2LFj9g8YeEKQnzkeOVnqQ07mW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txd/fXzIyMqp9v9OnT8uAAQOkadOmYmNjI97e3rJs2TLT/m+//VacnJzEaDRKQECA7N69WwDI+fPnTY9ZvHixtG3bVhRFkdDQUBERUVX1pep7caFPIiIion+DuYmI9E4REdGyKUZEZE6pqakICgpCYWEhWrRooXU5RERERLrF3EREtc2gdQFERERERERERNTwsClFRERERERERERmx8v3iIiIiIiIiIjI7DhTioiIiIiIiIiIzI5NKSIiIiIiIiIiMjs2pYiIiIiIiIiIyOzYlCIiIiIiIiIiIrNjU4qIiIiIiIiIiMyOTSkiIiIiIiIiIjI7NqWIiIiIiIiIiMjs2JQiIiIiIiIiIiKzY1OKiIiIiIiIiIjM7v8A87zjJ/iwFXUAAAAASUVORK5CYII=", "text/plain": [ "
" ] @@ -1098,7 +1057,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 14, "id": "5fq7f6ldk4h", "metadata": {}, "outputs": [ @@ -1146,7 +1105,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 15, "id": "9j5so13os8", "metadata": {}, "outputs": [ @@ -1199,7 +1158,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 16, "id": "uu4cyfhj0sc", "metadata": {}, "outputs": [ @@ -1281,7 +1240,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 17, "id": "24ejaruaks2", "metadata": {}, "outputs": [ @@ -1366,7 +1325,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 18, "id": "mlhkserjxb", "metadata": {}, "outputs": [ @@ -1478,7 +1437,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 19, "id": "9bxu0t9bab", "metadata": {}, "outputs": [ @@ -1562,7 +1521,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 20, "id": "l2cxwjhmpnc", "metadata": {}, "outputs": [ diff --git a/kernel.ptx b/kernel.ptx deleted file mode 100644 index 97394c7..0000000 --- a/kernel.ptx +++ /dev/null @@ -1,172 +0,0 @@ -// -// Generated by NVIDIA NVVM Compiler -// -// Compiler Build ID: CL-36836380 -// Cuda compilation tools, release 13.1, V13.1.80 -// Based on NVVM 7.0.1 -// - -.version 9.1 -.target sm_86 -.address_size 64 - - // .globl __raygen__main -.const .align 8 .b8 params[24]; - -.visible .entry __raygen__main() -{ - .reg .f32 %f<10>; - .reg .b32 %r<83>; - .reg .b64 %rd<10>; - - - // begin inline asm - call (%r1), _optix_get_launch_index_x, (); - // end inline asm - // begin inline asm - call (%r2), _optix_get_launch_index_y, (); - // end inline asm - // begin inline asm - call (%r3), _optix_get_launch_index_z, (); - // end inline asm - // begin inline asm - call (%r4), _optix_get_launch_dimension_x, (); - // end inline asm - // begin inline asm - call (%r5), _optix_get_launch_dimension_y, (); - // end inline asm - mad.lo.s32 %r77, %r5, %r3, %r2; - mad.lo.s32 %r78, %r77, %r4, %r1; - ld.const.u64 %rd2, [params+8]; - cvta.to.global.u64 %rd3, %rd2; - mul.wide.u32 %rd4, %r78, 32; - add.s64 %rd5, %rd3, %rd4; - ld.global.f32 %f1, [%rd5]; - ld.global.f32 %f2, [%rd5+4]; - ld.global.f32 %f3, [%rd5+8]; - ld.global.f32 %f7, [%rd5+12]; - ld.global.f32 %f4, [%rd5+16]; - ld.global.f32 %f5, [%rd5+20]; - ld.global.f32 %f6, [%rd5+24]; - ld.global.f32 %f8, [%rd5+28]; - ld.const.u64 %rd1, [params]; - mov.f32 %f9, 0f00000000; - mov.u32 %r42, 1; - mov.u32 %r44, 4; - mov.u32 %r76, 0; - // begin inline asm - call(%r6,%r7,%r8,%r9,%r10,%r11,%r12,%r13,%r14,%r15,%r16,%r17,%r18,%r19,%r20,%r21,%r22,%r23,%r24,%r25,%r26,%r27,%r28,%r29,%r30,%r31,%r32,%r33,%r34,%r35,%r36,%r37),_optix_trace_typed_32,(%r76,%rd1,%f1,%f2,%f3,%f4,%f5,%f6,%f7,%f8,%f9,%r42,%r76,%r76,%r42,%r76,%r44,%r79,%r80,%r81,%r82,%r76,%r76,%r76,%r76,%r76,%r76,%r76,%r76,%r76,%r76,%r76,%r76,%r76,%r76,%r76,%r76,%r76,%r76,%r76,%r76,%r76,%r76,%r76,%r76,%r76,%r76,%r76,%r76); - // end inline asm - ld.const.u64 %rd6, [params+16]; - cvta.to.global.u64 %rd7, %rd6; - mul.wide.u32 %rd8, %r78, 16; - add.s64 %rd9, %rd7, %rd8; - st.global.u32 [%rd9], %r6; - st.global.u32 [%rd9+4], %r7; - st.global.u32 [%rd9+8], %r8; - st.global.u32 [%rd9+12], %r9; - ret; - -} - // .globl __miss__miss -.visible .entry __miss__miss() -{ - .reg .b32 %r<9>; - - - mov.u32 %r8, 0; - mov.u32 %r2, -1082130432; - // begin inline asm - call _optix_set_payload, (%r8, %r2); - // end inline asm - mov.u32 %r3, 1; - mov.u32 %r4, 1065353216; - // begin inline asm - call _optix_set_payload, (%r3, %r4); - // end inline asm - mov.u32 %r5, 2; - // begin inline asm - call _optix_set_payload, (%r5, %r8); - // end inline asm - mov.u32 %r7, 3; - // begin inline asm - call _optix_set_payload, (%r7, %r8); - // end inline asm - ret; - -} - // .globl __closesthit__chit -.visible .entry __closesthit__chit() -{ - .reg .f32 %f<37>; - .reg .b32 %r<14>; - .reg .b64 %rd<3>; - - - // begin inline asm - call (%f1), _optix_get_ray_tmax, (); - // end inline asm - cvt.rzi.ftz.u32.f32 %r13, %f1; - // begin inline asm - call (%rd1), _optix_get_gas_traversable_handle, (); - // end inline asm - // begin inline asm - call (%r1), _optix_read_primitive_idx, (); - // end inline asm - // begin inline asm - call (%r2), _optix_read_sbt_gas_idx, (); - // end inline asm - // begin inline asm - call (%f2), _optix_get_ray_time, (); - // end inline asm - // begin inline asm - call (%f3, %f4, %f5, %f6, %f7, %f8, %f9, %f10, %f11), _optix_get_triangle_vertex_data, (%rd1, %r1, %r2, %f2); - // end inline asm - sub.ftz.f32 %f13, %f6, %f3; - sub.ftz.f32 %f14, %f7, %f4; - sub.ftz.f32 %f15, %f8, %f5; - sub.ftz.f32 %f16, %f9, %f3; - sub.ftz.f32 %f17, %f10, %f4; - sub.ftz.f32 %f18, %f11, %f5; - mul.ftz.f32 %f19, %f14, %f18; - mul.ftz.f32 %f20, %f15, %f17; - sub.ftz.f32 %f21, %f19, %f20; - mul.ftz.f32 %f22, %f13, %f18; - mul.ftz.f32 %f23, %f15, %f16; - sub.ftz.f32 %f24, %f22, %f23; - mul.ftz.f32 %f25, %f13, %f17; - mul.ftz.f32 %f26, %f14, %f16; - sub.ftz.f32 %f27, %f25, %f26; - mul.ftz.f32 %f28, %f24, %f24; - fma.rn.ftz.f32 %f29, %f21, %f21, %f28; - fma.rn.ftz.f32 %f30, %f27, %f27, %f29; - rsqrt.approx.ftz.f32 %f31, %f30; - mul.ftz.f32 %f32, %f31, %f21; - mul.ftz.f32 %f33, %f24, %f31; - neg.ftz.f32 %f34, %f33; - mul.ftz.f32 %f35, %f31, %f27; - cvt.rn.f32.u32 %f36, %r13; - mov.b32 %r6, %f36; - mov.u32 %r5, 0; - // begin inline asm - call _optix_set_payload, (%r5, %r6); - // end inline asm - mov.b32 %r8, %f32; - mov.u32 %r7, 1; - // begin inline asm - call _optix_set_payload, (%r7, %r8); - // end inline asm - mov.b32 %r10, %f34; - mov.u32 %r9, 2; - // begin inline asm - call _optix_set_payload, (%r9, %r10); - // end inline asm - mov.b32 %r12, %f35; - mov.u32 %r11, 3; - // begin inline asm - call _optix_set_payload, (%r11, %r12); - // end inline asm - ret; - -} - diff --git a/pyproject.toml b/pyproject.toml index d4852c6..3fd1cba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,20 +4,55 @@ build-backend = "setuptools.build_meta" [project] name = "rtxpy" -version = "0.0.0" +version = "0.0.4" description = "Ray tracing using CUDA accessible from Python" readme = { file = "README.md", content-type = "text/markdown" } requires-python = ">=3.10" -license = { text = "MIT" } +license = "MIT" authors = [{ name = "makepath" }] -dependencies = ["numpy>=1.16"] +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "Topic :: Scientific/Engineering :: Information Analysis", + "Topic :: Scientific/Engineering :: Mathematics", + "Topic :: Scientific/Engineering :: Visualization", +] +dependencies = [ + "numpy>=1.21", +] [project.optional-dependencies] +# GPU dependencies - cupy provides CUDA context management +# Note: otk-pyoptix must be installed separately from NVIDIA +# See: https://github.com/NVIDIA/otk-pyoptix +cuda12 = ["cupy-cuda12x>=12.0"] +cuda11 = ["cupy-cuda11x>=11.0"] tests = ["pytest"] +[project.urls] +Homepage = "https://github.com/makepath/rtxpy" +Repository = "https://github.com/makepath/rtxpy" + [tool.setuptools] include-package-data = true [tool.setuptools.package-data] rtxpy = ["*.ptx"] +[tool.ruff] +line-length = 100 +target-version = "py310" + +[tool.ruff.lint] +select = ["E", "F", "W", "I"] +ignore = ["E501"] + diff --git a/rtxpy/__init__.py b/rtxpy/__init__.py index e4a474b..04b4e0e 100644 --- a/rtxpy/__init__.py +++ b/rtxpy/__init__.py @@ -1,4 +1,4 @@ from .rtx import RTX, has_cupy -__version__ = "0.0.0" +__version__ = "0.0.4" diff --git a/rtxpy/rtx.py b/rtxpy/rtx.py index ce2c232..5d57f51 100644 --- a/rtxpy/rtx.py +++ b/rtxpy/rtx.py @@ -1,109 +1,505 @@ -import ctypes -import sys, os +""" +RTXpy - Ray tracing using NVIDIA OptiX, accessible from Python. -try: - import cupy - has_cupy = True -except ModuleNotFoundError: - has_cupy = False +This module provides GPU-accelerated ray-triangle intersection using +NVIDIA's OptiX ray tracing engine via the otk-pyoptix Python bindings. +""" +import os import atexit -#Handle to the OptiX library. -c_lib = None +import struct -def free_optix_resources(): - global c_lib - if c_lib: - c_lib.cleanRTX() - c_lib = None +# CRITICAL: cupy must be imported before optix for proper CUDA context sharing +import cupy +has_cupy = True -class RTX(): +import optix + +import numpy as np + + +# ----------------------------------------------------------------------------- +# Singleton state management +# ----------------------------------------------------------------------------- + +class _OptixState: + """ + Manages the global OptiX state including device context, module, pipeline, + shader binding table, and acceleration structure cache. + """ def __init__(self): - global c_lib - if c_lib != None: - return - - dir_path = os.path.dirname(os.path.realpath(__file__)) - # Load the shared library into c types. - if sys.platform.startswith("win"): - dir_path = dir_path + "\\rtxpy.dll" - elif sys.platform == "darwin": - dir_path = dir_path + "/librtxpy.dylib" - else: - dir_path = dir_path + "/librtxpy.so" - - try: - c_lib = ctypes.CDLL(dir_path) - c_lib = ctypes.CDLL(dir_path, use_errno=True) - - c_lib.initRTX.restype = ctypes.c_int - c_lib.buildRTX.restype = ctypes.c_int - c_lib.traceRTX.restype = ctypes.c_int - c_lib.cleanRTX.restype = ctypes.c_int - c_lib.getHashRTX.restype = ctypes.c_uint64 - c_lib.getLastErrorRTX.restype = ctypes.c_char_p - except: - raise RuntimeError("Failed to load RTX library") - - rc = c_lib.initRTX() - if rc != 0: - msg = c_lib.getLastErrorRTX() - free_optix_resources() - raise RuntimeError( - f"Failed to initialize RTX library (rc={rc}): " - + (msg.decode("utf-8", "replace") if msg else "no details") - ) - else: - atexit.register(free_optix_resources) - - def build(self, hashValue, vertexBuffer, indexBuffer): - if has_cupy and isinstance(vertexBuffer, cupy.ndarray): - vb = ctypes.c_ulonglong(vertexBuffer.data.ptr) - else: - vb = vertexBuffer.ctypes.data_as(ctypes.POINTER(ctypes.c_void_p)) - if has_cupy and isinstance(indexBuffer, cupy.ndarray): - ib = ctypes.c_ulonglong(indexBuffer.data.ptr) - else: - ib = indexBuffer.ctypes.data_as(ctypes.POINTER(ctypes.c_void_p)) - - if c_lib: - res = c_lib.buildRTX( - ctypes.c_uint64(hashValue), - vb, - vertexBuffer.size*4, #sizeof(float) is 4 - ib, - indexBuffer.size*4 #sizeof(int) is 4 - ) - else: - raise RuntimeError("Cannot communicate with OptiX") - - return res - - def getHash(self): - if c_lib: - return c_lib.getHashRTX() - else: - raise RuntimeError("Cannot communicate with OptiX") - - def trace(self, rays, hits, numRays): - if (rays.size != hits.size*2): - return -1 - if has_cupy and isinstance(rays, cupy.ndarray): - rays = ctypes.c_ulonglong(rays.data.ptr) - else: - rays = rays.ctypes.data_as(ctypes.POINTER(ctypes.c_void_p)) - if has_cupy and isinstance(hits, cupy.ndarray): - hits = ctypes.c_ulonglong(hits.data.ptr) - else: - hits = hits.ctypes.data_as(ctypes.POINTER(ctypes.c_void_p)) - - if c_lib: - res = c_lib.traceRTX( - rays, - hits, - numRays - ) - else: - raise Exception("Cannot communicate with OptiX") - return res + self.context = None + self.module = None + self.pipeline = None + self.raygen_pg = None + self.miss_pg = None + self.hit_pg = None + self.sbt = None + + # Acceleration structure cache + self.gas_handle = 0 + self.gas_buffer = None + self.current_hash = 0xFFFFFFFFFFFFFFFF # uint64(-1) + + # Device memory for params + self.d_params = None + + # Device buffers for CPU->GPU transfers + self.d_rays = None + self.d_rays_size = 0 + self.d_hits = None + self.d_hits_size = 0 + + self.initialized = False + + def cleanup(self): + """Release all OptiX and CUDA resources.""" + # Free device buffers + self.d_params = None + self.d_rays = None + self.d_hits = None + self.d_rays_size = 0 + self.d_hits_size = 0 + + # Free acceleration structure + self.gas_buffer = None + self.gas_handle = 0 + self.current_hash = 0xFFFFFFFFFFFFFFFF + + # OptiX objects are automatically cleaned up by Python GC + self.sbt = None + self.pipeline = None + self.hit_pg = None + self.miss_pg = None + self.raygen_pg = None + self.module = None + self.context = None + + self.initialized = False + + +_state = _OptixState() + + +def _cleanup_at_exit(): + """Cleanup function registered with atexit.""" + global _state + if _state: + _state.cleanup() + + +# ----------------------------------------------------------------------------- +# PTX loading +# ----------------------------------------------------------------------------- + +def _load_ptx_file(filename: str) -> str: + """Load PTX file from the package directory.""" + # Try the directory where this module is located + module_dir = os.path.dirname(os.path.realpath(__file__)) + + path = os.path.join(module_dir, filename) + if os.path.exists(path): + with open(path, 'rb') as f: + return f.read() + + # Try data subdirectory + path = os.path.join(module_dir, 'data', filename) + if os.path.exists(path): + with open(path, 'rb') as f: + return f.read() + + raise RuntimeError(f"Failed to load {filename}") + + +# ----------------------------------------------------------------------------- +# OptiX initialization +# ----------------------------------------------------------------------------- + +def _log_callback(level, tag, message): + """OptiX log callback for debugging.""" + print(f"[OPTIX][{level}][{tag}]: {message}") + + +def _init_optix(): + """Initialize OptiX context, module, pipeline, and SBT.""" + global _state + + if _state.initialized: + return + + # Create OptiX device context (uses cupy's CUDA context) + _state.context = optix.deviceContextCreate( + cupy.cuda.get_current_stream().ptr, + optix.DeviceContextOptions( + logCallbackLevel=4, + ) + ) + + # Load PTX and create module + ptx_data = _load_ptx_file("kernel.ptx") + + module_options = optix.ModuleCompileOptions( + maxRegisterCount=optix.COMPILE_DEFAULT_MAX_REGISTER_COUNT, + optLevel=optix.COMPILE_OPTIMIZATION_DEFAULT, + debugLevel=optix.COMPILE_DEBUG_LEVEL_MINIMAL, + ) + + pipeline_options = optix.PipelineCompileOptions( + usesMotionBlur=False, + traversableGraphFlags=optix.TRAVERSABLE_GRAPH_FLAG_ALLOW_SINGLE_GAS, + numPayloadValues=4, + numAttributeValues=2, + exceptionFlags=optix.EXCEPTION_FLAG_NONE, + pipelineLaunchParamsVariableName="params", + ) + + _state.module, log = _state.context.moduleCreate( + module_options, + pipeline_options, + ptx_data, + ) + + # Create program groups + pg_options = optix.ProgramGroupOptions() + + # Raygen program group + raygen_desc = optix.ProgramGroupDesc() + raygen_desc.raygenModule = _state.module + raygen_desc.raygenEntryFunctionName = "__raygen__main" + _state.raygen_pg, log = _state.context.programGroupCreate( + [raygen_desc], + pg_options, + ) + _state.raygen_pg = _state.raygen_pg[0] + + # Miss program group + miss_desc = optix.ProgramGroupDesc() + miss_desc.missModule = _state.module + miss_desc.missEntryFunctionName = "__miss__miss" + _state.miss_pg, log = _state.context.programGroupCreate( + [miss_desc], + pg_options, + ) + _state.miss_pg = _state.miss_pg[0] + + # Hit group (closest hit only) + hit_desc = optix.ProgramGroupDesc() + hit_desc.hitgroupModuleCH = _state.module + hit_desc.hitgroupEntryFunctionNameCH = "__closesthit__chit" + _state.hit_pg, log = _state.context.programGroupCreate( + [hit_desc], + pg_options, + ) + _state.hit_pg = _state.hit_pg[0] + + # Create pipeline + link_options = optix.PipelineLinkOptions( + maxTraceDepth=1, + ) + + program_groups = [_state.raygen_pg, _state.miss_pg, _state.hit_pg] + _state.pipeline = _state.context.pipelineCreate( + pipeline_options, + link_options, + program_groups, + "", # log + ) + + # Configure stack sizes + stack_sizes = optix.StackSizes() + for pg in program_groups: + optix.util.accumulateStackSizes(pg, stack_sizes, _state.pipeline) + + (dc_from_traversal, dc_from_state, continuation) = optix.util.computeStackSizes( + stack_sizes, + 1, # maxTraceDepth + 0, # maxCCDepth + 0, # maxDCDepth + ) + + _state.pipeline.setStackSize( + dc_from_traversal, + dc_from_state, + continuation, + 1, # maxTraversableDepth + ) + + # Create shader binding table + _create_sbt() + + # Allocate params buffer (24 bytes: handle(8) + rays_ptr(8) + hits_ptr(8)) + _state.d_params = cupy.zeros(24, dtype=cupy.uint8) + + _state.initialized = True + atexit.register(_cleanup_at_exit) + + +def _create_sbt(): + """Create the shader binding table.""" + global _state + + # SBT record header size is 32 bytes (OPTIX_SBT_RECORD_HEADER_SIZE) + # We use empty data records, so total size is just the header + header_size = optix.SBT_RECORD_HEADER_SIZE + + # Pack raygen record + raygen_record = bytearray(header_size) + optix.sbtRecordPackHeader(_state.raygen_pg, raygen_record) + d_raygen = cupy.array(np.frombuffer(raygen_record, dtype=np.uint8)) + + # Pack miss record + miss_record = bytearray(header_size) + optix.sbtRecordPackHeader(_state.miss_pg, miss_record) + d_miss = cupy.array(np.frombuffer(miss_record, dtype=np.uint8)) + + # Pack hit group record + hit_record = bytearray(header_size) + optix.sbtRecordPackHeader(_state.hit_pg, hit_record) + d_hit = cupy.array(np.frombuffer(hit_record, dtype=np.uint8)) + + _state.sbt = optix.ShaderBindingTable( + raygenRecord=d_raygen.data.ptr, + missRecordBase=d_miss.data.ptr, + missRecordStrideInBytes=header_size, + missRecordCount=1, + hitgroupRecordBase=d_hit.data.ptr, + hitgroupRecordStrideInBytes=header_size, + hitgroupRecordCount=1, + ) + + # Keep references to prevent garbage collection + _state._sbt_raygen = d_raygen + _state._sbt_miss = d_miss + _state._sbt_hit = d_hit + + +# ----------------------------------------------------------------------------- +# Acceleration structure building +# ----------------------------------------------------------------------------- + +def _build_accel(hash_value: int, vertices, indices) -> int: + """ + Build an OptiX acceleration structure for the given triangle mesh. + + Args: + hash_value: Hash to identify this geometry (for caching) + vertices: Vertex buffer (Nx3 float32, flattened) + indices: Index buffer (Mx3 int32, flattened) + + Returns: + 0 on success, non-zero on error + """ + global _state + + if not _state.initialized: + _init_optix() + + # Check if we already have this acceleration structure cached + if _state.current_hash == hash_value: + return 0 + + # Reset hash until successful build + _state.current_hash = 0xFFFFFFFFFFFFFFFF + + # Ensure data is on GPU as cupy arrays + if isinstance(vertices, cupy.ndarray): + d_vertices = vertices + else: + d_vertices = cupy.asarray(vertices, dtype=cupy.float32) + + if isinstance(indices, cupy.ndarray): + d_indices = indices + else: + d_indices = cupy.asarray(indices, dtype=cupy.int32) + + # Calculate counts + num_vertices = d_vertices.size // 3 + num_triangles = d_indices.size // 3 + + if num_vertices == 0 or num_triangles == 0: + return -1 + + # Build input + build_input = optix.BuildInputTriangleArray( + vertexBuffers_=[d_vertices.data.ptr], + vertexFormat=optix.VERTEX_FORMAT_FLOAT3, + vertexStrideInBytes=12, # 3 * sizeof(float) + indexBuffer=d_indices.data.ptr, + numIndexTriplets=num_triangles, + indexFormat=optix.INDICES_FORMAT_UNSIGNED_INT3, + indexStrideInBytes=12, # 3 * sizeof(int) + flags_=[optix.GEOMETRY_FLAG_DISABLE_ANYHIT], + numSbtRecords=1, + ) + build_input.numVertices = num_vertices + + # Acceleration structure options + accel_options = optix.AccelBuildOptions( + buildFlags=optix.BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS, + operation=optix.BUILD_OPERATION_BUILD, + ) + + # Compute memory requirements + buffer_sizes = _state.context.accelComputeMemoryUsage( + [accel_options], + [build_input], + ) + + # Allocate buffers + d_temp = cupy.zeros(buffer_sizes.tempSizeInBytes, dtype=cupy.uint8) + _state.gas_buffer = cupy.zeros(buffer_sizes.outputSizeInBytes, dtype=cupy.uint8) + + # Build acceleration structure + _state.gas_handle = _state.context.accelBuild( + 0, # stream + [accel_options], + [build_input], + d_temp.data.ptr, + buffer_sizes.tempSizeInBytes, + _state.gas_buffer.data.ptr, + buffer_sizes.outputSizeInBytes, + [], # emitted properties + ) + + _state.current_hash = hash_value + return 0 + + +# ----------------------------------------------------------------------------- +# Ray tracing +# ----------------------------------------------------------------------------- + +def _trace_rays(rays, hits, num_rays: int) -> int: + """ + Trace rays against the current acceleration structure. + + Args: + rays: Ray buffer (Nx8 float32: ox,oy,oz,tmin,dx,dy,dz,tmax) + hits: Hit buffer (Nx4 float32: t,nx,ny,nz) + num_rays: Number of rays to trace + + Returns: + 0 on success, non-zero on error + """ + global _state + + if not _state.initialized: + return -1 + + if _state.gas_handle == 0: + return -1 + + # Size check + if rays.size != num_rays * 8 or hits.size != num_rays * 4: + return -1 + + # Ensure rays are on GPU + if isinstance(rays, cupy.ndarray): + d_rays = rays + rays_on_host = False + else: + # Allocate/resize device buffer if needed + rays_size = num_rays * 8 * 4 # 8 floats * 4 bytes + if _state.d_rays_size != rays_size: + _state.d_rays = cupy.zeros(num_rays * 8, dtype=cupy.float32) + _state.d_rays_size = rays_size + _state.d_rays[:] = cupy.asarray(rays, dtype=cupy.float32) + d_rays = _state.d_rays + rays_on_host = True + + # Ensure hits buffer is on GPU + if isinstance(hits, cupy.ndarray): + d_hits = hits + hits_on_host = False + else: + # Allocate/resize device buffer if needed + hits_size = num_rays * 4 * 4 # 4 floats * 4 bytes + if _state.d_hits_size != hits_size: + _state.d_hits = cupy.zeros(num_rays * 4, dtype=cupy.float32) + _state.d_hits_size = hits_size + d_hits = _state.d_hits + hits_on_host = True + + # Pack params: handle(8 bytes) + rays_ptr(8 bytes) + hits_ptr(8 bytes) + params_data = struct.pack( + 'QQQ', + _state.gas_handle, + d_rays.data.ptr, + d_hits.data.ptr, + ) + _state.d_params[:] = cupy.frombuffer(np.frombuffer(params_data, dtype=np.uint8), dtype=cupy.uint8) + + # Launch + optix.launch( + _state.pipeline, + 0, # stream + _state.d_params.data.ptr, + 24, # sizeof(Params) + _state.sbt, + num_rays, # width + 1, # height + 1, # depth + ) + + # Copy results back if hits was on host + if hits_on_host: + cupy.cuda.Stream.null.synchronize() + hits[:] = d_hits.get() + + return 0 + + +# ----------------------------------------------------------------------------- +# Public API (backwards compatible) +# ----------------------------------------------------------------------------- + +class RTX: + """ + RTX ray tracing interface. + + This class provides GPU-accelerated ray-triangle intersection using + NVIDIA's OptiX ray tracing engine. + """ + + def __init__(self): + """Initialize the RTX context.""" + _init_optix() + + def build(self, hashValue: int, vertexBuffer, indexBuffer) -> int: + """ + Build an acceleration structure for the given triangle mesh. + + Args: + hashValue: A hash value to uniquely identify the geometry (for caching) + vertexBuffer: Vertex buffer (flattened float32 array, 3 floats per vertex) + indexBuffer: Index buffer (flattened int32 array, 3 ints per triangle) + + Returns: + 0 on success, non-zero on error + """ + return _build_accel(hashValue, vertexBuffer, indexBuffer) + + def getHash(self) -> int: + """ + Get the hash of the current acceleration structure. + + Returns: + The hash value, or uint64(-1) if no structure is present + """ + return _state.current_hash + + def trace(self, rays, hits, numRays: int) -> int: + """ + Trace rays against the current acceleration structure. + + Args: + rays: Ray buffer (8 float32 per ray: ox,oy,oz,tmin,dx,dy,dz,tmax) + hits: Hit buffer (4 float32 per hit: t,nx,ny,nz) + t=-1 indicates a miss + numRays: Number of rays to trace + + Returns: + 0 on success, non-zero on error + """ + return _trace_rays(rays, hits, numRays) diff --git a/setup.cfg b/setup.cfg index cf5f0f5..d46a44d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,41 +1,13 @@ +# Note: Most metadata is now in pyproject.toml +# This file is kept for backwards compatibility + [metadata] author = makepath author_email = a.soklev@gmail.com -classifiers = - Development Status :: 4 - Beta - Intended Audience :: Developers - Intended Audience :: Science/Research - License :: OSI Approved :: MIT License - Operating System :: Microsoft :: Windows - Operating System :: POSIX :: Linux - Programming Language :: C - Programming Language :: C++ - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Topic :: Scientific/Engineering :: Information Analysis - Topic :: Scientific/Engineering :: Mathematics - Topic :: Scientific/Engineering :: Visualization -description = Ray tracing using CUDA accessible from Python license = MIT -license_file = LICENSE -long_description = file: README.md -long_description_content_type = text/markdown -name = rtxpy -platforms = - Linux - Windows -url = https://github.com/makepath/rtxpy +license_files = LICENSE [options] -install_requires = - numpy>=1.16 packages = find: -python_requires = >=3.7 +python_requires = >=3.10 zip_safe = False - -[options.extras_require] -tests = - pytest diff --git a/setup.py b/setup.py index 7dd22c3..6068493 100644 --- a/setup.py +++ b/setup.py @@ -1,84 +1,3 @@ -import os -import re -import sys -import platform -import subprocess +from setuptools import setup -from packaging.version import Version -from setuptools import setup, Extension -from setuptools.command.build_ext import build_ext -from shutil import copyfile - -class CMakeExtension(Extension): - def __init__(self, name, moduleName, sourcedir=''): - Extension.__init__(self, name, sources=[]) - self.sourcedir = os.path.abspath(sourcedir) - self.moduleName = moduleName - -class CMakeBuild(build_ext): - def run(self): - try: - out = subprocess.check_output(['cmake', '--version']) - except OSError: - raise RuntimeError( - "CMake must be installed to build the following extensions: " + - ", ".join(e.name for e in self.extensions)) - - if platform.system() == "Windows": - cmake_version = Version(re.search(r'version\s*([\d.]+)', - out.decode()).group(1)) - if cmake_version < Version('3.10.0'): - raise RuntimeError("CMake >= 3.10.0 is required on Windows") - - for ext in self.extensions: - self.build_extension(ext) - - def build_extension(self, ext): - extdir = os.path.abspath( - os.path.dirname(self.get_ext_fullpath(ext.name))) - extdir += '/' + ext.moduleName - if platform.system() == "Windows": - extdir = extdir.replace("/","\\") - cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir] - cfg = 'Debug' if self.debug else 'Release' - build_args = ['--config', cfg] - conda_build = os.environ.get("CONDA_BUILD", 0) - - if platform.system() == "Windows": - cmake_args += ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}'.format( - cfg.upper(), - extdir)] - # CMake lets you override the generator, as is done in conda build. - # If using NMake for generator or building on conda, do not use - # arch specifier as not supported. - cmake_generator = os.environ.get("CMAKE_GENERATOR", "") - if sys.maxsize > 2**32 and not ( - cmake_generator.startswith("NMake") or conda_build): - cmake_args += ['-A', 'x64'] - if not conda_build: - build_args += ['--', '/m'] - else: - cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg] - build_args += ['--', '-j2'] - - env = os.environ.copy() - env['CXXFLAGS'] = '{} -DVERSION_INFO=\\"{}\\"'.format( - env.get('CXXFLAGS', ''), - self.distribution.get_version()) - if not os.path.exists(self.build_temp): - os.makedirs(self.build_temp) - subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, - cwd=self.build_temp, env=env) - subprocess.check_call(['cmake', '--build', '.'] + build_args, - cwd=self.build_temp) - - if platform.system() == "Windows": - src = self.build_temp + "\\" + cfg + "\\" + ext.moduleName + ".dll" - dst = extdir + "\\" + ext.moduleName + ".dll" - copyfile(src, dst) - -setup( - version='0.0.3', - ext_modules=[CMakeExtension('crtx','rtxpy')], - cmdclass=dict(build_ext=CMakeBuild), -) +setup()