Repository: NVIDIA-RTX/RTXMG
Branch: main
Commit: 230a15c6a4bc
Files: 171
Total size: 1.5 MB
Directory structure:
gitextract_4m5g8eoe/
├── .editorconfig
├── .gitattributes
├── .gitignore
├── .gitlab-ci.yml
├── .gitmodules
├── CHANGELOG.md
├── CMake/
│ ├── FetchDXC.cmake
│ ├── FetchImplot.cmake
│ └── FetchNVAPI.cmake
├── CMakeLists.txt
├── LICENSE.txt
├── README.md
├── demo/
│ ├── CMakeLists.txt
│ ├── args.cpp
│ ├── args.h
│ ├── audio/
│ │ ├── CMakeLists.txt
│ │ ├── audio.cpp
│ │ ├── audio.h
│ │ ├── waveFile.cpp
│ │ ├── waveFile.h
│ │ └── xaudiofaudio.h
│ ├── blit_params.h
│ ├── envmap/
│ │ ├── CMakeLists.txt
│ │ ├── preprocess_envmap.h
│ │ ├── preprocess_envmap_params.h
│ │ ├── scan_system.cpp
│ │ ├── scan_system.h
│ │ ├── scan_system_shared.h
│ │ ├── shaders/
│ │ │ ├── compute_conditional.hlsl
│ │ │ ├── compute_marginal.hlsl
│ │ │ ├── envmap.hlsli
│ │ │ └── prefix_scan.hlsl
│ │ └── shaders.cfg
│ ├── gbuffer.h
│ ├── gui.cpp
│ ├── gui.h
│ ├── gui_fonts.cpp
│ ├── korgi.cpp
│ ├── korgi.h
│ ├── lerp_keyframes_params.h
│ ├── lighting_cb.h
│ ├── maya_logger.cpp
│ ├── maya_logger.h
│ ├── motion_vectors_params.h
│ ├── ray_payload.h
│ ├── render_params.h
│ ├── render_targets.cpp
│ ├── render_targets.h
│ ├── rtxmg_demo.cpp
│ ├── rtxmg_demo.h
│ ├── rtxmg_demo_app.cpp
│ ├── rtxmg_demo_app.h
│ ├── rtxmg_renderer.cpp
│ ├── rtxmg_renderer.h
│ ├── shaders/
│ │ ├── blit.hlsl
│ │ ├── brdf.hlsli
│ │ ├── color.hlsli
│ │ ├── lerp_keyframes.hlsl
│ │ ├── motion_vectors.hlsl
│ │ ├── rtxmg_demo_path_tracer.hlsl
│ │ ├── self_intersection_avoidance.hlsli
│ │ ├── utils.hlsli
│ │ └── zrender.hlsl
│ ├── shaders.cfg
│ ├── trackball.cpp
│ ├── trackball.h
│ ├── zrender_params.h
│ ├── zrenderer.cpp
│ └── zrenderer.h
├── docs/
│ └── QuickStart.md
├── extern/
│ ├── CMakeLists.txt
│ └── nrd.cfg
├── notice.txt
├── rtxmg/
│ ├── CMakeLists.txt
│ ├── cluster_builder/
│ │ ├── CMakeLists.txt
│ │ ├── cluster_accel_builder.cpp
│ │ ├── shaders/
│ │ │ ├── compute_cluster_tiling.hlsl
│ │ │ ├── copy_cluster_offset.hlsl
│ │ │ ├── fill_blas_from_clas_args.hlsl
│ │ │ ├── fill_clusters.hlsl
│ │ │ ├── fill_instance_descs.hlsl
│ │ │ └── fill_instantiate_template_args.hlsl
│ │ └── shaders.cfg
│ ├── hiz/
│ │ ├── CMakeLists.txt
│ │ ├── hiz_buffer.cpp
│ │ ├── shaders/
│ │ │ ├── hiz_display.hlsl
│ │ │ ├── hiz_pass1.hlsl
│ │ │ ├── hiz_pass2.hlsl
│ │ │ ├── zbuffer_display.hlsl
│ │ │ └── zbuffer_minmax.hlsl
│ │ ├── shaders.cfg
│ │ └── zbuffer.cpp
│ ├── include/
│ │ └── rtxmg/
│ │ ├── cluster_builder/
│ │ │ ├── cluster.h
│ │ │ ├── cluster_accel_builder.h
│ │ │ ├── cluster_accels.h
│ │ │ ├── compute_cluster_tiling_params.h
│ │ │ ├── copy_cluster_offset_params.h
│ │ │ ├── displacement.hlsli
│ │ │ ├── fill_blas_from_clas_args_params.h
│ │ │ ├── fill_clusters_params.h
│ │ │ ├── fill_instance_descs_params.h
│ │ │ ├── fill_instantiate_template_args_params.h
│ │ │ ├── tessellation_counters.h
│ │ │ ├── tessellator_config.h
│ │ │ ├── tessellator_constants.h
│ │ │ └── tilings.h
│ │ ├── hiz/
│ │ │ ├── hiz_buffer.h
│ │ │ ├── hiz_buffer_constants.h
│ │ │ ├── hiz_buffer_display_params.h
│ │ │ ├── hiz_buffer_reduce_params.h
│ │ │ └── zbuffer.h
│ │ ├── profiler/
│ │ │ ├── gui.h
│ │ │ ├── profiler.h
│ │ │ ├── sampler.h
│ │ │ ├── statistics.h
│ │ │ └── stopwatch.h
│ │ ├── scene/
│ │ │ ├── box_extent.h
│ │ │ ├── camera.h
│ │ │ ├── json.h
│ │ │ ├── model.h
│ │ │ ├── obj_importer.h
│ │ │ ├── scene.h
│ │ │ └── string_utils.h
│ │ ├── subdivision/
│ │ │ ├── far.h
│ │ │ ├── osd_ports/
│ │ │ │ └── tmr/
│ │ │ │ ├── nodeDescriptor.h
│ │ │ │ ├── subdivisionNode.h
│ │ │ │ ├── surfaceDescriptor.h
│ │ │ │ ├── treeDescriptor.h
│ │ │ │ └── types.h
│ │ │ ├── patch_param.h
│ │ │ ├── segmented_vector.h
│ │ │ ├── shape.h
│ │ │ ├── subdivision_eval.hlsli
│ │ │ ├── subdivision_plan_hlsl.h
│ │ │ ├── subdivision_surface.h
│ │ │ ├── topology_cache.h
│ │ │ ├── topology_map.h
│ │ │ └── vertex.h
│ │ └── utils/
│ │ ├── box3.h
│ │ ├── buffer.h
│ │ ├── constants.h
│ │ ├── debug.h
│ │ ├── formatters.h
│ │ ├── shader_debug.h
│ │ └── vectorlog.h
│ ├── profiler/
│ │ ├── CMakeLists.txt
│ │ ├── gui.cpp
│ │ ├── profiler.cpp
│ │ ├── statistics.cpp
│ │ └── stopwatch.cpp
│ ├── scene/
│ │ ├── CMakeLists.txt
│ │ ├── box_extent.cpp
│ │ ├── camera.cpp
│ │ ├── json.cpp
│ │ ├── obj_importer.cpp
│ │ ├── scene.cpp
│ │ └── string_utils.cpp
│ ├── subdivision/
│ │ ├── CMakeLists.txt
│ │ ├── shape.cpp
│ │ ├── subdivision_surface.cpp
│ │ ├── topology_cache.cpp
│ │ └── topology_map.cpp
│ └── utils/
│ ├── CMakeLists.txt
│ ├── buffer.cpp
│ ├── csvdump.cpp
│ ├── debug.cpp
│ └── formatters.cpp
├── rtxmg_static_analysis.props
├── rtxmg_static_analysis.ruleset
├── shadertoolsconfig.json
└── tools/
└── set_vs_vars.ps1
================================================
FILE CONTENTS
================================================
================================================
FILE: .editorconfig
================================================
# Visual Studio generated .editorconfig file with C++ settings.
root = true
[*.{c++,cc,cpp,cppm,cu,cuh,cxx,fx,h,h++,hh,hlsl,hpp,hxx,inl,ipp,ixx,tlh,tli}]
indent_size = 4;
indent_style = space;
# Visual C++ Code Style settings
cpp_generate_documentation_comments = xml
# Visual C++ Formatting settings
cpp_indent_braces = false
cpp_indent_multi_line_relative_to = innermost_parenthesis
cpp_indent_within_parentheses = indent
cpp_indent_preserve_within_parentheses = true
cpp_indent_case_contents = true
cpp_indent_case_labels = false
cpp_indent_case_contents_when_block = false
cpp_indent_lambda_braces_when_parameter = true
cpp_indent_goto_labels = one_left
cpp_indent_preprocessor = leftmost_column
cpp_indent_access_specifiers = false
cpp_indent_namespace_contents = true
cpp_indent_preserve_comments = false
cpp_new_line_before_open_brace_namespace = new_line
cpp_new_line_before_open_brace_type = new_line
cpp_new_line_before_open_brace_function = new_line
cpp_new_line_before_open_brace_block = new_line
cpp_new_line_before_open_brace_lambda = new_line
cpp_new_line_scope_braces_on_separate_lines = true
cpp_new_line_close_brace_same_line_empty_type = false
cpp_new_line_close_brace_same_line_empty_function = false
cpp_new_line_before_catch = true
cpp_new_line_before_else = true
cpp_new_line_before_while_in_do_while = false
cpp_space_before_function_open_parenthesis = remove
cpp_space_within_parameter_list_parentheses = false
cpp_space_between_empty_parameter_list_parentheses = false
cpp_space_after_keywords_in_control_flow_statements = true
cpp_space_within_control_flow_statement_parentheses = false
cpp_space_before_lambda_open_parenthesis = false
cpp_space_within_cast_parentheses = false
cpp_space_after_cast_close_parenthesis = false
cpp_space_within_expression_parentheses = false
cpp_space_before_block_open_brace = true
cpp_space_between_empty_braces = false
cpp_space_before_initializer_list_open_brace = false
cpp_space_within_initializer_list_braces = true
cpp_space_preserve_in_initializer_list = true
cpp_space_before_open_square_bracket = false
cpp_space_within_square_brackets = false
cpp_space_before_empty_square_brackets = false
cpp_space_between_empty_square_brackets = false
cpp_space_group_square_brackets = true
cpp_space_within_lambda_brackets = false
cpp_space_between_empty_lambda_brackets = false
cpp_space_before_comma = false
cpp_space_after_comma = true
cpp_space_remove_around_member_operators = true
cpp_space_before_inheritance_colon = true
cpp_space_before_constructor_colon = true
cpp_space_remove_before_semicolon = true
cpp_space_after_semicolon = true
cpp_space_remove_around_unary_operator = true
cpp_space_around_binary_operator = insert
cpp_space_around_assignment_operator = insert
cpp_space_pointer_reference_alignment = left
cpp_space_around_ternary_operator = insert
cpp_use_unreal_engine_macro_formatting = true
cpp_wrap_preserve_blocks = one_liners
# Visual C++ Inlcude Cleanup settings
cpp_include_cleanup_add_missing_error_tag_type = suggestion
cpp_include_cleanup_remove_unused_error_tag_type = dimmed
cpp_include_cleanup_sort_after_edits = false
cpp_sort_includes_error_tag_type = none
cpp_sort_includes_priority_case_sensitive = false
cpp_sort_includes_priority_style = quoted
cpp_includes_style = default
cpp_includes_use_forward_slash = true
[*.md]
spelling_languages = en-us
spelling_error_severity = warning
================================================
FILE: .gitattributes
================================================
# Default behavior in case core.autocrlf set
* text=auto
*.dll filter=lfs diff=lfs merge=lfs -text
*.pdb filter=lfs diff=lfs merge=lfs -text
================================================
FILE: .gitignore
================================================
*.*~
scenes
bin/
_build/
_install/
build/
.vscode/
================================================
FILE: .gitlab-ci.yml
================================================
stages:
- build
variables:
GIT_SUBMODULE_STRATEGY: recursive
build-windows:
stage: build
tags:
- os/win11
rules:
- if: '$ENABLE_JOBS =~ /build-windows/'
parallel:
matrix:
- BUILD_TYPE: ['Release', 'Debug']
DX12: 'ON'
VULKAN: 'OFF'
script:
- tools/set_vs_vars.ps1
- mkdir build
- cd build
- cmake .. -G "Visual Studio 17 2022" -A x64 "-DCMAKE_BUILD_TYPE=$BUILD_TYPE" "-DDONUT_WITH_DX12=$DX12" "-DDONUT_WITH_VULKAN=$VULKAN"
- cmake --build . --config "$BUILD_TYPE" --target package
artifacts:
when: on_success
access: all
expire_in: 30 days
paths: ['build/rtxmg.*.zip']
================================================
FILE: .gitmodules
================================================
[submodule "extern/donut"]
path = extern/donut
url = https://github.com/NVIDIA-RTX/Donut.git
[submodule "assets"]
path = assets
url = https://github.com/NVIDIA-RTX/RTXMG-Sample-Assets.git
[submodule "extern/osd_lite"]
path = extern/osd_lite
url = https://github.com/NVIDIA-RTX/OSD-Lite.git
================================================
FILE: CHANGELOG.md
================================================
# RTX Mega Geometry SDK Change Log
## 1.0.1
Improvements
* Add smooth vertex normal support which allows for lower tessellation rates and includes memory profiler row for vertex normals
* Filter out degenerate normals for backface culling to improve backface test and reduce triangle count
Debugging Improvements
* Improve shader debug with stable cluster index output from path tracing shader
* Add surface highlighting feature where path-tracer will blink highlight a selected debug surface
* Add utilities to shader debug to force output
Bug Fixes
* Fix regression in surface 1-ring culling caused by 1D thread-ordering change, which resulted in incorrect lanes doing work for unrelated waves
* Fix crash when refreshing media list after changing json/obj filters with an asset already loaded
## 1.0.0
Vulkan Support
* Requires Vulkan SDK 1.4.313 or greater which uses Cluster SPIRV intrinsics
* Convert all bindless arrays to use ResourceDescriptorHeap via Vulkan's mutable descriptor extension
* Fix validation warnings and Vulkan shutdown crashes
Minor Changes
* Expose isolation level in the UI
* Add smooth single crease sharpness, which prevents transition artifacts between single and multicrease edges. Only visible if the isolation level is lowered.
* Improve Profiler "Frame" Tab, add average times in tool tip, expose motion vector pass time
* Update to Streamline v2.8.0
Bug Fixes
* Fix thread-ordering to be compliant with SM6.6 1D quad lane ordering.
* Fix micro-triangle view toggle when in DLAA mode.
* Fix cases where a surface resulted in over U16_MAX clusters
* Fix tessellation for when there was per-material displacement scaling
* Fix crash for some malformed OBJ files with '0' values for some indices.
## 0.9.2
Performance Improvements
Test Scene: amy_kitchenset.scene.json (default camera: 79M microtriangles)
Hardware: RTX 5090 @ 4K Render Resolution (r572.83)
* Compute Cluster tiling: 4.0ms -> 1.0ms (300% speedup)
* Coalesced UAV writes for structs, unaligned members were causing UAV readbacks
* Coalesce per wave atomics into a groupshared atomic to reduce pressure on global/UAV atomics by 4x
* Fill clusters: 4.9ms to -> 1.0ms (390% speedup)
* Fixed cases where the compiler was unable to unroll loops due to dynamic loop counts
* Specialized shaders by subdivision surface type, with a special path for Pure BSpline surfaces. Prefetch all control points into shared memory to be used wave wide.
Minor Fixes
* Fix SpecularHitT guide buffer to DLSS-RR to improve coherence of specular rays.
## 0.9.1
Stability
* Fix crash on scenes with multiple subdivision mesh instances when the topology quality color mode was selected
* Fix a crash if scene with audio is loaded and no audio devices are present.
Topology Quality
* Add button in the Subdivision Evaluator tab to switch to topology quality view if issues are detected
* Fix Subdivision Evaluator UI not resetting upon scene load.
UI
* Application Window Size/Maximized/Fullscreen and Window state is now saved to and restored from imgui.ini. Delete imgui.ini to reset layout
Minor
* Make initial VRAM check non-fatal but add warnings about performance degradation, memory budgets.
* Made localToWorld transform use Matrix3x4 for consistency
* Style clean-up
* Update donut version
## 0.9.0
Initial beta release.
================================================
FILE: CMake/FetchDXC.cmake
================================================
#
# Copyright (c) 2025, 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.
#
include(FetchContent)
set(DXC_URL https://github.com/microsoft/DirectXShaderCompiler/releases/download/v1.8.2407/dxc_2024_07_31.zip)
set(DXC_SHA256_HASH e2627f004f0f9424d8c71ea1314d04f38c5a5096884ae9217f1f18bd320267b5)
FetchContent_Declare(
DXC
URL ${DXC_URL}
URL_HASH SHA256=${DXC_SHA256_HASH}
DOWNLOAD_EXTRACT_TIMESTAMP ON
)
FetchContent_MakeAvailable(DXC)
message(STATUS "Updating DXC from ${DXC_URL}, SHA256 ${DXC_SHA256_HASH}, into folder ${dxc_SOURCE_DIR}")
set(SHADERMAKE_FIND_DXC OFF CACHE BOOL "" FORCE)
set(DXC_PATH "${dxc_SOURCE_DIR}/bin/x64/dxc.exe" CACHE STRING "" FORCE)
================================================
FILE: CMake/FetchImplot.cmake
================================================
#
# Copyright (c) 2022, 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.
#
if( TARGET implot )
return()
endif()
if (NOT TARGET imgui)
message(FATAL_ERROR "Implot requires imgui")
endif()
include(FetchContent)
FetchContent_Declare(
implot
GIT_REPOSITORY https://github.com/epezent/implot.git
GIT_TAG v0.16
)
FetchContent_MakeAvailable(implot)
# Override Imgui build - we want a lean static library
set(implot_srcs
${CMAKE_BINARY_DIR}/_deps/implot-src/implot.cpp
${CMAKE_BINARY_DIR}/_deps/implot-src/implot.h
${CMAKE_BINARY_DIR}/_deps/implot-src/implot_internal.h
${CMAKE_BINARY_DIR}/_deps/implot-src/implot_items.cpp
)
add_library(implot STATIC ${implot_srcs})
set_target_properties(implot PROPERTIES POSITION_INDEPENDENT_CODE ON)
add_compile_definitions(implot PRIVATE IMGUI_DEFINE_MATH_OPERATORS)
target_include_directories(implot PUBLIC "${CMAKE_BINARY_DIR}/_deps/implot-src/")
target_link_libraries(implot imgui)
================================================
FILE: CMake/FetchNVAPI.cmake
================================================
#
# Copyright (c) 2025, 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.
#
include(FetchContent)
set(NVAPI_FETCH_URL "https://github.com/NVIDIA/nvapi.git" CACHE STRING "Url to nvapi git repo to fetch")
set(NVAPI_FETCH_TAG "ce6d2a183f9559f717e82b80333966d19edb9c8c" CACHE STRING "Tag of nvapi git repo")
set(NVAPI_FETCH_DIR "" CACHE STRING "Directory to fetch streamline to, empty uses build directory default")
include(FetchContent)
FetchContent_Declare(
nvapi
GIT_REPOSITORY ${NVAPI_FETCH_URL}
GIT_TAG ${NVAPI_FETCH_TAG}
SOURCE_DIR ${NVAPI_FETCH_DIR}
)
FetchContent_MakeAvailable(nvapi)
message(STATUS "Updating nvapi from ${NVAPI_FETCH_URL}, tag ${NVAPI_FETCH_TAG}, into folder ${nvapi_SOURCE_DIR}")
set(NVAPI_SEARCH_PATHS "${nvapi_SOURCE_DIR}")
================================================
FILE: CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.10)
project(rtxmg LANGUAGES C CXX VERSION 1.0.1)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo;ReleaseAsan" CACHE STRING "Configurations" FORCE)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)
set(CMAKE_FIND_ROOT_PATH ${CMAKE_SOURCE_DIR}/extern)
####################################
# Static analysis
####################################
set(RULESET_PATH "${CMAKE_SOURCE_DIR}/rtxmg_static_analysis.ruleset")
add_compile_options("-wd26495")
set_property( GLOBAL PROPERTY VS_USER_PROPS "rtxmg_static_analysis.props")
####################################
# ASAN
####################################
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin")
foreach(CONFIG_TYPE DEBUG RELEASE MINSIZEREL RELWITHDEBINFO RELEASEASAN)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONFIG_TYPE} "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
endforeach()
set(CMAKE_CXX_FLAGS_RELEASEASAN "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fsanitize=address")
set(CMAKE_EXE_LINKER_FLAGS_RELEASEASAN "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO}")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASEASAN "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO}")
####################################
# AgilitySDK
####################################
if(WIN32)
# this SDK requires features from the D3D12 Agility SDK on Win 10
if(CMAKE_SYSTEM_VERSION LESS 11.0)
set(DONUT_D3D_AGILITY_SDK_URL "https://www.nuget.org/api/v2/package/Microsoft.Direct3D.D3D12/1.614.1")
# set fetch destination to cmake default build/_deps folder
set(DONUT_D3D_AGILITY_SDK_FETCH_DIR "" CACHE STRING "")
include("${PROJECT_SOURCE_DIR}/extern/donut/cmake/FetchAgilitySDK.cmake")
else()
message(STATUS "Windows 11 or newer detected: disabling Agility SDK")
endif()
endif()
####################################
# DXC
# WindowsSDK version is buggy and the compiler crashes
####################################
set(SHADERMAKE_FIND_DXC ON CACHE BOOL "" FORCE)
####################################
# Streamline
####################################
set(DONUT_WITH_STREAMLINE ON CACHE BOOL "" FORCE)
set(DONUT_STREAMLINE_FETCH_URL "https://github.com/NVIDIA-RTX/Streamline/releases/download/v2.8.0/streamline-sdk-v2.8.0.zip" CACHE STRING "")
set(DONUT_STREAMLINE_FETCH_SHA256 "313669f8cf886f823ea0518a50712efa5e2e8623689ed2a6bd0d9353e475bc47" CACHE STRING "")
set(STREAMLINE_FEATURE_DLSS_SR ON CACHE BOOL "" FORCE)
set(STREAMLINE_FEATURE_DLSS_RR ON CACHE BOOL "" FORCE)
set(STREAMLINE_INSTALL_DIR "bin" CACHE STRING "" FORCE)
####################################
# NVAPI
####################################
include("${PROJECT_SOURCE_DIR}/CMake/FetchNVAPI.cmake")
####################################
# DONUT
####################################
option(DONUT_WITH_DX11 OFF)
set(DONUT_WITH_VULKAN ON CACHE BOOL "Enable the Vulkan version of Donut")
set(NVRHI_WITH_NVAPI ON CACHE BOOL "" FORCE)
set(DONUT_WITH_AFTERMATH ON CACHE BOOL "" FORCE)
set(NVRHI_INSTALL OFF CACHE BOOL "" FORCE)
# Shaders
set(DONUT_SHADERS_OUTPUT_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/shaders/framework")
set(DONUT_DIR "${PROJECT_SOURCE_DIR}/extern/donut")
list(APPEND RTXMG_SHADERS_INCLUDE_DIR
"${PROJECT_SOURCE_DIR}"
"${PROJECT_SOURCE_DIR}/extern"
"${PROJECT_SOURCE_DIR}/extern/donut/include"
"${PROJECT_SOURCE_DIR}/rtxmg/include"
"${nvapi_SOURCE_DIR}"
"${PROJECT_SOURCE_DIR}/extern/donut/nvrhi/include")
set(RTXMG_SHADERMAKE_OPTIONS "--embedPDB --hlsl2021")
#-vd disable validator due to a bug in
# https://github.com/microsoft/DirectXShaderCompiler/issues/7181
# should be fixed in version 1.8.2505
set(RTXMG_SHADERMAKE_OPTIONS_SPIRV "--vulkanMemoryLayout scalar --compilerOptions -Vd")
set(RTXMG_SHADERS_SHADERMODEL "6_6")
set(RTXMG_SHADERS_IGNORED_INCLUDES "")
list(APPEND RTXMG_SHADERS_IGNORED_INCLUDES
"donut/core/math/math.h"
"nvrhi/nvrhi.h"
"array"
"assert.h"
"cstdint"
"cstdio"
"stdio.h"
"cmath"
"ostream"
"rtxmg/utils/buffer.h"
)
add_subdirectory(extern/donut)
add_subdirectory(extern/osd_lite EXCLUDE_FROM_ALL)
add_subdirectory(rtxmg)
add_subdirectory(demo)
add_subdirectory(extern)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT rtxmg_demo)
================================================
FILE: LICENSE.txt
================================================
NVIDIA RTX SDKs LICENSE
This license is a legal agreement between you and NVIDIA Corporation ("NVIDIA") and governs the use of the NVIDIA RTX
software development kits, including the DLSS SDK, NGX SDK, RTXGI SDK, RTXDI SDK, RTX Video SDK and/or NRD SDK, if and
when made available to you under this license (in each case, the SDK).
This license can be accepted only by an adult of legal age of majority in the country in which the SDK is used. If you are
under the legal age of majority, you must ask your parent or legal guardian to consent to this license. If you are entering this
license on behalf of a company or other legal entity, you represent that you have legal authority and you will mean the
entity you represent.
By using the SDK, you affirm that you have reached the legal age of majority, you accept the terms of this license, and you
take legal and financial responsibility for the actions of your permitted users.
You agree to use the SDK only for purposes that are permitted by (a) this license, and (b) any applicable law, regulation or
generally accepted practices or guidelines in the relevant jurisdictions.
1. LICENSE. Subject to the terms of this license and the terms in the supplement attached, NVIDIA hereby grants you a non-
exclusive, non-transferable license, without the right to sublicense (except as expressly provided in this license) to:
a. Install and use the SDK,
b. Modify and create derivative works of sample source code delivered in the SDK, and
c. Distribute any software and materials within the SDK, other than developer tools provided for your internal use, as
incorporated in object code format into a software application subject to the distribution requirements indicated in this
license.
2. DISTRIBUTION REQUIREMENTS. These are the distribution requirements for you to exercise the grants above:
a. An application must have material additional functionality, beyond the included portions of the SDK.
b. The following notice shall be included in modifications and derivative works of source code distributed: This software
contains source code provided by NVIDIA Corporation.
c. You agree to distribute the SDK subject to the terms at least as protective as the terms of this license, including (without
limitation) terms relating to the license grant, license restrictions and protection of NVIDIAs intellectual property rights.
Additionally, you agree that you will protect the privacy, security and legal rights of your application users.
d. You agree to notify NVIDIA in writing of any known or suspected distribution or use of the SDK not in compliance with
the requirements of this license, and to enforce the terms of your agreements with respect to the distributed portions of
the SDK.
3. AUTHORIZED USERS. You may allow employees and contractors of your entity or of your subsidiary(ies) to access and use
the SDK from your secure network to perform work on your behalf. If you are an academic institution you may allow users
enrolled or employed by the academic institution to access and use the SDK from your secure network. You are responsible
for the compliance with the terms of this license by your authorized users.
4. LIMITATIONS. Your license to use the SDK is restricted as follows:
a. You may not reverse engineer, decompile or disassemble, or remove copyright or other proprietary notices from any
portion of the SDK or copies of the SDK.
b. Except as expressly provided in this license, you may not copy, sell, rent, sublicense, transfer, distribute, modify, or
create derivative works of any portion of the SDK. For clarity, you may not distribute or sublicense the SDK as a stand-alone
product.
c. Unless you have an agreement with NVIDIA for this purpose, you may not indicate that an application created with the
SDK is sponsored or endorsed by NVIDIA.
d. You may not bypass, disable, or circumvent any technical limitation, encryption, security, digital rights management or
authentication mechanism in the SDK.
e. You may not use the SDK in any manner that would cause it to become subject to an open source software license. As
examples, licenses that require as a condition of use, modification, and/or distribution that the SDK be: (i) disclosed or
distributed in source code form; (ii) licensed for the purpose of making derivative works; or (iii) redistributable at no charge.
f. Unless you have an agreement with NVIDIA for this purpose, you may not use the SDK with any system or application
where the use or failure of the system or application can reasonably be expected to threaten or result in personal injury,
death, or catastrophic loss. Examples include use in avionics, navigation, military, medical, life support or other life critical
applications. NVIDIA does not design, test or manufacture the SDK for these critical uses and NVIDIA shall not be liable to
you or any third party, in whole or in part, for any claims or damages arising from such uses.
g. You agree to defend, indemnify and hold harmless NVIDIA and its affiliates, and their respective employees, contractors,
agents, officers and directors, from and against any and all claims, damages, obligations, losses, liabilities, costs or debt,
fines, restitutions and expenses (including but not limited to attorneys fees and costs incident to establishing the right of
indemnification) arising out of or related to your use of the SDK outside of the scope of this license, or not in compliance
with its terms.
5. UPDATES. NVIDIA may, at its option, make available patches, workarounds or other updates to this SDK. Unless the
updates are provided with their separate governing terms, they are deemed part of the SDK licensed to you as provided in
this license. Further, NVIDIA may, at its option, automatically update the SDK or other software in the system, except for
those updates that you may opt-out via the SDK API. You agree that the form and content of the SDK that NVIDIA provides
may change without prior notice to you. While NVIDIA generally maintains compatibility between versions, NVIDIA may in
some cases make changes that introduce incompatibilities in future versions of the SDK.
6. PRE-RELEASE VERSIONS. SDK versions identified as alpha, beta, preview, early access or otherwise as pre-release may not
be fully functional, may contain errors or design flaws, and may have reduced or different security, privacy, availability, and
reliability standards relative to commercial versions of NVIDIA software and materials. You may use a pre-release SDK
version at your own risk, understanding that these versions are not intended for use in production or business-critical
systems. NVIDIA may choose not to make available a commercial version of any pre-release SDK. NVIDIA may also choose to
abandon development and terminate the availability of a pre-release SDK at any time without liability.
7. THIRD-PARTY COMPONENTS. The SDK may include third-party components with separate legal notices or terms as may
be described in proprietary notices accompanying the SDK. If and to the extent there is a conflict between the terms in this
license and the third-party license terms, the third-party terms control only to the extent necessary to resolve the conflict.
8. OWNERSHIP.
8.1 NVIDIA reserves all rights, title and interest in and to the SDK not expressly granted to you under this license. NVIDIA
and its suppliers hold all rights, title and interest in and to the SDK, including their respective intellectual property rights.
The SDK is copyrighted and protected by the laws of the United States and other countries, and international treaty
provisions.
8.2 Subject to the rights of NVIDIA and its suppliers in the SDK, you hold all rights, title and interest in and to your
applications and your derivative works of the sample source code delivered in the SDK including their respective intellectual
property rights.
9. FEEDBACK. You may, but are not obligated to, provide Feedback to NVIDIA. Feedback means all suggestions, fixes,
modifications, feature requests or other feedback regarding the SDK. Feedback, even if designated as confidential by you,
shall not create any confidentiality obligation for NVIDIA. If you provide Feedback, you hereby grant NVIDIA, its affiliates
and its designees a non-exclusive, perpetual, irrevocable, sublicensable, worldwide, royalty-free, fully paid-up and
transferable license, under your intellectual property rights, to publicly perform, publicly display, reproduce, use, make,
have made, sell, offer for sale, distribute (through multiple tiers of distribution), import, create derivative works of and
otherwise commercialize and exploit the Feedback at NVIDIAs discretion. You will not give Feedback (i) that you have
reason to believe is subject to any restriction that impairs the exercise of the grant stated in this section, such as third-party
intellectual property rights or (ii) subject to license terms which seek to require any product incorporating or developed
using such Feedback, or other intellectual property of NVIDIA or its affiliates, to be licensed to or otherwise shared with any
third party.
10. NO WARRANTIES. THE SDK IS PROVIDED AS-IS. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW NVIDIA AND
ITS AFFILIATES EXPRESSLY DISCLAIM ALL WARRANTIES OF ANY KIND OR NATURE, WHETHER EXPRESS, IMPLIED OR
STATUTORY, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, FITNESS FOR A
PARTICULAR PURPOSE, USAGE OF TRADE AND COURSE OF DEALING. NVIDIA DOES NOT WARRANT THAT THE SDK WILL
MEET YOUR REQUIREMENTS OR THAT THE OPERATION THEREOF WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ALL
ERRORS WILL BE CORRECTED.
11. LIMITATIONS OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW NVIDIA AND ITS AFFILIATES SHALL
NOT BE LIABLE FOR ANY (I) SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL DAMAGES, OR FOR DAMAGES FOR (A)
ANY LOST PROFITS, PROJECT DELAYS, LOSS OF USE, LOSS OF DATA OR LOSS OF GOODWILL, OR (B) THE COSTS OF
PROCURING SUBSTITUTE PRODUCTS, ARISING OUT OF OR IN CONNECTION WITH THIS LICENSE OR THE USE OR
PERFORMANCE OF THE SDK, WHETHER SUCH LIABILITY ARISES FROM ANY CLAIM BASED UPON BREACH OF CONTRACT,
BREACH OF WARRANTY, TORT (INCLUDING NEGLIGENCE), PRODUCT LIABILITY OR ANY OTHER CAUSE OF ACTION OR
THEORY OF LIABILITY, EVEN IF NVIDIA HAS PREVIOUSLY BEEN ADVISED OF, OR COULD REASONABLY HAVE FORESEEN, THE
POSSIBILITY OF SUCH DAMAGES. IN NO EVENT WILL NVIDIAS AND ITS AFFILIATES TOTAL CUMULATIVE LIABILITY UNDER OR
ARISING OUT OF THIS LICENSE EXCEED US$10.00. THE NATURE OF THE LIABILITY OR THE NUMBER OF CLAIMS OR SUITS
SHALL NOT ENLARGE OR EXTEND THIS LIMIT.
12. TERMINATION. Your rights under this license will terminate automatically without notice from NVIDIA if you fail to
comply with any term and condition of this license or if you commence or participate in any legal proceeding against
NVIDIA with respect to the SDK. NVIDIA may terminate this license with advance written notice to you, if NVIDIA decides to
no longer provide the SDK in a country or, in NVIDIAs sole discretion, the continued use of it is no longer commercially
viable. Upon any termination of this license, you agree to promptly discontinue use of the SDK and destroy all copies in your
possession or control. Your prior distributions in accordance with this license are not affected by the termination of this
license. All provisions of this license will survive termination, except for the license granted to you.
13. APPLICABLE LAW. This license will be governed in all respects by the laws of the United States and of the State of
Delaware, without regard to the conflicts of laws principles. The United Nations Convention on Contracts for the
International Sale of Goods is specifically disclaimed. You agree to all terms of this license in the English language. The state
or federal courts residing in Santa Clara County, California shall have exclusive jurisdiction over any dispute or claim arising
out of this license. Notwithstanding this, you agree that NVIDIA shall still be allowed to apply for injunctive remedies or
urgent legal relief in any jurisdiction.
14. NO ASSIGNMENT. This license and your rights and obligations thereunder may not be assigned by you by any means or
operation of law without NVIDIAs permission. Any attempted assignment not approved by NVIDIA in writing shall be void
and of no effect. NVIDIA may assign, delegate or transfer this license and its rights and obligations, and if to a non-affiliate
you will be notified.
15. EXPORT. The SDK is subject to United States export laws and regulations. You agree to comply with all applicable U.S.
and international export laws, including the Export Administration Regulations (EAR) administered by the U.S. Department
of Commerce and economic sanctions administered by the U.S. Department of Treasurys Office of Foreign Assets Control
(OFAC). These laws include restrictions on destinations, end-users and end-use. By accepting this license, you confirm that
you are not currently residing in a country or region currently embargoed by the U.S. and that you are not otherwise
prohibited from receiving the SDK.
16. GOVERNMENT USE. The SDK, documentation and technology (Protected Items) are Commercial products as this
term is defined at 48 C.F.R. 2.101, consisting of commercial computer software and commercial computer software
documentation as such terms are used in, respectively, 48 C.F.R. 12.212 and 48 C.F.R. 227.7202 & 252.227-7014(a)(1).
Before any Protected Items are supplied to the U.S. Government, you will (i) inform the U.S. Government in writing that the
Protected Items are and must be treated as commercial computer software and commercial computer software
documentation developed at private expense; (ii) inform the U.S. Government that the Protected Items are provided
subject to the terms of the Agreement; and (iii) mark the Protected Items as commercial computer software and
commercial computer software documentation developed at private expense. In no event will you permit the U.S.
Government to acquire rights in Protected Items beyond those specified in 48 C.F.R. 52.227-19(b)(1)-(2) or 252.227-7013(c)
except as expressly approved by NVIDIA in writing.
17. NOTICES. You agree that any notices that NVIDIA sends you electronically, such as via email, will satisfy any legal
communication requirements. Please direct your legal notices or other correspondence to NVIDIA Corporation, 2788 San
Tomas Expressway, Santa Clara, California 95051, United States of America, Attention: Legal Department.
18. ENTIRE AGREEMENT. This license is the final, complete and exclusive agreement between the parties relating to the
subject matter of this license and supersedes all prior or contemporaneous understandings and agreements relating to this
subject matter, whether oral or written. If any court of competent jurisdiction determines that any provision of this license
is illegal, invalid or unenforceable, the remaining provisions will remain in full force and effect. Any amendment or waiver
under this license shall be in writing and signed by representatives of both parties.
19. LICENSING. If the distribution terms in this license are not suitable for your organization, or for any questions regarding
this license, please contact NVIDIA at nvidia-rtx-license-questions@nvidia.com.
(v. February 23, 2024)
NVIDIA RTX SUPPLEMENT TO SOFTWARE LICENSE AGREEMENT FOR NVIDIA SOFTWARE DEVELOPMENT KITS
The terms in this supplement govern your use of the NVIDIA RTX SDKs, including the DLSS SDK, NGX SDK, RTXGI SDK, RTXDI
SDK, Video SDK and/or NRD SDK, if and when made available to you (in each case, the SDK) under the terms of your
license agreement (Agreement) as modified by this supplement. Capitalized terms used but not defined below have the
meaning assigned to them in the Agreement.
This supplement is an exhibit to the Agreement and is incorporated as an integral part of the Agreement. In the event of
conflict between the terms in this supplement and the terms in the Agreement, the terms in this supplement govern.
1. Interoperability. Your applications that incorporate, or are based on, the SDK must be fully interoperable with
compatible GPU hardware products designed by NVIDIA or its affiliates. Further, the DLSS SDK and NGX SDK are licensed for
you to develop applications only for their use in systems with NVIDIA GPUs.
2. Game License. You may, but are not obligated to, provide your game or related content (Game Content) to NVIDIA. If
you provide Game Content, you hereby grant NVIDIA, its affiliates and its designees a non-exclusive, perpetual, irrevocable,
worldwide, royalty-free, fully paid-up license, to use the Game Content to improve NVIDIA DLSS SDK and DLSS Model
Training. The terms in this section do not apply to the Video SDK.
3. Limitations for the DLSS SDK and NGX SDK. Your applications that incorporate, or are based on, the DLSS SDK or NGX SDK
may be deployed in a cloud service that runs on systems that consume NVIDIA vGPU software, and any other cloud service
use of such SDKs or their functionality is outside of the scope of the Agreement. For the purpose of this section, cloud
services include application service providers or service bureaus, operators of hosted/virtual system environments, or
hosting, time sharing or providing any other type of service to others.
4. Notification for the DLSS SDK and NGX SDK. You are required to notify NVIDIA prior to commercial release of an
application (including a plug-in to a commercial application) that incorporates, or is based on, the DLSS SDK or NGX SDK.
Please send notifications to: https://developer.nvidia.com/sw-notification and provide the following information in the
email: company name, publisher and developer name, NVIDIA SDK used, application name, platform (i.e. PC, Linux),
scheduled ship date, and weblink to product/video.
5. Audio and Video Encoders and Decoders. You acknowledge and agree that it is your sole responsibility to obtain any
additional third-party licenses required to make, have made, use, have used, sell, import, and offer for sale your products or
services that include or incorporate any third-party software and content relating to audio and/or video encoders and
decoders from, including but not limited to, Microsoft, Thomson, Fraunhofer IIS, Sisvel S.p.A., MPEG-LA, and Coding
Technologies. NVIDIA does not grant to you under this Agreement any necessary patent or other rights with respect to any
audio and/or video encoders and decoders. The terms in this section do not apply to the Video SDK.
6. DLSS SDK Terms. By installing or using the DLSS SDK you agree that NVIDIA can make over-the-air updates of DLSS in
systems that have DLSS installed, including (without limitation) for quality, stability or performance improvements or to
support new hardware. If you publicly release a DLSS integration in an end user game or application that presents material
stability, performance, image quality, or other technical issues impacting the user experience, you will work to quickly
address the integration issues. In the case issues are not addressed, NVIDIA reserves the right, as a last resort, to
temporarily disable the DLSS integration until the issues can be fixed.
7. Marketing.
7.1 Marketing Activities. Your license to the SDK(s) under the Agreement is subject to your compliance with the following
marketing terms:
(a) Identification by You in the DLSS SDK, Video SDK or NGX SDK. During the term of the Agreement, NVIDIA agrees that
you may identify NVIDIA on your websites, printed collateral, trade-show displays and other retail packaging materials, as
the supplier of the DLSS SDK, Video SDK or NGX SDK for the applications that were developed with use of such SDKs,
provided that all such references to NVIDIA will be subject to NVIDIA's prior review and written approval, which will not be
unreasonably withheld or delayed.
(b) NVIDIA Trademark Placement in Applications with the DLSS SDK or NGX SDK. For applications that incorporate the DLSS
SDK or NGX SDK or portions thereof, you must attribute the use of the applicable SDK and include the NVIDIA Marks on
splash screens, in the about box of the application (if present), and in credits for game applications.
(c) NVIDIA Trademark Placement in Applications with a licensed SDK, other than the DLSS SDK, Video SDK or NGX SDK. For
applications that incorporates and/or makes use of a licensed SDK, other than the DLSS SDK, Video SDK or NGX SDK, you
must attribute the use of the applicable SDK and include the NVIDIA Marks on the credit screen for applications that have
such credit screen, or where a credit screen is not present prominently in end user documentation for the application.
(d) Identification by NVIDIA in the DLSS SDK, Video SDK or NGX SDK. You agree that NVIDIA may identify you on NVIDIA's
websites, printed collateral, trade-show displays, and other retail packaging materials as an individual or entity that
produces products and services which incorporate the DLSS SDK, Video SDK or NGX SDK as applicable. To the extent that
you provide NVIDIA with input or usage requests with regard to the use of your logo or materials, NVIDIA will use
commercially reasonable efforts to comply with such requests. For the avoidance of doubt, NVIDIAs rights pursuant to this
section shall survive any expiration or termination of the Agreement with respect to existing applications which incorporate
the DLSS SDK, Video SDK or NGX SDK.
(e) Applications Marketing Material in the DLSS SDK Video SDK or NGX SDK. You may provide NVIDIA with screenshots,
imagery, and video footage of applications representative of your use of the NVIDIA DLSS SDK or NGX SDKs in your
application (collectively, Assets). You hereby grant to NVIDIA the right to create and display self-promotional demo
materials using the Assets, and after release of the application to the public to distribute, sub-license, and use the Assets to
promote and market the NVIDIA RTX SDKs. To the extent you provide NVIDIA with input or usage requests with regard to
the use of your logo or materials, NVIDIA will use commercially reasonable efforts to comply with such requests. For the
avoidance of doubt, NVIDIAs rights pursuant to this section shall survive any termination of the Agreement with respect to
applications which incorporate the NVIDIA RTX SDK.
7.2 Trademark Ownership and Licenses. Trademarks are owned and licenses as follows:
(a) Ownership of Trademarks. Each party owns the trademarks, logos, and trade names (collectively "Marks") for their
respective products or services, including without limitation in applications, and the NVIDIA RTX SDKs. Each party agrees to
use the Marks of the other only as permitted in this exhibit.
(b) Trademark License to NVIDIA. You grant to NVIDIA a non-exclusive, non-sub licensable, non-transferable (except as set
forth in the assignment provision of the Agreement), worldwide license to refer to you and your applications, and to use
your Marks on NVIDIA's marketing materials and on NVIDIA's website (subject to any reasonable conditions of you) solely
for NVIDIAs marketing activities set forth in this exhibit Sections (d)-(e) above. NVIDIA will follow your specifications for
your Marks as to style, color, and typeface as reasonably provided to NVIDIA.
(c) Trademark License to You. NVIDIA grants to you a non-exclusive, non-sub licensable, non-transferable (except as set
forth in the assignment provision of the Agreement), worldwide license, subject to the terms of this exhibit and the
Agreement, to use NVIDIA RTX, NVIDIA GeForce RTX in combination with GeForce products, and/or NVIDIA Quadro
RTX in combination with Quadro products (collectively, the NVIDIA Marks) on your marketing materials and on your
website (subject to any reasonable conditions of NVIDIA) solely for your marketing activities set forth in this exhibit Sections
6.1 (a)-(c) above. For the avoidance of doubt, you will not and will not permit others to use any NVIDIA Mark for any other
goods or services, or in a way that tarnishes, degrades, disparages or reflects adversely any of the NVIDIA Marks or NVIDIAs
business or reputation, or that dilutes or otherwise harms the value, reputation or distinctiveness of or NVIDIAs goodwill in
any NVIDIA Mark. In addition to the termination rights set forth in the Agreement, NVIDIA may terminate this trademark
license at any time upon written notice to you. You will follow NVIDIA's use guidelines and specifications for NVIDIA's Marks
as to style, color and typeface as provided in NVIDIA Marks and submit a sample of each proposed use of NVIDIA's Marks at
least two (2) weeks prior to the desired implementation of such use to obtain NVIDIA's prior written approval (which
approval will not be unreasonably withheld or delayed). If NVIDIA does not respond within ten (10) business days of your
submission of such sample, the sample will be deemed unapproved. All goodwill associated with use of NVIDIA Marks will
inure to the sole benefit of NVIDIA. For the video SDK, contact NVIDIA at nvidia-rtx-video-sdk-license-
questions@nvidia.com.
7.3 Use Guidelines. Use of the NVIDIA Marks is subject to the following guidelines:
(a) Business Practices. You covenant that you will: (a) conduct business with respect to NVIDIAs products in a manner that
reflects favorably at all times on the good name, goodwill and reputation of such products; (b) avoid deceptive, misleading
or unethical practices that are detrimental to NVIDIA, its customers, or end users; (c) make no false or misleading
representations with regard to NVIDIA or its products; and (d) not publish or employ or cooperate in the publication or
employment of any misleading or deceptive advertising or promotional materials.
(b) No Combination Marks or Similar Marks. You agree not to (a) combine NVIDIA Marks with any other content without
NVIDIAs prior written approval, or (b) use any other trademark, trade name, or other designation of source which creates a
likelihood of confusion with NVIDIA Marks.
(v. February 23, 2024)
================================================
FILE: README.md
================================================
# RTX Mega Geometry

