Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions cmake/vcpkg-ports/nvidia-dlss/nvidia-dlss-config.cmake
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
get_filename_component(_nvidia_dlss_prefix "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)

if(NOT TARGET nvidia::dlss)
# The NGX loader is a static library, nvngx_dlss.dll is loaded by it at run time and never linked
# The NGX loader is a static library, the Super Resolution runtime is loaded by it at run time and never linked
add_library(nvidia::dlss STATIC IMPORTED)
set_target_properties(nvidia::dlss PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_nvidia_dlss_prefix}/include/ngx"
IMPORTED_CONFIGURATIONS "RELEASE;DEBUG"
IMPORTED_LOCATION_RELEASE "${_nvidia_dlss_prefix}/lib/nvsdk_ngx_d.lib"
IMPORTED_LOCATION_DEBUG "${_nvidia_dlss_prefix}/debug/lib/nvsdk_ngx_d_dbg.lib"
MAP_IMPORTED_CONFIG_RELWITHDEBINFO "RELEASE"
MAP_IMPORTED_CONFIG_MINSIZEREL "RELEASE"
)
if(WIN32)
set_target_properties(nvidia::dlss PROPERTIES
IMPORTED_LOCATION_RELEASE "${_nvidia_dlss_prefix}/lib/nvsdk_ngx_d.lib"
IMPORTED_LOCATION_DEBUG "${_nvidia_dlss_prefix}/debug/lib/nvsdk_ngx_d_dbg.lib"
)
else()
set_target_properties(nvidia::dlss PROPERTIES
IMPORTED_LOCATION_RELEASE "${_nvidia_dlss_prefix}/lib/libnvsdk_ngx.a"
IMPORTED_LOCATION_DEBUG "${_nvidia_dlss_prefix}/debug/lib/libnvsdk_ngx.a"
INTERFACE_LINK_LIBRARIES "${CMAKE_DL_LIBS}"
)
endif()
endif()

set(NVIDIA_DLSS_RUNTIME_DLL "${_nvidia_dlss_prefix}/bin/nvngx_dlss.dll")
if(WIN32)
set(NVIDIA_DLSS_RUNTIME_DLL "${_nvidia_dlss_prefix}/bin/nvngx_dlss.dll")
else()
file(GLOB NVIDIA_DLSS_RUNTIME_DLL "${_nvidia_dlss_prefix}/lib/libnvidia-ngx-dlss.so.*")
endif()
unset(_nvidia_dlss_prefix)
33 changes: 25 additions & 8 deletions cmake/vcpkg-ports/nvidia-dlss/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,20 @@ set(_dlss_files
include/nvsdk_ngx_standalone_common.h 7bd34e71dd346650d9194e3792fa0a95a5bef1fb1b514b678abebadbd4385a8ee6bcec75963ef66151dd4ec45220793dcc09bb984dd4af03fdf10abe4da71ac0
include/nvsdk_ngx_standalone_cuda.h 7cefa9dd4c35c8e6ef6213ae90deecd3fe180d5482dac35800bc7c853f76a188841baff1c2e48343590bd6cc0d544337046601ce67b9146883ec28eb33310167
include/nvsdk_ngx_vk.h 610fd37c9d059f939a1d9899662d9c8bf6f9b7059a22efdff78c4ef13466e211c51abef13f8098cb6b8c357a9574de617a1ca41bbe0a30107543d414e6eccecc
lib/Windows_x86_64/x64/nvsdk_ngx_d.lib 0809baf904b4246e2ecc35ffc4a5a88155f9c74722427a6b02d0fa85c5a4f24e9d9f759863e6fc3c7038927a14e003215f50215cda4dfbc7b4edb513e5bf58df
lib/Windows_x86_64/x64/nvsdk_ngx_d_dbg.lib 781cbe38adffc42b47b31a047d73e9de7e77242a2ad0d50a787335920985b2b3160f025c509bb9a31750f6094aecb0dd80607e12ed3029ed9bc7e79b33ef4d3b
lib/Windows_x86_64/rel/nvngx_dlss.dll 0e1fbd01ef2374f68e6ff8728f8b394279e58670c02d1f2aadbc8927db97476eb7bc8dca2a3dfd17d13789e6b5ef101850dec836a7fda3e67d379d4a34dfae7d
LICENSE.txt 72f5b66daad2df8b49098857adc8705dae17b60fcbefb3f8625fd252aa1e5b82dd92cb9824dd052976c73f5a0d7437ca54e593b8e9a9010758aba8887f853390
)
if(VCPKG_TARGET_IS_WINDOWS)
list(APPEND _dlss_files
lib/Windows_x86_64/x64/nvsdk_ngx_d.lib 0809baf904b4246e2ecc35ffc4a5a88155f9c74722427a6b02d0fa85c5a4f24e9d9f759863e6fc3c7038927a14e003215f50215cda4dfbc7b4edb513e5bf58df
lib/Windows_x86_64/x64/nvsdk_ngx_d_dbg.lib 781cbe38adffc42b47b31a047d73e9de7e77242a2ad0d50a787335920985b2b3160f025c509bb9a31750f6094aecb0dd80607e12ed3029ed9bc7e79b33ef4d3b
lib/Windows_x86_64/rel/nvngx_dlss.dll 0e1fbd01ef2374f68e6ff8728f8b394279e58670c02d1f2aadbc8927db97476eb7bc8dca2a3dfd17d13789e6b5ef101850dec836a7fda3e67d379d4a34dfae7d
)
else()
list(APPEND _dlss_files
lib/Linux_x86_64/libnvsdk_ngx.a ed292252d5a7f905f63b85ada671827300cf28d0cc18c6ae7679261289907518500cb5167991e90972cc1f412745dcd674281afaab60b4253095f0939ed1ce4a
lib/Linux_x86_64/rel/libnvidia-ngx-dlss.so.${VERSION} e95c833c790c656d93392d08938616596776581da6b2e88426b75bec1fccba24ea838d3ba472fea22ab2405726a2dba63e2b1b6badc577068df4b388dcb9b7c5
)
endif()