## Overview
RTX Mega Geometry (RTX MG) is a DX12 and Vulkan code sample that shows how to quickly
build ray-tracing acceleration structures for subdivision surfaces with structured
clusters. It contains a reference HLSL path tracing demo app that can be used as a
learning tool to begin integration with your own graphics engine.
## Features
* Real-time adaptive sampling of Catmull-Clark limit surfaces
* Structured cluster tessellation and displacement mapping
* BVH build with cluster templates using NVAPI for DXR, and the VK_NV_cluster_acceleration_structure extension for Vulkan.
* Hierarchical Z-buffer for reducing tessellation rate of non-primary ray geometry
* DLSS Ray Reconstruction denoising
## Requirements
To Run:
- Windows 10
- NVIDIA RTX GPU (10 GB VRAM or greater)
- GeForce Game Ready Driver 570 or later
- DirectX Raytracing 1.1 API or later
To Build:
- CMake v3.31+
- Windows 10 SDK 10.0.20348.0 or later
- MSVC Compiler 19.43.34810 (Visual Studio 2022 17.13) or later
- For Windows: DirectX 12 AgilitySDK will be fetched automatically
- For Vulkan: Vulkan SDK 1.4.313 or later
## Folder Structure
| | |
| - | - |
| /bin | default CMake folder for binaries and compiled shaders |
| /build | default CMake folder for build files |
| /external | external submoduled libraries and SDKs, including osd_lite and donut |
| /assets | models, textures, scene files (git submodule) |
| /rtxmg | **RTX Mega Geometry core** |
## Build
At the moment, only Windows builds are supported.
1. Clone the repository **with all submodules recursively**:
`git clone --recurse-submodules https://github.com/NVIDIA-RTX/rtxmg.git`
2. Use CMake to configure the build and generate the project files.
```
cd rtxmg
cmake CMakeLists.txt -B ./build
```
Use `-G "some tested VS version"` if specific Visual Studio or other environment
version required. Make sure the x64 platform is used.
3. Build the solution generated by CMake in the `./build/` folder.
For example, if using Visual Studio, open the generated solution `build/rtxmg.sln`
and build it.
4. Select and run the `rtxmg_demo` project. Binaries get built to the `bin` folder.
Media assets are loaded from the `assets` folder.
## User Interface
Once the application is running, most of the SDK features can be accessed via the
UI window on the left hand side. The UI is self-documenting : hover the mouse over
widgets to read tool-tips. See the Quick Start guide
for more details.
Camera can be moved using W/S/A/D keys and rotated by dragging with the left mouse
cursor. Holding the Alt key and left-click dragging will orbit the camera around
the scene's center.
## Command Line
- `-mf` loads a specific .scene.json or OBJ file;
example: `-mf programmer-art.scene.json`
- `-d` to enable the graphics API debug layer or runtime,
and the [NVRHI](https://github.com/NVIDIA-RTX/NVRHI) validation layer.
Additional command line flags can be found by running with the `-h` flag.
## Contact
RTX Mega Geometry is under active development. Please report any issues directly
through GitHub issue tracker, and for any information, suggestions or general
requests please feel free to contact us at rtxmg-sdk-support@nvidia.com
## Related RTX Mega Geometry Repositories
Vulkan
* [vk_animated_clusters](https://github.com/nvpro-samples/vk_animated_clusters) :
`VK_NV_cluster_acceleration_structure` for animated content.
* [vk_tessellated_clusters](https://github.com/nvpro-samples/vk_tessellated_clusters) :
adaptive triangle tessellation and displacement using `VK_NV_cluster_acceleration_structure`
* [vk_lod_clusters](https://github.com/nvpro-samples/vk_lod_clusters) :
cluster-lod system and streaming using `VK_NV_cluster_acceleration_structure`
* [vk_partitioned_tlas](https://github.com/nvpro-samples/vk_partitioned_tlas)
update the TLAS of large dynamic scenes with `VK_NV_partitioned_acceleration_structure`
Tools
* [meshoptimizer.org](https://meshoptimizer.org) - meshoptimizer provides ray tracing friendly clusterization through `meshopt_buildMeshletsSpatial`. If you are interested in building a continuous level of detail system, have a look at its clusterlod.h demo, it shows the necessary steps.
## Citation
If you use RTX Mega Geometry in a research project leading to a publication,
please cite the project.
BibTex:
```bibtex
@online{RTX MG,
title = {{{NVIDIA}}\textregistered{} {RTX Mega Geometry}},
author = {{NVIDIA}},
year = 2025,
url = {https://github.com/NVIDIA-RTX/rtxmg.git},
urldate = {2025-02-06},
}
```
## Known Issues
1. The RTX MG SDK does not currently support unstructured clusters or rasterization.
## License
See [LICENSE.txt](LICENSE.txt)
This project includes NVAPI software. All uses of NVAPI software are governed by the license terms specified here: https://github.com/NVIDIA/nvapi/blob/main/License.txt.
================================================
FILE: demo/CMakeLists.txt
================================================
# include ("private.cmake" OPTIONAL)
include ("${DONUT_DIR}/compileshaders.cmake")
add_subdirectory(audio)
file(GLOB shaders "shaders/*")
file(GLOB sources "*.cpp" "*.h" "osd_port_sources/tmr/*.h" *.cfg)
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/CMake/FetchImplot.cmake")
message(FATAL_ERROR "Missing FetchImplot.cmake file")
endif()
include("${PROJECT_SOURCE_DIR}/CMake/FetchImplot.cmake")
set_target_properties(implot PROPERTIES FOLDER "Third-Party Libraries")
set(app rtxmg_demo)
set(folder "Demo")
list(APPEND RTXMG_SHADERS_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
donut_compile_shaders_all_platforms(
TARGET ${app}_shaders
CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/shaders.cfg
FOLDER ${folder}
SOURCES ${shaders}
OUTPUT_BASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/shaders/${app}
SHADERMAKE_OPTIONS ${RTXMG_SHADERMAKE_OPTIONS}
SHADERMAKE_OPTIONS_SPIRV ${RTXMG_SHADERMAKE_OPTIONS_SPIRV}
SHADER_MODEL ${RTXMG_SHADERS_SHADERMODEL}
IGNORE_INCLUDES ${RTXMG_SHADERS_IGNORED_INCLUDES}
INCLUDES ${RTXMG_SHADERS_INCLUDE_DIR}
)
add_executable(${app}
${sources}
)
target_link_libraries(${app} PUBLIC envmap rtxmg donut_render donut_app donut_engine implot)
option(RTXMG_DEV_FEATURES "Enable development features (debugging, etc)" OFF)
if(RTXMG_DEV_FEATURES)
target_compile_definitions(${app} PUBLIC RTXMG_DEV_FEATURES=1)
endif()
target_compile_definitions(${app} PUBLIC RTXMG_VERSION="${PROJECT_VERSION}")
if(ENABLE_AUDIO_ENGINE)
if(TARGET audio_engine)
target_link_libraries(${app} PRIVATE audio_engine)
else()
message(WARNING "Audio engine option is enabled, but configuration failed")
endif()
endif()
add_dependencies(${app} ${app}_shaders)
set_target_properties(${app} PROPERTIES FOLDER ${folder})
add_compile_definitions( "_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING=1")
target_include_directories(${app} PUBLIC
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/extern
)
add_subdirectory(envmap)
if(DONUT_D3D_AGILITY_SDK_ENABLED)
target_compile_definitions(${app} PUBLIC DONUT_D3D_AGILITY_SDK_ENABLED=1)
target_compile_definitions(${app} PUBLIC DONUT_D3D_AGILITY_SDK_VERSION=${DONUT_D3D_AGILITY_SDK_VERSION})
add_custom_command(TARGET ${app} POST_BUILD
COMMAND
${CMAKE_COMMAND} -E make_directory "$/D3D12/"
COMMAND
${CMAKE_COMMAND} -E copy_if_different ${DONUT_D3D_AGILITY_SDK_CORE_DLL} "$/D3D12/"
)
endif()
if(WIN32)
add_custom_command( TARGET ${app} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $ $
COMMAND_EXPAND_LISTS)
endif()
#
# Installation & packaging
#
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/_install" CACHE PATH "Installation directory" FORCE)
endif()
install(TARGETS ${app} DESTINATION "bin")
install(DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/shaders" DESTINATION "bin" )
if(WIN32)
install(FILES $ DESTINATION "bin")
# generate some shortcuts to run various scenes
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/run_rtxmg.bat" "start \"\" bin/rtxmg_demo.exe")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/run_rtxmg.bat" DESTINATION ".")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/run_amy_kitchenset.bat" "start \"\" bin/rtxmg_demo.exe -mf amy_kitchenset.scene.json")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/run_amy_kitchenset.bat" DESTINATION ".")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/run_barbarian.bat" "start \"\" bin/rtxmg_demo.exe -mf barbarian_pt.scene.json")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/run_barbarian.bat" DESTINATION ".")
set(_os "win64")
elseif (UNIX AND NOT APPLE)
set(_os "linux64")
endif()
if(DONUT_D3D_AGILITY_SDK_ENABLED)
install(DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/D3D12" DESTINATION "bin" )
endif()
if(IS_DIRECTORY "${PROJECT_SOURCE_DIR}/assets")
install(
DIRECTORY "${PROJECT_SOURCE_DIR}/assets"
DESTINATION "."
PATTERN "*.bin" EXCLUDE)
endif()
set(CPACK_GENERATOR "ZIP")
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}.${PROJECT_VERSION}.${_os}")
include(CPack)
================================================
FILE: demo/args.cpp
================================================
//
// Copyright (c) 2021, 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.
//
// clang-format off
#include "args.h"
#include "rtxmg_demo.h"
#include
#include
#include
#include