while(_dlss_files)
list(POP_FRONT _dlss_files _path _sha512)
Expand All @@ -43,11 +52,19 @@ while(_dlss_files)
endif()
endwhile()

file(INSTALL "${_dlss_nvsdk_ngx_d.lib}" DESTINATION "${CURRENT_PACKAGES_DIR}/lib" RENAME "nvsdk_ngx_d.lib")
file(INSTALL "${_dlss_nvsdk_ngx_d_dbg.lib}" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib" RENAME "nvsdk_ngx_d_dbg.lib")
# NVIDIA ships only a release runtime, NGX loads it at run time in every configuration
file(INSTALL "${_dlss_nvngx_dlss.dll}" DESTINATION "${CURRENT_PACKAGES_DIR}/bin" RENAME "nvngx_dlss.dll")
file(INSTALL "${_dlss_nvngx_dlss.dll}" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin" RENAME "nvngx_dlss.dll")
if(VCPKG_TARGET_IS_WINDOWS)
file(INSTALL "${_dlss_nvsdk_ngx_d.lib}" DESTINATION "${CURRENT_PACKAGES_DIR}/lib" RENAME "nvsdk_ngx_d.lib")
file(INSTALL "${_dlss_nvsdk_ngx_d_dbg.lib}" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib" RENAME "nvsdk_ngx_d_dbg.lib")
# NVIDIA ships only a release runtime, NGX loads it at run time in every configuration
file(INSTALL "${_dlss_nvngx_dlss.dll}" DESTINATION "${CURRENT_PACKAGES_DIR}/bin" RENAME "nvngx_dlss.dll")
file(INSTALL "${_dlss_nvngx_dlss.dll}" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin" RENAME "nvngx_dlss.dll")
else()
# One static loader for both configurations, the runtime keeps NVIDIA's versioned file name because NGX looks for it
file(INSTALL "${_dlss_libnvsdk_ngx.a}" DESTINATION "${CURRENT_PACKAGES_DIR}/lib" RENAME "libnvsdk_ngx.a")
file(INSTALL "${_dlss_libnvsdk_ngx.a}" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib" RENAME "libnvsdk_ngx.a")
file(INSTALL "${_dlss_libnvidia-ngx-dlss.so.${VERSION}}" DESTINATION "${CURRENT_PACKAGES_DIR}/lib" RENAME "libnvidia-ngx-dlss.so.${VERSION}")
file(INSTALL "${_dlss_libnvidia-ngx-dlss.so.${VERSION}}" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib" RENAME "libnvidia-ngx-dlss.so.${VERSION}")
endif()

file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/nvidia-dlss-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(FILE_LIST "${_dlss_LICENSE.txt}")
2 changes: 1 addition & 1 deletion cmake/vcpkg-ports/nvidia-dlss/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"description": "NVIDIA DLSS SDK (NGX headers, static loader library and the Super Resolution runtime) from github.com/NVIDIA/DLSS",
"homepage": "https://github.com/NVIDIA/DLSS",
"license": null,
"supports": "windows & x64"
"supports": "(windows | linux) & x64"
}
2 changes: 2 additions & 0 deletions editor/Assets/Types/EnvironmentMapAsset.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System.Collections.Generic;
using Lucide.Avalonia;

namespace editor.Assets.Types;

public sealed class EnvironmentMapAsset : BaseAsset {
public override string Type => "environment_map";
public override IReadOnlyList<string> CppTypeNames => ["EnvironmentMap"];
public override string Extension => ".hdr";
public override string DisplayName => "Environment Map";
public override string ChipText => "HDRI";
Expand Down
13 changes: 11 additions & 2 deletions editor/Workspace/InspectorViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ private void Rebuild(string uid, string type, InspectorState state) {
// walk the inheritance chain most-derived -> base
var current = Bare(type);
while (ReflectionDatabase.Nodes.TryGetValue(current, out var info)) {
Cards.Add(BuildCard(info, ref colorCounter));
Cards.Add(BuildCard(info, ref colorCounter, HiddenGroups(Bare(type), info.Name)));
if (info.Parent is null) break;
current = Bare(info.Parent.Name);
}
Expand Down Expand Up @@ -520,7 +520,15 @@ private void BuildProfiledCards(string type, IReadOnlyList<InspectorSection> sec
}
}

private ClassCardVM BuildCard(NodeInfo info, ref int colorCounter) {
// Groups an inherited class card must not show for a given concrete type
private static readonly string[] s_noGroups = [];
private static readonly string[] s_ambientLightHidden = ["Optimization", "Area"];

// ambient light has no position, shadow or shape, so Light's shadow/cull and area groups mean nothing there
private static string[] HiddenGroups(string type, string cardClass) =>
type == "AmbientLight" && cardClass == "Light" ? s_ambientLightHidden : s_noGroups;

private ClassCardVM BuildCard(NodeInfo info, ref int colorCounter, string[] hiddenGroups) {
// class cards show the bare type name; the namespaced form lives in the header label only
var typeName = info.Name;
var card = new ClassCardVM(typeName, ReflectionDatabase.ResolveColor(typeName),
Expand All @@ -529,6 +537,7 @@ private ClassCardVM BuildCard(NodeInfo info, ref int colorCounter) {
foreach (var f in info.GlobalFields) AddField(card.Fields, f);

foreach (var g in info.Groups) {
if (hiddenGroups.Contains(g.Name)) continue;
var colorKey = Palette[colorCounter++ % Palette.Length];
var group = new GroupVM(g.Name, colorKey, $"group:{typeName}/{g.Name}", m_state!, this);
foreach (var f in g.Fields) AddField(group.Fields, f);
Expand Down
9 changes: 7 additions & 2 deletions engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ endforeach ()

target_compile_definitions(toast_engine PRIVATE TOAST_EXPORT)

# NVIDIA ships NGX for Windows x64 only, a missing package builds without DLSS instead of failing
# Only x86_64 Windows and Linux are wired up, a missing package builds without DLSS instead of failing
include(CMakeDependentOption)
cmake_dependent_option(TOAST_DLSS "NVIDIA DLSS" ON "WIN32;ARCH STREQUAL x86_64" OFF)
cmake_dependent_option(TOAST_DLSS "NVIDIA DLSS" ON "WIN32 OR CMAKE_SYSTEM_NAME STREQUAL Linux;ARCH STREQUAL x86_64" OFF)
if (TOAST_DLSS)
find_package(nvidia-dlss CONFIG QUIET)
if (nvidia-dlss_FOUND)
Expand Down Expand Up @@ -338,6 +338,11 @@ if (WIN32)
COMMAND_EXPAND_LISTS
VERBATIM
)
else ()
if (NOT TOAST_DLSS OR NOT nvidia-dlss_FOUND)
list(FILTER _vcpkg_dlls_debug EXCLUDE REGEX "/nvngx_dlss\\.so$")
list(FILTER _vcpkg_dlls_release EXCLUDE REGEX "/nvngx_dlss\\.so$")
endif ()
endif ()


Expand Down
5 changes: 4 additions & 1 deletion engine/assets/shaders/debris.slang
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ static const float kInertia = 0.667;
static const float kAirDrag = 0.15;
static const float kSpinDrag = 0.3;
static const float kRollDrag = 6.0;
static const float kSpawnGrace = 0.25; // seconds a new piece ignores being buried
static const float kEmissiveDecay = 0.4; // seconds for the glow to fall to 1/e
static const float kSpawnGrace = 0.25; // seconds a new piece ignores being buried
static const uint kGridCells = 1u << 16; // mirrors DebrisSimulation::k_grid_cells
static const uint kGridStride = 8; // mirrors DebrisSimulation::k_grid_stride
static const uint kGridSlots = kGridStride - 1u;
Expand Down Expand Up @@ -484,6 +485,8 @@ void integrateMain(uint3 id : SV_DispatchThreadID, uint3 groupThread : SV_GroupT
DebrisMotion motion = gMotion[i];
const float stepTime = gParams.dt * float(gParams.substeps);
motion.age += stepTime;
// Glow cools off shortly after the break
particle.emissive *= exp(-stepTime / kEmissiveDecay);
if (motion.age > motion.lifetime) {
particle.packed = 0u;
gCurrent[i] = particle;
Expand Down
Loading
Loading